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