diff --git a/src/Controller/Component.php b/src/Controller/Component.php index d6886f8..8e32e88 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -260,10 +260,16 @@ class Controller_Component $component->parameter = $params; $component->template = $params->get('template', false); - global $componentsConfig; $editor = $component->getEditUrl(); if ($editor) { - $componentsConfig[] = $editor; + if(class_exists("Controller_Site")){ //Если мы в CMS2 + $instance = Controller_Site::getInstance(); + $instance->componentsConfig[] = $editor; + }else{ + global $componentsConfig; + $componentsConfig[] = $editor; + + } } return $component; @@ -308,6 +314,10 @@ class Controller_Component return '?' . http_build_query($arr); } + /** + * @deprecated В CMS2 перенесено в контроллер сайта! + */ + function addRequireJsPath($name, $path, $shim = null) { Controller_Site::addRequireJsPath($name, $path, $shim); } diff --git a/src/Filter/ActionAccess.php b/src/Filter/ActionAccess.php index dc39ba0..7d4936f 100644 --- a/src/Filter/ActionAccess.php +++ b/src/Filter/ActionAccess.php @@ -26,7 +26,8 @@ class Filter_ActionAccess $action = $request->getAction(); if(! $this->checkAction($action)) { $request->set('action', 'index'); - } + $request->setAction('index'); + } return $this->processor->execute($request); } } diff --git a/src/View/Page.php b/src/View/Page.php index acddc60..847061c 100644 --- a/src/View/Page.php +++ b/src/View/Page.php @@ -49,10 +49,14 @@ class View_Page extends View_View { //$result = phptal_component($match, $offset); - //* - global $db, $registry; // Нужно как-то передавать параметры - - $component = Controller_Component::loadComponent($match, $db, $registry); + + if(class_exists("Controller_Site")){ //Если мы в CMS2 + $component = Controller_Site::loadComponent($match); + }else{ + global $db, $registry; // + $component = Controller_Component::loadComponent($match, $db, $registry); + } + $req = new HttpRequest(); unset($req['active_page']); diff --git a/src/tales.php b/src/tales.php index 416263b..5739bef 100644 --- a/src/tales.php +++ b/src/tales.php @@ -45,10 +45,14 @@ function phptal_time ($e) * Функция подключения компонента */ function phptal_component ($expression) { - global $db, $registry; // Нужно как-то передавать параметры - $begin = microtime(true); - $component = Controller_Component::loadComponent($expression, $db, $registry); + + if(class_exists("Controller_Site")){ //Если мы в CMS2 + $component = Controller_Site::loadComponent($expression); + }else{ + global $db, $registry; // Иначе обращаемся к глобальным переменным + $component = Controller_Component::loadComponent($expression, $db, $registry); + } $req = new HttpRequest(); $result = $component->execute($req);