1 | <?php |
---|
2 | |
---|
3 | /*********************************************************************** |
---|
4 | |
---|
5 | Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) |
---|
6 | |
---|
7 | This file is part of PunBB. |
---|
8 | |
---|
9 | PunBB is free software; you can redistribute it and/or modify it |
---|
10 | under the terms of the GNU General Public License as published |
---|
11 | by the Free Software Foundation; either version 2 of the License, |
---|
12 | or (at your option) any later version. |
---|
13 | |
---|
14 | PunBB is distributed in the hope that it will be useful, but |
---|
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with this program; if not, write to the Free Software |
---|
21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
22 | MA 02111-1307 USA |
---|
23 | |
---|
24 | ************************************************************************/ |
---|
25 | |
---|
26 | |
---|
27 | define('PUN_ROOT', './'); |
---|
28 | require PUN_ROOT.'include/common.php'; |
---|
29 | |
---|
30 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
---|
31 | $section = isset($_GET['section']) ? $_GET['section'] : null; |
---|
32 | $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
---|
33 | if ($id < 2) |
---|
34 | message($lang_common['Bad request']); |
---|
35 | |
---|
36 | if ($pun_user['g_read_board'] == '0' && ($action != 'change_pass' || !isset($_GET['key']))) |
---|
37 | message($lang_common['No view']); |
---|
38 | |
---|
39 | // Load the profile.php/register.php language file |
---|
40 | require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php'; |
---|
41 | |
---|
42 | // Load the profile.php language file |
---|
43 | require PUN_ROOT.'lang/'.$pun_user['language'].'/profile.php'; |
---|
44 | |
---|
45 | |
---|
46 | if ($action == 'change_pass') |
---|
47 | { |
---|
48 | if (isset($_GET['key'])) |
---|
49 | { |
---|
50 | // If the user is already logged in we shouldn't be here :) |
---|
51 | if (!$pun_user['is_guest']) |
---|
52 | { |
---|
53 | header('Location: index.php'); |
---|
54 | exit; |
---|
55 | } |
---|
56 | |
---|
57 | $key = $_GET['key']; |
---|
58 | |
---|
59 | $result = $db->query('SELECT activate_string, activate_key FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver le nouveau mot de passe', __FILE__, __LINE__, $db->error()); |
---|
60 | list($new_password_hash, $new_password_key) = $db->fetch_row($result); |
---|
61 | |
---|
62 | if ($key == '' || $key != $new_password_key) |
---|
63 | message($lang_profile['Pass key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); |
---|
64 | else |
---|
65 | { |
---|
66 | $db->query('UPDATE '.$db->prefix.'users SET password=\''.$new_password_hash.'\', activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Impossible de modifier le mot de passe', __FILE__, __LINE__, $db->error()); |
---|
67 | |
---|
68 | message($lang_profile['Pass updated'], true); |
---|
69 | } |
---|
70 | } |
---|
71 | |
---|
72 | // Make sure we are allowed to change this users password |
---|
73 | if ($pun_user['id'] != $id) |
---|
74 | { |
---|
75 | if ($pun_user['g_id'] > PUN_MOD) // A regular user trying to change another users password? |
---|
76 | message($lang_common['No permission']); |
---|
77 | else if ($pun_user['g_id'] == PUN_MOD) // A moderator trying to change a users password? |
---|
78 | { |
---|
79 | $result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
80 | if (!$db->num_rows($result)) |
---|
81 | message($lang_common['Bad request']); |
---|
82 | |
---|
83 | if ($pun_config['p_mod_edit_users'] == '0' || $pun_config['p_mod_change_passwords'] == '0' || $db->result($result) < PUN_GUEST) |
---|
84 | message($lang_common['No permission']); |
---|
85 | } |
---|
86 | } |
---|
87 | |
---|
88 | if (isset($_POST['form_sent'])) |
---|
89 | { |
---|
90 | $old_password = isset($_POST['req_old_password']) ? trim($_POST['req_old_password']) : ''; |
---|
91 | $new_password1 = trim($_POST['req_new_password1']); |
---|
92 | $new_password2 = trim($_POST['req_new_password2']); |
---|
93 | |
---|
94 | if ($new_password1 != $new_password2) |
---|
95 | message($lang_prof_reg['Pass not match']); |
---|
96 | if (strlen($new_password1) < 4) |
---|
97 | message($lang_prof_reg['Pass too short']); |
---|
98 | |
---|
99 | $result = $db->query('SELECT password, save_pass FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver le mot de passe', __FILE__, __LINE__, $db->error()); |
---|
100 | list($db_password_hash, $save_pass) = $db->fetch_row($result); |
---|
101 | |
---|
102 | $authorized = false; |
---|
103 | |
---|
104 | if (!empty($db_password_hash)) |
---|
105 | { |
---|
106 | $sha1_in_db = (strlen($db_password_hash) == 40) ? true : false; |
---|
107 | $sha1_available = (function_exists('sha1') || function_exists('mhash')) ? true : false; |
---|
108 | |
---|
109 | $old_password_hash = pun_hash($old_password); // This could result in either an SHA-1 or an MD5 hash |
---|
110 | |
---|
111 | if (($sha1_in_db && $sha1_available && $db_password_hash == $old_password_hash) || |
---|
112 | (!$sha1_in_db && $db_password_hash == md5($old_password)) || |
---|
113 | $pun_user['g_id'] < PUN_GUEST) |
---|
114 | $authorized = true; |
---|
115 | } |
---|
116 | |
---|
117 | if (!$authorized) |
---|
118 | message($lang_profile['Wrong pass']); |
---|
119 | |
---|
120 | $new_password_hash = pun_hash($new_password1); |
---|
121 | |
---|
122 | $db->query('UPDATE '.$db->prefix.'users SET password=\''.$new_password_hash.'\' WHERE id='.$id) or error('Impossible de modifier le mot de passe', __FILE__, __LINE__, $db->error()); |
---|
123 | |
---|
124 | if ($pun_user['id'] == $id) |
---|
125 | { |
---|
126 | $expire = ($save_pass == '1') ? time() + 31536000 : 0; |
---|
127 | pun_setcookie($pun_user['id'], $new_password_hash, $expire); |
---|
128 | } |
---|
129 | |
---|
130 | redirect('profile.php?section=essentials&id='.$id, $lang_profile['Pass updated redirect']); |
---|
131 | } |
---|
132 | |
---|
133 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
134 | $required_fields = array('req_old_password' => $lang_profile['Old pass'], 'req_new_password1' => $lang_profile['New pass'], 'req_new_password2' => $lang_profile['Confirm new pass']); |
---|
135 | $focus_element = array('change_pass', (($pun_user['g_id'] > PUN_MOD) ? 'req_old_password' : 'req_new_password1')); |
---|
136 | require PUN_ROOT.'header.php'; |
---|
137 | |
---|
138 | ?> |
---|
139 | <div class="blockform"> |
---|
140 | <h2><span><?php echo $lang_profile['Change pass'] ?></span></h2> |
---|
141 | <div class="box"> |
---|
142 | <form id="change_pass" method="post" action="profile.php?action=change_pass&id=<?php echo $id ?>" onsubmit="return process_form(this)"> |
---|
143 | <div class="inform"> |
---|
144 | <input type="hidden" name="form_sent" value="1" /> |
---|
145 | <fieldset> |
---|
146 | <legend><?php echo $lang_profile['Change pass legend'] ?></legend> |
---|
147 | <div class="infldset"> |
---|
148 | <?php if ($pun_user['g_id'] > PUN_MOD): ?> <label><strong><?php echo $lang_profile['Old pass'] ?></strong><br /> |
---|
149 | <input type="password" name="req_old_password" size="16" maxlength="16" /><br /></label> |
---|
150 | <?php endif; ?> <label class="conl"><strong><?php echo $lang_profile['New pass'] ?></strong><br /> |
---|
151 | <input type="password" name="req_new_password1" size="16" maxlength="16" /><br /></label> |
---|
152 | <label class="conl"><strong><?php echo $lang_profile['Confirm new pass'] ?></strong><br /> |
---|
153 | <input type="password" name="req_new_password2" size="16" maxlength="16" /><br /></label> |
---|
154 | <div class="clearb"></div> |
---|
155 | </div> |
---|
156 | </fieldset> |
---|
157 | </div> |
---|
158 | <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
---|
159 | </form> |
---|
160 | </div> |
---|
161 | </div> |
---|
162 | <?php |
---|
163 | |
---|
164 | require PUN_ROOT.'footer.php'; |
---|
165 | } |
---|
166 | |
---|
167 | |
---|
168 | else if ($action == 'change_email') |
---|
169 | { |
---|
170 | // Make sure we are allowed to change this users e-mail |
---|
171 | if ($pun_user['id'] != $id) |
---|
172 | { |
---|
173 | if ($pun_user['g_id'] > PUN_MOD) // A regular user trying to change another users e-mail? |
---|
174 | message($lang_common['No permission']); |
---|
175 | else if ($pun_user['g_id'] == PUN_MOD) // A moderator trying to change a users e-mail? |
---|
176 | { |
---|
177 | $result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
178 | if (!$db->num_rows($result)) |
---|
179 | message($lang_common['Bad request']); |
---|
180 | |
---|
181 | if ($pun_config['p_mod_edit_users'] == '0' || $db->result($result) < PUN_GUEST) |
---|
182 | message($lang_common['No permission']); |
---|
183 | } |
---|
184 | } |
---|
185 | |
---|
186 | if (isset($_GET['key'])) |
---|
187 | { |
---|
188 | $key = $_GET['key']; |
---|
189 | |
---|
190 | $result = $db->query('SELECT activate_string, activate_key FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver les données d\'activation', __FILE__, __LINE__, $db->error()); |
---|
191 | list($new_email, $new_email_key) = $db->fetch_row($result); |
---|
192 | |
---|
193 | if ($key != $new_email_key) |
---|
194 | message($lang_profile['E-mail key bad'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); |
---|
195 | else |
---|
196 | { |
---|
197 | $db->query('UPDATE '.$db->prefix.'users SET email=activate_string, activate_string=NULL, activate_key=NULL WHERE id='.$id) or error('Impossible de modifier l\'adresse e-mail', __FILE__, __LINE__, $db->error()); |
---|
198 | |
---|
199 | message($lang_profile['E-mail updated'], true); |
---|
200 | } |
---|
201 | } |
---|
202 | else if (isset($_POST['form_sent'])) |
---|
203 | { |
---|
204 | if (pun_hash($_POST['req_password']) !== $pun_user['password']) |
---|
205 | message($lang_profile['Wrong pass']); |
---|
206 | |
---|
207 | require PUN_ROOT.'include/email.php'; |
---|
208 | |
---|
209 | // Validate the email-address |
---|
210 | $new_email = strtolower(trim($_POST['req_new_email'])); |
---|
211 | if (!is_valid_email($new_email)) |
---|
212 | message($lang_common['Invalid e-mail']); |
---|
213 | |
---|
214 | // Check it it's a banned e-mail address |
---|
215 | if (is_banned_email($new_email)) |
---|
216 | { |
---|
217 | if ($pun_config['p_allow_banned_email'] == '0') |
---|
218 | message($lang_prof_reg['Banned e-mail']); |
---|
219 | else if ($pun_config['o_mailing_list'] != '') |
---|
220 | { |
---|
221 | $mail_subject = 'Alerte - Adresse e-mail bannis détectée'; |
---|
222 | $mail_message = 'L\'utilisateur \''.$pun_user['username'].'\' a changé son e-mail en une adresse interdite : '.$new_email."\n\n".'Profil utilisateur : '.$pun_config['o_base_url'].'/profile.php?id='.$id."\n\n".'-- '."\n".'E-mail automatique'."\n".'(Ne répondez pas à ce message)'; |
---|
223 | |
---|
224 | pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); |
---|
225 | } |
---|
226 | } |
---|
227 | |
---|
228 | // Check if someone else already has registered with that e-mail address |
---|
229 | $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE email=\''.$db->escape($new_email).'\'') or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
230 | if ($db->num_rows($result)) |
---|
231 | { |
---|
232 | if ($pun_config['p_allow_dupe_email'] == '0') |
---|
233 | message($lang_prof_reg['Dupe e-mail']); |
---|
234 | else if ($pun_config['o_mailing_list'] != '') |
---|
235 | { |
---|
236 | while ($cur_dupe = $db->fetch_assoc($result)) |
---|
237 | $dupe_list[] = $cur_dupe['username']; |
---|
238 | |
---|
239 | $mail_subject = 'Alerte - Adresse e-mail en doublon détectée'; |
---|
240 | $mail_message = 'L\'utilisateur \''.$pun_user['username'].'\' a changé son e-mail pour une adresse qui appartient déjà à : '.implode(', ', $dupe_list)."\n\n".'Profil utilisateur : '.$pun_config['o_base_url'].'/profile.php?id='.$id."\n\n".'-- '."\n".'E-mail automatique'."\n".'(Ne répondez pas à ce message)'; |
---|
241 | |
---|
242 | pun_mail($pun_config['o_mailing_list'], $mail_subject, $mail_message); |
---|
243 | } |
---|
244 | } |
---|
245 | |
---|
246 | |
---|
247 | $new_email_key = random_pass(8); |
---|
248 | |
---|
249 | $db->query('UPDATE '.$db->prefix.'users SET activate_string=\''.$db->escape($new_email).'\', activate_key=\''.$new_email_key.'\' WHERE id='.$id) or error('Impossible de modifier les données d\'activation', __FILE__, __LINE__, $db->error()); |
---|
250 | |
---|
251 | // Load the "activate e-mail" template |
---|
252 | $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$pun_user['language'].'/mail_templates/activate_email.tpl')); |
---|
253 | |
---|
254 | // The first row contains the subject |
---|
255 | $first_crlf = strpos($mail_tpl, "\n"); |
---|
256 | $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8)); |
---|
257 | $mail_message = trim(substr($mail_tpl, $first_crlf)); |
---|
258 | |
---|
259 | $mail_message = str_replace('<username>', $pun_user['username'], $mail_message); |
---|
260 | $mail_message = str_replace('<base_url>', $pun_config['o_base_url'], $mail_message); |
---|
261 | $mail_message = str_replace('<activation_url>', $pun_config['o_base_url'].'/profile.php?action=change_email&id='.$id.'&key='.$new_email_key, $mail_message); |
---|
262 | $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message); |
---|
263 | |
---|
264 | pun_mail($new_email, $mail_subject, $mail_message); |
---|
265 | |
---|
266 | message($lang_profile['Activate e-mail sent'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.', true); |
---|
267 | } |
---|
268 | |
---|
269 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
270 | $required_fields = array('req_new_email' => $lang_profile['New e-mail'], 'req_password' => $lang_common['Password']); |
---|
271 | $focus_element = array('change_email', 'req_new_email'); |
---|
272 | require PUN_ROOT.'header.php'; |
---|
273 | |
---|
274 | ?> |
---|
275 | <div class="blockform"> |
---|
276 | <h2><span><?php echo $lang_profile['Change e-mail'] ?></span></h2> |
---|
277 | <div class="box"> |
---|
278 | <form id="change_email" method="post" action="profile.php?action=change_email&id=<?php echo $id ?>" id="change_email" onsubmit="return process_form(this)"> |
---|
279 | <div class="inform"> |
---|
280 | <fieldset> |
---|
281 | <legend><?php echo $lang_profile['E-mail legend'] ?></legend> |
---|
282 | <div class="infldset"> |
---|
283 | <input type="hidden" name="form_sent" value="1" /> |
---|
284 | <label><strong><?php echo $lang_profile['New e-mail'] ?></strong><br /><input type="text" name="req_new_email" size="50" maxlength="50" /><br /></label> |
---|
285 | <label><strong><?php echo $lang_common['Password'] ?></strong><br /><input type="password" name="req_password" size="16" maxlength="16" /><br /></label> |
---|
286 | <p><?php echo $lang_profile['E-mail instructions'] ?></p> |
---|
287 | </div> |
---|
288 | </fieldset> |
---|
289 | </div> |
---|
290 | <p><input type="submit" name="new_email" value="<?php echo $lang_common['Submit'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
---|
291 | </form> |
---|
292 | </div> |
---|
293 | </div> |
---|
294 | <?php |
---|
295 | |
---|
296 | require PUN_ROOT.'footer.php'; |
---|
297 | } |
---|
298 | |
---|
299 | |
---|
300 | else if ($action == 'upload_avatar' || $action == 'upload_avatar2') |
---|
301 | { |
---|
302 | if ($pun_config['o_avatars'] == '0') |
---|
303 | message($lang_profile['Avatars disabled']); |
---|
304 | |
---|
305 | if ($pun_user['id'] != $id && $pun_user['g_id'] > PUN_MOD) |
---|
306 | message($lang_common['No permission']); |
---|
307 | |
---|
308 | if (isset($_POST['form_sent'])) |
---|
309 | { |
---|
310 | if (!isset($_FILES['req_file'])) |
---|
311 | message($lang_profile['No file']); |
---|
312 | |
---|
313 | $uploaded_file = $_FILES['req_file']; |
---|
314 | |
---|
315 | // Make sure the upload went smooth |
---|
316 | if (isset($uploaded_file['error'])) |
---|
317 | { |
---|
318 | switch ($uploaded_file['error']) |
---|
319 | { |
---|
320 | case 1: // UPLOAD_ERR_INI_SIZE |
---|
321 | case 2: // UPLOAD_ERR_FORM_SIZE |
---|
322 | message($lang_profile['Too large ini']); |
---|
323 | break; |
---|
324 | |
---|
325 | case 3: // UPLOAD_ERR_PARTIAL |
---|
326 | message($lang_profile['Partial upload']); |
---|
327 | break; |
---|
328 | |
---|
329 | case 4: // UPLOAD_ERR_NO_FILE |
---|
330 | message($lang_profile['No file']); |
---|
331 | break; |
---|
332 | |
---|
333 | case 6: // UPLOAD_ERR_NO_TMP_DIR |
---|
334 | message($lang_profile['No tmp directory']); |
---|
335 | break; |
---|
336 | |
---|
337 | default: |
---|
338 | // No error occured, but was something actually uploaded? |
---|
339 | if ($uploaded_file['size'] == 0) |
---|
340 | message($lang_profile['No file']); |
---|
341 | break; |
---|
342 | } |
---|
343 | } |
---|
344 | |
---|
345 | if (is_uploaded_file($uploaded_file['tmp_name'])) |
---|
346 | { |
---|
347 | $allowed_types = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'); |
---|
348 | if (!in_array($uploaded_file['type'], $allowed_types)) |
---|
349 | message($lang_profile['Bad type']); |
---|
350 | |
---|
351 | // Make sure the file isn't too big |
---|
352 | if ($uploaded_file['size'] > $pun_config['o_avatars_size']) |
---|
353 | message($lang_profile['Too large'].' '.$pun_config['o_avatars_size'].' '.$lang_profile['bytes'].'.'); |
---|
354 | |
---|
355 | // Determine type |
---|
356 | $extensions = null; |
---|
357 | if ($uploaded_file['type'] == 'image/gif') |
---|
358 | $extensions = array('.gif', '.jpg', '.png'); |
---|
359 | else if ($uploaded_file['type'] == 'image/jpeg' || $uploaded_file['type'] == 'image/pjpeg') |
---|
360 | $extensions = array('.jpg', '.gif', '.png'); |
---|
361 | else |
---|
362 | $extensions = array('.png', '.gif', '.jpg'); |
---|
363 | |
---|
364 | // Move the file to the avatar directory. We do this before checking the width/height to circumvent open_basedir restrictions. |
---|
365 | if (!@move_uploaded_file($uploaded_file['tmp_name'], $pun_config['o_avatars_dir'].'/'.$id.'.tmp')) |
---|
366 | message($lang_profile['Move failed'].' <a href="mailto:'.$pun_config['o_admin_email'].'">'.$pun_config['o_admin_email'].'</a>.'); |
---|
367 | |
---|
368 | // Now check the width/height |
---|
369 | list($width, $height, $type,) = getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.tmp'); |
---|
370 | if (empty($width) || empty($height) || $width > $pun_config['o_avatars_width'] || $height > $pun_config['o_avatars_height']) |
---|
371 | { |
---|
372 | @unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp'); |
---|
373 | message($lang_profile['Too wide or high'].' '.$pun_config['o_avatars_width'].'x'.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].'.'); |
---|
374 | } |
---|
375 | else if ($type == 1 && $uploaded_file['type'] != 'image/gif') // Prevent dodgy uploads |
---|
376 | { |
---|
377 | @unlink($pun_config['o_avatars_dir'].'/'.$id.'.tmp'); |
---|
378 | message($lang_profile['Bad type']); |
---|
379 | } |
---|
380 | |
---|
381 | // Delete any old avatars and put the new one in place |
---|
382 | @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[0]); |
---|
383 | @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[1]); |
---|
384 | @unlink($pun_config['o_avatars_dir'].'/'.$id.$extensions[2]); |
---|
385 | @rename($pun_config['o_avatars_dir'].'/'.$id.'.tmp', $pun_config['o_avatars_dir'].'/'.$id.$extensions[0]); |
---|
386 | @chmod($pun_config['o_avatars_dir'].'/'.$id.$extensions[0], 0644); |
---|
387 | } |
---|
388 | else |
---|
389 | message($lang_profile['Unknown failure']); |
---|
390 | |
---|
391 | // Enable use_avatar (seems sane since the user just uploaded an avatar) |
---|
392 | $db->query('UPDATE '.$db->prefix.'users SET use_avatar=1 WHERE id='.$id) or error('Impossible de modifier l\'état de l\'avatar', __FILE__, __LINE__, $db->error()); |
---|
393 | |
---|
394 | redirect('profile.php?section=personality&id='.$id, $lang_profile['Avatar upload redirect']); |
---|
395 | } |
---|
396 | |
---|
397 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
398 | $required_fields = array('req_file' => $lang_profile['File']); |
---|
399 | $focus_element = array('upload_avatar', 'req_file'); |
---|
400 | require PUN_ROOT.'header.php'; |
---|
401 | |
---|
402 | ?> |
---|
403 | <div class="blockform"> |
---|
404 | <h2><span><?php echo $lang_profile['Upload avatar'] ?></span></h2> |
---|
405 | <div class="box"> |
---|
406 | <form id="upload_avatar" method="post" enctype="multipart/form-data" action="profile.php?action=upload_avatar2&id=<?php echo $id ?>" onsubmit="return process_form(this)"> |
---|
407 | <div class="inform"> |
---|
408 | <fieldset> |
---|
409 | <legend><?php echo $lang_profile['Upload avatar legend'] ?></legend> |
---|
410 | <div class="infldset"> |
---|
411 | <input type="hidden" name="form_sent" value="1" /> |
---|
412 | <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $pun_config['o_avatars_size'] ?>" /> |
---|
413 | <label><strong><?php echo $lang_profile['File'] ?></strong><br /><input name="req_file" type="file" size="40" /><br /></label> |
---|
414 | <p><?php echo $lang_profile['Avatar desc'].' '.$pun_config['o_avatars_width'].' x '.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].' '.$lang_common['and'].' '.$pun_config['o_avatars_size'].' '.$lang_profile['bytes'].' ('.ceil($pun_config['o_avatars_size'] / 1024) ?> KB).</p> |
---|
415 | </div> |
---|
416 | </fieldset> |
---|
417 | </div> |
---|
418 | <p><input type="submit" name="upload" value="<?php echo $lang_profile['Upload'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
---|
419 | </form> |
---|
420 | </div> |
---|
421 | </div> |
---|
422 | <?php |
---|
423 | |
---|
424 | require PUN_ROOT.'footer.php'; |
---|
425 | } |
---|
426 | |
---|
427 | |
---|
428 | else if ($action == 'delete_avatar') |
---|
429 | { |
---|
430 | if ($pun_user['id'] != $id && $pun_user['g_id'] > PUN_MOD) |
---|
431 | message($lang_common['No permission']); |
---|
432 | |
---|
433 | confirm_referrer('profile.php'); |
---|
434 | |
---|
435 | @unlink($pun_config['o_avatars_dir'].'/'.$id.'.jpg'); |
---|
436 | @unlink($pun_config['o_avatars_dir'].'/'.$id.'.png'); |
---|
437 | @unlink($pun_config['o_avatars_dir'].'/'.$id.'.gif'); |
---|
438 | |
---|
439 | // Disable use_avatar |
---|
440 | $db->query('UPDATE '.$db->prefix.'users SET use_avatar=0 WHERE id='.$id) or error('Impossible de modifier l\'état de l\'avatar', __FILE__, __LINE__, $db->error()); |
---|
441 | |
---|
442 | redirect('profile.php?section=personality&id='.$id, $lang_profile['Avatar deleted redirect']); |
---|
443 | } |
---|
444 | |
---|
445 | |
---|
446 | else if (isset($_POST['update_group_membership'])) |
---|
447 | { |
---|
448 | if ($pun_user['g_id'] > PUN_ADMIN) |
---|
449 | message($lang_common['No permission']); |
---|
450 | |
---|
451 | confirm_referrer('profile.php'); |
---|
452 | |
---|
453 | $new_group_id = intval($_POST['group_id']); |
---|
454 | |
---|
455 | $db->query('UPDATE '.$db->prefix.'users SET group_id='.$new_group_id.' WHERE id='.$id) or error('Impossible de change de groupe', __FILE__, __LINE__, $db->error()); |
---|
456 | |
---|
457 | // If the user was a moderator or an administrator, we remove him/her from the moderator list in all forums as well |
---|
458 | if ($new_group_id > PUN_MOD) |
---|
459 | { |
---|
460 | $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Impossible de retrouver la liste des forums', __FILE__, __LINE__, $db->error()); |
---|
461 | |
---|
462 | while ($cur_forum = $db->fetch_assoc($result)) |
---|
463 | { |
---|
464 | $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
---|
465 | |
---|
466 | if (in_array($id, $cur_moderators)) |
---|
467 | { |
---|
468 | $username = array_search($id, $cur_moderators); |
---|
469 | unset($cur_moderators[$username]); |
---|
470 | $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
---|
471 | |
---|
472 | $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Impossible de modifier le forum', __FILE__, __LINE__, $db->error()); |
---|
473 | } |
---|
474 | } |
---|
475 | } |
---|
476 | |
---|
477 | redirect('profile.php?section=admin&id='.$id, $lang_profile['Group membership redirect']); |
---|
478 | } |
---|
479 | |
---|
480 | |
---|
481 | else if (isset($_POST['update_forums'])) |
---|
482 | { |
---|
483 | if ($pun_user['g_id'] > PUN_ADMIN) |
---|
484 | message($lang_common['No permission']); |
---|
485 | |
---|
486 | confirm_referrer('profile.php'); |
---|
487 | |
---|
488 | // Get the username of the user we are processing |
---|
489 | $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
490 | $username = $db->result($result); |
---|
491 | |
---|
492 | $moderator_in = (isset($_POST['moderator_in'])) ? array_keys($_POST['moderator_in']) : array(); |
---|
493 | |
---|
494 | // Loop through all forums |
---|
495 | $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Impossible de retrouver la liste des forums', __FILE__, __LINE__, $db->error()); |
---|
496 | |
---|
497 | while ($cur_forum = $db->fetch_assoc($result)) |
---|
498 | { |
---|
499 | $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
---|
500 | // If the user should have moderator access (and he/she doesn't already have it) |
---|
501 | if (in_array($cur_forum['id'], $moderator_in) && !in_array($id, $cur_moderators)) |
---|
502 | { |
---|
503 | $cur_moderators[$username] = $id; |
---|
504 | ksort($cur_moderators); |
---|
505 | |
---|
506 | $db->query('UPDATE '.$db->prefix.'forums SET moderators=\''.$db->escape(serialize($cur_moderators)).'\' WHERE id='.$cur_forum['id']) or error('Impossible de modifier les forums', __FILE__, __LINE__, $db->error()); |
---|
507 | } |
---|
508 | // If the user shouldn't have moderator access (and he/she already has it) |
---|
509 | else if (!in_array($cur_forum['id'], $moderator_in) && in_array($id, $cur_moderators)) |
---|
510 | { |
---|
511 | unset($cur_moderators[$username]); |
---|
512 | $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
---|
513 | |
---|
514 | $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Impossible de modifier les forums', __FILE__, __LINE__, $db->error()); |
---|
515 | } |
---|
516 | } |
---|
517 | |
---|
518 | redirect('profile.php?section=admin&id='.$id, $lang_profile['Update forums redirect']); |
---|
519 | } |
---|
520 | |
---|
521 | |
---|
522 | else if (isset($_POST['ban'])) |
---|
523 | { |
---|
524 | if ($pun_user['g_id'] > PUN_MOD || ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_ban_users'] == '0')) |
---|
525 | message($lang_common['No permission']); |
---|
526 | |
---|
527 | redirect('admin_bans.php?add_ban='.$id, $lang_profile['Ban redirect']); |
---|
528 | } |
---|
529 | |
---|
530 | |
---|
531 | else if (isset($_POST['delete_user']) || isset($_POST['delete_user_comply'])) |
---|
532 | { |
---|
533 | if ($pun_user['g_id'] > PUN_ADMIN) |
---|
534 | message($lang_common['No permission']); |
---|
535 | |
---|
536 | confirm_referrer('profile.php'); |
---|
537 | |
---|
538 | // Get the username and group of the user we are deleting |
---|
539 | $result = $db->query('SELECT group_id, username FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
540 | list($group_id, $username) = $db->fetch_row($result); |
---|
541 | |
---|
542 | if ($group_id == PUN_ADMIN) |
---|
543 | message('Les administrateurs ne peuvent êtres supprimés. Afin de supprimer cet utilisateur vous devez d\'abord le déplacer dans un autre groupe.'); |
---|
544 | |
---|
545 | if (isset($_POST['delete_user_comply'])) |
---|
546 | { |
---|
547 | // If the user is a moderator or an administrator, we remove him/her from the moderator list in all forums as well |
---|
548 | if ($group_id < PUN_GUEST) |
---|
549 | { |
---|
550 | $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Impossible de retrouver la liste des forums', __FILE__, __LINE__, $db->error()); |
---|
551 | |
---|
552 | while ($cur_forum = $db->fetch_assoc($result)) |
---|
553 | { |
---|
554 | $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
---|
555 | |
---|
556 | if (in_array($id, $cur_moderators)) |
---|
557 | { |
---|
558 | unset($cur_moderators[$username]); |
---|
559 | $cur_moderators = (!empty($cur_moderators)) ? '\''.$db->escape(serialize($cur_moderators)).'\'' : 'NULL'; |
---|
560 | |
---|
561 | $db->query('UPDATE '.$db->prefix.'forums SET moderators='.$cur_moderators.' WHERE id='.$cur_forum['id']) or error('Impossible de modifier les forums', __FILE__, __LINE__, $db->error()); |
---|
562 | } |
---|
563 | } |
---|
564 | } |
---|
565 | |
---|
566 | // Delete any subscriptions |
---|
567 | $db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE user_id='.$id) or error('Unable to delete subscriptions', __FILE__, __LINE__, $db->error()); |
---|
568 | |
---|
569 | // Remove him/her from the online list (if they happen to be logged in) |
---|
570 | $db->query('DELETE FROM '.$db->prefix.'online WHERE user_id='.$id) or error('Impossible de retirer l\'utilisateur de la liste des utilisateurs en ligne', __FILE__, __LINE__, $db->error()); |
---|
571 | |
---|
572 | // Should we delete all posts made by this user? |
---|
573 | if (isset($_POST['delete_posts'])) |
---|
574 | { |
---|
575 | require PUN_ROOT.'include/search_idx.php'; |
---|
576 | @set_time_limit(0); |
---|
577 | |
---|
578 | // Find all posts made by this user |
---|
579 | $result = $db->query('SELECT p.id, p.topic_id, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE p.poster_id='.$id) or error('Impossible de retrouver les messages', __FILE__, __LINE__, $db->error()); |
---|
580 | if ($db->num_rows($result)) |
---|
581 | { |
---|
582 | while ($cur_post = $db->fetch_assoc($result)) |
---|
583 | { |
---|
584 | // Determine whether this post is the "topic post" or not |
---|
585 | $result2 = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['topic_id'].' ORDER BY posted LIMIT 1') or error('Impossible de retrouver les informations des messages', __FILE__, __LINE__, $db->error()); |
---|
586 | |
---|
587 | if ($db->result($result2) == $cur_post['id']) |
---|
588 | delete_topic($cur_post['topic_id']); |
---|
589 | else |
---|
590 | delete_post($cur_post['id'], $cur_post['topic_id']); |
---|
591 | |
---|
592 | update_forum($cur_post['forum_id']); |
---|
593 | } |
---|
594 | } |
---|
595 | } |
---|
596 | else |
---|
597 | // Set all his/her posts to guest |
---|
598 | $db->query('UPDATE '.$db->prefix.'posts SET poster_id=1 WHERE poster_id='.$id) or error('Impossible de modifier les messages', __FILE__, __LINE__, $db->error()); |
---|
599 | |
---|
600 | // Delete the user |
---|
601 | $db->query('DELETE FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de supprimer l\'utilisateur', __FILE__, __LINE__, $db->error()); |
---|
602 | |
---|
603 | redirect('index.php', $lang_profile['User delete redirect']); |
---|
604 | } |
---|
605 | |
---|
606 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
607 | require PUN_ROOT.'header.php'; |
---|
608 | |
---|
609 | ?> |
---|
610 | <div class="blockform"> |
---|
611 | <h2><span><?php echo $lang_profile['Confirm delete user'] ?></span></h2> |
---|
612 | <div class="box"> |
---|
613 | <form id="confirm_del_user" method="post" action="profile.php?id=<?php echo $id ?>"> |
---|
614 | <div class="inform"> |
---|
615 | <fieldset> |
---|
616 | <legend><?php echo $lang_profile['Confirm delete legend'] ?></legend> |
---|
617 | <div class="infldset"> |
---|
618 | <p><?php echo $lang_profile['Confirmation info'].' '.pun_htmlspecialchars($username).'.' ?></p> |
---|
619 | <div class="rbox"> |
---|
620 | <label><input type="checkbox" name="delete_posts" value="1" checked="checked" /><?php echo $lang_profile['Delete posts'] ?><br /></label> |
---|
621 | </div> |
---|
622 | <p class="warntext"><strong><?php echo $lang_profile['Delete warning'] ?></strong></p> |
---|
623 | </div> |
---|
624 | </fieldset> |
---|
625 | </div> |
---|
626 | <p><input type="submit" name="delete_user_comply" value="<?php echo $lang_profile['Delete'] ?>" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p> |
---|
627 | </form> |
---|
628 | </div> |
---|
629 | </div> |
---|
630 | <?php |
---|
631 | |
---|
632 | require PUN_ROOT.'footer.php'; |
---|
633 | } |
---|
634 | |
---|
635 | |
---|
636 | else if (isset($_POST['form_sent'])) |
---|
637 | { |
---|
638 | // Fetch the user group of the user we are editing |
---|
639 | $result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE id='.$id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
640 | if (!$db->num_rows($result)) |
---|
641 | message($lang_common['Bad request']); |
---|
642 | |
---|
643 | $group_id = $db->result($result); |
---|
644 | |
---|
645 | if ($pun_user['id'] != $id && |
---|
646 | ($pun_user['g_id'] > PUN_MOD || |
---|
647 | ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '0') || |
---|
648 | ($pun_user['g_id'] == PUN_MOD && $group_id < PUN_GUEST))) |
---|
649 | message($lang_common['No permission']); |
---|
650 | |
---|
651 | if ($pun_user['g_id'] < PUN_GUEST) |
---|
652 | confirm_referrer('profile.php'); |
---|
653 | |
---|
654 | // Extract allowed elements from $_POST['form'] |
---|
655 | function extract_elements($allowed_elements) |
---|
656 | { |
---|
657 | $form = array(); |
---|
658 | |
---|
659 | while (list($key, $value) = @each($_POST['form'])) |
---|
660 | { |
---|
661 | if (in_array($key, $allowed_elements)) |
---|
662 | $form[$key] = $value; |
---|
663 | } |
---|
664 | |
---|
665 | return $form; |
---|
666 | } |
---|
667 | |
---|
668 | $username_updated = false; |
---|
669 | |
---|
670 | // Validate input depending on section |
---|
671 | switch ($section) |
---|
672 | { |
---|
673 | case 'essentials': |
---|
674 | { |
---|
675 | $form = extract_elements(array('timezone', 'language')); |
---|
676 | |
---|
677 | if ($pun_user['g_id'] < PUN_GUEST) |
---|
678 | { |
---|
679 | $form['admin_note'] = trim($_POST['admin_note']); |
---|
680 | |
---|
681 | // Are we allowed to change usernames? |
---|
682 | if ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_rename_users'] == '1')) |
---|
683 | { |
---|
684 | $form['username'] = trim($_POST['req_username']); |
---|
685 | $old_username = trim($_POST['old_username']); |
---|
686 | |
---|
687 | if (strlen($form['username']) < 2) |
---|
688 | message($lang_prof_reg['Username too short']); |
---|
689 | else if (pun_strlen($form['username']) > 25) // This usually doesn't happen since the form element only accepts 25 characters |
---|
690 | message($lang_common['Bad request']); |
---|
691 | else if (!strcasecmp($form['username'], 'invité') || !strcasecmp($form['username'], $lang_common['Guest'])) |
---|
692 | message($lang_prof_reg['Username guest']); |
---|
693 | else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $form['username'])) |
---|
694 | message($lang_prof_reg['Username IP']); |
---|
695 | else if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $form['username'])) |
---|
696 | message($lang_prof_reg['Username BBCode']); |
---|
697 | |
---|
698 | // Check that the username is not already registered |
---|
699 | $result = $db->query('SELECT 1 FROM '.$db->prefix.'users WHERE username=\''.$db->escape($form['username']).'\' AND id!='.$id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
700 | if ($db->num_rows($result)) |
---|
701 | message($lang_profile['Dupe username']); |
---|
702 | |
---|
703 | if ($form['username'] != $old_username) |
---|
704 | $username_updated = true; |
---|
705 | } |
---|
706 | |
---|
707 | // We only allow administrators to update the post count |
---|
708 | if ($pun_user['g_id'] == PUN_ADMIN) |
---|
709 | $form['num_posts'] = intval($_POST['num_posts']); |
---|
710 | } |
---|
711 | |
---|
712 | if ($pun_config['o_regs_verify'] == '0' || $pun_user['g_id'] < PUN_GUEST) |
---|
713 | { |
---|
714 | require PUN_ROOT.'include/email.php'; |
---|
715 | |
---|
716 | // Validate the email-address |
---|
717 | $form['email'] = strtolower(trim($_POST['req_email'])); |
---|
718 | if (!is_valid_email($form['email'])) |
---|
719 | message($lang_common['Invalid e-mail']); |
---|
720 | } |
---|
721 | |
---|
722 | // Make sure we got a valid language string |
---|
723 | $form['language'] = preg_replace('#[\.\\\/]#', '', $form['language']); |
---|
724 | if (!file_exists(PUN_ROOT.'lang/'.$form['language'].'/common.php')) |
---|
725 | message($lang_common['Bad request']); |
---|
726 | |
---|
727 | break; |
---|
728 | } |
---|
729 | |
---|
730 | case 'personal': |
---|
731 | { |
---|
732 | $form = extract_elements(array('realname', 'url', 'location')); |
---|
733 | |
---|
734 | if ($pun_user['g_id'] == PUN_ADMIN) |
---|
735 | $form['title'] = trim($_POST['title']); |
---|
736 | else if ($pun_user['g_set_title'] == '1') |
---|
737 | { |
---|
738 | $form['title'] = trim($_POST['title']); |
---|
739 | |
---|
740 | if ($form['title'] != '') |
---|
741 | { |
---|
742 | // A list of words that the title may not contain |
---|
743 | // If the language is English, there will be some duplicates, but it's not the end of the world |
---|
744 | $forbidden = array('Member', 'Moderator', 'Administrator', 'Banned', 'Guest', $lang_common['Member'], $lang_common['Moderator'], $lang_common['Administrator'], $lang_common['Banned'], $lang_common['Guest']); |
---|
745 | |
---|
746 | if (in_array($form['title'], $forbidden)) |
---|
747 | message($lang_profile['Forbidden title']); |
---|
748 | } |
---|
749 | } |
---|
750 | |
---|
751 | // Add http:// if the URL doesn't contain it already |
---|
752 | if ($form['url'] != '' && !stristr($form['url'], 'http://')) |
---|
753 | $form['url'] = 'http://'.$form['url']; |
---|
754 | |
---|
755 | break; |
---|
756 | } |
---|
757 | |
---|
758 | case 'messaging': |
---|
759 | { |
---|
760 | $form = extract_elements(array('jabber', 'icq', 'msn', 'aim', 'yahoo')); |
---|
761 | |
---|
762 | // If the ICQ UIN contains anything other than digits it's invalid |
---|
763 | if ($form['icq'] != '' && preg_match('/[^0-9]/', $form['icq'])) |
---|
764 | message($lang_prof_reg['Bad ICQ']); |
---|
765 | |
---|
766 | break; |
---|
767 | } |
---|
768 | |
---|
769 | case 'personality': |
---|
770 | { |
---|
771 | $form = extract_elements(array('use_avatar')); |
---|
772 | |
---|
773 | // Clean up signature from POST |
---|
774 | $form['signature'] = pun_linebreaks(trim($_POST['signature'])); |
---|
775 | |
---|
776 | // Validate signature |
---|
777 | if (pun_strlen($form['signature']) > $pun_config['p_sig_length']) |
---|
778 | message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.'); |
---|
779 | else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1)) |
---|
780 | message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.'); |
---|
781 | else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && strtoupper($form['signature']) == $form['signature'] && $pun_user['g_id'] > PUN_MOD) |
---|
782 | $form['signature'] = ucwords(strtolower($form['signature'])); |
---|
783 | |
---|
784 | // Validate BBCode syntax |
---|
785 | if ($pun_config['p_sig_bbcode'] == '1' && strpos($form['signature'], '[') !== false && strpos($form['signature'], ']') !== false) |
---|
786 | { |
---|
787 | require PUN_ROOT.'include/parser.php'; |
---|
788 | $form['signature'] = preparse_bbcode($form['signature'], $foo, true); |
---|
789 | } |
---|
790 | |
---|
791 | if (!isset($form['use_avatar']) || $form['use_avatar'] != '1') $form['use_avatar'] = '0'; |
---|
792 | |
---|
793 | break; |
---|
794 | } |
---|
795 | |
---|
796 | case 'display': |
---|
797 | { |
---|
798 | $form = extract_elements(array('disp_topics', 'disp_posts', 'show_smilies', 'show_img', 'show_img_sig', 'show_avatars', 'show_sig', 'style')); |
---|
799 | |
---|
800 | if ($form['disp_topics'] != '' && intval($form['disp_topics']) < 3) $form['disp_topics'] = 3; |
---|
801 | if ($form['disp_topics'] != '' && intval($form['disp_topics']) > 75) $form['disp_topics'] = 75; |
---|
802 | if ($form['disp_posts'] != '' && intval($form['disp_posts']) < 3) $form['disp_posts'] = 3; |
---|
803 | if ($form['disp_posts'] != '' && intval($form['disp_posts']) > 75) $form['disp_posts'] = 75; |
---|
804 | |
---|
805 | if (!isset($form['show_smilies']) || $form['show_smilies'] != '1') $form['show_smilies'] = '0'; |
---|
806 | if (!isset($form['show_img']) || $form['show_img'] != '1') $form['show_img'] = '0'; |
---|
807 | if (!isset($form['show_img_sig']) || $form['show_img_sig'] != '1') $form['show_img_sig'] = '0'; |
---|
808 | if (!isset($form['show_avatars']) || $form['show_avatars'] != '1') $form['show_avatars'] = '0'; |
---|
809 | if (!isset($form['show_sig']) || $form['show_sig'] != '1') $form['show_sig'] = '0'; |
---|
810 | |
---|
811 | break; |
---|
812 | } |
---|
813 | |
---|
814 | case 'privacy': |
---|
815 | { |
---|
816 | $form = extract_elements(array('email_setting', 'save_pass', 'notify_with_post')); |
---|
817 | |
---|
818 | $form['email_setting'] = intval($form['email_setting']); |
---|
819 | if ($form['email_setting'] < 0 && $form['email_setting'] > 2) $form['email_setting'] = 1; |
---|
820 | |
---|
821 | if (!isset($form['save_pass']) || $form['save_pass'] != '1') $form['save_pass'] = '0'; |
---|
822 | if (!isset($form['notify_with_post']) || $form['notify_with_post'] != '1') $form['notify_with_post'] = '0'; |
---|
823 | |
---|
824 | // If the save_pass setting has changed, we need to set a new cookie with the appropriate expire date |
---|
825 | if ($pun_user['id'] == $id && $form['save_pass'] != $pun_user['save_pass']) |
---|
826 | { |
---|
827 | $result = $db->query('SELECT password FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch user password hash', __FILE__, __LINE__, $db->error()); |
---|
828 | pun_setcookie($id, $db->result($result), ($form['save_pass'] == '1') ? time() + 31536000 : 0); |
---|
829 | } |
---|
830 | |
---|
831 | break; |
---|
832 | } |
---|
833 | |
---|
834 | default: |
---|
835 | message($lang_common['Bad request']); |
---|
836 | } |
---|
837 | |
---|
838 | |
---|
839 | // Singlequotes around non-empty values and NULL for empty values |
---|
840 | $temp = array(); |
---|
841 | while (list($key, $input) = @each($form)) |
---|
842 | { |
---|
843 | $value = ($input !== '') ? '\''.$db->escape($input).'\'' : 'NULL'; |
---|
844 | |
---|
845 | $temp[] = $key.'='.$value; |
---|
846 | } |
---|
847 | |
---|
848 | if (empty($temp)) |
---|
849 | message($lang_common['Bad request']); |
---|
850 | |
---|
851 | $db->query('UPDATE '.$db->prefix.'users SET '.implode(',', $temp).' WHERE id='.$id) or error('Impossible de modifier le profil utilisateur', __FILE__, __LINE__, $db->error()); |
---|
852 | |
---|
853 | // If we changed the username we have to update some stuff |
---|
854 | if ($username_updated) |
---|
855 | { |
---|
856 | $db->query('UPDATE '.$db->prefix.'posts SET poster=\''.$db->escape($form['username']).'\' WHERE poster_id='.$id) or error('Unable to update posts', __FILE__, __LINE__, $db->error()); |
---|
857 | $db->query('UPDATE '.$db->prefix.'topics SET poster=\''.$db->escape($form['username']).'\' WHERE poster=\''.$db->escape($old_username).'\'') or error('Impossible de modifier les discussions', __FILE__, __LINE__, $db->error()); |
---|
858 | $db->query('UPDATE '.$db->prefix.'topics SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Impossible de modifier les discussions', __FILE__, __LINE__, $db->error()); |
---|
859 | $db->query('UPDATE '.$db->prefix.'forums SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Impossible de modifier les forums', __FILE__, __LINE__, $db->error()); |
---|
860 | $db->query('UPDATE '.$db->prefix.'online SET ident=\''.$db->escape($form['username']).'\' WHERE ident=\''.$db->escape($old_username).'\'') or error('Impossible de modifier la liste des utilisateurs en ligne', __FILE__, __LINE__, $db->error()); |
---|
861 | |
---|
862 | // If the user is a moderator or an administrator we have to update the moderator lists |
---|
863 | $result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error()); |
---|
864 | $group_id = $db->result($result); |
---|
865 | |
---|
866 | if ($group_id < PUN_GUEST) |
---|
867 | { |
---|
868 | $result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Impossible de retrouver la liste des forums', __FILE__, __LINE__, $db->error()); |
---|
869 | |
---|
870 | while ($cur_forum = $db->fetch_assoc($result)) |
---|
871 | { |
---|
872 | $cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
---|
873 | |
---|
874 | if (in_array($id, $cur_moderators)) |
---|
875 | { |
---|
876 | unset($cur_moderators[$old_username]); |
---|
877 | $cur_moderators[$form['username']] = $id; |
---|
878 | ksort($cur_moderators); |
---|
879 | |
---|
880 | $db->query('UPDATE '.$db->prefix.'forums SET moderators=\''.$db->escape(serialize($cur_moderators)).'\' WHERE id='.$cur_forum['id']) or error('Impossible de modifier les forums', __FILE__, __LINE__, $db->error()); |
---|
881 | } |
---|
882 | } |
---|
883 | } |
---|
884 | } |
---|
885 | |
---|
886 | redirect('profile.php?section='.$section.'&id='.$id, $lang_profile['Profile redirect']); |
---|
887 | } |
---|
888 | |
---|
889 | |
---|
890 | |
---|
891 | $result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.save_pass, u.notify_with_post, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig, u.timezone, u.language, u.style, u.num_posts, u.last_post, u.registered, u.registration_ip, u.admin_note, g.g_id, g.g_user_title FROM '.$db->prefix.'users AS u LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id='.$id) or error('Impossible de retrouver les informations utilisateur', __FILE__, __LINE__, $db->error()); |
---|
892 | if (!$db->num_rows($result)) |
---|
893 | message($lang_common['Bad request']); |
---|
894 | |
---|
895 | $user = $db->fetch_assoc($result); |
---|
896 | |
---|
897 | $last_post = format_time($user['last_post']); |
---|
898 | |
---|
899 | if ($user['signature'] != '') |
---|
900 | { |
---|
901 | require PUN_ROOT.'include/parser.php'; |
---|
902 | $parsed_signature = parse_signature($user['signature']); |
---|
903 | } |
---|
904 | |
---|
905 | |
---|
906 | // View or edit? |
---|
907 | if ($pun_user['id'] != $id && |
---|
908 | ($pun_user['g_id'] > PUN_MOD || |
---|
909 | ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '0') || |
---|
910 | ($pun_user['g_id'] == PUN_MOD && $user['g_id'] < PUN_GUEST))) |
---|
911 | { |
---|
912 | if ($user['email_setting'] == '0' && !$pun_user['is_guest']) |
---|
913 | $email_field = '<a href="mailto:'.$user['email'].'">'.$user['email'].'</a>'; |
---|
914 | else if ($user['email_setting'] == '1' && !$pun_user['is_guest']) |
---|
915 | $email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a>'; |
---|
916 | else |
---|
917 | $email_field = $lang_profile['Private']; |
---|
918 | |
---|
919 | $user_title_field = get_title($user); |
---|
920 | |
---|
921 | if ($user['url'] != '') |
---|
922 | { |
---|
923 | $user['url'] = pun_htmlspecialchars($user['url']); |
---|
924 | |
---|
925 | if ($pun_config['o_censoring'] == '1') |
---|
926 | $user['url'] = censor_words($user['url']); |
---|
927 | |
---|
928 | $url = '<a href="'.$user['url'].'">'.$user['url'].'</a>'; |
---|
929 | } |
---|
930 | else |
---|
931 | $url = $lang_profile['Unknown']; |
---|
932 | |
---|
933 | if ($pun_config['o_avatars'] == '1') |
---|
934 | { |
---|
935 | if ($user['use_avatar'] == '1') |
---|
936 | { |
---|
937 | if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif')) |
---|
938 | $avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.gif" '.$img_size[3].' alt="" />'; |
---|
939 | else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg')) |
---|
940 | $avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.jpg" '.$img_size[3].' alt="" />'; |
---|
941 | else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png')) |
---|
942 | $avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.png" '.$img_size[3].' alt="" />'; |
---|
943 | else |
---|
944 | $avatar_field = $lang_profile['No avatar']; |
---|
945 | } |
---|
946 | else |
---|
947 | $avatar_field = $lang_profile['No avatar']; |
---|
948 | } |
---|
949 | |
---|
950 | $posts_field = ''; |
---|
951 | if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST) |
---|
952 | $posts_field = $user['num_posts']; |
---|
953 | if ($pun_user['g_search'] == '1') |
---|
954 | $posts_field .= (($posts_field != '') ? ' - ' : '').'<a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a>'; |
---|
955 | |
---|
956 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
957 | define('PUN_ALLOW_INDEX', 1); |
---|
958 | require PUN_ROOT.'header.php'; |
---|
959 | |
---|
960 | ?> |
---|
961 | <div id="viewprofile" class="block"> |
---|
962 | <h2><span><?php echo $lang_common['Profile'] ?></span></h2> |
---|
963 | <div class="box"> |
---|
964 | <div class="fakeform"> |
---|
965 | <div class="inform"> |
---|
966 | <fieldset> |
---|
967 | <legend><?php echo $lang_profile['Section personal'] ?></legend> |
---|
968 | <div class="infldset"> |
---|
969 | <dl> |
---|
970 | <dt><?php echo $lang_common['Username'] ?>: </dt> |
---|
971 | <dd><?php echo pun_htmlspecialchars($user['username']) ?></dd> |
---|
972 | <dt><?php echo $lang_common['Title'] ?>: </dt> |
---|
973 | <dd><?php echo ($pun_config['o_censoring'] == '1') ? censor_words($user_title_field) : $user_title_field; ?></dd> |
---|
974 | <dt><?php echo $lang_profile['Realname'] ?>: </dt> |
---|
975 | <dd><?php echo ($user['realname'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['realname']) : $user['realname']) : $lang_profile['Unknown']; ?></dd> |
---|
976 | <dt><?php echo $lang_profile['Location'] ?>: </dt> |
---|
977 | <dd><?php echo ($user['location'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']; ?></dd> |
---|
978 | <dt><?php echo $lang_profile['Website'] ?>: </dt> |
---|
979 | <dd><?php echo $url ?> </dd> |
---|
980 | <dt><?php echo $lang_common['E-mail'] ?>: </dt> |
---|
981 | <dd><?php echo $email_field ?></dd> |
---|
982 | </dl> |
---|
983 | <div class="clearer"></div> |
---|
984 | </div> |
---|
985 | </fieldset> |
---|
986 | </div> |
---|
987 | <div class="inform"> |
---|
988 | <fieldset> |
---|
989 | <legend><?php echo $lang_profile['Section messaging'] ?></legend> |
---|
990 | <div class="infldset"> |
---|
991 | <dl> |
---|
992 | <dt><?php echo $lang_profile['Jabber'] ?>: </dt> |
---|
993 | <dd><?php echo ($user['jabber'] !='') ? pun_htmlspecialchars($user['jabber']) : $lang_profile['Unknown']; ?></dd> |
---|
994 | <dt><?php echo $lang_profile['ICQ'] ?>: </dt> |
---|
995 | <dd><?php echo ($user['icq'] !='') ? $user['icq'] : $lang_profile['Unknown']; ?></dd> |
---|
996 | <dt><?php echo $lang_profile['MSN'] ?>: </dt> |
---|
997 | <dd><?php echo ($user['msn'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['msn']) : $user['msn']) : $lang_profile['Unknown']; ?></dd> |
---|
998 | <dt><?php echo $lang_profile['AOL IM'] ?>: </dt> |
---|
999 | <dd><?php echo ($user['aim'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['aim']) : $user['aim']) : $lang_profile['Unknown']; ?></dd> |
---|
1000 | <dt><?php echo $lang_profile['Yahoo'] ?>: </dt> |
---|
1001 | <dd><?php echo ($user['yahoo'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']) : $lang_profile['Unknown']; ?></dd> |
---|
1002 | </dl> |
---|
1003 | <div class="clearer"></div> |
---|
1004 | </div> |
---|
1005 | </fieldset> |
---|
1006 | </div> |
---|
1007 | <div class="inform"> |
---|
1008 | <fieldset> |
---|
1009 | <legend><?php echo $lang_profile['Section personality'] ?></legend> |
---|
1010 | <div class="infldset"> |
---|
1011 | <dl> |
---|
1012 | <?php if ($pun_config['o_avatars'] == '1'): ?> <dt><?php echo $lang_profile['Avatar'] ?>: </dt> |
---|
1013 | <dd><?php echo $avatar_field ?></dd> |
---|
1014 | <?php endif; ?> <dt><?php echo $lang_profile['Signature'] ?>: </dt> |
---|
1015 | <dd><div><?php echo isset($parsed_signature) ? $parsed_signature : $lang_profile['No sig']; ?></div></dd> |
---|
1016 | </dl> |
---|
1017 | <div class="clearer"></div> |
---|
1018 | </div> |
---|
1019 | </fieldset> |
---|
1020 | </div> |
---|
1021 | <div class="inform"> |
---|
1022 | <fieldset> |
---|
1023 | <legend><?php echo $lang_profile['User activity'] ?></legend> |
---|
1024 | <div class="infldset"> |
---|
1025 | <dl> |
---|
1026 | <?php if ($posts_field != ''): ?> <dt><?php echo $lang_common['Posts'] ?>: </dt> |
---|
1027 | <dd><?php echo $posts_field ?></dd> |
---|
1028 | <?php endif; ?> <dt><?php echo $lang_common['Last post'] ?>: </dt> |
---|
1029 | <dd><?php echo $last_post ?></dd> |
---|
1030 | <dt><?php echo $lang_common['Registered'] ?>: </dt> |
---|
1031 | <dd><?php echo format_time($user['registered'], true) ?></dd> |
---|
1032 | </dl> |
---|
1033 | <div class="clearer"></div> |
---|
1034 | </div> |
---|
1035 | </fieldset> |
---|
1036 | </div> |
---|
1037 | </div> |
---|
1038 | </div> |
---|
1039 | </div> |
---|
1040 | |
---|
1041 | <?php |
---|
1042 | |
---|
1043 | require PUN_ROOT.'footer.php'; |
---|
1044 | } |
---|
1045 | else |
---|
1046 | { |
---|
1047 | if (!$section || $section == 'essentials') |
---|
1048 | { |
---|
1049 | if ($pun_user['g_id'] < PUN_GUEST) |
---|
1050 | { |
---|
1051 | if ($pun_user['g_id'] == PUN_ADMIN || $pun_config['p_mod_rename_users'] == '1') |
---|
1052 | $username_field = '<input type="hidden" name="old_username" value="'.pun_htmlspecialchars($user['username']).'" /><label><strong>'.$lang_common['Username'].'</strong><br /><input type="text" name="req_username" value="'.pun_htmlspecialchars($user['username']).'" size="25" maxlength="25" /><br /></label>'."\n"; |
---|
1053 | else |
---|
1054 | $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n"; |
---|
1055 | |
---|
1056 | $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label><p><a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a></p>'."\n"; |
---|
1057 | } |
---|
1058 | else |
---|
1059 | { |
---|
1060 | $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n"; |
---|
1061 | |
---|
1062 | if ($pun_config['o_regs_verify'] == '1') |
---|
1063 | $email_field = '<p>'.$lang_common['E-mail'].': '.$user['email'].' - <a href="profile.php?action=change_email&id='.$id.'">'.$lang_profile['Change e-mail'].'</a></p>'."\n"; |
---|
1064 | else |
---|
1065 | $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label>'."\n"; |
---|
1066 | } |
---|
1067 | |
---|
1068 | if ($pun_user['g_id'] == PUN_ADMIN) |
---|
1069 | $posts_field = '<label>'.$lang_common['Posts'].'<br /><input type="text" name="num_posts" value="'.$user['num_posts'].'" size="8" maxlength="8" /><br /></label><p><a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n"; |
---|
1070 | else if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST) |
---|
1071 | $posts_field = '<p>'.$lang_common['Posts'].': '.$user['num_posts'].' - <a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n"; |
---|
1072 | else |
---|
1073 | $posts_field = '<p><a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n"; |
---|
1074 | |
---|
1075 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
1076 | $required_fields = array('req_username' => $lang_common['Username'], 'req_email' => $lang_common['E-mail']); |
---|
1077 | require PUN_ROOT.'header.php'; |
---|
1078 | |
---|
1079 | generate_profile_menu('essentials'); |
---|
1080 | |
---|
1081 | ?> |
---|
1082 | <div class="blockform"> |
---|
1083 | <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section essentials'] ?></span></h2> |
---|
1084 | <div class="box"> |
---|
1085 | <form id="profile1" method="post" action="profile.php?section=essentials&id=<?php echo $id ?>" onsubmit="return process_form(this)"> |
---|
1086 | <div class="inform"> |
---|
1087 | <fieldset> |
---|
1088 | <legend><?php echo $lang_profile['Username and pass legend'] ?></legend> |
---|
1089 | <div class="infldset"> |
---|
1090 | <input type="hidden" name="form_sent" value="1" /> |
---|
1091 | <?php echo $username_field ?> |
---|
1092 | <?php if ($pun_user['id'] == $id || $pun_user['g_id'] == PUN_ADMIN || ($user['g_id'] > PUN_MOD && $pun_config['p_mod_change_passwords'] == '1')): ?><p><a href="profile.php?action=change_pass&id=<?php echo $id ?>"><?php echo $lang_profile['Change pass'] ?></a></p> |
---|
1093 | <?php endif; ?> </div> |
---|
1094 | </fieldset> |
---|
1095 | </div> |
---|
1096 | <div class="inform"> |
---|
1097 | <fieldset> |
---|
1098 | <legend><?php echo $lang_prof_reg['E-mail legend'] ?></legend> |
---|
1099 | <div class="infldset"> |
---|
1100 | <?php echo $email_field ?> |
---|
1101 | </div> |
---|
1102 | </fieldset> |
---|
1103 | </div> |
---|
1104 | <div class="inform"> |
---|
1105 | <fieldset> |
---|
1106 | <legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend> |
---|
1107 | <div class="infldset"> |
---|
1108 | <label><?php echo $lang_prof_reg['Timezone'] ?>: <?php echo $lang_prof_reg['Timezone info'] ?> |
---|
1109 | <br /><select name="form[timezone]"> |
---|
1110 | <option value="-12"<?php if ($user['timezone'] == -12) echo ' selected="selected"' ?>>-12</option> |
---|
1111 | <option value="-11"<?php if ($user['timezone'] == -11) echo ' selected="selected"' ?>>-11</option> |
---|
1112 | <option value="-10"<?php if ($user['timezone'] == -10) echo ' selected="selected"' ?>>-10</option> |
---|
1113 | <option value="-9.5"<?php if ($user['timezone'] == -9.5) echo ' selected="selected"' ?>>-09.5</option> |
---|
1114 | <option value="-9"<?php if ($user['timezone'] == -9) echo ' selected="selected"' ?>>-09</option> |
---|
1115 | <option value="-8.5"<?php if ($user['timezone'] == -8.5) echo ' selected="selected"' ?>>-08.5</option> |
---|
1116 | <option value="-8"<?php if ($user['timezone'] == -8) echo ' selected="selected"' ?>>-08 PST</option> |
---|
1117 | <option value="-7"<?php if ($user['timezone'] == -7) echo ' selected="selected"' ?>>-07 MST</option> |
---|
1118 | <option value="-6"<?php if ($user['timezone'] == -6) echo ' selected="selected"' ?>>-06 CST</option> |
---|
1119 | <option value="-5"<?php if ($user['timezone'] == -5) echo ' selected="selected"' ?>>-05 EST</option> |
---|
1120 | <option value="-4"<?php if ($user['timezone'] == -4) echo ' selected="selected"' ?>>-04 AST</option> |
---|
1121 | <option value="-3.5"<?php if ($user['timezone'] == -3.5) echo ' selected="selected"' ?>>-03.5</option> |
---|
1122 | <option value="-3"<?php if ($user['timezone'] == -3) echo ' selected="selected"' ?>>-03 ADT</option> |
---|
1123 | <option value="-2"<?php if ($user['timezone'] == -2) echo ' selected="selected"' ?>>-02</option> |
---|
1124 | <option value="-1"<?php if ($user['timezone'] == -1) echo ' selected="selected"' ?>>-01</option> |
---|
1125 | <option value="0"<?php if ($user['timezone'] == 0) echo ' selected="selected"' ?>>00 GMT</option> |
---|
1126 | <option value="1"<?php if ($user['timezone'] == 1) echo ' selected="selected"' ?>>+01 CET</option> |
---|
1127 | <option value="2"<?php if ($user['timezone'] == 2) echo ' selected="selected"' ?>>+02</option> |
---|
1128 | <option value="3"<?php if ($user['timezone'] == 3) echo ' selected="selected"' ?>>+03</option> |
---|
1129 | <option value="3.5"<?php if ($user['timezone'] == 3.5) echo ' selected="selected"' ?>>+03.5</option> |
---|
1130 | <option value="4"<?php if ($user['timezone'] == 4) echo ' selected="selected"' ?>>+04</option> |
---|
1131 | <option value="4.5"<?php if ($user['timezone'] == 4.5) echo ' selected="selected"' ?>>+04.5</option> |
---|
1132 | <option value="5"<?php if ($user['timezone'] == 5) echo ' selected="selected"' ?>>+05</option> |
---|
1133 | <option value="5.5"<?php if ($user['timezone'] == 5.5) echo ' selected="selected"' ?>>+05.5</option> |
---|
1134 | <option value="6"<?php if ($user['timezone'] == 6) echo ' selected="selected"' ?>>+06</option> |
---|
1135 | <option value="6.5"<?php if ($user['timezone'] == 6.5) echo ' selected="selected"' ?>>+06.5</option> |
---|
1136 | <option value="7"<?php if ($user['timezone'] == 7) echo ' selected="selected"' ?>>+07</option> |
---|
1137 | <option value="8"<?php if ($user['timezone'] == 8) echo ' selected="selected"' ?>>+08</option> |
---|
1138 | <option value="9"<?php if ($user['timezone'] == 9) echo ' selected="selected"' ?>>+09</option> |
---|
1139 | <option value="9.5"<?php if ($user['timezone'] == 9.5) echo ' selected="selected"' ?>>+09.5</option> |
---|
1140 | <option value="10"<?php if ($user['timezone'] == 10) echo ' selected="selected"' ?>>+10</option> |
---|
1141 | <option value="10.5"<?php if ($user['timezone'] == 10.5) echo ' selected="selected"' ?>>+10.5</option> |
---|
1142 | <option value="11"<?php if ($user['timezone'] == 11) echo ' selected="selected"' ?>>+11</option> |
---|
1143 | <option value="11.5"<?php if ($user['timezone'] == 11.5) echo ' selected="selected"' ?>>+11.5</option> |
---|
1144 | <option value="12"<?php if ($user['timezone'] == 12) echo ' selected="selected"' ?>>+12</option> |
---|
1145 | <option value="13"<?php if ($user['timezone'] == 13) echo ' selected="selected"' ?>>+13</option> |
---|
1146 | <option value="14"<?php if ($user['timezone'] == 14) echo ' selected="selected"' ?>>+14</option> |
---|
1147 | </select> |
---|
1148 | <br /></label> |
---|
1149 | <?php |
---|
1150 | |
---|
1151 | $languages = array(); |
---|
1152 | $d = dir(PUN_ROOT.'lang'); |
---|
1153 | while (($entry = $d->read()) !== false) |
---|
1154 | { |
---|
1155 | if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/common.php')) |
---|
1156 | $languages[] = $entry; |
---|
1157 | } |
---|
1158 | $d->close(); |
---|
1159 | |
---|
1160 | // Only display the language selection box if there's more than one language available |
---|
1161 | if (count($languages) > 1) |
---|
1162 | { |
---|
1163 | natsort($languages); |
---|
1164 | |
---|
1165 | ?> |
---|
1166 | <label><?php echo $lang_prof_reg['Language'] ?>: <?php echo $lang_prof_reg['Language info'] ?> |
---|
1167 | <br /><select name="form[language]"> |
---|
1168 | <?php |
---|
1169 | |
---|
1170 | while (list(, $temp) = @each($languages)) |
---|
1171 | { |
---|
1172 | if ($user['language'] == $temp) |
---|
1173 | echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n"; |
---|
1174 | else |
---|
1175 | echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n"; |
---|
1176 | } |
---|
1177 | |
---|
1178 | ?> |
---|
1179 | </select> |
---|
1180 | <br /></label> |
---|
1181 | <?php |
---|
1182 | |
---|
1183 | } |
---|
1184 | |
---|
1185 | ?> |
---|
1186 | </div> |
---|
1187 | </fieldset> |
---|
1188 | </div> |
---|
1189 | <div class="inform"> |
---|
1190 | <fieldset> |
---|
1191 | <legend><?php echo $lang_profile['User activity'] ?></legend> |
---|
1192 | <div class="infldset"> |
---|
1193 | <p><?php echo $lang_common['Registered'] ?>: <?php echo format_time($user['registered'], true); if ($pun_user['g_id'] < PUN_GUEST) echo ' (<a href="moderate.php?get_host='.pun_htmlspecialchars($user['registration_ip']).'">'.pun_htmlspecialchars($user['registration_ip']).'</a>)'; ?></p> |
---|
1194 | <p><?php echo $lang_common['Last post'] ?>: <?php echo $last_post ?></p> |
---|
1195 | <?php echo $posts_field ?> |
---|
1196 | <?php if ($pun_user['g_id'] < PUN_GUEST): ?> <label><?php echo $lang_profile['Admin note'] ?><br /> |
---|
1197 | <input id="admin_note" type="text" name="admin_note" value="<?php echo pun_htmlspecialchars($user['admin_note']) ?>" size="30" maxlength="30" /><br /></label> |
---|
1198 | </div> |
---|
1199 | <?php endif; ?> </fieldset> |
---|
1200 | </div> |
---|
1201 | <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> |
---|
1202 | </form> |
---|
1203 | </div> |
---|
1204 | </div> |
---|
1205 | <?php |
---|
1206 | |
---|
1207 | } |
---|
1208 | else if ($section == 'personal') |
---|
1209 | { |
---|
1210 | if ($pun_user['g_set_title'] == '1') |
---|
1211 | $title_field = '<label>'.$lang_common['Title'].'  (<em>'.$lang_profile['Leave blank'].'</em>)<br /><input type="text" name="title" value="'.pun_htmlspecialchars($user['title']).'" size="30" maxlength="50" /><br /></label>'."\n"; |
---|
1212 | |
---|
1213 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
1214 | require PUN_ROOT.'header.php'; |
---|
1215 | |
---|
1216 | generate_profile_menu('personal'); |
---|
1217 | |
---|
1218 | ?> |
---|
1219 | <div class="blockform"> |
---|
1220 | <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section personal'] ?></span></h2> |
---|
1221 | <div class="box"> |
---|
1222 | <form id="profile2" method="post" action="profile.php?section=personal&id=<?php echo $id ?>"> |
---|
1223 | <div class="inform"> |
---|
1224 | <fieldset> |
---|
1225 | <legend><?php echo $lang_profile['Personal details legend'] ?></legend> |
---|
1226 | <div class="infldset"> |
---|
1227 | <input type="hidden" name="form_sent" value="1" /> |
---|
1228 | <label><?php echo $lang_profile['Realname'] ?><br /><input type="text" name="form[realname]" value="<?php echo pun_htmlspecialchars($user['realname']) ?>" size="40" maxlength="40" /><br /></label> |
---|
1229 | <?php if (isset($title_field)): ?> <?php echo $title_field ?> |
---|
1230 | <?php endif; ?> <label><?php echo $lang_profile['Location'] ?><br /><input type="text" name="form[location]" value="<?php echo pun_htmlspecialchars($user['location']) ?>" size="30" maxlength="30" /><br /></label> |
---|
1231 | <label><?php echo $lang_profile['Website'] ?><br /><input type="text" name="form[url]" value="<?php echo pun_htmlspecialchars($user['url']) ?>" size="50" maxlength="80" /><br /></label> |
---|
1232 | </div> |
---|
1233 | </fieldset> |
---|
1234 | </div> |
---|
1235 | <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> |
---|
1236 | </form> |
---|
1237 | </div> |
---|
1238 | </div> |
---|
1239 | <?php |
---|
1240 | |
---|
1241 | } |
---|
1242 | else if ($section == 'messaging') |
---|
1243 | { |
---|
1244 | |
---|
1245 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
1246 | require PUN_ROOT.'header.php'; |
---|
1247 | |
---|
1248 | generate_profile_menu('messaging'); |
---|
1249 | |
---|
1250 | ?> |
---|
1251 | <div class="blockform"> |
---|
1252 | <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section messaging'] ?></span></h2> |
---|
1253 | <div class="box"> |
---|
1254 | <form id="profile3" method="post" action="profile.php?section=messaging&id=<?php echo $id ?>"> |
---|
1255 | <div class="inform"> |
---|
1256 | <fieldset> |
---|
1257 | <legend><?php echo $lang_profile['Contact details legend'] ?></legend> |
---|
1258 | <div class="infldset"> |
---|
1259 | <input type="hidden" name="form_sent" value="1" /> |
---|
1260 | <label><?php echo $lang_profile['Jabber'] ?><br /><input id="jabber" type="text" name="form[jabber]" value="<?php echo pun_htmlspecialchars($user['jabber']) ?>" size="40" maxlength="75" /><br /></label> |
---|
1261 | <label><?php echo $lang_profile['ICQ'] ?><br /><input id="icq" type="text" name="form[icq]" value="<?php echo $user['icq'] ?>" size="12" maxlength="12" /><br /></label> |
---|
1262 | <label><?php echo $lang_profile['MSN'] ?><br /><input id="msn" type="text" name="form[msn]" value="<?php echo pun_htmlspecialchars($user['msn']) ?>" size="40" maxlength="50" /><br /></label> |
---|
1263 | <label><?php echo $lang_profile['AOL IM'] ?><br /><input id="aim" type="text" name="form[aim]" value="<?php echo pun_htmlspecialchars($user['aim']) ?>" size="20" maxlength="30" /><br /></label> |
---|
1264 | <label><?php echo $lang_profile['Yahoo'] ?><br /><input id="yahoo" type="text" name="form[yahoo]" value="<?php echo pun_htmlspecialchars($user['yahoo']) ?>" size="20" maxlength="30" /><br /></label> |
---|
1265 | </div> |
---|
1266 | </fieldset> |
---|
1267 | </div> |
---|
1268 | <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> |
---|
1269 | </form> |
---|
1270 | </div> |
---|
1271 | </div> |
---|
1272 | <?php |
---|
1273 | |
---|
1274 | } |
---|
1275 | else if ($section == 'personality') |
---|
1276 | { |
---|
1277 | $avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Change avatar'].'</a>'; |
---|
1278 | if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif')) |
---|
1279 | $avatar_format = 'gif'; |
---|
1280 | else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg')) |
---|
1281 | $avatar_format = 'jpg'; |
---|
1282 | else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png')) |
---|
1283 | $avatar_format = 'png'; |
---|
1284 | else |
---|
1285 | $avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Upload avatar'].'</a>'; |
---|
1286 | |
---|
1287 | // Display the delete avatar link? |
---|
1288 | if ($img_size) |
---|
1289 | $avatar_field .= '   <a href="profile.php?action=delete_avatar&id='.$id.'">'.$lang_profile['Delete avatar'].'</a>'; |
---|
1290 | |
---|
1291 | if ($user['signature'] != '') |
---|
1292 | $signature_preview = '<p>'.$lang_profile['Sig preview'].'</p>'."\n\t\t\t\t\t".'<div class="postsignature">'."\n\t\t\t\t\t\t".'<hr />'."\n\t\t\t\t\t\t".$parsed_signature."\n\t\t\t\t\t".'</div>'."\n"; |
---|
1293 | else |
---|
1294 | $signature_preview = '<p>'.$lang_profile['No sig'].'</p>'."\n"; |
---|
1295 | |
---|
1296 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
1297 | require PUN_ROOT.'header.php'; |
---|
1298 | |
---|
1299 | generate_profile_menu('personality'); |
---|
1300 | |
---|
1301 | |
---|
1302 | ?> |
---|
1303 | <div class="blockform"> |
---|
1304 | <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section personality'] ?></span></h2> |
---|
1305 | <div class="box"> |
---|
1306 | <form id="profile4" method="post" action="profile.php?section=personality&id=<?php echo $id ?>"> |
---|
1307 | <div><input type="hidden" name="form_sent" value="1" /></div> |
---|
1308 | <?php if ($pun_config['o_avatars'] == '1'): ?> <div class="inform"> |
---|
1309 | <fieldset id="profileavatar"> |
---|
1310 | <legend><?php echo $lang_profile['Avatar legend'] ?></legend> |
---|
1311 | <div class="infldset"> |
---|
1312 | <?php if (isset($avatar_format)): ?> <img src="<?php echo $pun_config['o_avatars_dir'].'/'.$id.'.'.$avatar_format ?>" <?php echo $img_size[3] ?> alt="" /> |
---|
1313 | <?php endif; ?> <p><?php echo $lang_profile['Avatar info'] ?></p> |
---|
1314 | <div class="rbox"> |
---|
1315 | <label><input type="checkbox" name="form[use_avatar]" value="1"<?php if ($user['use_avatar'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Use avatar'] ?><br /></label> |
---|
1316 | </div> |
---|
1317 | <p class="clearb"><?php echo $avatar_field ?></p> |
---|
1318 | </div> |
---|
1319 | </fieldset> |
---|
1320 | </div> |
---|
1321 | <?php endif; ?> <div class="inform"> |
---|
1322 | <fieldset> |
---|
1323 | <legend><?php echo $lang_profile['Signature legend'] ?></legend> |
---|
1324 | <div class="infldset"> |
---|
1325 | <p><?php echo $lang_profile['Signature info'] ?></p> |
---|
1326 | <div class="txtarea"> |
---|
1327 | <label><?php echo $lang_profile['Sig max length'] ?>: <?php echo $pun_config['p_sig_length'] ?> / <?php echo $lang_profile['Sig max lines'] ?>: <?php echo $pun_config['p_sig_lines'] ?><br /> |
---|
1328 | <textarea name="signature" rows="4" cols="65"><?php echo pun_htmlspecialchars($user['signature']) ?></textarea><br /></label> |
---|
1329 | </div> |
---|
1330 | <ul class="bblinks"> |
---|
1331 | <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_sig_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li> |
---|
1332 | <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_sig_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li> |
---|
1333 | <li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies_sig'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li> |
---|
1334 | </ul> |
---|
1335 | <?php echo $signature_preview ?> |
---|
1336 | </div> |
---|
1337 | </fieldset> |
---|
1338 | </div> |
---|
1339 | <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> |
---|
1340 | </form> |
---|
1341 | </div> |
---|
1342 | </div> |
---|
1343 | <?php |
---|
1344 | |
---|
1345 | } |
---|
1346 | else if ($section == 'display') |
---|
1347 | { |
---|
1348 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
1349 | require PUN_ROOT.'header.php'; |
---|
1350 | |
---|
1351 | generate_profile_menu('display'); |
---|
1352 | |
---|
1353 | ?> |
---|
1354 | <div class="blockform"> |
---|
1355 | <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section display'] ?></span></h2> |
---|
1356 | <div class="box"> |
---|
1357 | <form id="profile5" method="post" action="profile.php?section=display&id=<?php echo $id ?>"> |
---|
1358 | <div><input type="hidden" name="form_sent" value="1" /></div> |
---|
1359 | <?php |
---|
1360 | |
---|
1361 | $styles = array(); |
---|
1362 | $d = dir(PUN_ROOT.'style'); |
---|
1363 | while (($entry = $d->read()) !== false) |
---|
1364 | { |
---|
1365 | if (substr($entry, strlen($entry)-4) == '.css') |
---|
1366 | $styles[] = substr($entry, 0, strlen($entry)-4); |
---|
1367 | } |
---|
1368 | $d->close(); |
---|
1369 | |
---|
1370 | // Only display the style selection box if there's more than one style available |
---|
1371 | if (count($styles) == 1) |
---|
1372 | echo "\t\t\t".'<div><input type="hidden" name="form[style]" value="'.$styles[0].'" /></div>'."\n"; |
---|
1373 | else if (count($styles) > 1) |
---|
1374 | { |
---|
1375 | natsort($styles); |
---|
1376 | ?> |
---|
1377 | <div class="inform"> |
---|
1378 | <fieldset> |
---|
1379 | <legend><?php echo $lang_profile['Style legend'] ?></legend> |
---|
1380 | <div class="infldset"> |
---|
1381 | <label><?php echo $lang_profile['Style info'] ?><br /> |
---|
1382 | |
---|
1383 | <select name="form[style]"> |
---|
1384 | <?php |
---|
1385 | |
---|
1386 | while (list(, $temp) = @each($styles)) |
---|
1387 | { |
---|
1388 | if ($user['style'] == $temp) |
---|
1389 | echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n"; |
---|
1390 | else |
---|
1391 | echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n"; |
---|
1392 | } |
---|
1393 | |
---|
1394 | ?> |
---|
1395 | </select> |
---|
1396 | <br /></label> |
---|
1397 | </div> |
---|
1398 | </fieldset> |
---|
1399 | </div> |
---|
1400 | <?php |
---|
1401 | |
---|
1402 | } |
---|
1403 | |
---|
1404 | ?> |
---|
1405 | <div class="inform"> |
---|
1406 | <fieldset> |
---|
1407 | <legend><?php echo $lang_profile['Post display legend'] ?></legend> |
---|
1408 | <div class="infldset"> |
---|
1409 | <p><?php echo $lang_profile['Post display info'] ?></p> |
---|
1410 | <div class="rbox"> |
---|
1411 | <label><input type="checkbox" name="form[show_smilies]" value="1"<?php if ($user['show_smilies'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Show smilies'] ?><br /></label> |
---|
1412 | <label><input type="checkbox" name="form[show_sig]" value="1"<?php if ($user['show_sig'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Show sigs'] ?><br /></label> |
---|
1413 | <?php if ($pun_config['o_avatars'] == '1'): ?> <label><input type="checkbox" name="form[show_avatars]" value="1"<?php if ($user['show_avatars'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Show avatars'] ?><br /></label> |
---|
1414 | <?php endif; ?> <label><input type="checkbox" name="form[show_img]" value="1"<?php if ($user['show_img'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Show images'] ?><br /></label> |
---|
1415 | <label><input type="checkbox" name="form[show_img_sig]" value="1"<?php if ($user['show_img_sig'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Show images sigs'] ?><br /></label> |
---|
1416 | </div> |
---|
1417 | </div> |
---|
1418 | </fieldset> |
---|
1419 | </div> |
---|
1420 | <div class="inform"> |
---|
1421 | <fieldset> |
---|
1422 | <legend><?php echo $lang_profile['Pagination legend'] ?></legend> |
---|
1423 | <div class="infldset"> |
---|
1424 | <label class="conl"><?php echo $lang_profile['Topics per page'] ?><br /><input type="text" name="form[disp_topics]" value="<?php echo $user['disp_topics'] ?>" size="6" maxlength="3" /><br /></label> |
---|
1425 | <label class="conl"><?php echo $lang_profile['Posts per page'] ?><br /><input type="text" name="form[disp_posts]" value="<?php echo $user['disp_posts'] ?>" size="6" maxlength="3" /><br /></label> |
---|
1426 | <p class="clearb"><?php echo $lang_profile['Paginate info'] ?> <?php echo $lang_profile['Leave blank'] ?></p> |
---|
1427 | </div> |
---|
1428 | </fieldset> |
---|
1429 | </div> |
---|
1430 | <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p> |
---|
1431 | </form> |
---|
1432 | </div> |
---|
1433 | </div> |
---|
1434 | <?php |
---|
1435 | |
---|
1436 | } |
---|
1437 | else if ($section == 'privacy') |
---|
1438 | { |
---|
1439 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
1440 | require PUN_ROOT.'header.php'; |
---|
1441 | |
---|
1442 | generate_profile_menu('privacy'); |
---|
1443 | |
---|
1444 | ?> |
---|
1445 | <div class="blockform"> |
---|
1446 | <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section privacy'] ?></span></h2> |
---|
1447 | <div class="box"> |
---|
1448 | <form id="profile6" method="post" action="profile.php?section=privacy&id=<?php echo $id ?>"> |
---|
1449 | <div class="inform"> |
---|
1450 | <fieldset> |
---|
1451 | <legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend> |
---|
1452 | <div class="infldset"> |
---|
1453 | <input type="hidden" name="form_sent" value="1" /> |
---|
1454 | <p><?php echo $lang_prof_reg['E-mail setting info'] ?></p> |
---|
1455 | <div class="rbox"> |
---|
1456 | <label><input type="radio" name="form[email_setting]" value="0"<?php if ($user['email_setting'] == '0') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 1'] ?><br /></label> |
---|
1457 | <label><input type="radio" name="form[email_setting]" value="1"<?php if ($user['email_setting'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 2'] ?><br /></label> |
---|
1458 | <label><input type="radio" name="form[email_setting]" value="2"<?php if ($user['email_setting'] == '2') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['E-mail setting 3'] ?><br /></label> |
---|
1459 | </div> |
---|
1460 | <p><?php echo $lang_prof_reg['Save user/pass info'] ?></p> |
---|
1461 | <div class="rbox"> |
---|
1462 | <label><input type="checkbox" name="form[save_pass]" value="1"<?php if ($user['save_pass'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_prof_reg['Save user/pass'] ?><br /></label> |
---|
1463 | </div> |
---|
1464 | <p><?php echo $lang_profile['Notify full info'] ?></p> |
---|
1465 | <div class="rbox"> |
---|
1466 | <label><input type="checkbox" name="form[notify_with_post]" value="1"<?php if ($user['notify_with_post'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Notify full'] ?><br /></label> |
---|
1467 | </div> |
---|
1468 | </div> |
---|
1469 | </fieldset> |
---|
1470 | </div> |
---|
1471 | <p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p> |
---|
1472 | </form> |
---|
1473 | </div> |
---|
1474 | </div> |
---|
1475 | <?php |
---|
1476 | |
---|
1477 | } |
---|
1478 | else if ($section == 'admin') |
---|
1479 | { |
---|
1480 | if ($pun_user['g_id'] > PUN_MOD || ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_ban_users'] == '0')) |
---|
1481 | message($lang_common['Bad request']); |
---|
1482 | |
---|
1483 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile']; |
---|
1484 | require PUN_ROOT.'header.php'; |
---|
1485 | |
---|
1486 | generate_profile_menu('admin'); |
---|
1487 | |
---|
1488 | ?> |
---|
1489 | <div class="blockform"> |
---|
1490 | <h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section admin'] ?></span></h2> |
---|
1491 | <div class="box"> |
---|
1492 | <form id="profile7" method="post" action="profile.php?section=admin&id=<?php echo $id ?>&action=foo"> |
---|
1493 | <div class="inform"> |
---|
1494 | <input type="hidden" name="form_sent" value="1" /> |
---|
1495 | <fieldset> |
---|
1496 | <?php |
---|
1497 | |
---|
1498 | if ($pun_user['g_id'] == PUN_MOD) |
---|
1499 | { |
---|
1500 | |
---|
1501 | ?> |
---|
1502 | <legend><?php echo $lang_profile['Delete ban legend'] ?></legend> |
---|
1503 | <div class="infldset"> |
---|
1504 | <p><input type="submit" name="ban" value="<?php echo $lang_profile['Ban user'] ?>" /></p> |
---|
1505 | </div> |
---|
1506 | </fieldset> |
---|
1507 | </div> |
---|
1508 | <?php |
---|
1509 | |
---|
1510 | } |
---|
1511 | else |
---|
1512 | { |
---|
1513 | if ($pun_user['id'] != $id) |
---|
1514 | { |
---|
1515 | |
---|
1516 | ?> |
---|
1517 | <legend><?php echo $lang_profile['Group membership legend'] ?></legend> |
---|
1518 | <div class="infldset"> |
---|
1519 | <select id="group_id" name="group_id"> |
---|
1520 | <?php |
---|
1521 | |
---|
1522 | $result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' ORDER BY g_title') or error('Impossible de retrouver la liste des groupes utilisateurs', __FILE__, __LINE__, $db->error()); |
---|
1523 | |
---|
1524 | while ($cur_group = $db->fetch_assoc($result)) |
---|
1525 | { |
---|
1526 | if ($cur_group['g_id'] == $user['g_id'] || ($cur_group['g_id'] == $pun_config['o_default_user_group'] && $user['g_id'] == '')) |
---|
1527 | echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n"; |
---|
1528 | else |
---|
1529 | echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n"; |
---|
1530 | } |
---|
1531 | |
---|
1532 | ?> |
---|
1533 | </select> |
---|
1534 | <input type="submit" name="update_group_membership" value="<?php echo $lang_profile['Save'] ?>" /> |
---|
1535 | </div> |
---|
1536 | </fieldset> |
---|
1537 | </div> |
---|
1538 | <div class="inform"> |
---|
1539 | <fieldset> |
---|
1540 | <?php |
---|
1541 | |
---|
1542 | } |
---|
1543 | |
---|
1544 | ?> |
---|
1545 | <legend><?php echo $lang_profile['Delete ban legend'] ?></legend> |
---|
1546 | <div class="infldset"> |
---|
1547 | <input type="submit" name="delete_user" value="<?php echo $lang_profile['Delete user'] ?>" />  <input type="submit" name="ban" value="<?php echo $lang_profile['Ban user'] ?>" /> |
---|
1548 | </div> |
---|
1549 | </fieldset> |
---|
1550 | </div> |
---|
1551 | <?php |
---|
1552 | |
---|
1553 | if ($user['g_id'] == PUN_MOD || $user['g_id'] == PUN_ADMIN) |
---|
1554 | { |
---|
1555 | |
---|
1556 | ?> |
---|
1557 | <div class="inform"> |
---|
1558 | <fieldset> |
---|
1559 | <legend><?php echo $lang_profile['Set mods legend'] ?></legend> |
---|
1560 | <div class="infldset"> |
---|
1561 | <p><?php echo $lang_profile['Moderator in info'] ?></p> |
---|
1562 | <?php |
---|
1563 | |
---|
1564 | $result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.moderators FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id WHERE f.redirect_url IS NULL ORDER BY c.disp_position, c.id, f.disp_position') or error('Impossible de retrouver la liste des catégories et des forums', __FILE__, __LINE__, $db->error()); |
---|
1565 | |
---|
1566 | $cur_category = 0; |
---|
1567 | while ($cur_forum = $db->fetch_assoc($result)) |
---|
1568 | { |
---|
1569 | if ($cur_forum['cid'] != $cur_category) // A new category since last iteration? |
---|
1570 | { |
---|
1571 | if ($cur_category) |
---|
1572 | echo "\n\t\t\t\t\t\t\t\t".'</div>'; |
---|
1573 | |
---|
1574 | if ($cur_category != 0) |
---|
1575 | echo "\n\t\t\t\t\t\t\t".'</div>'."\n"; |
---|
1576 | |
---|
1577 | echo "\t\t\t\t\t\t\t".'<div class="conl">'."\n\t\t\t\t\t\t\t\t".'<p><strong>'.$cur_forum['cat_name'].'</strong></p>'."\n\t\t\t\t\t\t\t\t".'<div class="rbox">'; |
---|
1578 | $cur_category = $cur_forum['cid']; |
---|
1579 | } |
---|
1580 | |
---|
1581 | $moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array(); |
---|
1582 | |
---|
1583 | echo "\n\t\t\t\t\t\t\t\t\t".'<label><input type="checkbox" name="moderator_in['.$cur_forum['fid'].']" value="1"'.((in_array($id, $moderators)) ? ' checked="checked"' : '').' />'.pun_htmlspecialchars($cur_forum['forum_name']).'<br /></label>'."\n"; |
---|
1584 | } |
---|
1585 | |
---|
1586 | ?> |
---|
1587 | </div> |
---|
1588 | </div> |
---|
1589 | <br class="clearb" /><input type="submit" name="update_forums" value="<?php echo $lang_profile['Update forums'] ?>" /> |
---|
1590 | </div> |
---|
1591 | </fieldset> |
---|
1592 | </div> |
---|
1593 | <?php |
---|
1594 | |
---|
1595 | } |
---|
1596 | } |
---|
1597 | |
---|
1598 | ?> |
---|
1599 | </form> |
---|
1600 | </div> |
---|
1601 | </div> |
---|
1602 | <?php |
---|
1603 | |
---|
1604 | } |
---|
1605 | |
---|
1606 | ?> |
---|
1607 | <div class="clearer"></div> |
---|
1608 | </div> |
---|
1609 | <?php |
---|
1610 | |
---|
1611 | require PUN_ROOT.'footer.php'; |
---|
1612 | } |
---|