@@ -534,7 +534,7 @@ public function display_single_forum($event)
534
534
'S_SELECT_SORT_DIR ' => $ s_sort_dir ,
535
535
'S_SELECT_SORT_KEY ' => $ s_sort_key ,
536
536
'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 ),
538
538
'U_WATCH_FORUM_LINK ' => $ this ->viewforum_swap ($ s_watching_forum ['link ' ]),
539
539
'U_WATCH_FORUM_TOGGLE ' => $ this ->viewforum_swap ($ s_watching_forum ['link_toggle ' ]),
540
540
'S_WATCH_FORUM_TITLE ' => $ s_watching_forum ['title ' ],
@@ -765,7 +765,7 @@ public function display_single_forum($event)
765
765
else
766
766
{
767
767
$ 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 ;
769
769
}
770
770
771
771
// Grab just the sorted topic ids
@@ -835,6 +835,26 @@ public function display_single_forum($event)
835
835
'WHERE ' => $ this ->db ->sql_in_set ('t.topic_id ' , $ topic_list ),
836
836
);
837
837
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
+
838
858
// If store_reverse, then first obtain topics, then stickies, else the other way around...
839
859
// Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because
840
860
// the number of stickies are not known
@@ -894,7 +914,7 @@ public function display_single_forum($event)
894
914
}
895
915
896
916
// 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 ' ]))
898
918
{
899
919
// We need to remove any trace regarding this topic. :)
900
920
unset($ rowset [$ orig_topic_id ]);
@@ -1020,6 +1040,11 @@ public function display_single_forum($event)
1020
1040
1021
1041
// Replies
1022
1042
$ 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
+ }
1023
1048
1024
1049
if ($ row ['topic_status ' ] == ITEM_MOVED )
1025
1050
{
@@ -1203,7 +1228,10 @@ public function generate_forum_nav($event)
1203
1228
if ($ this ->phpbbasic_enabled )
1204
1229
{
1205
1230
$ 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
+ }
1207
1235
$ navlinks ['PHPBBASIC_FORUM_BREADCRUMB ' ] = $ navlinks ['FORUM_ID ' ] == $ this ->phpbbasic_forumid ;
1208
1236
$ event ['navlinks ' ] = $ navlinks ;
1209
1237
$ navlinks_parents = $ event ['navlinks_parents ' ];
0 commit comments