/** * Cài đặt chế độ debug * Nếu ISDEBUG được đặt là TRUE tất cả các warning sẽ được hiển thị * Không thay đổi thuộc tính này nếu không phải là nhà phát triển ứng dụng */ define('ISDEBUG', true); define('NSENV', 'dev'); define('HTTPURI', ''); define('HTTPURI_EMAIL', 'http://' . $_SERVER['HTTP_HOST']); //ini_set('display_errors', ISDEBUG); // //error_reporting(E_ERROR | E_PARSE); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); /** * Manufaction Registry * Khóa dùng để bảo mật ứng dụng các file source của hệ thống * Vui lòng không xóa bỏ nếu không ứng dụng sẽ không thể chạy */ define('NEWSOFTAUTH', true); //$now = time(); //$leftime = $now - $_SESSION['l']; //if ($leftime < 10) { // $_SESSION['d'] = (int) $_SESSION['d'] + 1; // if ($_SESSION['d'] > 15) // die("Ban thao tac qua nhanh. Vui long nhan F5 de thu lai!"); //}else { // $_SESSION['d'] = 0; //} //$_SESSION['l'] = $now; /** * Root URI sử dụng cho autoload file trên hệ thống * Không thay đổi thuộc tính này nếu không phải là nhà phát triển ứng dụng cao cấp * dirname(__FILE__) tự hiểu là địa chỉ hiện tại * @example Linux : /var/doc/httpd */ define('ROOTURL', dirname(__FILE__)); define('APPURL', ROOTURL . '/application'); /** * Địa chỉ đường dẫn đến thư mục lưu cache * Lưu ý chmod phân quyền write cho thư mục này */ define('CACHEURL', ROOTURL . '/application/cache'); /** * Cấu hình địa chỉ của website trên server thực tế * @example http://demo.newsoft.com.vn/project */ //define('REMOTE', ''); define('REMOTE', ''); define('IMGCDN', 'https://emily.kitewp.com/'); //define('IMGCDN', 'https://tutaylamhet.r.worldssl.net'); define('HOST', 'http://tutaylamhet.quang.appcloud-dev.com/'); /** * Cấu hình địa chỉ của website trên máy người phát triển ứng dụng (Localhost) * @example http://localhost http://192.168.1.102 http://server01 */ define('LOCAL', 'http://localhost:801/maygianhiet'); /** * Cấu hình lệch domain * Cấu hình này để cài đặt tùy theo server và thư mục chứa toàn bộ website */ // Cho môi trường Remote define('SHIFTROUTER_REMOTE', 0); // Cho môi trường Local define('SHIFTROUTER_LOCAL', 1); //Khu vực cấu hình bắt buộc Sử dụng newsoft web framework $domain = str_replace('www.', '', $_SERVER['SERVER_NAME']); $language = "vn"; if ($domain != "khucongnghiepsinhthai-vietnam.vn") { $language = "en"; } if ($domain != "khucongnghiepsinhthai-vietnam.vn") { define('LANGUAGE_MODEL', ""); } else { define('LANGUAGE_MODEL', "_vn"); } if ($domain != "khucongnghiepsinhthai-vietnam.vn") { define('LANGUAGE', "en"); } else { define('LANGUAGE', "vn"); } require 'vendor/autoload.php'; require 'system/core/NewsoftCore.php'; // Định nghĩa STATIC URI cho các file tĩnh của hệ thống dùng biến STATICURI define('STATICURI', '/static'); // Newsoft Library Reusable Bootstrap // @tutorial http://doc.newsoft.com.vn/ncream/bootstrap // Sử dụng jquery fancybox NSLib_CLR::Fancybox(); $_SESSION['pageurl'] = HTTPURI; /** * Xác thực phân quyền truy cập * @tutorial http://doc.newsoft.com.vn/ncream/authpermission */ NS::AF()->setPermission('*'); if ($RUI[0]) { } /** * *************************************************************************** * Định nghĩa các quy tắc router đến các controler thông qua apache rewrite * * **************************************************************************** */ global $RUI; // Không có tham biến nào hoặc truy cập trực tiếp đến index.php if ($RUI[0] == "dev=master") { $_SESSION['debug'] = "true"; } switch ($RUI[0]) { case 'api': NS_Dispatcher::manunal('api', 'index', $RUI); break; case 'admincp': NS_Dispatcher::manunal('admincp', 'index', $RUI); break; default: NS_Dispatcher::manunal('page', $RUI[0], $language); break; } /** * *************************************************************************** * Bắt đầu xử lí dữ liệu * * **************************************************************************** */ ob_clean(); try { // Điểm bắt đầu benmark timer $starttime = microtime(); NS_Dispatcher::dispatch(); $endtime = microtime(); // Điểm dừng benmark timer $t1 = explode(" ", $starttime); $t2 = explode(" ", $endtime); // Báo cáo thông số benmark FB::info($t2[1] + $t2[0] - $t1[1] - $t1[0], 'Time create'); } catch (ClassNotFoundException $e) { if (ISDEBUG) { FB::warn($e, 'Error Class not found Exception'); echo $e->getMessage(); } else { NS_WServiNS::Report($e); } exit(); } catch (Exception $e) { if (ISDEBUG) { FB::warn($e, 'Error Class not found Exception'); echo $e->getMessage(); exit(); } else { NSHelper_Route::Redirect(HTTPURI); exit(); } }