'),
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'),
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_MAP_TYPE' => 'Map', 'G_SATELLITE_TYPE' => 'Satellite', 'G_HYBRID_TYPE' => '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'),
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'] = '
';
}
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 ($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'] .= '
';
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');
}
?>