| 184 |
require_once($this->rootPath().'/administrator/includes/admin.php'); |
require_once($this->rootPath().'/administrator/includes/admin.php'); |
| 185 |
session_name(md5($this->mosConfig_live_site)); |
session_name(md5($this->mosConfig_live_site)); |
| 186 |
session_start(); |
session_start(); |
| 187 |
if ($user =& checkAdminSession($database)) return; |
$session =& mosSession::getCurrent(); |
| 188 |
|
$my =& new mosUser(); |
| 189 |
|
$my->getSessionData(); |
| 190 |
|
if (mosSession::validate($my)) return; |
| 191 |
include("$this->mosConfig_absolute_path/offline.php"); |
include("$this->mosConfig_absolute_path/offline.php"); |
| 192 |
exit(); |
exit(); |
| 193 |
} |
} |
| 1022 |
function &getMenuTypes () { |
function &getMenuTypes () { |
| 1023 |
$types = array(); |
$types = array(); |
| 1024 |
foreach ($this->_menus as $menu) { |
foreach ($this->_menus as $menu) { |
| 1025 |
if (!in_array($menu->menutype, $types)) $types[] = $menu->menutype; |
if (!isset($types[$menu->menutype])) $types[$menu->menutype] = 0; |
| 1026 |
|
$types[$menu->menutype]++; |
| 1027 |
} |
} |
| 1028 |
return $types; |
return $types; |
| 1029 |
} |
} |
| 1568 |
* Return true if this user is an administrator, false otherwise |
* Return true if this user is an administrator, false otherwise |
| 1569 |
*/ |
*/ |
| 1570 |
function isAdmin() { |
function isAdmin() { |
| 1571 |
return ( strtolower( $this->usertype ) == 'superadministrator' || strtolower( $this->usertype ) == 'super administrator' || $this->grp == 16 ) ? true : false; |
return ( strtolower( $this->usertype ) == 'superadministrator' OR strtolower( $this->usertype ) == 'super administrator' OR (isset($this->grp) AND $this->grp == 16) ) ? true : false; |
| 1572 |
} |
} |
| 1573 |
|
|
| 1574 |
/** |
/** |
| 2210 |
$current_time = time(); |
$current_time = time(); |
| 2211 |
$database = mamboDatabase::getInstance(); |
$database = mamboDatabase::getInstance(); |
| 2212 |
$database->setQuery ("UPDATE #__session" |
$database->setQuery ("UPDATE #__session" |
| 2213 |
. "\nSET time='$current_time'" |
. "\nSET time='$current_time', guest=-3-guest" |
| 2214 |
. "\nWHERE session_id='$session_id'" |
. "\nWHERE session_id='$session_id'" |
| 2215 |
. " AND username = '" . $database->getEscaped( $user->username ) . "'" |
. " AND username = '" . $database->getEscaped( $user->username ) . "'" |
| 2216 |
. " AND userid = " . intval( $user->id ) |
. " AND userid = " . intval( $user->id ) |
| 2510 |
$section = mosGetParam($_REQUEST, 'section', ''); |
$section = mosGetParam($_REQUEST, 'section', ''); |
| 2511 |
$no_html = strtolower(mosGetParam($_REQUEST, 'no_html', '')); |
$no_html = strtolower(mosGetParam($_REQUEST, 'no_html', '')); |
| 2512 |
|
|
| 2513 |
|
ini_set('session.use_trans_sid', 0); |
| 2514 |
|
ini_set('session.use_cookies', 1); |
| 2515 |
|
ini_set('session.use_only_cookies', 1); |
| 2516 |
|
|
| 2517 |
if ($adminside) { |
if ($adminside) { |
| 2518 |
// Start ACL |
// Start ACL |
| 2519 |
require_once($configuration->rootPath().'/includes/gacl.class.php' ); |
require_once($configuration->rootPath().'/includes/gacl.class.php' ); |
| 2527 |
$gettext->bindtextdomain($domain, $lang_path); |
$gettext->bindtextdomain($domain, $lang_path); |
| 2528 |
$admindomain = $gettext->textdomain(); |
$admindomain = $gettext->textdomain(); |
| 2529 |
$gettext->textdomain('administrator'); |
$gettext->textdomain('administrator'); |
|
// Login will, if it succeeds, start a new session and set $my |
|
|
if ($option == 'login') { |
|
|
require_once($configuration->rootPath().'/includes/authenticator.php'); |
|
|
$authenticator =& mamboAuthenticator::getInstance(); |
|
|
$my = $authenticator->loginAdmin($acl); |
|
|
} |
|
|
// If this is not login, we should already have a valid admin session |
|
|
else { |
|
|
ini_set('session.use_trans_sid', 0); |
|
|
ini_set('session.use_cookies', 1); |
|
|
ini_set('session.use_only_cookies', 1); |
|
| 2530 |
session_name(md5(mamboCore::get('mosConfig_live_site'))); |
session_name(md5(mamboCore::get('mosConfig_live_site'))); |
| 2531 |
session_start(); |
session_start(); |
|
// Handle the remaining special options |
|
|
if ($option == 'logout') { |
|
|
require($configuration->rootPath().'/administrator/logout.php'); |
|
|
exit(); |
|
|
} |
|
|
if ($option == 'simple_mode') $admin_mode = 'on'; |
|
|
elseif ($option == 'advanced_mode') $admin_mode = 'off'; |
|
|
else $admin_mode = mosGetParam($_SESSION, 'simple_editing', ''); |
|
|
$_SESSION['simple_editing'] = mosGetParam($_POST, 'simple_editing', $admin_mode); |
|
|
// Include admin side functions, check that we have a valid admin side session |
|
|
require_once($configuration->rootPath().'/administrator/includes/admin.php'); |
|
| 2532 |
// restore some session variables |
// restore some session variables |
| 2533 |
$my = new mosUser(); |
$my = new mosUser(); |
| 2534 |
$my->getSession(); |
$my->getSession(); |
| 2535 |
if (mosSession::validate($my)) mosSession::purge(); |
if (mosSession::validate($my)) mosSession::purge(); |
| 2536 |
else $my = null; |
else $my = null; |
| 2537 |
|
if (!$my AND $option == 'login') { |
| 2538 |
|
require_once($configuration->rootPath().'/includes/authenticator.php'); |
| 2539 |
|
$authenticator =& mamboAuthenticator::getInstance(); |
| 2540 |
|
$my = $authenticator->loginAdmin($acl); |
| 2541 |
|
} |
| 2542 |
|
// Handle the remaining special options |
| 2543 |
|
elseif ($option == 'logout') { |
| 2544 |
|
require($configuration->rootPath().'/administrator/logout.php'); |
| 2545 |
|
exit(); |
| 2546 |
} |
} |
| 2547 |
// We can now create the mainframe object |
// We can now create the mainframe object |
| 2548 |
$mainframe =& new mosMainFrame($database, $option, '..', true); |
$mainframe =& new mosMainFrame($database, $option, '..', true); |
| 2549 |
// 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 |
|
|
|
| 2550 |
if ($my) { |
if ($my) { |
| 2551 |
mamboCore::set('currentUser', $my); |
mamboCore::set('currentUser', $my); |
| 2552 |
|
if ($option == 'simple_mode') $admin_mode = 'on'; |
| 2553 |
|
elseif ($option == 'advanced_mode') $admin_mode = 'off'; |
| 2554 |
|
else $admin_mode = mosGetParam($_SESSION, 'simple_editing', ''); |
| 2555 |
|
$_SESSION['simple_editing'] = mosGetParam($_POST, 'simple_editing', $admin_mode); |
| 2556 |
|
require_once($configuration->rootPath().'/administrator/includes/admin.php'); |
| 2557 |
require_once( $configuration->rootPath().'/includes/mambo.php' ); |
require_once( $configuration->rootPath().'/includes/mambo.php' ); |
| 2558 |
require_once ($configuration->rootPath().'/includes/mambofunc.php'); |
require_once ($configuration->rootPath().'/includes/mambofunc.php'); |
| 2559 |
require_once ($configuration->rootPath().'/includes/mamboHTML.php'); |
require_once ($configuration->rootPath().'/includes/mamboHTML.php'); |
| 2585 |
} |
} |
| 2586 |
} |
} |
| 2587 |
} |
} |
| 2588 |
// 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 offer a login screen |
| 2589 |
else { |
else { |
| 2590 |
$configuration->initGzip(); |
$configuration->initGzip(); |
| 2591 |
$path = $configuration->rootPath().'/administrator/templates/'.$mainframe->getTemplate().'/login.php'; |
$path = $configuration->rootPath().'/administrator/templates/'.$mainframe->getTemplate().'/login.php'; |