diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php index b6cbf96a..d3d92828 100644 --- a/root/includes/acp/acp_portal.php +++ b/root/includes/acp/acp_portal.php @@ -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); @@ -704,11 +708,26 @@ 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); diff --git a/root/language/de/mods/info_acp_portal.php b/root/language/de/mods/info_acp_portal.php index 5cbb6857..0e08c36a 100644 --- a/root/language/de/mods/info_acp_portal.php +++ b/root/language/de/mods/info_acp_portal.php @@ -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', diff --git a/root/language/de/mods/portal/portal_latest_bots_module.php b/root/language/de/mods/portal/portal_latest_bots_module.php index bf84dc0f..ca89d4bb 100644 --- a/root/language/de/mods/portal/portal_latest_bots_module.php +++ b/root/language/de/mods/portal/portal_latest_bots_module.php @@ -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', diff --git a/root/language/en/mods/info_acp_portal.php b/root/language/en/mods/info_acp_portal.php index 2249a3a1..3377a0fc 100755 --- a/root/language/en/mods/info_acp_portal.php +++ b/root/language/en/mods/info_acp_portal.php @@ -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', diff --git a/root/language/en/mods/portal/portal_latest_bots_module.php b/root/language/en/mods/portal/portal_latest_bots_module.php index 8eb9d290..22642d40 100644 --- a/root/language/en/mods/portal/portal_latest_bots_module.php +++ b/root/language/en/mods/portal/portal_latest_bots_module.php @@ -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', diff --git a/root/portal/modules/portal_announcements.php b/root/portal/modules/portal_announcements.php index 7f842f16..a8862893 100644 --- a/root/portal/modules/portal_announcements.php +++ b/root/portal/modules/portal_announcements.php @@ -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, )); diff --git a/root/portal/modules/portal_forumlist.php b/root/portal/modules/portal_forumlist.php index 3a4ae332..ddb8fc10 100644 --- a/root/portal/modules/portal_forumlist.php +++ b/root/portal/modules/portal_forumlist.php @@ -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) : '', )); diff --git a/root/portal/modules/portal_friends.php b/root/portal/modules/portal_friends.php index 1dff111d..d244350f 100644 --- a/root/portal/modules/portal_friends.php +++ b/root/portal/modules/portal_friends.php @@ -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'; diff --git a/root/portal/modules/portal_latest_bots.php b/root/portal/modules/portal_latest_bots.php index dd405cf8..f83d5ef5 100755 --- a/root/portal/modules/portal_latest_bots.php +++ b/root/portal/modules/portal_latest_bots.php @@ -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, + $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']), )); - } - else - { - $template->assign_var('S_DISPLAY_LAST_BOTS', true); - - if($row['user_lastvisit'] > 0) - { - $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)) diff --git a/root/portal/modules/portal_news.php b/root/portal/modules/portal_news.php index a5496ac5..00903562 100644 --- a/root/portal/modules/portal_news.php +++ b/root/portal/modules/portal_news.php @@ -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, )); diff --git a/root/portal/modules/portal_poll.php b/root/portal/modules/portal_poll.php index d2f8d74f..ddbc2e22 100644 --- a/root/portal/modules/portal_poll.php +++ b/root/portal/modules/portal_poll.php @@ -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'), diff --git a/root/portal/modules/portal_statistics.php b/root/portal/modules/portal_statistics.php index 7a3957b5..e4bdba18 100644 --- a/root/portal/modules/portal_statistics.php +++ b/root/portal/modules/portal_statistics.php @@ -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), diff --git a/root/portal/modules/portal_stylechanger.php b/root/portal/modules/portal_stylechanger.php index 62434e6f..cb933b90 100644 --- a/root/portal/modules/portal_stylechanger.php +++ b/root/portal/modules/portal_stylechanger.php @@ -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'; diff --git a/root/styles/prosilver/template/portal/modules/news_center.html b/root/styles/prosilver/template/portal/modules/news_center.html index 4cf4d5df..4f8dfc62 100644 --- a/root/styles/prosilver/template/portal/modules/news_center.html +++ b/root/styles/prosilver/template/portal/modules/news_center.html @@ -8,7 +8,7 @@ -
+

{NEWEST_POST_IMG}{READ_POST_IMG} {news_row.ATTACH_ICON_IMG} {L_VIEW_TOPIC_POLL} {news_row.TITLE}

{news_row.PAGINATION} diff --git a/root/styles/prosilver/template/portal/modules/stylechanger_side.html b/root/styles/prosilver/template/portal/modules/stylechanger_side.html index 3c23b993..3583b4a2 100644 --- a/root/styles/prosilver/template/portal/modules/stylechanger_side.html +++ b/root/styles/prosilver/template/portal/modules/stylechanger_side.html @@ -1,4 +1,4 @@ - + {$LR_BLOCK_H_L} {$TITLE}{$LR_BLOCK_H_R}