mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
added the webui to the tarball
This commit is contained in:
50
webui/system/router.php
Normal file
50
webui/system/router.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
class Router {
|
||||
protected $class;
|
||||
protected $method;
|
||||
protected $args = array();
|
||||
|
||||
|
||||
private function sanitize_path($path){
|
||||
return str_replace('../', '', $path);
|
||||
}
|
||||
|
||||
|
||||
public function __construct($route, $args = array()) {
|
||||
|
||||
$path = $this->sanitize_path($route);
|
||||
|
||||
$file = DIR_APPLICATION . $path . '.php';
|
||||
|
||||
if(is_file($file)){
|
||||
$this->class = $path;
|
||||
}
|
||||
|
||||
if($args){
|
||||
$this->args = $args;
|
||||
}
|
||||
|
||||
$this->method = 'index';
|
||||
}
|
||||
|
||||
|
||||
public function getClass(){
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
|
||||
public function getMethod(){
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
|
||||
public function getArgs(){
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user