Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

news.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 2.79 KiB


001  <?php
002  /**
003  *
004  * This file is part of the phpBB Forum Software package.
005  *
006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
007  * @license GNU General Public License, version 2 (GPL-2.0)
008  *
009  * For full copyright and license information, please see
010  * the docs/CREDITS.txt file.
011  *
012  */
013   
014  namespace phpbb\feed;
015   
016  /**
017  * News feed
018  *
019  * This will give you {$this->num_items} first posts
020  * of all topics in the selected news forums.
021  */
022  class news extends \phpbb\feed\topic_base
023  {
024      function get_news_forums()
025      {
026          static $forum_ids;
027   
028          // Matches acp/acp_board.php
029          $cache_name    = 'feed_news_forum_ids';
030   
031          if (!isset($forum_ids) && ($forum_ids = $this->cache->get('_' . $cache_name)) === false)
032          {
033              $sql = 'SELECT forum_id
034                  FROM ' . FORUMS_TABLE . '
035                  WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
036              $result = $this->db->sql_query($sql);
037   
038              $forum_ids = array();
039              while ($forum_id = (int) $this->db->sql_fetchfield('forum_id'))
040              {
041                  $forum_ids[$forum_id] = $forum_id;
042              }
043              $this->db->sql_freeresult($result);
044   
045              $this->cache->put('_' . $cache_name, $forum_ids);
046          }
047   
048          return $forum_ids;
049      }
050   
051      function get_sql()
052      {
053          // Determine forum ids
054          $in_fid_ary = array_intersect($this->get_news_forums(), $this->get_readable_forums());
055          if (empty($in_fid_ary))
056          {
057              return false;
058          }
059   
060          $in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums());
061          if (empty($in_fid_ary))
062          {
063              return false;
064          }
065   
066          // We really have to get the post ids first!
067          $sql = 'SELECT topic_first_post_id, topic_time
068              FROM ' . TOPICS_TABLE . '
069              WHERE topic_moved_id = 0
070                  AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . '
071              ORDER BY topic_time DESC';
072          $result = $this->db->sql_query_limit($sql, $this->num_items);
073   
074          $post_ids = array();
075          while ($row = $this->db->sql_fetchrow($result))
076          {
077              $post_ids[] = (int) $row['topic_first_post_id'];
078          }
079          $this->db->sql_freeresult($result);
080   
081          if (empty($post_ids))
082          {
083              return false;
084          }
085   
086          $this->sql = array(
087              'SELECT'    => 'f.forum_id, f.forum_name,
088                              t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time,
089                              p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility',
090              'FROM'        => array(
091                  TOPICS_TABLE    => 't',
092                  POSTS_TABLE        => 'p',
093              ),
094              'LEFT_JOIN'    => array(
095                  array(
096                      'FROM'    => array(FORUMS_TABLE => 'f'),
097                      'ON'    => 'p.forum_id = f.forum_id',
098                  ),
099              ),
100              'WHERE'        => 'p.topic_id = t.topic_id
101                              AND ' . $this->db->sql_in_set('p.post_id', $post_ids),
102              'ORDER_BY'    => 'p.post_time DESC, p.post_id DESC',
103          );
104   
105          return true;
106      }
107  }
108