application->docroot as $docroot) { $path = $docroot . substr($uri, 3); if (is_file($path)) { $tmp_ext = explode('.', strtolower($path)); $mimeTypes = [ 'css' => 'text/css', 'js' => 'application/javascript', 'jpg' => 'image/jpg', 'png' => 'image/png', 'svg' => 'image/svg+xml', 'map' => 'application/json' ]; if (isset($mimeTypes[$tmp_ext[count($tmp_ext)-1]])) { header("Content-Type: {$mimeTypes[$tmp_ext[count($tmp_ext)-1]]}"); } readfile($path); return true; } } } return false; } } // set user to root for local testing session_start(); $_SESSION["Username"]="root"; session_write_close(); if (PHP_OS == 'WINNT') { // Windows doesn't know syslog facility LOCAL4 define("LOG_LOCAL4", LOG_USER); } // handle requests if (preg_match("/^\/ui\/.*/", $uri)) { require_once "{$DEV_WORKDIR}/stubs/index.php"; } elseif (preg_match("/^\/api\/.*/", $uri)) { require_once "{$DEV_WORKDIR}/stubs/api.php"; } else { header('Location: /ui/'); return true; }