switch basedir path source
Use $amp_conf['AMPWEBROOT'] instead of $_SERVER['DOCUMENT_ROOT'] as at least in one case the latter appears to be empty
This commit is contained in:
parent
d8d2f946ce
commit
ab7b295b87
25
install.php
25
install.php
|
@ -341,9 +341,10 @@ function CheckSCCPManagerDBVersion()
|
||||||
|
|
||||||
function CheckPermissions()
|
function CheckPermissions()
|
||||||
{
|
{
|
||||||
|
global $amp_conf;
|
||||||
outn("<li>" . _("Checking Filesystem Permissions") . "</li>");
|
outn("<li>" . _("Checking Filesystem Permissions") . "</li>");
|
||||||
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views';
|
$dst = $amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views';
|
||||||
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)) {
|
if (fileowner($amp_conf['AMPWEBROOT']) != fileowner($dst)) {
|
||||||
die_freepbx('Please (re-)check permissions by running "amportal chown. Installation Failed"');
|
die_freepbx('Please (re-)check permissions by running "amportal chown. Installation Failed"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -922,16 +923,17 @@ function Setup_RealTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDriver($sccp_compatible) {
|
function addDriver($sccp_compatible) {
|
||||||
|
global $amp_conf;
|
||||||
|
global $cnf_int;
|
||||||
outn("<li>" . _("Adding driver ...") . "</li>");
|
outn("<li>" . _("Adding driver ...") . "</li>");
|
||||||
$file = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
|
$file = $amp_conf['AMPWEBROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
|
||||||
$contents = "<?php include '/var/www/html/admin/modules/sccp_manager/sccpManClasses/Sccp.class.php.v{$sccp_compatible}'; ?>";
|
$contents = "<?php include '/var/www/html/admin/modules/sccp_manager/sccpManClasses/Sccp.class.php.v{$sccp_compatible}'; ?>";
|
||||||
file_put_contents($file, $contents);
|
file_put_contents($file, $contents);
|
||||||
|
|
||||||
global $cnf_int;
|
|
||||||
$dir = $cnf_int->get('ASTETCDIR');
|
$dir = $cnf_int->get('ASTETCDIR');
|
||||||
if (!file_exists("{$dir}/sccp.conf")) { // System re Config
|
if (!file_exists("{$dir}/sccp.conf")) { // System re Config
|
||||||
outn("<li>" . _("Adding default configuration file ...") . "</li>");
|
outn("<li>" . _("Adding default configuration file ...") . "</li>");
|
||||||
$sccpfile = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/sccp.conf');
|
$sccpfile = file_get_contents($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/conf/sccp.conf');
|
||||||
file_put_contents("{$dir}/sccp.conf", $sccpfile);
|
file_put_contents("{$dir}/sccp.conf", $sccpfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -942,14 +944,15 @@ function checkTftpServer() {
|
||||||
global $settingsFromDb;
|
global $settingsFromDb;
|
||||||
global $extconfigs;
|
global $extconfigs;
|
||||||
global $thisInstaller;
|
global $thisInstaller;
|
||||||
|
global $amp_conf;
|
||||||
$confDir = $cnf_int->get('ASTETCDIR');
|
$confDir = $cnf_int->get('ASTETCDIR');
|
||||||
$tftpRootPath = "";
|
$tftpRootPath = "";
|
||||||
// put the rewrite rules into the required location
|
// put the rewrite rules into the required location
|
||||||
if (file_exists("{$confDir}/sccpManagerRewrite.rules")) {
|
if (file_exists("{$confDir}/sccpManagerRewrite.rules")) {
|
||||||
rename("{$confDir}/sccpManagerRewrite.rules", "{$confDir}/sccpManagerRewrite.rules.bu");
|
rename("{$confDir}/sccpManagerRewrite.rules", "{$confDir}/sccpManagerRewrite.rules.bu");
|
||||||
}
|
}
|
||||||
copy($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/mappingRulesHeader',"{$confDir}/sccpManagerRewrite.rules");
|
copy($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/conf/mappingRulesHeader',"{$confDir}/sccpManagerRewrite.rules");
|
||||||
file_put_contents("{$confDir}/sccpManagerRewrite.rules", file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/contrib/rewrite.rules'), FILE_APPEND);
|
file_put_contents("{$confDir}/sccpManagerRewrite.rules", file_get_contents($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/contrib/rewrite.rules'), FILE_APPEND);
|
||||||
file_put_contents("{$confDir}/sccpManagerRewrite.rules", "\n# Do not disable this rule - this is required by sccp_manager\nri ^(.+\.tlzz)?$ settings/\\1", FILE_APPEND);
|
file_put_contents("{$confDir}/sccpManagerRewrite.rules", "\n# Do not disable this rule - this is required by sccp_manager\nri ^(.+\.tlzz)?$ settings/\\1", FILE_APPEND);
|
||||||
// TODO: add option to use external server
|
// TODO: add option to use external server
|
||||||
$remoteFileName = ".sccp_manager_installer_probe_sentinel_temp".mt_rand(0, 9999999);
|
$remoteFileName = ".sccp_manager_installer_probe_sentinel_temp".mt_rand(0, 9999999);
|
||||||
|
@ -1015,6 +1018,7 @@ function cleanUpSccpSettings() {
|
||||||
global $db;
|
global $db;
|
||||||
global $aminterface;
|
global $aminterface;
|
||||||
global $sccp_compatible;
|
global $sccp_compatible;
|
||||||
|
global $amp_conf;
|
||||||
|
|
||||||
// Get current default settings from db
|
// Get current default settings from db
|
||||||
$stmt = $db->prepare("SELECT keyword, sccpsettings.* FROM sccpsettings");
|
$stmt = $db->prepare("SELECT keyword, sccpsettings.* FROM sccpsettings");
|
||||||
|
@ -1042,9 +1046,12 @@ function cleanUpSccpSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
// TODO: It seems that DOCUMENT ROOT is not always set so maybe should switch to AMPWEBROOT.
|
||||||
|
// need to declare amp_conf global each time.
|
||||||
|
//global $amp_conf;
|
||||||
|
//dbug($amp_conf['AMPWEBROOT']);
|
||||||
// Clean up sccpsettings to remove legacy values.
|
// Clean up sccpsettings to remove legacy values.
|
||||||
$xml_vars = $_SERVER['DOCUMENT_ROOT'] . "/admin/modules/sccp_manager/conf/sccpgeneral.xml.v{$sccp_compatible}";
|
$xml_vars = $amp_conf['AMPWEBROOT'] . "/admin/modules/sccp_manager/conf/sccpgeneral.xml.v{$sccp_compatible}";
|
||||||
$thisInstaller->xml_data = simplexml_load_file($xml_vars);
|
$thisInstaller->xml_data = simplexml_load_file($xml_vars);
|
||||||
$thisInstaller->initVarfromXml();
|
$thisInstaller->initVarfromXml();
|
||||||
foreach ( array_diff_key($settingsFromDb,$thisInstaller->sccpvalues) as $key => $valueArray) {
|
foreach ( array_diff_key($settingsFromDb,$thisInstaller->sccpvalues) as $key => $valueArray) {
|
||||||
|
|
|
@ -228,9 +228,10 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDeviceDisplay($display, $deviceInfo, $currentComponent, $primarySection) {
|
public function getDeviceDisplay($display, $deviceInfo, $currentComponent, $primarySection) {
|
||||||
|
global $amp_conf;
|
||||||
$activeCodecs = array();
|
$activeCodecs = array();
|
||||||
// load xml data to get help from same source as rest of module
|
// load xml data to get help from same source as rest of module
|
||||||
$xml_vars = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/sccpgeneral.xml.v433';
|
$xml_vars = $amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/conf/sccpgeneral.xml.v433';
|
||||||
$this->xml_data = simplexml_load_file($xml_vars);
|
$this->xml_data = simplexml_load_file($xml_vars);
|
||||||
// load metainfo from chan-sccp - help information if not in xml. Only load first time as static data.
|
// load metainfo from chan-sccp - help information if not in xml. Only load first time as static data.
|
||||||
if (empty($this->sccpHelpInfo)) {
|
if (empty($this->sccpHelpInfo)) {
|
||||||
|
|
|
@ -237,6 +237,7 @@ class extconfigs
|
||||||
);
|
);
|
||||||
|
|
||||||
public function updateTftpStructure($settingsFromDb) {
|
public function updateTftpStructure($settingsFromDb) {
|
||||||
|
global $amp_conf;
|
||||||
$adv_config = array('tftproot' => $settingsFromDb['tftp_path']['data'],
|
$adv_config = array('tftproot' => $settingsFromDb['tftp_path']['data'],
|
||||||
'firmware' => 'firmware',
|
'firmware' => 'firmware',
|
||||||
'settings' => 'settings',
|
'settings' => 'settings',
|
||||||
|
@ -352,7 +353,7 @@ class extconfigs
|
||||||
}
|
}
|
||||||
// TODO: Need to add index.cnf, after setting defaults correctly
|
// TODO: Need to add index.cnf, after setting defaults correctly
|
||||||
if (!file_exists("{$baseConfig['tftp_templates_path']}/XMLDefault.cnf.xml_template")) {
|
if (!file_exists("{$baseConfig['tftp_templates_path']}/XMLDefault.cnf.xml_template")) {
|
||||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/';
|
$src_path = $amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/conf/';
|
||||||
$dst_path = "{$baseConfig["tftp_templates_path"]}/";
|
$dst_path = "{$baseConfig["tftp_templates_path"]}/";
|
||||||
foreach (glob("{$src_path}*.*_template") as $filename) {
|
foreach (glob("{$src_path}*.*_template") as $filename) {
|
||||||
copy($filename, $dst_path . basename($filename));
|
copy($filename, $dst_path . basename($filename));
|
||||||
|
|
|
@ -630,6 +630,7 @@ class formcreate
|
||||||
|
|
||||||
function addElementSLNA($child, $fvalues, $sccp_defaults,$npref, $installedLangs) {
|
function addElementSLNA($child, $fvalues, $sccp_defaults,$npref, $installedLangs) {
|
||||||
// Input element Select SLS - System Language with add from external
|
// Input element Select SLS - System Language with add from external
|
||||||
|
global $amp_conf;
|
||||||
$res_n = (string)$child ->name;
|
$res_n = (string)$child ->name;
|
||||||
$res_id = $npref.$res_n;
|
$res_id = $npref.$res_n;
|
||||||
$child->value ='';
|
$child->value ='';
|
||||||
|
@ -681,7 +682,7 @@ class formcreate
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?php
|
<?php
|
||||||
include($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views/getFileModal.html');
|
include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModal.html');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
|
|
|
@ -138,8 +138,9 @@ trait bmoFunctions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRightNav($request) {
|
public function getRightNav($request) {
|
||||||
|
global $amp_conf;
|
||||||
if (isset($request['tech_hardware']) && ($request['tech_hardware'] == 'cisco')) {
|
if (isset($request['tech_hardware']) && ($request['tech_hardware'] == 'cisco')) {
|
||||||
return load_view($_SERVER['DOCUMENT_ROOT'] .'/admin/modules/sccp_manager/views/hardware.rnav.php', array('request' => $request));
|
return load_view($amp_conf['AMPWEBROOT'] .'/admin/modules/sccp_manager/views/hardware.rnav.php', array('request' => $request));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
$requestType = 'firmware';
|
$requestType = 'firmware';
|
||||||
|
global $amp_conf;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="fpbx-container container-fluid">
|
<div class="fpbx-container container-fluid">
|
||||||
|
@ -160,7 +161,7 @@ foreach ($firmwareDir[0] as $child) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views/getFileModal.html');
|
include($amp_conf['AMPWEBROOT'] . '/admin/modules/sccp_manager/views/getFileModal.html');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="modal fade" id="edit_model" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
|
<div class="modal fade" id="edit_model" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
|
||||||
|
|
Loading…
Reference in a new issue