diff --git a/src/Core/Application.php b/src/Core/Application.php index f20426a..f6605e9 100644 --- a/src/Core/Application.php +++ b/src/Core/Application.php @@ -62,7 +62,7 @@ public function Run() echo $this->router->RenderView('layouts/error', [ 'message' => $e->getMessage(), 'code' => $errorCode, - 'app' => Application::$app->config['app'] + 'app' => Application::$app->config->app ]); } } @@ -74,7 +74,7 @@ public function Debug($var) { } public function LogError($code, $message) { - $db = new Database(Application::$app->config['env']->APP_ENV == 'local' ? 'ils-local' : 'ils-live'); + $db = new Database('ils'); $db->InsertOne("exception_logs", ['code', 'message'], [':in_code' => $code, ':in_message' => $message]); } diff --git a/src/Core/Request.php b/src/Core/Request.php index a04e706..a79b952 100644 --- a/src/Core/Request.php +++ b/src/Core/Request.php @@ -94,6 +94,19 @@ public function GetBody() return $data; } + public function GetValue($key = NULL) { + if(is_null($key)) { + return FALSE; + } + $data = $this->GetBody(); + if(array_key_exists($key, $data)) { + if(empty($data[$key])) { + return FALSE; + } + return $data[$key]; + } + } + /** * @param $params * @return self diff --git a/src/Core/Response.php b/src/Core/Response.php index fe875ff..d8409ec 100644 --- a/src/Core/Response.php +++ b/src/Core/Response.php @@ -20,7 +20,11 @@ public function Redirect($url = NULL) if(!array_key_exists($url, $router->GetRouteMap(Application::$app->request->GetMethod()))) { throw new NotFoundException(); } - header("Location: ?view=" . ltrim($url, '/')); + $url = ltrim($url, '/'); + if(empty($url)) { + $url = './'; + } + header("Location: " . $url); } public function RedirectWithConfirmation($url = NULL) {