private function _set_routing()
 {
     if (common::config_item('enable_query_strings') === TRUE and isset($_GET[config_item('controller_trigger')])) {
         $this->query_string = TRUE;
         $this->set_directory(trim($this->uri->_filter_uri($_GET[config_item('directory_trigger')])));
         $this->set_class(trim($this->uri->_filter_uri($_GET[config_item('controller_trigger')])));
         if (isset($_GET[config_item('function_trigger')])) {
             $this->set_method(trim($this->uri->_filter_uri($_GET[config_item('function_trigger')])));
         }
         return;
     }
     $this->default_controller = (!isset($this->routes['default_controller']) or $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) {
             throw new Exception("Unable to determine what should be displayed. A default route has not been specified in the routing file.");
         }
         $segments = $this->_validate_request(explode('/', $this->default_controller));
         $this->set_class($segments[1]);
         $this->set_method($this->routes['index_method']);
         // index
         $this->uri->rsegments = $segments;
         $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();
 }
 public function __construct()
 {
     parent::__construct();
     loader::sys_helper('view');
     loader::sys_helper('head_tag');
     $this->base = common::config_item('base_url');
     $this->base_url = common::config_item('base_url') . common::config_item('index_page');
     $this->base_img = common::config_item('source_url') . 'images/';
     $this->meta = meta('Content-type', 'text/html; charset=utf-8', 'equiv');
     $this->meta .= meta('author', 'Eko Heri Susanto');
 }
 public function _remove_url_suffix()
 {
     if (common::config_item('url_suffix') != "") {
         $this->uri_string = preg_replace("|" . preg_quote(config_item('url_suffix')) . "\$|", "", $this->uri_string);
     }
 }
//panggil class inti (core)
require SYS . 'constant' . DS . 'file.php';
require SYS . 'core' . DS . 'common.php';
require SYS . 'error' . DS . 'errors.php';
require SYS . 'libraries' . DS . 'benchmark_library.php';
$benchmark = common::register('Benchmark');
$benchmark->mark('total_execution_time_start');
require SYS . 'core' . DS . 'loader.php';
require SYS . 'core' . DS . 'base.php';
require SYS . 'core' . DS . 'controller.php';
require SYS . 'core' . DS . 'model.php';
require SYS . 'libraries' . DS . 'router_library.php';
require SYS . 'libraries' . DS . 'uri_library.php';
require SYS . 'libraries' . DS . 'output_library.php';
require SYS . 'libraries' . DS . 'config_library.php';
date_default_timezone_set(common::config_item('timezone_set'));
$uri = common::register('Uri');
$router = common::register('Router');
$output = common::register('Output');
if ($output->_display_cache($uri) == TRUE) {
    exit;
}
$GLOBALS['d'] = $router->fetch_directory();
// Get requested directory
$GLOBALS['c'] = $router->fetch_class();
// Get requested controller
$GLOBALS['m'] = $router->fetch_method();
// Get requested method
//panggil default controller pada directory application/controller
if (!file_exists(DIR . $GLOBALS['d'] . DS . 'controllers' . DS . $GLOBALS['c'] . PHP_EXT)) {
    if ($router->query_string) {
 public function _display_cache(&$URI)
 {
     //$cache_path = (common::config_item('cache_path', 'cache') == '') ? APP.'system'.DS.'cache'.DS : common::config_item('cache_path', 'cache');
     $cache_path = APP . 'cache' . DS;
     // Build the file path.  The file name is an MD5 hash of the full URI
     $uri = common::config_item('base_url') . common::config_item('index_page') . $URI->uri_string;
     $filepath = $cache_path . md5($uri);
     if (!@file_exists($filepath)) {
         return FALSE;
     }
     if (!($fp = @fopen($filepath, "r"))) {
         return FALSE;
     }
     flock($fp, LOCK_SH);
     $cache = '';
     if (filesize($filepath) > 0) {
         $cache = fread($fp, filesize($filepath));
     }
     flock($fp, LOCK_UN);
     fclose($fp);
     // Strip out the embedded timestamp
     if (!preg_match("/(\\d+TS--->)/", $cache, $match)) {
         return FALSE;
     }
     // Has the file expired? If so we'll delete it.
     if (time() >= trim(str_replace('TS--->', '', $match['1']))) {
         if (common::is_really_writable($cache_path)) {
             @unlink($filepath);
             //log_message('debug', "Cache file has expired. File deleted");
             return FALSE;
         }
     }
     // Display the cache
     $this->_display(str_replace($match['0'], '', $cache));
     return TRUE;
 }