';
prepareDBSettingContext($config_vars);
}
/**
* Just pause the signature applying thing.
*/
function pauseSignatureApplySettings()
{
global $context, $txt, $sig_start;
// Try get more time...
@set_time_limit(600);
if (function_exists('apache_reset_timeout'))
@apache_reset_timeout();
// Have we exhausted all the time we allowed?
if (time() - array_sum(explode(' ', $sig_start)) < 3)
return;
$context['continue_get_data'] = '?action=admin;area=featuresettings;sa=sig;apply;step=' . $_GET['step'] . ';' . $context['session_var'] . '=' . $context['session_id'];
$context['page_title'] = $txt['not_done_title'];
$context['continue_post_data'] = '';
$context['continue_countdown'] = '2';
$context['sub_template'] = 'not_done';
// Specific stuff to not break this template!
$context[$context['admin_menu_name']]['current_subsection'] = 'sig';
// Get the right percent.
$context['continue_percent'] = round(($_GET['step'] / $context['max_member']) * 100);
// Never more than 100%!
$context['continue_percent'] = min($context['continue_percent'], 100);
obExit();
}
/**
* Show all the custom profile fields available to the user.
*/
function ShowCustomProfiles()
{
global $txt, $scripturl, $context, $settings, $sc, $smcFunc;
global $modSettings, $sourcedir;
$context['page_title'] = $txt['custom_profile_title'];
$context['sub_template'] = 'show_custom_profile';
// What about standard fields they can tweak?
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'warning_status');
// What fields can't you put on the registration page?
$context['fields_no_registration'] = array('posts', 'warning_status');
// Are we saving any standard field changes?
if (isset($_POST['save']))
{
checkSession();
validateToken('admin-scp');
// Do the active ones first.
$disable_fields = array_flip($standard_fields);
if (!empty($_POST['active']))
{
foreach ($_POST['active'] as $value)
if (isset($disable_fields[$value]))
unset($disable_fields[$value]);
}
// What we have left!
$changes['disabled_profile_fields'] = empty($disable_fields) ? '' : implode(',', array_keys($disable_fields));
// Things we want to show on registration?
$reg_fields = array();
if (!empty($_POST['reg']))
{
foreach ($_POST['reg'] as $value)
if (in_array($value, $standard_fields) && !isset($disable_fields[$value]))
$reg_fields[] = $value;
}
// What we have left!
$changes['registration_fields'] = empty($reg_fields) ? '' : implode(',', $reg_fields);
if (!empty($changes))
updateSettings($changes);
}
createToken('admin-scp');
require_once($sourcedir . '/Subs-List.php');
$listOptions = array(
'id' => 'standard_profile_fields',
'title' => $txt['standard_profile_title'],
'base_href' => $scripturl . '?action=admin;area=featuresettings;sa=profile',
'get_items' => array(
'function' => 'list_getProfileFields',
'params' => array(
true,
),
),
'columns' => array(
'field' => array(
'header' => array(
'value' => $txt['standard_profile_field'],
'style' => 'text-align: left;',
),
'data' => array(
'db' => 'label',
'style' => 'width: 60%;',
),
),
'active' => array(
'header' => array(
'value' => $txt['custom_edit_active'],
),
'data' => array(
'function' => create_function('$rowData', '
$isChecked = $rowData[\'disabled\'] ? \'\' : \' checked="checked"\';
$onClickHandler = $rowData[\'can_show_register\'] ? sprintf(\'onclick="document.getElementById(\\\'reg_%1$s\\\').disabled = !this.checked;"\', $rowData[\'id\']) : \'\';
return sprintf(\'\', $rowData[\'id\'], $isChecked, $onClickHandler);
'),
'style' => 'width: 20%; text-align: center;',
),
),
'show_on_registration' => array(
'header' => array(
'value' => $txt['custom_edit_registration'],
),
'data' => array(
'function' => create_function('$rowData', '
$isChecked = $rowData[\'on_register\'] && !$rowData[\'disabled\'] ? \' checked="checked"\' : \'\';
$isDisabled = $rowData[\'can_show_register\'] ? \'\' : \' disabled="disabled"\';
return sprintf(\'\', $rowData[\'id\'], $isChecked, $isDisabled);
'),
'style' => 'width: 20%; text-align: center;',
),
),
),
'form' => array(
'href' => $scripturl . '?action=admin;area=featuresettings;sa=profile',
'name' => 'standardProfileFields',
'token' => 'admin-scp',
),
'additional_rows' => array(
array(
'position' => 'below_table_data',
'value' => '',
'style' => 'text-align: right;',
),
),
);
createList($listOptions);
$listOptions = array(
'id' => 'custom_profile_fields',
'title' => $txt['custom_profile_title'],
'base_href' => $scripturl . '?action=admin;area=featuresettings;sa=profile',
'default_sort_col' => 'field_name',
'no_items_label' => $txt['custom_profile_none'],
'items_per_page' => 25,
'get_items' => array(
'function' => 'list_getProfileFields',
'params' => array(
false,
),
),
'get_count' => array(
'function' => 'list_getProfileFieldSize',
),
'columns' => array(
'field_name' => array(
'header' => array(
'value' => $txt['custom_profile_fieldname'],
'style' => 'text-align: left;',
),
'data' => array(
'function' => create_function('$rowData', '
global $scripturl;
return sprintf(\'%3$s
%4$s
\', $scripturl, $rowData[\'id_field\'], $rowData[\'field_name\'], $rowData[\'field_desc\']);
'),
'style' => 'width: 62%;',
),
'sort' => array(
'default' => 'field_name',
'reverse' => 'field_name DESC',
),
),
'field_type' => array(
'header' => array(
'value' => $txt['custom_profile_fieldtype'],
'style' => 'text-align: left;',
),
'data' => array(
'function' => create_function('$rowData', '
global $txt;
$textKey = sprintf(\'custom_profile_type_%1$s\', $rowData[\'field_type\']);
return isset($txt[$textKey]) ? $txt[$textKey] : $textKey;
'),
'style' => 'width: 15%;',
),
'sort' => array(
'default' => 'field_type',
'reverse' => 'field_type DESC',
),
),
'active' => array(
'header' => array(
'value' => $txt['custom_profile_active'],
),
'data' => array(
'function' => create_function('$rowData', '
global $txt;
return $rowData[\'active\'] ? $txt[\'yes\'] : $txt[\'no\'];
'),
'style' => 'width: 8%; text-align: center;',
),
'sort' => array(
'default' => 'active DESC',
'reverse' => 'active',
),
),
'placement' => array(
'header' => array(
'value' => $txt['custom_profile_placement'],
),
'data' => array(
'function' => create_function('$rowData', '
global $txt;
return $txt[\'custom_profile_placement_\' . (empty($rowData[\'placement\']) ? \'standard\' : ($rowData[\'placement\'] == 1 ? \'withicons\' : \'abovesignature\'))];
'),
'style' => 'width: 8%; text-align: center;',
),
'sort' => array(
'default' => 'placement DESC',
'reverse' => 'placement',
),
),
'show_on_registration' => array(
'header' => array(
'value' => $txt['modify'],
),
'data' => array(
'sprintf' => array(
'format' => '' . $txt['modify'] . '',
'params' => array(
'id_field' => false,
),
),
'style' => 'width: 15%; text-align: center;',
),
),
),
'form' => array(
'href' => $scripturl . '?action=admin;area=featuresettings;sa=profileedit',
'name' => 'customProfileFields',
),
'additional_rows' => array(
array(
'position' => 'below_table_data',
'value' => '',
'style' => 'text-align: right;',
),
),
);
createList($listOptions);
}
/**
* Callback for createList().
*
* @param $start
* @param $items_per_page
* @param $sort
* @param $standardFields
*/
function list_getProfileFields($start, $items_per_page, $sort, $standardFields)
{
global $txt, $modSettings, $smcFunc;
$list = array();
if ($standardFields)
{
$standard_fields = array('icq', 'msn', 'aim', 'yim', 'location', 'gender', 'website', 'posts', 'warning_status');
$fields_no_registration = array('posts', 'warning_status');
$disabled_fields = isset($modSettings['disabled_profile_fields']) ? explode(',', $modSettings['disabled_profile_fields']) : array();
$registration_fields = isset($modSettings['registration_fields']) ? explode(',', $modSettings['registration_fields']) : array();
foreach ($standard_fields as $field)
$list[] = array(
'id' => $field,
'label' => isset($txt['standard_profile_field_' . $field]) ? $txt['standard_profile_field_' . $field] : (isset($txt[$field]) ? $txt[$field] : $field),
'disabled' => in_array($field, $disabled_fields),
'on_register' => in_array($field, $registration_fields) && !in_array($field, $fields_no_registration),
'can_show_register' => !in_array($field, $fields_no_registration),
);
}
else
{
// Load all the fields.
$request = $smcFunc['db_query']('', '
SELECT id_field, col_name, field_name, field_desc, field_type, active, placement
FROM {db_prefix}custom_fields
ORDER BY {raw:sort}
LIMIT {int:start}, {int:items_per_page}',
array(
'sort' => $sort,
'start' => $start,
'items_per_page' => $items_per_page,
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$list[] = $row;
$smcFunc['db_free_result']($request);
}
return $list;
}
/**
* Callback for createList().
*/
function list_getProfileFieldSize()
{
global $smcFunc;
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}custom_fields',
array(
)
);
list ($numProfileFields) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
return $numProfileFields;
}
/**
* Edit some profile fields?
*/
function EditCustomProfiles()
{
global $txt, $scripturl, $context, $settings, $sc, $smcFunc;
// Sort out the context!
$context['fid'] = isset($_GET['fid']) ? (int) $_GET['fid'] : 0;
$context[$context['admin_menu_name']]['current_subsection'] = 'profile';
$context['page_title'] = $context['fid'] ? $txt['custom_edit_title'] : $txt['custom_add_title'];
$context['sub_template'] = 'edit_profile_field';
// Load the profile language for section names.
loadLanguage('Profile');
if ($context['fid'])
{
$request = $smcFunc['db_query']('', '
SELECT
id_field, col_name, field_name, field_desc, field_type, field_length, field_options,
show_reg, show_display, show_profile, private, active, default_value, can_search,
bbc, mask, enclose, placement
FROM {db_prefix}custom_fields
WHERE id_field = {int:current_field}',
array(
'current_field' => $context['fid'],
)
);
$context['field'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if ($row['field_type'] == 'textarea')
@list ($rows, $cols) = @explode(',', $row['default_value']);
else
{
$rows = 3;
$cols = 30;
}
$context['field'] = array(
'name' => $row['field_name'],
'desc' => $row['field_desc'],
'colname' => $row['col_name'],
'profile_area' => $row['show_profile'],
'reg' => $row['show_reg'],
'display' => $row['show_display'],
'type' => $row['field_type'],
'max_length' => $row['field_length'],
'rows' => $rows,
'cols' => $cols,
'bbc' => $row['bbc'] ? true : false,
'default_check' => $row['field_type'] == 'check' && $row['default_value'] ? true : false,
'default_select' => $row['field_type'] == 'select' || $row['field_type'] == 'radio' ? $row['default_value'] : '',
'options' => strlen($row['field_options']) > 1 ? explode(',', $row['field_options']) : array('', '', ''),
'active' => $row['active'],
'private' => $row['private'],
'can_search' => $row['can_search'],
'mask' => $row['mask'],
'regex' => substr($row['mask'], 0, 5) == 'regex' ? substr($row['mask'], 5) : '',
'enclose' => $row['enclose'],
'placement' => $row['placement'],
);
}
$smcFunc['db_free_result']($request);
}
// Setup the default values as needed.
if (empty($context['field']))
$context['field'] = array(
'name' => '',
'colname' => '???',
'desc' => '',
'profile_area' => 'forumprofile',
'reg' => false,
'display' => false,
'type' => 'text',
'max_length' => 255,
'rows' => 4,
'cols' => 30,
'bbc' => false,
'default_check' => false,
'default_select' => '',
'options' => array('', '', ''),
'active' => true,
'private' => false,
'can_search' => false,
'mask' => 'nohtml',
'regex' => '',
'enclose' => '',
'placement' => 0,
);
// Are we saving?
if (isset($_POST['save']))
{
checkSession();
validateToken('admin-ecp');
// Everyone needs a name - even the (bracket) unknown...
if (trim($_POST['field_name']) == '')
redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=need_name');
// Regex you say? Do a very basic test to see if the pattern is valid
if (isset($_POST['regex']) && (empty($_POST['regex']) || @preg_match($_POST['regex'], 'dummy') === false))
redirectexit($scripturl . '?action=admin;area=featuresettings;sa=profileedit;fid=' . $_GET['fid'] . ';msg=regex_error');
$_POST['field_name'] = $smcFunc['htmlspecialchars']($_POST['field_name']);
$_POST['field_desc'] = $smcFunc['htmlspecialchars']($_POST['field_desc']);
// Checkboxes...
$show_reg = isset($_POST['reg']) ? (int) $_POST['reg'] : 0;
$show_display = isset($_POST['display']) ? 1 : 0;
$bbc = isset($_POST['bbc']) ? 1 : 0;
$show_profile = $_POST['profile_area'];
$active = isset($_POST['active']) ? 1 : 0;
$private = isset($_POST['private']) ? (int) $_POST['private'] : 0;
$can_search = isset($_POST['can_search']) ? 1 : 0;
// Some masking stuff...
$mask = isset($_POST['mask']) ? $_POST['mask'] : '';
if ($mask == 'regex' && isset($_POST['regex']))
$mask .= $_POST['regex'];
$field_length = isset($_POST['max_length']) ? (int) $_POST['max_length'] : 255;
$enclose = isset($_POST['enclose']) ? $_POST['enclose'] : '';
$placement = isset($_POST['placement']) ? (int) $_POST['placement'] : 0;
// Select options?
$field_options = '';
$newOptions = array();
$default = isset($_POST['default_check']) && $_POST['field_type'] == 'check' ? 1 : '';
if (!empty($_POST['select_option']) && ($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio'))
{
foreach ($_POST['select_option'] as $k => $v)
{
// Clean, clean, clean...
$v = $smcFunc['htmlspecialchars']($v);
$v = strtr($v, array(',' => ''));
// Nada, zip, etc...
if (trim($v) == '')
continue;
// Otherwise, save it boy.
$field_options .= $v . ',';
// This is just for working out what happened with old options...
$newOptions[$k] = $v;
// Is it default?
if (isset($_POST['default_select']) && $_POST['default_select'] == $k)
$default = $v;
}
$field_options = substr($field_options, 0, -1);
}
// Text area has default has dimensions
if ($_POST['field_type'] == 'textarea')
$default = (int) $_POST['rows'] . ',' . (int) $_POST['cols'];
// Come up with the unique name?
if (empty($context['fid']))
{
$colname = $smcFunc['substr'](strtr($_POST['field_name'], array(' ' => '')), 0, 6);
preg_match('~([\w\d_-]+)~', $colname, $matches);
// If there is nothing to the name, then let's start out own - for foreign languages etc.
if (isset($matches[1]))
$colname = $initial_colname = 'cust_' . strtolower($matches[1]);
else
$colname = $initial_colname = 'cust_' . mt_rand(1, 999);
// Make sure this is unique.
// @todo This may not be the most efficient way to do this.
$unique = false;
for ($i = 0; !$unique && $i < 9; $i ++)
{
$request = $smcFunc['db_query']('', '
SELECT id_field
FROM {db_prefix}custom_fields
WHERE col_name = {string:current_column}',
array(
'current_column' => $colname,
)
);
if ($smcFunc['db_num_rows']($request) == 0)
$unique = true;
else
$colname = $initial_colname . $i;
$smcFunc['db_free_result']($request);
}
// Still not a unique colum name? Leave it up to the user, then.
if (!$unique)
fatal_lang_error('custom_option_not_unique');
}
// Work out what to do with the user data otherwise...
else
{
// Anything going to check or select is pointless keeping - as is anything coming from check!
if (($_POST['field_type'] == 'check' && $context['field']['type'] != 'check')
|| (($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio') && $context['field']['type'] != 'select' && $context['field']['type'] != 'radio')
|| ($context['field']['type'] == 'check' && $_POST['field_type'] != 'check'))
{
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}themes
WHERE variable = {string:current_column}
AND id_member > {int:no_member}',
array(
'no_member' => 0,
'current_column' => $context['field']['colname'],
)
);
}
// Otherwise - if the select is edited may need to adjust!
elseif ($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio')
{
$optionChanges = array();
$takenKeys = array();
// Work out what's changed!
foreach ($context['field']['options'] as $k => $option)
{
if (trim($option) == '')
continue;
// Still exists?
if (in_array($option, $newOptions))
{
$takenKeys[] = $k;
continue;
}
}
// Finally - have we renamed it - or is it really gone?
foreach ($optionChanges as $k => $option)
{
// Just been renamed?
if (!in_array($k, $takenKeys) && !empty($newOptions[$k]))
$smcFunc['db_query']('', '
UPDATE {db_prefix}themes
SET value = {string:new_value}
WHERE variable = {string:current_column}
AND value = {string:old_value}
AND id_member > {int:no_member}',
array(
'no_member' => 0,
'new_value' => $newOptions[$k],
'current_column' => $context['field']['colname'],
'old_value' => $option,
)
);
}
}
// @todo Maybe we should adjust based on new text length limits?
}
// Do the insertion/updates.
if ($context['fid'])
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}custom_fields
SET
field_name = {string:field_name}, field_desc = {string:field_desc},
field_type = {string:field_type}, field_length = {int:field_length},
field_options = {string:field_options}, show_reg = {int:show_reg},
show_display = {int:show_display}, show_profile = {string:show_profile},
private = {int:private}, active = {int:active}, default_value = {string:default_value},
can_search = {int:can_search}, bbc = {int:bbc}, mask = {string:mask},
enclose = {string:enclose}, placement = {int:placement}
WHERE id_field = {int:current_field}',
array(
'field_length' => $field_length,
'show_reg' => $show_reg,
'show_display' => $show_display,
'private' => $private,
'active' => $active,
'can_search' => $can_search,
'bbc' => $bbc,
'current_field' => $context['fid'],
'field_name' => $_POST['field_name'],
'field_desc' => $_POST['field_desc'],
'field_type' => $_POST['field_type'],
'field_options' => $field_options,
'show_profile' => $show_profile,
'default_value' => $default,
'mask' => $mask,
'enclose' => $enclose,
'placement' => $placement,
)
);
// Just clean up any old selects - these are a pain!
if (($_POST['field_type'] == 'select' || $_POST['field_type'] == 'radio') && !empty($newOptions))
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}themes
WHERE variable = {string:current_column}
AND value NOT IN ({array_string:new_option_values})
AND id_member > {int:no_member}',
array(
'no_member' => 0,
'new_option_values' => $newOptions,
'current_column' => $context['field']['colname'],
)
);
}
else
{
$smcFunc['db_insert']('',
'{db_prefix}custom_fields',
array(
'col_name' => 'string', 'field_name' => 'string', 'field_desc' => 'string',
'field_type' => 'string', 'field_length' => 'string', 'field_options' => 'string',
'show_reg' => 'int', 'show_display' => 'int', 'show_profile' => 'string',
'private' => 'int', 'active' => 'int', 'default_value' => 'string', 'can_search' => 'int',
'bbc' => 'int', 'mask' => 'string', 'enclose' => 'string', 'placement' => 'int',
),
array(
$colname, $_POST['field_name'], $_POST['field_desc'],
$_POST['field_type'], $field_length, $field_options,
$show_reg, $show_display, $show_profile,
$private, $active, $default, $can_search,
$bbc, $mask, $enclose, $placement,
),
array('id_field')
);
}
// As there's currently no option to priorize certain fields over others, let's order them alphabetically.
$smcFunc['db_query']('alter_table_boards', '
ALTER TABLE {db_prefix}custom_fields
ORDER BY field_name',
array(
'db_error_skip' => true,
)
);
}
// Deleting?
elseif (isset($_POST['delete']) && $context['field']['colname'])
{
checkSession();
validateToken('admin-ecp');
// Delete the user data first.
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}themes
WHERE variable = {string:current_column}
AND id_member > {int:no_member}',
array(
'no_member' => 0,
'current_column' => $context['field']['colname'],
)
);
// Finally - the field itself is gone!
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}custom_fields
WHERE id_field = {int:current_field}',
array(
'current_field' => $context['fid'],
)
);
}
// Rebuild display cache etc.
if (isset($_POST['delete']) || isset($_POST['save']))
{
checkSession();
$request = $smcFunc['db_query']('', '
SELECT col_name, field_name, field_type, bbc, enclose, placement
FROM {db_prefix}custom_fields
WHERE show_display = {int:is_displayed}
AND active = {int:active}
AND private != {int:not_owner_only}
AND private != {int:not_admin_only}',
array(
'is_displayed' => 1,
'active' => 1,
'not_owner_only' => 2,
'not_admin_only' => 3,
)
);
$fields = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$fields[] = array(
'colname' => strtr($row['col_name'], array('|' => '', ';' => '')),
'title' => strtr($row['field_name'], array('|' => '', ';' => '')),
'type' => $row['field_type'],
'bbc' => $row['bbc'] ? '1' : '0',
'placement' => !empty($row['placement']) ? $row['placement'] : '0',
'enclose' => !empty($row['enclose']) ? $row['enclose'] : '',
);
}
$smcFunc['db_free_result']($request);
updateSettings(array('displayFields' => serialize($fields)));
redirectexit('action=admin;area=featuresettings;sa=profile');
}
createToken('admin-ecp');
}
/**
* Allow to edit the settings on the pruning screen.
* @param $return_config
*/
function ModifyPruningSettings($return_config = false)
{
global $txt, $scripturl, $sourcedir, $context, $settings, $sc, $modSettings;
// Make sure we understand what's going on.
loadLanguage('ManageSettings');
$context['page_title'] = $txt['pruning_title'];
$config_vars = array(
// Even do the pruning?
// The array indexes are there so we can remove/change them before saving.
'pruningOptions' => array('check', 'pruningOptions'),
'',
// Various logs that could be pruned.
array('int', 'pruneErrorLog', 'postinput' => $txt['days_word']), // Error log.
array('int', 'pruneModLog', 'postinput' => $txt['days_word']), // Moderation log.
array('int', 'pruneBanLog', 'postinput' => $txt['days_word']), // Ban hit log.
array('int', 'pruneReportLog', 'postinput' => $txt['days_word']), // Report to moderator log.
array('int', 'pruneScheduledTaskLog', 'postinput' => $txt['days_word']), // Log of the scheduled tasks and how long they ran.
array('int', 'pruneSpiderHitLog', 'postinput' => $txt['days_word']), // Log of the scheduled tasks and how long they ran.
// If you add any additional logs make sure to add them after this point. Additionally, make sure you add them to the weekly scheduled task.
// Mod Developers: Do NOT use the pruningOptions master variable for this as SMF Core may overwrite your setting in the future!
);
call_integration_hook('integrate_prune_settings', array(&$config_vars));
if ($return_config)
return $config_vars;
// We'll need this in a bit.
require_once($sourcedir . '/ManageServer.php');
// Saving?
if (isset($_GET['save']))
{
checkSession();
$savevar = array(
array('text', 'pruningOptions')
);
if (!empty($_POST['pruningOptions']))
{
$vals = array();
foreach ($config_vars as $index => $dummy)
{
if (!is_array($dummy) || $index == 'pruningOptions')
continue;
$vals[] = empty($_POST[$dummy[1]]) || $_POST[$dummy[1]] < 0 ? 0 : (int) $_POST[$dummy[1]];
}
$_POST['pruningOptions'] = implode(',', $vals);
}
else
$_POST['pruningOptions'] = '';
saveDBSettings($savevar);
redirectexit('action=admin;area=logs;sa=pruning');
}
$context['post_url'] = $scripturl . '?action=admin;area=logs;save;sa=pruning';
$context['settings_title'] = $txt['pruning_title'];
$context['sub_template'] = 'show_settings';
// Get the actual values
if (!empty($modSettings['pruningOptions']))
@list ($modSettings['pruneErrorLog'], $modSettings['pruneModLog'], $modSettings['pruneBanLog'], $modSettings['pruneReportLog'], $modSettings['pruneScheduledTaskLog'], $modSettings['pruneSpiderHitLog']) = explode(',', $modSettings['pruningOptions']);
else
$modSettings['pruneErrorLog'] = $modSettings['pruneModLog'] = $modSettings['pruneBanLog'] = $modSettings['pruneReportLog'] = $modSettings['pruneScheduledTaskLog'] = $modSettings['pruneSpiderHitLog'] = 0;
prepareDBSettingContext($config_vars);
}
/**
* 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(
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!
);
// 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'] = '
' . $txt['modification_no_misc_settings'] . '
';
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);
}
?>