Deprecated: Optional parameter $level declared before required parameter $message is implicitly treated as a required parameter in /home/u850506330/domains/high-voltage-lab.com/public_html/system/codeigniter/Common.php on line 157
class CI_Router {
public $config;
public $routes = [];
public $error_routes = [];
public $class = '';
public $method = 'index';
public $directory = '';
public $uri_protocol = 'auto';
public $default_controller;
public $scaffolding_request = FALSE;
public function __construct()
{
$this->config = load_class('Config');
$this->uri = load_class('URI');
$this->_set_routing();
log_message('debug', "Router Class Initialized");
}
private function _set_routing()
{
// Load routes
@include(APPPATH.'config/routes'.EXT);
$this->routes = (!isset($route) || !is_array($route)) ? [] : $route;
unset($route);
$this->default_controller = (!isset($this->routes['default_controller']) || $this->routes['default_controller'] === '') ? FALSE : strtolower($this->routes['default_controller']);
$this->uri->_fetch_uri_string();
if ($this->uri->uri_string === '') {
if ($this->default_controller === FALSE) {
show_error("Unable to determine what should be displayed. A default route has not been specified in the routing file.");
}
$this->set_class($this->default_controller);
$this->set_method('index');
$this->_set_request([$this->default_controller, 'index']);
$this->uri->_reindex_segments();
log_message('debug', "No URI present. Default controller set.");
return;
}
unset($this->routes['default_controller']);
$this->uri->_remove_url_suffix();
$this->uri->_explode_segments();
$this->_parse_routes();
$this->uri->_reindex_segments();
}
private function _validate_request($segments)
{
if (!isset($segments[0]) || $segments[0] === '' || $segments[0] === null) {
if ($this->default_controller === FALSE) {
show_error("Unable to determine what should be displayed. A default route has not been specified.");
}
return [$this->default_controller, 'index'];
}
if (file_exists(APPPATH.'controllers/'.$segments[0].EXT)) return $segments;
if (is_dir(APPPATH.'controllers/'.$segments[0])) {
$this->set_directory($segments[0]);
$segments = array_slice($segments, 1);
if (count($segments) > 0) {
if (!file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT)) {
show_404($this->fetch_directory().$segments[0]);
}
} else {
if ($this->default_controller !== FALSE && file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT)) {
return [$this->default_controller, 'index'];
}
$this->directory = '';
return [];
}
return $segments;
}
show_404($segments[0]);
}
public function set_class($class) { $this->class = $class; }
public function fetch_class() { return $this->class; }
public function set_method($method) { $this->method = $method; }
public function fetch_method() { return $this->method === $this->class ? 'index' : $this->method; }
public function set_directory($dir) { $this->directory = $dir.'/'; }
public function fetch_directory() { return $this->directory; }
// ...keep the rest (_set_request, _parse_routes) as in original
}
Fatal error: Uncaught Error: Class "CI_Router" not found in /home/u850506330/domains/high-voltage-lab.com/public_html/system/codeigniter/Common.php:89
Stack trace:
#0 /home/u850506330/domains/high-voltage-lab.com/public_html/system/codeigniter/CodeIgniter.php(33): load_class()
#1 /home/u850506330/domains/high-voltage-lab.com/public_html/index.php(134): require_once('/home/u85050633...')
#2 {main}
thrown in /home/u850506330/domains/high-voltage-lab.com/public_html/system/codeigniter/Common.php on line 89