1 rizwank 1.1 <?php
2 /***************************************************************************
3 * admin_users.php
4 * -------------------
5 * begin : Saturday, Feb 13, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
8 *
9 * $Id: admin_users.php,v 1.57.2.17 2002/12/21 19:09:57 psotfx Exp $
10 *
11 *
12 ***************************************************************************/
13
14 /***************************************************************************
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 ***************************************************************************/
22 rizwank 1.1
23 define('IN_PHPBB', 1);
24
25 if( !empty($setmodules) )
26 {
27 $filename = basename(__FILE__);
28 $module['Users']['Manage'] = $filename;
29
30 return;
31 }
32
33 $phpbb_root_path = "./../";
34 require($phpbb_root_path . 'extension.inc');
35 require('./pagestart.' . $phpEx);
36 require($phpbb_root_path . 'includes/bbcode.'.$phpEx);
37 require($phpbb_root_path . 'includes/functions_post.'.$phpEx);
38 require($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
39 require($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
40
41 $html_entities_match = array('#<#', '#>#');
42 $html_entities_replace = array('<', '>');
43 rizwank 1.1
44 //
45 // Set mode
46 //
47 if( isset( $HTTP_POST_VARS['mode'] ) || isset( $HTTP_GET_VARS['mode'] ) )
48 {
49 $mode = ( isset( $HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
50 }
51 else
52 {
53 $mode = '';
54 }
55
56 //
57 // Begin program
58 //
59 if( $mode == 'edit' || $mode == 'save' && ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_URL]) || isset( $HTTP_POST_VARS[POST_USERS_URL]) ) )
60 {
61 //
62 // Ok, the profile has been modified and submitted, let's update
63 //
64 rizwank 1.1 if( ( $mode == 'save' && isset( $HTTP_POST_VARS['submit'] ) ) || isset( $HTTP_POST_VARS['avatargallery'] ) || isset( $HTTP_POST_VARS['submitavatar'] ) || isset( $HTTP_POST_VARS['cancelavatar'] ) )
65 {
66 $user_id = intval( $HTTP_POST_VARS['id'] );
67
68 if (!($this_userdata = get_userdata($user_id)))
69 {
70 message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
71 }
72
73 if( $HTTP_POST_VARS['deleteuser'] )
74 {
75 $sql = "SELECT g.group_id
76 FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
77 WHERE ug.user_id = $user_id
78 AND g.group_id = ug.group_id
79 AND g.group_single_user = 1";
80 if( !($result = $db->sql_query($sql)) )
81 {
82 message_die(GENERAL_ERROR, 'Could not obtain group information for this user', '', __LINE__, __FILE__, $sql);
83 }
84
85 rizwank 1.1 $row = $db->sql_fetchrow($result);
86
87 $sql = "UPDATE " . POSTS_TABLE . "
88 SET poster_id = " . DELETED . ", post_username = '$username'
89 WHERE poster_id = $user_id";
90 if( !$db->sql_query($sql) )
91 {
92 message_die(GENERAL_ERROR, 'Could not update posts for this user', '', __LINE__, __FILE__, $sql);
93 }
94
95 $sql = "UPDATE " . TOPICS_TABLE . "
96 SET topic_poster = " . DELETED . "
97 WHERE topic_poster = $user_id";
98 if( !$db->sql_query($sql) )
99 {
100 message_die(GENERAL_ERROR, 'Could not update topics for this user', '', __LINE__, __FILE__, $sql);
101 }
102
103 $sql = "UPDATE " . VOTE_USERS_TABLE . "
104 SET vote_user_id = " . DELETED . "
105 WHERE vote_user_id = $user_id";
106 rizwank 1.1 if( !$db->sql_query($sql) )
107 {
108 message_die(GENERAL_ERROR, 'Could not update votes for this user', '', __LINE__, __FILE__, $sql);
109 }
110
111 $sql = "SELECT group_id
112 FROM " . GROUPS_TABLE . "
113 WHERE group_moderator = $user_id";
114 if( !($result = $db->sql_query($sql)) )
115 {
116 message_die(GENERAL_ERROR, 'Could not select groups where user was moderator', '', __LINE__, __FILE__, $sql);
117 }
118
119 while ( $row_group = $db->sql_fetchrow($result) )
120 {
121 $group_moderator[] = $row_group['group_id'];
122 }
123
124 if ( count($group_moderator) )
125 {
126 $update_moderator_id = implode(', ', $group_moderator);
127 rizwank 1.1
128 $sql = "UPDATE " . GROUPS_TABLE . "
129 SET group_moderator = " . $userdata['user_id'] . "
130 WHERE group_moderator IN ($update_moderator_id)";
131 if( !$db->sql_query($sql) )
132 {
133 message_die(GENERAL_ERROR, 'Could not update group moderators', '', __LINE__, __FILE__, $sql);
134 }
135 }
136
137 $sql = "DELETE FROM " . USERS_TABLE . "
138 WHERE user_id = $user_id";
139 if( !$db->sql_query($sql) )
140 {
141 message_die(GENERAL_ERROR, 'Could not delete user', '', __LINE__, __FILE__, $sql);
142 }
143
144 $sql = "DELETE FROM " . USER_GROUP_TABLE . "
145 WHERE user_id = $user_id";
146 if( !$db->sql_query($sql) )
147 {
148 rizwank 1.1 message_die(GENERAL_ERROR, 'Could not delete user from user_group table', '', __LINE__, __FILE__, $sql);
149 }
150
151 $sql = "DELETE FROM " . GROUPS_TABLE . "
152 WHERE group_id = " . $row['group_id'];
153 if( !$db->sql_query($sql) )
154 {
155 message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
156 }
157
158 $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . "
159 WHERE group_id = " . $row['group_id'];
160 if( !$db->sql_query($sql) )
161 {
162 message_die(GENERAL_ERROR, 'Could not delete group for this user', '', __LINE__, __FILE__, $sql);
163 }
164
165 $sql = "DELETE FROM " . TOPICS_WATCH_TABLE . "
166 WHERE user_id = $user_id";
167 if ( !$db->sql_query($sql) )
168 {
169 rizwank 1.1 message_die(GENERAL_ERROR, 'Could not delete user from topic watch table', '', __LINE__, __FILE__, $sql);
170 }
171
172 $sql = "DELETE FROM " . BANLIST_TABLE . "
173 WHERE ban_userid = $user_id";
174 if ( !$db->sql_query($sql) )
175 {
176 message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
177 }
178
179 $sql = "SELECT privmsgs_id
180 FROM " . PRIVMSGS_TABLE . "
181 WHERE privmsgs_from_userid = $user_id
182 OR privmsgs_to_userid = $user_id";
183 if ( !($result = $db->sql_query($sql)) )
184 {
185 message_die(GENERAL_ERROR, 'Could not select all users private messages', '', __LINE__, __FILE__, $sql);
186 }
187
188 // This little bit of code directly from the private messaging section.
189 while ( $row_privmsgs = $db->sql_fetchrow($result) )
190 rizwank 1.1 {
191 $mark_list[] = $row_privmsgs['privmsgs_id'];
192 }
193
194 if ( count($mark_list) )
195 {
196 $delete_sql_id = implode(', ', $mark_list);
197
198 $delete_text_sql = "DELETE FROM " . PRIVMSGS_TEXT_TABLE . "
199 WHERE privmsgs_text_id IN ($delete_sql_id)";
200 $delete_sql = "DELETE FROM " . PRIVMSGS_TABLE . "
201 WHERE privmsgs_id IN ($delete_sql_id)";
202
203 if ( !$db->sql_query($delete_sql) )
204 {
205 message_die(GENERAL_ERROR, 'Could not delete private message info', '', __LINE__, __FILE__, $delete_sql);
206 }
207
208 if ( !$db->sql_query($delete_text_sql) )
209 {
210 message_die(GENERAL_ERROR, 'Could not delete private message text', '', __LINE__, __FILE__, $delete_text_sql);
211 rizwank 1.1 }
212 }
213
214 $message = $lang['User_deleted'] . '<br /><br />' . sprintf($lang['Click_return_useradmin'], '<a href="' . append_sid("admin_users.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
215
216 message_die(GENERAL_MESSAGE, $message);
217 }
218
219 $username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags( $HTTP_POST_VARS['username'] ) ) : '';
220 $email = ( !empty($HTTP_POST_VARS['email']) ) ? trim(strip_tags(htmlspecialchars( $HTTP_POST_VARS['email'] ) )) : '';
221
222 $password = ( !empty($HTTP_POST_VARS['password']) ) ? trim(strip_tags(htmlspecialchars( $HTTP_POST_VARS['password'] ) )) : '';
223 $password_confirm = ( !empty($HTTP_POST_VARS['password_confirm']) ) ? trim(strip_tags(htmlspecialchars( $HTTP_POST_VARS['password_confirm'] ) )) : '';
224
225 $icq = ( !empty($HTTP_POST_VARS['icq']) ) ? trim(strip_tags( $HTTP_POST_VARS['icq'] ) ) : '';
226 $aim = ( !empty($HTTP_POST_VARS['aim']) ) ? trim(strip_tags( $HTTP_POST_VARS['aim'] ) ) : '';
227 $msn = ( !empty($HTTP_POST_VARS['msn']) ) ? trim(strip_tags( $HTTP_POST_VARS['msn'] ) ) : '';
228 $yim = ( !empty($HTTP_POST_VARS['yim']) ) ? trim(strip_tags( $HTTP_POST_VARS['yim'] ) ) : '';
229
230 $website = ( !empty($HTTP_POST_VARS['website']) ) ? trim(strip_tags( $HTTP_POST_VARS['website'] ) ) : '';
231 $location = ( !empty($HTTP_POST_VARS['location']) ) ? trim(strip_tags( $HTTP_POST_VARS['location'] ) ) : '';
232 rizwank 1.1 $occupation = ( !empty($HTTP_POST_VARS['occupation']) ) ? trim(strip_tags( $HTTP_POST_VARS['occupation'] ) ) : '';
233 $interests = ( !empty($HTTP_POST_VARS['interests']) ) ? trim(strip_tags( $HTTP_POST_VARS['interests'] ) ) : '';
234 $signature = ( !empty($HTTP_POST_VARS['signature']) ) ? trim(str_replace('<br />', "\n", $HTTP_POST_VARS['signature'] ) ) : '';
235
236 validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature);
237
238 $viewemail = ( isset( $HTTP_POST_VARS['viewemail']) ) ? ( ( $HTTP_POST_VARS['viewemail'] ) ? TRUE : 0 ) : 0;
239 $allowviewonline = ( isset( $HTTP_POST_VARS['hideonline']) ) ? ( ( $HTTP_POST_VARS['hideonline'] ) ? 0 : TRUE ) : TRUE;
240 $notifyreply = ( isset( $HTTP_POST_VARS['notifyreply']) ) ? ( ( $HTTP_POST_VARS['notifyreply'] ) ? TRUE : 0 ) : 0;
241 $notifypm = ( isset( $HTTP_POST_VARS['notifypm']) ) ? ( ( $HTTP_POST_VARS['notifypm'] ) ? TRUE : 0 ) : TRUE;
242 $popuppm = ( isset( $HTTP_POST_VARS['popup_pm']) ) ? ( ( $HTTP_POST_VARS['popup_pm'] ) ? TRUE : 0 ) : TRUE;
243 $attachsig = ( isset( $HTTP_POST_VARS['attachsig']) ) ? ( ( $HTTP_POST_VARS['attachsig'] ) ? TRUE : 0 ) : 0;
244
245 $allowhtml = ( isset( $HTTP_POST_VARS['allowhtml']) ) ? intval( $HTTP_POST_VARS['allowhtml'] ) : $board_config['allow_html'];
246 $allowbbcode = ( isset( $HTTP_POST_VARS['allowbbcode']) ) ? intval( $HTTP_POST_VARS['allowbbcode'] ) : $board_config['allow_bbcode'];
247 $allowsmilies = ( isset( $HTTP_POST_VARS['allowsmilies']) ) ? intval( $HTTP_POST_VARS['allowsmilies'] ) : $board_config['allow_smilies'];
248
249 $user_style = ( $HTTP_POST_VARS['style'] ) ? intval( $HTTP_POST_VARS['style'] ) : $board_config['default_style'];
250 $user_lang = ( $HTTP_POST_VARS['language'] ) ? $HTTP_POST_VARS['language'] : $board_config['default_lang'];
251 $user_timezone = ( isset( $HTTP_POST_VARS['timezone']) ) ? doubleval( $HTTP_POST_VARS['timezone'] ) : $board_config['board_timezone'];
252 $user_template = ( $HTTP_POST_VARS['template'] ) ? $HTTP_POST_VARS['template'] : $board_config['board_template'];
253 rizwank 1.1 $user_dateformat = ( $HTTP_POST_VARS['dateformat'] ) ? trim( $HTTP_POST_VARS['dateformat'] ) : $board_config['default_dateformat'];
254
255 $user_avatar_local = ( isset( $HTTP_POST_VARS['avatarselect'] ) && !empty($HTTP_POST_VARS['submitavatar'] ) && $board_config['allow_avatar_local'] ) ? $HTTP_POST_VARS['avatarselect'] : ( ( isset( $HTTP_POST_VARS['avatarlocal'] ) ) ? $HTTP_POST_VARS['avatarlocal'] : '' );
256
257 $user_avatar_remoteurl = ( !empty($HTTP_POST_VARS['avatarremoteurl']) ) ? trim( $HTTP_POST_VARS['avatarremoteurl'] ) : '';
258 $user_avatar_url = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim( $HTTP_POST_VARS['avatarurl'] ) : '';
259 $user_avatar_loc = ( $HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : '';
260 $user_avatar_name = ( !empty($HTTP_POST_FILES['avatar']['name']) ) ? $HTTP_POST_FILES['avatar']['name'] : '';
261 $user_avatar_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
262 $user_avatar_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
263
264 $user_avatar = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar'] : '';
265 $user_avatar_type = ( empty($user_avatar_loc) ) ? $this_userdata['user_avatar_type'] : '';
266
267 $user_status = ( !empty($HTTP_POST_VARS['user_status']) ) ? intval( $HTTP_POST_VARS['user_status'] ) : 0;
268 $user_allowpm = ( !empty($HTTP_POST_VARS['user_allowpm']) ) ? intval( $HTTP_POST_VARS['user_allowpm'] ) : 0;
269 $user_rank = ( !empty($HTTP_POST_VARS['user_rank']) ) ? intval( $HTTP_POST_VARS['user_rank'] ) : 0;
270 $user_allowavatar = ( !empty($HTTP_POST_VARS['user_allowavatar']) ) ? intval( $HTTP_POST_VARS['user_allowavatar'] ) : 0;
271
272 if( isset( $HTTP_POST_VARS['avatargallery'] ) || isset( $HTTP_POST_VARS['submitavatar'] ) || isset( $HTTP_POST_VARS['cancelavatar'] ) )
273 {
274 rizwank 1.1 $username = stripslashes($username);
275 $email = stripslashes($email);
276 $password = '';
277 $password_confirm = '';
278
279 $icq = stripslashes($icq);
280 $aim = htmlspecialchars(stripslashes($aim));
281 $msn = htmlspecialchars(stripslashes($msn));
282 $yim = htmlspecialchars(stripslashes($yim));
283
284 $website = htmlspecialchars(stripslashes($website));
285 $location = htmlspecialchars(stripslashes($location));
286 $occupation = htmlspecialchars(stripslashes($occupation));
287 $interests = htmlspecialchars(stripslashes($interests));
288 $signature = htmlspecialchars(stripslashes($signature));
289
290 $user_lang = stripslashes($user_lang);
291 $user_dateformat = htmlspecialchars(stripslashes($user_dateformat));
292
293 if ( !isset($HTTP_POST_VARS['cancelavatar']))
294 {
295 rizwank 1.1 $user_avatar = $user_avatar_local;
296 $user_avatar_type = USER_AVATAR_GALLERY;
297 }
298 }
299 }
300
301 if( isset( $HTTP_POST_VARS['submit'] ) )
302 {
303 include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
304
305 $error = FALSE;
306
307 if( stripslashes($username) != $this_userdata['username'] )
308 {
309 unset($rename_user);
310
311 $result = validate_username($username);
312 if ( $result['error'] )
313 {
314 $error = TRUE;
315 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
316 rizwank 1.1 }
317 else
318 {
319 $username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
320 $rename_user = $username; // Used for renaming usergroup
321 }
322 }
323
324 $passwd_sql = "";
325 if( !empty($password) && !empty($password_confirm) )
326 {
327 //
328 // Awww, the user wants to change their password, isn't that cute..
329 //
330 if($password != $password_confirm)
331 {
332 $error = TRUE;
333 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
334 }
335 else
336 {
337 rizwank 1.1 $password = md5($password);
338 $passwd_sql = "user_password = '$password', ";
339 }
340 }
341 else if( $password && !$password_confirm )
342 {
343 $error = TRUE;
344 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
345 }
346 else if( !$password && $password_confirm )
347 {
348 $error = TRUE;
349 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
350 }
351
352 if( $signature != "" )
353 {
354 $sig_length_check = preg_replace('/(\[.*?)(=.*?)\]/is', '\\1]', stripslashes($signature));
355 if ( $allowhtml )
356 {
357 $sig_length_check = preg_replace('/(\<.*?)(=.*?)( .*?=.*?)?([ \/]?\>)/is', '\\1\\3\\4', $sig_length_check);
358 rizwank 1.1 }
359
360 // Only create a new bbcode_uid when there was no uid yet.
361 if ( $signature_bbcode_uid == '' )
362 {
363 $signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : '';
364 }
365 $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
366
367 if ( strlen($sig_length_check) > $board_config['max_sig_chars'] )
368 {
369 $error = TRUE;
370 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
371 }
372 }
373
374 //
375 // Avatar stuff
376 //
377 $avatar_sql = "";
378 if( isset($HTTP_POST_VARS['avatardel']) )
379 rizwank 1.1 {
380 if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
381 {
382 if( @file_exists(@phpbb_realpath("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
383 {
384 @unlink("./" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
385 }
386 }
387 $avatar_sql = ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
388 }
389 else if( ( $user_avatar_loc != "" || !empty($user_avatar_url) ) && !$error )
390 {
391 //
392 // Only allow one type of upload, either a
393 // filename or a URL
394 //
395 if( !empty($user_avatar_loc) && !empty($user_avatar_url) )
396 {
397 $error = TRUE;
398 if( isset($error_msg) )
399 {
400 rizwank 1.1 $error_msg .= "<br />";
401 }
402 $error_msg .= $lang['Only_one_avatar'];
403 }
404
405 if( $user_avatar_loc != "" )
406 {
407 if( file_exists(@phpbb_realpath($user_avatar_loc)) && ereg(".jpg$|.gif$|.png$", $user_avatar_name) )
408 {
409 if( $user_avatar_size <= $board_config['avatar_filesize'] && $user_avatar_size > 0)
410 {
411 $error_type = false;
412
413 //
414 // Opera appends the image name after the type, not big, not clever!
415 //
416 preg_match("'image\/[x\-]*([a-z]+)'", $user_avatar_filetype, $user_avatar_filetype);
417 $user_avatar_filetype = $user_avatar_filetype[1];
418
419 switch( $user_avatar_filetype )
420 {
421 rizwank 1.1 case "jpeg":
422 case "pjpeg":
423 case "jpg":
424 $imgtype = '.jpg';
425 break;
426 case "gif":
427 $imgtype = '.gif';
428 break;
429 case "png":
430 $imgtype = '.png';
431 break;
432 default:
433 $error = true;
434 $error_msg = (!empty($error_msg)) ? $error_msg . "<br />" . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
435 break;
436 }
437
438 if( !$error )
439 {
440 list($width, $height) = @getimagesize($user_avatar_loc);
441
442 rizwank 1.1 if( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
443 {
444 $user_id = $this_userdata['user_id'];
445
446 $avatar_filename = $user_id . $imgtype;
447
448 if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "" )
449 {
450 if( @file_exists(@phpbb_realpath("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
451 {
452 @unlink("./../" . $board_config['avatar_path'] . "/". $this_userdata['user_avatar']);
453 }
454 }
455 @copy($user_avatar_loc, "./../" . $board_config['avatar_path'] . "/$avatar_filename");
456
457 $avatar_sql = ", user_avatar = '$avatar_filename', user_avatar_type = " . USER_AVATAR_UPLOAD;
458 }
459 else
460 {
461 $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
462
463 rizwank 1.1 $error = true;
464 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $l_avatar_size : $l_avatar_size;
465 }
466 }
467 }
468 else
469 {
470 $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
471
472 $error = true;
473 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $l_avatar_size : $l_avatar_size;
474 }
475 }
476 else
477 {
478 $error = true;
479 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
480 }
481 }
482 else if( !empty($user_avatar_url) )
483 {
484 rizwank 1.1 //
485 // First check what port we should connect
486 // to, look for a :[xxxx]/ or, if that doesn't
487 // exist assume port 80 (http)
488 //
489 preg_match("/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/", $user_avatar_url, $url_ary);
490
491 if( !empty($url_ary[4]) )
492 {
493 $port = (!empty($url_ary[3])) ? $url_ary[3] : 80;
494
495 $fsock = @fsockopen($url_ary[2], $port, $errno, $errstr);
496 if( $fsock )
497 {
498 $base_get = "/" . $url_ary[4];
499
500 //
501 // Uses HTTP 1.1, could use HTTP 1.0 ...
502 //
503 @fputs($fsock, "GET $base_get HTTP/1.1\r\n");
504 @fputs($fsock, "HOST: " . $url_ary[2] . "\r\n");
505 rizwank 1.1 @fputs($fsock, "Connection: close\r\n\r\n");
506
507 unset($avatar_data);
508 while( !@feof($fsock) )
509 {
510 $avatar_data .= @fread($fsock, $board_config['avatar_filesize']);
511 }
512 @fclose($fsock);
513
514 if( preg_match("/Content-Length\: ([0-9]+)[^\/ ][\s]+/i", $avatar_data, $file_data1) && preg_match("/Content-Type\: image\/[x\-]*([a-z]+)[\s]+/i", $avatar_data, $file_data2) )
515 {
516 $file_size = $file_data1[1];
517 $file_type = $file_data2[1];
518
519 switch( $file_type )
520 {
521 case "jpeg":
522 case "pjpeg":
523 case "jpg":
524 $imgtype = '.jpg';
525 break;
526 rizwank 1.1 case "gif":
527 $imgtype = '.gif';
528 break;
529 case "png":
530 $imgtype = '.png';
531 break;
532 default:
533 $error = true;
534 $error_msg = (!empty($error_msg)) ? $error_msg . "<br />" . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
535 break;
536 }
537
538 if( !$error && $file_size > 0 && $file_size < $board_config['avatar_filesize'] )
539 {
540 $avatar_data = substr($avatar_data, strlen($avatar_data) - $file_size, $file_size);
541
542 $tmp_filename = tempnam ("/tmp", $this_userdata['user_id'] . "-");
543 $fptr = @fopen($tmp_filename, "wb");
544 $bytes_written = @fwrite($fptr, $avatar_data, $file_size);
545 @fclose($fptr);
546
547 rizwank 1.1 if( $bytes_written == $file_size )
548 {
549 list($width, $height) = @getimagesize($tmp_filename);
550
551 if( $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
552 {
553 $user_id = $this_userdata['user_id'];
554
555 $avatar_filename = $user_id . $imgtype;
556
557 if( $this_userdata['user_avatar_type'] == USER_AVATAR_UPLOAD && $this_userdata['user_avatar'] != "")
558 {
559 if( file_exists(@phpbb_realpath("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar'])) )
560 {
561 @unlink("./../" . $board_config['avatar_path'] . "/" . $this_userdata['user_avatar']);
562 }
563 }
564 @copy($tmp_filename, "./../" . $board_config['avatar_path'] . "/$avatar_filename");
565 @unlink($tmp_filename);
566
567 $avatar_sql = ", user_avatar = '$avatar_filename', user_avatar_type = " . USER_AVATAR_UPLOAD;
568 rizwank 1.1 }
569 else
570 {
571 $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
572
573 $error = true;
574 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $l_avatar_size : $l_avatar_size;
575 }
576 }
577 else
578 {
579 //
580 // Error writing file
581 //
582 @unlink($tmp_filename);
583 message_die(GENERAL_ERROR, "Could not write avatar file to local storage. Please contact the board administrator with this message", "", __LINE__, __FILE__);
584 }
585 }
586 }
587 else
588 {
589 rizwank 1.1 //
590 // No data
591 //
592 $error = true;
593 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['File_no_data'] : $lang['File_no_data'];
594 }
595 }
596 else
597 {
598 //
599 // No connection
600 //
601 $error = true;
602 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['No_connection_URL'] : $lang['No_connection_URL'];
603 }
604 }
605 else
606 {
607 $error = true;
608 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
609 }
610 rizwank 1.1 }
611 else if( !empty($user_avatar_name) )
612 {
613 $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
614
615 $error = true;
616 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $l_avatar_size : $l_avatar_size;
617 }
618 }
619 else if( $user_avatar_remoteurl != "" && $avatar_sql == "" && !$error )
620 {
621 if( !preg_match("#^http:\/\/#i", $user_avatar_remoteurl) )
622 {
623 $user_avatar_remoteurl = "http://" . $user_avatar_remoteurl;
624 }
625
626 if( preg_match("#^(http:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+\/.*?\.(gif|jpg|png)$)#is", $user_avatar_remoteurl) )
627 {
628 $avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_remoteurl) . "', user_avatar_type = " . USER_AVATAR_REMOTE;
629 }
630 else
631 rizwank 1.1 {
632 $error = true;
633 $error_msg = ( !empty($error_msg) ) ? $error_msg . "<br />" . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
634 }
635 }
636 else if( $user_avatar_local != "" && $avatar_sql == "" && !$error )
637 {
638 $avatar_sql = ", user_avatar = '" . str_replace("\'", "''", $user_avatar_local) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
639 }
640
641 //
642 // Update entry in DB
643 //
644 if( !$error )
645 {
646 $sql = "UPDATE " . USERS_TABLE . "
647 SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
648 WHERE user_id = $user_id";
649
650 if( $result = $db->sql_query($sql) )
651 {
652 rizwank 1.1 if( isset($rename_user) )
653 {
654 $sql = "UPDATE " . GROUPS_TABLE . "
655 SET group_name = '".str_replace("\'", "''", $rename_user)."'
656 WHERE group_name = '".str_replace("\'", "''", $this_userdata['username'] )."'";
657 if( !$result = $db->sql_query($sql) )
658 {
659 message_die(GENERAL_ERROR, 'Could not rename users group', '', __LINE__, __FILE__, $sql);
660 }
661 }
662 $message .= $lang['Admin_user_updated'];
663 }
664 else
665 {
666 $error = TRUE;
667 $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Admin_user_fail'];
668 }
669
670 $message .= '<br /><br />' . sprintf($lang['Click_return_useradmin'], '<a href="' . append_sid("admin_users.$phpEx") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid("index.$phpEx?pane=right") . '">', '</a>');
671
672 message_die(GENERAL_MESSAGE, $message);
673 rizwank 1.1 }
674 else
675 {
676 $template->set_filenames(array(
677 'reg_header' => 'error_body.tpl')
678 );
679
680 $template->assign_vars(array(
681 'ERROR_MESSAGE' => $error_msg)
682 );
683
684 $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
685
686 $username = htmlspecialchars(stripslashes($username));
687 $email = stripslashes($email);
688 $password = '';
689 $password_confirm = '';
690
691 $icq = stripslashes($icq);
692 $aim = htmlspecialchars(str_replace('+', ' ', stripslashes($aim)));
693 $msn = htmlspecialchars(stripslashes($msn));
694 rizwank 1.1 $yim = htmlspecialchars(stripslashes($yim));
695
696 $website = htmlspecialchars(stripslashes($website));
697 $location = htmlspecialchars(stripslashes($location));
698 $occupation = htmlspecialchars(stripslashes($occupation));
699 $interests = htmlspecialchars(stripslashes($interests));
700 $signature = htmlspecialchars(stripslashes($signature));
701
702 $user_lang = stripslashes($user_lang);
703 $user_dateformat = htmlspecialchars(stripslashes($user_dateformat));
704 }
705 }
706 else if( !isset( $HTTP_POST_VARS['submit'] ) && $mode != 'save' && !isset( $HTTP_POST_VARS['avatargallery'] ) && !isset( $HTTP_POST_VARS['submitavatar'] ) && !isset( $HTTP_POST_VARS['cancelavatar'] ) )
707 {
708 if( isset( $HTTP_GET_VARS[POST_USERS_URL]) || isset( $HTTP_POST_VARS[POST_USERS_URL]) )
709 {
710 $user_id = ( isset( $HTTP_POST_VARS[POST_USERS_URL]) ) ? intval( $HTTP_POST_VARS[POST_USERS_URL]) : intval( $HTTP_GET_VARS[POST_USERS_URL]);
711 $this_userdata = get_userdata($user_id);
712 if( !$this_userdata )
713 {
714 message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
715 rizwank 1.1 }
716 }
717 else
718 {
719 $this_userdata = get_userdata(htmlspecialchars($HTTP_POST_VARS['username']));
720 if( !$this_userdata )
721 {
722 message_die(GENERAL_MESSAGE, $lang['No_user_id_specified'] );
723 }
724 }
725
726 //
727 // Now parse and display it as a template
728 //
729 $user_id = $this_userdata['user_id'];
730 $username = htmlspecialchars($this_userdata['username']);
731 $email = $this_userdata['user_email'];
732 $password = '';
733 $password_confirm = '';
734
735 $icq = $this_userdata['user_icq'];
736 rizwank 1.1 $aim = htmlspecialchars(str_replace('+', ' ', $this_userdata['user_aim'] ));
737 $msn = htmlspecialchars($this_userdata['user_msnm']);
738 $yim = htmlspecialchars($this_userdata['user_yim']);
739
740 $website = htmlspecialchars($this_userdata['user_website']);
741 $location = htmlspecialchars($this_userdata['user_from']);
742 $occupation = htmlspecialchars($this_userdata['user_occ']);
743 $interests = htmlspecialchars($this_userdata['user_interests']);
744
745 $signature = ($this_userdata['user_sig_bbcode_uid'] != '') ? preg_replace('#:' . $this_userdata['user_sig_bbcode_uid'] . '#si', '', $this_userdata['user_sig']) : $this_userdata['user_sig'];
746 $signature = preg_replace($html_entities_match, $html_entities_replace, $signature);
747
748 $viewemail = $this_userdata['user_viewemail'];
749 $notifypm = $this_userdata['user_notify_pm'];
750 $popuppm = $this_userdata['user_popup_pm'];
751 $notifyreply = $this_userdata['user_notify'];
752 $attachsig = $this_userdata['user_attachsig'];
753 $allowhtml = $this_userdata['user_allowhtml'];
754 $allowbbcode = $this_userdata['user_allowbbcode'];
755 $allowsmilies = $this_userdata['user_allowsmile'];
756 $allowviewonline = $this_userdata['user_allow_viewonline'];
757 rizwank 1.1
758 $user_avatar = $this_userdata['user_avatar'];
759 $user_avatar_type = $this_userdata['user_avatar_type'];
760 $user_style = $this_userdata['user_style'];
761 $user_lang = $this_userdata['user_lang'];
762 $user_timezone = $this_userdata['user_timezone'];
763 $user_dateformat = htmlspecialchars($this_userdata['user_dateformat']);
764
765 $user_status = $this_userdata['user_active'];
766 $user_allowavatar = $this_userdata['user_allowavatar'];
767 $user_allowpm = $this_userdata['user_allow_pm'];
768
769 $COPPA = false;
770
771 $html_status = ($this_userdata['user_allowhtml'] ) ? $lang['HTML_is_ON'] : $lang['HTML_is_OFF'];
772 $bbcode_status = ($this_userdata['user_allowbbcode'] ) ? $lang['BBCode_is_ON'] : $lang['BBCode_is_OFF'];
773 $smilies_status = ($this_userdata['user_allowsmile'] ) ? $lang['Smilies_are_ON'] : $lang['Smilies_are_OFF'];
774 }
775
776 if( isset($HTTP_POST_VARS['avatargallery']) && !$error )
777 {
778 rizwank 1.1 if( !$error )
779 {
780 $user_id = intval($HTTP_POST_VARS['id']);
781
782 $template->set_filenames(array(
783 "body" => "admin/user_avatar_gallery.tpl")
784 );
785
786 $dir = @opendir("../" . $board_config['avatar_gallery_path']);
787
788 $avatar_images = array();
789 while( $file = @readdir($dir) )
790 {
791 if( $file != "." && $file != ".." && !is_file(phpbb_realpath("./../" . $board_config['avatar_gallery_path'] . "/" . $file)) && !is_link(phpbb_realpath("./../" . $board_config['avatar_gallery_path'] . "/" . $file)) )
792 {
793 $sub_dir = @opendir("../" . $board_config['avatar_gallery_path'] . "/" . $file);
794
795 $avatar_row_count = 0;
796 $avatar_col_count = 0;
797
798 while( $sub_file = @readdir($sub_dir) )
799 rizwank 1.1 {
800 if( preg_match("/(\.gif$|\.png$|\.jpg)$/is", $sub_file) )
801 {
802 $avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . "/" . $sub_file;
803
804 $avatar_col_count++;
805 if( $avatar_col_count == 5 )
806 {
807 $avatar_row_count++;
808 $avatar_col_count = 0;
809 }
810 }
811 }
812 }
813 }
814
815 @closedir($dir);
816
817 if( isset($HTTP_POST_VARS['avatarcategory']) )
818 {
819 $category = $HTTP_POST_VARS['avatarcategory'];
820 rizwank 1.1 }
821 else
822 {
823 list($category, ) = each($avatar_images);
824 }
825 @reset($avatar_images);
826
827 $s_categories = "";
828 while( list($key) = each($avatar_images) )
829 {
830 $selected = ( $key == $category ) ? "selected=\"selected\"" : "";
831 if( count($avatar_images[$key]) )
832 {
833 $s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
834 }
835 }
836
837 $s_colspan = 0;
838 for($i = 0; $i < count($avatar_images[$category]); $i++)
839 {
840 $template->assign_block_vars("avatar_row", array());
841 rizwank 1.1
842 $s_colspan = max($s_colspan, count($avatar_images[$category][$i]));
843
844 for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
845 {
846 $template->assign_block_vars("avatar_row.avatar_column", array(
847 "AVATAR_IMAGE" => "../" . $board_config['avatar_gallery_path'] . "/" . $avatar_images[$category][$i][$j])
848 );
849
850 $template->assign_block_vars("avatar_row.avatar_option_column", array(
851 "S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
852 );
853 }
854 }
855
856 $coppa = ( ( !$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa'] ) || $mode == "register") ? 0 : TRUE;
857
858 $s_hidden_fields = '<input type="hidden" name="mode" value="edit" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
859 $s_hidden_fields .= '<input type="hidden" name="id" value="' . $user_id . '" />';
860
861 $s_hidden_fields .= '<input type="hidden" name="username" value="' . str_replace("\"", """, $username) . '" />';
862 rizwank 1.1 $s_hidden_fields .= '<input type="hidden" name="email" value="' . str_replace("\"", """, $email) . '" />';
863 $s_hidden_fields .= '<input type="hidden" name="icq" value="' . str_replace("\"", """, $icq) . '" />';
864 $s_hidden_fields .= '<input type="hidden" name="aim" value="' . str_replace("\"", """, $aim) . '" />';
865 $s_hidden_fields .= '<input type="hidden" name="msn" value="' . str_replace("\"", """, $msn) . '" />';
866 $s_hidden_fields .= '<input type="hidden" name="yim" value="' . str_replace("\"", """, $yim) . '" />';
867 $s_hidden_fields .= '<input type="hidden" name="website" value="' . str_replace("\"", """, $website) . '" />';
868 $s_hidden_fields .= '<input type="hidden" name="location" value="' . str_replace("\"", """, $location) . '" />';
869 $s_hidden_fields .= '<input type="hidden" name="occupation" value="' . str_replace("\"", """, $occupation) . '" />';
870 $s_hidden_fields .= '<input type="hidden" name="interests" value="' . str_replace("\"", """, $interests) . '" />';
871 $s_hidden_fields .= '<input type="hidden" name="signature" value="' . str_replace("\"", """, $signature) . '" />';
872 $s_hidden_fields .= '<input type="hidden" name="viewemail" value="' . $viewemail . '" />';
873 $s_hidden_fields .= '<input type="hidden" name="notifypm" value="' . $notifypm . '" />';
874 $s_hidden_fields .= '<input type="hidden" name="popup_pm" value="' . $popuppm . '" />';
875 $s_hidden_fields .= '<input type="hidden" name="notifyreply" value="' . $notifyreply . '" />';
876 $s_hidden_fields .= '<input type="hidden" name="attachsig" value="' . $attachsig . '" />';
877 $s_hidden_fields .= '<input type="hidden" name="allowhtml" value="' . $allowhtml . '" />';
878 $s_hidden_fields .= '<input type="hidden" name="allowbbcode" value="' . $allowbbcode . '" />';
879 $s_hidden_fields .= '<input type="hidden" name="allowsmilies" value="' . $allowsmilies . '" />';
880 $s_hidden_fields .= '<input type="hidden" name="hideonline" value="' . !$allowviewonline . '" />';
881 $s_hidden_fields .= '<input type="hidden" name="style" value="' . $user_style . '" />';
882 $s_hidden_fields .= '<input type="hidden" name="language" value="' . $user_lang . '" />';
883 rizwank 1.1 $s_hidden_fields .= '<input type="hidden" name="timezone" value="' . $user_timezone . '" />';
884 $s_hidden_fields .= '<input type="hidden" name="dateformat" value="' . str_replace("\"", """, $user_dateformat) . '" />';
885
886 $s_hidden_fields .= '<input type="hidden" name="user_status" value="' . $user_status . '" />';
887 $s_hidden_fields .= '<input type="hidden" name="user_allowpm" value="' . $user_allowpm . '" />';
888 $s_hidden_fields .= '<input type="hidden" name="user_allowavatar" value="' . $user_allowavatar . '" />';
889 $s_hidden_fields .= '<input type="hidden" name="user_rank" value="' . $user_rank . '" />';
890
891 $template->assign_vars(array(
892 "L_USER_TITLE" => $lang['User_admin'],
893 "L_USER_EXPLAIN" => $lang['User_admin_explain'],
894 "L_AVATAR_GALLERY" => $lang['Avatar_gallery'],
895 "L_SELECT_AVATAR" => $lang['Select_avatar'],
896 "L_RETURN_PROFILE" => $lang['Return_profile'],
897 "L_CATEGORY" => $lang['Select_category'],
898 "L_GO" => $lang['Go'],
899
900 "S_OPTIONS_CATEGORIES" => $s_categories,
901 "S_COLSPAN" => $s_colspan,
902 "S_PROFILE_ACTION" => append_sid("admin_users.$phpEx?mode=$mode"),
903 "S_HIDDEN_FIELDS" => $s_hidden_fields)
904 rizwank 1.1 );
905 }
906 }
907 else
908 {
909 $s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
910 $s_hidden_fields .= '<input type="hidden" name="id" value="' . $this_userdata['user_id'] . '" />';
911
912 if( !empty($user_avatar_local) )
913 {
914 $s_hidden_fields .= '<input type="hidden" name="avatarlocal" value="' . $user_avatar_local . '" />';
915 }
916
917 if( $user_avatar_type )
918 {
919 switch( $user_avatar_type )
920 {
921 case USER_AVATAR_UPLOAD:
922 $avatar = '<img src="../' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />';
923 break;
924 case USER_AVATAR_REMOTE:
925 rizwank 1.1 $avatar = '<img src="' . $user_avatar . '" alt="" />';
926 break;
927 case USER_AVATAR_GALLERY:
928 $avatar = '<img src="../' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />';
929 break;
930 }
931 }
932 else
933 {
934 $avatar = "";
935 }
936
937 $sql = "SELECT * FROM " . RANKS_TABLE . "
938 WHERE rank_special = 1
939 ORDER BY rank_title";
940 if ( !($result = $db->sql_query($sql)) )
941 {
942 message_die(GENERAL_ERROR, 'Could not obtain ranks data', '', __LINE__, __FILE__, $sql);
943 }
944
945 $rank_select_box = '<option value="0">' . $lang['No_assigned_rank'] . '</option>';
946 rizwank 1.1 while( $row = $db->sql_fetchrow($result) )
947 {
948 $rank = $row['rank_title'];
949 $rank_id = $row['rank_id'];
950
951 $selected = ( $this_userdata['user_rank'] == $rank_id ) ? ' selected="selected"' : '';
952 $rank_select_box .= '<option value="' . $rank_id . '"' . $selected . '>' . $rank . '</option>';
953 }
954
955 $template->set_filenames(array(
956 "body" => "admin/user_edit_body.tpl")
957 );
958
959 //
960 // Let's do an overall check for settings/versions which would prevent
961 // us from doing file uploads....
962 //
963 $ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
964 $form_enctype = ( !@$ini_val('file_uploads') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';
965
966 $template->assign_vars(array(
967 rizwank 1.1 'USERNAME' => $username,
968 'EMAIL' => $email,
969 'YIM' => $yim,
970 'ICQ' => $icq,
971 'MSN' => $msn,
972 'AIM' => $aim,
973 'OCCUPATION' => $occupation,
974 'INTERESTS' => $interests,
975 'LOCATION' => $location,
976 'WEBSITE' => $website,
977 'SIGNATURE' => str_replace('<br />', "\n", $signature),
978 'VIEW_EMAIL_YES' => ($viewemail) ? 'checked="checked"' : '',
979 'VIEW_EMAIL_NO' => (!$viewemail) ? 'checked="checked"' : '',
980 'HIDE_USER_YES' => (!$allowviewonline) ? 'checked="checked"' : '',
981 'HIDE_USER_NO' => ($allowviewonline) ? 'checked="checked"' : '',
982 'NOTIFY_PM_YES' => ($notifypm) ? 'checked="checked"' : '',
983 'NOTIFY_PM_NO' => (!$notifypm) ? 'checked="checked"' : '',
984 'POPUP_PM_YES' => ($popuppm) ? 'checked="checked"' : '',
985 'POPUP_PM_NO' => (!$popuppm) ? 'checked="checked"' : '',
986 'ALWAYS_ADD_SIGNATURE_YES' => ($attachsig) ? 'checked="checked"' : '',
987 'ALWAYS_ADD_SIGNATURE_NO' => (!$attachsig) ? 'checked="checked"' : '',
988 rizwank 1.1 'NOTIFY_REPLY_YES' => ( $notifyreply ) ? 'checked="checked"' : '',
989 'NOTIFY_REPLY_NO' => ( !$notifyreply ) ? 'checked="checked"' : '',
990 'ALWAYS_ALLOW_BBCODE_YES' => ($allowbbcode) ? 'checked="checked"' : '',
991 'ALWAYS_ALLOW_BBCODE_NO' => (!$allowbbcode) ? 'checked="checked"' : '',
992 'ALWAYS_ALLOW_HTML_YES' => ($allowhtml) ? 'checked="checked"' : '',
993 'ALWAYS_ALLOW_HTML_NO' => (!$allowhtml) ? 'checked="checked"' : '',
994 'ALWAYS_ALLOW_SMILIES_YES' => ($allowsmilies) ? 'checked="checked"' : '',
995 'ALWAYS_ALLOW_SMILIES_NO' => (!$allowsmilies) ? 'checked="checked"' : '',
996 'AVATAR' => $avatar,
997 'LANGUAGE_SELECT' => language_select($user_lang),
998 'TIMEZONE_SELECT' => tz_select($user_timezone),
999 'STYLE_SELECT' => style_select($user_style, 'style'),
1000 'DATE_FORMAT' => $user_dateformat,
1001 'ALLOW_PM_YES' => ($user_allowpm) ? 'checked="checked"' : '',
1002 'ALLOW_PM_NO' => (!$user_allowpm) ? 'checked="checked"' : '',
1003 'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
1004 'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',
1005 'USER_ACTIVE_YES' => ($user_status) ? 'checked="checked"' : '',
1006 'USER_ACTIVE_NO' => (!$user_status) ? 'checked="checked"' : '',
1007 'RANK_SELECT_BOX' => $rank_select_box,
1008
1009 rizwank 1.1 'L_USERNAME' => $lang['Username'],
1010 'L_USER_TITLE' => $lang['User_admin'],
1011 'L_USER_EXPLAIN' => $lang['User_admin_explain'],
1012 'L_NEW_PASSWORD' => $lang['New_password'],
1013 'L_PASSWORD_IF_CHANGED' => $lang['password_if_changed'],
1014 'L_CONFIRM_PASSWORD' => $lang['Confirm_password'],
1015 'L_PASSWORD_CONFIRM_IF_CHANGED' => $lang['password_confirm_if_changed'],
1016 'L_SUBMIT' => $lang['Submit'],
1017 'L_RESET' => $lang['Reset'],
1018 'L_ICQ_NUMBER' => $lang['ICQ'],
1019 'L_MESSENGER' => $lang['MSNM'],
1020 'L_YAHOO' => $lang['YIM'],
1021 'L_WEBSITE' => $lang['Website'],
1022 'L_AIM' => $lang['AIM'],
1023 'L_LOCATION' => $lang['Location'],
1024 'L_OCCUPATION' => $lang['Occupation'],
1025 'L_BOARD_LANGUAGE' => $lang['Board_lang'],
1026 'L_BOARD_STYLE' => $lang['Board_style'],
1027 'L_TIMEZONE' => $lang['Timezone'],
1028 'L_DATE_FORMAT' => $lang['Date_format'],
1029 'L_DATE_FORMAT_EXPLAIN' => $lang['Date_format_explain'],
1030 rizwank 1.1 'L_YES' => $lang['Yes'],
1031 'L_NO' => $lang['No'],
1032 'L_INTERESTS' => $lang['Interests'],
1033 'L_ALWAYS_ALLOW_SMILIES' => $lang['Always_smile'],
1034 'L_ALWAYS_ALLOW_BBCODE' => $lang['Always_bbcode'],
1035 'L_ALWAYS_ALLOW_HTML' => $lang['Always_html'],
1036 'L_HIDE_USER' => $lang['Hide_user'],
1037 'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
1038
1039 'L_SPECIAL' => $lang['User_special'],
1040 'L_SPECIAL_EXPLAIN' => $lang['User_special_explain'],
1041 'L_USER_ACTIVE' => $lang['User_status'],
1042 'L_ALLOW_PM' => $lang['User_allowpm'],
1043 'L_ALLOW_AVATAR' => $lang['User_allowavatar'],
1044
1045 'L_AVATAR_PANEL' => $lang['Avatar_panel'],
1046 'L_AVATAR_EXPLAIN' => $lang['Admin_avatar_explain'],
1047 'L_DELETE_AVATAR' => $lang['Delete_Image'],
1048 'L_CURRENT_IMAGE' => $lang['Current_Image'],
1049 'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
1050 'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
1051 rizwank 1.1 'L_AVATAR_GALLERY' => $lang['Select_from_gallery'],
1052 'L_SHOW_GALLERY' => $lang['View_avatar_gallery'],
1053 'L_LINK_REMOTE_AVATAR' => $lang['Link_remote_Avatar'],
1054
1055 'L_SIGNATURE' => $lang['Signature'],
1056 'L_SIGNATURE_EXPLAIN' => sprintf($lang['Signature_explain'], $board_config['max_sig_chars'] ),
1057 'L_NOTIFY_ON_PRIVMSG' => $lang['Notify_on_privmsg'],
1058 'L_NOTIFY_ON_REPLY' => $lang['Always_notify'],
1059 'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
1060 'L_PREFERENCES' => $lang['Preferences'],
1061 'L_PUBLIC_VIEW_EMAIL' => $lang['Public_view_email'],
1062 'L_ITEMS_REQUIRED' => $lang['Items_required'],
1063 'L_REGISTRATION_INFO' => $lang['Registration_info'],
1064 'L_PROFILE_INFO' => $lang['Profile_info'],
1065 'L_PROFILE_INFO_NOTICE' => $lang['Profile_info_warn'],
1066 'L_EMAIL_ADDRESS' => $lang['Email_address'],
1067 'S_FORM_ENCTYPE' => $form_enctype,
1068
1069 'HTML_STATUS' => $html_status,
1070 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="../' . append_sid("faq.$phpEx?mode=bbcode") . '" target="_phpbbcode">', '</a>'),
1071 'SMILIES_STATUS' => $smilies_status,
1072 rizwank 1.1
1073 'L_DELETE_USER' => $lang['User_delete'],
1074 'L_DELETE_USER_EXPLAIN' => $lang['User_delete_explain'],
1075 'L_SELECT_RANK' => $lang['Rank_title'],
1076
1077 'S_HIDDEN_FIELDS' => $s_hidden_fields,
1078 'S_PROFILE_ACTION' => append_sid("admin_users.$phpEx"))
1079 );
1080
1081 if( file_exists(@phpbb_realpath('./../' . $board_config['avatar_path'])) && ($board_config['allow_avatar_upload'] == TRUE) )
1082 {
1083 if ( $form_enctype != '' )
1084 {
1085 $template->assign_block_vars('avatar_local_upload', array() );
1086 }
1087 $template->assign_block_vars('avatar_remote_upload', array() );
1088 }
1089
1090 if( file_exists(@phpbb_realpath('./../' . $board_config['avatar_gallery_path'])) && ($board_config['allow_avatar_local'] == TRUE) )
1091 {
1092 $template->assign_block_vars('avatar_local_gallery', array() );
1093 rizwank 1.1 }
1094
1095 if( $board_config['allow_avatar_remote'] == TRUE )
1096 {
1097 $template->assign_block_vars('avatar_remote_link', array() );
1098 }
1099 }
1100
1101 $template->pparse('body');
1102 }
1103 else
1104 {
1105 //
1106 // Default user selection box
1107 //
1108 $template->set_filenames(array(
1109 'body' => 'admin/user_select_body.tpl')
1110 );
1111
1112 $template->assign_vars(array(
1113 'L_USER_TITLE' => $lang['User_admin'],
1114 rizwank 1.1 'L_USER_EXPLAIN' => $lang['User_admin_explain'],
1115 'L_USER_SELECT' => $lang['Select_a_User'],
1116 'L_LOOK_UP' => $lang['Look_up_user'],
1117 'L_FIND_USERNAME' => $lang['Find_username'],
1118
1119 'U_SEARCH_USER' => append_sid("./../search.$phpEx?mode=searchuser"),
1120
1121 'S_USER_ACTION' => append_sid("admin_users.$phpEx"),
1122 'S_USER_SELECT' => $select_list)
1123 );
1124 $template->pparse('body');
1125
1126 }
1127
1128 include('./page_footer_admin.'.$phpEx);
1129
1130 ?>
|