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