debug( $mosConfig_debug );
$acl = new gacl_api();
$option = strtolower( mosGetParam( $_REQUEST, 'option', '' ) );
if ($option == '') {
$option = 'com_admin';
}
// must start the session before we create the mainframe object
session_name( md5( $mosConfig_live_site ) );
session_start();
if ($option == 'simple_mode') {
$_SESSION['simple_editing'] = 'on';
}
if ($option == 'advanced_mode') {
$_SESSION['simple_editing'] = 'off';
}
// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame( $database, $option, '..', true );
// initialise some common request directives
$task = mosGetParam( $_REQUEST, 'task', '' );
$act = strtolower( mosGetParam( $_REQUEST, 'act', '' ) );
$section = mosGetParam( $_REQUEST, 'section', '' );
$no_html = strtolower( mosGetParam( $_REQUEST, 'no_html', '' ) );
if ($option == 'logout') {
require 'logout.php';
exit();
}
// restore some session variables
$my = new mosUser( $database );
$my->id = mosGetParam( $_SESSION, 'session_user_id', '' );
$my->username = mosGetParam( $_SESSION, 'session_username', '' );
$my->usertype = mosGetParam( $_SESSION, 'session_usertype', '' );
$my->gid = mosGetParam( $_SESSION, 'session_gid', '' );
$session_id = mosGetParam( $_SESSION, 'session_id', '' );
$logintime = mosGetParam( $_SESSION, 'session_logintime', '' );
if(!isset($_SESSION['simple_editing'])){
$_SESSION['simple_editing'] ='off';
}
if(isset($_POST['simple_editing']) && ($_POST['simple_editing'] != ''))
{
$_SESSION['simple_editing'] = $_POST['simple_editing'];
}
// check against db record of session
if ($session_id == md5( $my->id.$my->username.$my->usertype.$logintime )) {
$database->setQuery( "SELECT * FROM #__session"
. "\nWHERE session_id='$session_id'"
. " AND username = '" . $database->getEscaped( $my->username ) . "'"
. " AND userid = " . intval( $my->id )
);
if (!$result = $database->query()) {
echo $database->stderr();
}
if ($database->getNumRows( $result ) <> 1) {
echo "\n";
exit();
}
} else {
echo "\n";
exit();
}
// update session timestamp
$current_time = time();
$database->setQuery( "UPDATE #__session SET time='$current_time'"
. "\nWHERE session_id='$session_id'"
);
$database->query();
// timeout old sessions
$past = time()-1800;
$database->setQuery( "DELETE FROM #__session WHERE time < '$past'" );
$database->query();
// start the html output
if ($no_html) {
if ($path = $mainframe->getPath( "admin" )) {
require $path;
}
exit;
}
initGzip();
$path = $mosConfig_absolute_path . "/administrator/templates/" . $mainframe->getTemplate() . "/index.php";
require_once( $path );
doGzip();
?>