// $Id: index.php,v 1.51 2010/04/06 21:28:52 eddieajau Exp $ define( "_VALID_MOS", 1 ); if (!file_exists( "configuration.php" ) || filesize( "configuration.php") < 10) { header( "Location: installation/index.php" ); exit(); } include_once( "globals.php" ); require_once( "configuration.php" ); if ($mosConfig_offline == 1){ include( 'offline.php' ); exit(); } require_once( "classes/mambo.php" ); require_once( "includes/sef.php" ); require_once( "includes/frontend.php" ); /* if (file_exists( "installation/index.php" )) { include ("offline.php"); exit(); } */ // retrieve some expected url (or form) arguments $option = trim( strtolower( mosGetParam( $_REQUEST, 'option' ) ) ); $Itemid = intval( mosGetParam( $_REQUEST, 'Itemid', null ) ); $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix ); $acl = new gacl_api(); if ($option == '') { if ($Itemid) { $database->setQuery( "SELECT id, link" . "\nFROM #__menu" . "\nWHERE menutype='mainmenu' AND id='$Itemid' AND published='1'" ); } else { $database->setQuery( "SELECT id, link" . "\nFROM #__menu" . "\nWHERE menutype='mainmenu' AND published='1'" . "\nORDER BY parent, ordering LIMIT 1" ); } $menu = new mosMenu( $database ); if ($database->loadObject( $menu )) { $Itemid = $menu->id; } $link = $menu->link; if (($pos = strpos( $link, '?' )) !== false) { $link = substr( $link, $pos+1 ). '&Itemid='.$Itemid; } parse_str( $link, $temp ); // this is a patch, need to rework when globals are handled better foreach ($temp as $k=>$v) { $GLOBALS[$k] = $v; $_REQUEST[$k] = $v; if ($k == 'option') { $option = $v; } } } // do we have a valid Itemid yet?? if ($Itemid === null) { // Nope, just use the homepage then. $database->setQuery( "SELECT id" . "\nFROM #__menu" . "\nWHERE menutype='mainmenu' AND published='1'" . "\nORDER BY parent, ordering LIMIT 1" ); if (!($Itemid = $database->loadResult())) { echo $database->getErrorMsg(); } } // patch to lessen the impact on templates if ($option == 'search') { $option = 'com_search'; } // mainframe is an API workhorse, lots of 'core' interaction routines $mainframe = new mosMainFrame( $database, $option, '.' ); // Support for simple debug include_once($mosConfig_absolute_path . "/includes/debug.php"); $mosDebug = new mosDebug($mosConfig_debug); $mainframe->initSession(); if ($mosConfig_lang=='') { $mosConfig_lang='english'; } include_once ('language/'.$mosConfig_lang.'.php'); $return = mosGetParam( $_REQUEST, 'return', null ); if ($option == "login") { $mainframe->login(); if ($return) { mosRedirect( $return ); } else { mosRedirect( 'index.php' ); } } else if ($option == "logout") { $mainframe->logout(); if ($return) { mosRedirect($return); } else { mosRedirect('index.php'); } } // get the information about the current user from the