Альтернативный белый список

This commit is contained in:
Origami11 2020-11-02 18:00:14 +03:00
parent 86a180123b
commit 82c129305e
19 changed files with 82 additions and 131 deletions

View file

@ -331,6 +331,7 @@ class Controller_Action
if ($this->view instanceof View_View) {
$this->view->assignValues($this->ctrlValues);
/*.Widgets_Widget.*/$node = null;
foreach ($this->childNodes as $name => $node) {
$node->make($this);
$this->view->setView($name, $node->view);

View file

@ -23,7 +23,8 @@ class ComponentRequest {
if ($key == 'active_page') {
return $this->r->get($key);
}
if ($arr = $this->r->get($key)) {
$arr = $this->r->get($key);
if ($arr !== NULL) {
if (is_array($arr)) {
return Arr::get($arr, $this->component_id, $default);
} else {
@ -127,6 +128,14 @@ class Controller_Component
}
public function getTemplatePath($name) {
/*.Settings.*/$registry = $this->registry;
$template = ($this->template) ? $this->template : $registry->readKey(array('system', 'template'));
foreach ($this->viewPath as $index => $viewPath) {
if(is_dir(Path::join($this->viewPath[$index], 'templates', $template))) {
return Path::join($this->viewPath[$index], 'templates', $template, $name);
}
}
return Path::join($this->viewPath[0], 'templates', 'modern', $name);
}
@ -182,7 +191,7 @@ class Controller_Component
$options = new Form_OptionFactory($this->db, $this->registry);
$settings = $this->getInfo();
$form->addFieldList($settings['parameter'], $options);
$form->addFieldList($settings['parameter'], $options);
$view->form = $form;
$view->component = $settings['component'];
@ -271,10 +280,9 @@ class Controller_Component
if(class_exists("Controller_Site")){ //Если мы в CMS2
$instance = Controller_Site::getInstance();
$instance->componentsConfig[] = $editor;
}else{
} else {
global $componentsConfig;
$componentsConfig[] = $editor;
}
}

View file

@ -5,11 +5,14 @@
*/
class Controller_Service
{
public $viewPath = array();
public $viewPath = [];
public $webPath = [];
public $registry; // Registry->getInstance
public $template;
public $templatePath;
public $COMPONENTS_WEB;
public $db;
public function getTemplatePath($name)
{
@ -58,5 +61,14 @@ class Controller_Service
}
return $result;
}
function getInfo() {
$filename = Path::join($this->viewPath[0], 'install.json');
if (file_exists($filename)) {
$settings = json_decode(File::getContents($filename), true);
return $settings;
}
return array();
}
}