2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
2003-05-23 04:29:51 -04:00
|
|
|
$title = 'Team management';
|
2003-05-22 08:12:53 -04:00
|
|
|
/* <Team> */
|
|
|
|
|
|
|
|
$b2varstoreset = array('action','standalone','redirect','profile');
|
|
|
|
for ($i=0; $i<count($b2varstoreset); $i += 1) {
|
|
|
|
$b2var = $b2varstoreset[$i];
|
|
|
|
if (!isset($$b2var)) {
|
|
|
|
if (empty($HTTP_POST_VARS["$b2var"])) {
|
|
|
|
if (empty($HTTP_GET_VARS["$b2var"])) {
|
|
|
|
$$b2var = '';
|
|
|
|
} else {
|
|
|
|
$$b2var = $HTTP_GET_VARS["$b2var"];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$$b2var = $HTTP_POST_VARS["$b2var"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($action) {
|
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
case 'promote':
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
$standalone = 1;
|
2003-05-23 04:29:51 -04:00
|
|
|
require_once('b2header.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
if (empty($HTTP_GET_VARS["prom"])) {
|
2003-05-23 04:29:51 -04:00
|
|
|
header('Location: b2team.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
$id = $HTTP_GET_VARS["id"];
|
|
|
|
$prom = $HTTP_GET_VARS["prom"];
|
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
$user_data = get_userdata($id);
|
|
|
|
$usertopromote_level = $user_data[13];
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
if ($user_level <= $usertopromote_level) {
|
2003-05-23 04:29:51 -04:00
|
|
|
die('Can’t change the level of an user whose level is higher than yours.');
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
if ('up' == $prom) {
|
2003-05-22 08:12:53 -04:00
|
|
|
$sql="UPDATE $tableusers SET user_level=user_level+1 WHERE ID = $id";
|
2003-05-23 04:29:51 -04:00
|
|
|
} elseif ('down' == $prom) {
|
2003-05-22 08:12:53 -04:00
|
|
|
$sql="UPDATE $tableusers SET user_level=user_level-1 WHERE ID = $id";
|
|
|
|
}
|
2003-05-23 04:29:51 -04:00
|
|
|
$result = mysql_query($sql) or die("Couldn't change $id's level.");
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
header('Location: b2team.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
case 'delete':
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
$standalone = 1;
|
2003-05-23 04:29:51 -04:00
|
|
|
require_once('b2header.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
$id = $HTTP_GET_VARS["id"];
|
|
|
|
|
|
|
|
if (!$id) {
|
2003-05-23 04:29:51 -04:00
|
|
|
header('Location: b2team.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
$user_data = get_userdata($id);
|
|
|
|
$usertodelete_level = $user_data[13];
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
if ($user_level <= $usertodelete_level)
|
2003-05-23 04:29:51 -04:00
|
|
|
die('Can’t delete an user whose level is higher than yours.');
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
$sql="DELETE FROM $tableusers WHERE ID = $id";
|
2003-05-23 04:29:51 -04:00
|
|
|
$result = mysql_query($sql) or die("Couldn’t delete user #$id.");
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
$sql="DELETE FROM $tableposts WHERE post_author = $id";
|
2003-05-23 04:29:51 -04:00
|
|
|
$result = mysql_query($sql) or die("Couldn’t delete user #$id’s posts.");
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
header('Location: b2team.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
$standalone = 0;
|
|
|
|
include ('b2header.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
?>
|
2003-05-23 04:29:51 -04:00
|
|
|
|
|
|
|
<div class="wrap"><p>Click on an user’s login name to see his complete profile.<br />
|
|
|
|
To edit your profile, click on your login name.</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="wrap">
|
|
|
|
<h3>Active users</h3>
|
2003-05-22 08:12:53 -04:00
|
|
|
<table cellpadding="5" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td class="tabletoprow">ID</td>
|
|
|
|
<td class="tabletoprow">Nickname</td>
|
|
|
|
<td class="tabletoprow">Name</td>
|
|
|
|
<td class="tabletoprow">E-mail</td>
|
|
|
|
<td class="tabletoprow">URL</td>
|
|
|
|
<td class="tabletoprow">Level</td>
|
|
|
|
<?php if ($user_level > 3) { ?>
|
|
|
|
<td class="tabletoprow">Login</td>
|
|
|
|
<?php } ?>
|
|
|
|
</tr>
|
|
|
|
<?php
|
2003-05-23 04:29:51 -04:00
|
|
|
$request = "SELECT * FROM $tableusers WHERE user_level>0 ORDER BY ID";
|
2003-05-22 08:12:53 -04:00
|
|
|
$result = mysql_query($request);
|
|
|
|
while($row = mysql_fetch_object($result)) {
|
|
|
|
$user_data = get_userdata2($row->ID);
|
|
|
|
echo "<tr>\n<!--".$user_data["user_login"]."-->\n";
|
|
|
|
$email = $user_data["user_email"];
|
|
|
|
$url = $user_data["user_url"];
|
2003-05-24 18:25:39 -04:00
|
|
|
$bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\"";
|
|
|
|
$bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\"";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "<td $bg1>".$user_data["ID"]."</td>\n";
|
|
|
|
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
|
|
|
|
echo "<td $bg1>".$user_data["user_firstname"]." ".$user_data["user_lastname"]."</td>\n";
|
2003-05-24 18:25:39 -04:00
|
|
|
echo "<td $bg2> <a href=\"mailto:$email\" title=\"e-mail: $email\"><img src='../b2-img/email.gif' border=\"0\" alt=\"e-mail: $email\" /></a> </td>";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "<td $bg1> ";
|
|
|
|
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
|
2003-05-24 18:25:39 -04:00
|
|
|
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"../b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a> ";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "</td>\n";
|
|
|
|
echo "<td $bg2>".$user_data["user_level"];
|
|
|
|
if (($user_level >= 2) and ($user_level > ($user_data["user_level"] + 1)))
|
|
|
|
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
|
|
|
|
if (($user_level >= 2) and ($user_level > $user_data["user_level"]) and ($user_data["user_level"] > 0))
|
|
|
|
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=down\">-</a> ";
|
|
|
|
echo "</td>\n";
|
|
|
|
if ($user_level > 3) {
|
|
|
|
echo "<td $bg1>".$user_data["user_login"]."</td>\n";
|
|
|
|
}
|
|
|
|
echo "</tr>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
</table>
|
2003-05-23 04:29:51 -04:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
|
|
|
$request = " SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID";
|
|
|
|
$result = mysql_query($request);
|
|
|
|
if (mysql_num_rows($result)) {
|
|
|
|
?>
|
2003-05-23 04:29:51 -04:00
|
|
|
<div class="wrap">
|
|
|
|
<h3>Inactive users (level 0)</h3>
|
2003-05-22 08:12:53 -04:00
|
|
|
<table cellpadding="5" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td class="tabletoprow">ID</td>
|
|
|
|
<td class="tabletoprow">Nickname</td>
|
|
|
|
<td class="tabletoprow">Name</td>
|
|
|
|
<td class="tabletoprow">E-mail</td>
|
|
|
|
<td class="tabletoprow">URL</td>
|
|
|
|
<td class="tabletoprow">Level</td>
|
|
|
|
<?php if ($user_level > 3) { ?>
|
|
|
|
<td class="tabletoprow">Login</td>
|
|
|
|
<?php } ?>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
while($row = mysql_fetch_object($result)) {
|
|
|
|
$user_data = get_userdata2($row->ID);
|
|
|
|
echo "<tr>\n<!--".$user_data["user_login"]."-->\n";
|
|
|
|
$email = $user_data["user_email"];
|
|
|
|
$url = $user_data["user_url"];
|
2003-05-24 18:25:39 -04:00
|
|
|
$bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\"";
|
|
|
|
$bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\"";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "<td $bg1>".$user_data["ID"]."</td>\n";
|
|
|
|
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
|
|
|
|
echo "<td $bg1>".$user_data["user_firstname"]." ".$user_data["user_lastname"]."</td>\n";
|
2003-05-24 18:25:39 -04:00
|
|
|
echo "<td $bg1> <a href=\"mailto:".antispambot($email)."\" title=\"e-mail: ".antispambot($email)."\"><img src=\"../b2-img/email.gif\" border=\"0\" alt=\"e-mail: ".antispambot($email)."\" /></a> </td>";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "<td $bg2> ";
|
|
|
|
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
|
2003-05-24 18:25:39 -04:00
|
|
|
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"../b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a> ";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "</td>\n";
|
|
|
|
echo "<td $bg1>".$user_data["user_level"];
|
|
|
|
if ($user_level >= 2)
|
|
|
|
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
|
|
|
|
if ($user_level >= 3)
|
|
|
|
echo " <a href=\"b2team.php?action=delete&id=".$user_data["ID"]."\" style=\"color:red;font-weight:bold;\">X</a> ";
|
|
|
|
echo "</td>\n";
|
|
|
|
if ($user_level > 3) {
|
|
|
|
echo "<td $bg2>".$user_data["user_login"]."</td>\n";
|
|
|
|
}
|
|
|
|
echo "</tr>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
</table>
|
2003-05-23 04:29:51 -04:00
|
|
|
</div>
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if ($user_level >= 3) { ?>
|
2003-05-23 04:29:51 -04:00
|
|
|
<div class="wrap">
|
|
|
|
<p>To delete an user, bring his level to zero, then click on the red X.<br />
|
|
|
|
<strong>Warning:</strong> deleting an user also deletes all posts made by this user.
|
|
|
|
</p>
|
|
|
|
</div>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* </Team> */
|
2003-05-23 04:29:51 -04:00
|
|
|
include('b2footer.php');
|
|
|
|
?>
|