mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-03-24 17:25:40 +00:00
Change directory in core/domains to core/domain_settings.
This commit is contained in:
137
core/domain_settings/app_config.php
Normal file
137
core/domain_settings/app_config.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = 'Domains';
|
||||
$apps[$x]['guid'] = 'b31e723a-bf70-670c-a49b-470d2a232f71';
|
||||
$apps[$x]['category'] = 'Core';
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en-us'] = 'Manage a single domain or multiple domains for multi-tenant.';
|
||||
$apps[$x]['description']['es-mx'] = '';
|
||||
$apps[$x]['description']['de'] = '';
|
||||
$apps[$x]['description']['de-ch'] = '';
|
||||
$apps[$x]['description']['de-at'] = '';
|
||||
$apps[$x]['description']['fr'] = '';
|
||||
$apps[$x]['description']['fr-ca'] = '';
|
||||
$apps[$x]['description']['fr-ch'] = '';
|
||||
$apps[$x]['description']['pt-pt'] = 'Gerir um único domínio ou vários domínios para multi-tenant.';
|
||||
$apps[$x]['description']['pt-br'] = '';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = 'Domains';
|
||||
$apps[$x]['menu'][0]['title']['es-mx'] = '';
|
||||
$apps[$x]['menu'][0]['title']['de'] = '';
|
||||
$apps[$x]['menu'][0]['title']['de-ch'] = '';
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr-ch'] = '';
|
||||
$apps[$x]['menu'][0]['title']['pt-pt'] = 'Dominios';
|
||||
$apps[$x]['menu'][0]['title']['pt-br'] = '';
|
||||
$apps[$x]['menu'][0]['uuid'] = '4fa7e90b-6d6c-12d4-712f-62857402b801';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = '/core/domains/domains.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_select';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_setting_view';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_setting_add';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_setting_edit';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = 'domain_setting_delete';
|
||||
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
|
||||
$y++;
|
||||
|
||||
//schema details
|
||||
$y = 0; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_domains';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the domain name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the description.';
|
||||
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = 'v_domain_settings';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_category';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the category.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_subcategory';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the subcategory.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_name';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the name.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_value';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the value.';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_enabled';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_setting_description';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
|
||||
?>
|
||||
37
core/domain_settings/app_defaults.php
Normal file
37
core/domain_settings/app_defaults.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2010
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//remove external from the end of the gateway path
|
||||
if (substr($v_gateways_dir, -8) == "external") {
|
||||
//$v_gateways_dir = substr($v_gateways_dir, 0, (strlen($v_gateways_dir)-9));
|
||||
//$sql = "update v_domain_settings set ";
|
||||
//$sql .= "v_gateways_dir = '$v_gateways_dir' ";
|
||||
//$sql .= "where domain_uuid = '$domain_uuid'";
|
||||
//$db->exec($sql);
|
||||
//unset($sql);
|
||||
}
|
||||
|
||||
?>
|
||||
208
core/domain_settings/domain_settings.php
Normal file
208
core/domain_settings/domain_settings.php
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('domain_setting_view')) {
|
||||
//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>Domain 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 each domain.<br /><br />\n";
|
||||
//echo " </td>\n";
|
||||
//echo " </tr>\n";
|
||||
//echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
$previous_category = '';
|
||||
foreach($result as $row) {
|
||||
if ($previous_category != $row['domain_setting_category']) {
|
||||
echo "<tr><td colspan='4' align='left'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo " <b>".ucfirst($row['domain_setting_category'])."</b> </td></tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('domain_setting_subcategory', 'Category', $order_by, $order);
|
||||
echo th_order_by('domain_setting_name', 'Type', $order_by, $order);
|
||||
echo th_order_by('domain_setting_value', 'Value', $order_by, $order);
|
||||
echo th_order_by('domain_setting_enabled', 'Enabled', $order_by, $order);
|
||||
echo th_order_by('domain_setting_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('domain_setting_add')) {
|
||||
echo " <a href='domain_settings_edit.php?domain_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_subcategory']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>\n";
|
||||
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
$name = $row['domain_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "where menu_uuid = '".$row['domain_setting_value']."' ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as &$sub_row) {
|
||||
echo $sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
}
|
||||
elseif ($category == "email" && $subcategory == "smtp_password" && $name == "var" ) {
|
||||
echo " ******** \n";
|
||||
}
|
||||
elseif ($category == "provision" && $subcategory == "password" && $name == "var" ) {
|
||||
echo " ******** \n";
|
||||
} else {
|
||||
echo $row['domain_setting_value'];
|
||||
}
|
||||
echo " \n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_enabled']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_setting_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('domain_setting_edit')) {
|
||||
echo " <a href='domain_settings_edit.php?domain_uuid=".$row['domain_uuid']."&id=".$row['domain_setting_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('domain_setting_delete')) {
|
||||
echo " <a href='domain_settings_delete.php?domain_uuid=".$row['domain_uuid']."&id=".$row['domain_setting_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
$previous_category = $row['domain_setting_category'];
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('domain_setting_add')) {
|
||||
echo " <a href='domain_settings_edit.php?domain_uuid=".$_GET['id']."' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " \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";
|
||||
?>
|
||||
61
core/domain_settings/domain_settings_delete.php
Normal file
61
core/domain_settings/domain_settings_delete.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('domain_setting_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
}
|
||||
|
||||
if (strlen($id)>0) {
|
||||
//delete domain_setting
|
||||
$sql = "delete from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and domain_setting_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains_edit.php?id=$domain_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
375
core/domain_settings/domain_settings_edit.php
Normal file
375
core/domain_settings/domain_settings_edit.php
Normal file
@@ -0,0 +1,375 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('domain_setting_add') || permission_exists('domain_setting_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$domain_setting_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
if (strlen($_GET["domain_uuid"]) > 0) {
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$domain_setting_category = check_str($_POST["domain_setting_category"]);
|
||||
$domain_setting_subcategory = check_str($_POST["domain_setting_subcategory"]);
|
||||
$domain_setting_name = check_str($_POST["domain_setting_name"]);
|
||||
$domain_setting_value = check_str($_POST["domain_setting_value"]);
|
||||
$domain_setting_enabled = check_str($_POST["domain_setting_enabled"]);
|
||||
$domain_setting_description = check_str($_POST["domain_setting_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$domain_setting_uuid = check_str($_POST["domain_setting_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid<br>\n"; }
|
||||
//if (strlen($domain_setting_category) == 0) { $msg .= "Please provide: Category<br>\n"; }
|
||||
//if (strlen($domain_setting_subcategory) == 0) { $msg .= "Please provide: Subcategory<br>\n"; }
|
||||
//if (strlen($domain_setting_name) == 0) { $msg .= "Please provide: Type<br>\n"; }
|
||||
//if (strlen($domain_setting_value) == 0) { $msg .= "Please provide: Value<br>\n"; }
|
||||
//if (strlen($domain_setting_enabled) == 0) { $msg .= "Please provide: Enabled<br>\n"; }
|
||||
//if (strlen($domain_setting_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('domain_setting_add')) {
|
||||
$sql = "insert into v_domain_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "domain_setting_uuid, ";
|
||||
$sql .= "domain_setting_category, ";
|
||||
$sql .= "domain_setting_subcategory, ";
|
||||
$sql .= "domain_setting_name, ";
|
||||
$sql .= "domain_setting_value, ";
|
||||
$sql .= "domain_setting_enabled, ";
|
||||
$sql .= "domain_setting_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'$domain_uuid', ";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_setting_category', ";
|
||||
$sql .= "'$domain_setting_subcategory', ";
|
||||
$sql .= "'$domain_setting_name', ";
|
||||
$sql .= "'$domain_setting_value', ";
|
||||
$sql .= "'$domain_setting_enabled', ";
|
||||
$sql .= "'$domain_setting_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains_edit.php?id=$domain_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Add Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "add")
|
||||
|
||||
if ($action == "update" && permission_exists('domain_setting_edit')) {
|
||||
$sql = "update v_domain_settings set ";
|
||||
$sql .= "domain_setting_category = '$domain_setting_category', ";
|
||||
$sql .= "domain_setting_subcategory = '$domain_setting_subcategory', ";
|
||||
$sql .= "domain_setting_name = '$domain_setting_name', ";
|
||||
$sql .= "domain_setting_value = '$domain_setting_value', ";
|
||||
$sql .= "domain_setting_enabled = '$domain_setting_enabled', ";
|
||||
$sql .= "domain_setting_description = '$domain_setting_description' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and domain_setting_uuid = '$domain_setting_uuid'";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains_edit.php?id=$domain_uuid\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Update Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($action == "update")
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$domain_setting_uuid = check_str($_GET["id"]);
|
||||
$sql = "select * from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and domain_setting_uuid = '$domain_setting_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$domain_setting_category = $row["domain_setting_category"];
|
||||
$domain_setting_subcategory = $row["domain_setting_subcategory"];
|
||||
$domain_setting_name = $row["domain_setting_name"];
|
||||
$domain_setting_value = $row["domain_setting_value"];
|
||||
$domain_setting_enabled = $row["domain_setting_enabled"];
|
||||
$domain_setting_description = $row["domain_setting_description"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Setting Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Setting Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='domains_edit.php?id=$domain_uuid'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Settings used for each domain.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Category:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_category' maxlength='255' value=\"$domain_setting_category\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the category.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Subcategory:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_subcategory' maxlength='255' value=\"$domain_setting_subcategory\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the subcategory.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Type:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_name' maxlength='255' value=\"$domain_setting_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the type.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Value:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
$name = $row['domain_setting_name'];
|
||||
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$sql = "";
|
||||
$sql .= "select * from v_menus ";
|
||||
$sql .= "order by menu_language, menu_name asc ";
|
||||
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||
$sub_prep_statement->execute();
|
||||
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($sub_result as $sub_row) {
|
||||
if (strtolower($row['domain_setting_value']) == strtolower($sub_row["menu_uuid"])) {
|
||||
echo " <option value='".strtolower($sub_row["menu_uuid"])."' selected='selected'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".strtolower($sub_row["menu_uuid"])."'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."</option>\n";
|
||||
}
|
||||
}
|
||||
unset ($sub_prep_statement);
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//add all the themes to the list
|
||||
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
|
||||
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
|
||||
while (false !== ($dir_name = readdir($handle))) {
|
||||
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && is_dir($theme_dir.'/'.$dir_name)) {
|
||||
$dir_label = str_replace('_', ' ', $dir_name);
|
||||
$dir_label = str_replace('-', ' ', $dir_label);
|
||||
if ($dir_name == $row['domain_setting_value']) {
|
||||
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='$dir_name'>$dir_label</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
echo " </select>\n";
|
||||
} elseif ($category == "domain" && $subcategory == "time" && $name == "zone" ) {
|
||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//$list = DateTimeZone::listAbbreviations();
|
||||
$time_zone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$previous_category = '';
|
||||
$x = 0;
|
||||
foreach ($time_zone_identifiers as $key => $val) {
|
||||
$time_zone = explode("/", $val);
|
||||
$category = $time_zone[0];
|
||||
if ($category != $previous_category) {
|
||||
if ($x > 0) {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " <optgroup label='".$category."'>\n";
|
||||
}
|
||||
if ($val == $row['domain_setting_value']) {
|
||||
echo " <option value='".$val."' selected='selected'>".$val."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$val."'>".$val."</option>\n";
|
||||
}
|
||||
$previous_category = $category;
|
||||
$x++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
break;
|
||||
}
|
||||
elseif ($category == "email" && $subcategory == "smtp_password" && $name == "var" ) {
|
||||
echo " <input class='formfld' type='password' name='default_setting_value' maxlength='255' value=\"".$row['default_setting_value']."\">\n";
|
||||
}
|
||||
elseif ($category == "provision" && $subcategory == "password" && $name == "var" ) {
|
||||
echo " <input class='formfld' type='password' name='default_setting_value' maxlength='255' value=\"".$row['default_setting_value']."\">\n";
|
||||
} else {
|
||||
echo " <input class='formfld' type='text' name='domain_setting_value' maxlength='255' value=\"$domain_setting_value\">\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
echo "Enter the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||
echo " Enabled:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='domain_setting_enabled'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($domain_setting_enabled == "true") {
|
||||
echo " <option value='true' selected='selected'>true</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='true'>true</option>\n";
|
||||
}
|
||||
if ($domain_setting_enabled == "false") {
|
||||
echo " <option value='false' selected='selected'>false</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='false'>false</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo "Choose to enable or disable the value.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_setting_description' maxlength='255' value=\"$domain_setting_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='domain_setting_uuid' value='$domain_setting_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
215
core/domain_settings/domains.php
Normal file
215
core/domain_settings/domains.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('domain_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//change the domain
|
||||
if (strlen(check_str($_GET["domain_uuid"])) > 0 && check_str($_GET["domain_change"]) == "true") {
|
||||
if (permission_exists('domain_select')) {
|
||||
//get the domain_uuid
|
||||
$sql = "select * from v_domains ";
|
||||
$sql .= "order by domain_name asc ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
if (count($result) == 0) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
else {
|
||||
if ($row['domain_name'] == $domain_array[0] || $row['domain_name'] == 'www.'.$domain_array[0]) {
|
||||
$_SESSION["domain_uuid"] = $row["domain_uuid"];
|
||||
$_SESSION["domain_name"] = $row['domain_name'];
|
||||
}
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
|
||||
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name'];
|
||||
}
|
||||
}
|
||||
unset($result, $prep_statement);
|
||||
|
||||
//update the domain session variables
|
||||
$domain_uuid = check_str($_GET["domain_uuid"]);
|
||||
$_SESSION['domain_uuid'] = $domain_uuid;
|
||||
$_SESSION["domain_name"] = $_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||
$_SESSION['domain']['template']['name'] = $_SESSION['domains'][$domain_uuid]['template_name'];
|
||||
//clear the menu session so that it is regenerated for the selected domain
|
||||
$_SESSION["menu"] = '';
|
||||
//clear the extension array so that it is regenerated for the selected domain
|
||||
unset($_SESSION['extension_array']);
|
||||
//set the setting arrays
|
||||
//domains set()
|
||||
require "includes/classes/domains.php";
|
||||
$domain = new domains();
|
||||
$domain->db = $db;
|
||||
$domain->set();
|
||||
}
|
||||
}
|
||||
|
||||
//includes
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = $_GET["order_by"];
|
||||
$order = $_GET["order"];
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"center\">\n";
|
||||
echo " <br />";
|
||||
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' nowrap='nowrap'><b>Domains</b></td>\n";
|
||||
echo " <td width='50%' align='right'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' colspan='2'>\n";
|
||||
echo " Control the list of domains to manage.<br /><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_domains ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$param = "";
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_domains ";
|
||||
if (strlen($order_by) == 0) {
|
||||
$sql .= "order by domain_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();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('domain_name', 'Domain', $order_by, $order);
|
||||
echo th_order_by('domain_description', 'Description', $order_by, $order);
|
||||
echo "<td align='right' width='42'>\n";
|
||||
if (permission_exists('domain_add')) {
|
||||
echo " <a href='domains_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " \n";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
echo "<tr >\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_description']." </td>\n";
|
||||
echo " <td valign='top' align='right'>\n";
|
||||
if (permission_exists('domain_edit')) {
|
||||
echo " <a href='domains_edit.php?id=".$row['domain_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
|
||||
}
|
||||
if (permission_exists('domain_delete')) {
|
||||
echo " <a href='domains_delete.php?id=".$row['domain_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='3' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' align='right'>\n";
|
||||
if (permission_exists('domain_add')) {
|
||||
echo " <a href='domains_edit.php' alt='add'>$v_link_label_add</a>\n";
|
||||
}
|
||||
else {
|
||||
echo " \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";
|
||||
?>
|
||||
195
core/domain_settings/domains_delete.php
Normal file
195
core/domain_settings/domains_delete.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('domain_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (count($_GET)>0) {
|
||||
$id = check_str($_GET["id"]);
|
||||
}
|
||||
|
||||
if (strlen($id) > 0) {
|
||||
//get the domain using the id
|
||||
$sql = "select * from v_domains ";
|
||||
$sql .= "where domain_uuid = '$id' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$domain_name = $row["domain_name"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
|
||||
//get the domain settings
|
||||
$sql = "select * from v_domain_settings ";
|
||||
$sql .= "where domain_uuid = '".$id."' ";
|
||||
$sql .= "and domain_setting_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$name = $row['domain_setting_name'];
|
||||
$category = $row['domain_setting_category'];
|
||||
$subcategory = $row['domain_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
$_SESSION[$category][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
else {
|
||||
//$$category[$subcategory][$name] = $row['domain_setting_value'];
|
||||
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
|
||||
}
|
||||
}
|
||||
|
||||
//get the $apps array from the installed apps from the core and mod directories
|
||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
|
||||
$x=0;
|
||||
foreach ($config_list as &$config_path) {
|
||||
include($config_path);
|
||||
$x++;
|
||||
}
|
||||
|
||||
//delete the domain data from all tables in the database
|
||||
$db->beginTransaction();
|
||||
foreach ($apps as &$app) {
|
||||
foreach ($app['db'] as $row) {
|
||||
$table_name = $row['table'];
|
||||
foreach ($row['fields'] as $field) {
|
||||
if ($field['name'] == "domain_uuid") {
|
||||
$sql = "delete from $table_name where domain_uuid = '$id' ";
|
||||
$db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->commit();
|
||||
|
||||
if (strlen($domain_name) > 0) {
|
||||
//set the needle
|
||||
if (count($_SESSION["domains"]) > 1) {
|
||||
$v_needle = 'v_'.$domain_name.'_';
|
||||
}
|
||||
else {
|
||||
$v_needle = 'v_';
|
||||
}
|
||||
|
||||
//delete the dialplan
|
||||
unlink($_SESSION['switch']['dialplan']['dir'].'/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['dialplan']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the dialplan public
|
||||
unlink($_SESSION['switch']['dialplan']['dir'].'/public/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['dialplan']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['dialplan']['dir'].'/public/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the extension
|
||||
unlink($_SESSION['switch']['extensions']['dir'].'/'.$domain_name.'.xml');
|
||||
if (strlen($_SESSION['switch']['extensions']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['extensions']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete fax
|
||||
if (strlen($_SESSION['switch']['storage']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['storage']['dir'].'/fax/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete the gateways
|
||||
if($dh = opendir($_SESSION['switch']['gateways']['dir'])) {
|
||||
$files = Array();
|
||||
while($file = readdir($dh)) {
|
||||
if($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if(is_dir($dir . "/" . $file)) {
|
||||
//this is a directory do nothing
|
||||
} else {
|
||||
//check if file extension is xml
|
||||
if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
||||
unlink($_SESSION['switch']['gateways']['dir']."/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
|
||||
//delete the ivr menu
|
||||
if($dh = opendir($_SESSION['switch']['conf']['dir']."/ivr_menus/")) {
|
||||
$files = Array();
|
||||
while($file = readdir($dh)) {
|
||||
if($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if(is_dir($dir . "/" . $file)) {
|
||||
//this is a directory
|
||||
} else {
|
||||
if (strpos($file, $v_needle) !== false && substr($file,-4) == '.xml') {
|
||||
unlink($_SESSION['switch']['conf']['dir']."/ivr_menus/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
|
||||
//delete the recordings
|
||||
if (strlen($_SESSION['switch'][recordings]['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['recordings']['dir'].'/'.$domain_name);
|
||||
}
|
||||
|
||||
//delete voicemail
|
||||
if (strlen($_SESSION['switch']['voicemail']['dir']) > 0) {
|
||||
system('rm -rf '.$_SESSION['switch']['voicemail']['dir'].'/'.$domain_name);
|
||||
}
|
||||
}
|
||||
|
||||
//apply settings reminder
|
||||
$_SESSION["reload_xml"] = true;
|
||||
|
||||
//clear the domains session array to update it
|
||||
unset($_SESSION["domains"]);
|
||||
unset($_SESSION["domain_uuid"]);
|
||||
unset($_SESSION["domain_name"]);
|
||||
unset($_SESSION['domain']);
|
||||
unset($_SESSION['switch']);
|
||||
}
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "Delete Complete\n";
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
|
||||
?>
|
||||
224
core/domain_settings/domains_edit.php
Normal file
224
core/domain_settings/domains_edit.php
Normal file
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
require_once "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
if (permission_exists('domain_add') || permission_exists('domain_edit')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//action add or update
|
||||
if (isset($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$domain_uuid = check_str($_REQUEST["id"]);
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
$domain_name = strtolower(check_str($_POST["domain_name"]));
|
||||
$domain_description = check_str($_POST["domain_description"]);
|
||||
}
|
||||
|
||||
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
|
||||
$msg = '';
|
||||
if ($action == "update") {
|
||||
$domain_uuid = check_str($_POST["domain_uuid"]);
|
||||
}
|
||||
|
||||
//check for all required data
|
||||
//if (strlen($domain_name) == 0) { $msg .= "Please provide: Domain<br>\n"; }
|
||||
//if (strlen($domain_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
|
||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||
require_once "includes/header.php";
|
||||
require_once "includes/persistformvar.php";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table><tr><td>\n";
|
||||
echo $msg."<br />";
|
||||
echo "</td></tr></table>\n";
|
||||
persistformvar($_POST);
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if ($action == "add" && permission_exists('domain_add')) {
|
||||
$sql = "select count(*) as num_rows from v_domains ";
|
||||
$sql .= "where domain_name = '$domain_name' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] == 0) {
|
||||
$sql = "insert into v_domains ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "domain_name, ";
|
||||
$sql .= "domain_description ";
|
||||
$sql .= ")";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'$domain_name', ";
|
||||
$sql .= "'$domain_description' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "update" && permission_exists('domain_edit')) {
|
||||
$sql = "update v_domains set ";
|
||||
$sql .= "domain_name = '$domain_name', ";
|
||||
$sql .= "domain_description = '$domain_description' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
|
||||
//upgrade the domains
|
||||
require_once "core/upgrade/upgrade_domains.php";
|
||||
|
||||
//clear the domains session array to update it
|
||||
unset($_SESSION["domains"]);
|
||||
unset($_SESSION["domain_uuid"]);
|
||||
unset($_SESSION["domain_name"]);
|
||||
unset($_SESSION['domain']);
|
||||
unset($_SESSION['switch']);
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=domains.php\">\n";
|
||||
echo "<div align='center'>\n";
|
||||
if ($action == "update") {
|
||||
echo "Update Complete\n";
|
||||
}
|
||||
if ($action == "add") {
|
||||
echo "Add Complete\n";
|
||||
}
|
||||
echo "</div>\n";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
} //if ($_POST["persistformvar"] != "true")
|
||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$domain_uuid = $_GET["id"];
|
||||
$sql = "select * from v_domains ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as &$row) {
|
||||
$domain_name = strtolower($row["domain_name"]);
|
||||
$domain_description = $row["domain_description"];
|
||||
}
|
||||
unset ($prep_statement);
|
||||
}
|
||||
|
||||
//show the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\">\n";
|
||||
echo " <br>";
|
||||
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Add</b></td>\n";
|
||||
}
|
||||
if ($action == "update") {
|
||||
echo "<td align='left' width='30%' nowrap='nowrap'><b>Domain Edit</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='domains.php'\" value='Back'></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo "Control the list of domains to manage.<br /><br />\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Domain:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_name' maxlength='255' value=\"$domain_name\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the domain name.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " Description:\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='domain_description' maxlength='255' value=\"$domain_description\">\n";
|
||||
echo "<br />\n";
|
||||
echo "Enter the description.\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td colspan='2' align='right'>\n";
|
||||
if ($action == "update") {
|
||||
echo " <input type='hidden' name='domain_uuid' value='$domain_uuid'>\n";
|
||||
}
|
||||
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
if ($action == "update") {
|
||||
require "domain_settings.php";
|
||||
}
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
50
core/domain_settings/root.php
Normal file
50
core/domain_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