2012-06-04 16:58:40 +02:00
|
|
|
<?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>
|
2013-09-27 11:54:07 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2013
|
2012-06-04 16:58:40 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
include "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//check the permissions
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2013-06-09 06:32:24 +02:00
|
|
|
if (if_group("admin") || if_group("superadmin")) {
|
|
|
|
|
//access allowed
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//add multi-lingual support
|
|
|
|
|
require_once "app_languages.php";
|
|
|
|
|
foreach($text as $key => $value) {
|
|
|
|
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//show the header
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2013-06-09 06:32:24 +02:00
|
|
|
$page["title"] = $text['title-group_manager'];
|
2013-09-17 21:06:44 +02:00
|
|
|
if (isset($_REQUEST["change"])) {
|
|
|
|
|
//get the values from the HTTP POST and save them as PHP variables
|
|
|
|
|
$change = check_str($_REQUEST["change"]);
|
|
|
|
|
$group_name = check_str($_REQUEST["group_name"]);
|
|
|
|
|
|
|
|
|
|
$sql = "update v_groups set ";
|
2013-09-27 11:37:59 +02:00
|
|
|
$sql .= "group_protected = '$change' ";
|
2013-09-17 21:06:44 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
|
|
|
|
$sql .= "and group_name = '$group_name' ";
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
unset($sql);
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//show the content
|
|
|
|
|
echo "<div class='' style='padding:0px;'>\n";
|
|
|
|
|
echo "<table width='100%'>";
|
|
|
|
|
echo "<td>";
|
|
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0'><tr>";
|
2013-06-09 06:32:24 +02:00
|
|
|
echo "<td width='50%'><b>".$text['header-group_manager']."</b><br><br></td>";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<td width='50%' align='right'>";
|
|
|
|
|
if (permission_exists('user_view')) {
|
2013-06-09 06:32:24 +02:00
|
|
|
echo " <input type='button' class='btn' onclick=\"window.location='index.php'\" value='".$text['header-user_manager']."'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2014-05-09 03:33:58 +02:00
|
|
|
if (permission_exists('group_edit')) {
|
|
|
|
|
echo " <input type='button' class='btn' alt='".$text['button-restore']."' onclick=\"window.location='permissions_default.php'\" value='".$text['button-restore']."'>";
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr></table>";
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM v_groups ";
|
|
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
2013-09-27 11:54:07 +02:00
|
|
|
$sql .= "order by group_name asc ";
|
2012-06-04 16:58:40 +02:00
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
|
|
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
|
|
|
|
|
|
|
|
|
$strlist = "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
$strlist .= "<tr class='border'>\n";
|
2014-06-20 01:37:28 +02:00
|
|
|
$strlist .= " <th nowrap>".$text['label-group_name']."</th>\n";
|
|
|
|
|
$strlist .= " <th nowrap>".$text['label-group_description']."</th>\n";
|
|
|
|
|
$strlist .= " <th style='text-align: center;' nowrap> </th>\n";
|
|
|
|
|
$strlist .= " <th style='text-align: center;' nowrap>".$text['label-group_protected']."</th>\n";
|
2014-02-26 07:30:14 +01:00
|
|
|
$strlist .= " <td class='list_control_icons' style='width: 25px;'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
if (permission_exists('group_add')) {
|
2014-02-26 07:30:14 +01:00
|
|
|
$strlist .= "<a href='groupadd.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
$strlist .= " </td>\n";
|
|
|
|
|
$strlist .= "</tr>\n";
|
|
|
|
|
|
|
|
|
|
$count = 0;
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
foreach ($result as &$row) {
|
|
|
|
|
$group_name = $row["group_name"];
|
2013-09-27 11:37:59 +02:00
|
|
|
$group_protected= $row["group_protected"];
|
2012-06-04 16:58:40 +02:00
|
|
|
$group_uuid = $row["group_uuid"];
|
|
|
|
|
$group_description = $row["group_description"];
|
|
|
|
|
if (strlen($group_name) == 0) { $group_name = " "; }
|
|
|
|
|
if (strlen($group_description) == 0) { $group_description = " "; }
|
|
|
|
|
$group_description = wordwrap($group_description, 50, "<br />\n");
|
|
|
|
|
|
|
|
|
|
if (!if_group("superadmin") && $group_name == "superadmin") {
|
|
|
|
|
//hide the superadmin group from non superadmin's
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$strlist .= "<tr>";
|
2014-06-20 01:37:28 +02:00
|
|
|
$strlist .= "<td class='".$row_style[$c]."' nowrap>".$group_name."</td>\n";
|
|
|
|
|
$strlist .= "<td class='".$row_style[$c]."' nowrap>".$group_description."</td>\n";
|
|
|
|
|
$strlist .= "<td class='".$row_style[$c]."' style='text-align: center;' nowrap>\n";
|
|
|
|
|
if (permission_exists('group_add') || if_group("superadmin")) {
|
|
|
|
|
$strlist .= "<a class='' href='group_permissions.php?group_name=".$group_name."' title='".$text['label-group_permissions']."'>".$text['label-group_permissions']."</a> ";
|
|
|
|
|
}
|
|
|
|
|
if (permission_exists('group_member_view') || if_group("superadmin")) {
|
|
|
|
|
$strlist .= "<a class='' href='groupmembers.php?group_name=".$group_name."' title='".$text['label-group_members']."'>".$text['label-group_members']."</a>";
|
|
|
|
|
}
|
|
|
|
|
$strlist .= "</td>\n";
|
|
|
|
|
$strlist .= "<td class='".$row_style[$c]."' style=\"padding: 0px; text-align: center;\" align=\"center\" nowrap>\n";
|
2013-09-27 11:37:59 +02:00
|
|
|
if ($group_protected == "true") {
|
|
|
|
|
$strlist .= " <input type='checkbox' name='group_protected' checked='checked' value='true' onchange=\"window.location='".PROJECT_PATH."/core/users/groups.php?change=false&group_name=".$group_name."';\">\n";
|
2013-09-17 21:06:44 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2013-09-27 11:37:59 +02:00
|
|
|
$strlist .= " <input type='checkbox' name='group_protected' value='false' onchange=\"window.location='".PROJECT_PATH."/core/users/groups.php?change=true&group_name=".$group_name."';\">\n";
|
2013-09-17 21:06:44 +02:00
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
$strlist .= "</td>\n";
|
2014-02-26 07:30:14 +01:00
|
|
|
$strlist .= "<td class='list_control_icons' style='width: 25px;'>";
|
|
|
|
|
$strlist .= "<a href='groupdelete.php?id=$group_uuid' onclick=\"return confirm('".$text['confirm-delete']."')\" alt='".$text['button-delete']."'>$v_link_label_delete</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
$strlist .= "</td>\n";
|
|
|
|
|
$strlist .= "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
if ($c==0) { $c=1; } else { $c=0; }
|
|
|
|
|
$count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$strlist .= "<tr>\n";
|
2014-02-26 07:30:14 +01:00
|
|
|
$strlist .= "<td colspan='4'> </td>";
|
|
|
|
|
$strlist .= "<td class='list_control_icons' style='width: 25px;'>";
|
2012-06-04 16:58:40 +02:00
|
|
|
if (permission_exists('group_add')) {
|
2014-02-26 07:30:14 +01:00
|
|
|
$strlist .= "<a href='groupadd.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
$strlist .= "</td>\n";
|
|
|
|
|
$strlist .= "</tr>\n";
|
|
|
|
|
|
|
|
|
|
$strlist .= "</table>\n";
|
|
|
|
|
if ($count > 0) {
|
|
|
|
|
echo $strlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "</td>";
|
|
|
|
|
echo "</tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "<br>";
|
|
|
|
|
echo "</div>";
|
|
|
|
|
|
|
|
|
|
//show the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
?>
|