2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - administration *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-11-16 09:00:18 +01:00
|
|
|
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "admin");
|
2000-08-18 05:24:22 +02:00
|
|
|
|
|
|
|
if (! $group_id)
|
|
|
|
Header("Location: " . $phpgw->link("groups.php"));
|
|
|
|
|
|
|
|
include("../header.inc.php");
|
2000-08-19 05:38:35 +02:00
|
|
|
|
|
|
|
if ((($group_id) && ($confirm)) || $removeusers) {
|
|
|
|
if ($removeusers) {
|
2000-09-26 00:35:09 +02:00
|
|
|
$phpgw->db->query("select account_id,account_groups from accounts where account_groups like '%$group_id%'");
|
2000-08-19 05:38:35 +02:00
|
|
|
while ($phpgw->db->next_record()) {
|
2000-09-26 00:35:09 +02:00
|
|
|
$groups[$phpgw->db->f("account_id")] = $phpgw->db->f("account_groups");
|
2000-08-19 05:38:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
while ($user = each($groups)) {
|
2000-10-11 03:58:21 +02:00
|
|
|
$user_[1] = ereg_replace(",$group_id:[0-9]+,",",",$user[1]);
|
2000-08-21 00:55:00 +02:00
|
|
|
if ($user_[1] == ",") {
|
|
|
|
$user_[1] = "";
|
|
|
|
}
|
2000-09-28 01:17:36 +02:00
|
|
|
$phpgw->db->query("update accounts set account_groups='$user_[1]' where account_id=$user[0]");
|
2000-08-19 05:38:35 +02:00
|
|
|
}
|
|
|
|
$confirm = True;
|
|
|
|
}
|
|
|
|
|
2000-09-28 01:17:36 +02:00
|
|
|
$phpgw->db->query("select group_name from groups where group_id=$group_id");
|
2000-08-18 05:24:22 +02:00
|
|
|
$phpgw->db->next_record();
|
|
|
|
|
|
|
|
$group_name = $phpgw->db->f("group_name");
|
|
|
|
|
2000-10-02 12:48:03 +02:00
|
|
|
$phpgw->db->query("select count(*) from accounts where account_groups like '%$group_id%'");
|
|
|
|
$phpgw->db->next_record();
|
|
|
|
if ($phpgw->db->f(0) != 0) {
|
2000-09-28 17:01:11 +02:00
|
|
|
$phpgw->common->phpgw_header();
|
2000-08-19 05:38:35 +02:00
|
|
|
$phpgw->common->navbar();
|
|
|
|
|
2000-08-18 05:24:22 +02:00
|
|
|
echo '<p><center>';
|
2000-09-07 22:49:55 +02:00
|
|
|
echo lang("Sorry, the follow users are still a member of the group x",$group_name)
|
|
|
|
. '<br>' . lang("They must be removed before you can continue")
|
2000-08-26 21:20:27 +02:00
|
|
|
. '</td></tr>';
|
2000-08-18 05:24:22 +02:00
|
|
|
|
|
|
|
echo '<table border="0"><tr><td>';
|
|
|
|
|
2000-10-02 12:48:03 +02:00
|
|
|
$phpgw->db->query("select account_id,account_lid from accounts where account_groups like '%$group_id%'");
|
2000-08-18 05:24:22 +02:00
|
|
|
while ($phpgw->db->next_record()) {
|
2000-09-26 00:35:09 +02:00
|
|
|
echo '<tr><td><a href="' . $phpgw->link("editaccount.php","account_=" . $phpgw->db->f("account_id")) . '">' . $phpgw->db->f("loginid") . '</a></tr></td>';
|
2000-08-18 05:24:22 +02:00
|
|
|
}
|
|
|
|
echo "</table></center>";
|
2000-08-19 05:38:35 +02:00
|
|
|
echo "<a href=\"" . $phpgw->link("deletegroup.php","group_id=" . $group_id . "&removeusers=True")
|
2000-09-07 22:49:55 +02:00
|
|
|
. "\">" . lang("Remove all users from this group") . "</a>";
|
2000-08-18 05:24:22 +02:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2000-08-19 05:38:35 +02:00
|
|
|
if ($confirm) {
|
2000-09-28 01:17:36 +02:00
|
|
|
$phpgw->db->query("select group_name from groups where group_id=$group_id");
|
2000-08-19 05:38:35 +02:00
|
|
|
$phpgw->db->next_record();
|
|
|
|
$group_name = $phpgw->db->f("group_name");
|
|
|
|
|
2000-09-28 01:17:36 +02:00
|
|
|
$phpgw->db->query("delete from groups where group_id=$group_id");
|
2000-08-19 05:38:35 +02:00
|
|
|
|
2000-08-26 22:12:01 +02:00
|
|
|
$sep = $phpgw->common->filesystem_separator();
|
2000-08-19 05:38:35 +02:00
|
|
|
|
2000-08-22 19:06:09 +02:00
|
|
|
$basedir = $phpgw_info["server"]["files_dir"] . $sep . "groups" . $sep;
|
2000-08-19 05:38:35 +02:00
|
|
|
|
|
|
|
if (! @rmdir($basedir . $group_name)) {
|
|
|
|
$cd = 38;
|
|
|
|
} else {
|
|
|
|
$cd = 32;
|
|
|
|
}
|
|
|
|
|
|
|
|
Header("Location: " . $phpgw->link("groups.php","cd=$cd"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-28 17:01:11 +02:00
|
|
|
$phpgw->common->phpgw_header();
|
2000-08-19 05:38:35 +02:00
|
|
|
$phpgw->common->navbar();
|
|
|
|
?>
|
2000-08-18 05:24:22 +02:00
|
|
|
<center>
|
|
|
|
<table border=0 with=65%>
|
|
|
|
<tr colspan=2>
|
|
|
|
<td align=center>
|
2000-09-07 22:49:55 +02:00
|
|
|
<?php echo lang("Are you sure you want to delete this group ?"); ?>
|
2000-08-18 05:24:22 +02:00
|
|
|
<td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
2000-09-07 22:49:55 +02:00
|
|
|
<a href="<?php echo $phpgw->link("groups.php") . "\">" . lang("No") . "</a>"; ?>
|
2000-08-18 05:24:22 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
2000-09-07 22:49:55 +02:00
|
|
|
<a href="<?php echo $phpgw->link("deletegroup.php","group_id=$group_id&confirm=true") . "\">" . lang("Yes") . "</a>"; ?>
|
2000-08-18 05:24:22 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</center>
|
2000-09-28 01:17:36 +02:00
|
|
|
<?php
|
2000-09-29 07:24:18 +02:00
|
|
|
$phpgw->common->phpgw_footer();
|
2000-09-28 01:17:36 +02:00
|
|
|
?>
|