Ejemplo n.º 1
0
 public static function loadOpenCart()
 {
     if (!self::$loaded) {
         $application_config = 'test-config';
         $_SERVER['SERVER_PORT'] = 80;
         $_SERVER['SERVER_PROTOCOL'] = 'CLI';
         $_SERVER['REQUEST_METHOD'] = 'GET';
         $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
         ob_start();
         self::loadConfiguration();
         require_once DIR_SYSTEM . 'startup.php';
         require_once DIR_SYSTEM . 'framework.php';
         ob_end_clean();
         self::$registry = $registry;
         self::$registry->set('controller', $controller);
         if (self::isAdmin()) {
             $session = new stdClass();
             $session->data = array();
             $session->session_id = bin2hex(openssl_random_pseudo_bytes(16));
             $session->getId = function () use($session) {
                 return $session->session_id;
             };
             self::$registry->set('session', $session);
         }
         self::$loaded = true;
     }
 }