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

forum.php

Zuletzt modifiziert: 09.10.2024, 12:52 - Dateigröße: 3.61 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  * Forum feed
 018  *
 019  * This will give you the last {$this->num_items} posts made
 020  * within a specific forum.
 021  */
 022  class forum extends \phpbb\feed\post_base
 023  {
 024      var $forum_id        = 0;
 025      var $forum_data        = array();
 026   
 027      /**
 028      * Set the Forum ID
 029      *
 030      * @param int    $forum_id            Forum ID
 031      * @return    \phpbb\feed\forum
 032      */
 033      public function set_forum_id($forum_id)
 034      {
 035          $this->forum_id = (int) $forum_id;
 036   
 037          return $this;
 038      }
 039   
 040      function open()
 041      {
 042          // Check if forum exists
 043          $sql = 'SELECT forum_id, forum_name, forum_password, forum_type, forum_options
 044              FROM ' . FORUMS_TABLE . '
 045              WHERE forum_id = ' . $this->forum_id;
 046          $result = $this->db->sql_query($sql);
 047          $this->forum_data = $this->db->sql_fetchrow($result);
 048          $this->db->sql_freeresult($result);
 049   
 050          if (empty($this->forum_data))
 051          {
 052              trigger_error('NO_FORUM');
 053          }
 054   
 055          // Forum needs to be postable
 056          if ($this->forum_data['forum_type'] != FORUM_POST)
 057          {
 058              trigger_error('NO_FEED');
 059          }
 060   
 061          // Make sure forum is not excluded from feed
 062          if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->forum_data['forum_options']))
 063          {
 064              trigger_error('NO_FEED');
 065          }
 066   
 067          // Make sure we can read this forum
 068          if (!$this->auth->acl_get('f_read', $this->forum_id))
 069          {
 070              trigger_error('SORRY_AUTH_READ');
 071          }
 072   
 073          // Make sure forum is not passworded or user is authed
 074          if ($this->forum_data['forum_password'])
 075          {
 076              $forum_ids_passworded = $this->get_passworded_forums();
 077   
 078              if (isset($forum_ids_passworded[$this->forum_id]))
 079              {
 080                  trigger_error('SORRY_AUTH_READ');
 081              }
 082   
 083              unset($forum_ids_passworded);
 084          }
 085   
 086          parent::open();
 087      }
 088   
 089      function get_sql()
 090      {
 091          // Determine topics with recent activity
 092          $sql = 'SELECT topic_id, topic_last_post_time
 093              FROM ' . TOPICS_TABLE . '
 094              WHERE forum_id = ' . $this->forum_id . '
 095                  AND topic_moved_id = 0
 096                  AND ' . $this->content_visibility->get_visibility_sql('topic', $this->forum_id) . '
 097              ORDER BY topic_last_post_time DESC, topic_last_post_id DESC';
 098          $result = $this->db->sql_query_limit($sql, $this->num_items);
 099   
 100          $topic_ids = array();
 101          $min_post_time = 0;
 102          while ($row = $this->db->sql_fetchrow())
 103          {
 104              $topic_ids[] = (int) $row['topic_id'];
 105   
 106              $min_post_time = (int) $row['topic_last_post_time'];
 107          }
 108          $this->db->sql_freeresult($result);
 109   
 110          if (empty($topic_ids))
 111          {
 112              return false;
 113          }
 114   
 115          $this->sql = array(
 116              'SELECT'    =>    '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, ' .
 117                              'u.username, u.user_id',
 118              'FROM'        => array(
 119                  POSTS_TABLE        => 'p',
 120                  USERS_TABLE        => 'u',
 121              ),
 122              'WHERE'        => $this->db->sql_in_set('p.topic_id', $topic_ids) . '
 123                              AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
 124                              AND p.post_time >= ' . $min_post_time . '
 125                              AND p.poster_id = u.user_id',
 126              'ORDER_BY'    => 'p.post_time DESC, p.post_id DESC',
 127          );
 128   
 129          return true;
 130      }
 131   
 132      function adjust_item(&$item_row, &$row)
 133      {
 134          parent::adjust_item($item_row, $row);
 135   
 136          $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title'];
 137          $item_row['forum_id'] = $this->forum_id;
 138      }
 139   
 140      function get_item()
 141      {
 142          return ($row = parent::get_item()) ? array_merge($this->forum_data, $row) : $row;
 143      }
 144  }
 145