コード例 #1
0
ファイル: auth.php プロジェクト: alx/blogsfera
/**
 * Authenticate the current user as an admin.
 * this should only be used if there is currenty no admin in the database.
 */
function fs_dummy_auth()
{
    if (!fs_no_admin()) {
        echo "Admin is already defined in the database";
        return;
    }
    $user = new stdClass();
    $user->dummy = true;
    $user->name = "Dummy admin";
    $user->security_level = SEC_ADMIN;
    $res = fs_start_user_session($user);
    if ($res) {
        fs_store_session();
    }
    if ($res === false) {
        return false;
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: alx/blogsfera
            $show_db = true;
            break;
        case FS_DB_NEED_UPGRADE:
            if ($db['status'] == FS_DB_NEED_UPGRADE && $db['ver'] < 11) {
                $show_db = true;
            }
            break;
    }
    if ($show_db) {
        fs_dummy_auth();
        fs_show_page(FS_ABS_PATH . '/php/page-database.php');
        return;
    }
    // any other case, procceed with normal login screen.
} else {
    if (fs_no_admin()) {
        fs_dummy_auth();
        fs_show_page(FS_ABS_PATH . '/php/page-add-admin.php');
        return;
    }
}
// to force login in DEMO mode, append ?login to the firestats url.
if (defined('DEMO') && !isset($_GET['login'])) {
    $user = new stdClass();
    $user->name = "Demo";
    $user->id = 1;
    $user->security_level = SEC_USER;
    $res = fs_start_user_session($user);
} else {
    $res = fs_resume_user_session();
}