|
1 <?php |
|
2 /*********************************************************************** |
|
3 |
|
4 Copyright (C) 2002-2008 PunBB.org |
|
5 |
|
6 This file is part of PunBB. |
|
7 |
|
8 PunBB is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published |
|
10 by the Free Software Foundation; either version 2 of the License, |
|
11 or (at your option) any later version. |
|
12 |
|
13 PunBB is distributed in the hope that it will be useful, but |
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 GNU General Public License for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with this program; if not, write to the Free Software |
|
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
|
21 MA 02111-1307 USA |
|
22 |
|
23 ************************************************************************/ |
|
24 |
|
25 |
|
26 // if (!defined('PUN_ROOT')) |
|
27 // define('PUN_ROOT', './'); |
|
28 // require PUN_ROOT.'include/common.php'; |
|
29 |
|
30 // import globals (I really hope this isn't dangerous) |
|
31 foreach ( $GLOBALS as $key => $_ ) |
|
32 { |
|
33 $$key =& $GLOBALS[$key]; |
|
34 } |
|
35 |
|
36 ($hook = get_hook('pf_start')) ? eval($hook) : null; |
|
37 |
|
38 $action = isset($_GET['action']) ? $_GET['action'] : null; |
|
39 $section = isset($_GET['section']) ? $_GET['section'] : 'about'; // Default to section "about" |
|
40 $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
41 if ($id < 2) |
|
42 message($lang_common['Bad request']); |
|
43 |
|
44 if ($action != 'change_pass' || !isset($_GET['key'])) |
|
45 { |
|
46 if ($pun_user['g_read_board'] == '0') |
|
47 message($lang_common['No view']); |
|
48 else if ($pun_user['g_view_users'] == '0' && ($pun_user['is_guest'] || $pun_user['id'] != $id)) |
|
49 message($lang_common['No permission']); |
|
50 } |
|
51 |
|
52 // Load the profile.php language file |
|
53 require PUN_ROOT.'lang/'.$pun_user['language'].'/profile.php'; |
|
54 $GLOBALS['lang_profile'] = $lang_profile; |
|
55 |
|
56 // Fetch info about the user whose profile we're viewing |
|
57 $query = array( |
|
58 'SELECT' => 'u.*, eu.username, g.g_id, g.g_user_title, g.g_moderator', |
|
59 'FROM' => $pun_db->prefix . 'users AS u', |
|
60 'JOINS' => array( |
|
61 array( |
|
62 'LEFT JOIN' => $pun_db->prefix . 'groups AS g', |
|
63 'ON' => 'g.g_id=u.group_id' |
|
64 ), |
|
65 array( |
|
66 'LEFT JOIN' => table_prefix . 'users AS eu', |
|
67 'ON' => 'eu.user_id = u.id' |
|
68 ) |
|
69 ), |
|
70 'WHERE' => 'u.id='.$id, |
|
71 'PARAMS' => array( |
|
72 'NO_PREFIX' => '' |
|
73 ) |
|
74 ); |
|
75 |
|
76 ($hook = get_hook('pf_qr_get_user_info')) ? eval($hook) : null; |
|
77 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
78 if (!$pun_db->num_rows($result)) |
|
79 message($lang_common['Bad request']); |
|
80 |
|
81 $user = $pun_db->fetch_assoc($result); |
|
82 |
|
83 |
|
84 if ($action == 'change_pass') |
|
85 { |
|
86 ($hook = get_hook('pf_change_pass_selected')) ? eval($hook) : null; |
|
87 |
|
88 // User pressed the cancel button |
|
89 if (isset($_POST['cancel'])) |
|
90 pun_redirect(pun_link($pun_url['profile_about'], $id), $lang_common['Cancel redirect']); |
|
91 |
|
92 if (isset($_GET['key'])) |
|
93 { |
|
94 // If the user is already logged in we shouldn't be here :) |
|
95 if (!$pun_user['is_guest']) |
|
96 message($lang_profile['Pass logout']); |
|
97 |
|
98 ($hook = get_hook('pf_change_pass_key_supplied')) ? eval($hook) : null; |
|
99 |
|
100 $key = $_GET['key']; |
|
101 |
|
102 if ($key == '' || $key != $user['activate_key']) |
|
103 message(sprintf($lang_profile['Pass key bad'], '<a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>')); |
|
104 else |
|
105 { |
|
106 if (isset($_POST['form_sent'])) |
|
107 { |
|
108 ($hook = get_hook('pf_change_pass_key_form_submitted')) ? eval($hook) : null; |
|
109 |
|
110 $new_password1 = trim($_POST['req_new_password1']); |
|
111 $new_password2 = trim($_POST['req_new_password2']); |
|
112 |
|
113 if ($new_password1 != $new_password2) |
|
114 message($lang_profile['Pass not match']); |
|
115 if (pun_strlen($new_password1) < 4) |
|
116 message($lang_profile['Pass too short']); |
|
117 |
|
118 $new_password_hash = sha1($user['salt'].sha1($new_password1)); |
|
119 |
|
120 $query = array( |
|
121 'UPDATE' => 'users', |
|
122 'SET' => 'password=\''.$new_password_hash.'\', activate_key=NULL', |
|
123 'WHERE' => 'id='.$id |
|
124 ); |
|
125 |
|
126 ($hook = get_hook('pf_qr_update_password')) ? eval($hook) : null; |
|
127 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
128 |
|
129 pun_redirect(pun_link($pun_url['index']), $lang_profile['Pass updated']); |
|
130 } |
|
131 |
|
132 // Setup form |
|
133 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
134 $pun_page['form_action'] = pun_link($pun_url['change_password_key'], array($id, $key)); |
|
135 |
|
136 // Setup breadcrumbs |
|
137 $pun_page['crumbs'] = array( |
|
138 array($pun_config['o_board_title'], pun_link($pun_url['index'])), |
|
139 array(sprintf($lang_profile['Users profile'], htmlspecialchars($user['username']), $lang_profile['Section about']), pun_link($pun_url['profile_about'], $id)), |
|
140 $lang_profile['Change password'] |
|
141 ); |
|
142 |
|
143 ($hook = get_hook('pf_change_pass_key_pre_header_load')) ? eval($hook) : null; |
|
144 |
|
145 define('PUN_PAGE', 'profile-changepass'); |
|
146 require PUN_ROOT.'header.php'; |
|
147 |
|
148 ?> |
|
149 <div id="pun-main" class="main"> |
|
150 |
|
151 <h1><span><?php printf($lang_profile['Users profile'], htmlspecialchars($user['username'])) ?></span></h1> |
|
152 |
|
153 <div class="main-head"> |
|
154 <h2><span><?php echo $lang_profile['Change password'] ?></span></h2> |
|
155 </div> |
|
156 |
|
157 <div class="main-content frm"> |
|
158 <div id="req-msg" class="frm-warn"> |
|
159 <p class="important"><?php printf($lang_common['Required warn'], '<em class="req-text">'.$lang_common['Required'].'</em>') ?></p> |
|
160 </div> |
|
161 <form id="afocus" class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
162 <div class="hidden"> |
|
163 <input type="hidden" name="form_sent" value="1" /> |
|
164 </div> |
|
165 <?php ($hook = get_hook('pf_change_pass_key_pre_fieldset')) ? eval($hook) : null; ?> |
|
166 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
167 <legend class="frm-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend> |
|
168 <div class="frm-fld text required"> |
|
169 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
170 <span class="fld-label"><?php echo $lang_profile['New password'] ?></span><br /> |
|
171 <span class="fld-input"><input type="password" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_new_password1" size="35" /></span><br /> |
|
172 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
173 <span class="fld-help"><?php echo $lang_profile['Password help'] ?></span> |
|
174 </label> |
|
175 </div> |
|
176 <div class="frm-fld text required"> |
|
177 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
178 <span class="fld-label"><?php echo $lang_profile['Confirm new password'] ?></span><br /> |
|
179 <span class="fld-input"><input type="password" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_new_password2" size="35" /></span><br /> |
|
180 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
181 <span class="fld-help"><?php echo $lang_profile['Confirm password help'] ?></span> |
|
182 </label> |
|
183 </div> |
|
184 </fieldset> |
|
185 <?php ($hook = get_hook('pf_change_pass_key_post_fieldset')) ? eval($hook) : null; ?> |
|
186 <div class="frm-buttons"> |
|
187 <span class="submit"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /></span> |
|
188 <span class="cancel"><input type="submit" name="cancel" value="<?php echo $lang_common['Cancel'] ?>" /></span> |
|
189 </div> |
|
190 </form> |
|
191 </div> |
|
192 |
|
193 </div> |
|
194 <?php |
|
195 |
|
196 require PUN_ROOT.'footer.php'; |
|
197 } |
|
198 } |
|
199 |
|
200 // Make sure we are allowed to change this user's password |
|
201 if ($pun_user['id'] != $id && |
|
202 $pun_user['g_id'] != PUN_ADMIN && |
|
203 ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_edit_users'] == '0' || $pun_user['g_mod_change_passwords'] == '0' || $user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1')) |
|
204 message($lang_common['No permission']); |
|
205 |
|
206 if (isset($_POST['form_sent'])) |
|
207 { |
|
208 ($hook = get_hook('pf_change_pass_normal_form_submitted')) ? eval($hook) : null; |
|
209 |
|
210 $old_password = isset($_POST['req_old_password']) ? trim($_POST['req_old_password']) : ''; |
|
211 $new_password1 = trim($_POST['req_new_password1']); |
|
212 $new_password2 = trim($_POST['req_new_password2']); |
|
213 |
|
214 if ($new_password1 != $new_password2) |
|
215 message($lang_profile['Pass not match']); |
|
216 if (pun_strlen($new_password1) < 4) |
|
217 message($lang_profile['Pass too short']); |
|
218 |
|
219 $pun_page['authorized'] = false; |
|
220 if (!empty($user['password'])) |
|
221 { |
|
222 $old_password_hash = sha1($user['salt'].sha1($old_password)); |
|
223 |
|
224 if (($user['password'] == $old_password_hash) || $pun_user['is_admmod']) |
|
225 $authorized = true; |
|
226 } |
|
227 |
|
228 if (!$authorized) |
|
229 message($lang_profile['Wrong old password']); |
|
230 |
|
231 $new_password_hash = sha1($user['salt'].sha1($new_password1)); |
|
232 |
|
233 $query = array( |
|
234 'UPDATE' => 'users', |
|
235 'SET' => 'password=\''.$new_password_hash.'\'', |
|
236 'WHERE' => 'id='.$id |
|
237 ); |
|
238 |
|
239 ($hook = get_hook('pf_qr_update_password2')) ? eval($hook) : null; |
|
240 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
241 |
|
242 if ($pun_user['id'] == $id) |
|
243 { |
|
244 $expire = ($user['save_pass'] == '1') ? time() + 31536000 : 0; |
|
245 pun_setcookie($cookie_name, base64_encode($pun_user['id'].'|'.$new_password_hash), $expire); |
|
246 } |
|
247 |
|
248 pun_redirect(pun_link($pun_url['profile_about'], $id), $lang_profile['Pass updated redirect']); |
|
249 } |
|
250 |
|
251 // Setup form |
|
252 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
253 $pun_page['form_action'] = pun_link($pun_url['change_password'], $id); |
|
254 |
|
255 $pun_page['hidden_fields'][] = '<input type="hidden" name="form_sent" value="1" />'; |
|
256 if ($pun_user['is_admmod']) |
|
257 $pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />'; |
|
258 |
|
259 // Setup breadcrumbs |
|
260 $pun_page['crumbs'] = array( |
|
261 array($pun_config['o_board_title'], pun_link($pun_url['index'])), |
|
262 array(sprintf($lang_profile['Users profile'], htmlspecialchars($user['username']), $lang_profile['Section about']), pun_link($pun_url['profile_about'], $id)), |
|
263 $lang_profile['Change password'] |
|
264 ); |
|
265 |
|
266 ($hook = get_hook('pf_change_pass_normal_pre_header_load')) ? eval($hook) : null; |
|
267 |
|
268 define('PUN_PAGE', 'profile-changepass'); |
|
269 require PUN_ROOT.'header.php'; |
|
270 |
|
271 ?> |
|
272 <div id="pun-main" class="main sectioned"> |
|
273 |
|
274 <h1><span><?php printf($lang_profile['Users profile'], htmlspecialchars($user['username'])) ?></span></h1> |
|
275 |
|
276 <div class="main-head"> |
|
277 <h2><span><?php echo $lang_profile['Change password'] ?></span></h2> |
|
278 </div> |
|
279 |
|
280 <div class="main-content frm"> |
|
281 <div id="req-msg" class="frm-warn"> |
|
282 <p class="important"><?php printf($lang_common['Required warn'], '<em class="req-text">'.$lang_common['Required'].'</em>') ?></p> |
|
283 </div> |
|
284 <form id="afocus" class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
285 <div class="hidden"> |
|
286 <?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?> |
|
287 </div> |
|
288 <?php ($hook = get_hook('pf_change_pass_normal_pre_fieldset')) ? eval($hook) : null; ?> |
|
289 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
290 <legend class="frm-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend> |
|
291 <?php if (!$pun_user['is_admmod']): ?> <div class="frm-fld text required"> |
|
292 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
293 <span class="fld-label"><?php echo $lang_profile['Old password'] ?></span><br /> |
|
294 <span class="fld-input"><input type="password" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_old_password" size="35" /></span><br /> |
|
295 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
296 <span class="fld-help"><?php echo $lang_profile['Old password help'] ?></span> |
|
297 </label> |
|
298 </div> |
|
299 <?php endif; ?> <div class="frm-fld text required"> |
|
300 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
301 <span class="fld-label"><?php echo $lang_profile['New password'] ?></span><br /> |
|
302 <span class="fld-input"><input type="password" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_new_password1" size="35" /></span><br /> |
|
303 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
304 <span class="fld-help"><?php echo $lang_profile['Password help'] ?></span> |
|
305 </label> |
|
306 </div> |
|
307 <div class="frm-fld text required"> |
|
308 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
309 <span class="fld-label"><?php echo $lang_profile['Confirm new password'] ?></span><br /> |
|
310 <span class="fld-input"><input type="password" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_new_password2" size="35" /></span><br /> |
|
311 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
312 <span class="fld-help"><?php echo $lang_profile['Confirm password help'] ?></span> |
|
313 </label> |
|
314 </div> |
|
315 </fieldset> |
|
316 <?php ($hook = get_hook('pf_change_pass_normal_post_fieldset')) ? eval($hook) : null; ?> |
|
317 <div class="frm-buttons"> |
|
318 <span class="submit"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /></span> |
|
319 <span class="cancel"><input type="submit" name="cancel" value="<?php echo $lang_common['Cancel'] ?>" /></span> |
|
320 </div> |
|
321 </form> |
|
322 </div> |
|
323 |
|
324 </div> |
|
325 <?php |
|
326 |
|
327 require PUN_ROOT.'footer.php'; |
|
328 } |
|
329 |
|
330 |
|
331 else if ($action == 'change_email') |
|
332 { |
|
333 // Make sure we are allowed to change this user's e-mail |
|
334 if ($pun_user['id'] != $id && |
|
335 $pun_user['g_id'] != PUN_ADMIN && |
|
336 ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_edit_users'] == '0' || $user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1')) |
|
337 message($lang_common['No permission']); |
|
338 |
|
339 ($hook = get_hook('pf_change_email_selected')) ? eval($hook) : null; |
|
340 |
|
341 // User pressed the cancel button |
|
342 if (isset($_POST['cancel'])) |
|
343 pun_redirect(pun_link($pun_url['profile_about'], $id), $lang_common['Cancel redirect']); |
|
344 |
|
345 if (isset($_GET['key'])) |
|
346 { |
|
347 $key = $_GET['key']; |
|
348 |
|
349 ($hook = get_hook('pf_change_email_key_supplied')) ? eval($hook) : null; |
|
350 |
|
351 if ($key == '' || $key != $user['activate_key']) |
|
352 message(sprintf($lang_profile['E-mail key bad'], '<a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>')); |
|
353 else |
|
354 { |
|
355 $query = array( |
|
356 'UPDATE' => 'users', |
|
357 'SET' => 'email=activate_string, activate_string=NULL, activate_key=NULL', |
|
358 'WHERE' => 'id='.$id |
|
359 ); |
|
360 |
|
361 ($hook = get_hook('pf_qr_update_email')) ? eval($hook) : null; |
|
362 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
363 |
|
364 message($lang_profile['E-mail updated']); |
|
365 } |
|
366 } |
|
367 else if (isset($_POST['form_sent'])) |
|
368 { |
|
369 ($hook = get_hook('pf_change_email_normal_form_submitted')) ? eval($hook) : null; |
|
370 |
|
371 if (sha1($_POST['req_password']) !== $pun_user['password']) |
|
372 message($lang_profile['Wrong password']); |
|
373 |
|
374 require PUN_ROOT.'include/email.php'; |
|
375 |
|
376 // Validate the email-address |
|
377 $new_email = strtolower(trim($_POST['req_new_email'])); |
|
378 if (!is_valid_email($new_email)) |
|
379 message($lang_common['Invalid e-mail']); |
|
380 |
|
381 // Check it it's a banned e-mail address |
|
382 if (is_banned_email($new_email)) |
|
383 { |
|
384 ($hook = get_hook('pf_change_email_normal_banned_email')) ? eval($hook) : null; |
|
385 |
|
386 if ($pun_config['p_allow_banned_email'] == '0') |
|
387 message($lang_profile['Banned e-mail']); |
|
388 else if ($pun_config['o_mailing_list'] != '') |
|
389 { |
|
390 $mail_subject = 'Alert - Banned e-mail detected'; |
|
391 $mail_message = 'User \''.$pun_user['username'].'\' changed to banned e-mail address: '.$new_email."\n\n".'User profile: '.pun_link($pun_url['user'], $id)."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this message)'; |
|
392 |
|
393 pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); |
|
394 } |
|
395 } |
|
396 |
|
397 // Check if someone else already has registered with that e-mail address |
|
398 $query = array( |
|
399 'SELECT' => 'u.id, u.username', |
|
400 'FROM' => 'users AS u', |
|
401 'WHERE' => 'u.email=\''.$pun_db->escape($new_email).'\'' |
|
402 ); |
|
403 |
|
404 ($hook = get_hook('pf_qr_check_email_dupe')) ? eval($hook) : null; |
|
405 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
406 if ($pun_db->num_rows($result)) |
|
407 { |
|
408 ($hook = get_hook('pf_change_email_normal_dupe_email')) ? eval($hook) : null; |
|
409 |
|
410 if ($pun_config['p_allow_dupe_email'] == '0') |
|
411 message($lang_profile['Dupe e-mail']); |
|
412 else if ($pun_config['o_mailing_list'] != '') |
|
413 { |
|
414 while ($cur_dupe = $pun_db->fetch_assoc($result)) |
|
415 $dupe_list[] = $cur_dupe['username']; |
|
416 |
|
417 $mail_subject = 'Alert - Duplicate e-mail detected'; |
|
418 $mail_message = 'User \''.$pun_user['username'].'\' changed to an e-mail address that also belongs to: '.implode(', ', $dupe_list)."\n\n".'User profile: '.pun_link($pun_url['user'], $id)."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this message)'; |
|
419 |
|
420 pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); |
|
421 } |
|
422 } |
|
423 |
|
424 $new_email_key = random_key(8, true); |
|
425 |
|
426 // Save new e-mail and activation key |
|
427 $query = array( |
|
428 'UPDATE' => 'users', |
|
429 'SET' => 'activate_string=\''.$pun_db->escape($new_email).'\', activate_key=\''.$new_email_key.'\'', |
|
430 'WHERE' => 'id='.$id |
|
431 ); |
|
432 |
|
433 ($hook = get_hook('pf_qr_update_email_activation')) ? eval($hook) : null; |
|
434 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
435 |
|
436 // Load the "activate e-mail" template |
|
437 $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl')); |
|
438 |
|
439 // The first row contains the subject |
|
440 $first_crlf = strpos($mail_tpl, "\n"); |
|
441 $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8)); |
|
442 $mail_message = trim(substr($mail_tpl, $first_crlf)); |
|
443 |
|
444 $mail_message = str_replace('<username>', $pun_user['username'], $mail_message); |
|
445 $mail_message = str_replace('<base_url>', $base_url.'/', $mail_message); |
|
446 $mail_message = str_replace('<activation_url>', str_replace('&', '&', pun_link($pun_url['change_email_key'], array($id, $new_email_key))), $mail_message); |
|
447 $mail_message = str_replace('<board_mailer>', sprintf($lang_common['Forum mailer'], $pun_config['o_board_title']), $mail_message); |
|
448 |
|
449 ($hook = get_hook('pf_change_email_normal_pre_activation_email_sent')) ? eval($hook) : null; |
|
450 |
|
451 pun_mail($new_email, $mail_subject, $mail_message); |
|
452 |
|
453 message(sprintf($lang_profile['Activate e-mail sent'], '<a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>')); |
|
454 } |
|
455 |
|
456 // Setup form |
|
457 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
458 $pun_page['form_action'] = pun_link($pun_url['change_email'], $id); |
|
459 |
|
460 $pun_page['hidden_fields'][] = '<input type="hidden" name="form_sent" value="1" />'; |
|
461 if ($pun_user['is_admmod']) |
|
462 $pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />'; |
|
463 |
|
464 // Setup form information |
|
465 $pun_page['frm_info'] = '<p class="important"><span>'.$lang_profile['E-mail info'].'</span></p>'; |
|
466 |
|
467 // Setup breadcrumbs |
|
468 $pun_page['crumbs'] = array( |
|
469 array($pun_config['o_board_title'], pun_link($pun_url['index'])), |
|
470 array(sprintf($lang_profile['Users profile'], htmlspecialchars($user['username']), $lang_profile['Section about']), pun_link($pun_url['profile_about'], $id)), |
|
471 $lang_profile['Change e-mail'] |
|
472 ); |
|
473 |
|
474 ($hook = get_hook('pf_change_email_normal_pre_header_load')) ? eval($hook) : null; |
|
475 |
|
476 define('PUN_PAGE', 'profile-changemail'); |
|
477 require PUN_ROOT.'header.php'; |
|
478 |
|
479 ?> |
|
480 <div id="pun-main" class="main"> |
|
481 |
|
482 <h1><span><?php printf($lang_profile['Users profile'], htmlspecialchars($user['username'])) ?></span></h1> |
|
483 |
|
484 <div class="main-head"> |
|
485 <h2><span><?php echo $lang_profile['Change e-mail'] ?></span></h2> |
|
486 </div> |
|
487 |
|
488 <div class="main-content frm"> |
|
489 <div class="frm-info"> |
|
490 <?php echo $pun_page['frm_info']."\n" ?> |
|
491 </div> |
|
492 <div id="req-msg" class="frm-warn"> |
|
493 <p class="important"><?php printf($lang_common['Required warn'], '<em class="req-text">'.$lang_common['Required'].'</em>') ?></p> |
|
494 </div> |
|
495 <form id="afocus" class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
496 <div class="hidden"> |
|
497 <?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?> |
|
498 </div> |
|
499 <?php ($hook = get_hook('pf_change_email_normal_pre_fieldset')) ? eval($hook) : null; ?> |
|
500 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
501 <legend class="frm-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend> |
|
502 <div class="frm-fld text required"> |
|
503 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
504 <span class="fld-label"><?php echo $lang_profile['New e-mail'] ?></span><br /> |
|
505 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_new_email" size="50" maxlength="80" /></span> |
|
506 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
507 </label> |
|
508 </div> |
|
509 <div class="frm-fld text required"> |
|
510 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
511 <span class="fld-label"><?php echo $lang_profile['Password'] ?></span><br /> |
|
512 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_password" size="25" /></span> |
|
513 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
514 </label> |
|
515 </div> |
|
516 </fieldset> |
|
517 <?php ($hook = get_hook('pf_change_email_normal_post_fieldset')) ? eval($hook) : null; ?> |
|
518 <div class="frm-buttons"> |
|
519 <span class="submit"><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /></span> |
|
520 <span class="cancel"><input type="submit" name="cancel" value="<?php echo $lang_common['Cancel'] ?>" /></span> |
|
521 </div> |
|
522 </form> |
|
523 </div> |
|
524 |
|
525 </div> |
|
526 <?php |
|
527 |
|
528 require PUN_ROOT.'footer.php'; |
|
529 } |
|
530 |
|
531 else if ($action == 'delete_user' || isset($_POST['delete_user_comply']) || isset($_POST['cancel'])) |
|
532 { |
|
533 // User pressed the cancel button |
|
534 if (isset($_POST['cancel'])) |
|
535 pun_redirect(pun_link($pun_url['profile_admin'], $id), $lang_common['Cancel redirect']); |
|
536 |
|
537 ($hook = get_hook('pf_delete_user_selected')) ? eval($hook) : null; |
|
538 |
|
539 if ($pun_user['g_id'] != PUN_ADMIN) |
|
540 message($lang_common['No permission']); |
|
541 |
|
542 if ($user['g_id'] == PUN_ADMIN) |
|
543 message('Administrators cannot be deleted. In order to delete this user, you must first move him/her to a different user group.'); |
|
544 |
|
545 if (isset($_POST['delete_user_comply'])) |
|
546 { |
|
547 ($hook = get_hook('pf_delete_user_form_submitted')) ? eval($hook) : null; |
|
548 |
|
549 delete_user($id); |
|
550 |
|
551 pun_redirect(pun_link($pun_url['index']), $lang_profile['User delete redirect']); |
|
552 } |
|
553 |
|
554 // Setup form |
|
555 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
556 $pun_page['form_action'] = pun_link($pun_url['delete_user'], $id); |
|
557 |
|
558 // Setup form information |
|
559 $pun_page['frm_info'] = array( |
|
560 '<li class="warn"><span>'.$lang_profile['Delete warning'].'</span></li>', |
|
561 '<li class="warn"><span>'.$lang_profile['Delete posts info'].'</span></li>' |
|
562 ); |
|
563 |
|
564 // Setup breadcrumbs |
|
565 $pun_page['crumbs'] = array( |
|
566 array($pun_config['o_board_title'], pun_link($pun_url['index'])), |
|
567 array(sprintf($lang_profile['Users profile'], htmlspecialchars($user['username']), $lang_profile['Section admin']), pun_link($pun_url['profile_admin'], $id)), |
|
568 $lang_profile['Delete user'] |
|
569 ); |
|
570 |
|
571 ($hook = get_hook('pf_delete_user_pre_header_load')) ? eval($hook) : null; |
|
572 |
|
573 define('PUN_PAGE', 'dialogue'); |
|
574 require PUN_ROOT.'header.php'; |
|
575 |
|
576 ?> |
|
577 <div id="pun-main" class="main"> |
|
578 |
|
579 <h1><span><?php printf($lang_profile['Users profile'], htmlspecialchars($user['username'])) ?></span></h1> |
|
580 |
|
581 <div class="main-head"> |
|
582 <h2><span><?php echo $lang_common['Delete'].' '.htmlspecialchars($user['username']) ?></span></h2> |
|
583 </div> |
|
584 |
|
585 <div class="main-content frm"> |
|
586 <div class="frm-info"> |
|
587 <ul> |
|
588 <?php echo implode("\n\t\t\t\t\t", $pun_page['frm_info'])."\n" ?> |
|
589 </ul> |
|
590 </div> |
|
591 <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
592 <div class="hidden"> |
|
593 <input type="hidden" name="csrf_token" value="<?php echo generate_form_token($pun_page['form_action']) ?>" /> |
|
594 </div> |
|
595 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
596 <legend class="frm-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend> |
|
597 <div class="checkbox radbox"> |
|
598 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"><span class="fld-label"><?php echo $lang_profile['Delete posts'] ?></span><br /><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="delete_posts" value="1" checked="checked" /> <?php printf($lang_profile['Delete posts label'], htmlspecialchars($user['username'])) ?></label> |
|
599 </div> |
|
600 </fieldset> |
|
601 <div class="frm-buttons"> |
|
602 <span class="submit"><input type="submit" name="delete_user_comply" value="<?php echo $lang_common['Submit'] ?>" /></span> |
|
603 <span class="cancel"><input type="submit" name="cancel" value="<?php echo $lang_common['Cancel'] ?>" /></span> |
|
604 </div> |
|
605 </form> |
|
606 </div> |
|
607 |
|
608 </div> |
|
609 <?php |
|
610 |
|
611 require PUN_ROOT.'footer.php'; |
|
612 } |
|
613 |
|
614 |
|
615 else if ($action == 'delete_avatar') |
|
616 { |
|
617 // Make sure we are allowed to delete this user's avatar |
|
618 if ($pun_user['id'] != $id && |
|
619 $pun_user['g_id'] != PUN_ADMIN && |
|
620 ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_edit_users'] == '0' || $user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1')) |
|
621 message($lang_common['No permission']); |
|
622 |
|
623 ($hook = get_hook('pf_delete_avatar_selected')) ? eval($hook) : null; |
|
624 |
|
625 if (file_exists($pun_config['o_avatars_dir'].'/'.$id.'.jpg')) |
|
626 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.jpg'); |
|
627 if (file_exists($pun_config['o_avatars_dir'].'/'.$id.'.png')) |
|
628 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.png'); |
|
629 if (file_exists($pun_config['o_avatars_dir'].'/'.$id.'.gif')) |
|
630 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.gif'); |
|
631 |
|
632 pun_redirect(pun_link($pun_url['profile_avatar'], $id), $lang_profile['Avatar deleted redirect']); |
|
633 } |
|
634 |
|
635 |
|
636 else if (isset($_POST['update_group_membership'])) |
|
637 { |
|
638 if ($pun_user['g_id'] != PUN_ADMIN) |
|
639 message($lang_common['No permission']); |
|
640 |
|
641 ($hook = get_hook('pf_change_group_form_submitted')) ? eval($hook) : null; |
|
642 |
|
643 $new_group_id = intval($_POST['group_id']); |
|
644 |
|
645 $query = array( |
|
646 'UPDATE' => 'users', |
|
647 'SET' => 'group_id='.$new_group_id, |
|
648 'WHERE' => 'id='.$id |
|
649 ); |
|
650 |
|
651 ($hook = get_hook('pf_qr_update_group')) ? eval($hook) : null; |
|
652 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
653 |
|
654 $query = array( |
|
655 'SELECT' => 'g.g_moderator', |
|
656 'FROM' => 'groups AS g', |
|
657 'WHERE' => 'g.g_id='.$new_group_id |
|
658 ); |
|
659 |
|
660 ($hook = get_hook('pf_qr_check_new_group_mod')) ? eval($hook) : null; |
|
661 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
662 $new_group_mod = $pun_db->result($result); |
|
663 |
|
664 // If the user was a moderator or an administrator (and no longer is), we remove him/her from the moderator list in all forums |
|
665 if (($user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1') && $new_group_id != PUN_ADMIN && $new_group_mod != '1') |
|
666 clean_forum_moderators(); |
|
667 |
|
668 pun_redirect(pun_link($pun_url['profile_admin'], $id), $lang_profile['Group membership redirect']); |
|
669 } |
|
670 |
|
671 |
|
672 else if (isset($_POST['update_forums'])) |
|
673 { |
|
674 if ($pun_user['g_id'] != PUN_ADMIN) |
|
675 message($lang_common['No permission']); |
|
676 |
|
677 ($hook = get_hook('pf_forum_moderators_form_submitted')) ? eval($hook) : null; |
|
678 |
|
679 $moderator_in = (isset($_POST['moderator_in'])) ? array_keys($_POST['moderator_in']) : array(); |
|
680 |
|
681 // Loop through all forums |
|
682 $query = array( |
|
683 'SELECT' => 'f.id, f.moderators', |
|
684 'FROM' => 'forums AS f' |
|
685 ); |
|
686 |
|
687 ($hook = get_hook('pf_qr_get_all_forum_mods')) ? eval($hook) : null; |
|
688 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
689 while ($cur_forum = $pun_db->fetch_assoc($result)) |
|
690 { |
|
691 $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
|
692 |
|
693 // If the user should have moderator access (and he/she doesn't already have it) |
|
694 if (in_array($cur_forum['id'], $moderator_in) && !in_array($id, $cur_moderators)) |
|
695 { |
|
696 $cur_moderators[$user['username']] = $id; |
|
697 ksort($cur_moderators); |
|
698 } |
|
699 // If the user shouldn't have moderator access (and he/she already has it) |
|
700 else if (!in_array($cur_forum['id'], $moderator_in) && in_array($id, $cur_moderators)) |
|
701 unset($cur_moderators[$user['username']]); |
|
702 |
|
703 $cur_moderators = (!empty($cur_moderators)) ? '\''.$pun_db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
|
704 |
|
705 $query = array( |
|
706 'UPDATE' => 'forums', |
|
707 'SET' => 'moderators='.$cur_moderators, |
|
708 'WHERE' => 'id='.$cur_forum['id'] |
|
709 ); |
|
710 |
|
711 ($hook = get_hook('pf_qr_update_forum_moderators')) ? eval($hook) : null; |
|
712 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
713 } |
|
714 |
|
715 pun_redirect(pun_link($pun_url['profile_admin'], $id), $lang_profile['Update forums redirect']); |
|
716 } |
|
717 |
|
718 |
|
719 else if (isset($_POST['ban'])) |
|
720 { |
|
721 if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
|
722 message($lang_common['No permission']); |
|
723 |
|
724 ($hook = get_hook('pf_ban_user_selected')) ? eval($hook) : null; |
|
725 |
|
726 pun_redirect(pun_link($pun_url['admin_bans']).'&add_ban='.$id, $lang_profile['Ban redirect']); |
|
727 } |
|
728 |
|
729 |
|
730 else if (isset($_POST['form_sent'])) |
|
731 { |
|
732 // Make sure we are allowed to edit this user's profile |
|
733 if ($pun_user['id'] != $id && |
|
734 $pun_user['g_id'] != PUN_ADMIN && |
|
735 ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_edit_users'] == '0' || $user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1')) |
|
736 message($lang_common['No permission']); |
|
737 |
|
738 ($hook = get_hook('pf_change_details_form_submitted')) ? eval($hook) : null; |
|
739 |
|
740 // Extract allowed elements from $_POST['form'] |
|
741 function extract_elements($allowed_elements) |
|
742 { |
|
743 $form = array(); |
|
744 |
|
745 while (list($key, $value) = @each($_POST['form'])) |
|
746 { |
|
747 if (in_array($key, $allowed_elements)) |
|
748 $form[$key] = $value; |
|
749 } |
|
750 |
|
751 return $form; |
|
752 } |
|
753 |
|
754 $username_updated = false; |
|
755 |
|
756 // Validate input depending on section |
|
757 switch ($section) |
|
758 { |
|
759 case 'identity': |
|
760 { |
|
761 $form = extract_elements(array('realname', 'url', 'location', 'jabber', 'icq', 'msn', 'aim', 'yahoo')); |
|
762 |
|
763 ($hook = get_hook('pf_change_details_identity_validation')) ? eval($hook) : null; |
|
764 |
|
765 if ($pun_user['is_admmod']) |
|
766 { |
|
767 // Are we allowed to change usernames? |
|
768 if ($session->user_level >= USER_LEVEL_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_rename_users'] == '1')) |
|
769 { |
|
770 $form['username'] = trim($_POST['req_username']); |
|
771 $old_username = trim($_POST['old_username']); |
|
772 |
|
773 // Validate the new username |
|
774 $errors = validate_username($form['username'], $id); |
|
775 if (!empty($errors)) |
|
776 message(current($errors)); |
|
777 |
|
778 if ($form['username'] != $old_username) |
|
779 $username_updated = true; |
|
780 } |
|
781 |
|
782 // We only allow administrators to update the post count |
|
783 if ($session->user_level >= USER_LEVEL_ADMIN) |
|
784 $form['num_posts'] = intval($_POST['num_posts']); |
|
785 } |
|
786 |
|
787 if ($pun_config['o_regs_verify'] == '0' || $pun_user['is_admmod']) |
|
788 { |
|
789 require PUN_ROOT.'include/email.php'; |
|
790 |
|
791 // Validate the email-address |
|
792 $form['email'] = strtolower(trim($_POST['req_email'])); |
|
793 if (!is_valid_email($form['email'])) |
|
794 message($lang_common['Invalid e-mail']); |
|
795 } |
|
796 |
|
797 if ($pun_user['is_admmod']) |
|
798 $form['admin_note'] = trim($_POST['admin_note']); |
|
799 |
|
800 if ($session->user_level >= USER_LEVEL_ADMIN) |
|
801 $form['title'] = trim($_POST['title']); |
|
802 else if ($pun_user['g_set_title'] == '1') |
|
803 { |
|
804 $form['title'] = trim($_POST['title']); |
|
805 |
|
806 if ($form['title'] != '') |
|
807 { |
|
808 // A list of words that the title may not contain |
|
809 // If the language is English, there will be some duplicates, but it's not the end of the world |
|
810 $forbidden = array('Member', 'Moderator', 'Administrator', 'Banned', 'Guest', $lang_common['Member'], $lang_common['Moderator'], $lang_common['Administrator'], $lang_common['Banned'], $lang_common['Guest']); |
|
811 |
|
812 if (in_array($form['title'], $forbidden)) |
|
813 message($lang_profile['Forbidden title']); |
|
814 } |
|
815 } |
|
816 |
|
817 // Add http:// if the URL doesn't contain it already |
|
818 if ($form['url'] != '' && strpos(strtolower($form['url']), 'http://') !== 0) |
|
819 $form['url'] = 'http://'.$form['url']; |
|
820 |
|
821 // If the ICQ UIN contains anything other than digits it's invalid |
|
822 if ($form['icq'] != '' && !ctype_digit($form['icq'])) |
|
823 message($lang_profile['Bad ICQ']); |
|
824 |
|
825 break; |
|
826 } |
|
827 |
|
828 case 'settings': |
|
829 { |
|
830 $form = extract_elements(array('dst', 'timezone', 'language', 'email_setting', 'save_pass', 'notify_with_post', 'auto_notify', 'time_format', 'date_format', 'disp_topics', 'disp_posts', 'show_smilies', 'show_img', 'show_img_sig', 'show_avatars', 'show_sig', 'style')); |
|
831 |
|
832 ($hook = get_hook('pf_change_details_settings_validation')) ? eval($hook) : null; |
|
833 |
|
834 $form['dst'] = (isset($form['dst'])) ? 1 : 0; |
|
835 $form['time_format'] = (isset($form['time_format'])) ? intval($form['time_format']) : 0; |
|
836 $form['date_format'] = (isset($form['date_format'])) ? intval($form['date_format']) : 0; |
|
837 |
|
838 $form['email_setting'] = intval($form['email_setting']); |
|
839 if ($form['email_setting'] < 0 && $form['email_setting'] > 2) $form['email_setting'] = 1; |
|
840 |
|
841 if (!isset($form['save_pass']) || $form['save_pass'] != '1') $form['save_pass'] = '0'; |
|
842 if (!isset($form['notify_with_post']) || $form['notify_with_post'] != '1') $form['notify_with_post'] = '0'; |
|
843 if (!isset($form['auto_notify']) || $form['auto_notify'] != '1') $form['auto_notify'] = '0'; |
|
844 |
|
845 // If the save_pass setting has changed, we need to set a new cookie with the appropriate expire date |
|
846 if ($pun_user['id'] == $id && $form['save_pass'] != $pun_user['save_pass']) |
|
847 pun_setcookie($cookie_name, base64_encode($id.'|'.$user['password']), ($form['save_pass'] == '1') ? time() + 31536000 : 0); |
|
848 |
|
849 // Make sure we got a valid language string |
|
850 if (isset($form['language'])) |
|
851 { |
|
852 $form['language'] = preg_replace('#[\.\\\/]#', '', $form['language']); |
|
853 if (!file_exists(PUN_ROOT.'lang/'.$form['language'].'/common.php')) |
|
854 message($lang_common['Bad request']); |
|
855 } |
|
856 |
|
857 if ($form['disp_topics'] != '' && intval($form['disp_topics']) < 3) $form['disp_topics'] = 3; |
|
858 if ($form['disp_topics'] != '' && intval($form['disp_topics']) > 75) $form['disp_topics'] = 75; |
|
859 if ($form['disp_posts'] != '' && intval($form['disp_posts']) < 3) $form['disp_posts'] = 3; |
|
860 if ($form['disp_posts'] != '' && intval($form['disp_posts']) > 75) $form['disp_posts'] = 75; |
|
861 |
|
862 if (!isset($form['show_smilies']) || $form['show_smilies'] != '1') $form['show_smilies'] = '0'; |
|
863 if (!isset($form['show_img']) || $form['show_img'] != '1') $form['show_img'] = '0'; |
|
864 if (!isset($form['show_img_sig']) || $form['show_img_sig'] != '1') $form['show_img_sig'] = '0'; |
|
865 if (!isset($form['show_avatars']) || $form['show_avatars'] != '1') $form['show_avatars'] = '0'; |
|
866 if (!isset($form['show_sig']) || $form['show_sig'] != '1') $form['show_sig'] = '0'; |
|
867 |
|
868 // Make sure we got a valid style string |
|
869 if (isset($form['style'])) |
|
870 { |
|
871 $form['style'] = preg_replace('#[\.\\\/]#', '', $form['style']); |
|
872 if (!file_exists(PUN_ROOT.'style/'.$form['style'].'/'.$form['style'].'.css')) |
|
873 message($lang_common['Bad request']); |
|
874 } |
|
875 break; |
|
876 } |
|
877 |
|
878 case 'signature': |
|
879 { |
|
880 if ($pun_config['o_signatures'] == '0') |
|
881 message($lang_profile['Signatures disabled']); |
|
882 |
|
883 ($hook = get_hook('pf_change_details_signature_validation')) ? eval($hook) : null; |
|
884 |
|
885 // Clean up signature from POST |
|
886 $form['signature'] = pun_linebreaks(trim($_POST['signature'])); |
|
887 |
|
888 // Validate signature |
|
889 if (pun_strlen($form['signature']) > $pun_config['p_sig_length']) |
|
890 message(sprintf($lang_profile['Sig too long'], $pun_config['p_sig_length'])); |
|
891 else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines'] - 1)) |
|
892 message(sprintf($lang_profile['Sig too many lines'], $pun_config['p_sig_lines'])); |
|
893 else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && strtoupper($form['signature']) == $form['signature'] && !$pun_user['is_admmod']) |
|
894 $form['signature'] = ucwords(strtolower($form['signature'])); |
|
895 |
|
896 // Validate BBCode syntax |
|
897 if ($pun_config['p_sig_bbcode'] == '1' && strpos($form['signature'], '[') !== false && strpos($form['signature'], ']') !== false) |
|
898 { |
|
899 require PUN_ROOT.'include/parser.php'; |
|
900 $form['signature'] = preparse_bbcode($form['signature'], $foo, true); |
|
901 } |
|
902 |
|
903 break; |
|
904 } |
|
905 |
|
906 case 'avatar': |
|
907 { |
|
908 if ($pun_config['o_avatars'] == '0') |
|
909 message($lang_profile['Avatars disabled']); |
|
910 |
|
911 ($hook = get_hook('pf_change_details_avatar_validation')) ? eval($hook) : null; |
|
912 |
|
913 if (!isset($_FILES['req_file'])) |
|
914 message($lang_profile['No file']); |
|
915 |
|
916 $uploaded_file = $_FILES['req_file']; |
|
917 |
|
918 // Make sure the upload went smooth |
|
919 if (isset($uploaded_file['error'])) |
|
920 { |
|
921 switch ($uploaded_file['error']) |
|
922 { |
|
923 case 1: // UPLOAD_ERR_INI_SIZE |
|
924 case 2: // UPLOAD_ERR_FORM_SIZE |
|
925 message($lang_profile['Too large ini']); |
|
926 break; |
|
927 |
|
928 case 3: // UPLOAD_ERR_PARTIAL |
|
929 message($lang_profile['Partial upload']); |
|
930 break; |
|
931 |
|
932 case 4: // UPLOAD_ERR_NO_FILE |
|
933 message($lang_profile['No file']); |
|
934 break; |
|
935 |
|
936 case 6: // UPLOAD_ERR_NO_TMP_DIR |
|
937 message($lang_profile['No tmp directory']); |
|
938 break; |
|
939 |
|
940 default: |
|
941 // No error occured, but was something actually uploaded? |
|
942 if ($uploaded_file['size'] == 0) |
|
943 message($lang_profile['No file']); |
|
944 break; |
|
945 } |
|
946 } |
|
947 |
|
948 if (is_uploaded_file($uploaded_file['tmp_name'])) |
|
949 { |
|
950 $allowed_types = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'); |
|
951 if (!in_array($uploaded_file['type'], $allowed_types)) |
|
952 message($lang_profile['Bad type']); |
|
953 |
|
954 // Make sure the file isn't too big |
|
955 if ($uploaded_file['size'] > $pun_config['o_avatars_size']) |
|
956 message(sprintf($lang_profile['Too large'], $pun_config['o_avatars_size'])); |
|
957 |
|
958 // Determine type |
|
959 $extensions = null; |
|
960 if ($uploaded_file['type'] == 'image/gif') |
|
961 $extensions = array('.gif', '.jpg', '.png'); |
|
962 else if ($uploaded_file['type'] == 'image/jpeg' || $uploaded_file['type'] == 'image/pjpeg') |
|
963 $extensions = array('.jpg', '.gif', '.png'); |
|
964 else |
|
965 $extensions = array('.png', '.gif', '.jpg'); |
|
966 |
|
967 // Move the file to the avatar directory. We do this before checking the width/height to circumvent open_basedir restrictions. |
|
968 if (!@move_uploaded_file($uploaded_file['tmp_name'], $pun_config['o_avatars_dir'].'/'.$id.'.tmp')) |
|
969 message(sprintf($lang_profile['Move failed'], '<a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>')); |
|
970 |
|
971 // Now check the width/height |
|
972 list($width, $height, $type,) = getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.tmp'); |
|
973 if (empty($width) || empty($height) || $width > $pun_config['o_avatars_width'] || $height > $pun_config['o_avatars_height']) |
|
974 { |
|
975 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp'); |
|
976 message(sprintf($lang_profile['Too wide or high'], $pun_config['o_avatars_width'], $pun_config['o_avatars_height'])); |
|
977 } |
|
978 else if ($type == 1 && $uploaded_file['type'] != 'image/gif') // Prevent dodgy uploads |
|
979 { |
|
980 @unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp'); |
|
981 message($lang_profile['Bad type']); |
|
982 } |
|
983 |
|
984 // Delete any old avatars |
|
985 if (file_exists($pun_config['o_avatars_dir'].'/'.$id.$extensions[0])) |
|
986 @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[0]); |
|
987 if (file_exists($pun_config['o_avatars_dir'].'/'.$id.$extensions[1])) |
|
988 @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[1]); |
|
989 if (file_exists($pun_config['o_avatars_dir'].'/'.$id.$extensions[2])) |
|
990 @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[2]); |
|
991 |
|
992 // Put the new avatar in its place |
|
993 @rename($pun_config['o_avatars_dir'].'/'.$id.'.tmp', $pun_config['o_avatars_dir'].'/'.$id.$extensions[0]); |
|
994 @chmod($pun_config['o_avatars_dir'].'/'.$id.$extensions[0], 0644); |
|
995 } |
|
996 else |
|
997 message($lang_profile['Unknown failure']); |
|
998 |
|
999 break; |
|
1000 } |
|
1001 |
|
1002 default: |
|
1003 { |
|
1004 ($hook = get_hook('pf_change_details_new_section_validation')) ? eval($hook) : null; |
|
1005 break; |
|
1006 } |
|
1007 } |
|
1008 |
|
1009 // All sections apart from avatar potentially affect the database |
|
1010 if ($section != 'avatar') |
|
1011 { |
|
1012 ($hook = get_hook('pf_change_details_database_validation')) ? eval($hook) : null; |
|
1013 |
|
1014 // Singlequotes around non-empty values and NULL for empty values |
|
1015 $temp = array(); |
|
1016 while (list($key, $input) = @each($form)) |
|
1017 { |
|
1018 $value = ($input !== '') ? '\''.$pun_db->escape($input).'\'' : 'NULL'; |
|
1019 |
|
1020 $temp[] = $key.'='.$value; |
|
1021 } |
|
1022 |
|
1023 // Make sure we have something to update |
|
1024 if (empty($temp)) |
|
1025 message($lang_common['Bad request']); |
|
1026 |
|
1027 // Run the update |
|
1028 $query = array( |
|
1029 'UPDATE' => 'users', |
|
1030 'SET' => implode(',', $temp), |
|
1031 'WHERE' => 'id='.$id |
|
1032 ); |
|
1033 |
|
1034 ($hook = get_hook('pf_qr_update_user')) ? eval($hook) : null; |
|
1035 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1036 |
|
1037 // If we changed the username we have to update some stuff |
|
1038 if ($username_updated) |
|
1039 { |
|
1040 ($hook = get_hook('pf_change_details_username_changed')) ? eval($hook) : null; |
|
1041 |
|
1042 $query = array( |
|
1043 'UPDATE' => 'posts', |
|
1044 'SET' => 'poster=\''.$pun_db->escape($form['username']).'\'', |
|
1045 'WHERE' => 'poster_id='.$id |
|
1046 ); |
|
1047 |
|
1048 ($hook = get_hook('pf_qr_update_username1')) ? eval($hook) : null; |
|
1049 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1050 |
|
1051 $query = array( |
|
1052 'UPDATE' => 'topics', |
|
1053 'SET' => 'poster=\''.$pun_db->escape($form['username']).'\'', |
|
1054 'WHERE' => 'poster=\''.$pun_db->escape($old_username).'\'' |
|
1055 ); |
|
1056 |
|
1057 ($hook = get_hook('pf_qr_update_username2')) ? eval($hook) : null; |
|
1058 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1059 |
|
1060 $query = array( |
|
1061 'UPDATE' => 'topics', |
|
1062 'SET' => 'last_poster=\''.$pun_db->escape($form['username']).'\'', |
|
1063 'WHERE' => 'last_poster=\''.$pun_db->escape($old_username).'\'' |
|
1064 ); |
|
1065 |
|
1066 ($hook = get_hook('pf_qr_update_username3')) ? eval($hook) : null; |
|
1067 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1068 |
|
1069 $query = array( |
|
1070 'UPDATE' => 'forums', |
|
1071 'SET' => 'last_poster=\''.$pun_db->escape($form['username']).'\'', |
|
1072 'WHERE' => 'last_poster=\''.$pun_db->escape($old_username).'\'' |
|
1073 ); |
|
1074 |
|
1075 ($hook = get_hook('pf_qr_update_username4')) ? eval($hook) : null; |
|
1076 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1077 |
|
1078 $query = array( |
|
1079 'UPDATE' => 'online', |
|
1080 'SET' => 'ident=\''.$pun_db->escape($form['username']).'\'', |
|
1081 'WHERE' => 'ident=\''.$pun_db->escape($old_username).'\'' |
|
1082 ); |
|
1083 |
|
1084 ($hook = get_hook('pf_qr_update_username5')) ? eval($hook) : null; |
|
1085 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1086 |
|
1087 // If the user is a moderator or an administrator we have to update the moderator lists and bans cache |
|
1088 if ($user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1') |
|
1089 { |
|
1090 $query = array( |
|
1091 'SELECT' => 'f.id, f.moderators', |
|
1092 'FROM' => 'forums AS f' |
|
1093 ); |
|
1094 |
|
1095 ($hook = get_hook('pf_qr_get_all_forum_mods2')) ? eval($hook) : null; |
|
1096 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1097 while ($cur_forum = $pun_db->fetch_assoc($result)) |
|
1098 { |
|
1099 $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
|
1100 |
|
1101 if (in_array($id, $cur_moderators)) |
|
1102 { |
|
1103 unset($cur_moderators[$old_username]); |
|
1104 $cur_moderators[$form['username']] = $id; |
|
1105 ksort($cur_moderators); |
|
1106 |
|
1107 $query = array( |
|
1108 'UPDATE' => 'forums', |
|
1109 'SET' => 'moderators=\''.$pun_db->escape(serialize($cur_moderators)).'\'', |
|
1110 'WHERE' => 'id='.$cur_forum['id'] |
|
1111 ); |
|
1112 |
|
1113 ($hook = get_hook('pf_qr_update_forum_moderators2')) ? eval($hook) : null; |
|
1114 $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
1115 } |
|
1116 } |
|
1117 |
|
1118 // Regenerate the bans cache |
|
1119 require_once PUN_ROOT.'include/cache.php'; |
|
1120 generate_bans_cache(); |
|
1121 } |
|
1122 } |
|
1123 } |
|
1124 |
|
1125 pun_redirect(pun_link($pun_url['profile_'.$section], $id), $lang_profile['Profile redirect']); |
|
1126 } |
|
1127 |
|
1128 |
|
1129 if ($user['signature'] != '') |
|
1130 { |
|
1131 require PUN_ROOT.'include/parser.php'; |
|
1132 $parsed_signature = parse_signature($user['signature']); |
|
1133 } |
|
1134 |
|
1135 |
|
1136 // View or edit? |
|
1137 if ($pun_user['id'] != $id && |
|
1138 $pun_user['g_id'] != PUN_ADMIN && |
|
1139 ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_edit_users'] == '0' || $user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1')) |
|
1140 { |
|
1141 ($hook = get_hook('pf_view_details_selected')) ? eval($hook) : null; |
|
1142 |
|
1143 // Setup user identification |
|
1144 $pun_page['user_ident'] = array(); |
|
1145 |
|
1146 if ($pun_config['o_avatars'] == '1') |
|
1147 { |
|
1148 if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif')) |
|
1149 $pun_page['avatar_format'] = 'gif'; |
|
1150 else if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg')) |
|
1151 $pun_page['avatar_format'] = 'jpg'; |
|
1152 else if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png')) |
|
1153 $pun_page['avatar_format'] = 'png'; |
|
1154 else |
|
1155 $pun_page['avatar_format'] = ''; |
|
1156 |
|
1157 if ($pun_page['avatar_format'] != '') |
|
1158 $pun_page['user_ident'][] = '<img src="'.$base_url.'/'.$pun_config['o_avatars_dir'].'/'.$id.'.'.$pun_page['avatar_format'].'" '.$pun_page['img_size'][3].' alt="'.$lang_profile['Avatar'].'" />'; |
|
1159 } |
|
1160 |
|
1161 $pun_page['user_ident'][] = '<strong class="username'.(($user['realname'] =='') ? ' fn nickname' : ' nickname').'">'.htmlspecialchars($user['username']).'</strong>'; |
|
1162 |
|
1163 // Setup user information |
|
1164 $pun_page['user_info'] = array( |
|
1165 '<li class="title"><span><strong>'.$lang_profile['Title'].'</strong> '.get_title($user).'</span></li>', |
|
1166 '<li><span><strong>'.$lang_profile['From'].'</strong> '.(($user['location'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']).'</span></li>', |
|
1167 '<li><span><strong>'.$lang_profile['Registered'].'</strong> '.format_time($user['registered'], true).'</span></li>' |
|
1168 ); |
|
1169 |
|
1170 if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod']) |
|
1171 $pun_page['user_info'][] = '<li><span><strong>'.$lang_profile['Posts'].'</strong> '.$user['num_posts'].'</span></li>'; |
|
1172 |
|
1173 |
|
1174 // Setup user actions |
|
1175 $pun_page['user_actions'] = array(); |
|
1176 |
|
1177 if ($user['email_setting'] != '2' && !$pun_user['is_guest']) |
|
1178 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['email'], $id).'">'.$lang_common['Send forum e-mail'].'</a></li>'; |
|
1179 |
|
1180 if ($pun_user['g_search'] == '1') |
|
1181 { |
|
1182 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['search_user_posts'], $id).'">'.$lang_profile['Show posts'].'</a></li>'; |
|
1183 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['search_user_topics'], $id).'">'.$lang_profile['Show topics'].'</a></li>'; |
|
1184 } |
|
1185 |
|
1186 // Setup user data |
|
1187 $pun_page['user_data'] = array( |
|
1188 '<li><span'.(($user['realname'] !='') ? ' class="fn"' : '').'><strong>'.$lang_profile['Realname'].'</strong> '.(($user['realname'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['realname']) : $user['realname']) : $lang_profile['Unknown']).'</span></li>', |
|
1189 '<li><span><strong>'.$lang_profile['Last post'].'</strong> '.format_time($user['last_post']).'</span></li>' |
|
1190 ); |
|
1191 |
|
1192 if ($user['email_setting'] == '0' && !$pun_user['is_guest']) |
|
1193 $pun_page['user_data'][] = '<li><strong>'.$lang_profile['E-mail'].'</strong> <span><a href="mailto:'.$user['email'].'" class="email">'.$user['email'].'</a></span></li>'; |
|
1194 else |
|
1195 $pun_page['user_data'][] = '<li><strong>'.$lang_profile['E-mail'].'</strong> <span>'.$lang_profile['Private'].'</span></li>'; |
|
1196 |
|
1197 if ($user['url'] != '') |
|
1198 { |
|
1199 if ($pun_config['o_censoring'] == '1') |
|
1200 $user['url'] = censor_words($user['url']); |
|
1201 |
|
1202 $user['url'] = htmlspecialchars($user['url']); |
|
1203 $pun_page['url'] = '<a href="'.$user['url'].'" class="external url" rel="me">'.$user['url'].'</a>'; |
|
1204 } |
|
1205 else |
|
1206 $pun_page['url'] = $lang_profile['Unknown']; |
|
1207 |
|
1208 array_push( |
|
1209 $pun_page['user_data'], |
|
1210 '<li><span><strong>'.$lang_profile['Website'].'</strong> '.$pun_page['url'].'</span></li>', |
|
1211 '<li><span><strong>'.$lang_profile['Jabber'].'</strong> '.(($user['jabber'] !='') ? htmlspecialchars($user['jabber']) : $lang_profile['Unknown']).'</span></li>', |
|
1212 '<li><span><strong>'.$lang_profile['ICQ'].'</strong> '.(($user['icq'] !='') ? htmlspecialchars($user['icq']) : $lang_profile['Unknown']).'</span></li>', |
|
1213 '<li><span><strong>'.$lang_profile['MSN'].'</strong> '.(($user['msn'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['msn']) : $user['msn']) : $lang_profile['Unknown']).'</span></li>', |
|
1214 '<li><span><strong>'.$lang_profile['AOL IM'].'</strong> '.(($user['aim'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['aim']) : $user['aim']) : $lang_profile['Unknown']).'</span></li>', |
|
1215 '<li><span><strong>'.$lang_profile['Yahoo'].'</strong> '.(($user['yahoo'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']) : $lang_profile['Unknown']).'</span></li>' |
|
1216 ); |
|
1217 |
|
1218 if ($pun_config['o_signatures'] == '1' && isset($parsed_signature)) |
|
1219 $pun_page['sig_demo'] = $parsed_signature; |
|
1220 |
|
1221 // Setup breadcrumbs |
|
1222 $pun_page['crumbs'] = array( |
|
1223 array($pun_config['o_board_title'], pun_link($pun_url['index'])), |
|
1224 sprintf($lang_profile['Users profile'], htmlspecialchars($user['username'])) |
|
1225 ); |
|
1226 |
|
1227 ($hook = get_hook('pf_view_details_pre_header_load')) ? eval($hook) : null; |
|
1228 |
|
1229 define('PUN_ALLOW_INDEX', 1); |
|
1230 define('PUN_PAGE', 'profile'); |
|
1231 require PUN_ROOT.'header.php'; |
|
1232 |
|
1233 ?> |
|
1234 <div id="pun-main" class="main"> |
|
1235 |
|
1236 <h1><span><?php echo end($pun_page['crumbs']) ?></span></h1> |
|
1237 |
|
1238 <div class="main-head"> |
|
1239 <h2><span><?php printf($lang_profile['About settings'], htmlspecialchars($user['username'])) ?></span></h2> |
|
1240 </div> |
|
1241 |
|
1242 <div class="main-content frm"> |
|
1243 <div class="profile vcard"> |
|
1244 <h3><?php echo $lang_profile['User information'] ?></h3> |
|
1245 <div class="user"> |
|
1246 <h4 class="user-ident"><?php echo implode(' ', $pun_page['user_ident']) ?></h4> |
|
1247 <ul class="user-info"> |
|
1248 <?php echo implode("\n\t\t\t\t\t\t", $pun_page['user_info'])."\n" ?> |
|
1249 </ul> |
|
1250 </div> |
|
1251 <?php ($hook = get_hook('pf_view_details_pre_user_data')) ? eval($hook) : null; ?> |
|
1252 <ul class="user-data"> |
|
1253 <?php echo implode("\n\t\t\t\t\t\t", $pun_page['user_data'])."\n" ?> |
|
1254 </ul> |
|
1255 <h3><?php echo $lang_profile['User actions'] ?></h3> |
|
1256 <?php if (!empty($pun_page['user_actions'])): ?> <ul class="user-actions"> |
|
1257 <?php echo implode("\n\t\t\t\t", $pun_page['user_actions'])."\n" ?> |
|
1258 </ul> |
|
1259 <?php endif; if (isset($pun_page['sig_demo'])): ?> <h3><?php echo $lang_profile['Preview signature'] ?></h3> |
|
1260 <div class="sig-demo"> |
|
1261 <?php echo $pun_page['sig_demo']."\n" ?> |
|
1262 </div> |
|
1263 <?php endif; ?> </div> |
|
1264 <?php ($hook = get_hook('pf_view_details_end')) ? eval($hook) : null; ?> |
|
1265 </div> |
|
1266 |
|
1267 </div> |
|
1268 <?php |
|
1269 |
|
1270 require PUN_ROOT.'footer.php'; |
|
1271 } |
|
1272 |
|
1273 |
|
1274 else |
|
1275 { |
|
1276 // Setup breadcrumbs |
|
1277 $pun_page['crumbs'] = array( |
|
1278 array($pun_config['o_board_title'], pun_link($pun_url['index'])), |
|
1279 sprintf($lang_profile['Users profile'], htmlspecialchars($user['username'])) |
|
1280 ); |
|
1281 |
|
1282 if ($section == 'about') |
|
1283 { |
|
1284 // Setup user identification |
|
1285 $pun_page['user_ident'] = array(); |
|
1286 |
|
1287 if ($pun_config['o_avatars'] == '1') |
|
1288 { |
|
1289 if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif')) |
|
1290 $pun_page['avatar_format'] = 'gif'; |
|
1291 else if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg')) |
|
1292 $pun_page['avatar_format'] = 'jpg'; |
|
1293 else if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png')) |
|
1294 $pun_page['avatar_format'] = 'png'; |
|
1295 else |
|
1296 $pun_page['avatar_format'] = ''; |
|
1297 |
|
1298 if ($pun_page['avatar_format'] != '') |
|
1299 $pun_page['user_ident'][] = '<img src="'.$base_url.'/'.$pun_config['o_avatars_dir'].'/'.$id.'.'.$pun_page['avatar_format'].'" '.$pun_page['img_size'][3].' alt="'.$lang_profile['Avatar'].'" />'; |
|
1300 } |
|
1301 |
|
1302 $pun_page['user_ident'][] = '<strong class="username'.(($user['realname'] =='') ? ' fn nickname' : ' nickname').'">'.htmlspecialchars($user['username']).'</strong>'; |
|
1303 |
|
1304 // Setup user information |
|
1305 $pun_page['user_info'] = array( |
|
1306 '<li class="title"><span><strong>'.$lang_profile['Title'].'</strong> '.get_title($user).'</span></li>', |
|
1307 '<li><span><strong>'.$lang_profile['From'].'</strong> '.(($user['location'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']).'</span></li>', |
|
1308 '<li><span><strong>'.$lang_profile['Registered'].'</strong> '.format_time($user['registered'], true).'</span></li>' |
|
1309 ); |
|
1310 |
|
1311 if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod']) |
|
1312 $pun_page['user_info'][] = '<li><span><strong>'.$lang_profile['Posts'].'</strong> '.$user['num_posts'].'</span></li>'; |
|
1313 |
|
1314 if ($pun_user['is_admmod']) |
|
1315 $pun_page['user_info'][]= '<li><span><strong>'.$lang_profile['IP'].'</strong> <a href="'.pun_link($pun_url['get_host'], htmlspecialchars($user['registration_ip'])).'">'.htmlspecialchars($user['registration_ip']).'</a></span></li>'; |
|
1316 |
|
1317 if ($pun_user['is_admmod'] && $user['admin_note'] != '') |
|
1318 $pun_page['user_info'][] = '<li><span><strong>'.$lang_profile['Note'].'</strong> '.htmlspecialchars($user['admin_note']).'</span></li>'; |
|
1319 |
|
1320 |
|
1321 // Setup user actions |
|
1322 $pun_page['user_actions'] = array(); |
|
1323 |
|
1324 if ($pun_user['id'] == $id || $session->user_level >= USER_LEVEL_ADMIN || ($pun_user['g_moderator'] == '1' && $pun_user['g_mod_change_passwords'] == '1')) |
|
1325 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['change_password'], $id).'">'.$lang_profile['Change password'].'</a></li>'; |
|
1326 |
|
1327 if (!$pun_user['is_admmod'] && $pun_config['o_regs_verify'] == '1') |
|
1328 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['change_email'], $id).'">'.$lang_profile['Change e-mail'].'</a></li>'; |
|
1329 |
|
1330 if ($user['email_setting'] != '2' || $pun_user['is_admmod']) |
|
1331 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['email'], $id).'">'.$lang_profile['Send forum e-mail'].'</a></li>'; |
|
1332 |
|
1333 if ($pun_user['g_search'] == '1' || $pun_user['is_admmod']) |
|
1334 { |
|
1335 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['search_user_posts'], $id).'">'.$lang_profile['Show posts'].'</a></li>'; |
|
1336 $pun_page['user_actions'][] = '<li><a href="'.pun_link($pun_url['search_user_topics'], $id).'">'.$lang_profile['Show topics'].'</a></li>'; |
|
1337 } |
|
1338 |
|
1339 |
|
1340 // Setup user data |
|
1341 $pun_page['user_data'] = array( |
|
1342 '<li><strong>'.$lang_profile['Realname'].'</strong> <span'.(($user['realname'] !='') ? ' class="fn"' : '').'>'.(($user['realname'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['realname']) : $user['realname']) : $lang_profile['Unknown']).'</span></li>', |
|
1343 '<li><strong>'.$lang_profile['Last post'].'</strong> <span>'.format_time($user['last_post']).'</span></li>' |
|
1344 ); |
|
1345 |
|
1346 if ($user['email_setting'] == '0' && !$pun_user['is_guest']) |
|
1347 $pun_page['user_data'][] = '<li><strong>'.$lang_profile['E-mail'].'</strong> <a href="mailto:'.$user['email'].'" class="email"><span>'.$user['email'].'</span></a></li>'; |
|
1348 else |
|
1349 $pun_page['user_data'][] = '<li><strong>'.$lang_profile['E-mail'].'</strong> <span>'.$lang_profile['Private'].'</span></li>'; |
|
1350 |
|
1351 if ($user['url'] != '') |
|
1352 { |
|
1353 $user['url'] = htmlspecialchars($user['url']); |
|
1354 |
|
1355 if ($pun_config['o_censoring'] == '1') |
|
1356 $user['url'] = censor_words($user['url']); |
|
1357 |
|
1358 $pun_page['url'] = '<a href="'.$user['url'].'" class="external url" rel="me">'.$user['url'].'</a>'; |
|
1359 } |
|
1360 else |
|
1361 $pun_page['url'] = $lang_profile['Unknown']; |
|
1362 |
|
1363 array_push( |
|
1364 $pun_page['user_data'], |
|
1365 '<li><span><strong>'.$lang_profile['Website'].'</strong> '.$pun_page['url'].'</span></li>', |
|
1366 '<li><span><strong>'.$lang_profile['Jabber'].'</strong> '.(($user['jabber'] !='') ? htmlspecialchars($user['jabber']) : $lang_profile['Unknown']).'</span></li>', |
|
1367 '<li><span><strong>'.$lang_profile['ICQ'].'</strong> '.(($user['icq'] !='') ? htmlspecialchars($user['icq']) : $lang_profile['Unknown']).'</span></li>', |
|
1368 '<li><span><strong>'.$lang_profile['MSN'].'</strong> '.(($user['msn'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['msn']) : $user['msn']) : $lang_profile['Unknown']).'</span></li>', |
|
1369 '<li><span><strong>'.$lang_profile['AOL IM'].'</strong> '.(($user['aim'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['aim']) : $user['aim']) : $lang_profile['Unknown']).'</span></li>', |
|
1370 '<li><span><strong>'.$lang_profile['Yahoo'].'</strong> '.(($user['yahoo'] !='') ? htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']) : $lang_profile['Unknown']).'</span></li>' |
|
1371 ); |
|
1372 |
|
1373 if ($pun_config['o_signatures'] == '1' && isset($parsed_signature)) |
|
1374 $pun_page['sig_demo'] = $parsed_signature; |
|
1375 |
|
1376 ($hook = get_hook('pf_change_details_about_pre_header_load')) ? eval($hook) : null; |
|
1377 |
|
1378 define('PUN_PAGE', 'profile-about'); |
|
1379 require PUN_ROOT.'header.php'; |
|
1380 |
|
1381 ?> |
|
1382 <div id="pun-main" class="main sectioned"> |
|
1383 |
|
1384 <h1><span><?php echo end($pun_page['crumbs']) ?></span></h1> |
|
1385 |
|
1386 <?php generate_profile_menu(); ?> |
|
1387 |
|
1388 <div class="main-head"> |
|
1389 <h2><span><?php printf($lang_profile['About settings'], htmlspecialchars($user['username'])) ?></span></h2> |
|
1390 </div> |
|
1391 |
|
1392 <div class="main-content frm"> |
|
1393 <?php if ($id == $pun_user['id']): ?> <div class="frm-info"> |
|
1394 <p><?php echo $lang_profile['Profile welcome'] ?></p> |
|
1395 </div> |
|
1396 <?php endif; ($hook = get_hook('pf_change_details_about_pre_user_info')) ? eval($hook) : null; ?> |
|
1397 <div class="profile vcard"> |
|
1398 <h3><?php echo $lang_profile['Preview profile'] ?></h3> |
|
1399 <div class="user"> |
|
1400 <h4 class="user-ident"><?php echo implode(' ', $pun_page['user_ident']) ?></h4> |
|
1401 <ul class="user-info"> |
|
1402 <?php echo implode("\n\t\t\t\t\t", $pun_page['user_info'])."\n" ?> |
|
1403 </ul> |
|
1404 </div> |
|
1405 <ul class="user-data"> |
|
1406 <?php echo implode("\n\t\t\t\t", $pun_page['user_data'])."\n" ?> |
|
1407 </ul> |
|
1408 <h3><?php echo $lang_profile['User actions'] ?></h3> |
|
1409 <?php if (!empty($pun_page['user_actions'])): ?> <ul class="user-actions"> |
|
1410 <?php echo implode("\n\t\t\t\t", $pun_page['user_actions'])."\n" ?> |
|
1411 </ul> |
|
1412 <?php endif; if (isset($pun_page['sig_demo'])): ?> <h3><?php echo $lang_profile['Preview signature'] ?></h3> |
|
1413 <div class="sig-demo"> |
|
1414 <?php echo $pun_page['sig_demo']."\n" ?> |
|
1415 </div> |
|
1416 <?php endif; ?> </div> |
|
1417 <?php ($hook = get_hook('pf_change_details_about_end')) ? eval($hook) : null; ?> |
|
1418 </div> |
|
1419 </div> |
|
1420 <?php |
|
1421 |
|
1422 require PUN_ROOT.'footer.php'; |
|
1423 } |
|
1424 |
|
1425 else if ($section == 'identity') |
|
1426 { |
|
1427 // Setup the form |
|
1428 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
1429 $pun_page['form_action'] = pun_link($pun_url['profile_identity'], $id); |
|
1430 |
|
1431 $pun_page['hidden_fields'][] = '<input type="hidden" name="form_sent" value="1" />'; |
|
1432 if ($pun_user['is_admmod']) |
|
1433 $pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />'; |
|
1434 if ($pun_user['is_admmod'] && ($session->user_level >= USER_LEVEL_ADMIN || $pun_user['g_mod_rename_users'] == '1')) |
|
1435 $pun_page['hidden_fields'][] = '<input type="hidden" name="old_username" value="'.htmlspecialchars($user['username']).'" />'; |
|
1436 |
|
1437 // Does the form have required fields |
|
1438 $pun_page['has_required'] = ((($pun_user['is_admmod'] && ($session->user_level >= USER_LEVEL_ADMIN || $pun_user['g_mod_rename_users'] == '1')) || ($pun_user['is_admmod'] || $pun_config['o_regs_verify'] != '1')) ? true : false); |
|
1439 |
|
1440 ($hook = get_hook('pf_change_details_identity_pre_header_load')) ? eval($hook) : null; |
|
1441 |
|
1442 define('PUN_PAGE', 'profile-identity'); |
|
1443 require PUN_ROOT.'header.php'; |
|
1444 |
|
1445 ?> |
|
1446 <div id="pun-main" class="main sectioned"> |
|
1447 |
|
1448 <h1><span><?php echo end($pun_page['crumbs']) ?></span></h1> |
|
1449 |
|
1450 <?php generate_profile_menu(); ?> |
|
1451 |
|
1452 <div class="main-head"> |
|
1453 <h2><span><span><?php echo $lang_profile['Section identity'] ?>:</span> <?php printf($lang_profile['Identity settings'], strtolower($lang_profile['Section identity'])) ?></span></h2> |
|
1454 </div> |
|
1455 |
|
1456 <div class="main-content frm"> |
|
1457 <?php if ($pun_page['has_required']): ?> <div id="req-msg" class="frm-warn"> |
|
1458 <p class="important"><?php printf($lang_common['Required warn'], '<em class="req-text">'.$lang_common['Required'].'</em>') ?></p> |
|
1459 </div> |
|
1460 <?php endif; ?> <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
1461 <div class="hidden"> |
|
1462 <?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?> |
|
1463 </div> |
|
1464 <?php if ($pun_page['has_required']): ?> <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1465 <legend class="frm-legend"><strong><?php echo $lang_common['Required information'] ?></strong></legend> |
|
1466 <?php if ($pun_user['is_admmod'] && ($session->user_level >= USER_LEVEL_ADMIN || $pun_user['g_mod_rename_users'] == '1')): ?> |
|
1467 <div class="frm-fld text required"> |
|
1468 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1469 <span class="fld-label"><?php echo $lang_profile['Username'] ?></span><br /> |
|
1470 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_username" value="<?php echo htmlspecialchars($user['username']) ?>" size="35" maxlength="25" /></span><br /> |
|
1471 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
1472 <span class="fld-help"><?php echo $lang_profile['Username help'] ?></span> |
|
1473 </label> |
|
1474 </div> |
|
1475 <?php endif; if ($pun_user['is_admmod'] || $pun_config['o_regs_verify'] != '1'): ?> <div class="frm-fld text required"> |
|
1476 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1477 <span class="fld-label"><?php echo $lang_profile['E-mail'] ?></span><br /> |
|
1478 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="req_email" value="<?php echo $user['email'] ?>" size="35" maxlength="80" /></span> |
|
1479 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
1480 </label> |
|
1481 </div> |
|
1482 <?php endif; ($hook = get_hook('pf_change_details_identity_req_info_end')) ? eval($hook) : null; ?> </fieldset> |
|
1483 <?php endif; ($hook = get_hook('pf_change_details_identity_post_req_info_fieldset')) ? eval($hook) : null; ?> <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1484 <legend class="frm-legend"><strong><?php echo $lang_profile['Personal legend'] ?></strong></legend> |
|
1485 <div class="frm-fld text"> |
|
1486 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1487 <span class="fld-label"><?php echo $lang_profile['Realname'] ?></span><br /> |
|
1488 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[realname]" value="<?php echo htmlspecialchars($user['realname']) ?>" size="35" maxlength="40" /></span> |
|
1489 </label> |
|
1490 </div> |
|
1491 <?php if ($pun_user['g_set_title'] == '1'): ?> <div class="frm-fld text"> |
|
1492 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1493 <span class="fld-label"><?php echo $lang_profile['Title'] ?></span><br /> |
|
1494 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="title" value="<?php echo htmlspecialchars($user['title']) ?>" size="35" maxlength="50" /></span><br /> |
|
1495 <span class="fld-help"><?php echo $lang_profile['Leave blank'] ?></span> |
|
1496 </label> |
|
1497 </div> |
|
1498 <?php endif; ?> <div class="frm-fld text"> |
|
1499 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1500 <span class="fld-label"><?php echo $lang_profile['Location'] ?></span><br /> |
|
1501 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[location]" value="<?php echo htmlspecialchars($user['location']) ?>" size="35" maxlength="30" /></span> |
|
1502 </label> |
|
1503 </div> |
|
1504 <?php if ($session->user_level >= USER_LEVEL_ADMIN): ?> <div class="frm-fld text"> |
|
1505 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1506 <span class="fld-label"><?php echo $lang_profile['Edit count'] ?></span><br /> |
|
1507 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="num_posts" value="<?php echo $user['num_posts'] ?>" size="8" maxlength="8" /></span> |
|
1508 </label> |
|
1509 </div> |
|
1510 <?php endif; if ($pun_user['is_admmod']): ?> <div class="frm-fld text"> |
|
1511 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1512 <span class="fld-label"><?php echo $lang_profile['Admin note'] ?></span><br /> |
|
1513 <span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="admin_note" value="<?php echo htmlspecialchars($user['admin_note']) ?>" size="35" maxlength="30" /></span> |
|
1514 </label> |
|
1515 </div> |
|
1516 <?php endif; ($hook = get_hook('pf_change_details_identity_personal_end')) ? eval($hook) : null; ?> </fieldset> |
|
1517 <?php ($hook = get_hook('pf_change_details_identity_post_personal_fieldset')) ? eval($hook) : null; ?> <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1518 <legend class="frm-legend"><strong><?php echo $lang_profile['Contact legend'] ?></strong></legend> |
|
1519 <div class="frm-fld text"> |
|
1520 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1521 <span class="fld-label"><?php echo $lang_profile['Website'] ?></span><br /> |
|
1522 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[url]" value="<?php echo htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /></span> |
|
1523 </label> |
|
1524 </div> |
|
1525 <div class="frm-fld text"> |
|
1526 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1527 <span class="fld-label"><?php echo $lang_profile['Jabber'] ?></span><br /> |
|
1528 <span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="form[jabber]" value="<?php echo htmlspecialchars($user['jabber']) ?>" size="40" maxlength="80" /></span> |
|
1529 </label> |
|
1530 </div> |
|
1531 <div class="frm-fld text"> |
|
1532 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1533 <span class="fld-label"><?php echo $lang_profile['ICQ'] ?></span><br /> |
|
1534 <span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="form[icq]" value="<?php echo $user['icq'] ?>" size="12" maxlength="12" /></span> |
|
1535 </label> |
|
1536 </div> |
|
1537 <div class="frm-fld text"> |
|
1538 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1539 <span class="fld-label"><?php echo $lang_profile['MSN'] ?></span><br /> |
|
1540 <span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="form[msn]" value="<?php echo htmlspecialchars($user['msn']) ?>" size="40" maxlength="80" /></span> |
|
1541 </label> |
|
1542 </div> |
|
1543 <div class="frm-fld text"> |
|
1544 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1545 <span class="fld-label"><?php echo $lang_profile['AOL IM'] ?></span><br /> |
|
1546 <span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="form[aim]" value="<?php echo htmlspecialchars($user['aim']) ?>" size="20" maxlength="30" /></span> |
|
1547 </label> |
|
1548 </div> |
|
1549 <div class="frm-fld text"> |
|
1550 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1551 <span class="fld-label"><?php echo $lang_profile['Yahoo'] ?></span><br /> |
|
1552 <span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" type="text" name="form[yahoo]" value="<?php echo htmlspecialchars($user['yahoo']) ?>" size="20" maxlength="30" /></span> |
|
1553 </label> |
|
1554 </div> |
|
1555 <?php ($hook = get_hook('pf_change_details_identity_contact_end')) ? eval($hook) : null; ?> |
|
1556 </fieldset> |
|
1557 <?php ($hook = get_hook('pf_change_details_identity_post_contact_fieldset')) ? eval($hook) : null; ?> |
|
1558 <div class="frm-buttons"> |
|
1559 <span class="submit"><input type="submit" name="update" value="<?php echo $lang_profile['Update profile'] ?>" /> <?php echo $lang_profile['Instructions'] ?></span> |
|
1560 </div> |
|
1561 </form> |
|
1562 </div> |
|
1563 |
|
1564 </div> |
|
1565 <?php |
|
1566 |
|
1567 require PUN_ROOT.'footer.php'; |
|
1568 } |
|
1569 |
|
1570 else if ($section == 'settings') |
|
1571 { |
|
1572 $pun_page['styles'] = array(); |
|
1573 $pun_page['d'] = dir(PUN_ROOT.'style'); |
|
1574 while (($pun_page['entry'] = $pun_page['d']->read()) !== false) |
|
1575 { |
|
1576 if ($pun_page['entry'] != '.' && $pun_page['entry'] != '..' && is_dir(PUN_ROOT.'style/'.$pun_page['entry']) && file_exists(PUN_ROOT.'style/'.$pun_page['entry'].'/'.$pun_page['entry'].'.css')) |
|
1577 $pun_page['styles'][] = $pun_page['entry']; |
|
1578 } |
|
1579 $pun_page['d']->close(); |
|
1580 |
|
1581 // Setup the form |
|
1582 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
1583 $pun_page['form_action'] = pun_link($pun_url['profile_settings'], $id); |
|
1584 |
|
1585 $pun_page['hidden_fields'][] = '<input type="hidden" name="form_sent" value="1" />'; |
|
1586 if ($pun_user['is_admmod']) |
|
1587 $pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />'; |
|
1588 |
|
1589 ($hook = get_hook('pf_change_details_settings_pre_header_load')) ? eval($hook) : null; |
|
1590 |
|
1591 define('PUN_PAGE', 'profile-settings'); |
|
1592 require PUN_ROOT.'header.php'; |
|
1593 |
|
1594 ?> |
|
1595 <div id="pun-main" class="main sectioned"> |
|
1596 |
|
1597 <h1 class="pun main-title"><span><?php echo end($pun_page['crumbs']) ?></span></h1> |
|
1598 |
|
1599 <?php generate_profile_menu(); ?> |
|
1600 |
|
1601 <div class="main-head"> |
|
1602 <h2><span><span><?php echo $lang_profile['Section settings'] ?>:</span> <?php printf($lang_profile['Settings settings'], strtolower($lang_profile['Section settings'])) ?></span></h2> |
|
1603 </div> |
|
1604 |
|
1605 <div class="main-content frm"> |
|
1606 <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
1607 <div class="hidden"> |
|
1608 <?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?> |
|
1609 </div> |
|
1610 <?php ($hook = get_hook('pf_change_details_settings_pre_local_fieldset')) ? eval($hook) : null; ?> |
|
1611 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1612 <legend class="frm-legend"><strong><?php echo $lang_profile['Local legend'] ?></strong></legend> |
|
1613 <?php |
|
1614 |
|
1615 $pun_page['languages'] = array(); |
|
1616 $pun_page['d'] = dir(PUN_ROOT.'lang'); |
|
1617 while (($pun_page['entry'] = $pun_page['d']->read()) !== false) |
|
1618 { |
|
1619 if ($pun_page['entry'] != '.' && $pun_page['entry'] != '..' && is_dir(PUN_ROOT.'lang/'.$pun_page['entry']) && file_exists(PUN_ROOT.'lang/'.$pun_page['entry'].'/common.php')) |
|
1620 $pun_page['languages'][] = $pun_page['entry']; |
|
1621 } |
|
1622 $pun_page['d']->close(); |
|
1623 |
|
1624 // Only display the language selection box if there's more than one language available |
|
1625 if (count($pun_page['languages']) > 1) |
|
1626 { |
|
1627 natcasesort($pun_page['languages']); |
|
1628 |
|
1629 ?> |
|
1630 <div class="frm-fld select"> |
|
1631 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1632 <span class="fld-label"><?php echo $lang_profile['Language'] ?></span><br /> |
|
1633 <span class="fld-input"><select id="fld<?php echo $pun_page['fld_count'] ?>" name="form[language]"> |
|
1634 <?php |
|
1635 |
|
1636 while (list(, $temp) = @each($pun_page['languages'])) |
|
1637 { |
|
1638 if ($pun_user['language'] == $temp) |
|
1639 echo "\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n"; |
|
1640 else |
|
1641 echo "\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n"; |
|
1642 } |
|
1643 |
|
1644 ?> |
|
1645 </select></span> |
|
1646 </label> |
|
1647 </div> |
|
1648 <?php |
|
1649 |
|
1650 } |
|
1651 |
|
1652 ?> |
|
1653 <div class="frm-fld select"> |
|
1654 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1655 <span class="fld-label"><?php echo $lang_profile['Timezone'] ?></span><br /> |
|
1656 <span class="fld-input"><select id="fld<?php echo $pun_page['fld_count'] ?>" name="form[timezone]"> |
|
1657 <option value="-12"<?php if ($user['timezone'] == -12) echo ' selected="selected"' ?>>-12</option> |
|
1658 <option value="-11"<?php if ($user['timezone'] == -11) echo ' selected="selected"' ?>>-11</option> |
|
1659 <option value="-10"<?php if ($user['timezone'] == -10) echo ' selected="selected"' ?>>-10</option> |
|
1660 <option value="-9.5"<?php if ($user['timezone'] == -9.5) echo ' selected="selected"' ?>>-09.5</option> |
|
1661 <option value="-9"<?php if ($user['timezone'] == -9) echo ' selected="selected"' ?>>-09</option> |
|
1662 <option value="-8.5"<?php if ($user['timezone'] == -8.5) echo ' selected="selected"' ?>>-08.5</option> |
|
1663 <option value="-8"<?php if ($user['timezone'] == -8) echo ' selected="selected"' ?>>-08 PST</option> |
|
1664 <option value="-7"<?php if ($user['timezone'] == -7) echo ' selected="selected"' ?>>-07 MST</option> |
|
1665 <option value="-6"<?php if ($user['timezone'] == -6) echo ' selected="selected"' ?>>-06 CST</option> |
|
1666 <option value="-5"<?php if ($user['timezone'] == -5) echo ' selected="selected"' ?>>-05 EST</option> |
|
1667 <option value="-4"<?php if ($user['timezone'] == -4) echo ' selected="selected"' ?>>-04 AST</option> |
|
1668 <option value="-3.5"<?php if ($user['timezone'] == -3.5) echo ' selected="selected"' ?>>-03.5</option> |
|
1669 <option value="-3"<?php if ($user['timezone'] == -3) echo ' selected="selected"' ?>>-03 ADT</option> |
|
1670 <option value="-2"<?php if ($user['timezone'] == -2) echo ' selected="selected"' ?>>-02</option> |
|
1671 <option value="-1"<?php if ($user['timezone'] == -1) echo ' selected="selected"' ?>>-01</option> |
|
1672 <option value="0"<?php if ($user['timezone'] == 0) echo ' selected="selected"' ?>>00 GMT</option> |
|
1673 <option value="1"<?php if ($user['timezone'] == 1) echo ' selected="selected"' ?>>+01 CET</option> |
|
1674 <option value="2"<?php if ($user['timezone'] == 2) echo ' selected="selected"' ?>>+02</option> |
|
1675 <option value="3"<?php if ($user['timezone'] == 3) echo ' selected="selected"' ?>>+03</option> |
|
1676 <option value="3.5"<?php if ($user['timezone'] == 3.5) echo ' selected="selected"' ?>>+03.5</option> |
|
1677 <option value="4"<?php if ($user['timezone'] == 4) echo ' selected="selected"' ?>>+04</option> |
|
1678 <option value="4.5"<?php if ($user['timezone'] == 4.5) echo ' selected="selected"' ?>>+04.5</option> |
|
1679 <option value="5"<?php if ($user['timezone'] == 5) echo ' selected="selected"' ?>>+05</option> |
|
1680 <option value="5.5"<?php if ($user['timezone'] == 5.5) echo ' selected="selected"' ?>>+05.5</option> |
|
1681 <option value="6"<?php if ($user['timezone'] == 6) echo ' selected="selected"' ?>>+06</option> |
|
1682 <option value="6.5"<?php if ($user['timezone'] == 6.5) echo ' selected="selected"' ?>>+06.5</option> |
|
1683 <option value="7"<?php if ($user['timezone'] == 7) echo ' selected="selected"' ?>>+07</option> |
|
1684 <option value="8"<?php if ($user['timezone'] == 8) echo ' selected="selected"' ?>>+08</option> |
|
1685 <option value="9"<?php if ($user['timezone'] == 9) echo ' selected="selected"' ?>>+09</option> |
|
1686 <option value="9.5"<?php if ($user['timezone'] == 9.5) echo ' selected="selected"' ?>>+09.5</option> |
|
1687 <option value="10"<?php if ($user['timezone'] == 10) echo ' selected="selected"' ?>>+10</option> |
|
1688 <option value="10.5"<?php if ($user['timezone'] == 10.5) echo ' selected="selected"' ?>>+10.5</option> |
|
1689 <option value="11"<?php if ($user['timezone'] == 11) echo ' selected="selected"' ?>>+11</option> |
|
1690 <option value="11.5"<?php if ($user['timezone'] == 11.5) echo ' selected="selected"' ?>>+11.5</option> |
|
1691 <option value="12"<?php if ($user['timezone'] == 12) echo ' selected="selected"' ?>>+12</option> |
|
1692 <option value="13"<?php if ($user['timezone'] == 13) echo ' selected="selected"' ?>>+13</option> |
|
1693 <option value="14"<?php if ($user['timezone'] == 14) echo ' selected="selected"' ?>>+14</option> |
|
1694 </select></span><br /> |
|
1695 <span class="fld-extra"><?php echo $lang_profile['Timezone info'] ?></span> |
|
1696 </label> |
|
1697 </div> |
|
1698 <div class="checkbox radbox"> |
|
1699 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"><span class="fld-label"><?php echo $lang_profile['Adjust for DST'] ?></span><br /><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[dst]" value="1" <?php if ($user['dst'] == 1) echo ' checked="checked"' ?> /> <?php echo $lang_profile['DST label'] ?></label> |
|
1700 </div> |
|
1701 <div class="frm-fld select"> |
|
1702 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1703 <span class="fld-label"><?php echo $lang_profile['Time format'] ?></span><br /> |
|
1704 <span class="fld-input"><select id="fld<?php echo $pun_page['fld_count'] ?>" name="form[time_format]"> |
|
1705 <?php |
|
1706 |
|
1707 foreach (array_unique($pun_time_formats) as $key => $time_format) |
|
1708 { |
|
1709 echo "\t\t\t\t\t\t".'<option value="'.$key.'"'; |
|
1710 if ($user['time_format'] == $key) |
|
1711 echo ' selected="selected"'; |
|
1712 echo '>'. gmdate($time_format); |
|
1713 if ($key == 0) |
|
1714 echo ' ('.$lang_profile['Default'].')'; |
|
1715 echo "</option>\n"; |
|
1716 } |
|
1717 |
|
1718 ?> |
|
1719 </select></span> |
|
1720 </label> |
|
1721 </div> |
|
1722 <div class="frm-fld select"> |
|
1723 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1724 <span class="fld-label"><?php echo $lang_profile['Date format'] ?></span><br /> |
|
1725 <span class="fld-input"><select id="fld<?php echo $pun_page['fld_count'] ?>" name="form[date_format]"> |
|
1726 <?php |
|
1727 |
|
1728 foreach (array_unique($pun_date_formats) as $key => $date_format) |
|
1729 { |
|
1730 echo "\t\t\t\t\t\t\t".'<option value="'.$key.'"'; |
|
1731 if ($user['date_format'] == $key) |
|
1732 echo ' selected="selected"'; |
|
1733 echo '>'. gmdate($date_format); |
|
1734 if ($key == 0) |
|
1735 echo ' ('.$lang_profile['Default'].')'; |
|
1736 echo "</option>\n"; |
|
1737 } |
|
1738 |
|
1739 ?> |
|
1740 </select></span> |
|
1741 </label> |
|
1742 </div> |
|
1743 <?php ($hook = get_hook('pf_change_details_settings_local_end')) ? eval($hook) : null; ?> |
|
1744 </fieldset> |
|
1745 <?php ($hook = get_hook('pf_change_details_settings_pre_display_fieldset')) ? eval($hook) : null; ?> |
|
1746 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1747 <legend class="frm-legend"><strong><?php echo $lang_profile['Display settings'] ?></strong></legend> |
|
1748 <?php |
|
1749 |
|
1750 // Only display the style selection box if there's more than one style available |
|
1751 if (count($pun_page['styles']) == 1) |
|
1752 echo "\t\t\t\t".'<input type="hidden" name="form[style]" value="'.$pun_page['styles'][0].'" />'."\n"; |
|
1753 else if (count($pun_page['styles']) > 1) |
|
1754 { |
|
1755 natcasesort($pun_page['styles']); |
|
1756 |
|
1757 ?> |
|
1758 <div class="frm-fld select"> |
|
1759 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1760 <span class="fld-label"><?php echo $lang_profile['Styles'] ?></span><br /> |
|
1761 <span class="fld-input"><select id="fld<?php echo $pun_page['fld_count'] ?>" name="form[style]"> |
|
1762 <?php |
|
1763 |
|
1764 while (list(, $temp) = @each($pun_page['styles'])) |
|
1765 { |
|
1766 if ($user['style'] == $temp) |
|
1767 echo "\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n"; |
|
1768 else |
|
1769 echo "\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n"; |
|
1770 } |
|
1771 |
|
1772 ?> |
|
1773 </select></span> |
|
1774 </label> |
|
1775 </div> |
|
1776 <?php |
|
1777 |
|
1778 } |
|
1779 |
|
1780 ?> |
|
1781 <fieldset class="frm-group"> |
|
1782 <legend><span><?php echo $lang_profile['Image display'] ?></span></legend> |
|
1783 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[show_smilies]" value="1"<?php if ($user['show_smilies'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Show smilies'] ?></label></div> |
|
1784 <?php if ($pun_config['o_avatars'] == '1'): ?> <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[show_avatars]" value="1"<?php if ($user['show_avatars'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Show avatars'] ?></label></div> |
|
1785 <?php endif; ?> <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[show_img]" value="1"<?php if ($user['show_img'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Show images'] ?></label></div> |
|
1786 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[show_img_sig]" value="1"<?php if ($user['show_img_sig'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Show images sigs'] ?></label></div> |
|
1787 </fieldset> |
|
1788 <?php if ($pun_config['o_signatures'] == '1'): ?> <fieldset class="frm-group"> |
|
1789 <legend><span><?php echo $lang_profile['Signature display'] ?></span></legend> |
|
1790 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[show_sig]" value="1"<?php if ($user['show_sig'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Show sigs'] ?></label></div> |
|
1791 </fieldset> |
|
1792 <?php ($hook = get_hook('pf_change_details_settings_display_end')) ? eval($hook) : null; ?> |
|
1793 <?php endif; ?> </fieldset> |
|
1794 <?php ($hook = get_hook('pf_change_details_settings_pre_pagination_fieldset')) ? eval($hook) : null; ?> |
|
1795 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1796 <legend class="frm-legend"><strong><?php echo $lang_profile['Pagination settings'] ?></strong></legend> |
|
1797 <div class="frm-fld text"> |
|
1798 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1799 <span class="fld-label"><?php echo $lang_profile['Topics per page'] ?></span><br /> |
|
1800 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[disp_topics]" value="<?php echo $user['disp_topics'] ?>" size="6" maxlength="3" /></span> |
|
1801 <span class="fld-extra"><?php echo $lang_profile['Leave blank'] ?></span> |
|
1802 </label> |
|
1803 </div> |
|
1804 <div class="frm-fld text"> |
|
1805 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1806 <span class="fld-label"><?php echo $lang_profile['Posts per page'] ?></span><br /> |
|
1807 <span class="fld-input"><input type="text" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[disp_posts]" value="<?php echo $user['disp_posts'] ?>" size="6" maxlength="3" /></span> |
|
1808 <span class="fld-extra"><?php echo $lang_profile['Leave blank'] ?></span> |
|
1809 </label> |
|
1810 </div> |
|
1811 <?php ($hook = get_hook('pf_change_details_settings_pagination_end')) ? eval($hook) : null; ?> |
|
1812 </fieldset> |
|
1813 <?php ($hook = get_hook('pf_change_details_settings_pre_other_fieldset')) ? eval($hook) : null; ?> |
|
1814 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1815 <legend class="frm-legend"><strong><?php echo $lang_profile['Other settings'] ?></strong></legend> |
|
1816 <fieldset class="frm-group"> |
|
1817 <legend><span><?php echo $lang_profile['E-mail settings'] ?></span></legend> |
|
1818 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="radio" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[email_setting]" value="0"<?php if ($user['email_setting'] == '0') echo ' checked="checked"' ?> /> <?php echo $lang_profile['E-mail setting 1'] ?></label></div> |
|
1819 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="radio" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[email_setting]" value="1"<?php if ($user['email_setting'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['E-mail setting 2'] ?></label></div> |
|
1820 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="radio" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[email_setting]" value="2"<?php if ($user['email_setting'] == '2') echo ' checked="checked"' ?> /> <?php echo $lang_profile['E-mail setting 3'] ?></label></div> |
|
1821 </fieldset> |
|
1822 <fieldset class="frm-group"> |
|
1823 <legend><span><?php echo $lang_profile['Subscription settings'] ?></span></legend> |
|
1824 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[notify_with_post]" value="1"<?php if ($user['notify_with_post'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Notify full'] ?></label></div> |
|
1825 <div class="radbox"><label for="fld<?php echo ++$pun_page['fld_count'] ?>"><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[auto_notify]" value="1"<?php if ($user['auto_notify'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Subscribe by default'] ?></label></div> |
|
1826 </fieldset> |
|
1827 <div class="checkbox radbox"> |
|
1828 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"><span class="fld-label"><?php echo $lang_profile['Persistent login'] ?></span><br /><input type="checkbox" id="fld<?php echo $pun_page['fld_count'] ?>" name="form[save_pass]" value="1"<?php if ($user['save_pass'] == '1') echo ' checked="checked"' ?> /> <?php echo $lang_profile['Save user/pass'] ?></label> |
|
1829 </div> |
|
1830 <?php ($hook = get_hook('pf_change_details_settings_other_end')) ? eval($hook) : null; ?> |
|
1831 </fieldset> |
|
1832 <?php ($hook = get_hook('pf_change_details_settings_post_other_fieldset')) ? eval($hook) : null; ?> |
|
1833 <div class="frm-buttons"> |
|
1834 <span class="submit"><input type="submit" name="update" value="<?php echo $lang_profile['Update profile'] ?>" /> <?php echo $lang_profile['Instructions'] ?></span> |
|
1835 </div> |
|
1836 </form> |
|
1837 </div> |
|
1838 |
|
1839 </div> |
|
1840 <?php |
|
1841 |
|
1842 require PUN_ROOT.'footer.php'; |
|
1843 } |
|
1844 |
|
1845 else if ($section == 'signature') |
|
1846 { |
|
1847 $pun_page['sig_info'][] = '<li>'.$lang_profile['Signature info'].'</li>'; |
|
1848 |
|
1849 if ($user['signature'] != '') |
|
1850 $pun_page['sig_demo'] = $parsed_signature; |
|
1851 |
|
1852 // Setup the form |
|
1853 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
1854 $pun_page['form_action'] = pun_link($pun_url['profile_signature'], $id); |
|
1855 |
|
1856 $pun_page['hidden_fields'][] = '<input type="hidden" name="form_sent" value="1" />'; |
|
1857 if ($pun_user['is_admmod']) |
|
1858 $pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />'; |
|
1859 |
|
1860 // Setup help |
|
1861 $pun_page['main_head_options'] = array(); |
|
1862 if ($pun_config['p_message_bbcode'] == '1') |
|
1863 $pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'bbcode').'" title="'.sprintf($lang_common['Help page'], $lang_common['BBCode']).'"><span>'.$lang_common['BBCode'].'</span></a>'; |
|
1864 if ($pun_config['p_message_img_tag'] == '1') |
|
1865 $pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'img').'" title="'.sprintf($lang_common['Help page'], $lang_common['Images']).'"><span>'.$lang_common['Images'].'</span></a>'; |
|
1866 if ($pun_config['o_smilies'] == '1') |
|
1867 $pun_page['main_head_options'][] = '<a class="exthelp" href="'.pun_link($pun_url['help'], 'smilies').'" title="'.sprintf($lang_common['Help page'], $lang_common['Smilies']).'"><span>'.$lang_common['Smilies'].'</span></a>'; |
|
1868 |
|
1869 ($hook = get_hook('pf_change_details_signature_pre_header_load')) ? eval($hook) : null; |
|
1870 |
|
1871 define('PUN_PAGE', 'profile-signature'); |
|
1872 require PUN_ROOT.'header.php'; |
|
1873 |
|
1874 ?> |
|
1875 <div id="pun-main" class="main sectioned"> |
|
1876 |
|
1877 <h1><span><?php echo end($pun_page['crumbs']) ?></span></h1> |
|
1878 |
|
1879 <?php generate_profile_menu(); ?> |
|
1880 |
|
1881 <div class="main-head"> |
|
1882 <h2><span><span><?php echo $lang_profile['Section signature'] ?>:</span> <?php printf($lang_profile['Sig settings'], strtolower($lang_profile['Section signature'])) ?></span></h2> |
|
1883 <?php if (!empty($pun_page['main_head_options'])) echo "\t\t\t".'<p class="main-options">'.sprintf($lang_common['You may use'], implode(' ', $pun_page['main_head_options'])).'</p>'."\n" ?> |
|
1884 </div> |
|
1885 |
|
1886 <div class="main-content frm"> |
|
1887 <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
1888 <div class="hidden"> |
|
1889 <?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?> |
|
1890 </div> |
|
1891 <?php ($hook = get_hook('pf_change_details_signature_pre_fieldset')) ? eval($hook) : null; ?> |
|
1892 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1893 <legend class="frm-legend"><strong><?php echo $lang_profile['Signature'] ?></strong></legend> |
|
1894 <?php ($hook = get_hook('pf_change_details_signature_fieldset_start')) ? eval($hook) : null; ?> |
|
1895 <div class="frm-fld text textarea"> |
|
1896 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1897 <span class="fld-label"><?php echo $lang_profile['Compose signature'] ?></span><br /> |
|
1898 <span class="fld-input"> |
|
1899 <textarea id="fld<?php echo $pun_page['fld_count'] ?>" name="signature" rows="4" cols="65"><?php echo htmlspecialchars($user['signature']) ?></textarea></span><br /> |
|
1900 <span class="fld-help"><?php printf($lang_profile['Sig max size'], $pun_config['p_sig_length'], $pun_config['p_sig_lines']) ?></span> |
|
1901 </label> |
|
1902 </div> |
|
1903 </fieldset> |
|
1904 <?php if (isset($pun_page['sig_demo'])): ?> <div class="sig-demo"> |
|
1905 <?php echo $pun_page['sig_demo']."\n" ?> |
|
1906 </div> |
|
1907 <?php endif; ($hook = get_hook('pf_change_details_signature_pre_buttons')) ? eval($hook) : null; ?> <div class="frm-buttons"> |
|
1908 <span class="submit"><input type="submit" name="update" value="<?php echo $lang_profile['Update profile'] ?>" /> <?php echo $lang_profile['Instructions'] ?></span> |
|
1909 </div> |
|
1910 </form> |
|
1911 </div> |
|
1912 |
|
1913 </div> |
|
1914 <?php |
|
1915 |
|
1916 require PUN_ROOT.'footer.php'; |
|
1917 } |
|
1918 |
|
1919 else if ($section == 'avatar' && $pun_config['o_avatars'] == '1') |
|
1920 { |
|
1921 if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif')) |
|
1922 $pun_page['avatar_format'] = 'gif'; |
|
1923 else if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg')) |
|
1924 $pun_page['avatar_format'] = 'jpg'; |
|
1925 else if ($pun_page['img_size'] = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png')) |
|
1926 $pun_page['avatar_format'] = 'png'; |
|
1927 else |
|
1928 $pun_page['avatar_format'] = ''; |
|
1929 |
|
1930 // Setup the form |
|
1931 $pun_page['set_count'] = $pun_page['fld_count'] = 0; |
|
1932 $pun_page['form_action'] = pun_link($pun_url['profile_avatar'], $id); |
|
1933 |
|
1934 $pun_page['hidden_fields'] = array( |
|
1935 '<input type="hidden" name="form_sent" value="1" />', |
|
1936 '<input type="hidden" name="MAX_FILE_SIZE" value="'.$pun_config['o_avatars_size'].'" />' |
|
1937 ); |
|
1938 if ($pun_user['is_admmod']) |
|
1939 $pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />'; |
|
1940 |
|
1941 // Setup form information |
|
1942 $pun_page['frm_info'] = array(); |
|
1943 |
|
1944 if ($pun_page['avatar_format'] != '') |
|
1945 { |
|
1946 $pun_page['frm_info'][] = '<li><span>'.$lang_profile['Avatar info change'].'</span></li>'; |
|
1947 $pun_page['frm_info'][] = '<li><span>'.$lang_profile['Avatar info type'].'</span></li>'; |
|
1948 $pun_page['frm_info'][] = '<li><span>'.sprintf($lang_profile['Avatar info size'], $pun_config['o_avatars_width'], $pun_config['o_avatars_height'], $pun_config['o_avatars_size'], ceil($pun_config['o_avatars_size'] / 1024)).'</span></li>'; |
|
1949 $pun_page['avatar_demo'] = '<img src="'.$base_url.'/'.$pun_config['o_avatars_dir'].'/'.$id.'.'.$pun_page['avatar_format'].'" '.$pun_page['img_size'][3].' alt="'.$lang_profile['Avatar'].'" />'; |
|
1950 } |
|
1951 else |
|
1952 { |
|
1953 $pun_page['frm_info'][] = '<li><span>'.$lang_profile['Avatar info none'].'</span></li>'; |
|
1954 $pun_page['frm_info'][] = '<li><span>'.sprintf($lang_profile['Avatar info size'], $pun_config['o_avatars_width'], $pun_config['o_avatars_height'], $pun_config['o_avatars_size'], ceil($pun_config['o_avatars_size'] / 1024)).'</span></li>'; |
|
1955 } |
|
1956 |
|
1957 ($hook = get_hook('pf_change_details_avatar_pre_header_load')) ? eval($hook) : null; |
|
1958 |
|
1959 define('PUN_PAGE', 'profile-avatar'); |
|
1960 require PUN_ROOT.'header.php'; |
|
1961 |
|
1962 ?> |
|
1963 <div id="pun-main" class="main sectioned"> |
|
1964 |
|
1965 <h1><span><?php echo end($pun_page['crumbs']) ?></span></h1> |
|
1966 |
|
1967 <?php generate_profile_menu(); ?> |
|
1968 |
|
1969 <div class="main-head"> |
|
1970 <h2><span><span><?php echo $lang_profile['Section avatar'] ?>:</span> <?php printf($lang_profile['Avatar settings'], strtolower($lang_profile['Section avatar'])) ?></span></h2> |
|
1971 </div> |
|
1972 |
|
1973 <div class="main-content frm"> |
|
1974 <div class="frm-info<?php echo ($pun_page['avatar_format'] != '') ? ' av-preview' : '' ?>"> |
|
1975 <?php echo (isset($pun_page['avatar_demo'])) ? $pun_page['avatar_demo']."\n" : ''."\n" ?> |
|
1976 <ul> |
|
1977 <?php echo implode("\n\t\t\t\t", $pun_page['frm_info'])."\n\t\t\t" ?> |
|
1978 </ul> |
|
1979 </div> |
|
1980 <div id="req-msg" class="frm-warn"> |
|
1981 <p class="important"><?php printf($lang_common['Required warn'], '<em class="req-text">'.$lang_common['Required'].'</em>') ?></p> |
|
1982 </div> |
|
1983 <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>" enctype="multipart/form-data"> |
|
1984 <div class="hidden"> |
|
1985 <?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?> |
|
1986 </div> |
|
1987 <?php if ($pun_page['avatar_format'] != ''): ?> <div class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1988 <p class="frm-fld link"><span class="fld-label"><a href="<?php echo pun_link($pun_url['delete_avatar'], $id) ?>"><?php echo $lang_profile['Delete avatar'] ?></a>:</span> <span class="fm-input"><?php echo $lang_profile['Avatar info remove'] ?></span></p> |
|
1989 </div> |
|
1990 <?php endif; ?> <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
1991 <legend class="frm-legend"><strong><?php echo $lang_profile['Avatar'] ?></strong></legend> |
|
1992 <?php ($hook = get_hook('pf_change_details_avatar_fieldset_start')) ? eval($hook) : null; ?> |
|
1993 <div class="frm-fld text required"> |
|
1994 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
1995 <span class="fld-label"><?php echo $lang_profile['Upload avatar file'] ?></span><br /> |
|
1996 <span class="fld-input"><input id="fld<?php echo $pun_page['fld_count'] ?>" name="req_file" type="file" size="40" /></span> |
|
1997 <em class="req-text"><?php echo $lang_common['Required'] ?></em> |
|
1998 </label> |
|
1999 </div> |
|
2000 <?php ($hook = get_hook('pf_change_details_avatar_fieldset_end')) ? eval($hook) : null; ?> |
|
2001 </fieldset> |
|
2002 <?php ($hook = get_hook('pf_change_details_avatar_post_fieldset')) ? eval($hook) : null; ?> |
|
2003 <div class="frm-buttons"> |
|
2004 <span class="submit"><input type="submit" name="update" value="<?php echo $lang_profile['Update profile'] ?>" /> <?php echo $lang_profile['Instructions'] ?></span> |
|
2005 </div> |
|
2006 </form> |
|
2007 </div> |
|
2008 |
|
2009 </div> |
|
2010 <?php |
|
2011 |
|
2012 require PUN_ROOT.'footer.php'; |
|
2013 } |
|
2014 |
|
2015 else if ($section == 'admin') |
|
2016 { |
|
2017 if ($pun_user['g_id'] != PUN_ADMIN && ($pun_user['g_moderator'] != '1' || $pun_user['g_mod_ban_users'] == '0')) |
|
2018 message($lang_common['Bad request']); |
|
2019 |
|
2020 $pun_page['user_actions'] = array(); |
|
2021 $pun_page['user_management'] = array(); |
|
2022 |
|
2023 if ($pun_user['g_moderator'] == '1') |
|
2024 { |
|
2025 $pun_page['user_actions'][] = '<li class="frm-fld link"><span class="fld-label"><a href="'.pun_link($pun_url['admin_bans']).'&add_ban='.$id.'">'.$lang_profile['Ban user'].'</a>:</span> <span class="fld-input">'.$lang_profile['Ban user info'].'</span></li>'; |
|
2026 $pun_page['user_management'][] = '<li><span>'.$lang_profile['Manage ban'].'</span></li>'; |
|
2027 } |
|
2028 else if ($pun_user['g_moderator'] != '1' && $user['g_id'] != PUN_ADMIN ) |
|
2029 { |
|
2030 $pun_page['user_actions'][] = '<li class="frm-fld link"><span class="fld-label"><a href="'.pun_link($pun_url['admin_bans']).'&add_ban='.$id.'">'.$lang_profile['Ban user'].'</a>:</span> <span class="fld-input">'.$lang_profile['Ban user info'].'</span></li>'; |
|
2031 $pun_page['user_actions'][] = '<li class="frm-fld link"><span class="fld-label"><a href="'.pun_link($pun_url['delete_user'], $id).'">'.$lang_profile['Delete user'].'</a>:</span> <span class="fld-input">'.$lang_profile['Delete user info'].'</span></li>'; |
|
2032 $pun_page['user_management'][] = '<li><span>'.$lang_profile['Manage ban'].'</span></li>'; |
|
2033 $pun_page['user_management'][] = '<li><span>'.$lang_profile['Manage delete'].'</span></li>'; |
|
2034 } |
|
2035 |
|
2036 if ($pun_user['g_moderator'] != '1' && $pun_user['id'] != $id && $user['g_id'] == PUN_ADMIN ) |
|
2037 $pun_page['user_management'][] = '<li><span>'.$lang_profile['Manage groups'].'</span></li>'; |
|
2038 |
|
2039 // Setup form |
|
2040 $pun_page['fld_count'] = $pun_page['set_count'] = 0; |
|
2041 $pun_page['form_action'] = pun_link($pun_url['profile_admin'], $id); |
|
2042 |
|
2043 $pun_page['hidden_fields'][] = '<input type="hidden" name="form_sent" value="1" />'; |
|
2044 if ($pun_user['is_admmod']) |
|
2045 $pun_page['hidden_fields'][] = '<input type="hidden" name="csrf_token" value="'.generate_form_token($pun_page['form_action']).'" />'; |
|
2046 |
|
2047 ($hook = get_hook('pf_change_details_admin_pre_header_load')) ? eval($hook) : null; |
|
2048 |
|
2049 define('PUN_PAGE', 'profile-admin'); |
|
2050 require PUN_ROOT.'header.php'; |
|
2051 |
|
2052 ?> |
|
2053 <div id="pun-main" class="main sectioned"> |
|
2054 |
|
2055 <h1><span><?php echo end($pun_page['crumbs']) ?></span></h1> |
|
2056 |
|
2057 <?php generate_profile_menu(); ?> |
|
2058 |
|
2059 <div class="main-head"> |
|
2060 <h2><span><span><?php echo $lang_profile['Section admin'] ?>:</span> <?php printf($lang_profile['Admin settings'], strtolower($lang_profile['Section admin'])) ?></span></h2> |
|
2061 </div> |
|
2062 |
|
2063 <div class="main-content frm"> |
|
2064 <?php if (!empty($pun_page['user_management'])): ?> <div class="frm-info"> |
|
2065 <h3><?php echo $lang_profile['User management'] ?></h3> |
|
2066 <ul> |
|
2067 <?php echo implode("\n\t\t\t\t", $pun_page['user_management'])."\n" ?> |
|
2068 </ul> |
|
2069 </div> |
|
2070 <?php endif; ?> <form class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $pun_page['form_action'] ?>"> |
|
2071 <div class="hidden"> |
|
2072 <?php echo implode("\n\t\t\t\t", $pun_page['hidden_fields'])."\n" ?> |
|
2073 </div> |
|
2074 <?php if (!empty($pun_page['user_actions'])): ?> <ul class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
2075 <?php echo implode("\n\t\t\t\t", $pun_page['user_actions'])."\n" ?> |
|
2076 </ul> |
|
2077 <?php endif; |
|
2078 |
|
2079 ($hook = get_hook('pf_change_details_admin_pre_group_membership')) ? eval($hook) : null; |
|
2080 |
|
2081 if ($pun_user['g_moderator'] != '1') |
|
2082 { |
|
2083 if ($pun_user['id'] != $id) |
|
2084 { |
|
2085 |
|
2086 ?> |
|
2087 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
2088 <legend class="frm-legend"><strong><?php echo $lang_profile['Group membership'] ?></strong></legend> |
|
2089 <div class="frm-fld select"> |
|
2090 <label for="fld<?php echo ++$pun_page['fld_count'] ?>"> |
|
2091 <span class="fld-label"><?php echo $lang_profile['User group'] ?></span><br /> |
|
2092 <span class="fld-input"><select id="fld<?php echo $pun_page['fld_count'] ?>" name="group_id"> |
|
2093 <?php |
|
2094 |
|
2095 $query = array( |
|
2096 'SELECT' => 'g.g_id, g.g_title', |
|
2097 'FROM' => 'groups AS g', |
|
2098 'WHERE' => 'g.g_id!='.PUN_GUEST, |
|
2099 'ORDER BY' => 'g.g_title' |
|
2100 ); |
|
2101 |
|
2102 ($hook = get_hook('pf_qr_get_groups')) ? eval($hook) : null; |
|
2103 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
2104 while ($cur_group = $pun_db->fetch_assoc($result)) |
|
2105 { |
|
2106 if ($cur_group['g_id'] == $user['g_id'] || ($cur_group['g_id'] == $pun_config['o_default_user_group'] && $user['g_id'] == '')) |
|
2107 echo "\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.htmlspecialchars($cur_group['g_title']).'</option>'."\n"; |
|
2108 else |
|
2109 echo "\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.htmlspecialchars($cur_group['g_title']).'</option>'."\n"; |
|
2110 } |
|
2111 |
|
2112 ?> |
|
2113 </select></span> |
|
2114 </label> |
|
2115 <input type="submit" name="update_group_membership" value="<?php echo $lang_profile['Save'] ?>" /> |
|
2116 </div> |
|
2117 </fieldset> |
|
2118 <?php if ($user['g_id'] != PUN_ADMIN && $user['g_moderator'] != '1'): ?> <div class="frm-buttons"> |
|
2119 <span><?php echo $lang_profile['Instructions'] ?></span> |
|
2120 </div> |
|
2121 <?php endif; |
|
2122 |
|
2123 } |
|
2124 |
|
2125 if ($user['g_id'] == PUN_ADMIN || $user['g_moderator'] == '1') |
|
2126 { |
|
2127 $pun_page['set_count'] = 0; |
|
2128 |
|
2129 ?> |
|
2130 <div class="frm-info"> |
|
2131 <h3><?php echo $lang_profile['Moderator assignment'] ?></h3> |
|
2132 <ul> |
|
2133 <li><span><?php echo $lang_profile['Moderator in info'] ?></span></li> |
|
2134 <li><span><?php echo $lang_profile['Moderator in info 2'] ?></span></li> |
|
2135 </ul> |
|
2136 </div> |
|
2137 <fieldset class="frm-set set<?php echo ++$pun_page['set_count'] ?>"> |
|
2138 <?php |
|
2139 |
|
2140 $query = array( |
|
2141 'SELECT' => 'c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.moderators', |
|
2142 'FROM' => 'categories AS c', |
|
2143 'JOINS' => array( |
|
2144 array( |
|
2145 'INNER JOIN' => 'forums AS f', |
|
2146 'ON' => 'c.id=f.cat_id' |
|
2147 ) |
|
2148 ), |
|
2149 'WHERE' => 'f.redirect_url IS NULL', |
|
2150 'ORDER BY' => 'c.disp_position, c.id, f.disp_position' |
|
2151 ); |
|
2152 |
|
2153 ($hook = get_hook('pf_qr_get_cats_and_forums')) ? eval($hook) : null; |
|
2154 $result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
2155 |
|
2156 $cur_category = 0; |
|
2157 while ($cur_forum = $pun_db->fetch_assoc($result)) |
|
2158 { |
|
2159 if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? |
|
2160 { |
|
2161 if ($cur_category) |
|
2162 echo "\n\t\t\t\t\t".'</fieldset>'."\n"; |
|
2163 |
|
2164 echo "\t\t\t\t".'<fieldset class="frm-group">'."\n\t\t\t\t\t".'<legend><span>'.$cur_forum['cat_name'].':</span></legend>'."\n"; |
|
2165 $cur_category = $cur_forum['cid']; |
|
2166 } |
|
2167 |
|
2168 $moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
|
2169 |
|
2170 echo "\t\t\t\t\t".'<div class="radbox"><label for="fld'.(++$pun_page['fld_count']).'"><input type="checkbox" id="fld'.$pun_page['fld_count'].'" name="moderator_in['.$cur_forum['fid'].']" value="1"'.((in_array($id, $moderators)) ? ' checked="checked"' : '').' /> '.htmlspecialchars($cur_forum['forum_name']).'</label></div>'."\n"; |
|
2171 } |
|
2172 |
|
2173 ?> |
|
2174 </fieldset> |
|
2175 </fieldset> |
|
2176 <div class="frm-buttons"> |
|
2177 <span class="submit"><input type="submit" name="update_forums" value="<?php echo $lang_profile['Update forums'] ?>" /> <?php echo $lang_profile['Instructions'] ?></span> |
|
2178 </div> |
|
2179 <?php |
|
2180 |
|
2181 } |
|
2182 } |
|
2183 |
|
2184 ($hook = get_hook('pf_change_details_admin_form_end')) ? eval($hook) : null; |
|
2185 |
|
2186 ?> |
|
2187 </form> |
|
2188 </div> |
|
2189 |
|
2190 </div> |
|
2191 <?php |
|
2192 |
|
2193 require PUN_ROOT.'footer.php'; |
|
2194 } |
|
2195 |
|
2196 ($hook = get_hook('pf_change_details_new_section')) ? eval($hook) : null; |
|
2197 |
|
2198 message($lang_common['Bad request']); |
|
2199 } |