True, "nonavbar" => True);
if (! $group_id)
Header("Location: " . $phpgw->link("groups.php"));
$phpgw_info["flags"]["currentapp"] = "admin";
$phpgw_info["flags"]["disable_message_class"] = True;
$phpgw_info["flags"]["disable_send_class"] = True;
include("../header.inc.php");
if ((($group_id) && ($confirm)) || $removeusers) {
if ($removeusers) {
$phpgw->db->query("select account_id,account_groups from accounts where account_groups like '%$group_id%'");
while ($phpgw->db->next_record()) {
$groups[$phpgw->db->f("account_id")] = $phpgw->db->f("account_groups");
}
while ($user = each($groups)) {
$user_[1] = ereg_replace(",$group_id:[0-9]+,",",",$user[1]);
if ($user_[1] == ",") {
$user_[1] = "";
}
$phpgw->db->query("update accounts set account_groups='$user_[1]' where account_id=$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 count(*) from accounts where account_groups like '%$group_id%'");
$phpgw->db->next_record();
if ($phpgw->db->f(0) != 0) {
$phpgw->common->phpgw_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->phpgw_header();
$phpgw->common->navbar();
?>
common->phpgw_footer();
?>