From 9345b8d27e1b8032998bb76e97b44de5511adf09 Mon Sep 17 00:00:00 2001 From: akulikov Date: Mon, 29 Dec 2008 16:16:58 +0000 Subject: [PATCH] News admin panel git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@39 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/Model.class.php | 5 ++++- classes/Router.class.php | 16 +--------------- init/init.inc.php | 8 ++++++-- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/classes/Model.class.php b/classes/Model.class.php index 00ebefb..e2b20a8 100644 --- a/classes/Model.class.php +++ b/classes/Model.class.php @@ -113,7 +113,10 @@ abstract class Model function getList($limit = false, $sort = 'ASC') { - return $this->query('SELECT * FROM '.$this->table.' ORDER BY '.$this->primary_key.' '.($sort == 'ASC' ? 'ASC' : 'DESC').($limit === false ? ' LIMIT '.(int) $limit : '')); + return $this->query('SELECT * + FROM '.$this->table.' + ORDER BY '.$this->primary_key.' '.($sort == 'ASC' ? 'ASC' : 'DESC') + .($limit !== false ? ' LIMIT '.(int) $limit : ''))->fetchAll(); } } diff --git a/classes/Router.class.php b/classes/Router.class.php index a207549..d866511 100644 --- a/classes/Router.class.php +++ b/classes/Router.class.php @@ -56,10 +56,6 @@ final class Router */ function proccess($path) { - if(self::getRewriteBase()){ - $path = trim(ltrim($path, self::getRewriteBase()), '/'); - } - $path = explode('/', $path); foreach($this->routes as $name => $route) { @@ -73,21 +69,11 @@ final class Router throw new StaticPageException(E_404); } - static public function setRewriteBase($value = '') - { - self::$rewrite_base = $value; - } - - static public function getRewriteBase() - { - return self::$rewrite_base; - } - static public function setDefaultDecorator($decorator) { self::$decorator = $decorator.DECORATOR_POSTFIX; } - + static public function getRouteName() { return self::$route_name; diff --git a/init/init.inc.php b/init/init.inc.php index d979ac7..010bf59 100644 --- a/init/init.inc.php +++ b/init/init.inc.php @@ -13,8 +13,12 @@ require('sys.inc.php'); $path = explode('?', Env::Server('REQUEST_URI')); -define('MJ_PATH', trim($path[0], '/')); -define('MJ_URL', "/".MJ_PATH."/"); +$path = trim($path[0], '/'); +define('MJ_URL', '/'.$path.'/'); +if (defined('PATH_TRIM') && PATH_TRIM != '' && strpos($path, PATH_TRIM) === 0) { + $path = substr($path, strlen(PATH_TRIM) + 1); +} +define('MJ_PATH', $path); unset($path); require(CONFIG_PATH.'/routers.inc.php');