mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
85 lines
1.9 KiB
PHP
85 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
class Test extends BaseController
|
|
{
|
|
|
|
|
|
function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$request = \Config\Services::request();
|
|
$uri = 'https://sk-jjo.imnavajas.es/tarifas';
|
|
|
|
$language = \Config\Services::language();
|
|
$language->setLocale(session()->lang);
|
|
|
|
$getWhiteList = $this->whiteListController();
|
|
|
|
foreach ($getWhiteList as $item){
|
|
if(strtolower($item) == $uri->getSegment(1)){
|
|
return true;
|
|
}
|
|
}
|
|
|
|
$getRules = json_decode(session()->get('rules')??'[]');
|
|
|
|
foreach ($this->whiteListMethod() as $item){
|
|
if(strtolower($item) == $uri->getSegment(2)){
|
|
return true;
|
|
}
|
|
}
|
|
|
|
foreach ($getRules as $key=>$value){
|
|
if(strtolower($key) == $uri->getSegment(1)){
|
|
if($uri->getTotalSegments() <= 1){
|
|
return true;
|
|
}
|
|
foreach ($value as $item){
|
|
if(strtolower($item) == $uri->getSegment(2)){
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
session()->setFlashdata('sweet', ['error',lang("App.dashboard_alert_rules")]);
|
|
header('Location: /home');
|
|
exit();
|
|
|
|
echo '<pre>';
|
|
var_dump($controllers);
|
|
echo '</pre>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns the white list of allowed controllers.
|
|
*/
|
|
public function whiteListController(){
|
|
return [
|
|
'',
|
|
'BaseController',
|
|
'Home',
|
|
'Login',
|
|
'Oauth',
|
|
'Language',
|
|
'Api',
|
|
'Cron',
|
|
'lang',
|
|
'Ajax',
|
|
'Integration',
|
|
'Migrate',
|
|
'Test',
|
|
|
|
];
|
|
}
|
|
}
|