[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/feed/ -> overall.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\feed;
  15  
  16  /**
  17  * Board wide feed (aka overall feed)
  18  *
  19  * This will give you the newest {$this->num_items} posts
  20  * from the whole board.
  21  */
  22  class overall extends \phpbb\feed\post_base
  23  {
  24  	function get_sql()
  25      {
  26          $forum_ids = array_diff($this->get_readable_forums(), $this->get_excluded_forums(), $this->get_passworded_forums());
  27          if (empty($forum_ids))
  28          {
  29              return false;
  30          }
  31  
  32          // Determine topics with recent activity
  33          $sql = 'SELECT topic_id, topic_last_post_time
  34              FROM ' . TOPICS_TABLE . '
  35              WHERE topic_moved_id = 0
  36                  AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . '
  37              ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';
  38          $result = $this->db->sql_query_limit($sql, $this->num_items);
  39  
  40          $topic_ids = array();
  41          $min_post_time = 0;
  42          while ($row = $this->db->sql_fetchrow())
  43          {
  44              $topic_ids[] = (int) $row['topic_id'];
  45  
  46              $min_post_time = (int) $row['topic_last_post_time'];
  47          }
  48          $this->db->sql_freeresult($result);
  49  
  50          if (empty($topic_ids))
  51          {
  52              return false;
  53          }
  54  
  55          parent::fetch_attachments(array(), $topic_ids);
  56  
  57          // Get the actual data
  58          $this->sql = array(
  59              'SELECT'    =>    'f.forum_id, f.forum_name, ' .
  60                              'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' .
  61                              'u.username, u.user_id',
  62              'FROM'        => array(
  63                  USERS_TABLE        => 'u',
  64                  POSTS_TABLE        => 'p',
  65              ),
  66              'LEFT_JOIN'    => array(
  67                  array(
  68                      'FROM'    => array(FORUMS_TABLE    => 'f'),
  69                      'ON'    => 'f.forum_id = p.forum_id',
  70                  ),
  71              ),
  72              'WHERE'        => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
  73                              AND ' . $this->content_visibility->get_forums_visibility_sql('post', $forum_ids, 'p.') . '
  74                              AND p.post_time >= ' . $min_post_time . '
  75                              AND u.user_id = p.poster_id',
  76              'ORDER_BY'    => 'p.post_time DESC, p.post_id DESC',
  77          );
  78  
  79          return true;
  80      }
  81  
  82  	function adjust_item(&$item_row, &$row)
  83      {
  84          parent::adjust_item($item_row, $row);
  85  
  86          $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
  87      }
  88  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1