Show
Ignore:
Timestamp:
12/16/11 22:30:34 (2 years ago)
Author:
p_lindheimer
Message:

always use freepbx.conf to bootstrap and make more file name paths relative to amp_conf vars and not FILE

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.10/amp_conf/htdocs/admin/bootstrap.php

    r13076 r13083  
    5151$benchmark_starttime = microtime_float(); 
    5252 
     53global $amp_conf; 
     54if (empty($amp_conf['AMPWEBROOT'])) { 
     55  $amp_conf['AMPWEBROOT'] = dirname(dirname(__FILE__)); 
     56} 
     57$dirname = $amp_conf['AMPWEBROOT'] . '/admin'; 
     58 
     59 
    5360if (isset($bootstrap_settings['bootstrapped'])) { 
    5461  freepbx_log(FPBX_LOG_ERROR,"Bootstrap has already been called once, bad code somewhere"); 
     
    6976$bootstrap_settings['cdrdb'] = isset($bootstrap_settings['cdrdb']) ? $bootstrap_settings['cdrdb'] : false; 
    7077 
    71  
    7278$restrict_mods = isset($restrict_mods) ? $restrict_mods : false; 
    73  
    7479 
    7580      
    7681// include base functions 
    77 require_once(dirname(__FILE__) . '/libraries/utility.functions.php');  
     82require_once($dirname . '/libraries/utility.functions.php');  
    7883$bootstrap_settings['framework_functions_included'] = false;  
    79 require_once(dirname(__FILE__) . '/functions.inc.php');  
     84require_once($dirname . '/functions.inc.php');  
    8085$bootstrap_settings['framework_functions_included'] = true;  
    8186      
     
    8893} 
    8994 
    90 //include database conifguration  
    91 if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {  
    92       include_once('/etc/asterisk/freepbx.conf');  
    93 }  
    94  
    95 // connect to database 
    96 require_once(dirname(__FILE__) . '/libraries/db_connect.php'); //PEAR must be installed 
    97  
    98  
    99  
    100 //keep old values as well so that we have the db settings handy 
     95// bootstrap.php should always be called from freepbx.conf so  
     96// database conifguration already included, connect to database: 
     97// 
     98require_once($dirname . '/libraries/db_connect.php'); //PEAR must be installed 
     99 
    101100// get settings 
    102101$freepbx_conf =& freepbx_conf::create(); 
     
    126125$bootstrap_settings['astman_connected'] = false; 
    127126if (!$bootstrap_settings['skip_astman']) { 
    128   require_once(dirname(__FILE__) . '/libraries/php-asmanager.php'); 
     127  require_once($dirname . '/libraries/php-asmanager.php'); 
    129128  $astman = new AGI_AsteriskManager($bootstrap_settings['astman_config'], $bootstrap_settings['astman_options']); 
    130129  // attempt to connect to asterisk manager proxy 
     
    153152  } 
    154153} else { 
    155   require(dirname(__FILE__) . '/libraries/gui_auth.php'); 
     154  require($dirname . '/libraries/gui_auth.php'); 
    156155  frameworkPasswordCheck(); 
    157156} 
  • freepbx/branches/2.10/amp_conf/htdocs/admin/config.php

    r12995 r13083  
    6060header('Content-Type: text/html; charset=utf-8'); 
    6161 
     62// This needs to be included BEFORE the session_start or we fail so 
     63// we can't do it in bootstrap and thus we have to depend on the 
     64// __FILE__ path here. 
    6265require_once(dirname(__FILE__) . '/libraries/ampuser.class.php'); 
    6366 
     
    9093} 
    9194 
    92 require('bootstrap.php'); 
     95// call bootstrap.php through freepbx.conf 
     96if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {  
     97      include_once('/etc/asterisk/freepbx.conf');  
     98}  
    9399 
    94100/* If there is an action request then some sort of update is usually being done. 
  • freepbx/branches/2.10/amp_conf/htdocs/admin/functions.inc.php

    r13050 r13083  
    1212//GNU General Public License for more details. 
    1313 
    14 $dirname = dirname(__FILE__)
     14$dirname = $amp_conf['AMPWEBROOT'] . '/admin'
    1515define('MODULE_STATUS_NOTINSTALLED', 0); 
    1616define('MODULE_STATUS_DISABLED', 1); 
     
    9191//freepbx autoloader 
    9292function fpbx_framework_autoloader($class) { 
    93   $dirname = dirname(__FILE__); 
     93  global $amp_conf; 
     94  $dirname = $amp_conf['AMPWEBROOT'] . '/admin'; 
    9495  if (substr($class, 0, 3) == 'gui') { 
    9596    $class = 'component';