Exemplo n.º 1
0
/**
 * Checks if the there is a session cookie, and if so resume the session 
 */
function fs_resume_user_session()
{
    require_once FS_ABS_PATH . '/php/session.php';
    $res = fs_resume_existing_session();
    if ($res !== true) {
        return $res;
    }
    $authenticated = fs_current_user_id() !== false;
    if ($authenticated) {
        // raise authenticated event.
        // some initialization code may only happen after the user is authenticated.
        fs_do_action("authenticated");
    }
    return $authenticated;
}
Exemplo n.º 2
0
<?php

if (!isset($GLOBALS['fs_initialized'])) {
    require_once dirname(__FILE__) . '/constants.php';
    $fs_conf = dirname(dirname(__FILE__)) . '/conf.php';
    if (file_exists($fs_conf)) {
        require_once $fs_conf;
    }
    require_once dirname(__FILE__) . '/session.php';
    if (!defined('FS_NO_SESSION')) {
        $res = fs_resume_existing_session();
        if ($res !== true) {
            global $FS_SESSION_ERROR;
            $FS_SESSION_ERROR = $res;
        }
    }
    if (file_exists(dirname(__FILE__) . '/../demo')) {
        define('DEMO', true);
    }
    if (!defined('FS_COMMIT_STRATEGY')) {
        define('FS_COMMIT_STRATEGY', FS_COMMIT_IMMEDIATE);
    }
    global $FS_CONTEXT;
    if (!isset($FS_CONTEXT)) {
        detect_context();
    }
    // if we run in wordpress, load its config to gain access to the api and configuration
    if (fs_in_wordpress()) {
        global $FS_CONTEXT;
        $config_path = $FS_CONTEXT['WP_PATH'];
        require_once $config_path;