Skip to content

Commit 7635e44

Browse files
committed
add new function esc() to replace htmlspecialchars(), add DotEnv on Helper.php
1 parent 27fb2df commit 7635e44

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/Libraries/Helper.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
use App\Libraries\DotEnv;
3+
(new DotEnv(BASE_DIR . '/.env'))->load();
24
/**
35
* Generate output in JSON format and terminate the script
46
*
@@ -62,7 +64,7 @@ function view($fileName,$data = null){
6264
if(! function_exists('route')){
6365
function route($route){
6466
if($route == "")
65-
return header("Location: http://localhost/hris");
67+
return header("Location: ".getenv('APP_URL'));
6668
header("Location: $route");
6769
exit();
6870
}
@@ -88,3 +90,7 @@ function notFound(){
8890
header("HTTP/1.1 404 Not Found");
8991
exit("URL not found");
9092
}
93+
94+
function esc($string){
95+
return htmlspecialchars($string);
96+
}

0 commit comments

Comments
 (0)