mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Add a missing file sip_profile_copy.php to the dev branch.
This commit is contained in:
65
core/default_settings/app_config.php
Normal file
65
core/default_settings/app_config.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Default Settings';
|
||||
$apps[$x]['guid'] = '2c2453c0-1bea-4475-9f44-4d969650de09';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en'] = 'Default settings that apply to all domains.';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en'] = 'Default Settings';
|
||||
$apps[$x]['menu'][0]['uuid'] = '834b2739-9e99-4345-9b0b-7ec3ca332b67';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/default_settings/default_settings.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'default_setting_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'default_setting_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'default_setting_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_default_settings';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the category.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_subcategory';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the subcategory.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_value';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the value.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'default_setting_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
|
||||
?>
|
||||
29
core/default_settings/app_defaults.php
Normal file
29
core/default_settings/app_defaults.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2010
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
?>
|
||||
190
core/default_settings/default_settings.php
Normal file
190
core/default_settings/default_settings.php
Normal file
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>Default Settings</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Settings used for all domains.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "";
|
||||
$sql .= " select count(*) as num_rows from v_default_settings ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the domain list
|
||||
$sql = "";
|
||||
$sql .= " select * from v_default_settings ";
|
||||
if (strlen($order_by) == 0) {
|
||||
$sql .= "order by default_setting_category, default_setting_subcategory asc ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by $order_by $order ";
|
||||
}
|
||||
$sql .= " limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
$previous_category = '';
|
||||
foreach($result as $row) {
|
||||
if ($previous_category != $row['default_setting_category']) {
|
||||
echo "<tr><td colspan='4' align='left'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <b>".ucfirst($row['default_setting_category'])."</b> </td></tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('default_setting_subcategory', 'Category', $order_by, $order);
|
||||
echo th_order_by('default_setting_name', 'Name', $order_by, $order);
|
||||
echo th_order_by('default_setting_value', 'Value', $order_by, $order);
|
||||
echo th_order_by('default_setting_enabled', 'Enabled', $order_by, $order);
|
||||
echo th_order_by('default_setting_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
echo " <a href='default_settings_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_subcategory']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>\n";
|
||||
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
$name = $row['default_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "where menu_uuid = '".$row['default_setting_value']."' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
echo $sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
} else {
|
||||
echo $row['default_setting_value'];
|
||||
}
|
||||
echo " \n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_enabled']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['default_setting_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
echo " <a href='default_settings_edit.php?id=".$row['default_setting_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
echo " <a href='default_settings_delete.php?id=".$row['default_setting_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$previous_category = $row['default_setting_category'];
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
echo " <a href='default_settings_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
echo "<br /><br />";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
58
core/default_settings/default_settings_delete.php
Normal file
58
core/default_settings/default_settings_delete.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
$sql = "";
|
||||
$sql .= "delete from v_default_settings ";
|
||||
$sql .= "where default_setting_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=default_settings_edit.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
372
core/default_settings/default_settings_edit.php
Normal file
372
core/default_settings/default_settings_edit.php
Normal file
@@ -0,0 +1,372 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (if_group("admin") || if_group("superadmin")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$default_setting_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$default_setting_category = check_str($_POST["default_setting_category"]);
|
||||
$default_setting_subcategory = check_str($_POST["default_setting_subcategory"]);
|
||||
$default_setting_name = check_str($_POST["default_setting_name"]);
|
||||
$default_setting_value = check_str($_POST["default_setting_value"]);
|
||||
$default_setting_enabled = check_str($_POST["default_setting_enabled"]);
|
||||
$default_setting_description = check_str($_POST["default_setting_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$default_setting_uuid = check_str($_POST["default_setting_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($default_setting_category) == 0) { $msg .= "Please provide: Category<br>\n"; }
|
||||
//if (strlen($default_setting_subcategory) == 0) { $msg .= "Please provide: Subcategory<br>\n"; }
|
||||
//if (strlen($default_setting_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
|
||||
//if (strlen($default_setting_value) == 0) { $msg .= "Please provide: Value<br>\n"; }
|
||||
//if (strlen($default_setting_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
|
||||
//if (strlen($default_setting_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add") {
|
||||
$sql = "insert into v_default_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "default_setting_uuid, ";
|
||||
$sql .= "default_setting_category, ";
|
||||
$sql .= "default_setting_subcategory, ";
|
||||
$sql .= "default_setting_name, ";
|
||||
$sql .= "default_setting_value, ";
|
||||
$sql .= "default_setting_enabled, ";
|
||||
$sql .= "default_setting_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$default_setting_category', ";
|
||||
$sql .= "'$default_setting_subcategory', ";
|
||||
$sql .= "'$default_setting_name', ";
|
||||
$sql .= "'$default_setting_value', ";
|
||||
$sql .= "'$default_setting_enabled', ";
|
||||
$sql .= "'$default_setting_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=default_settings.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update") {
|
||||
$sql = "update v_default_settings set ";
|
||||
$sql .= "default_setting_category = '$default_setting_category', ";
|
||||
$sql .= "default_setting_subcategory = '$default_setting_subcategory', ";
|
||||
$sql .= "default_setting_name = '$default_setting_name', ";
|
||||
$sql .= "default_setting_value = '$default_setting_value', ";
|
||||
$sql .= "default_setting_enabled = '$default_setting_enabled', ";
|
||||
$sql .= "default_setting_description = '$default_setting_description' ";
|
||||
$sql .= "where default_setting_uuid = '$default_setting_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=default_settings.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$default_setting_uuid = $_GET["id"];
|
||||
$sql = "select * from v_default_settings ";
|
||||
$sql .= "where default_setting_uuid = '$default_setting_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$default_setting_category = $row["default_setting_category"];
|
||||
$default_setting_subcategory = $row["default_setting_subcategory"];
|
||||
$default_setting_name = $row["default_setting_name"];
|
||||
$default_setting_value = $row["default_setting_value"];
|
||||
$default_setting_enabled = $row["default_setting_enabled"];
|
||||
$default_setting_description = $row["default_setting_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Default Setting Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Default Setting Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='default_settings.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Settings used for all domains.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Category:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_category' maxlength='255' value=\"$default_setting_category\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Subcategory:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_subcategory' maxlength='255' value=\"$default_setting_subcategory\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Name:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_name' maxlength='255' value=\"$default_setting_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Value:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
$category = $row['default_setting_category'];
|
||||
$subcategory = $row['default_setting_subcategory'];
|
||||
$name = $row['default_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "order by menu_language, menu_name asc ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as $sub_row) {
|
||||
if (strtolower($row['default_setting_value']) == strtolower($sub_row["menu_uuid"])) {
|
||||
echo " <option value='".$sub_row["menu_uuid"]."' selected='selected'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$sub_row["menu_uuid"]."'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."</option>\n";
|
||||
}
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
||||
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//add all the themes to the list
|
||||
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
|
||||
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
|
||||
while (false !== ($dir_name = readdir($handle))) {
|
||||
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && is_dir($theme_dir.'/'.$dir_name)) {
|
||||
$dir_label = str_replace('_', ' ', $dir_name);
|
||||
$dir_label = str_replace('-', ' ', $dir_label);
|
||||
if ($dir_name == $row['default_setting_value']) {
|
||||
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='$dir_name'>$dir_label</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "time_zone" && $name == "name" ) {
|
||||
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//$list = DateTimeZone::listAbbreviations();
|
||||
$time_zone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$previous_category = '';
|
||||
$x = 0;
|
||||
foreach ($time_zone_identifiers as $key => $val) {
|
||||
$time_zone = explode("/", $val);
|
||||
$category = $time_zone[0];
|
||||
if ($category != $previous_category) {
|
||||
if ($x > 0) {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " <optgroup label='".$category."'>\n";
|
||||
}
|
||||
if (strlen($val) > 0) {
|
||||
$time_zone_offset = get_time_zone_offset($val)/3600;
|
||||
$time_zone_offset_hours = floor($time_zone_offset);
|
||||
$time_zone_offset_minutes = ($time_zone_offset - $time_zone_offset_hours) * 60;
|
||||
$time_zone_offset_minutes = number_pad($time_zone_offset_minutes, 2);
|
||||
if ($time_zone_offset > 0) {
|
||||
$time_zone_offset_hours = number_pad($time_zone_offset_hours, 2);
|
||||
$time_zone_offset_hours = "+".$time_zone_offset_hours;
|
||||
}
|
||||
else {
|
||||
$time_zone_offset_hours = str_replace("-", "", $time_zone_offset_hours);
|
||||
$time_zone_offset_hours = "-".number_pad($time_zone_offset_hours, 2);
|
||||
}
|
||||
}
|
||||
if ($val == $row['default_setting_value']) {
|
||||
echo " <option value='".$val."' selected='selected'>(UTC ".$time_zone_offset_hours.":".$time_zone_offset_minutes.") ".$val."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$val."'>(UTC ".$time_zone_offset_hours.":".$time_zone_offset_minutes.") ".$val."</option>\n";
|
||||
}
|
||||
$previous_category = $category;
|
||||
$x++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
} else {
|
||||
echo " <input class='formfld' type='text' name='default_setting_value' maxlength='255' value=\"$default_setting_value\">\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
echo "Enter the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Enabled:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='default_setting_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($default_setting_enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($default_setting_enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "Choose to enable or disable the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='default_setting_description' maxlength='255' value=\"$default_setting_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='default_setting_uuid' value='$default_setting_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
50
core/default_settings/root.php
Normal file
50
core/default_settings/root.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user