Further updates

git-svn-id: file:///svn/phpbb/trunk@4024 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-05-19 21:41:55 +00:00
parent 5a92a8c323
commit d43770db28
4 changed files with 90 additions and 12 deletions

View file

@ -133,7 +133,7 @@ class ucp extends user
break; break;
case 'bool': case 'bool':
$valid_data[$var_name] = ($data[$var_name] < 0) ? 0 : 1; $valid_data[$var_name] = ($data[$var_name] <= 0) ? 0 : 1;
break; break;
case 'string': case 'string':

View file

@ -47,8 +47,9 @@ class ucp_prefs extends ucp
'dateformat'=> '3,15', 'dateformat'=> '3,15',
'lang' => '2,5', 'lang' => '2,5',
), ),
'int' => array('viewemail', 'hideonline', 'notifypm', 'popuppm', 'dst', 'style'), 'int' => array('dst', 'style'),
'float' => array('tz') 'float' => array('tz'),
'bool' => array('viewemail', 'hideonline', 'notifypm', 'popuppm')
); );
$data = $this->normalise_data($_POST, $normalise); $data = $this->normalise_data($_POST, $normalise);
@ -80,7 +81,8 @@ class ucp_prefs extends ucp
$db->sql_query($sql); $db->sql_query($sql);
meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode"); meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode");
trigger_error(''); $message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode\">", '</a>');
trigger_error($message);
} }
// //
@ -135,6 +137,70 @@ class ucp_prefs extends ucp
break; break;
case 'post': case 'post':
if (isset($_POST['submit']))
{
$data = array();
$normalise = array(
'bool' => array('bbcode', 'html', 'smilies', 'sig', 'notify'),
);
$data = $this->normalise_data($_POST, $normalise);
if (!sizeof($this->error))
{
$sql_ary = array(
'user_allowbbcode' => $data['bbcode'],
'user_allowhtml' => $data['html'],
'user_allowsmile' => $data['smilies'],
'user_attachsig' => $data['sig'],
'user_notify' => $data['notify'],
);
$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;i=$id&amp;mode=$submode");
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode\">", '</a>');
trigger_error($message);
}
//
extract($data);
unset($data);
}
$bbcode = (isset($bbcode)) ? $bbcode : $user->data['user_allowbbcode'];
$bbcode_yes = ($bbcode) ? ' checked="checked"' : '';
$bbcode_no = (!$bbcode) ? ' checked="checked"' : '';
$html = (isset($html)) ? $html : $user->data['user_allowhtml'];
$html_yes = ($html) ? ' checked="checked"' : '';
$html_no = (!$html) ? ' checked="checked"' : '';
$smilies = (isset($smilies)) ? $smilies : $user->data['user_allowsmile'];
$smilies_yes = ($smilies) ? ' checked="checked"' : '';
$smilies_no = (!$smilies) ? ' checked="checked"' : '';
$sig = (isset($sig)) ? $sig : $user->data['user_attachsig'];
$sig_yes = ($sig) ? ' checked="checked"' : '';
$sig_no = (!$sig) ? ' checked="checked"' : '';
$notify = (isset($notify)) ? $notify : $user->data['user_notify'];
$notify_yes = ($notify) ? ' checked="checked"' : '';
$notify_no = (!$notify) ? ' checked="checked"' : '';
$template->assign_vars(array(
'ERROR' => (sizeof($this->error)) ? implode('<br />', $this->error) : '',
'DEFAULT_BBCODE_YES' => $bbcode_yes,
'DEFAULT_BBCODE_NO' => $bbcode_no,
'DEFAULT_HTML_YES' => $html_yes,
'DEFAULT_HTML_NO' => $html_no,
'DEFAULT_SMILIES_YES' => $smilies_yes,
'DEFAULT_SMILIES_NO' => $smilies_no,
'DEFAULT_SIG_YES' => $sig_yes,
'DEFAULT_SIG_NO' => $sig_no,
'DEFAULT_NOTIFY_YES' => $notify_yes,
'DEFAULT_NOTIFY_NO' => $notify_no,)
);
break; break;
} }

View file

@ -81,7 +81,8 @@ class ucp_profile extends ucp
$db->sql_query($sql); $db->sql_query($sql);
meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode"); meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode");
trigger_error(''); $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode\">", '</a>');
trigger_error($message);
} }
// //
@ -129,7 +130,7 @@ class ucp_profile extends ucp
$validate = array( $validate = array(
'match' => array( 'match' => array(
'icq' => ($data['icq']) ? '#^[0-9]+$#i' : '', 'icq' => ($data['icq']) ? '#^[0-9]+$#i' : '',
'website' => ($data['website']) ? '#^http[s]?://(.*?\.)*?([a-z0-9\-]+\.)?[a-z]+#i' : '', 'website' => ($data['website']) ? '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]+#i' : '',
), ),
); );
$this->validate_data($data, $validate); $this->validate_data($data, $validate);
@ -155,7 +156,8 @@ class ucp_profile extends ucp
$db->sql_query($sql); $db->sql_query($sql);
meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode"); meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode");
trigger_error(''); $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode\">", '</a>');
trigger_error($message);
} }
// //
@ -256,8 +258,8 @@ class ucp_profile extends ucp
WHERE user_id = ' . $user->data['user_id']; WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql); $db->sql_query($sql);
meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode"); $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id&amp;mode=$submode\">", '</a>');
trigger_error(''); trigger_error($message);
} }
} }

View file

@ -697,6 +697,8 @@ $lang = array(
'AVATAR_GALLERY' => 'Select from gallery', 'AVATAR_GALLERY' => 'Select from gallery',
'SHOW_GALLERY' => 'Show gallery', 'SHOW_GALLERY' => 'Show gallery',
'PROFILE_UPDATED' => 'Your profile has been updated.',
'UCP_PREFERENCES' => 'Preferences', 'UCP_PREFERENCES' => 'Preferences',
@ -713,15 +715,23 @@ $lang = array(
'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP <a href=\"http://www.php.net/date\" target=\"_other\">date()</a> function', 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP <a href=\"http://www.php.net/date\" target=\"_other\">date()</a> function',
'UCP_VIEW' => 'Viewing Posts', 'UCP_VIEW' => 'Viewing Posts',
'VIEW_IMAGES' => 'Display Images within posts',
'VIEW_FLASH' => 'Display Flash animations',
'VIEW_SMILIES' => 'Display Smileys as images',
'VIEW_SIGS' => 'Display Signatures',
'VIEW_AVATARS' => 'Display Avatars',
'DISABLE_CENSORS' => 'Disable Word censoring',
'UCP_POST' => 'Posting Messages', 'UCP_POST' => 'Posting Messages',
'DEFAULT_SMILE' => 'Enable smilies by default', 'DEFAULT_SMILE' => 'Enable smilies by default',
'DEFAULT_HTML' => 'Enable HTML by default', 'DEFAULT_HTML' => 'Enable HTML by default',
'DEFAULT_BBCODE' => 'Enable BBCode by default', 'DEFAULT_BBCODE' => 'Enable BBCode by default',
'DEFAULT_ADD_SIG' => 'Attach my signature by default', 'DEFAULT_ADD_SIG' => 'Attach my signature by default',
'DEFAULT_NOTIFY' => 'Notify me upon replies by default', 'DEFAULT_NOTIFY' => 'Notify me upon replies by default',
'PREFERENCES_UPDATED' => 'Your preferences have been updated.',
'UCP_MESSAGING' => 'Private Messaging', 'UCP_MESSAGING' => 'Private Messaging',