Advertisement
KeyDog

active_topics (Slavok/FalconFour)manifest.xml

Dec 30th, 2011
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 6.73 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <extension engine="1.0">
  4.     <id>active_topics</id>
  5.     <title>Active Topics List on Index</title>
  6.     <version>1.2.3</version>
  7.     <description>This will add the x most recent posts to the index page of the forum for easy navigation and attention-grabbing.</description>
  8.     <author>Slavok - FalconFour - KeyDog</author>
  9.     <minversion>1.3.2</minversion>
  10.     <maxtestedon>1.4.1</maxtestedon>
  11.     <install>
  12.         <![CDATA[
  13.        ]]>
  14.     </install>
  15.     <uninstall>
  16.         <![CDATA[
  17.        ]]>
  18.     </uninstall>    
  19.     <hooks>
  20.         <hook id="in_main_output_start"><![CDATA[
  21.        if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php')) {
  22.     include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
  23. } else {
  24.     include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
  25. }
  26. $topics_count = 5;
  27. $query_active_topics= array(
  28.    'SELECT'    => 't.id AS tid, t.poster, t.subject, t.posted AS has_posted, t.last_post, t.last_post_id, t.num_replies, t.num_views, t.closed, t.sticky, t.forum_id, t.last_poster',
  29.    'FROM'        => 'topics AS t',
  30.    'JOINS'        => array(
  31.        array(
  32.            'INNER JOIN'    => 'forums AS f',
  33.            'ON'            => 'f.id=t.forum_id'
  34.        ),
  35.        array(
  36.            'LEFT JOIN'     => 'forum_perms AS fp',
  37.            'ON'            => '(fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].')'
  38.        )
  39.    ),
  40.    'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1)',
  41.    'ORDER BY'    => 't.last_post DESC',
  42.    'LIMIT' => $topics_count
  43. );
  44. $result_active = $forum_db->query_build($query_active_topics) or error(__FILE__, __LINE__);
  45.  
  46. if ($forum_db->num_rows($result_active) == 0) {
  47.  
  48. ?>
  49.    <div class="main-content main-message">
  50.        <p>There are no active topics.</p>
  51.    </div>
  52. <?php
  53.    
  54. } else {
  55.    require_once FORUM_ROOT.'lang/'.$forum_user['language'].'/forum.php';
  56.  
  57. ?>    
  58.    <div class="main-head">
  59.      <h2 class="hn"><span><?php echo $lang_active_topics['Active topics']; ?></span></h2>
  60.    </div>
  61.  
  62.    <div class="main-subhead">
  63.            <p class="item-summary">
  64.                <span>
  65.                    <strong class="subject-title"><?php echo $lang_index['Topics']; ?></strong>
  66.                    <strong class="info-replies"><?php echo $lang_forum['Replies']; ?></strong>
  67.                    <strong class="info-views"><?php echo $lang_forum['Views']; ?></strong>
  68.                    <strong class="info-lastpost"><?php echo $lang_index['last post']; ?></strong>
  69.                </span>
  70.            </p>                                                
  71.        </div>
  72.    <div class="main-content main-forum">                    
  73.    <?php
  74.  
  75.        $item_num = 1;
  76.  
  77.        while ($cur_set = $forum_db->fetch_assoc($result_active))
  78.        {
  79.           // Start from scratch
  80.            $item_subject = $item_body = $item_status = $item_nav = $item_title = array();
  81.            $item_indicator = '';
  82.            
  83.            if (!empty($item_nav))
  84.                $item_title['nav'] = '<span class="item-nav">'.sprintf($lang_forum['Topic navigation'], implode('&#160;&#160;', $item_nav)).'</span>';
  85.  
  86.            if ($cur_set['sticky'] == '1')
  87.            {
  88.                $item_subject_status['sticky'] = $lang_forum['Sticky'];
  89.                $item_status['sticky'] = 'sticky';
  90.            }
  91.  
  92.            if ($cur_set['closed'] != '0')
  93.            {
  94.                $item_subject_status['closed'] = $lang_forum['Closed'];
  95.                $item_status['closed'] = 'closed';
  96.            }
  97.            if (!empty($item_subject_status))
  98.                $item_title['status'] = '<span class="item-status">'.sprintf($lang_forum['Item status'], implode(' ', $item_subject_status)).'</span>';
  99.            $item_title['link'] = '<a href="'.forum_link($forum_url['post'], $cur_set['last_post_id']).'">'.forum_htmlencode($cur_set['subject']).'</a>';
  100.            if (!$forum_user['is_guest'] && $forum_config['o_show_dot'] == '1' && $cur_set['has_posted'] > 0)
  101.            {
  102.                $item_title['posted'] = '<span class="posted-mark">'.$lang_forum['You posted indicator'].'</span>';
  103.                $item_status['posted'] = 'posted';
  104.            }
  105.  
  106.            $item_body['subject']['title'] = '<h3 class="hn"><span class="item-num">'.forum_number_format(++$item_num).'</span> '.implode(' ', $item_title).'</h3> ';
  107.  
  108.            // Does this topic contain posts we haven't read? If so, tag it accordingly.
  109.            if (!$forum_user['is_guest'] && $cur_set['last_post'] > $forum_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_set['tid']]) || $tracked_topics['topics'][$cur_set['tid']] < $cur_set['last_post']) && (!isset($tracked_topics['forums'][$cur_set['forum_id']]) || $tracked_topics['forums'][$cur_set['forum_id']] < $cur_set['last_post']))
  110.            {
  111.                $item_status['new'] = 'new';
  112.            }
  113.            
  114.            $item_body['subject']['desc'] = implode(' ', $item_subject);
  115.            if (empty($item_status))
  116.                $item_status['normal'] = 'normal';
  117.  
  118.            $item_style = (($item_num % 2 != 0) ? ' odd' : ' even').(($item_num == 1) ? ' main-first-item' : '').((!empty($item_status)) ? ' '.implode(' ', $item_status) : '');
  119.            
  120.            $item_body['info']['replies'] = '<li class="info-replies"><strong>'.forum_number_format($cur_set['num_replies']).'</strong> <span class="label">'.(($cur_set['num_replies'] == 1) ? $lang_forum['Reply'] : $lang_forum['Replies']).'</span></li>';
  121.            $item_body['info']['views'] = '<li class="info-replies"><strong>'.forum_number_format($cur_set['num_views']).'</strong> <span class="label">'.(($cur_set['num_views'] == 1) ? $lang_forum['View'] : $lang_forum['Views']).'</span></li>';
  122.            $item_body['info']['last_post'] = '<li class="info-lastpost"><span class="label">'.$lang_index['Last post'].'</span> <strong><a href="'.forum_link($forum_url['post'], $cur_set['last_post_id']).'">'.format_time($cur_set['last_post']).'</a></strong> <cite>'.sprintf($lang_index['Last poster'], forum_htmlencode($cur_set['last_poster'])).'</cite></li>';
  123.  
  124.            ?>
  125.                <div class="main-item<?php echo $item_style ?>">
  126.                    <span class="icon <?php echo implode(' ', $item_status) ?>"><!-- --></span>
  127.                    <div class="item-subject">
  128.                        <?php echo implode("\n\t\t\t\t", $item_body['subject'])."\n" ?>
  129.                    </div>
  130.                    <ul class="item-info">
  131.                        <?php echo implode("\n\t\t\t\t", $item_body['info'])."\n" ?>
  132.                    </ul>
  133.              </div>
  134.    <?php
  135.  
  136.       }
  137.  
  138. }
  139.        ]]></hook>
  140.     </hooks>
  141. </extension>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement