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