@@ -534,7 +534,7 @@ public function display_single_forum($event)
534534 'S_SELECT_SORT_DIR ' => $ s_sort_dir ,
535535 'S_SELECT_SORT_KEY ' => $ s_sort_key ,
536536 'S_SELECT_SORT_DAYS ' => $ s_limit_days ,
537- 'S_TOPIC_ICONS ' => ($ s_display_active && sizeof ($ active_forum_ary )) ? max ($ active_forum_ary ['enable_icons ' ]) : (($ forum_data ['enable_icons ' ]) ? true : false ),
537+ 'S_TOPIC_ICONS ' => ($ s_display_active && count ($ active_forum_ary )) ? max ($ active_forum_ary ['enable_icons ' ]) : (($ forum_data ['enable_icons ' ]) ? true : false ),
538538 'U_WATCH_FORUM_LINK ' => $ this ->viewforum_swap ($ s_watching_forum ['link ' ]),
539539 'U_WATCH_FORUM_TOGGLE ' => $ this ->viewforum_swap ($ s_watching_forum ['link_toggle ' ]),
540540 'S_WATCH_FORUM_TITLE ' => $ s_watching_forum ['title ' ],
@@ -765,7 +765,7 @@ public function display_single_forum($event)
765765 else
766766 {
767767 $ get_forum_ids = array_diff ($ active_forum_ary ['forum_id ' ], $ active_forum_ary ['exclude_forum_id ' ]);
768- $ sql_where = (sizeof ($ get_forum_ids )) ? $ this ->db ->sql_in_set ('t.forum_id ' , $ get_forum_ids ) : 't.forum_id = ' . $ forum_id ;
768+ $ sql_where = (count ($ get_forum_ids )) ? $ this ->db ->sql_in_set ('t.forum_id ' , $ get_forum_ids ) : 't.forum_id = ' . $ forum_id ;
769769 }
770770
771771 // Grab just the sorted topic ids
@@ -835,6 +835,26 @@ public function display_single_forum($event)
835835 'WHERE ' => $ this ->db ->sql_in_set ('t.topic_id ' , $ topic_list ),
836836 );
837837
838+ /**
839+ * Event to modify the SQL query before obtaining topics/stickies
840+ *
841+ * @event core.viewforum_modify_topic_list_sql
842+ * @var int forum_id The forum ID
843+ * @var array forum_data Data about the forum
844+ * @var array topic_list Topic ids array
845+ * @var array sql_array SQL query array for obtaining topics/stickies
846+ *
847+ * @since 3.2.10-RC1
848+ * @since 3.3.1-RC1
849+ */
850+ $ vars = [
851+ 'forum_id ' ,
852+ 'forum_data ' ,
853+ 'topic_list ' ,
854+ 'sql_array ' ,
855+ ];
856+ extract ($ this ->phpbb_dispatcher ->trigger_event ('core.viewforum_modify_topic_list_sql ' , compact ($ vars )));
857+
838858 // If store_reverse, then first obtain topics, then stickies, else the other way around...
839859 // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because
840860 // the number of stickies are not known
@@ -894,7 +914,7 @@ public function display_single_forum($event)
894914 }
895915
896916 // Do not include those topics the user has no permission to access
897- if (!$ this ->auth ->acl_get ('f_read ' , $ row ['forum_id ' ]))
917+ if (!$ this ->auth ->acl_gets ('f_read ' , ' f_list_topics ' , $ row ['forum_id ' ]))
898918 {
899919 // We need to remove any trace regarding this topic. :)
900920 unset($ rowset [$ orig_topic_id ]);
@@ -1020,6 +1040,11 @@ public function display_single_forum($event)
10201040
10211041 // Replies
10221042 $ replies = $ this ->phpbb_content_visibility ->get_count ('topic_posts ' , $ row , $ topic_forum_id ) - 1 ;
1043+ // Correction for case of unapproved topic visible to poster
1044+ if ($ replies < 0 )
1045+ {
1046+ $ replies = 0 ;
1047+ }
10231048
10241049 if ($ row ['topic_status ' ] == ITEM_MOVED )
10251050 {
@@ -1203,7 +1228,10 @@ public function generate_forum_nav($event)
12031228 if ($ this ->phpbbasic_enabled )
12041229 {
12051230 $ navlinks = $ event ['navlinks ' ];
1206- $ navlinks ['U_VIEW_FORUM ' ] = $ this ->viewforum_swap ($ navlinks ['U_VIEW_FORUM ' ]);
1231+ if (isset ($ navlinks ['U_VIEW_FORUM ' ]))
1232+ {
1233+ $ navlinks ['U_VIEW_FORUM ' ] = $ this ->viewforum_swap ($ navlinks ['U_VIEW_FORUM ' ]);
1234+ }
12071235 $ navlinks ['PHPBBASIC_FORUM_BREADCRUMB ' ] = $ navlinks ['FORUM_ID ' ] == $ this ->phpbbasic_forumid ;
12081236 $ event ['navlinks ' ] = $ navlinks ;
12091237 $ navlinks_parents = $ event ['navlinks_parents ' ];
0 commit comments