1 <?php
2
3 if (!defined('GEN_START')) {
4 http_response_code(404);
5 die();
6 }
7
8 ob_start();
9 require_once DIR_SYS . 'core' . DIRECTORY_SEPARATOR . 'log.php';
10 include_once DIR_SYS . 'external' . DIRECTORY_SEPARATOR . 'kint' . DIRECTORY_SEPARATOR . '_main.php';
11 require_once DIR_SYS . 'core' . DIRECTORY_SEPARATOR . 'handler.php';
12
13 spl_autoload_register('\Alo\Handler::autoloader');
14 set_error_handler('\Alo\Handler::error', ini_get('error_reporting'));
15 set_exception_handler('\Alo\Handler::ecxeption');
16
17 18 19 20 21 22 23
24 function get(&$var) {
25 return isset($var) ? $var : null;
26 }
27
28 29 30 31 32
33 function debug() {
34 if (!Kint::enabled()) {
35 return null;
36 } else {
37 ob_start();
38 $args = func_get_args();
39 call_user_func_array(['Kint', 'dump'], $args);
40
41 return ob_get_clean();
42 }
43 }
44
45 46 47 48 49 50
51 function server_is_windows() {
52 return substr(strtoupper(php_uname('s')), 0, 3) === 'WIN';
53 }
54
55 56 57 58 59
60 function lite_debug() {
61 if (!Kint::enabled()) {
62 return '';
63 } else {
64 ob_start();
65 $argv = func_get_args();
66 echo '<pre>';
67 foreach ($argv as $k => $v) {
68 $k && print("\n\n");
69 echo kintLite($v);
70 }
71 echo '</pre>' . "\n";
72
73 return ob_get_clean();
74 }
75 }
76
77 78 79 80 81 82 83
84 function timestamp_precise($microtime = null) {
85 if (!$microtime) {
86 $microtime = microtime(true);
87 }
88 $t = explode('.', $microtime);
89
90 return date('Y-m-d H:i:s', $t[0]) . ':' . round($t[1] / 10);
91 }
92
93 if (!function_exists('getallheaders')) {
94
95 96 97 98 99 100
101 function getallheaders() {
102 $headers = [];
103 foreach ($_SERVER as $name => $value) {
104 if (substr($name, 0, 5) == 'HTTP_') {
105 $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
106 }
107 }
108
109 return $headers;
110 }
111 }
112
113 require_once DIR_SYS . 'core' . DIRECTORY_SEPARATOR . 'alo.php';
114
115 if (!defined('PHPUNIT_RUNNING')) {
116 Alo::$router = new Alo\Controller\Router();
117 Alo::$router->init();
118 }