/** * center * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Center * @author Henry Ruhs */ function center() { Redaxscript\Hook::trigger(__FUNCTION__ . '_start'); /* center break */ if (CENTER_BREAK == 1 || Redaxscript\Registry::get('centerBreak') == 1) { return; } else { routing(); } Redaxscript\Hook::trigger(__FUNCTION__ . '_end'); }
function init() { global $config; $root = str_replace("/index.php", "", $_SERVER["SCRIPT_FILENAME"]); $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://"; $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; $subdir = str_replace("/index.php", "", $_SERVER['SCRIPT_NAME']); $path = $protocol . $host . $subdir; $config["root"] = $root; $config["path"] = $path; routing(); }
<?php /* * Initialize website * */ /* * Require Routing which then calls the hooks */ require_once ROOT . DS . 'boot' . DS . 'routing.php'; require_once ROOT . DS . 'boot' . DS . 'autoload.php'; require_once ROOT . DS . 'boot' . DS . 'checks.php'; //start session; Auth::startSession(); routing($url);
/** * Hook * @param $routes * @param $default * @return none */ function hook($routes, $translate){ $url = routing($routes); //Controller $controller = $url['route']['controller']; //Action $action = $url['route']['action'].'Action'; //Layout $layout = $url['route']['layout']; //Controller class name $controllerName = ucfirst($controller)."Controller"; //Controller file name $controllerFile = ucfirst($controller)."Controller.php"; $dispacher = new $controllerName($controller, $action, $layout); spl_autoload_register('\imagineLoader'); //Check if exitsts if((int)method_exists($controllerName, $action)){ call_user_func_array(array($dispacher,"beforeAction"), array('params' => $url['params'], '_t'=>$translate)); call_user_func_array(array($dispacher, $action), array('params' => $url['params'])); call_user_func_array(array($dispacher,"afterAction"), array('params' => $url['params'])); } }
<?php /** * write by vyouzhi */ include_once 'bootstrap.php'; $router = new AltoRouter(); $router->setBasePath(ROOT); foreach ($routeMap as $value) { $router->map($value['method'], $value['uri'], $value['params'], $value['module']); } $router->AutoLoad(); $match = $router->match(); $router->httpCode301(); //$router->httpCode404($match); routing($match['action']); if (class_exists($match['action'])) { $show = new $match['action'](); $show->Show(); } else { require_once Lib . '/error/e404.php'; $show = new e404(); $show->Show(); //如果没有就直接 404 //$router->httpCode404(false); } ?>
/******************************************************************************* Main File *******************************************************************************/ import('libs/cores/version.php'); import('libs/cores/rand.php'); import('libs/cores/regexp.php'); import('libs/cores/info.php'); import('libs/cores/db.php'); import('libs/cores/test.php'); bootstrap(); session(); database(); normalize(); routing(); if (LOGGING_GET) { logging('get'); } if (LOGGING_POST && !empty($_POST)) { logging('post'); } if (LOGGING_FILES && !empty($_FILES)) { logging('files'); } switch ($_REQUEST['_mode']) { case 'info_php': info_php(); break; case 'info_levis': info_levis();
/** * Hook * @param $routes * @param $default * @return none */ function hook($routes){ $url = routing($routes); //Controller $controller = $url['route']['controller']; //Action $action = $url['route']['action']; //Layout $layout = $url['route']['layout']; //Controller class name $controllerName = ucfirst($controller)."Controller"; //Controller file name $controllerFile = strtolower($controller)."Controller.class.php"; //Call default controller if(file_exists('library'.DS.'controller.class.php')) require_once 'library'.DS.'controller.class.php'; //Call controller for required page if(file_exists(CONTROLLER_PATH.$controllerFile)) require_once CONTROLLER_PATH.$controllerFile; $dispacher = new $controllerName($controller, $action, $layout); //Check if exitsts if((int)method_exists($controllerName, $action)) call_user_func_array(array($dispacher, $action), array('params' => $url['params'])); }
/** * * @name common * @param $arg * @package inclue default common lib */ private function common($arg = null) { global $BASETHEME_COMMON_ACTION; if ($arg && $this->ajax == 0) { routing($arg); if (class_exists($arg)) { $v = new $arg(); if (get_parent_class($v) == "BaseModule" && $BASETHEME_COMMON_ACTION) { $v->filter(); } } } }
{ $params = array(); if (!empty($_POST)) { if (get_magic_quotes_gpc() == 1) { //echo "1"; $params = array_merge($params, stripslashes_array($_POST)); } else { //echo "2"; $params = array_merge($params, $_POST); } } if (!empty($_GET)) { if (get_magic_quotes_gpc() == 1) { $params = array_merge($params, stripslashes_array($_GET)); } else { $params = array_merge($params, $_GET); } } return $params; } function stripslashes_array($value) { if (is_array($value)) { $value = array_map("stripslashes_array", $value); } else { $value = stripslashes($value); } return $value; } routing($routes);