|
indvdum@0
|
1 |
<?php
|
|
indvdum@0
|
2 |
/**
|
|
indvdum@0
|
3 |
*
|
|
indvdum@0
|
4 |
* @package ucp
|
|
indvdum@0
|
5 |
* @version $Id$
|
|
indvdum@0
|
6 |
* @copyright (c) 2005 phpBB Group
|
|
indvdum@0
|
7 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
indvdum@0
|
8 |
*
|
|
indvdum@0
|
9 |
*/
|
|
indvdum@0
|
10 |
|
|
indvdum@0
|
11 |
/**
|
|
indvdum@0
|
12 |
* @ignore
|
|
indvdum@0
|
13 |
*/
|
|
indvdum@0
|
14 |
if (!defined('IN_PHPBB'))
|
|
indvdum@0
|
15 |
{
|
|
indvdum@0
|
16 |
exit;
|
|
indvdum@0
|
17 |
}
|
|
indvdum@0
|
18 |
|
|
indvdum@0
|
19 |
/**
|
|
indvdum@0
|
20 |
* ucp_prefs
|
|
indvdum@0
|
21 |
* Changing user preferences
|
|
indvdum@0
|
22 |
* @package ucp
|
|
indvdum@0
|
23 |
*/
|
|
indvdum@0
|
24 |
class ucp_prefs
|
|
indvdum@0
|
25 |
{
|
|
indvdum@0
|
26 |
var $u_action;
|
|
indvdum@0
|
27 |
|
|
indvdum@0
|
28 |
function main($id, $mode)
|
|
indvdum@0
|
29 |
{
|
|
indvdum@0
|
30 |
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
|
|
indvdum@0
|
31 |
|
|
indvdum@0
|
32 |
$submit = (isset($_POST['submit'])) ? true : false;
|
|
indvdum@0
|
33 |
$error = $data = array();
|
|
indvdum@0
|
34 |
$s_hidden_fields = '';
|
|
indvdum@0
|
35 |
|
|
indvdum@0
|
36 |
switch ($mode)
|
|
indvdum@0
|
37 |
{
|
|
indvdum@0
|
38 |
case 'personal':
|
|
indvdum@0
|
39 |
add_form_key('ucp_prefs_personal');
|
|
indvdum@0
|
40 |
$data = array(
|
|
indvdum@0
|
41 |
'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']),
|
|
indvdum@0
|
42 |
'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true),
|
|
indvdum@0
|
43 |
'lang' => basename(request_var('lang', $user->data['user_lang'])),
|
|
indvdum@0
|
44 |
'style' => request_var('style', (int) $user->data['user_style']),
|
|
indvdum@0
|
45 |
'tz' => request_var('tz', (float) $user->data['user_timezone']),
|
|
indvdum@0
|
46 |
|
|
indvdum@0
|
47 |
'dst' => request_var('dst', (bool) $user->data['user_dst']),
|
|
indvdum@0
|
48 |
'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
|
|
indvdum@0
|
49 |
'massemail' => request_var('massemail', (bool) $user->data['user_allow_massemail']),
|
|
indvdum@0
|
50 |
'hideonline' => request_var('hideonline', (bool) !$user->data['user_allow_viewonline']),
|
|
indvdum@0
|
51 |
'notifypm' => request_var('notifypm', (bool) $user->data['user_notify_pm']),
|
|
indvdum@0
|
52 |
'popuppm' => request_var('popuppm', (bool) $user->optionget('popuppm')),
|
|
indvdum@0
|
53 |
'allowpm' => request_var('allowpm', (bool) $user->data['user_allow_pm']),
|
|
indvdum@0
|
54 |
);
|
|
indvdum@0
|
55 |
|
|
indvdum@0
|
56 |
if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml')))
|
|
indvdum@0
|
57 |
{
|
|
indvdum@0
|
58 |
// Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct.
|
|
indvdum@0
|
59 |
$data['notifymethod'] = NOTIFY_BOTH;
|
|
indvdum@0
|
60 |
}
|
|
indvdum@0
|
61 |
|
|
indvdum@0
|
62 |
if ($submit)
|
|
indvdum@0
|
63 |
{
|
|
indvdum@0
|
64 |
$data['style'] = ($config['override_user_style']) ? $config['default_style'] : $data['style'];
|
|
indvdum@0
|
65 |
|
|
indvdum@0
|
66 |
$error = validate_data($data, array(
|
|
indvdum@0
|
67 |
'dateformat' => array('string', false, 1, 30),
|
|
indvdum@0
|
68 |
'lang' => array('language_iso_name'),
|
|
indvdum@0
|
69 |
'tz' => array('num', false, -14, 14),
|
|
indvdum@0
|
70 |
));
|
|
indvdum@0
|
71 |
|
|
indvdum@0
|
72 |
if (!check_form_key('ucp_prefs_personal'))
|
|
indvdum@0
|
73 |
{
|
|
indvdum@0
|
74 |
$error[] = 'FORM_INVALID';
|
|
indvdum@0
|
75 |
}
|
|
indvdum@0
|
76 |
|
|
indvdum@0
|
77 |
if (!sizeof($error))
|
|
indvdum@0
|
78 |
{
|
|
indvdum@0
|
79 |
$user->optionset('popuppm', $data['popuppm']);
|
|
indvdum@0
|
80 |
|
|
indvdum@0
|
81 |
$sql_ary = array(
|
|
indvdum@0
|
82 |
'user_allow_pm' => $data['allowpm'],
|
|
indvdum@0
|
83 |
'user_allow_viewemail' => $data['viewemail'],
|
|
indvdum@0
|
84 |
'user_allow_massemail' => $data['massemail'],
|
|
indvdum@0
|
85 |
'user_allow_viewonline' => ($auth->acl_get('u_hideonline')) ? !$data['hideonline'] : $user->data['user_allow_viewonline'],
|
|
indvdum@0
|
86 |
'user_notify_type' => $data['notifymethod'],
|
|
indvdum@0
|
87 |
'user_notify_pm' => $data['notifypm'],
|
|
indvdum@0
|
88 |
'user_options' => $user->data['user_options'],
|
|
indvdum@0
|
89 |
|
|
indvdum@0
|
90 |
'user_dst' => $data['dst'],
|
|
indvdum@0
|
91 |
'user_dateformat' => $data['dateformat'],
|
|
indvdum@0
|
92 |
'user_lang' => $data['lang'],
|
|
indvdum@0
|
93 |
'user_timezone' => $data['tz'],
|
|
indvdum@0
|
94 |
'user_style' => $data['style'],
|
|
indvdum@0
|
95 |
);
|
|
indvdum@0
|
96 |
|
|
indvdum@0
|
97 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
indvdum@0
|
98 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
indvdum@0
|
99 |
WHERE user_id = ' . $user->data['user_id'];
|
|
indvdum@0
|
100 |
$db->sql_query($sql);
|
|
indvdum@0
|
101 |
|
|
indvdum@0
|
102 |
meta_refresh(3, $this->u_action);
|
|
indvdum@0
|
103 |
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
indvdum@0
|
104 |
trigger_error($message);
|
|
indvdum@0
|
105 |
}
|
|
indvdum@0
|
106 |
|
|
indvdum@0
|
107 |
// Replace "error" strings with their real, localised form
|
|
indvdum@0
|
108 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
indvdum@0
|
109 |
}
|
|
indvdum@0
|
110 |
|
|
indvdum@0
|
111 |
$dateformat_options = '';
|
|
indvdum@0
|
112 |
|
|
indvdum@0
|
113 |
foreach ($user->lang['dateformats'] as $format => $null)
|
|
indvdum@0
|
114 |
{
|
|
indvdum@0
|
115 |
$dateformat_options .= '<option value="' . $format . '"' . (($format == $data['dateformat']) ? ' selected="selected"' : '') . '>';
|
|
indvdum@0
|
116 |
$dateformat_options .= $user->format_date(time(), $format, false) . ((strpos($format, '|') !== false) ? $user->lang['VARIANT_DATE_SEPARATOR'] . $user->format_date(time(), $format, true) : '');
|
|
indvdum@0
|
117 |
$dateformat_options .= '</option>';
|
|
indvdum@0
|
118 |
}
|
|
indvdum@0
|
119 |
|
|
indvdum@0
|
120 |
$s_custom = false;
|
|
indvdum@0
|
121 |
|
|
indvdum@0
|
122 |
$dateformat_options .= '<option value="custom"';
|
|
indvdum@0
|
123 |
if (!isset($user->lang['dateformats'][$data['dateformat']]))
|
|
indvdum@0
|
124 |
{
|
|
indvdum@0
|
125 |
$dateformat_options .= ' selected="selected"';
|
|
indvdum@0
|
126 |
$s_custom = true;
|
|
indvdum@0
|
127 |
}
|
|
indvdum@0
|
128 |
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
|
|
indvdum@0
|
129 |
|
|
indvdum@0
|
130 |
$template->assign_vars(array(
|
|
indvdum@0
|
131 |
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
132 |
|
|
indvdum@0
|
133 |
'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false,
|
|
indvdum@0
|
134 |
'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false,
|
|
indvdum@0
|
135 |
'S_NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false,
|
|
indvdum@0
|
136 |
'S_VIEW_EMAIL' => $data['viewemail'],
|
|
indvdum@0
|
137 |
'S_MASS_EMAIL' => $data['massemail'],
|
|
indvdum@0
|
138 |
'S_ALLOW_PM' => $data['allowpm'],
|
|
indvdum@0
|
139 |
'S_HIDE_ONLINE' => $data['hideonline'],
|
|
indvdum@0
|
140 |
'S_NOTIFY_PM' => $data['notifypm'],
|
|
indvdum@0
|
141 |
'S_POPUP_PM' => $data['popuppm'],
|
|
indvdum@0
|
142 |
'S_DST' => $data['dst'],
|
|
indvdum@0
|
143 |
|
|
indvdum@0
|
144 |
'DATE_FORMAT' => $data['dateformat'],
|
|
indvdum@0
|
145 |
'A_DATE_FORMAT' => addslashes($data['dateformat']),
|
|
indvdum@0
|
146 |
'S_DATEFORMAT_OPTIONS' => $dateformat_options,
|
|
indvdum@0
|
147 |
'S_CUSTOM_DATEFORMAT' => $s_custom,
|
|
indvdum@0
|
148 |
'DEFAULT_DATEFORMAT' => $config['default_dateformat'],
|
|
indvdum@0
|
149 |
'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']),
|
|
indvdum@0
|
150 |
|
|
indvdum@0
|
151 |
'S_LANG_OPTIONS' => language_select($data['lang']),
|
|
indvdum@0
|
152 |
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
|
|
indvdum@0
|
153 |
'S_TZ_OPTIONS' => tz_select($data['tz'], true),
|
|
indvdum@0
|
154 |
'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false,
|
|
indvdum@0
|
155 |
'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false)
|
|
indvdum@0
|
156 |
);
|
|
indvdum@0
|
157 |
|
|
indvdum@0
|
158 |
break;
|
|
indvdum@0
|
159 |
|
|
indvdum@0
|
160 |
case 'view':
|
|
indvdum@0
|
161 |
|
|
indvdum@0
|
162 |
add_form_key('ucp_prefs_view');
|
|
indvdum@0
|
163 |
|
|
indvdum@0
|
164 |
$data = array(
|
|
indvdum@0
|
165 |
'topic_sk' => request_var('topic_sk', (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'),
|
|
indvdum@0
|
166 |
'topic_sd' => request_var('topic_sd', (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'),
|
|
indvdum@0
|
167 |
'topic_st' => request_var('topic_st', (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0),
|
|
indvdum@0
|
168 |
|
|
indvdum@0
|
169 |
'post_sk' => request_var('post_sk', (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'),
|
|
indvdum@0
|
170 |
'post_sd' => request_var('post_sd', (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'),
|
|
indvdum@0
|
171 |
'post_st' => request_var('post_st', (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0),
|
|
indvdum@0
|
172 |
|
|
indvdum@0
|
173 |
'images' => request_var('images', (bool) $user->optionget('viewimg')),
|
|
indvdum@0
|
174 |
'flash' => request_var('flash', (bool) $user->optionget('viewflash')),
|
|
indvdum@0
|
175 |
'smilies' => request_var('smilies', (bool) $user->optionget('viewsmilies')),
|
|
indvdum@0
|
176 |
'sigs' => request_var('sigs', (bool) $user->optionget('viewsigs')),
|
|
indvdum@0
|
177 |
'avatars' => request_var('avatars', (bool) $user->optionget('viewavatars')),
|
|
indvdum@0
|
178 |
'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')),
|
|
indvdum@0
|
179 |
);
|
|
indvdum@0
|
180 |
|
|
indvdum@0
|
181 |
if ($submit)
|
|
indvdum@0
|
182 |
{
|
|
indvdum@0
|
183 |
$error = validate_data($data, array(
|
|
indvdum@0
|
184 |
'topic_sk' => array('string', false, 1, 1),
|
|
indvdum@0
|
185 |
'topic_sd' => array('string', false, 1, 1),
|
|
indvdum@0
|
186 |
'post_sk' => array('string', false, 1, 1),
|
|
indvdum@0
|
187 |
'post_sd' => array('string', false, 1, 1),
|
|
indvdum@0
|
188 |
));
|
|
indvdum@0
|
189 |
|
|
indvdum@0
|
190 |
if (!check_form_key('ucp_prefs_view'))
|
|
indvdum@0
|
191 |
{
|
|
indvdum@0
|
192 |
$error[] = 'FORM_INVALID';
|
|
indvdum@0
|
193 |
}
|
|
indvdum@0
|
194 |
|
|
indvdum@0
|
195 |
if (!sizeof($error))
|
|
indvdum@0
|
196 |
{
|
|
indvdum@0
|
197 |
$user->optionset('viewimg', $data['images']);
|
|
indvdum@0
|
198 |
$user->optionset('viewflash', $data['flash']);
|
|
indvdum@0
|
199 |
$user->optionset('viewsmilies', $data['smilies']);
|
|
indvdum@0
|
200 |
$user->optionset('viewsigs', $data['sigs']);
|
|
indvdum@0
|
201 |
$user->optionset('viewavatars', $data['avatars']);
|
|
indvdum@0
|
202 |
|
|
indvdum@0
|
203 |
if ($auth->acl_get('u_chgcensors'))
|
|
indvdum@0
|
204 |
{
|
|
indvdum@0
|
205 |
$user->optionset('viewcensors', $data['wordcensor']);
|
|
indvdum@0
|
206 |
}
|
|
indvdum@0
|
207 |
|
|
indvdum@0
|
208 |
$sql_ary = array(
|
|
indvdum@0
|
209 |
'user_options' => $user->data['user_options'],
|
|
indvdum@0
|
210 |
'user_topic_sortby_type' => $data['topic_sk'],
|
|
indvdum@0
|
211 |
'user_post_sortby_type' => $data['post_sk'],
|
|
indvdum@0
|
212 |
'user_topic_sortby_dir' => $data['topic_sd'],
|
|
indvdum@0
|
213 |
'user_post_sortby_dir' => $data['post_sd'],
|
|
indvdum@0
|
214 |
|
|
indvdum@0
|
215 |
'user_topic_show_days' => $data['topic_st'],
|
|
indvdum@0
|
216 |
'user_post_show_days' => $data['post_st'],
|
|
indvdum@0
|
217 |
);
|
|
indvdum@0
|
218 |
|
|
indvdum@0
|
219 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
indvdum@0
|
220 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
indvdum@0
|
221 |
WHERE user_id = ' . $user->data['user_id'];
|
|
indvdum@0
|
222 |
$db->sql_query($sql);
|
|
indvdum@0
|
223 |
|
|
indvdum@0
|
224 |
meta_refresh(3, $this->u_action);
|
|
indvdum@0
|
225 |
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
indvdum@0
|
226 |
trigger_error($message);
|
|
indvdum@0
|
227 |
}
|
|
indvdum@0
|
228 |
|
|
indvdum@0
|
229 |
// Replace "error" strings with their real, localised form
|
|
indvdum@0
|
230 |
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
|
indvdum@0
|
231 |
}
|
|
indvdum@0
|
232 |
|
|
indvdum@0
|
233 |
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
|
|
indvdum@0
|
234 |
|
|
indvdum@0
|
235 |
// Topic ordering options
|
|
indvdum@0
|
236 |
$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']);
|
|
indvdum@0
|
237 |
|
|
indvdum@0
|
238 |
$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']);
|
|
indvdum@0
|
239 |
$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');
|
|
indvdum@0
|
240 |
|
|
indvdum@0
|
241 |
// Post ordering options
|
|
indvdum@0
|
242 |
$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']);
|
|
indvdum@0
|
243 |
|
|
indvdum@0
|
244 |
$sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']);
|
|
indvdum@0
|
245 |
$sort_by_post_sql = array('a' => 'u.username_clean', 't' => 'p.post_id', 's' => 'p.post_subject');
|
|
indvdum@0
|
246 |
|
|
indvdum@0
|
247 |
$_options = array('topic', 'post');
|
|
indvdum@0
|
248 |
foreach ($_options as $sort_option)
|
|
indvdum@0
|
249 |
{
|
|
indvdum@0
|
250 |
${'s_limit_' . $sort_option . '_days'} = '<select name="' . $sort_option . '_st">';
|
|
indvdum@0
|
251 |
foreach (${'limit_' . $sort_option . '_days'} as $day => $text)
|
|
indvdum@0
|
252 |
{
|
|
indvdum@0
|
253 |
$selected = ($data[$sort_option . '_st'] == $day) ? ' selected="selected"' : '';
|
|
indvdum@0
|
254 |
${'s_limit_' . $sort_option . '_days'} .= '<option value="' . $day . '"' . $selected . '>' . $text . '</option>';
|
|
indvdum@0
|
255 |
}
|
|
indvdum@0
|
256 |
${'s_limit_' . $sort_option . '_days'} .= '</select>';
|
|
indvdum@0
|
257 |
|
|
indvdum@0
|
258 |
${'s_sort_' . $sort_option . '_key'} = '<select name="' . $sort_option . '_sk">';
|
|
indvdum@0
|
259 |
foreach (${'sort_by_' . $sort_option . '_text'} as $key => $text)
|
|
indvdum@0
|
260 |
{
|
|
indvdum@0
|
261 |
$selected = ($data[$sort_option . '_sk'] == $key) ? ' selected="selected"' : '';
|
|
indvdum@0
|
262 |
${'s_sort_' . $sort_option . '_key'} .= '<option value="' . $key . '"' . $selected . '>' . $text . '</option>';
|
|
indvdum@0
|
263 |
}
|
|
indvdum@0
|
264 |
${'s_sort_' . $sort_option . '_key'} .= '</select>';
|
|
indvdum@0
|
265 |
|
|
indvdum@0
|
266 |
${'s_sort_' . $sort_option . '_dir'} = '<select name="' . $sort_option . '_sd">';
|
|
indvdum@0
|
267 |
foreach ($sort_dir_text as $key => $value)
|
|
indvdum@0
|
268 |
{
|
|
indvdum@0
|
269 |
$selected = ($data[$sort_option . '_sd'] == $key) ? ' selected="selected"' : '';
|
|
indvdum@0
|
270 |
${'s_sort_' . $sort_option . '_dir'} .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
|
|
indvdum@0
|
271 |
}
|
|
indvdum@0
|
272 |
${'s_sort_' . $sort_option . '_dir'} .= '</select>';
|
|
indvdum@0
|
273 |
}
|
|
indvdum@0
|
274 |
|
|
indvdum@0
|
275 |
$template->assign_vars(array(
|
|
indvdum@0
|
276 |
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
|
|
indvdum@0
|
277 |
|
|
indvdum@0
|
278 |
'S_IMAGES' => $data['images'],
|
|
indvdum@0
|
279 |
'S_FLASH' => $data['flash'],
|
|
indvdum@0
|
280 |
'S_SMILIES' => $data['smilies'],
|
|
indvdum@0
|
281 |
'S_SIGS' => $data['sigs'],
|
|
indvdum@0
|
282 |
'S_AVATARS' => $data['avatars'],
|
|
indvdum@0
|
283 |
'S_DISABLE_CENSORS' => $data['wordcensor'],
|
|
indvdum@0
|
284 |
|
|
indvdum@0
|
285 |
'S_CHANGE_CENSORS' => ($auth->acl_get('u_chgcensors') && $config['allow_nocensors']) ? true : false,
|
|
indvdum@0
|
286 |
|
|
indvdum@0
|
287 |
'S_TOPIC_SORT_DAYS' => $s_limit_topic_days,
|
|
indvdum@0
|
288 |
'S_TOPIC_SORT_KEY' => $s_sort_topic_key,
|
|
indvdum@0
|
289 |
'S_TOPIC_SORT_DIR' => $s_sort_topic_dir,
|
|
indvdum@0
|
290 |
'S_POST_SORT_DAYS' => $s_limit_post_days,
|
|
indvdum@0
|
291 |
'S_POST_SORT_KEY' => $s_sort_post_key,
|
|
indvdum@0
|
292 |
'S_POST_SORT_DIR' => $s_sort_post_dir)
|
|
indvdum@0
|
293 |
);
|
|
indvdum@0
|
294 |
|
|
indvdum@0
|
295 |
break;
|
|
indvdum@0
|
296 |
|
|
indvdum@0
|
297 |
case 'post':
|
|
indvdum@0
|
298 |
|
|
indvdum@0
|
299 |
$data = array(
|
|
indvdum@0
|
300 |
'bbcode' => request_var('bbcode', $user->optionget('bbcode')),
|
|
indvdum@0
|
301 |
'smilies' => request_var('smilies', $user->optionget('smilies')),
|
|
indvdum@0
|
302 |
'sig' => request_var('sig', $user->optionget('attachsig')),
|
|
indvdum@0
|
303 |
'notify' => request_var('notify', (bool) $user->data['user_notify']),
|
|
indvdum@0
|
304 |
);
|
|
indvdum@0
|
305 |
add_form_key('ucp_prefs_post');
|
|
indvdum@0
|
306 |
|
|
indvdum@0
|
307 |
if ($submit)
|
|
indvdum@0
|
308 |
{
|
|
indvdum@0
|
309 |
if (check_form_key('ucp_prefs_post'))
|
|
indvdum@0
|
310 |
{
|
|
indvdum@0
|
311 |
$user->optionset('bbcode', $data['bbcode']);
|
|
indvdum@0
|
312 |
$user->optionset('smilies', $data['smilies']);
|
|
indvdum@0
|
313 |
$user->optionset('attachsig', $data['sig']);
|
|
indvdum@0
|
314 |
|
|
indvdum@0
|
315 |
$sql_ary = array(
|
|
indvdum@0
|
316 |
'user_options' => $user->data['user_options'],
|
|
indvdum@0
|
317 |
'user_notify' => $data['notify'],
|
|
indvdum@0
|
318 |
);
|
|
indvdum@0
|
319 |
|
|
indvdum@0
|
320 |
$sql = 'UPDATE ' . USERS_TABLE . '
|
|
indvdum@0
|
321 |
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
|
indvdum@0
|
322 |
WHERE user_id = ' . $user->data['user_id'];
|
|
indvdum@0
|
323 |
$db->sql_query($sql);
|
|
indvdum@0
|
324 |
|
|
indvdum@0
|
325 |
$msg = $user->lang['PREFERENCES_UPDATED'];
|
|
indvdum@0
|
326 |
}
|
|
indvdum@0
|
327 |
else
|
|
indvdum@0
|
328 |
{
|
|
indvdum@0
|
329 |
$msg = $user->lang['FORM_INVALID'];
|
|
indvdum@0
|
330 |
}
|
|
indvdum@0
|
331 |
meta_refresh(3, $this->u_action);
|
|
indvdum@0
|
332 |
$message = $msg . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
indvdum@0
|
333 |
trigger_error($message);
|
|
indvdum@0
|
334 |
}
|
|
indvdum@0
|
335 |
|
|
indvdum@0
|
336 |
$template->assign_vars(array(
|
|
indvdum@0
|
337 |
'S_BBCODE' => $data['bbcode'],
|
|
indvdum@0
|
338 |
'S_SMILIES' => $data['smilies'],
|
|
indvdum@0
|
339 |
'S_SIG' => $data['sig'],
|
|
indvdum@0
|
340 |
'S_NOTIFY' => $data['notify'])
|
|
indvdum@0
|
341 |
);
|
|
indvdum@0
|
342 |
break;
|
|
indvdum@0
|
343 |
}
|
|
indvdum@0
|
344 |
|
|
indvdum@0
|
345 |
$template->assign_vars(array(
|
|
indvdum@0
|
346 |
'L_TITLE' => $user->lang['UCP_PREFS_' . strtoupper($mode)],
|
|
indvdum@0
|
347 |
|
|
indvdum@0
|
348 |
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
|
indvdum@0
|
349 |
'S_UCP_ACTION' => $this->u_action)
|
|
indvdum@0
|
350 |
);
|
|
indvdum@0
|
351 |
|
|
indvdum@0
|
352 |
$this->tpl_name = 'ucp_prefs_' . $mode;
|
|
indvdum@0
|
353 |
$this->page_title = 'UCP_PREFS_' . strtoupper($mode);
|
|
indvdum@0
|
354 |
}
|
|
indvdum@0
|
355 |
}
|
|
indvdum@0
|
356 |
|
|
indvdum@0
|
357 |
?> |