';
}
// Thirdly, push some JavaScript for the form to make it work.
addInlineJavaScript('
var nextrow = ' . (!empty($context['question_answers']) ? max(array_keys($context['question_answers'])) + 1 : 1) . ';
$(".qa_link a").click(function() {
var id = $(this).parent().attr("id").substring(6);
$("#qa_fs_" + id).show();
$(this).parent().hide();
});
$(".qa_fieldset legend a").click(function() {
var id = $(this).closest("fieldset").attr("id").substring(6);
$("#qa_dt_" + id).show();
$(this).closest("fieldset").hide();
});
$(".qa_add_question a").click(function() {
var id = $(this).closest("fieldset").attr("id").substring(6);
$(\'
\').insertBefore($(this).parent());
nextrow++;
});
$(".qa_fieldset ").on("click", ".qa_add_answer a", function() {
var attr = $(this).closest("dd").find(".verification_answer:last").attr("name");
$(\'\').insertBefore($(this).closest("div"));
return false;
});
$("#qa_dt_' . strtr($language, array('-utf8' => '')) . ' a").click();', true);
// Will need the utility functions from here.
require_once($sourcedir . '/ManageServer.php');
// Saving?
if (isset($_GET['save']))
{
checkSession();
// Fix PM settings.
$_POST['pm_spam_settings'] = (int) $_POST['max_pm_recipients'] . ',' . (int) $_POST['pm_posts_verification'] . ',' . (int) $_POST['pm_posts_per_hour'];
// Hack in guest requiring verification!
if (empty($_POST['posts_require_captcha']) && !empty($_POST['guests_require_captcha']))
$_POST['posts_require_captcha'] = -1;
$save_vars = $config_vars;
unset($save_vars['pm1'], $save_vars['pm2'], $save_vars['pm3'], $save_vars['guest_verify']);
$save_vars[] = array('text', 'pm_spam_settings');
// Handle verification questions.
$changes = array(
'insert' => array(),
'replace' => array(),
'delete' => array(),
);
$qs_per_lang = array();
foreach ($context['qa_languages'] as $lang_id => $dummy)
{
// If we had some questions for this language before, but don't now, delete everything from that language.
if ((!isset($_POST['question'][$lang_id]) || !is_array($_POST['question'][$lang_id])) && !empty($context['qa_by_lang'][$lang_id]))
$changes['delete'] = array_merge($changes['delete'], $context['qa_by_lang'][$lang_id]);
// Now step through and see if any existing questions no longer exist.
if (!empty($context['qa_by_lang'][$lang_id]))
foreach ($context['qa_by_lang'][$lang_id] as $q_id)
if (empty($_POST['question'][$lang_id][$q_id]))
$changes['delete'][] = $q_id;
// Now let's see if there are new questions or ones that need updating.
if (isset($_POST['question'][$lang_id]))
{
foreach ($_POST['question'][$lang_id] as $q_id => $question)
{
// Ignore junky ids.
$q_id = (int) $q_id;
if ($q_id <= 0)
continue;
// Check the question isn't empty (because they want to delete it?)
if (empty($question) || trim($question) == '')
{
if (isset($context['question_answers'][$q_id]))
$changes['delete'][] = $q_id;
continue;
}
$question = $smcFunc['htmlspecialchars'](trim($question));
// Get the answers. Firstly check there actually might be some.
if (!isset($_POST['answer'][$lang_id][$q_id]) || !is_array($_POST['answer'][$lang_id][$q_id]))
{
if (isset($context['question_answers'][$q_id]))
$changes['delete'][] = $q_id;
continue;
}
// Now get them and check that they might be viable.
$answers = array();
foreach ($_POST['answer'][$lang_id][$q_id] as $answer)
if (!empty($answer) && trim($answer) !== '')
$answers[] = $smcFunc['htmlspecialchars'](trim($answer));
if (empty($answers))
{
if (isset($context['question_answers'][$q_id]))
$changes['delete'][] = $q_id;
continue;
}
$answers = $smcFunc['json_encode']($answers);
// At this point we know we have a question and some answers. What are we doing with it?
if (!isset($context['question_answers'][$q_id]))
{
// New question. Now, we don't want to randomly consume ids, so we'll set those, rather than trusting the browser's supplied ids.
$changes['insert'][] = array($lang_id, $question, $answers);
}
else
{
// It's an existing question. Let's see what's changed, if anything.
if ($lang_id != $context['question_answers'][$q_id]['lngfile'] || $question != $context['question_answers'][$q_id]['question'] || $answers != $context['question_answers'][$q_id]['answers'])
$changes['replace'][$q_id] = array('lngfile' => $lang_id, 'question' => $question, 'answers' => $answers);
}
if (!isset($qs_per_lang[$lang_id]))
$qs_per_lang[$lang_id] = 0;
$qs_per_lang[$lang_id]++;
}
}
}
// OK, so changes?
if (!empty($changes['delete']))
{
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}qanda
WHERE id_question IN ({array_int:questions})',
array(
'questions' => $changes['delete'],
)
);
}
if (!empty($changes['replace']))
{
foreach ($changes['replace'] as $q_id => $question)
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}qanda
SET lngfile = {string:lngfile},
question = {string:question},
answers = {string:answers}
WHERE id_question = {int:id_question}',
array(
'id_question' => $q_id,
'lngfile' => $question['lngfile'],
'question' => $question['question'],
'answers' => $question['answers'],
)
);
}
}
if (!empty($changes['insert']))
{
$smcFunc['db_insert']('insert',
'{db_prefix}qanda',
array('lngfile' => 'string-50', 'question' => 'string-255', 'answers' => 'string-65534'),
$changes['insert'],
array('id_question')
);
}
// Lastly, the count of messages needs to be no more than the lowest number of questions for any one language.
$count_questions = empty($qs_per_lang) ? 0 : min($qs_per_lang);
if (empty($count_questions) || $_POST['qa_verification_number'] > $count_questions)
$_POST['qa_verification_number'] = $count_questions;
call_integration_hook('integrate_save_spam_settings', array(&$save_vars));
// Now save.
saveDBSettings($save_vars);
$_SESSION['adm-save'] = true;
cache_put_data('verificationQuestions', null, 300);
redirectexit('action=admin;area=antispam');
}
$character_range = array_merge(range('A', 'H'), array('K', 'M', 'N', 'P', 'R'), range('T', 'Y'));
$_SESSION['visual_verification_code'] = '';
for ($i = 0; $i < 6; $i++)
$_SESSION['visual_verification_code'] .= $character_range[array_rand($character_range)];
// Some javascript for CAPTCHA.
$context['settings_post_javascript'] = '';
if ($context['use_graphic_library'])
$context['settings_post_javascript'] .= '
function refreshImages()
{
var imageType = document.getElementById(\'visual_verification_type\').value;
document.getElementById(\'verification_image\').src = \'' . $context['verification_image_href'] . ';type=\' + imageType;
}';
// Show the image itself, or text saying we can't.
if ($context['use_graphic_library'])
$config_vars['vv']['postinput'] = '
';
else
$config_vars['vv']['postinput'] = ' ' . $txt['setting_image_verification_nogd'] . '';
// Hack for PM spam settings.
list ($modSettings['max_pm_recipients'], $modSettings['pm_posts_verification'], $modSettings['pm_posts_per_hour']) = explode(',', $modSettings['pm_spam_settings']);
// Hack for guests requiring verification.
$modSettings['guests_require_captcha'] = !empty($modSettings['posts_require_captcha']);
$modSettings['posts_require_captcha'] = !isset($modSettings['posts_require_captcha']) || $modSettings['posts_require_captcha'] == -1 ? 0 : $modSettings['posts_require_captcha'];
// Some minor javascript for the guest post setting.
if ($modSettings['posts_require_captcha'])
$context['settings_post_javascript'] .= '
document.getElementById(\'guests_require_captcha\').disabled = true;';
// And everything else.
$context['post_url'] = $scripturl . '?action=admin;area=antispam;save';
$context['settings_title'] = $txt['antispam_Settings'];
$context['page_title'] = $txt['antispam_title'];
$context['sub_template'] = 'show_settings';
$context[$context['admin_menu_name']]['tab_data'] = array(
'title' => $txt['antispam_title'],
'description' => $txt['antispam_Settings_desc'],
);
prepareDBSettingContext($config_vars);
}
/**
* You'll never guess what this function does...
*
* @param bool $return_config Whether or not to return the config_vars array (used for admin search)
* @return void|array Returns nothing or returns the $config_vars array if $return_config is true
*/
function ModifySignatureSettings($return_config = false)
{
global $context, $txt, $modSettings, $sig_start, $smcFunc, $scripturl;
$config_vars = array(
// Are signatures even enabled?
array('check', 'signature_enable'),
'',
// Tweaking settings!
array('int', 'signature_max_length', 'subtext' => $txt['zero_for_no_limit']),
array('int', 'signature_max_lines', 'subtext' => $txt['zero_for_no_limit']),
array('int', 'signature_max_font_size', 'subtext' => $txt['zero_for_no_limit']),
array('check', 'signature_allow_smileys', 'onclick' => 'document.getElementById(\'signature_max_smileys\').disabled = !this.checked;'),
array('int', 'signature_max_smileys', 'subtext' => $txt['zero_for_no_limit']),
'',
// Image settings.
array('int', 'signature_max_images', 'subtext' => $txt['signature_max_images_note']),
array('int', 'signature_max_image_width', 'subtext' => $txt['zero_for_no_limit']),
array('int', 'signature_max_image_height', 'subtext' => $txt['zero_for_no_limit']),
'',
array('bbc', 'signature_bbc'),
);
call_integration_hook('integrate_signature_settings', array(&$config_vars));
if ($return_config)
return $config_vars;
// Setup the template.
$context['page_title'] = $txt['signature_settings'];
$context['sub_template'] = 'show_settings';
// Disable the max smileys option if we don't allow smileys at all!
$context['settings_post_javascript'] = 'document.getElementById(\'signature_max_smileys\').disabled = !document.getElementById(\'signature_allow_smileys\').checked;';
// Load all the signature settings.
list ($sig_limits, $sig_bbc) = explode(':', $modSettings['signature_settings']);
$sig_limits = explode(',', $sig_limits);
$disabledTags = !empty($sig_bbc) ? explode(',', $sig_bbc) : array();
// Applying to ALL signatures?!!
if (isset($_GET['apply']))
{
// Security!
checkSession('get');
$sig_start = time();
// This is horrid - but I suppose some people will want the option to do it.
$_GET['step'] = isset($_GET['step']) ? (int) $_GET['step'] : 0;
$done = false;
$request = $smcFunc['db_query']('', '
SELECT MAX(id_member)
FROM {db_prefix}members',
array(
)
);
list ($context['max_member']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
while (!$done)
{
$changes = array();
$request = $smcFunc['db_query']('', '
SELECT id_member, signature
FROM {db_prefix}members
WHERE id_member BETWEEN {int:step} AND {int:step} + 49
AND id_group != {int:admin_group}
AND FIND_IN_SET({int:admin_group}, additional_groups) = 0',
array(
'admin_group' => 1,
'step' => $_GET['step'],
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// Apply all the rules we can realistically do.
$sig = strtr($row['signature'], array(' ' => "\n"));
// Max characters...
if (!empty($sig_limits[1]))
$sig = $smcFunc['substr']($sig, 0, $sig_limits[1]);
// Max lines...
if (!empty($sig_limits[2]))
{
$count = 0;
for ($i = 0; $i < strlen($sig); $i++)
{
if ($sig[$i] == "\n")
{
$count++;
if ($count >= $sig_limits[2])
$sig = substr($sig, 0, $i) . strtr(substr($sig, $i), array("\n" => ' '));
}
}
}
if (!empty($sig_limits[7]) && preg_match_all('~\[size=([\d\.]+)?(px|pt|em|x-large|larger)~i', $sig, $matches) !== false && isset($matches[2]))
{
foreach ($matches[1] as $ind => $size)
{
$limit_broke = 0;
// Attempt to allow all sizes of abuse, so to speak.
if ($matches[2][$ind] == 'px' && $size > $sig_limits[7])
$limit_broke = $sig_limits[7] . 'px';
elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75))
$limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt';
elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16))
$limit_broke = ((float) $sig_limits[7] / 16) . 'em';
elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18)
$limit_broke = 'large';
if ($limit_broke)
$sig = str_replace($matches[0][$ind], '[size=' . $sig_limits[7] . 'px', $sig);
}
}
// Stupid images - this is stupidly, stupidly challenging.
if ((!empty($sig_limits[3]) || !empty($sig_limits[5]) || !empty($sig_limits[6])))
{
$replaces = array();
$img_count = 0;
// Get all BBC tags...
preg_match_all('~\[img(\s+width=([\d]+))?(\s+height=([\d]+))?(\s+width=([\d]+))?\s*\](?: )*([^<">]+?)(?: )*\[/img\]~i', $sig, $matches);
// ... and all HTML ones.
preg_match_all('~<img\s+src=(?:")?((?:http://|ftp://|https://|ftps://).+?)(?:")?(?:\s+alt=(?:")?(.*?)(?:")?)?(?:\s?/)?>~i', $sig, $matches2, PREG_PATTERN_ORDER);
// And stick the HTML in the BBC.
if (!empty($matches2))
{
foreach ($matches2[0] as $ind => $dummy)
{
$matches[0][] = $matches2[0][$ind];
$matches[1][] = '';
$matches[2][] = '';
$matches[3][] = '';
$matches[4][] = '';
$matches[5][] = '';
$matches[6][] = '';
$matches[7][] = $matches2[1][$ind];
}
}
// Try to find all the images!
if (!empty($matches))
{
$image_count_holder = array();
foreach ($matches[0] as $key => $image)
{
$width = -1;
$height = -1;
$img_count++;
// Too many images?
if (!empty($sig_limits[3]) && $img_count > $sig_limits[3])
{
// If we've already had this before we only want to remove the excess.
if (isset($image_count_holder[$image]))
{
$img_offset = -1;
$rep_img_count = 0;
while ($img_offset !== false)
{
$img_offset = strpos($sig, $image, $img_offset + 1);
$rep_img_count++;
if ($rep_img_count > $image_count_holder[$image])
{
// Only replace the excess.
$sig = substr($sig, 0, $img_offset) . str_replace($image, '', substr($sig, $img_offset));
// Stop looping.
$img_offset = false;
}
}
}
else
$replaces[$image] = '';
continue;
}
// Does it have predefined restraints? Width first.
if ($matches[6][$key])
$matches[2][$key] = $matches[6][$key];
if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5])
{
$width = $sig_limits[5];
$matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]);
}
elseif ($matches[2][$key])
$width = $matches[2][$key];
// ... and height.
if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6])
{
$height = $sig_limits[6];
if ($width != -1)
$width = $width * ($height / $matches[4][$key]);
}
elseif ($matches[4][$key])
$height = $matches[4][$key];
// If the dimensions are still not fixed - we need to check the actual image.
if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6]))
{
$sizes = url_image_size($matches[7][$key]);
if (is_array($sizes))
{
// Too wide?
if ($sizes[0] > $sig_limits[5] && $sig_limits[5])
{
$width = $sig_limits[5];
$sizes[1] = $sizes[1] * ($width / $sizes[0]);
}
// Too high?
if ($sizes[1] > $sig_limits[6] && $sig_limits[6])
{
$height = $sig_limits[6];
if ($width == -1)
$width = $sizes[0];
$width = $width * ($height / $sizes[1]);
}
elseif ($width != -1)
$height = $sizes[1];
}
}
// Did we come up with some changes? If so remake the string.
if ($width != -1 || $height != -1)
{
$replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]';
}
// Record that we got one.
$image_count_holder[$image] = isset($image_count_holder[$image]) ? $image_count_holder[$image] + 1 : 1;
}
if (!empty($replaces))
$sig = str_replace(array_keys($replaces), array_values($replaces), $sig);
}
}
// Try to fix disabled tags.
if (!empty($disabledTags))
{
$sig = preg_replace('~\[(?:' . implode('|', $disabledTags) . ').+?\]~i', '', $sig);
$sig = preg_replace('~\[/(?:' . implode('|', $disabledTags) . ')\]~i', '', $sig);
}
$sig = strtr($sig, array("\n" => ' '));
call_integration_hook('integrate_apply_signature_settings', array(&$sig, $sig_limits, $disabledTags));
if ($sig != $row['signature'])
$changes[$row['id_member']] = $sig;
}
if ($smcFunc['db_num_rows']($request) == 0)
$done = true;
$smcFunc['db_free_result']($request);
// Do we need to delete what we have?
if (!empty($changes))
{
foreach ($changes as $id => $sig)
$smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET signature = {string:signature}
WHERE id_member = {int:id_member}',
array(
'id_member' => $id,
'signature' => $sig,
)
);
}
$_GET['step'] += 50;
if (!$done)
pauseSignatureApplySettings();
}
$settings_applied = true;
}
$context['signature_settings'] = array(
'enable' => isset($sig_limits[0]) ? $sig_limits[0] : 0,
'max_length' => isset($sig_limits[1]) ? $sig_limits[1] : 0,
'max_lines' => isset($sig_limits[2]) ? $sig_limits[2] : 0,
'max_images' => isset($sig_limits[3]) ? $sig_limits[3] : 0,
'allow_smileys' => isset($sig_limits[4]) && $sig_limits[4] == -1 ? 0 : 1,
'max_smileys' => isset($sig_limits[4]) && $sig_limits[4] != -1 ? $sig_limits[4] : 0,
'max_image_width' => isset($sig_limits[5]) ? $sig_limits[5] : 0,
'max_image_height' => isset($sig_limits[6]) ? $sig_limits[6] : 0,
'max_font_size' => isset($sig_limits[7]) ? $sig_limits[7] : 0,
);
// Temporarily make each setting a modSetting!
foreach ($context['signature_settings'] as $key => $value)
$modSettings['signature_' . $key] = $value;
// Make sure we check the right tags!
$modSettings['bbc_disabled_signature_bbc'] = $disabledTags;
// Saving?
if (isset($_GET['save']))
{
checkSession();
// Clean up the tag stuff!
$bbcTags = array();
foreach (parse_bbc(false) as $tag)
$bbcTags[] = $tag['tag'];
if (!isset($_POST['signature_bbc_enabledTags']))
$_POST['signature_bbc_enabledTags'] = array();
elseif (!is_array($_POST['signature_bbc_enabledTags']))
$_POST['signature_bbc_enabledTags'] = array($_POST['signature_bbc_enabledTags']);
$sig_limits = array();
foreach ($context['signature_settings'] as $key => $value)
{
if ($key == 'allow_smileys')
continue;
elseif ($key == 'max_smileys' && empty($_POST['signature_allow_smileys']))
$sig_limits[] = -1;
else
$sig_limits[] = !empty($_POST['signature_' . $key]) ? max(1, (int) $_POST['signature_' . $key]) : 0;
}
call_integration_hook('integrate_save_signature_settings', array(&$sig_limits, &$bbcTags));
$_POST['signature_settings'] = implode(',', $sig_limits) . ':' . implode(',', array_diff($bbcTags, $_POST['signature_bbc_enabledTags']));
// Even though we have practically no settings let's keep the convention going!
$save_vars = array();
$save_vars[] = array('text', 'signature_settings');
saveDBSettings($save_vars);
$_SESSION['adm-save'] = true;
redirectexit('action=admin;area=featuresettings;sa=sig');
}
$context['post_url'] = $scripturl . '?action=admin;area=featuresettings;save;sa=sig';
$context['settings_title'] = $txt['signature_settings'];
if (!empty($settings_applied))
$context['settings_message'] = array(
'label' => $txt['signature_settings_applied'],
'tag' => 'div',
'class' => 'infobox'
);
else
$context['settings_message'] = array(
'label' => sprintf($txt['signature_settings_warning'], $context['session_id'], $context['session_var'], $scripturl),
'tag' => 'div',
'class' => 'centertext'
);
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;
global $sourcedir;
$context['page_title'] = $txt['custom_profile_title'];
$context['sub_template'] = 'show_custom_profile';
// What about standard fields they can tweak?
$standard_fields = array('website', 'personal_text', 'timezone', '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);
$_SESSION['adm-save'] = true;
if (!empty($changes))
updateSettings($changes);
}
createToken('admin-scp');
// Need to know the max order for custom fields
$context['custFieldsMaxOrder'] = custFieldsMaxOrder();
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'],
),
'data' => array(
'db' => 'label',
'style' => 'width: 60%;',
),
),
'active' => array(
'header' => array(
'value' => $txt['custom_edit_active'],
'class' => 'centercol',
),
'data' => array(
'function' => function($rowData)
{
$isChecked = $rowData['disabled'] ? '' : ' 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%;',
'class' => 'centercol',
),
),
'show_on_registration' => array(
'header' => array(
'value' => $txt['custom_edit_registration'],
'class' => 'centercol',
),
'data' => array(
'function' => function($rowData)
{
$isChecked = $rowData['on_register'] && !$rowData['disabled'] ? ' checked' : '';
$isDisabled = $rowData['can_show_register'] ? '' : ' disabled';
return sprintf('', $rowData['id'], $isChecked, $isDisabled);
},
'style' => 'width: 20%;',
'class' => 'centercol',
),
),
),
'form' => array(
'href' => $scripturl . '?action=admin;area=featuresettings;sa=profile',
'name' => 'standardProfileFields',
'token' => 'admin-scp',
),
'additional_rows' => array(
array(
'position' => 'below_table_data',
'value' => '',
),
),
);
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_order',
'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_order' => array(
'header' => array(
'value' => $txt['custom_profile_fieldorder'],
),
'data' => array(
'function' => function($rowData) use ($context, $txt, $scripturl)
{
$return = '
';
if ($rowData['field_order'] > 1)
$return .= '';
if ($rowData['field_order'] < $context['custFieldsMaxOrder'])
$return .= '';
$return .= '