edits
This commit is contained in:
parent
0c9ae85fdc
commit
ea40d10f60
3 changed files with 5 additions and 82 deletions
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
|
||||
class View_Page extends View_View
|
||||
{
|
||||
private $counter;
|
||||
public $text;
|
||||
|
||||
function __construct($data)
|
||||
{
|
||||
// Вставка компонентов на странице
|
||||
$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);
|
||||
|
||||
$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' =>"<p>Добавьте текст<p>", '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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue