Другая интерпретация реестра

This commit is contained in:
CORP\phedor 2018-04-20 18:03:39 +03:00
parent 40fad0e75b
commit aaa9c2e1bf
21 changed files with 156 additions and 92 deletions

View file

@ -9,6 +9,8 @@ use ctiso\Shortcut,
ctiso\HttpRequest, ctiso\HttpRequest,
ctiso\Functions, ctiso\Functions,
ctiso\Settings, ctiso\Settings,
ctiso\Registry,
ctiso\Role\User,
ctiso\View\Composite, ctiso\View\Composite,
ctiso\Filter\ActionAccess, ctiso\Filter\ActionAccess,
ctiso\View\View, ctiso\View\View,
@ -45,8 +47,8 @@ class Action
private $helpers = array(); // Помошники для действий private $helpers = array(); // Помошники для действий
public $part = null; // Параметры для ссылки public $part = null; // Параметры для ссылки
public /*.Settings.*/$settings; // Ссылка на настройки public /*.Registry.*/$config; // Ссылка на настройки
public $user; // Обьект пользователя public /*.User.*/$user; // Обьект пользователя
// Для Widgets // Для Widgets
public $view = null; public $view = null;
@ -62,7 +64,7 @@ class Action
} }
public function loadConfig($name) { public function loadConfig($name) {
$basePath = $this->settings['base']; $basePath = $this->config->get('site', 'path');
$filename = Path::join($basePath, 'modules', $name); $filename = Path::join($basePath, 'modules', $name);
$settings = []; $settings = [];
@ -81,7 +83,7 @@ class Action
public function installPath($name) public function installPath($name)
{ {
$basePath = $this->settings['base']; $basePath = $this->config->get('site', 'path');
return Path::join($basePath, "modules", $name); return Path::join($basePath, "modules", $name);
} }
@ -94,7 +96,7 @@ class Action
} }
function findIcon($icon, $size) { function findIcon($icon, $size) {
$webPath = $this->settings['web']; $webPath = $this->config->get('site', 'web');
return Path::join($webPath, 'icons', $size . 'x' . $size, $icon . '.png'); return Path::join($webPath, 'icons', $size . 'x' . $size, $icon . '.png');
} }
@ -108,8 +110,8 @@ class Action
{ {
$file = $name . self::TEMPLATE_EXTENSION; $file = $name . self::TEMPLATE_EXTENSION;
$basePath = $this->settings['base']; $basePath = $this->config->get('site', 'path');
$webPath = $this->settings['web']; $webPath = $this->config->get('site', 'web');
$list = array( $list = array(
Path::join($this->modulePath, 'templates', $this->viewPathPrefix) => Path::join($webPath, "modules", $this->name, 'templates', $this->viewPathPrefix), Path::join($this->modulePath, 'templates', $this->viewPathPrefix) => Path::join($webPath, "modules", $this->name, 'templates', $this->viewPathPrefix),
@ -151,7 +153,7 @@ class Action
public function getModel($name) public function getModel($name)
{ {
if (!$this->factory) { if (!$this->factory) {
$this->factory = new Factory($this->db, $this->settings['registry']); $this->factory = new Factory($this->db, $this->config);
} }
return $this->factory->getModel($name); return $this->factory->getModel($name);
} }
@ -327,7 +329,8 @@ class Action
*/ */
public function render() public function render()
{ {
if ($this->view instanceof View) { $view = $this->view;
if ($view instanceof View) {
$this->view->assignValues($this->ctrlValues); $this->view->assignValues($this->ctrlValues);
/*.Composite.*/$node = null; /*.Composite.*/$node = null;
@ -369,8 +372,8 @@ class Action
$this->_getActionPath()->getPath($this, ($action) ? $action : $request->getAction()); $this->_getActionPath()->getPath($this, ($action) ? $action : $request->getAction());
} }
function redirect($action) { function redirect(/*.string.*/$action) {
header('location: ' . $action->toString()); header('location: ' . $action);
exit(); exit();
} }
} }

View file

@ -12,20 +12,11 @@ use ctiso\HttpRequest,
ctiso\Database, ctiso\Database,
ctiso\Database\PDOStatement, ctiso\Database\PDOStatement,
ctiso\Collection, ctiso\Collection,
ctiso\Settings, ctiso\Registry,
App\Controller\Site, App\Controller\Site,
PHPTAL, PHPTAL,
PHPTAL_PreFilter_Normalize; PHPTAL_PreFilter_Normalize;
function replaceContent($match) {
$result = Tales\Component::phptal_component(htmlspecialchars_decode($match[3]));
return $result;
}
function applyComponents($text) {
return preg_replace_callback('/<(\w+)(\s+[a-zA-Z\-]+=\"[^\"]*\")*\s+tal:replace="structure\s+component:([^\"]*)"[^>]*>/u', 'replaceContent', $text);
}
class FakeTemplate { class FakeTemplate {
public $_data = []; public $_data = [];
public $_name = ''; public $_name = '';
@ -56,11 +47,13 @@ class Component
public $component_id; public $component_id;
public $component_title; public $component_title;
public $COMPONENTS_WEB; public $COMPONENTS_WEB;
public /*.Settings.*/$registry; public /*.Registry.*/$config;
public /*.Database.*/$db; public /*.Database.*/$db;
public /*.Collection.*/$parameter; public /*.Collection.*/$parameter;
public $output = 'html'; public $output = 'html';
public $module; public $module;
@ -70,7 +63,12 @@ class Component
function before() { function before() {
} }
function get($request, $key, $default) { static function replaceContent($match) {
return \ctiso\Tales::phptal_component(htmlspecialchars_decode($match[3]));
}
static function applyComponents($text) {
return preg_replace_callback('/<(\w+)(\s+[a-zA-Z\-]+=\"[^\"]*\")*\s+tal:replace="structure\s+component:([^\"]*)"[^>]*>/u', 'ctiso\\Controller\\Component::replaceContent', $text);
} }
function execute(HttpRequest $request, $has_id = true) { function execute(HttpRequest $request, $has_id = true) {
@ -97,8 +95,9 @@ class Component
return new FakeTemplate($name); return new FakeTemplate($name);
} }
/*.Settings.*/$registry = $this->registry; /*.Registry.*/$config = $this->config;
$template = ($this->template) ? $this->template : $registry->readKey(array('system', 'template')); $default = $config->get('site', 'template');
$template = ($this->template) ? $this->template : $default;
$selected = null; $selected = null;
foreach ($this->viewPath as $index => $viewPath) { foreach ($this->viewPath as $index => $viewPath) {
@ -121,13 +120,14 @@ class Component
$tpl->stripComments(true); $tpl->stripComments(true);
$tpl->addPreFilter(new PHPTAL_PreFilter_Normalize()); $tpl->addPreFilter(new PHPTAL_PreFilter_Normalize());
$tpl->set('common', Path::join(WWW_PATH, '../', 'common')); $tpl->set('common', Path::join($this->config->get('system', 'web'), '../', 'common'));
$tpl->set('script', Path::join(WWW_PATH, 'js')); $tpl->set('script', Path::join($this->config->get('system', 'web'), 'js'));
$tpl->set('media', Path::join(TEMPLATE_WEB, $template)); $tpl->set('media', Path::join($this->config->get('system', 'templates_web'), $template));
if ($registry) {
$tpl->set('site_template', SITE_WWW_PATH . '/templates' . $registry->readKey(array('system', 'template'))); if ($default) {
$tpl->set('site_template', $this->config->get('site', 'web') . '/templates/' . $default);
} }
$tpl->set('base', SITE_WWW_PATH); $tpl->set('base', $this->config->get('site', 'web'));
$tpl->set('component_base', $this->webPath[$selected]); $tpl->set('component_base', $this->webPath[$selected]);
$tpl->set('component', Path::join($this->webPath[$selected], 'templates', $template)); $tpl->set('component', Path::join($this->webPath[$selected], 'templates', $template));
@ -199,7 +199,7 @@ class Component
public function setParameters(/*.Composite.*/ $view) public function setParameters(/*.Composite.*/ $view)
{ {
$form = new Form(); $form = new Form();
$options = new OptionFactory($this->db, $this->registry); $options = new OptionFactory($this->db, $this->config);
$settings = $this->getInfo(); $settings = $this->getInfo();
$form->addFieldList($settings['parameter'], $options); $form->addFieldList($settings['parameter'], $options);
@ -226,7 +226,7 @@ class Component
} }
$name = $path; $name = $path;
$path = Path::join (BASE_PATH, 'components', $name, $name . '.php'); $path = Path::join ($this->config->get('site', 'path'), 'components', $name, $name . '.php');
$className = 'Component_' . $name; $className = 'Component_' . $name;
/*.Component.*/$component = null; /*.Component.*/$component = null;
@ -235,26 +235,26 @@ class Component
require_once ($path); require_once ($path);
$component = new $className(); $component = new $className();
$component->viewPath = array(BASE_PATH . '/components/' . $name . '/'); $component->viewPath = array($this->config->get('site', 'path') . '/components/' . $name . '/');
$component->webPath = array(SITE_WWW_PATH . '/components/' . $name); $component->webPath = array($this->config->get('site', 'web') . '/components/' . $name);
$component->COMPONENTS_WEB = SITE_WWW_PATH . '/components/'; $component->COMPONENTS_WEB = $this->config->get('site', 'web') . '/components/';
} else { } else {
$path = Path::join (COMPONENTS, $name, $name . '.php'); $path = Path::join ($this->config->get('system', 'components'), $name, $name . '.php');
require_once ($path); require_once ($path);
$component = new $className(); $component = new $className();
$component->viewPath = array(COMPONENTS . '/' . $name . '/', BASE_PATH . '/components/' . $name . '/'); $component->viewPath = array($this->config->get('system', 'components') . '/' . $name . '/', $this->config->get('site', 'path') . '/components/' . $name . '/');
if (defined('COMPONENTS_WEB')) { if (defined('COMPONENTS_WEB')) {
$component->webPath = array(COMPONENTS_WEB . '/' . $name, SITE_WWW_PATH . '/components/' . $name); $component->webPath = array($this->config->get('system', 'components_web') . '/' . $name, $this->config->get('site', 'web') . '/components/' . $name);
$component->COMPONENTS_WEB = COMPONENTS_WEB; $component->COMPONENTS_WEB = $this->config->get('system', 'components_web');
} }
} }
$db = $site->db; $db = $site->db;
$component->db = $db; $component->db = $db;
$component->registry = $site->registry; $component->config = $site->config;
$component->site = $site; $component->site = $site;
$stmt = $db->prepareStatement("SELECT * FROM component WHERE code = ?"); $stmt = $db->prepareStatement("SELECT * FROM component WHERE code = ?");

View file

@ -26,9 +26,9 @@ class Front extends Action
/** /**
* @param Settings $settings * @param Settings $settings
*/ */
public function __construct($db, $settings, $user, $default) { public function __construct($db, $config, $user, $default) {
parent::__construct(); parent::__construct();
$this->settings = $settings; $this->config = $config;
$this->db = $db; $this->db = $db;
$this->user = $user; $this->user = $user;
$this->default = $default; $this->default = $default;
@ -50,11 +50,11 @@ class Front extends Action
$module = $this->modules[$name]; $module = $this->modules[$name];
return $module->access->execute($request); return $module->access->execute($request);
} }
$config = $this->config;
/*.Settings.*/$system = $this->settings['system']; $moulesPath = Path::join($config->get('system', 'path'), 'modules');
$logPath = Path::join($config->get('site', 'path'), $config->get('system', 'access.log'));
$moulesPath = Path::join($this->settings['base'], $system->readKey(['path', 'modules']));
$logPath = Path::join($this->settings['site'], $system->readKey(['path', 'access.log']));
$moduleFile = Path::join($moulesPath, $name, 'classes', $controller ? $controller : $name); $moduleFile = Path::join($moulesPath, $name, 'classes', $controller ? $controller : $name);
$ucname = ucfirst($name); $ucname = ucfirst($name);
@ -66,14 +66,14 @@ class Front extends Action
$module->modulePath = $modPath; $module->modulePath = $modPath;
$module->name = $name; $module->name = $name;
// //
$module->settings = $this->settings; $module->config = $this->config;
$module->db = $this->db; $module->db = $this->db;
$module->user = $this->user; $module->user = $this->user;
// Ведение лога // Ведение лога
$logger = new ActionLogger($module, $logPath, $this->user); $logger = new ActionLogger($module, $logPath, $this->user);
$logger->before = $this->loadSettings(Path::join($modPath, 'filter', 'logger.php')); $logger->before = $this->loadSettings(Path::join($modPath, 'filter', 'logger.php'));
// Управление доступом // Управление доступом
$module->access = new ActionAccess($logger); $module->access = new ActionAccess($logger, $this->user);
$module->access->access = $this->loadSettings(Path::join($modPath, 'filter', 'access.php')); $module->access->access = $this->loadSettings(Path::join($modPath, 'filter', 'access.php'));
$module->setUp(); $module->setUp();

View file

@ -35,7 +35,7 @@ class Installer
// Проверка версии обновления // Проверка версии обновления
function isChanged($name) // Информация о модулях function isChanged($name) // Информация о модулях
{ {
$item = $this->_registry->readKey(array($name)); $item = $this->_registry->get('system', $name);
if ($item) { if ($item) {
$setup = $this->getSetupFile($name); $setup = $this->getSetupFile($name);
if (file_exists($setup) && (filemtime($setup) > $item['time'])) { if (file_exists($setup) && (filemtime($setup) > $item['time'])) {
@ -81,7 +81,7 @@ class Installer
$settings = new Settings($setup); $settings = new Settings($setup);
$settings->read(); $settings->read();
$item = $registry->readKey(array($name)); $item = $registry->get('system', $name);
$version_new = $settings->get('version'); $version_new = $settings->get('version');
if ($item) { if ($item) {
@ -101,8 +101,9 @@ class Installer
// Обновление версии меню // Обновление версии меню
$registry->removeKey($name); $registry->removeKey($name);
$registry->writeKey(array($name), $settings->get('settings'));
$registry->writeKey(array($name), $registry->set($name, $settings->get('settings'));
$registry->set($name,
array('version' => $version_new, array('version' => $version_new,
'time' => filemtime($setup))); 'time' => filemtime($setup)));
} }

View file

@ -5,13 +5,14 @@
*/ */
namespace ctiso\Controller; namespace ctiso\Controller;
use ctiso\Path, use ctiso\Path,
ctiso\Registry,
ctiso\Database\PDOStatement; ctiso\Database\PDOStatement;
class Service class Service
{ {
public $viewPath = []; public $viewPath = [];
public $webPath = []; public $webPath = [];
public $registry; // Registry->getInstance public /*.Registry.*/$config;
public $template; public $template;
public $templatePath; public $templatePath;
public $COMPONENTS_WEB; public $COMPONENTS_WEB;
@ -33,7 +34,7 @@ class Service
*/ */
private function getModelPath($name) private function getModelPath($name)
{ {
return Path::join (CMS_PATH, "model", $name . ".php"); return Path::join ($this->config->get('system', 'path'), "model", $name . ".php");
} }
/** /**

View file

@ -1,7 +1,8 @@
<?php <?php
namespace ctiso\Controller; namespace ctiso\Controller;
use ctiso\Controller\Action; use ctiso\Controller\Action,
ctiso\Url;
class State class State
{ {

View file

@ -92,7 +92,7 @@ class Document {
$this->createStyles($doc); $this->createStyles($doc);
foreach ($this->table as $table) { foreach ($this->table as $table) {
if ($table instanceof Excel_Table) { if ($table instanceof Table) {
$table->createTable($doc); $table->createTable($doc);
} else { } else {
$table_data = call_user_func($table); $table_data = call_user_func($table);

View file

@ -4,7 +4,9 @@
* Клетка таблицы * Клетка таблицы
*/ */
namespace ctiso\Excel; namespace ctiso\Excel;
use XMLWriter; use XMLWriter,
ctiso\Excel\DateTime as Excel_DateTime,
ctiso\Excel\Number as Excel_Number;
class TableCell class TableCell
{ {

View file

@ -5,15 +5,18 @@
*/ */
namespace ctiso\Filter; namespace ctiso\Filter;
use ctiso\Filter\UserAccess, use ctiso\Filter\UserAccess,
ctiso\HttpRequest; ctiso\HttpRequest,
ctiso\Role\User;
class ActionAccess class ActionAccess
{ {
public $access = array(); public $access = array();
public $processor; public $processor;
public /*.User.*/$user;
function __construct(/*.Filter.*/$processor) { function __construct(/*.Filter.*/$processor, $user) {
$this->processor = $processor; $this->processor = $processor;
$this->user = $user;
} }
/** /**

View file

@ -5,38 +5,41 @@ namespace ctiso\Filter;
class Authorization { class Authorization {
const SESSION_BROWSER_SIGN_SECRET = '@w3dsju45Msk#'; const SESSION_BROWSER_SIGN_SECRET = '@w3dsju45Msk#';
const SESSION_BROWSER_SIGN_KEYNAME = 'session.app.browser.sign'; const SESSION_BROWSER_SIGN_KEYNAME = 'session.app.browser.sign';
public $group;
static function isLogged($group = 'access') { function __construct($group) {
$this->group = $group;
}
function isLogged() {
// echo session_status(); // echo session_status();
if (session_status() == PHP_SESSION_NONE) { if (session_status() == PHP_SESSION_NONE) {
session_start(); session_start();
} }
$hash = self::getBrowserSign(); $hash = self::getBrowserSign();
// Если $hash не совпадает $_SESSION['hash'] то удаляем сессию // Если $hash не совпадает $_SESSION['hash'] то удаляем сессию
if (isset($_SESSION[$group]) && isset($_SESSION[self::SESSION_BROWSER_SIGN_KEYNAME])) { if (isset($_SESSION[$this->group]) && isset($_SESSION[self::SESSION_BROWSER_SIGN_KEYNAME])) {
if ($hash == $_SESSION[self::SESSION_BROWSER_SIGN_KEYNAME]) { if ($hash == $_SESSION[self::SESSION_BROWSER_SIGN_KEYNAME]) {
// UserAccess::getUserById($_SESSION ['access']); // Поиск по идентификатору // UserAccess::getUserById($_SESSION ['access']); // Поиск по идентификатору
return true; return true;
} else { } else {
return false; return false;
} }
} }
return false; return false;
} }
static function enter($id, $group = 'access') function enter($id) {
{
// $db->executeQuery("UPDATE visitor SET sid = '' WHERE id_visitor = " . $result->getInt('id_user')); // $db->executeQuery("UPDATE visitor SET sid = '' WHERE id_visitor = " . $result->getInt('id_user'));
// session_register("access"); // session_register("access");
// session_register("time"); // session_register("time");
// $_SESSION ["group"] = $result->getInt('access'); $_SESSION [$this->group] = $id;
$_SESSION [$group] = $id; // id_user
$_SESSION [self::SESSION_BROWSER_SIGN_KEYNAME] = self::getBrowserSign(); $_SESSION [self::SESSION_BROWSER_SIGN_KEYNAME] = self::getBrowserSign();
$_SESSION ["time"] = time(); $_SESSION ["time"] = time();
} }
private static function getBrowserSign() static function getBrowserSign()
{ {
$rawSign = self::SESSION_BROWSER_SIGN_SECRET; $rawSign = self::SESSION_BROWSER_SIGN_SECRET;
// $signParts = array('HTTP_USER_AGENT', 'HTTP_ACCEPT_ENCODING'); // $signParts = array('HTTP_USER_AGENT', 'HTTP_ACCEPT_ENCODING');
@ -48,7 +51,7 @@ class Authorization {
return md5($rawSign); return md5($rawSign);
} }
static function logout() { function logout() {
session_destroy(); session_destroy();
} }
} }

View file

@ -13,6 +13,7 @@ use ctiso\Filter\Filter,
ctiso\HttpRequest, ctiso\HttpRequest,
ctiso\Settings, ctiso\Settings,
ctiso\Database, ctiso\Database,
ctiso\Role\User,
ctiso\Collection; ctiso\Collection;
class Login extends Filter class Login extends Filter
@ -22,7 +23,7 @@ class Login extends Filter
public $mode = 'ajax'; public $mode = 'ajax';
public $user; public $user;
public $role; public /*.User.*/$role;
public $whitelist; public $whitelist;
function __construct($processor, $role, $whitelist = []) { function __construct($processor, $role, $whitelist = []) {
@ -140,7 +141,7 @@ class Login extends Filter
// Параметры при неправильной авторизации // Параметры при неправильной авторизации
// Действия по умолчанию !! Возможно переход на форму регистрации // Действия по умолчанию !! Возможно переход на форму регистрации
if ($request->get('mode') == 'ajax') { if ($request->get('mode') == 'ajax') {
if (!$this->requestIsWhite($request, $this->whiteRequestList)) { if (!$this->requestIsWhite($request, $this->whitelist)) {
return json_encode(array('result' => 'fail', 'message' =>"NOT_AUTHORIZED")); return json_encode(array('result' => 'fail', 'message' =>"NOT_AUTHORIZED"));
} }
} else { } else {

View file

@ -38,7 +38,7 @@ class OptionFactory {
try { try {
$query_result = $this->db->executeQuery("SELECT * FROM $table"); $query_result = $this->db->executeQuery("SELECT * FROM $table");
$field->options = $this->optionsDB($key, $value, $query_result); $field->options = $this->optionsDB($key, $value, $query_result);
} catch(Exception $ex) { } catch(\Exception $ex) {
$field->options = []; $field->options = [];
} }
} elseif (isset($input['options.pair'])) { } elseif (isset($input['options.pair'])) {

View file

@ -372,7 +372,7 @@ class Path
*/ */
public function getContent($allow = null, $ignore = array()) public function getContent($allow = null, $ignore = array())
{ {
$ignore = array_merge(array(".", ".."), $ignore); $ignore = array_merge(array(".", ".."), $ignore);
return self::fileList($this->__toString(), $allow, $ignore); return self::fileList($this->__toString(), $allow, $ignore);
} }

40
src/Registry.php Normal file
View file

@ -0,0 +1,40 @@
<?php
namespace ctiso;
use ctiso\File,
Exception;
class Registry {
public $namespace = [];
function importFile($namespace, $filePath = null) {
$data = json_decode(File::getContents($filePath), true);
$data['_file'] = $filePath;
$this->namespace[$namespace] = [
'path' => $filePath,
'data' => $data
];
}
function importArray($namespace, $data = []) {
if (isset($this->namespace[$namespace])) {
$data = array_merge($this->namespace[$namespace]['data'], $data);
}
$this->namespace[$namespace] = [
'path' => null,
'data' => $data
];
}
public function get($ns, $key) {
return $this->namespace[$ns]['data'][$key];
}
public function has($ns, $key) {
return isset($this->namespace[$ns]['data'][$key]);
}
function set($ns, $key, $value) {
$this->namespace[$ns]['data'][$key] = $value;
}
}

View file

@ -10,12 +10,12 @@
* Имя необходимо чтобы потом легко было удалить ненужные ветки дерева * Имя необходимо чтобы потом легко было удалить ненужные ветки дерева
*/ */
namespace ctiso; namespace ctiso;
use ctiso\Collection, use ctiso\File,
ctiso\File,
Exception; Exception;
class Settings extends Collection class Settings
{ {
public $data;
protected $file; protected $file;
protected $format = 'php'; protected $format = 'php';
@ -45,7 +45,8 @@ class Settings extends Collection
if (!is_array($settings)) { if (!is_array($settings)) {
throw new Exception($this->file); throw new Exception($this->file);
} }
return $this->import($settings);
$this->data = $settings;
} }
/** /**
@ -175,11 +176,20 @@ class Settings extends Collection
file_put_contents (($file) ? $file : $this->file, $result); file_put_contents (($file) ? $file : $this->file, $result);
} }
/** public function set($key, $value) {
* Список модулей $this->data[$key] = $value;
*/ }
public function getModules()
public function get($key, $default = null)
{ {
return array_keys($this->data); return isset($this->data[$key]) && $this->data[$key] != '' ? $this->data[$key] : $default;
}
function export() {
return $this->data;
}
function import($data) {
$this->data = $data;
} }
} }

View file

@ -32,7 +32,7 @@ class Tales_Component implements PHPTAL_Tales
} }
class Tales { class Tales {
static $site; static /*.Site.*/$site;
static function phptal_date ($e) { static function phptal_date ($e) {
return date("d.m.Y", $e); return date("d.m.Y", $e);

View file

@ -4,7 +4,7 @@ namespace ctiso;
class Url { class Url {
public $parts = []; public $parts = [];
public $parent; public /*.Url.*/$parent;
function __construct() { function __construct() {
} }

View file

@ -30,7 +30,7 @@ class Count extends AbstractRule
$count = count(array_filter(array_map('trim', $count = count(array_filter(array_map('trim',
explode(";", $container->get($this->field))), array($this, 'not_empty'))); explode(";", $container->get($this->field))), array($this, 'not_empty')));
return $count >= $this->size && $count <= $this->max; return $count >= $this->size && $count <= ((int)$this->max);
} }
} }

View file

@ -2,7 +2,7 @@
namespace ctiso\View; namespace ctiso\View;
use ctiso\View\View, use ctiso\View\View,
App\Controller\Site, App\Controller\Site, /* Нужно импортровать интерфейс */
ctiso\Controller\Component, ctiso\Controller\Component,
ctiso\HttpRequest; ctiso\HttpRequest;
@ -10,7 +10,7 @@ class Page extends View
{ {
private $counter; private $counter;
public $text; public $text;
public $site; public /*.Site.*/$site;
function __construct($data, $site) function __construct($data, $site)
{ {
@ -55,8 +55,7 @@ class Page extends View
function replaceContent($match, $offset) function replaceContent($match, $offset)
{ {
/*.Component.*/$component = null; /*.Component.*/$component = $this->site->loadComponent($match);
$component = $this->site->loadComponent($match);
$req = new HttpRequest(); $req = new HttpRequest();
unset($req['active_page']); unset($req['active_page']);

View file

@ -29,7 +29,7 @@ class Top extends Composite {
private function groupFiles(array $list, $debugMode = true) private function groupFiles(array $list, $debugMode = true)
{ {
$debug = ($debugMode) ? 'debug=1' : ''; $debug = ($debugMode) ? 'debug=1' : '';
$path = parse_url(WWW_PATH, PHP_URL_PATH); $path = parse_url($this->config->get('system', 'web'), PHP_URL_PATH);
$groups = array(); $groups = array();
$use = array(); $use = array();
@ -120,7 +120,7 @@ class Top extends Composite {
$this->set('deps', implode(",", array_values($this->require))); $this->set('deps', implode(",", array_values($this->require)));
$this->set('title', $this->getTitle()); $this->set('title', $this->getTitle());
$this->set('jspath', enableHttps(WWW_PATH)); $this->set('jspath', enableHttps($this->config->get('system', 'web')));
// //
return $this->execute(); // execute+phptal ?? return $this->execute(); // execute+phptal ??
} }

View file

@ -2,6 +2,6 @@
namespace ctiso; namespace ctiso;
class WrongRequestException extends Exception class WrongRequestException extends \Exception
{ {
} }