True, "nonavbar" => True);
if (! $group_id)
Header("Location: " . $phpgw->link("groups.php"));
$phpgw_info["flags"]["currentapp"] = "admin";
include("../header.inc.php");
if ((($group_id) && ($confirm)) || $removeusers) {
if ($removeusers) {
$phpgw->db->query("select con,groups from accounts where groups like '%$group_id%'");
while ($phpgw->db->next_record()) {
$groups[$phpgw->db->f("con")] = $phpgw->db->f("groups");
}
while ($user = each($groups)) {
$user_[1] = ereg_replace(",$group_id,",",",$user[1]);
if ($user_[1] == ",") {
$user_[1] = "";
}
$phpgw->db->query("update accounts set groups='$user_[1]' where con='$user[0]'");
}
$confirm = True;
}
$phpgw->db->query("select group_name from groups where group_id='$group_id'");
$phpgw->db->next_record();
$group_name = $phpgw->db->f("group_name");
$phpgw->db->query("select con,loginid from accounts where groups like '%$group_id%'");
if ($phpgw->db->num_rows()) {
$phpgw->common->header();
$phpgw->common->navbar();
echo '
';
echo lang("Sorry, the follow users are still a member of the group x",$group_name)
. '
' . lang("They must be removed before you can continue")
. '';
echo '";
echo "link("deletegroup.php","group_id=" . $group_id . "&removeusers=True")
. "\">" . lang("Remove all users from this group") . "";
exit;
}
if ($confirm) {
$phpgw->db->query("select group_name from groups where group_id='$group_id'");
$phpgw->db->next_record();
$group_name = $phpgw->db->f("group_name");
$phpgw->db->query("delete from groups where group_id='$group_id'");
$sep = $phpgw->common->filesystem_separator();
$basedir = $phpgw_info["server"]["files_dir"] . $sep . "groups" . $sep;
if (! @rmdir($basedir . $group_name)) {
$cd = 38;
} else {
$cd = 32;
}
Header("Location: " . $phpgw->link("groups.php","cd=$cd"));
}
}
$phpgw->common->header();
$phpgw->common->navbar();
?>
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");