| 68 |
$this->Itemid = mosGetParam($_REQUEST, 'Itemid', 0); |
$this->Itemid = mosGetParam($_REQUEST, 'Itemid', 0); |
| 69 |
$this->getConfig(); |
$this->getConfig(); |
| 70 |
$this->fixLanguage(); |
$this->fixLanguage(); |
|
$this->secure(); |
|
| 71 |
@set_magic_quotes_runtime( 0 ); |
@set_magic_quotes_runtime( 0 ); |
| 72 |
if (@$this->mosConfig_error_reporting === 0) error_reporting(0); |
if (@$this->mosConfig_error_reporting === 0) error_reporting(0); |
| 73 |
elseif (@$this->mosConfig_error_reporting > 0) error_reporting($this->mosConfig_error_reporting); |
elseif (@$this->mosConfig_error_reporting > 0) error_reporting($this->mosConfig_error_reporting); |
| 147 |
if (($scheme == 'http' AND $port == ':80') OR ($scheme == 'https' AND $port == ':443')) $port = ''; |
if (($scheme == 'http' AND $port == ':80') OR ($scheme == 'https' AND $port == ':443')) $port = ''; |
| 148 |
} |
} |
| 149 |
else $port = ''; |
else $port = ''; |
| 150 |
$this->mosConfig_live_site = $scheme.'://'.$servername.$port.$this->subdirectory; |
$afterscheme = '://'.$servername.$port.$this->subdirectory; |
| 151 |
|
$this->mosConfig_live_site = $this->mosConfig_secure_site = $scheme.$afterscheme; |
| 152 |
|
$this->mosConfig_unsecure_site = 'http'.$afterscheme; |
| 153 |
// $this->mosConfig_live_site = 'http://'.$_SERVER['SERVER_NAME'].$this->subdirectory; |
// $this->mosConfig_live_site = 'http://'.$_SERVER['SERVER_NAME'].$this->subdirectory; |
| 154 |
$this->mosConfig_absolute_path = $this->rootPath; |
$this->mosConfig_absolute_path = $this->rootPath; |
| 155 |
preg_match_all('/\$this\-\>([A-Za-z_][A-Za-z0-9_]*)/', $code, $matches); |
preg_match_all('/\$this\-\>([A-Za-z_][A-Za-z0-9_]*)/', $code, $matches); |
| 192 |
if (file_exists($language_file)) require_once ($language_file); |
if (file_exists($language_file)) require_once ($language_file); |
| 193 |
################################### |
################################### |
| 194 |
|
|
| 195 |
//set_error_handler('error_handler'); |
#set_error_handler('error_handler'); |
| 196 |
$lang = $this->mosConfig_lang; |
$lang = $this->mosConfig_lang; |
| 197 |
|
|
| 198 |
|
|
| 199 |
$langfile = $this->rootPath.DIRECTORY_SEPARATOR.'language'.DIRECTORY_SEPARATOR.$lang.'.xml'; |
$langfile = $this->rootPath.DIRECTORY_SEPARATOR.'language'.DIRECTORY_SEPARATOR.$lang.'.xml'; |
| 200 |
|
/*$this->language[$this->mosConfig_language] = array( |
| 201 |
|
'locale' => 'pt, pt.utf-8', |
| 202 |
|
'encoding' => 'utf-8', |
| 203 |
|
'direction' => 'rtl', |
| 204 |
|
'dateformat' => '%A, %d %B %Y', |
| 205 |
|
'offset' => '+00:00' |
| 206 |
|
); |
| 207 |
|
*/ |
| 208 |
$p = xml_parser_create(); |
$p = xml_parser_create(); |
| 209 |
xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); |
xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0); |
| 210 |
xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1); |
xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1); |
| 218 |
} |
} |
| 219 |
} |
} |
| 220 |
|
|
| 221 |
|
|
| 222 |
if (!defined('_ISO')) DEFINE('_ISO','charset='.$this->language['encoding']); |
if (!defined('_ISO')) DEFINE('_ISO','charset='.$this->language['encoding']); |
| 223 |
if (!defined('_DATE_FORMAT_LC')) DEFINE('_DATE_FORMAT_LC', $this->language['dateformat']); //Uses PHP's strftime Command Format |
if (!defined('_DATE_FORMAT_LC')) DEFINE('_DATE_FORMAT_LC', $this->language['dateformat']); //Uses PHP's strftime Command Format |
| 224 |
if (!defined('_DATE_FORMAT_LC2')) DEFINE('_DATE_FORMAT_LC2', $this->language['dateformat']." %H:%M"); |
if (!defined('_DATE_FORMAT_LC2')) DEFINE('_DATE_FORMAT_LC2', $this->language['dateformat']." %H:%M"); |
| 225 |
|
|
| 226 |
//header('Content-Type: text/html; charset=utf-8'); |
//header('Content-Type: text/html; charset=utf-8'); |
|
$domain = $this->mosConfig_lang; |
|
|
$textdomain = $this->rootPath.'/language'; |
|
| 227 |
$gettext =& phpgettext(); |
$gettext =& phpgettext(); |
| 228 |
$gettext->debug = 0; |
$gettext->debug = 0; |
| 229 |
$gettext->has_gettext = 0; |
$gettext->has_gettext = 0; |
| 230 |
$gettext->setlocale($name); |
$gettext->setlocale($this->mosConfig_lang, $this->mosConfig_locale); |
| 231 |
setlocale(LC_ALL, $this->language['locale']); |
/*dump($gettext->getlocale()); |
| 232 |
setlocale(LC_CTYPE, $this->language['encoding']); |
$gettext->bindtextdomain('administrator', $lang_path);/*dump($gettext->getlocale()); |
| 233 |
$gettext->bindtextdomain($domain, $textdomain); |
dump(setlocale(LC_CTYPE, ''));; |
|
$gettext->bind_textdomain_codeset($domain, $this->language['encoding']); |
|
|
$gettext->textdomain($domain); |
|
|
/**/ |
|
| 234 |
|
|
|
} |
|
| 235 |
|
|
| 236 |
function secure () { |
dump(array($gettext, $this));*/ |
| 237 |
$this->mosConfig_unsecure_site = $this->mosConfig_live_site; |
|
|
if ($_SERVER['SERVER_PORT'] == 443) { |
|
|
if (!isset($this->mosConfig_secure_site)) $this->mosConfig_secure_site = str_replace('http://', 'https://', $this->mosConfig_live_site); |
|
|
$this->mosConfig_live_site = $this->mosConfig_secure_site; |
|
|
} |
|
| 238 |
} |
} |
| 239 |
|
|
| 240 |
function handleGlobals () { |
function handleGlobals () { |
| 708 |
} |
} |
| 709 |
|
|
| 710 |
function createDirectory ($dir) { |
function createDirectory ($dir) { |
| 711 |
|
if (file_exists($dir)) { |
| 712 |
if (is_dir($dir)) return true; |
if (is_dir($dir)) return true; |
| 713 |
|
else return false; |
| 714 |
|
} |
| 715 |
list($upDirectory, $count) = $this->containingDirectory($dir); |
list($upDirectory, $count) = $this->containingDirectory($dir); |
| 716 |
if ($count > 1 AND !is_dir($upDirectory)) if (!$this->createDirectory($upDirectory)) return false; |
if ($count > 1 AND !file_exists($upDirectory)) if (!$this->createDirectory($upDirectory)) return false; |
| 717 |
|
if (!is_dir($upDirectory)) return false; |
| 718 |
$dirperms = mamboCore::get('mosConfig_dirperms'); |
$dirperms = mamboCore::get('mosConfig_dirperms'); |
| 719 |
if ($dirperms) { |
if ($dirperms) { |
| 720 |
$origmask = @umask(0); |
$origmask = @umask(0); |
| 721 |
$mode = octdec($dirperms); |
$mode = octdec($dirperms); |
| 722 |
} |
} |
| 723 |
else $mode = 0777; |
else $mode = 0755; |
| 724 |
if (!@mkdir($dir, $mode )) $result = false; |
if (!@mkdir($dir, $mode )) $result = false; |
| 725 |
else { |
else { |
| 726 |
$result = true; |
$result = true; |
| 1351 |
return $instance; |
return $instance; |
| 1352 |
} |
} |
| 1353 |
/** |
/** |
| 1354 |
|
* Register a class-type mambot, provided it has a perform method |
| 1355 |
|
* - can register for multiple events if desired |
| 1356 |
|
* @param object The mambot object |
| 1357 |
|
* @param mixed string or array of strings - the mambot events to be registered |
| 1358 |
|
* @param int the subscript for use in the main array of mambots |
| 1359 |
|
*/ |
| 1360 |
|
function _botRegister (&$botObject, &$selected, $i) { |
| 1361 |
|
$function = array(&$newbot, 'perform'); |
| 1362 |
|
if (!is_callable($function)) return; |
| 1363 |
|
if (is_array($selected)) foreach ($selected as $select) $this->_botRegister($botObject, $select); |
| 1364 |
|
$this->_events[$selected][] = array ($function, $i); |
| 1365 |
|
$this->_registered[$i] = true; |
| 1366 |
|
} |
| 1367 |
|
|
| 1368 |
|
/** |
| 1369 |
* Loads all the bot files for a particular group |
* Loads all the bot files for a particular group |
| 1370 |
* @param string The group name, relates to the sub-directory in the mambots directory |
* @param string The group name, relates to the sub-directory in the mambots directory |
| 1371 |
*/ |
*/ |
| 1382 |
require_once( $path ); |
require_once( $path ); |
| 1383 |
if (!isset($this->_registered[$i])) { |
if (!isset($this->_registered[$i])) { |
| 1384 |
$botclass = str_replace('.','_',$bot->element); |
$botclass = str_replace('.','_',$bot->element); |
| 1385 |
|
if (class_exists($botclass)) { |
| 1386 |
$newbot = new $botclass(); |
$newbot = new $botclass(); |
| 1387 |
$function = array ($newbot, 'perform'); |
if (is_callable(array(&$newbot, 'register'))) { |
| 1388 |
$selected = $newbot->register(); |
$selected = $newbot->register(); |
| 1389 |
if (is_array($selected)) foreach ($selected as $select) $this->_events[$select][] = array($function, $i); |
$this->_botRegister($newbot, $selected, $i); |
| 1390 |
else $this->_events[$selected][] = array ($function, $i); |
} |
| 1391 |
$this->_registered[$i] = true; |
} |
| 1392 |
} |
} |
| 1393 |
$total++; |
$total++; |
| 1394 |
} |
} |
| 2336 |
return $result; |
return $result; |
| 2337 |
} |
} |
| 2338 |
/** |
/** |
| 2339 |
|
* @param string The name of the control, or the default text area if a setup file is not found |
| 2340 |
|
* @return string HTML |
| 2341 |
|
*/ |
| 2342 |
|
function render( $name='params' ) { |
| 2343 |
|
if (is_file($this->_path)) { |
| 2344 |
|
$parser = new mosXMLParams ($this->_path, $this, $name); |
| 2345 |
|
if (count($parser->html)) return implode("\n", $parser->html); |
| 2346 |
|
} |
| 2347 |
|
$raw = $this->_raw; |
| 2348 |
|
return "<textarea name='$name' cols='40' rows='10' class='text_area'$raw</textarea>"; |
| 2349 |
|
} |
| 2350 |
|
|
| 2351 |
|
/** |
| 2352 |
* special handling for textarea param |
* special handling for textarea param |
| 2353 |
*/ |
*/ |
| 2354 |
function textareaHandling( &$txt ) { |
function textareaHandling( &$txt ) { |
| 2394 |
$local_backup_path = $configuration->rootPath().'/administrator/backups'; |
$local_backup_path = $configuration->rootPath().'/administrator/backups'; |
| 2395 |
$media_path = $configuration->rootPath().'/media/'; |
$media_path = $configuration->rootPath().'/media/'; |
| 2396 |
$image_path = $configuration->rootPath().'/images/stories'; |
$image_path = $configuration->rootPath().'/images/stories'; |
| 2397 |
|
$lang_path = $configuration->rootPath().'/language'; |
| 2398 |
$image_size = 100; |
$image_size = 100; |
| 2399 |
|
|
| 2400 |
$database =& mamboDatabase::getInstance(); |
$database =& mamboDatabase::getInstance(); |
| 2401 |
$database->debug(mamboCore::get('mosConfig_debug')); |
$database->debug(mamboCore::get('mosConfig_debug')); |
| 2402 |
|
|
| 2403 |
|
// |
| 2404 |
|
|
| 2405 |
|
$gettext =& phpgettext(); |
| 2406 |
|
$gettext->bindtextdomain('common', $configuration->rootPath().'/language'); |
| 2407 |
|
$gettext->textdomain('common'); |
| 2408 |
|
//dump($gettext->textdomain(substr($option, 3))); |
| 2409 |
|
//$gettext->bindtextdomain('frontend', $lang_path); |
| 2410 |
|
//$gettext->textdomain('frontend'); |
| 2411 |
|
|
| 2412 |
if (!$adminside) { |
if (!$adminside) { |
| 2413 |
$sefcode = $configuration->rootPath().'/components/com_sef/sef.php'; |
$sefcode = $configuration->rootPath().'/components/com_sef/sef.php'; |
| 2414 |
if (file_exists($sefcode)) require_once($sefcode); |
if (file_exists($sefcode)) require_once($sefcode); |
| 2438 |
$acl = new gacl_api(); |
$acl = new gacl_api(); |
| 2439 |
// Handle special admin side options |
// Handle special admin side options |
| 2440 |
$option = strtolower(mosGetParam($_REQUEST,'option','com_admin')); |
$option = strtolower(mosGetParam($_REQUEST,'option','com_admin')); |
| 2441 |
|
|
| 2442 |
|
$domain = substr($option, 4); |
| 2443 |
|
$gettext->bindtextdomain('administrator', $lang_path); |
| 2444 |
|
$gettext->bindtextdomain($domain, $lang_path); |
| 2445 |
|
$admindomain = $gettext->textdomain(); |
| 2446 |
|
$gettext->textdomain('administrator'); |
| 2447 |
// Login will, if it succeeds, start a new session and set $my |
// Login will, if it succeeds, start a new session and set $my |
| 2448 |
if ($option == 'login') { |
if ($option == 'login') { |
| 2449 |
require_once($configuration->rootPath().'/includes/authenticator.php'); |
require_once($configuration->rootPath().'/includes/authenticator.php'); |
| 2470 |
// We can now create the mainframe object |
// We can now create the mainframe object |
| 2471 |
$mainframe =& new mosMainFrame($database, $option, '..', true); |
$mainframe =& new mosMainFrame($database, $option, '..', true); |
| 2472 |
// Provided $my is set, we have a valid admin side session and can include remaining code |
// Provided $my is set, we have a valid admin side session and can include remaining code |
| 2473 |
|
|
| 2474 |
if ($my) { |
if ($my) { |
| 2475 |
mamboCore::set('currentUser', $my); |
mamboCore::set('currentUser', $my); |
| 2476 |
require_once( $configuration->rootPath().'/includes/mambo.php' ); |
require_once( $configuration->rootPath().'/includes/mambo.php' ); |
| 2479 |
require_once( $configuration->rootPath().'/administrator/includes/mosAdminMenus.php'); |
require_once( $configuration->rootPath().'/administrator/includes/mosAdminMenus.php'); |
| 2480 |
require_once($configuration->rootPath().'/administrator/includes/admin.php'); |
require_once($configuration->rootPath().'/administrator/includes/admin.php'); |
| 2481 |
require_once( $configuration->rootPath() . '/includes/cmtclasses.php' ); |
require_once( $configuration->rootPath() . '/includes/cmtclasses.php' ); |
| 2482 |
|
require_once( $configuration->rootPath() . '/components/com_content/content.class.php' ); |
| 2483 |
$_MAMBOTS =& mosMambotHandler::getInstance(); |
$_MAMBOTS =& mosMambotHandler::getInstance(); |
| 2484 |
|
|
| 2485 |
|
|
| 2486 |
// If no_html is set, we avoid starting the template, and go straight to the component |
// If no_html is set, we avoid starting the template, and go straight to the component |
| 2487 |
if ($no_html) { |
if ($no_html) { |
| 2488 |
if ($path = $mainframe->getPath( "admin" )) require $path; |
if ($path = $mainframe->getPath( "admin" )) require $path; |
| 2496 |
$configuration->doGzip(); |
$configuration->doGzip(); |
| 2497 |
} |
} |
| 2498 |
else { |
else { |
| 2499 |
|
if (!$popup) { |
| 2500 |
$pop = mosGetParam($_REQUEST, 'pop', ''); |
$pop = mosGetParam($_REQUEST, 'pop', ''); |
| 2501 |
if ($pop) require_once($configuration->rootPath()."/administrator/popups/$pop"); |
if ($pop) require_once($configuration->rootPath()."/administrator/popups/$pop"); |
| 2502 |
else require_once($configuration->rootPath()."/administrator/popups/index3pop.php"); |
else require_once($configuration->rootPath()."/administrator/popups/index3pop.php"); |
| 2503 |
$configuration->doGzip(); |
$configuration->doGzip(); |
| 2504 |
} |
} |
| 2505 |
} |
} |
| 2506 |
|
} |
| 2507 |
// If $my was not set, the only possibility is to ask for an admin side login |
// If $my was not set, the only possibility is to ask for an admin side login |
| 2508 |
else { |
else { |
| 2509 |
$configuration->initGzip(); |
$configuration->initGzip(); |
| 2518 |
$configuration->handleGlobals(); |
$configuration->handleGlobals(); |
| 2519 |
$Itemid = $configuration->get('Itemid'); |
$Itemid = $configuration->get('Itemid'); |
| 2520 |
|
|
| 2521 |
|
// load frontend language file |
| 2522 |
|
$gettext->bindtextdomain(substr($option, 4), $configuration->rootPath().'/language'); |
| 2523 |
|
$gettext->bindtextdomain('frontend', $configuration->rootPath().'/language'); |
| 2524 |
|
$frontdomain = $gettext->textdomain(); |
| 2525 |
|
$gettext->textdomain('frontend'); |
| 2526 |
|
|
| 2527 |
|
|
| 2528 |
$mainframe =& new mosMainFrame($database, $option, '.'); |
$mainframe =& new mosMainFrame($database, $option, '.'); |
| 2529 |
if ($option == 'login') $configuration->handleLogin(); |
if ($option == 'login') $configuration->handleLogin(); |
| 2530 |
elseif ($option == 'logout') $configuration->handleLogout(); |
elseif ($option == 'logout') $configuration->handleLogout(); |
| 2556 |
require_once( $configuration->rootPath().'/editor/editor.php' ); |
require_once( $configuration->rootPath().'/editor/editor.php' ); |
| 2557 |
require_once( $configuration->rootPath() . '/includes/gacl.class.php' ); |
require_once( $configuration->rootPath() . '/includes/gacl.class.php' ); |
| 2558 |
require_once( $configuration->rootPath() . '/includes/gacl_api.class.php' ); |
require_once( $configuration->rootPath() . '/includes/gacl_api.class.php' ); |
| 2559 |
|
require_once( $configuration->rootPath() . '/components/com_content/content.class.php' ); |
| 2560 |
$acl = new gacl_api(); |
$acl = new gacl_api(); |
| 2561 |
|
|
| 2562 |
|
|
| 2563 |
/** Get the component handler */ |
/** Get the component handler */ |
| 2564 |
require_once( $configuration->rootPath() . '/includes/cmtclasses.php' ); |
require_once( $configuration->rootPath() . '/includes/cmtclasses.php' ); |
| 2565 |
$c_handler =& mosComponentHandler::getInstance(); |
$c_handler =& mosComponentHandler::getInstance(); |
| 2569 |
$menuhandler =& mosMenuHandler::getInstance(); |
$menuhandler =& mosMenuHandler::getInstance(); |
| 2570 |
$ret = $menuhandler->menuCheck($Itemid, $option, $task, $gid); |
$ret = $menuhandler->menuCheck($Itemid, $option, $task, $gid); |
| 2571 |
$menuhandler->setPathway($Itemid); |
$menuhandler->setPathway($Itemid); |
| 2572 |
if ($ret) require_once( $path ); |
if ($ret) { |
| 2573 |
|
$gettext->textdomain(substr($option, 4)); // get the component lang file |
| 2574 |
|
require_once( $path ); |
| 2575 |
|
$gettext->textdomain($frontdomain); |
| 2576 |
|
} |
| 2577 |
else mosNotAuth(); |
else mosNotAuth(); |
| 2578 |
} |
} |
| 2579 |
else { |
else { |
| 2587 |
$configuration->initGzip(); |
$configuration->initGzip(); |
| 2588 |
|
|
| 2589 |
$configuration->standardHeaders(); |
$configuration->standardHeaders(); |
| 2590 |
if ($indextype == 1) { |
if (mosGetParam($_GET, 'syndstyle', '') == 'yes') mosMainBody(); |
| 2591 |
|
elseif ($indextype == 1) { |
| 2592 |
// loads template file |
// loads template file |
| 2593 |
if ( !file_exists( 'templates/'. $cur_template .'/index.php' ) ) { |
if ( !file_exists( 'templates/'. $cur_template .'/index.php' ) ) { |
| 2594 |
echo '<font color=\"red\"><b>'.T_('Template File Not Found! Looking for template').'</b></font>'.$cur_template; |
echo '<font color=\"red\"><b>'.T_('Template File Not Found! Looking for template').'</b></font>'.$cur_template; |