Beispiel #1
0
 private function __construct($REQUEST, $modules)
 {
     if ($REQUEST->get('c') == '') {
         UI::init()->static_page('home');
     } else {
         if (isset($modules[$REQUEST->get('c')])) {
             // \CORE::msg('debug','Controller: '.$REQUEST->get('c'));
             $model = null;
             $view = null;
             $controller = null;
             $p2 = strtoupper($REQUEST->get('c'));
             $path = array('m' => '', 'v' => '', 'c' => '');
             if ($modules[$REQUEST->get('c')] == 0) {
                 $p1 = 'CORE\\MVC\\';
                 $path['m'] = $p1 . 'M\\' . $p2 . '_M';
                 $path['v'] = $p1 . 'V\\' . $p2 . '_V';
                 $path['c'] = $p1 . 'C\\' . $p2 . '_C';
             } else {
                 $p1 = 'APP\\MVC\\';
                 $path['m'] = $p1 . 'M\\' . $p2 . '_M';
                 $path['v'] = $p1 . 'V\\' . $p2 . '_V';
                 $path['c'] = $p1 . 'C\\' . $p2 . '_C';
             }
             if (class_exists($path['c'])) {
                 if (\SEC::init()->acl($REQUEST->get('c'), $REQUEST->get('act'))) {
                     // access control ($USER)
                     if (class_exists($path['m'])) {
                         $model = new $path['m']();
                     }
                     if (class_exists($path['v'])) {
                         $view = new $path['v']();
                     }
                     $controller = new $path['c']($REQUEST, $model, $view);
                 }
             } else {
                 \CORE::msg('error', 'Module not loaded');
             }
         } else {
             \CORE::msg('error', 'Unregistered module');
             UI::init()->static_page('home');
         }
     }
 }
Beispiel #2
0
 public static function init()
 {
     if (empty(self::$inst)) {
         self::$inst = new self();
     }
     return self::$inst;
 }