/** * check action * @param string $action name of action with extention */ static function isset_php($action) { $_arr = explode(".", $action); if (!$action or $_arr[1] == 'php') { return true; } else { system::error(404); } }
<?php die('<p style="font-size:36px;color:black;font-weight:bold;">404!</p>'); global $_str; // проверка на авторизованного юзера if (!registration::is_Autorize()) { system::error(404); } //если регистрируемся if (system::isset_ctrl('ctrl')) { switch ($_GET['ctrl']) { // новый пользователь case "myorders": // массив типов global $_status_order; if (!mycabinet::get_My_Order($_SESSION['user_id'])) { $_str .= 'У вас нет заказов!'; } else { // выводим заказы пользователя $_str .= system::show_tpl(array('result' => mycabinet::get_My_Order($_SESSION['user_id']), 'status_order' => $_status_order), 'frontend/mycabinet/list_index.php'); } break; // печать заказа // печать заказа case "print": // строим запрос $_sql = "SELECT order_number.*, users.name, users.address, users.phone, users.email, users.city \n\t\t\t\t\t\t\tFROM order_number, users \n\t\t\t\t\t\t\twhere order_number.id_user=users.id and order_number.id=" . $_GET['id']; // выбираем данные о заказе $_sql0 = 'SELECT orders.*, catalog.name, catalog.artikul FROM orders Left Outer Join catalog ON orders.id_good=catalog.id
*/ $ctrl = system::_get('ctrl'); $action = system::_get('action'); // get controller $ctrl_file = ADMIN_PATH . "/ctrl/" . $ctrl . "Controller.php"; //echo ($ctrl_file); if (is_file($ctrl_file)) { // load core classes $class = $ctrl . 'Controller'; //echo ($class); // get action if (class_exists($class)) { $class = new $class(); $method = $action . 'Action'; //echo ($method); if (method_exists($class, $method)) { // execute action $class->_pre(); $class->_post($class->{$method}()); } else { system::error(404, '!method_exists: ' . $method); } } else { system::error(404, '!class_exists: ' . $class); } } else { system::error(404, '!controller: ' . $ctrl_file); } /* * CONTROLLER */