From 7320106ea79b5c4202fd5874bfd571c73ec9f644 Mon Sep 17 00:00:00 2001 From: brunoais Date: Sun, 27 May 2018 13:17:11 +0100 Subject: [PATCH] Whitespace changes to comply better with phpBB's code guidelines --- event/language_listener.php | 4 +- event/main_listener.php | 60 +++++++++++----------- event/mcp_listener.php | 41 ++++++++------- event/search_listener.php | 86 ++++++++++++++++---------------- shared/permission_evaluation.php | 26 +++++----- 5 files changed, 108 insertions(+), 109 deletions(-) diff --git a/event/language_listener.php b/event/language_listener.php index 4a59feb..5d6e6c3 100644 --- a/event/language_listener.php +++ b/event/language_listener.php @@ -29,10 +29,10 @@ static public function getSubscribedEvents() public static function insert_at_in_assoc_array($original, $searching_key, $new_thing_key, $new_thing) { $rebuild = array(); - foreach($original AS $key => $elem) + foreach ($original AS $key => $elem) { $rebuild[$key] = $elem; - if($key == $searching_key) + if ($key == $searching_key) { $rebuild[$new_thing_key] = $new_thing; } diff --git a/event/main_listener.php b/event/main_listener.php index 8b3cecb..115da54 100644 --- a/event/main_listener.php +++ b/event/main_listener.php @@ -91,7 +91,7 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\content_visibility $c public function phpbb_ucp_pm_compose_compose_pm_basic_info_query_before($event) { - if($event['action'] === 'quotepost') + if ($event['action'] === 'quotepost') { $sql = $event['sql']; @@ -110,7 +110,7 @@ public function phpbb_ucp_pm_compose_quotepost_query_after($event) 'topic_poster' => $event['topic_poster'], )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { trigger_error('NOT_AUTHORISED'); } @@ -118,7 +118,7 @@ public function phpbb_ucp_pm_compose_quotepost_query_after($event) public function phpbb_modify_posting_auth($event) { - if(in_array($event['mode'], array('reply', 'quote', 'edit', 'delete', 'bump'), true)) + if (in_array($event['mode'], array('reply', 'quote', 'edit', 'delete', 'bump'), true)) { $permission_result = $this->permission_evaluation->permission_evaluate(array( @@ -127,7 +127,7 @@ public function phpbb_modify_posting_auth($event) 'post_id' => $event['post_id'], )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { trigger_error('NOT_AUTHORISED'); } @@ -145,7 +145,7 @@ public function phpbb_report_post_auth($event) 'topic_type' => $event['report_data']['topic_type'], )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { trigger_error('POST_NOT_EXIST'); } @@ -157,14 +157,14 @@ public function phpbb_get_logs_main_query_before($event) $full_access_forum_IDs = array(); - if($event['log_type'] == LOG_MOD) + if ($event['log_type'] == LOG_MOD) { if ($event['topic_id']) { $permission_result = $this->permission_evaluation->permission_evaluate(array( 'topic_id' => $event['topic_id'], )); - if($permission_result === accesses::FULL_READ) + if ($permission_result === accesses::FULL_READ) { return; } @@ -173,15 +173,15 @@ public function phpbb_get_logs_main_query_before($event) { $forum_ids = $event['forum_id']; $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; @@ -189,7 +189,7 @@ public function phpbb_get_logs_main_query_before($event) } else if (!empty($event['forum_id'])) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $event['forum_id'])) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $event['forum_id'])) { return; } @@ -198,14 +198,14 @@ public function phpbb_get_logs_main_query_before($event) { $forum_ids = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_'))); $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; @@ -215,7 +215,7 @@ public function phpbb_get_logs_main_query_before($event) $from_sql = $event['get_logs_sql_ary']['FROM']; $where_sql = $event['get_logs_sql_ary']['WHERE']; - if(!isset($from_sql[$this->topics_table])) + if (!isset($from_sql[$this->topics_table])) { $from_sql[$this->topics_table] = 't'; $where_sql = 't.topic_id = l.topic_id @@ -237,9 +237,9 @@ public function phpbb_get_logs_main_query_before($event) public function phpbb_content_visibility_get_visibility_sql_before($event) { - if(!$this->auth->acl_get('f_read_others_topics_brunoais', $event['forum_id'])) + if (!$this->auth->acl_get('f_read_others_topics_brunoais', $event['forum_id'])) { - if($event['mode'] === 'topic') + if ($event['mode'] === 'topic') { $event['where_sql'] .= ' (' . $event['table_alias'] . ' topic_poster = ' . (int) $this->user->data['user_id'] . ' OR topic_type = ' . POST_GLOBAL . ' @@ -254,20 +254,20 @@ public function phpbb_content_visibility_get_forums_visibility_before($event) { // If the event mode is 'post', there's nothing I can do here. - if($event['mode'] === 'topic') + if ($event['mode'] === 'topic') { $forum_ids = $event['forum_ids']; $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; @@ -285,9 +285,9 @@ public function phpbb_display_forums_after($event) $active_forum_ary = $event['active_forum_ary']; - if(empty($active_forum_ary['exclude_forum_id'])) + if (empty($active_forum_ary['exclude_forum_id'])) { - if(empty($active_forum_ary['forum_id'])) + if (empty($active_forum_ary['forum_id'])) { $forum_ids = array(); } @@ -302,9 +302,9 @@ public function phpbb_display_forums_after($event) } $full_access_forum_IDs = array(); - foreach($forum_ids as $forum_id) + foreach ($forum_ids as $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } @@ -318,7 +318,7 @@ public function phpbb_display_forums_after($event) public function phpbb_viewforum_get_topic_data($event) { - if(!$event['sort_days']) + if (!$event['sort_days']) { $sql = 'SELECT COUNT(topic_id) AS num_topics @@ -343,7 +343,7 @@ public function phpbb_viewforum_get_topic_data($event) public function phpbb_viewforum_get_topic_ids_data($event) { - if( $event['forum_data']['forum_type'] != FORUM_POST && + if ( $event['forum_data']['forum_type'] != FORUM_POST && strpos($event['sql_where'], 't.forum_id IN') === 0 && !empty($this->info_storage['ActiveTopicIds']['restrictedAccess'])) { @@ -367,7 +367,7 @@ public function phpbb_display_forums_modify_template_vars($event) 'post_id' => $event['row']['forum_last_post_id'], )); - if($post_access !== accesses::FULL_READ) + if ($post_access !== accesses::FULL_READ) { $this->user->add_lang_ext('brunoais/readOthersTopics', 'common'); $forum_row = $event['forum_row']; @@ -380,7 +380,7 @@ public function phpbb_display_forums_modify_template_vars($event) $event['forum_row'] = $forum_row; } - if(!$this->auth->acl_get('f_read_others_topics_brunoais', $event['row']['forum_id'])) + if (!$this->auth->acl_get('f_read_others_topics_brunoais', $event['row']['forum_id'])) { $forum_row = $event['forum_row']; $forum_row['TOPICS'] = '-'; @@ -400,7 +400,7 @@ public function phpbb_viewtopic_before_f_read_check($event) 'topic_type' => $event['topic_data']['topic_type'], )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { $this->permission_evaluation->access_failed(); } diff --git a/event/mcp_listener.php b/event/mcp_listener.php index 5e33f7b..10f9792 100644 --- a/event/mcp_listener.php +++ b/event/mcp_listener.php @@ -82,14 +82,14 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\content_visibility $c public function phpbb_mcp_global_f_read_auth_after($event) { - if($event['forum_id'] && $event['topic_id']) + if ($event['forum_id'] && $event['topic_id']) { $permission_result = $this->permission_evaluation->permission_evaluate(array( 'forum_id' => $event['forum_id'], 'topic_id' => $event['topic_id'], )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { trigger_error('NOT_AUTHORISED'); } @@ -101,15 +101,15 @@ public function phpbb_mcp_reports_get_reports_query_before($event) $forum_ids = $event['forum_list']; $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; @@ -135,14 +135,13 @@ public function phpbb_mcp_sorting_query_before($event) { case 'forum_view': - $event['sql'] .= ' AND (' . $this->db->sql_in_set('forum_id', $full_access_forum_IDs, false, true) . ' OR topic_poster = ' . (int) $this->user->data['user_id'] . ' ) '; break; } - if($event['where_sql'] === 'WHERE') + if ($event['where_sql'] === 'WHERE') { $event['where_sql'] = 'WHERE '; } @@ -154,15 +153,15 @@ public function phpbb_mcp_front_queue_unapproved_total_before($event) $forum_ids = $event['forum_list']; $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; @@ -172,7 +171,7 @@ public function phpbb_mcp_front_queue_unapproved_total_before($event) $from_sql = $event['sql_ary']['FROM']; $where_sql = $event['sql_ary']['WHERE']; - if(!isset($from_sql[$this->topics_table])) + if (!isset($from_sql[$this->topics_table])) { $from_sql[$this->topics_table] = 't'; $where_sql = 't.topic_id = p.topic_id @@ -193,19 +192,19 @@ public function phpbb_mcp_front_queue_unapproved_total_before($event) public function phpbb_mcp_front_view_queue_postid_list_after($event) { - if($event['total'] > 0) + if ($event['total'] > 0) { $forum_ids = $event['forum_list']; $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; @@ -244,15 +243,15 @@ public function phpbb_mcp_front_reports_count_query_before($event) { $forum_ids = $event['forum_list']; $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; @@ -279,15 +278,15 @@ public function phpbb_mcp_front_reports_listing_query_before($event) $forum_ids = $event['forum_list']; $full_access_forum_IDs = array(); - foreach($forum_ids AS $forum_id) + foreach ($forum_ids AS $forum_id) { - if($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) + if ($this->auth->acl_get('f_read_others_topics_brunoais', $forum_id)) { $full_access_forum_IDs[] = $forum_id; } } - if(sizeof($full_access_forum_IDs) === sizeof($forum_ids)) + if (sizeof($full_access_forum_IDs) === sizeof($forum_ids)) { // Nothing to filter return; diff --git a/event/search_listener.php b/event/search_listener.php index fb13c74..dcdb961 100644 --- a/event/search_listener.php +++ b/event/search_listener.php @@ -89,7 +89,7 @@ public function search_modify_rowset($event) $rowset = $event['rowset']; - foreach($rowset AS $key => $row) + foreach ($rowset AS $key => $row) { $permission_result = $this->permission_evaluation->permission_evaluate(array( 'forum_id' => $row['forum_id'], @@ -97,7 +97,7 @@ public function search_modify_rowset($event) 'topic_type' => $row['topic_type'], )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { unset($rowset[$key]); } @@ -109,7 +109,7 @@ public function search_mysql_keywords_main_query_before($event) { $topic_id = $event['topic_id']; - if(empty($topic_id)) + if (empty($topic_id)) { $forums_permissions = $this->auth->acl_get_list($this->user->data['user_id'], array('f_read', 'f_read_others_topics_brunoais')); @@ -118,13 +118,13 @@ public function search_mysql_keywords_main_query_before($event) $partial_read_access_fids = $full_read_access_fids = array(); - foreach($forums_permissions as $forum_id => $forum_permissions) + foreach ($forums_permissions as $forum_id => $forum_permissions) { - if(isset($forum_permissions['f_read']) && + if (isset($forum_permissions['f_read']) && !isset($ex_fid_keys[$forum_id])) { - if(isset($forum_permissions['f_read_others_topics_brunoais'])) + if (isset($forum_permissions['f_read_others_topics_brunoais'])) { $full_read_access_fids[$forum_id] = $forum_id; }else{ @@ -133,7 +133,7 @@ public function search_mysql_keywords_main_query_before($event) } } - if(sizeof($partial_read_access_fids) > 0) + if (sizeof($partial_read_access_fids) > 0) { // The filter has to be in place $event['join_topic'] = true; @@ -155,7 +155,7 @@ public function search_mysql_keywords_main_query_before($event) 'topic_id' => $topic_id, )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { $event['join_topic'] = true; @@ -172,7 +172,7 @@ public function search_native_keywords_count_query_before($event) { $topic_id = $event['topic_id']; - if(empty($topic_id)) + if (empty($topic_id)) { $forums_permissions = $this->auth->acl_get_list($this->user->data['user_id'], array('f_read', 'f_read_others_topics_brunoais')); @@ -181,13 +181,13 @@ public function search_native_keywords_count_query_before($event) $partial_read_access_fids = $full_read_access_fids = array(); - foreach($forums_permissions as $forum_id => $forum_permissions) + foreach ($forums_permissions as $forum_id => $forum_permissions) { - if(isset($forum_permissions['f_read']) && + if (isset($forum_permissions['f_read']) && !isset($ex_fid_keys[$forum_id])) { - if(isset($forum_permissions['f_read_others_topics_brunoais'])) + if (isset($forum_permissions['f_read_others_topics_brunoais'])) { $full_read_access_fids[$forum_id] = $forum_id; }else{ @@ -196,7 +196,7 @@ public function search_native_keywords_count_query_before($event) } } - if(sizeof($partial_read_access_fids) > 0) + if (sizeof($partial_read_access_fids) > 0) { // The filter has to be in place $event['total_results'] = false; @@ -217,7 +217,7 @@ public function search_native_keywords_count_query_before($event) 'topic_id' => $topic_id, )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { $event['total_results'] = -1; $event['left_join_topics'] = true; @@ -235,7 +235,7 @@ public function search_postgres_keywords_main_query_before($event) { $topic_id = $event['topic_id']; - if(empty($topic_id)) + if (empty($topic_id)) { $forums_permissions = $this->auth->acl_get_list($this->user->data['user_id'], array('f_read', 'f_read_others_topics_brunoais')); @@ -244,13 +244,13 @@ public function search_postgres_keywords_main_query_before($event) $partial_read_access_fids = $full_read_access_fids = array(); - foreach($forums_permissions as $forum_id => $forum_permissions) + foreach ($forums_permissions as $forum_id => $forum_permissions) { - if(isset($forum_permissions['f_read']) && + if (isset($forum_permissions['f_read']) && !isset($ex_fid_keys[$forum_id])) { - if(isset($forum_permissions['f_read_others_topics_brunoais'])) + if (isset($forum_permissions['f_read_others_topics_brunoais'])) { $full_read_access_fids[$forum_id] = $forum_id; } @@ -261,7 +261,7 @@ public function search_postgres_keywords_main_query_before($event) } } - if(sizeof($partial_read_access_fids) > 0) + if (sizeof($partial_read_access_fids) > 0) { // The filter has to be in place $event['join_topic'] = true; @@ -281,7 +281,7 @@ public function search_postgres_keywords_main_query_before($event) 'topic_id' => $topic_id, )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { $event['join_topic'] = true; @@ -298,12 +298,12 @@ public function search_postgres_keywords_main_query_before($event) private function search_cache_check($search_key_array, $topic_id, $excluding_forums) { - if($topic_id > 0) + if ($topic_id > 0) { $permission_result = $this->permission_evaluation->permission_evaluate(array( 'topic_id' => $topic_id, )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { return array('NoAccessResult'); } @@ -313,12 +313,12 @@ private function search_cache_check($search_key_array, $topic_id, $excluding_for $forums_permissions = $this->auth->acl_get_list($this->user->data['user_id'], array('f_read', 'f_read_others_topics_brunoais')); $ex_fid_keys = array_keys($excluding_forums); - foreach($forums_permissions as $forum_id => $forum_permissions) + foreach ($forums_permissions as $forum_id => $forum_permissions) { - if(isset($forum_permissions['f_read']) && + if (isset($forum_permissions['f_read']) && !isset($ex_fid_keys[$forum_id])) { - if(!isset($forum_permissions['f_read_others_topics_brunoais'])) + if (!isset($forum_permissions['f_read_others_topics_brunoais'])) { $search_key_array[] = (int) $this->user->data['user_id']; return $search_key_array; @@ -365,7 +365,7 @@ public function search_mysql_author_query_before($event) $topic_id = $event['topic_id']; - if(empty($topic_id)) + if (empty($topic_id)) { $forums_permissions = $this->auth->acl_get_list($this->user->data['user_id'], array('f_read', 'f_read_others_topics_brunoais')); @@ -374,13 +374,13 @@ public function search_mysql_author_query_before($event) $partial_read_access_fids = $full_read_access_fids = array(); - foreach($forums_permissions as $forum_id => $forum_permissions) + foreach ($forums_permissions as $forum_id => $forum_permissions) { - if(isset($forum_permissions['f_read']) && + if (isset($forum_permissions['f_read']) && !isset($ex_fid_keys[$forum_id])) { - if(isset($forum_permissions['f_read_others_topics_brunoais'])) + if (isset($forum_permissions['f_read_others_topics_brunoais'])) { $full_read_access_fids[$forum_id] = $forum_id; } @@ -391,7 +391,7 @@ public function search_mysql_author_query_before($event) } } - if(sizeof($partial_read_access_fids) > 0) + if (sizeof($partial_read_access_fids) > 0) { // The filter has to be in place @@ -422,7 +422,7 @@ public function search_mysql_author_query_before($event) 'topic_id' => $topic_id, )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { // Workaround for a mistake I made myself when making the event. @@ -449,7 +449,7 @@ public function search_native_author_count_query_before($event) $topic_id = $event['topic_id']; - if(empty($topic_id)) + if (empty($topic_id)) { $forums_permissions = $this->auth->acl_get_list($this->user->data['user_id'], array('f_read', 'f_read_others_topics_brunoais')); @@ -460,13 +460,13 @@ public function search_native_author_count_query_before($event) $partial_read_access_fids = $full_read_access_fids = array(); - foreach($forums_permissions as $forum_id => $forum_permissions) + foreach ($forums_permissions as $forum_id => $forum_permissions) { - if(isset($forum_permissions['f_read']) && + if (isset($forum_permissions['f_read']) && !isset($ex_fid_keys[$forum_id])) { - if(isset($forum_permissions['f_read_others_topics_brunoais'])) + if (isset($forum_permissions['f_read_others_topics_brunoais'])) { $full_read_access_fids[$forum_id] = $forum_id; } @@ -477,7 +477,7 @@ public function search_native_author_count_query_before($event) } } - if(sizeof($partial_read_access_fids) > 0) + if (sizeof($partial_read_access_fids) > 0) { // The filter has to be in place @@ -506,7 +506,7 @@ public function search_native_author_count_query_before($event) 'topic_id' => $topic_id, )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { // Workaround for a mistake I made myself when making the event. @@ -535,7 +535,7 @@ public function search_postgres_author_count_query_before($event) $topic_id = $event['topic_id']; - if(empty($topic_id)) + if (empty($topic_id)) { $forums_permissions = $this->auth->acl_get_list($this->user->data['user_id'], array('f_read', 'f_read_others_topics_brunoais')); @@ -544,13 +544,13 @@ public function search_postgres_author_count_query_before($event) $partial_read_access_fids = $full_read_access_fids = array(); - foreach($forums_permissions as $forum_id => $forum_permissions) + foreach ($forums_permissions as $forum_id => $forum_permissions) { - if(isset($forum_permissions['f_read']) && + if (isset($forum_permissions['f_read']) && !isset($ex_fid_keys[$forum_id])) { - if(isset($forum_permissions['f_read_others_topics_brunoais'])) + if (isset($forum_permissions['f_read_others_topics_brunoais'])) { $full_read_access_fids[$forum_id] = $forum_id; }else{ @@ -559,7 +559,7 @@ public function search_postgres_author_count_query_before($event) } } - if(sizeof($partial_read_access_fids) > 0) + if (sizeof($partial_read_access_fids) > 0) { // The filter has to be in place @@ -589,7 +589,7 @@ public function search_postgres_author_count_query_before($event) 'topic_id' => $topic_id, )); - if($permission_result === accesses::NO_READ_OTHER) + if ($permission_result === accesses::NO_READ_OTHER) { // Workaround for a mistake I made myself when making the event. diff --git a/shared/permission_evaluation.php b/shared/permission_evaluation.php index cfff2d0..710ab4b 100644 --- a/shared/permission_evaluation.php +++ b/shared/permission_evaluation.php @@ -68,32 +68,32 @@ public function __construct(\phpbb\auth\auth $auth, \phpbb\content_visibility $c */ public function permission_evaluate($info) { - if(empty($info['forum_id'])) + if (empty($info['forum_id'])) { - if(!empty($info['topic_id'])) + if (!empty($info['topic_id'])) { $this->get_forum_id_and_poster_from_topic($info); } - else if(!empty($info['post_id'])) + else if (!empty($info['post_id'])) { $this->get_forum_id_and_poster_from_post($info); } } - if(!$this->auth->acl_get('f_read', $info['forum_id'])) + if (!$this->auth->acl_get('f_read', $info['forum_id'])) { return accesses::NO_READ; } - if(!$this->auth->acl_get('f_read_others_topics_brunoais', $info['forum_id'])) + if (!$this->auth->acl_get('f_read_others_topics_brunoais', $info['forum_id'])) { - if($this->user->data['user_id'] == ANONYMOUS) + if ($this->user->data['user_id'] == ANONYMOUS) { return accesses::NO_READ_OTHER; } - if( + if ( isset($info['topic_type']) && ( $info['topic_type'] == POST_ANNOUNCE || @@ -104,26 +104,26 @@ public function permission_evaluate($info) return accesses::FULL_READ; } - if(!isset($info['topic_poster'])) + if (!isset($info['topic_poster'])) { - if(!isset($info['topic_id'])) + if (!isset($info['topic_id'])) { $this->get_forum_id_and_poster_from_post($info); } $this->get_poster_and_type_from_topic_id($info); } - if($info['topic_poster'] != $this->user->data['user_id']) + if ($info['topic_poster'] != $this->user->data['user_id']) { - if(!isset($info['topic_type'])) + if (!isset($info['topic_type'])) { - if(!isset($info['topic_id'])) + if (!isset($info['topic_id'])) { $this->get_forum_id_and_poster_from_post($info); } $this->get_poster_and_type_from_topic_id($info); } - if( + if ( $info['topic_type'] != POST_ANNOUNCE && $info['topic_type'] != POST_GLOBAL )