public static function core_msg($type = '') { $msg_array = \CORE::init()->get_msg_arr(); $styles = array('error' => 'danger', 'info' => 'info', 'debug' => 'warning'); if ($type != '') { if (isset($msg_array[$type])) { if ($msg_array[$type] != '') { echo UI::init()->core_msg_show($type, $styles[$type], $msg_array[$type]); } } } else { foreach ($msg_array as $type => $msg) { if ($msg != '') { echo UI::init()->core_msg_show($type, $styles[$type], $msg); } } } }
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'); } } }