fix: Доп. проверки значений
This commit is contained in:
parent
33565c9f7e
commit
b20ea0e7dc
8 changed files with 45 additions and 39 deletions
|
|
@ -16,35 +16,7 @@ use ctiso\Controller\SiteInterface;
|
|||
use ctiso\Database\PDOStatement;
|
||||
use PHPTAL;
|
||||
use PHPTAL_PreFilter_Normalize;
|
||||
|
||||
class FakeTemplate {
|
||||
/** @var array */
|
||||
public $_data = [];
|
||||
/** @var string */
|
||||
public $_name = '';
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
function __construct($name) {
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
function __set($key, $value): void {
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function execute() {
|
||||
return json_encode($this->_data);
|
||||
}
|
||||
}
|
||||
use ctiso\View\FakeTemplate;
|
||||
|
||||
/**
|
||||
* Класс компонента
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ class Session
|
|||
function set(string|array $key, mixed $value): void
|
||||
{
|
||||
if (is_array($key)) {
|
||||
$_SESSION[strtolower(get_class($key[0]))][$key[1]] = $value;
|
||||
$className = get_class($key[0]);
|
||||
$_SESSION[strtolower($className)][$key[1]] = $value;
|
||||
} else {
|
||||
$_SESSION[$key] = $value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class Settings
|
|||
/**
|
||||
* Запись настроек в файл (Может переименовать в store)
|
||||
*
|
||||
* @param File $file
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
public function write($file = null)
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ class SQLStatementExtractor
|
|||
/**
|
||||
* Extract SQL statements from array of lines.
|
||||
*
|
||||
* @param list<string> $lines Lines of the read-in file.
|
||||
* @return list<string>
|
||||
* @param string[] $lines Lines of the read-in file.
|
||||
* @return string[] SQL statements
|
||||
*/
|
||||
protected static function extractStatements($lines)
|
||||
{
|
||||
|
|
@ -177,6 +177,6 @@ class SQLStatementExtractor
|
|||
protected static function getLines(string $buffer): array
|
||||
{
|
||||
$lines = preg_split("/\r?\n|\r/", $buffer);
|
||||
return $lines;
|
||||
return $lines === false ? [] : $lines;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ class PregMatch extends AbstractRule
|
|||
|
||||
public function isValid(Collection $container, $status = null): bool
|
||||
{
|
||||
return preg_match($this->pattern, $container->get($this->field));
|
||||
return preg_match($this->pattern, $container->get($this->field)) !== false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\View;
|
||||
use ctiso\View\View,
|
||||
PHPTAL;
|
||||
|
||||
use ctiso\View\View;
|
||||
use PHPTAL;
|
||||
use PHPTAL_TranslationService;
|
||||
|
||||
class Composite extends View
|
||||
|
|
|
|||
32
src/View/FakeTemplate.php
Normal file
32
src/View/FakeTemplate.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace ctiso\View;
|
||||
|
||||
class FakeTemplate extends \stdClass {
|
||||
/** @var array */
|
||||
public $_data = [];
|
||||
/** @var string */
|
||||
public $_name = '';
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
function __construct($name) {
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
function __set($key, $value): void {
|
||||
$this->_data[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function execute() {
|
||||
return json_encode($this->_data);
|
||||
}
|
||||
}
|
||||
|
|
@ -71,6 +71,6 @@ class Plain extends \stdClass
|
|||
include ($document);
|
||||
$content = ob_get_contents ();
|
||||
ob_clean ();
|
||||
return $content;
|
||||
return $content === false ? '' : $content;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue