2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
2018-03-25 18:00:12 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2018
|
2012-06-04 16:58:40 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
2018-03-25 18:00:12 +02:00
|
|
|
//includes
|
|
|
|
|
include "root.php";
|
|
|
|
|
require_once "resources/require.php";
|
|
|
|
|
require_once "resources/check_auth.php";
|
|
|
|
|
|
|
|
|
|
//check permissions
|
|
|
|
|
if (permission_exists('var_view')) {
|
|
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-05-30 00:27:04 +02:00
|
|
|
//add multi-lingual support
|
2015-01-18 11:04:43 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2013-05-30 00:27:04 +02:00
|
|
|
|
2015-01-22 02:10:30 +01:00
|
|
|
//toggle enabled state
|
|
|
|
|
if ($_REQUEST['id'] != '' && $_REQUEST['enabled'] != '') {
|
|
|
|
|
$sql = "update v_vars set ";
|
|
|
|
|
$sql .= "var_enabled = '".check_str($_REQUEST['enabled'])."' ";
|
|
|
|
|
$sql .= "where var_uuid = '".check_str($_REQUEST['id'])."' ";
|
|
|
|
|
$db->exec(check_sql($sql));
|
|
|
|
|
unset($sql);
|
|
|
|
|
|
|
|
|
|
//unset the user defined variables
|
|
|
|
|
$_SESSION["user_defined_variables"] = "";
|
|
|
|
|
|
|
|
|
|
//synchronize the configuration
|
|
|
|
|
save_var_xml();
|
|
|
|
|
|
2017-06-10 04:13:40 +02:00
|
|
|
messages::add($text['message-update']);
|
2015-01-22 02:10:30 +01:00
|
|
|
header("Location: vars.php?id=".$_REQUEST['id']);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 16:58:40 +02:00
|
|
|
//include the header
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/header.php";
|
2014-07-10 02:32:50 +02:00
|
|
|
$document['title'] = $text['title-variables'];
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
//set http values as php variables
|
|
|
|
|
$order_by = $_GET["order_by"];
|
|
|
|
|
$order = $_GET["order"];
|
|
|
|
|
|
|
|
|
|
//show the content
|
2015-02-15 08:59:02 +01:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " <tr>\n";
|
2013-05-30 00:27:04 +02:00
|
|
|
echo " <td align='left'><b>".$text['header-variables']."</b><br>\n";
|
|
|
|
|
echo " ".$text['description-variables']."\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
2012-09-24 22:39:53 +02:00
|
|
|
$sql = "select * from v_vars ";
|
2012-06-04 16:58:40 +02:00
|
|
|
if (strlen($order_by)> 0) {
|
|
|
|
|
$sql .= "order by $order_by $order ";
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-03-25 18:00:12 +02:00
|
|
|
$sql .= "order by var_category, var_order asc ";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
$prep_statement = $db->prepare(check_sql($sql));
|
|
|
|
|
$prep_statement->execute();
|
|
|
|
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
|
|
|
$result_count = count($result);
|
|
|
|
|
unset ($prep_statement, $sql);
|
|
|
|
|
|
|
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
|
|
|
|
|
2014-06-21 09:04:04 +02:00
|
|
|
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
$tmp_var_header = '';
|
|
|
|
|
$tmp_var_header .= "<tr>\n";
|
2013-05-30 00:27:04 +02:00
|
|
|
$tmp_var_header .= th_order_by('var_name', $text['label-name'], $order_by, $order);
|
|
|
|
|
$tmp_var_header .= th_order_by('var_value', $text['label-value'], $order_by, $order);
|
2015-03-25 21:30:17 +01:00
|
|
|
$tmp_var_header .= th_order_by('var_hostname', $text['label-hostname'], $order_by, $order);
|
2013-05-30 00:27:04 +02:00
|
|
|
$tmp_var_header .= th_order_by('var_enabled', $text['label-enabled'], $order_by, $order);
|
|
|
|
|
$tmp_var_header .= "<th>".$text['label-description']."</th>\n";
|
2014-02-26 03:27:13 +01:00
|
|
|
$tmp_var_header .= "<td class='list_control_icons'>";
|
2013-09-25 22:23:10 +02:00
|
|
|
if (permission_exists('var_add')) {
|
2014-02-26 03:27:13 +01:00
|
|
|
$tmp_var_header .= "<a href='var_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
$tmp_var_header .= "</td>\n";
|
|
|
|
|
$tmp_var_header .= "<tr>\n";
|
|
|
|
|
|
2012-11-24 02:24:13 +01:00
|
|
|
if ($result_count > 0) {
|
2018-03-25 18:00:12 +02:00
|
|
|
$prev_var_category = '';
|
2012-06-04 16:58:40 +02:00
|
|
|
foreach($result as $row) {
|
2016-12-26 22:57:49 +01:00
|
|
|
$var_value = $row['var_value'];
|
2012-06-04 16:58:40 +02:00
|
|
|
$var_value = substr($var_value, 0, 50);
|
2018-03-25 18:00:12 +02:00
|
|
|
if ($prev_var_category != $row['var_category']) {
|
2012-06-04 16:58:40 +02:00
|
|
|
$c=0;
|
2018-03-25 18:00:12 +02:00
|
|
|
if (strlen($prev_var_category) > 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2015-03-26 01:18:19 +01:00
|
|
|
echo "<td colspan='6'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
|
|
|
|
echo " <td width='33.3%' nowrap> </td>\n";
|
|
|
|
|
echo " <td width='33.3%' align='center' nowrap> </td>\n";
|
2014-02-26 03:27:13 +01:00
|
|
|
echo " <td width='33.3%' align='right'>";
|
2013-09-25 22:23:10 +02:00
|
|
|
if (permission_exists('var_add')) {
|
2014-02-26 03:27:13 +01:00
|
|
|
echo "<a href='var_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
echo "<tr><td colspan='4' align='left'>\n";
|
|
|
|
|
echo " <br />\n";
|
|
|
|
|
echo " <br />\n";
|
2018-03-25 18:00:12 +02:00
|
|
|
echo " <b>".$row['var_category']."</b> </td></tr>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo $tmp_var_header;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-21 10:52:47 +02:00
|
|
|
$tr_link = (permission_exists('var_edit')) ? "href='var_edit.php?id=".$row['var_uuid']."'" : null;
|
2014-06-21 09:04:04 +02:00
|
|
|
echo "<tr ".$tr_link.">\n";
|
2014-06-21 02:58:16 +02:00
|
|
|
echo " <td valign='top' align='left' class='".$row_style[$c]."'>";
|
|
|
|
|
if (permission_exists('var_edit')) {
|
|
|
|
|
echo "<a href='var_edit.php?id=".$row['var_uuid']."'>".substr($row['var_name'],0,32)."</a>";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo substr($row['var_name'],0,32);
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".substr($var_value,0,30)."</td>\n";
|
2015-06-02 23:33:43 +02:00
|
|
|
echo " <td valign='top' align='left' class='".$row_style[$c]."'>".$row['var_hostname']." </td>\n";
|
2015-03-26 01:09:54 +01:00
|
|
|
echo " <td valign='top' align='left' class='".$row_style[$c]."'>";
|
2015-01-22 02:10:30 +01:00
|
|
|
echo " <a href='?id=".$row['var_uuid']."&enabled=".(($row['var_enabled'] == 'true') ? 'false' : 'true')."'>".(($row['var_enabled'] == 'true') ? $text['option-true'] : $text['option-false'])."</a>";
|
|
|
|
|
echo " </td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
$var_description = str_replace("\n", "<br />", trim(substr(base64_decode($row['var_description']),0,40)));
|
|
|
|
|
$var_description = str_replace(" ", " ", $var_description);
|
2014-06-22 08:35:33 +02:00
|
|
|
echo " <td valign='top' align='left' class='row_stylebg'>".$var_description." </td>\n";
|
2014-02-26 03:27:13 +01:00
|
|
|
echo " <td valign='top' align='right'>";
|
2013-09-25 22:23:10 +02:00
|
|
|
if (permission_exists('var_edit')) {
|
2018-08-28 04:26:46 +02:00
|
|
|
echo "<a href='var_edit.php?id=".escape($row['var_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-09-25 22:23:10 +02:00
|
|
|
if (permission_exists('var_delete')) {
|
2018-08-28 04:26:46 +02:00
|
|
|
echo "<a href='var_delete.php?id=".escape($row['var_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
2018-03-25 18:00:12 +02:00
|
|
|
$prev_var_category = $row['var_category'];
|
2012-06-04 16:58:40 +02:00
|
|
|
if ($c==0) { $c=1; } else { $c=0; }
|
|
|
|
|
} //end foreach
|
|
|
|
|
unset($sql, $result, $row_count);
|
|
|
|
|
} //end if results
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td colspan='6' align='left'>\n";
|
|
|
|
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
|
|
|
|
echo " <tr>\n";
|
2015-03-26 01:01:24 +01:00
|
|
|
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
2015-03-26 01:18:19 +01:00
|
|
|
echo " <td align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
2015-03-26 01:05:14 +01:00
|
|
|
echo " <td width='33.3%' class='list_control_icons'>";
|
2013-09-25 22:23:10 +02:00
|
|
|
if (permission_exists('var_add')) {
|
2014-02-26 03:27:13 +01:00
|
|
|
echo "<a href='var_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "<br><br>";
|
|
|
|
|
|
|
|
|
|
//include the footer
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2018-03-25 18:00:12 +02:00
|
|
|
?>
|