Add a missing file sip_profile_copy.php to the dev branch.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = 'App Manager';
|
||||
$apps[$x]['uuid'] = 'd8704214-75a0-e52f-1336-f0780e29fef8';
|
||||
$apps[$x]['category'] = '';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = '';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'App Manager';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'ef00f229-7890-00c2-bf23-fed5b8fa9fe7';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/apps/apps.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'app_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'app_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'app_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'app_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_apps';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'app_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'primary';
|
||||
$z++;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//get the list of installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as $config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap><b>App Manager</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Manage the applications that are installed.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <th>Name</th>\n";
|
||||
echo " <th>Category</th>\n";
|
||||
echo " <th>Subcategory</th>\n";
|
||||
echo " <th>Version</th>\n";
|
||||
echo " <th>Description</th>\n";
|
||||
//echo "<td align='right' width='42'>\n";
|
||||
//echo " <a href='apps_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
//echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
foreach($apps as $row) {
|
||||
if ($row['uuid'] != "d8704214-75a0-e52f-1336-f0780e29fef8") {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' nowrap='nowrap'>".$row['name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['category']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['subcategory']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['version']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."' width='35%'>".$row['description']['en']." </td>\n";
|
||||
echo " <td valign='top' align='left' nowrap='nowrap' width='42'>\n";
|
||||
echo " <a href='apps_edit.php?id=".$row['uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='apps_delete.php?id=".$row['uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,95 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET) > 0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$app_uuid = $_GET["id"];
|
||||
//get the list of installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as $config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
//find the app using the $app_uuid
|
||||
foreach ($apps as &$row) {
|
||||
if ($row["uuid"] == $app_uuid) {
|
||||
$name = $row['name'];
|
||||
if ($row["uuid"] == $app_uuid && $row['category'] != "Core") {
|
||||
//delete the app from the menu
|
||||
foreach ($row['menu'] as &$menu) {
|
||||
//delete menu groups and permissions from the database
|
||||
$sql = "delete from v_menu_item_groups ";
|
||||
$sql .= "where menu_item_uuid = '".$menu['uuid']."' ";
|
||||
$db->query($sql);
|
||||
|
||||
$sql = "delete from v_menu_items ";
|
||||
$sql .= "where menu_item_uuid = '".$menu['uuid']."' ";
|
||||
$db->query($sql);
|
||||
|
||||
//delete the app from the file system
|
||||
if (strlen($menu['path']) > 0) {
|
||||
system('rm -rf '.dirname($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.$menu['path']));
|
||||
}
|
||||
}
|
||||
|
||||
//delete the group permissions for the app
|
||||
foreach ($row['permissions'] as &$permission) {
|
||||
$sql = "delete from v_group_permissions ";
|
||||
$sql .= "where permission_name = '".$permission['name']."' ";
|
||||
$db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=apps.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,215 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$app_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$app_enabled = check_str($_POST["app_enabled"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$app_uuid = check_str($_POST["app_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($app_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$sql = "insert into v_apps ";
|
||||
$sql .= "(";
|
||||
$sql .= "app_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."' ";
|
||||
$sql .= ")";
|
||||
//$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=apps.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_apps set ";
|
||||
$sql .= "app_uuid = '$app_uuid' ";
|
||||
$sql .= "where app_uuid = '$app_uuid'";
|
||||
//$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=apps.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$app_uuid = $_GET["id"];
|
||||
//get the list of installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as $config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
foreach ($apps as &$row) {
|
||||
if ($row["uuid"] == $app_uuid) {
|
||||
$name = $row['name'];
|
||||
$category = $row['category'];
|
||||
$subcategory = $row['subcategory'];
|
||||
$version = $row['version'];
|
||||
$description = $row['description']['en'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>$name</b></td>\n";
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='apps.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Manage the applications that are installed.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Category:\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " $category \n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Subcategory:\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " $subcategory \n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Version:\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " $version \n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Description:\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class='vtable' align='left'>\n";
|
||||
echo " $description \n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='app_uuid' value='$app_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
|
||||
if (if_group("superadmin")) {
|
||||
|
||||
$fh = fopen($db_file_path.'/'.$dbfilename, 'r+b');
|
||||
$contents = fread($fh, filesize($db_file_path.'/'.$dbfilename));
|
||||
|
||||
header("Content-disposition: attachment; filename=$dbfilename");
|
||||
header("Content-Type: application/force-download");
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header("Content-Length: ".strlen($contents));
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: 0");
|
||||
|
||||
echo $contents;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
|
||||
if (if_group("superadmin")) {
|
||||
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
||||
echo "<tr>\n";
|
||||
echo " <th colspan='2' align='left'>Backup</th>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " <a href='".PROJECT_PATH."/core/backup/backup.php'>download</a> \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"row_style1\">\n";
|
||||
echo " <br />\n";
|
||||
echo "To backup your application click on the download link and then choose \n";
|
||||
echo "a safe location on your computer to save the file. You may want to \n";
|
||||
echo "save the backup to more than one computer to prevent the backup from being lost. \n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "\n";
|
||||
|
||||
echo "<span class=\"\" ><strong></strong></span><br>\n";
|
||||
echo "<br>";
|
||||
echo "<br><br>";
|
||||
|
||||
/*
|
||||
echo "<span class=\"\" >Restore Application</span><br>\n";
|
||||
echo "<div class='borderlight' style='padding:10px;'>\n";
|
||||
//Browse to Backup File
|
||||
echo "Click on 'Browse' then locate and select the application backup file named '.bak'. \n";
|
||||
echo "Then click on 'Restore.' \n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<form name='frmrestore' method='post' action='restore2.php'>";
|
||||
echo " <table border='0' cellpadding='0' cellspacing='0'>";
|
||||
echo " <tr>\n";
|
||||
echo " <td class='' colspan='2' nowrap align='left'>\n";
|
||||
echo " <table width='200'><tr>";
|
||||
echo " <td><input type='file' class='frm' onChange='frmrestore.fileandpath.value = frmrestore.filename.value;' style='font-family: verdana; font-size: 11px;' name='filename'></td>";
|
||||
echo " <td>";
|
||||
echo " <input type='hidden' name='fileandpath' value=''>\n";
|
||||
echo " <input type='submit' class='btn' value='Restore'>\n";
|
||||
echo " </td>";
|
||||
echo " </tr></table>";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</form>\n";
|
||||
echo "</div>";
|
||||
|
||||
echo "</div>";
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Databases';
|
||||
$apps[$x]['uuid'] = '8d229b6d-1383-fcec-74c6-4ce1682479e2';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'Storeds database connection information.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Databases';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'ebbd754d-ca74-d5b1-a77e-9206ba3ecc3f';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/databases/databases.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'database_view';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'database_add';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][2]['name'] = 'database_edit';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][3]['name'] = 'database_delete';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_databases';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'database_connection_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT PRIMARY KEY';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'database_connection_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Select the database type.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_host';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_host';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the host name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_port';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_port';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the port number.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the database name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_username';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_username';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the database username.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_password';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_password';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the database password.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_path';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_path';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the database file path.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'database_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'db_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the description.';
|
||||
$z++;
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
$sql = "";
|
||||
$sql .= "delete from v_databases ";
|
||||
$sql .= "where database_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=databases.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,346 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$database_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//clear the values
|
||||
$database_type = '';
|
||||
$database_host = '';
|
||||
$database_port = '';
|
||||
$database_name = '';
|
||||
$database_username = '';
|
||||
$database_password = '';
|
||||
$database_path = '';
|
||||
$database_description = '';
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$database_type = check_str($_POST["database_type"]);
|
||||
$database_host = check_str($_POST["database_host"]);
|
||||
$database_port = check_str($_POST["database_port"]);
|
||||
$database_name = check_str($_POST["database_name"]);
|
||||
$database_username = check_str($_POST["database_username"]);
|
||||
$database_password = check_str($_POST["database_password"]);
|
||||
$database_path = check_str($_POST["database_path"]);
|
||||
$database_description = check_str($_POST["database_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$database_uuid = check_str($_POST["database_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($database_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
|
||||
//if (strlen($database_host) == 0) { $msg .= "Please provide: Host<br>\n"; }
|
||||
//if (strlen($database_port) == 0) { $msg .= "Please provide: Port<br>\n"; }
|
||||
//if (strlen($database_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
//if (strlen($database_username) == 0) { $msg .= "Please provide: Username<br>\n"; }
|
||||
//if (strlen($database_password) == 0) { $msg .= "Please provide: Password<br>\n"; }
|
||||
//if (strlen($database_path) == 0) { $msg .= "Please provide: Path<br>\n"; }
|
||||
//if (strlen($database_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$database_uuid = uuid();
|
||||
$sql = "insert into v_databases ";
|
||||
$sql .= "(";
|
||||
//$sql .= "domain_uuid, ";
|
||||
$sql .= "database_uuid, ";
|
||||
$sql .= "database_type, ";
|
||||
$sql .= "database_host, ";
|
||||
$sql .= "database_port, ";
|
||||
$sql .= "database_name, ";
|
||||
$sql .= "database_username, ";
|
||||
$sql .= "database_password, ";
|
||||
$sql .= "database_path, ";
|
||||
$sql .= "database_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
//$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$database_uuid', ";
|
||||
$sql .= "'$database_type', ";
|
||||
$sql .= "'$database_host', ";
|
||||
$sql .= "'$database_port', ";
|
||||
$sql .= "'$database_name', ";
|
||||
$sql .= "'$database_username', ";
|
||||
$sql .= "'$database_password', ";
|
||||
$sql .= "'$database_path', ";
|
||||
$sql .= "'$database_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=databases.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_databases set ";
|
||||
$sql .= "database_type = '$database_type', ";
|
||||
$sql .= "database_host = '$database_host', ";
|
||||
$sql .= "database_port = '$database_port', ";
|
||||
$sql .= "database_name = '$database_name', ";
|
||||
$sql .= "database_username = '$database_username', ";
|
||||
$sql .= "database_password = '$database_password', ";
|
||||
$sql .= "database_path = '$database_path', ";
|
||||
$sql .= "database_description = '$database_description' ";
|
||||
$sql .= "where database_uuid = '$database_uuid' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=databases.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$database_uuid = $_GET["id"];
|
||||
$sql = "select * from v_databases ";
|
||||
$sql .= "where database_uuid = '$database_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$database_type = $row["database_type"];
|
||||
$database_host = $row["database_host"];
|
||||
$database_port = $row["database_port"];
|
||||
$database_name = $row["database_name"];
|
||||
$database_username = $row["database_username"];
|
||||
$database_password = $row["database_password"];
|
||||
$database_path = $row["database_path"];
|
||||
$database_description = $row["database_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='3' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align=\"left\" width='30%' nowrap=\"nowrap\"><b>Database Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align=\"left\" width='30%' nowrap=\"nowrap\"><b>Database Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align=\"right\"><input type='button' class='btn' name='' alt='back' onclick=\"window.location='databases.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align=\"left\" colspan='2'>\n";
|
||||
echo "Database connection information.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Type:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='database_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($database_type == "sqlite") {
|
||||
echo " <option value='sqlite' selected='selected'>sqlite</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='sqlite'>sqlite</option>\n";
|
||||
}
|
||||
if ($database_type == "odbc") {
|
||||
echo " <option value='odbc' selected='selected'>odbc</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='odbc'>odbc</option>\n";
|
||||
}
|
||||
if ($database_type == "pgsql") {
|
||||
echo " <option value='pgsql' selected='selected'>pgsql</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='pgsql'>pgsql</option>\n";
|
||||
}
|
||||
if ($database_type == "mysql") {
|
||||
echo " <option value='mysql' selected='selected'>mysql</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='mysql'>mysql</option>\n";
|
||||
}
|
||||
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "Select the database type.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Host:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='database_host' maxlength='255' value=\"$database_host\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the host name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Port:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='database_port' maxlength='255' value=\"$database_port\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the port number.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='database_name' maxlength='255' value=\"$database_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the database name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Username:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='database_username' maxlength='255' value=\"$database_username\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the database username.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Password:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='database_password' maxlength='255' value=\"$database_password\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the database password.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Path:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='database_path' maxlength='255' value=\"$database_path\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the database file path.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='database_description' maxlength='255' value=\"$database_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='database_uuid' value='$database_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,162 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Databases</b></td>\n";
|
||||
echo " <td width='50%' align=\"right\"> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align=\"left\" colspan='2'>\n";
|
||||
echo " Database information.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = " select count(*) as num_rows from v_databases ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = " select * from v_databases ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('database_type', 'Type', $order_by, $order);
|
||||
echo th_order_by('database_host', 'Host', $order_by, $order);
|
||||
//echo th_order_by('database_port', 'Port', $order_by, $order);
|
||||
echo th_order_by('database_name', 'Name', $order_by, $order);
|
||||
//echo th_order_by('database_username', 'Username', $order_by, $order);
|
||||
//echo th_order_by('database_path', 'Path', $order_by, $order);
|
||||
echo th_order_by('database_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='database_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_type']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_host']." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_port']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_name']." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_username']." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_path']." </td>\n";
|
||||
echo " <td valign='top' class='row_stylebg'>".$row['database_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='database_edit.php?id=".$row['database_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='database_delete.php?id=".$row['database_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='10' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='database_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Default Settings';
|
||||
$apps[$x]['guid'] = '2c2453c0-1bea-4475-9f44-4d969650de09';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'Default settings that apply to all domains.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Default Settings';
|
||||
$apps[$x]['menu'][0]['uuid'] = '834b2739-9e99-4345-9b0b-7ec3ca332b67';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/default_settings/default_settings.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'default_setting_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'default_setting_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'default_setting_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_default_settings';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the category.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_subcategory';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the subcategory.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_value';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the value.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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-2010
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,190 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>Default Settings</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Settings used for all domains.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "";
|
||||
$sql .= " select count(*) as num_rows from v_default_settings ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the domain list
|
||||
$sql = "";
|
||||
$sql .= " select * from v_default_settings ";
|
||||
if (strlen($order_by) == 0) {
|
||||
$sql .= "order by default_setting_category, default_setting_subcategory asc ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by $order_by $order ";
|
||||
}
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
$previous_category = '';
|
||||
foreach($result as $row) {
|
||||
if ($previous_category != $row['default_setting_category']) {
|
||||
echo "<tr><td colspan='4' align='left'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <b>".ucfirst($row['default_setting_category'])."</b> </td></tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('default_setting_subcategory', 'Category', $order_by, $order);
|
||||
echo th_order_by('default_setting_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('default_setting_value', 'Value', $order_by, $order);
|
||||
echo th_order_by('default_setting_enabled', 'Enabled', $order_by, $order);
|
||||
echo th_order_by('default_setting_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='default_settings_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_subcategory']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>\n";
|
||||
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
$name = $row['default_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "where menu_uuid = '".$row['default_setting_value']."' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
echo $sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
} else {
|
||||
echo $row['default_setting_value'];
|
||||
}
|
||||
echo " \n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_enabled']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='default_settings_edit.php?id=".$row['default_setting_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='default_settings_delete.php?id=".$row['default_setting_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$previous_category = $row['default_setting_category'];
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='default_settings_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
$sql = "";
|
||||
$sql .= "delete from v_default_settings ";
|
||||
$sql .= "where default_setting_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=default_settings_edit.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,372 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$default_setting_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$default_setting_category = check_str($_POST["default_setting_category"]);
|
||||
$default_setting_subcategory = check_str($_POST["default_setting_subcategory"]);
|
||||
$default_setting_name = check_str($_POST["default_setting_name"]);
|
||||
$default_setting_value = check_str($_POST["default_setting_value"]);
|
||||
$default_setting_enabled = check_str($_POST["default_setting_enabled"]);
|
||||
$default_setting_description = check_str($_POST["default_setting_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$default_setting_uuid = check_str($_POST["default_setting_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($default_setting_category) == 0) { $msg .= "Please provide: Category<br>\n"; }
|
||||
//if (strlen($default_setting_subcategory) == 0) { $msg .= "Please provide: Subcategory<br>\n"; }
|
||||
//if (strlen($default_setting_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
//if (strlen($default_setting_value) == 0) { $msg .= "Please provide: Value<br>\n"; }
|
||||
//if (strlen($default_setting_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
|
||||
//if (strlen($default_setting_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$sql = "insert into v_default_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "default_setting_uuid, ";
|
||||
$sql .= "default_setting_category, ";
|
||||
$sql .= "default_setting_subcategory, ";
|
||||
$sql .= "default_setting_name, ";
|
||||
$sql .= "default_setting_value, ";
|
||||
$sql .= "default_setting_enabled, ";
|
||||
$sql .= "default_setting_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$default_setting_category', ";
|
||||
$sql .= "'$default_setting_subcategory', ";
|
||||
$sql .= "'$default_setting_name', ";
|
||||
$sql .= "'$default_setting_value', ";
|
||||
$sql .= "'$default_setting_enabled', ";
|
||||
$sql .= "'$default_setting_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=default_settings.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_default_settings set ";
|
||||
$sql .= "default_setting_category = '$default_setting_category', ";
|
||||
$sql .= "default_setting_subcategory = '$default_setting_subcategory', ";
|
||||
$sql .= "default_setting_name = '$default_setting_name', ";
|
||||
$sql .= "default_setting_value = '$default_setting_value', ";
|
||||
$sql .= "default_setting_enabled = '$default_setting_enabled', ";
|
||||
$sql .= "default_setting_description = '$default_setting_description' ";
|
||||
$sql .= "where default_setting_uuid = '$default_setting_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=default_settings.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$default_setting_uuid = $_GET["id"];
|
||||
$sql = "select * from v_default_settings ";
|
||||
$sql .= "where default_setting_uuid = '$default_setting_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$default_setting_category = $row["default_setting_category"];
|
||||
$default_setting_subcategory = $row["default_setting_subcategory"];
|
||||
$default_setting_name = $row["default_setting_name"];
|
||||
$default_setting_value = $row["default_setting_value"];
|
||||
$default_setting_enabled = $row["default_setting_enabled"];
|
||||
$default_setting_description = $row["default_setting_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Default Setting Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Default Setting Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='default_settings.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Settings used for all domains.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Category:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_category' maxlength='255' value=\"$default_setting_category\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Subcategory:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_subcategory' maxlength='255' value=\"$default_setting_subcategory\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_name' maxlength='255' value=\"$default_setting_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Value:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
$name = $row['default_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "order by menu_language, menu_name asc ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as $sub_row) {
|
||||
if (strtolower($row['default_setting_value']) == strtolower($sub_row["menu_uuid"])) {
|
||||
echo " <option value='".$sub_row["menu_uuid"]."' selected='selected'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$sub_row["menu_uuid"]."'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."</option>\n";
|
||||
}
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
||||
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//add all the themes to the list
|
||||
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
|
||||
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
|
||||
while (false !== ($dir_name = readdir($handle))) {
|
||||
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && is_dir($theme_dir.'/'.$dir_name)) {
|
||||
$dir_label = str_replace('_', ' ', $dir_name);
|
||||
$dir_label = str_replace('-', ' ', $dir_label);
|
||||
if ($dir_name == $row['default_setting_value']) {
|
||||
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='$dir_name'>$dir_label</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "time_zone" && $name == "name" ) {
|
||||
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//$list = DateTimeZone::listAbbreviations();
|
||||
$time_zone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$previous_category = '';
|
||||
$x = 0;
|
||||
foreach ($time_zone_identifiers as $key => $val) {
|
||||
$time_zone = explode("/", $val);
|
||||
$category = $time_zone[0];
|
||||
if ($category != $previous_category) {
|
||||
if ($x > 0) {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " <optgroup label='".$category."'>\n";
|
||||
}
|
||||
if (strlen($val) > 0) {
|
||||
$time_zone_offset = get_time_zone_offset($val)/3600;
|
||||
$time_zone_offset_hours = floor($time_zone_offset);
|
||||
$time_zone_offset_minutes = ($time_zone_offset - $time_zone_offset_hours) * 60;
|
||||
$time_zone_offset_minutes = number_pad($time_zone_offset_minutes, 2);
|
||||
if ($time_zone_offset > 0) {
|
||||
$time_zone_offset_hours = number_pad($time_zone_offset_hours, 2);
|
||||
$time_zone_offset_hours = "+".$time_zone_offset_hours;
|
||||
}
|
||||
else {
|
||||
$time_zone_offset_hours = str_replace("-", "", $time_zone_offset_hours);
|
||||
$time_zone_offset_hours = "-".number_pad($time_zone_offset_hours, 2);
|
||||
}
|
||||
}
|
||||
if ($val == $row['default_setting_value']) {
|
||||
echo " <option value='".$val."' selected='selected'>(UTC ".$time_zone_offset_hours.":".$time_zone_offset_minutes.") ".$val."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$val."'>(UTC ".$time_zone_offset_hours.":".$time_zone_offset_minutes.") ".$val."</option>\n";
|
||||
}
|
||||
$previous_category = $category;
|
||||
$x++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
} else {
|
||||
echo " <input class='formfld' type='text' name='default_setting_value' maxlength='255' value=\"$default_setting_value\">\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
echo "Enter the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Enabled:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='default_setting_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($default_setting_enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($default_setting_enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "Choose to enable or disable the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_description' maxlength='255' value=\"$default_setting_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='default_setting_uuid' value='$default_setting_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Domains';
|
||||
$apps[$x]['guid'] = 'b31e723a-bf70-670c-a49b-470d2a232f71';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'Manage a single domain or multiple domains for multi-tenant.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Domains';
|
||||
$apps[$x]['menu'][0]['uuid'] = '4fa7e90b-6d6c-12d4-712f-62857402b801';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/domains/domains.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_setting_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_setting_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_setting_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the domain name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the description.';
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_domain_settings';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the category.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_subcategory';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the subcategory.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_value';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the value.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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-2010
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//remove external from the end of the gateway path
|
||||
if (substr($v_gateways_dir, -8) == "external") {
|
||||
//$v_gateways_dir = substr($v_gateways_dir, 0, (strlen($v_gateways_dir)-9));
|
||||
//$sql = "update v_domain_settings set ";
|
||||
//$sql .= "v_gateways_dir = '$v_gateways_dir' ";
|
||||
//$sql .= "where domain_uuid = '$domain_uuid'";
|
||||
//$db->exec($sql);
|
||||
//unset($sql);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,189 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
//echo "<table width='100%' border='0'>\n";
|
||||
//echo " <tr>\n";
|
||||
//echo " <td width='50%' nowrap><b>Domain Settings</b></td>\n";
|
||||
//echo " <td width='50%' align='right'> </td>\n";
|
||||
//echo " </tr>\n";
|
||||
//echo " <tr>\n";
|
||||
//echo " <td colspan='2'>\n";
|
||||
//echo " Settings used for each domain.<br /><br />\n";
|
||||
//echo " </td>\n";
|
||||
//echo " </tr>\n";
|
||||
//echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = " select count(*) as num_rows from v_domain_settings ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the domain list
|
||||
$sql = "";
|
||||
$sql .= " select * from v_domain_settings ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
$previous_category = '';
|
||||
foreach($result as $row) {
|
||||
if ($previous_category != $row['domain_setting_category']) {
|
||||
echo "<tr><td colspan='4' align='left'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo " <b>".ucfirst($row['domain_setting_category'])."</b> </td></tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('domain_setting_subcategory', 'Category', $order_by, $order);
|
||||
echo th_order_by('domain_setting_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('domain_setting_value', 'Value', $order_by, $order);
|
||||
echo th_order_by('domain_setting_enabled', 'Enabled', $order_by, $order);
|
||||
echo th_order_by('domain_setting_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='domain_settings_edit.php?domain_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_subcategory']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>\n";
|
||||
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
$name = $row['domain_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "where menu_uuid = '".$row['domain_setting_value']."' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
echo $sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
} else {
|
||||
echo $row['domain_setting_value'];
|
||||
}
|
||||
echo " \n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_enabled']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='domain_settings_edit.php?domain_uuid=".$row['domain_uuid']."&id=".$row['domain_setting_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='domain_settings_delete.php?domain_uuid=".$row['domain_uuid']."&id=".$row['domain_setting_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$previous_category = $row['domain_setting_category'];
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='domain_settings_edit.php?domain_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
$sql = "";
|
||||
$sql .= "delete from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and domain_setting_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains_edit.php?id=$domain_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,369 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$domain_setting_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["domain_uuid"]) > 0) {
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$domain_setting_category = check_str($_POST["domain_setting_category"]);
|
||||
$domain_setting_subcategory = check_str($_POST["domain_setting_subcategory"]);
|
||||
$domain_setting_name = check_str($_POST["domain_setting_name"]);
|
||||
$domain_setting_value = check_str($_POST["domain_setting_value"]);
|
||||
$domain_setting_enabled = check_str($_POST["domain_setting_enabled"]);
|
||||
$domain_setting_description = check_str($_POST["domain_setting_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$domain_setting_uuid = check_str($_POST["domain_setting_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
|
||||
//if (strlen($domain_setting_category) == 0) { $msg .= "Please provide: Category<br>\n"; }
|
||||
//if (strlen($domain_setting_subcategory) == 0) { $msg .= "Please provide: Subcategory<br>\n"; }
|
||||
//if (strlen($domain_setting_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
//if (strlen($domain_setting_value) == 0) { $msg .= "Please provide: Value<br>\n"; }
|
||||
//if (strlen($domain_setting_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
|
||||
//if (strlen($domain_setting_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$sql = "insert into v_domain_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "domain_setting_uuid, ";
|
||||
$sql .= "domain_setting_category, ";
|
||||
$sql .= "domain_setting_subcategory, ";
|
||||
$sql .= "domain_setting_name, ";
|
||||
$sql .= "domain_setting_value, ";
|
||||
$sql .= "domain_setting_enabled, ";
|
||||
$sql .= "domain_setting_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_setting_category', ";
|
||||
$sql .= "'$domain_setting_subcategory', ";
|
||||
$sql .= "'$domain_setting_name', ";
|
||||
$sql .= "'$domain_setting_value', ";
|
||||
$sql .= "'$domain_setting_enabled', ";
|
||||
$sql .= "'$domain_setting_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains_edit.php?id=$domain_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_domain_settings set ";
|
||||
$sql .= "domain_setting_category = '$domain_setting_category', ";
|
||||
$sql .= "domain_setting_subcategory = '$domain_setting_subcategory', ";
|
||||
$sql .= "domain_setting_name = '$domain_setting_name', ";
|
||||
$sql .= "domain_setting_value = '$domain_setting_value', ";
|
||||
$sql .= "domain_setting_enabled = '$domain_setting_enabled', ";
|
||||
$sql .= "domain_setting_description = '$domain_setting_description' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and domain_setting_uuid = '$domain_setting_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains_edit.php?id=$domain_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$domain_setting_uuid = $_GET["id"];
|
||||
$sql = "select * from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and domain_setting_uuid = '$domain_setting_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$domain_setting_category = $row["domain_setting_category"];
|
||||
$domain_setting_subcategory = $row["domain_setting_subcategory"];
|
||||
$domain_setting_name = $row["domain_setting_name"];
|
||||
$domain_setting_value = $row["domain_setting_value"];
|
||||
$domain_setting_enabled = $row["domain_setting_enabled"];
|
||||
$domain_setting_description = $row["domain_setting_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Setting Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Setting Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='domains_edit.php?id=$domain_uuid'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Settings used for each domain.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Category:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_category' maxlength='255' value=\"$domain_setting_category\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Subcategory:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_subcategory' maxlength='255' value=\"$domain_setting_subcategory\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_name' maxlength='255' value=\"$domain_setting_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Value:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
$name = $row['domain_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "order by menu_language, menu_name asc ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as $sub_row) {
|
||||
if (strtolower($row['domain_setting_value']) == strtolower($sub_row["menu_uuid"])) {
|
||||
echo " <option value='".$sub_row["menu_uuid"]."' selected='selected'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$sub_row["menu_uuid"]."'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."</option>\n";
|
||||
}
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//add all the themes to the list
|
||||
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
|
||||
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
|
||||
while (false !== ($dir_name = readdir($handle))) {
|
||||
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && is_dir($theme_dir.'/'.$dir_name)) {
|
||||
$dir_label = str_replace('_', ' ', $dir_name);
|
||||
$dir_label = str_replace('-', ' ', $dir_label);
|
||||
if ($dir_name == $row['domain_setting_value']) {
|
||||
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='$dir_name'>$dir_label</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "time" && $name == "zone" ) {
|
||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//$list = DateTimeZone::listAbbreviations();
|
||||
$time_zone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$previous_category = '';
|
||||
$x = 0;
|
||||
foreach ($time_zone_identifiers as $key => $val) {
|
||||
$time_zone = explode("/", $val);
|
||||
$category = $time_zone[0];
|
||||
if ($category != $previous_category) {
|
||||
if ($x > 0) {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " <optgroup label='".$category."'>\n";
|
||||
}
|
||||
if ($val == $row['domain_setting_value']) {
|
||||
echo " <option value='".$val."' selected='selected'>".$val."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$val."'>".$val."</option>\n";
|
||||
}
|
||||
$previous_category = $category;
|
||||
$x++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
break;
|
||||
} else {
|
||||
echo " <input class='formfld' type='text' name='domain_setting_value' maxlength='255' value=\"$domain_setting_value\">\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
echo "Enter the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Enabled:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='domain_setting_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($domain_setting_enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($domain_setting_enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "Choose to enable or disable the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_description' maxlength='255' value=\"$domain_setting_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='domain_setting_uuid' value='$domain_setting_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,197 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//change the tenant
|
||||
if (strlen($_GET["domain_uuid"]) > 0 && $_GET["domain_change"] == "true") {
|
||||
//get the domain_uuid
|
||||
$sql = "select * from v_domains ";
|
||||
$sql .= "order by domain_name asc ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
if (count($result) == 0) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
else {
|
||||
if ($row['domain_name'] == $domain_array[0] || $row['domain_name'] == 'www.'.$domain_array[0]) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name'];
|
||||
}
|
||||
}
|
||||
unset($result, $prep_statement);
|
||||
|
||||
//update the domain session variables
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
$_SESSION['domain_uuid'] = $domain_uuid;
|
||||
$_SESSION["domain_name"] = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||
$_SESSION['domain']['template']['name'] = $_SESSION['domains'][$domain_uuid]['template_name'];
|
||||
//clear the menu session so that it is regenerated for the selected domain
|
||||
$_SESSION["menu"] = '';
|
||||
//clear the extension array so that it is regenerated for the selected domain
|
||||
unset($_SESSION['extension_array']);
|
||||
//set the context
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$_SESSION["context"] = $_SESSION["domain_name"];
|
||||
}
|
||||
else {
|
||||
$_SESSION["context"] = 'default';
|
||||
}
|
||||
}
|
||||
|
||||
//includes
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>Domains</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Control the list of domains to manage.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_domains ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_domains ";
|
||||
$sql .= "order by domain_name asc ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('domain_name', 'Domain', $order_by, $order);
|
||||
echo th_order_by('domain_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='domains_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='domains_edit.php?id=".$row['domain_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='domains_delete.php?id=".$row['domain_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='3' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='domains_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,195 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id) > 0) {
|
||||
//get the domain using the id
|
||||
$sql = "select * from v_domains ";
|
||||
$sql .= "where domain_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$domain_name = $row["domain_name"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//get the domain settings
|
||||
$sql = "select * from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '".$id."' ";
|
||||
$sql .= "and domain_setting_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$name = $row['domain_setting_name'];
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
$_SESSION[$category][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
else {
|
||||
//$$category[$subcategory][$name] = $row['domain_setting_value'];
|
||||
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
}
|
||||
|
||||
//get the $apps array from the installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
//delete the domain data from all tables in the database
|
||||
$db->beginTransaction();
|
||||
foreach ($apps as &$app) {
|
||||
foreach ($app['db'] as $row) {
|
||||
$table_name = $row['table'];
|
||||
foreach ($row['fields'] as $field) {
|
||||
if ($field['name'] == "domain_uuid") {
|
||||
$sql = "delete from $table_name where domain_uuid = '$id' ";
|
||||
$db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->commit();
|
||||
|
||||
if (strlen($domain_name) > 0) {
|
||||
//set the needle
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$v_needle = 'v_'.$domain_name.'_';
|
||||
}
|
||||
else {
|
||||
$v_needle = 'v_';
|
||||
}
|
||||
|
||||
//delete the dialplan
|
||||
unlink($_SESSION['switch']['dialplan']['dir'].'/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['dialplan']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the dialplan public
|
||||
unlink($_SESSION['switch']['dialplan']['dir'].'/public/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['dialplan']['dir'].'/public/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the extension
|
||||
unlink($_SESSION['switch']['extensions']['dir'].'/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['extensions']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['extensions']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete fax
|
||||
if (strlen($_SESSION['switch']['storage']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['storage']['dir'].'/fax/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the gateways
|
||||
if($dh = opendir($_SESSION['switch']['gateways']['dir'])) {
|
||||
$files = Array();
|
||||
while($file = readdir($dh)) {
|
||||
if($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if(is_dir($dir . "/" . $file)) {
|
||||
//this is a directory do nothing
|
||||
} else {
|
||||
//check if file extension is xml
|
||||
if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
||||
unlink($_SESSION['switch']['gateways']['dir']."/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
|
||||
//delete the ivr menu
|
||||
if($dh = opendir($_SESSION['switch']['conf']['dir']."/ivr_menus/")) {
|
||||
$files = Array();
|
||||
while($file = readdir($dh)) {
|
||||
if($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if(is_dir($dir . "/" . $file)) {
|
||||
//this is a directory
|
||||
} else {
|
||||
if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
||||
unlink($_SESSION['switch']['conf']['dir']."/ivr_menus/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
|
||||
//delete the recordings
|
||||
if (strlen($_SESSION['switch'][recordings]['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete voicemail
|
||||
if (strlen($_SESSION['switch']['voicemail']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['voicemail']['dir'].'/'.$domain_name);
|
||||
}
|
||||
}
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the domains session array to update it
|
||||
unset($_SESSION["domains"]);
|
||||
unset($_SESSION["domain_uuid"]);
|
||||
unset($_SESSION["domain_name"]);
|
||||
unset($_SESSION['domain']);
|
||||
unset($_SESSION['switch']);
|
||||
}
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,216 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$domain_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$domain_name = check_str($_POST["domain_name"]);
|
||||
$domain_description = check_str($_POST["domain_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$domain_uuid = check_str($_POST["domain_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($domain_name) == 0) { $msg .= "Please provide: Domain<br>\n"; }
|
||||
//if (strlen($domain_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$sql = "insert into v_domains ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "domain_name, ";
|
||||
$sql .= "domain_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_name', ";
|
||||
$sql .= "'$domain_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_domains set ";
|
||||
$sql .= "domain_name = '$domain_name', ";
|
||||
$sql .= "domain_description = '$domain_description' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//upgrade the domains
|
||||
require_once "core/upgrade/upgrade_domains.php";
|
||||
|
||||
//clear the domains session array to update it
|
||||
unset($_SESSION["domains"]);
|
||||
unset($_SESSION["domain_uuid"]);
|
||||
unset($_SESSION["domain_name"]);
|
||||
unset($_SESSION['domain']);
|
||||
unset($_SESSION['switch']);
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
if ($action == "update") {
|
||||
echo "Update Complete\n";
|
||||
}
|
||||
if ($action == "add") {
|
||||
echo "Add Complete\n";
|
||||
}
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$domain_uuid = $_GET["id"];
|
||||
$sql = "select * from v_domains ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$domain_name = $row["domain_name"];
|
||||
$domain_description = $row["domain_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='domains.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Control the list of domains to manage.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Domain:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value=\"$domain_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the domain name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_description' maxlength='255' value=\"$domain_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
if ($action == "update") {
|
||||
require "domain_settings.php";
|
||||
}
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,232 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "Menu Manager";
|
||||
$apps[$x]['uuid'] = 'f4b3b3d2-6287-489c-2a00-64529e46f2d7';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'The menu can be customized using this tool.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Menu Manager';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'da3a9ab4-c28e-ea8d-50cc-e8405ac8e76e';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
//$apps[$x]['menu'][0]['path'] = '/core/menu/menu_list.php';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/menu/menu.php';
|
||||
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][1]['title']['en'] = 'System';
|
||||
$apps[$x]['menu'][1]['uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
|
||||
$apps[$x]['menu'][1]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][1]['category'] = 'internal';
|
||||
$apps[$x]['menu'][1]['path'] = '/index2.php';
|
||||
$apps[$x]['menu'][1]['order'] = '5';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'user';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][2]['title']['en'] = 'Accounts';
|
||||
$apps[$x]['menu'][2]['uuid'] = 'bc96d773-ee57-0cdd-c3ac-2d91aba61b55';
|
||||
$apps[$x]['menu'][2]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][2]['category'] = 'internal';
|
||||
$apps[$x]['menu'][2]['path'] = '/app/extensions/v_extensions.php';
|
||||
$apps[$x]['menu'][2]['order'] = '10';
|
||||
$apps[$x]['menu'][2]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][3]['title']['en'] = 'Dialplan2';
|
||||
$apps[$x]['menu'][3]['uuid'] = 'b94e8bd9-9eb5-e427-9c26-ff7a6c21552a';
|
||||
$apps[$x]['menu'][3]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][3]['category'] = 'internal';
|
||||
$apps[$x]['menu'][3]['path'] = '/app/dialplan/dialplans.php';
|
||||
$apps[$x]['menu'][3]['order'] = '15';
|
||||
$apps[$x]['menu'][3]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][3]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][4]['title']['en'] = 'Status';
|
||||
$apps[$x]['menu'][4]['uuid'] = '0438b504-8613-7887-c420-c837ffb20cb1';
|
||||
$apps[$x]['menu'][4]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][4]['category'] = 'internal';
|
||||
$apps[$x]['menu'][4]['path'] = '/app/calls_active/v_calls_active_extensions.php';
|
||||
$apps[$x]['menu'][4]['order'] = '25';
|
||||
$apps[$x]['menu'][4]['groups'][] = 'user';
|
||||
$apps[$x]['menu'][4]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][4]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][5]['title']['en'] = 'Advanced';
|
||||
$apps[$x]['menu'][5]['uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][5]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][5]['category'] = 'internal';
|
||||
$apps[$x]['menu'][5]['path'] = '/app/exec/v_exec.php';
|
||||
$apps[$x]['menu'][5]['order'] = '30';
|
||||
$apps[$x]['menu'][5]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'menu_view';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'menu_add';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][2]['name'] = 'menu_edit';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][3]['name'] = 'menu_delete';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][4]['name'] = 'menu_restore';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_menus';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name of the menu.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_language';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the language.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_desc';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the description.';
|
||||
$z++;
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_menu_items';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_menus';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_parent_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_parent_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_title';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_link';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_str';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_protected';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_order';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_desc';
|
||||
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_add_user';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_add_date';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_mod_user';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'menu_item_mod_date';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 2; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_menu_item_groups';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_group_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_menus';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'menu_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'menu_item_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'menu_item_guid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_menu_items';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'menu_item_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//if there are no items in the menu then add the default menu
|
||||
$sql = "SELECT count(*) as count FROM v_menus ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement);
|
||||
if ($sub_result['count'] > 0) {
|
||||
if ($display_type == "text") {
|
||||
echo " Menu: no change\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
//create the uuid
|
||||
$menu_uuid = 'b4750c3f-2a86-b00d-b7d0-345c14eca286';
|
||||
//set the defaults
|
||||
$menu_name = 'default';
|
||||
$menu_language = 'en';
|
||||
$menu_description = '';
|
||||
//add the menu
|
||||
$sql = "insert into v_menus ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_name, ";
|
||||
$sql .= "menu_language, ";
|
||||
$sql .= "menu_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$menu_uuid."', ";
|
||||
$sql .= "'$menu_name', ";
|
||||
$sql .= "'$menu_language', ";
|
||||
$sql .= "'$menu_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//add the menu items
|
||||
require_once "includes/classes/menu.php";
|
||||
$menu = new menu;
|
||||
$menu->db = $db;
|
||||
$menu->menu_uuid = $menu_uuid;
|
||||
$menu->restore();
|
||||
unset($menu);
|
||||
if ($display_type == "text") {
|
||||
echo " Menu: added\n";
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $sub_result);
|
||||
|
||||
//if there are no groups listed in v_menu_item_groups then add the default groups
|
||||
$sql = "SELECT * FROM v_menus ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
foreach($result as $field) {
|
||||
//get the menu_uuid
|
||||
$menu_uuid = $field['menu_uuid'];
|
||||
//check each menu to see if there are items in the menu assigned to it
|
||||
$sql = "";
|
||||
$sql .= "select count(*) as count from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement);
|
||||
if ($sub_result['count'] == 0) {
|
||||
//no menu item groups found add the defaults
|
||||
foreach($apps as $app) {
|
||||
foreach ($app['menu'] as $sub_row) {
|
||||
foreach ($sub_row['groups'] as $group) {
|
||||
//add the record
|
||||
$sql = "insert into v_menu_item_groups ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_item_uuid, ";
|
||||
$sql .= "group_name ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$menu_uuid', ";
|
||||
$sql .= "'".$sub_row['uuid']."', ";
|
||||
$sql .= "'".$group."' ";
|
||||
$sql .= ")";
|
||||
$db->exec($sql);
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>Menu Manager</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Used to customize one or more menus.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = " select count(*) as num_rows from v_menus ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 150;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = " select * from v_menus ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('menu_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('menu_language', 'Language', $order_by, $order);
|
||||
echo th_order_by('menu_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='menu_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_language']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='menu_edit.php?id=".$row['menu_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='menu_delete.php?id=".$row['menu_uuid']."&menu_uuid=".$row['menu_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='5' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='menu_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$menu_uuid = check_str($_GET["menu_uuid"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
//start the database transaction
|
||||
$db->beginTransaction();
|
||||
|
||||
//delete the menu
|
||||
$sql = "";
|
||||
$sql .= "delete from v_menus ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//delete the items in the menu
|
||||
$sql = "";
|
||||
$sql .= "delete from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//delete the menu permissions
|
||||
$sql = "";
|
||||
$sql .= "delete from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
|
||||
//save the changes to the database
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,245 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$menu_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$menu_uuid = check_str($_POST["menu_uuid"]);
|
||||
$menu_name = check_str($_POST["menu_name"]);
|
||||
$menu_language = check_str($_POST["menu_language"]);
|
||||
$menu_description = check_str($_POST["menu_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$menu_uuid = check_str($_POST["menu_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($menu_uuid) == 0) { $msg .= "Please provide: Menu UUID<br>\n"; }
|
||||
//if (strlen($menu_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
//if (strlen($menu_language) == 0) { $msg .= "Please provide: Language<br>\n"; }
|
||||
//if (strlen($menu_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
//create a new unique id
|
||||
$menu_uuid = uuid();
|
||||
|
||||
//start a new menu
|
||||
$sql = "insert into v_menus ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_name, ";
|
||||
$sql .= "menu_language, ";
|
||||
$sql .= "menu_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$menu_uuid."', ";
|
||||
$sql .= "'$menu_name', ";
|
||||
$sql .= "'$menu_language', ";
|
||||
$sql .= "'$menu_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add the default items in the menu
|
||||
require_once "includes/classes/menu.php";
|
||||
$menu = new menu;
|
||||
$menu->db = $db;
|
||||
$menu->menu_uuid = $menu_uuid;
|
||||
$menu->restore();
|
||||
|
||||
//redirect the user back to the main menu
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
//update the menu
|
||||
$sql = "update v_menus set ";
|
||||
$sql .= "menu_name = '$menu_name', ";
|
||||
$sql .= "menu_language = '$menu_language', ";
|
||||
$sql .= "menu_description = '$menu_description' ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//redirect the user back to the main menu
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$menu_uuid = $_GET["id"];
|
||||
$sql = "select * from v_menus ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$menu_uuid = $row["menu_uuid"];
|
||||
$menu_name = $row["menu_name"];
|
||||
$menu_language = $row["menu_language"];
|
||||
$menu_description = $row["menu_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Menu Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Menu Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'>\n";
|
||||
if (permission_exists('menu_restore')) {
|
||||
echo " <input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='menu_restore_default.php?menu_uuid=$menu_uuid&menu_uuid=$menu_uuid';\" />";
|
||||
}
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='menu.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Used to customize one or more menus.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='menu_name' maxlength='255' value=\"$menu_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name of the menu.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Language:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='menu_language' maxlength='255' value=\"$menu_language\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the language.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='menu_description' maxlength='255' value=\"$menu_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='menu_uuid' value='$menu_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//show the menu items
|
||||
require_once "core/menu/menu_item_list.php";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//get the menu uuid
|
||||
$menu_uuid = check_str($_GET["id"]);
|
||||
$menu_item_id = check_str($_GET["menu_item_id"]);
|
||||
|
||||
//delete the item in the menu
|
||||
$sql = "delete from v_menu_items ";
|
||||
$sql .= "where menu_item_id = '$menu_item_id' ";
|
||||
$sql .= "and menu_uuid = '$menu_uuid' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_edit.php?id=$menu_uuid\">\n";
|
||||
echo "<div align='center'>";
|
||||
echo "Delete Completed";
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,464 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit') || permission_exists('menu_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//include the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//get the menu_uuid
|
||||
$menu_uuid = check_str($_REQUEST["id"]);
|
||||
$menu_item_uuid = check_str($_REQUEST['menu_item_uuid']);
|
||||
$group_name = check_str($_REQUEST['group_name']);
|
||||
|
||||
//delete the group from the user
|
||||
if ($_REQUEST["a"] == "delete" && permission_exists("menu_delete")) {
|
||||
//delete the group from the users
|
||||
$sql = "delete from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_uuid = '".$menu_item_uuid."' ";
|
||||
$sql .= "and group_name = '".$group_name."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add a group to the menu
|
||||
if ($_REQUEST["a"] != "delete" && strlen($group_name) > 0 && permission_exists('menu_add')) {
|
||||
//add the group to the menu
|
||||
if (strlen($menu_item_uuid) > 0) {
|
||||
$sql_insert = "insert into v_menu_item_groups ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "menu_uuid, ";
|
||||
$sql_insert .= "menu_item_uuid, ";
|
||||
$sql_insert .= "group_name ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".$menu_uuid."', ";
|
||||
$sql_insert .= "'".$menu_item_uuid."', ";
|
||||
$sql_insert .= "'".$group_name."' ";
|
||||
$sql_insert .= ")";
|
||||
$db->exec($sql_insert);
|
||||
}
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["menu_item_uuid"])) {
|
||||
if (strlen($_REQUEST["menu_item_uuid"]) > 0) {
|
||||
$action = "update";
|
||||
$menu_item_uuid = check_str($_REQUEST["menu_item_uuid"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//get the HTTP POST variables and set them as PHP variables
|
||||
if (count($_POST)>0) {
|
||||
$menu_uuid = check_str($_POST["menu_uuid"]);
|
||||
$menu_item_uuid = check_str($_POST["menu_item_uuid"]);
|
||||
$menu_item_title = check_str($_POST["menu_item_title"]);
|
||||
$menu_item_link = check_str($_POST["menu_item_link"]);
|
||||
$menu_item_category = check_str($_POST["menu_item_category"]);
|
||||
$menu_item_description = check_str($_POST["menu_item_description"]);
|
||||
$menu_item_protected = check_str($_POST["menu_item_protected"]);
|
||||
//$menu_item_uuid = check_str($_POST["menu_item_uuid"]);
|
||||
$menu_item_parent_uuid = check_str($_POST["menu_item_parent_uuid"]);
|
||||
$menu_item_order = check_str($_POST["menu_item_order"]);
|
||||
}
|
||||
|
||||
//when a HTTP POST is available then process it
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
if ($action == "update") {
|
||||
$menu_item_uuid = check_str($_POST["menu_item_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
$msg = '';
|
||||
if (strlen($menu_item_title) == 0) { $msg .= "Please provide: title<br>\n"; }
|
||||
if (strlen($menu_item_category) == 0) { $msg .= "Please provide: category<br>\n"; }
|
||||
//if (strlen($menu_item_link) == 0) { $msg .= "Please provide: menu_item_link<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('menu_add')) {
|
||||
$sql = "SELECT menu_item_order FROM v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_parent_uuid = '$menu_item_parent_uuid' ";
|
||||
$sql .= "order by menu_item_order desc ";
|
||||
$sql .= "limit 1 ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$highest_menu_item_order = $row[menu_item_order];
|
||||
}
|
||||
unset($prep_statement);
|
||||
|
||||
$sql = "insert into v_menu_items ";
|
||||
$sql .= "(";
|
||||
$sql .= "menu_uuid, ";
|
||||
$sql .= "menu_item_title, ";
|
||||
$sql .= "menu_item_link, ";
|
||||
$sql .= "menu_item_category, ";
|
||||
$sql .= "menu_item_description, ";
|
||||
$sql .= "menu_item_protected, ";
|
||||
$sql .= "menu_item_uuid, ";
|
||||
$sql .= "menu_item_parent_uuid, ";
|
||||
$sql .= "menu_item_order, ";
|
||||
$sql .= "menu_item_add_user, ";
|
||||
$sql .= "menu_item_add_date ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$menu_uuid', ";
|
||||
$sql .= "'$menu_item_title', ";
|
||||
$sql .= "'$menu_item_link', ";
|
||||
$sql .= "'$menu_item_category', ";
|
||||
$sql .= "'$menu_item_description', ";
|
||||
$sql .= "'$menu_item_protected', ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
if (strlen($menu_item_parent_uuid) == 0) {
|
||||
$sql .= "null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "'$menu_item_parent_uuid', ";
|
||||
}
|
||||
$sql .= "'".($highest_menu_item_order+1)."', ";
|
||||
$sql .= "'".$_SESSION["username"]."', ";
|
||||
$sql .= "now() ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($action == "update" && permission_exists('menu_edit')) {
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_title = '$menu_item_title', ";
|
||||
$sql .= "menu_item_link = '$menu_item_link', ";
|
||||
$sql .= "menu_item_category = '$menu_item_category', ";
|
||||
$sql .= "menu_item_description = '$menu_item_description', ";
|
||||
$sql .= "menu_item_protected = '$menu_item_protected', ";
|
||||
if (strlen($menu_item_parent_uuid) == 0) {
|
||||
$sql .= "menu_item_parent_uuid = null, ";
|
||||
}
|
||||
else {
|
||||
$sql .= "menu_item_parent_uuid = '$menu_item_parent_uuid', ";
|
||||
}
|
||||
$sql .= "menu_item_order = '$menu_item_order', ";
|
||||
$sql .= "menu_item_mod_user = '".$_SESSION["username"]."', ";
|
||||
$sql .= "menu_item_mod_date = now() ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
|
||||
$count = $db->exec(check_sql($sql));
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=menu_item_edit.php?id=$menu_uuid&menu_item_uuid=$menu_item_uuid&menu_uuid=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Edit Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$menu_item_uuid = $_GET["menu_item_uuid"];
|
||||
|
||||
$sql = "select * from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$menu_item_uuid = $row["menu_item_uuid"];
|
||||
$menu_item_title = $row["menu_item_title"];
|
||||
$menu_item_link = $row["menu_item_link"];
|
||||
$menu_item_category = $row["menu_item_category"];
|
||||
$menu_item_description = $row["menu_item_description"];
|
||||
$menu_item_protected = $row["menu_item_protected"];
|
||||
$menu_item_parent_uuid = $row["menu_item_parent_uuid"];
|
||||
$menu_item_order = $row["menu_item_order"];
|
||||
$menu_item_add_user = $row["menu_item_add_user"];
|
||||
$menu_item_add_date = $row["menu_item_add_date"];
|
||||
//$menu_item_del_user = $row["menu_item_del_user"];
|
||||
//$menu_item_del_date = $row["menu_item_del_date"];
|
||||
$menu_item_mod_user = $row["menu_item_mod_user"];
|
||||
$menu_item_mod_date = $row["menu_item_mod_date"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
}
|
||||
|
||||
//show the content
|
||||
require_once "includes/header.php";
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<table width='100%' cellpadding='6' cellspacing='0'>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' align='left' valign='top' nowrap><b>Menu Item Edit</b></td>\n";
|
||||
echo "<td width='70%' align='right' valign='top'><input type='button' class='btn' name='' alt='back' onclick=\"window.history.back();\" value='Back'><br /><br /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Title:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_title' value='$menu_item_title'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Link:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_link' value='$menu_item_link'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Category:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
echo " <select name=\"menu_item_category\" class='formfld'>\n";
|
||||
echo " <option value=\"\"></option>\n";
|
||||
if ($menu_item_category == "internal") { echo "<option value=\"internal\" selected>internal</option>\n"; } else { echo "<option value=\"internal\">internal</option>\n"; }
|
||||
if ($menu_item_category == "external") { echo "<option value=\"external\" selected>external</option>\n"; } else { echo "<option value=\"external\">external</option>\n"; }
|
||||
if ($menu_item_category == "email") { echo "<option value=\"email\" selected>email</option>\n"; } else { echo "<option value=\"email\">email</option>\n"; }
|
||||
echo " </select>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Parent Menu:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
$sql = "SELECT * FROM v_menu_items ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "order by menu_item_title asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo "<select name=\"menu_item_parent_uuid\" class='formfld'>\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
if ($menu_item_parent_uuid == $field['menu_item_uuid']) {
|
||||
echo "<option value='".$field['menu_item_uuid']."' selected>".$field['menu_item_title']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$field['menu_item_uuid']."'>".$field['menu_item_title']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
unset($sql, $result);
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>Groups:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
|
||||
echo "<table width='52%'>\n";
|
||||
$sql = "SELECT * FROM v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid=:menu_uuid ";
|
||||
$sql .= "and menu_item_uuid=:menu_item_uuid ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->bindParam(':menu_uuid', $menu_uuid);
|
||||
$prep_statement->bindParam(':menu_item_uuid', $menu_item_uuid);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
foreach($result as $field) {
|
||||
if (strlen($field['group_name']) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable'>".$field['group_name']."</td>\n";
|
||||
echo " <td>\n";
|
||||
if (permission_exists('group_member_delete') || if_group("superadmin")) {
|
||||
echo " <a href='menu_item_edit.php?id=".$field['menu_uuid']."&group_name=".$field['group_name']."&menu_item_uuid=".$menu_item_uuid."&menu_item_parent_uuid=".$menu_item_parent_uuid."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo "<select name=\"group_name\" class='frm'>\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
if ($field['group_name'] == "superadmin") {
|
||||
//only show the superadmin group to other users in the superadmin group
|
||||
if (if_group("superadmin")) {
|
||||
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
echo "<input type=\"submit\" class='btn' value=\"Add\">\n";
|
||||
unset($sql, $result);
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " Protected:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='menu_item_protected'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($menu_item_protected == "true") {
|
||||
echo " <option value='true' selected='selected' >true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($menu_item_protected == "false") {
|
||||
echo " <option value='false' selected='selected' >false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select><br />\n";
|
||||
echo "Protect this item in the menu so that is is not removed by 'Restore Default.'<br />\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($action == "update") {
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Menu Order:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_order' value='$menu_item_order'></td>";
|
||||
echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Added By:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_add_user </td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Add Date:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_add_date </td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>menu_item_del_user:</td>";
|
||||
//echo " <td><input type='text' name='menu_item_del_user' value='$menu_item_del_user'></td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>menu_item_del_date:</td>";
|
||||
//echo " <td><input type='text' name='menu_item_del_date' value='$menu_item_del_date'></td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Modified By:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_mod_user </td>";
|
||||
//echo " </tr>";
|
||||
//echo " <tr>";
|
||||
//echo " <td class='vncell'>Modified Date:</td>";
|
||||
//echo " <td class='vtable'>$menu_item_mod_date </td>";
|
||||
//echo " </tr>";
|
||||
}
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Description:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='menu_item_description' value='$menu_item_description'></td>";
|
||||
echo " </tr>";
|
||||
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <table width='100%'>";
|
||||
echo " <tr>";
|
||||
echo " <td align='left'>";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right'>";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='menu_item_uuid' value='$menu_item_uuid'>";
|
||||
}
|
||||
echo " <input type='hidden' name='menu_uuid' value='$menu_uuid'>";
|
||||
echo " <input type='hidden' name='menu_item_uuid' value='$menu_item_uuid'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='Save'>\n";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,371 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_add') || permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
$tmp_menu_item_order = 0;
|
||||
|
||||
function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
|
||||
global $menu_uuid, $tmp_menu_item_order, $v_link_label_edit, $v_link_label_delete;
|
||||
|
||||
//check for sub menus
|
||||
$menu_item_level = $menu_item_level+1;
|
||||
$sql = "select * from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_parent_uuid = '".$menu_item_uuid."' ";
|
||||
$sql .= "order by menu_item_order, menu_item_title asc ";
|
||||
$prep_statement_2 = $db->prepare($sql);
|
||||
$prep_statement_2->execute();
|
||||
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
|
||||
|
||||
$row_style["0"] = "row_style1";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
if (count($result2) > 0) {
|
||||
if ($c == 0) { $c2 = 1; } else { $c2 = 0; }
|
||||
foreach($result2 as $row2) {
|
||||
//set the db values as php variables
|
||||
$menu_item_uuid = $row2['menu_item_uuid'];
|
||||
$menu_item_category = $row2['menu_item_category'];
|
||||
$menu_item_protected = $row2['menu_item_protected'];
|
||||
$menu_item_parent_uuid = $row2['menu_item_parent_uuid'];
|
||||
$menu_item_order = $row2['menu_item_order'];
|
||||
$menu_item_language = $row2['menu_item_language'];
|
||||
$menu_item_title = $row2[menu_item_title];
|
||||
$menu_item_link = $row2[menu_item_link];
|
||||
//get the groups that have been assigned to the menu
|
||||
$sql = "";
|
||||
$sql .= "select group_name from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '".$menu_item_uuid."' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$group_list = "";
|
||||
$x = 0;
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
if ($x == 0) {
|
||||
$group_list = $sub_row["group_name"];
|
||||
}
|
||||
else {
|
||||
$group_list .= ", ".$sub_row["group_name"];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
//display the main body of the list
|
||||
switch ($menu_item_category) {
|
||||
case "internal":
|
||||
$menu_item_title = "<a href='".PROJECT_PATH."/$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
case "external":
|
||||
if (substr($menu_item_link, 0,1) == "/") {
|
||||
$menu_item_link = PROJECT_PATH . $menu_item_link;
|
||||
}
|
||||
$menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
|
||||
break;
|
||||
case "email":
|
||||
$menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
}
|
||||
|
||||
//display the content of the list
|
||||
echo "<tr'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'>";
|
||||
echo " <table cellpadding='0' cellspacing='0' border='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td nowrap>";
|
||||
$i=0;
|
||||
while($i < $menu_item_level){
|
||||
echo " ";
|
||||
$i++;
|
||||
}
|
||||
echo " ".$menu_item_title." ";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo "</td>";
|
||||
//echo "<td valign='top'> ".$menu_item_link." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$group_list." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_category." </td>";
|
||||
//echo "<td valign='top'>".$row[menu_item_description]."</td>";
|
||||
//echo "<td valign='top'> ".$row[menu_item_order]." </td>";
|
||||
if ($menu_item_protected == "true") {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> <strong>yes</strong> </td>";
|
||||
}
|
||||
else {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> no </td>";
|
||||
}
|
||||
echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
||||
echo " ";
|
||||
//echo " ".$row2[menu_item_order]." ";
|
||||
echo "</td>";
|
||||
|
||||
//echo "<td valign='top' align='center' class='".$row_style[$c]."'>";
|
||||
//if (permission_exists('menu_edit')) {
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='<' title='".$row2[menu_item_order].". Move Up'>";
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."&menu_item_uuid=".$row2[menu_item_uuid]."&menu_item_order=".$row2[menu_item_order]."'\" value='>' title='".$row2[menu_item_order].". Move Down'>";
|
||||
//}
|
||||
//echo "</td>";
|
||||
|
||||
echo " <td valign='top' align='right' nowrap>\n";
|
||||
if (permission_exists('menu_edit')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('menu_delete')) {
|
||||
echo " <a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
//update the menu order
|
||||
if ($row2[menu_item_order] != $tmp_menu_item_order) {
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_title = '".$row2[menu_item_title]."', ";
|
||||
$sql .= "menu_item_order = '".$tmp_menu_item_order."' ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_uuid = '".$row2[menu_item_uuid]."' ";
|
||||
$count = $db->exec(check_sql($sql));
|
||||
}
|
||||
$tmp_menu_item_order++;
|
||||
|
||||
//check for additional sub menus
|
||||
if (strlen($menu_item_uuid)> 0) {
|
||||
$c = build_db_child_menu_list($db, $menu_item_level, $menu_item_uuid, $c);
|
||||
}
|
||||
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result2, $row2);
|
||||
}
|
||||
return $c;
|
||||
//end check for children
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
|
||||
echo "<table width='100%' border='0'><tr>";
|
||||
//echo "<td width='50%'><b>Menu Manager</b></td>";
|
||||
echo "<td width='50%' align='right'>\n";
|
||||
//if (permission_exists('menu_restore')) {
|
||||
// echo " <input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='menu_restore_default.php';\" />";
|
||||
//}
|
||||
echo "</td>\n";
|
||||
echo "<td width='35' nowrap></td>\n";
|
||||
echo "</tr></table>";
|
||||
|
||||
$sql = "select * from v_menu_items ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_parent_uuid is null ";
|
||||
if (strlen($order_by)> 0) {
|
||||
$sql .= "order by $order_by $order ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by menu_item_order asc ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style0";
|
||||
|
||||
echo "<div align='left'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if ($result_count == 0) {
|
||||
//no results
|
||||
echo "<tr><td> </td></tr>";
|
||||
}
|
||||
else {
|
||||
echo "<tr>";
|
||||
echo "<th align='left' nowrap> Title </th>";
|
||||
echo "<th align='left' nowrap> Groups </th>";
|
||||
echo "<th align='left'nowrap> Category </th>";
|
||||
echo "<th nowrap> Protected </th>";
|
||||
//echo "<th align='left' width='55' nowrap> Order </th>";
|
||||
echo "<th nowrap width='70'>Order </th>";
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('menu_add')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
foreach($result as $row) {
|
||||
//set the db values as php variables
|
||||
$menu_item_uuid = $row['menu_item_uuid'];
|
||||
$menu_item_category = $row['menu_item_category'];
|
||||
$menu_item_title = $row['menu_item_title'];
|
||||
$menu_item_link = $row['menu_item_link'];
|
||||
$menu_item_protected = $row['menu_item_protected'];
|
||||
|
||||
//get the groups that have been assigned to the menu
|
||||
$sql = "";
|
||||
$sql .= "select group_name from v_menu_item_groups ";
|
||||
$sql .= "where menu_uuid = '$menu_uuid' ";
|
||||
$sql .= "and menu_item_uuid = '$menu_item_uuid' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$group_list = "";
|
||||
$x = 0;
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
if ($x == 0) {
|
||||
$group_list = $sub_row["group_name"];
|
||||
}
|
||||
else {
|
||||
$group_list .= ", ".$sub_row["group_name"];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
|
||||
//add the type link based on the typd of the menu
|
||||
switch ($menu_item_category) {
|
||||
case "internal":
|
||||
$menu_item_title = "<a href='".PROJECT_PATH."/$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
case "external":
|
||||
if (substr($menu_item_link, 0,1) == "/") {
|
||||
$menu_item_link = PROJECT_PATH . $menu_item_link;
|
||||
}
|
||||
$menu_item_title = "<a href='$menu_item_link' target='_blank'>$menu_item_title</a>";
|
||||
break;
|
||||
case "email":
|
||||
$menu_item_title = "<a href='mailto:$menu_item_link'>$menu_item_title</a>";
|
||||
break;
|
||||
}
|
||||
|
||||
//display the content of the list
|
||||
echo "<tr style='".$row_style[$c]."'>\n";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_title." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$group_list." </td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_link." </td>";
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> ".$menu_item_category." </td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'>".$row[menu_item_description]."</td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'> ".$row['menu_item_parent_uuid']." </td>";
|
||||
//echo "<td valign='top' class='".$row_style[$c]."'> ".$row['menu_item_order']." </td>";
|
||||
|
||||
if ($menu_item_protected == "true") {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> <strong>yes</strong> </td>";
|
||||
}
|
||||
else {
|
||||
echo "<td valign='top' class='".$row_style[$c]."'> no </td>";
|
||||
}
|
||||
|
||||
echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
||||
echo " ".$row[menu_item_order]." ";
|
||||
echo "</td>";
|
||||
|
||||
//echo "<td valign='top' align='center' nowrap class='".$row_style[$c]."'>";
|
||||
//if (permission_exists('menu_edit')) {
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_up.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='<' title='".$row['menu_item_order'].". Move Up'>";
|
||||
// echo " <input type='button' class='btn' name='' onclick=\"window.location='menu_item_move_down.php?menu_uuid=".$menu_uuid."&menu_item_parent_uuid=".$row['menu_item_parent_uuid']."&menu_item_uuid=".$row['menu_item_uuid']."&menu_item_order=".$row['menu_item_order']."'\" value='>' title='".$row['menu_item_order'].". Move Down'>";
|
||||
//}
|
||||
//echo "</td>";
|
||||
|
||||
echo " <td valign='top' align='right' nowrap>\n";
|
||||
if (permission_exists('menu_edit')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('menu_delete')) {
|
||||
echo " <a href='menu_item_delete.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
//update the menu order
|
||||
if ($row[menu_item_order] != $tmp_menu_item_order) {
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_title = '".$row['menu_item_title']."', ";
|
||||
$sql .= "menu_item_order = '".$tmp_menu_item_order."' ";
|
||||
$sql .= "where menu_uuid = '".$menu_uuid."' ";
|
||||
$sql .= "and menu_item_uuid = '".$row[menu_item_uuid]."' ";
|
||||
//$db->exec(check_sql($sql));
|
||||
}
|
||||
$tmp_menu_item_order++;
|
||||
|
||||
//check for sub menus
|
||||
$menu_item_level = 0;
|
||||
if (strlen($row['menu_item_uuid']) > 0) {
|
||||
$c = build_db_child_menu_list($db, $menu_item_level, $row['menu_item_uuid'], $c);
|
||||
}
|
||||
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo " <table border='0' width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('menu_add')) {
|
||||
echo " <a href='menu_item_edit.php?id=".$menu_uuid."' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>";
|
||||
|
||||
echo "<br><br>";
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//move down more than one level at a time
|
||||
//update v_menu_items set menu_item_order = (menu_item_order+1) where menu_item_order > 2 or menu_item_order = 2
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$menu_item_id = check_str($_GET["menu_item_id"]);
|
||||
$menu_item_order = check_str($_GET["menu_item_order"]);
|
||||
$menu_parent_guid = check_str($_GET["menu_parent_guid"]);
|
||||
|
||||
$sql = "SELECT menu_item_order FROM v_menu_items ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "order by menu_item_order desc ";
|
||||
$sql .= "limit 1 ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$highestmenu_item_order = $row[menu_item_order];
|
||||
}
|
||||
unset($prep_statement);
|
||||
|
||||
if ($menu_item_order != $highestmenu_item_order) {
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//move the current item's order number up
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_order = (menu_item_order-1) "; //move down
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_item_order = ".($menu_item_order+1)." ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//move the selected item's order number down
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_item_order = (menu_item_order+1) "; //move up
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_item_id = '$menu_item_id' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"1;url=menu_list.php?menu_item_id=$menu_item_id\">\n";
|
||||
echo "<div align='center'>";
|
||||
echo "Item Moved Down";
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//move down more than one level at a time
|
||||
//update v_menu_items set menu_order = (menu_order+1) where menu_order > 2 or menu_order = 2
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$menu_item_id = check_str($_GET["menu_item_id"]);
|
||||
$menu_order = check_str($_GET["menu_order"]);
|
||||
|
||||
if ($menu_order != 1) {
|
||||
//clear the menu session so it will rebuild with the update
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//move the current item's order number down
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_order = (menu_order+1) "; //move down
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_order = ".($menu_order-1)." ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//move the selected item's order number up
|
||||
$sql = "update v_menu_items set ";
|
||||
$sql .= "menu_order = (menu_order-1) "; //move up
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and menu_item_id = '$menu_item_id' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"1;url=menu_list.php?menu_item_id=$menu_item_id\">\n";
|
||||
echo "<div align='center'>";
|
||||
echo "Item Moved Up";
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('menu_restore')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the http value and set as a php variable
|
||||
$menu_uuid = check_str($_REQUEST["menu_uuid"]);
|
||||
|
||||
//menu restore default
|
||||
require_once "includes/classes/menu.php";
|
||||
$menu = new menu;
|
||||
$menu->db = $db;
|
||||
$menu->menu_uuid = $menu_uuid;
|
||||
$menu->delete();
|
||||
$menu->restore();
|
||||
|
||||
//unset the menu session variable
|
||||
$_SESSION["menu"] = "";
|
||||
|
||||
//unset the default template
|
||||
$_SESSION["template_content"] = '';
|
||||
|
||||
//show a message to the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=/core/menu/menu_edit.php?id=$menu_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Restore Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/*
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Servers';
|
||||
$apps[$x]['guid'] = '0f390134-071e-83d7-a79a-ebb7ae139d71';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = '';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Servers';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'f35ee905-1f30-7529-7420-35fc77e47882';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/servers/v_servers.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_setting_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_setting_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_setting_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'server_setting_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_servers';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the description.';
|
||||
$z++;
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_setting_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_setting_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the category.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_setting_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_setting_value';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the value.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_setting_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'server_setting_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
*/
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,161 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' nowrap><b>Server Setting List</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'>\n";
|
||||
echo " Server settings are assigned to Domains.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "";
|
||||
$sql .= " select count(*) as num_rows from v_server_settings ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and server_uuid = '$server_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the server list
|
||||
$sql = "";
|
||||
$sql .= " select * from v_server_settings ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= " and server_uuid = '$server_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('server_setting_category', 'Category', $order_by, $order);
|
||||
echo th_order_by('server_setting_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('server_setting_value', 'Value', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='v_server_settings_edit.php?server_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_setting_category']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_setting_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_setting_value']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='v_server_settings_edit.php?server_uuid=".$row['server_uuid']."&id=".$row['server_setting_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='v_server_settings_delete.php?server_uuid=".$row['server_uuid']."&id=".$row['server_setting_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='v_server_settings_edit.php?server_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$server_uuid = check_str($_GET["server_uuid"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
$sql = "";
|
||||
$sql .= "delete from v_server_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and server_setting_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_servers_edit.php?id=$server_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,244 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$server_setting_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["server_uuid"]) > 0) {
|
||||
$server_uuid = check_str($_GET["server_uuid"]);
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$server_uuid = check_str($_POST["server_uuid"]);
|
||||
$server_setting_category = check_str($_POST["server_setting_category"]);
|
||||
$server_setting_value = check_str($_POST["server_setting_value"]);
|
||||
$server_setting_name = check_str($_POST["server_setting_name"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$server_setting_uuid = check_str($_POST["server_setting_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($server_uuid) == 0) { $msg .= "Please provide: server_uuid<br>\n"; }
|
||||
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
|
||||
//if (strlen($server_setting_category) == 0) { $msg .= "Please provide: Category<br>\n"; }
|
||||
//if (strlen($server_setting_value) == 0) { $msg .= "Please provide: Value<br>\n"; }
|
||||
//if (strlen($server_setting_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$sql = "insert into v_server_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "server_uuid, ";
|
||||
$sql .= "server_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "server_setting_category, ";
|
||||
$sql .= "server_setting_value, ";
|
||||
$sql .= "server_setting_name ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$server_uuid', ";
|
||||
$sql .= "'$server_uuid', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$server_setting_category', ";
|
||||
$sql .= "'$server_setting_value', ";
|
||||
$sql .= "'$server_setting_name' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_servers_edit.php?id=$server_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_server_settings set ";
|
||||
$sql .= "server_uuid = '$server_uuid', ";
|
||||
$sql .= "server_uuid = '$server_uuid', ";
|
||||
$sql .= "domain_uuid = '$domain_uuid', ";
|
||||
$sql .= "server_setting_category = '$server_setting_category', ";
|
||||
$sql .= "server_setting_value = '$server_setting_value', ";
|
||||
$sql .= "server_setting_name = '$server_setting_name' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and server_setting_uuid = '$server_setting_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_servers_edit.php?id=$server_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$server_setting_uuid = $_GET["id"];
|
||||
$sql = "";
|
||||
$sql .= "select * from v_server_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and server_setting_uuid = '$server_setting_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$server_uuid = $row["server_uuid"];
|
||||
$server_setting_category = $row["server_setting_category"];
|
||||
$server_setting_value = $row["server_setting_value"];
|
||||
$server_setting_name = $row["server_setting_name"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Server Setting Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Server Setting Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_servers_edit.php?id=$server_uuid'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='2'>\n";
|
||||
echo "Server settings are assigned to Domains.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Category:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='server_setting_category' maxlength='255' value=\"$server_setting_category\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='server_setting_name' maxlength='255' value=\"$server_setting_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Value:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='server_setting_value' maxlength='255' value=\"$server_setting_value\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='server_uuid' value='$server_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='server_setting_uuid' value='$server_setting_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,158 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' nowrap><b>Servers</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2'>\n";
|
||||
echo " Servers Settings<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "";
|
||||
$sql .= " select count(*) as num_rows from v_servers ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 10;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "";
|
||||
$sql .= " select * from v_servers ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('server_name', 'Server Name', $order_by, $order);
|
||||
echo th_order_by('server_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='v_servers_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
//print_r( $row );
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='v_servers_edit.php?id=".$row[server_uuid]."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='v_servers_delete.php?id=".$row[server_uuid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='3' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='v_servers_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
$sql = "";
|
||||
$sql .= "delete from v_servers ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and server_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_servers.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,212 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$server_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$server_name = check_str($_POST["server_name"]);
|
||||
$server_description = check_str($_POST["server_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$server_uuid = check_str($_POST["server_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($server_name) == 0) { $msg .= "Please provide: Server Name<br>\n"; }
|
||||
//if (strlen($server_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$sql = "insert into v_servers ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "server_name, ";
|
||||
$sql .= "server_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$server_name', ";
|
||||
$sql .= "'$server_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_servers.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_servers set ";
|
||||
$sql .= "server_name = '$server_name', ";
|
||||
$sql .= "server_description = '$server_description' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and server_uuid = '$server_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_servers.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$server_uuid = $_GET["id"];
|
||||
$sql = "";
|
||||
$sql .= "select * from v_servers ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and server_uuid = '$server_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$server_name = $row["server_name"];
|
||||
$server_description = $row["server_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Server Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Server Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_servers.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='2'>\n";
|
||||
echo "Servers Settings<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Server Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='server_name' maxlength='255' value=\"$server_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='server_description' maxlength='255' value=\"$server_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='server_uuid' value='$server_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
if ($action == "update") {
|
||||
require "v_server_settings.php";
|
||||
}
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "Upgrade Schema";
|
||||
$apps[$x]['uuid'] = '8b1d7eb5-1009-052c-e1a8-d1f4887a3f5c';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'Upgrade the database schema.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Upgrade Schema';
|
||||
$apps[$x]['menu'][0]['uuid'] = '8c826e92-be3c-0944-669a-24e5b915d562';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/upgrade/upgrade_schema.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'upgrade_schema';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'upgrade_svn';
|
||||
|
||||
//schema details
|
||||
/*
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_src';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'src_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'src_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'type';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'last_mod';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'path';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
*/
|
||||
?>
|
||||
@@ -0,0 +1,132 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
|
||||
|
||||
//if the resource scripts resource directory does not exist then create it
|
||||
if (!is_dir($_SESSION['switch']['scripts']['dir']."/resources")) { mkdir($_SESSION['switch']['scripts']['dir']."/resources",0755,true); }
|
||||
|
||||
//get odbc information
|
||||
$sql = "select count(*) as num_rows from v_databases ";
|
||||
$sql .= "where database_type = 'odbc' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$odbc_num_rows = $row['num_rows'];
|
||||
|
||||
$sql = "select * from v_databases ";
|
||||
$sql .= "where database_type = 'odbc' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$dsn_name = $row["database_name"];
|
||||
$dsn_username = $row["database_username"];
|
||||
$dsn_password = $row["database_password"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
else {
|
||||
$odbc_num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//config.lua
|
||||
$fout = fopen($_SESSION['switch']['scripts']['dir']."/resources/config.lua","w");
|
||||
$tmp = "\n";
|
||||
$tmp .= "--switch directories\n";
|
||||
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
|
||||
$tmp .= " sounds_dir = \"".$_SESSION['switch']['sounds']['dir']."\";\n";
|
||||
}
|
||||
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
|
||||
$tmp .= " recordings_dir = \"".$_SESSION['switch']['recordings']['dir']."\";\n";
|
||||
}
|
||||
$tmp .= "\n";
|
||||
$tmp .= "--database connection info\n";
|
||||
if (strlen($db_type) > 0) {
|
||||
$tmp .= " db_type = \"".$db_type."\";\n";
|
||||
}
|
||||
if (strlen($db_name) > 0) {
|
||||
$tmp .= " db_name = \"".$db_name."\";\n";
|
||||
}
|
||||
if (strlen($db_path) > 0) {
|
||||
$tmp .= " db_path = \"".$db_path."\";\n";
|
||||
}
|
||||
if (strlen($dsn_name) > 0) {
|
||||
$tmp .= " dsn_name = \"".$dsn_name."\";\n";
|
||||
}
|
||||
if (strlen($dsn_username) > 0) {
|
||||
$tmp .= " dsn_username = \"".$dsn_username."\";\n";
|
||||
}
|
||||
if (strlen($dsn_password) > 0) {
|
||||
$tmp .= " dsn_password = \"".$dsn_password."\";\n";
|
||||
}
|
||||
$tmp .= "\n";
|
||||
$tmp .= "--additional info\n";
|
||||
$tmp .= " tmp_dir = \"".$tmp_dir."\";\n";
|
||||
fwrite($fout, $tmp);
|
||||
unset($tmp);
|
||||
fclose($fout);
|
||||
|
||||
//config.js
|
||||
$fout = fopen($_SESSION['switch']['scripts']['dir']."/resources/config.js","w");
|
||||
$tmp = "\n";
|
||||
$tmp .= "//switch directories\n";
|
||||
$tmp .= " var admin_pin = \"".$row["admin_pin"]."\";\n";
|
||||
$tmp .= " var sounds_dir = \"".$_SESSION['switch']['sounds']['dir']."\";\n";
|
||||
$tmp .= " var recordings_dir = \"".$_SESSION['switch']['recordings']['dir']."\";\n";
|
||||
$tmp .= "\n";
|
||||
$tmp = "//database connection info\n";
|
||||
if (strlen($db_type) > 0) {
|
||||
$tmp .= " var db_type = \"".$db_type."\";\n";
|
||||
}
|
||||
if (strlen($db_name) > 0) {
|
||||
$tmp .= " var db_name = \"".$db_name."\";\n";
|
||||
}
|
||||
if (strlen($db_path) > 0) {
|
||||
$tmp .= " var db_path = \"".$db_path."\";\n";
|
||||
}
|
||||
if (strlen($dsn_name) > 0) {
|
||||
$tmp .= " var dsn_name = \"".$dsn_name."\";\n";
|
||||
}
|
||||
if (strlen($dsn_username) > 0) {
|
||||
$tmp .= " var dsn_username = \"".$dsn_username."\";\n";
|
||||
}
|
||||
if (strlen($dsn_password) > 0) {
|
||||
$tmp .= " var dsn_password = \"".$dsn_password."\";\n";
|
||||
}
|
||||
$tmp .= "\n";
|
||||
$tmp .= "//additional info\n";
|
||||
$tmp .= " var tmp_dir = \"".$tmp_dir."\";\n";
|
||||
fwrite($fout, $tmp);
|
||||
unset($tmp);
|
||||
fclose($fout);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//check the permission
|
||||
if(defined('STDIN')) {
|
||||
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
||||
preg_match("/^(.*)\/core\/.*$/", $document_root, $matches);
|
||||
$document_root = $matches[1];
|
||||
set_include_path($document_root);
|
||||
require_once "includes/require.php";
|
||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||
$display_type = 'text'; //html, text
|
||||
}
|
||||
else {
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('upgrade_schema') || permission_exists('upgrade_svn') || if_group("superadmin")) {
|
||||
//echo "access granted";
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//set the default
|
||||
if (!isset($display_results)) {
|
||||
$display_results = false;
|
||||
}
|
||||
|
||||
//include the header
|
||||
if ($display_results) {
|
||||
require_once "includes/header.php";
|
||||
}
|
||||
|
||||
if ($display_type == 'text') {
|
||||
echo "\n";
|
||||
echo "Upgrade\n";
|
||||
echo "-----------------------------------------\n";
|
||||
echo "\n";
|
||||
echo "Database\n";
|
||||
}
|
||||
|
||||
//upgrade the database schema
|
||||
require_once "core/upgrade/upgrade_schema.php";
|
||||
|
||||
//show the content
|
||||
if ($display_type == 'html') {
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th align='left'>Message</th>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td class='row_style1'><strong>Upgrade Completed</strong></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
}
|
||||
|
||||
if ($display_type == 'text') {
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
//include the footer
|
||||
if ($display_results) {
|
||||
require_once "includes/footer.php";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,188 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//check the permission
|
||||
if(defined('STDIN')) {
|
||||
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
||||
preg_match("/^(.*)\/core\/.*$/", $document_root, $matches);
|
||||
$document_root = $matches[1];
|
||||
set_include_path($document_root);
|
||||
require_once "includes/require.php";
|
||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||
$display_type = 'text'; //html, text
|
||||
}
|
||||
else {
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('upgrade_schema') || permission_exists('upgrade_svn') || if_group("superadmin")) {
|
||||
//echo "access granted";
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//copy the files and directories from includes/install
|
||||
require_once "includes/classes/install.php";
|
||||
$install = new install;
|
||||
$install->domain_uuid = $domain_uuid;
|
||||
$install->domain_name = $domain;
|
||||
$install->switch_conf_dir = $_SESSION['switch']['conf']['dir'];
|
||||
$install->switch_scripts_dir = $_SESSION['switch']['scripts']['dir'];
|
||||
$install->switch_sounds_dir = $_SESSION['switch']['sounds']['dir'];
|
||||
$install->copy();
|
||||
//print_r($install->result);
|
||||
|
||||
//get the list of installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
//get the domain_uuid
|
||||
$sql = "select * from v_domains ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
if (count($result) == 0) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
else {
|
||||
if ($row['domain_name'] == $domain_array[0] || $row['domain_name'] == 'www.'.$domain_array[0]) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name'];
|
||||
}
|
||||
}
|
||||
unset($result, $prep_statement);
|
||||
|
||||
//get the default settings
|
||||
$sql = "select * from v_default_settings ";
|
||||
$sql .= "where default_setting_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
|
||||
//get the default recordings directory
|
||||
foreach($result_default_settings as $row) {
|
||||
$name = $row['default_setting_name'];
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
if ($category == 'switch' && $subcategory == 'recordings' && $name == 'dir') {
|
||||
$switch_recordings_dir = $row['default_setting_value'];
|
||||
}
|
||||
}
|
||||
|
||||
//loop through all domains
|
||||
$sql = "select * from v_domains ";
|
||||
$v_prep_statement = $db->prepare(check_sql($sql));
|
||||
$v_prep_statement->execute();
|
||||
$main_result = $v_prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
$domain_count = count($main_result);
|
||||
foreach ($main_result as &$row) {
|
||||
//get the values from database and set them as php variables
|
||||
$domain_uuid = $row["domain_uuid"];
|
||||
$domain_name = $row["domain_name"];
|
||||
|
||||
//get the context
|
||||
if ($domain_count == 1) {
|
||||
$context = "default";
|
||||
}
|
||||
else {
|
||||
$context = $domain_name;
|
||||
}
|
||||
|
||||
//show the domain when display_type is set to text
|
||||
if ($display_type == "text") {
|
||||
echo "\n";
|
||||
echo $domain_name;
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
//get the default settings - this needs to be done to reset the session values back to the defaults for each domain in the loop
|
||||
foreach($result_defaults_settings as $row) {
|
||||
$name = $row['default_setting_name'];
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
$_SESSION[$category][$name] = $row['default_setting_value'];
|
||||
}
|
||||
else {
|
||||
$_SESSION[$category][$subcategory][$name] = $row['default_setting_value'];
|
||||
}
|
||||
}
|
||||
|
||||
//get the domains settings
|
||||
$sql = "select * from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and domain_setting_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$name = $row['domain_setting_name'];
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
$_SESSION[$category][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
else {
|
||||
//$$category[$subcategory][$name] = $row['domain_setting_value'];
|
||||
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
}
|
||||
|
||||
//set the recordings directory
|
||||
if (strlen($switch_recordings_dir) > 1 && count($_SESSION["domains"]) > 1) {
|
||||
$_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir."/".$domain_name;
|
||||
}
|
||||
|
||||
//get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php
|
||||
$default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
|
||||
foreach ($default_list as &$default_path) {
|
||||
include($default_path);
|
||||
}
|
||||
// synchronize the dialplan
|
||||
if (function_exists('save_dialplan_xml')) {
|
||||
save_dialplan_xml();
|
||||
}
|
||||
}
|
||||
unset ($v_prep_statement);
|
||||
|
||||
//clear the session variables
|
||||
unset($_SESSION['domain']);
|
||||
unset($_SESSION['switch']);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//check the permission
|
||||
if(defined('STDIN')) {
|
||||
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
|
||||
preg_match("/^(.*)\/core\/.*$/", $document_root, $matches);
|
||||
$document_root = $matches[1];
|
||||
set_include_path($document_root);
|
||||
require_once "includes/require.php";
|
||||
$_SERVER["DOCUMENT_ROOT"] = $document_root;
|
||||
$display_type = 'text'; //html, text
|
||||
}
|
||||
else {
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('upgrade_schema') || if_group("superadmin")) {
|
||||
//echo "access granted";
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
$display_type = 'html'; //html, text
|
||||
}
|
||||
|
||||
//set the default
|
||||
if (!isset($display_results)) {
|
||||
$display_results = true;
|
||||
}
|
||||
|
||||
//load the default database into memory and compare it with the active database
|
||||
require_once "includes/lib_schema.php";
|
||||
db_upgrade_schema ($db, $db_type, $db_name, $display_results);
|
||||
unset($apps);
|
||||
|
||||
//upgrade the domains
|
||||
require_once "core/upgrade/upgrade_domains.php";
|
||||
|
||||
if ($display_results && $display_type == "html") {
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
require_once "includes/footer.php";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,296 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
/*
|
||||
$mtime = microtime();
|
||||
$mtime = explode(" ",$mtime);
|
||||
$mtime = $mtime[1] + $mtime[0];
|
||||
$start_time = $mtime;
|
||||
*/
|
||||
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/phpsvnclient/phpsvnclient.php";
|
||||
|
||||
if (!isset($display_results)) {
|
||||
$display_results = true;
|
||||
}
|
||||
|
||||
if (strlen($_SERVER['HTTP_USER_AGENT']) > 0) {
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('upgrade_svn') || if_group("superadmin")) {
|
||||
//echo "access granted";
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$display_results = false; //true false
|
||||
//$display_type = 'csv'; //html, csv
|
||||
}
|
||||
|
||||
ini_set('display_errors', '0');
|
||||
ini_set(max_execution_time,3600);
|
||||
clearstatcache();
|
||||
|
||||
if ($display_results) {
|
||||
require_once "includes/header.php";
|
||||
}
|
||||
|
||||
$svn_url = 'http://fusionpbx.googlecode.com/svn/';
|
||||
$svn_path = '/trunk/fusionpbx/';
|
||||
|
||||
//set path_array
|
||||
$sql = "";
|
||||
$sql .= "select * from v_src ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$path = trim($row["path"]);
|
||||
$path_array[$path][type] = $row["type"];
|
||||
$path_array[$path][last_mod] = $row["last_mod"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
$svn = new phpsvnclient($svn_url);
|
||||
//$svn_version = $svn->getVersion();
|
||||
$svn_directory_tree = $svn->getDirectoryTree($svn_path);
|
||||
|
||||
if ($display_results) {
|
||||
echo "<table width='100%' border='0' cellpadding='20' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th>Type</th>\n";
|
||||
echo "<th>Last Modified</th>\n";
|
||||
echo "<th>Path</th>\n";
|
||||
echo "<th>Status/Size</th>\n";
|
||||
echo "<th>MD5 file</th>\n";
|
||||
echo "<th>MD5 xml</th>\n";
|
||||
echo "<th>Action</th>\n";
|
||||
echo "<tr>\n";
|
||||
}
|
||||
|
||||
//$db->beginTransaction();
|
||||
foreach ($svn_directory_tree as &$row) {
|
||||
$md5_match = false;
|
||||
$xml_type = $row[type];
|
||||
$xml_relative_path = trim(str_replace(trim($svn_path,'/'),"",$row[path]));
|
||||
$xml_last_mod = $row[last_mod];
|
||||
$new_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH . $xml_relative_path;
|
||||
|
||||
if (file_exists($new_path)) {
|
||||
$exists = true;
|
||||
}
|
||||
else {
|
||||
$exists = false;
|
||||
}
|
||||
|
||||
if ( $xml_type == 'file' ) {
|
||||
$xml_file_path = trim($row[path]); //we need this to download the file from svn
|
||||
$md5_xml = $row[md5];
|
||||
if ($exists) {
|
||||
$md5_file = md5_file($new_path);
|
||||
if ($md5_xml == $md5_file){
|
||||
$md5_match = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$md5_match = false;//???
|
||||
$md5_file = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
$md5_xml = '';//directory has no md5
|
||||
}
|
||||
|
||||
if (strlen($xml_relative_path) > 0) {
|
||||
if ($display_results) {
|
||||
if ($xml_type == 'file' && !$md5_match) {
|
||||
echo "<tr>\n";
|
||||
echo "<td class='row_style1'>$xml_type</td>\n";
|
||||
echo "<td class='row_style1'>$xml_last_mod</td>\n";
|
||||
echo "<td class='row_style1'>$xml_relative_path</td>\n";
|
||||
echo "<td class='row_style1'>$exists</td>\n";
|
||||
//echo "<td class='row_style1'>$xml_size</td>\n";
|
||||
echo "<td class='row_style1'>$md5_file</td>\n";
|
||||
echo "<td class='row_style1'>$md5_xml</td>\n";
|
||||
echo "<td class='row_style1'>$md5_match </td>\n";
|
||||
//file_get_contents($svn_url.$svn_path.$xml_relative_path);</td>\n";
|
||||
echo "<td class='row_style1'>\n";
|
||||
}
|
||||
}
|
||||
|
||||
//update the v_scr data
|
||||
if ($xml_type=='file' && strlen($path_array[$xml_relative_path]['type']) == 0) {
|
||||
//insert a new record into the src table
|
||||
$sql ="";
|
||||
$sql .= "insert into v_src ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "type, ";
|
||||
$sql .= "last_mod, ";
|
||||
$sql .= "path ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$xml_type', ";
|
||||
$sql .= "'$xml_last_mod', ";
|
||||
$sql .= "'$xml_relative_path' ";
|
||||
$sql .= ")";
|
||||
//echo "$sql<br />\n";
|
||||
}
|
||||
else {
|
||||
if ($xml_type=='file' && !$md5_match) {//update changed files
|
||||
//update the src table
|
||||
$sql ="";
|
||||
$sql .= "update v_src set ";
|
||||
$sql .= "type = '$xml_type', ";
|
||||
$sql .= "last_mod = '$xml_last_mod' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and path = '$xml_relative_path' ";
|
||||
}
|
||||
}
|
||||
//if the path exists and is a file
|
||||
if ($exists && $xml_type == 'file') {
|
||||
//the md5 of the xml file and the local file do not match
|
||||
if ($md5_match) {
|
||||
if ($display_results) {
|
||||
//echo "current "; //the file is up to date
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* if ($xml_file_path == '/core/upgrade/upgrade_svn.php' ) {
|
||||
if ($display_results) {
|
||||
echo "white list"; //the file is up to date
|
||||
}
|
||||
continue;
|
||||
}
|
||||
*/ //get the remote file contents
|
||||
$file_content = $svn->getFile($xml_file_path);
|
||||
|
||||
//the md5 of the local file and the remote content match
|
||||
if (md5_file($new_path) == md5($file_content)) {
|
||||
if ($display_results) {
|
||||
//echo "current 2 "; //the file is up to date
|
||||
}
|
||||
}
|
||||
else {
|
||||
//make sure the string matches the file md5 that was recorded.
|
||||
if (strlen($file_content) > 0) {
|
||||
$tmp_fh = fopen($new_path, 'w');
|
||||
fwrite($tmp_fh, $file_content);
|
||||
fclose($tmp_fh);
|
||||
}
|
||||
|
||||
//display the results
|
||||
if ($display_results) {
|
||||
echo "<strong style='color: #FF0000;'> ";
|
||||
if (is_writable($new_path)) {
|
||||
echo "updated ";
|
||||
}
|
||||
else {
|
||||
echo "not writable ";
|
||||
}
|
||||
echo "</strong>";
|
||||
}
|
||||
}
|
||||
}
|
||||
//unset the variable
|
||||
unset($file_content);
|
||||
}
|
||||
else {
|
||||
|
||||
//if the path does not exist create it and then add it to the database
|
||||
//echo "file is missing |";
|
||||
if ($xml_type == 'directory' && !$exists) {
|
||||
//make sure the directory exists
|
||||
mkdir (dirname($new_path), 0755, true);
|
||||
}
|
||||
if ($xml_type == 'file') {
|
||||
//make sure the directory exists
|
||||
if (!is_dir(dirname($new_path))){
|
||||
mkdir (dirname($new_path), 0755, true);
|
||||
}
|
||||
|
||||
//get the remote file contents
|
||||
$file_content = $svn->getFile($xml_file_path);
|
||||
|
||||
//make sure we got some data.
|
||||
if (strlen($file_content) > 0) {
|
||||
$tmp_fh = fopen($new_path, 'w');
|
||||
fwrite($tmp_fh, $file_content);
|
||||
fclose($tmp_fh);
|
||||
}
|
||||
|
||||
if ($display_results) {
|
||||
echo "<strong style='color: #FF0000;'> ";
|
||||
if (is_writable($new_path)) {
|
||||
echo "added/restored";
|
||||
}
|
||||
else {
|
||||
echo "not writable ";
|
||||
}
|
||||
echo "</strong>";
|
||||
//echo "<br />\n";
|
||||
}
|
||||
//unset the variable
|
||||
unset($file_content);
|
||||
}
|
||||
}
|
||||
|
||||
if ($display_results) {
|
||||
if ($xml_type == 'file' && !$md5_match) {
|
||||
echo " ";
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
}
|
||||
}
|
||||
//update the database
|
||||
if (strlen($sql) > 0) {
|
||||
$db->exec(check_sql($sql));
|
||||
//echo "$sql<br />\n";
|
||||
}
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
//$db->commit();
|
||||
//clearstatcache();
|
||||
if ($display_results) {
|
||||
echo "</table>\n";
|
||||
require_once "includes/footer.php";
|
||||
}
|
||||
/*
|
||||
$mtime = microtime();
|
||||
$mtime = explode(" ",$mtime);
|
||||
$mtime = $mtime[1] + $mtime[0];
|
||||
$end_time = $mtime;
|
||||
$total_time = ($end_time - $start_time);
|
||||
echo "This page was created in ".$total_time." seconds";
|
||||
*/
|
||||
?>
|
||||
@@ -0,0 +1,356 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "User Manager";
|
||||
$apps[$x]['uuid'] = '112124b3-95c2-5352-7e9d-d14c0b88f207';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'Add, edit, delete, and search for users.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Login';
|
||||
$apps[$x]['menu'][0]['uuid'] = 'c85bf816-b88d-40fa-8634-11b456928afa';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/login.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'public';
|
||||
$apps[$x]['menu'][0]['order'] = '99';
|
||||
|
||||
$apps[$x]['menu'][1]['title']['en'] = 'Logout';
|
||||
$apps[$x]['menu'][1]['uuid'] = '0d29e9f4-0c9b-9d8d-cd2d-454899dc9bc4';
|
||||
$apps[$x]['menu'][1]['parent_uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
|
||||
$apps[$x]['menu'][1]['category'] = 'internal';
|
||||
$apps[$x]['menu'][1]['path'] = '/logout.php';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'user';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][2]['title']['en'] = 'User Manager';
|
||||
$apps[$x]['menu'][2]['uuid'] = '0d57cc1e-1874-47b9-7ddd-fe1f57cec99b';
|
||||
$apps[$x]['menu'][2]['parent_uuid'] = 'bc96d773-ee57-0cdd-c3ac-2d91aba61b55';
|
||||
$apps[$x]['menu'][2]['category'] = 'internal';
|
||||
$apps[$x]['menu'][2]['path'] = '/core/users/index.php';
|
||||
$apps[$x]['menu'][2]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['menu'][3]['title']['en'] = 'Group Manager';
|
||||
$apps[$x]['menu'][3]['uuid'] = '3b4acc6d-827b-f537-bf21-0093d94ffec7';
|
||||
$apps[$x]['menu'][3]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][3]['category'] = 'internal';
|
||||
$apps[$x]['menu'][3]['path'] = '/core/users/grouplist.php';
|
||||
$apps[$x]['menu'][3]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'user_view';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'user_add';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][2]['name'] = 'user_edit';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][3]['name'] = 'user_delete';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][4]['name'] = 'group_view';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][5]['name'] = 'group_add';
|
||||
$apps[$x]['permissions'][5]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][6]['name'] = 'group_edit';
|
||||
$apps[$x]['permissions'][6]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][7]['name'] = 'group_delete';
|
||||
$apps[$x]['permissions'][7]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][7]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][8]['name'] = 'group_member_view';
|
||||
$apps[$x]['permissions'][8]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][8]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][9]['name'] = 'group_member_add';
|
||||
$apps[$x]['permissions'][9]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][9]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][10]['name'] = 'group_member_delete';
|
||||
$apps[$x]['permissions'][10]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][10]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][11]['name'] = 'group_permissions';
|
||||
$apps[$x]['permissions'][11]['groups'][] = 'superadmin';
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_users';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'username';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'password';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'salt';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_email';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'useremail';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_status';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'userstatus';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_time_zone';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'usertimezone';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_add_user';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'useradduser';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_add_date';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'useradddate';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_groups';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'group_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'groupid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'group_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'groupdesc';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 2; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_group_users';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_user_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'group_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'groupid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
//$z++;
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'username';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 3; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_group_permissions';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_permission_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'group_permission_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'permission_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'permission_id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
//$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
|
||||
$y = 4; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_user_settings';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the category.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_subcategory';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the subcategory.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_value';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the value.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
?>
|
||||
@@ -0,0 +1,169 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//if the are no groups add the default groups
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "WHERE domain_uuid = '$domain_uuid' ";
|
||||
$sub_result = $db->query($sql)->fetch();
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$sub_result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
if (count($sub_result) == 0) {
|
||||
$x = 0;
|
||||
$tmp[$x]['group_name'] = 'superadmin';
|
||||
$tmp[$x]['group_description'] = 'Super Administrator Group';
|
||||
$x++;
|
||||
$tmp[$x]['group_name'] = 'admin';
|
||||
$tmp[$x]['group_description'] = 'Administrator Group';
|
||||
$x++;
|
||||
$tmp[$x]['group_name'] = 'user';
|
||||
$tmp[$x]['group_description'] = 'User Group';
|
||||
$x++;
|
||||
$tmp[$x]['group_name'] = 'public';
|
||||
$tmp[$x]['group_description'] = 'Public Group';
|
||||
$x++;
|
||||
$tmp[$x]['group_name'] = 'agent';
|
||||
$tmp[$x]['group_description'] = 'Call Center Agent Group';
|
||||
foreach($tmp as $row) {
|
||||
if (strlen($row['group_name']) > 0) {
|
||||
$sql = "insert into v_groups ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "group_uuid, ";
|
||||
$sql .= "group_name, ";
|
||||
$sql .= "group_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'".$row['group_name']."', ";
|
||||
$sql .= "'".$row['group_description']."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($prep_statement, $sub_result);
|
||||
|
||||
//if there are no permissions listed in v_group_permissions then set the default permissions
|
||||
$sql = "select count(*) as count from v_group_permissions ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement);
|
||||
if ($sub_result['count'] > 0) {
|
||||
if ($display_type == "text") {
|
||||
echo " Group Permissions: no change\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($display_type == "text") {
|
||||
echo " Group Permissions: added\n";
|
||||
}
|
||||
//no permissions found add the defaults
|
||||
$db->beginTransaction();
|
||||
foreach($apps as $app) {
|
||||
foreach ($app['permissions'] as $sub_row) {
|
||||
foreach ($sub_row['groups'] as $group) {
|
||||
//add the record
|
||||
$sql = "insert into v_group_permissions ";
|
||||
$sql .= "(";
|
||||
$sql .= "group_permission_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "permission_name, ";
|
||||
$sql .= "group_name ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'".$sub_row['name']."', ";
|
||||
$sql .= "'".$group."' ";
|
||||
$sql .= ")";
|
||||
$db->exec($sql);
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
//find rows that have a null user_uuid and set the correct user_uuid
|
||||
$sql = "select * from v_group_users ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and user_uuid is null; ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
if (strlen($row['username']) > 0) {
|
||||
//get the user_uuid
|
||||
$sql = "select user_uuid from v_users ";
|
||||
$sql .= "where username = '".$row['username']."' ";
|
||||
$prep_statement_sub = $db->prepare($sql);
|
||||
$prep_statement_sub->execute();
|
||||
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement_sub);
|
||||
$user_uuid = $sub_result['user_uuid'];
|
||||
//set the user uuid
|
||||
$sql = "update v_group_users set ";
|
||||
$sql .= "user_uuid = '".$user_uuid."' ";
|
||||
$sql .= "where username = '".$row['username']."'; ";
|
||||
$db->exec($sql);
|
||||
unset($sql);
|
||||
}
|
||||
else {
|
||||
//get the number of users
|
||||
$sql = "select count(*) as num_rows from v_users ";
|
||||
$prep_statement_sub = $db->prepare($sql);
|
||||
$prep_statement_sub->execute();
|
||||
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement_sub);
|
||||
$num_rows = $sub_result['num_rows'];
|
||||
if ($num_rows == 1) {
|
||||
//get the user_uuid
|
||||
$sql = "select user_uuid from v_users ";
|
||||
$prep_statement_sub = $db->prepare($sql);
|
||||
$prep_statement_sub->execute();
|
||||
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
|
||||
unset ($prep_statement_sub);
|
||||
$user_uuid = $sub_result['user_uuid'];
|
||||
//set the user uuid
|
||||
$sql = "update v_group_users set ";
|
||||
$sql .= "user_uuid = '".$user_uuid."' ";
|
||||
$db->exec($sql);
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,275 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('group_permissions') || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get the list of installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
//if there are no permissions listed in v_group_permissions then set the default permissions
|
||||
$sql = "";
|
||||
$sql .= "select count(*) as count from v_group_permissions ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$group_permission_count = $row["count"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
if ($group_permission_count == 0) {
|
||||
//no permissions found add the defaults
|
||||
foreach($apps as $app) {
|
||||
foreach ($app['permissions'] as $row) {
|
||||
foreach ($row['groups'] as $group) {
|
||||
//add the record
|
||||
$sql = "insert into v_group_permissions ";
|
||||
$sql .= "(";
|
||||
$sql .= "group_permission_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "permission_name, ";
|
||||
$sql .= "group_name ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'".$row['name']."', ";
|
||||
$sql .= "'".$group."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get the http values and set them as php variables
|
||||
$group_name = $_REQUEST['group_name'];
|
||||
|
||||
//get the permissions assigned to this group
|
||||
$sql = "";
|
||||
$sql .= " select * from v_group_permissions ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and group_name = '$group_name' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$permission_name = $row["permission_name"];
|
||||
$permissions_db[$permission_name] = "true";
|
||||
}
|
||||
//show the db checklist
|
||||
//echo "<pre>";
|
||||
//print_r($permissions_db);
|
||||
//echo "</pre>";
|
||||
|
||||
//list all the permissions in the database
|
||||
foreach($apps as $app) {
|
||||
foreach ($app['permissions'] as $row) {
|
||||
if ($permissions_db[$row['name']] == "true") {
|
||||
$permissions_db_checklist[$row['name']] = "true";
|
||||
}
|
||||
else {
|
||||
$permissions_db_checklist[$row['name']] = "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
//show the db checklist
|
||||
//echo "<pre>";
|
||||
//print_r($permissions_db_checklist);
|
||||
//echo "</pre>";
|
||||
|
||||
//process the http post
|
||||
if (count($_POST)>0) {
|
||||
foreach($_POST['permissions_form'] as $permission) {
|
||||
$permissions_form[$permission] = "true";
|
||||
}
|
||||
|
||||
//list all the permissions
|
||||
foreach($apps as $app) {
|
||||
foreach ($app['permissions'] as $row) {
|
||||
if ($permissions_form[$row['name']] == "true") {
|
||||
$permissions_form_checklist[$row['name']] = "true";
|
||||
}
|
||||
else {
|
||||
$permissions_form_checklist[$row['name']] = "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
//show the form db checklist
|
||||
//echo "<pre>";
|
||||
//print_r($permissions_form_checklist);
|
||||
//echo "</pre>";
|
||||
|
||||
//list all the permissions
|
||||
foreach($apps as $app) {
|
||||
foreach ($app['permissions'] as $row) {
|
||||
$permission = $row['name'];
|
||||
if ($permissions_db_checklist[$permission] == "true" && $permissions_form_checklist[$permission] == "true") {
|
||||
//matched do nothing
|
||||
}
|
||||
if ($permissions_db_checklist[$permission] == "false" && $permissions_form_checklist[$permission] == "false") {
|
||||
//matched do nothing
|
||||
}
|
||||
if ($permissions_db_checklist[$permission] == "true" && $permissions_form_checklist[$permission] == "false") {
|
||||
//delete the record
|
||||
$sql = "delete from v_group_permissions ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and group_name = '$group_name' ";
|
||||
$sql .= "and permission_name = '$permission' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//set the permission to false in the permissions_db_checklist
|
||||
$permissions_db_checklist[$permission] = "false";
|
||||
}
|
||||
if ($permissions_db_checklist[$permission] == "false" && $permissions_form_checklist[$permission] == "true") {
|
||||
//add the record
|
||||
$sql = "insert into v_group_permissions ";
|
||||
$sql .= "(";
|
||||
$sql .= "group_permission_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "permission_name, ";
|
||||
$sql .= "group_name ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$permission', ";
|
||||
$sql .= "'$group_name' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//set the permission to true in the permissions_db_checklist
|
||||
$permissions_db_checklist[$permission] = "true";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//show the content
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Group Permission List for $group_name</b></td>\n";
|
||||
echo "<td width='50%' align=\"right\">\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='grouplist.php'\" value='Back'> ";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align=\"left\" colspan='2'>\n";
|
||||
echo " Assign permissions to groups.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</tr></table>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='left'>\n";
|
||||
|
||||
//list all the permissions
|
||||
foreach($apps as $app) {
|
||||
$app_name = $app['name'];
|
||||
$description = $app['description']['en'];
|
||||
|
||||
echo "<strong>".$app_name."</strong><br />\n";
|
||||
echo "".$description."<br /><br />";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th>Permissions</th>\n";
|
||||
echo "<th>Description</th>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
foreach ($app['permissions'] as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' style='width:250px' nowrap='nowrap' class='".$row_style[$c]."'>\n";
|
||||
if ($permissions_db_checklist[$row['name']] == "true") {
|
||||
echo " <input type='checkbox' name='permissions_form[]' checked='checked' value='".$row['name']."'>\n";
|
||||
}
|
||||
else {
|
||||
echo " <input type='checkbox' name='permissions_form[]' value='".$row['name']."'>\n";
|
||||
}
|
||||
echo " ".$row['name']."\n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>\n";
|
||||
echo " ".$row['description']."\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
}
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan='3' align='right'>\n";
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>";
|
||||
echo "<br />\n";
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<form>\n";
|
||||
|
||||
echo "<br><br>";
|
||||
|
||||
//show the footer
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,134 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('group_add')) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the http values and set them as variables
|
||||
$path = check_str($_GET["path"]);
|
||||
$msg = check_str($_GET["msg"]);
|
||||
$group_name = check_str($_POST["group_name"]);
|
||||
$group_description = check_str($_POST["group_description"]);
|
||||
|
||||
if (strlen($group_name) > 0) {
|
||||
$sql_insert = "insert into v_groups ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "domain_uuid, ";
|
||||
$sql_insert .= "group_uuid, ";
|
||||
$sql_insert .= "group_name, ";
|
||||
$sql_insert .= "group_description ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'$domain_uuid', ";
|
||||
$sql_insert .= "'".uuid()."', ";
|
||||
$sql_insert .= "'$group_name', ";
|
||||
$sql_insert .= "'$group_description' ";
|
||||
$sql_insert .= ")";
|
||||
if (!$db->exec($sql_insert)) {
|
||||
//echo $db->errorCode() . "<br>";
|
||||
$info = $db->errorInfo();
|
||||
print_r($info);
|
||||
// $info[0] == $db->errorCode() unified error code
|
||||
// $info[1] is the driver specific error code
|
||||
// $info[2] is the driver specific error string
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=grouplist.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Group Added\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//include the header
|
||||
include "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<br><br>";
|
||||
echo "<div align='center'>";
|
||||
|
||||
echo "<table width='100%' cellpadding='6' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " Please choose a group name. ";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='grouplist.php'\" value='Back'> ";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br>";
|
||||
|
||||
echo "<form name='login' METHOD=\"POST\" action=\"groupadd.php\">\n";
|
||||
echo "<table width='100%' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncellreq'>\n";
|
||||
echo "Group Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' align='left' class='vtable'>\n";
|
||||
echo " <input type=\"text\" class='formfld' name=\"group_name\">\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq'>\n";
|
||||
echo "Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td align='left' class='vtable'>\n";
|
||||
echo "<textarea name='group_description' class='formfld'></textarea>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td>\n";
|
||||
echo "</td>\n";
|
||||
echo "<td align=\"right\">\n";
|
||||
echo " <input type=\"hidden\" name=\"path\" value=\"$path\">\n";
|
||||
echo " <input type=\"submit\" class='btn' value=\"Save\">\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</form>";
|
||||
echo "</div>";
|
||||
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
//include the footer
|
||||
include "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('group_delete') || if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the http value and set as a variable
|
||||
$id = check_str($_GET["id"]);
|
||||
|
||||
//delete the group
|
||||
$sqldelete = "delete from v_groups ";
|
||||
$sqldelete .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sqldelete .= "and group_uuid = '$id' ";
|
||||
if (!$db->exec($sqldelete)) {
|
||||
//echo $db->errorCode() . "<br>";
|
||||
$info = $db->errorInfo();
|
||||
print_r($info);
|
||||
// $info[0] == $db->errorCode() unified error code
|
||||
// $info[1] is the driver specific error code
|
||||
// $info[2] is the driver specific error string
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header("Location: grouplist.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,137 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
|
||||
//check the permissions
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div class='' style='padding:0px;'>\n";
|
||||
echo "<table width='100%'>";
|
||||
echo "<td>";
|
||||
|
||||
echo "<table width='100%' border='0'><tr>";
|
||||
echo "<td width='50%'><b>Group List</b></td>";
|
||||
echo "<td width='50%' align='right'>";
|
||||
if (permission_exists('user_view')) {
|
||||
echo " <input type='button' class='btn' onclick=\"window.location='index.php'\" value='User Manager'>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr></table>";
|
||||
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$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";
|
||||
$strlist .= " <th align=\"left\" nowrap> Group Name </th>\n";
|
||||
$strlist .= " <th align=\"left\" nowrap> Group Description </th>\n";
|
||||
$strlist .= " <th align=\"center\" nowrap> </th>\n";
|
||||
|
||||
$strlist .= " <td width='22px' align=\"right\" nowrap>\n";
|
||||
if (permission_exists('group_add')) {
|
||||
$strlist .= " <a href='groupadd.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
$strlist .= " </td>\n";
|
||||
$strlist .= "</tr>\n";
|
||||
|
||||
$count = 0;
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$group_name = $row["group_name"];
|
||||
$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>";
|
||||
$strlist .= "<td class='".$row_style[$c]."' align=\"left\" class='' nowrap> $group_name </td>\n";
|
||||
$strlist .= "<td class='".$row_style[$c]."' align=\"left\" class='' nowrap> $group_description </td>\n";
|
||||
|
||||
$strlist .= "<td class='".$row_style[$c]."' align=\"center\" nowrap>\n";
|
||||
if (permission_exists('group_add') || if_group("superadmin")) {
|
||||
$strlist .= " <a class='' href='group_permissions.php?group_name=$group_name' title='Group Permissions'>Permissions</a> ";
|
||||
}
|
||||
if (permission_exists('group_member_view') || if_group("superadmin")) {
|
||||
$strlist .= " <a class='' href='groupmembers.php?group_name=$group_name' title='Group Members'>Members</a> ";
|
||||
}
|
||||
$strlist .= "</td>\n";
|
||||
|
||||
$strlist .= "<td align=\"right\" nowrap>\n";
|
||||
$strlist .= "<a href='groupdelete.php?id=$group_uuid' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
|
||||
|
||||
$strlist .= "</td>\n";
|
||||
$strlist .= "</tr>\n";
|
||||
}
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
$count++;
|
||||
}
|
||||
|
||||
$strlist .= "<tr>\n";
|
||||
$strlist .= "<td colspan='4' align='right' height='20'>\n";
|
||||
if (permission_exists('group_add')) {
|
||||
$strlist .= " <a href='groupadd.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
$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
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('group_member_add') || if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//requires a superadmin to add a user to the superadmin group
|
||||
if (!if_group("superadmin") && $_GET["group_name"] == "superadmin") {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the http values and set them as variables
|
||||
$group_name = check_str($_POST["group_name"]);
|
||||
$user_uuid = check_str($_POST["user_uuid"]);
|
||||
|
||||
if (strlen($user_uuid) > 0 && strlen($group_name) > 0) {
|
||||
$sql_insert = "insert into v_group_users ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "group_user_uuid, ";
|
||||
$sql_insert .= "domain_uuid, ";
|
||||
$sql_insert .= "group_name, ";
|
||||
$sql_insert .= "user_uuid ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".uuid()."', ";
|
||||
$sql_insert .= "'$domain_uuid', ";
|
||||
$sql_insert .= "'$group_name', ";
|
||||
$sql_insert .= "'$user_uuid' ";
|
||||
$sql_insert .= ")";
|
||||
if (!$db->exec($sql_insert)) {
|
||||
//echo $db->errorCode() . "<br>";
|
||||
$info = $db->errorInfo();
|
||||
print_r($info);
|
||||
// $info[0] == $db->errorCode() unified error code
|
||||
// $info[1] is the driver specific error code
|
||||
// $info[2] is the driver specific error string
|
||||
}
|
||||
else {
|
||||
//log the success
|
||||
//$log_type = 'group'; $log_status='add'; $log_add_user=$_SESSION["username"]; $log_desc= "username: ".$username." added to group: ".$group_name;
|
||||
//log_add($db, $log_type, $log_status, $log_desc, $log_add_user, $_SERVER["REMOTE_ADDR"]);
|
||||
}
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header("Location: groupmembers.php?group_name=$group_name");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('group_member_delete') || if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//requires a superadmin to delete superadmin group
|
||||
if (!if_group("superadmin") && $_GET["group_name"] == "superadmin") {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the http values and set them as variables
|
||||
$group_name = check_str($_GET["group_name"]);
|
||||
$user_uuid = check_str($_GET["user_uuid"]);
|
||||
|
||||
//delete the group membership
|
||||
$sql_delete = "delete from v_group_users ";
|
||||
$sql_delete .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql_delete .= "and user_uuid = '$user_uuid' ";
|
||||
$sql_delete .= "and group_name = '$group_name' ";
|
||||
if (!$db->exec($sql_delete)) {
|
||||
//echo $db->errorCode() . "<br>";
|
||||
$info = $db->errorInfo();
|
||||
print_r($info);
|
||||
// $info[0] == $db->errorCode() unified error code
|
||||
// $info[1] is the driver specific error code
|
||||
// $info[2] is the driver specific error string
|
||||
}
|
||||
else {
|
||||
//$log_type = 'group'; $log_status='remove'; $log_add_user=$_SESSION["username"]; $log_desc= "username: ".$username." removed from group: ".$group_name;
|
||||
//log_add($db, $log_type, $log_status, $log_desc, $log_add_user, $_SERVER["REMOTE_ADDR"]);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header("Location: groupmembers.php?group_name=$group_name");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,166 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('group_members_view') || if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//requires a superadmin to view members of the superadmin group
|
||||
if (!if_group("superadmin") && $_GET["group_name"] == "superadmin") {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the http value and set as a variable
|
||||
$group_name = $_GET["group_name"];
|
||||
|
||||
//define the if group members function
|
||||
function if_group_members($db, $group_name, $user_uuid) {
|
||||
$sql = "select * from v_group_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and group_name = '$group_name' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) == 0) { return true; } else { return false; }
|
||||
unset ($sql, $prep_statement);
|
||||
}
|
||||
//$exampledatareturned = example("apples", 1);
|
||||
|
||||
//include the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='90%' border='0'><tr><td align='left'>\n";
|
||||
echo "\n";
|
||||
|
||||
echo "<table width='100%' cellpadding='6' cellspacing='1'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'>\n";
|
||||
echo " <span class=\"\" height='50'>Member list for <b>$group_name</b></span>";
|
||||
echo " </td>\n";
|
||||
echo " <td align='right' nowrap='nowrap'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='grouplist.php'\" value='Back'>";
|
||||
echo " \n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
$sql = "SELECT u.user_uuid, u.username, g.group_user_uuid FROM v_group_users as g, v_users as u ";
|
||||
$sql .= "where g.user_uuid = u.user_uuid ";
|
||||
$sql .= "and g.domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and g.group_name = '$group_name' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
|
||||
$strlist = "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
$strlist .= "<tr>\n";
|
||||
$strlist .= " <th align=\"left\" nowrap> Username </th>\n";
|
||||
$strlist .= " <th align=\"left\" nowrap> </th>\n";
|
||||
$strlist .= " <td width='22' align=\"right\" nowrap>\n";
|
||||
$strlist .= " \n";
|
||||
$strlist .= " </td>\n";
|
||||
$strlist .= "</tr>\n";
|
||||
|
||||
$count = 0;
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$group_user_uuid = $row["group_user_uuid"];
|
||||
$username = $row["username"];
|
||||
$user_uuid = $row["user_uuid"];
|
||||
$strlist .= "<tr'>";
|
||||
$strlist .= "<td align=\"left\" class='".$row_style[$c]."' nowrap> $username </td>\n";
|
||||
$strlist .= "<td align=\"left\" class='".$row_style[$c]."' nowrap> </td>\n";
|
||||
$strlist .= "<td align=\"right\" nowrap>\n";
|
||||
if (permission_exists('group_member_delete')) {
|
||||
$strlist .= " <a href='groupmemberdelete.php?user_uuid=$user_uuid&group_name=$group_name' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
|
||||
}
|
||||
$strlist .= "</td>\n";
|
||||
$strlist .= "</tr>\n";
|
||||
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
$count++;
|
||||
}
|
||||
|
||||
$strlist .= "</table>\n";
|
||||
echo $strlist;
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "<br>";
|
||||
|
||||
echo " <div align='center'>";
|
||||
echo " <form method='post' action='groupmemberadd.php'>";
|
||||
echo " <table width='250'>";
|
||||
echo " <tr>";
|
||||
echo " <td width='60%' align='right'>";
|
||||
|
||||
$sql = "SELECT * FROM v_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "order by username ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
|
||||
echo "<select name=\"user_uuid\" style='width: 200px;' class='formfld'>\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
$username = $field['username'];
|
||||
if (if_group_members($db, $group_name, $field['user_uuid'])) {
|
||||
echo "<option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
unset($sql, $result);
|
||||
|
||||
echo " </td>";
|
||||
echo " <td align='right'>";
|
||||
if (permission_exists('group_member_add')) {
|
||||
echo " <input type='hidden' name='group_name' value='$group_name'>";
|
||||
echo " <input type='submit' class='btn' value='Add Member'>";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo " </form>";
|
||||
echo " </div>";
|
||||
echo "<br><br>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('user_view') || if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//include the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the user list
|
||||
echo "<div align='center'>";
|
||||
echo " <table width='100%' border='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td align='left' width='100%'>";
|
||||
require_once "userlist.php";
|
||||
echo " <br />";
|
||||
echo " <br />";
|
||||
echo " <br />";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " </table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
include "includes/footer.php";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,258 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
$username = check_str($_POST["username"]);
|
||||
$password = check_str($_POST["password"]);
|
||||
$confirmpassword = check_str($_POST["confirmpassword"]);
|
||||
$contact_organization = check_str($_POST["contact_organization"]);
|
||||
$contact_name_given = check_str($_POST["contact_name_given"]);
|
||||
$contact_name_family = check_str($_POST["contact_name_family"]);
|
||||
$user_email = check_str($_POST["user_email"]);
|
||||
|
||||
if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
|
||||
|
||||
$msgerror = '';
|
||||
|
||||
//--- begin captcha verification ---------------------
|
||||
//session_start(); //make sure sessions are started
|
||||
if (strtolower($_SESSION["captcha"]) != strtolower($_REQUEST["captcha"]) || strlen($_SESSION["captcha"]) == 0) {
|
||||
//$msgerror .= "Captcha Verification Failed<br>\n";
|
||||
}
|
||||
else {
|
||||
//echo "verified";
|
||||
}
|
||||
//--- end captcha verification -----------------------
|
||||
|
||||
//username is already used.
|
||||
if (strlen($username) == 0) {
|
||||
$msgerror .= "Please provide a Username.<br>\n";
|
||||
}
|
||||
else {
|
||||
$sql = "SELECT * FROM v_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and username = '$username' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) > 0) {
|
||||
$msgerror .= "Please choose a different Username.<br>\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen($password) == 0) { $msgerror .= "Password cannot be blank.<br>\n"; }
|
||||
if ($password != $confirmpassword) { $msgerror .= "Passwords did not match.<br>\n"; }
|
||||
//if (strlen($contact_organization) == 0) { $msgerror .= "Please provide a organization name.<br>\n"; }
|
||||
//if (strlen($contact_name_given) == 0) { $msgerror .= "Please provide a first name.<br>\n"; }
|
||||
//if (strlen($contact_name_family) == 0) { $msgerror .= "Please provide a last name $user_last_name.<br>\n"; }
|
||||
if (strlen($user_email) == 0) { $msgerror .= "Please provide an email.<br>\n"; }
|
||||
|
||||
if (strlen($msgerror) > 0) {
|
||||
require_once "includes/header.php";
|
||||
echo "<div align='center'>";
|
||||
echo "<table><tr><td>";
|
||||
echo $msgerror;
|
||||
echo "</td></tr></table>";
|
||||
require_once "includes/persistform.php";
|
||||
echo persistform($_POST);
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//salt used with the password to create a one way hash
|
||||
$salt = generate_password('20', '4');
|
||||
|
||||
//prepare the uuids
|
||||
$user_uuid = uuid();
|
||||
$contact_uuid = uuid();
|
||||
|
||||
//add the user
|
||||
$sql = "insert into v_users ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "user_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "username, ";
|
||||
$sql .= "password, ";
|
||||
$sql .= "salt, ";
|
||||
$sql .= "user_add_date, ";
|
||||
$sql .= "user_add_user ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$user_uuid', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'$username', ";
|
||||
$sql .= "'".md5($salt.$password)."', ";
|
||||
$sql .= "'".$salt."', ";
|
||||
$sql .= "now(), ";
|
||||
$sql .= "'".$_SESSION["username"]."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add to contacts
|
||||
$sql = "insert into v_contacts ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "contact_uuid, ";
|
||||
$sql .= "contact_type, ";
|
||||
$sql .= "contact_organization, ";
|
||||
$sql .= "contact_name_given, ";
|
||||
$sql .= "contact_name_family, ";
|
||||
$sql .= "contact_nickname, ";
|
||||
$sql .= "contact_email ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$contact_uuid', ";
|
||||
$sql .= "'user', ";
|
||||
$sql .= "'$contact_organization', ";
|
||||
$sql .= "'$contact_name_given', ";
|
||||
$sql .= "'$contact_name_family', ";
|
||||
$sql .= "'$username', ";
|
||||
$sql .= "'$user_email' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//log the success
|
||||
//$log_type = 'user'; $log_status='add'; $log_add_user=$_SESSION["username"]; $log_desc= "username: ".$username." user added.";
|
||||
//log_add($db, $log_type, $log_status, $log_desc, $log_add_user, $_SERVER["REMOTE_ADDR"]);
|
||||
|
||||
$group_name = 'user';
|
||||
$sql = "insert into v_group_users ";
|
||||
$sql .= "(";
|
||||
$sql .= "group_user_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "group_name, ";
|
||||
$sql .= "user_uuid ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'$group_name', ";
|
||||
$sql .= "'$user_uuid' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"3;url=index.php\">\n";
|
||||
echo "<div align='center'>Add Complete</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
$tablewidth ='width="100%"';
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<div class='borderlight' style='padding:10px;'>\n";
|
||||
|
||||
echo "<table border='0' $tablewidth cellpadding='6' cellspacing='0'>";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='80%'>\n";
|
||||
echo " <b>To add a user, please fill out this form completely. All fields are required. </b><br>";
|
||||
echo " </td>\n";
|
||||
echo " <td width='20%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='back' alt='back' onclick=\"window.history.back()\" value='Back'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table border='0' $tablewidth cellpadding='6' cellspacing='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq' width='40%'>Username:</td>";
|
||||
echo " <td class='vtable' width='60%'><input type='text' class='formfld' autocomplete='off' name='username' value='$username'></td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Password:</td>";
|
||||
echo " <td class='vtable'><input type='password' class='formfld' autocomplete='off' name='password' value='$password'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Confirm Password:</td>";
|
||||
echo " <td class='vtable'><input type='password' class='formfld' autocomplete='off' name='confirmpassword' value='$confirmpassword'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncellreq'>Email:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='user_email' value='$user_email'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>First Name:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='contact_name_given' value='$contact_name_given'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Last Name:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='contact_name_family' value='$contact_name_family'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Company Name:</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='contact_organization' value='$contact_organization'></td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='' style='padding:10px;'>\n";
|
||||
echo "<table $tablewidth>";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='2' align='right'>";
|
||||
echo " <input type='submit' name='submit' class='btn' value='Create Account'>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//show the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('user_delete')) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the id
|
||||
$user_uuid = check_str($_GET["id"]);
|
||||
|
||||
//get the username from v_users
|
||||
$sql = "";
|
||||
$sql .= "select * from v_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$username = $row["username"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//required to be a superadmin to delete a member of the superadmin group
|
||||
$superadmin_list = superadmin_list($db);
|
||||
if (if_superadmin($superadmin_list, $_SESSION['user_uuid'])) {
|
||||
if (!if_group("superadmin")) {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
}
|
||||
//delete the user
|
||||
$sql_delete = "delete from v_users ";
|
||||
$sql_delete .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql_delete .= "and user_uuid = '$user_uuid' ";
|
||||
if (!$db->exec($sql_delete)) {
|
||||
//echo $db->errorCode() . "<br>";
|
||||
$info = $db->errorInfo();
|
||||
print_r($info);
|
||||
// $info[0] == $db->errorCode() unified error code
|
||||
// $info[1] is the driver specific error code
|
||||
// $info[2] is the driver specific error string
|
||||
}
|
||||
|
||||
//delete the groups the user is assigned to
|
||||
$sql_delete = "delete from v_group_users ";
|
||||
$sql_delete .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql_delete .= "and user_uuid = '$user_uuid' ";
|
||||
if (!$db->exec($sql_delete)) {
|
||||
$info = $db->errorInfo();
|
||||
print_r($info);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
header("Location: index.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,192 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists("user_view") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
//require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
$field_name = $_REQUEST["field_name"];
|
||||
$field_value = $_REQUEST["field_value"];
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
|
||||
//page title and description
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' width='90%' nowrap><b>User Manager</b></td>\n";
|
||||
echo "<td align='right' nowrap='nowrap'>Search by: </td>";
|
||||
echo "<td align='left'>\n";
|
||||
echo " <select name='field_name' style='width:150px' class='frm'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($field_name == "username") {
|
||||
echo " <option value='username' selected='selected'>Username</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='username'>Username</option>\n";
|
||||
}
|
||||
//if ($field_name == "user_email") {
|
||||
// echo " <option value='user_email' selected='selected'>Email</option>\n";
|
||||
//}
|
||||
//else {
|
||||
// echo " <option value='user_email'>Email</option>\n";
|
||||
//}
|
||||
echo " </select>\n";
|
||||
echo "</td>\n";
|
||||
echo "<td align='left' width='3px'> </td>";
|
||||
echo "<td align='left'><input type='text' class='txt' style='width: 150px' name='field_value' value='$field_value'></td>";
|
||||
echo "<td align='left' width='60px'><input type='submit' class='btn' name='submit' value='search'></td>";
|
||||
//echo " <input type='button' class='btn' name='' alt='view' onclick=\"window.location='user_search.php'\" value='advanced'> \n";
|
||||
echo "</tr>\n";
|
||||
echo "</form>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='4'>\n";
|
||||
echo "Add, edit, delete, and search for users. \n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//get the user list from the database
|
||||
$sql = "";
|
||||
$sql .= " select * from v_users ";
|
||||
$sql .= " where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($field_name) > 0 && strlen($field_value) > 0) {
|
||||
$sql .= " and $field_name = '$field_value' ";
|
||||
}
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$num_rows = count($result);
|
||||
unset ($prep_statement, $result, $sql);
|
||||
$rows_per_page = 200;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
$sql = "";
|
||||
$sql .= " select * from v_users ";
|
||||
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
if (strlen($field_name) > 0 && strlen($field_value) > 0) {
|
||||
$sql .= " and $field_name like '%$field_value%' ";
|
||||
}
|
||||
if (strlen($order_by)> 0) {
|
||||
$sql .= "order by $order_by $order ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by username ";
|
||||
}
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//alternate the row style
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//show the data
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('username', 'Username', $order_by, $order);
|
||||
//echo th_order_by('user_email', 'Email', $order_by, $order);
|
||||
//echo th_order_by('user_template_name', 'Template', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('user_add')) {
|
||||
echo " <a href='signup.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['username']." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['user_email']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('user_edit')) {
|
||||
echo " <a href='usersupdate.php?id=".$row['user_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('user_delete')) {
|
||||
echo " <a href='userdelete.php?id=".$row['user_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='49' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('user_add')) {
|
||||
echo " <a href='signup.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,612 @@
|
||||
<?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-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists("user_add") ||
|
||||
permission_exists("user_edit") ||
|
||||
permission_exists("user_delete") ||
|
||||
if_group("superadmin")) {
|
||||
//access allowed
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
//get data from the db
|
||||
if (strlen($_REQUEST["id"])> 0) {
|
||||
$user_uuid = $_REQUEST["id"];
|
||||
}
|
||||
else {
|
||||
if (strlen($_SESSION["username"]) > 0) {
|
||||
$username = $_SESSION["username"];
|
||||
}
|
||||
}
|
||||
|
||||
//get the username from v_users
|
||||
$sql = "select * from v_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$username = $row["username"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//required to be a superadmin to update an account that is a member of the superadmin group
|
||||
$superadmin_list = superadmin_list($db);
|
||||
if (if_superadmin($superadmin_list, $_SESSION['user_uuid'])) {
|
||||
if (!if_group("superadmin")) {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//delete the group from the user
|
||||
if ($_GET["a"] == "delete" && permission_exists("user_delete")) {
|
||||
//set the variables
|
||||
$group_name = check_str($_GET["group_name"]);
|
||||
//delete the group from the users
|
||||
$sql = "delete from v_group_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and group_name = '$group_name' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
$db->exec(check_sql($sql));
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=usersupdate.php?id=$user_uuid\">\n";
|
||||
echo "<div align='center'>Update Complete</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the user settings
|
||||
$sql = "select * from v_user_settings ";
|
||||
$sql .= "where user_uuid = '".$_SESSION["user_uuid"]."' ";
|
||||
$sql .= "and user_setting_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$name = $row['user_setting_name'];
|
||||
$category = $row['user_setting_category'];
|
||||
$subcategory = $row['user_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
$user_settings[$category][$name] = $row['user_setting_value'];
|
||||
}
|
||||
else {
|
||||
$user_settings[$category][$subcategory][$name] = $row['user_setting_value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && $_POST["persistform"] != "1") {
|
||||
$user_uuid = $_REQUEST["id"];
|
||||
$password = check_str($_POST["password"]);
|
||||
$confirm_password = check_str($_POST["confirm_password"]);
|
||||
$user_status = check_str($_POST["user_status"]);
|
||||
//$user_template_name = check_str($_POST["user_template_name"]);
|
||||
$user_time_zone = check_str($_POST["user_time_zone"]);
|
||||
$contact_uuid = check_str($_POST["contact_uuid"]);
|
||||
$group_member = check_str($_POST["group_member"]);
|
||||
|
||||
//if (strlen($password) == 0) { $msg_error .= "Password cannot be blank.<br>\n"; }
|
||||
//if (strlen($username) == 0) { $msg_error .= "Please provide the username.<br>\n"; }
|
||||
if ($password != $confirm_password) { $msg_error .= "Passwords did not match.<br>\n"; }
|
||||
//if (strlen($contact_uuid) == 0) { $msg_error .= "Please provide an email.<br>\n"; }
|
||||
//if (strlen($user_time_zone) == 0) { $msg_error .= "Please provide an time zone.<br>\n"; }
|
||||
if ($msg_error) {
|
||||
require_once "includes/header.php";
|
||||
echo "<div align='center'>";
|
||||
echo "<table><tr><td>";
|
||||
echo $msg_error;
|
||||
echo "</td></tr></table>";
|
||||
echo "<br />\n";
|
||||
require_once "includes/persistform.php";
|
||||
echo persistform($_POST);
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the number of rows in v_user_settings
|
||||
$sql = "select count(*) as num_rows from v_user_settings ";
|
||||
$sql .= "where user_setting_category = 'domain' ";
|
||||
$sql .= "and user_setting_subcategory = 'time_zone' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] == 0) {
|
||||
$user_setting_uuid = uuid();
|
||||
$sql = "insert into v_user_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "user_setting_uuid, ";
|
||||
$sql .= "user_setting_category, ";
|
||||
$sql .= "user_setting_subcategory, ";
|
||||
$sql .= "user_setting_name, ";
|
||||
$sql .= "user_setting_value, ";
|
||||
$sql .= "user_setting_enabled, ";
|
||||
$sql .= "user_uuid ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$user_setting_uuid."', ";
|
||||
$sql .= "'domain', ";
|
||||
$sql .= "'time_zone', ";
|
||||
$sql .= "'name', ";
|
||||
$sql .= "'".$user_time_zone."', ";
|
||||
$sql .= "'true', ";
|
||||
$sql .= "'".$user_uuid."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
}
|
||||
else {
|
||||
if (strlen($user_time_zone) == 0) {
|
||||
$sql = "delete from v_user_settings ";
|
||||
$sql .= "where user_setting_category = 'domain' ";
|
||||
$sql .= "and user_setting_subcategory = 'time_zone' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
else {
|
||||
$sql = "update v_user_settings set ";
|
||||
$sql .= "user_setting_value = '".$user_time_zone."', ";
|
||||
$sql .= "user_setting_enabled = 'true' ";
|
||||
$sql .= "where user_setting_category = 'domain' ";
|
||||
$sql .= "and user_setting_subcategory = 'time_zone' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//assign the user to the group
|
||||
if (strlen($_REQUEST["group_name"]) > 0) {
|
||||
$sql_insert = "insert into v_group_users ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "group_user_uuid, ";
|
||||
$sql_insert .= "domain_uuid, ";
|
||||
$sql_insert .= "group_name, ";
|
||||
$sql_insert .= "user_uuid ";
|
||||
$sql_insert .= ")";
|
||||
$sql_insert .= "values ";
|
||||
$sql_insert .= "(";
|
||||
$sql_insert .= "'".uuid()."', ";
|
||||
$sql_insert .= "'$domain_uuid', ";
|
||||
$sql_insert .= "'".$_REQUEST["group_name"]."', ";
|
||||
$sql_insert .= "'$user_uuid' ";
|
||||
$sql_insert .= ")";
|
||||
if ($_REQUEST["group_name"] == "superadmin") {
|
||||
//only a user in the superadmin group can add other users to that group
|
||||
if (if_group("superadmin")) {
|
||||
$db->exec($sql_insert);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$db->exec($sql_insert);
|
||||
}
|
||||
}
|
||||
|
||||
//if the template has not been assigned by the superadmin
|
||||
//if (strlen($_SESSION['domain']['template']['name']) == 0) {
|
||||
//set the session theme for the active user
|
||||
// if ($_SESSION["username"] == $username) {
|
||||
// $_SESSION['domain']['template']['name'] = $user_template_name;
|
||||
// }
|
||||
//}
|
||||
|
||||
//sql update
|
||||
$sql = "update v_users set ";
|
||||
if (if_group("admin") && strlen($_POST["username"])> 0) {
|
||||
$sql .= "username = '$username', ";
|
||||
}
|
||||
if (strlen($password) > 0 && $confirm_password == $password) {
|
||||
//salt used with the password to create a one way hash
|
||||
$salt = generate_password('20', '4');
|
||||
//set the password
|
||||
$sql .= "password = '".md5($salt.$password)."', ";
|
||||
$sql .= "salt = '".$salt."', ";
|
||||
}
|
||||
$sql .= "user_status = '$user_status', ";
|
||||
if (strlen($contact_uuid) == 0) {
|
||||
$sql .= "contact_uuid = null ";
|
||||
}
|
||||
else {
|
||||
$sql .= "contact_uuid = '$contact_uuid' ";
|
||||
}
|
||||
if (strlen($user_uuid)> 0) {
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
}
|
||||
else {
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and username = '$username' ";
|
||||
}
|
||||
$db->exec(check_sql($sql));
|
||||
|
||||
//update the user_status
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
$switch_cmd .= "callcenter_config agent set status ".$username."@".$_SESSION['domain_name']." '".$user_status."'";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
|
||||
//update the user state
|
||||
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
|
||||
//clear the template so it will rebuild in case the template was changed
|
||||
//$_SESSION["template_content"] = '';
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
if (if_group("admin")) {
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=usersupdate.php?id=$user_uuid\">\n";
|
||||
}
|
||||
else {
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=usersupdate.php?id=$user_uuid\">\n";
|
||||
}
|
||||
echo "<div align='center'>Update Complete</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$sql = "select * from v_users ";
|
||||
//allow admin access
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
if (strlen($user_uuid)> 0) {
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
}
|
||||
else {
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and username = '$username' ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and username = '$username' ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$user_uuid = $row["user_uuid"];
|
||||
if (if_group("admin")) {
|
||||
$username = $row["username"];
|
||||
}
|
||||
$password = $row["password"];
|
||||
$contact_uuid = $row["contact_uuid"];
|
||||
$user_status = $row["user_status"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
|
||||
//get the groups the user is a member of
|
||||
//group_members function defined in config.php
|
||||
$group_members = group_members($db, $user_uuid);
|
||||
}
|
||||
|
||||
//include the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
$table_width ='width="100%"';
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td>\n";
|
||||
|
||||
echo "<table $table_width cellpadding='3' cellspacing='0' border='0'>";
|
||||
echo "<td align='left' width='90%' nowrap><b>User Manager</b></td>\n";
|
||||
echo "<td nowrap='nowrap'>\n";
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>";
|
||||
echo " <input type='button' class='btn' onclick=\"window.location='index.php'\" value='Back'>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo " Edit user information and group membership. \n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<table $table_width cellpadding='6' cellspacing='0' border='0'>";
|
||||
echo "<tr>\n";
|
||||
echo " <th class='th' colspan='2' align='left'>User Info</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td width='30%' class='vncellreq'>Username:</td>";
|
||||
echo " <td width='70%' class='vtable'>$username</td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Password:</td>";
|
||||
echo " <td class='vtable'><input type='password' autocomplete='off' class='formfld' name='password' value=\"\"></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>Confirm Password:</td>";
|
||||
echo " <td class='vtable'><input type='password' autocomplete='off' class='formfld' name='confirm_password' value=\"\"></td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>Groups:</td>";
|
||||
echo " <td class='vtable'>";
|
||||
|
||||
echo "<table width='52%'>\n";
|
||||
$sql = "SELECT * FROM v_group_users ";
|
||||
$sql .= "where domain_uuid=:domain_uuid ";
|
||||
$sql .= "and user_uuid=:user_uuid ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->bindParam(':domain_uuid', $domain_uuid);
|
||||
$prep_statement->bindParam(':user_uuid', $user_uuid);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
foreach($result as $field) {
|
||||
if (strlen($field['group_name']) > 0) {
|
||||
echo "<tr>\n";
|
||||
echo " <td class='vtable'>".$field['group_name']."</td>\n";
|
||||
echo " <td>\n";
|
||||
if (permission_exists('group_member_delete') || if_group("superadmin")) {
|
||||
echo " <a href='usersupdate.php?id=".$user_uuid."&domain_uuid=".$domain_uuid."&group_name=".$field['group_name']."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo "<select name=\"group_name\" class='frm'>\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
if ($field['group_name'] == "superadmin") {
|
||||
//only show the superadmin group to other users in the superadmin group
|
||||
if (if_group("superadmin")) {
|
||||
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo "</select>";
|
||||
echo "<input type=\"submit\" class='btn' value=\"Add\">\n";
|
||||
unset($sql, $result);
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo "<br>";
|
||||
echo "<br>";
|
||||
|
||||
echo "<table $table_width cellpadding='6' cellspacing='0'>";
|
||||
echo " <tr>\n";
|
||||
echo " <th class='th' colspan='2' align='left'>Additional Info</th>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td width='30%' class='vncell'>Contact:</td>";
|
||||
echo " <td width='70%' class='vtable'>\n";
|
||||
$sql = " select contact_uuid, contact_organization, contact_name_given, contact_name_family from v_contacts ";
|
||||
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= " order by contact_organization asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
echo "<select name=\"contact_uuid\" id=\"contact_uuid\" class=\"formfld\">\n";
|
||||
echo "<option value=\"\"></option>\n";
|
||||
foreach($result as $row) {
|
||||
$contact_name = '';
|
||||
if (strlen($row['contact_organization']) > 0) {
|
||||
$contact_name = $row['contact_organization'];
|
||||
}
|
||||
if (strlen($row['contact_name_family']) > 0) {
|
||||
if (strlen($contact_name) > 0) { $contact_name .= ", "; }
|
||||
$contact_name .= $row['contact_name_family'];
|
||||
}
|
||||
if (strlen($row['contact_name_given']) > 0) {
|
||||
if (strlen($contact_name) > 0) { $contact_name .= ", "; }
|
||||
$contact_name .= $row['contact_name_given'];
|
||||
}
|
||||
if ($row['contact_uuid'] == $contact_uuid) {
|
||||
echo "<option value=\"".$row['contact_uuid']."\" selected=\"selected\">".$contact_name."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo "<option value=\"".$row['contact_uuid']."\">".$contact_name."</option>\n";
|
||||
}
|
||||
}
|
||||
unset($sql, $result, $row_count);
|
||||
echo "</select>\n";
|
||||
echo "<br />\n";
|
||||
echo "Assign a contact to this user account.\n";
|
||||
if (strlen($contact_uuid) > 0) {
|
||||
echo " <a href=\"/app/contacts/contacts_edit.php?id=$contact_uuid\">View</a>\n";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
|
||||
if ($_SESSION['user_status_display'] == "false") {
|
||||
//hide the user_status when it is set to false
|
||||
}
|
||||
else {
|
||||
echo " <tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " Status:\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"vtable\">\n";
|
||||
$cmd = "'".PROJECT_PATH."/app/calls_active/v_calls_exec.php?cmd=callcenter_config+agent+set+status+".$_SESSION['username']."@".$_SESSION['domain_name']."+'+this.value";
|
||||
echo " <select id='user_status' name='user_status' class='formfld' style='' onchange=\"send_cmd($cmd);\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($user_status == "Available") {
|
||||
echo " <option value='Available' selected='selected'>Available</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Available'>Available</option>\n";
|
||||
}
|
||||
if ($user_status == "Available (On Demand)") {
|
||||
echo " <option value='Available (On Demand)' selected='selected'>Available (On Demand)</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Available (On Demand)'>Available (On Demand)</option>\n";
|
||||
}
|
||||
if ($user_status == "Logged Out") {
|
||||
echo " <option value='Logged Out' selected='selected'>Logged Out</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Logged Out'>Logged Out</option>\n";
|
||||
}
|
||||
if ($user_status == "On Break") {
|
||||
echo " <option value='On Break' selected='selected'>On Break</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='On Break'>On Break</option>\n";
|
||||
}
|
||||
if ($user_status == "Do Not Disturb") {
|
||||
echo " <option value='Do Not Disturb' selected='selected'>Do Not Disturb</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Do Not Disturb'>Do Not Disturb</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " Select a the user status.<br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
|
||||
//if the template has not been assigned by the superadmin
|
||||
/*
|
||||
if (strlen($_SESSION['domain']['template']['name']) == 0) {
|
||||
echo " <tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " Template: \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"vtable\">\n";
|
||||
echo " <select id='user_template_name' name='user_template_name' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
|
||||
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
|
||||
while (false !== ($dir_name = readdir($handle))) {
|
||||
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && is_dir($theme_dir.'/'.$dir_name)) {
|
||||
$dir_label = str_replace('_', ' ', $dir_name);
|
||||
$dir_label = str_replace('-', ' ', $dir_label);
|
||||
if ($dir_name == $user_settings['domain']['template']['name']) {
|
||||
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='$dir_name'>$dir_label</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " Select a template to set as the default and then press save.<br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
*/
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " Time Zone: \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"vtable\" align='left'>\n";
|
||||
echo " <select id='user_time_zone' name='user_time_zone' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//$list = DateTimeZone::listAbbreviations();
|
||||
$time_zone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$previous_category = '';
|
||||
$x = 0;
|
||||
foreach ($time_zone_identifiers as $key => $row) {
|
||||
$time_zone = explode("/", $row);
|
||||
$category = $time_zone[0];
|
||||
if ($category != $previous_category) {
|
||||
if ($x > 0) {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " <optgroup label='".$category."'>\n";
|
||||
}
|
||||
if ($row == $user_settings['domain']['time_zone']['name']) {
|
||||
echo " <option value='".$row."' selected='selected'>".$row."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$row."'>".$row."</option>\n";
|
||||
}
|
||||
$previous_category = $category;
|
||||
$x++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " Select the default time zone.<br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
echo " </table>";
|
||||
echo "<br>";
|
||||
|
||||
echo "<div class='' style='padding:10px;'>\n";
|
||||
echo "<table $table_width>";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='2' align='right'>";
|
||||
echo " <input type='hidden' name='id' value=\"$user_uuid\">";
|
||||
echo " <input type='hidden' name='username' value=\"$username\">";
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user