/var
/www
/html
/admin
/libraries
/BMO
/View.class.php
-
- /**
- * Set System Timezone
- */
- public function setTimezone($timezone=null) {
- if(empty($timezone) && !empty($this->tz)) {
- return $this->tz;
- }
- date_default_timezone_set('UTC');
- $freepbxtimezone = $this->freepbx->Config->get('PHPTIMEZONE');
- $phptimezone = !empty($timezone) ? $timezone : $freepbxtimezone;
- $phptimezone = trim($phptimezone);
- $invalidtimezone = false;
- if(!empty($phptimezone)) {
- $tzi = \DateTimeZone::listIdentifiers();
- if(!in_array($phptimezone,$tzi)) {
- $invalidtimezone = $phptimezone;
- $timezone = 'UTC';
- }
- date_default_timezone_set($phptimezone);
- }
- if(!empty($invalidtimezone)) {
- //$this->nt->add_warning("framework", "TIMEZONE", _("Unable to set timezone"), sprintf(_("Unable to set timezone to %s because PHP does not support that timezone, the timezone has been temporarily changed to UTC. Please set the timezone in Advanced Settings."),$invalidtimezone), "config.php?display=advancedsettings", true, true);
- } else {
- //$this->nt->delete("framework", "TIMEZONE");
- }
- $this->tz = date_default_timezone_get();
- return $this->tz;
- }
-
- /**
- * Get User or System Timezone
- * @param int $userid The User Manager ID, if not supplied try to infere it
- * @return string The Timezone
- */
- public function getTimezone() {
- if(empty($this->tz)) {
- $this->setTimezone();
- }
- $tz = $this->tz;
/var
/www
/html
/admin
/libraries
/BMO
/View.class.php
/**
* Set System Timezone
*/
public function setTimezone($timezone=null) {
if(empty($timezone) && !empty($this->tz)) {
return $this->tz;
}
date_default_timezone_set('UTC');
$freepbxtimezone = $this->freepbx->Config->get('PHPTIMEZONE');
$phptimezone = !empty($timezone) ? $timezone : $freepbxtimezone;
$phptimezone = trim($phptimezone);
$invalidtimezone = false;
if(!empty($phptimezone)) {
$tzi = \DateTimeZone::listIdentifiers();
if(!in_array($phptimezone,$tzi)) {
$invalidtimezone = $phptimezone;
$timezone = 'UTC';
}
date_default_timezone_set($phptimezone);
}
if(!empty($invalidtimezone)) {
//$this->nt->add_warning("framework", "TIMEZONE", _("Unable to set timezone"), sprintf(_("Unable to set timezone to %s because PHP does not support that timezone, the timezone has been temporarily changed to UTC. Please set the timezone in Advanced Settings."),$invalidtimezone), "config.php?display=advancedsettings", true, true);
} else {
//$this->nt->delete("framework", "TIMEZONE");
}
$this->tz = date_default_timezone_get();
return $this->tz;
}
/**
* Get User or System Timezone
* @param int $userid The User Manager ID, if not supplied try to infere it
* @return string The Timezone
*/
public function getTimezone() {
if(empty($this->tz)) {
$this->setTimezone();
}
$tz = $this->tz;
/var
/www
/html
/admin
/bootstrap.php
/** TODO Remove this when all modules are finally NOT referencing it like this **/
class Database extends FreePBX\Database {};
//Not available until PHP 5.4
if(!defined("ENT_HTML401")) {
define("ENT_HTML401", 0);
}
// bootstrap.php should always be called from freepbx.conf so
// database conifguration already included, connect to database:
//
require_once(dirname(__FILE__)."/libraries/DB.class.php");
global $db;
$db = new DB();
// get settings
$freepbx_conf = $bmo->Freepbx_conf();
//set this before we run date functions
$timezone = $bmo->View->setTimezone();
// passing by reference, this means that the $amp_conf available to everyone is the same one as present
// within the class, which is probably a direction we want to go to use the class.
//
$bootstrap_settings['amportal_conf_initialized'] = false;
$amp_conf = $freepbx_conf->parse_amportal_conf("/etc/amportal.conf",$amp_conf);
if($amp_conf['PHP_CONSOLE']) {
$connector = PhpConsole\Connector::getInstance();
if(!empty($amp_conf['PHP_CONSOLE_PASSWORD'])) {
$connector->setPassword($amp_conf['PHP_CONSOLE_PASSWORD']);
}
$handler = PhpConsole\Handler::getInstance();
$handler->start();
}
$amp_conf['PHP_ERROR_LEVEL'] = !empty($amp_conf['PHP_ERROR_LEVEL']) ? $amp_conf['PHP_ERROR_LEVEL'] : "ALL_NOSTRICTNOTICE";
switch($amp_conf['PHP_ERROR_LEVEL']) {
case "ALL":
error_reporting(E_ALL);
<?php
$amp_conf['AMPDBUSER'] = 'freepbxuser';
$amp_conf['AMPDBPASS'] = '0acafd6cedf9a128ec7777d459137e93';
$amp_conf['AMPDBHOST'] = 'localhost';
$amp_conf['AMPDBNAME'] = 'asterisk';
$amp_conf['AMPDBENGINE'] = 'mysql';
$amp_conf['datasource'] = ''; //for sqlite3
require_once('/var/www/html/admin/bootstrap.php');
?>
/var
/www
/html
/admin
/config.php
//session_cache_limiter('public, no-store');
if (isset($_REQUEST['handler'])) {
if ($restrict_mods === false) {
$restrict_mods = true;
}
switch ($_REQUEST['handler']) {
case 'api':
break;
default:
// If we didn't provide skip_astman in the $_REQUEST[] array it will be boolean false and for handlers, this should default
// to true, if we did provide it, it will NOT be a boolean (it could be 0) so we will honor the setting
//
$bootstrap_settings['skip_astman'] = $bootstrap_settings['skip_astman'] === false ? true : $bootstrap_settings['skip_astman'];
break;
}
}
// call bootstrap.php through freepbx.conf
include_once '/etc/freepbx.conf';
//check to make sure zend files aren't breaking the SPL autoloader.
//if they are then tell the user to run said command below
//which disables any zend module that breaks the autoloader
if(function_exists('SPLAutoloadBroken') && SPLAutoloadBroken()) {
//note this has to be done outside of freepbx_die
die(_("The autoloader is damaged. Please run: ".$amp_conf['AMPBIN']."/fwconsole --fix_zend"));
}
$d = FreePBX::View()->setAdminLocales();
$timezone = $d['timezone'];
$language = $d['language'];
// At this point, we have a session, and BMO was created in bootstrap, so we can check to
// see if someone's trying to programatically log in.
if ($unlock) {
if ($bmo->Unlock($unlock)) {
unset($no_auth);
$display = 'index';
}