Advertisement
Guest User

Untitled

a guest
Apr 13th, 2011
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 19.09 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Copyright (C) 2011 CRLin
  5.  * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  6.  */
  7.  
  8. define('PUN_ROOT', dirname(__FILE__).'/');
  9. require PUN_ROOT.'include/common.php';
  10.  
  11. if ($pun_user['g_read_board'] == '0')
  12.     message($lang_common['No view']);
  13.  
  14. $bid = 1; // Put forum ID here
  15.  
  16. // Load the viewtopic.php language file
  17. require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
  18. require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
  19.    
  20. // Load the viewforum.php language file
  21. if (file_exists(PUN_ROOT.'lang/'.$pun_user['language'].'/blog.php'))
  22.     require PUN_ROOT.'lang/'.$pun_user['language'].'/blog.php';
  23. else
  24.     require PUN_ROOT.'lang/English/blog.php';
  25.  
  26. $message_len = 200; // Short message for Not Admin
  27. $pun_user['disp_topics'] = 10; // Number of topics to display per page
  28. // Display topics number
  29. $last_topics = 10;
  30. $most_replies = 10;
  31. $most_views =  10;
  32. $cut_str = 17; // Topics subject
  33.  
  34. // Fetch some info about the forum
  35. if (!$pun_user['is_guest'])
  36.     $result = $db->query('SELECT f.forum_name, f.redirect_url, f.moderators, f.num_topics, f.sort_by, fp.post_topics, s.user_id AS is_subscribed FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_subscriptions AS s ON (f.id=s.forum_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$bid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
  37. else
  38.     $result = $db->query('SELECT f.forum_name, f.redirect_url, f.moderators, f.num_topics, f.sort_by, fp.post_topics, 0 AS is_subscribed FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$bid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
  39.    
  40. $cur_forum = $db->fetch_assoc($result);
  41. if ($cur_forum['redirect_url'] != '')
  42. {
  43.     header('Location: '.$cur_forum['redirect_url']);
  44.     exit;
  45. }
  46.  
  47.  
  48. // Can we or can we not post new topics?
  49. $post_link = '';
  50. if ($bid > 0)
  51. {
  52.     // Sort out who the moderators are and if we are currently a moderator (or an admin)
  53.     $mods_array = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array();
  54.     $is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
  55.  
  56.     if (($cur_forum['post_topics'] == '' && $pun_user['g_post_topics'] == '1') || $cur_forum['post_topics'] == '1' || $is_admmod)
  57.         $post_link = "\t\t\t".'<p class="postlink conr"><a href="post.php?fid='.$bid.'">'.$lang_forum['Post topic'].'</a></p>'."\n";
  58.     else
  59.         $post_link = '';
  60. }  
  61.  
  62. // Count topics
  63. if ($pun_user['g_id'] == PUN_ADMIN)
  64. {
  65.     $result = $db->query('SELECT COUNT(t.id), t.forum_id, t.moved_to FROM '.$db->prefix.'topics as t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE t.moved_to IS NULL'.$sql_fid) or error('Unable to get the admin\'s topic list', __FILE__, __LINE__, $db->error());
  66. }  
  67. elseif ($pun_user['is_guest'])
  68. {
  69.     $result = $db->query('SELECT COUNT(t.id), t.forum_id, t.moved_to FROM '.$db->prefix.'topics as t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$sql_fid) or error('Unable to get the guest\'s topic list', __FILE__, __LINE__, $db->error());
  70. }
  71. else
  72. {
  73.     $result = $db->query('SELECT COUNT(t.id), t.forum_id, t.moved_to FROM '.$db->prefix.'topics as t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$sql_fid) or error('Unable to get the member\'s topic list', __FILE__, __LINE__, $db->error());
  74. }
  75.  
  76. $num_topics = $db->result($result);
  77. $num_pages = ceil($num_topics / $pun_user['disp_topics']);//$pun_user['disp_posts'];
  78.  
  79. $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']);
  80. $start_from = $pun_user['disp_topics'] * ($p - 1);
  81.  
  82. // Generate paging links
  83. $paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'viewblog.php?bid='.$bid);
  84.  
  85. $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Blog']);
  86. define('PUN_ALLOW_INDEX', 1);
  87. define('PUN_ACTIVE_PAGE', 'index');
  88. require PUN_ROOT.'header.php';
  89.  
  90. ?>
  91. <div class="linkst">
  92.     <div class="inbox crumbsplus">
  93.         <ul class="crumbs">
  94.             <li><a href="viewblog.php"><?php echo $lang_common['Blog'] ?></a></li>
  95. <?php
  96. if ($bid >= 1) 
  97. {      
  98. ?>         
  99.             <li><span>»&#160;</span><a href="viewblog.php?bid=<?php echo $bid ?>"><strong><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></strong></a></li>
  100. <?php
  101. }          
  102. ?>
  103.         </ul>
  104.         <div class="pagepost">
  105.             <p class="pagelink conl"><?php echo $paging_links ?></p>
  106. <?php echo $post_link ?>           
  107.         </div>
  108.         <div class="clearer"></div>
  109.     </div>
  110. </div>
  111.  
  112. <div class="blogright">
  113. <?php
  114.     generate_forumlinks($pun_user['g_id']);
  115.     most_topics('last', $last_topics);
  116.     most_topics('most_replies', $most_replies);
  117.     most_topics('most_views', $most_views);
  118. ?>
  119. </div>
  120.  
  121. <div class="blogleft">
  122. <?php
  123.  
  124. require PUN_ROOT.'include/parser.php';
  125.  
  126. $post_count = 0; // Keep track of post numbers
  127.  
  128. if ($pun_user['g_id'] == PUN_ADMIN)
  129. {
  130.     $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.first_post_id, t.last_post, t.last_post_id, t.last_poster, t.closed, t.num_replies, t.num_views, t.moved_to, t.forum_id, p.poster_id, p.topic_id, p.message, p.hide_smilies FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE t.first_post_id=p.id AND t.moved_to IS NULL'.$sql_fid.' ORDER BY t.posted DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Unable to get the admin\'s topic list', __FILE__, __LINE__, $db->error());
  131. }  
  132. elseif ($pun_user['is_guest'])
  133. {
  134.     $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.first_post_id, t.last_post, t.last_post_id, t.last_poster, t.closed, t.num_replies, t.num_views, t.moved_to, t.forum_id, p.poster_id, p.topic_id, p.message, p.hide_smilies FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE t.first_post_id=p.id AND (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$sql_fid.' ORDER BY t.posted DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Unable to get the guest\'s topic list', __FILE__, __LINE__, $db->error());
  135. }
  136. else
  137. {
  138.     $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.first_post_id, t.last_post, t.last_post_id, t.last_poster, t.closed, t.num_replies, t.num_views, t.moved_to, t.forum_id, p.poster_id, p.topic_id, p.message, p.hide_smilies FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE t.first_post_id=p.id AND (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$sql_fid.' ORDER BY t.posted DESC LIMIT '.$start_from.', '.$pun_user['disp_topics']) or error('Unable to get the member\'s topic list', __FILE__, __LINE__, $db->error());
  139. }
  140.  
  141. if ($db->num_rows($result)) // If there are topics
  142. {
  143.     while ($cur_topic = $db->fetch_assoc($result)) {
  144.         $post_count++;
  145.         $post_actions = array();
  146.        
  147.         if ($pun_config['o_censoring'] == '1')
  148.             $cur_topic['subject'] = censor_words($cur_topic['subject']);
  149.  
  150.         // Generation post action array (quote, edit, delete etc.)
  151.         if ($pun_user['g_id'] == PUN_ADMIN)
  152.         {
  153.             $post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_topic['id'].'">'.$lang_topic['Report'].'</a></span></li>';
  154.             $post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_topic['first_post_id'].'">'.$lang_topic['Delete'].'</a></span></li>';
  155.             $post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_topic['first_post_id'].'">'.$lang_topic['Edit'].'</a></span></li>';
  156.             $post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$cur_topic['id'].'&amp;qid='.$cur_topic['first_post_id'].'">'.$lang_topic['Quote'].'</a></span></li>';
  157.             if ($cur_topic['closed'] == '0')
  158.             $post_actions[] = '<li class="postreply"><span><a href="post.php?tid='.$cur_topic['id'].'">'.$lang_topic['Post reply'].'</a></span></li>';
  159.         }
  160.         else
  161.         {
  162.             if (!$pun_user['is_guest'])
  163.             $post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_topic['first_post_id'].'">'.$lang_topic['Report'].'</a></span></li>';
  164.  
  165.             if ($cur_topic['closed'] == '0')
  166.             {
  167.                 if ($cur_topic['poster_id'] == $pun_user['id'])
  168.                 {
  169.                     if (($pun_user['g_delete_topics'] == '1') || $pun_user['g_delete_posts'] == '1')
  170.                     $post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_topic['first_post_id'].'">'.$lang_topic['Delete'].'</a></span></li>';
  171.                     if ($pun_user['g_edit_posts'] == '1')
  172.                         $post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_topic['first_post_id'].'">'.$lang_topic['Edit'].'</a></span></li>';
  173.                 }
  174.  
  175.                 if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
  176.                 $post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$cur_topic['id'].'&amp;qid='.$cur_topic['first_post_id'].'">'.$lang_topic['Quote'].'</a></span></li>';
  177.                
  178.                 if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
  179.                 $post_actions[] = '<li class="postreply"><span><a href="post.php?tid='.$cur_topic['id'].'">'.$lang_topic['Post reply'].'</a></span></li>';
  180.             }
  181.         }
  182.        
  183.         // Short message for Not Admin
  184.         $short = false;
  185.         if ((mb_strlen($cur_topic['message'], 'UTF-8') > $message_len) && ($pun_user['g_id'] != PUN_ADMIN))
  186.         {
  187.             $message_len++;
  188.             $tmp = mb_substr($cur_topic['message'], 0, $message_len, 'UTF-8');
  189.             while(!parse_message($tmp, $cur_topic['hide_smilies']))
  190.             {
  191.                 $message_len++;
  192.                 $tmp = mb_substr($cur_topic['message'], 0, $message_len, 'UTF-8');
  193.             }
  194.             if ($cur_topic['message'] != $tmp) $short = true;
  195.             // Perform the main parsing of the message (BBCode, smilies, censor words etc)
  196.             $cur_topic['message'] = parse_message($tmp, $cur_topic['hide_smilies']);
  197.         }
  198.         else
  199.         {
  200.             // Perform the main parsing of the message (BBCode, smilies, censor words etc)
  201.             $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']);
  202.         }
  203. ?>
  204. <div id="p<?php echo $cur_topic['first_post_id'] ?>" class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?>">
  205.     <h2><span><span class="conr">(<a href="viewtopic.php?pid=<?php echo $cur_topic['first_post_id'].'#p'.$cur_topic['first_post_id'] ?>"><?php echo format_time($cur_topic['posted']) ?></a>)&nbsp;&nbsp;#<?php echo ($start_from + $post_count) ?></span> <a href="viewtopic.php?pid=<?php echo $cur_topic['first_post_id'].'#p'.$cur_topic['first_post_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></a></span></h2>
  206.     <div class="box">
  207.         <div class="inbox">
  208.             <div class="blogpostmsg">
  209.                 <?php echo $cur_topic['message']."\n" ?>
  210.                 <?php
  211.                     if($short) echo "(<a href='viewtopic.php?pid=".$cur_topic['first_post_id']."#p".$cur_topic['first_post_id']."'>".$lang_blog['Read full']."</a>)\n"
  212.                 ?>
  213.                 <div class="postfoot">
  214.                     <?php if (count($post_actions)) echo "\t\t\t\t".'<div class="postfootright">'."\n\t\t\t\t\t".'<ul>'."\n\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $post_actions)."\n\t\t\t\t\t".'</ul>'."\n\t\t\t\t".'</div>'."\n" ?>
  215.                 </div>
  216.             </div>
  217.         </div>
  218.     </div>
  219. </div>
  220.     <?php
  221.     }
  222. }
  223. else
  224. {
  225. ?>
  226. <div id="p0" class="blockpost rowodd">
  227.     <h2><span><?php echo $lang_common['Topic']; ?></span></h2>
  228.     <div class="box">
  229.         <div class="inbox">
  230.             <div class="blogpostmsg">
  231.                 <?php echo $lang_common['Never'] ?>
  232.             </div>
  233.         </div>
  234.     </div>
  235. </div>
  236.  
  237. <?php
  238. }
  239. ?>
  240. <div class="postlinksb">
  241.     <div class="inbox crumbsplus">
  242.         <div class="pagepost">
  243.             <p class="pagelink conl"><?php echo $paging_links ?></p>
  244. <?php echo $post_link ?>           
  245.         </div>
  246.         <ul class="crumbs">
  247.             <li><a href="viewblog.php"><?php echo $lang_common['Blog'] ?></a></li>
  248. <?php
  249. if ($bid >= 1) 
  250. {      
  251. ?>         
  252.             <li><span>»&#160;</span><a href="viewblog.php?bid=<?php echo $bid ?>"><strong><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></strong></a></li>
  253. <?php
  254. }          
  255. ?>
  256.         </ul>
  257.         <div class="clearer"></div>
  258.     </div>
  259. </div>
  260.  
  261. </div>
  262. <div class="viewblogfoot"></div>
  263.  
  264. <?php
  265.  
  266. //$footer_style = 'viewblog';
  267. $pun_config['o_quickjump'] = '0';
  268. require PUN_ROOT.'footer.php';
  269.  
  270. //
  271. // Generate forum links PHP scripts
  272. //
  273. function generate_forumlinks($group_id = false)
  274. {
  275.     global $db, $lang_blog, $pun_user;
  276.  
  277.     $groups = array();
  278.  
  279.     // If a group_id was supplied, we generate the forum links cache for that group only
  280.     if ($group_id !== false)
  281.     {
  282.         // Is this group even allowed to read forums?
  283.         $result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch user group read permission', __FILE__, __LINE__, $db->error());
  284.         $read_board = $db->result($result);
  285.  
  286.         $groups[$group_id] = $read_board;
  287.     }
  288.     else
  289.     {
  290.         // A group_id was not supplied, so we generate the forum links cache for all groups
  291.         $result = $db->query('SELECT g_id, g_read_board FROM '.$db->prefix.'groups') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
  292.         $num_groups = $db->num_rows($result);
  293.  
  294.         while ($row = $db->fetch_row($result))
  295.             $groups[$row[0]] = $row[1];
  296.     }
  297.  
  298.     // Loop through the groups in $groups and output the cache for each of them
  299.     foreach ($groups as $group_id => $read_board)
  300.     {
  301.         if ($read_board == '1')
  302.         {
  303.             $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$group_id.') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
  304.  
  305.             if ($db->num_rows($result))
  306.             {
  307. ?>         
  308.     <div id="vf" class="blocktable">
  309.         <!--h2><span><?php echo $lang_blog['All forums'] ?></span></h2-->
  310.         <div class="box">
  311.             <div class="inbox">
  312.                 <table cellspacing="0">
  313.                 <thead>
  314.                     <tr><th class="tcl" scope="col">
  315.                             <?php echo $lang_blog['All forums'] ?>
  316.                     </th></tr>
  317.                 </thead>
  318.                 <tbody>
  319. <?php
  320.                 while ($cur_forum = $db->fetch_assoc($result))
  321.                 {
  322.                     if ($cur_forum['redirect_url'] == '')
  323.                     {
  324.                         $output = "\t\t\t\t\t".'<tr><td class="tcl"><div class="tclcon">'."\n";
  325.                         $output .= "\t\t\t\t\t\t".'<a href="viewblog.php?bid='.$cur_forum['fid'].'">'.pun_htmlspecialchars($cur_forum['forum_name']).'</a>'."\n";
  326.                         $output .= "\t\t\t\t\t".'</div></td></tr>'."\n";
  327.                         echo $output;
  328.                     }
  329.                 }
  330. ?>             
  331.                 </tbody>
  332.                 </table>
  333.             </div>
  334.         </div>
  335.     </div>
  336. <?php              
  337.             }
  338.         }
  339.     }
  340. }
  341.  
  342. function most_topics($query, $topics_num)
  343. {
  344.     global $db, $lang_blog, $pun_user, $cut_str;
  345.    
  346.     switch ($query)
  347.     {
  348.         case 'last':
  349.             $sort_by = 't.last_post DESC';
  350.             $title = $lang_blog['Last topics'];
  351.             break;
  352.         case 'most_replies':
  353.             $sort_by = 't.num_replies DESC';
  354.             $where_sql = ' AND t.num_replies > 0';
  355.             $title = $lang_blog['Most replies'];
  356.             break;
  357.         case 'most_views':
  358.             $sort_by = 't.num_views DESC';
  359.             $where_sql = ' AND t.num_views > 0';
  360.             $title = $lang_blog['Most views'];
  361.             break;
  362.         default:
  363.             $sort_by = 't.last_post DESC';
  364.             $title = $lang_blog['Last topics'];
  365.             break;
  366.     }
  367.  
  368.     if ($pun_user['g_id'] == PUN_ADMIN)
  369.     {
  370.         $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.num_views, t.moved_to, t.forum_id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE t.moved_to IS NULL'.$where_sql.' ORDER BY '.$sort_by.' LIMIT '.$topics_num) or error('Unable to get the admin\'s topic list', __FILE__, __LINE__, $db->error());
  371.     }  
  372.     elseif ($pun_user['is_guest'])
  373.     {
  374.         $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.num_views, t.moved_to, t.forum_id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$where_sql.' ORDER BY '.$sort_by.' LIMIT '.$topics_num) or error('Unable to get the guest\'s topic list', __FILE__, __LINE__, $db->error());
  375.     }
  376.     else
  377.     {
  378.         $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.num_views, t.moved_to, t.forum_id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$where_sql.' ORDER BY '.$sort_by.' LIMIT '.$topics_num) or error('Unable to get the member\'s topic list', __FILE__, __LINE__, $db->error());
  379.     }
  380. ?> 
  381.     <div id="most<?php echo $query; ?>" class="blockpost">
  382.         <h2><span><?php echo $title ?></span></h2>
  383.         <div class="box">
  384.             <div class="inbox">
  385.                 <table cellspacing="0">
  386.                 <tbody>
  387.                 <tr><td>
  388. <?php
  389. if ($db->num_rows($result))
  390. {
  391.     while ($cur_topic = $db->fetch_assoc($result)) {
  392.         if ($pun_config['o_censoring'] == '1')
  393.             $cur_topic['subject'] = censor_words($cur_topic['subject']);
  394.            
  395.             if (mb_strlen($cur_topic['subject'])>$cut_str && strlen($cur_topic['subject'])>$cut_str)
  396.             {
  397.                 $cur_topic['subject'] = mb_substr($cur_topic['subject'], 0,$cut_str).'...';
  398.             }
  399.            
  400.             $subject = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'" title="'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'&nbsp;'.format_time($cur_topic['last_post']).'">'.pun_htmlspecialchars($cur_topic['subject']).'</a>';
  401. ?>
  402.                 <!--tr><td-->
  403.                     <div class="tclcon1">
  404.                         <?php echo $subject ?>
  405.                     </div>
  406.                 <!--/td></tr-->
  407. <?php
  408.     }
  409. }
  410. else
  411. {
  412. ?>
  413.                 <!--tr><td-->
  414.                     <div class="tclcon1">
  415.                         <?php echo $lang_common['Never'] ?>
  416.                     </div>
  417.                 <!--/td></tr-->
  418. <?php
  419. }
  420. ?>
  421.                 </td></tr>
  422.                 </tbody></table></div></div></div>
  423. <?php          
  424. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement