[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
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 * New Topics feed 18 * 19 * This will give you the last {$this->num_items} created topics 20 * including the first post. 21 */ 22 class topics extends \phpbb\feed\topic_base 23 { 24 function get_sql() 25 { 26 $forum_ids_read = $this->get_readable_forums(); 27 if (empty($forum_ids_read)) 28 { 29 return false; 30 } 31 32 $in_fid_ary = array_diff($forum_ids_read, $this->get_excluded_forums(), $this->get_passworded_forums()); 33 if (empty($in_fid_ary)) 34 { 35 return false; 36 } 37 38 // We really have to get the post ids first! 39 $sql = 'SELECT topic_first_post_id, topic_time 40 FROM ' . TOPICS_TABLE . ' 41 WHERE topic_moved_id = 0 42 AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . ' 43 ORDER BY topic_time DESC'; 44 $result = $this->db->sql_query_limit($sql, $this->num_items); 45 46 $post_ids = array(); 47 while ($row = $this->db->sql_fetchrow($result)) 48 { 49 $post_ids[] = (int) $row['topic_first_post_id']; 50 } 51 $this->db->sql_freeresult($result); 52 53 if (empty($post_ids)) 54 { 55 return false; 56 } 57 58 parent::fetch_attachments($post_ids); 59 60 $this->sql = array( 61 'SELECT' => 'f.forum_id, f.forum_name, 62 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, 63 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', 64 'FROM' => array( 65 TOPICS_TABLE => 't', 66 POSTS_TABLE => 'p', 67 ), 68 'LEFT_JOIN' => array( 69 array( 70 'FROM' => array(FORUMS_TABLE => 'f'), 71 'ON' => 'p.forum_id = f.forum_id', 72 ), 73 ), 74 'WHERE' => 'p.topic_id = t.topic_id 75 AND ' . $this->db->sql_in_set('p.post_id', $post_ids), 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 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |