Exemple #1
0
/**
 * 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);
}
Exemple #2
0
/**
 * 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 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);
}
Exemple #4
0
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);
}
Exemple #5
0
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);
}
/**
 * @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);
}
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);
}
Exemple #8
0
/**
 * 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);
}
Exemple #9
0
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);
}
Exemple #10
0
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);
}
Exemple #11
0
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);
}
    function settings($scripturl)
    {
        if (isset($_GET['save'])) {
            $charid = $_POST["tea_charid"];
            $userid = $_POST["tea_userid"];
            $api = $_POST["tea_api"];
        } else {
            $charid = $this->modSettings["tea_charid"];
            $userid = $this->modSettings["tea_userid"];
            $api = $this->modSettings["tea_api"];
        }
        $chars = $this->tea->get_characters($userid, $api);
        $charlist = array();
        if (!empty($chars)) {
            foreach ($chars as $char) {
                $charlist[$char['charid']] = $char['name'];
                if ($charid == $char['charid']) {
                    $corp = $char['corpid'];
                    $alliance = $char['allianceid'];
                }
            }
        }
        $groups2 = $this->tea->MemberGroups(TRUE);
        $groups[-1] = '-';
        foreach ($groups2 as $i => $g) {
            $groups[$i] = $g;
        }
        $options = '';
        if (!empty($charlist)) {
            foreach ($charlist as $i => $c) {
                $options .= '<option value="' . $i . '"';
                if ($this->tea->modSettings["tea_charid"] == $i) {
                    $options .= ' selected="selected"';
                }
                $options .= '>' . $c . '</option>
				';
            }
        }
        if (!empty($this->tea->modSettings['tea_ts_host'])) {
            require_once $this->sourcedir . '/TS3_Class/TeamSpeak3.php';
            $tslv = TeamSpeak3::LIB_VERSION;
            TeamSpeak3::init();
            try {
                $ts3 = TeamSpeak3::factory("serverquery://" . $this->modSettings["tea_ts_username"] . ":" . $this->modSettings["tea_ts_password"] . "@" . $this->modSettings["tea_ts_host"] . ":" . $this->modSettings["tea_ts_qport"] . "/?server_port=" . $this->modSettings["tea_ts_port"] . "&blocking=0");
                $sg = $ts3->serverGroupList();
                $gl[0] = '-';
                foreach ($sg as $n) {
                    if ((int) $n->type == 1 && (string) $n->name != 'Guest') {
                        //	$gl['s'.(int)$n -> sgid] = 'Server - '.(string)$n -> name;
                        $gl['s' . (int) $n->sgid] = (string) $n->name;
                    }
                }
                //		$cg = $ts3 -> channelGroupList();
                //		foreach($cg as $i => $n)
                //		{
                //			if((int)$n -> type == 1)
                //				$gl['c'.$i] = 'Channel - '.(string)$n -> name;
                //		}
            } catch (Exception $e) {
                echo "[ERROR] " . $e->getMessage() . "\n";
            }
        }
        $cgq = $this->smcFunc['db_query']('', "SELECT id, value FROM {db_prefix}tea_ts_groups ORDER BY id");
        $cgq = $this->tea->select($cgq);
        if (!empty($cgq)) {
            foreach ($cgq as $cgqs) {
                $cg[$cgqs[0]] = $cgqs[1];
            }
        }
        $groupcheck = '<dt>' . $this->txt['tea_groupmon'] . '
		<table><tr><td>Name</td><td>Checked</td></tr>';
        foreach ($gl as $id => $g) {
            if ($id != '0') {
                $check = '';
                if ($cg[$id] == 1) {
                    $check = 'checked';
                }
                $groupcheck .= '<tr><td>' . $g . '</td><td><input type="checkbox" name="group[' . $id . ']" value="main" ' . $check . ' /></td><td></tr>';
            }
        }
        $groupcheck .= '<tr><td>
			</td></tr></table></dt>';
        $config_vars = array('</form>
			<form name="miniform" method="post" action="">
				<input type="hidden" name="minitype" value="" />
				<input type="hidden" name="value" value="" />
			</form>
			<form action="' . $scripturl . '?action=admin;area=tea;sa=ts;save" method="post" accept-charset="ISO-8859-1" name="tea_ts_settings">', array('check', 'tea_ts_enable'), '', $groupcheck, '', array('text', 'tea_ts_host', 30), array('int', 'tea_ts_qport', 6), array('int', 'tea_ts_port', 6), array('text', 'tea_ts_username', 15), array('text', 'tea_ts_password', 15), array('text', 'tea_ts_nf', 15), '<dt>TeamSpeak Info (HTML) will display on TS area of profile</dt>', '<dt><textarea name="tea_ts_info" cols=120 rows=6>' . $this->modSettings['tea_ts_info'] . '</textarea></dt>', '', $this->txt['tea_ts_db_need'], array('text', 'tea_ts_db_host', 15), array('text', 'tea_ts_db_user', 15), array('text', 'tea_ts_db_pw', 15), array('text', 'tea_ts_db_pre', 15), array('int', 'tea_ts_dbid', 3), array('check', 'tea_ts_method_online'), array('check', 'tea_ts_method_create'), '', array('int', 'tea_ts_warnm', 4), array('int', 'tea_ts_kickm', 4), '');
        $rules = $this->smcFunc['db_query']('', "SELECT id, smf, ts, tst, nf FROM {db_prefix}tea_ts_rules ORDER BY id");
        $rules = $this->tea->select($rules);
        $ro = '<table border="1"><tr><td>Rule ID</td><td>SMF Group</td><td>TS Group</td><td>Name Format</td></tr>';
        $ids['new'] = 'new';
        if (!empty($rules)) {
            $first = TRUE;
            foreach ($rules as $i => $r) {
                $ids[$r[0]] = $r[0];
                $ro .= '<tr><td>' . $r[0] . '</td><td>' . $groups[$r[1]] . '</td><td>' . $gl[$r[3] . $r[2]] . '</td><td>' . $r[4] . '</td>';
                $ro .= '<td>';
                if (!$first) {
                    $ro .= '<a href="javascript:move(' . $r[0] . ', \'up\')"><img src="' . $this->settings['images_url'] . '/sort_up.gif"></a>';
                }
                if ($i != count($rules) - 1) {
                    $ro .= '<a href="javascript:move(' . $r[0] . ', \'down\')"><img src="' . $this->settings['images_url'] . '/sort_down.gif"></a>';
                }
                $ro .= '<a href="javascript:edit(' . $r[0] . ', ' . $r[1] . ', \'' . $r[3] . $r[2] . '\', \'' . $r[4] . '\')"><img src="' . $this->settings['images_url'] . '/icons/config_sm.gif"></a>
				<a href="javascript: delrule(' . $r[0] . ')"><img src="' . $this->settings['images_url'] . '/icons/quick_remove.gif"></a></td></tr>';
                $first = FALSE;
            }
        }
        $config_vars[] = '<dt>' . $ro . '</table></dt>';
        $config_vars[] = '';
        $config_vars[100] = array('select', 'tea_ts_addrule_id', $ids, 'Rule ID');
        $config_vars[101] = array('select', 'tea_ts_addrule_group', $groups);
        $config_vars[102] = array('select', 'tea_ts_addrule_tsg', $gl);
        $config_vars[103] = array('text', 'tea_ts_addrule_nf', 15);
        //$config_vars[103] = array('hidden', 'tea_ts_editrule_id');
        $config_vars[] = '
<script type="text/javascript">
function edit(id, smf, ts, nf)
{
	document.tea_ts_settings.tea_ts_addrule_id.value=id;
	document.tea_ts_settings.tea_ts_addrule_group.value=smf;
	document.tea_ts_settings.tea_ts_addrule_tsg.value=ts;
	document.tea_ts_settings.tea_ts_addrule_nf.value=nf;
}
function delrule(value)
{
	if (confirm("\\nAre you sure you want Delete rule "+value+"?"))
		subform(\'delrule\', value);
}
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);
    }
Exemple #13
0
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);
}
/**
 * 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);
}
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);
}
Exemple #16
0
function ModifyCalendarSettings($return_config = false)
{
    global $modSettings, $context, $settings, $txt, $boarddir, $sourcedir, $scripturl, $smcFunc;
    // Load the boards list.
    $boards = array('');
    $request = $smcFunc['db_query']('order_by_board_order', '
		SELECT b.id_board, b.name AS board_name, c.name AS cat_name
		FROM {db_prefix}boards AS b
			LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)', array());
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $boards[$row['id_board']] = $row['cat_name'] . ' - ' . $row['board_name'];
    }
    $smcFunc['db_free_result']($request);
    // Look, all the calendar settings - of which there are many!
    $config_vars = array(array('permissions', 'calendar_view', 'help' => 'cal_enabled'), array('permissions', 'calendar_post'), array('permissions', 'calendar_edit_own'), array('permissions', 'calendar_edit_any'), '', array('int', 'cal_days_for_index'), array('select', 'cal_showholidays', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])), array('select', 'cal_showbdays', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])), array('select', 'cal_showevents', array(0 => $txt['setting_cal_show_never'], 1 => $txt['setting_cal_show_cal'], 3 => $txt['setting_cal_show_index'], 2 => $txt['setting_cal_show_all'])), '', array('select', 'cal_defaultboard', $boards), array('check', 'cal_daysaslink'), array('check', 'cal_allow_unlinked'), array('check', 'cal_showInTopic'), '', array('int', 'cal_minyear'), array('int', 'cal_maxyear'), '', array('check', 'cal_allowspan'), array('int', 'cal_maxspan'));
    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['calendar_settings'];
    $context['sub_template'] = 'show_settings';
    // Get the final touches in place.
    $context['post_url'] = $scripturl . '?action=admin;area=managecalendar;save;sa=settings';
    $context['settings_title'] = $txt['calendar_settings'];
    // Saving the settings?
    if (isset($_GET['save'])) {
        checkSession();
        saveDBSettings($config_vars);
        // Update the stats in case.
        updateSettings(array('calendar_updated' => time()));
        redirectexit('action=admin;area=managecalendar;sa=settings');
    }
    // Prepare the settings...
    prepareDBSettingContext($config_vars);
}
function saveSettings(&$config_vars)
{
    global $boarddir, $sc, $cookiename, $modSettings, $user_settings;
    global $sourcedir, $context, $cachedir;
    // Fix the darn stupid cookiename! (more may not be allowed, but these for sure!)
    if (isset($_POST['cookiename'])) {
        $_POST['cookiename'] = preg_replace('~[,;\\s\\.$]+~' . ($context['utf8'] ? 'u' : ''), '', $_POST['cookiename']);
    }
    // Fix the forum's URL if necessary.
    if (isset($_POST['boardurl'])) {
        if (substr($_POST['boardurl'], -10) == '/index.php') {
            $_POST['boardurl'] = substr($_POST['boardurl'], 0, -10);
        } elseif (substr($_POST['boardurl'], -1) == '/') {
            $_POST['boardurl'] = substr($_POST['boardurl'], 0, -1);
        }
        if (substr($_POST['boardurl'], 0, 7) != 'http://' && substr($_POST['boardurl'], 0, 7) != 'file://' && substr($_POST['boardurl'], 0, 8) != 'https://') {
            $_POST['boardurl'] = 'http://' . $_POST['boardurl'];
        }
    }
    // Any passwords?
    $config_passwords = array('db_passwd', 'ssi_db_passwd');
    // All the strings to write.
    $config_strs = array('mtitle', 'mmessage', 'language', 'mbname', 'boardurl', 'cookiename', 'webmaster_email', 'db_name', 'db_user', 'db_server', 'db_prefix', 'ssi_db_user', 'boarddir', 'sourcedir', 'cachedir');
    // All the numeric variables.
    $config_ints = array();
    // All the checkboxes.
    $config_bools = array('db_persist', 'db_error_send', 'maintenance');
    // Now sort everything into a big array, and figure out arrays and etc.
    $new_settings = array();
    foreach ($config_passwords as $config_var) {
        if (isset($_POST[$config_var][1]) && $_POST[$config_var][0] == $_POST[$config_var][1]) {
            $new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var][0], '\'\\') . '\'';
        }
    }
    foreach ($config_strs as $config_var) {
        if (isset($_POST[$config_var])) {
            $new_settings[$config_var] = '\'' . addcslashes($_POST[$config_var], '\'\\') . '\'';
        }
    }
    foreach ($config_ints as $config_var) {
        if (isset($_POST[$config_var])) {
            $new_settings[$config_var] = (int) $_POST[$config_var];
        }
    }
    foreach ($config_bools as $key) {
        if (!empty($_POST[$key])) {
            $new_settings[$key] = '1';
        } else {
            $new_settings[$key] = '0';
        }
    }
    // Save the relevant settings in the Settings.php file.
    require_once $sourcedir . '/Subs-Admin.php';
    updateSettingsFile($new_settings);
    // Now loopt through the remaining (database-based) settings.
    $new_settings = array();
    foreach ($config_vars as $config_var) {
        // We just saved the file-based settings, so skip their definitions.
        if (!is_array($config_var) || $config_var[2] == 'file') {
            continue;
        }
        // Rewrite the definition a bit.
        $new_settings[] = array($config_var[3], $config_var[0]);
    }
    // Save the new database-based settings, if any.
    if (!empty($new_settings)) {
        saveDBSettings($new_settings);
    }
}
    /**
     * Called in SMF admin panel for managing roles
     */
    private function ManageRoles()
    {
        global $txt, $scripturl, $context, $settings, $smcFunc, $modSettings;
        // Get the basic group data.
        $request = $smcFunc['db_query']('', '
			SELECT id_group, group_name
			FROM {db_prefix}membergroups
			WHERE min_posts = -1
			ORDER BY CASE WHEN id_group < 4 THEN id_group ELSE 4 END, group_name', array());
        $context['smfGroups'] = array('0' => array('id_group' => 0, 'group_name' => $txt['membergroups_members']));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $context['smfGroups'][$row['id_group']] = array('id_group' => $row['id_group'], 'group_name' => $row['group_name']);
        }
        $smcFunc['db_free_result']($request);
        $this->loadWordpressSettings();
        // Get the WP roles
        $request = $smcFunc['db_query']('', '
			SELECT option_value
			FROM {raw:wp_prefix}options
			WHERE option_name LIKE {string:wp_roles}', array('wp_prefix' => $this->db_prefix, 'wp_roles' => 'wp_user_roles'), $this->db_connection);
        list($wp_roles) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);
        $context['wpRoles'] = unserialize($wp_roles);
        // Lastly, our mapping
        $context['wpMapping'] = !empty($modSettings['wordpress_role_maps']) ? unserialize($modSettings['wordpress_role_maps']) : array('smf' => array(), 'wp' => array());
        $config_vars = array(array('title', 'wordpress wp to smf mapping'), array('desc', 'wordpress wp to smf mapping desc'), array('callback', 'wordpress_edit_roles'), array('title', 'wordpress smf to wp mapping'), array('desc', 'wordpress smf to wp mapping desc'), array('callback', 'wordpress_edit_membergroups'));
        $context['post_url'] = $scripturl . '?action=admin;area=wordpress;sa=roles;save';
        if (isset($_GET['save'])) {
            checkSession();
            foreach ($_POST['smfroles'] as $id_group => $role) {
                if (empty($context['smfGroups'][$id_group]) || empty($context['wpRoles'][$role])) {
                    unset($_POST['smfroles'][$id_group]);
                }
            }
            foreach ($_POST['wproles'] as $role => $id_group) {
                if (empty($context['smfGroups'][$id_group]) || empty($context['wpRoles'][$role])) {
                    unset($_POST['wproles'][$role]);
                }
            }
            $_POST['wordpress_role_maps'] = serialize(array('smf' => $_POST['smfroles'], 'wp' => $_POST['wproles']));
            $save_vars = array(array('text', 'wordpress_role_maps'));
            saveDBSettings($save_vars);
            redirectexit('action=admin;area=wordpress;sa=roles');
        }
        prepareDBSettingContext($config_vars);
    }
function teknoromisidebarSettings($return_config = false)
{
    global $modSettings, $webmaster_email, $txt, $scripturl, $context, $sc, $smcFunc;
    loadLanguage('teknoromisidebar');
    $boards = array();
    $request = $smcFunc['db_query']('order_by_board_order', '
		SELECT b.id_board, b.name AS board_name, c.name AS cat_name
		FROM {db_prefix}boards AS b
			LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)', array());
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $boards[$row['id_board']] = $row['cat_name'] . ' - ' . $row['board_name'];
    }
    $smcFunc['db_free_result']($request);
    $config_vars = array(array('check', 'sideleft'), array('text', 'sideleftwidth'), array('text', 'lefthtmlbaslik'), array('large_text', 'sideleft1'), array('text', 'leftphpbaslik'), array('large_text', 'sideleftphp'), array('check', 'sidelefthaberetkin'), array('text', 'lbaslik'), array('select', 'sidelefthaber', $boards), array('int', 'sideleftsay'), '', array('check', 'sideright'), array('text', 'siderightwidth'), array('text', 'righthtmlbaslik'), array('large_text', 'sideright1'), array('text', 'rightphpbaslik'), array('large_text', 'siderightphp'), array('check', 'siderighthaberetkin'), array('text', 'rbaslik'), array('select', 'siderighthaber', $boards), array('int', 'siderightsay'));
    if ($return_config) {
        return $config_vars;
    }
    $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=teknoromisidebar';
    $context['settings_title'] = $txt['teknoromisidebartitle'];
    // Saving?
    if (isset($_GET['save'])) {
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=modsettings;sa=teknoromisidebar');
    }
    prepareDBSettingContext($config_vars);
}
Exemple #20
0
function ModifyInviteSettings($return_config = false)
{
    global $context, $txt, $scripturl, $smcFunc, $modSettings;
    $context['sub_template'] = 'show_settings';
    $config_vars = array(array('check', 'invite_enabled'), array('check', 'roll_over'), array('check', 'invite_email'), array('int', 'key_renew'), array('int', 'key_expire'));
    if ($return_config) {
        return $config_vars;
    }
    if (isset($_GET['save'])) {
        // Looks like you pressed that save button. Great, let's throw that in then.
        checkSession();
        $smcFunc['db_query']('', '
			UPDATE {db_prefix}scheduled_tasks
			SET time_regularity = {int:time}, disabled = {int:active}
			WHERE task = {string:task}', array('time' => (int) $_POST[$config_vars[4][1]], 'active' => (int) $_POST[$config_vars[4][1]] == 0 ? 1 : 0, 'task' => 'keyExpire'));
        $smcFunc['db_query']('', '
			UPDATE {db_prefix}scheduled_tasks
			SET time_regularity = {int:time}, disabled = {int:active}
			WHERE task = {string:task}', array('time' => (int) $_POST[$config_vars[3][1]], 'active' => $_POST[$config_vars[3][1]] == 0 ? 1 : 0, 'task' => 'keyRenew'));
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=invite;sa=modify');
    }
    $context['post_url'] = $scripturl . '?action=admin;area=invite;sa=modify;save';
    $context['settings_title'] = $txt['invite_settings_title'];
    prepareDBSettingContext($config_vars);
}
Exemple #21
0
function EditSmileySettings($return_config = false)
{
    global $modSettings, $context, $settings, $txt, $boarddir, $sourcedir, $scripturl;
    // The directories...
    $context['smileys_dir'] = empty($modSettings['smileys_dir']) ? $boarddir . '/Smileys' : $modSettings['smileys_dir'];
    $context['smileys_dir_found'] = is_dir($context['smileys_dir']);
    // Get the names of the smiley sets.
    $smiley_sets = explode(',', $modSettings['smiley_sets_known']);
    $set_names = explode("\n", $modSettings['smiley_sets_names']);
    $smiley_context = array();
    foreach ($smiley_sets as $i => $set) {
        $smiley_context[$set] = $set_names[$i];
    }
    // All the settings for the page...
    $config_vars = array(array('title', 'settings'), array('permissions', 'manage_smileys'), '', array('select', 'smiley_sets_default', $smiley_context), array('check', 'smiley_sets_enable'), array('check', 'smiley_enable', 'subtext' => $txt['smileys_enable_note']), array('text', 'smileys_url'), array('text', 'smileys_dir', 'invalid' => !$context['smileys_dir_found']), '', array('check', 'messageIcons_enable', 'subtext' => $txt['setting_messageIcons_enable_note']));
    if ($return_config) {
        return $config_vars;
    }
    // Setup the basics of the settings template.
    require_once $sourcedir . '/ManageServer.php';
    $context['sub_template'] = 'show_settings';
    // Finish up the form...
    $context['post_url'] = $scripturl . '?action=admin;area=smileys;save;sa=settings';
    $context['permissions_excluded'] = array(-1);
    // Saving the settings?
    if (isset($_GET['save'])) {
        checkSession();
        // Validate the smiley set name.
        $_POST['smiley_sets_default'] = empty($smiley_context[$_POST['smiley_sets_default']]) ? 'default' : $_POST['smiley_sets_default'];
        // Make sure that the smileys are in the right order after enabling them.
        if (isset($_POST['smiley_enable'])) {
            sortSmileyTable();
        }
        saveDBSettings($config_vars);
        cache_put_data('parsing_smileys', null, 480);
        cache_put_data('posting_smileys', null, 480);
        redirectexit('action=admin;area=smileys;sa=settings');
    }
    prepareDBSettingContext($config_vars);
}
Exemple #22
0
/**
 * A screen to set a few general board and category settings.
 *
 * @uses modify_general_settings sub-template.
 * @param $return_config
 */
function EditBoardSettings($return_config = false)
{
    global $context, $txt, $sourcedir, $modSettings, $scripturl, $smcFunc;
    // Load the boards list - for the recycle bin!
    $recycle_boards = array('');
    $request = $smcFunc['db_query']('order_by_board_order', '
		SELECT b.id_board, b.name AS board_name, c.name AS cat_name
		FROM {db_prefix}boards AS b
			LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
		WHERE redirect = {string:empty_string}', array('empty_string' => ''));
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $recycle_boards[$row['id_board']] = $row['cat_name'] . ' - ' . $row['board_name'];
    }
    $smcFunc['db_free_result']($request);
    // Here and the board settings...
    $config_vars = array(array('title', 'settings'), array('permissions', 'manage_boards'), '', array('check', 'countChildPosts'), array('check', 'recycle_enable', 'onclick' => 'document.getElementById(\'recycle_board\').disabled = !this.checked;'), array('select', 'recycle_board', $recycle_boards), array('check', 'allow_ignore_boards'), array('check', 'deny_boards_access'));
    call_integration_hook('integrate_modify_board_settings', array(&$config_vars));
    if ($return_config) {
        return $config_vars;
    }
    // Needed for the settings template.
    require_once $sourcedir . '/ManageServer.php';
    // Don't let guests have these permissions.
    $context['post_url'] = $scripturl . '?action=admin;area=manageboards;save;sa=settings';
    $context['permissions_excluded'] = array(-1);
    $context['page_title'] = $txt['boards_and_cats'] . ' - ' . $txt['settings'];
    loadTemplate('ManageBoards');
    $context['sub_template'] = 'show_settings';
    // Add some javascript stuff for the recycle box.
    $context['settings_insert_below'] = '
		<script type="text/javascript"><!-- // --><![CDATA[
			document.getElementById("recycle_board").disabled = !document.getElementById("recycle_enable").checked;
		// ]]></script>';
    // Warn the admin against selecting the recycle topic without selecting a board.
    $context['force_form_onsubmit'] = 'if(document.getElementById(\'recycle_enable\').checked && document.getElementById(\'recycle_board\').value == 0) { return confirm(\'' . $txt['recycle_board_unselected_notice'] . '\');} return true;';
    // Doing a save?
    if (isset($_GET['save'])) {
        checkSession();
        call_integration_hook('integrate_save_board_settings');
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=manageboards;sa=settings');
    }
    // We need this for the in-line permissions
    createToken('admin-mp');
    // Prepare the settings...
    prepareDBSettingContext($config_vars);
}
Exemple #23
0
function ModifyNewsSettings($return_config = false)
{
    global $context, $sourcedir, $modSettings, $txt, $scripturl;
    $config_vars = array(array('title', 'settings'), array('permissions', 'edit_news', 'help' => ''), array('permissions', 'send_mail'), '', array('check', 'xmlnews_enable', 'onclick' => 'document.getElementById(\'xmlnews_maxlen\').disabled = !this.checked;'), array('text', 'xmlnews_maxlen', 10));
    if ($return_config) {
        return $config_vars;
    }
    $context['page_title'] = $txt['admin_edit_news'] . ' - ' . $txt['settings'];
    $context['sub_template'] = 'show_settings';
    // Needed for the inline permission functions, and the settings template.
    require_once $sourcedir . '/ManagePermissions.php';
    require_once $sourcedir . '/ManageServer.php';
    // Wrap it all up nice and warm...
    $context['post_url'] = $scripturl . '?action=admin;area=news;save;sa=settings';
    $context['permissions_excluded'] = array(-1);
    // Add some javascript at the bottom...
    $context['settings_insert_below'] = '
		<script type="text/javascript"><!-- // --><![CDATA[
			document.getElementById("xmlnews_maxlen").disabled = !document.getElementById("xmlnews_enable").checked;
		// ]]></script>';
    // Saving the settings?
    if (isset($_GET['save'])) {
        checkSession();
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=news;sa=settings');
    }
    prepareDBSettingContext($config_vars);
}
Exemple #24
0
function og_settings($return_config = false)
{
    global $scripturl, $context, $txt;
    $config_vars = array(array('check', 'og_ext_chk', 'subtext' => $txt['og_ext_chk_desc']), array('large_text', 'og_allowed', 'subtext' => $txt['og_allowed_desc']));
    if (!empty($return_config)) {
        return $config_vars;
    }
    $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=og_settings';
    $context['settings_title'] = $txt['og_settings'];
    if (isset($_GET['save'])) {
        checkSession();
        $save_vars = $config_vars;
        saveDBSettings($save_vars);
        redirectexit('action=admin;area=modsettings;sa=og_settings');
    }
    prepareDBSettingContext($config_vars);
}
Exemple #25
0
/**
 * Allows to view and modify the mail settings.
 *
 * @param bool $return_config = false
 * @return array
 */
function ModifyMailSettings($return_config = false)
{
    global $txt, $scripturl, $context, $settings, $modSettings, $txtBirthdayEmails;
    loadLanguage('EmailTemplates');
    $body = $txtBirthdayEmails[(empty($modSettings['birthday_email']) ? 'happy_birthday' : $modSettings['birthday_email']) . '_body'];
    $subject = $txtBirthdayEmails[(empty($modSettings['birthday_email']) ? 'happy_birthday' : $modSettings['birthday_email']) . '_subject'];
    $emails = array();
    $processedBirthdayEmails = array();
    foreach ($txtBirthdayEmails as $key => $value) {
        $index = substr($key, 0, strrpos($key, '_'));
        $element = substr($key, strrpos($key, '_') + 1);
        $processedBirthdayEmails[$index][$element] = $value;
    }
    foreach ($processedBirthdayEmails as $index => $dummy) {
        $emails[$index] = $index;
    }
    $config_vars = array(array('check', 'mail_queue'), array('int', 'mail_limit'), array('int', 'mail_quantity'), '', array('select', 'mail_type', array($txt['mail_type_default'], 'SMTP')), array('text', 'smtp_host'), array('text', 'smtp_port'), array('text', 'smtp_username'), array('password', 'smtp_password'), '', array('select', 'birthday_email', $emails, 'value' => array('subject' => $subject, 'body' => $body), 'javascript' => 'onchange="fetch_birthday_preview()"'), 'birthday_subject' => array('var_message', 'birthday_subject', 'var_message' => $processedBirthdayEmails[empty($modSettings['birthday_email']) ? 'happy_birthday' : $modSettings['birthday_email']]['subject'], 'disabled' => true, 'size' => strlen($subject) + 3), 'birthday_body' => array('var_message', 'birthday_body', 'var_message' => nl2br($body), 'disabled' => true, 'size' => ceil(strlen($body) / 25)));
    call_integration_hook('integrate_modify_mail_settings', array(&$config_vars));
    if ($return_config) {
        return $config_vars;
    }
    // Saving?
    if (isset($_GET['save'])) {
        // Make the SMTP password a little harder to see in a backup etc.
        if (!empty($_POST['smtp_password'][1])) {
            $_POST['smtp_password'][0] = base64_encode($_POST['smtp_password'][0]);
            $_POST['smtp_password'][1] = base64_encode($_POST['smtp_password'][1]);
        }
        checkSession();
        // We don't want to save the subject and body previews.
        unset($config_vars['birthday_subject'], $config_vars['birthday_body']);
        call_integration_hook('integrate_save_mail_settings');
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=mailqueue;sa=settings');
    }
    $context['post_url'] = $scripturl . '?action=admin;area=mailqueue;save;sa=settings';
    $context['settings_title'] = $txt['mailqueue_settings'];
    prepareDBSettingContext($config_vars);
    $context['settings_insert_above'] = '
	<script type="text/javascript"><!-- // --><![CDATA[
		var bDay = {';
    $i = 0;
    foreach ($processedBirthdayEmails as $index => $email) {
        $is_last = ++$i == count($processedBirthdayEmails);
        $context['settings_insert_above'] .= '
			' . $index . ': {
				subject: ' . JavaScriptEscape($email['subject']) . ',
				body: ' . JavaScriptEscape(nl2br($email['body'])) . '
			}' . (!$is_last ? ',' : '');
    }
    $context['settings_insert_above'] .= '
		};
		function fetch_birthday_preview()
		{
			var index = document.getElementById(\'birthday_email\').value;
			document.getElementById(\'birthday_subject\').innerHTML = bDay[index].subject;
			document.getElementById(\'birthday_body\').innerHTML = bDay[index].body;
		}
	// ]]></script>';
}
function ManageAvatarSettings($return_config = false)
{
    global $txt, $context, $modSettings, $sourcedir, $scripturl;
    // Perform a test to see if the GD module is installed.
    $testGD = get_extension_funcs('gd');
    $context['valid_avatar_dir'] = is_dir($modSettings['avatar_directory']);
    $context['valid_custom_avatar_dir'] = empty($modSettings['custom_avatar_enabled']) || !empty($modSettings['custom_avatar_dir']) && is_dir($modSettings['custom_avatar_dir']) && is_writable($modSettings['custom_avatar_dir']);
    $config_vars = array(array('title', 'avatar_server_stored'), array('warning', empty($testGD) ? 'avatar_gd_warning' : ''), array('permissions', 'profile_server_avatar', 0, $txt['avatar_server_stored_groups']), array('text', 'avatar_directory', 40, 'invalid' => !$context['valid_avatar_dir']), array('text', 'avatar_url', 40), array('title', 'avatar_external'), array('permissions', 'profile_remote_avatar', 0, $txt['avatar_external_url_groups']), array('check', 'avatar_download_external', 0, 'onchange' => 'fUpdateStatus();'), array('text', 'avatar_max_width_external', 6), array('text', 'avatar_max_height_external', 6), array('select', 'avatar_action_too_large', array('option_refuse' => $txt['option_refuse'], 'option_html_resize' => $txt['option_html_resize'], 'option_js_resize' => $txt['option_js_resize'], 'option_download_and_resize' => $txt['option_download_and_resize'])), array('title', 'avatar_upload'), array('permissions', 'profile_upload_avatar', 0, $txt['avatar_upload_groups']), array('text', 'avatar_max_width_upload', 6), array('text', 'avatar_max_height_upload', 6), array('check', 'avatar_resize_upload', 'subtext' => $txt['avatar_resize_upload_note']), array('check', 'avatar_reencode'), '', array('warning', 'avatar_paranoid_warning'), array('check', 'avatar_paranoid'), '', array('check', 'avatar_download_png'), array('select', 'custom_avatar_enabled', array($txt['option_attachment_dir'], $txt['option_specified_dir']), 'onchange' => 'fUpdateStatus();'), array('text', 'custom_avatar_dir', 40, 'subtext' => $txt['custom_avatar_dir_desc'], 'invalid' => !$context['valid_custom_avatar_dir']), array('text', 'custom_avatar_url', 40));
    if ($return_config) {
        return $config_vars;
    }
    // We need these files for the inline permission settings, and the settings template.
    require_once $sourcedir . '/ManagePermissions.php';
    require_once $sourcedir . '/ManageServer.php';
    // Saving avatar settings?
    if (isset($_GET['save'])) {
        checkSession();
        // Just incase the admin forgot to set both custom avatar values, we disable it to prevent errors.
        if (isset($_POST['custom_avatar_enabled']) && $_POST['custom_avatar_enabled'] == 1 && (empty($_POST['custom_avatar_dir']) || empty($_POST['custom_avatar_url']))) {
            $_POST['custom_avatar_enabled'] = 0;
        }
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=manageattachments;sa=avatars');
    }
    // Attempt to figure out if the admin is trying to break things.
    $context['settings_save_onclick'] = 'return document.getElementById(\'custom_avatar_enabled\').value == 1 && (document.getElementById(\'custom_avatar_dir\').value == \'\' || document.getElementById(\'custom_avatar_url\').value == \'\') ? confirm(\'' . $txt['custom_avatar_check_empty'] . '\') : true;';
    // Prepare the context.
    $context['post_url'] = $scripturl . '?action=admin;area=manageattachments;save;sa=avatars';
    prepareDBSettingContext($config_vars);
    // Add a layer for the javascript.
    $context['template_layers'][] = 'avatar_settings';
    $context['sub_template'] = 'show_settings';
}
Exemple #27
0
function ModifyRegistrationSettings($return_config = false)
{
    global $txt, $context, $scripturl, $modSettings, $sourcedir, $backend_subdir;
    // This is really quite wanting.
    require_once $sourcedir . '/' . $backend_subdir . '/ManageServer.php';
    $config_vars = array(array('select', 'registration_method', array($txt['setting_registration_standard'], $txt['setting_registration_activate'], $txt['setting_registration_approval'], $txt['setting_registration_disabled'])), array('check', 'enableOpenID'), array('check', 'notify_new_registration'), array('check', 'send_welcomeEmail'), '', array('int', 'coppaAge', 'subtext' => $txt['setting_coppaAge_desc'], 'onchange' => 'checkCoppa();'), array('select', 'coppaType', array($txt['setting_coppaType_reject'], $txt['setting_coppaType_approval']), 'onchange' => 'checkCoppa();'), array('large_text', 'coppaPost', 'subtext' => $txt['setting_coppaPost_desc']), array('text', 'coppaFax'), array('text', 'coppaPhone'));
    if ($return_config) {
        return $config_vars;
    }
    // Setup the template
    $context['sub_template'] = 'show_settings';
    $context['page_title'] = $txt['registration_center'];
    if (isset($_GET['save'])) {
        checkSession();
        // Are there some contacts missing?
        if (!empty($_POST['coppaAge']) && !empty($_POST['coppaType']) && empty($_POST['coppaPost']) && empty($_POST['coppaFax'])) {
            fatal_lang_error('admin_setting_coppa_require_contact');
        }
        // Post needs to take into account line breaks.
        $_POST['coppaPost'] = str_replace("\n", '<br />', empty($_POST['coppaPost']) ? '' : $_POST['coppaPost']);
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=regcenter;sa=settings');
    }
    $context['post_url'] = $scripturl . '?action=admin;area=regcenter;save;sa=settings';
    $context['settings_title'] = $txt['settings'];
    // Define some javascript for COPPA.
    $context['settings_post_javascript'] = '
		function checkCoppa()
		{
			var coppaDisabled = document.getElementById(\'coppaAge\').value == 0;
			document.getElementById(\'coppaType\').disabled = coppaDisabled;

			var disableContacts = coppaDisabled || document.getElementById(\'coppaType\').options[document.getElementById(\'coppaType\').selectedIndex].value != 1;
			document.getElementById(\'coppaPost\').disabled = disableContacts;
			document.getElementById(\'coppaFax\').disabled = disableContacts;
			document.getElementById(\'coppaPhone\').disabled = disableContacts;
		}
		checkCoppa();';
    // Turn the postal address into something suitable for a textbox.
    $modSettings['coppaPost'] = !empty($modSettings['coppaPost']) ? preg_replace('~<br ?/?' . '>~', "\n", $modSettings['coppaPost']) : '';
    prepareDBSettingContext($config_vars);
}
Exemple #28
0
/**
 * Modify any setting related to drafts.
 * Requires the admin_forum permission.
 * Accessed from ?action=admin;area=managedrafts
 *
 * @param bool $return_config = false
 * @uses Admin template, edit_topic_settings sub-template.
 */
function ModifyDraftSettings($return_config = false)
{
    global $context, $txt, $sourcedir, $scripturl;
    isAllowedTo('admin_forum');
    // Here are all the draft settings, a bit lite for now, but we can add more :P
    $config_vars = array(array('check', 'drafts_post_enabled'), array('check', 'drafts_pm_enabled'), array('check', 'drafts_show_saved_enabled', 'subtext' => $txt['drafts_show_saved_enabled_subnote']), array('int', 'drafts_keep_days', 'postinput' => $txt['days_word'], 'subtext' => $txt['drafts_keep_days_subnote']), '', array('check', 'drafts_autosave_enabled', 'subtext' => $txt['drafts_autosave_enabled_subnote']), array('int', 'drafts_autosave_frequency', 'postinput' => $txt['manageposts_seconds'], 'subtext' => $txt['drafts_autosave_frequency_subnote']));
    if ($return_config) {
        return $config_vars;
    }
    // Get the settings template ready.
    require_once $sourcedir . '/ManageServer.php';
    // Setup the template.
    $context['page_title'] = $txt['managedrafts_settings'];
    $context['sub_template'] = 'show_settings';
    // Saving them ?
    if (isset($_GET['save'])) {
        checkSession();
        // Protect them from themselves.
        $_POST['drafts_autosave_frequency'] = $_POST['drafts_autosave_frequency'] < 30 ? 30 : $_POST['drafts_autosave_frequency'];
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=managedrafts');
    }
    // some javascript to enable / disable the frequency input box
    $context['settings_post_javascript'] = '
		var autosave = document.getElementById(\'drafts_autosave_enabled\');
		createEventListener(autosave)
		autosave.addEventListener(\'change\', toggle);
		toggle();

		function toggle()
		{
			var select_elem = document.getElementById(\'drafts_autosave_frequency\');
			select_elem.disabled = !autosave.checked;
		}
	';
    // Final settings...
    $context['post_url'] = $scripturl . '?action=admin;area=managedrafts;save';
    $context['settings_title'] = $txt['managedrafts_settings'];
    // Prepare the settings...
    prepareDBSettingContext($config_vars);
}
function ModifyTopicSettings($return_config = false)
{
    global $context, $txt, $modSettings, $sourcedir, $scripturl;
    // Here are all the topic settings.
    $config_vars = array(array('check', 'enableStickyTopics'), array('check', 'enableParticipation'), '', array('int', 'oldTopicDays', 'postinput' => $txt['manageposts_days'], 'subtext' => $txt['oldTopicDays_zero']), array('int', 'defaultMaxTopics', 'postinput' => $txt['manageposts_topics']), array('int', 'defaultMaxMessages', 'postinput' => $txt['manageposts_posts']), '', array('int', 'hotTopicPosts', 'postinput' => $txt['manageposts_posts']), array('int', 'hotTopicVeryPosts', 'postinput' => $txt['manageposts_posts']), '', array('int', 'enableAllMessages', 'postinput' => $txt['manageposts_posts'], 'subtext' => $txt['enableAllMessages_zero']), array('check', 'disableCustomPerPage'), array('check', 'enablePreviousNext'), '', array('int', 'doublePostThold', 'postinput' => $txt['doublePostAdmin_main'], 'subtext' => $txt['doublePostAdmin_sub']));
    if ($return_config) {
        return $config_vars;
    }
    // Get the settings template ready.
    require_once $sourcedir . '/ManageServer.php';
    // Setup the template.
    $context['page_title'] = $txt['manageposts_topic_settings'];
    $context['sub_template'] = 'show_settings';
    // Are we saving them - are we??
    if (isset($_GET['save'])) {
        checkSession();
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=postsettings;sa=topics');
    }
    // Final settings...
    $context['post_url'] = $scripturl . '?action=admin;area=postsettings;save;sa=topics';
    $context['settings_title'] = $txt['manageposts_topic_settings'];
    // Prepare the settings...
    prepareDBSettingContext($config_vars);
}
/**
 * ModifyGoogleMapSettings()
 */
function ModifyGoogleMapSettings()
{
    global $txt, $scripturl, $context, $settings, $sc;
    loadlanguage('GoogleMap');
    $context[$context['admin_menu_name']]['tab_data']['tabs']['googlemap']['description'] = $txt['googleMap_desc'];
    $config_vars = array(array('check', 'googleMap_Enable', 'postinput' => $txt['googleMap_license']), array('title', 'googleMap_MapSettings'), array('select', 'googleMap_ButtonLocation', array('home' => $txt['home'], 'help' => $txt['help'], 'search' => $txt['search'], 'login' => $txt['login'], 'register' => $txt['register'], 'calendar' => $txt['calendar'], 'profile' => $txt['profile'], 'pm' => $txt['pm_short'])), array('float', 'googleMap_DefaultLat', 10, 'postinput' => $txt['googleMap_DefaultLat_info']), array('float', 'googleMap_DefaultLong', 10, 'postinput' => $txt['googleMap_DefaultLong_info']), array('int', 'googleMap_DefaultZoom', 'subtext' => $txt['googleMap_DefaultZoom_Info']), array('select', 'googleMap_Type', array('ROADMAP' => $txt['googleMap_roadmap'], 'SATELLITE' => $txt['googleMap_satellite'], 'HYBRID' => $txt['googleMap_hybrid'])), array('select', 'googleMap_NavType', array('LARGE' => $txt['googleMap_largemapcontrol3d'], 'SMALL' => $txt['googleMap_smallzoomcontrol3d'], 'DEFAULT' => $txt['googleMap_defaultzoomcontrol'])), array('check', 'googleMap_EnableLegend'), array('check', 'googleMap_KMLoutput_enable', 'subtext' => $txt['googleMap_KMLoutput_enable_info']), array('int', 'googleMap_PinNumber', 'subtext' => $txt['googleMap_PinNumber_info']), array('select', 'googleMap_Sidebar', array('none' => $txt['googleMap_nosidebar'], 'right' => $txt['googleMap_rightsidebar'], 'left' => $txt['googleMap_leftsidebar'])), array('check', 'googleMap_BoldMember'), array('title', 'googleMap_MemeberpinSettings'), array('check', 'googleMap_PinGender'), array('text', 'googleMap_PinBackground', 6), array('text', 'googleMap_PinForeground', 6), array('select', 'googleMap_PinStyle', array('googleMap_plainpin' => $txt['googleMap_plainpin'], 'googleMap_textpin' => $txt['googleMap_textpin'], 'googleMap_iconpin' => $txt['googleMap_iconpin'])), array('check', 'googleMap_PinShadow'), array('int', 'googleMap_PinSize', 2), array('text', 'googleMap_PinText', 10, 'postinput' => $txt['googleMap_PinText_info']), array('select', 'googleMap_PinIcon', array('academy' => $txt['academy'], 'activities' => $txt['activities'], 'airport' => $txt['airport'], 'amusement' => $txt['amusement'], 'aquarium' => $txt['aquarium'], 'art-gallery' => $txt['art-gallery'], 'atm' => $txt['atm'], 'baby' => $txt['baby'], 'bank-dollar' => $txt['bank-dollar'], 'bank-euro' => $txt['bank-euro'], 'bank-intl' => $txt['bank-intl'], 'bank-pound' => $txt['bank-pound'], 'bank-yen' => $txt['bank-yen'], 'bar' => $txt['bar'], 'barber' => $txt['barber'], 'beach' => $txt['beach'], 'beer' => $txt['beer'], 'bicycle' => $txt['bicycle'], 'books' => $txt['books'], 'bowling' => $txt['bowling'], 'bus' => $txt['bus'], 'cafe' => $txt['cafe'], 'camping' => $txt['camping'], 'car-dealer' => $txt['car-dealer'], 'car-rental' => $txt['car-rental'], 'car-repair' => $txt['car-repair'], 'casino' => $txt['casino'], 'caution' => $txt['caution'], 'cemetery-grave' => $txt['cemetery-grave'], 'cemetery-tomb' => $txt['cemetery-tomb'], 'cinema' => $txt['cinema'], 'civic-building' => $txt['civic-building'], 'computer' => $txt['computer'], 'corporate' => $txt['corporate'], 'fire' => $txt['fire'], 'flag' => $txt['flag'], 'floral' => $txt['floral'], 'helicopter' => $txt['helicopter'], 'home' => $txt['home1'], 'info' => $txt['info'], 'landslide' => $txt['landslide'], 'legal' => $txt['legal'], 'location' => $txt['location1'], 'locomotive' => $txt['locomotive'], 'medical' => $txt['medical'], 'mobile' => $txt['mobile'], 'motorcycle' => $txt['motorcycle'], 'music' => $txt['music'], 'parking' => $txt['parking'], 'pet' => $txt['pet'], 'petrol' => $txt['petrol'], 'phone' => $txt['phone'], 'picnic' => $txt['picnic'], 'postal' => $txt['postal'], 'repair' => $txt['repair'], 'restaurant' => $txt['restaurant'], 'sail' => $txt['sail'], 'school' => $txt['school'], 'scissors' => $txt['scissors'], 'ship' => $txt['ship'], 'shoppingbag' => $txt['shoppingbag'], 'shoppingcart' => $txt['shoppingcart'], 'ski' => $txt['ski'], 'snack' => $txt['snack'], 'snow' => $txt['snow'], 'sport' => $txt['sport'], 'star' => $txt['star'], 'swim' => $txt['swim'], 'taxi' => $txt['taxi'], 'train' => $txt['train'], 'truck' => $txt['truck'], 'wc-female' => $txt['wc-female'], 'wc-male' => $txt['wc-male'], 'wc' => $txt['wc'], 'wheelchair' => $txt['wheelchair']), 'postinput' => $txt['googleMap_PinIcon_info']), array('title', 'googleMap_ClusterpinSettings'), array('check', 'googleMap_EnableClusterer', 'subtext' => $txt['googleMap_EnableClusterer_info']), array('int', 'googleMap_MinMarkerPerCluster'), array('int', 'googleMap_MinMarkertoCluster'), array('int', 'googleMap_GridSize'), array('check', 'googleMap_ScalableCluster', 'subtext' => $txt['googleMap_ScalableCluster_info']), array('title', 'googleMap_ClusterpinStyle'), array('text', 'googleMap_ClusterBackground', 6), array('text', 'googleMap_ClusterForeground', 6), array('select', 'googleMap_ClusterStyle', array('googleMap_plainpin' => $txt['googleMap_plainpin'], 'googleMap_textpin' => $txt['googleMap_textpin'], 'googleMap_iconpin' => $txt['googleMap_iconpin'], 'googleMap_zonepin' => $txt['googleMap_zonepin'], 'googleMap_peepspin' => $txt['googleMap_peepspin'], 'googleMap_talkpin' => $txt['googleMap_talkpin'])), array('check', 'googleMap_ClusterShadow'), array('int', 'googleMap_ClusterSize', '2'), array('text', 'googleMap_ClusterText', 'postinput' => $txt['googleMap_PinText_info']), array('select', 'googleMap_ClusterIcon', array('academy' => $txt['academy'], 'activities' => $txt['activities'], 'airport' => $txt['airport'], 'amusement' => $txt['amusement'], 'aquarium' => $txt['aquarium'], 'art-gallery' => $txt['art-gallery'], 'atm' => $txt['atm'], 'baby' => $txt['baby'], 'bank-dollar' => $txt['bank-dollar'], 'bank-euro' => $txt['bank-euro'], 'bank-intl' => $txt['bank-intl'], 'bank-pound' => $txt['bank-pound'], 'bank-yen' => $txt['bank-yen'], 'bar' => $txt['bar'], 'barber' => $txt['barber'], 'beach' => $txt['beach'], 'beer' => $txt['beer'], 'bicycle' => $txt['bicycle'], 'books' => $txt['books'], 'bowling' => $txt['bowling'], 'bus' => $txt['bus'], 'cafe' => $txt['cafe'], 'camping' => $txt['camping'], 'car-dealer' => $txt['car-dealer'], 'car-rental' => $txt['car-rental'], 'car-repair' => $txt['car-repair'], 'casino' => $txt['casino'], 'caution' => $txt['caution'], 'cemetery-grave' => $txt['cemetery-grave'], 'cemetery-tomb' => $txt['cemetery-tomb'], 'cinema' => $txt['cinema'], 'civic-building' => $txt['civic-building'], 'computer' => $txt['computer'], 'corporate' => $txt['corporate'], 'fire' => $txt['fire'], 'flag' => $txt['flag'], 'floral' => $txt['floral'], 'helicopter' => $txt['helicopter'], 'home' => $txt['home1'], 'info' => $txt['info'], 'landslide' => $txt['landslide'], 'legal' => $txt['legal'], 'location' => $txt['location1'], 'locomotive' => $txt['locomotive'], 'medical' => $txt['medical'], 'mobile' => $txt['mobile'], 'motorcycle' => $txt['motorcycle'], 'music' => $txt['music'], 'parking' => $txt['parking'], 'pet' => $txt['pet'], 'petrol' => $txt['petrol'], 'phone' => $txt['phone'], 'picnic' => $txt['picnic'], 'postal' => $txt['postal'], 'repair' => $txt['repair'], 'restaurant' => $txt['restaurant'], 'sail' => $txt['sail'], 'school' => $txt['school'], 'scissors' => $txt['scissors'], 'ship' => $txt['ship'], 'shoppingbag' => $txt['shoppingbag'], 'shoppingcart' => $txt['shoppingcart'], 'ski' => $txt['ski'], 'snack' => $txt['snack'], 'snow' => $txt['snow'], 'sport' => $txt['sport'], 'star' => $txt['star'], 'swim' => $txt['swim'], 'taxi' => $txt['taxi'], 'train' => $txt['train'], 'truck' => $txt['truck'], 'wc-female' => $txt['wc-female'], 'wc-male' => $txt['wc-male'], 'wc' => $txt['wc'], 'wheelchair' => $txt['wheelchair']), 'postinput' => $txt['googleMap_PinIcon_info']));
    // Saving?
    if (isset($_GET['save'])) {
        checkSession();
        saveDBSettings($config_vars);
        redirectexit('action=admin;area=modsettings;sa=googlemap');
    }
    $context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=googlemap';
    $context['settings_title'] = $txt['googleMap'];
    $context['settings_insert_below'] = '
	<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/jscolor/jscolor.js"></script>
	<script type="text/javascript">
		var myPicker1 = new jscolor.color(document.getElementById(\'googleMap_PinBackground\'), {});
		myPicker1.fromString(document.getElementById(\'googleMap_PinBackground\').value);

		var myPicker2 = new jscolor.color(document.getElementById(\'googleMap_PinForeground\'), {});
		myPicker2.fromString(document.getElementById(\'googleMap_PinForeground\').value);

		var myPicker3 = new jscolor.color(document.getElementById(\'googleMap_ClusterBackground\'), {});
		myPicker3.fromString(document.getElementById(\'googleMap_ClusterBackground\').value);

		var myPicker4 = new jscolor.color(document.getElementById(\'googleMap_ClusterForeground\'), {});
		myPicker4.fromString(document.getElementById(\'googleMap_ClusterForeground\').value);
	</script>';
    prepareDBSettingContext($config_vars);
}