| 43 |
if (is_numeric($def)) $result = intval($result); |
if (is_numeric($def)) $result = intval($result); |
| 44 |
} |
} |
| 45 |
} |
} |
| 46 |
|
if (!get_magic_quotes_gpc()) { |
| 47 |
|
$result = addslashes( $result ); |
| 48 |
|
} |
| 49 |
} |
} |
| 50 |
return $result; |
return $result; |
| 51 |
} else { |
} else { |
| 58 |
return $sef->sefRelToAbs($string); |
return $sef->sefRelToAbs($string); |
| 59 |
} |
} |
| 60 |
|
|
| 61 |
|
function adminSide($val='') { |
| 62 |
/* This is the new error handler to store errors in the database |
static $adminside; |
| 63 |
class mosErrorHandler { |
if (is_null($adminside)) { |
| 64 |
var $types = array ( |
$adminside = ($val == '') ? 0 : $val; |
| 65 |
E_STRICT => 'Strict check', |
} else { |
| 66 |
E_USER_WARNING => 'User Warning', |
$adminside = ($val == '') ? $adminside : $val; |
|
E_USER_NOTICE => 'User Notice', |
|
|
E_WARNING => 'Warning', |
|
|
E_NOTICE => 'Notice', |
|
|
E_CORE_WARNING => 'Core Warning', |
|
|
E_COMPILE_WARNING => 'Compile Warning', |
|
|
E_USER_ERROR => 'User Error', |
|
|
E_ERROR => 'Error', |
|
|
E_PARSE => 'Parse error', |
|
|
E_CORE_ERROR => 'Core Error', |
|
|
E_COMPILE_ERROR => 'Compile Error' |
|
|
); |
|
|
|
|
|
function mosErrorHandler () { |
|
|
set_error_handler(array(&$this, 'handler')); |
|
|
} |
|
|
|
|
|
function handler ($errno, $errstr, $errfile, $errline, $errcontext) { |
|
|
if ($errno = E_STRICT) return; |
|
|
$string = $this->types[$errno].': '.$errstr.' in '.$errfile.' at '.$errline; |
|
|
$database =& mamboDatabase::getInstance(); |
|
|
if (eregi('^(sql)$', $errstr)) { |
|
|
$extra = $database->getErrorMsg(); |
|
|
} |
|
|
if (function_exists('debug_backtrace')) { |
|
|
foreach(debug_backtrace() as $back) { |
|
|
if (@$back['file']) { |
|
|
$extra .= "\n".$back['file'].':'.$back['line']; |
|
|
} |
|
|
} |
|
|
} |
|
|
$database->setQuery("DELETE FROM #__errors WHERE file=$errfile AND line=$errline AND number=$errno"); |
|
|
$database->query(); |
|
|
$database->setQuery("INSERT INTO #__errors VALUES (0, $errno, '$errfile', $errline, '$string', '$extra')"); |
|
|
$database->query(); |
|
| 67 |
} |
} |
| 68 |
|
return $adminside; |
| 69 |
} |
} |
|
*/ |
|
| 70 |
|
|
| 71 |
if (!isset($adminside)) { |
function indexType($val='') { |
| 72 |
$adminside = 0; |
static $indextype; |
| 73 |
|
if (is_null($indextype)) { |
| 74 |
|
$indextype = ($val == '') ? 1 : $val; |
| 75 |
|
} else { |
| 76 |
|
$indextype = ($val == '') ? $indextype : $val; |
| 77 |
} |
} |
| 78 |
if (!isset($indextype)) { |
return $indextype; |
|
$indextype = 1; |
|
| 79 |
} |
} |
| 80 |
|
|
| 81 |
|
if (!isset($adminside)) $adminside = 0; |
| 82 |
|
if (!isset($indextype)) $indextype = 1; |
| 83 |
|
|
| 84 |
|
adminSide($adminside); |
| 85 |
|
indexType($indextype); |
| 86 |
|
|
| 87 |
require_once (dirname(__FILE__).'/includes/database.php'); |
require_once (dirname(__FILE__).'/includes/database.php'); |
| 88 |
require_once(dirname(__FILE__).'/includes/core.classes.php'); |
require_once(dirname(__FILE__).'/includes/core.classes.php'); |
| 89 |
$configuration =& mamboCore::getMamboCore(); |
$configuration =& mamboCore::getMamboCore(); |
| 90 |
$configuration->handleGlobals(); |
$configuration->handleGlobals(); |
| 91 |
|
|
| 92 |
//new mosErrorHandler(); |
$adminside = adminSide(); |
| 93 |
|
$indextype = indexType(); |
|
|
|
| 94 |
|
|
| 95 |
require($configuration->rootPath().'/includes/version.php'); |
require($configuration->rootPath().'/includes/version.php'); |
| 96 |
$_VERSION =& new version(); |
$_VERSION =& new version(); |
| 97 |
|
|
| 98 |
|
|
|
|
|
| 99 |
$version = $_VERSION->PRODUCT .' '. $_VERSION->RELEASE .'.'. $_VERSION->DEV_LEVEL .' ' |
$version = $_VERSION->PRODUCT .' '. $_VERSION->RELEASE .'.'. $_VERSION->DEV_LEVEL .' ' |
| 100 |
. $_VERSION->DEV_STATUS |
. $_VERSION->DEV_STATUS |
| 101 |
.' [ '.$_VERSION->CODENAME .' ] '. $_VERSION->RELDATE .' ' |
.' [ '.$_VERSION->CODENAME .' ] '. $_VERSION->RELDATE .' ' |
| 103 |
|
|
| 104 |
if (phpversion() < '4.2.0') require_once( $configuration->rootPath() . '/includes/compat.php41x.php' ); |
if (phpversion() < '4.2.0') require_once( $configuration->rootPath() . '/includes/compat.php41x.php' ); |
| 105 |
if (phpversion() < '4.3.0') require_once( $configuration->rootPath() . '/includes/compat.php42x.php' ); |
if (phpversion() < '4.3.0') require_once( $configuration->rootPath() . '/includes/compat.php42x.php' ); |
| 106 |
|
if (phpversion() < '5.0.0') require_once( $configuration->rootPath() . '/includes/compat.php5xx.php' ); |
| 107 |
|
|
| 108 |
$local_backup_path = $configuration->rootPath().'/administrator/backups'; |
$local_backup_path = $configuration->rootPath().'/administrator/backups'; |
| 109 |
$media_path = $configuration->rootPath().'/media/'; |
$media_path = $configuration->rootPath().'/media/'; |
| 114 |
$database =& mamboDatabase::getInstance(); |
$database =& mamboDatabase::getInstance(); |
| 115 |
$database->debug(mamboCore::get('mosConfig_debug')); |
$database->debug(mamboCore::get('mosConfig_debug')); |
| 116 |
|
|
|
// |
|
|
$gettext =& phpgettext(); |
|
|
$gettext->bindtextdomain('common', $configuration->rootPath().'/language'); |
|
|
$gettext->textdomain('common'); |
|
|
//dump($gettext->textdomain(substr($option, 3))); |
|
|
//$gettext->bindtextdomain('frontend', $lang_path); |
|
|
//$gettext->textdomain('frontend'); |
|
| 117 |
|
|
| 118 |
if (!$adminside) { |
if (!$adminside) { |
| 119 |
$sefcode = $configuration->rootPath().'/components/com_sef/sef.php'; |
$sefcode = $configuration->rootPath().'/components/com_sef/sef.php'; |
| 143 |
ini_set('session.use_only_cookies', 1); |
ini_set('session.use_only_cookies', 1); |
| 144 |
|
|
| 145 |
|
|
| 146 |
|
/* initialize i18n */ |
| 147 |
|
$lang = $configuration->current_language->name; |
| 148 |
|
$charset = $configuration->current_language->charset; |
| 149 |
|
$gettext =& phpgettext(); |
| 150 |
|
$gettext->debug = $configuration->mosConfig_locale_debug; |
| 151 |
|
$gettext->has_gettext = $configuration->mosConfig_locale_use_gettext; |
| 152 |
|
$gettext->setlocale($lang); |
| 153 |
|
$gettext->bindtextdomain($lang, $configuration->rootPath().'/language'); |
| 154 |
|
$gettext->textdomain($lang); |
| 155 |
|
#$gettext =& phpgettext(); dump($gettext); |
| 156 |
|
|
| 157 |
if ($adminside) { |
if ($adminside) { |
| 158 |
// Start ACL |
// Start ACL |
| 159 |
require_once($configuration->rootPath().'/includes/gacl.class.php' ); |
require_once($configuration->rootPath().'/includes/gacl.class.php' ); |
| 163 |
$option = strtolower(mosGetParam($_REQUEST,'option','com_admin')); |
$option = strtolower(mosGetParam($_REQUEST,'option','com_admin')); |
| 164 |
|
|
| 165 |
$domain = substr($option, 4); |
$domain = substr($option, 4); |
|
$gettext->bindtextdomain('administrator', $lang_path); |
|
|
$gettext->bindtextdomain($domain, $lang_path); |
|
|
$admindomain = $gettext->textdomain(); |
|
|
$gettext->textdomain('administrator'); |
|
| 166 |
session_name(md5(mamboCore::get('mosConfig_live_site'))); |
session_name(md5(mamboCore::get('mosConfig_live_site'))); |
| 167 |
session_start(); |
session_start(); |
| 168 |
// restore some session variables |
// restore some session variables |
| 236 |
// Finished admin side; the rest is user side code: |
// Finished admin side; the rest is user side code: |
| 237 |
else { |
else { |
| 238 |
$option = $configuration->determineOptionAndItemid(); |
$option = $configuration->determineOptionAndItemid(); |
|
$configuration->handleGlobals(); |
|
| 239 |
$Itemid = $configuration->get('Itemid'); |
$Itemid = $configuration->get('Itemid'); |
| 240 |
|
|
|
// load frontend language file |
|
|
$gettext->bindtextdomain(substr($option, 4), $configuration->rootPath().'/language'); |
|
|
$gettext->bindtextdomain('frontend', $configuration->rootPath().'/language'); |
|
|
$frontdomain = $gettext->textdomain(); |
|
|
$gettext->textdomain('frontend'); |
|
|
|
|
|
|
|
| 241 |
$mainframe =& new mosMainFrame($database, $option, '.'); |
$mainframe =& new mosMainFrame($database, $option, '.'); |
| 242 |
if ($option == 'login') $configuration->handleLogin(); |
if ($option == 'login') $configuration->handleLogin(); |
| 243 |
elseif ($option == 'logout') $configuration->handleLogout(); |
elseif ($option == 'logout') $configuration->handleLogout(); |
| 282 |
$ret = $menuhandler->menuCheck($Itemid, $option, $task, $gid); |
$ret = $menuhandler->menuCheck($Itemid, $option, $task, $gid); |
| 283 |
$menuhandler->setPathway($Itemid); |
$menuhandler->setPathway($Itemid); |
| 284 |
if ($ret) { |
if ($ret) { |
|
$gettext->textdomain(substr($option, 4)); // get the component lang file |
|
| 285 |
require ($path); |
require ($path); |
|
$gettext->textdomain($frontdomain); |
|
| 286 |
} |
} |
| 287 |
else mosNotAuth(); |
else mosNotAuth(); |
| 288 |
} |
} |