1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-02 04:24:56 +02:00

Very rough code in places ... particularly sig parsing ... mainly as a "does it work?" test ... the answer seems to be "yes, it does" ... I don't recall the met office saying "Hell has frozen over", strange ...

git-svn-id: file:///svn/phpbb/trunk@3999 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-05-10 01:00:29 +00:00
parent cb6cd93dae
commit 6d119a0e45
2 changed files with 158 additions and 16 deletions

View File

@ -34,12 +34,6 @@ class ucp_prefs extends ucp
$submodules['VIEW'] = "module_id=$module_id&mode=view";
$submodules['POST'] = "module_id=$module_id&mode=post";
$user->lang = array_merge($user->lang, array(
'UCP_PERSONAL' => 'Personal Settings',
'UCP_VIEW' => 'Viewing Posts',
'UCP_POST' => 'Posting Messages')
);
ucp::subsection($submodules, $submode);
unset($submodules);

View File

@ -35,13 +35,6 @@ class ucp_profile extends ucp
$submodules['SIGNATURE'] = "module_id=$module_id&mode=signature";
$submodules['AVATAR'] = "module_id=$module_id&mode=avatar";
$user->lang = array_merge($user->lang, array(
'UCP_REG_DETAILS' => 'Registration details',
'UCP_PROFILE' => 'Your Profile',
'UCP_SIGNATURE' => 'Your signature',
'UCP_AVATAR' => 'Your avatar')
);
ucp::subsection($submodules, $submode);
unset($submodules);
@ -49,22 +42,177 @@ class ucp_profile extends ucp
{
case 'reg_details':
$template->assign_vars(array(
'USERNAME' => $user->data['username'],
'USERNAME' => $user->data['username'],
'EMAIL' => $user->data['user_email'],
'S_CHANGE_USERNAME' => $auth->acl_get('u_chgname'), )
'S_CHANGE_USERNAME' => $config['allow_namechange'] & $auth->acl_get('u_chgname'),
'S_CHANGE_EMAIL' => $auth->acl_get('u_chgemail'),
'S_CHANGE_PASSWORD' => $auth->acl_get('u_chgpass'), )
);
break;
case 'profile':
$s_birthday_day_options = '';
for ($i = 1; $i < 32; $i++)
{
$selected = '';
$s_birthday_day_options .= "<option value=\"$i\">$i</option>";
}
$s_birthday_month_options = '';
for ($i = 1; $i < 13; $i++)
{
$selected = '';
$s_birthday_month_options .= "<option value=\"$i\">$i</option>";
}
$s_birthday_year_options = '';
for ($i = 1900; $i < 2004; $i++)
{
$selected = '';
$s_birthday_year_options .= "<option value=\"$i\">$i</option>";
}
$template->assign_vars(array(
'ICQ' => $user->data['user_icq'],
'YIM' => $user->data['user_yim'],
'AIM' => $user->data['user_aim'],
'MSNM' => $user->data['user_msnm'],
'JABBER' => $user->data['user_jabber'],
'WEBSITE' => $user->data['user_website'],
'LOCATION' => $user->data['user_from'],
'OCCUPATION'=> $user->data['user_occ'],
'INTERESTS' => $user->data['user_interests'],
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,)
);
break;
case 'signature':
ucp::load('includes/functions_posting');
$html_status = ($config['allow_html']) ? true : false;
$bbcode_status = ($config['allow_bbcode']) ? true : false;
$smilies_status = ($config['allow_smilies']) ? true : false;
$img_status = ($config['allow_img']) ? true : false;
$flash_status = ($config['allow_flash']) ? true : false;
$enable_html = (isset($_POST['disable_html'])) ? !$_POST['disable_html'] : $config['allow_html'];
$enable_bbcode = (isset($_POST['disable_bbcode'])) ? !$_POST['disable_bbcode'] : $config['allow_bbcode'];
$enable_smilies = (isset($_POST['disable_smilies'])) ? !$_POST['disable_smilies'] : $config['allow_smilies'];
$enable_urls = (isset($_POST['disable_magic_url'])) ? !$_POST['disable_magic_url'] : 1;
decode_text($user->data['user_sig'], $user->data['user_sig_bbcode_uid']);
$signature = (!empty($_POST['signature'])) ? htmlspecialchars($_POST['signature']) : $user->data['user_sig'];
$error = array();
if ($_POST['submit'])
{
if (strlen($signature) > $config['max_sig_chars'])
{
$error[] = $user->lang['SIGNATURE_TOO_LONG'];
}
if (!sizeof($error))
{
ucp::load('includes/message_parser');
$message_parser = new parse_message();
$message_parser->message = trim(stripslashes($signature));
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
$signature = $message_parser->message;
$sql_ary = array(
'user_sig' => $signature,
'user_sig_bbcode_uid' => $message_parser->bbcode_uid,
'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield
);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
meta_refresh(3, "ucp.$phpEx$SID&amp;module_id=$module_id&amp;mode=$submode");
trigger_error('');
}
}
$signature_preview = '';
if ($_POST['preview'])
{
// Fudge-o-rama ...
global $phpbb_root_path;
ucp::load('includes/message_parser');
$signature_preview = $signature;
$message_parser = new parse_message();
$message_parser->message = trim(stripslashes($signature_preview));
$message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
$signature_preview = $message_parser->message;
if ($enable_bbcode)
{
ucp::load('includes/bbcode');
$bbcode = new bbcode($message_parser->bbcode_bitfield);
// Second parse bbcode here
$signature_preview = $bbcode->bbcode_second_pass($signature_preview, $message_parser->bbcode_uid);
}
// If we allow users to disable display of emoticons
// we'll need an appropriate check and preg_replace here
$signature_preview = (empty($enable_smilies) || empty($config['allow_smilies'])) ? preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILE_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '\1', $signature_preview) : str_replace('<img src="{SMILE_PATH}', '<img src="' . $phpbb_root_path . $config['smilies_path'], $signature_preview);
// Replace naughty words such as farty pants
if (sizeof($censors))
{
$signature_preview = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$censors['match'], \$censors['replace'], '\\0')", '>' . $signature_preview . '<'), 1, -1));
}
$signature_preview = str_replace("\n", '<br />', $signature_preview);
}
$template->assign_vars(array(
'SIGNATURE' => $user->data['signature'])
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'SIGNATURE' => $signature,
'SIGNATURE_PREVIEW' => $signature_preview,
'S_SIGNATURE_PREVIEW' => ($signature_preview) ? true : false,
'S_HTML_CHECKED' => (!$enable_html) ? 'checked="checked"' : '',
'S_BBCODE_CHECKED' => (!$enable_bbcode) ? 'checked="checked"' : '',
'S_SMILIES_CHECKED' => (!$enable_smilies) ? 'checked="checked"' : '',
'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? 'checked="checked"' : '',
'HTML_STATUS' => ($html_status) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF'],
'BBCODE_STATUS' => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . "faq.$phpEx$SID&amp;mode=bbcode" . '" target="_phpbbcode">', '</a>'),
'SMILIES_STATUS'=> ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),
'S_HTML_ALLOWED' => $config['allow_html'],
'S_BBCODE_ALLOWED' => $config['allow_bbcode'],
'S_SMILIES_ALLOWED' => $config['allow_smilies'],)
);
break;
case 'avatar':
$template->assign_vars(array(
'AVATAR' => '<img src="images/avatars/upload/' . $user->data['user_avatar'] . '" />',
'S_UPLOAD_AVATAR_FILE' => true,
'S_UPLOAD_AVATAR_URL' => true,
'S_LINK_AVATAR' => true,
'S_GALLERY_AVATAR' => true,)
);
break;
default: