find . -name "*.php" | xargs dos2unix
This commit is contained in:
Mafoo 2017-06-13 06:09:36 +01:00 committed by FusionPBX
parent 6c97a1ae3d
commit 7bdea2c30c
32 changed files with 9072 additions and 9072 deletions

View File

@ -1,32 +1,32 @@
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//proccess this only one time
if ($domains_processed == 1) {
}
?>
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//proccess this only one time
if ($domains_processed == 1) {
}
?>

View File

@ -1,31 +1,31 @@
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//process this only one time
if ($domains_processed == 1) {
}
?>
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//process this only one time
if ($domains_processed == 1) {
}
?>

View File

@ -1,131 +1,131 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//add the conference controls list to the database
$sql = "select count(*) as num_rows from v_conference_controls; ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
//set the directory
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
$xml_file = $xml_dir."/conference.conf";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/resources/templates/conf/autoload_configs/conference.conf';
//rename the file
if (file_exists($xml_dir.'/conference.conf.xml.noload')) {
rename($xml_dir.'/conference.conf.xml.noload', $xml_dir.'/conference.conf');
}
//load the xml and save it into an array
if (file_exists($xml_file)) {
$xml_string = file_get_contents($xml_file);
}
elseif (file_exists($xml_file_alt)) {
$xml_string = file_get_contents($xml_file_alt);
}
$xml_object = simplexml_load_string($xml_string);
$json = json_encode($xml_object);
$conf_array = json_decode($json, true);
//process the array
foreach ($conf_array['caller-controls']['group'] as $row) {
//get the data from the array
$control_name = $row['@attributes']['name'];
//echo $profile_name."<br />\n";
//insert the data into the database
$conference_control_uuid = uuid();
$sql = "insert into v_conference_controls ";
$sql .= "(";
//$sql .= "domain_uuid, ";
$sql .= "conference_control_uuid, ";
$sql .= "control_name, ";
$sql .= "control_enabled ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
//$sql .= "'".$domain_uuid."', ";
$sql .= "'".$conference_control_uuid."', ";
$sql .= "'".check_str($control_name)."', ";
$sql .= "'true' ";
$sql .= ");";
//echo $sql."\n";
$db->exec(check_sql($sql));
unset($sql);
//insert the profile params
foreach ($row['control'] as $p) {
//get the name
//print_r($p);
$control_action = $p['@attributes']['action'];
$control_digits = $p['@attributes']['digits'];
$control_data = $p['@attributes']['data'];
$control_enabled = 'true';
//add the coference profile params
$conference_control_detail_uuid = uuid();
$sql = "insert into v_conference_control_details ";
$sql .= "(";
$sql .= "conference_control_uuid, ";
$sql .= "conference_control_detail_uuid, ";
$sql .= "control_digits, ";
$sql .= "control_action, ";
if (strlen($control_data) > 0) {
$sql .= "control_data, ";
}
$sql .= "control_enabled ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$conference_control_uuid."', ";
$sql .= "'".$conference_control_detail_uuid."', ";
$sql .= "'".$control_digits."', ";
$sql .= "'".$control_action."', ";
if (strlen($control_data) > 0) {
$sql .= "'".$control_data."', ";
}
$sql .= "'".$control_enabled."' ";
$sql .= ");";
//echo $sql."\n";
$db->exec(check_sql($sql));
unset($sql);
}
}
} //if num_rows
} //if prep_statement
}
?>
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//add the conference controls list to the database
$sql = "select count(*) as num_rows from v_conference_controls; ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) {
//set the directory
$xml_dir = $_SESSION["switch"]["conf"]["dir"].'/autoload_configs';
$xml_file = $xml_dir."/conference.conf";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/resources/templates/conf/autoload_configs/conference.conf';
//rename the file
if (file_exists($xml_dir.'/conference.conf.xml.noload')) {
rename($xml_dir.'/conference.conf.xml.noload', $xml_dir.'/conference.conf');
}
//load the xml and save it into an array
if (file_exists($xml_file)) {
$xml_string = file_get_contents($xml_file);
}
elseif (file_exists($xml_file_alt)) {
$xml_string = file_get_contents($xml_file_alt);
}
$xml_object = simplexml_load_string($xml_string);
$json = json_encode($xml_object);
$conf_array = json_decode($json, true);
//process the array
foreach ($conf_array['caller-controls']['group'] as $row) {
//get the data from the array
$control_name = $row['@attributes']['name'];
//echo $profile_name."<br />\n";
//insert the data into the database
$conference_control_uuid = uuid();
$sql = "insert into v_conference_controls ";
$sql .= "(";
//$sql .= "domain_uuid, ";
$sql .= "conference_control_uuid, ";
$sql .= "control_name, ";
$sql .= "control_enabled ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
//$sql .= "'".$domain_uuid."', ";
$sql .= "'".$conference_control_uuid."', ";
$sql .= "'".check_str($control_name)."', ";
$sql .= "'true' ";
$sql .= ");";
//echo $sql."\n";
$db->exec(check_sql($sql));
unset($sql);
//insert the profile params
foreach ($row['control'] as $p) {
//get the name
//print_r($p);
$control_action = $p['@attributes']['action'];
$control_digits = $p['@attributes']['digits'];
$control_data = $p['@attributes']['data'];
$control_enabled = 'true';
//add the coference profile params
$conference_control_detail_uuid = uuid();
$sql = "insert into v_conference_control_details ";
$sql .= "(";
$sql .= "conference_control_uuid, ";
$sql .= "conference_control_detail_uuid, ";
$sql .= "control_digits, ";
$sql .= "control_action, ";
if (strlen($control_data) > 0) {
$sql .= "control_data, ";
}
$sql .= "control_enabled ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$conference_control_uuid."', ";
$sql .= "'".$conference_control_detail_uuid."', ";
$sql .= "'".$control_digits."', ";
$sql .= "'".$control_action."', ";
if (strlen($control_data) > 0) {
$sql .= "'".$control_data."', ";
}
$sql .= "'".$control_enabled."' ";
$sql .= ");";
//echo $sql."\n";
$db->exec(check_sql($sql));
unset($sql);
}
}
} //if num_rows
} //if prep_statement
}
?>

View File

