Example #1
0
 public function __construct(Ac_Context $context = null)
 {
     if (empty($context)) {
         $context = Ac_Context::getInstance();
     }
     /* @var $context Ac_Context */
     $this->context = $context;
     $this->GET = new Ac_Model_Globals("_GET");
     $this->POST = new Ac_Model_Globals("_POST");
     /**
      * Input variables of PUT/DELETE methods
      * @global type $GLOBALS['_INPUT']
      * @name $_INPUT 
      */
     $GLOBALS["_INPUT"] = $this->parsedInput();
     $this->INPUT = new Ac_Model_Globals("_INPUT");
     $this->COOKIE = new Ac_Model_Globals_Cookie();
     /**
      * Merge the $_INPUT variables into the $_REQUEST global
      */
     $GLOBALS["_REQUEST"] = array_merge($_GET, $_POST, $GLOBALS["_INPUT"], $_COOKIE);
     $this->REQUEST = new Ac_Model_Globals("_REQUEST");
 }
Example #2
0
 /**
  * Changes and reinitializes the current context
  *
  * @param   array           $context
  * @return  Ac_Context      The new context
  */
 public static function parse(array $context = array())
 {
     self::$instance = new self(array_merge(self::$default_context, $context));
     return self::$instance;
 }
Example #3
0
 public static function __init()
 {
     if (empty(self::$observer)) {
         self::$reg = new stdClass();
         self::$finals = array();
         self::$observer = new Ac_Observer();
         self::$loader = Ac_Loader::getInstance();
         self::$config = static::trigger('AcBeforeInit', self::$loader->getConfig());
         if (empty(self::$context)) {
             self::$context = Ac_Context::getInstance();
         }
         static::trigger('AcLoaderLoad');
         self::$session = new Ac_Model_Globals_Session(self::config("session.name"), self::config("session.sessid_lifetime"), self::config("session.sessid_fingerprint_data"));
         self::$session->start();
         if (empty(self::$request)) {
             self::$request = new Ac_Http_Request(self::$context);
         }
         if (empty(self::$response)) {
             self::$response = new Ac_Http_Response(self::$request);
         }
         //Initialize db connections (and connect if autoconnect==true in their config)
         self::db();
         if (empty(self::$router)) {
             self::$router = new Ac_Router();
         }
         //load app module
         self::module("app", true);
         //load and initialize all modules defined in modules.autoload
         foreach (self::config("modules.autoload") as $moduleName) {
             if ($moduleName != "app") {
                 self::module($moduleName, true);
             }
         }
         self::loader()->setActiveModule("app");
         //resolve request resource
         self::$router->resolve();
         static::trigger('AcInit');
     }
 }