Fixes in routers for permissions
This commit is contained in:
parent
fa8277dfc6
commit
840f74f5c6
1 changed files with 27 additions and 5 deletions
|
|
@ -7,6 +7,8 @@ class Config {
|
|||
|
||||
static public $home_module='welcome';
|
||||
|
||||
static public $modules_allowed=['welcome' => false];
|
||||
|
||||
}
|
||||
|
||||
function get_controller($controller, $args=[]) {
|
||||
|
|
@ -49,8 +51,12 @@ function get_route($path_info) {
|
|||
case 1:
|
||||
|
||||
$controller='modules/'.$arr_path[1].'/controllers/index.php';
|
||||
echo 'pepe';
|
||||
if(Config::$modules_allowed[$arr_path[1]]==true) {
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -58,7 +64,11 @@ function get_route($path_info) {
|
|||
|
||||
$controller='modules/'.$arr_path[1].'/controllers/'.$arr_path[2].'.php';
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
if(Config::$modules_allowed[$arr_path[1]]==true) {
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, []);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -66,9 +76,13 @@ function get_route($path_info) {
|
|||
|
||||
$controller='modules/'.$arr_path[1].'/controllers/'.$arr_path[2].'.php';
|
||||
|
||||
$args=array_slice($arr_path, 2, count($arr_path));
|
||||
if(Config::$modules_allowed[$arr_path[1]]==true) {
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, $args);
|
||||
$args=array_slice($arr_path, 2, count($arr_path));
|
||||
|
||||
return \PhangoApp\PhaRouter\get_controller($controller, $args);
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -83,6 +97,14 @@ function get_route($path_info) {
|
|||
|
||||
}
|
||||
|
||||
//If not return, page not found.
|
||||
|
||||
echo 'Page not found';
|
||||
|
||||
http_response_code(404);
|
||||
|
||||
exit(1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue