Zeile 11 | Zeile 11 |
---|
define("IN_MYBB", 1); define('THIS_SCRIPT', 'printthread.php');
|
define("IN_MYBB", 1); define('THIS_SCRIPT', 'printthread.php');
|
$templatelist = "printthread,printthread_post,forumdisplay_password_wrongpass,forumdisplay_password,printthread_multipage,printthread_multipage_page,printthread_multipage_page_current";
| $templatelist = "printthread,printthread_post,printthread_nav,forumdisplay_password_wrongpass,forumdisplay_password,printthread_multipage,printthread_multipage_page,printthread_multipage_page_current";
|
require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
| require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
|
Zeile 23 | Zeile 23 |
---|
$plugins->run_hooks("printthread_start");
|
$plugins->run_hooks("printthread_start");
|
$thread = get_thread($mybb->get_input('tid', 1));
| $thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
|
|
|
if(!$thread)
| if(!$thread || $thread['visible'] == -1)
|
{ error($lang->error_invalidthread); }
|
{ error($lang->error_invalidthread); }
|
| $plugins->run_hooks("printthread_start");
|
$thread['threadprefix'] = $thread['displaystyle'] = ''; if($thread['prefix'])
|
$thread['threadprefix'] = $thread['displaystyle'] = ''; if($thread['prefix'])
|
{
| {
|
$threadprefix = build_prefixes($thread['prefix']); if(!empty($threadprefix)) { $thread['threadprefix'] = $threadprefix['prefix']; $thread['displaystyle'] = $threadprefix['displaystyle']; }
|
$threadprefix = build_prefixes($thread['prefix']); if(!empty($threadprefix)) { $thread['threadprefix'] = $threadprefix['prefix']; $thread['displaystyle'] = $threadprefix['displaystyle']; }
|
}
| }
|
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
|
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
|
|
|
$fid = $thread['fid']; $tid = $thread['tid'];
// Is the currently logged in user a moderator of this forum?
|
$fid = $thread['fid']; $tid = $thread['tid'];
// Is the currently logged in user a moderator of this forum?
|
if(is_moderator($fid)) { $ismod = true; } else { $ismod = false; }
| $ismod = is_moderator($fid);
|
// Make sure we are looking at a real thread here. if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
| // Make sure we are looking at a real thread here. if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
|
Zeile 92 | Zeile 87 |
---|
// Check if this forum is password protected and we have a valid password check_forum_password($forum['fid']);
|
// Check if this forum is password protected and we have a valid password check_forum_password($forum['fid']);
|
$page = $mybb->get_input('page', 1);
| $page = $mybb->get_input('page', MyBB::INPUT_INT);
|
// Paginate this thread if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)
| // Paginate this thread if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)
|
Zeile 120 | Zeile 115 |
---|
if($postcount > $perpage) { $multipage = printthread_multipage($postcount, $perpage, $page, "printthread.php?tid={$tid}");
|
if($postcount > $perpage) { $multipage = printthread_multipage($postcount, $perpage, $page, "printthread.php?tid={$tid}");
|
}
| }
|
else { $multipage = '';
|
else { $multipage = '';
|
}
$thread['threadlink'] = get_thread_link($tid);
| }
$thread['threadlink'] = get_thread_link($tid);
|
$postrows = ''; if(is_moderator($forum['fid'], "canviewunapprove"))
|
$postrows = ''; if(is_moderator($forum['fid'], "canviewunapprove"))
|
{ $visible = "AND (p.visible='0' OR p.visible='1')"; }
| { $visible = "AND (p.visible='0' OR p.visible='1')"; }
|
else {
|
else {
|
$visible = "AND p.visible='1'";
| $visible = "AND p.visible='1'";
|
}
|
}
|
| $postrow_cache = $attachcache = array();
|
$query = $db->query("
|
$query = $db->query("
|
SELECT u.*, u.username AS userusername, p.* FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid='$tid' {$visible} ORDER BY p.dateline
| SELECT u.*, u.username AS userusername, p.* FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid='$tid' {$visible} ORDER BY p.dateline, p.pid
|
LIMIT {$start}, {$perpage} ");
|
LIMIT {$start}, {$perpage} ");
|
|
|
while($postrow = $db->fetch_array($query))
|
while($postrow = $db->fetch_array($query))
|
{ if($postrow['userusername']) { $postrow['username'] = $postrow['userusername']; } $postrow['subject'] = htmlspecialchars_uni($parser->parse_badwords($postrow['subject'])); $postrow['date'] = my_date($mybb->settings['dateformat'], $postrow['dateline'], null, 0); $postrow['profilelink'] = build_profile_link($postrow['username'], $postrow['uid']);
| { $postrow_cache[$postrow['pid']] = $postrow; }
$postrow_cache = array_filter($postrow_cache);
$pids = implode("','", array_keys($postrow_cache));
// Get the attachments for all posst. if($mybb->settings['enableattachments']) { $queryAttachments = $db->simple_select("attachments", "*", "pid IN ('{$pids}')");
while($attachment = $db->fetch_array($queryAttachments)) { $attachcache[$attachment['pid']][$attachment['aid']] = $attachment; } }
foreach($postrow_cache as $postrow) {
|
$parser_options = array( "allow_html" => $forum['allowhtml'], "allow_mycode" => $forum['allowmycode'],
| $parser_options = array( "allow_html" => $forum['allowhtml'], "allow_mycode" => $forum['allowmycode'],
|
Zeile 169 | Zeile 181 |
---|
$parser_options['allow_smilies'] = 0; }
|
$parser_options['allow_smilies'] = 0; }
|
if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)
| if($mybb->user['uid'] != 0 && $mybb->user['showimages'] != 1 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)
|
{ $parser_options['allow_imgcode'] = 0;
|
{ $parser_options['allow_imgcode'] = 0;
|
}
| }
|
|
|
if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
| if($mybb->user['uid'] != 0 && $mybb->user['showvideos'] != 1 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
|
{ $parser_options['allow_videocode'] = 0; }
|
{ $parser_options['allow_videocode'] = 0; }
|
| if($postrow['userusername']) { $postrow['username'] = $postrow['userusername']; } $postrow['username'] = htmlspecialchars_uni($postrow['username']); $postrow['subject'] = htmlspecialchars_uni($parser->parse_badwords($postrow['subject'])); $postrow['date'] = my_date($mybb->settings['dateformat'], $postrow['dateline'], null, 0); $postrow['profilelink'] = build_profile_link($postrow['username'], $postrow['uid']);
|
$postrow['message'] = $parser->parse_message($postrow['message'], $parser_options);
|
$postrow['message'] = $parser->parse_message($postrow['message'], $parser_options);
|
| if($mybb->settings['enableattachments'] == 1 && !empty($attachcache[$postrow['pid']]) && $thread['attachmentcount'] > 0 || is_moderator($fid, 'caneditposts')) { get_post_attachments($postrow['pid'], $postrow); }
|
$plugins->run_hooks("printthread_post"); eval("\$postrows .= \"".$templates->get("printthread_post")."\";"); }
| $plugins->run_hooks("printthread_post"); eval("\$postrows .= \"".$templates->get("printthread_post")."\";"); }
|
Zeile 189 | Zeile 216 |
---|
eval("\$printable = \"".$templates->get("printthread")."\";"); output_page($printable);
|
eval("\$printable = \"".$templates->get("printthread")."\";"); output_page($printable);
|
function makeprintablenav($pid="0", $depth="--")
| /** * @param int $pid * @param string $depth * * @return string */ function makeprintablenav($pid=0, $depth="--")
|
{
|
{
|
global $mybb, $db, $pforumcache, $fid, $forum, $lang;
| global $mybb, $db, $pforumcache, $fid, $forum, $lang, $templates;
|
if(!is_array($pforumcache)) { $parlist = build_parent_list($fid, "fid", "OR", $forum['parentlist']); $query = $db->simple_select("forums", "name, fid, pid", "$parlist", array('order_by' => 'pid, disporder')); while($forumnav = $db->fetch_array($query))
|
if(!is_array($pforumcache)) { $parlist = build_parent_list($fid, "fid", "OR", $forum['parentlist']); $query = $db->simple_select("forums", "name, fid, pid", "$parlist", array('order_by' => 'pid, disporder')); while($forumnav = $db->fetch_array($query))
|
{
| {
|
$pforumcache[$forumnav['pid']][$forumnav['fid']] = $forumnav; } unset($forumnav);
| $pforumcache[$forumnav['pid']][$forumnav['fid']] = $forumnav; } unset($forumnav);
|
Zeile 207 | Zeile 240 |
---|
{ foreach($pforumcache[$pid] as $key => $forumnav) {
|
{ foreach($pforumcache[$pid] as $key => $forumnav) {
|
$forums .= "+".$depth." $lang->forum {$forumnav['name']} (<i>".$mybb->settings['bburl']."/".get_forum_link($forumnav['fid'])."</i>)<br />\n";
| $forumnav['link'] = get_forum_link($forumnav['fid']); eval("\$forums .= \"".$templates->get("printthread_nav")."\";");
|
if(!empty($pforumcache[$forumnav['fid']])) { $newdepth = $depth."-";
| if(!empty($pforumcache[$forumnav['fid']])) { $newdepth = $depth."-";
|
Zeile 221 | Zeile 255 |
---|
/** * Output multipage navigation. *
|
/** * Output multipage navigation. *
|
* @param int The total number of items. * @param int The items per page. * @param int The current page. * @param string The URL base.
| * @param int $count The total number of items. * @param int $perpage The items per page. * @param int $current_page The current page. * @param string $url The URL base. * * @return string
|
*/ function printthread_multipage($count, $perpage, $current_page, $url) {
| */ function printthread_multipage($count, $perpage, $current_page, $url) {
|