[ticket/382] Code clean up in modules

B3P-382
This commit is contained in:
Marc Alexander
2014-10-31 07:49:46 +01:00
parent a4336cfff2
commit 5f04c9a2bb
5 changed files with 6 additions and 12 deletions

View File

@@ -119,6 +119,7 @@ class news extends module_base
$this->user->add_lang('viewforum');
$start = $this->request->variable('np', 0);
$start = ($start < 0) ? 0 : $start;
$total_news = 1;
// Fetch news from portal functions.php with check if "read full" is requested.
$portal_news_length = ($news < 0) ? $this->config['board3_news_length_' . $module_id] : 0;
@@ -234,7 +235,7 @@ class news extends module_base
}
$replies = ($this->auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
$folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
switch ($fetch_news[$i]['topic_type'])
{
case POST_STICKY:
@@ -325,7 +326,7 @@ class news extends module_base
if ($this->config['board3_number_of_news_' . $module_id] <> 0 && $this->config['board3_news_archive_' . $module_id])
{
$this->template->assign_vars(array(
'NP_PAGINATION' => $pagination,
'NP_PAGINATION' => (!empty($pagination)) ? $pagination : '',
'TOTAL_NEWS' => ($total_news == 1) ? sprintf($this->user->lang['VIEW_FORUM_TOPICS'][1], $total_news) : sprintf($this->user->lang['VIEW_FORUM_TOPICS'][2], $total_news),
'NP_PAGE_NUMBER' => $this->pagination->on_page($total_news, $this->config['board3_number_of_news_' . $module_id], $start))
);

View File

@@ -209,7 +209,7 @@ class poll extends module_base
// Cookie based guest tracking ... I don't like this but hum ho
// it's oft requested. This relies on "nice" users who don't feel
// the need to delete cookies to mess with results.
if ($request->is_set($this->config['cookie_name'] . '_poll_' . $up_topic_id, \phpbb\request\request_interface::COOKIE))
if ($this->request->is_set($this->config['cookie_name'] . '_poll_' . $up_topic_id, \phpbb\request\request_interface::COOKIE))
{
$cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'] . '_poll_' . $up_topic_id, '', true, \phpbb\request\request_interface::COOKIE));
$cur_voted_id = array_map('intval', $cur_voted_id);
@@ -317,12 +317,9 @@ class poll extends module_base
}
}
$where = '';
$poll_forums = false;
// Get readable forums
$forum_list = array();
$forum_list = array_unique(array_keys($this->auth->acl_getf('f_read', true)));
if($this->config['board3_poll_topic_id_' . $module_id] !== '')

View File

@@ -108,7 +108,7 @@ class random_member extends module_base
$avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($row, 'user'), 'USER_AVATAR');
$rank_title = $rank_img = '';
$rank_title = $rank_img = $rank_img_src = '';
get_user_rank($row['user_rank'], $row['user_posts'], $rank_title, $rank_img, $rank_img_src);
$username = $row['username'];

View File

@@ -113,7 +113,6 @@ class user_menu extends module_base
if ($this->auth->acl_get('m_approve'))
{
$m_approve_fid_ary = array(-1);
$m_approve_fid_sql = '';
}
else if ($this->auth->acl_getf_global('m_approve'))
@@ -123,7 +122,6 @@ class user_menu extends module_base
}
else
{
$m_approve_fid_ary = array();
$m_approve_fid_sql = ' AND p.post_visibility = 1';
}
@@ -141,7 +139,6 @@ class user_menu extends module_base
$sql_where = 'AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . ((sizeof($ex_fid_ary)) ? 'AND ' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
$unread_list = array();
$unread_list = get_unread_topics($this->user->data['user_id'], $sql_where, 'ORDER BY t.topic_id DESC');
$unread_posts_count = sizeof($unread_list);
@@ -150,7 +147,7 @@ class user_menu extends module_base
$username = $this->user->data['username'];
$colour = $this->user->data['user_colour'];
$avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($this->user->data, 'user'), 'USER_AVATAR');
$rank_title = $rank_img = '';
$rank_title = $rank_img = $rank_img_src = '';
\get_user_rank($this->user->data['user_rank'], $this->user->data['user_posts'], $rank_title, $rank_img, $rank_img_src);
// Assign specific vars

View File

@@ -184,7 +184,6 @@ class welcome extends module_base
$welcome_message = $this->request->variable('welcome_message', '', true);
$uid = $bitfield = $flags = '';
$options = 7;
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