Added check to prevent adding a module more than once
Few small bugfixes
This commit is contained in:
@@ -261,13 +261,17 @@ class acp_portal
|
||||
|
||||
$sql_ary = array(
|
||||
'module_image_src' => request_var('module_image', ''),
|
||||
'module_name' => request_var('module_name', '', true),
|
||||
'module_image_width' => request_var('module_img_width', 0),
|
||||
'module_image_height' => request_var('module_img_height', 0),
|
||||
'module_group_ids' => $module_permission,
|
||||
'module_status' => request_var('module_status', B3_MODULE_ENABLED),
|
||||
);
|
||||
|
||||
if($module_data['module_classname'] != 'latest_bots')
|
||||
{
|
||||
$sql_ary['module_name'] = utf8_normalize_nfc(request_var('module_name', '', true));
|
||||
}
|
||||
|
||||
// check if module image file actually exists
|
||||
check_file_src($sql_ary['module_image_src'], '', $module_id);
|
||||
|
||||
@@ -705,10 +709,25 @@ class acp_portal
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
$directory = $phpbb_root_path . 'portal/modules/';
|
||||
|
||||
// Create an array of already installed modules
|
||||
$portal_modules = obtain_portal_modules();
|
||||
$installed_modules = array();
|
||||
|
||||
foreach($portal_modules as $cur_module)
|
||||
{
|
||||
$installed_modules[] = $cur_module['module_classname'];
|
||||
}
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
$module_classname = request_var('module_classname', '');
|
||||
$class = 'portal_' . $module_classname . '_module';
|
||||
|
||||
if(in_array($module_classname, $installed_modules) && $module_classname != 'custom')
|
||||
{
|
||||
trigger_error($user->lang['MODULE_ADD_ONCE'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||
}
|
||||
|
||||
if (!class_exists($class))
|
||||
{
|
||||
include($directory . 'portal_' . $module_classname . '.' . $phpEx);
|
||||
@@ -788,6 +807,11 @@ class acp_portal
|
||||
if (preg_match('/^portal_.+\.' . $phpEx . '$/', $file))
|
||||
{
|
||||
$class = str_replace(".$phpEx", '', $file) . '_module';
|
||||
if(in_array(str_replace(array('portal_', '_module'), '', $class), $installed_modules))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!class_exists($class))
|
||||
{
|
||||
include($directory . $file);
|
||||
|
||||
@@ -71,6 +71,7 @@ $lang = array_merge($lang, array(
|
||||
'MODULE_RESET' => 'Modul Einstellungen zurücksetzen',
|
||||
'MODULE_RESET_EXP' => 'Dies wird alle Einstellungen des Moduls auf die Standardeinstellungen zurücksetzen!',
|
||||
'MODULE_STATUS' => 'Aktiviere Modul',
|
||||
'MODULE_ADD_ONCE' => 'Diese Modul kann nur ein Mal hinzugefügt werden.',
|
||||
|
||||
// general
|
||||
'ACP_PORTAL' => 'Portal',
|
||||
|
||||
@@ -33,7 +33,8 @@ if (empty($lang) || !is_array($lang))
|
||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||
$lang = array_merge($lang, array(
|
||||
'LATEST_BOTS' => 'Letzte Bots',
|
||||
'LAST_VISITED_BOTS' => 'Die letzten %s Bots',
|
||||
'LAST_VISITED_BOTS' => 'Die letzten Bots',
|
||||
'LAST_VISITED_BOTS_CNT' => 'Die letzten %s Bots',
|
||||
|
||||
// ACP
|
||||
'ACP_PORTAL_BOTS_SETTINGS' => 'Einstellungen für Bot-Besuche',
|
||||
|
||||
@@ -70,6 +70,7 @@ $lang = array_merge($lang, array(
|
||||
'MODULE_RESET' => 'Reset module configuration',
|
||||
'MODULE_RESET_EXP' => 'This will reset all settings to the default!',
|
||||
'MODULE_STATUS' => 'Enable module',
|
||||
'MODULE_ADD_ONCE' => 'This module can only be added once.',
|
||||
|
||||
// general
|
||||
'ACP_PORTAL' => 'Portal',
|
||||
|
||||
@@ -33,7 +33,8 @@ if (empty($lang) || !is_array($lang))
|
||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||
$lang = array_merge($lang, array(
|
||||
'LATEST_BOTS' => 'Latest Bots',
|
||||
'LAST_VISITED_BOTS' => 'Last %s visited bots',
|
||||
'LAST_VISITED_BOTS' => 'Last visited bots',
|
||||
'LAST_VISITED_BOTS_CNT' => 'Last %s visited bots',
|
||||
|
||||
// ACP
|
||||
'ACP_PORTAL_BOTS_SETTINGS' => 'Visiting bots settings',
|
||||
|
||||
@@ -352,7 +352,6 @@ class portal_announcements_module
|
||||
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
|
||||
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
|
||||
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
|
||||
'S_DISPLAY_ANNOUNCEMENTS' => true,
|
||||
'S_DISPLAY_ANNOUNCEMENTS_RVS' => ($config['board3_show_announcements_replies_views_' . $module_id]) ? true : false,
|
||||
'S_TOPIC_ICONS' => $topic_icons,
|
||||
));
|
||||
|
||||
@@ -64,7 +64,6 @@ class portal_forumlist_module
|
||||
'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'),
|
||||
'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
|
||||
'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
|
||||
'S_DISPLAY_PORTAL_FORUM_INDEX' => true,
|
||||
'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
|
||||
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '',
|
||||
));
|
||||
|
||||
@@ -97,7 +97,6 @@ class portal_friends_module
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_FRIENDS' => $s_display_friends,
|
||||
'S_ZEBRA_ENABLED' => true,
|
||||
));
|
||||
|
||||
return 'friends_side.html';
|
||||
|
||||
@@ -55,36 +55,22 @@ class portal_latest_bots_module
|
||||
$sql = 'SELECT username, user_colour, user_lastvisit
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_type = ' . USER_IGNORE . '
|
||||
AND user_lastvisit > 0
|
||||
ORDER BY user_lastvisit DESC';
|
||||
$result = $db->sql_query_limit($sql, $config['board3_last_visited_bots_number_' . $module_id]);
|
||||
$first = true;
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!$row['user_lastvisit'] && $first == true)
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_LAST_BOTS' => false,
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_var('S_DISPLAY_LAST_BOTS', true);
|
||||
|
||||
if($row['user_lastvisit'] > 0)
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$template->assign_block_vars('last_visited_bots', array(
|
||||
'BOT_NAME' => get_username_string('full', '', $row['username'], $row['user_colour']),
|
||||
'LAST_VISIT_DATE' => $user->format_date($row['user_lastvisit']),
|
||||
));
|
||||
}
|
||||
}
|
||||
$first = false;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'LAST_VISITED_BOTS' => sprintf($user->lang['LAST_VISITED_BOTS'], $config['board3_last_visited_bots_number_' . $module_id]),
|
||||
'LAST_VISITED_BOTS' => ($config['board3_last_visited_bots_number_' . $module_id] != 0) ? sprintf($user->lang['LAST_VISITED_BOTS_CNT'], $config['board3_last_visited_bots_number_' . $module_id]) : $user->lang['LAST_VISITED_BOTS'],
|
||||
));
|
||||
|
||||
if(!empty($row))
|
||||
|
||||
@@ -340,7 +340,6 @@ class portal_news_module
|
||||
'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'),
|
||||
'S_NEWEST_OR_FIRST' => ($config['board3_news_show_last_' . $module_id]) ? $user->lang['JUMP_NEWEST'] : $user->lang['JUMP_FIRST'],
|
||||
'POSTED_BY_TEXT' => ($config['board3_news_show_last_' . $module_id]) ? $user->lang['LAST_POST'] : $user->lang['POSTED'],
|
||||
'S_DISPLAY_NEWS' => true,
|
||||
'S_DISPLAY_NEWS_RVS' => ($config['board3_show_news_replies_views_' . $module_id]) ? true : false,
|
||||
'S_TOPIC_ICONS' => $topic_icons,
|
||||
));
|
||||
|
||||
@@ -421,7 +421,6 @@ class portal_poll_module
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_POLL' => true,
|
||||
'S_HAS_POLL' => $has_poll,
|
||||
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
|
||||
'POLL_RIGHT_CAP_IMG' => $user->img('poll_right'),
|
||||
@@ -789,7 +788,7 @@ class portal_poll_module
|
||||
'POLL_OPTION_RESULT' => $pd['poll_option_total'],
|
||||
'POLL_OPTION_PERCENT' => $option_pct_txt,
|
||||
'POLL_OPTION_PCT' => round($option_pct * 100),
|
||||
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * 250)),
|
||||
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * 35) . 'px'),
|
||||
'POLL_OPTION_VOTED' => (in_array($pd['poll_option_id'], $cur_voted_id)) ? true : false
|
||||
));
|
||||
}
|
||||
@@ -798,7 +797,6 @@ class portal_poll_module
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_POLL' => true,
|
||||
'S_HAS_POLL' => $has_poll,
|
||||
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
|
||||
'POLL_RIGHT_CAP_IMG' => $user->img('poll_right'),
|
||||
|
||||
@@ -119,7 +119,6 @@ class portal_statistics_module
|
||||
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_DISPLAY_ADVANCED_STAT' => true,
|
||||
'B3_TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
|
||||
'B3_TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
|
||||
'B3_TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
|
||||
|
||||
@@ -82,7 +82,6 @@ class portal_stylechanger_module
|
||||
// Assign specific vars
|
||||
$template->assign_vars(array(
|
||||
'S_STYLE_OPTIONS' => ($config['override_user_style'] || $style_count < 2) ? '' : style_select($user->data['user_style']),
|
||||
'S_DISPLAY_CHANGE_STYLE' => true,
|
||||
));
|
||||
|
||||
return 'stylechanger_side.html';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<span class="portal-corners-bottom-inner"></span></div>
|
||||
</div>
|
||||
<!-- ELSE -->
|
||||
<div style="margin-bottom: <!-- IF announcements_row.S_LAST_ROW -->0px<!-- ELSE -->1px<!-- ENDIF -->" class="post <!-- IF news_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
|
||||
<div style="margin-bottom: <!-- IF news_row.S_LAST_ROW -->0px<!-- ELSE -->1px<!-- ENDIF -->" class="post <!-- IF news_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
|
||||
<div class="inner"><span class="portal-corners-top-inner"></span>
|
||||
<h4 class="first"><a name="n"></a><a name="n{news_row.N_ID}"></a><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --><strong>{L_VIEW_TOPIC_POLL}</strong><!-- ENDIF --><!-- IF news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}" width="{news_row.TOPIC_ICON_IMG_WIDTH}" height="{news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="{news_row.U_VIEW_COMMENTS}"><strong>{news_row.TITLE}</strong></a></h4>
|
||||
<!-- IF news_row.PAGINATION --><strong class="pagination"><span>{news_row.PAGINATION}</span></strong><!-- ENDIF -->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- IF S_STYLE_OPTIONS and S_DISPLAY_CHANGE_STYLE -->
|
||||
<!-- IF S_STYLE_OPTIONS -->
|
||||
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" /> <!-- ENDIF -->{$TITLE}{$LR_BLOCK_H_R}
|
||||
<select style="width: 150px;" name="demo" id="demo" onchange="document.location.href = this.options[this.selectedIndex].value;">
|
||||
{STYLE_SELECT}
|
||||
|
||||
BIN
root/styles/subsilver2/theme/images/portal/portal_poll.png
Normal file
BIN
root/styles/subsilver2/theme/images/portal/portal_poll.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
Reference in New Issue
Block a user