private function bootstrapInitShop()
 {
     if (FALSE == $this->CI->config->item('is_installed') || FALSE === ($shopPath = getModulePath('shop'))) {
         return;
     }
     define('SHOP_DIR', $shopPath);
     ClassLoader::getInstance()->registerNamespacedPath(SHOP_DIR . 'models2/generated-classes')->registerClassesPath(SHOP_DIR . 'models2/generated-classes')->registerClassesPath(SHOP_DIR . 'classes')->registerNamespacedPath(SHOP_DIR . 'classes');
     ShopCore::init();
     // Diable CSRF library form web money service
     $this->CI =& get_instance();
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['result'] == 'true' && $_GET['pm'] > 0) {
         define('ICMS_DISBALE_CSRF', true);
     }
     // Support for robokassa
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['getResult'] == 'true') {
         define('ICMS_DISBALE_CSRF', true);
     }
     // Support for privat
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'order' && $this->CI->uri->segment(3) == 'view' && $_POST) {
         define('ICMS_DISBALE_CSRF', true);
     }
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['succes'] == 'true') {
         define('ICMS_DISBALE_CSRF', true);
     }
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'cart' && $this->CI->uri->segment(3) == 'view' && $_GET['fail'] == 'true') {
         define('ICMS_DISBALE_CSRF', true);
     }
     if (isset($_SERVER['HTTP_REFERER']) and strpos($_SERVER['HTTP_REFERER'] . "", 'facebook.com')) {
         define('ICMS_DISBALE_CSRF', true);
     }
     // Support for privat
     if ($this->CI->uri->segment(1) == 'shop' && $this->CI->uri->segment(2) == 'order' && $this->CI->uri->segment(3) == 'view') {
         define('ICMS_DISBALE_CSRF', true);
     }
     //new payment system
     if (preg_match("/payment_method_/i", $this->CI->uri->segment(1)) || preg_match("/payment_method_/i", $this->CI->uri->segment(2))) {
         define('ICMS_DISBALE_CSRF', true);
     }
 }
Example #2
0
 /**
  * 获取控制目录
  *
  * @return array
  */
 public static function getControllerPaths()
 {
     $paths = array();
     foreach ((array) static::$controllerNamespace as $ns) {
         $ps = ClassLoader::getInstance()->getNamespacePaths(strstr($ns, '\\', true));
         foreach ($ps as &$v) {
             $v .= strtr(strstr($ns, '\\'), '\\', DS);
         }
         $paths[$ns] = $ps;
     }
     return $paths;
 }
<?php

spl_autoload_register(array(ClassLoader::getInstance(), 'loadClass'));
require_once dirname(__FILE__) . "/Interfaces.php";
class ClassLoader
{
    private static $SAVE_FILE = 'ClassLoader.class.php';
    private static $instance = null;
    private static $moduleDirs = array('framework/core', 'framework/schema', 'framework/servlets', 'framework/utils');
    private $classList = array();
    private $refreshed;
    private $path;
    public static function getInstance()
    {
        if (is_null(self::$instance)) {
            self::$instance = new ClassLoader();
        }
        return self::$instance;
    }
    private function __construct()
    {
        $this->path = $_SERVER['DOCUMENT_ROOT'] . "/framework/core/";
        $this->initClassList();
    }
    public function loadClass($className)
    {
        if (!array_key_exists($className, $this->classList) && !$this->refreshed) {
            $this->refreshClassList();
        }
        require_once $this->classList[$className];
    }
Example #4
0
 public function testAutoloadReturnsFalseIfClassDoesNotExist()
 {
     $this->assertFalse(ClassLoader::getInstance()->autoload('Omlex\\Invalid'));
 }