|
@@ -796,7 +796,7 @@ function saveProfileFields()
|
|
|
// Cycle through the profile fields working out what to do!
|
|
|
foreach ($profile_fields as $key => $field)
|
|
|
{
|
|
|
- if (!isset($_POST[$key]) || !empty($field['is_dummy']))
|
|
|
+ if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview']) && $key == 'signature'))
|
|
|
continue;
|
|
|
|
|
|
// What gets updated?
|
|
@@ -1581,6 +1581,7 @@ function forumProfile($memID)
|
|
|
|
|
|
$context['sub_template'] = 'edit_options';
|
|
|
$context['page_desc'] = $txt['forumProfile_info'];
|
|
|
+ $context['show_preview_button'] = true;
|
|
|
|
|
|
setupProfileContext(
|
|
|
array(
|
|
@@ -2381,7 +2382,7 @@ function profileLoadGroups()
|
|
|
*/
|
|
|
function profileLoadSignatureData()
|
|
|
{
|
|
|
- global $modSettings, $context, $txt, $cur_profile, $smcFunc;
|
|
|
+ global $modSettings, $context, $txt, $cur_profile, $smcFunc, $memberContext;
|
|
|
|
|
|
// Signature limits.
|
|
|
list ($sig_limits, $sig_bbc) = explode(':', $modSettings['signature_settings']);
|
|
@@ -2409,7 +2410,28 @@ function profileLoadSignatureData()
|
|
|
|
|
|
$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
|
|
|
|
|
|
- $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br />', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']);
|
|
|
+ if (empty($context['do_preview']))
|
|
|
+ $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br />', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $signature = !empty($_POST['signature']) ? $_POST['signature'] : '';
|
|
|
+ $validation = profileValidateSignature($signature);
|
|
|
+ if (empty($context['post_errors']))
|
|
|
+ {
|
|
|
+ loadLanguage('Errors');
|
|
|
+ $context['post_errors'] = array();
|
|
|
+ }
|
|
|
+ $context['post_errors'][] = 'signature_not_yet_saved';
|
|
|
+ if ($validation !== true && $validation !== false)
|
|
|
+ $context['post_errors'][] = $validation;
|
|
|
+
|
|
|
+ censorText($context['member']['signature']);
|
|
|
+ $context['member']['current_signature'] = $context['member']['signature'];
|
|
|
+ censorText($signature);
|
|
|
+ $context['member']['signature_preview'] = parse_bbc($signature, true, 'sig' . $memberContext[$context['id_member']]);
|
|
|
+ $context['member']['signature'] = $_POST['signature'];
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return true;
|
|
|
}
|