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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
topic.php
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 * Topic feed for a specific topic
018 *
019 * This will give you the last {$this->num_items} posts made within this topic.
020 */
021 class topic extends \phpbb\feed\post_base
022 {
023 var $topic_id = 0;
024 var $forum_id = 0;
025 var $topic_data = array();
026
027 /**
028 * Set the Topic ID
029 *
030 * @param int $topic_id Topic ID
031 * @return \phpbb\feed\topic
032 */
033 public function set_topic_id($topic_id)
034 {
035 $this->topic_id = (int) $topic_id;
036
037 return $this;
038 }
039
040 function open()
041 {
042 $sql = 'SELECT f.forum_options, f.forum_password, t.topic_id, t.forum_id, t.topic_visibility, t.topic_title, t.topic_time, t.topic_views, t.topic_posts_approved, t.topic_type
043 FROM ' . TOPICS_TABLE . ' t
044 LEFT JOIN ' . FORUMS_TABLE . ' f
045 ON (f.forum_id = t.forum_id)
046 WHERE t.topic_id = ' . $this->topic_id;
047 $result = $this->db->sql_query($sql);
048 $this->topic_data = $this->db->sql_fetchrow($result);
049 $this->db->sql_freeresult($result);
050
051 if (empty($this->topic_data))
052 {
053 trigger_error('NO_TOPIC');
054 }
055
056 $this->forum_id = (int) $this->topic_data['forum_id'];
057
058 // Make sure topic is either approved or user authed
059 if ($this->topic_data['topic_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $this->forum_id))
060 {
061 trigger_error('SORRY_AUTH_READ');
062 }
063
064 // Make sure forum is not excluded from feed
065 if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options']))
066 {
067 trigger_error('NO_FEED');
068 }
069
070 // Make sure we can read this forum
071 if (!$this->auth->acl_get('f_read', $this->forum_id))
072 {
073 trigger_error('SORRY_AUTH_READ');
074 }
075
076 // Make sure forum is not passworded or user is authed
077 if ($this->topic_data['forum_password'])
078 {
079 $forum_ids_passworded = $this->get_passworded_forums();
080
081 if (isset($forum_ids_passworded[$this->forum_id]))
082 {
083 trigger_error('SORRY_AUTH_READ');
084 }
085
086 unset($forum_ids_passworded);
087 }
088
089 parent::open();
090 }
091
092 function get_sql()
093 {
094 $this->sql = array(
095 'SELECT' => 'p.post_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, ' .
096 'u.username, u.user_id',
097 'FROM' => array(
098 POSTS_TABLE => 'p',
099 USERS_TABLE => 'u',
100 ),
101 'WHERE' => 'p.topic_id = ' . $this->topic_id . '
102 AND ' . $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.') . '
103 AND p.poster_id = u.user_id',
104 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC',
105 );
106
107 return true;
108 }
109
110 function adjust_item(&$item_row, &$row)
111 {
112 parent::adjust_item($item_row, $row);
113
114 $item_row['forum_id'] = $this->forum_id;
115 }
116
117 function get_item()
118 {
119 return ($row = parent::get_item()) ? array_merge($this->topic_data, $row) : $row;
120 }
121 }
122