From c2b9254fd0b1bab0c1525cc86c782214b9b243b7 Mon Sep 17 00:00:00 2001 From: "CORP\\phedor" Date: Mon, 23 Apr 2018 11:18:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D1=85=D0=BE=D0=B6=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=B2=D1=82=D1=80=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Action.php | 5 +++-- src/File.php | 2 +- src/Filter/ActionLogger.php | 1 + src/Model/Factory.php | 10 +++++----- src/Settings.php | 2 +- src/Url.php | 2 +- src/View/Composite.php | 4 ++-- src/View/Top.php | 2 +- src/View/View.php | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/Controller/Action.php b/src/Controller/Action.php index be0dfb8..34137af 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -110,8 +110,8 @@ class Action { $file = $name . self::TEMPLATE_EXTENSION; - $basePath = $this->config->get('site', 'path'); - $webPath = $this->config->get('site', 'web'); + $basePath = $this->config->get('system', 'path'); + $webPath = $this->config->get('system', 'web'); $list = array( Path::join($this->modulePath, 'templates', $this->viewPathPrefix) => Path::join($webPath, "modules", $this->name, 'templates', $this->viewPathPrefix), @@ -125,6 +125,7 @@ class Action } /*.Composite.*/$tpl = new $viewClass($template); + $tpl->config = $this->config; $stylePath = Path::join($webPath, "assets", "css"); $iconsPath = Path::join($webPath, 'icons'); diff --git a/src/File.php b/src/File.php index 5de7429..c523cf6 100644 --- a/src/File.php +++ b/src/File.php @@ -5,7 +5,7 @@ use Exception; class File { static function getContents($filename) { - $buffer = file_get_contents($filename); + $buffer = @file_get_contents($filename); if ($buffer !== false) { return $buffer; } diff --git a/src/Filter/ActionLogger.php b/src/Filter/ActionLogger.php index 93c11e7..403d3b0 100644 --- a/src/Filter/ActionLogger.php +++ b/src/Filter/ActionLogger.php @@ -15,6 +15,7 @@ class ActionLogger function __construct(/*.Filter.*/$processor, $logPath, $user) { $this->processor = $processor; $this->user = $user; + $file = fopen($logPath, "a"); if (is_resource($file)) { $this->file = $file; diff --git a/src/Model/Factory.php b/src/Model/Factory.php index 2e57587..577b826 100644 --- a/src/Model/Factory.php +++ b/src/Model/Factory.php @@ -1,19 +1,19 @@ db = $db; - $this->_registry = $_registry; + $this->config = $config; } /** @@ -27,7 +27,7 @@ class Factory $model = new $modelName(); $model->db = $this->db; $model->factory = $this; - $model->_registry = $this->_registry; + $model->config = $this->config; $model->setUp(); // return $model; diff --git a/src/Settings.php b/src/Settings.php index 5ea6a52..4bd7ee5 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -15,7 +15,7 @@ use ctiso\File, class Settings { - public $data; + public $data = []; protected $file; protected $format = 'php'; diff --git a/src/Url.php b/src/Url.php index a7b16fd..5c824ab 100644 --- a/src/Url.php +++ b/src/Url.php @@ -22,6 +22,6 @@ class Url { } function toString() { - return '?' . http_build_query(array_merge($this->parts, $this->parent->parts)); + return '?' . http_build_query(array_merge($this->parts, $this->parent ? $this->parent->parts : [])); } } \ No newline at end of file diff --git a/src/View/Composite.php b/src/View/Composite.php index 8be63fc..ff659ef 100644 --- a/src/View/Composite.php +++ b/src/View/Composite.php @@ -11,6 +11,7 @@ use ctiso\View\View, class Composite extends View { private $tal; + public $config; function __construct($file) { @@ -18,7 +19,7 @@ class Composite extends View $this->tal = new PHPTAL($file); $this->tal->setPhpCodeDestination(PHPTAL_PHP_CODE_DESTINATION); - $this->tal->setEncoding(PHPTAL_DEFAULT_ENCODING); // PHPTAL_DEFAULT_ENCODING !! + $this->tal->setEncoding(PHPTAL_DEFAULT_ENCODING); $this->tal->setTemplateRepository(PHPTAL_TEMPLATE_REPOSITORY); $this->tal->setOutputMode(PHPTAL::HTML5); $this->tal->stripComments(true); @@ -39,7 +40,6 @@ class Composite extends View function execute() { parent::execute(); - // postProcess return $this->tal->execute(); } diff --git a/src/View/Top.php b/src/View/Top.php index 47d1a2c..08051f0 100644 --- a/src/View/Top.php +++ b/src/View/Top.php @@ -120,7 +120,7 @@ class Top extends Composite { $this->set('deps', implode(",", array_values($this->require))); $this->set('title', $this->getTitle()); - $this->set('jspath', enableHttps($this->config->get('system', 'web'))); + $this->set('jspath', $this->config->get('system', 'web')); // return $this->execute(); // execute+phptal ?? } diff --git a/src/View/View.php b/src/View/View.php index 5955112..ab8aff9 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -205,4 +205,4 @@ class View } return $result; } -} \ No newline at end of file +}