function AddPost() { global $txt, $mbname, $context, $db_prefix, $sourcedir, $modSettings; loadLanguage('index'); adminIndex('postscheduler_settings'); require_once $sourcedir . '/Subs-Post.php'; // Get the boards. $context['schedule_boards'] = array(); $request = db_query("\n\tSELECT \n\t\tb.ID_BOARD, b.name AS bName, c.name AS cName \n\tFROM {$db_prefix}boards AS b, {$db_prefix}categories AS c \n\tWHERE b.ID_CAT = c.ID_CAT ORDER BY c.catOrder, b.boardOrder", __FILE__, __LINE__); while ($row = mysql_fetch_assoc($request)) { $context['schedule_boards'][$row['ID_BOARD']] = $row['cName'] . ' - ' . $row['bName']; } mysql_free_result($request); // Load Message Icons $context['msg_icons'] = array(); $result = db_query("SELECT title, filename\n\t\t\t\tFROM {$db_prefix}message_icons\n\t\t\t\t", __FILE__, __LINE__); while ($row = mysql_fetch_assoc($result)) { $context['msg_icons'][] = $row; } $context['page_title'] = $mbname . ' - ' . $txt['postscheduler_addpost']; // Set the page title $context['sub_template'] = 'addpost'; // Check if spellchecking is both enabled and actually working. $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new'); $context['post_box_name'] = 'message'; $context['post_form'] = 'frmfeed'; }
public function testInstall($verify = 1) { global $DB; // Delete if Table of Monitoring yet in DB $query = "SHOW FULL TABLES WHERE TABLE_TYPE LIKE 'VIEW'"; $result = $DB->query($query); while ($data = $DB->fetch_array($result)) { if (strstr($data[0], "monitoring")) { $DB->query("DROP VIEW " . $data[0]); } } $query = "SHOW TABLES"; $result = $DB->query($query); while ($data = $DB->fetch_array($result)) { if (strstr($data[0], "monitoring")) { $DB->query("DROP TABLE " . $data[0]); } } passthru("cd ../tools && /usr/local/bin/php -f cli_install.php"); $_SESSION['glpi_use_mode'] = 2; $_SESSION["glpiID"] = 2; Plugin::load("monitoring"); loadLanguage("en_GB"); if ($verify == '1') { $MonitoringInstall = new MonitoringInstall(); $MonitoringInstall->testDB("monitoring"); } $GLPIlog = new GLPIlogs(); $GLPIlog->testSQLlogs(); $GLPIlog->testPHPlogs(); }
function ShowAdminHelp() { global $txt, $helptxt, $context, $scripturl; if (!isset($_GET['help']) || !is_string($_GET['help'])) { fatal_lang_error('no_access', false); } if (!isset($helptxt)) { $helptxt = array(); } // Load the admin help language file and template. loadLanguage('Help'); // Permission specific help? if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp') { loadLanguage('ManagePermissions'); } loadTemplate('Help'); // Set the page title to something relevant. $context['page_title'] = $context['forum_name'] . ' - ' . $txt['help']; // Don't show any template layers, just the popup sub template. $context['template_layers'] = array(); $context['sub_template'] = 'popup'; // What help string should be used? if (isset($helptxt[$_GET['help']])) { $context['help_text'] = $helptxt[$_GET['help']]; } elseif (isset($txt[$_GET['help']])) { $context['help_text'] = $txt[$_GET['help']]; } else { $context['help_text'] = $_GET['help']; } // Does this text contain a link that we should fill in? if (preg_match('~%([0-9]+\\$)?s\\?~', $context['help_text'], $match)) { $context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']); } }
public static function load_theme() { global $context, $modSettings, $txt, $settings, $user_info; if (($themes = cache_get_data('TS_themes_list', 3600)) === null) { loadLanguage('ManageThemes'); require_once SUBSDIR . '/Themes.subs.php'; $themes = availableThemes($user_info['theme'], $user_info['id']); cache_put_data('TS_themes_list', $themes, 3600); } foreach ($themes[0] as $theme_id => $theme) { $name = $theme['name']; $selected = !empty($user_info['theme']) && $user_info['theme'] == $theme_id; $context['ThemeSelector'][$theme_id] = array('name' => $name, 'selected' => $selected, 'variants' => array()); if (isset($theme['variants'])) { foreach ($theme['variants'] as $key => $variant) { $context['ThemeSelector'][$theme_id]['variants'][$key] = array('name' => $variant['label'], 'selected' => $context['theme_variant'] == '_' . $key); } } } if (!isset($context['theme_header_callbacks'])) { $context['theme_header_callbacks'] = array(); } $context['theme_header_callbacks'][] = 'themeselector'; loadTemplate('ThemeSelector'); loadJavascriptFile('ThemeSelector.js'); loadCSSFile('ThemeSelector.css'); }
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 ManageSmileys() { global $context, $txt, $scripturl, $modSettings; isAllowedTo('manage_smileys'); adminIndex('manage_smileys'); loadLanguage('ManageSmileys'); loadTemplate('ManageSmileys'); $subActions = array('addsmiley' => 'AddSmiley', 'editicon' => 'EditMessageIcons', 'editicons' => 'EditMessageIcons', 'editsets' => 'EditSmileySets', 'editsmileys' => 'EditSmileys', 'import' => 'EditSmileySets', 'modifyset' => 'EditSmileySets', 'modifysmiley' => 'EditSmileys', 'setorder' => 'EditSmileyOrder', 'settings' => 'EditSmileySettings', 'install' => 'InstallSmileySet'); // Default the sub-action to 'edit smiley settings'. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'settings'; $context['page_title'] =& $txt['smileys_manage']; $context['sub_action'] = $_REQUEST['sa']; $context['sub_template'] =& $context['sub_action']; // Load up all the tabs... $context['admin_tabs'] = array('title' => &$txt['smileys_manage'], 'help' => 'smileys', 'description' => $txt['smiley_settings_explain'], 'tabs' => array('editsets' => array('title' => $txt['smiley_sets'], 'description' => $txt['smiley_editsets_explain'], 'href' => $scripturl . '?action=smileys;sa=editsets'), 'addsmiley' => array('title' => $txt['smileys_add'], 'description' => $txt['smiley_addsmiley_explain'], 'href' => $scripturl . '?action=smileys;sa=addsmiley'), 'editsmileys' => array('title' => $txt['smileys_edit'], 'description' => $txt['smiley_editsmileys_explain'], 'href' => $scripturl . '?action=smileys;sa=editsmileys'), 'setorder' => array('title' => $txt['smileys_set_order'], 'description' => $txt['smiley_setorder_explain'], 'href' => $scripturl . '?action=smileys;sa=setorder'), 'editicons' => array('title' => $txt['icons_edit_message_icons'], 'description' => $txt['icons_edit_icons_explain'], 'href' => $scripturl . '?action=smileys;sa=editicons'), 'settings' => array('title' => $txt['settings'], 'description' => $txt['smiley_settings_explain'], 'href' => $scripturl . '?action=smileys;sa=settings', 'is_last' => true))); // Select the right tab based on the sub action. if (isset($context['admin_tabs']['tabs'][$context['sub_action']])) { $context['admin_tabs']['tabs'][$context['sub_action']]['is_selected'] = true; } // Some settings may not be enabled, disallow these from the tabs as appropriate. if (empty($modSettings['messageIcons_enable'])) { unset($context['admin_tabs']['tabs']['editicons']); } if (empty($modSettings['smiley_enable'])) { unset($context['admin_tabs']['tabs']['addsmiley']); unset($context['admin_tabs']['tabs']['editsmileys']); unset($context['admin_tabs']['tabs']['setorder']); } // Call the right function for this sub-acton. $subActions[$_REQUEST['sa']](); }
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']](); }
function ManageSmileys() { global $context, $txt, $scripturl, $modSettings; isAllowedTo('manage_smileys'); loadLanguage('ManageSmileys'); loadAdminTemplate('ManageSmileys'); $subActions = array('addsmiley' => 'AddSmiley', 'editicon' => 'EditMessageIcons', 'editicons' => 'EditMessageIcons', 'editsets' => 'EditSmileySets', 'editsmileys' => 'EditSmileys', 'import' => 'EditSmileySets', 'modifyset' => 'EditSmileySets', 'modifysmiley' => 'EditSmileys', 'setorder' => 'EditSmileyOrder', 'settings' => 'EditSmileySettings', 'install' => 'InstallSmileySet'); // Default the sub-action to 'edit smiley settings'. $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'editsets'; $context['page_title'] = $txt['smileys_manage']; $context['sub_action'] = $_REQUEST['sa']; $context['sub_template'] = $context['sub_action']; // Load up all the tabs... $context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['smileys_manage'], 'help' => 'smileys', 'description' => $txt['smiley_settings_explain'], 'tabs' => array('editsets' => array('description' => $txt['smiley_editsets_explain']), 'addsmiley' => array('description' => $txt['smiley_addsmiley_explain']), 'editsmileys' => array('description' => $txt['smiley_editsmileys_explain']), 'setorder' => array('description' => $txt['smiley_setorder_explain']), 'editicons' => array('description' => $txt['icons_edit_icons_explain']), 'settings' => array('description' => $txt['smiley_settings_explain']))); // Some settings may not be enabled, disallow these from the tabs as appropriate. if (empty($modSettings['messageIcons_enable'])) { $context[$context['admin_menu_name']]['tab_data']['tabs']['editicons']['disabled'] = true; } if (empty($modSettings['smiley_enable'])) { $context[$context['admin_menu_name']]['tab_data']['tabs']['addsmiley']['disabled'] = true; $context[$context['admin_menu_name']]['tab_data']['tabs']['editsmileys']['disabled'] = true; $context[$context['admin_menu_name']]['tab_data']['tabs']['setorder']['disabled'] = true; } // Call the right function for this sub-acton. $subActions[$_REQUEST['sa']](); }
function Packages() { global $txt, $sourcedir, $context; //!!! Remove this! if (isset($_GET['get']) || isset($_GET['pgdownload'])) { require_once $sourcedir . '/PackageGet.php'; return PackageGet(); } isAllowedTo('admin_forum'); // Load all the basic stuff. require_once $sourcedir . '/lib/Subs-Package.php'; loadLanguage('Packages'); loadAdminTemplate('Packages'); $context['page_title'] = $txt['package']; // Delegation makes the world... that is, the package manager go 'round. $subActions = array('browse' => 'PackageBrowse', 'remove' => 'PackageRemove', 'list' => 'PackageList', 'ftptest' => 'PackageFTPTest', 'install' => 'PackageInstallTest', 'install2' => 'PackageInstall', 'uninstall' => 'PackageInstallTest', 'uninstall2' => 'PackageInstall', 'installed' => 'InstalledList', 'options' => 'PackageOptions', 'perms' => 'PackagePermissions', 'flush' => 'FlushInstall', 'examine' => 'ExamineFile', 'showoperations' => 'ViewOperations'); // 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[$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']))); // Call the function we're handing control to. $subActions[$context['sub_action']](); }
/** * Config array for chaning the karma settings * Accessed from ?action=admin;area=featuresettings;sa=karma; * * @param $return_config */ function ModifyKarmaSettings($return_config = false) { global $txt, $scripturl, $context, $modSettings; loadLanguage('Karma+ManageKarma'); if (empty($modSettings['karmaMode'])) { $config_vars = array(array('select', 'karmaMode', explode('|', $txt['karma_options']))); } else { $config_vars = array(array('select', 'karmaMode', explode('|', $txt['karma_options'])), '', array('int', 'karmaMinPosts', 6, 'postinput' => strtolower($txt['posts'])), array('float', 'karmaWaitTime', 6, 'postinput' => $txt['hours']), array('check', 'karmaTimeRestrictAdmins')); } call_integration_hook('integrate_karma_settings', array(&$config_vars)); if ($return_config) { return $config_vars; } // Saving? if (isset($_GET['save'])) { checkSession(); call_integration_hook('integrate_save_karma_settings'); saveDBSettings($config_vars); $_SESSION['adm-save'] = true; redirectexit('action=admin;area=featuresettings;sa=karma'); } $context['post_url'] = $scripturl . '?action=admin;area=featuresettings;save;sa=karma'; $context['settings_title'] = $txt['karma']; loadLanguage('ManageKarma'); prepareDBSettingContext($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 AddPost() { global $txt, $mbname, $context, $smcFunc, $sourcedir, $modSettings; loadLanguage('index'); require_once $sourcedir . '/Subs-Post.php'; // Get the boards. $context['schedule_boards'] = array(); $request = $smcFunc['db_query']('', "\n\tSELECT \n\t\tb.ID_BOARD, b.name AS bName, c.name AS cName \n\tFROM {db_prefix}boards AS b, {db_prefix}categories AS c \n\tWHERE b.ID_CAT = c.ID_CAT ORDER BY c.cat_order, b.board_order"); while ($row = $smcFunc['db_fetch_assoc']($request)) { $context['schedule_boards'][$row['ID_BOARD']] = $row['cName'] . ' - ' . $row['bName']; } $smcFunc['db_free_result']($request); // Load Message Icons $context['msg_icons'] = array(); $result = $smcFunc['db_query']('', "SELECT title, filename\n\t\t\t\tFROM {db_prefix}message_icons\n\t\t\t\t"); while ($row = $smcFunc['db_fetch_assoc']($result)) { $context['msg_icons'][] = $row; } $context['page_title'] = $mbname . ' - ' . $txt['postscheduler_addpost']; // Set the page title $context['sub_template'] = 'addpost'; // Check if spellchecking is both enabled and actually working. $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new'); $context['post_box_name'] = 'message'; $context['post_form'] = 'frmfeed'; // Needed for the WYSIWYG editor. require_once $sourcedir . '/Subs-Editor.php'; // Now create the editor. $editorOptions = array('id' => 'message', 'value' => '', 'width' => '90%', 'form' => 'frmfeed', 'labels' => array('addpost' => $txt['postscheduler_addpost'])); create_control_richedit($editorOptions); $context['post_box_name'] = $editorOptions['id']; }
function ENotifyMain() { global $modSettings; // Guests can't have unread things, we don't know anything about them. is_not_guest(); // Update our unread replies log if (!empty($modSettings['enotify_replies'])) { ENotifyUpdateUnreadReplies(); } // Update our personal messages log if (!empty($modSettings['enotify_pms'])) { ENotifyUpdatePms(); } // Load up the notifications at last :) ENotifyLoad(); // Run our garbage collection randomly (setting 0.05% chance for it to run) $random = rand(1, 5000); if ($random == '1987') { ENotifyGarbageCollect(); } // Load the language and the template file. loadLanguage('ENotify'); loadTemplate('ENotify'); template_enotify_main(); // We use this to deactivate the SMF Wrapping Templates die; }
public static function member_context(&$memID, $display_custom_fields) { global $context, $modSettings, $memberContext, $scripturl, $txt; static $karma; loadLanguage('Karma'); if (!empty($modSettings['karmaMode']) && $display_custom_fields) { if (empty($karma[$memID])) { $karma = loadMemberCustomFields($memID, array('karma_good', 'karma_bad')); } if (empty($karma[$memID]['karma_good']['value'])) { $karma[$memID]['karma_good']['value'] = 0; } if (empty($karma[$memID]['karma_bad']['value'])) { $karma[$memID]['karma_bad']['value'] = 0; } // Total or +/-? if ($modSettings['karmaMode'] == 1) { $value = $karma[$memID]['karma_good']['value'] - $karma[$memID]['karma_bad']['value']; } elseif ($modSettings['karmaMode'] == 2) { $value = '+' . $karma[$memID]['karma_good']['value'] . ' / -' . $karma[$memID]['karma_bad']['value']; } $memberContext[$memID]['custom_fields'][] = array('title' => $txt['karma'], 'col_name' => 'karma', 'value' => $value, 'placement' => 6); $memberContext[$memID]['custom_fields'][] = array('title' => '', 'col_name' => 'karma_labels', 'value' => ' <a href="' . $scripturl . '?action=karma;sa=applaud;uid=' . $memID . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['karmaApplaudLabel'] . '</a> <a href="' . $scripturl . '?action=karma;sa=smite;uid=' . $memID . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['karmaSmiteLabel'] . '</a>', 'placement' => 6); } }
function RegbarWarning() { global $context, $settings; loadLanguage('smfhacks_languages/regbar-warning'); loadTemplate('smfhacks_templates/regbar-warning'); $context['html_headers'] .= "\n" . '<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/smfhacks_css/regbar-warning.css" />'; loadSubTemplate('regbar_warning'); }
function icv_recaptcha(&$known_verifications) { // Because we are reusing all the settings, better unset it first $key = array_search('captcha', $known_verifications); unset($known_verifications[$key]); $known_verifications[] = 'ReCaptcha'; loadLanguage('reCaptcha'); }
function bans_main() { global $txt, $sourcedir, $boardurl, $context, $forum_version, $user_info; $db = database(); loadLanguage('Admin'); bans_loadLanguage(); $context['sub_template'] = 'ban_script'; // Sorry, only logged in admins... isAllowedTo('admin_forum'); if (isset($_POST['save']) && empty($context['errors'])) { banScript(); } if (!empty($_POST['check_board'])) { $context['id_board_to_check'] = (int) $_POST['id_board']; $context['id_topic_to_start'] = (int) $_POST['id_topic']; } if (!empty($context['id_board_to_check']) && empty($context['errors'])) { // Making a list is not hard with this beauty. require_once $sourcedir . '/Subs-List.php'; // Use the standard templates for showing this. $listOptions = array('id' => 'to_be_banned', 'title' => $txt['bans'], 'items_per_page' => 25, 'base_href' => $boardurl, 'get_items' => array('function' => 'list_getToBeBans'), 'get_count' => array('function' => 'list_getNumToBeBans'), 'columns' => array('name' => array('header' => array('value' => $txt['username']), 'data' => array('db' => 'member_name')), 'warning' => array('header' => array('value' => $txt['warning_status']), 'data' => array('db' => 'warning')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$data', ' return \'<input type="checkbox" name="remove[]" value="\' . $data[\'id_member\'] . \'" class="input_check" />\'; '), 'class' => 'centertext'))), 'form' => array('href' => $boardurl . '/ban_script.php?' . $context['session_var'] . '=' . $context['session_id']), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="add_to_ban" value="' . $txt['ban_add'] . '" class="button_submit" />', 'class' => 'righttext'))); $context['sub_template'] = 'show_list'; $context['default_list'] = 'to_be_banned'; // Create the request list. createList($listOptions); } elseif (isset($_POST['remove'])) { // Process the IDs from the list $id_to_bans = array(); $context['to_bans'] = array(); foreach ($_POST['remove'] as $id_member) { $id_to_bans[] = (int) $id_member; } $context['id_to_bans'] = array_unique($id_to_bans); $request = $db->query('', ' SELECT member_name FROM {db_prefix}members WHERE id_member IN ({array_int:id_members})', array('id_members' => $context['id_to_bans'])); while ($row = $db->fetch_assoc($request)) { $context['to_bans'][] = $row['member_name']; } // Let's show the forms to do the actual ban $context['ban_forms'] = true; $context['ban_names'] = bans_getBanNames(); } else { $context['to_bans'] = array(); if (!empty($_POST['to_bans'])) { $to_bans = explode(',', $_POST['to_bans']); foreach ($to_bans as $IDs) { $context['to_bans'][] = $IDs; } } // First time visit, everything clear! $context['ban_forms'] = true; $context['ban_names'] = bans_getBanNames(); } }
function TPCredits() { tp_hidebars(); $context['TPortal']['not_forum'] = false; if (loadLanguage('TPhelp') == false) { loadLanguage('TPhelp', 'english'); } loadtemplate('TPhelp'); }
/** * Function for getting translated message from lang */ function getMessage($messageKey) { $lang = loadLanguage(); if (array_key_exists($messageKey, $lang)) { return $lang[$messageKey]; } else { return $messageKey; } }
function sportal_credits() { global $sourcedir, $context, $txt; require_once $sourcedir . '/PortalAdminMain.php'; loadLanguage('SPortalAdmin', sp_languageSelect('SPortalAdmin')); sportal_information(false); $context['page_title'] = $txt['sp-info_title']; $context['sub_template'] = 'information'; }
function GHF_Settings(&$config_vars) { // Load the language loadLanguage('GHF'); // Add the settings $ghf = array(array('large_text', 'global_head', '4'), array('large_text', 'global_mid', '4'), array('large_text', 'global_foot', '4'), array('text', 'global_copy', '30'), ''); // Insert after all available slice. $first = array_slice($config_vars, 0); $config_vars = array_merge($first, $ghf); }
function TagsMain() { loadtemplate('Tagging'); loadLanguage('Tagging'); $subActions = array('addtag' => 'TaggingSystem_Add', 'submittag' => 'TaggingSystem_Submit', 'deletetag' => 'TaggingSystem_Delete', 'admin' => 'TagsSettings', 'admin2' => 'TagsSettings2', 'cleanup' => 'TagCleanUp'); if (!empty($subActions[@$_GET['sa']])) { $subActions[$_GET['sa']](); } else { ViewTags(); } }
/** * Starts a new list * Makes sure the passed list contains the miniumn needed options to create a list * Loads the options in to this instance * * @param mixed[] $listOptions */ public function __construct($listOptions) { // First make sure the array is constructed properly. $this->_validateListOptions($listOptions); // Now that we've done that, let's set it, we're gonna need it! $this->_listOptions = $listOptions; // Be ready for those pesky errors loadLanguage('Errors'); // Load the template loadTemplate('GenericList'); }
/** * Test the settings for admin search */ public function testSettings() { // trick loadLanguage('Admin'); $controller = new ManagePosts_Controller(); $settings = $controller->settings_search(); // Lets see some hardcoded setting for posts management... $this->assertNotNull($settings); $this->assertTrue(in_array(array('check', 'removeNestedQuotes'), $settings)); $this->assertTrue(in_array(array('int', 'spamWaitTime', 'postinput' => 'seconds'), $settings)); }
/** * Creates a docker image based on the requested language with the given user script added to the image for execution. * * @param string $languageName One of the supported languages. * @param string $script The file path to the user's submission to test. * @param array $constants An array of constants to set. * @return array A description of the docker image that was created. * @throws Exception if unable to create docker image */ function createImage($languageName, $script, array $constants) { $image = loadLanguage($languageName); $scriptContents = file_get_contents($script); if ($scriptContents === false) { throw new \Exception('Failed to read user script.'); } foreach ($constants as $constantName => $constantValue) { $scriptContents = $image['addConstant']($scriptContents, $constantName, $constantValue); } return buildImage($image, ['/tmp/userScript' => $scriptContents]); }
function GlobalHF() { global $context, $settings, $txt, $global_hf; define('GlobalHF_VERSION', '<a href="http://custom.simplemachines.org/mods/index.php?mod=351" target="_blank">Global Headers and Footers 2.0.1</a>'); define('GlobalHF_COPYRIGHT', 'Copyright <a href="http://www.smfhacks.com/" target="_blank">SMFHacks.com</a> 2012'); $context['insert_after_template'] .= '<div class="centertext smalltext">' . GlobalHF_VERSION . ' | ' . GlobalHF_COPYRIGHT . '</div>'; loadLanguage('smfhacks_languages/global-hf'); loadTemplate('smfhacks_templates/global-hf', array('smfhacks_css/global-hf')); GlobalHFCheckSaving(); $context['page_title'] = $txt['global_hf']['title']; $context['sub_template'] = 'global_hf_admin'; }
/** * This is the entry point for all things post moderation. * * @uses ModerationCenter template * @uses ModerationCenter language file * @see Action_Controller::action_index() */ public function action_index() { // @todo We'll shift these later bud. loadLanguage('ModerationCenter'); loadTemplate('ModerationCenter'); require_once SUBSDIR . '/Action.class.php'; // Allowed sub-actions, you know the drill by now! $subActions = array('approve' => array($this, 'action_approve'), 'attachments' => array($this, 'action_unapproved_attachments'), 'replies' => array($this, 'action_unapproved'), 'topics' => array($this, 'action_unapproved')); // Pick something valid... $action = new Action(); $subAction = $action->initialize($subActions, 'replies'); $action->dispatch($subAction); }
function getServerVersions($checkFor) { global $txt, $db_connection, $_PHPA, $smcFunc, $memcached, $modSettings; loadLanguage('Admin'); $versions = array(); // Is GD available? If it is, we should show version information for it too. if (in_array('gd', $checkFor) && function_exists('gd_info')) { $temp = gd_info(); $versions['gd'] = array('title' => $txt['support_versions_gd'], 'version' => $temp['GD Version']); } // Now lets check for the Database. if (in_array('db_server', $checkFor)) { db_extend(); if (!isset($db_connection) || $db_connection === false) { trigger_error('getServerVersions(): you need to be connected to the database in order to get its server version', E_USER_NOTICE); } else { $versions['db_server'] = array('title' => sprintf($txt['support_versions_db'], $smcFunc['db_title']), 'version' => ''); $versions['db_server']['version'] = $smcFunc['db_get_version'](); } } // If we're using memcache we need the server info. if (empty($memcached) && function_exists('memcache_get') && isset($modSettings['cache_memcached']) && trim($modSettings['cache_memcached']) != '') { get_memcached_server(); } // Check to see if we have any accelerators installed... if (in_array('mmcache', $checkFor) && defined('MMCACHE_VERSION')) { $versions['mmcache'] = array('title' => 'Turck MMCache', 'version' => MMCACHE_VERSION); } if (in_array('eaccelerator', $checkFor) && defined('EACCELERATOR_VERSION')) { $versions['eaccelerator'] = array('title' => 'eAccelerator', 'version' => EACCELERATOR_VERSION); } if (in_array('phpa', $checkFor) && isset($_PHPA)) { $versions['phpa'] = array('title' => 'ionCube PHP-Accelerator', 'version' => $_PHPA['VERSION']); } if (in_array('apc', $checkFor) && extension_loaded('apc')) { $versions['apc'] = array('title' => 'Alternative PHP Cache', 'version' => phpversion('apc')); } if (in_array('memcache', $checkFor) && function_exists('memcache_set')) { $versions['memcache'] = array('title' => 'Memcached', 'version' => empty($memcached) ? '???' : memcache_get_version($memcached)); } if (in_array('xcache', $checkFor) && function_exists('xcache_set')) { $versions['xcache'] = array('title' => 'XCache', 'version' => XCACHE_VERSION); } if (in_array('php', $checkFor)) { $versions['php'] = array('title' => 'PHP', 'version' => PHP_VERSION); } if (in_array('server', $checkFor)) { $versions['server'] = array('title' => $txt['support_versions_server'], 'version' => $_SERVER['SERVER_SOFTWARE']); } return $versions; }
function UPInternalPageMain() { global $sourcedir, $context, $ultimateportalSettings; //load template and language loadtemplate('UPInternalPage'); loadLanguage('UPInternalPage'); //Is active the Internal Page module? if (empty($ultimateportalSettings['ipage_enable'])) { fatal_lang_error('ultport_error_no_active', false); } $subActions = array('main' => 'IPMain', 'view' => 'View', 'add' => 'Add', 'edit' => 'Edit', 'delete' => 'Delete', 'inactive' => 'Inactive', 'view-inactive' => 'ViewInactive'); $_REQUEST['sa'] = !empty($_REQUEST['sa']) && !empty($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main'; $subActions[$_REQUEST['sa']](); }