| [ Index ] |
PHP Cross Reference of MyBB 1.4.13 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.4 4 * Copyright © 2008 MyBB Group, All Rights Reserved 5 * 6 * Website: http://www.mybboard.net 7 * License: http://www.mybboard.net/about/license 8 * 9 * $Id: printthread.php 4304 2009-01-02 01:11:56Z chris $ 10 */ 11 12 define("IN_MYBB", 1); 13 define('THIS_SCRIPT', 'printthread.php'); 14 15 $templatelist = "printthread,printthread_post"; 16 17 require_once "./global.php"; 18 require_once MYBB_ROOT."inc/functions_post.php"; 19 require_once MYBB_ROOT."inc/class_parser.php"; 20 $parser = new postParser; 21 22 // Load global language phrases 23 $lang->load("printthread"); 24 25 $plugins->run_hooks("printthread_start"); 26 27 $query = $db->simple_select("threads", "*", "tid='".intval($mybb->input['tid'])."' AND closed NOT LIKE 'moved|%'"); 28 $thread = $db->fetch_array($query); 29 $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject'])); 30 31 $fid = $thread['fid']; 32 $tid = $thread['tid']; 33 34 // Is the currently logged in user a moderator of this forum? 35 if(is_moderator($fid)) 36 { 37 $ismod = true; 38 } 39 else 40 { 41 $ismod = false; 42 } 43 44 // Make sure we are looking at a real thread here. 45 if(!$tid || ($thread['visible'] == 0 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true)) 46 { 47 error($lang->error_invalidthread); 48 } 49 50 // Get forum info 51 $forum = get_forum($fid); 52 if(!$forum) 53 { 54 error($lang->error_invalidforum); 55 } 56 57 $breadcrumb = makeprintablenav(); 58 59 $parentsexp = explode(",", $forum['parentlist']); 60 $numparents = count($parentsexp); 61 $tdepth = "-"; 62 for($i = 0; $i < $numparents; ++$i) 63 { 64 $tdepth .= "-"; 65 } 66 $forumpermissions = forum_permissions($forum['fid']); 67 68 if($forum['type'] != "f") 69 { 70 error($lang->error_invalidforum); 71 } 72 if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0) 73 { 74 error_no_permission(); 75 } 76 77 // Check if this forum is password protected and we have a valid password 78 check_forum_password($forum['fid']); 79 80 $thread['threadlink'] = get_thread_link($tid); 81 82 $postrows = ''; 83 if(is_moderator($forum['fid'])) 84 { 85 $visible = "AND (p.visible='0' OR p.visible='1')"; 86 } 87 else 88 { 89 $visible = "AND p.visible='1'"; 90 } 91 $query = $db->query(" 92 SELECT u.*, u.username AS userusername, p.* 93 FROM ".TABLE_PREFIX."posts p 94 LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) 95 WHERE p.tid='$tid' {$visible} 96 ORDER BY p.dateline 97 "); 98 while($postrow = $db->fetch_array($query)) 99 { 100 if($postrow['userusername']) 101 { 102 $postrow['username'] = $postrow['userusername']; 103 } 104 $postrow['subject'] = htmlspecialchars_uni($parser->parse_badwords($postrow['subject'])); 105 $postrow['date'] = my_date($mybb->settings['dateformat'], $postrow['dateline']); 106 $postrow['time'] = my_date($mybb->settings['timeformat'], $postrow['dateline']); 107 $postrow['profilelink'] = build_profile_link($postrow['username'], $postrow['uid']); 108 $parser_options = array( 109 "allow_html" => $forum['allowhtml'], 110 "allow_mycode" => $forum['allowmycode'], 111 "allow_smilies" => $forum['allowsmilies'], 112 "allow_imgcode" => $forum['allowimgcode'], 113 "me_username" => $postrow['username'], 114 "shorten_urls" => 0, 115 "filter_badwords" => 1 116 ); 117 if($postrow['smilieoff'] == 1) 118 { 119 $parser_options['allow_smilies'] = 0; 120 } 121 122 $postrow['message'] = $parser->parse_message($postrow['message'], $parser_options); 123 $plugins->run_hooks("printthread_post"); 124 eval("\$postrows .= \"".$templates->get("printthread_post")."\";"); 125 } 126 eval("\$printable = \"".$templates->get("printthread")."\";"); 127 128 $plugins->run_hooks("printthread_end"); 129 130 output_page($printable); 131 132 function makeprintablenav($pid="0", $depth="--") 133 { 134 global $db, $pforumcache, $fid, $forum, $lang; 135 if(!is_array($pforumcache)) 136 { 137 $parlist = build_parent_list($fid, "fid", "OR", $forum['parentlist']); 138 $query = $db->simple_select("forums", "name, fid, pid", "$parlist", array('order_by' => 'pid, disporder')); 139 while($forumnav = $db->fetch_array($query)) 140 { 141 $pforumcache[$forumnav['pid']][$forumnav['fid']] = $forumnav; 142 } 143 unset($forumnav); 144 } 145 if(is_array($pforumcache[$pid])) 146 { 147 foreach($pforumcache[$pid] as $key => $forumnav) 148 { 149 $forums .= "+".$depth." $lang->forum {$forumnav['name']} (<i>".$mybb->settings['bburl']."/".get_forum_link($forumnav['fid'])."</i>)<br />\n"; 150 if($pforumcache[$forumnav['fid']]) 151 { 152 $newdepth = $depth."-"; 153 $forums .= makeprintablenav($forumnav['fid'], $newdepth); 154 } 155 } 156 } 157 return $forums; 158 } 159 160 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Apr 19 19:52:21 2010 | Cross-referenced by PHPXref 0.7 |