示例#1
0
 function Controller($rewrite = false, $htaccess = false)
 {
     parent::__construct();
     global $cfg;
     $this->lang = $this->lang ? $this->lang : $cfg["lang"];
     $this->uri = rtrim($_SERVER[$GLOBALS['cfg']['server_var']], '\\/') . '/';
     $this->domain = 'http' . (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) != 'OFF' ? 's' : '') . '://' . $_SERVER['SERVER_NAME'];
     $project = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/') . '/';
     if ($rewrite) {
         if ($htaccess === true) {
             $this->root_dir = './';
             $this->uri = str_replace("index.php/", "", strtok($this->uri, "?"));
             $this->root_dir_absolute = $project;
             if ($project != '/') {
                 $this->params = explode('/', str_replace($project, '', $this->uri));
             } else {
                 $this->params = explode('/', ltrim($this->uri, '/'));
             }
         } else {
             $file = $htaccess === false ? 'index.php' : $htaccess;
             $tmp = explode('/' . $file . '/', strtok($this->uri, "?"));
             $this->params = explode('/', rtrim($tmp[1], "/"));
             $this->root_dir = "./{$file}/";
             $this->root_dir_absolute = "{$project}{$file}/";
         }
         if ($this->params[0]) {
             $arrmod = pathinfo($this->params[0]);
             $this->module = $arrmod["filename"];
         }
         if (isset($this->params[1])) {
             $arrmod = pathinfo($this->params[1]);
             $this->action = $arrmod["filename"];
         }
     } else {
         if (isset($_GET['mod'])) {
             $this->module = $_GET['mod'];
         }
         if (isset($_GET['act'])) {
             $this->action = $_GET['act'];
         }
     }
     $this->module_name = $this->module;
     $this->project = $project;
 }
示例#2
0
文件: _db.php 项目: ngukho/mvc-cms
 function limit($sql, $start, $limit)
 {
     return parent::limit($sql, $start, $limit);
 }