File: Session.php

package info (click to toggle)
ingo1 1.0.1-1sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,368 kB
  • ctags: 921
  • sloc: php: 4,030; xml: 1,182; makefile: 63
file content (55 lines) | stat: -rw-r--r-- 1,978 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
 * Functions required to start a Ingo session.
 *
 * $Horde: ingo/lib/Session.php,v 1.2.10.1 2005/01/03 12:25:38 jan Exp $
 *
 * Copyright 2004-2005 Michael Slusarz <slusarz@horde.org>
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author  Michael Slusarz <slusarz@horde.org>
 * @version $Revision: 1.2.10.1 $
 * @since   Ingo 1.0
 * @package Ingo
 */
class Ingo_Session {

    /**
     * Create an ingo session.
     * This function should only be called once, when the user first uses
     * Ingo in a session.
     *
     * Creates the $ingo session variable with the following entries:
     * 'backend' (array) - The backend configuration to use.
     * 'change' (integer) - The timestamp of the last time the rules were
     *                      altered.
     * 'storage' (array) - Used by Ingo_Storage:: for caching data.
     * 'script_categories' (array) - The list of available categories for the
     *                               Ingo_Script driver in use.
     * 'script_generate' (boolean) - Is the Ingo_Script::generate() call
     *                               available?
     *
     * @access public
     *
     * @return boolean  True on success, false on failure.
     */
    function createSession()
    {
        $_SESSION['ingo'] = array();
        $_SESSION['ingo']['change'] = 0;
        $_SESSION['ingo']['storage'] = array();

        /* Get the backend. */
        $_SESSION['ingo']['backend'] = Ingo::getBackend();

        /* Determine if the Ingo_Script:: generate() method is available. */
        $ingo_script = &Ingo::loadIngoScript();
        $_SESSION['ingo']['script_generate'] = $ingo_script->generateAvailable();

        /* Get the list of categories this driver supports. */
        $_SESSION['ingo']['script_categories'] = array_merge($ingo_script->availableActions(), $ingo_script->availableCategories());
    }

}