True, "nonavbar" => True);
if (! $group_id)
Header("Location: " . $phpgw->link("groups.php"));
$phpgw_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]);
$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_admin("Sorry, the follow users are still a member of the group x",$group_name)
. '
' . lang_admin("They must be removed before you can continue")
. '';
echo '";
echo "link("deletegroup.php","group_id=" . $group_id . "&removeusers=True")
. "\">" . lang_admin("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_sepeartor();
$basedir = $phpgw_info["server"]["server_root"] . $sep . "filemanager" . $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");