From d9b6faafc6c833e5b85e4ea9d20a395423b3f2bf Mon Sep 17 00:00:00 2001 From: "origami11@yandex.ru" Date: Fri, 16 Dec 2022 12:38:01 +0300 Subject: [PATCH] =?UTF-8?q?fix=20=D0=94=D0=BE=D0=BF.=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B8=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D1=85=D0=BE=D0=B6?= =?UTF-8?q?=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=82=D0=B5=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Action.php | 7 ++++--- src/Database.php | 4 ++-- src/Settings.php | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Controller/Action.php b/src/Controller/Action.php index ee955f5..2066995 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -14,7 +14,6 @@ use Exception, ctiso\Filter\ActionAccess, ctiso\View\View, ctiso\Controller\State; - /** * Контроллер страниц */ @@ -219,9 +218,11 @@ class Action if ($access == null || $access->checkAction($name)) { $moduleName = explode("\\", strtolower(get_class($this))); - array_shift($moduleName); - if ($moduleName[0] == $moduleName[1]) { + if (count($moduleName) > 2) { array_shift($moduleName); + if ($moduleName[0] == $moduleName[1]) { + array_shift($moduleName); + } } $param = array_merge(array('module' => implode("\\", $moduleName), "action" => $name), $param); diff --git a/src/Database.php b/src/Database.php index b2ac6ca..ad989d7 100644 --- a/src/Database.php +++ b/src/Database.php @@ -48,8 +48,8 @@ class Database/**/ extends PDO static function getConnection(array $dsn) { - if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') { - $port = (isset($dsn['port'])) ? "port={$dsn['port']};" : ""; + if ($dsn['phptype'] == 'pgsql' || $dsn['phptype'] == 'mysql') { + $port = (isset($dsn['port'])) ? "port={$dsn['port']};" : ""; $connection/*: Database*/ = new static("{$dsn['phptype']}:host={$dsn['hostspec']}; $port dbname={$dsn['database']}", $dsn['username'], $dsn['password']); if ($dsn['phptype'] == 'pgsql') { $connection->query('SET client_encoding="UTF-8"'); diff --git a/src/Settings.php b/src/Settings.php index 1325830..d443681 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -46,7 +46,7 @@ class Settings } if (!is_array($settings)) { - throw new Exception($this->file); + throw new Exception('no data in ' . $this->file); } $this->data = $settings;