Advertisement
Guest User

anmnt

a guest
Jan 26th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.65 KB | None | 0 0
  1. <?php
  2.     define('IN_PHPBB', true);
  3.     $phpbb_root_path = './forum/'; // Path to phpbb folder
  4.     $phpEx = substr(strrchr(__FILE__, '.'), 1);
  5.     include($phpbb_root_path . 'common.' . $phpEx);
  6.     include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  7.  
  8.     // Start session management
  9.     $user->session_begin();
  10.     $auth->acl($user->data);
  11.  
  12.     // Grab user preferences
  13.     $user->setup();
  14.     /*** phpBB3 - Last Active Topics System ***/
  15.     //Show last x topics
  16.     define('TOPICS_LIMIT',10);
  17.  
  18.     // Create arrays
  19.     $topics = array();
  20.    
  21.     // Get forums that current user has read rights to.
  22.    
  23.     $forums = '2';
  24.    
  25.     // Get active topics.
  26.     $sql="SELECT *
  27.    FROM " . TOPICS_TABLE . "
  28.    WHERE topic_approved = '1' AND " . $db->sql_in_set('forum_id', $forums) . "
  29.    ORDER BY topic_last_post_time DESC";
  30.    
  31.     $result = $db->sql_query_limit($sql,TOPICS_LIMIT);
  32.    
  33.     while ($r = $db->sql_fetchrow($result)):
  34.    
  35.         $topics[] = $r;
  36.        
  37.     endwhile;
  38.    
  39.     $db->sql_freeresult($result);
  40.    
  41. ?>
  42.  
  43. <div id="recent_topics">
  44.    
  45.     <table class="recent-topic-table">
  46.        
  47.         <tbody><tr>
  48.             <td class="recent-topic-table-header" colspan="5" align="center" valign="middle">Annoucement</td>
  49.         </tr>
  50.  
  51. <?php
  52.        
  53.     foreach ($topics as $t):
  54.    
  55.         // Get folder img, topic status/type related information
  56.         $topic_tracking_info = get_complete_topic_tracking($t['forum_id'], $t['topic_id']);
  57.         $unread_topic = (isset($topic_tracking_info[$t['topic_id']]) && $t['topic_last_post_time'] > $topic_tracking_info[$t['topic_id']]) ? true : false;
  58.         $folder_img = $folder_alt = $topic_type = '';
  59.         topic_status($t, $t['topic_replies'], $unread_topic, $folder_img, $folder_alt, $topic_type);
  60.        
  61.         // output the link
  62.        
  63. ?>
  64.  
  65.             <tr>
  66.            
  67.                 <td align="center">
  68.                     <img style="vertical-align: text-bottom" src="<?php echo $user->img($folder_img, $folder_alt, false, '', 'src');?>" title="<?php echo $user->lang[$folder_alt];?>" alt="<?php echo $user->lang[$folder_alt];?>" />
  69.                 </td>
  70.                
  71.                 <td>
  72.                
  73.                     <a href="<?php echo $phpbb_root_path . 'viewtopic.php?f=' . $t['forum_id'] . '&amp;t=' . $t['topic_id'] . '&amp;p=' . $t['topic_last_post_id'] . '#p' . $t['topic_last_post_id'];?>">
  74.                     <?php echo html_entity_decode($t['topic_title']);?>
  75.                     </a>
  76.                    
  77.                 </td>
  78.                 <td align="right">
  79.                     <p class="topicdetails"><?php echo html_entity_decode($t['topic_last_post_time']);?></p>
  80.                 </td>
  81.             </tr>
  82.    
  83. <?php
  84.  
  85. endforeach;
  86.  
  87. ?>
  88.  
  89.         </tbody></table>
  90.        
  91. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement