&$txt['displayedValue']), &$txt['descriptionOfTheOption'], 'OptionalReferenceToHelpAdmin'), Note that just saying array('first', 'second') will put 0 in the SQL for 'first'. * A password input box. Used for passwords, no less! ie. array('password', 'nameInModSettingsAndSQL', 'OptionalInputBoxWidth', &$txt['descriptionOfTheOption'], 'OptionalReferenceToHelpAdmin'), For each option: type (see above), variable name, size/possible values, description, helptext. OR make type 'rule' for an empty string for a horizontal rule. OR make type 'heading' with a string for a titled section. */ $config_vars = array( array('heading', &$txt['mods_cat_features']), // Big Options... polls, sticky, guest stuff.... array('select', 'pollMode', array(&$txt['smf34'], &$txt['smf32'], &$txt['smf33'])), array('check', 'enableStickyTopics'), array('rule'), // Basic stuff, user languages, titles, flash, permissions... array('check', 'allow_guestAccess'), array('check', 'userLanguage'), array('check', 'allow_editDisplayName'), array('check', 'allow_hideOnline'), array('check', 'allow_hideEmail'), array('check', 'guest_hideContacts'), array('check', 'titlesEnable'), array('text', 'default_personalText'), array('int', 'max_signatureLength', 5), array('check', 'removeNestedQuotes'), array('check', 'enableEmbeddedFlash'), array('check', 'enablePostHTML'), array('text', 'disabledBBC'), array('check', 'enableBBC'), array('int', 'max_messageLength', 5), array('check', 'enableNewReplyWarning'), array('rule'), // Stats, compression, cookies.... server type stuff. array('text', 'time_format'), array('select', 'number_format', array('1234.00' => '1234.00', '1,234.00' => '1,234.00', '1.234,00' => '1.234,00', '1 234,00' => '1 234,00', '1234,00' => '1234,00')), array('float', 'time_offset'), array('int', 'spamWaitTime'), array('int', 'edit_wait_time'), array('int', 'failed_login_threshold'), array('int', 'lastActive'), array('check', 'enableSpellChecking'), array('check', 'trackStats'), array('check', 'hitStats'), array('check', 'enableCompressedOutput'), array('check', 'databaseSession_enable'), array('check', 'databaseSession_loose'), array('int', 'databaseSession_lifetime'), array('check', 'enableErrorLogging'), array('int', 'cookieTime', 5), array('check', 'localCookies'), array('check', 'globalCookies'), array('check', 'redirectMetaRefresh'), array('check', 'securityDisable'), array('rule'), // Email and registration type stuff... array('select', 'registration_method', array(&$txt['registration_standard'], &$txt['registration_activate'], &$txt['registration_approval'], &$txt['registration_disabled'])), array('check', 'notify_on_new_registration'), array('check', 'send_validation_onChange'), array('check', 'send_welcomeEmail'), array('rule'), // Database reapir, optimization, etc. array('int', 'autoOptDatabase', 4), array('int', 'autoOptMaxOnline', 4), array('check', 'autoFixDatabase'), array('rule'), // Option-ish things... miscellaneous sorta. array('check', 'notifyAnncmnts_UserDisable'), array('check', 'modlog_enabled'), array('check', 'queryless_urls'), array('rule'), // Width/Height image reduction. array('int', 'maxwidth'), array('int', 'maxheight'), array('rule'), // SMTP stuff. array('select', 'mail_type', array('smtp' => 'SMTP', 'sendmail' => 'sendmail')), array('text', 'smtp_host'), array('text', 'smtp_port'), array('text', 'smtp_username'), array('password', 'smtp_password'), array('rule'), // XML stuff ;). array('check', 'xmlnews_enable'), array('int', 'xmlnews_maxlen'), array('rule'), // Recycle topics? array('check', 'recycle_enable'), array('select', 'recycle_board', $calBoards), array('heading', &$txt['mods_cat_layout']), // Compact pages? array('check', 'compactTopicPagesEnable'), array('int', 'compactTopicPagesContiguous', null, $txt['smf235'] . '
' . str_replace(' ', ' ', '"3" ' . $txt['smf236'] . ': 1 ... 4 [5] 6 ... 9') . '
' . str_replace(' ', ' ', '"5" ' . $txt['smf236'] . ': 1 ... 3 4 [5] 6 7 ... 9') . '
'), array('rule'), // Stuff that just is everywhere - today, search, online, etc. array('select', 'todayMod', array(&$txt['smf290'], &$txt['smf291'], &$txt['smf292'])), array('check', 'topbottomEnable'), array('check', 'onlineEnable'), array('check', 'enableVBStyleLogin'), array('check', 'autoLinkUrls'), array('int', 'fixLongWords'), array('rule'), // Pagination stuff. array('int', 'defaultMaxTopics'), array('int', 'defaultMaxMessages'), array('int', 'defaultMaxMembers'), array('int', 'topicSummaryPosts'), array('int', 'enableAllMessages'), array('rule'), // Number of posts for a hot topic, participation, etc.? array('int', 'hotTopicPosts'), array('int', 'hotTopicVeryPosts'), array('check', 'enableParticipation'), array('check', 'enablePreviousNext'), array('rule'), // This is like debugging sorta. array('check', 'timeLoadPageEnable'), array('check', 'disableHostnameLookup'), array('rule'), // Who's online. array('check', 'who_enabled'), '', // Recent topics ? array('check', 'recent_topics',null, &$txt['recent_topics']), array('heading', &$txt['mods_cat_search']), // Basic search settings. array('check', 'simpleSearch'), array('check', 'search_match_complete_words'), array('check', 'disableTemporaryTables'), // Number of search results displayed/cached. array('rule'), array('int', 'search_results_per_page'), array('int', 'search_cache_size'), array('rule'), // Search weight settings. array('int', 'search_weight_frequency'), array('int', 'search_weight_age'), array('int', 'search_weight_length'), array('int', 'search_weight_subject'), array('int', 'search_weight_first_message'), array('heading', &$txt['mods_cat_avatars']), // Basic avatar settings. array('check', 'avatar_allow_server_stored'), array('text', 'avatar_directory', 30), array('text', 'avatar_url', 30), array('rule'), // External avatars... array('check', 'avatar_allow_external_url'), array('int', 'avatar_max_width_external'), array('int', 'avatar_max_height_external'), array('check', 'avatar_check_size'), array('select', 'avatar_action_too_large', array( 'option_refuse' => &$txt['option_refuse'], 'option_html_resize' => &$txt['option_html_resize'], 'option_download_and_resize' => &$txt['option_download_and_resize'] )), array('rule'), // Uploaded avatars. array('check', 'avatar_allow_upload'), array('int', 'avatar_max_width_upload'), array('int', 'avatar_max_height_upload'), array('check', 'avatar_resize_upload'), array('check', 'avatar_download_png'), array('heading', &$txt['smf294']), // Who can do attachments? array('select', 'attachmentEnable', explode('|', $txt['smf111'])), array('rule'), // Extensions/images...? array('check', 'attachmentCheckExtensions'), array('text', 'attachmentExtensions'), array('check', 'attachmentShowImages'), array('check', 'attachmentEncryptFilenames'), array('rule'), // Directories and sizes/numbers. array('text', 'attachmentUploadDir', 30), array('int', 'attachmentDirSizeLimit'), array('int', 'attachmentPostLimit'), array('int', 'attachmentSizeLimit'), array('int', 'attachmentNumPerPostLimit'), array('heading', &$txt['smf293']), // Karma - On or off? array('select', 'karmaMode', explode('|', $txt['smf64'])), array('check', 'karmadescmod'), array('int', 'karmamaxmembers'), array('check', 'karmalogview'), array('check', 'karmapermiss'), array('check', 'karmalinks'), array('check', 'karmaisowner'), array('check', 'karmakarma'), array('check', 'karmaurl'), array('check', 'karmaotherstat'), array('check', 'karmasurv'), array('text', 'karmawhatwrite'), array('check', 'karmacensor'), array('check', 'karmatopicstarter'), array('rule'), // Who can do it.... and who is restricted by time limits? array('int', 'karmaMinPosts'), array('float', 'karmaWaitTime'), array('check', 'karmaTimeRestrictAdmins'), array('rule'), // What does it look like? [smite]? array('text', 'karmaLabel'), array('text', 'karmaApplaudLabel'), array('text', 'karmaSmiteLabel'), array('heading', "Google Member Map"), array('check', 'googleMapsEnable'), array('check', 'googleMapsEnableLegend'), array('text', 'googleMapsKey'), array('check', 'googleMapsPinGender'), array('int', 'googleMapsPinNumber'), array('select', 'googleMapsType', array('G_NORMAL_MAP' => 'Map', 'G_SATELLITE_MAP' => 'Satellite', 'G_HYBRID_MAP' => 'Hybrid')), array('select', 'googleSidebar', array('No Sidebar', 'Sidebar Right', 'Sidebar Bottom')), array('rule'), array('float', 'googleMapsDefaultLat', '25'), array('float', 'googleMapsDefaultLong', '25'), array('int', 'googleMapsDefaultZoom'), array('rule'), array('check', 'googleMapsEnableClusterer'), array('int', 'googleMapsMinMarkerCluster'), array('int', 'googleMapsMaxVisMarker'), array('int', 'googleMapsMaxNumClusters'), array('int', 'googleMapsMaxLinesCluster'), array('heading', &$txt['mods_cat_calendar']), // Enable the calendar? array('check', 'cal_enabled'), array('rule'), // How the actual calendar looks... array('check', 'cal_daysaslink'), array('check', 'cal_showweeknum'), array('rule'), // Show it on the boardindex? array('int', 'cal_days_for_index'), array('check', 'cal_showholidaysonindex'), array('check', 'cal_showbdaysonindex'), array('check', 'cal_showeventsonindex'), array('rule'), // The default board to post in... kinda alone... array('select', 'cal_defaultboard', $calBoards), array('rule'), // Minimum/Maximum year for events. array('int', 'cal_minyear'), array('int', 'cal_maxyear'), array('rule'), // Colors for the calendar display. array('text', 'cal_bdaycolor'), array('text', 'cal_eventcolor'), array('text', 'cal_holidaycolor'), array('rule'), // One day events or multi-day? array('check', 'cal_allowspan'), array('int', 'cal_maxspan'), //Begin CAPTCHA Mod 0.1 array('heading', $txt['captchaHeading']), array('int', 'captchaChars'), array('int', 'captchaMinSize'), array('int', 'captchaMaxSize'), array('int', 'captchaMaxRotate'), array('check', 'captchaNoise'), array('check', 'captchaWebSafeColours'), array('text', 'captchaBadGuysURL', 50), //End CAPTCHA Mod array('heading', &$txt['visual_warning_mod']), array('text', 'visualw_mess_ban'), array('text', 'visualw_mess_mute'), array('text', 'visualw_mess_pmod'), array('text', 'visualw_mess_warn'), array('rule'), array('text', 'visualw_color_ban'), array('text', 'visualw_color_mute'), array('text', 'visualw_color_pmod'), array('text', 'visualw_color_warn'), array('rule'), array('text', 'visualw_image_ban'), array('text', 'visualw_image_mute'), array('text', 'visualw_image_pmod'), array('text', 'visualw_image_warn'), array('rule'), array('text', 'muteAutoTime'), array('text', 'moderationAutoTime'), array('text', 'warningAutoTime'), array('rule'), array('check', 'visualw_pmod_edit'), array('heading', &$txt['nowplaying1']), array('check', 'nowplayingEnabled'), array('text', 'nowplaying_text', 30), array('text', 'nowplaying_image', 30), array('rule'), array('heading', &$txt['ob_googlebot_modname']), // Count all instances of spiders? array('check', 'ob_googlebot_count_all_instances'), array('check', 'ob_googlebot_display_all_instances'), array('check', 'ob_googlebot_display_agent'), array('check', 'ob_googlebot_display_own_list'), array('rule'), array('check', 'ob_googlebot_count_most_online'), array('rule'), ); return $config_vars; } function ModifyModSettings() { global $txt, $scripturl, $context, $settings, $sc; isAllowedTo('admin_forum'); // Load the administration bar... adminIndex('edit_mods_settings'); loadLanguage('Help'); $config_vars = defineSettings(); $context['page_title'] = $txt['modSettings_title']; $context['sub_template'] = 'rawdata'; $context['raw_data'] = '
'; // Show them! displaySettings($config_vars); $context['raw_data'] .= '
' . $txt[119] . ' ' . $txt['modSettings_title'] . ' ' . $txt['mods_cat_expand_all'] . '
' . $txt['smf3'] . '
'; } function displaySettings(&$config_vars) { global $txt, $helptxt, $scripturl, $modSettings, $context, $settings; // If it's not yet set, default it to just 0. if (empty($_SESSION['expand']) || isset($_GET['collapseall'])) $_SESSION['expand'] = serialize(array(0)); // Otherwise take off the slashes. else $_SESSION['expand'] = stripslashes($_SESSION['expand']); // Get the actual array. $expanded = unserialize($_SESSION['expand']); // Expanding/Collapsing? if (isset($_GET['expand'])) { if ($_GET['expand'] == 'all') $_GET['expandall'] = true; // Collapse. elseif (in_array($_GET['expand'], $expanded)) { foreach ($expanded as $k => $v) if ($v == $_GET['expand']) unset($expanded[$k]); } // Expand. else $expanded = array_merge($expanded, array((int) $_GET['expand'])); // Reset the array. $_SESSION['expand'] = serialize($expanded); } // Right now we are showing the boxes, etc. $display = true; // 0: type, 1: name, 2:desc, 3:helptext, 4:size/values. foreach ($config_vars as $k => $config_var) { if (empty($config_var)) continue; if ($display) $context['raw_data'] .= ' '; // These two are referenced so much they deserve their own variables. $config_type = $config_var[0]; $config_id = isset($config_var[1]) ? $config_var[1] : ''; // A rule, no more no less - assuming we're displaying things, go for it. if ($config_type == 'rule' && $display) { $context['raw_data'] .= '
'; continue; } elseif ($config_type == 'heading') { // Currently not displaying... close the old cell. if (!$display) $context['raw_data'] .= ' '; else $context['raw_data'] .= ' '; // Show the bar with the +/-. [ + Blah ]... $context['raw_data'] .= '
* ' . $config_id . '
'; // If it's not in the expanded array, and we're not expanding everything... if (!in_array($k, $expanded) && !isset($_GET['expandall'])) { // Turn off display. $display = false; // Start an empty box. (just so it looks better... err, I think it looks better.) $context['raw_data'] .= ' '; } // Expand this and set the session var... done so collapsing after expanding all is logical. elseif (isset($_GET['expandall'])) $expanded = array_merge($expanded, array($k)); // Turn display on otherwise. else $display = true; continue; } // Don't do anything more if we're not displaying anything! if (!$display) continue; // This setting isn't set!! Ignore it and set it to a blank value so mods are easier to write ;). if (!isset($modSettings[$config_id])) $modSettings[$config_id] = ''; $context['raw_data'] .= ' '; // Show the little [?] if display is on. if (isset($config_var[4]) || isset($helptxt[$config_id])) $context['raw_data'] .= '
' . $txt[119] . ''; else $context['raw_data'] .= ' '; // Show the description... if a specific string wasn't passed, look for it... makes it easier ;). if ($config_id != '') $context['raw_data'] .= ' '; // If it's a textbox.... (text, int, float, etc.) if (in_array($config_type, array('text', 'int', 'float'))) $context['raw_data'] .= ''; // If it's a password... elseif ($config_type == 'password') $context['raw_data'] .= ''; // If it's a checkbox, we're gonna have to send a hidden 0 with it... elseif ($config_var[0] == 'check') $context['raw_data'] .= ''; // A select box... display on... elseif ($config_var[0] == 'select') { $context['raw_data'] .= ' '; } // End the table cell. $context['raw_data'] .= ''; } // Cleanup the expanded array again: if (isset($_GET['expandall'])) $_SESSION['expand'] = serialize($expanded); // Gotta close it off if we weren't showing anything ;). if (!$display) $context['raw_data'] .= ' '; } // Save the settings. function ModifyModSettings2() { global $scripturl, $db_prefix, $settings; // Verify the user is allowed to be here! isAllowedTo('admin_forum'); checkSession(); $setArray = array(); // All the checkbox values.... $config_vars = defineSettings(); foreach ($config_vars as $var) { if (!isset($var[1]) || !isset($_POST[$var[1]])) continue; // Checkboxes! elseif ($var[0] == 'check') $setArray[$var[1]] = !empty($_POST[$var[1]]) ? '1' : '0'; // Select boxes! elseif ($var[0] == 'select' && in_array($_POST[$var[1]], array_keys($var[2]))) $setArray[$var[1]] = $_POST[$var[1]]; // Integers! elseif ($var[0] == 'int') $setArray[$var[1]] = (int) $_POST[$var[1]]; // Floating point! elseif ($var[0] == 'float') $setArray[$var[1]] = (float) $_POST[$var[1]]; // Text and passwords! elseif ($var[0] == 'text' || $var[0] == 'password') $setArray[$var[1]] = $_POST[$var[1]]; } updateSettings($setArray); updateStats('calendar'); loadUserSettings(); writeLog(); // Expand something? if (isset($_POST['expand']) && $_POST['expand'] != '') redirectexit('action=modifyModSettings;expand=' . $_POST['expand'] . '#sect' . $_POST['expand']); // Back to administration. redirectexit('action=modifyModSettings'); } ?>