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);
|
2003-06-02 20:08:51 -04:00
|
|
|
$usertopromote_level = $user_data->user_level;
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
if ($user_level <= $usertopromote_level) {
|
2003-06-02 20:08:51 -04:00
|
|
|
die('Can’t change the level of a 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-06-01 04:06:11 -04:00
|
|
|
$result = $wpdb->query($sql);
|
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);
|
2003-06-01 04:06:11 -04:00
|
|
|
$usertodelete_level = $user_data->user_level;
|
2003-05-22 08:12:53 -04:00
|
|
|
|
|
|
|
if ($user_level <= $usertodelete_level)
|
2003-06-02 20:08:51 -04:00
|
|
|
die('Can’t delete a user whose level is higher than yours.');
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2003-06-01 04:06:11 -04:00
|
|
|
$sql = "DELETE FROM $tableusers WHERE ID = $id";
|
|
|
|
$result = $wpdb->query($sql) or die("Couldn’t delete user #$id.");
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2003-06-01 04:06:11 -04:00
|
|
|
$sql = "DELETE FROM $tableposts WHERE post_author = $id";
|
|
|
|
$result = $wpdb->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
|
|
|
|
2003-06-02 20:08:51 -04:00
|
|
|
<div class="wrap"><p>Click on a user’s login name to see his complete profile.<br />
|
2003-05-23 04:29:51 -04:00
|
|
|
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>
|
2003-06-01 04:06:11 -04:00
|
|
|
<th>ID</th>
|
|
|
|
<th>Nickname</th>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>E-mail</th>
|
|
|
|
<th>URL</th>
|
|
|
|
<th>Level</th>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php if ($user_level > 3) { ?>
|
2003-06-01 04:06:11 -04:00
|
|
|
<th>Login</th>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php } ?>
|
|
|
|
</tr>
|
|
|
|
<?php
|
2003-06-01 04:06:11 -04:00
|
|
|
$users = $wpdb->get_results("SELECT ID FROM $tableusers WHERE user_level>0 ORDER BY ID");
|
|
|
|
foreach ($users as $user) {
|
|
|
|
$user_data = get_userdata($user->ID);
|
|
|
|
echo "<tr>\n<!--".$user_data->user_login."-->\n";
|
|
|
|
$email = $user_data->user_email;
|
|
|
|
$url = $user_data->user_url;
|
2003-06-12 18:48:06 -04:00
|
|
|
$bg1 = ($user_data->user_login == $user_login) ? "bgcolor=\"#ffffff\"" : "bgcolor=\"#dddddd\"";
|
|
|
|
$bg2 = ($user_data->user_login == $user_login) ? "bgcolor=\"#ffffff\"" : "bgcolor=\"#eeeeee\"";
|
2003-06-01 04:06:11 -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> ";
|
2003-06-01 04:06:11 -04:00
|
|
|
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";
|
2003-06-01 04:06:11 -04:00
|
|
|
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> ";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "</td>\n";
|
|
|
|
if ($user_level > 3) {
|
2003-06-01 04:06:11 -04:00
|
|
|
echo "<td $bg1>".$user_data->user_login."</td>\n";
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
echo "</tr>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
</table>
|
2003-05-23 04:29:51 -04:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
2003-06-01 04:06:11 -04:00
|
|
|
$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID");
|
|
|
|
if ($users) {
|
2003-05-22 08:12:53 -04:00
|
|
|
?>
|
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>
|
2003-06-01 04:06:11 -04:00
|
|
|
<td>ID</td>
|
|
|
|
<td>Nickname</td>
|
|
|
|
<td>Name</td>
|
|
|
|
<td>E-mail</td>
|
|
|
|
<td>URL</td>
|
|
|
|
<td>Level</td>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php if ($user_level > 3) { ?>
|
2003-06-01 04:06:11 -04:00
|
|
|
<td>Login</td>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php } ?>
|
|
|
|
</tr>
|
|
|
|
<?php
|
2003-06-01 04:06:11 -04:00
|
|
|
foreach ($users as $user) {
|
|
|
|
$user_data = get_userdata($user->ID);
|
|
|
|
echo "<tr>\n<!--".$user_data->user_login."-->\n";
|
|
|
|
$email = $user_data->user_email;
|
|
|
|
$url = $user_data->user_url;
|
|
|
|
$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\"";
|
|
|
|
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> ";
|
2003-06-01 04:06:11 -04:00
|
|
|
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";
|
2003-06-01 04:06:11 -04:00
|
|
|
echo "<td $bg1>".$user_data->user_level;
|
2003-05-22 08:12:53 -04:00
|
|
|
if ($user_level >= 2)
|
2003-06-01 04:06:11 -04:00
|
|
|
echo " <a href=\"b2team.php?action=promote&id=".$user_data->ID."&prom=up\">+</a> ";
|
2003-05-22 08:12:53 -04:00
|
|
|
if ($user_level >= 3)
|
2003-06-01 04:06:11 -04:00
|
|
|
echo " <a href=\"b2team.php?action=delete&id=".$user_data->ID."\" style=\"color:red;font-weight:bold;\">X</a> ";
|
2003-05-22 08:12:53 -04:00
|
|
|
echo "</td>\n";
|
|
|
|
if ($user_level > 3) {
|
2003-06-01 04:06:11 -04:00
|
|
|
echo "<td $bg2>".$user_data->user_login."</td>\n";
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
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">
|
2003-06-02 20:08:51 -04:00
|
|
|
<p>To delete a user, bring his level to zero, then click on the red X.<br />
|
|
|
|
<strong>Warning:</strong> deleting a user also deletes all posts made by this user.
|
2003-05-23 04:29:51 -04:00
|
|
|
</p>
|
|
|
|
</div>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* </Team> */
|
2003-05-23 04:29:51 -04:00
|
|
|
include('b2footer.php');
|
|
|
|
?>
|