| 218 |
function mamboCore () { |
function mamboCore () { |
| 219 |
global $adminside; |
global $adminside; |
| 220 |
$this->init_errorlevel = error_reporting(0); |
$this->init_errorlevel = error_reporting(0); |
| 221 |
$this->rootPath = str_replace('\\', '/', str_replace('includes', '', realpath(dirname(__FILE__)))); |
//$this->rootPath = str_replace('\\', '/', realpath(str_replace('includes', '', dirname(__FILE__)))); |
| 222 |
|
$this->rootPath = str_replace('\\', '/',str_replace('includes', '', dirname(__FILE__))); |
| 223 |
$this->checkConfig(); |
$this->checkConfig(); |
| 224 |
$this->Itemid = mosGetParam($_REQUEST, 'Itemid', 0); |
$this->Itemid = mosGetParam($_REQUEST, 'Itemid', 0); |
| 225 |
$this->getConfig(); |
$this->getConfig(); |
| 246 |
* @return unknown |
* @return unknown |
| 247 |
*/ |
*/ |
| 248 |
function rootPath () { |
function rootPath () { |
| 249 |
if (realpath($this->rootPath) === false) die ('Invalid program load path'); |
//if (realpath($this->rootPath) === false) die ('Invalid program load path'); |
| 250 |
|
if (file_exists($this->rootPath) === false) die ('Invalid program load path'); |
| 251 |
return $this->rootPath; |
return $this->rootPath; |
| 252 |
} |
} |
| 253 |
|
|
| 260 |
function get ($property) { |
function get ($property) { |
| 261 |
$config =& mamboCore::getMamboCore(); |
$config =& mamboCore::getMamboCore(); |
| 262 |
if ($property == 'mosConfig_absolute_path') { |
if ($property == 'mosConfig_absolute_path') { |
| 263 |
if (realpath($config->mosConfig_absolute_path) === false) die ('Invalid program load path'); |
//if (realpath($config->mosConfig_absolute_path) === false) die ('Invalid program load path'); |
| 264 |
|
if (file_exists($config->mosConfig_absolute_path) === false) die ('Invalid program load path'); |
| 265 |
else return $config->rootPath; |
else return $config->rootPath; |
| 266 |
} |
} |
| 267 |
if (isset($config->$property)) return $config->$property; |
if (isset($config->$property)) return $config->$property; |
| 343 |
$mamboroot = str_replace('\\', '/', rtrim($this->rootPath, '\/')); |
$mamboroot = str_replace('\\', '/', rtrim($this->rootPath, '\/')); |
| 344 |
$this->subdirectory = substr($mamboroot, strlen($docroot)); |
$this->subdirectory = substr($mamboroot, strlen($docroot)); |
| 345 |
|
|
|
|
|
| 346 |
$scheme = isset($_SERVER['HTTP_SCHEME']) ? $_SERVER['HTTP_SCHEME'] : ((isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS'] != 'off')) ? 'https' : 'http'); |
$scheme = isset($_SERVER['HTTP_SCHEME']) ? $_SERVER['HTTP_SCHEME'] : ((isset($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS'] != 'off')) ? 'https' : 'http'); |
| 347 |
if (isset($_SERVER['HTTP_HOST'])) { |
if (isset($_SERVER['HTTP_HOST'])) { |
| 348 |
$withport = explode(':', $_SERVER['HTTP_HOST']); |
$withport = explode(':', $_SERVER['HTTP_HOST']); |
| 419 |
################################### |
################################### |
| 420 |
|
|
| 421 |
|
|
| 422 |
$this->mosConfig_lang = mosGetParam($_POST, 'setLanguage', $this->mosConfig_lang); |
$this->mosConfig_lang = mosGetParam($_POST, 'user_lang', $this->mosConfig_lang); |
| 423 |
|
|
| 424 |
|
|
| 425 |
$language =& mamboLanguage::getInstance($this->mosConfig_lang, $this->rootPath.'/language/'); |
$language =& new mamboLanguage($this->mosConfig_lang, $this->rootPath.'/language/'); |
| 426 |
$languages = $language->getLanguages(); |
$languages = $language->getLanguages(); |
| 427 |
$charset = $language->get('charset'); |
$charset = $language->get('charset'); |
| 428 |
$dateformat = $language->get('dateformat'); |
$dateformat = $language->get('dateformat'); |
| 431 |
if (!defined('_DATE_FORMAT_LC')) DEFINE('_DATE_FORMAT_LC', $dateformat); //Uses PHP's strftime Command Format |
if (!defined('_DATE_FORMAT_LC')) DEFINE('_DATE_FORMAT_LC', $dateformat); //Uses PHP's strftime Command Format |
| 432 |
if (!defined('_DATE_FORMAT_LC2')) DEFINE('_DATE_FORMAT_LC2', $dateformat); |
if (!defined('_DATE_FORMAT_LC2')) DEFINE('_DATE_FORMAT_LC2', $dateformat); |
| 433 |
|
|
| 434 |
$gettext =& phpgettext(); |
|
|
$gettext->debug = $this->mosConfig_locale_debug; |
|
|
$gettext->has_gettext = $this->mosConfig_locale_use_gettext; |
|
|
$gettext->setlocale($this->mosConfig_lang); |
|
| 435 |
} |
} |
| 436 |
|
|
| 437 |
/** |
/** |
| 2030 |
* @return boolean True is satisfactory |
* @return boolean True is satisfactory |
| 2031 |
*/ |
*/ |
| 2032 |
function check() { |
function check() { |
| 2033 |
|
Global $mosConfig_absolute_path; |
| 2034 |
|
include $mosConfig_absolute_path . ('language/english.php'); |
| 2035 |
$this->_error = ''; |
$this->_error = ''; |
| 2036 |
if ($this->name == '') $this->_error = _REGWARN_NAME; |
if ($this->name == '') $this->_error = _REGWARN_NAME; |
| 2037 |
elseif ($this->username == '') $this->_error = _REGWARN_UNAME; |
elseif ($this->username == '') $this->_error = _REGWARN_UNAME; |
| 2202 |
} |
} |
| 2203 |
|
|
| 2204 |
/** |
/** |
| 2205 |
* Singleton get instance |
* @param object |
|
* @param object the mainframe instance (if called internally) |
|
|
* Note that because of the need for creation parameters, this cannot |
|
|
* be called successfully unless the mainframe object is already created |
|
| 2206 |
*/ |
*/ |
| 2207 |
function &getInstance () { |
function &getInstance () { |
| 2208 |
static $mainframe; |
global $mainframe; |
| 2209 |
if (func_num_args()) { |
if (isset($mainframe)) { |
| 2210 |
$args = func_get_args(); |
return $mainframe; |
| 2211 |
$mainframe = $args[0]; |
} else { |
| 2212 |
} |
$result = null; |
|
if (isset($mainframe)) $result =& $mainframe; |
|
|
else $result = null; |
|
| 2213 |
return $result; |
return $result; |
| 2214 |
} |
} |
| 2215 |
|
} |
| 2216 |
|
|
| 2217 |
/** |
/** |
| 2218 |
* @param string |
* @param string |
| 2219 |
*/ |
*/ |
| 2335 |
* @param string The default value for the variable if not found |
* @param string The default value for the variable if not found |
| 2336 |
*/ |
*/ |
| 2337 |
function getUserStateFromRequest( $var_name, $req_name, $var_default=null ) { |
function getUserStateFromRequest( $var_name, $req_name, $var_default=null ) { |
| 2338 |
|
if (is_array($this->_userstate)) { |
| 2339 |
if (isset($_REQUEST[$req_name])) $this->setUserState($var_name, $_REQUEST[$req_name]); |
if (isset($_REQUEST[$req_name])) $this->setUserState($var_name, $_REQUEST[$req_name]); |
| 2340 |
elseif (isset($var_default) AND !isset($this->userstate[$var_name])) $this->setUserState($var_name, $var_default); |
else if (isset($var_default) AND !isset($this->_userstate[$var_name])) $this->setUserState($var_name, $var_default); |
| 2341 |
return $this->getUserState($var_name); |
return $this->_userstate[$var_name]; |
| 2342 |
|
} else { |
| 2343 |
|
return null; |
| 2344 |
|
} |
| 2345 |
} |
} |
| 2346 |
/** |
/** |
| 2347 |
* Initialises the user session |
* Initialises the user session |