Update modules code with small fixes and improvements

This commit is contained in:
Marc Alexander
2023-02-13 20:24:54 +01:00
parent ccd7e27410
commit 46a9e89db2
17 changed files with 64 additions and 59 deletions

View File

@@ -223,8 +223,8 @@ class announcements extends module_base
OR topic_type = ' . POST_ANNOUNCE . ') OR topic_type = ' . POST_ANNOUNCE . ')
AND topic_visibility = 1 AND topic_visibility = 1
AND topic_moved_id = 0 AND topic_moved_id = 0
' . $post_time . ' ' . $this->db->sql_escape($post_time) . '
' . $str_where; ' . $this->db->sql_escape($str_where);
$result = $this->db->sql_query($sql, 30); $result = $this->db->sql_query($sql, 30);
$total_announcements = (int) $this->db->sql_fetchfield('num_topics'); $total_announcements = (int) $this->db->sql_fetchfield('num_topics');
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
@@ -317,6 +317,7 @@ class announcements extends module_base
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '', 'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '',
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '', 'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
'TITLE' => $fetch_news[$i]['topic_title'], 'TITLE' => $fetch_news[$i]['topic_title'],
'MINI_POST' => $unread_topic ? $this->user->lang['UNREAD_POST'] : $this->user->lang['POST'],
'POSTER' => $fetch_news[$i]['username'], 'POSTER' => $fetch_news[$i]['username'],
'POSTER_FULL' => $fetch_news[$i]['username_full'], 'POSTER_FULL' => $fetch_news[$i]['username_full'],
'USERNAME_FULL_LAST' => $fetch_news[$i]['username_full_last'], 'USERNAME_FULL_LAST' => $fetch_news[$i]['username_full_last'],
@@ -447,9 +448,9 @@ class announcements extends module_base
'vars' => array( 'vars' => array(
'legend1' => 'ACP_PORTAL_ANNOUNCE_SETTINGS', 'legend1' => 'ACP_PORTAL_ANNOUNCE_SETTINGS',
'board3_announcements_style_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_STYLE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_announcements_style_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_STYLE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_number_of_announcements_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_number_of_announcements_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
'board3_announcements_day_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_announcements_day_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
'board3_announcements_length_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_announcements_length_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
'board3_global_announcements_forum_' . $module_id => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')), 'board3_global_announcements_forum_' . $module_id => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
'board3_announcements_forum_exclude_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_FORUM_EXCLUDE', 'validate' => 'string', 'type' => 'radio:yes_no', 'explain' => true), 'board3_announcements_forum_exclude_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_FORUM_EXCLUDE', 'validate' => 'string', 'type' => 'radio:yes_no', 'explain' => true),
'board3_announcements_archive_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_announcements_archive_' . $module_id => array('lang' => 'PORTAL_ANNOUNCEMENTS_ARCHIVE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),

View File

@@ -115,18 +115,18 @@ class attachments extends module_base
*/ */
public function get_template_acp($module_id) public function get_template_acp($module_id)
{ {
return array( return [
'title' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS', 'title' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
'vars' => array( 'vars' => [
'legend1' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS', 'legend1' => 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
'board3_attachments_number_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_NUMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_attachments_number_' . $module_id => ['lang' => 'PORTAL_ATTACHMENTS_NUMBER' , 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true],
'board3_attach_max_length_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_MAX_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_attach_max_length_' . $module_id => ['lang' => 'PORTAL_ATTACHMENTS_MAX_LENGTH', 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true],
'board3_attachments_forum_ids_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FORUM_IDS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')), 'board3_attachments_forum_ids_' . $module_id => ['lang' => 'PORTAL_ATTACHMENTS_FORUM_IDS', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => ['board3.portal.modules_helper', 'generate_forum_select'], 'submit' => ['board3.portal.modules_helper', 'store_selected_forums']],
'board3_attachments_forum_exclude_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FORUM_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_attachments_forum_exclude_' . $module_id => ['lang' => 'PORTAL_ATTACHMENTS_FORUM_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
'board3_attachments_filetype_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_FILETYPE', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_filetype', 'submit' => 'store_filetypes'), 'board3_attachments_filetype_' . $module_id => ['lang' => 'PORTAL_ATTACHMENTS_FILETYPE', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_filetype', 'submit' => 'store_filetypes'],
'board3_attachments_exclude_' . $module_id => array('lang' => 'PORTAL_ATTACHMENTS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_attachments_exclude_' . $module_id => ['lang' => 'PORTAL_ATTACHMENTS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
), ],
); ];
} }
/** /**
@@ -279,7 +279,7 @@ class attachments extends module_base
WHERE WHERE
a.topic_id <> 0 a.topic_id <> 0
AND a.topic_id = t.topic_id AND a.topic_id = t.topic_id
' . $where . ' ' . $this->db->sql_escape($where) . '
ORDER BY ORDER BY
filetime ' . ((!$this->config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC'; filetime ' . ((!$this->config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_attachments_number_' . $module_id], 0, 600); $result = $this->db->sql_query_limit($sql, $this->config['board3_attachments_number_' . $module_id], 0, 600);

View File

@@ -114,12 +114,12 @@ class birthday_list extends module_base
), ),
'WHERE' => "(b.ban_id IS NULL 'WHERE' => "(b.ban_id IS NULL
OR b.ban_exclude = 1) OR b.ban_exclude = 1)
AND (u.user_birthday " . $this->db->sql_like_expression($this->db->get_any_char() . sprintf('%2d-%2d-', $now['mday'], $now['mon']) . $this->db->get_any_char()) . " {$sql_days}) AND (u.user_birthday " . $this->db->sql_like_expression($this->db->get_any_char() . sprintf('%2d-%2d-', $this->db->sql_escape($now['mday']), $this->db->sql_escape($now['mon'])) . $this->db->get_any_char()) . " {$sql_days})
AND " . $this->db->sql_in_set('u.user_type', array(USER_NORMAL , USER_FOUNDER)), AND " . $this->db->sql_in_set('u.user_type', array(USER_NORMAL , USER_FOUNDER)),
'ORDER BY' => $order_by, 'ORDER BY' => $order_by,
); );
$sql = $this->db->sql_build_query('SELECT', $sql_array); $sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql, 300); $result = $this->db->sql_query($sql, 15);
$today = sprintf('%2d-%2d-', $now['mday'], $now['mon']); $today = sprintf('%2d-%2d-', $now['mday'], $now['mon']);
while ($row = $this->db->sql_fetchrow($result)) while ($row = $this->db->sql_fetchrow($result))
@@ -166,7 +166,7 @@ class birthday_list extends module_base
'title' => 'ACP_PORTAL_BIRTHDAYS_SETTINGS', 'title' => 'ACP_PORTAL_BIRTHDAYS_SETTINGS',
'vars' => array( 'vars' => array(
'legend1' => 'ACP_PORTAL_BIRTHDAYS_SETTINGS', 'legend1' => 'ACP_PORTAL_BIRTHDAYS_SETTINGS',
'board3_birthdays_ahead_' . $module_id => array('lang' => 'PORTAL_BIRTHDAYS_AHEAD', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_birthdays_ahead_' . $module_id => ['lang' => 'PORTAL_BIRTHDAYS_AHEAD', 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true],
), ),
); );
} }

View File

@@ -193,14 +193,14 @@ class calendar extends module_base
$this->template->assign_block_vars('minical', array( $this->template->assign_block_vars('minical', array(
'S_SUNDAY_FIRST' => ($this->config['board3_sunday_first_' . $module_id]) ? true : false, 'S_SUNDAY_FIRST' => ($this->config['board3_sunday_first_' . $module_id]) ? true : false,
'L_MINI_CAL_MONTH' => (($this->config['board3_long_month_' . $module_id]) ? $this->user->lang(['mini_cal', 'long_month'], $this->day[0][1]) : $this->user->lang(['mini_cal', 'month'], $this->day[0][1])) . " " . $this->day[0][2], 'L_MINI_CAL_MONTH' => (($this->config['board3_long_month_' . $module_id]) ? $this->user->lang['mini_cal']['long_month'][$this->day[0][1]] : $this->user->lang['mini_cal']['month'][$this->day[0][1]]) . " " . $this->day[0][2],
'L_MINI_CAL_SUN' => '<span style="color: ' . $this->config['board3_calendar_sunday_color_' . $module_id] . ';">' . $this->user->lang(['mini_cal', 'day'], 1) . '</span>', 'L_MINI_CAL_SUN' => '<span style="color: ' . $this->config['board3_calendar_sunday_color_' . $module_id] . ';">' . $this->user->lang['mini_cal']['day'][1] . '</span>',
'L_MINI_CAL_MON' => $this->user->lang(['mini_cal', 'day'], 2), 'L_MINI_CAL_MON' => $this->user->lang['mini_cal']['day'][2],
'L_MINI_CAL_TUE' => $this->user->lang(['mini_cal', 'day'], 3), 'L_MINI_CAL_TUE' => $this->user->lang['mini_cal']['day'][3],
'L_MINI_CAL_WED' => $this->user->lang(['mini_cal', 'day'], 4), 'L_MINI_CAL_WED' => $this->user->lang['mini_cal']['day'][4],
'L_MINI_CAL_THU' => $this->user->lang(['mini_cal', 'day'], 5), 'L_MINI_CAL_THU' => $this->user->lang['mini_cal']['day'][5],
'L_MINI_CAL_FRI' => $this->user->lang(['mini_cal', 'day'], 6), 'L_MINI_CAL_FRI' => $this->user->lang['mini_cal']['day'][6],
'L_MINI_CAL_SAT' => $this->user->lang(['mini_cal', 'day'], 7), 'L_MINI_CAL_SAT' => $this->user->lang['mini_cal']['day'][7],
'U_PREV_MONTH' => $prev_month, 'U_PREV_MONTH' => $prev_month,
'U_NEXT_MONTH' => $next_month, 'U_NEXT_MONTH' => $next_month,
'S_DISPLAY_EVENTS' => ($this->config['board3_display_events_' . $module_id]) ? true : false, 'S_DISPLAY_EVENTS' => ($this->config['board3_display_events_' . $module_id]) ? true : false,
@@ -503,7 +503,7 @@ class calendar extends module_base
'end_time' => $end_time, 'end_time' => $end_time,
'all_day' => $event_all_day, 'all_day' => $event_all_day,
'permission' => $event_permission, 'permission' => $event_permission,
'url' => htmlspecialchars_decode($event_url), 'url' => htmlentities($event_url, ENT_QUOTES | ENT_SUBSTITUTE),
); );
$this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_EVENT_UPDATED', false, array($event_title)); $this->log->add('admin', $this->user->data['user_id'], $this->user->data['user_ip'], 'LOG_PORTAL_EVENT_UPDATED', false, array($event_title));

View File

@@ -214,7 +214,7 @@ class custom extends module_base
// first check for obvious errors, we don't want to waste server resources // first check for obvious errors, we don't want to waste server resources
if (empty($custom_code)) if (empty($custom_code))
{ {
trigger_error($this->user->lang['ACP_PORTAL_CUSTOM_CODE_SHORT']. adm_back_link($u_action), E_USER_WARNING); trigger_error($this->user->lang['TOO_FEW_CHARS']. adm_back_link($u_action), E_USER_WARNING);
} }
// get groups and check if the selected groups actually exist // get groups and check if the selected groups actually exist

View File

@@ -98,7 +98,7 @@ class friends extends module_base
) )
), ),
'WHERE' => 'z.user_id = ' . $this->user->data['user_id'] . ' 'WHERE' => 'z.user_id = ' . (int) $this->user->data['user_id'] . '
AND z.friend = 1 AND z.friend = 1
AND u.user_id = z.zebra_id', AND u.user_id = z.zebra_id',
'GROUP_BY' => 'z.zebra_id, u.user_id, u.username, u.username_clean, u.user_allow_viewonline, u.user_colour', 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username, u.username_clean, u.user_allow_viewonline, u.user_colour',
@@ -139,7 +139,7 @@ class friends extends module_base
'title' => 'ACP_PORTAL_FRIENDS_SETTINGS', 'title' => 'ACP_PORTAL_FRIENDS_SETTINGS',
'vars' => array( 'vars' => array(
'legend1' => 'ACP_PORTAL_FRIENDS_SETTINGS', 'legend1' => 'ACP_PORTAL_FRIENDS_SETTINGS',
'board3_max_online_friends_' . $module_id => array('lang' => 'PORTAL_MAX_ONLINE_FRIENDS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_max_online_friends_' . $module_id => array('lang' => 'PORTAL_MAX_ONLINE_FRIENDS', 'validate' => 'int', 'type' => 'number:1:999', 'explain' => true),
) )
); );
} }

View File

@@ -114,7 +114,7 @@ class latest_bots extends module_base
'title' => 'ACP_PORTAL_BOTS_SETTINGS', 'title' => 'ACP_PORTAL_BOTS_SETTINGS',
'vars' => array( 'vars' => array(
'legend1' => 'ACP_PORTAL_BOTS_SETTINGS', 'legend1' => 'ACP_PORTAL_BOTS_SETTINGS',
'board3_last_visited_bots_number_' . $module_id => array('lang' => 'PORTAL_LAST_VISITED_BOTS_NUMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_last_visited_bots_number_' . $module_id => array('lang' => 'PORTAL_LAST_VISITED_BOTS_NUMBER' , 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
) )
); );
} }

View File

@@ -102,7 +102,7 @@ class latest_members extends module_base
'title' => 'ACP_PORTAL_MEMBERS_SETTINGS', 'title' => 'ACP_PORTAL_MEMBERS_SETTINGS',
'vars' => array( 'vars' => array(
'legend1' => 'ACP_PORTAL_MEMBERS_SETTINGS', 'legend1' => 'ACP_PORTAL_MEMBERS_SETTINGS',
'board3_max_last_member_' . $module_id => array('lang' => 'PORTAL_MAX_LAST_MEMBER' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_max_last_member_' . $module_id => array('lang' => 'PORTAL_MAX_LAST_MEMBER' , 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
) )
); );
} }

View File

@@ -116,7 +116,7 @@ class leaders extends module_base
AND ug.user_pending = 0 AND ug.user_pending = 0
) )
WHERE g.group_legend >= 1 WHERE g.group_legend >= 1
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $this->user->data['user_id'] . ') AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . (int) $this->user->data['user_id'] . ')
ORDER BY g.' . $order_legend . ' ASC'; ORDER BY g.' . $order_legend . ' ASC';
} }
$result = $this->db->sql_query($sql, 600); $result = $this->db->sql_query($sql, 600);

View File

@@ -75,7 +75,8 @@ class link_us extends module_base
// Assign specific vars // Assign specific vars
$this->template->assign_vars(array( $this->template->assign_vars(array(
'LINK_US_TXT' => sprintf($this->user->lang['LINK_US_TXT'], $this->config['sitename']), 'LINK_US_TXT' => sprintf($this->user->lang['LINK_US_TXT'], $this->config['sitename']),
'U_LINK_US' => '&lt;a&nbsp;href=&quot;' . $u_link . '&quot;&nbsp;' . (($this->config['site_desc']) ? 'title=&quot;' . $this->config['site_desc'] . '&quot;' : '' ) . '&gt;' . (($this->config['sitename']) ? $this->config['sitename'] : $u_link ) . '&lt;/a&gt;', 'U_LINK_US_HTML' => '&lt;a&nbsp;href=&quot;' . $u_link . '&quot;&nbsp;' . (($this->config['sitename']) ? 'title=&quot;' . $this->config['sitename'] . '&quot;' : '' ) . '&gt;' . (($this->config['sitename']) ? $this->config['sitename'] : $u_link ) . '&lt;/a&gt;',
'U_LINK_US_BB' => '[url=' . $u_link . ']' . (($this->config['sitename']) ? $this->config['sitename'] : $u_link ) . '[/url]',
)); ));
return 'link_us_side.html'; return 'link_us_side.html';

View File

@@ -299,7 +299,7 @@ class links extends module_base
$links[$link_id] = array( $links[$link_id] = array(
'title' => $link_title, 'title' => $link_title,
'url' => htmlspecialchars_decode($link_url), 'url' => htmlentities($link_url, ENT_QUOTES | ENT_SUBSTITUTE),
'type' => $link_type, 'type' => $link_type,
'permission' => $link_permissions, 'permission' => $link_permissions,
); );
@@ -312,7 +312,7 @@ class links extends module_base
$links[] = array( $links[] = array(
'title' => $link_title, 'title' => $link_title,
'url' => htmlspecialchars_decode($link_url), 'url' => htmlentities($link_url, ENT_QUOTES | ENT_SUBSTITUTE),
'type' => $link_type, 'type' => $link_type,
'permission' => $link_permissions, 'permission' => $link_permissions,
); );

View File

@@ -355,7 +355,7 @@ class main_menu extends module_base
$links[$link_id] = array( $links[$link_id] = array(
'title' => $link_title, 'title' => $link_title,
'url' => htmlspecialchars_decode($link_url), 'url' => htmlentities($link_url, ENT_QUOTES | ENT_SUBSTITUTE),
'type' => $link_type, 'type' => $link_type,
'permission' => $link_permissions, 'permission' => $link_permissions,
); );
@@ -372,7 +372,7 @@ class main_menu extends module_base
} }
$links[] = array( $links[] = array(
'title' => $link_title, 'title' => $link_title,
'url' => htmlspecialchars_decode($link_url), 'url' => htmlentities($link_url, ENT_QUOTES | ENT_SUBSTITUTE),
'type' => $link_type, 'type' => $link_type,
'permission' => $link_permissions, 'permission' => $link_permissions,
); );

View File

@@ -313,6 +313,7 @@ class news extends module_base
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '', 'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment'] && $this->config['allow_attachments']) ? $this->user->img('icon_topic_attach', $this->user->lang['TOTAL_ATTACHMENTS']) : '',
'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '', 'FORUM_NAME' => ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
'TITLE' => $fetch_news[$i]['topic_title'], 'TITLE' => $fetch_news[$i]['topic_title'],
'MINI_POST' => $unread_topic ? $this->user->lang['UNREAD_POST'] : $this->user->lang['POST'],
'POSTER' => $fetch_news[$i]['username'], 'POSTER' => $fetch_news[$i]['username'],
'POSTER_FULL' => $fetch_news[$i]['username_full'], 'POSTER_FULL' => $fetch_news[$i]['username_full'],
'USERNAME_FULL_LAST' => $fetch_news[$i]['username_full_last'], 'USERNAME_FULL_LAST' => $fetch_news[$i]['username_full_last'],
@@ -439,8 +440,8 @@ class news extends module_base
'legend1' => 'ACP_PORTAL_NEWS_SETTINGS', 'legend1' => 'ACP_PORTAL_NEWS_SETTINGS',
'board3_news_style_' . $module_id => array('lang' => 'PORTAL_NEWS_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_news_style_' . $module_id => array('lang' => 'PORTAL_NEWS_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_show_all_news_' . $module_id => array('lang' => 'PORTAL_SHOW_ALL_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_show_all_news_' . $module_id => array('lang' => 'PORTAL_SHOW_ALL_NEWS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_number_of_news_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_NEWS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_number_of_news_' . $module_id => array('lang' => 'PORTAL_NUMBER_OF_NEWS', 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
'board3_news_length_' . $module_id => array('lang' => 'PORTAL_NEWS_LENGTH', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_news_length_' . $module_id => array('lang' => 'PORTAL_NEWS_LENGTH', 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
'board3_news_forum_' . $module_id => array('lang' => 'PORTAL_NEWS_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')), 'board3_news_forum_' . $module_id => array('lang' => 'PORTAL_NEWS_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
'board3_news_exclude_' . $module_id => array('lang' => 'PORTAL_NEWS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_news_exclude_' . $module_id => array('lang' => 'PORTAL_NEWS_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_news_show_last_' . $module_id => array('lang' => 'PORTAL_NEWS_SHOW_LAST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_news_show_last_' . $module_id => array('lang' => 'PORTAL_NEWS_SHOW_LAST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),

View File

@@ -127,7 +127,7 @@ class poll extends module_base
'legend1' => 'ACP_PORTAL_POLLS_SETTINGS', 'legend1' => 'ACP_PORTAL_POLLS_SETTINGS',
'board3_poll_topic_id_' . $module_id => array('lang' => 'PORTAL_POLL_TOPIC_ID' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')), 'board3_poll_topic_id_' . $module_id => array('lang' => 'PORTAL_POLL_TOPIC_ID' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
'board3_poll_exclude_id_' . $module_id => array('lang' => 'PORTAL_POLL_EXCLUDE_ID' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_poll_exclude_id_' . $module_id => array('lang' => 'PORTAL_POLL_EXCLUDE_ID' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_poll_limit_' . $module_id => array('lang' => 'PORTAL_POLL_LIMIT' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_poll_limit_' . $module_id => array('lang' => 'PORTAL_POLL_LIMIT' , 'validate' => 'int', 'type' => 'number:1:999', 'explain' => true),
'board3_poll_allow_vote_' . $module_id => array('lang' => 'PORTAL_POLL_ALLOW_VOTE' , 'validate' => 'ibool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_poll_allow_vote_' . $module_id => array('lang' => 'PORTAL_POLL_ALLOW_VOTE' , 'validate' => 'ibool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_poll_hide_' . $module_id => array('lang' => 'PORTAL_POLL_HIDE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_poll_hide_' . $module_id => array('lang' => 'PORTAL_POLL_HIDE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
) )
@@ -474,6 +474,7 @@ class poll extends module_base
} }
$data['poll_title'] = censor_text($data['poll_title']); $data['poll_title'] = censor_text($data['poll_title']);
decode_message($data['poll_title'], $data['bbcode_uid']);
if ($poll_bbcode !== false) if ($poll_bbcode !== false)
{ {
@@ -517,6 +518,7 @@ class poll extends module_base
} }
$pd['poll_option_text'] = censor_text($pd['poll_option_text']); $pd['poll_option_text'] = censor_text($pd['poll_option_text']);
decode_message($pd['poll_option_text'], $data['bbcode_uid']);
if ($poll_bbcode !== false) if ($poll_bbcode !== false)
{ {
@@ -542,7 +544,7 @@ class poll extends module_base
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
$this->template->assign_vars(array( $this->template->assign_vars(array(
'S_HAS_POLL' => $has_poll, 'S_HAS_B3P_POLL' => $has_poll,
'POLL_LEFT_CAP_IMG' => $this->user->img('poll_left'), 'POLL_LEFT_CAP_IMG' => $this->user->img('poll_left'),
'POLL_RIGHT_CAP_IMG' => $this->user->img('poll_right'), 'POLL_RIGHT_CAP_IMG' => $this->user->img('poll_right'),
)); ));

View File

@@ -134,7 +134,7 @@ class recent extends module_base
AND topic_visibility = ' . ITEM_APPROVED . ' AND topic_visibility = ' . ITEM_APPROVED . '
AND (topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ') AND (topic_type = ' . POST_ANNOUNCE . ' OR topic_type = ' . POST_GLOBAL . ')
AND topic_moved_id = 0 AND topic_moved_id = 0
' . $sql_where . $forum_sql . ' ' . $this->db->sql_escape($sql_where) . $this->db->sql_escape($forum_sql) . '
ORDER BY topic_time DESC'; ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0 , 30); $result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0 , 30);
@@ -158,9 +158,9 @@ class recent extends module_base
$sql = 'SELECT topic_title, forum_id, topic_id $sql = 'SELECT topic_title, forum_id, topic_id
FROM ' . TOPICS_TABLE . ' t FROM ' . TOPICS_TABLE . ' t
WHERE topic_visibility = ' . ITEM_APPROVED . ' WHERE topic_visibility = ' . ITEM_APPROVED . '
AND topic_posts_approved >' . $this->config['hot_threshold'] . ' AND topic_posts_approved >' . (int) $this->config['hot_threshold'] . '
AND topic_moved_id = 0 AND topic_moved_id = 0
' . $sql_where . $forum_sql . ' ' . $this->db->sql_escape($sql_where) . $this->db->sql_escape($forum_sql) . '
ORDER BY topic_time DESC'; ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 30); $result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 30);
@@ -187,7 +187,7 @@ class recent extends module_base
AND topic_visibility = ' . ITEM_APPROVED . ' AND topic_visibility = ' . ITEM_APPROVED . '
AND topic_type = ' . POST_NORMAL . ' AND topic_type = ' . POST_NORMAL . '
AND topic_moved_id = 0 AND topic_moved_id = 0
' . $sql_where . $forum_sql . ' ' . $this->db->sql_escape($sql_where) . $this->db->sql_escape($forum_sql) . '
ORDER BY topic_time DESC'; ORDER BY topic_time DESC';
$result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 30); $result = $this->db->sql_query_limit($sql, $this->config['board3_max_topics_' . $module_id], 0, 30);
@@ -217,8 +217,8 @@ class recent extends module_base
'title' => 'ACP_PORTAL_RECENT_SETTINGS', 'title' => 'ACP_PORTAL_RECENT_SETTINGS',
'vars' => array( 'vars' => array(
'legend1' => 'ACP_PORTAL_RECENT_SETTINGS', 'legend1' => 'ACP_PORTAL_RECENT_SETTINGS',
'board3_max_topics_' . $module_id => array('lang' => 'PORTAL_MAX_TOPIC', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_max_topics_' . $module_id => array('lang' => 'PORTAL_MAX_TOPIC', 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
'board3_recent_title_limit_' . $module_id => array('lang' => 'PORTAL_RECENT_TITLE_LIMIT', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_recent_title_limit_' . $module_id => array('lang' => 'PORTAL_RECENT_TITLE_LIMIT', 'validate' => 'int', 'type' => 'number:0:999', 'explain' => true),
'board3_recent_forum_' . $module_id => array('lang' => 'PORTAL_RECENT_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')), 'board3_recent_forum_' . $module_id => array('lang' => 'PORTAL_RECENT_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => array('board3.portal.modules_helper', 'generate_forum_select'), 'submit' => array('board3.portal.modules_helper', 'store_selected_forums')),
'board3_recent_exclude_forums_' . $module_id => array('lang' => 'PORTAL_EXCLUDE_FORUM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'board3_recent_exclude_forums_' . $module_id => array('lang' => 'PORTAL_EXCLUDE_FORUM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
) )

View File

@@ -89,11 +89,11 @@ class topposters extends module_base
while (($row = $this->db->sql_fetchrow($result))) while (($row = $this->db->sql_fetchrow($result)))
{ {
$this->template->assign_block_vars('topposters', array( $this->template->assign_block_vars('topposters', [
'S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'author_id=' . $row['user_id'] . '&amp;sr=posts'), 'S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'author_id=' . $row['user_id'] . '&amp;sr=posts'),
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'POSTER_POSTS' => $row['user_posts'], 'POSTER_POSTS' => $row['user_posts'],
)); ]);
} }
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
@@ -105,13 +105,13 @@ class topposters extends module_base
*/ */
public function get_template_acp($module_id) public function get_template_acp($module_id)
{ {
return array( return [
'title' => 'TOPPOSTERS_CONFIG', 'title' => 'TOPPOSTERS_CONFIG',
'vars' => array( 'vars' => [
'legend1' => 'TOPPOSTERS', 'legend1' => 'TOPPOSTERS',
'board3_topposters_' . $module_id => array('lang' => 'NUM_TOPPOSTERS', 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true), 'board3_topposters_' . $module_id => ['lang' => 'NUM_TOPPOSTERS', 'validate' => 'int', 'type' => 'number:1:999', 'explain' => true],
), ],
); ];
} }
/** /**
@@ -128,9 +128,9 @@ class topposters extends module_base
*/ */
public function uninstall($module_id, $db) public function uninstall($module_id, $db)
{ {
$del_config = array( $del_config = [
'board3_topposters_' . $module_id, 'board3_topposters_' . $module_id,
); ];
$sql = 'DELETE FROM ' . CONFIG_TABLE . ' $sql = 'DELETE FROM ' . CONFIG_TABLE . '
WHERE ' . $db->sql_in_set('config_name', $del_config); WHERE ' . $db->sql_in_set('config_name', $del_config);
return $db->sql_query($sql); return $db->sql_query($sql);

View File

@@ -189,7 +189,7 @@ class welcome extends module_base
// first check for obvious errors, we don't want to waste server resources // 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); trigger_error($this->user->lang['TOO_FEW_CHARS']. adm_back_link($u_action), E_USER_WARNING);
} }
// set_portal_config will take care of escaping the welcome message // set_portal_config will take care of escaping the welcome message