@ -1,49 +1,49 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET) > 0) {
$id = check_str($_GET["id"]);
}
//delete the data
if (strlen($id) > 0) {
//delete conference_control_detail
$sql = "delete from v_conference_control_details ";
$sql .= "where conference_control_uuid = '$id' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//delete conference_control
$sql = "delete from v_conference_controls ";
$sql .= "where conference_control_uuid = '$id' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: conference_controls.php');
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET) > 0) {
$id = check_str($_GET["id"]);
}
//delete the data
if (strlen($id) > 0) {
//delete conference_control_detail
$sql = "delete from v_conference_control_details ";
$sql .= "where conference_control_uuid = '$id' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
//delete conference_control
$sql = "delete from v_conference_controls ";
$sql .= "where conference_control_uuid = '$id' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: conference_controls.php');
?>

View File

@ -1,42 +1,42 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_detail_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET) > 0) {
$id = check_str($_GET["id"]);
$conference_control_uuid = check_str($_GET["conference_control_uuid"]);
}
//delete the data
if (strlen($id) > 0) {
//delete conference_control_detail
$sql = "delete from v_conference_control_details ";
$sql .= "where conference_control_detail_uuid = '$id' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: conference_control_detail_edit.php?id='.$conference_control_uuid);
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_detail_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET) > 0) {
$id = check_str($_GET["id"]);
$conference_control_uuid = check_str($_GET["conference_control_uuid"]);
}
//delete the data
if (strlen($id) > 0) {
//delete conference_control_detail
$sql = "delete from v_conference_control_details ";
$sql .= "where conference_control_detail_uuid = '$id' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: conference_control_detail_edit.php?id='.$conference_control_uuid);
?>

View File

@ -1,226 +1,226 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_detail_add') || permission_exists('conference_control_detail_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$conference_control_detail_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//set the parent uuid
if (strlen($_GET["conference_control_uuid"]) > 0) {
$conference_control_uuid = check_str($_GET["conference_control_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$control_digits = check_str($_POST["control_digits"]);
$control_action = check_str($_POST["control_action"]);
$control_data = check_str($_POST["control_data"]);
$control_enabled = check_str($_POST["control_enabled"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//get the uuid
if ($action == "update") {
$conference_control_detail_uuid = check_str($_POST["conference_control_detail_uuid"]);
}
//check for all required data
$msg = '';
//if (strlen($control_digits) == 0) { $msg .= $text['message-required']." ".$text['label-control_digits']."<br>\n"; }
if (strlen($control_action) == 0) { $msg .= $text['message-required']." ".$text['label-control_action']."<br>\n"; }
//if (strlen($control_data) == 0) { $msg .= $text['message-required']." ".$text['label-control_data']."<br>\n"; }
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('conference_control_detail_add')) {
$sql = "insert into v_conference_control_details ";
$sql .= "(";
//$sql .= "domain_uuid, ";
$sql .= "conference_control_detail_uuid, ";
$sql .= "conference_control_uuid, ";
$sql .= "control_digits, ";
$sql .= "control_action, ";
$sql .= "control_data, ";
$sql .= "control_enabled ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
//$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$conference_control_uuid', ";
$sql .= "'$control_digits', ";
$sql .= "'$control_action', ";
$sql .= "'$control_data', ";
$sql .= "'$control_enabled' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header('Location: conference_control_edit.php?id='.$conference_control_uuid);
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('conference_control_detail_edit')) {
$sql = "update v_conference_control_details set ";
$sql .= "conference_control_uuid = '$conference_control_uuid', ";
$sql .= "control_digits = '$control_digits', ";
$sql .= "control_action = '$control_action', ";
$sql .= "control_data = '$control_data', ";
$sql .= "control_enabled = '$control_enabled' ";
$sql .= "where conference_control_detail_uuid = '$conference_control_detail_uuid'";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header('Location: conference_control_edit.php?id='.$conference_control_uuid);
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") {
$conference_control_detail_uuid = check_str($_GET["id"]);
$sql = "select * from v_conference_control_details ";
$sql .= "where conference_control_detail_uuid = '$conference_control_detail_uuid' ";
//$sql .= "and 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) {
$control_digits = $row["control_digits"];
$control_action = $row["control_action"];
$control_data = $row["control_data"];
$control_enabled = $row["control_enabled"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-conference_control_detail']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='conference_control_edit.php?id=$conference_control_uuid'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_digits']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_digits' maxlength='255' value='$control_digits'>\n";
echo "<br />\n";
echo $text['description-control_digits']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_action']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_action' maxlength='255' value=\"$control_action\">\n";
echo "<br />\n";
echo $text['description-control_action']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_data']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_data' maxlength='255' value=\"$control_data\">\n";
echo "<br />\n";
echo $text['description-control_data']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='control_enabled'>\n";
echo " <option value=''></option>\n";
if ($control_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($control_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-control_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='conference_control_uuid' value='$conference_control_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='conference_control_detail_uuid' value='$conference_control_detail_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_detail_add') || permission_exists('conference_control_detail_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$conference_control_detail_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//set the parent uuid
if (strlen($_GET["conference_control_uuid"]) > 0) {
$conference_control_uuid = check_str($_GET["conference_control_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$control_digits = check_str($_POST["control_digits"]);
$control_action = check_str($_POST["control_action"]);
$control_data = check_str($_POST["control_data"]);
$control_enabled = check_str($_POST["control_enabled"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//get the uuid
if ($action == "update") {
$conference_control_detail_uuid = check_str($_POST["conference_control_detail_uuid"]);
}
//check for all required data
$msg = '';
//if (strlen($control_digits) == 0) { $msg .= $text['message-required']." ".$text['label-control_digits']."<br>\n"; }
if (strlen($control_action) == 0) { $msg .= $text['message-required']." ".$text['label-control_action']."<br>\n"; }
//if (strlen($control_data) == 0) { $msg .= $text['message-required']." ".$text['label-control_data']."<br>\n"; }
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('conference_control_detail_add')) {
$sql = "insert into v_conference_control_details ";
$sql .= "(";
//$sql .= "domain_uuid, ";
$sql .= "conference_control_detail_uuid, ";
$sql .= "conference_control_uuid, ";
$sql .= "control_digits, ";
$sql .= "control_action, ";
$sql .= "control_data, ";
$sql .= "control_enabled ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
//$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$conference_control_uuid', ";
$sql .= "'$control_digits', ";
$sql .= "'$control_action', ";
$sql .= "'$control_data', ";
$sql .= "'$control_enabled' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header('Location: conference_control_edit.php?id='.$conference_control_uuid);
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('conference_control_detail_edit')) {
$sql = "update v_conference_control_details set ";
$sql .= "conference_control_uuid = '$conference_control_uuid', ";
$sql .= "control_digits = '$control_digits', ";
$sql .= "control_action = '$control_action', ";
$sql .= "control_data = '$control_data', ";
$sql .= "control_enabled = '$control_enabled' ";
$sql .= "where conference_control_detail_uuid = '$conference_control_detail_uuid'";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header('Location: conference_control_edit.php?id='.$conference_control_uuid);
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") {
$conference_control_detail_uuid = check_str($_GET["id"]);
$sql = "select * from v_conference_control_details ";
$sql .= "where conference_control_detail_uuid = '$conference_control_detail_uuid' ";
//$sql .= "and 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) {
$control_digits = $row["control_digits"];
$control_action = $row["control_action"];
$control_data = $row["control_data"];
$control_enabled = $row["control_enabled"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-conference_control_detail']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='conference_control_edit.php?id=$conference_control_uuid'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_digits']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_digits' maxlength='255' value='$control_digits'>\n";
echo "<br />\n";
echo $text['description-control_digits']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_action']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_action' maxlength='255' value=\"$control_action\">\n";
echo "<br />\n";
echo $text['description-control_action']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_data']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_data' maxlength='255' value=\"$control_data\">\n";
echo "<br />\n";
echo $text['description-control_data']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='control_enabled'>\n";
echo " <option value=''></option>\n";
if ($control_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($control_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-control_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='conference_control_uuid' value='$conference_control_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='conference_control_detail_uuid' value='$conference_control_detail_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,160 +1,160 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_detail_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "control_digits like '%".$search."%'";
$sql_search .= "or control_action like '%".$search."%'";
$sql_search .= "or control_data like '%".$search."%'";
$sql_search .= "or control_enabled like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows ";
$sql .= "from v_conference_control_details ";
$sql .= "where conference_control_uuid = '$conference_control_uuid' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_conference_control_details ";
$sql .= "where conference_control_uuid = '$conference_control_uuid' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-conference_control_details']."</b></td>\n";
//echo " <form method='get' action=''>\n";
//echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
//echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
//echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
//echo " </td>\n";
//echo " </form>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('control_digits', $text['label-control_digits'], $order_by, $order);
echo th_order_by('control_action', $text['label-control_action'], $order_by, $order);
echo th_order_by('control_data', $text['label-control_data'], $order_by, $order);
echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('conference_control_detail_add')) {
echo "<a href='conference_control_detail_edit.php?conference_control_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('conference_control_detail_edit')) {
$tr_link = "href='conference_control_detail_edit.php?conference_control_uuid=".$row['conference_control_uuid']."&id=".$row['conference_control_detail_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_digits']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_action']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_data']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_enabled']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_detail_edit')) {
echo "<a href='conference_control_detail_edit.php?conference_control_uuid=".$row['conference_control_uuid']."&id=".$row['conference_control_detail_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('conference_control_detail_delete')) {
echo "<a href='conference_control_detail_delete.php?conference_control_uuid=".$row['conference_control_uuid']."&id=".$row['conference_control_detail_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_detail_add')) {
echo "<a href='conference_control_detail_edit.php?conference_control_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_detail_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "control_digits like '%".$search."%'";
$sql_search .= "or control_action like '%".$search."%'";
$sql_search .= "or control_data like '%".$search."%'";
$sql_search .= "or control_enabled like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows ";
$sql .= "from v_conference_control_details ";
$sql .= "where conference_control_uuid = '$conference_control_uuid' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_conference_control_details ";
$sql .= "where conference_control_uuid = '$conference_control_uuid' ";
//$sql .= "and domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-conference_control_details']."</b></td>\n";
//echo " <form method='get' action=''>\n";
//echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
//echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
//echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
//echo " </td>\n";
//echo " </form>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('control_digits', $text['label-control_digits'], $order_by, $order);
echo th_order_by('control_action', $text['label-control_action'], $order_by, $order);
echo th_order_by('control_data', $text['label-control_data'], $order_by, $order);
echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('conference_control_detail_add')) {
echo "<a href='conference_control_detail_edit.php?conference_control_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('conference_control_detail_edit')) {
$tr_link = "href='conference_control_detail_edit.php?conference_control_uuid=".$row['conference_control_uuid']."&id=".$row['conference_control_detail_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_digits']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_action']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_data']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_enabled']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_detail_edit')) {
echo "<a href='conference_control_detail_edit.php?conference_control_uuid=".$row['conference_control_uuid']."&id=".$row['conference_control_detail_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('conference_control_detail_delete')) {
echo "<a href='conference_control_detail_delete.php?conference_control_uuid=".$row['conference_control_uuid']."&id=".$row['conference_control_detail_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_detail_add')) {
echo "<a href='conference_control_detail_edit.php?conference_control_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,191 +1,191 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_add') || permission_exists('conference_control_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$conference_control_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (is_array($_POST)) {
$control_name = check_str($_POST["control_name"]);
$control_enabled = check_str($_POST["control_enabled"]);
$control_description = check_str($_POST["control_description"]);
}
//process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the uuid from the POST
if ($action == "update") {
$conference_control_uuid = check_str($_POST["conference_control_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($control_name) == 0) { $msg .= $text['message-required']." ".$text['label-control_name']."<br>\n"; }
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
//if (strlen($control_description) == 0) { $msg .= $text['message-required']." ".$text['label-control_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add the conference_control_uuid
if (strlen($_POST["conference_control_uuid"]) == 0) {
$conference_control_uuid = uuid();
$_POST["conference_control_uuid"] = $conference_control_uuid;
}
//prepare the array
$array['conference_controls'][] = $_POST;
//save to the data
$database = new database;
$database->app_name = 'conference_controls';
$database->app_uuid = null;
if (strlen($conference_control_uuid) > 0) {
$database->uuid($conference_control_uuid);
}
$database->save($array);
$message = $database->message;
//redirect the user
if (isset($action)) {
if ($action == "add") {
messages::add($text['message-add']);
}
if ($action == "update") {
messages::add($text['message-update']);
}
header("Location: conference_controls.php");
return;
}
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
$conference_control_uuid = check_str($_GET["id"]);
$sql = "select * from v_conference_controls ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "where conference_control_uuid = '$conference_control_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$control_name = $row["control_name"];
$control_enabled = $row["control_enabled"];
$control_description = $row["control_description"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-conference_control']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='conference_controls.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_name' maxlength='255' value=\"$control_name\">\n";
echo "<br />\n";
echo $text['description-control_name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='control_enabled'>\n";
echo " <option value=''></option>\n";
if ($control_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($control_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-control_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_description' maxlength='255' value=\"$control_description\">\n";
echo "<br />\n";
echo $text['description-control_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='conference_control_uuid' value='$conference_control_uuid'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
if ($action == "update") {
require "conference_control_details.php";
}
//include the footer
require_once "resources/footer.php";
?>
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_add') || permission_exists('conference_control_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$conference_control_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (is_array($_POST)) {
$control_name = check_str($_POST["control_name"]);
$control_enabled = check_str($_POST["control_enabled"]);
$control_description = check_str($_POST["control_description"]);
}
//process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the uuid from the POST
if ($action == "update") {
$conference_control_uuid = check_str($_POST["conference_control_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($control_name) == 0) { $msg .= $text['message-required']." ".$text['label-control_name']."<br>\n"; }
if (strlen($control_enabled) == 0) { $msg .= $text['message-required']." ".$text['label-control_enabled']."<br>\n"; }
//if (strlen($control_description) == 0) { $msg .= $text['message-required']." ".$text['label-control_description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add the conference_control_uuid
if (strlen($_POST["conference_control_uuid"]) == 0) {
$conference_control_uuid = uuid();
$_POST["conference_control_uuid"] = $conference_control_uuid;
}
//prepare the array
$array['conference_controls'][] = $_POST;
//save to the data
$database = new database;
$database->app_name = 'conference_controls';
$database->app_uuid = null;
if (strlen($conference_control_uuid) > 0) {
$database->uuid($conference_control_uuid);
}
$database->save($array);
$message = $database->message;
//redirect the user
if (isset($action)) {
if ($action == "add") {
messages::add($text['message-add']);
}
if ($action == "update") {
messages::add($text['message-update']);
}
header("Location: conference_controls.php");
return;
}
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
$conference_control_uuid = check_str($_GET["id"]);
$sql = "select * from v_conference_controls ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "where conference_control_uuid = '$conference_control_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$control_name = $row["control_name"];
$control_enabled = $row["control_enabled"];
$control_description = $row["control_description"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-conference_control']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='conference_controls.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_name' maxlength='255' value=\"$control_name\">\n";
echo "<br />\n";
echo $text['description-control_name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='control_enabled'>\n";
echo " <option value=''></option>\n";
if ($control_enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($control_enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-control_enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-control_description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='control_description' maxlength='255' value=\"$control_description\">\n";
echo "<br />\n";
echo $text['description-control_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='conference_control_uuid' value='$conference_control_uuid'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
if ($action == "update") {
require "conference_control_details.php";
}
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,159 +1,159 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = strtolower(check_str($_GET["search"]));
if (strlen($search) > 0) {
$sql_search = "where (";
$sql_search .= "lower(control_name) like '%".$search."%' ";
$sql_search .= "or lower(control_description) like '%".$search."%' ";
$sql_search .= ") ";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(conference_control_uuid) as num_rows ";
$sql .= "from v_conference_controls";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_conference_controls ";
//$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-conference_controls']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['title_description-conference_control']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('control_name', $text['label-control_name'], $order_by, $order);
echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order);
echo th_order_by('control_description', $text['label-control_description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('conference_control_add')) {
echo "<a href='conference_control_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('conference_control_edit')) {
$tr_link = "href='conference_control_edit.php?id=".$row['conference_control_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['control_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_edit')) {
echo "<a href='conference_control_edit.php?id=".$row['conference_control_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('conference_control_delete')) {
echo "<a href='conference_control_delete.php?id=".$row['conference_control_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='4' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_add')) {
echo "<a href='conference_control_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('conference_control_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = strtolower(check_str($_GET["search"]));
if (strlen($search) > 0) {
$sql_search = "where (";
$sql_search .= "lower(control_name) like '%".$search."%' ";
$sql_search .= "or lower(control_description) like '%".$search."%' ";
$sql_search .= ") ";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(conference_control_uuid) as num_rows ";
$sql .= "from v_conference_controls";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_conference_controls ";
//$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-conference_controls']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['title_description-conference_control']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('control_name', $text['label-control_name'], $order_by, $order);
echo th_order_by('control_enabled', $text['label-control_enabled'], $order_by, $order);
echo th_order_by('control_description', $text['label-control_description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('conference_control_add')) {
echo "<a href='conference_control_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('conference_control_edit')) {
$tr_link = "href='conference_control_edit.php?id=".$row['conference_control_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['control_enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='row_stylebg'>".$row['control_description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_edit')) {
echo "<a href='conference_control_edit.php?id=".$row['conference_control_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('conference_control_delete')) {
echo "<a href='conference_control_delete.php?id=".$row['conference_control_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='4' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('conference_control_add')) {
echo "<a href='conference_control_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,122 +1,122 @@
<?php
//application details
$apps[$x]['name'] = "Database Transactions";
$apps[$x]['uuid'] = "de47783c-1caa-4b3e-9b51-ad6c9e69215c";
$apps[$x]['category'] = "";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "1.0";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Track database transactions";
$apps[$x]['description']['ar-eg'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['es-cl'] = "";
$apps[$x]['description']['es-mx'] = "";
$apps[$x]['description']['fr-ca'] = "";
$apps[$x]['description']['fr-fr'] = "";
$apps[$x]['description']['he-il'] = "";
$apps[$x]['description']['it-it'] = "";
$apps[$x]['description']['nl-nl'] = "";
$apps[$x]['description']['pl-pl'] = "";
$apps[$x]['description']['pt-br'] = "";
$apps[$x]['description']['pt-pt'] = "";
$apps[$x]['description']['ro-ro'] = "";
$apps[$x]['description']['ru-ru'] = "";
$apps[$x]['description']['sv-se'] = "";
$apps[$x]['description']['uk-ua'] = "";
//permission details
$y=0;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_view";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "user";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_add";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_edit";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
//$apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_delete";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
//schema details
$y=0;
$apps[$x]['db'][$y]['table']['name'] = "v_database_transactions";
$apps[$x]['db'][$y]['table']['parent'] = "";
$z=0;
$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";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "database_transaction_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]['description']['en-us'] = "User transaction.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "app_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Application name.";
$z++;
$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]['description']['en-us'] = "Application ID";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_code";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Transaction code.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_address";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "IP address of the user.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_type";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Type: insert, update, delete, select";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_date";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Transaction date.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_old";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "longtext";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Before the transaction.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_new";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "longtext";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "After the transaction.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_result";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "longtext";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Result of the transaction.";
?>
<?php
//application details
$apps[$x]['name'] = "Database Transactions";
$apps[$x]['uuid'] = "de47783c-1caa-4b3e-9b51-ad6c9e69215c";
$apps[$x]['category'] = "";
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "1.0";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Track database transactions";
$apps[$x]['description']['ar-eg'] = "";
$apps[$x]['description']['de-at'] = "";
$apps[$x]['description']['de-ch'] = "";
$apps[$x]['description']['de-de'] = "";
$apps[$x]['description']['es-cl'] = "";
$apps[$x]['description']['es-mx'] = "";
$apps[$x]['description']['fr-ca'] = "";
$apps[$x]['description']['fr-fr'] = "";
$apps[$x]['description']['he-il'] = "";
$apps[$x]['description']['it-it'] = "";
$apps[$x]['description']['nl-nl'] = "";
$apps[$x]['description']['pl-pl'] = "";
$apps[$x]['description']['pt-br'] = "";
$apps[$x]['description']['pt-pt'] = "";
$apps[$x]['description']['ro-ro'] = "";
$apps[$x]['description']['ru-ru'] = "";
$apps[$x]['description']['sv-se'] = "";
$apps[$x]['description']['uk-ua'] = "";
//permission details
$y=0;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_view";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "user";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_add";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_edit";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
//$apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
$apps[$x]['permissions'][$y]['name'] = "database_transaction_delete";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
//schema details
$y=0;
$apps[$x]['db'][$y]['table']['name'] = "v_database_transactions";
$apps[$x]['db'][$y]['table']['parent'] = "";
$z=0;
$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";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "database_transaction_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]['description']['en-us'] = "User transaction.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "app_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Application name.";
$z++;
$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]['description']['en-us'] = "Application ID";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_code";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Transaction code.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_address";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "IP address of the user.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_type";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Type: insert, update, delete, select";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_date";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Transaction date.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_old";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "longtext";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Before the transaction.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_new";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "longtext";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "After the transaction.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "transaction_result";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "longtext";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Result of the transaction.";
?>

View File

@ -1,21 +1,21 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = 'Transactions';
$apps[$x]['menu'][0]['title']['es-cl'] = '';
$apps[$x]['menu'][0]['title']['fr-fr'] = '';
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
$apps[$x]['menu'][0]['title']['pl'] = '';
<?php
$apps[$x]['menu'][0]['title']['en-us'] = 'Transactions';
$apps[$x]['menu'][0]['title']['es-cl'] = '';
$apps[$x]['menu'][0]['title']['fr-fr'] = '';
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
$apps[$x]['menu'][0]['title']['pl'] = '';
$apps[$x]['menu'][0]['title']['ru-ru'] = 'Изменения в БД';
$apps[$x]['menu'][0]['title']['sv-se'] = '';
$apps[$x]['menu'][0]['title']['uk'] = '';
$apps[$x]['menu'][0]['title']['de-de'] = 'Datenbank Transaktionen';
$apps[$x]['menu'][0]['title']['de-at'] = 'Datenbank Transaktionen';
$apps[$x]['menu'][0]['uuid'] = 'ffc57bea-df1d-4099-b7e5-835d68f09006';
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/database_transactions/database_transactions.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//$apps[$x]['menu'][0]['groups'][] = 'admin';
//$apps[$x]['menu'][0]['groups'][] = 'user';
$apps[$x]['menu'][0]['title']['sv-se'] = '';
$apps[$x]['menu'][0]['title']['uk'] = '';
$apps[$x]['menu'][0]['title']['de-de'] = 'Datenbank Transaktionen';
$apps[$x]['menu'][0]['title']['de-at'] = 'Datenbank Transaktionen';
$apps[$x]['menu'][0]['uuid'] = 'ffc57bea-df1d-4099-b7e5-835d68f09006';
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/database_transactions/database_transactions.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//$apps[$x]['menu'][0]['groups'][] = 'admin';
//$apps[$x]['menu'][0]['groups'][] = 'user';
?>

View File

@ -1,64 +1,64 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('database_transaction_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete database_transaction
if (strlen($id)>0) {
$sql = "delete from v_database_transactions ";
$sql .= "where database_transaction_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: database_transactions.php');
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('database_transaction_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete database_transaction
if (strlen($id)>0) {
$sql = "delete from v_database_transactions ";
$sql .= "where database_transaction_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: database_transactions.php');
?>

View File

@ -1,475 +1,475 @@
<?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) 2016 - 2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('database_transaction_add') || permission_exists('database_transaction_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
//$action = "update";
$database_transaction_uuid = check_str($_REQUEST["id"]);
}
//else {
// $action = "add";
//}
//get http post variables and set them to php variables
/*
if (count($_POST) > 0) {
$user_uuid = check_str($_POST["user_uuid"]);
$app_uuid = check_str($_POST["app_uuid"]);
$transaction_code = check_str($_POST["transaction_code"]);
$transaction_address = check_str($_POST["transaction_address"]);
$transaction_type = check_str($_POST["transaction_type"]);
$transaction_date = check_str($_POST["transaction_date"]);
$transaction_old = check_str($_POST["transaction_old"]);
$transaction_new = check_str($_POST["transaction_new"]);
$transaction_result = check_str($_POST["transaction_result"]);
}
*/
//process the data
/*
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$database_transaction_uuid = check_str($_POST["database_transaction_uuid"]);
}
//check for all required data
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (strlen($user_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-user_uuid']."<br>\n"; }
if (strlen($app_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-app_uuid']."<br>\n"; }
if (strlen($transaction_code) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_code']."<br>\n"; }
if (strlen($transaction_address) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_address']."<br>\n"; }
if (strlen($transaction_type) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_type']."<br>\n"; }
if (strlen($transaction_date) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_date']."<br>\n"; }
if (strlen($transaction_old) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_old']."<br>\n"; }
if (strlen($transaction_new) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_new']."<br>\n"; }
if (strlen($transaction_result) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_result']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('database_transaction_add')) {
$sql = "insert into v_database_transactions ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "database_transaction_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "user_uuid, ";
$sql .= "app_uuid, ";
$sql .= "transaction_code, ";
$sql .= "transaction_address, ";
$sql .= "transaction_type, ";
$sql .= "transaction_date, ";
$sql .= "transaction_old, ";
$sql .= "transaction_new, ";
$sql .= "transaction_result ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$user_uuid', ";
$sql .= "'$app_uuid', ";
$sql .= "'$transaction_code', ";
$sql .= "'$transaction_address', ";
$sql .= "'$transaction_type', ";
$sql .= "now(), ";
$sql .= "'$transaction_old', ";
$sql .= "'$transaction_new', ";
$sql .= "'$transaction_result' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header("Location: database_transactions.php");
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('database_transaction_edit')) {
$sql = "update v_database_transactions set ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "user_uuid = '$user_uuid', ";
$sql .= "app_uuid = '$app_uuid', ";
$sql .= "transaction_code = '$transaction_code', ";
$sql .= "transaction_address = '$transaction_address', ";
$sql .= "transaction_type = '$transaction_type', ";
$sql .= "transaction_date = now(), ";
$sql .= "transaction_old = '$transaction_old', ";
$sql .= "transaction_new = '$transaction_new', ";
$sql .= "transaction_result = '$transaction_result' ";
$sql .= "where database_transaction_uuid = '$database_transaction_uuid'";
$sql .= "and domain_uuid = '$domain_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header("Location: database_transactions.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_transaction_uuid = check_str($_GET["id"]);
$sql = "select ";
$sql .= "t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, ";
$sql .= "t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date, ";
$sql .= "t.transaction_old, t.transaction_new, t.transaction_result ";
$sql .= "from v_database_transactions as t, v_domains as d, v_users as u ";
$sql .= "where t.domain_uuid = '$domain_uuid' ";
$sql .= "and t.database_transaction_uuid = '$database_transaction_uuid' ";
$sql .= "and t.user_uuid = u.user_uuid ";
$sql .= "and t.domain_uuid = d.domain_uuid ";
//$sql = "select *, u.username from v_database_transactions as t, v_users as u ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
//$sql .= "t.user_uuid = u.user_uuid ";
//$sql .= "and database_transaction_uuid = '$database_transaction_uuid' ";
$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"];
$app_name = $row["app_name"];
$app_uuid = $row["app_uuid"];
$domain_name = $row["domain_name"];
$username = $row["username"];
$transaction_code = $row["transaction_code"];
$transaction_address = $row["transaction_address"];
//$transaction_type = $row["transaction_type"];
$transaction_date = $row["transaction_date"];
$transaction_old = $row["transaction_old"];
$transaction_new = $row["transaction_new"];
$transaction_result = $row["transaction_result"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
//echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' width='20%' nowrap='nowrap' valign='top'><b>".$text['title-database_transaction']."</b><br><br></td>\n";
echo " <td width='80%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='database_transactions.php'\" value='".$text['button-back']."'>";
//echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table width='350px' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<td valign='top'>\n";
echo " <table>\n";
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-app_name']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " ".$app_name."\n";
//echo " <input class='formfld' type='text' name='app_name' maxlength='255' value='$app_name'>\n";
//echo " <br />\n";
//echo " ".$text['description-app_uuid']."\n";
echo " </td>\n";
echo " </tr>\n";
/*echo " <tr>\n";
echo " <th width='10%' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-domain']."\n";
echo " </th>\n";
echo " <td width='90%' aclass='vtable' align='left'>\n";
echo " ".$domain_name;
//echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value='$domain_name'>\n";
//echo " <br />\n";
//echo " ".$text['description-domain']."\n";
echo " </td>\n";
echo " </tr>\n";
*/
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-user_uuid']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " ".$username."\n";
//echo " <input class='formfld' type='text' name='username' maxlength='255' value='$username'>\n";
//echo " <br />\n";
//echo " ".$text['description-user_uuid']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "<td valign='top'>\n";
echo " <table>\n";
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_code']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " $transaction_code\n";
//echo " <input class='formfld' type='text' name='transaction_code' maxlength='255' value='$transaction_code'>\n";
//echo " <br />\n";
//echo " ".$text['description-transaction_code']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_address']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " $transaction_address\n";
//echo " <input class='formfld' type='text' name='transaction_address' maxlength='255' value=\"$transaction_address\">\n";
//echo " <br />\n";
//echo " ".$text['description-transaction_address']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
//echo "<tr>\n";
//echo "<th valign='top' align='left' nowrap='nowrap'>\n";
//echo " ".$text['label-transaction_type']."\n";
//echo "</th>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_type' maxlength='255' value=\"$transaction_type\">\n";
//echo "<br />\n";
//echo $text['description-transaction_type']."\n";
//echo "</td>\n";
//echo "</tr>\n";
if ($_REQUEST["debug"] == "true") {
echo "<table width='350px' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_old']."\n";
echo "</th>\n";
echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_old' maxlength='255' value=\"$transaction_old\">\n";
echo " <textarea name='transaction_old' style='width: 265px; height: 80px;'>$transaction_old</textarea>\n";
//echo "<br />\n";
//echo $text['description-transaction_old']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_new']."\n";
echo "</th>\n";
echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_new' maxlength='255' value=\"$transaction_new\">\n";
echo " <textarea name='transaction_new' style='width: 265px; height: 80px;'>$transaction_new</textarea>\n";
//echo "<br />\n";
//echo $text['description-transaction_new']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_result']."\n";
echo "</th>\n";
echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_result' maxlength='255' value=\"$transaction_result\">\n";
echo " <textarea name='transaction_result' style='width: 265px; height: 80px;'>$transaction_result</textarea>\n";
//echo "<br />\n";
//echo $text['description-transaction_result']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
}
//echo " <tr>\n";
//echo " <td colspan='2' align='right'>\n";
//if ($action == "update") {
// echo " <input type='hidden' name='database_transaction_uuid' value='$database_transaction_uuid'>\n";
//}
//echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
//echo " </td>\n";
//echo " </tr>";
//echo "</table>";
//echo "</form>";
//echo "<br /><br />";
//define the array _difference function
//this adds old and new values to the array
function array_difference($array1, $array2) {
$difference = array();
if (is_array($array1)) {
foreach($array1 as $key => $value) {
if(is_array($array2[$key])) {
$difference[$key] = array_difference($array1[$key], $array2[$key]);
}
else {
$difference[$key]['old'] = $value;
}
}
}
if (is_array($array2)) {
foreach($array2 as $key => $value) {
if(is_array($value)) {
$difference[$key] = array_difference($array1[$key], $array2[$key]);
}
else {
$difference[$key]['new'] = $value;
}
}
}
return $difference;
}
//show the content from the difference array as a list
function show_difference($array) {
//loop through the array
foreach($array as $key => $value) {
if(is_array($value) && !isset($value['old']) && !isset($value['new'])) {
if (!is_numeric($key)) {
//get the table name
$_SESSION['name'] = $key;
}
else {
//get the row id
$_SESSION['row'] = $key;
}
$array = show_difference($value);
}
else {
//set the variables
$old = $value['old'];
$new = $value['new'];
if (is_null($old)) { $old = ''; }
if (is_null($new)) { $new = ''; }
//determine if the value has changed
if (strval($old) == strval($new) && isset($old)) {
$color = "#000000";
}
else {
$color = "#ff0000";
}
//set the table header
if ($_SESSION['previous_name'] != $_SESSION['name'] || $_SESSION['previous_row'] != $_SESSION['row']) {
echo str_replace("<th>name</th>","<th>".$_SESSION['name']."</th>",$_SESSION['table_header']);
//echo $_SESSION['table_header'];
}
$_SESSION['previous_name'] = $_SESSION['name'];
$_SESSION['previous_row'] = $_SESSION['row'];
//show the results
echo "<tr style='color: $color;'>\n";
//echo " <td class=\"vtable\" style='color: $color;'>".$_SESSION['name']."</td>\n";
//echo " <td class=\"vtable\" style='color: $color; text-align: center;'>".$_SESSION['row']."</td>\n";
echo " <td class=\"vtable\" style='color: $color;'>$key</td>\n";
echo " <td class=\"vtable\" style='color: $color;'>".$old."</td>\n";
echo " <td class=\"vtable\" style='color: $color;'>".$new."</td>";
echo "</tr>\n";
//echo "</table>\n";
}
}
}
//decode the json to arrays
$before = json_decode($transaction_old, true);
$after = json_decode($transaction_new, true);
//unset the sessions
unset($_SESSION['previous_name']);
unset($_SESSION['previous_row']);
//show the add or update
if (count($before) > 0 && count($after) > 0) {
//create the table header
$array = array_difference($before, $after, 1);
$table_header = "<tr><td colspan='5'>&nbsp;</td></tr>\n";
$table_header .= "<tr>\n";
//$table_header .= " <th>Table</th>\n";
//$table_header .= " <th>Row</th>\n";
$table_header .= " <th>name</th>\n";
$table_header .= " <th>old</th>\n";
$table_header .= " <th>new</th>\n";
$table_header .= "</tr>\n";
$_SESSION['table_header'] = $table_header;
//show the difference
echo "<table border='0' cellpadding='3'>\n";
show_difference($array);
echo "</table>\n";
}
//show the delete
if (count($before) > 0 && count($after) == 0) {
echo "<h3>Record Deleted</h3><br />\n";
echo " <pre>\n";
print_r($before);
echo " </pre>\n";
}
//add a few lines at the end
echo "<br />\n";
echo "<br />\n";
//include the footer
require_once "resources/footer.php";
?>
<?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) 2016 - 2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('database_transaction_add') || permission_exists('database_transaction_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
//$action = "update";
$database_transaction_uuid = check_str($_REQUEST["id"]);
}
//else {
// $action = "add";
//}
//get http post variables and set them to php variables
/*
if (count($_POST) > 0) {
$user_uuid = check_str($_POST["user_uuid"]);
$app_uuid = check_str($_POST["app_uuid"]);
$transaction_code = check_str($_POST["transaction_code"]);
$transaction_address = check_str($_POST["transaction_address"]);
$transaction_type = check_str($_POST["transaction_type"]);
$transaction_date = check_str($_POST["transaction_date"]);
$transaction_old = check_str($_POST["transaction_old"]);
$transaction_new = check_str($_POST["transaction_new"]);
$transaction_result = check_str($_POST["transaction_result"]);
}
*/
//process the data
/*
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$database_transaction_uuid = check_str($_POST["database_transaction_uuid"]);
}
//check for all required data
if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
if (strlen($user_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-user_uuid']."<br>\n"; }
if (strlen($app_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-app_uuid']."<br>\n"; }
if (strlen($transaction_code) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_code']."<br>\n"; }
if (strlen($transaction_address) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_address']."<br>\n"; }
if (strlen($transaction_type) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_type']."<br>\n"; }
if (strlen($transaction_date) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_date']."<br>\n"; }
if (strlen($transaction_old) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_old']."<br>\n"; }
if (strlen($transaction_new) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_new']."<br>\n"; }
if (strlen($transaction_result) == 0) { $msg .= $text['message-required']." ".$text['label-transaction_result']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('database_transaction_add')) {
$sql = "insert into v_database_transactions ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "database_transaction_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "user_uuid, ";
$sql .= "app_uuid, ";
$sql .= "transaction_code, ";
$sql .= "transaction_address, ";
$sql .= "transaction_type, ";
$sql .= "transaction_date, ";
$sql .= "transaction_old, ";
$sql .= "transaction_new, ";
$sql .= "transaction_result ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$user_uuid', ";
$sql .= "'$app_uuid', ";
$sql .= "'$transaction_code', ";
$sql .= "'$transaction_address', ";
$sql .= "'$transaction_type', ";
$sql .= "now(), ";
$sql .= "'$transaction_old', ";
$sql .= "'$transaction_new', ";
$sql .= "'$transaction_result' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header("Location: database_transactions.php");
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('database_transaction_edit')) {
$sql = "update v_database_transactions set ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "user_uuid = '$user_uuid', ";
$sql .= "app_uuid = '$app_uuid', ";
$sql .= "transaction_code = '$transaction_code', ";
$sql .= "transaction_address = '$transaction_address', ";
$sql .= "transaction_type = '$transaction_type', ";
$sql .= "transaction_date = now(), ";
$sql .= "transaction_old = '$transaction_old', ";
$sql .= "transaction_new = '$transaction_new', ";
$sql .= "transaction_result = '$transaction_result' ";
$sql .= "where database_transaction_uuid = '$database_transaction_uuid'";
$sql .= "and domain_uuid = '$domain_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header("Location: database_transactions.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_transaction_uuid = check_str($_GET["id"]);
$sql = "select ";
$sql .= "t.database_transaction_uuid, d.domain_name, u.username, t.user_uuid, t.app_name, t.app_uuid, ";
$sql .= "t.transaction_code, t.transaction_address, t.transaction_type, t.transaction_date, ";
$sql .= "t.transaction_old, t.transaction_new, t.transaction_result ";
$sql .= "from v_database_transactions as t, v_domains as d, v_users as u ";
$sql .= "where t.domain_uuid = '$domain_uuid' ";
$sql .= "and t.database_transaction_uuid = '$database_transaction_uuid' ";
$sql .= "and t.user_uuid = u.user_uuid ";
$sql .= "and t.domain_uuid = d.domain_uuid ";
//$sql = "select *, u.username from v_database_transactions as t, v_users as u ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
//$sql .= "t.user_uuid = u.user_uuid ";
//$sql .= "and database_transaction_uuid = '$database_transaction_uuid' ";
$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"];
$app_name = $row["app_name"];
$app_uuid = $row["app_uuid"];
$domain_name = $row["domain_name"];
$username = $row["username"];
$transaction_code = $row["transaction_code"];
$transaction_address = $row["transaction_address"];
//$transaction_type = $row["transaction_type"];
$transaction_date = $row["transaction_date"];
$transaction_old = $row["transaction_old"];
$transaction_new = $row["transaction_new"];
$transaction_result = $row["transaction_result"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
//echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' width='20%' nowrap='nowrap' valign='top'><b>".$text['title-database_transaction']."</b><br><br></td>\n";
echo " <td width='80%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='database_transactions.php'\" value='".$text['button-back']."'>";
//echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table width='350px' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<td valign='top'>\n";
echo " <table>\n";
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-app_name']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " ".$app_name."\n";
//echo " <input class='formfld' type='text' name='app_name' maxlength='255' value='$app_name'>\n";
//echo " <br />\n";
//echo " ".$text['description-app_uuid']."\n";
echo " </td>\n";
echo " </tr>\n";
/*echo " <tr>\n";
echo " <th width='10%' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-domain']."\n";
echo " </th>\n";
echo " <td width='90%' aclass='vtable' align='left'>\n";
echo " ".$domain_name;
//echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value='$domain_name'>\n";
//echo " <br />\n";
//echo " ".$text['description-domain']."\n";
echo " </td>\n";
echo " </tr>\n";
*/
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-user_uuid']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " ".$username."\n";
//echo " <input class='formfld' type='text' name='username' maxlength='255' value='$username'>\n";
//echo " <br />\n";
//echo " ".$text['description-user_uuid']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "<td valign='top'>\n";
echo " <table>\n";
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_code']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " $transaction_code\n";
//echo " <input class='formfld' type='text' name='transaction_code' maxlength='255' value='$transaction_code'>\n";
//echo " <br />\n";
//echo " ".$text['description-transaction_code']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_address']."\n";
echo " </th>\n";
echo " <td class='vtable' align='left'>\n";
echo " $transaction_address\n";
//echo " <input class='formfld' type='text' name='transaction_address' maxlength='255' value=\"$transaction_address\">\n";
//echo " <br />\n";
//echo " ".$text['description-transaction_address']."\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
//echo "<tr>\n";
//echo "<th valign='top' align='left' nowrap='nowrap'>\n";
//echo " ".$text['label-transaction_type']."\n";
//echo "</th>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_type' maxlength='255' value=\"$transaction_type\">\n";
//echo "<br />\n";
//echo $text['description-transaction_type']."\n";
//echo "</td>\n";
//echo "</tr>\n";
if ($_REQUEST["debug"] == "true") {
echo "<table width='350px' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_old']."\n";
echo "</th>\n";
echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_old' maxlength='255' value=\"$transaction_old\">\n";
echo " <textarea name='transaction_old' style='width: 265px; height: 80px;'>$transaction_old</textarea>\n";
//echo "<br />\n";
//echo $text['description-transaction_old']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_new']."\n";
echo "</th>\n";
echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_new' maxlength='255' value=\"$transaction_new\">\n";
echo " <textarea name='transaction_new' style='width: 265px; height: 80px;'>$transaction_new</textarea>\n";
//echo "<br />\n";
//echo $text['description-transaction_new']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<th valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-transaction_result']."\n";
echo "</th>\n";
echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='transaction_result' maxlength='255' value=\"$transaction_result\">\n";
echo " <textarea name='transaction_result' style='width: 265px; height: 80px;'>$transaction_result</textarea>\n";
//echo "<br />\n";
//echo $text['description-transaction_result']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
}
//echo " <tr>\n";
//echo " <td colspan='2' align='right'>\n";
//if ($action == "update") {
// echo " <input type='hidden' name='database_transaction_uuid' value='$database_transaction_uuid'>\n";
//}
//echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
//echo " </td>\n";
//echo " </tr>";
//echo "</table>";
//echo "</form>";
//echo "<br /><br />";
//define the array _difference function
//this adds old and new values to the array
function array_difference($array1, $array2) {
$difference = array();
if (is_array($array1)) {
foreach($array1 as $key => $value) {
if(is_array($array2[$key])) {
$difference[$key] = array_difference($array1[$key], $array2[$key]);
}
else {
$difference[$key]['old'] = $value;
}
}
}
if (is_array($array2)) {
foreach($array2 as $key => $value) {
if(is_array($value)) {
$difference[$key] = array_difference($array1[$key], $array2[$key]);
}
else {
$difference[$key]['new'] = $value;
}
}
}
return $difference;
}
//show the content from the difference array as a list
function show_difference($array) {
//loop through the array
foreach($array as $key => $value) {
if(is_array($value) && !isset($value['old']) && !isset($value['new'])) {
if (!is_numeric($key)) {
//get the table name
$_SESSION['name'] = $key;
}
else {
//get the row id
$_SESSION['row'] = $key;
}
$array = show_difference($value);
}
else {
//set the variables
$old = $value['old'];
$new = $value['new'];
if (is_null($old)) { $old = ''; }
if (is_null($new)) { $new = ''; }
//determine if the value has changed
if (strval($old) == strval($new) && isset($old)) {
$color = "#000000";
}
else {
$color = "#ff0000";
}
//set the table header
if ($_SESSION['previous_name'] != $_SESSION['name'] || $_SESSION['previous_row'] != $_SESSION['row']) {
echo str_replace("<th>name</th>","<th>".$_SESSION['name']."</th>",$_SESSION['table_header']);
//echo $_SESSION['table_header'];
}
$_SESSION['previous_name'] = $_SESSION['name'];
$_SESSION['previous_row'] = $_SESSION['row'];
//show the results
echo "<tr style='color: $color;'>\n";
//echo " <td class=\"vtable\" style='color: $color;'>".$_SESSION['name']."</td>\n";
//echo " <td class=\"vtable\" style='color: $color; text-align: center;'>".$_SESSION['row']."</td>\n";
echo " <td class=\"vtable\" style='color: $color;'>$key</td>\n";
echo " <td class=\"vtable\" style='color: $color;'>".$old."</td>\n";
echo " <td class=\"vtable\" style='color: $color;'>".$new."</td>";
echo "</tr>\n";
//echo "</table>\n";
}
}
}
//decode the json to arrays
$before = json_decode($transaction_old, true);
$after = json_decode($transaction_new, true);
//unset the sessions
unset($_SESSION['previous_name']);
unset($_SESSION['previous_row']);
//show the add or update
if (count($before) > 0 && count($after) > 0) {
//create the table header
$array = array_difference($before, $after, 1);
$table_header = "<tr><td colspan='5'>&nbsp;</td></tr>\n";
$table_header .= "<tr>\n";
//$table_header .= " <th>Table</th>\n";
//$table_header .= " <th>Row</th>\n";
$table_header .= " <th>name</th>\n";
$table_header .= " <th>old</th>\n";
$table_header .= " <th>new</th>\n";
$table_header .= "</tr>\n";
$_SESSION['table_header'] = $table_header;
//show the difference
echo "<table border='0' cellpadding='3'>\n";
show_difference($array);
echo "</table>\n";
}
//show the delete
if (count($before) > 0 && count($after) == 0) {
echo "<h3>Record Deleted</h3><br />\n";
echo " <pre>\n";
print_r($before);
echo " </pre>\n";
}
//add a few lines at the end
echo "<br />\n";
echo "<br />\n";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,90 +1,90 @@
<?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
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
<?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
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +1,64 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete the data
if (strlen($id)>0) {
//delete device_vendor
$sql = "delete from v_device_vendors ";
$sql .= "where device_vendor_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: device_vendors.php');
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete the data
if (strlen($id)>0) {
//delete device_vendor
$sql = "delete from v_device_vendors ";
$sql .= "where device_vendor_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: device_vendors.php');
?>

View File

@ -1,223 +1,223 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_add') || permission_exists('device_vendor_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$device_vendor_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$name = check_str($_POST["name"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$device_vendor_uuid = check_str($_POST["device_vendor_uuid"]);
}
//check for all required data
if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('device_vendor_add')) {
$sql = "insert into v_device_vendors ";
$sql .= "(";
$sql .= "device_vendor_uuid, ";
$sql .= "name, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$name', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header("Location: device_vendors.php");
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('device_vendor_edit')) {
$sql = "update v_device_vendors set ";
$sql .= "name = '$name', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid'";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header("Location: device_vendors.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") {
$device_vendor_uuid = check_str($_GET["id"]);
$sql = "select * from v_device_vendors ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$name = $row["name"];
$enabled = $row["enabled"];
$description = $row["description"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-device_vendor']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_vendors.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"$name\">\n";
echo "<br />\n";
echo $text['description-name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='enabled'>\n";
echo " <option value=''></option>\n";
if ($enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
if ($enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"$description\">\n";
echo "<br />\n";
echo $text['description-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='device_vendor_uuid' value='$device_vendor_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
if ($action == "update") {
require "device_vendor_functions.php";
}
//include the footer
require_once "resources/footer.php";
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_add') || permission_exists('device_vendor_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$device_vendor_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$name = check_str($_POST["name"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$device_vendor_uuid = check_str($_POST["device_vendor_uuid"]);
}
//check for all required data
if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('device_vendor_add')) {
$sql = "insert into v_device_vendors ";
$sql .= "(";
$sql .= "device_vendor_uuid, ";
$sql .= "name, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$name', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header("Location: device_vendors.php");
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('device_vendor_edit')) {
$sql = "update v_device_vendors set ";
$sql .= "name = '$name', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid'";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header("Location: device_vendors.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") {
$device_vendor_uuid = check_str($_GET["id"]);
$sql = "select * from v_device_vendors ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$name = $row["name"];
$enabled = $row["enabled"];
$description = $row["description"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-device_vendor']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_vendors.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"$name\">\n";
echo "<br />\n";
echo $text['description-name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='enabled'>\n";
echo " <option value=''></option>\n";
if ($enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
if ($enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"$description\">\n";
echo "<br />\n";
echo $text['description-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='device_vendor_uuid' value='$device_vendor_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
if ($action == "update") {
require "device_vendor_functions.php";
}
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,65 +1,65 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_function_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$device_vendor_uuid = check_str($_GET["device_vendor_uuid"]);
}
//delete the data
if (strlen($id)>0) {
//delete device_vendor_function
$sql = "delete from v_device_vendor_functions ";
$sql .= "where device_vendor_function_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: device_vendor_function_edit.php?id='.$device_vendor_uuid);
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_function_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$device_vendor_uuid = check_str($_GET["device_vendor_uuid"]);
}
//delete the data
if (strlen($id)>0) {
//delete device_vendor_function
$sql = "delete from v_device_vendor_functions ";
$sql .= "where device_vendor_function_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: device_vendor_function_edit.php?id='.$device_vendor_uuid);
?>

View File

@ -1,393 +1,393 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//delete the group from the menu item
if ($_REQUEST["a"] == "delete" && permission_exists("device_vendor_function_delete") && $_REQUEST["id"] != '') {
//get the id
$device_vendor_function_group_uuid = check_str($_REQUEST["id"]);
$device_vendor_function_uuid = check_str($_REQUEST["device_vendor_function_uuid"]);
$device_vendor_uuid = check_str($_REQUEST["device_vendor_uuid"]);
//delete the group from the users
$sql = "delete from v_device_vendor_function_groups ";
$sql .= "where device_vendor_function_group_uuid = '".$device_vendor_function_group_uuid."' ";
$db->exec(check_sql($sql));
//redirect the browser
messages::add($text['message-delete']);
header("Location: device_vendor_function_edit.php?id=".$device_vendor_function_uuid ."&device_vendor_uuid=".$device_vendor_uuid);
return;
}
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_function_add') || permission_exists('device_vendor_function_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$device_vendor_function_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the parent uuid
if (strlen($_GET["device_vendor_uuid"]) > 0) {
$device_vendor_uuid = check_str($_GET["device_vendor_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
//$label = check_str($_POST["label"]);
$name = check_str($_POST["name"]);
$value = check_str($_POST["value"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
//process the http variables
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the uuid
if ($action == "update") {
$device_vendor_function_uuid = check_str($_POST["device_vendor_function_uuid"]);
}
//check for all required data
$msg = '';
//if (strlen($label) == 0) { $msg .= $text['message-required']." ".$text['label-label']."<br>\n"; }
if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (strlen($value) == 0) { $msg .= $text['message-required']." ".$text['label-value']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
//add vendor functions
if ($action == "add" && permission_exists('device_vendor_function_add')) {
$device_vendor_function_uuid = uuid();
$sql = "insert into v_device_vendor_functions ";
$sql .= "(";
$sql .= "device_vendor_function_uuid, ";
$sql .= "device_vendor_uuid, ";
//$sql .= "label, ";
$sql .= "name, ";
$sql .= "value, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$device_vendor_function_uuid."', ";
$sql .= "'$device_vendor_uuid', ";
//$sql .= "'$label', ";
$sql .= "'$name', ";
$sql .= "'$value', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "add")
//update vendor functions
if ($action == "update" && permission_exists('device_vendor_function_edit')) {
$sql = "update v_device_vendor_functions set ";
$sql .= "device_vendor_uuid = '$device_vendor_uuid', ";
//$sql .= "label = '$label', ";
$sql .= "name = '$name', ";
$sql .= "value = '$value', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where device_vendor_function_uuid = '$device_vendor_function_uuid'";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "update")
//add a group to the menu
if (permission_exists('device_vendor_function_add') && $_REQUEST["group_uuid_name"] != '') {
//get the group uuid and group_name
$group_data = explode('|', check_str($_REQUEST["group_uuid_name"]));
$group_uuid = $group_data[0];
$group_name = $group_data[1];
//add the group to the menu
if (strlen($device_vendor_function_uuid) > 0) {
$device_vendor_function_group_uuid = uuid();
$sql = "insert into v_device_vendor_function_groups ";
$sql .= "(";
$sql .= "device_vendor_function_group_uuid, ";
$sql .= "device_vendor_function_uuid, ";
$sql .= "device_vendor_uuid, ";
$sql .= "group_name, ";
$sql .= "group_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$device_vendor_function_group_uuid."', ";
$sql .= "'".$device_vendor_function_uuid."', ";
$sql .= "'".$device_vendor_uuid."', ";
$sql .= "'".$group_name."', ";
$sql .= "'".$group_uuid."' ";
$sql .= ")";
$db->exec($sql);
}
}
//redirect the user
$_SESSION["message"] = $text['message-'.$action];
header("Location: device_vendor_function_edit.php?id=".$device_vendor_function_uuid ."&device_vendor_uuid=".$device_vendor_uuid);
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$device_vendor_function_uuid = check_str($_GET["id"]);
$sql = "select * from v_device_vendor_functions ";
$sql .= "where device_vendor_function_uuid = '$device_vendor_function_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_vendor_functions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($device_vendor_functions as &$row) {
//$label = $row["label"];
$name = $row["name"];
$value = $row["value"];
$enabled = $row["enabled"];
$description = $row["description"];
}
unset ($prep_statement);
}
//group groups assigned
$sql = "select ";
$sql .= " fg.*, g.domain_uuid as group_domain_uuid ";
$sql .= "from ";
$sql .= " v_device_vendor_function_groups as fg, ";
$sql .= " v_groups as g ";
$sql .= "where ";
$sql .= " fg.group_uuid = g.group_uuid ";
$sql .= " and fg.device_vendor_uuid = :device_vendor_uuid ";
//$sql .= " and fg.device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= " and fg.device_vendor_function_uuid = :device_vendor_function_uuid ";
//$sql .= " and fg.device_vendor_function_uuid = '$device_vendor_function_uuid' ";
$sql .= "order by ";
$sql .= " g.domain_uuid desc, ";
$sql .= " g.group_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->bindParam(':device_vendor_uuid', $device_vendor_uuid);
$prep_statement->bindParam(':device_vendor_function_uuid', $device_vendor_function_uuid);
$prep_statement->execute();
$function_groups = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
//set the assigned_groups array
if (is_array($menu_item_groups)) {
foreach($menu_item_groups as $field) {
if (strlen($field['group_name']) > 0) {
$assigned_groups[] = $field['group_uuid'];
}
}
}
//get the groups
$sql = "select * from v_groups ";
if (sizeof($assigned_groups) > 0) {
$sql .= "where group_uuid not in ('".implode("','",$assigned_groups)."') ";
}
$sql .= "order by domain_uuid desc, group_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$groups = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-device_vendor_function']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_vendor_edit.php?id=$device_vendor_uuid'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
//echo " ".$text['label-label']."\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='label' maxlength='255' value=\"$label\">\n";
//echo "<br />\n";
//echo $text['description-label']."\n";
//echo "</td>\n";
//echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"$name\">\n";
echo "<br />\n";
echo $text['description-name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-value']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='value' maxlength='255' value=\"$value\">\n";
echo "<br />\n";
echo $text['description-value']."\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<pre>\n";
//print_r($function_groups);
//echo "</pre>\n";
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-groups']."</td>";
echo " <td class='vtable'>";
if (is_array($function_groups)) {
echo "<table cellpadding='0' cellspacing='0' border='0'>\n";
foreach($function_groups as $field) {
if (strlen($field['group_name']) > 0) {
echo "<tr>\n";
echo " <td class='vtable' style='white-space: nowrap; padding-right: 30px;' nowrap='nowrap'>";
echo $field['group_name'].(($field['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null);
echo " </td>\n";
if (permission_exists('group_member_delete') || if_group("superadmin")) {
echo " <td class='list_control_icons' style='width: 25px;'>";
echo "<a href='device_vendor_function_edit.php?id=".$field['device_vendor_function_group_uuid']."&group_uuid=".$field['group_uuid']."&device_vendor_function_uuid=".$device_vendor_function_uuid."&device_vendor_uuid=".$device_vendor_uuid."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
echo " </td>";
}
echo "</tr>\n";
}
}
echo "</table>\n";
}
if (is_array($groups)) {
echo "<br />\n";
echo "<select name='group_uuid_name' class='formfld' style='width: auto; margin-right: 3px;'>\n";
echo " <option value=''></option>\n";
foreach($groups as $field) {
if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; } //only show the superadmin group to other superadmins
if ($field['group_name'] == "admin" && (!if_group("superadmin") && !if_group("admin") )) { continue; } //only show the admin group to other admins
if (!in_array($field["group_uuid"], $assigned_groups)) {
echo " <option value='".$field['group_uuid']."|".$field['group_name']."'>".$field['group_name'].(($field['domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['domain_uuid']]['domain_name'] : null)."</option>\n";
}
}
echo "</select>";
echo "<input type='submit' class='btn' name='submit' value=\"".$text['button-add']."\">\n";
}
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='enabled'>\n";
echo " <option value=''></option>\n";
if ($enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"$description\">\n";
echo "<br />\n";
echo $text['description-description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='device_vendor_uuid' value='$device_vendor_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='device_vendor_function_uuid' value='$device_vendor_function_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//delete the group from the menu item
if ($_REQUEST["a"] == "delete" && permission_exists("device_vendor_function_delete") && $_REQUEST["id"] != '') {
//get the id
$device_vendor_function_group_uuid = check_str($_REQUEST["id"]);
$device_vendor_function_uuid = check_str($_REQUEST["device_vendor_function_uuid"]);
$device_vendor_uuid = check_str($_REQUEST["device_vendor_uuid"]);
//delete the group from the users
$sql = "delete from v_device_vendor_function_groups ";
$sql .= "where device_vendor_function_group_uuid = '".$device_vendor_function_group_uuid."' ";
$db->exec(check_sql($sql));
//redirect the browser
messages::add($text['message-delete']);
header("Location: device_vendor_function_edit.php?id=".$device_vendor_function_uuid ."&device_vendor_uuid=".$device_vendor_uuid);
return;
}
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_function_add') || permission_exists('device_vendor_function_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$device_vendor_function_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//set the parent uuid
if (strlen($_GET["device_vendor_uuid"]) > 0) {
$device_vendor_uuid = check_str($_GET["device_vendor_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
//$label = check_str($_POST["label"]);
$name = check_str($_POST["name"]);
$value = check_str($_POST["value"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
//process the http variables
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the uuid
if ($action == "update") {
$device_vendor_function_uuid = check_str($_POST["device_vendor_function_uuid"]);
}
//check for all required data
$msg = '';
//if (strlen($label) == 0) { $msg .= $text['message-required']." ".$text['label-label']."<br>\n"; }
if (strlen($name) == 0) { $msg .= $text['message-required']." ".$text['label-name']."<br>\n"; }
if (strlen($value) == 0) { $msg .= $text['message-required']." ".$text['label-value']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
//add vendor functions
if ($action == "add" && permission_exists('device_vendor_function_add')) {
$device_vendor_function_uuid = uuid();
$sql = "insert into v_device_vendor_functions ";
$sql .= "(";
$sql .= "device_vendor_function_uuid, ";
$sql .= "device_vendor_uuid, ";
//$sql .= "label, ";
$sql .= "name, ";
$sql .= "value, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$device_vendor_function_uuid."', ";
$sql .= "'$device_vendor_uuid', ";
//$sql .= "'$label', ";
$sql .= "'$name', ";
$sql .= "'$value', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "add")
//update vendor functions
if ($action == "update" && permission_exists('device_vendor_function_edit')) {
$sql = "update v_device_vendor_functions set ";
$sql .= "device_vendor_uuid = '$device_vendor_uuid', ";
//$sql .= "label = '$label', ";
$sql .= "name = '$name', ";
$sql .= "value = '$value', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where device_vendor_function_uuid = '$device_vendor_function_uuid'";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "update")
//add a group to the menu
if (permission_exists('device_vendor_function_add') && $_REQUEST["group_uuid_name"] != '') {
//get the group uuid and group_name
$group_data = explode('|', check_str($_REQUEST["group_uuid_name"]));
$group_uuid = $group_data[0];
$group_name = $group_data[1];
//add the group to the menu
if (strlen($device_vendor_function_uuid) > 0) {
$device_vendor_function_group_uuid = uuid();
$sql = "insert into v_device_vendor_function_groups ";
$sql .= "(";
$sql .= "device_vendor_function_group_uuid, ";
$sql .= "device_vendor_function_uuid, ";
$sql .= "device_vendor_uuid, ";
$sql .= "group_name, ";
$sql .= "group_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$device_vendor_function_group_uuid."', ";
$sql .= "'".$device_vendor_function_uuid."', ";
$sql .= "'".$device_vendor_uuid."', ";
$sql .= "'".$group_name."', ";
$sql .= "'".$group_uuid."' ";
$sql .= ")";
$db->exec($sql);
}
}
//redirect the user
$_SESSION["message"] = $text['message-'.$action];
header("Location: device_vendor_function_edit.php?id=".$device_vendor_function_uuid ."&device_vendor_uuid=".$device_vendor_uuid);
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$device_vendor_function_uuid = check_str($_GET["id"]);
$sql = "select * from v_device_vendor_functions ";
$sql .= "where device_vendor_function_uuid = '$device_vendor_function_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$device_vendor_functions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($device_vendor_functions as &$row) {
//$label = $row["label"];
$name = $row["name"];
$value = $row["value"];
$enabled = $row["enabled"];
$description = $row["description"];
}
unset ($prep_statement);
}
//group groups assigned
$sql = "select ";
$sql .= " fg.*, g.domain_uuid as group_domain_uuid ";
$sql .= "from ";
$sql .= " v_device_vendor_function_groups as fg, ";
$sql .= " v_groups as g ";
$sql .= "where ";
$sql .= " fg.group_uuid = g.group_uuid ";
$sql .= " and fg.device_vendor_uuid = :device_vendor_uuid ";
//$sql .= " and fg.device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= " and fg.device_vendor_function_uuid = :device_vendor_function_uuid ";
//$sql .= " and fg.device_vendor_function_uuid = '$device_vendor_function_uuid' ";
$sql .= "order by ";
$sql .= " g.domain_uuid desc, ";
$sql .= " g.group_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->bindParam(':device_vendor_uuid', $device_vendor_uuid);
$prep_statement->bindParam(':device_vendor_function_uuid', $device_vendor_function_uuid);
$prep_statement->execute();
$function_groups = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
//set the assigned_groups array
if (is_array($menu_item_groups)) {
foreach($menu_item_groups as $field) {
if (strlen($field['group_name']) > 0) {
$assigned_groups[] = $field['group_uuid'];
}
}
}
//get the groups
$sql = "select * from v_groups ";
if (sizeof($assigned_groups) > 0) {
$sql .= "where group_uuid not in ('".implode("','",$assigned_groups)."') ";
}
$sql .= "order by domain_uuid desc, group_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$groups = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-device_vendor_function']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='device_vendor_edit.php?id=$device_vendor_uuid'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
//echo " ".$text['label-label']."\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <input class='formfld' type='text' name='label' maxlength='255' value=\"$label\">\n";
//echo "<br />\n";
//echo $text['description-label']."\n";
//echo "</td>\n";
//echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-name']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='name' maxlength='255' value=\"$name\">\n";
echo "<br />\n";
echo $text['description-name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-value']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='value' maxlength='255' value=\"$value\">\n";
echo "<br />\n";
echo $text['description-value']."\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<pre>\n";
//print_r($function_groups);
//echo "</pre>\n";
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-groups']."</td>";
echo " <td class='vtable'>";
if (is_array($function_groups)) {
echo "<table cellpadding='0' cellspacing='0' border='0'>\n";
foreach($function_groups as $field) {
if (strlen($field['group_name']) > 0) {
echo "<tr>\n";
echo " <td class='vtable' style='white-space: nowrap; padding-right: 30px;' nowrap='nowrap'>";
echo $field['group_name'].(($field['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['group_domain_uuid']]['domain_name'] : null);
echo " </td>\n";
if (permission_exists('group_member_delete') || if_group("superadmin")) {
echo " <td class='list_control_icons' style='width: 25px;'>";
echo "<a href='device_vendor_function_edit.php?id=".$field['device_vendor_function_group_uuid']."&group_uuid=".$field['group_uuid']."&device_vendor_function_uuid=".$device_vendor_function_uuid."&device_vendor_uuid=".$device_vendor_uuid."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
echo " </td>";
}
echo "</tr>\n";
}
}
echo "</table>\n";
}
if (is_array($groups)) {
echo "<br />\n";
echo "<select name='group_uuid_name' class='formfld' style='width: auto; margin-right: 3px;'>\n";
echo " <option value=''></option>\n";
foreach($groups as $field) {
if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; } //only show the superadmin group to other superadmins
if ($field['group_name'] == "admin" && (!if_group("superadmin") && !if_group("admin") )) { continue; } //only show the admin group to other admins
if (!in_array($field["group_uuid"], $assigned_groups)) {
echo " <option value='".$field['group_uuid']."|".$field['group_name']."'>".$field['group_name'].(($field['domain_uuid'] != '') ? "@".$_SESSION['domains'][$field['domain_uuid']]['domain_name'] : null)."</option>\n";
}
}
echo "</select>";
echo "<input type='submit' class='btn' name='submit' value=\"".$text['button-add']."\">\n";
}
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='enabled'>\n";
echo " <option value=''></option>\n";
if ($enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"$description\">\n";
echo "<br />\n";
echo $text['description-description']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='device_vendor_uuid' value='$device_vendor_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='device_vendor_function_uuid' value='$device_vendor_function_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,218 +1,218 @@
<?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) 2016-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_function_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "label like '%".$search."%'";
$sql_search .= "or name like '%".$search."%'";
$sql_search .= "or value like '%".$search."%'";
$sql_search .= "or enabled like '%".$search."%'";
$sql_search .= "or description like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_vendor_functions ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= $sql_search;
if (strlen($order_by) == 0) { $sql .= "order by name asc "; } else { $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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_device_vendor_functions ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= $sql_search;
if (strlen($order_by) == 0) { $sql .= "order by name 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();
$vendor_functions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-device_vendor_functions']."</b></td>\n";
//echo " <form method='get' action=''>\n";
//echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
//echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
//echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
//echo " </td>\n";
//echo " </form>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-label']."</th>\n";
echo th_order_by('name', $text['label-name'], $order_by, $order);
echo th_order_by('value', $text['label-value'], $order_by, $order);
echo "<th>".$text['label-groups']."</th>\n";
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('device_vendor_function_add')) {
echo "<a href='device_vendor_function_edit.php?device_vendor_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($vendor_functions)) {
foreach($vendor_functions as $row) {
//get the groups that have been assigned to the vendor functions
$sql = "select ";
$sql .= " fg.*, g.domain_uuid as group_domain_uuid ";
$sql .= "from ";
$sql .= " v_device_vendor_function_groups as fg, ";
$sql .= " v_groups as g ";
$sql .= "where ";
$sql .= " fg.group_uuid = g.group_uuid ";
$sql .= " and fg.device_vendor_uuid = :device_vendor_uuid ";
//$sql .= " and fg.device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= " and fg.device_vendor_function_uuid = :device_vendor_function_uuid ";
//$sql .= " and fg.device_vendor_function_uuid = '".$row['device_vendor_function_uuid']."' ";
$sql .= "order by ";
$sql .= " g.domain_uuid desc, ";
$sql .= " g.group_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->bindParam(':device_vendor_uuid', $device_vendor_uuid);
$prep_statement->bindParam(':device_vendor_function_uuid', $row['device_vendor_function_uuid']);
$prep_statement->execute();
$vendor_function_groups = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
unset($group_list);
foreach ($vendor_function_groups as &$sub_row) {
$group_list[] = $sub_row["group_name"].(($sub_row['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
}
$group_list = isset($group_list) ? implode(', ', $group_list) : '';
unset ($vendor_function_groups);
//build the edit link
if (permission_exists('device_vendor_function_edit')) {
$tr_link = "href='device_vendor_function_edit.php?device_vendor_uuid=".$row['device_vendor_uuid']."&id=".$row['device_vendor_function_uuid']."'";
}
//show the row of data
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['name']]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['name']." &nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['value']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$group_list."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_function_edit')) {
echo "<a href='device_vendor_function_edit.php?device_vendor_uuid=".$row['device_vendor_uuid']."&id=".$row['device_vendor_function_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('device_vendor_function_delete')) {
echo "<a href='device_vendor_function_delete.php?device_vendor_uuid=".$row['device_vendor_uuid']."&id=".$row['device_vendor_function_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
//toggle the value of the c variable
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='7' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_function_add')) {
echo "<a href='device_vendor_function_edit.php?device_vendor_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?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) 2016-2017
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_function_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "label like '%".$search."%'";
$sql_search .= "or name like '%".$search."%'";
$sql_search .= "or value like '%".$search."%'";
$sql_search .= "or enabled like '%".$search."%'";
$sql_search .= "or description like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_vendor_functions ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= $sql_search;
if (strlen($order_by) == 0) { $sql .= "order by name asc "; } else { $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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_device_vendor_functions ";
$sql .= "where device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= $sql_search;
if (strlen($order_by) == 0) { $sql .= "order by name 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();
$vendor_functions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-device_vendor_functions']."</b></td>\n";
//echo " <form method='get' action=''>\n";
//echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
//echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
//echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
//echo " </td>\n";
//echo " </form>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>".$text['label-label']."</th>\n";
echo th_order_by('name', $text['label-name'], $order_by, $order);
echo th_order_by('value', $text['label-value'], $order_by, $order);
echo "<th>".$text['label-groups']."</th>\n";
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('device_vendor_function_add')) {
echo "<a href='device_vendor_function_edit.php?device_vendor_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($vendor_functions)) {
foreach($vendor_functions as $row) {
//get the groups that have been assigned to the vendor functions
$sql = "select ";
$sql .= " fg.*, g.domain_uuid as group_domain_uuid ";
$sql .= "from ";
$sql .= " v_device_vendor_function_groups as fg, ";
$sql .= " v_groups as g ";
$sql .= "where ";
$sql .= " fg.group_uuid = g.group_uuid ";
$sql .= " and fg.device_vendor_uuid = :device_vendor_uuid ";
//$sql .= " and fg.device_vendor_uuid = '$device_vendor_uuid' ";
$sql .= " and fg.device_vendor_function_uuid = :device_vendor_function_uuid ";
//$sql .= " and fg.device_vendor_function_uuid = '".$row['device_vendor_function_uuid']."' ";
$sql .= "order by ";
$sql .= " g.domain_uuid desc, ";
$sql .= " g.group_name asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->bindParam(':device_vendor_uuid', $device_vendor_uuid);
$prep_statement->bindParam(':device_vendor_function_uuid', $row['device_vendor_function_uuid']);
$prep_statement->execute();
$vendor_function_groups = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($sql, $prep_statement);
unset($group_list);
foreach ($vendor_function_groups as &$sub_row) {
$group_list[] = $sub_row["group_name"].(($sub_row['group_domain_uuid'] != '') ? "@".$_SESSION['domains'][$sub_row['group_domain_uuid']]['domain_name'] : null);
}
$group_list = isset($group_list) ? implode(', ', $group_list) : '';
unset ($vendor_function_groups);
//build the edit link
if (permission_exists('device_vendor_function_edit')) {
$tr_link = "href='device_vendor_function_edit.php?device_vendor_uuid=".$row['device_vendor_uuid']."&id=".$row['device_vendor_function_uuid']."'";
}
//show the row of data
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.$row['name']]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['name']." &nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['value']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$group_list."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_function_edit')) {
echo "<a href='device_vendor_function_edit.php?device_vendor_uuid=".$row['device_vendor_uuid']."&id=".$row['device_vendor_function_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('device_vendor_function_delete')) {
echo "<a href='device_vendor_function_delete.php?device_vendor_uuid=".$row['device_vendor_uuid']."&id=".$row['device_vendor_function_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
echo " </td>\n";
echo "</tr>\n";
//toggle the value of the c variable
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='7' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_function_add')) {
echo "<a href='device_vendor_function_edit.php?device_vendor_uuid=".$_GET['id']."' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,185 +1,185 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "where (";
$sql_search .= "name like '%".$search."%'";
$sql_search .= "or enabled like '%".$search."%'";
$sql_search .= "or description like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_vendors ";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_device_vendors ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-device_vendors']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
if (permission_exists('device_vendor_restore')) {
echo " <input type='button' class='btn' alt='".$text['button-restore']."' onclick=\"document.location='device_vendor_restore.php'\" value='".$text['button-restore']."'>";
}
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'>";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['title_description-device_vendor']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('name', $text['label-name'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('device_vendor_add')) {
echo "<a href='device_vendor_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('device_vendor_edit')) {
$tr_link = "href='device_vendor_edit.php?id=".$row['device_vendor_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_edit')) {
echo "<a href='device_vendor_edit.php?id=".$row['device_vendor_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('device_vendor_delete')) {
echo "<a href='device_vendor_delete.php?id=".$row['device_vendor_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='4' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_add')) {
echo "<a href='device_vendor_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('device_vendor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "where (";
$sql_search .= "name like '%".$search."%'";
$sql_search .= "or enabled like '%".$search."%'";
$sql_search .= "or description like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_device_vendors ";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_device_vendors ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-device_vendors']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
if (permission_exists('device_vendor_restore')) {
echo " <input type='button' class='btn' alt='".$text['button-restore']."' onclick=\"document.location='device_vendor_restore.php'\" value='".$text['button-restore']."'>";
}
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'>";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['title_description-device_vendor']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('name', $text['label-name'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('device_vendor_add')) {
echo "<a href='device_vendor_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('device_vendor_edit')) {
$tr_link = "href='device_vendor_edit.php?id=".$row['device_vendor_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_edit')) {
echo "<a href='device_vendor_edit.php?id=".$row['device_vendor_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('device_vendor_delete')) {
echo "<a href='device_vendor_delete.php?id=".$row['device_vendor_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='4' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_vendor_add')) {
echo "<a href='device_vendor_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,249 +1,249 @@
<?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>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/functions/object_to_array.php";
require_once "resources/functions/parse_message.php";
if (permission_exists('fax_inbox_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get fax server uuid, set connection parameters
if (strlen($_GET['id']) > 0) {
$fax_uuid = check_str($_GET["id"]);
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
}
else {
//show only assigned fax extensions
$sql = "select * from v_fax as f, v_fax_users as u ";
$sql .= "where f.fax_uuid = u.fax_uuid ";
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and f.fax_uuid = '$fax_uuid' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
if (!if_group("superadmin") && !if_group("admin")) {
echo "access denied";
exit;
}
}
foreach ($result as &$row) {
$fax_name = $row["fax_name"];
$fax_extension = $row["fax_extension"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_inbound_subject_tag = $row["fax_email_inbound_subject_tag"];
break;
}
unset ($prep_statement);
// make connection
$fax_email_connection = "{".$fax_email_connection_host.":".$fax_email_connection_port."/".$fax_email_connection_type;
$fax_email_connection .= ($fax_email_connection_security != '') ? "/".$fax_email_connection_security : "/notls";
$fax_email_connection .= "/".(($fax_email_connection_validate == 'false') ? "no" : null)."validate-cert";
$fax_email_connection .= "}".$fax_email_connection_mailbox;
if (!$connection = imap_open($fax_email_connection, $fax_email_connection_username, $fax_email_connection_password)) {
messages::add($text['message-cannot_connect']."(".imap_last_error().")", 'neative');
header("Location: fax.php");
exit;
}
}
else {
header("Location: fax.php");
exit;
}
//message action
if ($_GET['email_id'] != '') {
$email_id = check_str($_GET['email_id']);
//download attachment
if (isset($_GET['download'])) {
$message = parse_message($connection, $email_id, FT_UID);
$attachment = $message['attachments'][0];
if ($attachment) {
$file_type = pathinfo($attachment['name'], PATHINFO_EXTENSION);
switch ($file_type) {
case "pdf" : header("Content-Type: application/pdf"); break;
case "tif" : header("Contet-Type: image/tiff"); break;
}
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Content-Length: ".$attachment['size']);
$browser = $_SERVER["HTTP_USER_AGENT"];
if (preg_match("/MSIE 5.5/", $browser) || preg_match("/MSIE 6.0/", $browser)) {
header("Content-Disposition: filename=\"".$attachment['name']."\"");
}
else {
header("Content-Disposition: attachment; filename=\"".$attachment['name']."\"");
}
header("Content-Transfer-Encoding: binary");
echo $attachment['data'];
exit;
}
else{
//redirect user
messages::add($text['message-download_failed'], 'negative');
header("Location: ?id=".$fax_uuid);
exit;
}
}
//delete email
if (isset($_GET['delete']) && permission_exists('fax_inbox_delete')) {
$message = parse_message($connection, $email_id, FT_UID);
$attachment = $message['attachments'][0];
if (imap_delete($connection, $email_id, FT_UID)) {
if (imap_expunge($connection)) {
//clean up local inbox copy
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
@unlink($fax_dir.'/'.$fax_extension.'/inbox/'.$attachment['name']);
//redirect user
messages::add($text['message-delete']);
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
messages::add($text['message-delete_failed'], 'negative');
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
messages::add($text['message-delete_failed'], 'negative');
header("Location: ?id=".$fax_uuid);
exit;
}
}
//get emails
$emails = imap_search($connection, "SUBJECT \"".$fax_email_inbound_subject_tag."\"", SE_UID);
//show the header
require_once "resources/header.php";
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the inbox
$c = 0;
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='fax.php';\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' alt='".$text['button-refresh']."' onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br><br>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th>".$text['label-fax_caller_id_name']."</th>\n";
echo " <th>".$text['label-fax_caller_id_number']."</th>\n";
echo " <th>".$text['table-file']."</th>\n";
echo " <th>".$text['label-email_size']."</th>\n";
echo " <th>".$text['label-email_received']."</th>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'>&nbsp;</td>\n";
}
echo " </tr>";
if ($emails) {
rsort($emails); // most recent on top
foreach ($emails as $email_id) {
$metadata = object_to_array(imap_fetch_overview($connection, $email_id, FT_UID));
$message = parse_message($connection, $email_id, FT_UID);
$attachment = $message['attachments'][0];
$file_name = $attachment['name'];
$caller_id_name = substr($file_name, 0, strpos($file_name, '-'));
$caller_id_number = (is_numeric($caller_id_name)) ? format_phone((int) $caller_id_name) : null;
echo " <tr ".(($metadata[0]['seen'] == 0) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_name."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_number."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='?id=".$fax_uuid."&email_id=".$email_id."&download'>".$file_name."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".byte_convert($attachment['size'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$metadata[0]['date']."</td>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'><a href='?id=".$fax_uuid."&email_id=".$email_id."&delete' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a></td>\n";
}
echo " </tr>\n";
$c = ($c) ? 0 : 1;
}
}
else {
echo "<tr valign='top'>\n";
echo " <td colspan='4' style='text-align: center;'><br><br>".$text['message-no_faxes_found']."<br><br></td>\n";
echo "</tr>\n";
}
echo "</table>";
echo "<br><br>";
/* close the connection */
imap_close($connection);
//show the footer
require_once "resources/footer.php";
?>
<?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>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/functions/object_to_array.php";
require_once "resources/functions/parse_message.php";
if (permission_exists('fax_inbox_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get fax server uuid, set connection parameters
if (strlen($_GET['id']) > 0) {
$fax_uuid = check_str($_GET["id"]);
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select * from v_fax ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and fax_uuid = '$fax_uuid' ";
}
else {
//show only assigned fax extensions
$sql = "select * from v_fax as f, v_fax_users as u ";
$sql .= "where f.fax_uuid = u.fax_uuid ";
$sql .= "and f.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and f.fax_uuid = '$fax_uuid' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) == 0) {
if (!if_group("superadmin") && !if_group("admin")) {
echo "access denied";
exit;
}
}
foreach ($result as &$row) {
$fax_name = $row["fax_name"];
$fax_extension = $row["fax_extension"];
$fax_email_connection_type = $row["fax_email_connection_type"];
$fax_email_connection_host = $row["fax_email_connection_host"];
$fax_email_connection_port = $row["fax_email_connection_port"];
$fax_email_connection_security = $row["fax_email_connection_security"];
$fax_email_connection_validate = $row["fax_email_connection_validate"];
$fax_email_connection_username = $row["fax_email_connection_username"];
$fax_email_connection_password = $row["fax_email_connection_password"];
$fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
$fax_email_inbound_subject_tag = $row["fax_email_inbound_subject_tag"];
break;
}
unset ($prep_statement);
// make connection
$fax_email_connection = "{".$fax_email_connection_host.":".$fax_email_connection_port."/".$fax_email_connection_type;
$fax_email_connection .= ($fax_email_connection_security != '') ? "/".$fax_email_connection_security : "/notls";
$fax_email_connection .= "/".(($fax_email_connection_validate == 'false') ? "no" : null)."validate-cert";
$fax_email_connection .= "}".$fax_email_connection_mailbox;
if (!$connection = imap_open($fax_email_connection, $fax_email_connection_username, $fax_email_connection_password)) {
messages::add($text['message-cannot_connect']."(".imap_last_error().")", 'neative');
header("Location: fax.php");
exit;
}
}
else {
header("Location: fax.php");
exit;
}
//message action
if ($_GET['email_id'] != '') {
$email_id = check_str($_GET['email_id']);
//download attachment
if (isset($_GET['download'])) {
$message = parse_message($connection, $email_id, FT_UID);
$attachment = $message['attachments'][0];
if ($attachment) {
$file_type = pathinfo($attachment['name'], PATHINFO_EXTENSION);
switch ($file_type) {
case "pdf" : header("Content-Type: application/pdf"); break;
case "tif" : header("Contet-Type: image/tiff"); break;
}
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // date in the past
header("Content-Length: ".$attachment['size']);
$browser = $_SERVER["HTTP_USER_AGENT"];
if (preg_match("/MSIE 5.5/", $browser) || preg_match("/MSIE 6.0/", $browser)) {
header("Content-Disposition: filename=\"".$attachment['name']."\"");
}
else {
header("Content-Disposition: attachment; filename=\"".$attachment['name']."\"");
}
header("Content-Transfer-Encoding: binary");
echo $attachment['data'];
exit;
}
else{
//redirect user
messages::add($text['message-download_failed'], 'negative');
header("Location: ?id=".$fax_uuid);
exit;
}
}
//delete email
if (isset($_GET['delete']) && permission_exists('fax_inbox_delete')) {
$message = parse_message($connection, $email_id, FT_UID);
$attachment = $message['attachments'][0];
if (imap_delete($connection, $email_id, FT_UID)) {
if (imap_expunge($connection)) {
//clean up local inbox copy
$fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
@unlink($fax_dir.'/'.$fax_extension.'/inbox/'.$attachment['name']);
//redirect user
messages::add($text['message-delete']);
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
messages::add($text['message-delete_failed'], 'negative');
header("Location: ?id=".$fax_uuid);
exit;
}
}
else {
//redirect user
messages::add($text['message-delete_failed'], 'negative');
header("Location: ?id=".$fax_uuid);
exit;
}
}
//get emails
$emails = imap_search($connection, "SUBJECT \"".$fax_email_inbound_subject_tag."\"", SE_UID);
//show the header
require_once "resources/header.php";
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the inbox
$c = 0;
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='fax.php';\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' alt='".$text['button-refresh']."' onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br><br>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <th>".$text['label-fax_caller_id_name']."</th>\n";
echo " <th>".$text['label-fax_caller_id_number']."</th>\n";
echo " <th>".$text['table-file']."</th>\n";
echo " <th>".$text['label-email_size']."</th>\n";
echo " <th>".$text['label-email_received']."</th>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'>&nbsp;</td>\n";
}
echo " </tr>";
if ($emails) {
rsort($emails); // most recent on top
foreach ($emails as $email_id) {
$metadata = object_to_array(imap_fetch_overview($connection, $email_id, FT_UID));
$message = parse_message($connection, $email_id, FT_UID);
$attachment = $message['attachments'][0];
$file_name = $attachment['name'];
$caller_id_name = substr($file_name, 0, strpos($file_name, '-'));
$caller_id_number = (is_numeric($caller_id_name)) ? format_phone((int) $caller_id_name) : null;
echo " <tr ".(($metadata[0]['seen'] == 0) ? "style='font-weight: bold;'" : null).">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_name."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$caller_id_number."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='?id=".$fax_uuid."&email_id=".$email_id."&download'>".$file_name."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".byte_convert($attachment['size'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$metadata[0]['date']."</td>\n";
if (permission_exists('fax_inbox_delete')) {
echo " <td style='width: 25px;' class='list_control_icons'><a href='?id=".$fax_uuid."&email_id=".$email_id."&delete' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a></td>\n";
}
echo " </tr>\n";
$c = ($c) ? 0 : 1;
}
}
else {
echo "<tr valign='top'>\n";
echo " <td colspan='4' style='text-align: center;'><br><br>".$text['message-no_faxes_found']."<br><br></td>\n";
echo "</tr>\n";
}
echo "</table>";
echo "<br><br>";
/* close the connection */
imap_close($connection);
//show the footer
require_once "resources/footer.php";
?>

View File

@ -1,65 +1,65 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('pin_number_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete the data
if (strlen($id)>0) {
//delete pin_number
$sql = "delete from v_pin_numbers ";
$sql .= "where pin_number_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: pin_numbers.php');
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('pin_number_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete the data
if (strlen($id)>0) {
//delete pin_number
$sql = "delete from v_pin_numbers ";
$sql .= "where pin_number_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
messages::add($text['message-delete']);
header('Location: pin_numbers.php');
?>

View File

@ -1,240 +1,240 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('pin_number_add') || permission_exists('pin_number_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$pin_number_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$pin_number = check_str($_POST["pin_number"]);
$accountcode = check_str($_POST["accountcode"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$pin_number_uuid = check_str($_POST["pin_number_uuid"]);
}
//check for all required data
if (strlen($pin_number) == 0) { $msg .= $text['message-required']." ".$text['label-pin_number']."<br>\n"; }
//if (strlen($accountcode) == 0) { $msg .= $text['message-required']." ".$text['label-accountcode']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('pin_number_add')) {
$sql = "insert into v_pin_numbers ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "pin_number_uuid, ";
$sql .= "pin_number, ";
$sql .= "accountcode, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$pin_number', ";
$sql .= "'$accountcode', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header("Location: pin_numbers.php");
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('pin_number_edit')) {
$sql = "update v_pin_numbers set ";
$sql .= "pin_number = '$pin_number', ";
$sql .= "accountcode = '$accountcode', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where pin_number_uuid = '$pin_number_uuid'";
$sql .= "and domain_uuid = '$domain_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header("Location: pin_numbers.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") {
$pin_number_uuid = check_str($_GET["id"]);
$sql = "select * from v_pin_numbers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and pin_number_uuid = '$pin_number_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$pin_number = $row["pin_number"];
$accountcode = $row["accountcode"];
$enabled = $row["enabled"];
$description = $row["description"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-pin_number']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='pin_numbers.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-pin_number']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='pin_number' maxlength='255' value=\"$pin_number\">\n";
echo "<br />\n";
echo $text['description-pin_number']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-accountcode']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='accountcode' maxlength='255' value=\"$accountcode\">\n";
echo "<br />\n";
echo $text['description-accountcode']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='enabled'>\n";
echo " <option value=''></option>\n";
if ($enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"$description\">\n";
echo "<br />\n";
echo $text['description-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='pin_number_uuid' value='$pin_number_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('pin_number_add') || permission_exists('pin_number_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$pin_number_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$pin_number = check_str($_POST["pin_number"]);
$accountcode = check_str($_POST["accountcode"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$pin_number_uuid = check_str($_POST["pin_number_uuid"]);
}
//check for all required data
if (strlen($pin_number) == 0) { $msg .= $text['message-required']." ".$text['label-pin_number']."<br>\n"; }
//if (strlen($accountcode) == 0) { $msg .= $text['message-required']." ".$text['label-accountcode']."<br>\n"; }
if (strlen($enabled) == 0) { $msg .= $text['message-required']." ".$text['label-enabled']."<br>\n"; }
//if (strlen($description) == 0) { $msg .= $text['message-required']." ".$text['label-description']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.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 "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('pin_number_add')) {
$sql = "insert into v_pin_numbers ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "pin_number_uuid, ";
$sql .= "pin_number, ";
$sql .= "accountcode, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$pin_number', ";
$sql .= "'$accountcode', ";
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-add']);
header("Location: pin_numbers.php");
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('pin_number_edit')) {
$sql = "update v_pin_numbers set ";
$sql .= "pin_number = '$pin_number', ";
$sql .= "accountcode = '$accountcode', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where pin_number_uuid = '$pin_number_uuid'";
$sql .= "and domain_uuid = '$domain_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
messages::add($text['message-update']);
header("Location: pin_numbers.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") {
$pin_number_uuid = check_str($_GET["id"]);
$sql = "select * from v_pin_numbers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and pin_number_uuid = '$pin_number_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$pin_number = $row["pin_number"];
$accountcode = $row["accountcode"];
$enabled = $row["enabled"];
$description = $row["description"];
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap' valign='top'><b>".$text['title-pin_number']."</b><br><br></td>\n";
echo "<td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='pin_numbers.php'\" value='".$text['button-back']."'>";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-pin_number']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='pin_number' maxlength='255' value=\"$pin_number\">\n";
echo "<br />\n";
echo $text['description-pin_number']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-accountcode']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='accountcode' maxlength='255' value=\"$accountcode\">\n";
echo "<br />\n";
echo $text['description-accountcode']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='enabled'>\n";
echo " <option value=''></option>\n";
if ($enabled == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($enabled == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-enabled']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-description']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='description' maxlength='255' value=\"$description\">\n";
echo "<br />\n";
echo $text['description-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='pin_number_uuid' value='$pin_number_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,186 +1,186 @@
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('pin_number_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "pin_number like '%".$search."%'";
$sql_search .= "or accountcode like '%".$search."%'";
$sql_search .= "or enabled like '%".$search."%'";
$sql_search .= "or description like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_pin_numbers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_pin_numbers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<input type='button' class='btn' style='margin-right: 15px;' value='".$text['button-export']."' onclick=\"window.location.href='pin_download.php'\">\n";
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-pin_numbers']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['title_description-pin_number']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('pin_number', $text['label-pin_number'], $order_by, $order);
echo th_order_by('accountcode', $text['label-accountcode'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('pin_number_add')) {
echo "<a href='pin_number_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('pin_number_edit')) {
$tr_link = "href='pin_number_edit.php?id=".$row['pin_number_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['pin_number']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['accountcode']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('pin_number_edit')) {
echo "<a href='pin_number_edit.php?id=".$row['pin_number_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('pin_number_delete')) {
echo "<a href='pin_number_delete.php?id=".$row['pin_number_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('pin_number_add')) {
echo "<a href='pin_number_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>
<?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) 2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
//check permissions
require_once "resources/check_auth.php";
if (permission_exists('pin_number_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get variables used to control the order
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//add the search term
$search = check_str($_GET["search"]);
if (strlen($search) > 0) {
$sql_search = "and (";
$sql_search .= "pin_number like '%".$search."%'";
$sql_search .= "or accountcode like '%".$search."%'";
$sql_search .= "or enabled like '%".$search."%'";
$sql_search .= "or description like '%".$search."%'";
$sql_search .= ")";
}
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//prepare to page the results
$sql = "select count(*) as num_rows from v_pin_numbers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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 = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$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_pin_numbers ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= $sql_search;
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);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the content
echo "<input type='button' class='btn' style='margin-right: 15px;' value='".$text['button-export']."' onclick=\"window.location.href='pin_download.php'\">\n";
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-pin_numbers']."</b></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
echo " ".$text['title_description-pin_number']."<br /><br />\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('pin_number', $text['label-pin_number'], $order_by, $order);
echo th_order_by('accountcode', $text['label-accountcode'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
if (permission_exists('pin_number_add')) {
echo "<a href='pin_number_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;\n";
}
echo "</td>\n";
echo "<tr>\n";
if (is_array($result)) {
foreach($result as $row) {
if (permission_exists('pin_number_edit')) {
$tr_link = "href='pin_number_edit.php?id=".$row['pin_number_uuid']."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['pin_number']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['accountcode']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['enabled']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['description']."&nbsp;</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('pin_number_edit')) {
echo "<a href='pin_number_edit.php?id=".$row['pin_number_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
}
if (permission_exists('pin_number_delete')) {
echo "<a href='pin_number_delete.php?id=".$row['pin_number_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
}
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='nowrap'>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('pin_number_add')) {
echo "<a href='pin_number_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
}
else {
echo "&nbsp;";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";
?>

View File

@ -1,90 +1,90 @@
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,341 +1,341 @@
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* scripts class provides methods for creating the config.lua and copying switch scripts
*
* @method string correct_path
* @method string copy_files
* @method string write_config
*/
if (!class_exists('scripts')) {
class scripts {
public $db;
public $db_type;
public $db_name;
public $db_host;
public $db_port;
public $db_path;
public $db_username;
public $db_password;
public $dsn_name;
public $dsn_username;
public $dsn_password;
/**
* Called when the object is created
*/
public function __construct() {
//connect to the database if not connected
require_once "resources/classes/database.php";
$database = new database;
$database->connect();
$this->db = $database->db;
$this->db_type = $database->type;
$this->db_name = $database->db_name;
$this->db_host = $database->host;
$this->db_port = $database->port;
$this->db_path = $database->path;
$this->db_username = $database->username;
$this->db_password = $database->password;
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Corrects the path for specifically for windows
*/
private function correct_path($path) {
global $IS_WINDOWS;
if ($IS_WINDOWS == null) {
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
}
if ($IS_WINDOWS) {
return str_replace('\\', '/', $path);
}
return $path;
}
/**
* Copy the switch scripts from the web directory to the switch directory
*/
public function copy_files() {
if (is_array($_SESSION['switch']['scripts'])) {
$dst_dir = $_SESSION['switch']['scripts']['dir'];
if (file_exists($dst_dir)) {
//get the source directory
if (file_exists('/usr/share/examples/fusionpbx/scripts')){
$src_dir = '/usr/share/examples/fusionpbx/scripts';
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
}
if (is_readable($dst_dir)) {
recursive_copy($src_dir,$dst_dir);
unset($src_dir);
// Copy the app/*/resource/install/scripts
$app_scripts = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'app/*/resource/install/scripts');
foreach ($app_scripts as $app_script){
recursive_copy($app_script, $dst_dir);
}
unset($app_scripts);
}else{
throw new Exception("Cannot read from '$src_dir' to get the scripts");
}
chmod($dst_dir, 0775);
unset($dst_dir);
}
}
}
/**
* Writes the config.lua
*/
public function write_config() {
if (is_array($_SESSION['switch']['scripts'])) {
//replace the backslash with a forward slash
$this->db_path = str_replace("\\", "/", $this->db_path);
//get the odbc information
$sql = "select count(*) as num_rows from v_databases ";
$sql .= "where database_driver = 'odbc' ";
$prep_statement = $this->db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset($prep_statement);
if ($row['num_rows'] > 0) {
$odbc_num_rows = $row['num_rows'];
$sql = "select * from v_databases ";
$sql .= "where database_driver = 'odbc' ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (is_array($result)) {
foreach ($result as &$row) {
$this->dsn_name = $row["database_name"];
$this->dsn_username = $row["database_username"];
$this->dsn_password = $row["database_password"];
break; //limit to 1 row
}
unset ($prep_statement);
}
}
else {
$odbc_num_rows = '0';
}
}
//get the recordings directory
if (is_array($_SESSION['switch']['recordings'])) {
$recordings_dir = $_SESSION['switch']['recordings']['dir'];
}
//get the http_protocol
if (!isset($_SERVER['HTTP_PROTOCOL'])) {
$_SERVER['HTTP_PROTOCOL'] = 'http';
if (isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['HTTP_PROTOCOL'] = $_SERVER['REQUEST_SCHEME']; }
if ($_SERVER['HTTPS'] == 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
if ($_SERVER['SERVER_PORT'] == '443') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
}
//find the location to write the config.lua
if (is_dir("/etc/fusionpbx")){
$config = "/etc/fusionpbx/config.lua";
} elseif (is_dir("/usr/local/etc/fusionpbx")){
$config = "/usr/local/etc/fusionpbx/config.lua";
}
else {
$config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua";
}
$fout = fopen($config,"w");
if(!$fout){
return;
}
//make the config.lua
$tmp = "\n";
$tmp .= "--set the variables\n";
if (strlen($_SESSION['switch']['conf']['dir']) > 0) {
$tmp .= $this->correct_path(" conf_dir = [[".$_SESSION['switch']['conf']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
$tmp .= $this->correct_path(" sounds_dir = [[".$_SESSION['switch']['sounds']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['db']['dir']) > 0) {
$tmp .= $this->correct_path(" database_dir = [[".$_SESSION['switch']['db']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
$tmp .= $this->correct_path(" recordings_dir = [[".$recordings_dir."]];\n");
}
if (strlen($_SESSION['switch']['storage']['dir']) > 0) {
$tmp .= $this->correct_path(" storage_dir = [[".$_SESSION['switch']['storage']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['voicemail']['dir']) > 0) {
$tmp .= $this->correct_path(" voicemail_dir = [[".$_SESSION['switch']['voicemail']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
$tmp .= $this->correct_path(" scripts_dir = [[".$_SESSION['switch']['scripts']['dir']."]];\n");
}
$tmp .= $this->correct_path(" php_dir = [[".PHP_BINDIR."]];\n");
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
$tmp .= " php_bin = \"php.exe\";\n";
}
elseif (file_exists(PHP_BINDIR."/php5")) {
$tmp .= " php_bin = \"php5\";\n";
}
else {
$tmp .= " php_bin = \"php\";\n";
}
$tmp .= $this->correct_path(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n");
$tmp .= $this->correct_path(" project_path = [[".PROJECT_PATH."]];\n");
$tmp .= $this->correct_path(" http_protocol = [[".$_SERVER['HTTP_PROTOCOL']."]];\n");
$tmp .= "\n";
$tmp .= "--store settings in memcache\n";
$tmp .= " settings_in_cache = false;\n";
$tmp .= "\n";
if ((strlen($this->db_type) > 0) || (strlen($this->dsn_name) > 0)) {
$tmp .= "--database information\n";
$tmp .= " database = {}\n";
$tmp .= " database.type = \"".$this->db_type."\";\n";
$tmp .= " database.name = \"".$this->db_name."\";\n";
$tmp .= $this->correct_path(" database.path = [[".$this->db_path."]];\n");
if (strlen($this->dsn_name) > 0) {
$tmp .= " database.system = \"odbc://".$this->dsn_name.":".$this->dsn_username.":".$this->dsn_password."\";\n";
$tmp .= " database.switch = \"odbc://freeswitch:".$this->dsn_username.":".$this->dsn_password."\";\n";
}
elseif ($this->db_type == "pgsql") {
if ($this->db_host == "localhost") { $this->db_host = "127.0.0.1"; }
$tmp .= " database.system = \"pgsql://hostaddr=".$this->db_host." port=".$this->db_port." dbname=".$this->db_name." user=".$this->db_username." password=".$this->db_password." options='' application_name='".$this->db_name."'\";\n";
$tmp .= " database.switch = \"pgsql://hostaddr=".$this->db_host." port=".$this->db_port." dbname=freeswitch user=".$this->db_username." password=".$this->db_password." options='' application_name='freeswitch'\";\n";
}
elseif ($this->db_type == "sqlite") {
$tmp .= " database.system = \"sqlite://".$this->db_path."/".$this->db_name."\";\n";
$tmp .= " database.switch = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n";
}
elseif ($this->db_type == "mysql") {
$tmp .= " database.system = \"\";\n";
$tmp .= " database.switch = \"\";\n";
}
$tmp .= "\n";
$tmp .= " database.backend = {}\n";
$tmp .= " database.backend.base64 = 'luasql'\n";
$tmp .= "\n";
}
$tmp .= "--set defaults\n";
$tmp .= " expire = {}\n";
$tmp .= " expire.default = \"3600\";\n";
$tmp .= " expire.directory = \"3600\";\n";
$tmp .= " expire.dialplan = \"3600\";\n";
$tmp .= " expire.languages = \"3600\";\n";
$tmp .= " expire.sofia = \"3600\";\n";
$tmp .= " expire.acl = \"3600\";\n";
$tmp .= " expire.ivr = \"3600\";\n";
$tmp .= "\n";
$tmp .= "--set xml_handler\n";
$tmp .= " xml_handler = {}\n";
$tmp .= " xml_handler.fs_path = false;\n";
$tmp .= " xml_handler.reg_as_number_alias = false;\n";
$tmp .= " xml_handler.number_as_presence_id = true;\n";
$tmp .= "\n";
$tmp .= "--set settings\n";
$tmp .= " settings = {}\n";
$tmp .= " settings.recordings = {}\n";
$tmp .= " settings.voicemail = {}\n";
$tmp .= " settings.fax = {}\n";
if (isset($_SESSION['recordings']['storage_type']['text'])) {
$tmp .= " settings.recordings.storage_type = \"".$_SESSION['recordings']['storage_type']['text']."\";\n";
}
else {
$tmp .= " settings.recordings.storage_type = \"\";\n";
}
if (isset($_SESSION['voicemail']['storage_type']['text'])) {
$tmp .= " settings.voicemail.storage_type = \"".$_SESSION['voicemail']['storage_type']['text']."\";\n";
}
else {
$tmp .= " settings.voicemail.storage_type = \"\";\n";
}
if (isset($_SESSION['fax']['storage_type']['text'])) {
$tmp .= " settings.fax.storage_type = \"".$_SESSION['fax']['storage_type']['text']."\";\n";
}
else {
$tmp .= " settings.fax.storage_type = \"\";\n";
}
$tmp .= "\n";
$tmp .= "--set the debug options\n";
$tmp .= " debug.params = false;\n";
$tmp .= " debug.sql = false;\n";
$tmp .= " debug.xml_request = false;\n";
$tmp .= " debug.xml_string = false;\n";
$tmp .= " debug.cache = false;\n";
$tmp .= "\n";
$tmp .= "--additional info\n";
$tmp .= " domain_count = ".count($_SESSION["domains"]).";\n";
$tmp .= $this->correct_path(" temp_dir = [[".$_SESSION['server']['temp']['dir']."]];\n");
if (isset($_SESSION['domain']['dial_string']['text'])) {
$tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n";
}
$tmp .= "\n";
$tmp .= "--include local.lua\n";
$tmp .= " require(\"resources.functions.file_exists\");\n";
$tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n";
$tmp .= " require(\"resources.local\");\n";
$tmp .= " end\n";
fwrite($fout, $tmp);
unset($tmp);
fclose($fout);
}
} //end config_lua
} //end scripts class
}
/*
//example use
//update config.lua
$obj = new scripts;
$obj->write_config();
*/
?>
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* scripts class provides methods for creating the config.lua and copying switch scripts
*
* @method string correct_path
* @method string copy_files
* @method string write_config
*/
if (!class_exists('scripts')) {
class scripts {
public $db;
public $db_type;
public $db_name;
public $db_host;
public $db_port;
public $db_path;
public $db_username;
public $db_password;
public $dsn_name;
public $dsn_username;
public $dsn_password;
/**
* Called when the object is created
*/
public function __construct() {
//connect to the database if not connected
require_once "resources/classes/database.php";
$database = new database;
$database->connect();
$this->db = $database->db;
$this->db_type = $database->type;
$this->db_name = $database->db_name;
$this->db_host = $database->host;
$this->db_port = $database->port;
$this->db_path = $database->path;
$this->db_username = $database->username;
$this->db_password = $database->password;
}
/**
* Called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* Corrects the path for specifically for windows
*/
private function correct_path($path) {
global $IS_WINDOWS;
if ($IS_WINDOWS == null) {
if (stristr(PHP_OS, 'WIN')) { $IS_WINDOWS = true; } else { $IS_WINDOWS = false; }
}
if ($IS_WINDOWS) {
return str_replace('\\', '/', $path);
}
return $path;
}
/**
* Copy the switch scripts from the web directory to the switch directory
*/
public function copy_files() {
if (is_array($_SESSION['switch']['scripts'])) {
$dst_dir = $_SESSION['switch']['scripts']['dir'];
if (file_exists($dst_dir)) {
//get the source directory
if (file_exists('/usr/share/examples/fusionpbx/scripts')){
$src_dir = '/usr/share/examples/fusionpbx/scripts';
}
else {
$src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts';
}
if (is_readable($dst_dir)) {
recursive_copy($src_dir,$dst_dir);
unset($src_dir);
// Copy the app/*/resource/install/scripts
$app_scripts = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'app/*/resource/install/scripts');
foreach ($app_scripts as $app_script){
recursive_copy($app_script, $dst_dir);
}
unset($app_scripts);
}else{
throw new Exception("Cannot read from '$src_dir' to get the scripts");
}
chmod($dst_dir, 0775);
unset($dst_dir);
}
}
}
/**
* Writes the config.lua
*/
public function write_config() {
if (is_array($_SESSION['switch']['scripts'])) {
//replace the backslash with a forward slash
$this->db_path = str_replace("\\", "/", $this->db_path);
//get the odbc information
$sql = "select count(*) as num_rows from v_databases ";
$sql .= "where database_driver = 'odbc' ";
$prep_statement = $this->db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset($prep_statement);
if ($row['num_rows'] > 0) {
$odbc_num_rows = $row['num_rows'];
$sql = "select * from v_databases ";
$sql .= "where database_driver = 'odbc' ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (is_array($result)) {
foreach ($result as &$row) {
$this->dsn_name = $row["database_name"];
$this->dsn_username = $row["database_username"];
$this->dsn_password = $row["database_password"];
break; //limit to 1 row
}
unset ($prep_statement);
}
}
else {
$odbc_num_rows = '0';
}
}
//get the recordings directory
if (is_array($_SESSION['switch']['recordings'])) {
$recordings_dir = $_SESSION['switch']['recordings']['dir'];
}
//get the http_protocol
if (!isset($_SERVER['HTTP_PROTOCOL'])) {
$_SERVER['HTTP_PROTOCOL'] = 'http';
if (isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['HTTP_PROTOCOL'] = $_SERVER['REQUEST_SCHEME']; }
if ($_SERVER['HTTPS'] == 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
if ($_SERVER['SERVER_PORT'] == '443') { $_SERVER['HTTP_PROTOCOL'] = 'https'; }
}
//find the location to write the config.lua
if (is_dir("/etc/fusionpbx")){
$config = "/etc/fusionpbx/config.lua";
} elseif (is_dir("/usr/local/etc/fusionpbx")){
$config = "/usr/local/etc/fusionpbx/config.lua";
}
else {
$config = $_SESSION['switch']['scripts']['dir']."/resources/config.lua";
}
$fout = fopen($config,"w");
if(!$fout){
return;
}
//make the config.lua
$tmp = "\n";
$tmp .= "--set the variables\n";
if (strlen($_SESSION['switch']['conf']['dir']) > 0) {
$tmp .= $this->correct_path(" conf_dir = [[".$_SESSION['switch']['conf']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['sounds']['dir']) > 0) {
$tmp .= $this->correct_path(" sounds_dir = [[".$_SESSION['switch']['sounds']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['db']['dir']) > 0) {
$tmp .= $this->correct_path(" database_dir = [[".$_SESSION['switch']['db']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['recordings']['dir']) > 0) {
$tmp .= $this->correct_path(" recordings_dir = [[".$recordings_dir."]];\n");
}
if (strlen($_SESSION['switch']['storage']['dir']) > 0) {
$tmp .= $this->correct_path(" storage_dir = [[".$_SESSION['switch']['storage']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['voicemail']['dir']) > 0) {
$tmp .= $this->correct_path(" voicemail_dir = [[".$_SESSION['switch']['voicemail']['dir']."]];\n");
}
if (strlen($_SESSION['switch']['scripts']['dir']) > 0) {
$tmp .= $this->correct_path(" scripts_dir = [[".$_SESSION['switch']['scripts']['dir']."]];\n");
}
$tmp .= $this->correct_path(" php_dir = [[".PHP_BINDIR."]];\n");
if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
$tmp .= " php_bin = \"php.exe\";\n";
}
elseif (file_exists(PHP_BINDIR."/php5")) {
$tmp .= " php_bin = \"php5\";\n";
}
else {
$tmp .= " php_bin = \"php\";\n";
}
$tmp .= $this->correct_path(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n");
$tmp .= $this->correct_path(" project_path = [[".PROJECT_PATH."]];\n");
$tmp .= $this->correct_path(" http_protocol = [[".$_SERVER['HTTP_PROTOCOL']."]];\n");
$tmp .= "\n";
$tmp .= "--store settings in memcache\n";
$tmp .= " settings_in_cache = false;\n";
$tmp .= "\n";
if ((strlen($this->db_type) > 0) || (strlen($this->dsn_name) > 0)) {
$tmp .= "--database information\n";
$tmp .= " database = {}\n";
$tmp .= " database.type = \"".$this->db_type."\";\n";
$tmp .= " database.name = \"".$this->db_name."\";\n";
$tmp .= $this->correct_path(" database.path = [[".$this->db_path."]];\n");
if (strlen($this->dsn_name) > 0) {
$tmp .= " database.system = \"odbc://".$this->dsn_name.":".$this->dsn_username.":".$this->dsn_password."\";\n";
$tmp .= " database.switch = \"odbc://freeswitch:".$this->dsn_username.":".$this->dsn_password."\";\n";
}
elseif ($this->db_type == "pgsql") {
if ($this->db_host == "localhost") { $this->db_host = "127.0.0.1"; }
$tmp .= " database.system = \"pgsql://hostaddr=".$this->db_host." port=".$this->db_port." dbname=".$this->db_name." user=".$this->db_username." password=".$this->db_password." options='' application_name='".$this->db_name."'\";\n";
$tmp .= " database.switch = \"pgsql://hostaddr=".$this->db_host." port=".$this->db_port." dbname=freeswitch user=".$this->db_username." password=".$this->db_password." options='' application_name='freeswitch'\";\n";
}
elseif ($this->db_type == "sqlite") {
$tmp .= " database.system = \"sqlite://".$this->db_path."/".$this->db_name."\";\n";
$tmp .= " database.switch = \"sqlite://".$_SESSION['switch']['db']['dir']."\";\n";
}
elseif ($this->db_type == "mysql") {
$tmp .= " database.system = \"\";\n";
$tmp .= " database.switch = \"\";\n";
}
$tmp .= "\n";
$tmp .= " database.backend = {}\n";
$tmp .= " database.backend.base64 = 'luasql'\n";
$tmp .= "\n";
}
$tmp .= "--set defaults\n";
$tmp .= " expire = {}\n";
$tmp .= " expire.default = \"3600\";\n";
$tmp .= " expire.directory = \"3600\";\n";
$tmp .= " expire.dialplan = \"3600\";\n";
$tmp .= " expire.languages = \"3600\";\n";
$tmp .= " expire.sofia = \"3600\";\n";
$tmp .= " expire.acl = \"3600\";\n";
$tmp .= " expire.ivr = \"3600\";\n";
$tmp .= "\n";
$tmp .= "--set xml_handler\n";
$tmp .= " xml_handler = {}\n";
$tmp .= " xml_handler.fs_path = false;\n";
$tmp .= " xml_handler.reg_as_number_alias = false;\n";
$tmp .= " xml_handler.number_as_presence_id = true;\n";
$tmp .= "\n";
$tmp .= "--set settings\n";
$tmp .= " settings = {}\n";
$tmp .= " settings.recordings = {}\n";
$tmp .= " settings.voicemail = {}\n";
$tmp .= " settings.fax = {}\n";
if (isset($_SESSION['recordings']['storage_type']['text'])) {
$tmp .= " settings.recordings.storage_type = \"".$_SESSION['recordings']['storage_type']['text']."\";\n";
}
else {
$tmp .= " settings.recordings.storage_type = \"\";\n";
}
if (isset($_SESSION['voicemail']['storage_type']['text'])) {
$tmp .= " settings.voicemail.storage_type = \"".$_SESSION['voicemail']['storage_type']['text']."\";\n";
}
else {
$tmp .= " settings.voicemail.storage_type = \"\";\n";
}
if (isset($_SESSION['fax']['storage_type']['text'])) {
$tmp .= " settings.fax.storage_type = \"".$_SESSION['fax']['storage_type']['text']."\";\n";
}
else {
$tmp .= " settings.fax.storage_type = \"\";\n";
}
$tmp .= "\n";
$tmp .= "--set the debug options\n";
$tmp .= " debug.params = false;\n";
$tmp .= " debug.sql = false;\n";
$tmp .= " debug.xml_request = false;\n";
$tmp .= " debug.xml_string = false;\n";
$tmp .= " debug.cache = false;\n";
$tmp .= "\n";
$tmp .= "--additional info\n";
$tmp .= " domain_count = ".count($_SESSION["domains"]).";\n";
$tmp .= $this->correct_path(" temp_dir = [[".$_SESSION['server']['temp']['dir']."]];\n");
if (isset($_SESSION['domain']['dial_string']['text'])) {
$tmp .= " dial_string = \"".$_SESSION['domain']['dial_string']['text']."\";\n";
}
$tmp .= "\n";
$tmp .= "--include local.lua\n";
$tmp .= " require(\"resources.functions.file_exists\");\n";
$tmp .= " if (file_exists(\"/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n";
$tmp .= " dofile(\"/usr/local/etc/fusionpbx/local.lua\");\n";
$tmp .= " elseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n";
$tmp .= " require(\"resources.local\");\n";
$tmp .= " end\n";
fwrite($fout, $tmp);
unset($tmp);
fclose($fout);
}
} //end config_lua
} //end scripts class
}
/*
//example use
//update config.lua
$obj = new scripts;
$obj->write_config();
*/
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +1,110 @@
<?php
include "root.php";
require_once "resources/require.php";
$font_loader_version = ($_GET['v'] != '') ? $_GET['v'] : 1;
header("Content-type: text/javascript; charset: UTF-8");
//web font loader
if ($_SESSION['theme']['font_loader']['text'] == 'true') {
//parse font names
if (is_array($_SESSION['theme']) && sizeof($_SESSION['theme']) > 0) {
foreach ($_SESSION['theme'] as $subcategory => $type) {
if (substr_count($subcategory, '_font') > 0) {
$font_string = $type['text'];
if ($font_string != '') {
if (substr_count($font_string, ',') > 0) {
$tmp_array = explode(',', $font_string);
}
else {
$tmp_array[] = $font_string;
}
foreach ($tmp_array as $font_name) {
$font_name = trim($font_name, "'");
$font_name = trim($font_name, '"');
$font_name = trim($font_name);
$fonts[] = $font_name;
}
}
}
unset($tmp_array);
}
}
//optimize fonts array
if (is_array($fonts) && sizeof($fonts) > 0) {
$fonts = array_unique($fonts);
$common_fonts = 'serif,sans-serif,arial,arial black,arial narrow,calibri,'.
'candara,apple gothic,geneva,tahoma,microsoft sans serif,'.
'lucidia,lucidia console,monaco,lucidia sans unicode,'.
'lucidiagrande,consolas,menlo,trebuchet,trebuchet ms,'.
'helvetica,times,times new roman,courier,courier new,'.
'impact,comic sans,comic sans ms,georgia,palatino,'.
'palatino linotype,verdana,franklin gothic,'.
'franklin gothic medium,gill sans,gill sans mt,'.
'brush script,corbel,segoe,segoe ui,optima,';
$common_fonts = explode(',', $common_fonts);
foreach ($fonts as $index => $font) {
if (in_array(strtolower($font), $common_fonts)) {
unset($fonts[$index]);
}
}
}
//load fonts
if (is_array($fonts) && sizeof($fonts) > 0) {
if ($_SESSION['theme']['font_retrieval']['text'] == 'asynchronous') {
?>
WebFontConfig = {
google: {
families: ['<?php echo implode("','", $fonts); ?>']
}
};
(function(d) {
var wf = d.createElement('script'), s = d.scripts[0];
wf.src = '//ajax.googleapis.com/ajax/libs/webfont/<?php echo $font_loader_version; ?>/webfont.js';
s.parentNode.insertBefore(wf, s);
})(document);
<?php
}
else { //synchronous
?>
WebFont.load({
google: {
families: ['<?php echo implode("','", $fonts); ?>']
}
});
<?php
}
}
}
?>
<?php
include "root.php";
require_once "resources/require.php";
$font_loader_version = ($_GET['v'] != '') ? $_GET['v'] : 1;
header("Content-type: text/javascript; charset: UTF-8");
//web font loader
if ($_SESSION['theme']['font_loader']['text'] == 'true') {
//parse font names
if (is_array($_SESSION['theme']) && sizeof($_SESSION['theme']) > 0) {
foreach ($_SESSION['theme'] as $subcategory => $type) {
if (substr_count($subcategory, '_font') > 0) {
$font_string = $type['text'];
if ($font_string != '') {
if (substr_count($font_string, ',') > 0) {
$tmp_array = explode(',', $font_string);
}
else {
$tmp_array[] = $font_string;
}
foreach ($tmp_array as $font_name) {
$font_name = trim($font_name, "'");
$font_name = trim($font_name, '"');
$font_name = trim($font_name);
$fonts[] = $font_name;
}
}
}
unset($tmp_array);
}
}
//optimize fonts array
if (is_array($fonts) && sizeof($fonts) > 0) {
$fonts = array_unique($fonts);
$common_fonts = 'serif,sans-serif,arial,arial black,arial narrow,calibri,'.
'candara,apple gothic,geneva,tahoma,microsoft sans serif,'.
'lucidia,lucidia console,monaco,lucidia sans unicode,'.
'lucidiagrande,consolas,menlo,trebuchet,trebuchet ms,'.
'helvetica,times,times new roman,courier,courier new,'.
'impact,comic sans,comic sans ms,georgia,palatino,'.
'palatino linotype,verdana,franklin gothic,'.
'franklin gothic medium,gill sans,gill sans mt,'.
'brush script,corbel,segoe,segoe ui,optima,';
$common_fonts = explode(',', $common_fonts);
foreach ($fonts as $index => $font) {
if (in_array(strtolower($font), $common_fonts)) {
unset($fonts[$index]);
}
}
}
//load fonts
if (is_array($fonts) && sizeof($fonts) > 0) {
if ($_SESSION['theme']['font_retrieval']['text'] == 'asynchronous') {
?>
WebFontConfig = {
google: {
families: ['<?php echo implode("','", $fonts); ?>']
}
};
(function(d) {
var wf = d.createElement('script'), s = d.scripts[0];
wf.src = '//ajax.googleapis.com/ajax/libs/webfont/<?php echo $font_loader_version; ?>/webfont.js';
s.parentNode.insertBefore(wf, s);
})(document);
<?php
}
else { //synchronous
?>
WebFont.load({
google: {
families: ['<?php echo implode("','", $fonts); ?>']
}
});
<?php
}
}
}
?>

View File

@ -1,59 +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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//get the background images
$relative_path = PROJECT_PATH.'/themes/default/images/backgrounds';
$backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path);
unset($array);
$x = 0;
while (false !== ($file = readdir($backgrounds))) {
if ($file != "." AND $file != "..") {
$ext = pathinfo($file, PATHINFO_EXTENSION);
if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") {
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'background_image';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = $relative_path.'/'.$file;
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_background_image';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = $relative_path.'/'.$file;
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
$x++;
}
if ($x > 300) { break; };
}
}
}
?>
<?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-2016
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
if ($domains_processed == 1) {
//get the background images
$relative_path = PROJECT_PATH.'/themes/default/images/backgrounds';
$backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path);
unset($array);
$x = 0;
while (false !== ($file = readdir($backgrounds))) {
if ($file != "." AND $file != "..") {
$ext = pathinfo($file, PATHINFO_EXTENSION);
if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") {
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'background_image';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = $relative_path.'/'.$file;
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
$x++;
$array[$x]['default_setting_category'] = 'theme';
$array[$x]['default_setting_subcategory'] = 'login_background_image';
$array[$x]['default_setting_name'] = 'array';
$array[$x]['default_setting_value'] = $relative_path.'/'.$file;
$array[$x]['default_setting_enabled'] = 'false';
$array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
$x++;
}
if ($x > 300) { break; };
}
}
}
?>

File diff suppressed because it is too large Load Diff