From d63cb2913f1eb9007c87532e062a6e3560152c7a Mon Sep 17 00:00:00 2001 From: "CORP\\phedor" Date: Wed, 21 Feb 2018 13:50:55 +0300 Subject: [PATCH 1/8] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D1=81=D0=BB?= =?UTF-8?q?=D0=B8=D1=8F=D0=BD=D0=B8=D0=B8=20=D0=BF=D1=83=D1=82=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Filter/Filter.php | 2 +- src/Path.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Filter/Filter.php b/src/Filter/Filter.php index 8140e8f..e5135dc 100644 --- a/src/Filter/Filter.php +++ b/src/Filter/Filter.php @@ -6,7 +6,7 @@ class Filter_Filter { public $processor; - public function __construct(/*.Filter_Filter.*/$processor) + public function __construct(/*.Controller_Action.*/$processor) { $this->processor = $processor; } diff --git a/src/Path.php b/src/Path.php index 9835f88..2af0fde 100644 --- a/src/Path.php +++ b/src/Path.php @@ -287,7 +287,7 @@ class Path $result [] = $parts->getParts(); } // При обьединении ссылок можно обьеденить path, query, fragment - $path = implode(self::SEPARATOR, call_user_func_array('array_merge', $result)); + $path = implode(self::SEPARATOR, self::optimize(call_user_func_array('array_merge', $result))); $parts0->url['path'] = ($parts0->isAbsolute()) ? '/' . $path : $path; return $parts0; } From 7c7ad1bf9d0e155db847c29a8c7c7245dd776f81 Mon Sep 17 00:00:00 2001 From: "CORP\\phedor" Date: Mon, 5 Mar 2018 16:24:41 +0300 Subject: [PATCH 2/8] =?UTF-8?q?=D0=93=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B8=D0=B7=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Tools/TemplateImage.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Tools/TemplateImage.php b/src/Tools/TemplateImage.php index 31bdfcc..6ce9a33 100644 --- a/src/Tools/TemplateImage.php +++ b/src/Tools/TemplateImage.php @@ -122,28 +122,26 @@ class Tools_TemplateImage $text = strtr($text, $this->context); $size = $value->fontSize; - fb('font-style'); - fb($value->fontStyle); $fontfile = $this->getFontFile($value->fontFamily . $this->fontSuffix($value->fontStyle)); $color = intval(substr($value->color, 1), 16); if ($value->align[0]) { - $align = Drawing::ALIGN_LEFT; + $align = Tools_Drawing::ALIGN_LEFT; } elseif ($value->align[2]) { - $align = Drawing::ALIGN_RIGHT; + $align = Tools_Drawing::ALIGN_RIGHT; } else { - $align = Drawing::ALIGN_CENTER; + $align = Tools_Drawing::ALIGN_CENTER; } if ($value->valign[0]) { $valign = Drawing::ALIGN_TOP; } elseif ($value->valign[1]) { - $valign = Drawing::ALIGN_CENTER; + $valign = Tools_Drawing::ALIGN_CENTER; } else { - $valign = Drawing::ALIGN_BOTTOM; + $valign = Tools_Drawing::ALIGN_BOTTOM; } - Drawing::imagettftextbox($this->image, $size, 0, $value->left, $value->top, $color, $fontfile, $text, + Tools_Drawing::imagettftextbox($this->image, $size, 0, $value->left, $value->top, $color, $fontfile, $text, $value->width, $value->height, $align, $valign); } @@ -154,7 +152,7 @@ class Tools_TemplateImage function encode($text) { assert(is_string($text)); - return iconv("WINDOWS-1251", "UTF-8", $text); + return $text; //iconv("WINDOWS-1251", "UTF-8", $text); } function setSize($new_width, $new_height) From 53b531f85349d98b6090a22b798e17e2b75a9f96 Mon Sep 17 00:00:00 2001 From: "CORP\\phedor" Date: Thu, 15 Mar 2018 14:48:50 +0300 Subject: [PATCH 3/8] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Action.php | 1 + src/Controller/Component.php | 5 ++--- src/Database.php | 3 ++- src/Database/PDOStatement.php | 2 -- src/Path.php | 2 +- src/Registry.php | 2 +- src/Validator/Validator.php | 2 +- src/tales.php | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Controller/Action.php b/src/Controller/Action.php index 5d2d13e..6045d5b 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -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); diff --git a/src/Controller/Component.php b/src/Controller/Component.php index c389198..efc3cdf 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -271,10 +271,9 @@ class Controller_Component if(class_exists("Controller_Site")){ //Если мы в CMS2 $instance = Controller_Site::getInstance(); $instance->componentsConfig[] = $editor; - }else{ + } else { global $componentsConfig; - $componentsConfig[] = $editor; - + $componentsConfig[] = $editor; } } diff --git a/src/Database.php b/src/Database.php index b08d864..415619d 100644 --- a/src/Database.php +++ b/src/Database.php @@ -1,6 +1,7 @@ require_once "Database/PDOStatement.php"; + /** * Класс оболочка для PDO для замены Creole */ @@ -81,7 +82,7 @@ class Database extends PDO /** * Извлекает из базы первый элемент по запросу */ - public function fetchOneArray($query,$values=null) + public function fetchOneArray($query, $values = null) { /*.Database_PDOStatement.*/$sth = $this->prepare($query); $prep = $this->prepareValues($values); diff --git a/src/Database/PDOStatement.php b/src/Database/PDOStatement.php index 0cbd058..1274e6e 100644 --- a/src/Database/PDOStatement.php +++ b/src/Database/PDOStatement.php @@ -1,7 +1,5 @@ +/// /** * http://www.patternsforphp.com/wiki/Registry diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php index 0af90e3..c6d52f9 100644 --- a/src/Validator/Validator.php +++ b/src/Validator/Validator.php @@ -1,6 +1,6 @@ +/// /** * Проверка коллекции diff --git a/src/tales.php b/src/tales.php index 0d727e8..2c9bc91 100644 --- a/src/tales.php +++ b/src/tales.php @@ -48,7 +48,7 @@ function phptal_component ($expression) { $begin = floatval(microtime(true)); /*.Controller_Component.*/$component = null; - if(class_exists("Controller_Site")){ //Если мы в CMS2 + if (class_exists("Controller_Site")) { //Если мы в CMS2 $component = Controller_Site::loadComponent($expression); } else { global $db, $registry; // Иначе обращаемся к глобальным переменным From 0c9ae85fdc1636c430897fa91ca3d5a71cc33bf2 Mon Sep 17 00:00:00 2001 From: "CORP\\phedor" Date: Fri, 6 Apr 2018 11:40:37 +0300 Subject: [PATCH 4/8] =?UTF-8?q?=D0=BD=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE=20=D0=B2=D1=8B=D0=B7=D1=8B=D0=B2?= =?UTF-8?q?=D0=B0=D0=BB=D0=B0=D1=81=D1=8C=20=D1=84=D1=83=D0=BD=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Database/PDOStatement.php | 2 +- src/Tools/String.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Database/PDOStatement.php b/src/Database/PDOStatement.php index 1274e6e..4561611 100644 --- a/src/Database/PDOStatement.php +++ b/src/Database/PDOStatement.php @@ -86,7 +86,7 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate } function getArray($name) { - return strToArray($this->fields[$name]); + return Tools_String::strToArray($this->fields[$name]); } function getRecordCount() { diff --git a/src/Tools/String.php b/src/Tools/String.php index bd6c2de..41fd465 100644 --- a/src/Tools/String.php +++ b/src/Tools/String.php @@ -15,7 +15,7 @@ class Tools_String { if ($in_subarr > 0) { // already in sub-array? $subarr[$in_subarr][] = $tok; if ('}' === substr($tok, -1, 1)) { // check to see if we just added last component - $res[] = strToArray(implode(',', $subarr[$in_subarr])); + $res[] = static::strToArray(implode(',', $subarr[$in_subarr])); $in_subarr--; } } elseif ($tok{0} === '{') { // we're inside a new sub-array @@ -25,7 +25,7 @@ class Tools_String { $subarr[$in_subarr] = array(); $subarr[$in_subarr][] = $tok; } else { - $res[] = strToArray($tok); + $res[] = static::strToArray($tok); } } else { // not sub-array $val = trim($tok, '"'); // remove " (surrounding strings) From dbac85204f3ffdfa869f4336e2baec20a7f0905e Mon Sep 17 00:00:00 2001 From: Anatoly Date: Thu, 7 Jun 2018 13:33:18 +0300 Subject: [PATCH 5/8] whitelist --- src/Filter/Login.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Filter/Login.php b/src/Filter/Login.php index 70ad01d..2891e2e 100644 --- a/src/Filter/Login.php +++ b/src/Filter/Login.php @@ -17,7 +17,8 @@ class Filter_Login extends Filter_Filter //AJAX-Реквесты для которых не требуется авторизация, потребовалось для сбора статистики public $whiteRequestList = [['module' => "requiredcontent", "action" => "getcount"], ['module' => "requiredcontent", "action" => "teststructure"], - ['module' => "requiredcontent", "action" => "specialdump"] + ['module' => "requiredcontent", "action" => "specialdump"], + ['module' => "requiredcontent", "action" => "MDOUMonitoring"] ]; /** * Проверка авторизации From cbd50862ce920c74a6093561de0a802e49a3514b Mon Sep 17 00:00:00 2001 From: "CORP\\phedor" Date: Fri, 8 Jun 2018 15:20:43 +0300 Subject: [PATCH 6/8] =?UTF-8?q?schema=20=D0=B4=D0=BB=D1=8F=20bd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Component.php | 2 +- src/Controller/Service.php | 5 ++++- src/Database.php | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Controller/Component.php b/src/Controller/Component.php index efc3cdf..e5a4bc2 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -273,7 +273,7 @@ class Controller_Component $instance->componentsConfig[] = $editor; } else { global $componentsConfig; - $componentsConfig[] = $editor; + $componentsConfig[] = $editor; } } diff --git a/src/Controller/Service.php b/src/Controller/Service.php index 46f96aa..5bc439f 100644 --- a/src/Controller/Service.php +++ b/src/Controller/Service.php @@ -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) { diff --git a/src/Database.php b/src/Database.php index 415619d..9544526 100644 --- a/src/Database.php +++ b/src/Database.php @@ -35,6 +35,10 @@ class Database extends PDO if ($dsn['phptype'] == 'pgsql') { $connection->query('SET client_encoding="UTF-8"'); } + + if (isset($dsn['schema'])) { + $connection->query('SET search_path TO ' . $dsn['schema']); + } } if ($dsn['phptype'] == 'sqlite') { /*.Database.*/$connection = new static("{$dsn['phptype']}:{$dsn['database']}"); From aa61c2ddc10c4a1f5bccd7f217561637ac0b76d1 Mon Sep 17 00:00:00 2001 From: Origami11 Date: Tue, 14 Jan 2020 10:40:01 +0300 Subject: [PATCH 7/8] =?UTF-8?q?=D0=A1=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D1=81=20=D1=81=D0=B5?= =?UTF-8?q?=D1=80=D0=B2=D0=B5=D1=80=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Component.php | 3 ++- src/Controller/Service.php | 9 +++++++++ src/Database.php | 6 ++++++ src/Database/PDOStatement.php | 8 +++++++- src/Database/Statement.php | 18 ++++++------------ src/Excel/Number.php | 2 +- src/Filter/Login.php | 16 +++++++++++----- src/Filter/UserAccess.php | 2 +- src/Tools/TemplateImage.php | 2 +- src/Validator/Rule/Date.php | 1 + src/View/Page.php | 4 ++-- 11 files changed, 47 insertions(+), 24 deletions(-) diff --git a/src/Controller/Component.php b/src/Controller/Component.php index e5a4bc2..65587fb 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -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 { diff --git a/src/Controller/Service.php b/src/Controller/Service.php index 5bc439f..a1f7185 100644 --- a/src/Controller/Service.php +++ b/src/Controller/Service.php @@ -61,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(); + } } diff --git a/src/Database.php b/src/Database.php index 9544526..def3072 100644 --- a/src/Database.php +++ b/src/Database.php @@ -13,8 +13,14 @@ class Database extends PDO { parent::__construct($dsn, $username, $password); $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $this->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Database_PDOStatement', array())); } + + function prepare($sql, $args = []) { + $result = parent::prepare($sql, $args); + return $result; + } public function getDSN() { diff --git a/src/Database/PDOStatement.php b/src/Database/PDOStatement.php index 4561611..43c7564 100644 --- a/src/Database/PDOStatement.php +++ b/src/Database/PDOStatement.php @@ -74,7 +74,7 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate } function getString($name) { - return $this->fields[$name]; + return isset($this->fields[$name]) ? $this->fields[$name]: null; } function getBoolean($name) { @@ -92,4 +92,10 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate function getRecordCount() { return count($this->cache); } + + function execute($args = null) { + $result = parent::execute($args); + return $result; + } + } diff --git a/src/Database/Statement.php b/src/Database/Statement.php index 80b77da..dbcee3a 100644 --- a/src/Database/Statement.php +++ b/src/Database/Statement.php @@ -17,33 +17,27 @@ class Database_Statement $this->conn = $conn; } - function setInt($n, $value) - { + function setInt($n, $value) { $this->binds [] = array($n, $value, PDO::PARAM_INT); } - function setString($n, $value) - { + function setString($n, $value) { $this->binds [] = array($n, $value, PDO::PARAM_STR); } - function setBlob($n, $value) - { + function setBlob($n, $value) { $this->binds [] = array($n, $value, PDO::PARAM_LOB); } - function setLimit($limit) - { + function setLimit($limit) { $this->limit = $limit; } - function setOffset($offset) - { + function setOffset($offset) { $this->offset = $offset; } - function executeQuery() - { + function executeQuery() { if ($this->limit) { $this->query .= " LIMIT {$this->limit} OFFSET {$this->offset}"; } diff --git a/src/Excel/Number.php b/src/Excel/Number.php index 66dd6b6..dfc220a 100644 --- a/src/Excel/Number.php +++ b/src/Excel/Number.php @@ -6,7 +6,7 @@ class Excel_Number function __construct($value) { - $this->value = intval($value); + $this->value = (int)($value); } function getString() diff --git a/src/Filter/Login.php b/src/Filter/Login.php index 2891e2e..b7e9cac 100644 --- a/src/Filter/Login.php +++ b/src/Filter/Login.php @@ -13,13 +13,18 @@ class Filter_Login extends Filter_Filter const SESSION_BROWSER_SIGN_SECRET = '@w3dsju45Msk#'; const SESSION_BROWSER_SIGN_KEYNAME = 'session.app.browser.sign'; public $mode = 'ajax'; + public $user; //AJAX-Реквесты для которых не требуется авторизация, потребовалось для сбора статистики - public $whiteRequestList = [['module' => "requiredcontent", "action" => "getcount"], - ['module' => "requiredcontent", "action" => "teststructure"], - ['module' => "requiredcontent", "action" => "specialdump"], - ['module' => "requiredcontent", "action" => "MDOUMonitoring"] - ]; + public $whiteRequestList = [ + ['module' => "requiredcontent", "action" => "getcount"], + ['module' => "requiredcontent", "action" => "teststructure"], + ['module' => "requiredcontent", "action" => "specialdump"], + ['module' => "requiredcontent", "action" => "OrgMonitoring"], + ['module' => "requiredcontent", "action" => "OrgMonitoringSchema"], + ['module' => "appeals", "action" => "changestatus"], + ['module' => "appeals", "action" => "savestatus"] + ]; /** * Проверка авторизации * @return Boolean Авторизовани пользователь или нет @@ -30,6 +35,7 @@ class Filter_Login extends Filter_Filter session_start(); $db = $this->getConnection(); Filter_UserAccess::setUp($db); // Соединение + switch ($request->getAction()) { // Авторизация по постоянному паролю case 'login': diff --git a/src/Filter/UserAccess.php b/src/Filter/UserAccess.php index ce27a66..fbf97b4 100644 --- a/src/Filter/UserAccess.php +++ b/src/Filter/UserAccess.php @@ -62,7 +62,7 @@ class Filter_UserAccess $time = time(); if ($time - $lasttime > self::LIFE_TIME) return null; // Вышло время сессии $id = self::$id; - self::$db->executeQuery("UPDATE users SET lasttime = $time WHERE id_user = $id"); // Время последнего обращения входа + // self::$db->executeQuery("UPDATE users SET lasttime = $time WHERE id_user = $id"); // Время последнего обращения входа } return $result; } diff --git a/src/Tools/TemplateImage.php b/src/Tools/TemplateImage.php index 6ce9a33..171f285 100644 --- a/src/Tools/TemplateImage.php +++ b/src/Tools/TemplateImage.php @@ -134,7 +134,7 @@ class Tools_TemplateImage } if ($value->valign[0]) { - $valign = Drawing::ALIGN_TOP; + $valign = Tools_Drawing::ALIGN_TOP; } elseif ($value->valign[1]) { $valign = Tools_Drawing::ALIGN_CENTER; } else { diff --git a/src/Validator/Rule/Date.php b/src/Validator/Rule/Date.php index be8e17e..166907a 100644 --- a/src/Validator/Rule/Date.php +++ b/src/Validator/Rule/Date.php @@ -15,6 +15,7 @@ class Validator_Rule_Date extends Validator_Rule_Abstract public function isValid(Collection $container, $status = null) { $pattern = "/^([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})$/"; + $matches = []; return (preg_match($pattern, $container->get($this->field), $matches) && checkdate($matches[2], $matches[1], $matches[3])); } diff --git a/src/View/Page.php b/src/View/Page.php index a280f26..1982fcb 100644 --- a/src/View/Page.php +++ b/src/View/Page.php @@ -8,7 +8,7 @@ class View_Page extends View_View function __construct($data) { // Вставка компонентов на странице - $pattern = '/<(\w+)(\s+[a-zA-Z\-]+=\"[^\"]*\")*\s+tal:replace="structure\s+component:([^\"]*)"[^>]*>/u'; + $pattern = '/<(\w+)(\s+[a-zA-Z\-]+(=\"[^\"]*\")?)*\s+tal:replace="structure\s+component:([^\"]*)"[^>]*>/u'; $matches = array(); preg_match_all($pattern, $data, $matches, PREG_OFFSET_CAPTURE, 0); @@ -20,7 +20,7 @@ class View_Page extends View_View $split[] = array('type' => 'page-text', 'content' => $text, 'component' => '', 'module' => ''); } $offset = $match[1] + strlen($match[0]); - $split[] = $this->replaceContent($matches[3][$key][0], $matches[3][$key][1]); + $split[] = $this->replaceContent($matches[4][$key][0], $matches[4][$key][1]); } $text = $this->fixHTML(substr($data, $offset)); if (trim($text)) { From ea40d10f60af9e46dbdef9c3c3f9e2eeff89ab4f Mon Sep 17 00:00:00 2001 From: Anatoly Date: Fri, 17 Jan 2020 11:33:23 +0300 Subject: [PATCH 8/8] edits --- src/Database.php | 1 - src/Filter/Login.php | 8 +++-- src/View/Page.php | 78 -------------------------------------------- 3 files changed, 5 insertions(+), 82 deletions(-) delete mode 100644 src/View/Page.php diff --git a/src/Database.php b/src/Database.php index 415619d..8b73743 100644 --- a/src/Database.php +++ b/src/Database.php @@ -126,7 +126,6 @@ class Database extends PDO $sql = "INSERT INTO $table (" . implode(",", array_keys($values)) . ") VALUES (" . implode(",", array_keys($prep)). ")"; - if ($return_id) { if ($this->isPostgres()){ $sql = $sql." RETURNING $index"; diff --git a/src/Filter/Login.php b/src/Filter/Login.php index 70ad01d..4ab48e8 100644 --- a/src/Filter/Login.php +++ b/src/Filter/Login.php @@ -17,7 +17,8 @@ class Filter_Login extends Filter_Filter //AJAX-Реквесты для которых не требуется авторизация, потребовалось для сбора статистики public $whiteRequestList = [['module' => "requiredcontent", "action" => "getcount"], ['module' => "requiredcontent", "action" => "teststructure"], - ['module' => "requiredcontent", "action" => "specialdump"] + ['module' => "requiredcontent", "action" => "specialdump"], + ['module' => "requiredcontent", "action" => "OrgMonitoringSchema"] ]; /** * Проверка авторизации @@ -51,9 +52,10 @@ class Filter_Login extends Filter_Filter if (md5($password) == $userPassword) { // password $this->enter($db, $result); return true; - } + } else { + $request->set('error', true); + } } - $request->set('error', true); break; case 'logout': // Выход session_destroy(); diff --git a/src/View/Page.php b/src/View/Page.php deleted file mode 100644 index a280f26..0000000 --- a/src/View/Page.php +++ /dev/null @@ -1,78 +0,0 @@ -]*>/u'; - $matches = array(); - preg_match_all($pattern, $data, $matches, PREG_OFFSET_CAPTURE, 0); - - $split = array(); - $offset = 0; - foreach ($matches[0] as $key => $match) { - $text = $this->fixHTML(substr($data, $offset, $match[1] - $offset)); - if (trim($text)) { - $split[] = array('type' => 'page-text', 'content' => $text, 'component' => '', 'module' => ''); - } - $offset = $match[1] + strlen($match[0]); - $split[] = $this->replaceContent($matches[3][$key][0], $matches[3][$key][1]); - } - $text = $this->fixHTML(substr($data, $offset)); - if (trim($text)) { - $split[] = array('type' => 'page-text', 'content' => $text, 'component' => '', 'module' => ''); - } - - $this->text = $this->merge($split); - } - - function fixHTML($fragment) { - return $fragment; - } - - function merge($data) { - if (count($data) == 0) { - $data[] = array('type' => 'page-text', 'content' =>"

Добавьте текст

", 'component' => '', 'module' => ''); - } - $result = array(); - foreach($data as $key => $part) { - $result[] = $part['content']; - } - return implode("", $result); - } - - function replaceContent($match, $offset) - { - //$result = phptal_component($match, $offset); - /*.Controller_Component.*/$component = null; - - - if(class_exists("Controller_Site")){ //Если мы в CMS2 - $component = Controller_Site::loadComponent($match); - } else { - global $db, $registry; // - $component = Controller_Component::loadComponent($match, $db, $registry); - } - - $req = new HttpRequest(); - unset($req['active_page']); - - $info = $component->getInfo(); - $result = $component->execute($req); - - if (is_string($result)) { - return array('type' => 'page-component', 'content' => $result, 'component' => $match); - } else { - $this->setView('view' . $this->counter++, $result); - return array('type' => 'page-component', 'content' => $result->execute(), 'component' => $match); - } - } - - function execute() { - return $this->text; - } -}