function shd_frontpage_options($return_config) { global $context, $modSettings, $txt, $sourcedir, $smcFunc; // Since this is potentially dangerous, real admins only, thanks. isAllowedTo('admin_forum'); $config_vars = array(array('select', 'shdp_frontpage_appear', array('always' => $txt['shdp_frontpage_appear_always'], 'firstload' => $txt['shdp_frontpage_appear_firstload'], 'firstdefault' => $txt['shdp_frontpage_appear_firstdefault'])), '', array('select', 'shdp_frontpage_type', array('php' => $txt['shdp_frontpage_type_php'], 'bbcode' => $txt['shdp_frontpage_type_bbcode'])), array('large_text', 'shdp_frontpage_content', 'size' => 30)); $context['settings_title'] = $txt['shdp_frontpage']; $context['settings_icon'] = 'frontpage.png'; // Are we actually going to display this, or bouncing it back just for admin search? if (!$return_config) { require_once $sourcedir . '/Subs-Post.php'; require_once $sourcedir . '/Subs-Editor.php'; loadTemplate('sd_plugins_template/SDPluginFrontPage'); $context['sub_template'] = 'shd_frontpage_admin'; $context['shdp_frontpage_content'] = !empty($modSettings['shdp_frontpage_content']) ? un_preparsecode($modSettings['shdp_frontpage_content']) : ''; if (isset($_GET['save'])) { $_POST['shdp_frontpage_content'] = isset($_POST['shdp_frontpage_content']) ? $_POST['shdp_frontpage_content'] : ''; if (!empty($_POST['shdp_frontpage_type']) && $_POST['shdp_frontpage_type'] == 'php') { $context['shdp_frontpage_content'] = $smcFunc['htmlspecialchars']($_POST['shdp_frontpage_content'], ENT_QUOTES); } else { $_POST['shdp_frontpage_content'] = $smcFunc['htmlspecialchars']($_POST['shdp_frontpage_content'], ENT_QUOTES); preparsecode($_POST['shdp_frontpage_content']); $context['shdp_frontpage_content'] = un_preparsecode($_POST['shdp_frontpage_content']); // So it's a known safe version. } } $modSettings['disable_wysiwyg'] = true; $editorOptions = array('id' => 'shdp_frontpage_content', 'value' => $context['shdp_frontpage_content'], 'labels' => array('post_button' => $txt['save']), 'preview_type' => 0, 'width' => '70%', 'disable_smiley_box' => false); create_control_richedit($editorOptions); $context['post_box_name'] = $editorOptions['id']; } return $config_vars; }
function PackageGet() { global $txt, $scripturl, $context, $boarddir, $sourcedir, $modSettings; isAllowedTo('admin_forum'); require_once $sourcedir . '/Subs-Package.php'; // Still managing packages... adminIndex('manage_packages'); // Use the Packages template... no reason to separate. loadLanguage('Packages'); loadTemplate('Packages'); // Add the appropriate items to the link tree. $context['linktree'][] = array('url' => $scripturl . '?action=packages', 'name' => &$txt['package1']); $context['linktree'][] = array('url' => $scripturl . '?action=packageget', 'name' => &$txt['smf182']); $context['page_title'] = $txt['package1']; // Here is a list of all the potentially valid actions. $subActions = array('servers' => 'PackageServers', 'add' => 'PackageServerAdd', 'browse' => 'PackageGBrowse', 'download' => 'PackageDownload', 'remove' => 'PackageServerRemove', 'upload' => 'PackageUpload'); // Now let's decide where we are taking this... if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { $context['sub_action'] = $_REQUEST['sa']; } elseif ($_REQUEST['action'] == 'pgdownload') { $context['sub_action'] = 'download'; } else { $context['sub_action'] = 'servers'; } // Now create the tabs for the template. $context['admin_tabs'] = array('title' => &$txt['package1'], 'description' => $txt['package_manager_desc'], 'tabs' => array('browse' => array('title' => $txt['package3'], 'href' => $scripturl . '?action=packages;sa=browse'), 'packageget' => array('title' => $txt['download_packages'], 'description' => $txt['download_packages_desc'], 'href' => $scripturl . '?action=packageget', 'is_selected' => true), 'installed' => array('title' => $txt['installed_packages'], 'description' => $txt['installed_packages_desc'], 'href' => $scripturl . '?action=packages;sa=installed'), 'options' => array('title' => $txt['package_settings'], 'description' => $txt['package_install_options_ftp_why'], 'href' => $scripturl . '?action=packages;sa=options', 'is_last' => true))); $subActions[$context['sub_action']](); }
function ManageCalendar() { global $context, $txt, $scripturl, $modSettings; isAllowedTo('admin_forum'); // Administrative side bar, here we come! adminIndex('manage_calendar'); // Everything's gonna need this. loadLanguage('ManageCalendar'); // Default text. $context['explain_text'] =& $txt['calendar_desc']; // Little short on the ground of functions here... but things can and maybe will change... $subActions = array('editholiday' => 'EditHoliday', 'holidays' => 'ModifyHolidays', 'settings' => 'ModifySettings'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'settings'; // Set up the two tabs here... $context['admin_tabs'] = array('title' => &$txt['manage_calendar'], 'help' => 'calendar', 'description' => $txt['calendar_settings_desc'], 'tabs' => array('holidays' => array('title' => $txt['manage_holidays'], 'description' => $txt['manage_holidays_desc'], 'href' => $scripturl . '?action=managecalendar;sa=holidays'), 'settings' => array('title' => $txt['calendar_settings'], 'description' => $txt['calendar_settings_desc'], 'href' => $scripturl . '?action=managecalendar;sa=settings', 'is_last' => true))); // Select the tab they're at... if (isset($context['admin_tabs']['tabs'][$_REQUEST['sa']])) { $context['admin_tabs']['tabs'][$_REQUEST['sa']]['is_selected'] = true; } // Some settings may not be enabled, disallow these from the tabs as appropriate. if (empty($modSettings['cal_enabled'])) { unset($context['admin_tabs']['tabs']['holidays']); } $subActions[$_REQUEST['sa']](); }
function Memberlist() { global $scripturl, $txt, $modSettings, $context, $settings; // Make sure they can view the memberlist. isAllowedTo('view_mlist'); loadTemplate('Memberlist'); $context['listing_by'] = !empty($_GET['sa']) ? $_GET['sa'] : 'all'; // $subActions array format: // 'subaction' => array('label', 'function', 'is_selected') $subActions = array('all' => array(&$txt[303], 'MLAll', $context['listing_by'] == 'all'), 'search' => array(&$txt['mlist_search'], 'MLSearch', $context['listing_by'] == 'search')); // Set up the sort links. $context['sort_links'] = array(); foreach ($subActions as $act => $text) { $context['sort_links'][] = array('label' => $text[0], 'action' => $act, 'selected' => $text[2]); } $context['num_members'] = $modSettings['totalMembers']; // Set up the columns... $context['columns'] = array('isOnline' => array('label' => $txt['online8'], 'width' => '20'), 'realName' => array('label' => $txt[35]), 'emailAddress' => array('label' => $txt[307], 'width' => '25'), 'websiteUrl' => array('label' => $txt[96], 'width' => '25'), 'ICQ' => array('label' => $txt[513], 'width' => '25'), 'AIM' => array('label' => $txt[603], 'width' => '25'), 'YIM' => array('label' => $txt[604], 'width' => '25'), 'MSN' => array('label' => $txt['MSN'], 'width' => '25'), 'ID_GROUP' => array('label' => $txt[87]), 'registered' => array('label' => $txt[233]), 'posts' => array('label' => $txt[21], 'width' => '115', 'colspan' => '2')); $context['linktree'][] = array('url' => $scripturl . '?action=mlist', 'name' => &$txt[332]); $context['can_send_pm'] = allowedTo('pm_send'); // Jump to the sub action. if (isset($subActions[$context['listing_by']])) { $subActions[$context['listing_by']][1](); } else { $subActions['all'][1](); } }
function AdkAdmin() { global $txt, $context, $settings, $adkportal, $boardurl, $adkFolder; //Is allowed to manage adkportal isAllowedTo('adk_portal'); //Load my template adktemplate('Adk-Admin'); //Load Adk Language adkLanguage('Adk-Admin'); $subActions = array('view' => 'view', 'adksettings' => 'adksettings', 'adksavesettings' => 'adksavesettings', 'manageicons' => 'manageicons'); //Set subactions for standalone mode if ($adkportal['adk_enable'] == 2) { $subActions += array('standalone' => 'SettingsStandAlone', 'save_stand' => 'SaveSettingsStandAlone'); } $context['html_headers'] .= getCss('admin_adkportal'); $context['html_headers'] .= getJs('admin'); $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['adkadmin_settings'], 'description' => $txt['adkadmin_news_desc'], 'tabs' => array('view' => array('description' => $txt['adkadmin_news_desc'], 'label' => '<img style="vertical-align: middle;" alt="" src="' . $settings['default_theme_url'] . '/images/admin/news.png" /> ' . $txt['adkadmin_news']), 'adksettings' => array('description' => $txt['adkadmin_setting_desc'], 'label' => '<img style="vertical-align: middle;" alt="" src="' . $settings['default_theme_url'] . '/images/admin/settings.png" /> ' . $txt['adkadmin_setting']), 'manageicons' => array('description' => $txt['adkadmin_icons_desc'], 'label' => '<img style="vertical-align: middle;" alt="" src="' . $settings['default_theme_url'] . '/images/admin/icons.png" /> ' . $txt['adkadmin_icons']))); //The last thing... print the stand alone menu if ($adkportal['adk_enable'] == 2) { $context[$context['admin_menu_name']]['tab_data']['tabs']['standalone'] = array('description' => $txt['adkadmin_stand_desc'], 'label' => '<img style="vertical-align: middle;" alt="" src="' . $adkFolder['images'] . '/php.png" /> ' . $txt['adkadmin_stand']); } // Follow the sa or just go to View function if (!empty($_GET['sa']) && !empty($subActions[$_GET['sa']])) { $subActions[@$_GET['sa']](); } else { $subActions['view'](); } }
function ManagePostSettings() { global $context, $txt, $scripturl; // Boldify "Posts and Topics" on the admin bar. adminIndex('posts_and_topics'); $subActions = array('posts' => array('ModifyPostSettings', 'admin_forum'), 'bbc' => array('ModifyBBCSettings', 'admin_forum'), 'censor' => array('SetCensor', 'moderate_forum'), 'topics' => array('ModifyTopicSettings', 'admin_forum')); // Default the sub-action to 'view ban list'. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('admin_forum') ? 'posts' : 'censor'); // Make sure you can do this. isAllowedTo($subActions[$_REQUEST['sa']][1]); $context['page_title'] = $txt['manageposts_title']; // Tabs for browsing the different ban functions. $context['admin_tabs'] = array('title' => $txt['manageposts_title'], 'help' => 'posts_and_topics', 'description' => $txt['manageposts_description'], 'tabs' => array()); if (allowedTo('admin_forum')) { $context['admin_tabs']['tabs'][] = array('title' => $txt['manageposts_settings'], 'description' => $txt['manageposts_settings_description'], 'href' => $scripturl . '?action=postsettings;sa=posts', 'is_selected' => $_REQUEST['sa'] == 'posts'); $context['admin_tabs']['tabs'][] = array('title' => $txt['manageposts_bbc_settings'], 'description' => $txt['manageposts_bbc_settings_description'], 'href' => $scripturl . '?action=postsettings;sa=bbc', 'is_selected' => $_REQUEST['sa'] == 'bbc'); } if (allowedTo('moderate_forum')) { $context['admin_tabs']['tabs'][] = array('title' => $txt[135], 'description' => $txt[141], 'href' => $scripturl . '?action=postsettings;sa=censor', 'is_selected' => $_REQUEST['sa'] == 'censor', 'is_last' => !allowedTo('admin_forum')); } if (allowedTo('admin_forum')) { $context['admin_tabs']['tabs'][] = array('title' => $txt['manageposts_topic_settings'], 'description' => $txt['manageposts_topic_settings_description'], 'href' => $scripturl . '?action=postsettings;sa=topics', 'is_selected' => $_REQUEST['sa'] == 'topics', 'is_last' => true); } // Call the right function for this sub-acton. $subActions[$_REQUEST['sa']][0](); }
function ManageNews() { global $context, $txt, $scripturl; // First, let's do a quick permissions check for the best error message possible. isAllowedTo(array('edit_news', 'send_mail', 'admin_forum')); // Administrative side bar, here we come! adminIndex('news'); loadTemplate('ManageNews'); // Format: 'sub-action' => array('function', 'permission') $subActions = array('editnews' => array('EditNews', 'edit_news'), 'mailingmembers' => array('SelectMailingMembers', 'send_mail'), 'mailingcompose' => array('ComposeMailing', 'send_mail'), 'mailingsend' => array('SendMailing', 'send_mail'), 'settings' => array('ModifyNewsSettings', 'admin_forum')); // Default to sub action 'main' or 'settings' depending on permissions. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('edit_news') ? 'editnews' : (allowedTo('send_mail') ? 'mailingmembers' : 'settings')); // Have you got the proper permissions? isAllowedTo($subActions[$_REQUEST['sa']][1]); // Create the tabs for the template. $context['admin_tabs'] = array('title' => $txt['news_title'], 'help' => 'edit_news', 'description' => $txt[670], 'tabs' => array()); if (allowedTo('edit_news')) { $context['admin_tabs']['tabs'][] = array('title' => $txt[7], 'description' => $txt[670], 'href' => $scripturl . '?action=news', 'is_selected' => $_REQUEST['sa'] == 'editnews'); } if (allowedTo('send_mail')) { $context['admin_tabs']['tabs'][] = array('title' => $txt[6], 'description' => $txt['news_mailing_desc'], 'href' => $scripturl . '?action=news;sa=mailingmembers', 'is_selected' => substr($_REQUEST['sa'], 0, 7) == 'mailing'); } if (allowedTo('admin_forum')) { $context['admin_tabs']['tabs'][] = array('title' => $txt['settings'], 'description' => $txt['news_settings_desc'], 'href' => $scripturl . '?action=news;sa=settings', 'is_selected' => $_REQUEST['sa'] == 'settings'); } $context['admin_tabs']['tabs'][count($context['admin_tabs']['tabs']) - 1]['is_last'] = true; $subActions[$_REQUEST['sa']][0](); }
function RegCenter() { global $modSettings, $context, $txt, $db_prefix, $scripturl; // Old templates might still request this. if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'browse') { redirectexit('action=viewmembers;sa=browse' . (isset($_REQUEST['type']) ? ';type=' . $_REQUEST['type'] : '')); } $subActions = array('register' => array('AdminRegister', 'moderate_forum'), 'agreement' => array('EditAgreement', 'admin_forum'), 'reservednames' => array('SetReserve', 'admin_forum'), 'settings' => array('AdminSettings', 'admin_forum')); // Work out which to call... $context['sub_action'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (allowedTo('moderate_forum') ? 'register' : 'settings'); // Must have sufficient permissions. isAllowedTo($subActions[$context['sub_action']][1]); // Set the admin area... adminIndex('registration_center'); // Loading, always loading. loadLanguage('Login'); loadTemplate('Register'); // Next create the tabs for the template. $context['admin_tabs'] = array('title' => &$txt['registration_center'], 'help' => 'registrations', 'description' => $txt['admin_settings_desc'], 'tabs' => array('register' => array('title' => $txt['admin_browse_register_new'], 'description' => $txt['admin_register_desc'], 'href' => $scripturl . '?action=regcenter;sa=register', 'is_selected' => $context['sub_action'] == 'register', 'is_last' => !allowedTo('admin_forum')))); if (allowedTo('admin_forum')) { $context['admin_tabs']['tabs']['agreement'] = array('title' => $txt['smf11'], 'description' => $txt['smf12'], 'href' => $scripturl . '?action=regcenter;sa=agreement', 'is_selected' => $context['sub_action'] == 'agreement'); $context['admin_tabs']['tabs']['reservednames'] = array('title' => $txt[341], 'description' => $txt[699], 'href' => $scripturl . '?action=regcenter;sa=reservednames', 'is_selected' => $context['sub_action'] == 'reservednames'); $context['admin_tabs']['tabs']['settings'] = array('title' => $txt['settings'], 'description' => $txt['admin_settings_desc'], 'href' => $scripturl . '?action=regcenter;sa=settings', 'is_last' => true, 'is_selected' => $context['sub_action'] == 'settings'); } // Finally, get around to calling the function... $subActions[$context['sub_action']][0](); }
function Packages() { global $txt, $scripturl, $sourcedir, $context; isAllowedTo('admin_forum'); // Managing packages! adminIndex('manage_packages'); // Load all the basic stuff. require_once $sourcedir . '/Subs-Package.php'; loadLanguage('Packages'); loadTemplate('Packages'); // Set up the linktree and title so it's already done. $context['linktree'][] = array('url' => $scripturl . '?action=packages', 'name' => &$txt['package1']); $context['page_title'] = $txt['package1']; // Delegation makes the world... that is, the package manager go 'round. $subActions = array('browse' => 'PackageBrowse', 'remove' => 'PackageRemove', 'list' => 'PackageList', 'install' => 'PackageInstallTest', 'install2' => 'PackageInstall', 'uninstall' => 'PackageInstallTest', 'uninstall2' => 'PackageInstall', 'installed' => 'InstalledList', 'options' => 'PackageOptions', 'flush' => 'FlushInstall', 'examine' => 'ExamineFile'); // Work out exactly who it is we are calling. if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { $context['sub_action'] = $_REQUEST['sa']; } else { $context['sub_action'] = 'browse'; } // Set up some tabs... $context['admin_tabs'] = array('title' => &$txt['package1'], 'description' => $txt['package_manager_desc'], 'tabs' => array('browse' => array('title' => $txt['package3'], 'href' => $scripturl . '?action=packages;sa=browse'), 'packageget' => array('title' => $txt['download_packages'], 'description' => $txt['download_packages_desc'], 'href' => $scripturl . '?action=packageget'), 'installed' => array('title' => $txt['installed_packages'], 'description' => $txt['installed_packages_desc'], 'href' => $scripturl . '?action=packages;sa=installed'), 'options' => array('title' => $txt['package_settings'], 'description' => $txt['package_install_options_ftp_why'], 'href' => $scripturl . '?action=packages;sa=options', 'is_last' => true))); // Attempt to automatically select the right tab. if (isset($context['admin_tabs']['tabs'][$context['sub_action']])) { $context['admin_tabs']['tabs'][$context['sub_action']]['is_selected'] = true; } else { $context['admin_tabs']['tabs']['browse']['is_selected'] = true; } // Call the function we're handing control to. $subActions[$context['sub_action']](); }
/** * This is the main dispatcher. Sets up all the available sub-actions, all the tabs and selects * the appropriate one based on the sub-action. * * Requires the admin_forum permission. * Redirects to the appropriate function based on the sub-action. * * @uses edit_settings adminIndex. */ function ModifySettings() { global $context, $txt, $scripturl, $boarddir; // This is just to keep the database password more secure. isAllowedTo('admin_forum'); // Load up all the tabs... $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['admin_server_settings'], 'help' => 'serversettings', 'description' => $txt['admin_basic_settings']); checkSession('request'); // The settings are in here, I swear! loadLanguage('ManageSettings'); $context['page_title'] = $txt['admin_server_settings']; $context['sub_template'] = 'show_settings'; $subActions = array('general' => 'ModifyGeneralSettings', 'database' => 'ModifyDatabaseSettings', 'cookie' => 'ModifyCookieSettings', 'cache' => 'ModifyCacheSettings', 'loads' => 'ModifyLoadBalancingSettings', 'phpinfo' => 'ShowPHPinfoSettings'); call_integration_hook('integrate_server_settings', array(&$subActions)); // By default we're editing the core settings $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'general'; $context['sub_action'] = $_REQUEST['sa']; // Any messages to speak of? $context['settings_message'] = isset($_REQUEST['msg']) && isset($txt[$_REQUEST['msg']]) ? $txt[$_REQUEST['msg']] : ''; // Warn the user if there's any relevant information regarding Settings.php. if ($_REQUEST['sa'] != 'cache') { // Warn the user if the backup of Settings.php failed. $settings_not_writable = !is_writable($boarddir . '/Settings.php'); $settings_backup_fail = !@is_writable($boarddir . '/Settings_bak.php') || !@copy($boarddir . '/Settings.php', $boarddir . '/Settings_bak.php'); if ($settings_not_writable) { $context['settings_message'] = '<div class="centertext"><strong>' . $txt['settings_not_writable'] . '</strong></div><br />'; } elseif ($settings_backup_fail) { $context['settings_message'] = '<div class="centertext"><strong>' . $txt['admin_backup_fail'] . '</strong></div><br />'; } $context['settings_not_writable'] = $settings_not_writable; } // Call the right function for this sub-action. $subActions[$_REQUEST['sa']](); }
function PackageGet() { global $txt, $scripturl, $context, $boarddir, $sourcedir, $modSettings; isAllowedTo('admin_forum'); require_once $sourcedir . '/Subs-Package.php'; // Use the Packages template... no reason to separate. loadLanguage('Packages'); loadTemplate('Packages', 'admin'); $context['page_title'] = $txt['package']; // Here is a list of all the potentially valid actions. $subActions = array('servers' => 'PackageServers', 'add' => 'PackageServerAdd', 'browse' => 'PackageGBrowse', 'download' => 'PackageDownload', 'remove' => 'PackageServerRemove', 'upload' => 'PackageUpload'); // Now let's decide where we are taking this... if (isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']])) { $context['sub_action'] = $_REQUEST['sa']; } elseif (isset($_GET['pgdownload'])) { $context['sub_action'] = 'download'; } else { $context['sub_action'] = 'servers'; } // We need to force the "Download" tab as selected. $context['menu_data_' . $context['admin_menu_id']]['current_subsection'] = 'packageget'; // Now create the tabs for the template. $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['package_manager'], 'description' => $txt['package_manager_desc'], 'tabs' => array('browse' => array(), 'packageget' => array('description' => $txt['download_packages_desc']), 'installed' => array('description' => $txt['installed_packages_desc']), 'perms' => array('description' => $txt['package_file_perms_desc']), 'options' => array('description' => $txt['package_install_options_ftp_why']))); $subActions[$context['sub_action']](); }
/** * file_source() * * - initialises all the basic context required for the database cleanup. * - passes execution onto the relevant section. * - if the passed action is not found it shows the main page. * * @return */ function file_source() { global $smcFunc, $context, $table_prefix, $version; // You have to be allowed to do this isAllowedTo('admin_forum'); // SMF 1 or 2 ? if (isset($smcFunc)) { db_extend('packages'); $version = 2; $table_prefix = '{db_prefix}'; } else { db_compat(); $version = 1; $table_prefix = ''; } $actions = array('examine' => 'examine', 'execute' => 'execute'); $titles = array('examine' => 'Examine Database', 'execute' => 'Execute Changes'); // Set a default action if none or an unsupported one is given if (!isset($_GET['action']) || !isset($actions[$_GET['action']])) { $current_action = 'examine'; } else { $current_action = $actions[$_GET['action']]; } // Set up the template information and language loadtext(); $context['sub_template'] = $current_action; $context['page_title'] = $titles[$current_action]; $context['page_title_html_safe'] = $titles[$current_action]; $context['robot_no_index'] = true; $context['html_headers'] .= ' <style type="text/css"> .normallist li { list-style: circle; line-height: 1.5em; } .submit_button { text-align: center; } .error { background-color: #FFECEC; } .success { color: #00CC00; } .fail { color: #EE0000; } </style>'; $current_action(); }
/** * Display some useful/interesting board statistics. * * What it does: * - Gets all the statistics in order and puts them in. * - Uses the Stats template and language file. (and main sub template.) * - Requires the view_stats permission. * - Accessed from ?action=stats. * * @uses Stats language file * @uses Stats template, statistics sub template */ public function action_stats() { global $txt, $scripturl, $modSettings, $context; // You have to be able to see these isAllowedTo('view_stats'); // Page disabled - redirect them out if (empty($modSettings['trackStats'])) { fatal_lang_error('feature_disabled', true); } if (!empty($_REQUEST['expand'])) { $context['robot_no_index'] = true; $month = (int) substr($_REQUEST['expand'], 4); $year = (int) substr($_REQUEST['expand'], 0, 4); if ($year > 1900 && $year < 2200 && $month >= 1 && $month <= 12) { $_SESSION['expanded_stats'][$year][] = $month; } } elseif (!empty($_REQUEST['collapse'])) { $context['robot_no_index'] = true; $month = (int) substr($_REQUEST['collapse'], 4); $year = (int) substr($_REQUEST['collapse'], 0, 4); if (!empty($_SESSION['expanded_stats'][$year])) { $_SESSION['expanded_stats'][$year] = array_diff($_SESSION['expanded_stats'][$year], array($month)); } } // Just a lil' help from our friend :P require_once SUBSDIR . '/Stats.subs.php'; // Handle the XMLHttpRequest. if (isset($_REQUEST['xml'])) { // Collapsing stats only needs adjustments of the session variables. if (!empty($_REQUEST['collapse'])) { obExit(false); } $context['sub_template'] = 'stats'; getDailyStats('YEAR(date) = {int:year} AND MONTH(date) = {int:month}', array('year' => $year, 'month' => $month)); $context['yearly'][$year]['months'][$month]['date'] = array('month' => sprintf('%02d', $month), 'year' => $year); return; } // Stats it is loadLanguage('Stats'); loadTemplate('Stats'); loadJavascriptFile('stats.js'); // Build the link tree...... $context['linktree'][] = array('url' => $scripturl . '?action=stats', 'name' => $txt['stats_center']); // Prepare some things for the template page $context['page_title'] = $context['forum_name'] . ' - ' . $txt['stats_center']; $context['sub_template'] = 'statistics'; // These are the templates that will be used to render the statistics $context['statistics_callbacks'] = array('general_statistics', 'top_statistics'); // Call each area of statics to load our friend $context $this->loadGeneralStatistics(); $this->loadTopStatistics(); $this->loadMontlyActivity(); // Custom stats (just add a template_layer or another callback to add it to the page!) call_integration_hook('integrate_forum_stats'); }
function Staff() { global $context, $mbname, $txt; //Check if the current user can view the staff list isAllowedTo('view_stafflist'); loadtemplate('Staff'); //Load the main staff template $context['sub_template'] = 'main'; //Set the page title $context['page_title'] = $mbname . ' - ' . $txt['smfstaff_stafflist']; }
function RepairBoards() { global $txt, $scripturl, $db_connection, $context, $sourcedir; global $salvageCatID, $salvageBoardID, $smcFunc, $errorTests; isAllowedTo('admin_forum'); // Try secure more memory. @ini_set('memory_limit', '128M'); // Print out the top of the webpage. $context['page_title'] = $txt['admin_repair']; $context['sub_template'] = 'repair_boards'; $context[$context['admin_menu_name']]['current_subsection'] = 'general'; // Load the language file. loadLanguage('ManageMaintenance'); // Make sure the tabs stay nice. $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['maintain_title'], 'help' => '', 'description' => $txt['maintain_info'], 'tabs' => array()); // Start displaying errors without fixing them. if (isset($_GET['fixErrors'])) { checkSession('get'); } // Will want this. loadForumTests(); // Giant if/else. The first displays the forum errors if a variable is not set and asks // if you would like to continue, the other fixes the errors. if (!isset($_GET['fixErrors'])) { $context['error_search'] = true; $context['repair_errors'] = array(); $context['to_fix'] = findForumErrors(); if (!empty($context['to_fix'])) { $_SESSION['repairboards_to_fix'] = $context['to_fix']; $_SESSION['repairboards_to_fix2'] = null; if (empty($context['repair_errors'])) { $context['repair_errors'][] = '???'; } } } else { $context['error_search'] = false; $context['to_fix'] = isset($_SESSION['repairboards_to_fix']) ? $_SESSION['repairboards_to_fix'] : array(); require_once $sourcedir . '/Subs-Boards.php'; // Get the MySQL version for future reference. $mysql_version = $smcFunc['db_server_info']($db_connection); // Actually do the fix. findForumErrors(true); // Note that we've changed everything possible ;) updateSettings(array('settings_updated' => time())); updateStats('message'); updateStats('topic'); updateSettings(array('calendar_updated' => time())); if (!empty($salvageBoardID)) { $context['redirect_to_recount'] = true; } $_SESSION['repairboards_to_fix'] = null; $_SESSION['repairboards_to_fix2'] = null; } }
function SaveNote() { global $db_prefix; //Check if they are allowed to admin forum. isAllowedTo('admin_forum'); //Make the html safe if used so it does not mess up the page $anotes = htmlspecialchars($_POST['txtnotes'], ENT_QUOTES); //Insert the admin notes into the database db_query("REPLACE INTO {$db_prefix}settings\n\t\t\t(variable, value)\n\t\tVALUES ('adminnotes','{$anotes}')", __FILE__, __LINE__); //Redirect to the main admin page to see the changed notes redirectexit('action=admin'); }
/** * Set up the context for the announce topic function (action=announce). * This function is called before the flow is redirected to action_selectgroup() or action_send(). * * checks the topic announcement permissions and loads the announcement template. * requires the announce_topic permission. * uses the Announce template and Post language file. */ public function pre_dispatch() { global $context, $txt, $topic; isAllowedTo('announce_topic'); validateSession(); if (empty($topic)) { fatal_lang_error('topic_gone', false); } loadLanguage('Post'); loadTemplate('Announce'); $context['page_title'] = $txt['announce_topic']; }
function SaveNote() { global $smcFunc; // Check if they are allowed to admin forum. isAllowedTo('admin_forum'); // Make the html safe if used so it does not mess up the page $anotes = htmlspecialchars($_POST['txtnotes'], ENT_QUOTES); // Insert the admin notes into the database updateSettings(array('adminnotes' => $anotes)); // Redirect to the main admin page to see the changed notes redirectexit('action=admin'); }
/** * The main entrance point for the Manage Members screen. * As everyone else, it calls a function based on the given sub-action. * Called by ?action=admin;area=viewmembers. * Requires the moderate_forum permission. * * @uses ManageMembers template * @uses ManageMembers language file. */ function ViewMembers() { global $txt, $scripturl, $context, $modSettings, $smcFunc; $subActions = array('all' => array('ViewMemberlist', 'moderate_forum'), 'approve' => array('AdminApprove', 'moderate_forum'), 'browse' => array('MembersAwaitingActivation', 'moderate_forum'), 'search' => array('SearchMembers', 'moderate_forum'), 'query' => array('ViewMemberlist', 'moderate_forum')); call_integration_hook('integrate_manage_members', array(&$subActions)); // Default to sub action 'index' or 'settings' depending on permissions. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'all'; // We know the sub action, now we know what you're allowed to do. isAllowedTo($subActions[$_REQUEST['sa']][1]); // Load the essentials. loadLanguage('ManageMembers'); loadTemplate('ManageMembers'); // Get counts on every type of activation - for sections and filtering alike. $request = $smcFunc['db_query']('', ' SELECT COUNT(*) AS total_members, is_activated FROM {db_prefix}members WHERE is_activated != {int:is_activated} GROUP BY is_activated', array('is_activated' => 1)); $context['activation_numbers'] = array(); $context['awaiting_activation'] = 0; $context['awaiting_approval'] = 0; while ($row = $smcFunc['db_fetch_assoc']($request)) { $context['activation_numbers'][$row['is_activated']] = $row['total_members']; } $smcFunc['db_free_result']($request); foreach ($context['activation_numbers'] as $activation_type => $total_members) { if (in_array($activation_type, array(0, 2))) { $context['awaiting_activation'] += $total_members; } elseif (in_array($activation_type, array(3, 4, 5))) { $context['awaiting_approval'] += $total_members; } } // For the page header... do we show activation? $context['show_activate'] = !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 || !empty($context['awaiting_activation']); // What about approval? $context['show_approve'] = !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2 || !empty($context['awaiting_approval']) || !empty($modSettings['approveAccountDeletion']); // Setup the admin tabs. $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['admin_members'], 'help' => 'view_members', 'description' => $txt['admin_members_list'], 'tabs' => array()); $context['tabs'] = array('viewmembers' => array('label' => $txt['view_all_members'], 'description' => $txt['admin_members_list'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=all', 'is_selected' => $_REQUEST['sa'] == 'all'), 'search' => array('label' => $txt['mlist_search'], 'description' => $txt['admin_members_list'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=search', 'is_selected' => $_REQUEST['sa'] == 'search' || $_REQUEST['sa'] == 'query'), 'approve' => array('label' => sprintf($txt['admin_browse_awaiting_approval'], $context['awaiting_approval']), 'description' => $txt['admin_browse_approve_desc'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=approve', 'is_selected' => false), 'activate' => array('label' => sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), 'description' => $txt['admin_browse_activate_desc'], 'url' => $scripturl . '?action=admin;area=viewmembers;sa=browse;type=activate', 'is_selected' => false, 'is_last' => true)); // Sort out the tabs for the ones which may not exist! if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) { $context['tabs']['approve']['is_last'] = true; unset($context['tabs']['activate']); } if (!$context['show_approve'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'approve')) { if (!$context['show_activate'] && ($_REQUEST['sa'] != 'browse' || $_REQUEST['type'] != 'activate')) { $context['tabs']['search']['is_last'] = true; } unset($context['tabs']['approve']); } $subActions[$_REQUEST['sa']][0](); }
function ViewMembers() { global $txt, $scripturl, $context, $modSettings, $db_prefix; $subActions = array('all' => array('ViewMemberlist', 'moderate_forum'), 'approve' => array('AdminApprove', 'moderate_forum'), 'browse' => array('MembersAwaitingActivation', 'moderate_forum'), 'search' => array('SearchMembers', 'moderate_forum'), 'query' => array('ViewMemberlist', 'moderate_forum')); // Default to sub action 'index' or 'settings' depending on permissions. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'all'; // We know the sub action, now we know what you're allowed to do. isAllowedTo($subActions[$_REQUEST['sa']][1]); // Administration bar, I choose you! adminIndex('view_members'); // Load the essentials. loadLanguage('ManageMembers'); loadTemplate('ManageMembers'); // Get counts on every type of activation - for sections and filtering alike. $request = db_query("\n\t\tSELECT COUNT(*) AS totalMembers, is_activated\n\t\tFROM {$db_prefix}members\n\t\tWHERE is_activated != 1\n\t\tGROUP BY is_activated", __FILE__, __LINE__); $context['activation_numbers'] = array(); $context['awaiting_activation'] = 0; $context['awaiting_approval'] = 0; while ($row = mysql_fetch_assoc($request)) { $context['activation_numbers'][$row['is_activated']] = $row['totalMembers']; } mysql_free_result($request); foreach ($context['activation_numbers'] as $activation_type => $total_members) { if (in_array($activation_type, array(0, 2))) { $context['awaiting_activation'] += $total_members; } elseif (in_array($activation_type, array(3, 4, 5))) { $context['awaiting_approval'] += $total_members; } } // For the page header... do we show activation? $context['show_activate'] = !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 1 || !empty($context['awaiting_activation']); // What about approval? $context['show_approve'] = !empty($modSettings['registration_method']) && $modSettings['registration_method'] == 2 || !empty($context['awaiting_approval']); // Setup the admin tabs. $context['admin_tabs'] = array('title' => $txt[9], 'help' => 'view_members', 'description' => $txt[11], 'tabs' => array()); if (allowedTo('moderate_forum')) { $context['admin_tabs']['tabs'] = array('viewmembers' => array('title' => $txt[303], 'description' => $txt[11], 'href' => $scripturl . '?action=viewmembers;sa=all', 'is_selected' => $_REQUEST['sa'] == 'all'), 'search' => array('title' => $txt['mlist_search'], 'description' => $txt[11], 'href' => $scripturl . '?action=viewmembers;sa=search', 'is_selected' => $_REQUEST['sa'] == 'search' || $_REQUEST['sa'] == 'query'), 'approve' => array('title' => sprintf($txt['admin_browse_awaiting_approval'], $context['awaiting_approval']), 'description' => $txt['admin_browse_approve_desc'], 'href' => $scripturl . '?action=viewmembers;sa=browse;type=approve', 'is_selected' => false), 'activate' => array('title' => sprintf($txt['admin_browse_awaiting_activate'], $context['awaiting_activation']), 'description' => $txt['admin_browse_activate_desc'], 'href' => $scripturl . '?action=viewmembers;sa=browse;type=activate', 'is_selected' => false, 'is_last' => true)); } // Sort out the tabs for the ones which may not exist! if (!$context['show_activate']) { $context['admin_tabs']['tabs']['approve']['is_last'] = true; unset($context['admin_tabs']['tabs']['activate']); } if (!$context['show_approve']) { if (!$context['show_activate']) { $context['admin_tabs']['tabs']['search']['is_last'] = true; } unset($context['admin_tabs']['tabs']['approve']); } $subActions[$_REQUEST['sa']][0](); }
function sportal_admin_pages_main() { global $context, $txt, $scripturl, $sourcedir; if (!allowedTo('sp_admin')) { isAllowedTo('sp_manage_pages'); } require_once $sourcedir . '/Subs-PortalAdmin.php'; loadTemplate('PortalAdminPages'); $subActions = array('list' => 'sportal_admin_page_list', 'add' => 'sportal_admin_page_edit', 'edit' => 'sportal_admin_page_edit', 'delete' => 'sportal_admin_page_delete', 'status' => 'sportal_admin_page_status'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list'; $context['sub_action'] = $_REQUEST['sa']; $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['sp_admin_pages_title'], 'help' => 'sp_PagesArea', 'description' => $txt['sp_admin_pages_desc'], 'tabs' => array('list' => array(), 'add' => array())); $subActions[$_REQUEST['sa']](); }
function ArcadeSettings() { global $scripturl, $txt, $context, $sourcedir, $modSettings; require_once $sourcedir . '/Subs-Arcade.php'; loadLanguage('ArcadeAdmin'); loadArcadeSettings(); loadTemplate('ManageArcade'); $subActions = array('show' => array('ArcadeSettingsShow', 'arcade_admin'), 'edit' => array('ArcadeSettingsEdit', 'arcade_admin'), 'save' => array('ArcadeSettingsSave', 'arcade_admin'), 'editcats' => array('ArcadeCategoryEdit', 'arcade_admin'), 'savecats' => array('ArcadeCategorySave', 'arcade_admin'), 'quick' => array('GamesQuickEdit', 'arcade_admin'), 'listgames' => array('GamesAdminList', 'arcade_admin'), 'files' => array('GamesAdminFiles', 'arcade_admin'), 'autofiles' => array('GamesAutoFiles', 'arcade_admin'), 'delete' => array('GamesDelete', 'arcade_admin'), 'upload' => array('GamesUpload', 'arcade_admin'), 'clear' => array('GamesCacheClear', 'arcade_admin'), 'highscore' => array('HighscoreEditor', 'arcade_admin'), 'highscore2' => array('HighscoreEditor2', 'arcade_admin'), 'settopics' => array('GamesTopicUpdater', 'arcade_admin'), 'arc_maintenance' => array('Arcade_Maintenance', 'arcade_admin'), 'fix' => array('Arcade_Fix_Scores', 'arcade_admin'), 'delshout' => array('arcade_del_shouts', 'arcade_admin')); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'show'; isAllowedTo($subActions[$_REQUEST['sa']][1]); // Tabs for browsing the different functions. $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['arcade_admin'], 'help' => '', 'description' => $txt['arcade_description1'], 'tabs' => array('show' => array('description' => $txt['arcade_description1'], 'href' => $scripturl . '?action=admin;area=managearcade;sa=show'), 'edit' => array('description' => $txt['arcade_description2'], 'href' => $scripturl . '?action=admin;area=managearcade;sa=edit'), 'editcats' => array('description' => $txt['arcade_description3'], 'href' => $scripturl . '?action=admin;area=managearcade;sa=editcats'), 'listgames' => array('description' => $txt['arcade_description4'], 'href' => $scripturl . '?action=admin;area=managearcade;sa=listgames'), 'files' => array('description' => $txt['arcade_description5'], 'href' => $scripturl . '?action=admin;area=managearcade;sa=files'), 'autofiles' => array('description' => $txt['arcade_description6'], 'href' => $scripturl . '?action=admin;area=managearcade;sa=autofiles'), 'arc_maintenance' => array('description' => $txt['arcade_description7'], 'href' => $scripturl . '?action=admin;area=managearcade;sa=arc_maintenance'))); $subActions[$_REQUEST['sa']][0](); }
function ManagePostSettings() { global $context, $txt, $scripturl; // Make sure you can be here. isAllowedTo('admin_forum'); $subActions = array('posts' => 'ModifyPostSettings', 'bbc' => 'ModifyBBCSettings', 'censor' => 'SetCensor', 'topics' => 'ModifyTopicSettings'); // Default the sub-action to 'posts'. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'posts'; $context['page_title'] = $txt['manageposts_title']; // Tabs for browsing the different ban functions. $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['manageposts_title'], 'help' => 'posts_and_topics', 'description' => $txt['manageposts_description'], 'tabs' => array('posts' => array('description' => $txt['manageposts_settings_description']), 'bbc' => array('description' => $txt['manageposts_bbc_settings_description']), 'censor' => array('description' => $txt['admin_censored_desc']), 'topics' => array('description' => $txt['manageposts_topic_settings_description']))); // Call the right function for this sub-action. $subActions[$_REQUEST['sa']](); }
function globalhf() { //Check if the current user can change headers footers isAllowedTo('admin_forum'); loadtemplate('globalhf'); //Global Headers Footers Actions $subActions = array('view' => 'view', 'save' => 'save'); // Follow the sa or just go to View function if (!empty($subActions[@$_GET['sa']])) { $subActions[@$_GET['sa']](); } else { $subActions['view'](); } }
/** * Handling function for generating reports. * - Requires the admin_forum permission. * - Loads the Reports template and language files. * - Decides which type of report to generate, if this isn't passed * through the querystring it will set the report_type sub-template to * force the user to choose which type. * - When generating a report chooses which sub_template to use. * - Depends on the cal_enabled setting, and many of the other cal_ settings. * - Will call the relevant report generation function. * - If generating report will call finishTables before returning. * * Accessed through ?action=admin;area=reports. * * @see Action_Controller::action_index() */ public function action_index() { global $txt, $context, $scripturl; // Only admins, only EVER admins! isAllowedTo('admin_forum'); // Let's get our things running... loadTemplate('Reports'); loadLanguage('Reports'); $context['page_title'] = $txt['generate_reports']; // These are the types of reports which exist - and the functions to generate them. $context['report_types'] = array('boards' => 'action_boards', 'board_perms' => 'action_board_perms', 'member_groups' => 'action_member_groups', 'group_perms' => 'action_group_perms', 'staff' => 'action_staff'); call_integration_hook('integrate_report_types'); // Load up all the tabs... $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['generate_reports'], 'help' => '', 'description' => $txt['generate_reports_desc']); $is_first = 0; foreach ($context['report_types'] as $k => $temp) { $context['report_types'][$k] = array('id' => $k, 'title' => isset($txt['gr_type_' . $k]) ? $txt['gr_type_' . $k] : $k, 'description' => isset($txt['gr_type_desc_' . $k]) ? $txt['gr_type_desc_' . $k] : null, 'function' => $temp, 'is_first' => $is_first++ == 0); } // If they haven't choosen a report type which is valid, send them off to the report type chooser! if (empty($_REQUEST['rt']) || !isset($context['report_types'][$_REQUEST['rt']])) { $context['sub_template'] = 'report_type'; return; } $context['report_type'] = $_REQUEST['rt']; $context['sub_template'] = 'generate_report'; // What are valid templates for showing reports? $reportTemplates = array('main' => array('layers' => null), 'print' => array('layers' => array('print'))); // Specific template? Use that instead of main! if (isset($_REQUEST['st']) && isset($reportTemplates[$_REQUEST['st']])) { $context['sub_template'] = $_REQUEST['st']; // Are we disabling the other layers - print friendly for example? if ($reportTemplates[$_REQUEST['st']]['layers'] !== null) { $template_layers = Template_Layers::getInstance(); $template_layers->removeAll(); foreach ($reportTemplates[$_REQUEST['st']]['layers'] as $layer) { $template_layers->add($layer); } } } // Make the page title more descriptive. $context['page_title'] .= ' - ' . (isset($txt['gr_type_' . $context['report_type']]) ? $txt['gr_type_' . $context['report_type']] : $context['report_type']); // Build the reports button array. $context['report_buttons'] = array('generate_reports' => array('text' => 'generate_reports', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports', 'active' => true), 'print' => array('text' => 'print', 'image' => 'print.png', 'lang' => true, 'url' => $scripturl . '?action=admin;area=reports;rt=' . $context['report_type'] . ';st=print', 'custom' => 'target="_blank"')); // Allow mods to add additional buttons here call_integration_hook('integrate_report_buttons'); // Now generate the data. $this->{$context['report_types'][$context['report_type']]['function']}(); // Finish the tables before exiting - this is to help the templates a little more. finishTables(); }
function ManageShoutbox() { global $txt, $context, $scripturl; isAllowedTo('admin_forum'); $context['sub_action'] = 'shoutbox'; if (loadLanguage('Shoutbox') == false) { loadLanguage('Shoutbox', 'english'); } loadTemplate('ManageShoutbox'); $context['page_title'] = $txt['sba_1']; $subActions = array('settings' => 'ManageShoutbox_Settings', 'settings2' => 'ManageShoutbox_Settings2'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'settings'; $subActions[$_REQUEST['sa']](); }
/** * Dispaches to the right function based on the given subaction. * Checks the permissions, based on the sub-action. * Called by ?action=managepermissions. * * @uses ManagePermissions language file. */ function ModifyPermissions() { global $txt, $scripturl, $context; loadLanguage('ManagePermissions+ManageMembers'); loadTemplate('ManagePermissions'); // Format: 'sub-action' => array('function_to_call', 'permission_needed'), $subActions = array('board' => array('PermissionByBoard', 'manage_permissions'), 'index' => array('PermissionIndex', 'manage_permissions'), 'modify' => array('ModifyMembergroup', 'manage_permissions'), 'modify2' => array('ModifyMembergroup2', 'manage_permissions'), 'quick' => array('SetQuickGroups', 'manage_permissions'), 'quickboard' => array('SetQuickBoards', 'manage_permissions'), 'postmod' => array('ModifyPostModeration', 'manage_permissions', 'disabled' => !in_array('pm', $context['admin_features'])), 'profiles' => array('EditPermissionProfiles', 'manage_permissions'), 'settings' => array('GeneralPermissionSettings', 'admin_forum')); call_integration_hook('integrate_manage_permissions', array(&$subActions)); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) && empty($subActions[$_REQUEST['sa']]['disabled']) ? $_REQUEST['sa'] : (allowedTo('manage_permissions') ? 'index' : 'settings'); isAllowedTo($subActions[$_REQUEST['sa']][1]); // Create the tabs for the template. $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['permissions_title'], 'help' => 'permissions', 'description' => '', 'tabs' => array('index' => array('description' => $txt['permissions_groups']), 'board' => array('description' => $txt['permission_by_board_desc']), 'profiles' => array('description' => $txt['permissions_profiles_desc']), 'postmod' => array('description' => $txt['permissions_post_moderation_desc']), 'settings' => array('description' => $txt['permission_settings_desc']))); $subActions[$_REQUEST['sa']][0](); }
/** * This just avoids some repetition. * * @param array $subActions = array() * @param string $defaultAction = '' */ function loadGeneralSettingParameters($subActions = array(), $defaultAction = '') { global $context, $txt, $sourcedir; // You need to be an admin to edit settings! isAllowedTo('admin_forum'); loadLanguage('Help'); loadLanguage('ManageSettings'); // Will need the utility functions from here. require_once $sourcedir . '/ManageServer.php'; $context['sub_template'] = 'show_settings'; // By default do the basic settings. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (!empty($defaultAction) ? $defaultAction : array_pop($temp = array_keys($subActions))); $context['sub_action'] = $_REQUEST['sa']; }
function sportal_admin_blocks_main() { global $context, $txt, $scripturl, $sourcedir; if (!allowedTo('sp_admin')) { isAllowedTo('sp_manage_blocks'); } require_once $sourcedir . '/Subs-PortalAdmin.php'; loadTemplate('PortalAdminBlocks'); $subActions = array('list' => 'sportal_admin_block_list', 'header' => 'sportal_admin_block_list', 'left' => 'sportal_admin_block_list', 'top' => 'sportal_admin_block_list', 'bottom' => 'sportal_admin_block_list', 'right' => 'sportal_admin_block_list', 'footer' => 'sportal_admin_block_list', 'add' => 'sportal_admin_block_edit', 'edit' => 'sportal_admin_block_edit', 'delete' => 'sportal_admin_block_delete', 'move' => 'sportal_admin_block_move', 'statechange' => 'sportal_admin_state_change'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list'; $context['sub_action'] = $_REQUEST['sa']; $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['sp-blocksBlocks'], 'help' => 'sp_BlocksArea', 'description' => $txt['sp-adminBlockListDesc'], 'tabs' => array('list' => array('description' => $txt['sp-adminBlockListDesc']), 'add' => array('description' => $txt['sp-adminBlockAddDesc']), 'header' => array('description' => $txt['sp-adminBlockHeaderListDesc']), 'left' => array('description' => $txt['sp-adminBlockLeftListDesc']), 'top' => array('description' => $txt['sp-adminBlockTopListDesc']), 'bottom' => array('description' => $txt['sp-adminBlockBottomListDesc']), 'right' => array('description' => $txt['sp-adminBlockRightListDesc']), 'footer' => array('description' => $txt['sp-adminBlockFooterListDesc']))); $subActions[$_REQUEST['sa']](); }
function sportal_admin_config_main() { global $sourcedir, $context, $txt; if (!allowedTo('sp_admin')) { isAllowedTo('sp_manage_settings'); } require_once $sourcedir . '/Subs-PortalAdmin.php'; require_once $sourcedir . '/ManageServer.php'; loadTemplate('PortalAdmin'); $subActions = array('information' => 'sportal_information', 'generalsettings' => 'sportal_admin_general_settings', 'blocksettings' => 'sportal_admin_block_settings', 'articlesettings' => 'sportal_admin_article_settings'); $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'information'; $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['sp-adminConfiguration'], 'help' => 'sp_ConfigurationArea', 'description' => $txt['sp-adminConfigurationDesc']); $subActions[$_REQUEST['sa']](); }