|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @package ucp
|
|
|
4c79b5 |
* @version $Id: ucp_prefs.php 8990 2008-10-09 15:41:19Z acydburn $
|
|
|
4c79b5 |
* @copyright (c) 2005 phpBB Group
|
|
|
4c79b5 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @ignore
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
if (!defined('IN_PHPBB'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* ucp_prefs
|
|
|
4c79b5 |
* Changing user preferences
|
|
|
4c79b5 |
* @package ucp
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
class ucp_prefs
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
var $u_action;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function main($id, $mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
|
4c79b5 |
$error = $data = array();
|
|
|
4c79b5 |
$s_hidden_fields = '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ($mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'personal':
|
|
|
4c79b5 |
add_form_key('ucp_prefs_personal');
|
|
|
4c79b5 |
$data = array(
|
|
|
4c79b5 |
'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']),
|
|
|
4c79b5 |
'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true),
|
|
|
4c79b5 |
'lang' => basename(request_var('lang', $user->data['user_lang'])),
|
|
|
4c79b5 |
'style' => request_var('style', (int) $user->data['user_style']),
|
|
|
4c79b5 |
'tz' => request_var('tz', (float) $user->data['user_timezone']),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'dst' => request_var('dst', (bool) $user->data['user_dst']),
|
|
|
4c79b5 |
'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
|
|
|
4c79b5 |
'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']),
|
|
|
4c79b5 |
'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
|
|
|
4c79b5 |
'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']),
|
|
|
4c79b5 |
'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')),
|
|
|
4c79b5 |
'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml')))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct.
|
|
|
4c79b5 |
$data['notifymethod'] = NOTIFY_BOTH;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($submit)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$error = validate_data($data, array(
|
|
|
4c79b5 |
'dateformat' => array('string', false, 1, 30),
|
|
|
4c79b5 |
'lang' => array('match', false, '#^[a-z0-9_\-]{2,}$#i'),
|
|
|
4c79b5 |
'tz' => array('num', false, -14, 14),
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!check_form_key('ucp_prefs_personal'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = 'FORM_INVALID';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!sizeof($error))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$user->optionset('popuppm', $data['popuppm']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_ary = array(
|
|
|
4c79b5 |
'user_allow_pm' => $data['allowpm'],
|
|
|
4c79b5 |
'user_allow_viewemail' => $data['viewemail'],
|
|
|
4c79b5 |
'user_allow_massemail' => $data['massemail'],
|
|
|
4c79b5 |
'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'],
|
|
|
4c79b5 |
'user_notify_type' => $data['notifymethod'],
|
|
|
4c79b5 |
'user_notify_pm' => $data['notifypm'],
|
|
|
4c79b5 |
'user_options' => $user->data['user_options'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'user_dst' => $data['dst'],
|
|
|
4c79b5 |
'user_dateformat' => $data['dateformat'],
|
|
|
4c79b5 |
'user_lang' => $data['lang'],
|
|
|
4c79b5 |
'user_timezone' => $data['tz'],
|
|
|
4c79b5 |
'user_style' => $data['style'],
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
4c79b5 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
4c79b5 |
WHERE user_id = ' . $user->data['user_id'];
|
|
|
4c79b5 |
$db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
meta_refresh(3, $this->u_action);
|
|
|
4c79b5 |
$message = $user->lang['PREFERENCES_UPDATED'] . '
' . sprintf($user->lang['RETURN_UCP'], '', '');
|
|
|
4c79b5 |
trigger_error($message);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Replace "error" strings with their real, localised form
|
|
|
4c79b5 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$dateformat_options = '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($user->lang['dateformats'] as $format => $null)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$dateformat_options .= '<option value="' . $format . '"' . (($format == $data['dateformat']) ? ' selected="selected"' : '') . '>';
|
|
|
4c79b5 |
$dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
|
|
|
4c79b5 |
$dateformat_options .= '</option>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$s_custom = false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$dateformat_options .= '
|
|
|
4c79b5 |
if (!isset($user->lang['dateformats'][$data['dateformat']]))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$dateformat_options .= ' selected="selected"';
|
|
|
4c79b5 |
$s_custom = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'ERROR' => (sizeof($error)) ? implode(' ', $error) : '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false,
|
|
|
4c79b5 |
'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false,
|
|
|
4c79b5 |
'S_NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false,
|
|
|
4c79b5 |
'S_VIEW_EMAIL' => $data['viewemail'],
|
|
|
4c79b5 |
'S_MASS_EMAIL' => $data['massemail'],
|
|
|
4c79b5 |
'S_ALLOW_PM' => $data['allowpm'],
|
|
|
4c79b5 |
'S_HIDE_ONLINE' => $data['hideonline'],
|
|
|
4c79b5 |
'S_NOTIFY_PM' => $data['notifypm'],
|
|
|
4c79b5 |
'S_POPUP_PM' => $data['popuppm'],
|
|
|
4c79b5 |
'S_DST' => $data['dst'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'DATE_FORMAT' => $data['dateformat'],
|
|
|
4c79b5 |
'A_DATE_FORMAT' => addslashes($data['dateformat']),
|
|
|
4c79b5 |
'S_DATEFORMAT_OPTIONS' => $dateformat_options,
|
|
|
4c79b5 |
'S_CUSTOM_DATEFORMAT' => $s_custom,
|
|
|
4c79b5 |
'DEFAULT_DATEFORMAT' => $config['default_dateformat'],
|
|
|
4c79b5 |
'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_LANG_OPTIONS' => language_select($data['lang']),
|
|
|
4c79b5 |
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
|
|
|
4c79b5 |
'S_TZ_OPTIONS' => tz_select($data['tz'], true),
|
|
|
4c79b5 |
'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false,
|
|
|
4c79b5 |
'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'view':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_form_key('ucp_prefs_view');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$data = array(
|
|
|
4c79b5 |
'topic_sk' => request_var('topic_sk', (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'),
|
|
|
4c79b5 |
'topic_sd' => request_var('topic_sd', (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'),
|
|
|
4c79b5 |
'topic_st' => request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'post_sk' => request_var('post_sk', (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'),
|
|
|
4c79b5 |
'post_sd' => request_var('post_sd', (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'),
|
|
|
4c79b5 |
'post_st' => request_var('post_st', (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'images' => request_var('images', (bool) $user->optionget('viewimg')),
|
|
|
4c79b5 |
'flash' => request_var('flash', (bool) $user->optionget('viewflash')),
|
|
|
4c79b5 |
'smilies' => request_var('smilies', (bool) $user->optionget('viewsmilies')),
|
|
|
4c79b5 |
'sigs' => request_var('sigs', (bool) $user->optionget('viewsigs')),
|
|
|
4c79b5 |
'avatars' => request_var('avatars', (bool) $user->optionget('viewavatars')),
|
|
|
4c79b5 |
'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($submit)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error = validate_data($data, array(
|
|
|
4c79b5 |
'topic_sk' => array('string', false, 1, 1),
|
|
|
4c79b5 |
'topic_sd' => array('string', false, 1, 1),
|
|
|
4c79b5 |
'post_sk' => array('string', false, 1, 1),
|
|
|
4c79b5 |
'post_sd' => array('string', false, 1, 1),
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!check_form_key('ucp_prefs_view'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = 'FORM_INVALID';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!sizeof($error))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$user->optionset('viewimg', $data['images']);
|
|
|
4c79b5 |
$user->optionset('viewflash', $data['flash']);
|
|
|
4c79b5 |
$user->optionset('viewsmilies', $data['smilies']);
|
|
|
4c79b5 |
$user->optionset('viewsigs', $data['sigs']);
|
|
|
4c79b5 |
$user->optionset('viewavatars', $data['avatars']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($auth->acl_get('u_chgcensors'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$user->optionset('viewcensors', $data['wordcensor']);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_ary = array(
|
|
|
4c79b5 |
'user_options' => $user->data['user_options'],
|
|
|
4c79b5 |
'user_topic_sortby_type' => $data['topic_sk'],
|
|
|
4c79b5 |
'user_post_sortby_type' => $data['post_sk'],
|
|
|
4c79b5 |
'user_topic_sortby_dir' => $data['topic_sd'],
|
|
|
4c79b5 |
'user_post_sortby_dir' => $data['post_sd'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'user_topic_show_days' => $data['topic_st'],
|
|
|
4c79b5 |
'user_post_show_days' => $data['post_st'],
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
4c79b5 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
4c79b5 |
WHERE user_id = ' . $user->data['user_id'];
|
|
|
4c79b5 |
$db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
meta_refresh(3, $this->u_action);
|
|
|
4c79b5 |
$message = $user->lang['PREFERENCES_UPDATED'] . '
' . sprintf($user->lang['RETURN_UCP'], '', '');
|
|
|
4c79b5 |
trigger_error($message);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Replace "error" strings with their real, localised form
|
|
|
4c79b5 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Topic ordering options
|
|
|
4c79b5 |
$limit_topic_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sort_by_topic_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']);
|
|
|
4c79b5 |
$sort_by_topic_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Post ordering options
|
|
|
4c79b5 |
$limit_post_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
|
|
4c79b5 |
$sort_by_post_sql = array('a' => 'u.username_clean', 't' => 'p.post_id', 's' => 'p.post_subject');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$_options = array('topic', 'post');
|
|
|
4c79b5 |
foreach ($_options as $sort_option)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
|
|
|
4c79b5 |
foreach (${'limit_' . $sort_option . '_days'} as $day => $text)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$selected = ($data[$sort_option . '_st'] == $day) ? ' selected="selected"' : '';
|
|
|
4c79b5 |
${'s_limit_' . $sort_option . '_days'} .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
${'s_limit_' . $sort_option . '_days'} .= '</select>';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
|
|
|
4c79b5 |
foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$selected = ($data[$sort_option . '_sk'] == $key) ? ' selected="selected"' : '';
|
|
|
4c79b5 |
${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
${'s_sort_' . $sort_option . '_key'} .= '</select>';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
${'s_sort_' . $sort_option . '_dir'} = '<select name="' . $sort_option . '_sd">';
|
|
|
4c79b5 |
foreach ($sort_dir_text as $key => $value)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$selected = ($data[$sort_option . '_sd'] == $key) ? ' selected="selected"' : '';
|
|
|
4c79b5 |
${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
${'s_sort_' . $sort_option . '_dir'} .= '</select>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'ERROR' => (sizeof($error)) ? implode(' ', $error) : '',
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_IMAGES' => $data['images'],
|
|
|
4c79b5 |
'S_FLASH' => $data['flash'],
|
|
|
4c79b5 |
'S_SMILIES' => $data['smilies'],
|
|
|
4c79b5 |
'S_SIGS' => $data['sigs'],
|
|
|
4c79b5 |
'S_AVATARS' => $data['avatars'],
|
|
|
4c79b5 |
'S_DISABLE_CENSORS' => $data['wordcensor'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors')) ? true : false,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_TOPIC_SORT_DAYS' => $s_limit_topic_days,
|
|
|
4c79b5 |
'S_TOPIC_SORT_KEY' => $s_sort_topic_key,
|
|
|
4c79b5 |
'S_TOPIC_SORT_DIR' => $s_sort_topic_dir,
|
|
|
4c79b5 |
'S_POST_SORT_DAYS' => $s_limit_post_days,
|
|
|
4c79b5 |
'S_POST_SORT_KEY' => $s_sort_post_key,
|
|
|
4c79b5 |
'S_POST_SORT_DIR' => $s_sort_post_dir)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'post':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$data = array(
|
|
|
4c79b5 |
'bbcode' => request_var('bbcode', $user->optionget('bbcode')),
|
|
|
4c79b5 |
'smilies' => request_var('smilies', $user->optionget('smilies')),
|
|
|
4c79b5 |
'sig' => request_var('sig', $user->optionget('attachsig')),
|
|
|
4c79b5 |
'notify' => request_var('notify', (bool) $user->data['user_notify']),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
add_form_key('ucp_prefs_post');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($submit)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (check_form_key('ucp_prefs_post'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$user->optionset('bbcode', $data['bbcode']);
|
|
|
4c79b5 |
$user->optionset('smilies', $data['smilies']);
|
|
|
4c79b5 |
$user->optionset('attachsig', $data['sig']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_ary = array(
|
|
|
4c79b5 |
'user_options' => $user->data['user_options'],
|
|
|
4c79b5 |
'user_notify' => $data['notify'],
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
4c79b5 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
4c79b5 |
WHERE user_id = ' . $user->data['user_id'];
|
|
|
4c79b5 |
$db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$msg = $user->lang['PREFERENCES_UPDATED'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$msg = $user->lang['FORM_INVALID'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
meta_refresh(3, $this->u_action);
|
|
|
4c79b5 |
$message = $msg . '
' . sprintf($user->lang['RETURN_UCP'], '', '');
|
|
|
4c79b5 |
trigger_error($message);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'S_BBCODE' => $data['bbcode'],
|
|
|
4c79b5 |
'S_SMILIES' => $data['smilies'],
|
|
|
4c79b5 |
'S_SIG' => $data['sig'],
|
|
|
4c79b5 |
'S_NOTIFY' => $data['notify'])
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'L_TITLE' => $user->lang['UCP_PREFS_' . strtoupper($mode)],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
|
|
4c79b5 |
'S_UCP_ACTION' => $this->u_action)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->tpl_name = 'ucp_prefs_' . $mode;
|
|
|
4c79b5 |
$this->page_title = 'UCP_PREFS_' . strtoupper($mode);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|