本文整理汇总了PHP中saveDBSettings函数的典型用法代码示例。如果您正苦于以下问题:PHP saveDBSettings函数的具体用法?PHP saveDBSettings怎么用?PHP saveDBSettings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveDBSettings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EditSearchSettings
/**
* Edit some general settings related to the search function.
* Called by ?action=admin;area=managesearch;sa=settings.
* Requires the admin_forum permission.
*
* @param $return_config
* @uses ManageSearch template, 'modify_settings' sub-template.
*/
function EditSearchSettings($return_config = false)
{
global $txt, $context, $scripturl, $sourcedir, $modSettings;
// What are we editing anyway?
$config_vars = array(array('permissions', 'search_posts'), array('check', 'simpleSearch'), array('check', 'search_dropdown'), array('int', 'search_results_per_page'), array('int', 'search_max_results', 'subtext' => $txt['search_max_results_disable']), '', array('int', 'search_floodcontrol_time', 'subtext' => $txt['search_floodcontrol_time_desc'], 6, 'postinput' => $txt['seconds']));
call_integration_hook('integrate_modify_search_settings', array(&$config_vars));
// Perhaps the search method wants to add some settings?
require_once $sourcedir . '/Search.php';
$searchAPI = findSearchAPI();
if (is_callable(array($searchAPI, 'searchSettings'))) {
call_user_func_array($searchAPI->searchSettings, array(&$config_vars));
}
if ($return_config) {
return $config_vars;
}
$context['page_title'] = $txt['search_settings_title'];
$context['sub_template'] = 'show_settings';
call_integration_hook('integrate_modify_search_weights', array(&$factors));
// We'll need this for the settings.
require_once $sourcedir . '/ManageServer.php';
// A form was submitted.
if (isset($_REQUEST['save'])) {
checkSession();
call_integration_hook('integrate_save_search_settings');
saveDBSettings($config_vars);
redirectexit('action=admin;area=managesearch;sa=settings;' . $context['session_var'] . '=' . $context['session_id']);
}
// Prep the template!
$context['post_url'] = $scripturl . '?action=admin;area=managesearch;save;sa=settings';
$context['settings_title'] = $txt['search_settings_title'];
// We need this for the in-line permissions
createToken('admin-mp');
prepareDBSettingContext($config_vars);
}
示例2: ModifyKarmaSettings
/**
* 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);
}
示例3: ManageSearchEngineSettings
function ManageSearchEngineSettings($return_config = false)
{
global $context, $txt, $modSettings, $scripturl, $sourcedir, $smcFunc;
$config_vars = array(array('select', 'spider_mode', array($txt['spider_mode_off'], $txt['spider_mode_standard'], $txt['spider_mode_high'], $txt['spider_mode_vhigh']), 'onchange' => 'disableFields();'), 'spider_group' => array('select', 'spider_group', array($txt['spider_group_none'], $txt['membergroups_members'])), array('select', 'show_spider_online', array($txt['show_spider_online_no'], $txt['show_spider_online_summary'], $txt['show_spider_online_detail'], $txt['show_spider_online_detail_admin'])));
// Set up a message.
$context['settings_message'] = '<span class="smalltext">' . sprintf($txt['spider_settings_desc'], $scripturl . '?action=admin;area=logs;sa=pruning;' . $context['session_var'] . '=' . $context['session_id']) . '</span>';
// Do some javascript.
$javascript_function = '
function disableFields()
{
disabledState = document.getElementById(\'spider_mode\').value == 0;';
foreach ($config_vars as $variable) {
if ($variable[1] != 'spider_mode') {
$javascript_function .= '
if (document.getElementById(\'' . $variable[1] . '\'))
document.getElementById(\'' . $variable[1] . '\').disabled = disabledState;';
}
}
$javascript_function .= '
}
disableFields();';
if ($return_config) {
return $config_vars;
}
// We need to load the groups for the spider group thingy.
$request = $smcFunc['db_query']('', '
SELECT id_group, group_name
FROM {db_prefix}membergroups
WHERE id_group != {int:admin_group}
AND id_group != {int:moderator_group}', array('admin_group' => 1, 'moderator_group' => 3));
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$config_vars['spider_group'][2][$row['id_group']] = $row['group_name'];
}
$smcFunc['db_free_result']($request);
// Make sure it's valid - note that regular members are given id_group = 1 which is reversed in Load.php - no admins here!
if (isset($_POST['spider_group']) && !isset($config_vars['spider_group'][2][$_POST['spider_group']])) {
$_POST['spider_group'] = 0;
}
// We'll want this for our easy save.
require_once $sourcedir . '/ManageServer.php';
// Setup the template.
$context['page_title'] = $txt['settings'];
$context['sub_template'] = 'show_settings';
// Are we saving them - are we??
if (isset($_GET['save'])) {
checkSession();
saveDBSettings($config_vars);
recacheSpiderNames();
redirectexit('action=admin;area=sengines;sa=settings');
}
// Final settings...
$context['post_url'] = $scripturl . '?action=admin;area=sengines;save;sa=settings';
$context['settings_title'] = $txt['settings'];
$context['settings_insert_below'] = '
<script type="text/javascript"><!-- // --><![CDATA[
' . $javascript_function . '
// ]]></script>';
// Prepare the settings...
prepareDBSettingContext($config_vars);
}
示例4: gplus_admin
function gplus_admin()
{
global $txt, $scripturl, $context;
$context['sub_template'] = 'show_settings';
$config_vars = array(array('check', 'gp_app_enabled'), array('check', 'gp_app_enabledautolog'), '', array('text', 'gp_app_client_id'), array('text', 'gp_app_client_secret'), '', array('text', 'gp_app_custon_logurl'), array('text', 'gp_app_custon_logimg'), array('int', 'gp_app_detait_gid'), array('select', 'gp_reg_auto', array($txt['gp_dfbregauto'], $txt['gp_dfbregauto1'])), '', array('text', 'gp_app_board_showplus1'));
if (isset($_GET['save'])) {
checkSession();
saveDBSettings($config_vars);
redirectexit('action=admin;area=gplus');
}
$context['post_url'] = $scripturl . '?action=admin;area=gplus;save';
$context['settings_title'] = $txt['gp_googplus'];
prepareDBSettingContext($config_vars);
}
示例5: CLS_ChangeThemeSettings
function CLS_ChangeThemeSettings($return_config = false)
{
global $txt, $scripturl, $context;
$config_vars = array();
$config_vars[] = array('check', 'change_theme_check_top');
$config_vars[] = array('check', 'change_theme_check_bot');
if ($return_config) {
return $config_vars;
}
$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=cls';
if (isset($_GET['save'])) {
checkSession();
saveDBSettings($config_vars);
redirectexit('action=admin;area=modsettings;sa=cls');
}
prepareDBSettingContext($config_vars);
}
示例6: addMenuButtonWithBoardsListAdminSettings
/**
* @param bool $return_config
* @return array config vars
*/
function addMenuButtonWithBoardsListAdminSettings($return_config = false)
{
global $txt, $scripturl, $context;
loadLanguage('MenuButtonWithBoardsList/');
$context['page_title'] = $txt['menu_button_with_boards'];
$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=menu_button_with_boards';
$context['settings_message'] = '';
$config_vars = array(array('title', 'menu_button_with_boards_settings'), array('text', 'menu_button_with_boards_title'), array('text', 'menu_button_with_boards_cats', 'subtext' => $txt['menu_button_with_boards_cats_desc']));
if ($return_config) {
return $config_vars;
}
if (isset($_GET['save'])) {
checkSession();
saveDBSettings($config_vars);
clean_cache();
redirectexit('action=admin;area=modsettings;sa=menu_button_with_boards');
}
prepareDBSettingContext($config_vars);
}
开发者ID:realdigger,项目名称:SMF-Menu-Button-With-Boards-List,代码行数:23,代码来源:Mod-MenuButtonWithBoardsList.php
示例7: ajaxchat_modifySettings
function ajaxchat_modifySettings($return_config = false)
{
global $txt, $scripturl, $context, $settings, $sc, $modSettings;
$config_vars = array(array('check', 'enableShoutBox'), array('check', 'anyPageShoutBox'), array('check', 'enableChatButtonNo'));
if ($return_config) {
return $config_vars;
}
$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=chat';
$context['settings_title'] = $txt['chat'];
// No removing this line you, dirty unwashed mod authors. :p
if (empty($config_vars)) {
$context['settings_save_dont_show'] = true;
$context['settings_message'] = '<div style="text-align: center">' . $txt['modification_no_misc_settings'] . '</div>';
return prepareDBSettingContext($config_vars);
}
// Saving?
if (isset($_GET['save'])) {
checkSession();
$save_vars = $config_vars;
saveDBSettings($save_vars);
redirectexit('action=admin;area=modsettings;sa=chat');
}
prepareDBSettingContext($config_vars);
}
示例8: ModifyGeneralModSettings
/**
* If you have a general mod setting to add stick it here.
*
* @param $return_config
*/
function ModifyGeneralModSettings($return_config = false)
{
global $txt, $scripturl, $context, $settings, $sc, $modSettings;
$config_vars = array();
// Make it even easier to add new settings.
call_integration_hook('integrate_general_mod_settings', array(&$config_vars));
if ($return_config) {
return $config_vars;
}
$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=general';
$context['settings_title'] = $txt['mods_cat_modifications_misc'];
// No removing this line you, dirty unwashed mod authors. :p
if (empty($config_vars)) {
$context['settings_save_dont_show'] = true;
$context['settings_message'] = '<div class="centertext">' . $txt['modification_no_misc_settings'] . '</div>';
return prepareDBSettingContext($config_vars);
}
// Saving?
if (isset($_GET['save'])) {
checkSession();
$save_vars = $config_vars;
call_integration_hook('integrate_save_general_mod_settings', array(&$save_vars));
// This line is to help mod authors do a search/add after if you want to add something here. Keyword: FOOT TAPPING SUCKS!
saveDBSettings($save_vars);
// This line is to help mod authors do a search/add after if you want to add something here. Keyword: I LOVE TEA!
redirectexit('action=admin;area=modsettings;sa=general');
}
// This line is to help mod authors do a search/add after if you want to add something here. Keyword: RED INK IS FOR TEACHERS AND THOSE WHO LIKE PAIN!
prepareDBSettingContext($config_vars);
}
示例9: KB_standalone
function KB_standalone()
{
global $context, $sourcedir, $scripturl, $modSettings, $txt;
require_once $sourcedir . '/ManageServer.php';
$context['sub_template'] = 'show_settings';
$value = false;
$disabled = !empty($modSettings['kb_knowledge_only']) ? false : true;
$config_vars = array(array('check', 'kb_knowledge_only', 'subtext' => $txt['kb_knowledge_only_note']));
$disabled_options = array('kb_disable_pm', 'kb_disable_mlist');
foreach ($disabled_options as $name) {
$value = !isset($modSettings[$name]) ? $value : $modSettings[$name];
$config_vars[] = array('check', $name, 'value' => $value, 'disabled' => $disabled);
}
if (isset($_GET['save'])) {
checkSession();
saveDBSettings($config_vars);
KB_cleanCache();
redirectexit('action=admin;area=kb;sa=kbstand');
}
$context['post_url'] = $scripturl . '?action=admin;area=kb;sa=kbstand;save';
$context['settings_title'] = $txt['kbase_sto'];
prepareDBSettingContext($config_vars);
}
示例10: ModifyDraftSettings
function ModifyDraftSettings($return_config = false)
{
global $txt, $sourcedir, $context, $scripturl, $backend_subdir;
$config_vars = array(array('int', 'enableAutoSaveDrafts', 'subtext' => $txt['draftsave_subnote'], 'postinput' => $txt['manageposts_seconds']));
$context['page_title'] = $txt['manageposts_draft_settings'];
$context['sub_template'] = 'show_settings';
if ($return_config) {
return $config_vars;
}
require_once $sourcedir . '/' . $backend_subdir . '/ManageServer.php';
if (isset($_GET['save'])) {
checkSession();
saveDBSettings($config_vars);
redirectexit('action=admin;area=postsettings;sa=drafts');
}
// Final settings...
$context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=drafts';
$context['settings_title'] = $txt['manageposts_draft_settings'];
prepareDBSettingContext($config_vars);
}
示例11: ArcadeAdminPemission
function ArcadeAdminPemission($return_config = false)
{
global $scripturl, $txt, $modSettings, $context, $settings;
$config_vars = array(array('select', 'arcadePermissionMode', array($txt['arcade_permission_mode_none'], $txt['arcade_permission_mode_category'], $txt['arcade_permission_mode_game'], $txt['arcade_permission_mode_and_both'], $txt['arcade_permission_mode_or_both'])), '', array('check', 'arcadePostPermission'), array('int', 'arcadePostsPlay'), array('int', 'arcadePostsLastDay'), array('int', 'arcadePostsPlayAverage'), '', array('permissions', 'arcade_view', 0, $txt['perm_arcade_view']), array('permissions', 'arcade_play', 0, $txt['perm_arcade_play']), array('permissions', 'arcade_submit', 0, $txt['perm_arcade_submit']));
if ($return_config) {
return $config_vars;
}
if (isset($_GET['save'])) {
checkSession('post');
saveDBSettings($config_vars);
writeLog();
redirectexit('action=admin;area=arcade;sa=permission');
}
$context['post_url'] = $scripturl . '?action=admin;area=arcade;sa=permission;save';
$context['settings_title'] = $txt['arcade_general_permissions'];
$context['sub_template'] = 'show_settings';
prepareDBSettingContext($config_vars);
}
示例12: settings
//.........这里部分代码省略.........
function subform(type, value)
{
document.miniform.minitype.value=type;
document.miniform.value.value=value;
document.miniform.submit();
}
function move(id, value)
{
subform(value, id);
}
</script>';
// if(isset($_POST['tea_useapiabove']))
// {
// $_POST['tea_corpid'] = $corp;
// $_POST['tea_allianceid'] = $alliance;
// unset($_POST['tea_useapiabove']);
// }
// if(!empty($_POST['tea_ts_delrule']
if ($_POST['minitype'] == 'delrule') {
if (!is_numeric($_POST['value'])) {
die("delete value must be number");
}
$this->tea->query("DELETE FROM {db_prefix}tea_ts_rules WHERE id = " . $_POST['value']);
redirectexit('action=admin;area=tea;sa=ts');
} elseif ($_POST['minitype'] == 'up' || $_POST['minitype'] == 'down') {
$id = $_POST['value'];
if (!is_numeric($id)) {
die("move id must be number");
}
$rules = $this->smcFunc['db_query']('', "SELECT id FROM {db_prefix}tea_ts_rules ORDER BY id");
$rules = $this->tea->select($rules);
if (!empty($rules)) {
// foreach($rules as $rule)
// {
// $rl[$rule[1]][$rule[0]] = $rule[0];
// if($rule[0] == $id)
// $main = $rule[1];
// }
// if(isset($main))
// {
// $rules = $rl[$main];
// sort($rules);
foreach ($rules as $i => $rule) {
if ($rule[0] == $id) {
if ($_POST['minitype'] == 'up') {
$move = $rules[$i - 1][0];
} elseif ($_POST['minitype'] == 'down') {
$move = $rules[$i + 1][0];
}
$this->tea->query("UPDATE {db_prefix}tea_ts_rules SET id = -1 WHERE id = " . $move);
$this->tea->query("UPDATE {db_prefix}tea_ts_rules SET id = {$move} WHERE id = " . $id);
$this->tea->query("UPDATE {db_prefix}tea_ts_rules SET id = {$id} WHERE id = -1");
break;
}
}
}
redirectexit('action=admin;area=tea;sa=ts');
}
if (isset($_POST['group'])) {
$this->tea->query("DELETE FROM {db_prefix}tea_ts_groups");
foreach ($_POST['group'] as $g => $v) {
$this->tea->query("\n\t\t\t\t\t\tINSERT INTO {db_prefix}tea_ts_groups\n\t\t\t\t\t\t\t(id, value)\n\t\t\t\t\t\tVALUES \n\t\t\t\t\t\t\t({string:id}, {int:value})", array('id' => $g, 'value' => '1'));
}
}
// Saving?
if (isset($_GET['save'])) {
if ($_POST['tea_ts_addrule_group'] > -1 && !empty($_POST['tea_ts_addrule_tsg'])) {
if (!is_numeric($_POST['tea_ts_addrule_group'])) {
die('Group must be Number');
}
$l = $_POST['tea_ts_addrule_tsg'][0];
$_POST['tea_ts_addrule_tsg'] = substr($_POST['tea_ts_addrule_tsg'], 1);
if (!is_numeric($_POST['tea_ts_addrule_tsg'])) {
die('Group must be Number');
}
if ($l != 's' && $l != 'c') {
die('Channel must be s or c');
}
if ($_POST['tea_ts_addrule_id'] == 'new') {
$this->tea->query('INSERT INTO {db_prefix}tea_ts_rules (smf, ts, tst, nf) VALUES (' . $_POST['tea_ts_addrule_group'] . ', ' . $_POST['tea_ts_addrule_tsg'] . ', \'' . $l . '\', \'' . mysql_real_escape_string($_POST['tea_ts_addrule_nf']) . '\')');
} else {
if (!is_numeric($_POST['tea_ts_addrule_id'])) {
die('ID must be Number or new');
}
$this->tea->query("UPDATE {db_prefix}tea_ts_rules SET smf = " . $_POST['tea_ts_addrule_group'] . ", ts = " . $_POST['tea_ts_addrule_tsg'] . ", tst = '" . $l . "', nf = '" . mysql_real_escape_string($_POST['tea_ts_addrule_nf']) . "' WHERE id = " . $_POST['tea_ts_addrule_id']);
}
}
unset($config_vars[100], $config_vars[101], $config_vars[102], $config_vars[103]);
$config_vars[] = array('select', 'tea_charid', $charlist);
$config_vars[] = array('text', 'tea_ts_info');
saveDBSettings($config_vars);
redirectexit('action=admin;area=tea;sa=ts');
loadUserSettings();
writeLog();
}
$this->context['post_url'] = $scripturl . '?action=admin;area=tea;sa=ts;save';
// $context['settings_title'] = $txt['tea_tea'];
// $context['settings_message'] = $txt['tea_settings_message'];
prepareDBSettingContext($config_vars);
}
示例13: ModifyCacheSettings
function ModifyCacheSettings()
{
global $context, $scripturl, $txt, $helptxt, $sc, $modSettings;
// Cache information is in here, honest.
loadLanguage('ModSettings');
loadLanguage('Help');
// Define the variables we want to edit.
$config_vars = array(array('select', 'cache_enable', array($txt['cache_off'], $txt['cache_level1'], $txt['cache_level2'], $txt['cache_level3'])), array('text', 'cache_memcached'));
// Saving again?
if (isset($_GET['save'])) {
saveDBSettings($config_vars);
redirectexit('action=serversettings;sa=cache;sesc=' . $sc);
}
$context['post_url'] = $scripturl . '?action=serversettings2;save;sa=cache';
$context['settings_title'] = $txt['caching_settings'];
$context['settings_message'] = $txt['caching_information'];
// Detect an optimizer?
if (function_exists('eaccelerator_put')) {
$detected = 'eAccelerator';
} elseif (function_exists('mmcache_put')) {
$detected = 'MMCache';
} elseif (function_exists('apc_store')) {
$detected = 'APC';
} elseif (function_exists('output_cache_put')) {
$detected = 'Zend';
} elseif (function_exists('memcache_set')) {
$detected = 'Memcached';
} else {
$detected = 'no_caching';
}
$context['settings_message'] = sprintf($context['settings_message'], $txt['detected_' . $detected]);
// Prepare the template.
prepareDBSettingContext($config_vars);
}
示例14: ModifyMembergroupsettings
/**
* Set some general membergroup settings and permissions.
* Called by ?action=admin;area=membergroups;sa=settings
* Requires the admin_forum permission (and manage_permissions for changing permissions)
* Redirects to itself.
*
* @uses membergroup_settings sub template of ManageMembergroups.
*/
function ModifyMembergroupsettings()
{
global $context, $sourcedir, $scripturl, $modSettings, $txt;
$context['sub_template'] = 'show_settings';
$context['page_title'] = $txt['membergroups_settings'];
// Needed for the settings functions.
require_once $sourcedir . '/ManageServer.php';
// Don't allow assignment of guests.
$context['permissions_excluded'] = array(-1);
// Only one thing here!
$config_vars = array(array('permissions', 'manage_membergroups'));
call_integration_hook('integrate_modify_membergroup_settings', array(&$config_vars));
if (isset($_REQUEST['save'])) {
checkSession();
call_integration_hook('integrate_save_membergroup_settings');
// Yeppers, saving this...
saveDBSettings($config_vars);
redirectexit('action=admin;area=membergroups;sa=settings');
}
// Some simple context.
$context['post_url'] = $scripturl . '?action=admin;area=membergroups;save;sa=settings';
$context['settings_title'] = $txt['membergroups_settings'];
// We need this for the in-line permissions
createToken('admin-mp');
prepareDBSettingContext($config_vars);
}
示例15: ModifySubscriptionSettings
function ModifySubscriptionSettings($return_config = false)
{
global $context, $txt, $modSettings, $sourcedir, $smcFunc, $scripturl;
// If the currency is set to something different then we need to set it to other for this to work and set it back shortly.
$modSettings['paid_currency'] = !empty($modSettings['paid_currency_code']) ? $modSettings['paid_currency_code'] : '';
if (!empty($modSettings['paid_currency_code']) && !in_array($modSettings['paid_currency_code'], array('usd', 'eur', 'gbp'))) {
$modSettings['paid_currency'] = 'other';
}
// These are all the default settings.
$config_vars = array(array('select', 'paid_email', array(0 => $txt['paid_email_no'], 1 => $txt['paid_email_error'], 2 => $txt['paid_email_all']), 'subtext' => $txt['paid_email_desc']), array('text', 'paid_email_to', 'subtext' => $txt['paid_email_to_desc'], 'size' => 60), '', 'dummy_currency' => array('select', 'paid_currency', array('usd' => $txt['usd'], 'eur' => $txt['eur'], 'gbp' => $txt['gbp'], 'other' => $txt['other']), 'javascript' => 'onchange="toggleOther();"'), array('text', 'paid_currency_code', 'subtext' => $txt['paid_currency_code_desc'], 'size' => 5, 'force_div_id' => 'custom_currency_code_div'), array('text', 'paid_currency_symbol', 'subtext' => $txt['paid_currency_symbol_desc'], 'size' => 8, 'force_div_id' => 'custom_currency_symbol_div'), array('check', 'paidsubs_test', 'subtext' => $txt['paidsubs_test_desc'], 'onclick' => 'return document.getElementById(\'paidsubs_test\').checked ? confirm(\'' . $txt['paidsubs_test_confirm'] . '\') : true;'));
// Now load all the other gateway settings.
$gateways = loadPaymentGateways();
foreach ($gateways as $gateway) {
$gatewayClass = new $gateway['display_class']();
$setting_data = $gatewayClass->getGatewaySettings();
if (!empty($setting_data)) {
$config_vars[] = array('title', $gatewayClass->title, 'text_label' => isset($txt['paidsubs_gateway_title_' . $gatewayClass->title]) ? $txt['paidsubs_gateway_title_' . $gatewayClass->title] : $gatewayClass->title);
$config_vars = array_merge($config_vars, $setting_data);
}
}
// Just searching?
if ($return_config) {
return $config_vars;
}
// Get the settings template fired up.
require_once $sourcedir . '/ManageServer.php';
// Some important context stuff
$context['page_title'] = $txt['settings'];
$context['sub_template'] = 'show_settings';
$context['settings_message'] = '<span class="smalltext">' . $txt['paid_note'] . '</span>';
$context[$context['admin_menu_name']]['current_subsection'] = 'settings';
// Get the final touches in place.
$context['post_url'] = $scripturl . '?action=admin;area=paidsubscribe;save;sa=settings';
$context['settings_title'] = $txt['settings'];
// We want javascript for our currency options.
$context['settings_insert_below'] = '
<script type="text/javascript"><!-- // --><![CDATA[
function toggleOther()
{
var otherOn = document.getElementById("paid_currency").value == \'other\';
var currencydd = document.getElementById("custom_currency_code_div_dd");
if (otherOn)
{
document.getElementById("custom_currency_code_div").style.display = "";
document.getElementById("custom_currency_symbol_div").style.display = "";
if (currencydd)
{
document.getElementById("custom_currency_code_div_dd").style.display = "";
document.getElementById("custom_currency_symbol_div_dd").style.display = "";
}
}
else
{
document.getElementById("custom_currency_code_div").style.display = "none";
document.getElementById("custom_currency_symbol_div").style.display = "none";
if (currencydd)
{
document.getElementById("custom_currency_symbol_div_dd").style.display = "none";
document.getElementById("custom_currency_code_div_dd").style.display = "none";
}
}
}
toggleOther();
// ]]></script>';
// Saving the settings?
if (isset($_GET['save'])) {
checkSession();
// Sort out the currency stuff.
if ($_POST['paid_currency'] != 'other') {
$_POST['paid_currency_code'] = $_POST['paid_currency'];
$_POST['paid_currency_symbol'] = $txt[$_POST['paid_currency'] . '_symbol'];
}
unset($config_vars['dummy_currency']);
saveDBSettings($config_vars);
redirectexit('action=admin;area=paidsubscribe;sa=settings');
}
// Prepare the settings...
prepareDBSettingContext($config_vars);
}