Move core/servers to apps

This commit is contained in:
Mark Crane
2012-11-24 00:46:46 +00:00
parent 07da8c782f
commit 0791238cfa
8 changed files with 0 additions and 1036 deletions

View File

@@ -1,98 +0,0 @@
<?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-us'] = '';
//menu details
$apps[$x]['menu'][0]['title']['en-us'] = '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/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-us'] = '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-us'] = '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-us'] = '';
$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-us'] = '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-us'] = '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-us'] = '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-us'] = '';
$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-us'] = '';
*/
?>

View File

@@ -1,50 +0,0 @@
<?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'] );
}
?>

View File

@@ -1,159 +0,0 @@
<?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'>&nbsp;</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 = "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 = "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='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']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_setting_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_setting_value']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='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='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>&nbsp;</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='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";
?>

View File

@@ -1,60 +0,0 @@
<?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=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;
?>

View File

@@ -1,244 +0,0 @@
<?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=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=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='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";
?>

View File

@@ -1,156 +0,0 @@
<?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'>&nbsp;</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 = " 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 = "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='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']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['server_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='servers_edit.php?id=".$row[server_uuid]."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='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>&nbsp;</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='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";
?>

View File

@@ -1,58 +0,0 @@
<?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 = "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=servers.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>

View File

@@ -1,211 +0,0 @@
<?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=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=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 = "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='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 "server_settings.php";
}
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "includes/footer.php";
?>