2003-05-19 15:23:04 +00:00
|
|
|
<?php
|
2007-10-05 14:36:34 +00:00
|
|
|
/**
|
2005-04-09 12:26:45 +00:00
|
|
|
*
|
|
|
|
* @package ucp
|
|
|
|
* @version $Id$
|
2007-10-05 14:36:34 +00:00
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
2005-04-09 12:26:45 +00:00
|
|
|
*
|
|
|
|
*/
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2007-10-05 14:36:34 +00:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
* ucp_prefs
|
|
|
|
* Changing user preferences
|
2006-06-13 21:06:29 +00:00
|
|
|
* @package ucp
|
2005-04-09 12:26:45 +00:00
|
|
|
*/
|
2005-10-04 21:31:35 +00:00
|
|
|
class ucp_prefs
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
var $u_action;
|
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
function main($id, $mode)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
$submit = (isset($_POST['submit'])) ? true : false;
|
|
|
|
$error = $data = array();
|
2004-06-06 21:44:49 +00:00
|
|
|
$s_hidden_fields = '';
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2004-10-13 19:30:02 +00:00
|
|
|
switch ($mode)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
|
|
|
case 'personal':
|
2007-10-03 15:05:54 +00:00
|
|
|
add_form_key('ucp_prefs_personal');
|
2006-06-11 18:13:52 +00:00
|
|
|
$data = array(
|
2006-11-04 17:19:33 +00:00
|
|
|
'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']),
|
2006-11-24 14:59:26 +00:00
|
|
|
'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true),
|
2007-06-24 13:57:02 +00:00
|
|
|
'lang' => basename(request_var('lang', $user->data['user_lang'])),
|
2006-11-04 17:19:33 +00:00
|
|
|
'style' => request_var('style', (int) $user->data['user_style']),
|
|
|
|
'tz' => request_var('tz', (float) $user->data['user_timezone']),
|
|
|
|
|
|
|
|
'dst' => request_var('dst', (bool) $user->data['user_dst']),
|
|
|
|
'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
|
|
|
|
'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']),
|
|
|
|
'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
|
|
|
|
'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']),
|
|
|
|
'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')),
|
|
|
|
'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']),
|
2006-06-11 18:13:52 +00:00
|
|
|
);
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if ($submit)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-10-04 20:51:51 +00:00
|
|
|
$data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style'];
|
|
|
|
|
2006-11-04 17:19:33 +00:00
|
|
|
$error = validate_data($data, array(
|
#10005, #10003, #10001, #9999, #9945, #9965, #9909, #9906, #9877, #9861, #9831, #9830, #9815, #9665, #9624
prosilver adjustments for important announcements in ucp - #9995
MCP fixes for user notes/warnings - #9981
Preserving imageset values on save/edit
find a member link for Mass PM's - #9925
syndicate window.onload events where necessary - #9878
Duplicate topics in forums with announcements - #9840
Email template for forced re-activation - #9808
Topic pagination adjustment - #9763
Changed compose message layout in UCP - #9706, #9702
Fixed inline attachment font size (hopefully)
git-svn-id: file:///svn/phpbb/trunk@7384 89ea8834-ac86-4346-8a33-228a782c2dd0
2007-04-22 15:27:40 +00:00
|
|
|
'dateformat' => array('string', false, 1, 30),
|
2006-09-17 22:02:28 +00:00
|
|
|
'lang' => array('match', false, '#^[a-z0-9_\-]{2,}$#i'),
|
2006-04-09 21:20:24 +00:00
|
|
|
'tz' => array('num', false, -14, 14),
|
2006-11-04 17:19:33 +00:00
|
|
|
));
|
2003-09-08 12:42:32 +00:00
|
|
|
|
2007-10-03 15:05:54 +00:00
|
|
|
if (!check_form_key('ucp_prefs_personal'))
|
|
|
|
{
|
|
|
|
$error[] = 'FORM_INVALID';
|
|
|
|
}
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if (!sizeof($error))
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
$user->optionset('popuppm', $data['popuppm']);
|
2004-09-04 19:32:23 +00:00
|
|
|
|
2003-05-19 15:23:04 +00:00
|
|
|
$sql_ary = array(
|
2006-06-11 18:13:52 +00:00
|
|
|
'user_allow_pm' => $data['allowpm'],
|
|
|
|
'user_allow_viewemail' => $data['viewemail'],
|
|
|
|
'user_allow_massemail' => $data['massemail'],
|
|
|
|
'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'],
|
|
|
|
'user_notify_type' => $data['notifymethod'],
|
|
|
|
'user_notify_pm' => $data['notifypm'],
|
2004-09-01 15:47:46 +00:00
|
|
|
'user_options' => $user->data['user_options'],
|
2003-09-08 12:42:32 +00:00
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
'user_dst' => $data['dst'],
|
|
|
|
'user_dateformat' => $data['dateformat'],
|
|
|
|
'user_lang' => $data['lang'],
|
|
|
|
'user_timezone' => $data['tz'],
|
|
|
|
'user_style' => $data['style'],
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
2003-05-19 15:23:04 +00:00
|
|
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
meta_refresh(3, $this->u_action);
|
|
|
|
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
2003-05-19 21:41:55 +00:00
|
|
|
trigger_error($message);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
2004-10-13 19:30:02 +00:00
|
|
|
|
|
|
|
// Replace "error" strings with their real, localised form
|
|
|
|
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
2005-11-17 17:32:25 +00:00
|
|
|
$dateformat_options = '';
|
|
|
|
|
|
|
|
foreach ($user->lang['dateformats'] as $format => $null)
|
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
$dateformat_options .= '<option value="' . $format . '"' . (($format == $data['dateformat']) ? ' selected="selected"' : '') . '>';
|
2007-04-24 17:52:40 +00:00
|
|
|
$dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
|
2005-11-17 17:32:25 +00:00
|
|
|
$dateformat_options .= '</option>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$s_custom = false;
|
|
|
|
|
|
|
|
$dateformat_options .= '<option value="custom"';
|
2006-06-11 18:13:52 +00:00
|
|
|
if (!in_array($data['dateformat'], array_keys($user->lang['dateformats'])))
|
2005-11-17 17:32:25 +00:00
|
|
|
{
|
|
|
|
$dateformat_options .= ' selected="selected"';
|
|
|
|
$s_custom = true;
|
|
|
|
}
|
|
|
|
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
|
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
$template->assign_vars(array(
|
2003-09-08 12:42:32 +00:00
|
|
|
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false,
|
|
|
|
'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false,
|
|
|
|
'S_NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false,
|
2006-11-04 17:19:33 +00:00
|
|
|
'S_VIEW_EMAIL' => $data['viewemail'],
|
|
|
|
'S_MASS_EMAIL' => $data['massemail'],
|
|
|
|
'S_ALLOW_PM' => $data['allowpm'],
|
|
|
|
'S_HIDE_ONLINE' => $data['hideonline'],
|
|
|
|
'S_NOTIFY_PM' => $data['notifypm'],
|
|
|
|
'S_POPUP_PM' => $data['popuppm'],
|
|
|
|
'S_DST' => $data['dst'],
|
2006-06-11 18:13:52 +00:00
|
|
|
|
|
|
|
'DATE_FORMAT' => $data['dateformat'],
|
2007-06-29 13:00:54 +00:00
|
|
|
'A_DATE_FORMAT' => addslashes($data['dateformat']),
|
2005-11-17 17:32:25 +00:00
|
|
|
'S_DATEFORMAT_OPTIONS' => $dateformat_options,
|
|
|
|
'S_CUSTOM_DATEFORMAT' => $s_custom,
|
|
|
|
'DEFAULT_DATEFORMAT' => $config['default_dateformat'],
|
2006-05-06 15:15:40 +00:00
|
|
|
'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']),
|
2004-09-01 15:47:46 +00:00
|
|
|
|
2006-11-27 12:45:26 +00:00
|
|
|
'S_LANG_OPTIONS' => language_select($data['lang']),
|
|
|
|
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
|
2006-11-27 16:05:23 +00:00
|
|
|
'S_TZ_OPTIONS' => tz_select($data['tz'], true),
|
2006-11-27 12:45:26 +00:00
|
|
|
'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false,
|
|
|
|
'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false)
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
2006-06-11 18:13:52 +00:00
|
|
|
|
|
|
|
break;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
|
|
|
case 'view':
|
2003-05-20 12:16:25 +00:00
|
|
|
|
2007-10-03 15:05:54 +00:00
|
|
|
add_form_key('ucp_prefs_view');
|
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
$data = array(
|
2006-11-21 18:15:53 +00:00
|
|
|
'topic_sk' => request_var('topic_sk', (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'),
|
|
|
|
'topic_sd' => request_var('topic_sd', (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'),
|
|
|
|
'topic_st' => request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0),
|
2005-01-20 20:57:45 +00:00
|
|
|
|
2006-11-21 18:15:53 +00:00
|
|
|
'post_sk' => request_var('post_sk', (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'),
|
|
|
|
'post_sd' => request_var('post_sd', (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'),
|
|
|
|
'post_st' => request_var('post_st', (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0),
|
2006-11-04 17:19:33 +00:00
|
|
|
|
|
|
|
'images' => request_var('images', (bool) $user->optionget('viewimg')),
|
|
|
|
'flash' => request_var('flash', (bool) $user->optionget('viewflash')),
|
|
|
|
'smilies' => request_var('smilies', (bool) $user->optionget('viewsmilies')),
|
|
|
|
'sigs' => request_var('sigs', (bool) $user->optionget('viewsigs')),
|
|
|
|
'avatars' => request_var('avatars', (bool) $user->optionget('viewavatars')),
|
|
|
|
'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')),
|
2006-06-11 18:13:52 +00:00
|
|
|
);
|
2003-10-12 11:59:23 +00:00
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
if ($submit)
|
|
|
|
{
|
2006-11-04 17:19:33 +00:00
|
|
|
$error = validate_data($data, array(
|
2005-01-20 20:57:45 +00:00
|
|
|
'topic_sk' => array('string', false, 1, 1),
|
|
|
|
'topic_sd' => array('string', false, 1, 1),
|
|
|
|
'post_sk' => array('string', false, 1, 1),
|
|
|
|
'post_sd' => array('string', false, 1, 1),
|
2006-11-04 17:19:33 +00:00
|
|
|
));
|
2003-09-08 12:42:32 +00:00
|
|
|
|
2007-10-03 15:05:54 +00:00
|
|
|
if (!check_form_key('ucp_prefs_view'))
|
|
|
|
{
|
|
|
|
$error[] = 'FORM_INVALID';
|
|
|
|
}
|
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if (!sizeof($error))
|
2003-05-20 12:16:25 +00:00
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
$user->optionset('viewimg', $data['images']);
|
|
|
|
$user->optionset('viewflash', $data['flash']);
|
|
|
|
$user->optionset('viewsmilies', $data['smilies']);
|
|
|
|
$user->optionset('viewsigs', $data['sigs']);
|
|
|
|
$user->optionset('viewavatars', $data['avatars']);
|
|
|
|
|
2003-10-12 11:59:23 +00:00
|
|
|
if ($auth->acl_get('u_chgcensors'))
|
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
$user->optionset('viewcensors', $data['wordcensor']);
|
2003-10-12 11:59:23 +00:00
|
|
|
}
|
|
|
|
|
2003-05-20 12:16:25 +00:00
|
|
|
$sql_ary = array(
|
2006-06-11 18:13:52 +00:00
|
|
|
'user_options' => $user->data['user_options'],
|
|
|
|
'user_topic_sortby_type' => $data['topic_sk'],
|
|
|
|
'user_post_sortby_type' => $data['post_sk'],
|
|
|
|
'user_topic_sortby_dir' => $data['topic_sd'],
|
|
|
|
'user_post_sortby_dir' => $data['post_sd'],
|
|
|
|
|
|
|
|
'user_topic_show_days' => $data['topic_st'],
|
|
|
|
'user_post_show_days' => $data['post_st'],
|
2003-05-20 12:16:25 +00:00
|
|
|
);
|
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
2003-05-20 12:16:25 +00:00
|
|
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
meta_refresh(3, $this->u_action);
|
|
|
|
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
2003-05-20 12:16:25 +00:00
|
|
|
trigger_error($message);
|
|
|
|
}
|
2004-10-13 19:30:02 +00:00
|
|
|
|
|
|
|
// Replace "error" strings with their real, localised form
|
|
|
|
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
2003-05-20 12:16:25 +00:00
|
|
|
}
|
|
|
|
|
2005-01-20 20:57:45 +00:00
|
|
|
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
|
|
|
|
|
|
|
// Topic ordering options
|
2006-03-23 19:23:52 +00:00
|
|
|
$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']);
|
2005-01-20 20:57:45 +00:00
|
|
|
|
|
|
|
$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']);
|
|
|
|
$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');
|
|
|
|
|
|
|
|
// Post ordering options
|
2006-03-23 19:23:52 +00:00
|
|
|
$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']);
|
2005-01-20 20:57:45 +00:00
|
|
|
|
|
|
|
$sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
2006-12-02 13:19:40 +00:00
|
|
|
$sort_by_post_sql = array('a' => 'u.username_clean', 't' => 'p.post_id', 's' => 'p.post_subject');
|
2003-05-20 12:16:25 +00:00
|
|
|
|
2005-11-30 17:48:06 +00:00
|
|
|
$_options = array('topic', 'post');
|
|
|
|
foreach ($_options as $sort_option)
|
2005-01-20 20:57:45 +00:00
|
|
|
{
|
|
|
|
${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
|
|
|
|
foreach (${'limit_' . $sort_option . '_days'} as $day => $text)
|
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
$selected = ($data[$sort_option . '_st'] == $day) ? ' selected="selected"' : '';
|
2005-01-20 20:57:45 +00:00
|
|
|
${'s_limit_' . $sort_option . '_days'} .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
|
|
|
|
}
|
|
|
|
${'s_limit_' . $sort_option . '_days'} .= '</select>';
|
2003-05-20 12:16:25 +00:00
|
|
|
|
2005-01-20 20:57:45 +00:00
|
|
|
${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
|
|
|
|
foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text)
|
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
$selected = ($data[$sort_option . '_sk'] == $key) ? ' selected="selected"' : '';
|
2005-01-20 20:57:45 +00:00
|
|
|
${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
|
|
|
|
}
|
|
|
|
${'s_sort_' . $sort_option . '_key'} .= '</select>';
|
2003-05-20 12:16:25 +00:00
|
|
|
|
2005-01-20 20:57:45 +00:00
|
|
|
${'s_sort_' . $sort_option . '_dir'} = '<select name="' . $sort_option . '_sd">';
|
|
|
|
foreach ($sort_dir_text as $key => $value)
|
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
$selected = ($data[$sort_option . '_sd'] == $key) ? ' selected="selected"' : '';
|
2005-01-20 20:57:45 +00:00
|
|
|
${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
|
|
}
|
|
|
|
${'s_sort_' . $sort_option . '_dir'} .= '</select>';
|
|
|
|
}
|
2003-05-20 12:16:25 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
$template->assign_vars(array(
|
2003-09-08 12:42:32 +00:00
|
|
|
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
2003-05-20 12:16:25 +00:00
|
|
|
|
2006-11-04 17:19:33 +00:00
|
|
|
'S_IMAGES' => $data['images'],
|
|
|
|
'S_FLASH' => $data['flash'],
|
|
|
|
'S_SMILIES' => $data['smilies'],
|
|
|
|
'S_SIGS' => $data['sigs'],
|
|
|
|
'S_AVATARS' => $data['avatars'],
|
|
|
|
'S_DISABLE_CENSORS' => $data['wordcensor'],
|
2003-06-02 17:27:38 +00:00
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors')) ? true : false,
|
2005-01-20 20:57:45 +00:00
|
|
|
|
|
|
|
'S_TOPIC_SORT_DAYS' => $s_limit_topic_days,
|
|
|
|
'S_TOPIC_SORT_KEY' => $s_sort_topic_key,
|
|
|
|
'S_TOPIC_SORT_DIR' => $s_sort_topic_dir,
|
|
|
|
'S_POST_SORT_DAYS' => $s_limit_post_days,
|
|
|
|
'S_POST_SORT_KEY' => $s_sort_post_key,
|
|
|
|
'S_POST_SORT_DIR' => $s_sort_post_dir)
|
2003-05-20 12:16:25 +00:00
|
|
|
);
|
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
break;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
|
|
|
case 'post':
|
2003-05-19 21:41:55 +00:00
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
$data = array(
|
2006-11-04 17:19:33 +00:00
|
|
|
'bbcode' => request_var('bbcode', $user->optionget('bbcode')),
|
|
|
|
'smilies' => request_var('smilies', $user->optionget('smilies')),
|
|
|
|
'sig' => request_var('sig', $user->optionget('attachsig')),
|
|
|
|
'notify' => request_var('notify', $user->data['user_notify']),
|
2006-06-11 18:13:52 +00:00
|
|
|
);
|
2007-10-03 15:05:54 +00:00
|
|
|
add_form_key('ucp_prefs_post');
|
2006-06-11 18:13:52 +00:00
|
|
|
|
2003-09-08 12:42:32 +00:00
|
|
|
if ($submit)
|
2003-05-19 21:41:55 +00:00
|
|
|
{
|
2007-10-03 15:05:54 +00:00
|
|
|
if (check_form_key('ucp_prefs_post'))
|
|
|
|
{
|
|
|
|
$user->optionset('bbcode', $data['bbcode']);
|
|
|
|
$user->optionset('smilies', $data['smilies']);
|
|
|
|
$user->optionset('attachsig', $data['sig']);
|
2003-10-12 11:59:23 +00:00
|
|
|
|
2007-10-03 15:05:54 +00:00
|
|
|
$sql_ary = array(
|
|
|
|
'user_options' => $user->data['user_options'],
|
|
|
|
'user_notify' => $data['notify'],
|
|
|
|
);
|
2003-05-19 21:41:55 +00:00
|
|
|
|
2007-10-03 15:05:54 +00:00
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
|
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
|
|
WHERE user_id = ' . $user->data['user_id'];
|
|
|
|
$db->sql_query($sql);
|
2004-10-13 19:30:02 +00:00
|
|
|
|
2007-10-03 15:05:54 +00:00
|
|
|
$msg = $user->lang['PREFERENCES_UPDATED'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$msg = $user->lang['FORM_INVALID'];
|
|
|
|
}
|
2006-06-11 18:13:52 +00:00
|
|
|
meta_refresh(3, $this->u_action);
|
2007-10-03 15:05:54 +00:00
|
|
|
$message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
2006-06-11 18:13:52 +00:00
|
|
|
trigger_error($message);
|
2003-05-19 21:41:55 +00:00
|
|
|
}
|
2004-09-01 15:47:46 +00:00
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2006-06-11 18:13:52 +00:00
|
|
|
'S_BBCODE' => $data['bbcode'],
|
|
|
|
'S_SMILIES' => $data['smilies'],
|
|
|
|
'S_SIG' => $data['sig'],
|
|
|
|
'S_NOTIFY' => $data['notify'])
|
2003-05-19 21:41:55 +00:00
|
|
|
);
|
2006-06-11 18:13:52 +00:00
|
|
|
break;
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
2004-09-01 15:47:46 +00:00
|
|
|
$template->assign_vars(array(
|
2004-05-26 20:16:20 +00:00
|
|
|
'L_TITLE' => $user->lang['UCP_PREFS_' . strtoupper($mode)],
|
2003-05-19 15:23:04 +00:00
|
|
|
|
2003-10-12 11:59:23 +00:00
|
|
|
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
2006-06-06 20:53:46 +00:00
|
|
|
'S_UCP_ACTION' => $this->u_action)
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
$this->tpl_name = 'ucp_prefs_' . $mode;
|
2006-06-12 22:16:27 +00:00
|
|
|
$this->page_title = 'UCP_PREFS_' . strtoupper($mode);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|