/** * Sets the session variables for the authenticated user * * @since 1.0 * @package facileManager * * @param object $user User information to create session variables from * @return null */ function setSession($user) { global $fm_name; session_set_cookie_params(strtotime('+1 week')); @session_start(); $_SESSION['user']['logged_in'] = true; $_SESSION['user']['id'] = $user->user_id; $_SESSION['user']['name'] = $user->user_login; $_SESSION['user']['last_login'] = $user->user_last_login; $_SESSION['user']['account_id'] = $user->account_id; $_SESSION['user']['ipaddr'] = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $_SERVER['REMOTE_ADDR']; /** Upgrade compatibility */ if (getOption('fm_db_version') < 32) { $_SESSION['user']['fm_perms'] = $user->user_perms; } setUserModule($user->user_default_module); setcookie('myid', session_id(), strtotime('+1 week')); }
/** Show/Hide errors */ if (getOption('show_errors')) { error_reporting(E_ALL); ini_set('display_errors', true); } else { ini_set('display_errors', false); error_reporting(0); } /** Include module variables */ include ABSPATH . 'fm-modules/' . $fm_name . '/variables.inc.php'; if (isset($_SESSION['module'])) { include ABSPATH . 'fm-modules/' . $_SESSION['module'] . '/variables.inc.php'; } /** Handle module change request */ if (isset($_REQUEST['module']) && !isset($_REQUEST['action'])) { setUserModule($_REQUEST['module']); header('Location: ' . $GLOBALS['RELPATH']); exit; } /** Ensure selected module is indeed active */ if (isset($_SESSION['module']) && $_SESSION['module'] != $fm_name && !in_array($_SESSION['module'], getActiveModules())) { $_SESSION['module'] = $fm_name; header('Location: ' . $GLOBALS['RELPATH'] . 'admin-modules.php'); exit; } if (!defined('UPGRADE')) { /** Once logged in process the menuing */ if ($fm_login->isLoggedIn()) { if (isUpgradeAvailable()) { $fm_login->logout(); header('Location: ' . $GLOBALS['RELPATH']);