[ticket/558] Fix coding guidelines infractions

B3P-558
This commit is contained in:
Marc Alexander
2015-06-03 13:59:26 +02:00
parent 8cdf4a2161
commit 522b4d3087
16 changed files with 76 additions and 76 deletions

View File

@@ -138,7 +138,7 @@ class announcements extends module_base
);
$topic_icons = false;
if(!empty($fetch_news['topic_icons']))
if (!empty($fetch_news['topic_icons']))
{
$topic_icons = true;
}
@@ -182,7 +182,7 @@ class announcements extends module_base
// Get disallowed forums
$disallow_access = $this->modules_helper->get_disallowed_forums($permissions);
if($this->config['board3_announcements_forum_exclude_' . $module_id] == true)
if ($this->config['board3_announcements_forum_exclude_' . $module_id] == true)
{
$disallow_access = array_merge($disallow_access, $forum_from);
$forum_from = array();
@@ -190,18 +190,18 @@ class announcements extends module_base
$global_f = 0;
if(sizeof($forum_from))
if (sizeof($forum_from))
{
$disallow_access = array_diff($forum_from, $disallow_access);
if(!sizeof($disallow_access))
if (!sizeof($disallow_access))
{
return array();
}
foreach($disallow_access as $acc_id)
foreach ($disallow_access as $acc_id)
{
$str_where .= 'forum_id = ' . (int) $acc_id . ' OR ';
if($global_f < 1 && $acc_id > 0)
if ($global_f < 1 && $acc_id > 0)
{
$global_f = $acc_id;
}
@@ -209,7 +209,7 @@ class announcements extends module_base
}
else
{
foreach($disallow_access as $acc_id)
foreach ($disallow_access as $acc_id)
{
$str_where .= 'forum_id <> ' . (int) $acc_id . ' AND ';
}
@@ -247,12 +247,12 @@ class announcements extends module_base
$this->template->assign_block_vars('announcements', $announcements_row);
// Show the announcements overview
if($announcement < 0)
if ($announcement < 0)
{
$count = $fetch_news['topic_count'];
for ($i = 0; $i < $count; $i++)
{
if(isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true)
if (isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true)
{
$open_bracket = '[ ';
$close_bracket = ' ]';
@@ -352,7 +352,7 @@ class announcements extends module_base
$this->pagination->generate_template_pagination($view_topic_url, 'announcements.center_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
if(!empty($fetch_news[$i]['attachments']))
if (!empty($fetch_news[$i]['attachments']))
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
@@ -415,7 +415,7 @@ class announcements extends module_base
$this->pagination->generate_template_pagination($view_topic_url, 'announcements.center_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1, true, true);
if(!empty($fetch_news[$i]['attachments']))
if (!empty($fetch_news[$i]['attachments']))
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{

View File

@@ -230,12 +230,12 @@ class attachments extends module_base
// Get filetypes and put them into an array
$filetypes = $this->get_selected_filetypes($module_id);
if($this->config['board3_attachments_forum_ids_' . $module_id] !== '')
if ($this->config['board3_attachments_forum_ids_' . $module_id] !== '')
{
$attach_forums_config = (strpos($this->config['board3_attachments_forum_ids_' . $module_id], ',') !== false) ? explode(',', $this->config['board3_attachments_forum_ids_' . $module_id]) : array($this->config['board3_attachments_forum_ids_' . $module_id]);
$forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true)));
if($this->config['board3_attachments_forum_exclude_' . $module_id])
if ($this->config['board3_attachments_forum_exclude_' . $module_id])
{
$forum_list = array_unique(array_diff($forum_list, $attach_forums_config));
}
@@ -249,15 +249,15 @@ class attachments extends module_base
$forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true)));
}
if(sizeof($forum_list))
if (sizeof($forum_list))
{
$attach_forums = true;
$where = 'AND ' . $this->db->sql_in_set('t.forum_id', $forum_list);
}
if(sizeof($filetypes))
if (sizeof($filetypes))
{
if($this->config['board3_attachments_exclude_' . $module_id])
if ($this->config['board3_attachments_exclude_' . $module_id])
{
$where .= ' AND ' . $this->db->sql_in_set('a.extension', $filetypes, true);
}
@@ -267,7 +267,7 @@ class attachments extends module_base
}
}
if($attach_forums === true)
if ($attach_forums === true)
{
// Just grab all attachment info from database
$sql = 'SELECT
@@ -328,7 +328,7 @@ class attachments extends module_base
protected function get_selected_filetypes($module_id)
{
$selected = array();
if(isset($this->config['board3_attachments_filetype_' . $module_id]) && strlen($this->config['board3_attachments_filetype_' . $module_id]) > 0)
if (isset($this->config['board3_attachments_filetype_' . $module_id]) && strlen($this->config['board3_attachments_filetype_' . $module_id]) > 0)
{
$selected = explode(',', $this->config['board3_attachments_filetype_' . $module_id]);
}

View File

@@ -81,7 +81,7 @@ class latest_members extends module_base
ORDER BY user_regdate DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_last_member_' . $module_id], 0, 600);
while(($row = $this->db->sql_fetchrow($result)) && ($row['username']))
while (($row = $this->db->sql_fetchrow($result)) && ($row['username']))
{
$this->template->assign_block_vars('latest_members', array(
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),

View File

@@ -93,7 +93,7 @@ class leaders extends module_base
$this->user->add_lang('groups');
$order_legend = ($this->config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
if($this->config['board3_leaders_ext_' . $module_id])
if ($this->config['board3_leaders_ext_' . $module_id])
{
$legends = array();
$groups = array();
@@ -160,9 +160,9 @@ class leaders extends module_base
if (sizeof($groups))
{
foreach($groups as $group_id => $group)
foreach ($groups as $group_id => $group)
{
if(sizeof($group['group_users']))
if (sizeof($group['group_users']))
{
$group_name = ($group['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_' . $group['group_name']] : $group['group_name'];
$u_group = append_sid("{$this->phpbb_root_path}memberlist.{$this->php_ext}", 'mode=group&amp;g=' . $group_id);
@@ -173,7 +173,7 @@ class leaders extends module_base
'U_GROUP' => $u_group,
));
foreach($group['group_users'] as $group_user)
foreach ($group['group_users'] as $group_user)
{
$this->template->assign_block_vars('group.member', array(
'USER_ID' => $group_user['user_id'],

View File

@@ -366,7 +366,7 @@ class main_menu extends module_base
{
$message = $this->user->lang['LINK_ADDED'];
if($link_type != self::LINK_CAT && sizeof($links) < 1)
if ($link_type != self::LINK_CAT && sizeof($links) < 1)
{
trigger_error($this->user->lang['ACP_PORTAL_MENU_CREATE_CAT'] . adm_back_link($u_action), E_USER_WARNING);
}

View File

@@ -139,7 +139,7 @@ class news extends module_base
);
$topic_icons = false;
if(!empty($fetch_news['topic_icons']))
if (!empty($fetch_news['topic_icons']))
{
$topic_icons = true;
}
@@ -179,21 +179,21 @@ class news extends module_base
// Get disallowed forums
$disallow_access = $this->modules_helper->get_disallowed_forums($permissions);
if($this->config['board3_news_exclude_' . $module_id] == true)
if ($this->config['board3_news_exclude_' . $module_id] == true)
{
$disallow_access = array_merge($disallow_access, $forum_from);
$forum_from = array();
}
if(sizeof($forum_from))
if (sizeof($forum_from))
{
$disallow_access = array_diff($forum_from, $disallow_access);
if(!sizeof($disallow_access))
if (!sizeof($disallow_access))
{
return array();
}
foreach($disallow_access as $acc_id)
foreach ($disallow_access as $acc_id)
{
$acc_id = (int) $acc_id;
$str_where .= "forum_id = $acc_id OR ";
@@ -201,7 +201,7 @@ class news extends module_base
}
else
{
foreach($disallow_access as $acc_id)
foreach ($disallow_access as $acc_id)
{
$acc_id = (int) $acc_id;
$str_where .= "forum_id <> $acc_id AND ";
@@ -244,12 +244,12 @@ class news extends module_base
$this->template->assign_block_vars('news', $news_row);
// Show the news overview
if($news < 0)
if ($news < 0)
{
$count = $fetch_news['topic_count'];
for ($i = 0; $i < $count; $i++)
{
if(isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true)
if (isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true)
{
$open_bracket = '[ ';
$close_bracket = ' ]';
@@ -349,7 +349,7 @@ class news extends module_base
// Assign pagination
$this->pagination->generate_template_pagination($view_topic_url, 'news.news_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1);
if(!empty($fetch_news[$i]['attachments']))
if (!empty($fetch_news[$i]['attachments']))
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
@@ -400,7 +400,7 @@ class news extends module_base
$this->pagination->generate_template_pagination($view_topic_url, 'news.news_row.pagination', 'start', $fetch_news[$i]['topic_replies'] + 1, $this->config['posts_per_page'], 1);
if(!empty($fetch_news[$i]['attachments']))
if (!empty($fetch_news[$i]['attachments']))
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
@@ -418,7 +418,7 @@ class news extends module_base
'GOTO_PAGE_IMG' => $this->user->img('icon_post_target', 'GOTO_PAGE'),
));
if($this->config['board3_news_style_' . $module_id])
if ($this->config['board3_news_style_' . $module_id])
{
return 'news_compact_center.html';
}

View File

@@ -177,7 +177,7 @@ class poll extends module_base
$this->user->add_lang('viewtopic');
// check if we need to include the bbcode class
if(!class_exists('bbcode'))
if (!class_exists('bbcode'))
{
include($this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext);
}
@@ -234,7 +234,7 @@ class poll extends module_base
$topic_data['topic_status'] != ITEM_LOCKED &&
$topic_data['forum_status'] != ITEM_LOCKED) ? true : false;
if($s_can_up_vote)
if ($s_can_up_vote)
{
$redirect_url = $this->modules_helper->route('board3_portal_controller');
@@ -327,11 +327,11 @@ class poll extends module_base
// Get readable forums
$forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true)));
if($this->config['board3_poll_topic_id_' . $module_id] !== '')
if ($this->config['board3_poll_topic_id_' . $module_id] !== '')
{
$poll_forums_config = explode(',' ,$this->config['board3_poll_topic_id_' . $module_id]);
if($this->config['board3_poll_exclude_id_' . $module_id])
if ($this->config['board3_poll_exclude_id_' . $module_id])
{
$forum_list = array_unique(array_diff($forum_list, $poll_forums_config));
}
@@ -343,7 +343,7 @@ class poll extends module_base
$where = '';
if(sizeof($forum_list))
if (sizeof($forum_list))
{
$poll_forums = true;
$where = 'AND ' . $this->db->sql_in_set('t.forum_id', $forum_list);
@@ -375,7 +375,7 @@ class poll extends module_base
if ($result)
{
while($data = $this->db->sql_fetchrow($result))
while ($data = $this->db->sql_fetchrow($result))
{
$has_poll = true;
$poll_has_options = false;
@@ -384,7 +384,7 @@ class poll extends module_base
$forum_id = (int) $data['forum_id'];
$cur_voted_id = array();
if($this->config['board3_poll_allow_vote_' . $module_id])
if ($this->config['board3_poll_allow_vote_' . $module_id])
{
if ($this->user->data['is_registered'])
{
@@ -436,7 +436,7 @@ class poll extends module_base
if ($poll_result)
{
while($polls_data = $this->db->sql_fetchrow($poll_result))
while ($polls_data = $this->db->sql_fetchrow($poll_result))
{
$poll_has_options = true;
$poll_data[] = $polls_data;
@@ -447,7 +447,7 @@ class poll extends module_base
$make_poll_view = array();
if(in_array($topic_id, $poll_view_ar) === false)
if (in_array($topic_id, $poll_view_ar) === false)
{
$make_poll_view[] = $topic_id;
$make_poll_view = array_merge($poll_view_ar, $make_poll_view);
@@ -497,7 +497,7 @@ class poll extends module_base
'U_VIEW_TOPIC' => $viewtopic_url,
));
foreach($poll_data as $pd)
foreach ($poll_data as $pd)
{
$option_pct = ($poll_total_votes > 0) ? $pd['poll_option_total'] / $poll_total_votes : 0;
$option_pct_txt = sprintf("%.1d%%", round($option_pct * 100));

View File

@@ -138,7 +138,7 @@ class recent extends module_base
ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0 , 600);
while(($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
while (($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
{
// auto auth
if (($this->auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
@@ -164,7 +164,7 @@ class recent extends module_base
ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 600);
while(($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
while (($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
{
// auto auth
if (($this->auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))
@@ -191,7 +191,7 @@ class recent extends module_base
ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 600);
while(($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
while (($row = $this->db->sql_fetchrow($result)) && ($row['topic_title']))
{
// auto auth
if (($this->auth->acl_get('f_read', $row['forum_id'])) || ($row['forum_id'] == '0'))

View File

@@ -106,7 +106,7 @@ class stylechanger extends module_base
$style_select .= '<option value="' . $url . '"' . ($row['style_id'] == $this->user->style['style_id'] ? ' selected="selected"' : '') . '>' . utf8_htmlspecialchars($row['style_name']) . '</option>';
}
$this->db->sql_freeresult($result);
if(strlen($style_select))
if (strlen($style_select))
{
$this->template->assign_var('STYLE_SELECT', $style_select);
}

View File

@@ -187,7 +187,7 @@ class welcome extends module_base
generate_text_for_storage($welcome_message, $uid, $bitfield, $flags, true, true, true);
// first check for obvious errors, we don't want to waste server resources
if(empty($welcome_message))
if (empty($welcome_message))
{
trigger_error($this->user->lang['ACP_PORTAL_WELCOME_MESSAGE_SHORT']. adm_back_link($u_action), E_USER_WARNING);
}
@@ -217,7 +217,7 @@ class welcome extends module_base
// Edit or add menu item
case 'reset':
default:
if(!isset($welcome_message))
if (!isset($welcome_message))
{
$welcome_message = generate_text_for_edit($portal_config['board3_welcome_message_' . $module_id], $this->config['board3_welcome_message_uid_' . $module_id], '');
}
@@ -235,7 +235,7 @@ class welcome extends module_base
'MAX_FONT_SIZE' => (int) $this->config['max_post_font_size'],
));
if(!function_exists('display_forums'))
if (!function_exists('display_forums'))
{
include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext);
}