egroupware_official/admin/deletegroup.php

94 lines
3.6 KiB
PHP
Raw Normal View History

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$ */
$phpgw_info = array();
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "admin");
2000-08-18 05:24:22 +02:00
2001-01-21 03:05:45 +01:00
if (! $group_id) {
2000-08-18 05:24:22 +02:00
Header("Location: " . $phpgw->link("groups.php"));
2001-01-21 03:05:45 +01:00
}
2000-08-18 05:24:22 +02:00
include("../header.inc.php");
2001-02-01 05:02:01 +01:00
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
$p->set_file(array("body" => "delete_common.tpl"));
if ((($group_id) && ($confirm)) || $removeusers) {
if ($removeusers) {
2001-02-01 05:02:01 +01:00
$old_group_list = $phpgw->acl->get_ids_for_location("$group_id",1,"phpgw_group","u");
@reset($old_group_list);
while($old_group_list && $id = each($old_group_list)) {
$phpgw->acl->delete("phpgw_group","$group_id",intval($id[1]),"u");
}
}
2001-01-21 03:05:45 +01:00
$phpgw->db->query("select group_name from groups where group_id=$group_id",__LINE__,__FILE__);
2000-08-18 05:24:22 +02:00
$phpgw->db->next_record();
$group_name = $phpgw->db->f("group_name");
2001-02-01 05:02:01 +01:00
$old_group_list = $phpgw->acl->get_ids_for_location("$group_id",1,"phpgw_group","u");
if ($old_group_list) {
$phpgw->common->phpgw_header();
echo parse_navbar();
2000-08-18 05:24:22 +02:00
echo '<p><center>';
2001-02-01 05:02:01 +01:00
echo lang("Sorry, the follow users are still a member of the group x",$group_name)
2000-09-07 22:49:55 +02:00
. '<br>' . lang("They must be removed before you can continue")
. '</td></tr>';
2000-08-18 05:24:22 +02:00
echo '<table border="0"><tr><td>';
2001-02-01 05:02:01 +01:00
while (list(,$id) = each($old_group_list)) {
echo '<tr><td><a href="' . $phpgw->link("editaccount.php","account_=" . $id) . '">' . $phpgw->common->grab_owner_name($id) . '</a></tr></td>';
2000-08-18 05:24:22 +02:00
}
echo "</table></center>";
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>";
$phpgw->common->phpgw_exit();
2000-08-18 05:24:22 +02:00
}
if ($confirm) {
2001-01-21 03:05:45 +01:00
$phpgw->db->query("select group_name from groups where group_id=$group_id",__LINE__,__FILE__);
$phpgw->db->next_record();
$group_name = $phpgw->db->f("group_name");
2001-01-21 03:05:45 +01:00
$phpgw->db->query("delete from groups where group_id=$group_id",__LINE__,__FILE__);
$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"));
2001-02-01 05:02:01 +01:00
$phpgw->common->phpgw_exit();
}
2001-02-01 05:02:01 +01:00
} else {
2001-02-01 05:02:01 +01:00
$phpgw->common->phpgw_header();
echo parse_navbar();
2001-01-21 03:05:45 +01:00
2001-02-01 05:02:01 +01:00
$p->set_var("message_display",lang("Are you sure you want to delete this group ?"));
$p->parse("messages","message_row");
$p->set_var("yes",'<a href="' . $phpgw->link("deletegroup.php","group_id=$group_id&confirm=true") . '">' . lang("Yes") . '</a>');
$p->set_var("no",'<a href="' . $phpgw->link("groups.php") . '">' . lang("No") . '</a>');
2001-01-21 03:05:45 +01:00
2001-02-01 05:02:01 +01:00
$p->pparse("out","body");
2001-01-21 03:05:45 +01:00
2001-02-01 05:02:01 +01:00
$phpgw->common->phpgw_footer();
}
2000-09-28 01:17:36 +02:00
?>