Simply deleting contact users and groups.
This commit is contained in:
parent
9e8cd7d348
commit
38af18d127
|
|
@ -38,21 +38,6 @@ else {
|
||||||
$language = new text;
|
$language = new text;
|
||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
//handle removal of contact group
|
|
||||||
if ($_GET['a'] == 'delete') {
|
|
||||||
$contact_uuid = $_GET["id"];
|
|
||||||
$contact_group_uuid = $_GET["cgid"];
|
|
||||||
$sql = "delete from v_contact_groups ";
|
|
||||||
$sql .= "where contact_uuid = '".$contact_uuid."' ";
|
|
||||||
$sql .= "and contact_group_uuid = '".$contact_group_uuid."' ";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
$_SESSION["message"] = $text['message-update'];
|
|
||||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//action add or update
|
//action add or update
|
||||||
if (isset($_REQUEST["id"])) {
|
if (isset($_REQUEST["id"])) {
|
||||||
$action = "update";
|
$action = "update";
|
||||||
|
|
@ -80,25 +65,6 @@ else {
|
||||||
$contact_note = check_str($_POST["contact_note"]);
|
$contact_note = check_str($_POST["contact_note"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete the user
|
|
||||||
if ($_GET["a"] == "delete" && permission_exists('contact_user_delete')) {
|
|
||||||
if (strlen($_REQUEST["contact_user_uuid"]) > 0) {
|
|
||||||
//set the variables
|
|
||||||
$contact_uuid = check_str($_REQUEST["contact_uuid"]);
|
|
||||||
$contact_user_uuid = check_str($_REQUEST["contact_user_uuid"]);
|
|
||||||
//delete the assigned user from the contact
|
|
||||||
$sql = "delete from v_contact_users ";
|
|
||||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
|
||||||
$sql .= "and contact_user_uuid = '$contact_user_uuid' ";
|
|
||||||
$db->exec(check_sql($sql));
|
|
||||||
unset($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION["message"] = $text['message-delete'];
|
|
||||||
header("Location: contact_edit.php?id=".$contact_uuid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//process the form data
|
//process the form data
|
||||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
|
||||||
|
|
@ -682,7 +648,7 @@ else {
|
||||||
echo " <td class='vtable'>".$field['username']."</td>\n";
|
echo " <td class='vtable'>".$field['username']."</td>\n";
|
||||||
echo " <td style='width: 25px;' align='right'>\n";
|
echo " <td style='width: 25px;' align='right'>\n";
|
||||||
if (permission_exists('contact_user_delete')) {
|
if (permission_exists('contact_user_delete')) {
|
||||||
echo " <a href='contact_edit.php?contact_user_uuid=".$field['contact_user_uuid']."&contact_uuid=".$contact_uuid."&a=delete' alt='delete' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n";
|
echo " <a href='contact_user_delete.php?id=".$field['contact_user_uuid']."&contact_uuid=".$contact_uuid."' alt='delete' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n";
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " </tr>\n";
|
echo " </tr>\n";
|
||||||
|
|
@ -739,7 +705,7 @@ else {
|
||||||
echo " <td class='vtable'>".$field['group_name']."</td>\n";
|
echo " <td class='vtable'>".$field['group_name']."</td>\n";
|
||||||
echo " <td>\n";
|
echo " <td>\n";
|
||||||
if (permission_exists('contact_group_delete') || if_group("superadmin")) {
|
if (permission_exists('contact_group_delete') || if_group("superadmin")) {
|
||||||
echo " <a href='contact_edit.php?id=".$contact_uuid."&cgid=".$field['contact_group_uuid']."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
echo " <a href='contact_group_delete.php?id=".$contact_group_uuid."&contact_uuid=".$field['contact_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
FusionPBX
|
||||||
|
Version: MPL 1.1
|
||||||
|
|
||||||
|
The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
for the specific language governing rights and limitations under the
|
||||||
|
License.
|
||||||
|
|
||||||
|
The Original Code is FusionPBX
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is
|
||||||
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
*/
|
||||||
|
require_once "root.php";
|
||||||
|
require_once "resources/require.php";
|
||||||
|
require_once "resources/check_auth.php";
|
||||||
|
if (permission_exists('contact_group_delete')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if included in another file
|
||||||
|
if (!$included) {
|
||||||
|
//add multi-lingual support
|
||||||
|
$language = new text;
|
||||||
|
$text = $language->get();
|
||||||
|
|
||||||
|
if (count($_REQUEST) > 0) {
|
||||||
|
$contact_uuid = check_str($_REQUEST["contact_uuid"]);
|
||||||
|
$contact_group_uuid = $_REQUEST["id"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete the group
|
||||||
|
if (is_uuid($contact_uuid) && is_uuid($contact_group_uuid)) {
|
||||||
|
$sql = "delete from v_contact_groups ";
|
||||||
|
$sql .= "where contact_uuid = '".$contact_uuid."' ";
|
||||||
|
$sql .= "and contact_group_uuid = '".$contact_group_uuid."' ";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//redirect the browser
|
||||||
|
if (!$included) {
|
||||||
|
$_SESSION["message"] = $text['message-delete'];
|
||||||
|
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
FusionPBX
|
||||||
|
Version: MPL 1.1
|
||||||
|
|
||||||
|
The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
http://www.mozilla.org/MPL/
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
for the specific language governing rights and limitations under the
|
||||||
|
License.
|
||||||
|
|
||||||
|
The Original Code is FusionPBX
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is
|
||||||
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
*/
|
||||||
|
require_once "root.php";
|
||||||
|
require_once "resources/require.php";
|
||||||
|
require_once "resources/check_auth.php";
|
||||||
|
if (permission_exists('contact_group_delete')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if included in another file
|
||||||
|
if (!$included) {
|
||||||
|
//add multi-lingual support
|
||||||
|
$language = new text;
|
||||||
|
$text = $language->get();
|
||||||
|
|
||||||
|
if (count($_REQUEST) > 0) {
|
||||||
|
$contact_user_uuid = check_str($_REQUEST["id"]);
|
||||||
|
$contact_uuid = check_str($_REQUEST["contact_uuid"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete the user
|
||||||
|
if (is_uuid($contact_uuid) && is_uuid($contact_user_uuid)) {
|
||||||
|
$sql = "delete from v_contact_users ";
|
||||||
|
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||||
|
$sql .= "and contact_user_uuid = '$contact_user_uuid' ";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//redirect the browser
|
||||||
|
if (!$included) {
|
||||||
|
$_SESSION["message"] = $text['message-delete'];
|
||||||
|
header("Location: contact_edit.php?id=".$contact_uuid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue