From ea40d10f60af9e46dbdef9c3c3f9e2eeff89ab4f Mon Sep 17 00:00:00 2001 From: Anatoly Date: Fri, 17 Jan 2020 11:33:23 +0300 Subject: [PATCH] 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; - } -}