Example #1
0
 /**
  * forward<br/>
  * ex) $this->forward_to('/main/index/1');
  * @see public/codeseed.php 
  */
 public function forward_to($where)
 {
     // parse path
     $path = parse_url_path($where);
     if (empty($path[1])) {
         $path[1] = Config::get('default_controller');
     }
     if (empty($path[2])) {
         $path[2] = Config::get('default_action');
     }
     $controller_path = $path[1];
     $action_path = $path[2];
     if (file_exists(Config::get('help_dir') . '/' . $controller_path . '.php')) {
         require_once Config::get('help_dir') . '/' . $controller_path . '.php';
     }
     $controller_name = under_to_camel($controller_path . '_controller');
     $controller = new $controller_name();
     // reserve controller and action name
     $controller->controller_name = $this->controller_name;
     $controller->action_name = $this->action_name;
     // execute request
     call_user_func(array($controller, 'before_filter'));
     call_user_func_array(array($controller, $action_path), refine_params(array_slice($path, 3)));
     call_user_func(array($controller, 'after_filter'));
     if (file_exists(Config::get('view_dir') . '/' . $controller_path . '/' . $action_path . '.php')) {
         call_user_func_array(array($controller, 'load_view'), array($controller_path . '/' . $action_path));
     }
     $this->skip();
 }
Example #2
0
//header('P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
//header('P3P: CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"');
session_start();
// init flash
$flash = Context::get('flash');
$flash->load();
// routing
Log::debug(_server('REQUEST_METHOD') . ' ' . _server('PATH_INFO'));
// make contents
ob_start();
try {
    /**
     * @see Controller.forward_to()
     */
    // parse path
    $path = parse_url_path(_server('PATH_INFO'));
    if (empty($path[1])) {
        $path[1] = Config::get('default_controller');
    }
    if (empty($path[2])) {
        $path[2] = Config::get('default_action');
    }
    $controller_path = $path[1];
    $action_path = $path[2];
    if (file_exists(Config::get('help_dir') . '/' . $controller_path . '.php')) {
        require_once Config::get('help_dir') . '/' . $controller_path . '.php';
    }
    $controller_name = under_to_camel($controller_path . '_controller');
    $controller = new $controller_name();
    // set action name
    $controller->controller_name = $controller_name;
Example #3
0
    //Check for Other Pages
    if (isset($path_arr[1]) && $path_arr[1] != "" && (isset($path_arr[2]) && $path_arr[2] == "" || !isset($path_arr[2])) && count($path_arr) <= 3) {
        $path_bits = explode('-', $path_arr[1]);
        if (isset($path_bits[0]) && $path_bits[0] != "") {
            $stat_type = $path_bits[0];
            if (isset($path_bits[1]) && $path_bits[1] != "" && !isset($path_bits[2])) {
                // If true, this is a Stats Page
                $stat_id = $path_bits[1];
                return array('page_type' => 'stat', 'stat_type' => $stat_type, 'stat_id' => $stat_id);
                //Return the stat type and stat id
            }
        }
    }
    return array('page_type' => '404');
}
$parsed_url = parse_url_path(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
//Include relevant stat page php file if that is the page type
if ($parsed_url['page_type'] == 'stat') {
    if (array_search(strtolower($parsed_url['stat_type']), array_map('strtolower', $stat_types)) !== false) {
        $_GET['id'] = $parsed_url['stat_id'];
        include_once $parsed_url['stat_type'] . '.php';
    }
} else {
    if ($parsed_url['page_type'] == 'home') {
        if (isset($_GET['q']) && $_GET['q'] != '') {
            include_once 'search.php';
        } else {
            include_once 'main.php';
        }
    } else {
        include_once '404.php';