Beispiel #1
0
 public static function process($route, $type)
 {
     $sammy = static::instance();
     // Check for ajax
     if ($type == 'XMLHttpRequest') {
         $sammy->method = isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? $_SERVER['HTTP_X_REQUESTED_WITH'] : 'GET';
     }
     if (static::$route_found || (!preg_match('@^' . $route . '(?:\\.(\\w+))?$@uD', $sammy->uri, $matches) || $sammy->method != $type)) {
         return false;
     }
     //Define Parameter
     if (isset($matches[1])) {
         $params = explode('/', $matches[1]);
     } else {
         $params = null;
     }
     static::$route_found = true;
     Map::dispatch($params);
 }
Beispiel #2
0
 public static function process($route, $type)
 {
     $sammy = static::instance();
     // Check for ajax
     if ($type == 'XMLHttpRequest') {
         $sammy->method = isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? $_SERVER['HTTP_X_REQUESTED_WITH'] : 'GET';
     }
     if (static::$route_found || (!preg_match('@^' . $route . '(?:\\.(\\w+))?$@uD', $sammy->uri, $matches) || $sammy->method != $type)) {
         return false;
     }
     // Get the extension
     $extension = $matches[count($matches) - 1];
     $extension_test = substr($sammy->uri, -(strlen($extension) + 1), strlen($extension) + 1);
     if ($extension_test == '.' . $extension) {
         $sammy->format = $extension;
     } else {
         $sammy->format = 'html';
     }
     static::$route_found = true;
     Map::dispatch($sammy->format);
 }
Beispiel #3
0
}
if (isset($argv[4])) {
    $action = $argv[4];
}
if (isset($argv[5])) {
    $params[0] = $argv[5];
}
if (isset($argv[6])) {
    $params[1] = $argv[6];
}
$dir = '../textsite/';
$textsiteDir = $dir . $projectName . '/' . $siteDirName . '/';
$configPath = $textsiteDir . 'config/config.php';
if (!file_exists($configPath)) {
    die("config file does not exitst");
}
include $configPath;
extract($cfg);
$scArr = explode('#', $statcounter);
$sc_project = $scArr[0];
$sc_security = $scArr[1];
include $textsiteDir . 'config/define-site-config.php';
include $textsiteDir . 'libs/initvars.php';
include $textsiteDir . 'libs/object.php';
include $textsiteDir . 'libs/controller.php';
include $textsiteDir . 'libs/component.php';
include $textsiteDir . 'libs/cache.php';
include $textsiteDir . 'libs/helper.php';
include 'router.php';
Map::dispatch($controller, $action, $params);