Skip to content

Commit a2f40ad

Browse files
Merge pull request #12 from infinitybrackets/main
Main
2 parents fa005a0 + a9bf7bc commit a2f40ad

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/Core/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function Run()
6262
echo $this->router->RenderView('layouts/error', [
6363
'message' => $e->getMessage(),
6464
'code' => $errorCode,
65-
'app' => Application::$app->config['app']
65+
'app' => Application::$app->config->app
6666
]);
6767
}
6868
}
@@ -74,7 +74,7 @@ public function Debug($var) {
7474
}
7575

7676
public function LogError($code, $message) {
77-
$db = new Database(Application::$app->config['env']->APP_ENV == 'local' ? 'ils-local' : 'ils-live');
77+
$db = new Database('ils');
7878
$db->InsertOne("exception_logs", ['code', 'message'], [':in_code' => $code, ':in_message' => $message]);
7979
}
8080

src/Core/Request.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ public function GetBody()
9494
return $data;
9595
}
9696

97+
public function GetValue($key = NULL) {
98+
if(is_null($key)) {
99+
return FALSE;
100+
}
101+
$data = $this->GetBody();
102+
if(array_key_exists($key, $data)) {
103+
if(empty($data[$key])) {
104+
return FALSE;
105+
}
106+
return $data[$key];
107+
}
108+
}
109+
97110
/**
98111
* @param $params
99112
* @return self

src/Core/Response.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ public function Redirect($url = NULL)
2020
if(!array_key_exists($url, $router->GetRouteMap(Application::$app->request->GetMethod()))) {
2121
throw new NotFoundException();
2222
}
23-
header("Location: ?view=" . ltrim($url, '/'));
23+
$url = ltrim($url, '/');
24+
if(empty($url)) {
25+
$url = './';
26+
}
27+
header("Location: " . $url);
2428
}
2529

2630
public function RedirectWithConfirmation($url = NULL) {

0 commit comments

Comments
 (0)