diff --git a/src/Controller/Action.php b/src/Controller/Action.php index 73ef7aa..3ccfa11 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -14,7 +14,7 @@ use Exception, /** * Контроллер страниц */ -class Action +class Action implements ActionInterface { const TEMPLATE_EXTENSION = ".html"; // Расширение для шаблонов @@ -35,7 +35,7 @@ class Action public Database $db; // Фильтры - /** @var ?ActionAccess */ + /** @var ?\ctiso\Filter\ActionAccess */ public $access = null; // Обьект хранит параметры доступа public $logger = null; // Обьект для ведения лога @@ -220,7 +220,6 @@ class Action $access = $this->access; $url = new Url(); - //print_r([$name, $param]); if ($access == null || $access->checkAction($actionName)) { $moduleName = explode("\\", strtolower(get_class($this))); if (count($moduleName) > 2) { diff --git a/src/Controller/ActionInterface.php b/src/Controller/ActionInterface.php new file mode 100644 index 0000000..e932c97 --- /dev/null +++ b/src/Controller/ActionInterface.php @@ -0,0 +1,11 @@ + 0); + assert($index > 0); $offset = $this->getRows() + 1; $this->setRow($offset, $index, $data); diff --git a/src/Filter/ActionAccess.php b/src/Filter/ActionAccess.php index 9e05a73..706efc1 100644 --- a/src/Filter/ActionAccess.php +++ b/src/Filter/ActionAccess.php @@ -16,7 +16,7 @@ class ActionAccess public $user; /** - * @param Filter $processor + * @param FilterInterface $processor */ function __construct($processor, $user) { $this->processor = $processor; diff --git a/src/Filter/ActionLogger.php b/src/Filter/ActionLogger.php index 9b07344..73ea856 100644 --- a/src/Filter/ActionLogger.php +++ b/src/Filter/ActionLogger.php @@ -5,7 +5,7 @@ use ctiso\Role\UserInterface, ctiso\HttpRequest; /* Переделать формат Логов на список json */ -class ActionLogger +class ActionLogger implements FilterInterface { public $before = array(); public $file; @@ -14,9 +14,9 @@ class ActionLogger public $processor; /** - * @param $processor Filter - * @param $logPath string - * @param $user UserInterface + * @param \ctiso\Controller\ActionInterface $processor + * @param string $logPath + * @param UserInterface $user */ function __construct($processor, $logPath, $user) { $this->processor = $processor; diff --git a/src/Filter/Filter.php b/src/Filter/Filter.php index afa35b5..da34f8e 100644 --- a/src/Filter/Filter.php +++ b/src/Filter/Filter.php @@ -8,13 +8,13 @@ namespace ctiso\Filter; use ctiso\Controller\Action, ctiso\HttpRequest; -class Filter +class Filter implements \ctiso\Controller\ActionInterface { - /** @var Action */ + /** @var \ctiso\Controller\ActionInterface */ public $processor; /** - * @param Action $processor + * @param \ctiso\Controller\ActionInterface $processor */ public function __construct($processor) { @@ -26,7 +26,7 @@ class Filter return $this->processor->execute($request); } - public function getView($name, $class = 'ctiso\\View\\Top') + public function getView($name, $class = \ctiso\View\Top::class) { return $this->processor->getView($name, $class); } @@ -35,4 +35,8 @@ class Filter { return $this->processor->getConnection(); } + + public function addUrlPart($key, $value) { + $this->processor->addUrlPart($key, $value); + } } diff --git a/src/Filter/FilterInterface.php b/src/Filter/FilterInterface.php new file mode 100644 index 0000000..075b80f --- /dev/null +++ b/src/Filter/FilterInterface.php @@ -0,0 +1,8 @@ +set('lastupdate', true); return false; }*/ - // Проверка на количества попыток авторизации + // Проверка на количества попыток авторизации $lastAttempt = $result; if ($lastAttempt->get('trie_count') >= self::AUTH_MAX_ATTEMPT /*&& time() - $lastAttempt['trie_time'] < self::AUTH_LAST_ATTEMPT_TIMER*/) { @@ -100,7 +100,7 @@ class Login extends Filter $result = $this->role->getUserByLogin($login); // Поиск по логину if ($result) { $temp = md5($result->getString('password') . $result->getString('login') . $result->getString('sid')); - if ($password == $temp) { + if ($password == $temp) { $this->enter($result); return true; } @@ -125,7 +125,7 @@ class Login extends Filter return false; } - private function enter($result) + private function enter($result) { $this->user = $result; $random = rand(0, 1024 * 1024); diff --git a/src/Functions.php b/src/Functions.php index 68d6a08..3fed5a4 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -223,7 +223,7 @@ class Functions { * @example key_values('a', array(1 => array('a' => 1, 'b' => 2))) => array(1) * * @param string $key - * @param array|ArrayIterator $array + * @param array|\ArrayIterator $array * @return mixed */ static function key_values($key, $array) { @@ -237,7 +237,7 @@ class Functions { /** * @param string $key - * @param array|ArrayIterator $array + * @param array|\ArrayIterator $array */ static function key_values_object($key, $array) { $result = [];