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;