0
|
1 |
<?php
|
|
2 |
/***********************************************************************
|
|
3 |
|
|
4 |
Copyright (C) 2002-2005 Rickard Andersson (rickard@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 |
define('PUN_ROOT', './');
|
|
27 |
require PUN_ROOT.'include/common.php';
|
|
28 |
|
|
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('Unable to fetch new password', __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('Unable to update password', __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('Unable to fetch user info', __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('Unable to fetch password', __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('Unable to update password', __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('Unable to fetch user info', __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('Unable to fetch activation data', __FILE__, __LINE__, $db->error());
|
|
191 |
list($new_email, $new_email_key) = $db->fetch_row($result);
|
|
192 |
|
|
193 |
if ($key == '' || $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('Unable to update e-mail address', __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 = 'Alert - Banned e-mail detected';
|
|
222 |
$mail_message = 'User \''.$pun_user['username'].'\' changed to banned e-mail address: '.$new_email."\n\n".'User profile: '.$pun_config['o_base_url'].'/profile.php?id='.$id."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this 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('Unable to fetch user info', __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 = 'Alert - Duplicate e-mail detected';
|
|
240 |
$mail_message = 'User \''.$pun_user['username'].'\' changed to an e-mail address that also belongs to: '.implode(', ', $dupe_list)."\n\n".'User profile: '.$pun_config['o_base_url'].'/profile.php?id='.$id."\n\n".'-- '."\n".'Forum Mailer'."\n".'(Do not reply to this 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('Unable to update activation data', __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('Unable to update avatar state', __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('Unable to update avatar state', __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('Unable to change user group', __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('Unable to fetch forum list', __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('Unable to update 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('Unable to fetch user info', __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('Unable to fetch forum list', __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('Unable to update forum', __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('Unable to update forum', __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('Unable to fetch user info', __FILE__, __LINE__, $db->error());
|
|
540 |
list($group_id, $username) = $db->fetch_row($result);
|
|
541 |
|
|
542 |
if ($group_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 |
// 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('Unable to fetch forum list', __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('Unable to update forum', __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('Unable to remove user from online list', __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('Unable to fetch posts', __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('Unable to fetch post info', __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('Unable to update posts', __FILE__, __LINE__, $db->error());
|
|
599 |
|
|
600 |
// Delete the user
|
|
601 |
$db->query('DELETE FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to delete user', __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('Unable to fetch user info', __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'], 'Guest') || !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('Unable to fetch user info', __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 |
if (isset($form['language']))
|
|
724 |
{
|
|
725 |
$form['language'] = preg_replace('#[\.\\\/]#', '', $form['language']);
|
|
726 |
if (!file_exists(PUN_ROOT.'lang/'.$form['language'].'/common.php'))
|
|
727 |
message($lang_common['Bad request']);
|
|
728 |
}
|
|
729 |
|
|
730 |
break;
|
|
731 |
}
|
|
732 |
|
|
733 |
case 'personal':
|
|
734 |
{
|
|
735 |
$form = extract_elements(array('realname', 'url', 'location'));
|
|
736 |
|
|
737 |
if ($pun_user['g_id'] == PUN_ADMIN)
|
|
738 |
$form['title'] = trim($_POST['title']);
|
|
739 |
else if ($pun_user['g_set_title'] == '1')
|
|
740 |
{
|
|
741 |
$form['title'] = trim($_POST['title']);
|
|
742 |
|
|
743 |
if ($form['title'] != '')
|
|
744 |
{
|
|
745 |
// A list of words that the title may not contain
|
|
746 |
// If the language is English, there will be some duplicates, but it's not the end of the world
|
|
747 |
$forbidden = array('Member', 'Moderator', 'Administrator', 'Banned', 'Guest', $lang_common['Member'], $lang_common['Moderator'], $lang_common['Administrator'], $lang_common['Banned'], $lang_common['Guest']);
|
|
748 |
|
|
749 |
if (in_array($form['title'], $forbidden))
|
|
750 |
message($lang_profile['Forbidden title']);
|
|
751 |
}
|
|
752 |
}
|
|
753 |
|
|
754 |
// Add http:// if the URL doesn't contain it already
|
|
755 |
if ($form['url'] != '' && strpos(strtolower($form['url']), 'http://') !== 0)
|
|
756 |
$form['url'] = 'http://'.$form['url'];
|
|
757 |
|
|
758 |
break;
|
|
759 |
}
|
|
760 |
|
|
761 |
case 'messaging':
|
|
762 |
{
|
|
763 |
$form = extract_elements(array('jabber', 'icq', 'msn', 'aim', 'yahoo'));
|
|
764 |
|
|
765 |
// If the ICQ UIN contains anything other than digits it's invalid
|
|
766 |
if ($form['icq'] != '' && @preg_match('/[^0-9]/', $form['icq']))
|
|
767 |
message($lang_prof_reg['Bad ICQ']);
|
|
768 |
|
|
769 |
break;
|
|
770 |
}
|
|
771 |
|
|
772 |
case 'personality':
|
|
773 |
{
|
|
774 |
$form = extract_elements(array('use_avatar'));
|
|
775 |
|
|
776 |
// Clean up signature from POST
|
|
777 |
$form['signature'] = pun_linebreaks(trim($_POST['signature']));
|
|
778 |
|
|
779 |
// Validate signature
|
|
780 |
if (pun_strlen($form['signature']) > $pun_config['p_sig_length'])
|
|
781 |
message($lang_prof_reg['Sig too long'].' '.$pun_config['p_sig_length'].' '.$lang_prof_reg['characters'].'.');
|
|
782 |
else if (substr_count($form['signature'], "\n") > ($pun_config['p_sig_lines']-1))
|
|
783 |
message($lang_prof_reg['Sig too many lines'].' '.$pun_config['p_sig_lines'].' '.$lang_prof_reg['lines'].'.');
|
|
784 |
else if ($form['signature'] && $pun_config['p_sig_all_caps'] == '0' && strtoupper($form['signature']) == $form['signature'] && $pun_user['g_id'] > PUN_MOD)
|
|
785 |
$form['signature'] = ucwords(strtolower($form['signature']));
|
|
786 |
|
|
787 |
// Validate BBCode syntax
|
|
788 |
if ($pun_config['p_sig_bbcode'] == '1' && strpos($form['signature'], '[') !== false && strpos($form['signature'], ']') !== false)
|
|
789 |
{
|
|
790 |
require PUN_ROOT.'include/parser.php';
|
|
791 |
$form['signature'] = preparse_bbcode($form['signature'], $foo, true);
|
|
792 |
}
|
|
793 |
|
|
794 |
if (!isset($form['use_avatar']) || $form['use_avatar'] != '1') $form['use_avatar'] = '0';
|
|
795 |
|
|
796 |
break;
|
|
797 |
}
|
|
798 |
|
|
799 |
case 'display':
|
|
800 |
{
|
|
801 |
$form = extract_elements(array('disp_topics', 'disp_posts', 'show_smilies', 'show_img', 'show_img_sig', 'show_avatars', 'show_sig', 'style'));
|
|
802 |
|
|
803 |
if ($form['disp_topics'] != '' && intval($form['disp_topics']) < 3) $form['disp_topics'] = 3;
|
|
804 |
if ($form['disp_topics'] != '' && intval($form['disp_topics']) > 75) $form['disp_topics'] = 75;
|
|
805 |
if ($form['disp_posts'] != '' && intval($form['disp_posts']) < 3) $form['disp_posts'] = 3;
|
|
806 |
if ($form['disp_posts'] != '' && intval($form['disp_posts']) > 75) $form['disp_posts'] = 75;
|
|
807 |
|
|
808 |
if (!isset($form['show_smilies']) || $form['show_smilies'] != '1') $form['show_smilies'] = '0';
|
|
809 |
if (!isset($form['show_img']) || $form['show_img'] != '1') $form['show_img'] = '0';
|
|
810 |
if (!isset($form['show_img_sig']) || $form['show_img_sig'] != '1') $form['show_img_sig'] = '0';
|
|
811 |
if (!isset($form['show_avatars']) || $form['show_avatars'] != '1') $form['show_avatars'] = '0';
|
|
812 |
if (!isset($form['show_sig']) || $form['show_sig'] != '1') $form['show_sig'] = '0';
|
|
813 |
|
|
814 |
break;
|
|
815 |
}
|
|
816 |
|
|
817 |
case 'privacy':
|
|
818 |
{
|
|
819 |
$form = extract_elements(array('email_setting', 'save_pass', 'notify_with_post'));
|
|
820 |
|
|
821 |
$form['email_setting'] = intval($form['email_setting']);
|
|
822 |
if ($form['email_setting'] < 0 && $form['email_setting'] > 2) $form['email_setting'] = 1;
|
|
823 |
|
|
824 |
if (!isset($form['save_pass']) || $form['save_pass'] != '1') $form['save_pass'] = '0';
|
|
825 |
if (!isset($form['notify_with_post']) || $form['notify_with_post'] != '1') $form['notify_with_post'] = '0';
|
|
826 |
|
|
827 |
// If the save_pass setting has changed, we need to set a new cookie with the appropriate expire date
|
|
828 |
if ($pun_user['id'] == $id && $form['save_pass'] != $pun_user['save_pass'])
|
|
829 |
{
|
|
830 |
$result = $db->query('SELECT password FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch user password hash', __FILE__, __LINE__, $db->error());
|
|
831 |
pun_setcookie($id, $db->result($result), ($form['save_pass'] == '1') ? time() + 31536000 : 0);
|
|
832 |
}
|
|
833 |
|
|
834 |
break;
|
|
835 |
}
|
|
836 |
|
|
837 |
default:
|
|
838 |
message($lang_common['Bad request']);
|
|
839 |
}
|
|
840 |
|
|
841 |
|
|
842 |
// Singlequotes around non-empty values and NULL for empty values
|
|
843 |
$temp = array();
|
|
844 |
while (list($key, $input) = @each($form))
|
|
845 |
{
|
|
846 |
$value = ($input !== '') ? '\''.$db->escape($input).'\'' : 'NULL';
|
|
847 |
|
|
848 |
$temp[] = $key.'='.$value;
|
|
849 |
}
|
|
850 |
|
|
851 |
if (empty($temp))
|
|
852 |
message($lang_common['Bad request']);
|
|
853 |
|
|
854 |
|
|
855 |
$db->query('UPDATE '.$db->prefix.'users SET '.implode(',', $temp).' WHERE id='.$id) or error('Unable to update profile', __FILE__, __LINE__, $db->error());
|
|
856 |
|
|
857 |
// If we changed the username we have to update some stuff
|
|
858 |
if ($username_updated)
|
|
859 |
{
|
|
860 |
$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());
|
|
861 |
$db->query('UPDATE '.$db->prefix.'topics SET poster=\''.$db->escape($form['username']).'\' WHERE poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error());
|
|
862 |
$db->query('UPDATE '.$db->prefix.'topics SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update topics', __FILE__, __LINE__, $db->error());
|
|
863 |
$db->query('UPDATE '.$db->prefix.'forums SET last_poster=\''.$db->escape($form['username']).'\' WHERE last_poster=\''.$db->escape($old_username).'\'') or error('Unable to update forums', __FILE__, __LINE__, $db->error());
|
|
864 |
$db->query('UPDATE '.$db->prefix.'online SET ident=\''.$db->escape($form['username']).'\' WHERE ident=\''.$db->escape($old_username).'\'') or error('Unable to update online list', __FILE__, __LINE__, $db->error());
|
|
865 |
|
|
866 |
// If the user is a moderator or an administrator we have to update the moderator lists
|
|
867 |
$result = $db->query('SELECT group_id FROM '.$db->prefix.'users WHERE id='.$id) or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
|
|
868 |
$group_id = $db->result($result);
|
|
869 |
|
|
870 |
if ($group_id < PUN_GUEST)
|
|
871 |
{
|
|
872 |
$result = $db->query('SELECT id, moderators FROM '.$db->prefix.'forums') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
|
|
873 |
|
|
874 |
while ($cur_forum = $db->fetch_assoc($result))
|
|
875 |
{
|
|
876 |
$cur_moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array();
|
|
877 |
|
|
878 |
if (in_array($id, $cur_moderators))
|
|
879 |
{
|
|
880 |
unset($cur_moderators[$old_username]);
|
|
881 |
$cur_moderators[$form['username']] = $id;
|
|
882 |
ksort($cur_moderators);
|
|
883 |
|
|
884 |
$db->query('UPDATE '.$db->prefix.'forums SET moderators=\''.$db->escape(serialize($cur_moderators)).'\' WHERE id='.$cur_forum['id']) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
|
|
885 |
}
|
|
886 |
}
|
|
887 |
}
|
|
888 |
}
|
|
889 |
|
|
890 |
redirect('profile.php?section='.$section.'&id='.$id, $lang_profile['Profile redirect']);
|
|
891 |
}
|
|
892 |
|
|
893 |
|
|
894 |
$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('Unable to fetch user info', __FILE__, __LINE__, $db->error());
|
|
895 |
if (!$db->num_rows($result))
|
|
896 |
message($lang_common['Bad request']);
|
|
897 |
|
|
898 |
$user = $db->fetch_assoc($result);
|
|
899 |
|
|
900 |
$last_post = format_time($user['last_post']);
|
|
901 |
|
|
902 |
if ($user['signature'] != '')
|
|
903 |
{
|
|
904 |
require PUN_ROOT.'include/parser.php';
|
|
905 |
$parsed_signature = parse_signature($user['signature']);
|
|
906 |
}
|
|
907 |
|
|
908 |
|
|
909 |
// View or edit?
|
|
910 |
if ($pun_user['id'] != $id &&
|
|
911 |
($pun_user['g_id'] > PUN_MOD ||
|
|
912 |
($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_edit_users'] == '0') ||
|
|
913 |
($pun_user['g_id'] == PUN_MOD && $user['g_id'] < PUN_GUEST)))
|
|
914 |
{
|
|
915 |
if ($user['email_setting'] == '0' && !$pun_user['is_guest'])
|
|
916 |
$email_field = '<a href="mailto:'.$user['email'].'">'.$user['email'].'</a>';
|
|
917 |
else if ($user['email_setting'] == '1' && !$pun_user['is_guest'])
|
|
918 |
$email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a>';
|
|
919 |
else
|
|
920 |
$email_field = $lang_profile['Private'];
|
|
921 |
|
|
922 |
$user_title_field = get_title($user);
|
|
923 |
|
|
924 |
if ($user['url'] != '')
|
|
925 |
{
|
|
926 |
$user['url'] = pun_htmlspecialchars($user['url']);
|
|
927 |
|
|
928 |
if ($pun_config['o_censoring'] == '1')
|
|
929 |
$user['url'] = censor_words($user['url']);
|
|
930 |
|
|
931 |
$url = '<a href="'.$user['url'].'">'.$user['url'].'</a>';
|
|
932 |
}
|
|
933 |
else
|
|
934 |
$url = $lang_profile['Unknown'];
|
|
935 |
|
|
936 |
if ($pun_config['o_avatars'] == '1')
|
|
937 |
{
|
|
938 |
if ($user['use_avatar'] == '1')
|
|
939 |
{
|
|
940 |
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif'))
|
|
941 |
$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.gif" '.$img_size[3].' alt="" />';
|
|
942 |
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg'))
|
|
943 |
$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.jpg" '.$img_size[3].' alt="" />';
|
|
944 |
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png'))
|
|
945 |
$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.png" '.$img_size[3].' alt="" />';
|
|
946 |
else
|
|
947 |
$avatar_field = $lang_profile['No avatar'];
|
|
948 |
}
|
|
949 |
else
|
|
950 |
$avatar_field = $lang_profile['No avatar'];
|
|
951 |
}
|
|
952 |
|
|
953 |
$posts_field = '';
|
|
954 |
if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
|
|
955 |
$posts_field = $user['num_posts'];
|
|
956 |
if ($pun_user['g_search'] == '1')
|
|
957 |
$posts_field .= (($posts_field != '') ? ' - ' : '').'<a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a>';
|
|
958 |
|
|
959 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
960 |
define('PUN_ALLOW_INDEX', 1);
|
|
961 |
require PUN_ROOT.'header.php';
|
|
962 |
|
|
963 |
?>
|
|
964 |
<div id="viewprofile" class="block">
|
|
965 |
<h2><span><?php echo $lang_common['Profile'] ?></span></h2>
|
|
966 |
<div class="box">
|
|
967 |
<div class="fakeform">
|
|
968 |
<div class="inform">
|
|
969 |
<fieldset>
|
|
970 |
<legend><?php echo $lang_profile['Section personal'] ?></legend>
|
|
971 |
<div class="infldset">
|
|
972 |
<dl>
|
|
973 |
<dt><?php echo $lang_common['Username'] ?>: </dt>
|
|
974 |
<dd><?php echo pun_htmlspecialchars($user['username']) ?></dd>
|
|
975 |
<dt><?php echo $lang_common['Title'] ?>: </dt>
|
|
976 |
<dd><?php echo ($pun_config['o_censoring'] == '1') ? censor_words($user_title_field) : $user_title_field; ?></dd>
|
|
977 |
<dt><?php echo $lang_profile['Realname'] ?>: </dt>
|
|
978 |
<dd><?php echo ($user['realname'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['realname']) : $user['realname']) : $lang_profile['Unknown']; ?></dd>
|
|
979 |
<dt><?php echo $lang_profile['Location'] ?>: </dt>
|
|
980 |
<dd><?php echo ($user['location'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['location']) : $user['location']) : $lang_profile['Unknown']; ?></dd>
|
|
981 |
<dt><?php echo $lang_profile['Website'] ?>: </dt>
|
|
982 |
<dd><?php echo $url ?> </dd>
|
|
983 |
<dt><?php echo $lang_common['E-mail'] ?>: </dt>
|
|
984 |
<dd><?php echo $email_field ?></dd>
|
|
985 |
</dl>
|
|
986 |
<div class="clearer"></div>
|
|
987 |
</div>
|
|
988 |
</fieldset>
|
|
989 |
</div>
|
|
990 |
<div class="inform">
|
|
991 |
<fieldset>
|
|
992 |
<legend><?php echo $lang_profile['Section messaging'] ?></legend>
|
|
993 |
<div class="infldset">
|
|
994 |
<dl>
|
|
995 |
<dt><?php echo $lang_profile['Jabber'] ?>: </dt>
|
|
996 |
<dd><?php echo ($user['jabber'] !='') ? pun_htmlspecialchars($user['jabber']) : $lang_profile['Unknown']; ?></dd>
|
|
997 |
<dt><?php echo $lang_profile['ICQ'] ?>: </dt>
|
|
998 |
<dd><?php echo ($user['icq'] !='') ? $user['icq'] : $lang_profile['Unknown']; ?></dd>
|
|
999 |
<dt><?php echo $lang_profile['MSN'] ?>: </dt>
|
|
1000 |
<dd><?php echo ($user['msn'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['msn']) : $user['msn']) : $lang_profile['Unknown']; ?></dd>
|
|
1001 |
<dt><?php echo $lang_profile['AOL IM'] ?>: </dt>
|
|
1002 |
<dd><?php echo ($user['aim'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['aim']) : $user['aim']) : $lang_profile['Unknown']; ?></dd>
|
|
1003 |
<dt><?php echo $lang_profile['Yahoo'] ?>: </dt>
|
|
1004 |
<dd><?php echo ($user['yahoo'] !='') ? pun_htmlspecialchars(($pun_config['o_censoring'] == '1') ? censor_words($user['yahoo']) : $user['yahoo']) : $lang_profile['Unknown']; ?></dd>
|
|
1005 |
</dl>
|
|
1006 |
<div class="clearer"></div>
|
|
1007 |
</div>
|
|
1008 |
</fieldset>
|
|
1009 |
</div>
|
|
1010 |
<div class="inform">
|
|
1011 |
<fieldset>
|
|
1012 |
<legend><?php echo $lang_profile['Section personality'] ?></legend>
|
|
1013 |
<div class="infldset">
|
|
1014 |
<dl>
|
|
1015 |
<?php if ($pun_config['o_avatars'] == '1'): ?> <dt><?php echo $lang_profile['Avatar'] ?>: </dt>
|
|
1016 |
<dd><?php echo $avatar_field ?></dd>
|
|
1017 |
<?php endif; ?> <dt><?php echo $lang_profile['Signature'] ?>: </dt>
|
|
1018 |
<dd><div><?php echo isset($parsed_signature) ? $parsed_signature : $lang_profile['No sig']; ?></div></dd>
|
|
1019 |
</dl>
|
|
1020 |
<div class="clearer"></div>
|
|
1021 |
</div>
|
|
1022 |
</fieldset>
|
|
1023 |
</div>
|
|
1024 |
<div class="inform">
|
|
1025 |
<fieldset>
|
|
1026 |
<legend><?php echo $lang_profile['User activity'] ?></legend>
|
|
1027 |
<div class="infldset">
|
|
1028 |
<dl>
|
|
1029 |
<?php if ($posts_field != ''): ?> <dt><?php echo $lang_common['Posts'] ?>: </dt>
|
|
1030 |
<dd><?php echo $posts_field ?></dd>
|
|
1031 |
<?php endif; ?> <dt><?php echo $lang_common['Last post'] ?>: </dt>
|
|
1032 |
<dd><?php echo $last_post ?></dd>
|
|
1033 |
<dt><?php echo $lang_common['Registered'] ?>: </dt>
|
|
1034 |
<dd><?php echo format_time($user['registered'], true) ?></dd>
|
|
1035 |
</dl>
|
|
1036 |
<div class="clearer"></div>
|
|
1037 |
</div>
|
|
1038 |
</fieldset>
|
|
1039 |
</div>
|
|
1040 |
</div>
|
|
1041 |
</div>
|
|
1042 |
</div>
|
|
1043 |
|
|
1044 |
<?php
|
|
1045 |
|
|
1046 |
require PUN_ROOT.'footer.php';
|
|
1047 |
}
|
|
1048 |
else
|
|
1049 |
{
|
|
1050 |
if (!$section || $section == 'essentials')
|
|
1051 |
{
|
|
1052 |
if ($pun_user['g_id'] < PUN_GUEST)
|
|
1053 |
{
|
|
1054 |
if ($pun_user['g_id'] == PUN_ADMIN || $pun_config['p_mod_rename_users'] == '1')
|
|
1055 |
$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";
|
|
1056 |
else
|
|
1057 |
$username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n";
|
|
1058 |
|
|
1059 |
$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";
|
|
1060 |
}
|
|
1061 |
else
|
|
1062 |
{
|
|
1063 |
$username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n";
|
|
1064 |
|
|
1065 |
if ($pun_config['o_regs_verify'] == '1')
|
|
1066 |
$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";
|
|
1067 |
else
|
|
1068 |
$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";
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
if ($pun_user['g_id'] == PUN_ADMIN)
|
|
1072 |
$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";
|
|
1073 |
else if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
|
|
1074 |
$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";
|
|
1075 |
else
|
|
1076 |
$posts_field = '<p><a href="search.php?action=show_user&user_id='.$id.'">'.$lang_profile['Show posts'].'</a></p>'."\n";
|
|
1077 |
|
|
1078 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
1079 |
$required_fields = array('req_username' => $lang_common['Username'], 'req_email' => $lang_common['E-mail']);
|
|
1080 |
require PUN_ROOT.'header.php';
|
|
1081 |
|
|
1082 |
generate_profile_menu('essentials');
|
|
1083 |
|
|
1084 |
?>
|
|
1085 |
<div class="blockform">
|
|
1086 |
<h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section essentials'] ?></span></h2>
|
|
1087 |
<div class="box">
|
|
1088 |
<form id="profile1" method="post" action="profile.php?section=essentials&id=<?php echo $id ?>" onsubmit="return process_form(this)">
|
|
1089 |
<div class="inform">
|
|
1090 |
<fieldset>
|
|
1091 |
<legend><?php echo $lang_profile['Username and pass legend'] ?></legend>
|
|
1092 |
<div class="infldset">
|
|
1093 |
<input type="hidden" name="form_sent" value="1" />
|
|
1094 |
<?php echo $username_field ?>
|
|
1095 |
<?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>
|
|
1096 |
<?php endif; ?> </div>
|
|
1097 |
</fieldset>
|
|
1098 |
</div>
|
|
1099 |
<div class="inform">
|
|
1100 |
<fieldset>
|
|
1101 |
<legend><?php echo $lang_prof_reg['E-mail legend'] ?></legend>
|
|
1102 |
<div class="infldset">
|
|
1103 |
<?php echo $email_field ?>
|
|
1104 |
</div>
|
|
1105 |
</fieldset>
|
|
1106 |
</div>
|
|
1107 |
<div class="inform">
|
|
1108 |
<fieldset>
|
|
1109 |
<legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend>
|
|
1110 |
<div class="infldset">
|
|
1111 |
<label><?php echo $lang_prof_reg['Timezone'] ?>: <?php echo $lang_prof_reg['Timezone info'] ?>
|
|
1112 |
<br /><select name="form[timezone]">
|
|
1113 |
<option value="-12"<?php if ($user['timezone'] == -12) echo ' selected="selected"' ?>>-12</option>
|
|
1114 |
<option value="-11"<?php if ($user['timezone'] == -11) echo ' selected="selected"' ?>>-11</option>
|
|
1115 |
<option value="-10"<?php if ($user['timezone'] == -10) echo ' selected="selected"' ?>>-10</option>
|
|
1116 |
<option value="-9.5"<?php if ($user['timezone'] == -9.5) echo ' selected="selected"' ?>>-09.5</option>
|
|
1117 |
<option value="-9"<?php if ($user['timezone'] == -9) echo ' selected="selected"' ?>>-09</option>
|
|
1118 |
<option value="-8.5"<?php if ($user['timezone'] == -8.5) echo ' selected="selected"' ?>>-08.5</option>
|
|
1119 |
<option value="-8"<?php if ($user['timezone'] == -8) echo ' selected="selected"' ?>>-08 PST</option>
|
|
1120 |
<option value="-7"<?php if ($user['timezone'] == -7) echo ' selected="selected"' ?>>-07 MST</option>
|
|
1121 |
<option value="-6"<?php if ($user['timezone'] == -6) echo ' selected="selected"' ?>>-06 CST</option>
|
|
1122 |
<option value="-5"<?php if ($user['timezone'] == -5) echo ' selected="selected"' ?>>-05 EST</option>
|
|
1123 |
<option value="-4"<?php if ($user['timezone'] == -4) echo ' selected="selected"' ?>>-04 AST</option>
|
|
1124 |
<option value="-3.5"<?php if ($user['timezone'] == -3.5) echo ' selected="selected"' ?>>-03.5</option>
|
|
1125 |
<option value="-3"<?php if ($user['timezone'] == -3) echo ' selected="selected"' ?>>-03 ADT</option>
|
|
1126 |
<option value="-2"<?php if ($user['timezone'] == -2) echo ' selected="selected"' ?>>-02</option>
|
|
1127 |
<option value="-1"<?php if ($user['timezone'] == -1) echo ' selected="selected"' ?>>-01</option>
|
|
1128 |
<option value="0"<?php if ($user['timezone'] == 0) echo ' selected="selected"' ?>>00 GMT</option>
|
|
1129 |
<option value="1"<?php if ($user['timezone'] == 1) echo ' selected="selected"' ?>>+01 CET</option>
|
|
1130 |
<option value="2"<?php if ($user['timezone'] == 2) echo ' selected="selected"' ?>>+02</option>
|
|
1131 |
<option value="3"<?php if ($user['timezone'] == 3) echo ' selected="selected"' ?>>+03</option>
|
|
1132 |
<option value="3.5"<?php if ($user['timezone'] == 3.5) echo ' selected="selected"' ?>>+03.5</option>
|
|
1133 |
<option value="4"<?php if ($user['timezone'] == 4) echo ' selected="selected"' ?>>+04</option>
|
|
1134 |
<option value="4.5"<?php if ($user['timezone'] == 4.5) echo ' selected="selected"' ?>>+04.5</option>
|
|
1135 |
<option value="5"<?php if ($user['timezone'] == 5) echo ' selected="selected"' ?>>+05</option>
|
|
1136 |
<option value="5.5"<?php if ($user['timezone'] == 5.5) echo ' selected="selected"' ?>>+05.5</option>
|
|
1137 |
<option value="6"<?php if ($user['timezone'] == 6) echo ' selected="selected"' ?>>+06</option>
|
|
1138 |
<option value="6.5"<?php if ($user['timezone'] == 6.5) echo ' selected="selected"' ?>>+06.5</option>
|
|
1139 |
<option value="7"<?php if ($user['timezone'] == 7) echo ' selected="selected"' ?>>+07</option>
|
|
1140 |
<option value="8"<?php if ($user['timezone'] == 8) echo ' selected="selected"' ?>>+08</option>
|
|
1141 |
<option value="9"<?php if ($user['timezone'] == 9) echo ' selected="selected"' ?>>+09</option>
|
|
1142 |
<option value="9.5"<?php if ($user['timezone'] == 9.5) echo ' selected="selected"' ?>>+09.5</option>
|
|
1143 |
<option value="10"<?php if ($user['timezone'] == 10) echo ' selected="selected"' ?>>+10</option>
|
|
1144 |
<option value="10.5"<?php if ($user['timezone'] == 10.5) echo ' selected="selected"' ?>>+10.5</option>
|
|
1145 |
<option value="11"<?php if ($user['timezone'] == 11) echo ' selected="selected"' ?>>+11</option>
|
|
1146 |
<option value="11.5"<?php if ($user['timezone'] == 11.5) echo ' selected="selected"' ?>>+11.5</option>
|
|
1147 |
<option value="12"<?php if ($user['timezone'] == 12) echo ' selected="selected"' ?>>+12</option>
|
|
1148 |
<option value="13"<?php if ($user['timezone'] == 13) echo ' selected="selected"' ?>>+13</option>
|
|
1149 |
<option value="14"<?php if ($user['timezone'] == 14) echo ' selected="selected"' ?>>+14</option>
|
|
1150 |
</select>
|
|
1151 |
<br /></label>
|
|
1152 |
<?php
|
|
1153 |
|
|
1154 |
$languages = array();
|
|
1155 |
$d = dir(PUN_ROOT.'lang');
|
|
1156 |
while (($entry = $d->read()) !== false)
|
|
1157 |
{
|
|
1158 |
if ($entry != '.' && $entry != '..' && is_dir(PUN_ROOT.'lang/'.$entry) && file_exists(PUN_ROOT.'lang/'.$entry.'/common.php'))
|
|
1159 |
$languages[] = $entry;
|
|
1160 |
}
|
|
1161 |
$d->close();
|
|
1162 |
|
|
1163 |
// Only display the language selection box if there's more than one language available
|
|
1164 |
if (count($languages) > 1)
|
|
1165 |
{
|
|
1166 |
natsort($languages);
|
|
1167 |
|
|
1168 |
?>
|
|
1169 |
<label><?php echo $lang_prof_reg['Language'] ?>: <?php echo $lang_prof_reg['Language info'] ?>
|
|
1170 |
<br /><select name="form[language]">
|
|
1171 |
<?php
|
|
1172 |
|
|
1173 |
while (list(, $temp) = @each($languages))
|
|
1174 |
{
|
|
1175 |
if ($user['language'] == $temp)
|
|
1176 |
echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
|
|
1177 |
else
|
|
1178 |
echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
|
|
1179 |
}
|
|
1180 |
|
|
1181 |
?>
|
|
1182 |
</select>
|
|
1183 |
<br /></label>
|
|
1184 |
<?php
|
|
1185 |
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
?>
|
|
1189 |
</div>
|
|
1190 |
</fieldset>
|
|
1191 |
</div>
|
|
1192 |
<div class="inform">
|
|
1193 |
<fieldset>
|
|
1194 |
<legend><?php echo $lang_profile['User activity'] ?></legend>
|
|
1195 |
<div class="infldset">
|
|
1196 |
<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>
|
|
1197 |
<p><?php echo $lang_common['Last post'] ?>: <?php echo $last_post ?></p>
|
|
1198 |
<?php echo $posts_field ?>
|
|
1199 |
<?php if ($pun_user['g_id'] < PUN_GUEST): ?> <label><?php echo $lang_profile['Admin note'] ?><br />
|
|
1200 |
<input id="admin_note" type="text" name="admin_note" value="<?php echo pun_htmlspecialchars($user['admin_note']) ?>" size="30" maxlength="30" /><br /></label>
|
|
1201 |
</div>
|
|
1202 |
<?php endif; ?> </fieldset>
|
|
1203 |
</div>
|
|
1204 |
<p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>
|
|
1205 |
</form>
|
|
1206 |
</div>
|
|
1207 |
</div>
|
|
1208 |
<?php
|
|
1209 |
|
|
1210 |
}
|
|
1211 |
else if ($section == 'personal')
|
|
1212 |
{
|
|
1213 |
if ($pun_user['g_set_title'] == '1')
|
|
1214 |
$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";
|
|
1215 |
|
|
1216 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
1217 |
require PUN_ROOT.'header.php';
|
|
1218 |
|
|
1219 |
generate_profile_menu('personal');
|
|
1220 |
|
|
1221 |
?>
|
|
1222 |
<div class="blockform">
|
|
1223 |
<h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section personal'] ?></span></h2>
|
|
1224 |
<div class="box">
|
|
1225 |
<form id="profile2" method="post" action="profile.php?section=personal&id=<?php echo $id ?>">
|
|
1226 |
<div class="inform">
|
|
1227 |
<fieldset>
|
|
1228 |
<legend><?php echo $lang_profile['Personal details legend'] ?></legend>
|
|
1229 |
<div class="infldset">
|
|
1230 |
<input type="hidden" name="form_sent" value="1" />
|
|
1231 |
<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>
|
|
1232 |
<?php if (isset($title_field)): ?> <?php echo $title_field ?>
|
|
1233 |
<?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>
|
|
1234 |
<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>
|
|
1235 |
</div>
|
|
1236 |
</fieldset>
|
|
1237 |
</div>
|
|
1238 |
<p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>
|
|
1239 |
</form>
|
|
1240 |
</div>
|
|
1241 |
</div>
|
|
1242 |
<?php
|
|
1243 |
|
|
1244 |
}
|
|
1245 |
else if ($section == 'messaging')
|
|
1246 |
{
|
|
1247 |
|
|
1248 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
1249 |
require PUN_ROOT.'header.php';
|
|
1250 |
|
|
1251 |
generate_profile_menu('messaging');
|
|
1252 |
|
|
1253 |
?>
|
|
1254 |
<div class="blockform">
|
|
1255 |
<h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section messaging'] ?></span></h2>
|
|
1256 |
<div class="box">
|
|
1257 |
<form id="profile3" method="post" action="profile.php?section=messaging&id=<?php echo $id ?>">
|
|
1258 |
<div class="inform">
|
|
1259 |
<fieldset>
|
|
1260 |
<legend><?php echo $lang_profile['Contact details legend'] ?></legend>
|
|
1261 |
<div class="infldset">
|
|
1262 |
<input type="hidden" name="form_sent" value="1" />
|
|
1263 |
<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>
|
|
1264 |
<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>
|
|
1265 |
<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>
|
|
1266 |
<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>
|
|
1267 |
<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>
|
|
1268 |
</div>
|
|
1269 |
</fieldset>
|
|
1270 |
</div>
|
|
1271 |
<p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>
|
|
1272 |
</form>
|
|
1273 |
</div>
|
|
1274 |
</div>
|
|
1275 |
<?php
|
|
1276 |
|
|
1277 |
}
|
|
1278 |
else if ($section == 'personality')
|
|
1279 |
{
|
|
1280 |
$avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Change avatar'].'</a>';
|
|
1281 |
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif'))
|
|
1282 |
$avatar_format = 'gif';
|
|
1283 |
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg'))
|
|
1284 |
$avatar_format = 'jpg';
|
|
1285 |
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png'))
|
|
1286 |
$avatar_format = 'png';
|
|
1287 |
else
|
|
1288 |
$avatar_field = '<a href="profile.php?action=upload_avatar&id='.$id.'">'.$lang_profile['Upload avatar'].'</a>';
|
|
1289 |
|
|
1290 |
// Display the delete avatar link?
|
|
1291 |
if ($img_size)
|
|
1292 |
$avatar_field .= ' <a href="profile.php?action=delete_avatar&id='.$id.'">'.$lang_profile['Delete avatar'].'</a>';
|
|
1293 |
|
|
1294 |
if ($user['signature'] != '')
|
|
1295 |
$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";
|
|
1296 |
else
|
|
1297 |
$signature_preview = '<p>'.$lang_profile['No sig'].'</p>'."\n";
|
|
1298 |
|
|
1299 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
1300 |
require PUN_ROOT.'header.php';
|
|
1301 |
|
|
1302 |
generate_profile_menu('personality');
|
|
1303 |
|
|
1304 |
|
|
1305 |
?>
|
|
1306 |
<div class="blockform">
|
|
1307 |
<h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section personality'] ?></span></h2>
|
|
1308 |
<div class="box">
|
|
1309 |
<form id="profile4" method="post" action="profile.php?section=personality&id=<?php echo $id ?>">
|
|
1310 |
<div><input type="hidden" name="form_sent" value="1" /></div>
|
|
1311 |
<?php if ($pun_config['o_avatars'] == '1'): ?> <div class="inform">
|
|
1312 |
<fieldset id="profileavatar">
|
|
1313 |
<legend><?php echo $lang_profile['Avatar legend'] ?></legend>
|
|
1314 |
<div class="infldset">
|
|
1315 |
<?php if (isset($avatar_format)): ?> <img src="<?php echo $pun_config['o_avatars_dir'].'/'.$id.'.'.$avatar_format ?>" <?php echo $img_size[3] ?> alt="" />
|
|
1316 |
<?php endif; ?> <p><?php echo $lang_profile['Avatar info'] ?></p>
|
|
1317 |
<div class="rbox">
|
|
1318 |
<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>
|
|
1319 |
</div>
|
|
1320 |
<p class="clearb"><?php echo $avatar_field ?></p>
|
|
1321 |
</div>
|
|
1322 |
</fieldset>
|
|
1323 |
</div>
|
|
1324 |
<?php endif; ?> <div class="inform">
|
|
1325 |
<fieldset>
|
|
1326 |
<legend><?php echo $lang_profile['Signature legend'] ?></legend>
|
|
1327 |
<div class="infldset">
|
|
1328 |
<p><?php echo $lang_profile['Signature info'] ?></p>
|
|
1329 |
<div class="txtarea">
|
|
1330 |
<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 />
|
|
1331 |
<textarea name="signature" rows="4" cols="65"><?php echo pun_htmlspecialchars($user['signature']) ?></textarea><br /></label>
|
|
1332 |
</div>
|
|
1333 |
<ul class="bblinks">
|
|
1334 |
<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>
|
|
1335 |
<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>
|
|
1336 |
<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>
|
|
1337 |
</ul>
|
|
1338 |
<?php echo $signature_preview ?>
|
|
1339 |
</div>
|
|
1340 |
</fieldset>
|
|
1341 |
</div>
|
|
1342 |
<p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>
|
|
1343 |
</form>
|
|
1344 |
</div>
|
|
1345 |
</div>
|
|
1346 |
<?php
|
|
1347 |
|
|
1348 |
}
|
|
1349 |
else if ($section == 'display')
|
|
1350 |
{
|
|
1351 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
1352 |
require PUN_ROOT.'header.php';
|
|
1353 |
|
|
1354 |
generate_profile_menu('display');
|
|
1355 |
|
|
1356 |
?>
|
|
1357 |
<div class="blockform">
|
|
1358 |
<h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section display'] ?></span></h2>
|
|
1359 |
<div class="box">
|
|
1360 |
<form id="profile5" method="post" action="profile.php?section=display&id=<?php echo $id ?>">
|
|
1361 |
<div><input type="hidden" name="form_sent" value="1" /></div>
|
|
1362 |
<?php
|
|
1363 |
|
|
1364 |
$styles = array();
|
|
1365 |
$d = dir(PUN_ROOT.'style');
|
|
1366 |
while (($entry = $d->read()) !== false)
|
|
1367 |
{
|
|
1368 |
if (substr($entry, strlen($entry)-4) == '.css')
|
|
1369 |
$styles[] = substr($entry, 0, strlen($entry)-4);
|
|
1370 |
}
|
|
1371 |
$d->close();
|
|
1372 |
|
|
1373 |
// Only display the style selection box if there's more than one style available
|
|
1374 |
if (count($styles) == 1)
|
|
1375 |
echo "\t\t\t".'<div><input type="hidden" name="form[style]" value="'.$styles[0].'" /></div>'."\n";
|
|
1376 |
else if (count($styles) > 1)
|
|
1377 |
{
|
|
1378 |
natsort($styles);
|
|
1379 |
|
|
1380 |
?>
|
|
1381 |
<div class="inform">
|
|
1382 |
<fieldset>
|
|
1383 |
<legend><?php echo $lang_profile['Style legend'] ?></legend>
|
|
1384 |
<div class="infldset">
|
|
1385 |
<label><?php echo $lang_profile['Style info'] ?><br />
|
|
1386 |
|
|
1387 |
<select name="form[style]">
|
|
1388 |
<?php
|
|
1389 |
|
|
1390 |
while (list(, $temp) = @each($styles))
|
|
1391 |
{
|
|
1392 |
if ($user['style'] == $temp)
|
|
1393 |
echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n";
|
|
1394 |
else
|
|
1395 |
echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n";
|
|
1396 |
}
|
|
1397 |
|
|
1398 |
?>
|
|
1399 |
</select>
|
|
1400 |
<br /></label>
|
|
1401 |
</div>
|
|
1402 |
</fieldset>
|
|
1403 |
</div>
|
|
1404 |
<?php
|
|
1405 |
|
|
1406 |
}
|
|
1407 |
|
|
1408 |
?>
|
|
1409 |
<div class="inform">
|
|
1410 |
<fieldset>
|
|
1411 |
<legend><?php echo $lang_profile['Post display legend'] ?></legend>
|
|
1412 |
<div class="infldset">
|
|
1413 |
<p><?php echo $lang_profile['Post display info'] ?></p>
|
|
1414 |
<div class="rbox">
|
|
1415 |
<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>
|
|
1416 |
<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>
|
|
1417 |
<?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>
|
|
1418 |
<?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>
|
|
1419 |
<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>
|
|
1420 |
</div>
|
|
1421 |
</div>
|
|
1422 |
</fieldset>
|
|
1423 |
</div>
|
|
1424 |
<div class="inform">
|
|
1425 |
<fieldset>
|
|
1426 |
<legend><?php echo $lang_profile['Pagination legend'] ?></legend>
|
|
1427 |
<div class="infldset">
|
|
1428 |
<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>
|
|
1429 |
<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>
|
|
1430 |
<p class="clearb"><?php echo $lang_profile['Paginate info'] ?> <?php echo $lang_profile['Leave blank'] ?></p>
|
|
1431 |
</div>
|
|
1432 |
</fieldset>
|
|
1433 |
</div>
|
|
1434 |
<p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /> <?php echo $lang_profile['Instructions'] ?></p>
|
|
1435 |
</form>
|
|
1436 |
</div>
|
|
1437 |
</div>
|
|
1438 |
<?php
|
|
1439 |
|
|
1440 |
}
|
|
1441 |
else if ($section == 'privacy')
|
|
1442 |
{
|
|
1443 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
1444 |
require PUN_ROOT.'header.php';
|
|
1445 |
|
|
1446 |
generate_profile_menu('privacy');
|
|
1447 |
|
|
1448 |
?>
|
|
1449 |
<div class="blockform">
|
|
1450 |
<h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section privacy'] ?></span></h2>
|
|
1451 |
<div class="box">
|
|
1452 |
<form id="profile6" method="post" action="profile.php?section=privacy&id=<?php echo $id ?>">
|
|
1453 |
<div class="inform">
|
|
1454 |
<fieldset>
|
|
1455 |
<legend><?php echo $lang_prof_reg['Privacy options legend'] ?></legend>
|
|
1456 |
<div class="infldset">
|
|
1457 |
<input type="hidden" name="form_sent" value="1" />
|
|
1458 |
<p><?php echo $lang_prof_reg['E-mail setting info'] ?></p>
|
|
1459 |
<div class="rbox">
|
|
1460 |
<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>
|
|
1461 |
<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>
|
|
1462 |
<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>
|
|
1463 |
</div>
|
|
1464 |
<p><?php echo $lang_prof_reg['Save user/pass info'] ?></p>
|
|
1465 |
<div class="rbox">
|
|
1466 |
<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>
|
|
1467 |
</div>
|
|
1468 |
<p><?php echo $lang_profile['Notify full info'] ?></p>
|
|
1469 |
<div class="rbox">
|
|
1470 |
<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>
|
|
1471 |
</div>
|
|
1472 |
</div>
|
|
1473 |
</fieldset>
|
|
1474 |
</div>
|
|
1475 |
<p><input type="submit" name="update" value="<?php echo $lang_common['Submit'] ?>" /><?php echo $lang_profile['Instructions'] ?></p>
|
|
1476 |
</form>
|
|
1477 |
</div>
|
|
1478 |
</div>
|
|
1479 |
<?php
|
|
1480 |
|
|
1481 |
}
|
|
1482 |
else if ($section == 'admin')
|
|
1483 |
{
|
|
1484 |
if ($pun_user['g_id'] > PUN_MOD || ($pun_user['g_id'] == PUN_MOD && $pun_config['p_mod_ban_users'] == '0'))
|
|
1485 |
message($lang_common['Bad request']);
|
|
1486 |
|
|
1487 |
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_common['Profile'];
|
|
1488 |
require PUN_ROOT.'header.php';
|
|
1489 |
|
|
1490 |
generate_profile_menu('admin');
|
|
1491 |
|
|
1492 |
?>
|
|
1493 |
<div class="blockform">
|
|
1494 |
<h2><span><?php echo pun_htmlspecialchars($user['username']).' - '.$lang_profile['Section admin'] ?></span></h2>
|
|
1495 |
<div class="box">
|
|
1496 |
<form id="profile7" method="post" action="profile.php?section=admin&id=<?php echo $id ?>&action=foo">
|
|
1497 |
<div class="inform">
|
|
1498 |
<input type="hidden" name="form_sent" value="1" />
|
|
1499 |
<fieldset>
|
|
1500 |
<?php
|
|
1501 |
|
|
1502 |
if ($pun_user['g_id'] == PUN_MOD)
|
|
1503 |
{
|
|
1504 |
|
|
1505 |
?>
|
|
1506 |
<legend><?php echo $lang_profile['Delete ban legend'] ?></legend>
|
|
1507 |
<div class="infldset">
|
|
1508 |
<p><input type="submit" name="ban" value="<?php echo $lang_profile['Ban user'] ?>" /></p>
|
|
1509 |
</div>
|
|
1510 |
</fieldset>
|
|
1511 |
</div>
|
|
1512 |
<?php
|
|
1513 |
|
|
1514 |
}
|
|
1515 |
else
|
|
1516 |
{
|
|
1517 |
if ($pun_user['id'] != $id)
|
|
1518 |
{
|
|
1519 |
|
|
1520 |
?>
|
|
1521 |
<legend><?php echo $lang_profile['Group membership legend'] ?></legend>
|
|
1522 |
<div class="infldset">
|
|
1523 |
<select id="group_id" name="group_id">
|
|
1524 |
<?php
|
|
1525 |
|
|
1526 |
$result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
|
|
1527 |
|
|
1528 |
while ($cur_group = $db->fetch_assoc($result))
|
|
1529 |
{
|
|
1530 |
if ($cur_group['g_id'] == $user['g_id'] || ($cur_group['g_id'] == $pun_config['o_default_user_group'] && $user['g_id'] == ''))
|
|
1531 |
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";
|
|
1532 |
else
|
|
1533 |
echo "\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
|
|
1534 |
}
|
|
1535 |
|
|
1536 |
?>
|
|
1537 |
</select>
|
|
1538 |
<input type="submit" name="update_group_membership" value="<?php echo $lang_profile['Save'] ?>" />
|
|
1539 |
</div>
|
|
1540 |
</fieldset>
|
|
1541 |
</div>
|
|
1542 |
<div class="inform">
|
|
1543 |
<fieldset>
|
|
1544 |
<?php
|
|
1545 |
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
?>
|
|
1549 |
<legend><?php echo $lang_profile['Delete ban legend'] ?></legend>
|
|
1550 |
<div class="infldset">
|
|
1551 |
<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'] ?>" />
|
|
1552 |
</div>
|
|
1553 |
</fieldset>
|
|
1554 |
</div>
|
|
1555 |
<?php
|
|
1556 |
|
|
1557 |
if ($user['g_id'] == PUN_MOD || $user['g_id'] == PUN_ADMIN)
|
|
1558 |
{
|
|
1559 |
|
|
1560 |
?>
|
|
1561 |
<div class="inform">
|
|
1562 |
<fieldset>
|
|
1563 |
<legend><?php echo $lang_profile['Set mods legend'] ?></legend>
|
|
1564 |
<div class="infldset">
|
|
1565 |
<p><?php echo $lang_profile['Moderator in info'] ?></p>
|
|
1566 |
<?php
|
|
1567 |
|
|
1568 |
$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('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
|
|
1569 |
|
|
1570 |
$cur_category = 0;
|
|
1571 |
while ($cur_forum = $db->fetch_assoc($result))
|
|
1572 |
{
|
|
1573 |
if ($cur_forum['cid'] != $cur_category) // A new category since last iteration?
|
|
1574 |
{
|
|
1575 |
if ($cur_category)
|
|
1576 |
echo "\n\t\t\t\t\t\t\t\t".'</div>';
|
|
1577 |
|
|
1578 |
if ($cur_category != 0)
|
|
1579 |
echo "\n\t\t\t\t\t\t\t".'</div>'."\n";
|
|
1580 |
|
|
1581 |
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">';
|
|
1582 |
$cur_category = $cur_forum['cid'];
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
$moderators = ($cur_forum['moderators'] != '') ? unserialize($cur_forum['moderators']) : array();
|
|
1586 |
|
|
1587 |
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";
|
|
1588 |
}
|
|
1589 |
|
|
1590 |
?>
|
|
1591 |
</div>
|
|
1592 |
</div>
|
|
1593 |
<br class="clearb" /><input type="submit" name="update_forums" value="<?php echo $lang_profile['Update forums'] ?>" />
|
|
1594 |
</div>
|
|
1595 |
</fieldset>
|
|
1596 |
</div>
|
|
1597 |
<?php
|
|
1598 |
|
|
1599 |
}
|
|
1600 |
}
|
|
1601 |
|
|
1602 |
?>
|
|
1603 |
</form>
|
|
1604 |
</div>
|
|
1605 |
</div>
|
|
1606 |
<?php
|
|
1607 |
|
|
1608 |
}
|
|
1609 |
|
|
1610 |
?>
|
|
1611 |
<div class="clearer"></div>
|
|
1612 |
</div>
|
|
1613 |
<?php
|
|
1614 |
|
|
1615 |
require PUN_ROOT.'footer.php';
|
|
1616 |
}
|