root / tags / milestone_3 / phpBB / adm / admin_users.php
History | View | Annotate | Download (76 kB)
| 1 | <?php
|
|---|---|
| 2 | /**
|
| 3 | * |
| 4 | * @package acp |
| 5 | * @version $Id: admin_users.php 5114 2005-04-09 12:26:45Z acydburn $ |
| 6 | * @copyright (c) 2005 phpBB Group |
| 7 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | /**
|
| 12 | */ |
| 13 | if (!empty($setmodules)) |
| 14 | {
|
| 15 | if (!$auth->acl_gets('a_user', 'a_useradd', 'a_userdel')) |
| 16 | {
|
| 17 | return;
|
| 18 | } |
| 19 | |
| 20 | $module['USER']['MANAGE_USERS'] = basename(__FILE__) . $SID; |
| 21 | |
| 22 | return;
|
| 23 | } |
| 24 | |
| 25 | define('IN_PHPBB', 1); |
| 26 | // Include files
|
| 27 | $phpbb_root_path = '../'; |
| 28 | $phpEx = substr(strrchr(__FILE__, '.'), 1); |
| 29 | require('pagestart.' . $phpEx); |
| 30 | include($phpbb_root_path.'includes/functions_user.'.$phpEx); |
| 31 | include($phpbb_root_path.'includes/functions_profile_fields.'.$phpEx); |
| 32 | |
| 33 | $user->add_lang(array('posting', 'ucp')); |
| 34 | |
| 35 | //
|
| 36 | // Get and set basic vars
|
| 37 | //
|
| 38 | $mode = request_var('mode', 'overview'); |
| 39 | $action = request_var('action', ''); |
| 40 | |
| 41 | $username = request_var('username', ''); |
| 42 | $user_id = request_var('u', 0); |
| 43 | $gid = request_var('g', 0); |
| 44 | |
| 45 | $start = request_var('start', 0); |
| 46 | $ip = request_var('ip', ''); |
| 47 | $start = request_var('start', 0); |
| 48 | $delete = request_var('delete', ''); |
| 49 | $deletetype = request_var('deletetype', ''); |
| 50 | $marked = request_var('mark', 0); |
| 51 | $quicktools = request_var('quicktools', ''); |
| 52 | |
| 53 | $st = request_var('st', 0); |
| 54 | $sk = request_var('sk', 'a'); |
| 55 | $sd = request_var('sd', 'd'); |
| 56 | |
| 57 | $submit = (isset($_POST['update'])) ? true : false; |
| 58 | $confirm = (isset($_POST['confirm'])) ? true : false; |
| 59 | $cancel = (isset($_POST['cancel'])) ? true : false; |
| 60 | $preview = (isset($_POST['preview'])) ? true : false; |
| 61 | $deletemark = (isset($_POST['delmarked'])) ? true : false; |
| 62 | $deleteall = (isset($_POST['delall'])) ? true : false; |
| 63 | |
| 64 | $error = array(); |
| 65 | $colspan = 0; |
| 66 | |
| 67 | //
|
| 68 | // Whois output
|
| 69 | //
|
| 70 | if ($action == 'whois') |
| 71 | {
|
| 72 | // Output relevant page
|
| 73 | adm_page_header($user->lang['WHOIS']); |
| 74 | |
| 75 | if ($ip && $domain = gethostbyaddr($ip)) |
| 76 | {
|
| 77 | ?>
|
| 78 | |
| 79 | <table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 80 | <tr>
|
| 81 | <th>IP whois for <?php echo $domain; ?></th> |
| 82 | </tr>
|
| 83 | <tr>
|
| 84 | <td class="row1"><?php |
| 85 | |
| 86 | if ($ipwhois = user_ipwhois($ip)) |
| 87 | {
|
| 88 | $ipwhois = preg_replace('#(\s+?)([\w\-\._\+]+?@[\w\-\.]+?)(\s+?)#s', '\1<a href="mailto:\2">\2</a>\3', $ipwhois); |
| 89 | echo '<br /><pre align="left">' . trim($ipwhois) . '</pre>'; |
| 90 | } |
| 91 | |
| 92 | ?></td> |
| 93 | </tr>
|
| 94 | </table>
|
| 95 | |
| 96 | <br clear="all" /> |
| 97 | |
| 98 | <?php
|
| 99 | |
| 100 | } |
| 101 | |
| 102 | adm_page_footer(); |
| 103 | } |
| 104 | |
| 105 | // |
| 106 | // Obtain user information if appropriate |
| 107 | // |
| 108 | if ($username || $user_id) |
| 109 | {
|
| 110 | $session_time = 0; |
| 111 | $sql_where = ($user_id) ? "user_id = $user_id" : "username = '" . $db->sql_escape($username) . "'";
|
| 112 | $sql = ($action == 'overview') ? 'SELECT u.*, s.session_time, s.session_page, s.session_ip FROM (' . USERS_TABLE . ' u LEFT JOIN ' . SESSIONS_TABLE . " s ON s.session_user_id = u.user_id) WHERE u.$sql_where ORDER BY s.session_time DESC" : 'SELECT * FROM ' . USERS_TABLE . " WHERE $sql_where";
|
| 113 | $result = $db->sql_query($sql);
|
| 114 | |
| 115 | if (!extract($db->sql_fetchrow($result)))
|
| 116 | {
|
| 117 | trigger_error($user->lang['NO_USER']);
|
| 118 | } |
| 119 | $db->sql_freeresult($result);
|
| 120 | |
| 121 | if ($session_time > $user_lastvisit)
|
| 122 | {
|
| 123 | $user_lastvisit = $session_time; |
| 124 | $user_lastpage = $session_page; |
| 125 | } |
| 126 | |
| 127 | $user_password = ''; |
| 128 | } |
| 129 | |
| 130 | // Output page |
| 131 | adm_page_header($user->lang['MANAGE']);
|
| 132 | |
| 133 | |
| 134 | // |
| 135 | // Output forms |
| 136 | // |
| 137 | |
| 138 | // Begin program |
| 139 | if ($username || $user_id) |
| 140 | {
|
| 141 | // Generate overall "header" for user admin |
| 142 | $form_options = ''; |
| 143 | $forms_ary = array('overview' => 'OVERVIEW', 'feedback' => 'FEEDBACK', 'profile' => 'PROFILE', 'prefs' => 'PREFS', 'avatar' => 'AVATAR', 'sig' => 'SIG', 'groups' => 'GROUP', 'perm' => 'PERM', 'attach' => 'ATTACH');
|
| 144 | |
| 145 | foreach ($forms_ary as $value => $lang)
|
| 146 | {
|
| 147 | $selected = ($mode == $value) ? ' selected="selected"' : ''; |
| 148 | $form_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang['USER_ADMIN_' . $lang] . '</option>'; |
| 149 | } |
| 150 | |
| 151 | $pagination = ''; |
| 152 | |
| 153 | ?>
|
| 154 | |
| 155 | <script language="javascript" type="text/javascript"> |
| 156 | <!--
|
| 157 | |
| 158 | var form_name = 'admin'; |
| 159 | var text_name = 'signature'; |
| 160 | |
| 161 | // Define the bbCode tags |
| 162 | bbcode = new Array(); |
| 163 | bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
|
| 164 | imageTag = false; |
| 165 | |
| 166 | // Helpline messages |
| 167 | b_help = "<?php echo $user->lang['BBCODE_B_HELP']; ?>"; |
| 168 | i_help = "<?php echo $user->lang['BBCODE_I_HELP']; ?>"; |
| 169 | u_help = "<?php echo $user->lang['BBCODE_U_HELP']; ?>"; |
| 170 | q_help = "<?php echo $user->lang['BBCODE_Q_HELP']; ?>"; |
| 171 | c_help = "<?php echo $user->lang['BBCODE_C_HELP']; ?>"; |
| 172 | l_help = "<?php echo $user->lang['BBCODE_L_HELP']; ?>"; |
| 173 | o_help = "<?php echo $user->lang['BBCODE_O_HELP']; ?>"; |
| 174 | p_help = "<?php echo $user->lang['BBCODE_P_HELP']; ?>"; |
| 175 | w_help = "<?php echo $user->lang['BBCODE_W_HELP']; ?>"; |
| 176 | a_help = "<?php echo $user->lang['BBCODE_A_HELP']; ?>"; |
| 177 | s_help = "<?php echo $user->lang['BBCODE_S_HELP']; ?>"; |
| 178 | f_help = "<?php echo $user->lang['BBCODE_F_HELP']; ?>"; |
| 179 | e_help = "<?php echo $user->lang['BBCODE_E_HELP']; ?>"; |
| 180 | |
| 181 | //-->
|
| 182 | </script>
|
| 183 | <script language="javascript" type="text/javascript" src="editor.js"></script> |
| 184 | |
| 185 | <h1><?php echo $user->lang['USER_ADMIN']; ?></h1> |
| 186 | |
| 187 | <p><?php echo $user->lang['USER_ADMIN_EXPLAIN']; ?></p> |
| 188 | |
| 189 | <form method="post" name="admin" action="<?php echo "admin_users.$phpEx$SID&mode=$mode&u=$user_id"; ?>"<?php echo ($file_uploads) ? ' enctype="multipart/form-data"' : ''; ?>><table width="100%" cellspacing="2" cellpadding="0" border="0" align="center"> |
| 190 | <tr>
|
| 191 | <td align="right"><?php echo $user->lang['SELECT_FORM']; ?>: <select name="mode" onchange="if (this.options[this.selectedIndex].value != '') this.form.submit();"><?php echo $form_options; ?></select></td> |
| 192 | </tr>
|
| 193 | <tr>
|
| 194 | <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"> |
| 195 | <?php
|
| 196 | |
| 197 | if (sizeof($error)) |
| 198 | {
|
| 199 | |
| 200 | ?>
|
| 201 | <tr>
|
| 202 | <td class="row3" colspan="" align="center"><span class="error"><?php echo implode('<br />', $error); ?></span></td> |
| 203 | </tr>
|
| 204 | <?php
|
| 205 | |
| 206 | } |
| 207 | |
| 208 | |
| 209 | switch ($mode) |
| 210 | {
|
| 211 | case 'overview': |
| 212 | |
| 213 | if ($submit) |
| 214 | {
|
| 215 | if ($delete && $user_type != USER_FOUNDER) |
| 216 | {
|
| 217 | if (!$auth->acl_get('a_userdel'))
|
| 218 | {
|
| 219 | trigger_error($user->lang['NO_ADMIN']);
|
| 220 | } |
| 221 | |
| 222 | if (!$cancel && !$confirm) |
| 223 | {
|
| 224 | adm_page_confirm($user->lang['CONFIRM'], $user->lang['CONFIRM_OPERATION']); |
| 225 | } |
| 226 | else if (!$cancel) |
| 227 | {
|
| 228 | user_delete($deletetype, $user_id); |
| 229 | |
| 230 | add_log('admin', 'LOG_USER_DELETED', $username);
|
| 231 | trigger_error($user->lang['USER_DELETED']);
|
| 232 | } |
| 233 | } |
| 234 | |
| 235 | // Handle quicktool actions |
| 236 | if ($quicktools && $user_type != USER_FOUNDER) |
| 237 | {
|
| 238 | switch ($quicktools) |
| 239 | {
|
| 240 | case 'banuser': |
| 241 | case 'banemail': |
| 242 | case 'banip': |
| 243 | $ban = array(); |
| 244 | |
| 245 | switch ($quicktools) |
| 246 | {
|
| 247 | case 'banuser': |
| 248 | $ban[] = $username; |
| 249 | $reason = 'USER_ADMIN_BAN_NAME_REASON'; |
| 250 | $log = 'LOG_BAN_USERNAME_USER'; |
| 251 | break; |
| 252 | |
| 253 | case 'banemail': |
| 254 | $ban[] = $user_email; |
| 255 | $reason = 'USER_ADMIN_BAN_EMAIL_REASON'; |
| 256 | $log = 'LOG_BAN_EMAIL_USER'; |
| 257 | break; |
| 258 | |
| 259 | case 'banip': |
| 260 | $ban[] = $user_ip; |
| 261 | |
| 262 | $sql = 'SELECT DISTINCT poster_ip |
| 263 | FROM ' . POSTS_TABLE . " |
| 264 | WHERE poster_id = $user_id"; |
| 265 | $result = $db->sql_query($sql);
|
| 266 | |
| 267 | while ($row = $db->sql_fetchrow($result))
|
| 268 | {
|
| 269 | $ban[] = $row['poster_ip']; |
| 270 | } |
| 271 | $db->sql_freeresult($result);
|
| 272 | |
| 273 | $reason = 'USER_ADMIN_BAN_IP_REASON'; |
| 274 | $log = 'LOG_BAN_IP_USER'; |
| 275 | break; |
| 276 | } |
| 277 | |
| 278 | user_ban(substr($quicktools, 3), $ban, 0, 0, 0, $user->lang[$reason]);
|
| 279 | |
| 280 | add_log('user', $user_id, $log);
|
| 281 | |
| 282 | trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']);
|
| 283 | |
| 284 | break; |
| 285 | |
| 286 | case 'reactivate': |
| 287 | |
| 288 | if ($config['email_enable']) |
| 289 | {
|
| 290 | include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); |
| 291 | |
| 292 | $user_actkey = gen_rand_string(10); |
| 293 | $key_len = 54 - (strlen($server_url)); |
| 294 | $key_len = ($key_len > 6) ? $key_len : 6;
|
| 295 | $user_actkey = substr($user_actkey, 0, $key_len); |
| 296 | |
| 297 | user_active_flip($user_id, $user_type, $user_actkey, $username); |
| 298 | |
| 299 | $messenger = new messenger(); |
| 300 | |
| 301 | $messenger->template('user_welcome_inactive', $user_lang);
|
| 302 | $messenger->subject();
|
| 303 | |
| 304 | $messenger->replyto($config['board_contact']);
|
| 305 | $messenger->to($user_email, $username);
|
| 306 | |
| 307 | $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
|
| 308 | $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); |
| 309 | $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); |
| 310 | $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); |
| 311 | |
| 312 | $messenger->assign_vars(array(
|
| 313 | 'SITENAME' => $config['sitename'],
|
| 314 | 'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), |
| 315 | 'USERNAME' => $username,
|
| 316 | 'PASSWORD' => $password_confirm,
|
| 317 | 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), |
| 318 | |
| 319 | 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") |
| 320 | ); |
| 321 | |
| 322 | $messenger->send(NOTIFY_EMAIL);
|
| 323 | $messenger->save_queue();
|
| 324 | |
| 325 | add_log('admin', 'LOG_USER_REACTIVATE', $username);
|
| 326 | add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER');
|
| 327 | |
| 328 | trigger_error($user->lang['USER_ADMIN_REACTIVATE']);
|
| 329 | } |
| 330 | |
| 331 | break; |
| 332 | |
| 333 | case 'active': |
| 334 | |
| 335 | user_active_flip($user_id, $user_type, false, $username); |
| 336 | |
| 337 | $message = ($user_type == USER_NORMAL) ? 'USER_ADMIN_INACTIVE' : 'USER_ADMIN_ACTIVE'; |
| 338 | $log = ($user_type == USER_NORMAL) ? 'LOG_USER_INACTIVE' : 'LOG_USER_ACTIVE'; |
| 339 | |
| 340 | add_log('admin', $log, $username);
|
| 341 | add_log('user', $user_id, $log . '_USER');
|
| 342 | |
| 343 | trigger_error($user->lang[$message]);
|
| 344 | break; |
| 345 | |
| 346 | case 'moveposts': |
| 347 | |
| 348 | if (!($new_forum_id = request_var('new_f', 0)))
|
| 349 | {
|
| 350 | |
| 351 | ?>
|
| 352 | |
| 353 | <h1><?php echo $user->lang['USER_ADMIN']; ?></h1> |
| 354 | |
| 355 | <p><?php echo $user->lang['USER_ADMIN_EXPLAIN']; ?></p> |
| 356 | |
| 357 | <form method="post" action="<?php echo "admin_users.$phpEx$SID&action=$action&quicktools=moveposts&u=$user_id"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 358 | <tr>
|
| 359 | <th align="center"><?php echo $user->lang['USER_ADMIN_MOVE_POSTS']; ?></th> |
| 360 | </tr>
|
| 361 | <tr>
|
| 362 | <td class="row2" align="center" valign="middle"><?php echo $user->lang['MOVE_POSTS_EXPLAIN']; ?><br /><br /><select name="new_f"><?php |
| 363 | |
| 364 | echo make_forum_select(false, false, false, true); |
| 365 | |
| 366 | ?></select> </td> |
| 367 | </tr>
|
| 368 | <tr>
|
| 369 | <td class="cat" align="center"><input type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /></td> |
| 370 | </tr>
|
| 371 | </table>
|
| 372 | <?php
|
| 373 | |
| 374 | adm_page_footer(); |
| 375 | } |
| 376 | else |
| 377 | {
|
| 378 | // Two stage? |
| 379 | // Move topics comprising only posts from this user |
| 380 | $topic_id_ary = array(); |
| 381 | $forum_id_ary = array($new_forum_id); |
| 382 | |
| 383 | $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts |
| 384 | FROM ' . POSTS_TABLE . " |
| 385 | WHERE poster_id = $user_id |
| 386 | AND forum_id <> $new_forum_id |
| 387 | GROUP BY topic_id"; |
| 388 | $result = $db->sql_query($sql);
|
| 389 | |
| 390 | while ($row = $db->sql_fetchrow($result))
|
| 391 | {
|
| 392 | $topic_id_ary[$row['topic_id']] = $row['total_posts']; |
| 393 | } |
| 394 | $db->sql_freeresult($result);
|
| 395 | |
| 396 | $sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real |
| 397 | FROM ' . TOPICS_TABLE . ' |
| 398 | WHERE topic_id IN (' . implode(', ', array_keys($topic_id_ary)) . ')';
|
| 399 | $result = $db->sql_query($sql);
|
| 400 | |
| 401 | $move_topic_ary = $move_post_ary = array(); |
| 402 | while ($row = $db->sql_fetchrow($result))
|
| 403 | {
|
| 404 | if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']]) |
| 405 | {
|
| 406 | $move_topic_ary[] = $row['topic_id']; |
| 407 | } |
| 408 | else |
| 409 | {
|
| 410 | $move_post_ary[$row['topic_id']]['title'] = $row['topic_title']; |
| 411 | $move_post_ary[$row['topic_id']]['attach'] = ($row['attach']) ? 1 : 0; |
| 412 | } |
| 413 | |
| 414 | $forum_id_ary[] = $row['forum_id']; |
| 415 | } |
| 416 | $db->sql_freeresult($result);
|
| 417 | |
| 418 | // Entire topic comprises posts by this user, move these topics |
| 419 | if (sizeof($move_topic_ary)) |
| 420 | {
|
| 421 | move_topics($move_topic_ary, $new_forum_id, false); |
| 422 | } |
| 423 | |
| 424 | if (sizeof($move_post_ary)) |
| 425 | {
|
| 426 | // Create new topic |
| 427 | // Update post_ids, report_ids, attachment_ids |
| 428 | foreach ($move_post_ary as $topic_id => $post_ary)
|
| 429 | {
|
| 430 | // Create new topic |
| 431 | $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
|
| 432 | 'topic_poster' => $user_id,
|
| 433 | 'topic_time' => time(),
|
| 434 | 'forum_id' => $new_forum_id,
|
| 435 | 'icon_id' => 0,
|
| 436 | 'topic_approved' => 1,
|
| 437 | 'topic_title' => $post_ary['title'],
|
| 438 | 'topic_first_poster_name' => $username,
|
| 439 | 'topic_type' => POST_NORMAL,
|
| 440 | 'topic_time_limit' => 0,
|
| 441 | 'topic_attachment' => $post_ary['attach'],)
|
| 442 | ); |
| 443 | $db->sql_query($sql);
|
| 444 | |
| 445 | $new_topic_id = $db->sql_nextid();
|
| 446 | |
| 447 | // Move posts |
| 448 | $sql = 'UPDATE ' . POSTS_TABLE . " |
| 449 | SET forum_id = $new_forum_id, topic_id = $new_topic_id |
| 450 | WHERE topic_id = $topic_id |
| 451 | AND poster_id = $user_id"; |
| 452 | $db->sql_query($sql);
|
| 453 | |
| 454 | if ($post_ary['attach']) |
| 455 | {
|
| 456 | $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " |
| 457 | SET topic_id = $new_topic_id |
| 458 | WHERE topic_id = $topic_id |
| 459 | AND poster_id = $user_id"; |
| 460 | $db->sql_query($sql);
|
| 461 | } |
| 462 | |
| 463 | $new_topic_id_ary[] = $new_topic_id; |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | $forum_id_ary = array_unique($forum_id_ary); |
| 468 | $topic_id_ary = array_unique(array_merge($topic_id_ary, $new_topic_id_ary)); |
| 469 | |
| 470 | sync('reported', 'topic_id', $topic_id_ary);
|
| 471 | sync('topic', 'topic_id', $topic_id_ary);
|
| 472 | sync('forum', 'forum_id', $forum_id_ary);
|
| 473 | } |
| 474 | |
| 475 | break; |
| 476 | } |
| 477 | |
| 478 | $sql = 'SELECT forum_name |
| 479 | FROM ' . TOPICS_TABLE . " |
| 480 | WHERE topic_id = $new_forum_id"; |
| 481 | $result = $db->sql_query($sql);
|
| 482 | |
| 483 | extract($db->sql_fetchrow($result));
|
| 484 | $db->sql_freeresult($result);
|
| 485 | |
| 486 | add_log('admin', 'LOG_USER_MOVE_POSTS', $forum_name, $username);
|
| 487 | add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_name);
|
| 488 | |
| 489 | trigger_error($user->lang['USER_ADMIN_MOVE']);
|
| 490 | } |
| 491 | |
| 492 | // Handle registration info updates |
| 493 | $var_ary = array( |
| 494 | 'username' => (string) $username,
|
| 495 | 'user_founder' => (int) $user_founder,
|
| 496 | 'user_type' => (int) $user_type,
|
| 497 | 'user_email' => (string) $user_email,
|
| 498 | 'email_confirm' => (string) '',
|
| 499 | 'user_password' => (string) '',
|
| 500 | 'password_confirm' => (string) '',
|
| 501 | 'user_warnings' => (int) $user_warnings,
|
| 502 | ); |
| 503 | |
| 504 | foreach ($var_ary as $var => $default)
|
| 505 | {
|
| 506 | $data[$var] = request_var($var, $default); |
| 507 | } |
| 508 | |
| 509 | $var_ary = array( |
| 510 | 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
| 511 | 'user_password' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']),
|
| 512 | 'user_email' => array(
|
| 513 | array('string', false, 6, 60),
|
| 514 | array('email', $email)),
|
| 515 | 'email_confirm' => array('string', true, 6, 60),
|
| 516 | 'user_warnings' => array('num', 0, $config['max_warnings']),
|
| 517 | ); |
| 518 | |
| 519 | // Check username if altered |
| 520 | if ($username != $data['username']) |
| 521 | {
|
| 522 | $var_ary += array( |
| 523 | 'username' => array(
|
| 524 | array('string', false, $config['min_name_chars'], $config['max_name_chars']),
|
| 525 | array('username', $username)),
|
| 526 | ); |
| 527 | } |
| 528 | |
| 529 | $error = validate_data($data, $var_ary); |
| 530 | |
| 531 | if ($data['user_password'] && $data['password_confirm'] != $data['user_password']) |
| 532 | {
|
| 533 | $error[] = 'NEW_PASSWORD_ERROR'; |
| 534 | } |
| 535 | |
| 536 | if ($user_email != $data['user_email'] && $data['email_confirm'] != $data['user_email']) |
| 537 | {
|
| 538 | $error[] = 'NEW_EMAIL_ERROR'; |
| 539 | } |
| 540 | |
| 541 | // Which updates do we need to do? |
| 542 | $update_warning = ($user_warnings != $data['user_warnings']) ? true : false; |
| 543 | $update_username = ($username != $data['username']) ? $username : false; |
| 544 | $update_password = ($user_password != $data['user_password']) ? true : false; |
| 545 | |
| 546 | extract($data); |
| 547 | unset($data); |
| 548 | |
| 549 | if (!sizeof($error)) |
| 550 | {
|
| 551 | $sql_ary = array( |
| 552 | 'username' => $username,
|
| 553 | 'user_founder' => $user_founder,
|
| 554 | 'user_email' => $user_email,
|
| 555 | 'user_email_hash' => crc32(strtolower($user_email)) . strlen($user_email),
|
| 556 | 'user_warnings' => $user_warnings,
|
| 557 | ); |
| 558 | |
| 559 | if ($update_password) |
| 560 | {
|
| 561 | $sql_ary += array( |
| 562 | 'user_password' => md5($user_password),
|
| 563 | 'user_passchg' => time(),
|
| 564 | ); |
| 565 | } |
| 566 | |
| 567 | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 568 | SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
| 569 | WHERE user_id = ' . $user->data['user_id'];
|
| 570 | $db->sql_query($sql);
|
| 571 | |
| 572 | // TODO |
| 573 | if ($update_warning) |
| 574 | {
|
| 575 | } |
| 576 | |
| 577 | if ($update_username) |
| 578 | {
|
| 579 | user_update_name($update_username, $username); |
| 580 | } |
| 581 | |
| 582 | trigger_error($user->lang['USER_OVERVIEW_UPDATED']);
|
| 583 | } |
| 584 | |
| 585 | // Replace "error" strings with their real, localised form |
| 586 | $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
|
| 587 | } |
| 588 | |
| 589 | $colspan = 2; |
| 590 | |
| 591 | $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS');
|
| 592 | $quick_tool_ary = array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP', 'active' => (($user_type == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE'), 'delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
|
| 593 | if ($config['email_enable']) |
| 594 | {
|
| 595 | $quick_tool_ary['reactivate'] = 'FORCE'; |
| 596 | } |
| 597 | |
| 598 | $options = '<option class="sep" value="">' . $user->lang['SELECT_OPTION'] . '</option>'; |
| 599 | foreach ($quick_tool_ary as $value => $lang)
|
| 600 | {
|
| 601 | $options .= '<option value="' . $value . '">' . $user->lang['USER_ADMIN_' . $lang] . '</option>'; |
| 602 | } |
| 603 | |
| 604 | $user_founder_yes = ($user_type == USER_FOUNDER) ? ' checked="checked"' : ''; |
| 605 | $user_founder_no = ($user_type != USER_FOUNDER) ? ' checked="checked"' : (($user->data['user_type'] != USER_FOUNDER) ? ' disabled="disabled"' : '');
|
| 606 | |
| 607 | ?>
|
| 608 | <tr>
|
| 609 | <th colspan="2"><?php echo $user->lang['USER_ADMIN_OVERVIEW']; ?></th> |
| 610 | </tr>
|
| 611 | <tr>
|
| 612 | <td class="row1" width="40%"><?php echo $user->lang['USERNAME']; ?>: <br /><span class="gensmall"><?php echo sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']); ?></span></td> |
| 613 | <td class="row2"><input class="post" type="text" name="username" value="<?php echo $username; ?>" maxlength="60" /></td> |
| 614 | </tr>
|
| 615 | <tr>
|
| 616 | <td class="row1"><?php echo $user->lang['REGISTERED']; ?>: </td> |
| 617 | <td class="row2"><strong><?php echo $user->format_date($user_regdate); ?></strong></td> |
| 618 | </tr>
|
| 619 | <?php
|
| 620 | |
| 621 | if ($user_ip) |
| 622 | {
|
| 623 | |
| 624 | ?>
|
| 625 | <tr>
|
| 626 | <td class="row1"><?php echo $user->lang['REGISTERED_IP']; ?>: </td> |
| 627 | <td class="row2"><strong><?php echo "<a href=\"admin_users.$phpEx$SID&action=$action&u=$user_id&ip=" . ((!$ip || $ip == 'ip') ? 'hostname' : 'ip') . '">' . (($ip == 'hostname') ? gethostbyaddr($user_ip) : $user_ip) . "</a> [ <a href=\"admin_users.$phpEx$SID&action=whois&ip=$user_ip\" onclick=\"window.open('admin_users.$phpEx$SID&action=whois&ip=$user_ip', '', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=600');return false;\">" . $user->lang['WHOIS'] . '</a> ]'; ?></strong></td> |
| 628 | </tr>
|
| 629 | <?php
|
| 630 | |
| 631 | } |
| 632 | |
| 633 | ?>
|
| 634 | <tr>
|
| 635 | <td class="row1" width="40%"><?php echo $user->lang['LAST_ACTIVE']; ?>: </td> |
| 636 | <td class="row2"><strong><?php echo $user->format_date($user_lastvisit); ?></strong></td> |
| 637 | </tr>
|
| 638 | <tr>
|
| 639 | <td class="row1"><?php echo $user->lang['FOUNDER']; ?>: <br /><span class="gensmall"><?php echo $user->lang['FOUNDER_EXPLAIN']; ?></span></td> |
| 640 | <td class="row2"><input type="radio" name="user_founder" value="1"<?php echo $user_founder_yes; ?> /><?php echo $user->lang['YES']; ?> <input type="radio" name="user_founder" value="0"<?php echo $user_founder_no; ?> /><?php echo $user->lang['NO']; ?></td> |
| 641 | </tr>
|
| 642 | <tr>
|
| 643 | <td class="row1"><?php echo $user->lang['EMAIL']; ?>: </td> |
| 644 | <td class="row2"><input class="post" type="text" name="user_email" value="<?php echo $user_email; ?>" maxlength="60" /></td> |
| 645 | </tr>
|
| 646 | <tr>
|
| 647 | <td class="row1"><?php echo $user->lang['CONFIRM_EMAIL']; ?>: <br /><span class="gensmall"><?php echo $user->lang['CONFIRM_EMAIL_EXPLAIN']; ?></span></td> |
| 648 | <td class="row2"><input class="post" type="text" name="email_confirm" value="<?php echo $email_confirm; ?>" maxlength="60" /></td> |
| 649 | </tr>
|
| 650 | <tr>
|
| 651 | <td class="row1"><?php echo $user->lang['NEW_PASSWORD']; ?>: <br /><span class="gensmall"><?php echo sprintf($user->lang['CHANGE_PASSWORD_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']) ?></span></td> |
| 652 | <td class="row2"><input class="post" type="password" name="user_password" value="<?php echo ($submit) ? $user_password : ''; ?>" maxlength="60" /></td> |
| 653 | </tr>
|
| 654 | <tr>
|
| 655 | <td class="row1"><?php echo $user->lang['CONFIRM_PASSWORD']; ?>: <br /><span class="gensmall"><?php echo $user->lang['CONFIRM_PASSWORD_EXPLAIN']; ?></span></td> |
| 656 | <td class="row2"><input class="post" type="password" name="password_confirm" value="<?php echo ($submit) ? $user_password_confirm : ''; ?>" maxlength="60" /></td> |
| 657 | </tr>
|
| 658 | <?php
|
| 659 | |
| 660 | if ($user_type != USER_FOUNDER) |
| 661 | {
|
| 662 | |
| 663 | ?>
|
| 664 | <tr>
|
| 665 | <th colspan="2"><?php echo $user->lang['USER_TOOLS']; ?></td> |
| 666 | </tr>
|
| 667 | <tr>
|
| 668 | <td class="row1"><?php echo $user->lang['WARNINGS']; ?>: <br /><span class="gensmall"><?php echo $user->lang['WARNINGS_EXPLAIN']; ?></span></td> |
| 669 | <td class="row2"><input class="post" type="text" name="warnings" size="2" maxlength="2" value="<?php echo $user->data['user_warnings']; ?>" /></td> |
| 670 | </tr>
|
| 671 | <tr>
|
| 672 | <td class="row1"><?php echo $user->lang['QUICK_TOOLS']; ?>: </td> |
| 673 | <td class="row2"><select name="quicktools"><?php echo $options; ?></select></td> |
| 674 | </tr>
|
| 675 | <tr>
|
| 676 | <td class="row1"><?php echo $user->lang['DELETE_USER']; ?>: <br /><span class="gensmall"><?php echo $user->lang['DELETE_USER_EXPLAIN']; ?></span></td> |
| 677 | <td class="row2"><select name="deletetype"><option value="retain"><?php echo $user->lang['RETAIN_POSTS']; ?></option><option value="remove"><?php echo $user->lang['DELETE_POSTS']; ?></option></select> <input type="checkbox" name="delete" value="1" /> </td> |
| 678 | </tr>
|
| 679 | <?php
|
| 680 | |
| 681 | } |
| 682 | |
| 683 | ?>
|
| 684 | <tr>
|
| 685 | <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> |
| 686 | </tr>
|
| 687 | <?php
|
| 688 | |
| 689 | break;
|
| 690 | |
| 691 | case 'feedback': |
| 692 | |
| 693 | if ($submit) |
| 694 | {
|
| 695 | if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) |
| 696 | {
|
| 697 | $where_sql = ''; |
| 698 | if ($deletemark && $marked) |
| 699 | {
|
| 700 | $sql_in = array(); |
| 701 | foreach ($marked as $mark) |
| 702 | {
|
| 703 | $sql_in[] = $mark; |
| 704 | } |
| 705 | $where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')'; |
| 706 | unset($sql_in); |
| 707 | } |
| 708 | |
| 709 | $sql = 'DELETE FROM ' . LOG_TABLE . ' |
| 710 | WHERE log_type = ' . LOG_USERS . " |
| 711 | $where_sql"; |
| 712 | $db->sql_query($sql); |
| 713 | |
| 714 | add_log('admin', 'LOG_USERS_CLEAR'); |
| 715 | trigger_error(""); |
| 716 | } |
| 717 | |
| 718 | if ($message = request_var('message', '')) |
| 719 | {
|
| 720 | add_log('admin', 'LOG_USER_FEEDBACK', $username); |
| 721 | add_log('user', $user_id, 'LOG_USER_GENERAL', $message); |
| 722 | |
| 723 | trigger_error($user->lang['USER_FEEDBACK_ADDED']); |
| 724 | } |
| 725 | } |
| 726 | |
| 727 | $colspan = 2; |
| 728 | |
| 729 | $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']); |
| 730 | $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_IP'], 'd' => $user->lang['SORT_ACTION']); |
| 731 | $sort_by_sql = array('a' => 'l.user_id', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation'); |
| 732 | |
| 733 | $s_limit_days = $s_sort_key = $s_sort_dir = ''; |
| 734 | gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir); |
| 735 | |
| 736 | // Define where and sort sql for use in displaying logs
|
| 737 | $sql_where = ($st) ? (time() - ($st * 86400)) : 0; |
| 738 | $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); |
| 739 | |
| 740 | ?>
|
| 741 | <tr>
|
| 742 | <th colspan="2"><?php echo $user->lang['USER_ADMIN_FEEDBACK']; ?></th> |
| 743 | </tr>
|
| 744 | <tr>
|
| 745 | <td class="cat" colspan="2" align="center"><?php echo $user->lang['DISPLAY_LOG']; ?>: <?php echo $s_limit_days; ?> <?php echo $user->lang['SORT_BY']; ?>: <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></td> |
| 746 | </tr>
|
| 747 | <?php
|
| 748 | |
| 749 | $log_data = array(); |
| 750 | $log_count = 0; |
| 751 | view_log('user', $log_data, $log_count, $config['posts_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); |
| 752 | |
| 753 | if ($log_count) |
| 754 | {
|
| 755 | for($i = 0; $i < sizeof($log_data); $i++) |
| 756 | {
|
| 757 | $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; |
| 758 | |
| 759 | ?>
|
| 760 | <tr>
|
| 761 | <td class="<?php echo $row_class; ?>"><span class="gensmall">Report by: <b><?php echo $log_data[$i]['username']; ?></b> on <?php echo $user->format_date($log_data[$i]['time']); ?></span><hr /><?php echo $log_data[$i]['action']; ?></td> |
| 762 | <td class="<?php echo $row_class; ?>" width="5%" align="center"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td> |
| 763 | </tr>
|
| 764 | <?php
|
| 765 | |
| 766 | } |
| 767 | } |
| 768 | else |
| 769 | {
|
| 770 | |
| 771 | ?>
|
| 772 | <tr>
|
| 773 | <td class="row1" colspan="2" align="center">No reports exist for this user</td> |
| 774 | </tr>
|
| 775 | <?php
|
| 776 | |
| 777 | } |
| 778 | |
| 779 | |
| 780 | ?>
|
| 781 | <tr>
|
| 782 | <td class="cat" colspan="2" align="right"><?php |
| 783 | |
| 784 | if ($auth->acl_get('a_clearlogs')) |
| 785 | {
|
| 786 | |
| 787 | ?><input class="btnlite" type="submit" name="delmarked" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> <input class="btnlite" type="submit" name="delall" value="<?php echo $user->lang['DELETE_ALL']; ?>" /><?php |
| 788 | |
| 789 | } |
| 790 | |
| 791 | ?> </td> |
| 792 | </tr>
|
| 793 | </table></td> |
| 794 | </tr>
|
| 795 | <tr>
|
| 796 | <td class="nav"><div style="float:left;"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></div><div style="float:right;"><b><a href="javascript:marklist('admin', true);"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('admin', false);"><?php echo $user->lang['UNMARK_ALL']; ?></a></b> <br /><br /><?php |
| 797 | |
| 798 | echo generate_pagination("admin_users.$phpEx$SID&action=$action&u=$user_id&st=$st&sk=$sk&sd=$sd", $log_count, $config['posts_per_page'], $start); |
| 799 | |
| 800 | ?></div></td> |
| 801 | </tr>
|
| 802 | </table>
|
| 803 | |
| 804 | <script language="Javascript" type="text/javascript"> |
| 805 | <!--
|
| 806 | function marklist(match, status) |
| 807 | {
|
| 808 | len = eval('document.' + match + '.length');
|
| 809 | for (i = 0; i < len; i++) |
| 810 | {
|
| 811 | eval('document.' + match + '.elements[i].checked = ' + status);
|
| 812 | } |
| 813 | } |
| 814 | //--> |
| 815 | </script>
|
| 816 | |
| 817 | <h1><?php echo $user->lang['ADD_FEEDBACK']; ?></h1> |
| 818 | |
| 819 | <p><?php echo $user->lang['ADD_FEEDBACK_EXPLAIN']; ?></p> |
| 820 | |
| 821 | <table width="100%" cellspacing="2" cellpadding="0" border="0" align="center"> |
| 822 | <tr>
|
| 823 | <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"> |
| 824 | <tr>
|
| 825 | <th colspan="2"><?php echo $user->lang['USER_ADMIN_' . strtoupper($action)]; ?></th> |
| 826 | </tr>
|
| 827 | <tr>
|
| 828 | <td class="row1" colspan="2" align="center"><textarea name="message" rows="10" cols="76"></textarea></td> |
| 829 | </tr>
|
| 830 | <tr>
|
| 831 | <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> |
| 832 | </tr>
|
| 833 | <?php
|
| 834 | |
| 835 | |
| 836 | break;
|
| 837 | |
| 838 | |
| 839 | case 'profile': |
| 840 | |
| 841 | if ($submit) |
| 842 | {
|
| 843 | $var_ary = array( |
| 844 | 'icq' => (string) '', |
| 845 | 'aim' => (string) '', |
| 846 | 'msn' => (string) '', |
| 847 | 'yim' => (string) '', |
| 848 | 'jabber' => (string) '', |
| 849 | 'website' => (string) '', |
| 850 | 'location' => (string) '', |
| 851 | 'occupation' => (string) '', |
| 852 | 'interests' => (string) '', |
| 853 | 'bday_day' => 0, |
| 854 | 'bday_month' => 0, |
| 855 | 'bday_year' => 0, |
| 856 | ); |
| 857 | |
| 858 | foreach ($var_ary as $var => $default) |
| 859 | {
|
| 860 | $data[$var] = request_var($var, $default); |
| 861 | } |
| 862 | |
| 863 | $var_ary = array( |
| 864 | 'icq' => array( |
| 865 | array('string', true, 3, 15), |
| 866 | array('match', true, '#^[0-9]+$#i')), |
| 867 | 'aim' => array('string', true, 5, 255), |
| 868 | 'msn' => array('string', true, 5, 255), |
| 869 | 'jabber' => array( |
| 870 | array('string', true, 5, 255), |
| 871 | array('match', true, '#^[a-z0-9\.\-_\+]+?@(.*?\.)*?[a-z0-9\-_]+?\.[a-z]{2,4}(/.*)?$#i')), |
| 872 | 'yim' => array('string', true, 5, 255), |
| 873 | 'website' => array( |
| 874 | array('string', true, 12, 255), |
| 875 | array('match', true, '#^http[s]?://(.*?\.)*?[a-z0-9\-]+\.[a-z]{2,4}#i')), |
| 876 | 'location' => array('string', true, 2, 255), |
| 877 | 'occupation' => array('string', true, 2, 500), |
| 878 | 'interests' => array('string', true, 2, 500), |
| 879 | 'bday_day' => array('num', true, 1, 31), |
| 880 | 'bday_month' => array('num', true, 1, 12), |
| 881 | 'bday_year' => array('num', true, 1901, gmdate('Y', time())), |
| 882 | ); |
| 883 | |
| 884 | $error = validate_data($data, $var_ary); |
| 885 | extract($data); |
| 886 | unset($data); |
| 887 | |
| 888 | // validate custom profile fields
|
| 889 | // $cp->submit_cp_field('profile', $cp_data, $cp_error);
|
| 890 | |
| 891 | if (!sizeof($error) && !sizeof($cp_error)) |
| 892 | {
|
| 893 | $sql_ary = array( |
| 894 | 'user_icq' => $icq, |
| 895 | 'user_aim' => $aim, |
| 896 | 'user_msnm' => $msn, |
| 897 | 'user_yim' => $yim, |
| 898 | 'user_jabber' => $jabber, |
| 899 | 'user_website' => $website, |
| 900 | 'user_from' => $location, |
| 901 | 'user_occ' => $occupation, |
| 902 | 'user_interests'=> $interests, |
| 903 | 'user_birthday' => sprintf('%2d-%2d-%4d', $bday_day, $bday_month, $bday_year), |
| 904 | ); |
| 905 | |
| 906 | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 907 | SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " |
| 908 | WHERE user_id = $user_id"; |
| 909 | $db->sql_query($sql); |
| 910 | |
| 911 | /*
|
| 912 | // Update Custom Fields |
| 913 | if (sizeof($cp_data)) |
| 914 | {
|
| 915 | $sql = 'UPDATE ' . PROFILE_DATA_TABLE . ' |
| 916 | SET ' . $db->sql_build_array('UPDATE', $cp_data) . "
|
| 917 | WHERE user_id = $user_id"; |
| 918 | $db->sql_query($sql); |
| 919 | |
| 920 | if (!$db->sql_affectedrows()) |
| 921 | {
|
| 922 | $cp_data['user_id'] = $user_id; |
| 923 | |
| 924 | $db->return_on_error = true; |
| 925 | |
| 926 | $sql = 'INSERT INTO ' . PROFILE_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data);
|
| 927 | $db->sql_query(); |
| 928 | |
| 929 | $db->return_on_error = false; |
| 930 | } |
| 931 | } |
| 932 | */ |
| 933 | trigger_error($user->lang['USER_PROFILE_UPDATED']); |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | $colspan = 2; |
| 938 | |
| 939 | $cp = new custom_profile(); |
| 940 | |
| 941 | $cp_data = $cp_error = array(); |
| 942 | |
| 943 | if (!isset($bday_day)) |
| 944 | {
|
| 945 | list($bday_day, $bday_month, $bday_year) = explode('-', $user_birthday); |
| 946 | } |
| 947 | |
| 948 | $s_birthday_day_options = '<option value="0"' . ((!$bday_day) ? ' selected="selected"' : '') . '>--</option>'; |
| 949 | for ($i = 1; $i < 32; $i++) |
| 950 | {
|
| 951 | $selected = ($i == $bday_day) ? ' selected="selected"' : ''; |
| 952 | $s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>"; |
| 953 | } |
| 954 | |
| 955 | $s_birthday_month_options = '<option value="0"' . ((!$bday_month) ? ' selected="selected"' : '') . '>--</option>'; |
| 956 | for ($i = 1; $i < 13; $i++) |
| 957 | {
|
| 958 | $selected = ($i == $bday_month) ? ' selected="selected"' : ''; |
| 959 | $s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>"; |
| 960 | } |
| 961 | $s_birthday_year_options = ''; |
| 962 | |
| 963 | $now = getdate(); |
| 964 | $s_birthday_year_options = '<option value="0"' . ((!$bday_year) ? ' selected="selected"' : '') . '>--</option>'; |
| 965 | for ($i = $now['year'] - 100; $i < $now['year']; $i++) |
| 966 | {
|
| 967 | $selected = ($i == $bday_year) ? ' selected="selected"' : ''; |
| 968 | $s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>"; |
| 969 | } |
| 970 | unset($now); |
| 971 | |
| 972 | // Get additional profile fields and assign them to the template block var 'profile_fields'
|
| 973 | // $user->get_profile_fields($user->data['user_id']);
|
| 974 | // $cp->generate_profile_fields('profile', $user->get_iso_lang_id(), $cp_error);
|
| 975 | |
| 976 | |
| 977 | ?>
|
| 978 | <tr>
|
| 979 | <th colspan="2"><?php echo $user->lang['USER_ADMIN_SIG']; ?></th> |
| 980 | </tr>
|
| 981 | <tr>
|
| 982 | <td class="row1" width="40%"><b><?php echo $user->lang['UCP_ICQ']; ?>: </b></td> |
| 983 | <td class="row2"><input class="post" type="text" name="icq" size="30" maxlength="15" value="<?php echo $user_icq; ?>" /></td> |
| 984 | </tr>
|
| 985 | <tr>
|
| 986 | <td class="row1"><b><?php echo $user->lang['UCP_AIM']; ?>: </b></td> |
| 987 | <td class="row2"><input class="post" type="text" name="aim" size="30" maxlength="255" value="<?php echo $user_aim; ?>" /></td> |
| 988 | </tr>
|
| 989 | <tr>
|
| 990 | <td class="row1"><b><?php echo $user->lang['UCP_MSNM']; ?>: </b></td> |
| 991 | <td class="row2"><input class="post" type="text" name="msn" size="30" maxlength="255" value="<?php echo $user_msnm; ?>" /></td> |
| 992 | </tr>
|
| 993 | <tr>
|
| 994 | <td class="row1"><b><?php echo $user->lang['UCP_YIM']; ?>: </b></td> |
| 995 | <td class="row2"><input class="post" type="text" name="yim" size="30" maxlength="255" value="<?php echo $user_yim; ?>" /></td> |
| 996 | </tr>
|
| 997 | <tr>
|
| 998 | <td class="row1"><b><?php echo $user->lang['UCP_JABBER']; ?>: </b></td> |
| 999 | <td class="row2"><input class="post" type="text" name="jabber" size="30" maxlength="255" value="<?php echo $user_jabber; ?>" /></td> |
| 1000 | </tr>
|
| 1001 | <tr>
|
| 1002 | <td class="row1"><b><?php echo $user->lang['WEBSITE']; ?>: </b></td> |
| 1003 | <td class="row2"><input class="post" type="text" name="website" size="30" maxlength="255" value="<?php echo $user_website; ?>" /></td> |
| 1004 | </tr>
|
| 1005 | <tr>
|
| 1006 | <td class="row1"><b><?php echo $user->lang['LOCATION']; ?>: </b></td> |
| 1007 | <td class="row2"><input class="post" type="text" name="location" size="30" maxlength="100" value="<?php echo $user_location; ?>" /></td> |
| 1008 | </tr>
|
| 1009 | <tr>
|
| 1010 | <td class="row1"><b><?php echo $user->lang['OCCUPATION']; ?>: </b></td> |
| 1011 | <td class="row2"><textarea class="post" name="occ" rows="3" cols="30"><?php echo $user_occ; ?></textarea></td> |
| 1012 | </tr>
|
| 1013 | <tr>
|
| 1014 | <td class="row1"><b><?php echo $user->lang['INTERESTS']; ?>: </b></td> |
| 1015 | <td class="row2"><textarea class="post" name="interests" rows="3" cols="30"><?php echo $user_interests; ?></textarea></td> |
| 1016 | </tr>
|
| 1017 | <tr>
|
| 1018 | <td class="row1"><b><?php echo $user->lang['BIRTHDAY']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BIRTHDAY_EXPLAIN']; ?></span></td> |
| 1019 | <td class="row2"><span class="genmed"><?php echo $user->lang['DAY']; ?>:</span> <select name="bday_day"><?php echo $s_birthday_day_options; ?></select> <span class="genmed"><?php echo $user->lang['MONTH']; ?>:</span> <select name="bday_month"><?php echo $s_birthday_month_options; ?></select> <span class="genmed"><?php echo $user->lang['YEAR']; ?>:</span> <select name="bday_year"><?php echo $s_birthday_year_options; ?></select></td> |
| 1020 | </tr>
|
| 1021 | <tr>
|
| 1022 | <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> |
| 1023 | </tr>
|
| 1024 | <?php
|
| 1025 | |
| 1026 | break;
|
| 1027 | |
| 1028 | |
| 1029 | case 'prefs': |
| 1030 | |
| 1031 | if ($submit) |
| 1032 | {
|
| 1033 | $var_ary = array( |
| 1034 | 'user_dateformat' => (string) $config['default_dateformat'], |
| 1035 | 'user_lang' => (string) $config['default_lang'], |
| 1036 | 'user_tz' => (float) $config['board_timezone'], |
| 1037 | 'user_style' => (int) $config['default_style'], |
| 1038 | 'user_dst' => (bool) $config['board_dst'], |
| 1039 | 'user_allow_viewemail' => false, |
| 1040 | 'user_allow_massemail' => true, |
| 1041 | 'user_allow_viewonline' => true, |
| 1042 | 'user_notify_type' => 0, |
| 1043 | 'user_notify_pm' => true, |
| 1044 | 'user_allow_pm' => true, |
| 1045 | 'user_notify' => false, |
| 1046 | |
| 1047 | 'sk' => (string) 't', |
| 1048 | 'sd' => (string) 'd', |
| 1049 | 'st' => 0, |
| 1050 | |
| 1051 | 'popuppm' => false, |
| 1052 | 'viewimg' => true, |
| 1053 | 'viewflash' => false, |
| 1054 | 'viewsmilies' => true, |
| 1055 | 'viewsigs' => true, |
| 1056 | 'viewavatars' => true, |
| 1057 | 'viewcensors' => false, |
| 1058 | 'bbcode' => true, |
| 1059 | 'html' => false, |
| 1060 | 'smilies' => true, |
| 1061 | 'attachsig' => true, |
| 1062 | ); |
| 1063 | |
| 1064 | foreach ($var_ary as $var => $default) |
| 1065 | {
|
| 1066 | $data[$var] = request_var($var, $default); |
| 1067 | } |
| 1068 | |
| 1069 | $var_ary = array( |
| 1070 | 'user_dateformat' => array('string', false, 3, 15), |
| 1071 | 'user_lang' => array('match', false, '#^[a-z_]{2,}$#i'), |
| 1072 | 'user_tz' => array('num', false, -13, 13), |
| 1073 | |
| 1074 | 'sk' => array('string', false, 1, 1), |
| 1075 | 'sd' => array('string', false, 1, 1), |
| 1076 | ); |
| 1077 | |
| 1078 | $error = validate_data($data, $var_ary); |
| 1079 | extract($data); |
| 1080 | unset($data); |
| 1081 | |
| 1082 | // Set the popuppm option
|
| 1083 | $option_ary = array('popuppm', 'viewimg', 'viewflash', 'viewsmilies', 'viewsigs', 'viewavatars', 'viewcensors', 'bbcode', 'html', 'smilies', 'attachsig'); |
| 1084 | |
| 1085 | foreach ($option_ary as $option) |
| 1086 | {
|
| 1087 | $user_options = $user->optionset($option, $$option, $user_options); |
| 1088 | } |
| 1089 | |
| 1090 | if (!sizeof($error)) |
| 1091 | {
|
| 1092 | $sql_ary = array( |
| 1093 | 'user_allow_pm' => $user_allow_pm, |
| 1094 | 'user_allow_viewemail' => $user_allow_viewemail, |
| 1095 | 'user_allow_massemail' => $user_allow_massemail, |
| 1096 | 'user_allow_viewonline' => $user_allow_viewonline, |
| 1097 | 'user_notify_type' => $user_notify_type, |
| 1098 | 'user_notify_pm' => $user_notify_pm, |
| 1099 | 'user_options' => $user_options, |
| 1100 | 'user_notify' => $user_notify, |
| 1101 | 'user_dst' => $user_dst, |
| 1102 | 'user_dateformat' => $user_dateformat, |
| 1103 | 'user_lang' => $user_lang, |
| 1104 | 'user_timezone' => $user_tz, |
| 1105 | 'user_style' => $user_style, |
| 1106 | 'user_sortby_type' => $sk, |
| 1107 | 'user_sortby_dir' => $sd, |
| 1108 | 'user_show_days' => $st, |
| 1109 | ); |
| 1110 | |
| 1111 | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 1112 | SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " |
| 1113 | WHERE user_id = $user_id"; |
| 1114 | $db->sql_query($sql); |
| 1115 | |
| 1116 | trigger_error($user->lang['USER_PREFS_UPDATED']); |
| 1117 | } |
| 1118 | |
| 1119 | $user_sortby_type = $sk; |
| 1120 | $user_sortby_dir = $sd; |
| 1121 | $user_show_days = $st; |
| 1122 | } |
| 1123 | |
| 1124 | $colspan = 2; |
| 1125 | |
| 1126 | $option_ary = array('user_allow_viewemail', 'user_allow_massemail', 'user_allow_pm', 'user_allow_viewonline', 'user_notify_pm', 'user_dst', 'user_notify'); |
| 1127 | |
| 1128 | foreach ($option_ary as $option) |
| 1129 | {
|
| 1130 | ${$option . '_yes'} = ($$option) ? ' checked="checked"' : '';
|
| 1131 | ${$option . '_no'} = (!$$option) ? ' checked="checked"' : '';
|
| 1132 | } |
| 1133 | unset($option_ary); |
| 1134 | |
| 1135 | $option_ary = array('popuppm', 'viewimg', 'viewflash', 'viewsmilies', 'viewsigs', 'viewavatars', 'viewcensors', 'bbcode', 'html', 'smilies', 'attachsig'); |
| 1136 | |
| 1137 | foreach ($option_ary as $option) |
| 1138 | {
|
| 1139 | ${$option . '_yes'} = ($user->optionget($option, $user_options)) ? ' checked="checked"' : '';
|
| 1140 | ${$option . '_no'} = (!$user->optionget($option, $user_options)) ? ' checked="checked"' : '';
|
| 1141 | } |
| 1142 | |
| 1143 | $notify_email = ($user_notify_type == NOTIFY_EMAIL) ? ' checked="checked"' : ''; |
| 1144 | $notify_im = ($user_notify_type == NOTIFY_IM) ? ' checked="checked"' : ''; |
| 1145 | $notify_both = ($user_notify_type == NOTIFY_BOTH) ? ' checked="checked"' : ''; |
| 1146 | |
| 1147 | // Topic ordering display
|
| 1148 | $limit_days = array(0 => $user->lang['ALL_TOPICS'], 0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']); |
| 1149 | |
| 1150 | $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); |
| 1151 | $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'r' => 't.topic_replies', 's' => 't.topic_title', 'v' => 't.topic_views'); |
| 1152 | |
| 1153 | $s_limit_days = $s_sort_key = $s_sort_dir = ''; |
| 1154 | gen_sort_selects($limit_days, $sort_by_text, $user_show_days, $user_sortby_type, $user_sortby_dir, $s_limit_days, $s_sort_key, $s_sort_dir); |
| 1155 | |
| 1156 | ?>
|
| 1157 | <tr>
|
| 1158 | <th colspan="2"><?php echo $user->lang['USER_ADMIN_PREFS']; ?></th> |
| 1159 | </tr>
|
| 1160 | <tr>
|
| 1161 | <td class="row1" width="40%"><b><?php echo $user->lang['VIEW_IMAGES']; ?>:</b></td> |
| 1162 | <td class="row2"><input type="radio" name="viewimg" value="1"<?php echo $viewimg_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="viewimg" value="0"<?php echo $viewimg_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1163 | </tr>
|
| 1164 | <tr>
|
| 1165 | <td class="row1"><b><?php echo $user->lang['VIEW_FLASH']; ?>:</b></td> |
| 1166 | <td class="row2"><input type="radio" name="viewflash" value="1"<?php echo $viewflash_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="viewflash" value="0"<?php echo $viewflash_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1167 | </tr>
|
| 1168 | <tr>
|
| 1169 | <td class="row1"><b><?php echo $user->lang['VIEW_SMILIES']; ?>:</b></td> |
| 1170 | <td class="row2"><input type="radio" name="viewsmilies" value="1"<?php echo $viewsmilies_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="viewsmilies" value="0"<?php echo $viewsmilies_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1171 | </tr>
|
| 1172 | <tr>
|
| 1173 | <td class="row1"><b><?php echo $user->lang['VIEW_SIGS']; ?>:</b></td> |
| 1174 | <td class="row2"><input type="radio" name="viewsigs" value="1"<?php echo $viewsigs_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="viewsigs" value="0"<?php echo $viewsigs_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1175 | </tr>
|
| 1176 | <tr>
|
| 1177 | <td class="row1"><b><?php echo $user->lang['VIEW_AVATARS']; ?>:</b></td> |
| 1178 | <td class="row2"><input type="radio" name="viewavatars" value="1"<?php echo $viewavatars_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="viewavatars" value="0"<?php echo $viewavatars_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1179 | </tr>
|
| 1180 | <tr>
|
| 1181 | <td class="row1"><b><?php echo $user->lang['DISABLE_CENSORS']; ?>:</b></td> |
| 1182 | <td class="row2"><input type="radio" name="viewcensors" value="1"<?php echo $viewcensors_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="viewcensors" value="0"<?php echo $viewcensors_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1183 | </tr>
|
| 1184 | <!-- tr> |
| 1185 | <td class="row1"><b><?php echo $user->lang['MINIMUM_KARMA']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['MINIMUM_KARMA_EXPLAIN']; ?></span></td> |
| 1186 | <td class="row2"><select name="user_min_karma">{S_MIN_KARMA_OPTIONS}</select></td> |
| 1187 | </tr-->
|
| 1188 | <tr>
|
| 1189 | <td class="row1"><b><?php echo $user->lang['VIEW_TOPICS_DAYS']; ?>:</b></td> |
| 1190 | <td class="row2"><?php echo $s_limit_days; ?></td> |
| 1191 | </tr>
|
| 1192 | <tr>
|
| 1193 | <td class="row1"><b><?php echo $user->lang['VIEW_TOPICS_KEY']; ?>:</b></td> |
| 1194 | <td class="row2"><?php echo $s_sort_key; ?></td> |
| 1195 | </tr>
|
| 1196 | <tr>
|
| 1197 | <td class="row1"><b><?php echo $user->lang['VIEW_TOPICS_DIR']; ?>:</b></td> |
| 1198 | <td class="row2"><?php echo $s_sort_dir; ?></td> |
| 1199 | </tr>
|
| 1200 | <tr>
|
| 1201 | <th colspan="2"><?php echo $user->lang['USER_POSTING_PREFS']; ?></th> |
| 1202 | </tr>
|
| 1203 | <tr>
|
| 1204 | <td class="row1"><b><?php echo $user->lang['DEFAULT_BBCODE']; ?>:</b></td> |
| 1205 | <td class="row2"><input type="radio" name="bbcode" value="1"<?php echo $bbcode_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="bbcode" value="0"<?php echo $bbcode_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1206 | </tr>
|
| 1207 | <tr>
|
| 1208 | <td class="row1"><b><?php echo $user->lang['DEFAULT_HTML']; ?>:</b></td> |
| 1209 | <td class="row2"><input type="radio" name="html" value="1"<?php echo $html_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="html" value="0"<?php echo $html_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1210 | </tr>
|
| 1211 | <tr>
|
| 1212 | <td class="row1"><b><?php echo $user->lang['DEFAULT_SMILIES']; ?>:</b></td> |
| 1213 | <td class="row2"><input type="radio" name="smilies" value="1"<?php echo $smilies_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="smilies" value="0"<?php echo $smilies_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1214 | </tr>
|
| 1215 | <tr>
|
| 1216 | <td class="row1"><b><?php echo $user->lang['DEFAULT_ADD_SIG']; ?>:</b></td> |
| 1217 | <td class="row2"><input type="radio" name="attachsig" value="1"<?php echo $attachsig_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="attachsig" value="0"<?php echo $attachsig_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1218 | </tr>
|
| 1219 | <tr>
|
| 1220 | <td class="row1"><b><?php echo $user->lang['DEFAULT_NOTIFY']; ?>:</b></td> |
| 1221 | <td class="row2"><input type="radio" name="user_notify" value="1"<?php echo $user_notify_yes; ?> /><span class="gen"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="user_notify" value="0"<?php echo $user_notify_no; ?> /><span class="gen"><?php echo $user->lang['NO']; ?></span></td> |
| 1222 | </tr>
|
| 1223 | <tr>
|
| 1224 | <th colspan="2"></th> |
| 1225 | </tr>
|
| 1226 | <tr>
|
| 1227 | <td class="row1"><b><?php echo $user->lang['SHOW_EMAIL']; ?>:</b></td> |
| 1228 | <td class="row2"><input type="radio" name="user_allow_viewemail" value="1"<?php echo $user_allow_viewemail_yes; ?> /><span class="genmed"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="user_allow_viewemail" value="0"<?php echo $user_allow_viewemail_no; ?> /><span class="genmed"><?php echo $user->lang['NO']; ?></span></td> |
| 1229 | </tr>
|
| 1230 | <tr>
|
| 1231 | <td class="row1"><b><?php echo $user->lang['ADMIN_EMAIL']; ?>:</b></td> |
| 1232 | <td class="row2"><input type="radio" name="user_allow_massemail" value="1"<?php echo $user_allow_massemail_yes; ?> /><span class="genmed"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="user_allow_massemail" value="0"<?php echo $user_allow_massemail_no; ?> /><span class="genmed"><?php echo $user->lang['NO']; ?></span></td> |
| 1233 | </tr>
|
| 1234 | <tr>
|
| 1235 | <td class="row1"><b><?php echo $user->lang['ALLOW_PM']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['ALLOW_PM_EXPLAIN']; ?></span></td> |
| 1236 | <td class="row2"><input type="radio" name="user_allow_pm" value="1"<?php echo $user_allow_pm_yes; ?> /><span class="genmed"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="user_allow_pm" value="0"<?php echo $user_allow_pm_no; ?> /><span class="genmed"><?php echo $user->lang['NO']; ?></span></td> |
| 1237 | </tr>
|
| 1238 | <tr>
|
| 1239 | <td class="row1"><b><?php echo $user->lang['HIDE_ONLINE']; ?>:</b></td> |
| 1240 | <td class="row2"><input type="radio" name="user_allow_viewonline" value="0"<?php echo $user_allow_viewonline_no; ?> /><span class="genmed"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="user_allow_viewonline" value="1"<?php echo $user_allow_viewonline_yes; ?> /><span class="genmed"><?php echo $user->lang['NO']; ?></span></td> |
| 1241 | </tr>
|
| 1242 | <tr>
|
| 1243 | <td class="row1"><b><?php echo $user->lang['NOTIFY_METHOD']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['NOTIFY_METHOD_EXPLAIN']; ?></span></td> |
| 1244 | <td class="row2"><input type="radio" name="user_notify_type" value="0"<?php echo $notify_email; ?> /><span class="genmed"><?php echo $user->lang['NOTIFY_METHOD_EMAIL']; ?></span> <input type="radio" name="user_notify_type" value="1"<?php echo $notify_im; ?> /><span class="genmed"><?php echo $user->lang['NOTIFY_METHOD_IM']; ?></span> <input type="radio" name="user_notify_type" value="2"<?php echo $notify_both; ?> /><span class="genmed"><?php echo $user->lang['NOTIFY_METHOD_BOTH']; ?></span></td> |
| 1245 | </tr>
|
| 1246 | <tr>
|
| 1247 | <td class="row1"><b><?php echo $user->lang['NOTIFY_ON_PM']; ?>:</b></td> |
| 1248 | <td class="row2"><input type="radio" name="user_notify_pm" value="1"<?php echo $user_notify_pm_yes; ?> /><span class="genmed"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="user_notify_pm" value="0"<?php echo $user_notify_pm_no; ?> /><span class="genmed"><?php echo $user->lang['NO']; ?></span></td> |
| 1249 | </tr>
|
| 1250 | <tr>
|
| 1251 | <td class="row1"><b><?php echo $user->lang['POPUP_ON_PM']; ?>:</b></td> |
| 1252 | <td class="row2"><input type="radio" name="popuppm" value="1"<?php echo $popuppm_yes; ?> /><span class="genmed"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="popuppm" value="0"<?php echo $popuppm_no; ?> /><span class="genmed"><?php echo $user->lang['NO']; ?></span></td> |
| 1253 | </tr>
|
| 1254 | <tr>
|
| 1255 | <td class="row1"><b><?php echo $user->lang['BOARD_LANGUAGE']; ?>:</b></td> |
| 1256 | <td class="row2"><select name="user_lang"><?php echo language_select($user_lang); ?></select></td> |
| 1257 | </tr>
|
| 1258 | <tr>
|
| 1259 | <td class="row1"><b><?php echo $user->lang['BOARD_STYLE']; ?>:</b></td> |
| 1260 | <td class="row2"><select name="user_style"><?php echo style_select($user_style); ?></select></td> |
| 1261 | </tr>
|
| 1262 | <tr>
|
| 1263 | <td class="row1"><b><?php echo $user->lang['BOARD_TIMEZONE']; ?>:</b></td> |
| 1264 | <td class="row2"><select name="user_tz"><?php echo tz_select($user_timezone); ?></select></td> |
| 1265 | </tr>
|
| 1266 | <tr>
|
| 1267 | <td class="row1"><b><?php echo $user->lang['BOARD_DST']; ?>:</b></td> |
| 1268 | <td class="row2"><input type="radio" name="user_dst" value="1"<?php echo $user_dst_yes; ?> /><span class="genmed"><?php echo $user->lang['YES']; ?></span> <input type="radio" name="user_dst" value="0"<?php echo $user_dst_no; ?> /><span class="genmed"><?php echo $user->lang['NO']; ?></span></td> |
| 1269 | </tr>
|
| 1270 | <tr>
|
| 1271 | <td class="row1"><b><?php echo $user->lang['BOARD_DATE_FORMAT']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['BOARD_DATE_FORMAT_EXPLAIN']; ?></span></td> |
| 1272 | <td class="row2"><input type="text" name="user_dateformat" value="<?php echo $user_dateformat; ?>" maxlength="14" class="post" /></td> |
| 1273 | </tr>
|
| 1274 | <tr>
|
| 1275 | <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> |
| 1276 | </tr>
|
| 1277 | <?php
|
| 1278 | |
| 1279 | break;
|
| 1280 | |
| 1281 | case 'avatar': |
| 1282 | |
| 1283 | $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; |
| 1284 | |
| 1285 | if ($submit) |
| 1286 | {
|
| 1287 | $var_ary = array( |
| 1288 | 'uploadurl' => (string) '', |
| 1289 | 'remotelink' => (string) '', |
| 1290 | 'width' => (string) '', |
| 1291 | 'height' => (string) '', |
| 1292 | ); |
| 1293 | |
| 1294 | foreach ($var_ary as $var => $default) |
| 1295 | {
|
| 1296 | $data[$var] = request_var($var, $default); |
| 1297 | } |
| 1298 | |
| 1299 | $var_ary = array( |
| 1300 | 'uploadurl' => array('string', true, 5, 255), |
| 1301 | 'remotelink' => array('string', true, 5, 255), |
| 1302 | 'width' => array('string', true, 1, 3), |
| 1303 | 'height' => array('string', true, 1, 3), |
| 1304 | ); |
| 1305 | |
| 1306 | $error = validate_data($data, $var_ary); |
| 1307 | |
| 1308 | if (!sizeof($error)) |
| 1309 | {
|
| 1310 | $data['user_id'] = $user_id; |
| 1311 | |
| 1312 | if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) |
| 1313 | {
|
| 1314 | list($type, $filename, $width, $height) = avatar_upload($data, $error); |
| 1315 | } |
| 1316 | else if ($data['remotelink']) |
| 1317 | {
|
| 1318 | list($type, $filename, $width, $height) = avatar_remote($data, $error); |
| 1319 | } |
| 1320 | else if ($delete) |
| 1321 | {
|
| 1322 | $type = $filename = $width = $height = ''; |
| 1323 | } |
| 1324 | } |
| 1325 | |
| 1326 | if (!sizeof($error)) |
| 1327 | {
|
| 1328 | // Do we actually have any data to update?
|
| 1329 | if (sizeof($data)) |
| 1330 | {
|
| 1331 | $sql_ary = array( |
| 1332 | 'user_avatar' => $filename, |
| 1333 | 'user_avatar_type' => $type, |
| 1334 | 'user_avatar_width' => $width, |
| 1335 | 'user_avatar_height' => $height, |
| 1336 | ); |
| 1337 | |
| 1338 | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 1339 | SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " |
| 1340 | WHERE user_id = $user_id"; |
| 1341 | $db->sql_query($sql); |
| 1342 | |
| 1343 | // Delete old avatar if present
|
| 1344 | if ($user_avatar && $filename != $user_avatar) |
| 1345 | {
|
| 1346 | avatar_delete($user_avatar);
|
| 1347 | } |
| 1348 | } |
| 1349 | |
| 1350 | trigger_error($message); |
| 1351 | } |
| 1352 | |
| 1353 | extract($data); |
| 1354 | unset($data); |
| 1355 | } |
| 1356 | |
| 1357 | $colspan = 2; |
| 1358 | |
| 1359 | $display_gallery = (isset($_POST['displaygallery'])) ? true : false; |
| 1360 | $avatar_category = request_var('category', ''); |
| 1361 | |
| 1362 | // Generate users avatar
|
| 1363 | $avatar_img = ''; |
| 1364 | if ($user_avatar) |
| 1365 | {
|
| 1366 | switch ($user_avatar_type) |
| 1367 | {
|
| 1368 | case AVATAR_UPLOAD: |
| 1369 | $avatar_img = $phpbb_root_path . $config['avatar_path'] . '/'; |
| 1370 | break;
|
| 1371 | case AVATAR_GALLERY: |
| 1372 | $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/'; |
| 1373 | break;
|
| 1374 | } |
| 1375 | $avatar_img .= $user_avatar; |
| 1376 | |
| 1377 | $avatar_img = '<img src="' . $avatar_img . '" width="' . $user_avatar_width . '" height="' . $user_avatar_height . '" border="0" alt="" />'; |
| 1378 | } |
| 1379 | else
|
| 1380 | {
|
| 1381 | $avatar_img = '<img src="images/no_avatar.gif" alt="" />'; |
| 1382 | } |
| 1383 | |
| 1384 | ?>
|
| 1385 | <tr>
|
| 1386 | <th colspan="<?php echo $colspan; ?>"><?php echo $user->lang['USER_ADMIN_AVATAR']; ?></th> |
| 1387 | </tr>
|
| 1388 | <tr>
|
| 1389 | <td class="row2" width="35%"><b><?php echo $user->lang['CURRENT_IMAGE']; ?>: </b><br /><span class="gensmall"><?php echo sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)); ?></span></td> |
| 1390 | <td class="row1" align="center"><br /><?php echo $avatar_img; ?><br /><br /><input type="checkbox" name="delete" /> <span class="gensmall"><?php echo $user->lang['DELETE_AVATAR']; ?></span></td> |
| 1391 | </tr>
|
| 1392 | <?php
|
| 1393 | |
| 1394 | // Can we upload?
|
| 1395 | if ($can_upload) |
| 1396 | {
|
| 1397 | |
| 1398 | ?>
|
| 1399 | <tr>
|
| 1400 | <td class="row2" width="35%"><b><?php echo $user->lang['UPLOAD_AVATAR_FILE']; ?>: </b></td> |
| 1401 | <td class="row1"><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $config['avatar_max_filesize']; ?>" /><input class="post" type="file" name="uploadfile" /></td> |
| 1402 | </tr>
|
| 1403 | <tr>
|
| 1404 | <td class="row2" width="35%"><b><?php echo $user->lang['UPLOAD_AVATAR_URL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['UPLOAD_AVATAR_URL_EXPLAIN']; ?></span></td> |
| 1405 | <td class="row1"><input class="post" type="text" name="uploadurl" size="40" value="<?php echo $avatar_url; ?>" /></td> |
| 1406 | </tr>
|
| 1407 | <?php
|
| 1408 | |
| 1409 | } |
| 1410 | |
| 1411 | ?>
|
| 1412 | <tr>
|
| 1413 | <td class="row2" width="35%"><b><?php echo $user->lang['LINK_REMOTE_AVATAR']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['LINK_REMOTE_AVATAR_EXPLAIN']; ?></span></td> |
| 1414 | <td class="row1"><input class="post" type="text" name="remotelink" size="40" value="<?php echo $avatar_url; ?>" /></td> |
| 1415 | </tr>
|
| 1416 | <tr>
|
| 1417 | <td class="row2" width="35%"><b><?php echo $user->lang['LINK_REMOTE_SIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['LINK_REMOTE_SIZE_EXPLAIN']; ?></span></td> |
| 1418 | <td class="row1"><input class="post" type="text" name="width" size="3" value="<?php echo $user_avatar_width; ?>" /> <span class="gen">px X </span> <input class="post" type="text" name="height" size="3" value="<?php echo $user_avatar_height; ?>" /> <span class="gen">px</span></td> |
| 1419 | </tr>
|
| 1420 | <?php
|
| 1421 | |
| 1422 | // Do we have a gallery?
|
| 1423 | if ($config['null'] && !$display_gallery) |
| 1424 | {
|
| 1425 | |
| 1426 | ?>
|
| 1427 | <tr>
|
| 1428 | <td class="row2" width="35%"><b><?php echo $user->lang['AVATAR_GALLERY']; ?>: </b></td> |
| 1429 | <td class="row1"><input class="btnlite" type="submit" name="displaygallery" value="<?php echo $user->lang['DISPLAY_GALLERY']; ?>" /></td> |
| 1430 | </tr>
|
| 1431 | <?php
|
| 1432 | } |
| 1433 | |
| 1434 | // Do we want to display it? |
| 1435 | if ($config['null'] && $display_gallery) |
| 1436 | {
|
| 1437 | |
| 1438 | ?>
|
| 1439 | <tr>
|
| 1440 | <th colspan="2"><?php echo $user->lang['AVATAR_GALLERY']; ?></th> |
| 1441 | </tr>
|
| 1442 | <tr>
|
| 1443 | <td class="cat" colspan="2" align="center" valign="middle"><span class="genmed"><?php echo $user->lang['AVATAR_CATEGORY']; ?>: </span><select name="avatarcat">{S_CAT_OPTIONS}</select> <span class="genmed"><?php echo $user->lang['AVATAR_PAGE']; ?>: </span><select name="avatarpage">{S_PAGE_OPTIONS}</select> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" name="avatargallery" /></td> |
| 1444 | </tr>
|
| 1445 | <tr>
|
| 1446 | <td class="row1" colspan="2" align="center"><table cellspacing="1" cellpadding="4" border="0"> |
| 1447 | |
| 1448 | <!-- BEGIN avatar_row -->
|
| 1449 | <tr>
|
| 1450 | <!-- BEGIN avatar_column -->
|
| 1451 | <td class="row1" align="center"><img src="{avatar_row.avatar_column.AVATAR_IMAGE}" alt="{avatar_row.avatar_column.AVATAR_NAME}" title="{avatar_row.avatar_column.AVATAR_NAME}" /></td> |
| 1452 | <!-- END avatar_column -->
|
| 1453 | </tr>
|
| 1454 | <tr>
|
| 1455 | <!-- BEGIN avatar_option_column -->
|
| 1456 | <td class="row2" align="center"><input type="radio" name="avatarselect" value="{avatar_row.avatar_option_column.S_OPTIONS_AVATAR}" /></td> |
| 1457 | <!-- END avatar_option_column -->
|
| 1458 | </tr>
|
| 1459 | <!-- END avatar_row -->
|
| 1460 | |
| 1461 | </table></td> |
| 1462 | </tr>
|
| 1463 | <?php
|
| 1464 | |
| 1465 | } |
| 1466 | |
| 1467 | ?>
|
| 1468 | <tr>
|
| 1469 | <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> |
| 1470 | </tr>
|
| 1471 | <?php
|
| 1472 | |
| 1473 | break;
|
| 1474 | |
| 1475 | |
| 1476 | case 'sig': |
| 1477 | |
| 1478 | if ($submit || $preview) |
| 1479 | {
|
| 1480 | $var_ary = array( |
| 1481 | 'enable_html' => (bool) $config['allow_html'], |
| 1482 | 'enable_bbcode' => (bool) $config['allow_bbcode'], |
| 1483 | 'enable_smilies' => (bool) $config['allow_smilies'], |
| 1484 | 'enable_urls' => true, |
| 1485 | 'signature' => (string) $user_sig, |
| 1486 | |
| 1487 | ); |
| 1488 | |
| 1489 | foreach ($var_ary as $var => $default) |
| 1490 | {
|
| 1491 | $$var = request_var($var, $default); |
| 1492 | } |
| 1493 | |
| 1494 | // NOTE: allow_img and allow_flash do not exist in config table
|
| 1495 | $img_status = ($config['allow_img']) ? true : false; |
| 1496 | $flash_status = ($config['allow_flash']) ? true : false; |
| 1497 | |
| 1498 | include($phpbb_root_path . 'includes/message_parser.'.$phpEx); |
| 1499 | $message_parser = new parse_message($signature); |
| 1500 | |
| 1501 | // Allowing Quote BBCode
|
| 1502 | $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status, true); |
| 1503 | |
| 1504 | if ($submit) |
| 1505 | {
|
| 1506 | $sql_ary = array( |
| 1507 | 'user_sig' => (string) $message_parser->message, |
| 1508 | 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, |
| 1509 | 'user_sig_bbcode_bitfield' => (int) $message_parser->bbcode_bitfield |
| 1510 | ); |
| 1511 | |
| 1512 | $sql = 'UPDATE ' . USERS_TABLE . ' |
| 1513 | SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " |
| 1514 | WHERE user_id = $user_id"; |
| 1515 | $db->sql_query($sql); |
| 1516 | |
| 1517 | unset($message_parser); |
| 1518 | trigger_error($user->lang['PROFILE_UPDATED']); |
| 1519 | } |
| 1520 | } |
| 1521 | |
| 1522 | $colspan = 2; |
| 1523 | |
| 1524 | include($phpbb_root_path . 'includes/functions_posting.'.$phpEx); |
| 1525 | |
| 1526 | $signature_preview = ''; |
| 1527 | if ($preview) |
| 1528 | {
|
| 1529 | // Now parse it for displaying
|
| 1530 | $signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false); |
| 1531 | unset($message_parser); |
| 1532 | } |
| 1533 | |
| 1534 | decode_message($user_sig, $user_sig_bbcode_uid); |
| 1535 | |
| 1536 | ?>
|
| 1537 | <tr>
|
| 1538 | <th colspan="<?php echo $colspan; ?>"><?php echo $user->lang['USER_ADMIN_SIG']; ?></th> |
| 1539 | </tr>
|
| 1540 | <tr>
|
| 1541 | <td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['SIGNATURE']; ?>: </b></td> |
| 1542 | <td class="row2"><table cellspacing="0" cellpadding="2" border="0"> |
| 1543 | <tr align="center" valign="middle"> |
| 1544 | <td><input class="btnlite" type="button" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onclick="bbstyle(0)" onmouseover="helpline('b')" /></td> |
| 1545 | <td><input class="btnlite" type="button" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onclick="bbstyle(2)" onmouseover="helpline('i')" /></td> |
| 1546 | <td><input class="btnlite" type="button" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onclick="bbstyle(4)" onmouseover="helpline('u')" /></td> |
| 1547 | <td><input class="btnlite" type="button" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onclick="bbstyle(6)" onmouseover="helpline('q')" /></td> |
| 1548 | <td><input class="btnlite" type="button" accesskey="c" name="addbbcode8" value="Code" style="width: 40px" onclick="bbstyle(8)" onmouseover="helpline('c')" /></td> |
| 1549 | <td><input class="btnlite" type="button" accesskey="l" name="addbbcode10" value="List" style="width: 40px" onclick="bbstyle(10)" onmouseover="helpline('l')" /></td> |
| 1550 | <td><input class="btnlite" type="button" accesskey="o" name="addbbcode12" value="List=" style="width: 40px" onclick="bbstyle(12)" onmouseover="helpline('o')" /></td> |
| 1551 | <td><input class="btnlite" type="button" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" onmouseover="helpline('p')" /></td> |
| 1552 | <td><input class="btnlite" type="button" accesskey="w" name="addbbcode18" value="URL" style="text-decoration: underline; width: 40px" onclick="bbstyle(18)" onmouseover="helpline('w')" /></td> |
| 1553 | </tr>
|
| 1554 | <tr>
|
| 1555 | <td colspan="9"><table width="100%" cellspacing="0" cellpadding="0" border="0"> |
| 1556 | <tr>
|
| 1557 | <td><span class="genmed"> <?php echo $user->lang['FONT_SIZE']; ?>:</span> <select name="addbbcode20" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]');this.form.addbbcode20.selectedIndex = 2;" onmouseover="helpline('f')"> |
| 1558 | <option value="7"><?php echo $user->lang['FONT_TINY']; ?></option> |
| 1559 | <option value="9"><?php echo $user->lang['FONT_SMALL']; ?></option> |
| 1560 | <option value="12" selected="selected"><?php echo $user->lang['FONT_NORMAL']; ?></option> |
| 1561 | <option value="18"><?php echo $user->lang['FONT_LARGE']; ?></option> |
| 1562 | <option value="24"><?php echo $user->lang['FONT_HUGE']; ?></option> |
| 1563 | </select></td> |
| 1564 | <td class="gensmall" nowrap="nowrap" align="right"><a href="javascript:bbstyle(-1)" onmouseover="helpline('a')"><?php echo $user->lang['CLOSE_TAGS']; ?></a></td> |
| 1565 | </tr>
|
| 1566 | </table></td> |
| 1567 | </tr>
|
| 1568 | <tr>
|
| 1569 | <td colspan="9"><input class="helpline" type="text" name="helpbox" size="45" maxlength="100" value="<?php echo $user->lang['STYLES_TIP']; ?>" /></td> |
| 1570 | </tr>
|
| 1571 | <tr>
|
| 1572 | <td colspan="9"><textarea name="signature" rows="6" cols="60" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);"><?php echo $user_sig; ?></textarea></td> |
| 1573 | </tr>
|
| 1574 | <tr>
|
| 1575 | <td colspan="9"><table cellspacing="0" cellpadding="0" border="0"> |
| 1576 | <tr>
|
| 1577 | <td bgcolor="black"><script language="javascript" type="text/javascript"><!-- |
| 1578 | |
| 1579 | colorPalette('h', 14, 5)
|
| 1580 | |
| 1581 | //--></script></td> |
| 1582 | </tr>
|
| 1583 | </table></td> |
| 1584 | </tr>
|
| 1585 | </table></td> |
| 1586 | </tr>
|
| 1587 | <tr>
|
| 1588 | <td class="row1" valign="top"><b class="genmed"><?php echo $user->lang['OPTIONS']; ?></b><br /><table cellspacing="2" cellpadding="0" border="0"> |
| 1589 | <tr>
|
| 1590 | <td class="gensmall"><?php echo ($config['allow_html']) ? $user->lang['HTML_IS_ON'] : $user->lang['HTML_IS_OFF']; ?></td> |
| 1591 | </tr>
|
| 1592 | <tr>
|
| 1593 | <td class="gensmall"><?php echo ($config['allow_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], "<a href=\"../faq.$phpEx$SID&mode=bbcode\" target=\"_blank\">", '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], "<a href=\"../faq.$phpEx$SID&mode=bbcode\" target=\"_blank\">", '</a>'); ?></td> |
| 1594 | </tr>
|
| 1595 | <tr>
|
| 1596 | <td class="gensmall"><?php echo ($config['allow_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF']; ?></td> |
| 1597 | </tr>
|
| 1598 | <tr>
|
| 1599 | <td class="gensmall"><?php echo ($config['allow_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF']; ?></td> |
| 1600 | </tr>
|
| 1601 | <tr>
|
| 1602 | <td class="gensmall"><?php echo ($config['allow_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF']; ?></td> |
| 1603 | </tr>
|
| 1604 | </table></td> |
| 1605 | <td class="row2" valign="top"><table cellspacing="0" cellpadding="1" border="0"> |
| 1606 | <?php
|
| 1607 | |
| 1608 | if ($config['allow_html']) |
| 1609 | {
|
| 1610 | |
| 1611 | ?>
|
| 1612 | <tr>
|
| 1613 | <td><input type="checkbox" name="disable_html" /></td> |
| 1614 | <td class="gen"><?php echo $user->lang['DISABLE_HTML']; ?></td> |
| 1615 | </tr>
|
| 1616 | <?php
|
| 1617 | |
| 1618 | } |
| 1619 | |
| 1620 | if ($config['allow_bbcode']) |
| 1621 | {
|
| 1622 | |
| 1623 | ?>
|
| 1624 | <tr>
|
| 1625 | <td><input type="checkbox" name="disable_bbcode" /></td> |
| 1626 | <td class="gen"><?php echo $user->lang['DISABLE_BBCODE']; ?></td> |
| 1627 | </tr>
|
| 1628 | <?php
|
| 1629 | |
| 1630 | } |
| 1631 | |
| 1632 | if ($config['allow_smilies']) |
| 1633 | {
|
| 1634 | |
| 1635 | ?>
|
| 1636 | <tr>
|
| 1637 | <td><input type="checkbox" name="disable_smilies" /></td> |
| 1638 | <td class="gen"><?php echo $user->lang['DISABLE_SMILIES']; ?></td> |
| 1639 | </tr>
|
| 1640 | <?php
|
| 1641 | |
| 1642 | } |
| 1643 | |
| 1644 | ?>
|
| 1645 | <tr>
|
| 1646 | <td><input type="checkbox" name="disable_magic_url" /></td> |
| 1647 | <td class="gen"><?php echo $user->lang['DISABLE_MAGIC_URL']; ?></td> |
| 1648 | </tr>
|
| 1649 | </table></td> |
| 1650 | </tr>
|
| 1651 | <tr>
|
| 1652 | <td class="cat" colspan="2" align="center"><input class="btnlite" type="submit" name="preview" value="<?php echo $user->lang['PREVIEW']; ?>" /> <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> |
| 1653 | </tr>
|
| 1654 | <?php
|
| 1655 | |
| 1656 | if ($signature_preview) |
| 1657 | {
|
| 1658 | |
| 1659 | ?>
|
| 1660 | <tr>
|
| 1661 | <th colspan="2" valign="middle"><?php echo $user->lang['ADMIN_SIGNATURE_PREVIEW']; ?></th> |
| 1662 | </tr>
|
| 1663 | <tr>
|
| 1664 | <td class="row1" colspan="2"><div class="postdetails" style="padding: 6px;"><?php echo $signature_preview; ?></div></td> |
| 1665 | </tr>
|
| 1666 | <?php
|
| 1667 | |
| 1668 | } |
| 1669 | |
| 1670 | ?>
|
| 1671 | <?php
|
| 1672 | |
| 1673 | break;
|
| 1674 | |
| 1675 | case 'groups': |
| 1676 | |
| 1677 | switch ($action) |
| 1678 | {
|
| 1679 | case 'demote': |
| 1680 | case 'promote': |
| 1681 | case 'default': |
| 1682 | group_user_attributes($action, $gid, $user_id); |
| 1683 | |
| 1684 | if ($action == 'default') |
| 1685 | {
|
| 1686 | $group_id = $gid; |
| 1687 | } |
| 1688 | break;
|
| 1689 | |
| 1690 | case 'delete': |
| 1691 | if (!$cancel && !$confirm) |
| 1692 | {
|
| 1693 | adm_page_confirm($user->lang['CONFIRM'], $user->lang['CONFIRM_OPERATION']); |
| 1694 | } |
| 1695 | else if (!$cancel) |
| 1696 | {
|
| 1697 | if (!$gid) |
| 1698 | {
|
| 1699 | trigger_error($user->lang['NO_GROUP']); |
| 1700 | } |
| 1701 | |
| 1702 | if ($error = group_user_del($gid, $user_id)) |
| 1703 | {
|
| 1704 | trigger_error($user->lang[$error]); |
| 1705 | } |
| 1706 | } |
| 1707 | break;
|
| 1708 | } |
| 1709 | |
| 1710 | // Add user to group?
|
| 1711 | if ($submit) |
| 1712 | {
|
| 1713 | if (!$gid) |
| 1714 | {
|
| 1715 | trigger_error($user->lang['NO_GROUP']); |
| 1716 | } |
| 1717 | |
| 1718 | // Add user/s to group
|
| 1719 | if ($error = group_user_add($gid, $user_id)) |
| 1720 | {
|
| 1721 | trigger_error($user->lang[$error]); |
| 1722 | } |
| 1723 | } |
| 1724 | |
| 1725 | $colspan = 4; |
| 1726 | |
| 1727 | ?>
|
| 1728 | <tr>
|
| 1729 | <th colspan="4"><?php echo $user->lang['USER_ADMIN_GROUPS']; ?></th> |
| 1730 | </tr>
|
| 1731 | <?php
|
| 1732 | |
| 1733 | $sql = 'SELECT ug.group_leader, g.* |
| 1734 | FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug |
| 1735 | WHERE ug.user_id = $user_id |
| 1736 | AND g.group_id = ug.group_id |
| 1737 | ORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name";
|
| 1738 | $result = $db->sql_query($sql); |
| 1739 | |
| 1740 | $i = 0; |
| 1741 | $group_data = $id_ary = array(); |
| 1742 | while ($row = $db->sql_fetchrow($result)) |
| 1743 | {
|
| 1744 | $type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : (($row['user_pending']) ? 'pending' : 'normal'); |
| 1745 | |
| 1746 | $group_data[$type][$i]['group_id'] = $row['group_id']; |
| 1747 | $group_data[$type][$i]['group_name'] = $row['group_name']; |
| 1748 | $group_data[$type][$i]['group_leader'] = ($row['group_leader']) ? 1 : 0; |
| 1749 | |
| 1750 | $id_ary[] = $row['group_id']; |
| 1751 | |
| 1752 | $i++;
|
| 1753 | } |
| 1754 | $db->sql_freeresult($result); |
| 1755 | |
| 1756 | // Select box for other groups
|
| 1757 | $sql = 'SELECT group_id, group_name, group_type |
| 1758 | FROM ' . GROUPS_TABLE . ' |
| 1759 | WHERE group_id NOT IN (' . implode(', ', $id_ary) . ') |
| 1760 | ORDER BY group_type DESC, group_name ASC';
|
| 1761 | $result = $db->sql_query($sql); |
| 1762 | |
| 1763 | $group_options = ''; |
| 1764 | while ($row = $db->sql_fetchrow($result)) |
| 1765 | {
|
| 1766 | $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="blue"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; |
| 1767 | } |
| 1768 | $db->sql_freeresult($result); |
| 1769 | |
| 1770 | $current_type = ''; |
| 1771 | foreach ($group_data as $group_type => $data_ary) |
| 1772 | {
|
| 1773 | if ($current_type != $group_type) |
| 1774 | {
|
| 1775 | |
| 1776 | ?>
|
| 1777 | <tr>
|
| 1778 | <td class="row3" colspan="4"><strong><?php echo $user->lang['USER_GROUP_' . strtoupper($group_type)]; ?></strong></td> |
| 1779 | </tr>
|
| 1780 | <?php
|
| 1781 | |
| 1782 | } |
| 1783 | |
| 1784 | foreach ($data_ary as $data) |
| 1785 | {
|
| 1786 | $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; |
| 1787 | |
| 1788 | ?>
|
| 1789 | <tr>
|
| 1790 | <td class="<?php echo $row_class; ?>"><a href="<?php echo "admin_groups.$phpEx$SID&mode=manage&action=edit&g=" . $data['group_id']; ?>"><?php echo ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name']; ?></a></td> |
| 1791 | <td class="<?php echo $row_class; ?>" width="10%" nowrap="nowrap"> <?php |
| 1792 | |
| 1793 | if ($group_id != $data['group_id']) |
| 1794 | {
|
| 1795 | |
| 1796 | ?><a href="<?php echo "admin_users.$phpEx$SID&mode=$mode&action=default&u=$user_id&g=" . $data['group_id']; ?>"><?php echo $user->lang['GROUP_DEFAULT']; ?></a><?php |
| 1797 | |
| 1798 | } |
| 1799 | else |
| 1800 | {
|
| 1801 | echo $user->lang['GROUP_DEFAULT'];
|
| 1802 | } |
| 1803 | |
| 1804 | ?> </td> |
| 1805 | <td class="<?php echo $row_class; ?>" width="10%" nowrap="nowrap"> <?php |
| 1806 | |
| 1807 | if ($group_type != 'special') |
| 1808 | {
|
| 1809 | |
| 1810 | ?><a href="<?php echo "admin_users.$phpEx$SID&mode=$mode&action=" . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id']; ?>"><?php echo ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE']; ?></a> <?php |
| 1811 | |
| 1812 | } |
| 1813 | |
| 1814 | ?></td> |
| 1815 | <td class="<?php echo $row_class; ?>" width="10%" nowrap="nowrap"> <a href="<?php echo "admin_users.$phpEx$SID&mode=$mode&action=delete&u=$user_id&g=" . $data['group_id']; ?>"><?php echo $user->lang['GROUP_DELETE']; ?></a> </td> |
| 1816 | </tr>
|
| 1817 | <?php
|
| 1818 | |
| 1819 | } |
| 1820 | } |
| 1821 | |
| 1822 | ?>
|
| 1823 | <tr>
|
| 1824 | <td class="cat" colspan="4" align="right"><?php echo $user->lang['USER_GROUP_ADD']; ?>: <select name="g"><?php echo $group_options; ?></select> <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> </td> |
| 1825 | </tr>
|
| 1826 | <?php
|
| 1827 | |
| 1828 | break;
|
| 1829 | |
| 1830 | |
| 1831 | case 'perm': |
| 1832 | break;
|
| 1833 | |
| 1834 | |
| 1835 | case 'attach': |
| 1836 | |
| 1837 | if ($deletemark && $marked) |
| 1838 | {
|
| 1839 | if (!$cancel && !$confirm) |
| 1840 | {
|
| 1841 | adm_page_confirm($user->lang['CONFIRM'], $user->lang['CONFIRM_OPERATION']); |
| 1842 | } |
| 1843 | else if (!$cancel) |
| 1844 | {
|
| 1845 | $sql = 'SELECT real_filename |
| 1846 | FROM ' . ATTACHMENTS_TABLE . ' |
| 1847 | WHERE attach_id IN (' . implode(', ', $marked) . ')'; |
| 1848 | $result = $db->sql_query($sql); |
| 1849 | |
| 1850 | $log_attachments = array(); |
| 1851 | while ($row = $db->sql_fetchrow($result)) |
| 1852 | {
|
| 1853 | $log_attachments[] = $row['real_filename']; |
| 1854 | } |
| 1855 | $db->sql_freeresult($result); |
| 1856 | |
| 1857 | delete_attachments('attach', $marked); |
| 1858 | |
| 1859 | $log = (sizeof($delete_ids) == 1) ? 'ATTACHMENT_DELETED' : 'ATTACHMENTS_DELETED'; |
| 1860 | $meesage = (sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; |
| 1861 | |
| 1862 | add_log('admin', $log, implode(', ', $log_attachments)); |
| 1863 | trigger_error($message); |
| 1864 | } |
| 1865 | } |
| 1866 | |
| 1867 | $colspan = 6; |
| 1868 | |
| 1869 | $uri = "admin_users.$phpEx$SID&mode=$mode&action=$action&u=$user_id"; |
| 1870 | |
| 1871 | $sk_text = array('a' => $user->lang['SORT_FILENAME'], 'b' => $user->lang['SORT_COMMENT'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); |
| 1872 | $sk_sql = array('a' => 'a.real_filename', 'b' => 'a.comment', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); |
| 1873 | |
| 1874 | $sd_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); |
| 1875 | |
| 1876 | $s_sort_key = ''; |
| 1877 | foreach ($sk_text as $key => $value) |
| 1878 | {
|
| 1879 | $selected = ($sk == $key) ? ' selected="selected"' : ''; |
| 1880 | $s_sort_key .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; |
| 1881 | } |
| 1882 | |
| 1883 | $s_sort_dir = ''; |
| 1884 | foreach ($sd_text as $key => $value) |
| 1885 | {
|
| 1886 | $selected = ($sd == $key) ? ' selected="selected"' : ''; |
| 1887 | $s_sort_dir .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; |
| 1888 | } |
| 1889 | |
| 1890 | $order_by = $sk_sql[$sk] . ' ' . (($sd == 'a') ? 'ASC' : 'DESC'); |
| 1891 | |
| 1892 | $sql = 'SELECT COUNT(*) as num_attachments |
| 1893 | FROM ' . ATTACHMENTS_TABLE . " |
| 1894 | WHERE poster_id = $user_id"; |
| 1895 | $result = $db->sql_query_limit($sql, 1); |
| 1896 | |
| 1897 | $num_attachments = $db->sql_fetchfield('num_attachments', 0, $result); |
| 1898 | $db->sql_freeresult($result); |
| 1899 | |
| 1900 | $sql = 'SELECT a.*, t.topic_title |
| 1901 | FROM ' . ATTACHMENTS_TABLE . ' a, ' . TOPICS_TABLE . " t |
| 1902 | WHERE a.topic_id = t.topic_id |
| 1903 | AND a.poster_id = $user_id |
| 1904 | ORDER BY $order_by"; |
| 1905 | $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start); |
| 1906 | |
| 1907 | $row_count = 0; |
| 1908 | if ($row = $db->sql_fetchrow($result)) |
| 1909 | {
|
| 1910 | $class = 'row2'; |
| 1911 | |
| 1912 | ?>
|
| 1913 | <tr>
|
| 1914 | <th nowrap="nowrap">#</th> |
| 1915 | <th nowrap="nowrap" width="15%"><a class="th" href="<?php echo "$uri&sk=a&sd=" . (($sk == 'a' && $sd == 'a') ? 'd' : 'a'); ?>"><?php echo $user->lang['FILENAME']; ?></a></th> |
| 1916 | <th nowrap="nowrap" width="5%"><a class="th" href="<?php echo "$uri&sk=f&sd=" . (($sk == 'f' && $sd == 'a') ? 'd' : 'a'); ?>"><?php echo $user->lang['POST_TIME']; ?></a></th> |
| 1917 | <th nowrap="nowrap" width="5%"><a class="th" href="<?php echo "$uri&sk=d&sd=" . (($sk == 'd' && $sd == 'a') ? 'd' : 'a'); ?>"><?php echo $user->lang['FILESIZE']; ?></a></th> |
| 1918 | <th nowrap="nowrap" width="5%"><a class="th" href="<?php echo "$uri&sk=e&sd=" . (($sk == 'e' && $sd == 'a') ? 'd' : 'a'); ?>"><?php echo $user->lang['DOWNLOADS']; ?></a></th> |
| 1919 | <th width="2%" nowrap="nowrap"><?php echo $user->lang['DELETE']; ?></th> |
| 1920 | </tr>
|
| 1921 | <?php
|
| 1922 | |
| 1923 | do
|
| 1924 | {
|
| 1925 | $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . '#' . $row['post_id']; |
| 1926 | |
| 1927 | $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; |
| 1928 | |
| 1929 | ?>
|
| 1930 | <tr>
|
| 1931 | <td class="<?php echo $row_class; ?>" style="padding: 4px;" width="2%" align="center"><span class="gen"> <?php echo $row_count + ($start + 1); ?> </span></td> |
| 1932 | <td class="<?php echo $row_class; ?>" style="padding: 4px;"><a class="gen" href="<?php echo "{$phpbb_root_path}download.$phpEx$SID&id=" . $row['attach_id']; ?>" target="_blank"><?php echo $row['real_filename']; ?></a><br /><span class="gensmall"><?php echo $user->lang['TOPIC']; ?>: <a href="<?php echo $view_topic; ?>" target="_blank"><?php echo $row['topic_title']; ?></a></span></td> |
| 1933 | <td class="<?php echo $row_class; ?>" class="gensmall" style="padding: 4px;" align="center" nowrap="nowrap"> <?php echo $user->format_date($row['filetime'], $user->lang['DATE_FORMAT']); ?> </td> |
| 1934 | <td class="<?php echo $row_class; ?>" style="padding: 4px;" align="center" nowrap="nowrap"><span class="gen"><?php echo ($row['filesize'] >= 1048576) ? (round($row['filesize'] / 1048576 * 100) / 100) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? (round($row['filesize'] / 1024 * 100) / 100) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']); ?></span></td> |
| 1935 | <td class="<?php echo $row_class; ?>" style="padding: 4px;" align="center"><span class="gen"><?php echo $row['download_count']; ?></span></td> |
| 1936 | <td class="<?php echo $row_class; ?>" style="padding: 4px;" align="center"><input type="checkbox" name="mark[]" value="<?php echo $row['attach_id']; ?>" /></td> |
| 1937 | </tr>
|
| 1938 | <?php
|
| 1939 | |
| 1940 | $row_count++;
|
| 1941 | } |
| 1942 | while ($row = $db->sql_fetchrow($result));
|
| 1943 | } |
| 1944 | $db->sql_freeresult($result);
|
| 1945 | |
| 1946 | $pagination = generate_pagination("$uri&sk=$sk&sd=$sd", $num_attachments, $config['topics_per_page'], $start);
|
| 1947 | |
| 1948 | ?>
|
| 1949 | <tr>
|
| 1950 | <td class="cat" colspan="<?php echo $colspan; ?>"><table width="100%" cellspacing="0" cellpadding="0" border="0"> |
| 1951 | <tr>
|
| 1952 | <td width="100%" align="center"><span class="gensmall"><?php echo $user->lang['SORT_BY']; ?>: </span><select name="sk"><?php echo $s_sort_key; ?></select> <select name="sd"><?php echo $s_sort_dir; ?></select> <input class="btnlite" type="submit" name="sort" value="<?php echo $user->lang['SORT']; ?>" /></td> |
| 1953 | <td align="right"><input class="btnlite" type="submit" name="delmarked" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> </td> |
| 1954 | </tr>
|
| 1955 | </table></td> |
| 1956 | </tr>
|
| 1957 | </table></td> |
| 1958 | </tr>
|
| 1959 | <?php
|
| 1960 | |
| 1961 | break;
|
| 1962 | } |
| 1963 | |
| 1964 | |
| 1965 | ?>
|
| 1966 | </table></td> |
| 1967 | </tr>
|
| 1968 | |
| 1969 | <?php
|
| 1970 | |
| 1971 | |
| 1972 | if ($pagination) |
| 1973 | {
|
| 1974 | |
| 1975 | ?>
|
| 1976 | <tr>
|
| 1977 | <td align="right"><?php echo $pagination; ?></td> |
| 1978 | </tr>
|
| 1979 | <?php
|
| 1980 | |
| 1981 | } |
| 1982 | |
| 1983 | ?>
|
| 1984 | </table></form> |
| 1985 | |
| 1986 | <?php
|
| 1987 | |
| 1988 | adm_page_footer(); |
| 1989 | |
| 1990 | } |
| 1991 | |
| 1992 | // Do we have permission? |
| 1993 | if (!$auth->acl_get('a_user'))
|
| 1994 | {
|
| 1995 | trigger_error($user->lang['No_admin']);
|
| 1996 | } |
| 1997 | |
| 1998 | ?>
|
| 1999 | |
| 2000 | <h1><?php echo $user->lang['USER_ADMIN']; ?></h1> |
| 2001 | |
| 2002 | <p><?php echo $user->lang['USER_ADMIN_EXPLAIN']; ?></p> |
| 2003 | |
| 2004 | <form method="post" name="post" action="<?php echo "admin_users.$phpEx$SID"; ?>"><table class="bg" width="75%" cellspacing="1" cellpadding="4" border="0" align="center"> |
| 2005 | <tr>
|
| 2006 | <th colspan="2"align="center"><?php echo $user->lang['SELECT_USER']; ?></th> |
| 2007 | </tr>
|
| 2008 | <tr>
|
| 2009 | <td class="row1" width="40%"><b><?php echo $user->lang['FIND_USERNAME']; ?>: </b><br /><span class="gensmall">[ <a href="<?php echo "../memberlist.$phpEx$SID&mode=searchuser&field=username"; ?>" onclick="window.open('<?php echo "../memberlist.$phpEx$SID&mode=searchuser&field=username"?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;"><?php echo $user->lang['FIND_USERNAME']; ?></a> ]</span></td> |
| 2010 | <td class="row2"><input type="text" class="post" name="username" maxlength="50" size="20" /></td> |
| 2011 | </tr>
|
| 2012 | <tr>
|
| 2013 | <td class="cat" colspan="2" align="center"><input type="submit" name="submituser" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /></td> |
| 2014 | </tr>
|
| 2015 | </table></form> |
| 2016 | |
| 2017 | <?php
|
| 2018 | |
| 2019 | adm_page_footer(); |
| 2020 | |
| 2021 | |
| 2022 | /* Module class
|
| 2023 | class acp_admin_users extends module |
| 2024 | {
|
| 2025 | |
| 2026 | |
| 2027 | |
| 2028 | |
| 2029 | } |
| 2030 | */ |
| 2031 | |
| 2032 | ?> |

