From df2e65a6702f16cd73cfbe9dd28be5fb679e3b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=91=D0=B4=D0=BE=D1=80=20=D0=9F=D0=BE=D0=B4=D0=BB?= =?UTF-8?q?=D0=B5=D1=81=D0=BD=D0=BE=D0=B2?= Date: Thu, 14 Jul 2016 16:29:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=B2=20utf-8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PHPTAL/RepeatController.php | 2 +- core/adapter.php | 2 +- core/collection.php | 6 +- core/connection/httpconnection.php | 18 +-- core/connection/httpconnectionresponse.php | 10 +- core/controller/admincontroller.php | 140 ++++++++++----------- core/controller/component.php | 28 ++--- core/controller/controller.php | 92 +++++++------- core/controller/frontcontroller.php | 24 ++-- core/controller/installer.php | 10 +- core/database.php | 2 +- core/drivers/database.mysql.php | 2 +- core/drivers/database.odbc.php | 2 +- core/drivers/database.pgsql.php | 2 +- core/drivers/db.php | 2 +- core/file.php | 4 +- core/filesystem.php | 28 ++--- core/filter/actionaccess.php | 10 +- core/filter/filter.php | 8 +- core/filter/filterbase.php | 2 +- core/filter/filterlogin.php | 32 ++--- core/form.php | 56 ++++----- core/form/form.php | 36 +++--- core/form/viewstate.php | 2 +- core/formats/dot.php | 6 +- core/functions.php | 40 +++--- core/geometry/rectangle.php | 4 +- core/httprequest.php | 2 +- core/json.php | 4 +- core/layout/layout.php | 24 ++-- core/mail.php | 32 ++--- core/mapper/factory.php | 2 +- core/mapper/mapper.php | 58 ++++----- core/mapper/pathmapper.php | 6 +- core/path.php | 68 +++++----- core/primitive.php | 12 +- core/query/meta.php | 2 +- core/query/query.php | 50 ++++---- core/query/table.php | 2 +- core/search/htmlhelper.php | 20 +-- core/search/index.php | 14 +-- core/search/lexer.php | 8 +- core/search/search.php | 8 +- core/search/searcher.php | 18 +-- core/search/stemmer.php | 38 +++--- core/settings.php | 30 ++--- core/setup.php | 12 +- core/shortcut.php | 8 +- core/spell.php | 8 +- core/tabletree.php | 34 ++--- core/tales.php | 4 +- core/tools/exceltable.php | 80 ++++++------ core/tools/templateimage.php | 12 +- core/tools/translit.php | 14 +-- core/tree/dbtree.php | 6 +- core/tree/sort.php | 18 +-- core/validator/rule/alpha.php | 4 +- core/validator/rule/code.php | 4 +- core/validator/rule/count.php | 4 +- core/validator/rule/date.php | 4 +- core/validator/rule/email.php | 4 +- core/validator/rule/emaillist.php | 4 +- core/validator/rule/match.php | 4 +- core/validator/rule/notnull.php | 2 +- core/validator/rule/numeric.php | 4 +- core/validator/rule/time.php | 4 +- core/validator/rule/unique.php | 2 +- core/validator/validator.php | 24 ++-- core/view/compositeview.php | 52 ++++---- core/view/view.php | 2 +- core/widgets/dialog.php | 2 +- core/widgets/filebrowser.php | 2 +- core/widgets/listtable.php | 4 +- core/widgets/menu.php | 16 +-- core/widgets/pagemenu.php | 2 +- core/widgets/pages.php | 2 +- core/widgets/search.php | 4 +- core/widgets/tree.php | 4 +- core/widgets/widget.php | 16 +-- core/zipfile.php | 2 +- 80 files changed, 668 insertions(+), 668 deletions(-) diff --git a/PHPTAL/RepeatController.php b/PHPTAL/RepeatController.php index e902c25..6d05807 100644 --- a/PHPTAL/RepeatController.php +++ b/PHPTAL/RepeatController.php @@ -299,7 +299,7 @@ class PHPTAL_RepeatController implements Iterator * Keeps track of variable contents when using grouping in a path (first/ and last/) * * @package phptal - * @author Ivn Montes + * @author Ivбn Montes */ class PHPTAL_RepeatController_Groups { diff --git a/core/adapter.php b/core/adapter.php index 8169fb3..9200f43 100644 --- a/core/adapter.php +++ b/core/adapter.php @@ -1,7 +1,7 @@ table->setHeader + * FIXME: Лучше $this->table->setHeader */ public $tableSchema = null; public $formSchema = array(); @@ -44,8 +44,8 @@ class Controller_Model extends Controller_Action */ function setUp() { - $this->table->addMenuItem($this->aUrl('delete'), '', false, 'all', 'warning'); - //$this->table->addMenuItem($this->nUrl('form'), '', 'edit-24.png'); + $this->table->addMenuItem($this->aUrl('delete'), 'удалить', false, 'all', 'warning'); + //$this->table->addMenuItem($this->nUrl('form'), 'редактировать', 'edit-24.png'); } function saveParameters($args, $list) @@ -66,12 +66,12 @@ class Controller_Model extends Controller_Action } /** - * + * Удаление сторк из таблицы */ public function actionDelete(HttpRequest $request) { $model = $this->getModel($this->useModel); - // table_item ??? + // Почему table_item ??? $list = ($request->get('table_item')) ? $request->get('table_item'): $request->get('id'); $model->deleteList($list); @@ -79,7 +79,7 @@ class Controller_Model extends Controller_Action } /** - * + * Ответ на запрос по поиску */ public function actionSearch(HttpRequest $request) { @@ -90,7 +90,7 @@ class Controller_Model extends Controller_Action } /** - * + * Список элементов */ public function actionList(HttpRequest $request) { @@ -110,47 +110,47 @@ class Controller_Model extends Controller_Action } /** - * + * Сохранение формы */ function beforeSave(/*Model*/ $item, Collection $request) { if (empty($this->formSchema)) { $this->setFormSchema(); } - // <-- beforeSave + // Сделать отображение Формы в обьект и обратно <-- Убрать в beforeSave foreach ($this->formSchema as $key => $conv) { list($value, $type) = $conv; - $item->$value = call_user_func(array('Cast', 'to_' . $type), $request->get($key)); // + $item->$value = call_user_func(array('Cast', 'to_' . $type), $request->get($key)); // Здесть нужно преобразовывать тип значения } } /** - * + * Обновление формы */ function formUpdate(TForm $form, Collection $request) { } /** - * + * Загрузка формы */ function beforeLoad(/*Model*/ $item, TForm $form) { if (empty($this->formSchema)) { $this->setFormSchema(); } - // - // + // Вставка значений из данных в форму + // Отображение обьекта в поля формы $form->fill($item, $this->formSchema); } - // + // Проверка ввода protected function validate($validator, $request) { } /** - * + * Действие для проверки формы */ public function actionValidate($request) { @@ -158,10 +158,10 @@ class Controller_Model extends Controller_Action $validator = new Validator(); $validator->addRuleList($this->schema); - // + // Действия до проверки формы $this->validate($validator, $request); // <--| $validator->validate($request); // --| - // + // Проверка формы if (!$validator->isValid()) { return json::encode($validator->getErrorMsg()); } @@ -169,7 +169,7 @@ class Controller_Model extends Controller_Action } /** - * + * Инициализация формы */ protected function formSetup($form, $id = null, $ref = null) { @@ -185,65 +185,65 @@ class Controller_Model extends Controller_Action } /** - * + * Добавление пользователя */ public function actionAdd(HttpRequest $request) { require_once "core/validator/validator.php"; - // {{{ ref + // {{{ тоже может быть один ref или несколько $ref = $request->get('ref'); - $this->addParameter('ref', $ref); // url + $this->addParameter('ref', $ref); // Добавляет параметр в url /// }}} if ($this->checkPageId($request, $request->get('page'))) { - // + // Проверка $validator = new Validator(); $validator->addRuleList($this->schema); - // + // Действия до проверки формы $this->validate($validator, $request); // <--| $validator->validate($request); // --| - // + // Проверка формы if (!$validator->isValid()) { $request->setAction('form'); $this->getActionPath($request); $form = new TForm(); - $this->formSetup($form, $request->get('id'), $request->get('ref')); // + $this->formSetup($form, $request->get('id'), $request->get('ref')); // Инициализация формы - $form->setValues($request); // <-- formUpdate + $form->setValues($request); // <-- Убрать в formUpdate $this->formUpdate($form, $request); - $form->setError($validator); // + $form->setError($validator); // Установка ошибок для формы $tpl = $this->formPage($form, $request); $id = $request->get('id'); - if ($id) { // - $tpl->action = forceUrl($this->nUrl('add', array('id' => $id, 'page' => $this->getPageId($request)))); // action + if ($id) { // Редактирование + $tpl->action = forceUrl($this->nUrl('add', array('id' => $id, 'page' => $this->getPageId($request)))); // action Совйство формы } return $tpl /*->execute()*/; } - // + // Нужен тест для формы $model = $this->getModel($this->useModel); $className = $model->className; $item = new $className(); - // + // Сохраняем значение в базе данных $item->id = $request->get('id'); - // + // Если таблица связана с другой таблицей if ($request->get('ref') && $model->reference[1]) { $ref_id = $model->reference[1]; $item->$ref_id = $request->get('ref'); } - // - $this->beforeSave($item, $request); // - // nextId ??? + // Подготовка к сохранению + $this->beforeSave($item, $request); // Сюдаже и истрия переходов + // nextId ??? или выход или новая форма для создания новости $model->saveDB($item, $request); } - // id -> !!?? + // Для страницы со списком id -> идентефикатор родительской таблицы !!?? // $request->set('id', $request->get('ref')); if ($request->get('apply')) { $request->setAction('form'); @@ -253,7 +253,7 @@ class Controller_Model extends Controller_Action } /** - * + * Заголовок */ private function setTitlePath($ref) { @@ -263,37 +263,37 @@ class Controller_Model extends Controller_Action $refmodel = $this->getModel($model->reference[0]); try { $parent = $refmodel->findById($ref); - $this->path->addTitle($parent->getTitle()); // + $this->path->addTitle($parent->getTitle()); // Заголовок к подписям путей } catch (Exception $e) { - // + // Не найден заголовок потому что неправильно определен родительский элемент } } } } /** - * + * Форма для редактирования */ public function actionForm(HttpRequest $request) { $this->getActionPath($request); $ref = $request->get('ref'); - $this->addParameter('ref', $ref); // url + $this->addParameter('ref', $ref); // Добавляет параметр в url $this->setTitlePath($ref); $model = $this->getModel($this->useModel); - $form = new TForm(); // - $form->header = ' '; - $this->formSetup($form, $request->get('id'), $request->get('ref')); // + $form = new TForm(); // Показываем форму + $form->header = 'Редактирование записи'; + $this->formSetup($form, $request->get('id'), $request->get('ref')); // Инициализация формы $list = $request->get('table_item'); $id = ($list[0]) ? $list[0] : $request->get('id'); $tpl = $this->formPage ($form, $request); - if ($id) { // - $form->action = forceUrl($this->nUrl('add', array('id' => $id, 'page' => $this->getPageId($request)))); // action + if ($id) { // Редактирование + $form->action = forceUrl($this->nUrl('add', array('id' => $id, 'page' => $this->getPageId($request)))); // action Свойство формы $item = $model->findById($id); - // + // Загрузка формы $this->beforeLoad($item, $form); /// } @@ -304,11 +304,11 @@ class Controller_Model extends Controller_Action */ function tableSetup($table, $id = null, $ref = null) { - // FIXME: $tableSchema -> table->setHeader ! + // FIXME: После замены везде $tableSchema -> table->setHeader удалить! if ($this->tableSchema) { $table->setHeader($this->tableSchema); } else { - // + // Настройка таблицы отображения по схеме данных require_once 'core/mapper/uimapper.php'; $model = $this->getModel($this->useModel); $ui = new UIMapper($model); @@ -324,17 +324,17 @@ class Controller_Model extends Controller_Action public function actionIndex(HttpRequest $request) { $this->getActionPath($request, 'index'); - // + // Такое мета действие наверное можно вынести в отдельный класс return $this->metaActionIndex($request, array($this, 'tableSetup'), $this->aUrl('list')); } /** - * + * Страница по умолчанию */ public function metaActionIndex(HttpRequest $request, $setup, $list) { - // ref - // {{{ + // может быть одно ref или несколько + // {{{ история переходов $ref = null; if ($request->get('ref')) { $ref = $request->get('ref'); @@ -349,9 +349,9 @@ class Controller_Model extends Controller_Action $tpl = $this->getView('list'); - // + // Помошники действий $this->callHelpers($request); - // + // Таблица if ($request->session()->get(strtolower(get_class($this)))) { $session = $request->session()->get(strtolower(get_class($this))); if (isset($session['view'])) { @@ -368,28 +368,28 @@ class Controller_Model extends Controller_Action } } - call_user_func($setup, $this->table, $request->get('id'), $ref);// --> formSetup + call_user_func($setup, $this->table, $request->get('id'), $ref);// --> Эквивалент formSetup $this->table->setAction($list); // $tpl->menu_path = $this->path->getItems(); - // + // Поиск $search = new SearchDialog(); - $search->setTitle(''); + $search->setTitle('Поиск'); $search->setAction($this->aUrl('search')); $search->setFriend($this->table); $search->addFields($this->schemaSearch); - // + // Настройки $setup = new SetupDialog(); - $setup->setTitle(''); + $setup->setTitle('Настройки'); $setup->setAction($this->nUrl('setup')); $setup->setFriend($this->table); - // - $this->menu->addMenuItem('?menu=toggle&id=' . $search->getName(), '', 'actions/system-search'); // 22-24px - $this->menu->addMenuItem('?menu=toggle&id=' . $setup->getName(), '', 'categories/applications-system'); - // + // Меню + $this->menu->addMenuItem('?menu=toggle&id=' . $search->getName(), 'поиск', 'actions/system-search'); // Стандартный размер для иконок 22-24px + $this->menu->addMenuItem('?menu=toggle&id=' . $setup->getName(), 'настройки', 'categories/applications-system'); + // Добавление компонентов $this->addChild('menu', $this->menu); $this->addChild('search', $search); $this->addChild('setup', $setup); @@ -417,14 +417,14 @@ class Controller_Model extends Controller_Action { $view = $this->getView('form'); $view->setView('form', $form); - $view->action = forceUrl($this->nUrl('add', array('page' => $this->getPageId($request)))); // + $view->action = forceUrl($this->nUrl('add', array('page' => $this->getPageId($request)))); // Действие для формы $view->menu_path = $this->path->getItems(); $view->back = $this->path->getPrev(); return $view; } - // Controller_Model + // Тоже убрать в метод Controller_Model function getActionPath(HttpRequest $request/*, $action = false*/) { require_once 'state.php'; diff --git a/core/controller/component.php b/core/controller/component.php index a4b63d4..0d3ecd6 100644 --- a/core/controller/component.php +++ b/core/controller/component.php @@ -7,12 +7,12 @@ class FileNotFountException extends Exception } /** - * + * Класс компонента */ class Component { static $_uid = 1; - public $uid; // UID , , + public $uid; // UID компонента создается при создании страницы, вставки компонента, или это статическое свойство public $viewPath; public $registry; // Registry->getInstance public $template; @@ -33,7 +33,7 @@ class Component require_once "core/view/compositeview.php"; // $template = ($this->template) ? $this->template : $this->_registry->readKey(array('system', 'template')); - // + // Загружать шаблон по умолчанию если не найден текущий if (is_dir(Path::join($this->viewPath, 'templates', $template))) { $template_file = Path::join($this->viewPath, 'templates', $template, $name); } else { @@ -59,7 +59,7 @@ class Component } /** - * @param $name + * @param $name Имя модели */ private function getModelPath($name) { @@ -67,7 +67,7 @@ class Component } /** - * + * Создает модель * @param string $name * @return model */ @@ -98,8 +98,8 @@ class Component return $result; } - /* - + javascript + /* В дальнейшем нужно зменить на методы + + Методы могут быть и javascript */ protected $editUrl; @@ -115,7 +115,7 @@ class Component } /** - * TALES + * TALES для подключения компонентов * component:name?param1=value1¶m2=value2 */ class Component_Tales implements PHPTAL_Tales @@ -143,13 +143,13 @@ function loadComponent($name, $db, $registry) } /** - * + * Функция подключения компонента */ global $componentList; $componentList = array(); function phptal_component ($real_expression, $offset = 0) { - global $db, $registry, $componentList; // + global $db, $registry, $componentList; // Нужно както передавать параметры $expression = htmlspecialchars_decode($real_expression); $url = parse_url($expression); @@ -165,9 +165,9 @@ function phptal_component ($real_expression, $offset = 0) { $componentList [] = array( 'uid' => $component->getUID(), 'params' => $expression, 'name' => $name, 'offset' => $offset, 'size' => strlen($real_expression), - /* - edit ( ), new ( ), ... - ! + /* Вместо ссылки на редактирование нужно передавать список методов для работы с компонентом + edit (редактирование содержание), new (новое содержание), шаблон коменнента ... вместе с иконками этих методов + ! Компоненты могут содержать другие компоненты */ 'editurl' => $component->getEditUrl(), 'newurl' => '' @@ -179,7 +179,7 @@ function phptal_component ($real_expression, $offset = 0) { return $component->execute($params, $req); } -/* */ +/* Регистрация нового префикса для подключения компонента */ $registry = PHPTAL_TalesRegistry::getInstance(); $registry->registerPrefix('component', array('Component_Tales', 'component')); diff --git a/core/controller/controller.php b/core/controller/controller.php index 3aa806d..36db024 100644 --- a/core/controller/controller.php +++ b/core/controller/controller.php @@ -14,32 +14,32 @@ function forceUrl($name) } /** - * + * Контроллер страниц * @package core */ class Controller { - const TEMPLATE_EXTENSION = ".html"; // - const ACTION_PREFIX = "action"; // + const TEMPLATE_EXTENSION = ".html"; // Расширение для шаблонов + const ACTION_PREFIX = "action"; // Префикс для функций действий - public $jsPath; // - public $themePath; // + public $jsPath; // Глобальный путь к скриптам + public $themePath; // Глобальный путь к текущей теме - // - public $name; // - public $viewPath = null; // - public $db; // + // Параметры устанавливаются при создании контроллера + public $name; // Имя модуля + public $viewPath = null; // Путь к шаблонам контроллера + public $db; // Соединение с базой данных - // - public $access; // - public $logger; // + // Фильтры + public $access; // Обьект хранит параметры доступа + public $logger; // Обьект для ведения лога - private $factory; // - private $helpers = array(); // - public $param = array(); // + private $factory; // Ссылка на обьект создания модели + private $helpers = array(); // Помошники для действий + public $param = array(); // Параметры для ссылки - public $_registry; // + public $_registry; // Ссылка на реестр public $_shortcut; public function __construct () @@ -83,7 +83,7 @@ class Controller } /** - * + * Создает представление * @param string $file * @return template */ @@ -92,7 +92,7 @@ class Controller require_once "core/view/compositeview.php"; $file = $name . self::TEMPLATE_EXTENSION; - // + // Список возможных директорий для поиска файла шаблона $theme = $this->_registry->readKey(array('system', 'theme')); $icon_theme = $this->_registry->readKey(array('system', 'icon_theme')); $list = array( @@ -100,17 +100,17 @@ class Controller PHPTAL_TEMPLATE_REPOSITORY => ""); - // + // Поиск файла для шаблона foreach($list as $ospath => $path) { $template = Path::join($ospath, $file); if(file_exists($template)) { break; } } $tpl = new View_Composite($template); - $tpl->icons = $this->iconPath; // - $tpl->media = $this->themePath; // - $tpl->script = $this->jsPath; // - $tpl->template = $path; // + $tpl->icons = $this->iconPath; // Путь к файлам текущей темы + $tpl->media = $this->themePath; // Путь к файлам текущей темы + $tpl->script = $this->jsPath; // Путь к файлам скриптов + $tpl->template = $path; // Путь к файлам текущего шаблона $tpl->setAlias(array( '${icons}' => $this->iconPath, '${media}' => $this->themePath, @@ -132,11 +132,11 @@ class Controller } /** - * - * . - * 1. - * 2. - * @param $request + * Выбор действия + * Т.к действия являются методами класса то + * 1. Можно переопределить действия + * 2. Использовать наследование чтобы добавить к старому обработчику новое поведение + * @param $request Обьект запроса */ public function execute1(HTTPRequest $request) { @@ -159,7 +159,7 @@ class Controller public function forward($action, HTTPRequest $args) { - // + // Действия до вызова основного обработчика /*foreach($this->_aspect as $aspect) { if (isset($aspect->before[$action])) { call_user_func ($aspect->before[$action], $action, $args); @@ -169,7 +169,7 @@ class Controller } /** - * + * Страница по умолчанию */ public function actionIndex(HttpRequest $request) { @@ -184,10 +184,10 @@ class Controller } /** - * c + * Генерация ссылки c учетом прав пользователя на ссылки * - * @parma string $name - * @parma string $param + * @parma string $name Действие + * @parma string $param Дополнительные параметры */ public function nUrl($name, array $param = array()) { @@ -203,7 +203,7 @@ class Controller } /** - * nUrl, aUrl + * Добавляет параметр для всех ссылок создаваемых функцией nUrl, aUrl */ public function addParameter($name, $value) { @@ -213,8 +213,8 @@ class Controller } /** - * - * Ajax mode = ajax layout + * Генерация ссылки на действие контроллера + * Ajax определяется автоматически mode = ajax используется для смены layout */ public function aUrl($name, array $param = array()) { @@ -222,7 +222,7 @@ class Controller } /** - * + * Добавление помошника контроллера */ public function addHelper($class) { @@ -230,7 +230,7 @@ class Controller } /** - * + * Вызов помошников контроллера */ public function callHelpers(HttpRequest $request) { @@ -239,13 +239,13 @@ class Controller if (method_exists($helper, $action)) { return call_user_func(array($helper, $action), $request, $this); } else { - return $helper->actionIndex($request, $this); // return response ??? + return $helper->actionIndex($request, $this); // Вместо return response ??? } } } /** - * + * Загрузка файла класса */ public function loadClass($path, $setup = null) { @@ -264,7 +264,7 @@ class Controller return $result->export(); } - // Widgets + // Для Widgets public $view = null; public $childNodes = array(); public $childViews = array(); @@ -275,7 +275,7 @@ class Controller } /** - * + * Установка заголовка для отображения */ public function setTitle($title) { @@ -283,7 +283,7 @@ class Controller } /** - * widget + * Добавление widget к отображению */ public function addChild(/*Widget*/ $section, $node) { @@ -291,7 +291,7 @@ class Controller } /** - * + * Добавление дочернего отображения к текущему отображению */ public function addView(/*CompositeView*/ $section, $node) { @@ -299,8 +299,8 @@ class Controller } /** - * - * c execute render + * Генерация содержания + * Путаница c execute и render */ public function render() { diff --git a/core/controller/frontcontroller.php b/core/controller/frontcontroller.php index f6106b2..c88d74e 100644 --- a/core/controller/frontcontroller.php +++ b/core/controller/frontcontroller.php @@ -4,15 +4,15 @@ require_once 'core/controller/controller.php'; require_once 'core/controller/installer.php'; /** - * + * Первичный контроллер контроллер страниц * @package core */ class Controller_Front extends Controller { - protected $shortcut; // - protected $_param; // - protected $default; // + protected $shortcut; // Ярлык к модулю + protected $_param; // Параметр по которому выбирается модуль + protected $default; // Значение параметра по умолчанию protected $installer; public function __construct(Settings $_registry, $_shortcut) @@ -29,9 +29,9 @@ class Controller_Front extends Controller /** - * - * @param string $name - * @param request $request + * Создает экземпляр модуля и выполняет действия для него + * @param string $name Имя модуля + * @param request $request Имя модуля * @return string */ public function loadModule($name, Collection $request) @@ -43,7 +43,7 @@ class Controller_Front extends Controller $module = $this->loadClass($moduleFile); if ($module) { - // + // Инициализация модуля // $module->viewPath = dirname($moduleFile); $module->viewPath = Shortcut::getUrl('modulepath', $name); $module->name = $name; @@ -57,11 +57,11 @@ class Controller_Front extends Controller $module->themePath = $this->themePath; // -> Registry $module->jsPath = $this->jsPath; // -> Registry $module->db = $this->db; - // - // + // Не для всех приложений нужно вести лог действий + // Ведение лога $logger = $this->loadClass(FRAMEWORK_PATH . '/core/filter/actionlogger.php', $module); $logger->before = $this->loadSettings(Shortcut::getUrl('logger', $name)); - // + // Управление доступом $module->access = $this->loadClass(FRAMEWORK_PATH . '/core/filter/actionaccess.php', $logger); $module->access->access = $this->loadSettings(Shortcut::getUrl('access', $name)); @@ -75,7 +75,7 @@ class Controller_Front extends Controller public function setParameter($shortcut, $param, $name) { $this->shortcut = $shortcut; - // + // Параметр $this->_param = $param; $this->default = $name; } diff --git a/core/controller/installer.php b/core/controller/installer.php index 11fbac6..a148839 100644 --- a/core/controller/installer.php +++ b/core/controller/installer.php @@ -24,8 +24,8 @@ class Installer return Path::join(call_user_func($this->installPath, $name), "setup.php"); } - // - function isChanged($name) // + // Проверка версии обновления + function isChanged($name) // Информация о модулях { $item = $this->_registry->readKey(array($name)); if ($item) { @@ -50,8 +50,8 @@ class Installer } } - // - function doUpdates($name, $force = false) // + // Устанавливает обновления если есть + function doUpdates($name, $force = false) // Установка модуля { $setup = $this->getSetupFile($name); if (file_exists($setup) && ($this->isChanged($name) || $force)) { @@ -77,7 +77,7 @@ class Installer } } - // + // Обновление версии меню $registry->writeKey(array($name), $settings->get('settings')); $registry->writeKey(array($name), array('version' => $version_new, diff --git a/core/database.php b/core/database.php index cf34f57..f26488d 100644 --- a/core/database.php +++ b/core/database.php @@ -1,7 +1,7 @@ getSize(); - foreach (array(' ', 'K', 'M') as $suffix) { + foreach (array('б ', 'Kб', 'Mб') as $suffix) { if (($size / 1024) <= 1) { return round($size, 0) . ' ' . $suffix; } diff --git a/core/filesystem.php b/core/filesystem.php index 68bf1b8..b28f17a 100644 --- a/core/filesystem.php +++ b/core/filesystem.php @@ -5,7 +5,7 @@ require_once 'core/file.php'; interface IFileSystem { - // + // Операции над файлами public function makeDirectory($name); public function deleteDirectory($name); @@ -18,7 +18,7 @@ interface IFileSystem public function readFile($source); public function writeFile($source, $content); - // + // Содержание директории public function directoryFiles($name); public function directoryFilesRecursive($name); } @@ -27,12 +27,12 @@ interface IFileControl { public function commitFile($name, $who, $message); public function readFileVersion($name, $version = false); - // + // Информация о файле public function getFileLog($name); public function getFileInfo($name); } -// +// Реальная файловая система class FileSystem implements IFileSystem { protected $hidden = array('.', '..'); @@ -111,7 +111,7 @@ class FileSystem implements IFileSystem } } - // + // При перемещении или все файлы если есть совпадения переписываются /** * */ @@ -211,7 +211,7 @@ class FileSystem implements IFileSystem } } -// +// То что хранится в базе данных class EFileSystem implements IFileSystem, IFileControl { @@ -280,7 +280,7 @@ class EFileSystem implements IFileSystem, IFileControl $index = $result->getInt('idfile'); return $index; } - return false; // ?? + return false; // Может лучше кидать исключение ?? } function getIdFromPath($name) @@ -288,7 +288,7 @@ class EFileSystem implements IFileSystem, IFileControl return $this->getRecordId(basename($name), self::getPathName($name)); } - // + // Создание новой директории public function makeDirectory($name) { $path = new Path($name); @@ -311,10 +311,10 @@ class EFileSystem implements IFileSystem, IFileControl return $this->fs->isDir($this->getFullPath($name)); } - // !!! + // Переименование файла или директории все изменения должны записываться в базу чтобы можно было сделать отмену !!! public function renameFile($source, $destination) { - // + // При перемещении файлы могут совпадать $stmt = $this->db->prepareStatement('UPDATE files SET filepath = ?, filename = ? WHERE filepath = ? AND filename = ?'); $stmt->setString(1, self::getPathName($destination)); $stmt->setString(2, basename($destination)); @@ -335,10 +335,10 @@ class EFileSystem implements IFileSystem, IFileControl $this->fs->renameFile($this->getFullPath($source), $this->getFullPath($destination)); } - // + // Копирование файла или директории public function copyFile($source, $destination) { - // + // При копировании файлы могут совпадать $stmt = $this->db->prepareStatement('INSERT INTO files (filepath, filename, lastrevdate) VALUES (?, ?, ?)'); $stmt->setString(1, self::getPathName($destination)); $stmt->setString(2, basename($destination)); @@ -466,7 +466,7 @@ class EFileSystem implements IFileSystem, IFileControl { $result = $this->fs->directoryFiles($this->getFullPath($name)); - /* */ + /* Список файлов из базы данных */ $query = $this->db->prepareStatement("SELECT * FROM files WHERE filepath = ?"); $query->setString(1, $name); $list = $query->executeQuery(); @@ -530,7 +530,7 @@ class EFileSystem implements IFileSystem, IFileControl } /** - * + * Удаляем директорию если она не пустая */ function deleteDirectory($name) { diff --git a/core/filter/actionaccess.php b/core/filter/actionaccess.php index c289248..a44721b 100644 --- a/core/filter/actionaccess.php +++ b/core/filter/actionaccess.php @@ -1,7 +1,7 @@ access[$action]) || in_array(UserAccess::$access, $this->access[$action])); } diff --git a/core/filter/filter.php b/core/filter/filter.php index ea61093..126b21d 100644 --- a/core/filter/filter.php +++ b/core/filter/filter.php @@ -3,7 +3,7 @@ require_once 'filterbase.php'; require_once 'filterlogin.php'; -// +// Класс должен быть в библиотеке приложения class UserAccess { const LIFE_TIME = 1800; // = 30min * 60sec; @@ -50,7 +50,7 @@ class UserAccess if ($result) { $time = time(); $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; } @@ -63,9 +63,9 @@ class UserAccess if ($result) { $lasttime = $result->getInt('lasttime'); $time = time(); - if ($time - $lasttime > self::LIFE_TIME) return null; // + if ($time - $lasttime > self::LIFE_TIME) return null; // Вышло время сессии $id = self::$id; - $stmt = self::$db->executeQuery("UPDATE users SET lasttime = $time WHERE id_user = $id"); // + $stmt = self::$db->executeQuery("UPDATE users SET lasttime = $time WHERE id_user = $id"); // Время последнего обращения входа } return $result; } diff --git a/core/filter/filterbase.php b/core/filter/filterbase.php index 7a41275..d6059cd 100644 --- a/core/filter/filterbase.php +++ b/core/filter/filterbase.php @@ -1,7 +1,7 @@ getConnection(); - UserAccess::setUp($db); // + UserAccess::setUp($db); // Соединение switch ($request->getAction()) { - // + // Авторизация по постоянному паролю case 'login': $login = $request->get('login'); $password = $request->get('password'); - $result = UserAccess::getUserByLogin($login); // + $result = UserAccess::getUserByLogin($login); // Поиск по логину if ($result) { if (md5($password) == $result->getString('password')) { // password $this->enter($db, $result); @@ -38,14 +38,14 @@ class LoginFilter extends Filter } $request->set('error', true); break; - case 'logout': // + case 'logout': // Выход session_destroy(); break; - // + // Вход по временному паролю case 'enter': $login = $request->get('login'); $password = $request->get('sid'); - $result = UserAccess::getUserByLogin($login); // + $result = UserAccess::getUserByLogin($login); // Поиск по логину if ($result) { $temp = md5($result->getString('password') . $result->getString('login') . $result->getString('sid')); if ($password == $temp) { @@ -56,10 +56,10 @@ class LoginFilter extends Filter break; default: $hash = $this->getBrowserSign(); - // $hash $_SESSION['hash'] + // Если $hash не совпадает $_SESSION['hash'] то удаляем сессию if (isset($_SESSION ['access']) && isset($_SESSION[self::SESSION_BROWSER_SIGN_SECRET])) { if ($hash == $_SESSION[self::SESSION_BROWSER_SIGN_SECRET]) { - UserAccess::getUserById($_SESSION ['access']); // + UserAccess::getUserById($_SESSION ['access']); // Поиск по идентификатору return true; } else { session_destroy(); @@ -94,8 +94,8 @@ class LoginFilter extends Filter public function execute(Collection $request) { if (!$this->isLoggin($request)) { - // - // !! + // Параметры при неправильной авторизации + // Действия по умолчанию !! Возможно переход на форму регистрации $request->set('module', 'login'); $request->set('mode', $this->mode); } diff --git a/core/form.php b/core/form.php index 30ee46a..af3dfac 100644 --- a/core/form.php +++ b/core/form.php @@ -7,7 +7,7 @@ require_once 'core/adapter.php'; /** - * API + * Новое API для Форм * $form = new Form (); * $form->render () -> html, * $form->adjust ($scheme); @@ -20,24 +20,24 @@ require_once 'core/adapter.php'; */ /** - * + * Элемент формы * @package core */ class TField { - protected $_value; // + protected $_value; // Форматированное значение поля - var $label; // - var $rule = array ();// - var $value; // -// var $default; // - var $error = false; // XRule - var $error_msg = " "; - var $type; // TAL + var $label; // Метка поля + var $rule = array ();// Правила для проверки поля + var $value; // Форматированное Значение поля +// var $default; // Значение по умолчанию + var $error = false; // в XRule Правила для проверки значений + var $error_msg = "Поле не может быть пустым"; + var $type; // Каждому типу элемента соответствует макрос TAL public function __construct ($input) { // $this->deafult = null; $this->require = false; - // + // Инициализация свойст обьетка foreach ($input as $key => $value) { $this->$key = $value; } @@ -56,7 +56,7 @@ class TField { return true; } - // getString, setString ?? + // Добавить методы getString, setString ?? function setValue ($value) { $this->_value = $value; @@ -69,7 +69,7 @@ class TField { } /** - * Input + * Поле ввода Input * @package core */ class TInput extends TField { @@ -95,7 +95,7 @@ class TCheckbox extends TField { } /** - * + * Выбор из одного элемента */ class TSelect1 extends TField { var $options = array (); @@ -134,11 +134,11 @@ class TSelectGroup extends TField { } /** - * + * Поле с датой * @package core */ class TDate extends TField { - var $error_msg = " "; + var $error_msg = "Неверный формат даты"; var $separator = "."; public function __construct ($input) { @@ -167,7 +167,7 @@ class TDate extends TField { } class TTime extends TField { - var $error_msg = " "; + var $error_msg = "Неверный формат времени"; public function __construct ($input) { parent::__construct ($input); @@ -200,7 +200,7 @@ class TTime extends TField { /* * - * + * Текстовое поле * @package core */ class TTextArea extends TField { @@ -211,7 +211,7 @@ class TTextArea extends TField { } /** - * + * Поле для ввода пароля * @package core */ class TSecret extends TField { @@ -235,7 +235,7 @@ class TUpload extends TField { } /** - * + * Форма для ввода * @package core */ class TForm { @@ -271,12 +271,12 @@ class TForm { } /** - * - * + * Метод должен проверять значения полей формы полсле заполнения + * Проверка правильности заполнения формы и установка значений */ function isValid () { $haveErrors = false; - foreach ($this->field as $name => $el) { // + foreach ($this->field as $name => $el) { // ссылка if ($this->field [$name] instanceof TUpload) { // print_r ($_POST); $filename = $this->request->getRawData ('files', $name); @@ -296,7 +296,7 @@ class TForm { } /** - * + * Добавляет одно поле ввода на форму */ public function addField ($init) { assert ($init['type']); @@ -310,7 +310,7 @@ class TForm { } /** - * + * Добавляет спсок полей для формы * @param array $list */ public function addFieldList ($list) { @@ -320,10 +320,10 @@ class TForm { } /** - * - * Adapter pattern + * Заполняет форму данными из коллекции + * Для обьектов и массивов можно использовать Adapter pattern * @param object $data - * @param array $schema + * @param array $schema Связь между элементами формы и свойствами обьекта */ public function fill ($data) { foreach ($this->field as $name => $el) { diff --git a/core/form/form.php b/core/form/form.php index 7471c02..e32b431 100644 --- a/core/form/form.php +++ b/core/form/form.php @@ -1,15 +1,15 @@ require = strpos($input['validate'], 'require') !== false; } - // + // Инициализация свойст обьетка foreach (array('label', 'name', 'type') as $name) { $this->$name = $input[$name]; } @@ -33,14 +33,14 @@ class TField } /** - * Input + * Поле ввода Input * @package core */ class TInput extends TField { } /** - * + * Выбор из одного элемента */ class TSelect1 extends TField { @@ -52,13 +52,13 @@ class TSelect1 extends TField function setValue($value) { - // selected options + // Установить selected у options $this->value = $value; } } /** - * + * Поле с датой * @package core */ class TDate extends TField @@ -66,7 +66,7 @@ class TDate extends TField } /* * - * + * Текстовое поле * @package core */ class TTextArea extends TField @@ -74,7 +74,7 @@ class TTextArea extends TField } /** - * + * Поле для ввода пароля * @package core */ class TSecret extends TField @@ -86,7 +86,7 @@ class TUpload extends TField } /** - * + * Форма для ввода * @package core */ class TForm @@ -111,7 +111,7 @@ class TForm } /** - * + * Добавляет одно поле ввода на форму */ public function addField (array $init) { @@ -127,7 +127,7 @@ class TForm } /** - * + * Добавляет спсок полей для формы * @param array $list */ public function addFieldList (array $list) @@ -138,7 +138,7 @@ class TForm } /** - * + * Устанавливает ошибки после проверки */ function setError (Validator $validator) { @@ -150,7 +150,7 @@ class TForm } /** - * + * Устанавливает значения из масива */ function setValues (Collection $request) { foreach ($this->field as $key => $el) { @@ -160,9 +160,9 @@ class TForm } /** - * + * Заполняет форму данными из обьекта * @param object $data - * @param array $schema + * @param array $schema Связь между элементами формы и свойствами обьекта */ public function fill ($data, array $schema) { diff --git a/core/form/viewstate.php b/core/form/viewstate.php index 1d35737..c2ecaab 100644 --- a/core/form/viewstate.php +++ b/core/form/viewstate.php @@ -2,7 +2,7 @@ /** * http://www.alternateinterior.com/2006/09/a-viewstate-for-php.html - * + * Управление состоянием между страницами */ class ViewState // extends Collection { diff --git a/core/formats/dot.php b/core/formats/dot.php index c6da43c..3c57d3b 100644 --- a/core/formats/dot.php +++ b/core/formats/dot.php @@ -1,7 +1,7 @@ $value) { foreach ($value as $n) { $result [] = "\t\"$key\" -> \"$n\"\n"; diff --git a/core/functions.php b/core/functions.php index 02f9b76..f3bd521 100644 --- a/core/functions.php +++ b/core/functions.php @@ -1,12 +1,12 @@ array('a' => 1, 'b' => 2))) => array(1) * * @return mixed @@ -261,7 +261,7 @@ function _get_key($key, $value, $array) { /** - * && + * Логическа операция && ко всем элементам массива * @return bool */ function every(array $array, $callback) { @@ -274,7 +274,7 @@ function every(array $array, $callback) { } /** - * || + * Логическа операция || ко всем элементам массива * @param array $array * @param mixed $callback * @@ -312,11 +312,11 @@ function call() { } /** - * - * @param function $cb - * @param array $hs + * Поиск элемента в массиве + * @param function $cb сравнение с элементом массива + * @param array $hs массив в котором ищется значение * - * @return int|string + * @return int|string ключ найденого элемента в массиве */ function array_usearch($cb, array $hs, $strict = false) { foreach($hs as $key => $value) if (call_user_func_array($cb, array($value, $key, $strict))) return $key; @@ -324,7 +324,7 @@ function array_usearch($cb, array $hs, $strict = false) { if (!function_exists('hash_key')) { /** - * + * Преобразует ключи элементов для многомерного массива * @return mixed */ function hash_key ($key_name,/*. array .*/ $array) { diff --git a/core/geometry/rectangle.php b/core/geometry/rectangle.php index 411418c..36bd13a 100644 --- a/core/geometry/rectangle.php +++ b/core/geometry/rectangle.php @@ -31,7 +31,7 @@ class Rectangle } /** - * + * Смещает прямоугольник на заданное положение */ function addPoint(Point $point) { @@ -42,7 +42,7 @@ class Rectangle } /** - * + * Координаты точки при выравнивании прямоугольника относительно текущего */ function alignment(Rectangle $base) { diff --git a/core/httprequest.php b/core/httprequest.php index c7af0a9..f82d625 100644 --- a/core/httprequest.php +++ b/core/httprequest.php @@ -5,7 +5,7 @@ require_once 'core/json.php'; require_once 'core/session.php'; /** - * + * Неверный запрос */ class WrongRequestException extends Exception { diff --git a/core/json.php b/core/json.php index 027de39..d99a6fa 100644 --- a/core/json.php +++ b/core/json.php @@ -13,7 +13,7 @@ class json return php2js($var); //json_encode(self::prepare($var, array('self', 'unicode_encode'))); } - // json + // Преобразование json в массив static function decode($var, $encoding = 'utf-8', $is_array = false) { if ($encoding != 'utf-8') $var = iconv($encoding, self::$INTERNAL_ENCODING, $var); @@ -46,7 +46,7 @@ class json } $var = $new; } elseif (is_object($var)) { - // !! + // Было преобразование типа для отображения !! $vars = get_object_vars($var); foreach ($vars as $m => $v) { $var->$m = self::prepare($var->$m, $encode); diff --git a/core/layout/layout.php b/core/layout/layout.php index a63b736..e39ac1e 100644 --- a/core/layout/layout.php +++ b/core/layout/layout.php @@ -1,20 +1,20 @@ 'personal'), 'personal') @@ -26,7 +26,7 @@ class LayoutManager extends Filter } /** - * . addConditionGet ajax + * Условие для аякс запросов. Тоже самое что и addConditionGet но еще проверяется является ли запрос ajax */ public function addConditionXHR($get, Filter $layout) { @@ -51,9 +51,9 @@ class LayoutManager extends Filter } /** - * - * @parma $get function(HttpRequest) - * @parma $layout Layout + * Добавляет есловие в общем виде + * @parma $get function(HttpRequest) Функция + * @parma $layout Layout Макет */ public function addCondition($get, Filter $layout) { @@ -61,7 +61,7 @@ class LayoutManager extends Filter } /** - * + * Выбирает и применяет макет для страницы */ public function execute(Collection $request) { @@ -82,7 +82,7 @@ class LayoutManager extends Filter } /** - * + * Самый простой макет */ class LayoutNone extends Filter { diff --git a/core/mail.php b/core/mail.php index 8970251..90a95cb 100644 --- a/core/mail.php +++ b/core/mail.php @@ -1,7 +1,7 @@ setEncoding("windows-1251"); - $this->uniqid = strtoupper(uniqid(time())); // + $this->uniqid = strtoupper(uniqid(time())); // Идентефикатор разделителя // $this->mime } /** - * + * Установка отправителя */ function from($name) { @@ -34,7 +34,7 @@ class Mail } /** - * + * Установка получателя */ function to($name) // recipient { @@ -42,7 +42,7 @@ class Mail } /** - * + * Установка получателей копии */ function copy($name) // recipient cc { @@ -55,7 +55,7 @@ class Mail } /** - * + * Тема письма */ function subject($subject) { @@ -63,7 +63,7 @@ class Mail } /** - * + * Текст письма */ function setContent($text) { @@ -71,7 +71,7 @@ class Mail } /** - * + * Кодировка текста в письме */ function setEncoding($encoding) { @@ -79,7 +79,7 @@ class Mail } /** - * + * Добавление вложения из файла */ function addAttachment($filename, $name = false) { @@ -93,7 +93,7 @@ class Mail } /** - * + * Добавление вложения из строки с указанием имени файла */ function addAttachmentRaw($data, $name) { @@ -108,7 +108,7 @@ class Mail } /** - * MIME + * Общий формат тегов MIME * http://tools.ietf.org/html/rfc2045 */ function mimeTag($name, $value, array $args = array()) @@ -129,7 +129,7 @@ class Mail } /** - * + * Тело сообщения */ function getMessage() { @@ -139,7 +139,7 @@ class Mail $message .= PHP_EOL . $this->content . PHP_EOL . PHP_EOL; /** - * + * Вложения * http://tools.ietf.org/html/rfc2046#section-5.1.3 */ foreach ($this->attachment as $value) { @@ -155,7 +155,7 @@ class Mail } /** - * + * Заголовок сообщения */ function getHeader() { @@ -180,7 +180,7 @@ class Mail } /** - * .eml + * Вывод строки для сохранения в формате .eml */ function eml() { @@ -188,7 +188,7 @@ class Mail } /** - * + * Отправка почты */ function send() { diff --git a/core/mapper/factory.php b/core/mapper/factory.php index c63789c..4c24c0b 100644 --- a/core/mapper/factory.php +++ b/core/mapper/factory.php @@ -10,7 +10,7 @@ class ModelFactory } /** - * + * Создает модель * @param string $name * @return model */ diff --git a/core/mapper/mapper.php b/core/mapper/mapper.php index affd68d..07d30ba 100644 --- a/core/mapper/mapper.php +++ b/core/mapper/mapper.php @@ -3,10 +3,10 @@ require_once 'core/primitive.php'; /** - * - * Action View - * . - * + * Использовать интерфейсы чтобы определить какие действия можно совершать с обьектом и таким образом + * Строить набор действий Action и отображений View для обьекта + * Т.к отображение данных может быть не только на таблицу баз данных + * И возможно реализованны все интерфейсы */ interface IDataList { @@ -22,22 +22,22 @@ interface IDataSave } /** - * + * Отображение таблицы базы данных в обьекты * Mapper -> DataMapper implements IDataList, IDataSave, IDataSort, IDataDelete ... * * @package core */ class DataMapper implements IDataList { - /* ?!, + !! + /* Хранить метаданные в статическом свойстве класса для ототбражения ?!, + Скрипт для генерации метаданных!! */ public $factory; - public $className; /* */ + public $className; /* Класс на который будет отображаться строчка таблицы */ public $filter = ""; /* */ - public $schema = array (); /* , !! */ - public $database; /* */ - public $index; /* */ - public $db; /* */ + public $schema = array (); /* Соответствие между свойством обьекта и столбцом, добавить тип для записей !! */ + public $database; /* Таблица */ + public $index; /* Индексный столбец */ + public $db; /* Соединение с базой данных */ public $reference = array (null, null); public function __construct () @@ -56,13 +56,13 @@ class DataMapper implements IDataList } /** - * - * @param $id - * @return $className + * Поиск строки в таблице по идентификатору + * @param $id Значение идентификатора + * @return Обьект класса $className */ public function findById ($id) { - // (getSQLSelect ...) + // Строки запроса преобразовать в методы (getSQLSelect ...) // Query::from($this->database)->where ($this->index, "=", $id)->select(); $stmt = $this->db->prepareStatement ("SELECT * FROM ".$this->database." WHERE ".$this->index." = ?"); $stmt->setInt (1, $id); @@ -72,7 +72,7 @@ class DataMapper implements IDataList } /** - * parseResult + * Преобразует parseResult в обьект */ public /* private */ function mapOne ($rs) { @@ -87,7 +87,7 @@ class DataMapper implements IDataList public /* private */ function mapAll ($rs) { $result = array (); - // SQL + // Преобразование SQL в обьект while ($rs->next ()) { $result[] = $this->mapOne ($rs); } @@ -99,7 +99,7 @@ class DataMapper implements IDataList } /** - * SQL WHERE + * Преобразует параметры формы в SQL запрос WHERE * @param array $params * @param array $schema * @return string @@ -118,8 +118,8 @@ class DataMapper implements IDataList } /** - * - * @param $list array + * Удаление строк из таблицы с заданными индексами + * @param $list array Массив идентефикаторов */ public function deleteList (array $list) { @@ -152,13 +152,13 @@ class DataMapper implements IDataList } /** - * + * Извлекает список записей из базы данных */ public function findAll (Collection $request, $id = null) { $name0 = $this->database; $foreign = $this->reference[1]; - // Query !!! + // Переписать используя Query !!! if ($foreign && $id) { $filter = ($this->filter)?$filter = " AND ".$this->filter: ""; $sql = "SELECT t1.* FROM $name0 as t1 WHERE t1.$foreign = $id " . $filter.self::getOrder($request); @@ -181,7 +181,7 @@ class DataMapper implements IDataList { $name0 = $this->database; $foreign = $this->reference[1]; - // Query !!! + // Переписать используя Query !!! if ($foreign && $id) { $filter = ($this->filter)?$filter = " AND " . $this->filter: ""; $sql = "SELECT count(t1.*) as length FROM $name0 as t1 WHERE t1.$foreign = $id " . $filter; @@ -195,8 +195,8 @@ class DataMapper implements IDataList } /** - * - * @param $o + * Добавление записи в базу данных + * @param $o Обьект для записи в базу данных */ public function saveTo (Model $o) { @@ -214,8 +214,8 @@ class DataMapper implements IDataList } /** - * - * @param $o + * Обновляет запись в базе данных + * @param $o Обьект для обновления */ public function updateTo (Model $o) { @@ -226,7 +226,7 @@ class DataMapper implements IDataList $keys_values[] = $key." = '".$o->$value."'"; } } - // id + // Для всех должен быть идентефикатор id $stmt = $this->db->prepareStatement ("UPDATE ".$this->database." SET ".implode($keys_values, ",")." WHERE ".$this->index." = ".$o->id); $stmt->executeQuery (); } @@ -261,7 +261,7 @@ class Model $this->$key = new Primitive (); } } - // __get, __set . , !! + // __get, __set методы. В метаданных хранится тип свойств, проверять при присваивании!! } ?> \ No newline at end of file diff --git a/core/mapper/pathmapper.php b/core/mapper/pathmapper.php index 1dc4953..32d0a1f 100644 --- a/core/mapper/pathmapper.php +++ b/core/mapper/pathmapper.php @@ -1,7 +1,7 @@ __toString(), $allow, $ignore); } - // SPL ??? + // Использовать SPL ??? protected function fileList ($base, &$allow, &$ignore) { $result = array (); @@ -121,10 +121,10 @@ class Path } /** - * + * Список файлов в директориии и ее поддиректорий * - * @param array $allow - * @param array $ignore + * @param array $allow массив расширений разрешеных для файлов + * @param array $ignore массив имен пааок которые не нужно обрабатывать * * @return array */ @@ -138,10 +138,10 @@ class Path /** - * + * Рекурсивно копирует директорию * - * @param string $source - * @param string $target + * @param string $source Папка из которой копируется + * @param string $target Папка в которую копируется */ public static function copy ($source, $target) { @@ -161,9 +161,9 @@ class Path } /** - * + * Рекурсивно удаляет директорию * - * @param string $path + * @param string $path Папка */ public static function delete ($path) { @@ -182,9 +182,9 @@ class Path } /** - * + * Преобразует строку путя в массив * - * @param string $path + * @param string $path Путь * * @return array */ @@ -197,7 +197,7 @@ class Path } /** - * + * Преобразует относительный путь в абсолютный */ public function optimize () { @@ -217,7 +217,7 @@ class Path } /** - * + * Преобразует путь в строку * * @return string */ @@ -228,7 +228,7 @@ class Path } /** - * + * Проверяет является ли папка родительской для другой папки * * @parma Path $path * @@ -248,11 +248,11 @@ class Path } /** - * + * Находит путь относительно текущего путя * - * @param string $name + * @param string $name Полный путь к файлу * - * @return string + * @return string Относительный путь к файлу */ public function relPath ($name) { @@ -270,9 +270,9 @@ class Path } /** - * + * Создает недастающие папки для записи файла * - * @param string $dst + * @param string $dst Полное имя файла * * @return void */ @@ -285,11 +285,11 @@ class Path } /** - * + * Подбирает новое временное имя для файла * - * @param string $dst + * @param string $dst Предпологаемое имя файла * - * @return string + * @return string Новое имя файла */ static function resolveFile ($dst) { @@ -305,7 +305,7 @@ class Path } /** - * + * Обьединяет строки в путь соединяя необходимым разделителем * * @return string */ diff --git a/core/primitive.php b/core/primitive.php index f462220..ff10b89 100644 --- a/core/primitive.php +++ b/core/primitive.php @@ -1,6 +1,6 @@ name = $name; } - // + // Преобразование из внешнего вормата public function setString ($value) { $this->value = $value; } - // + // Преобразование из формата базы данных public function setRes ($res, $key) { $this->value = $res->getString ($key); @@ -29,7 +29,7 @@ class Primitive return ((string) $this->value); } - // + // Преобразование во внешний формат public function getString () { return $this->__toString (); @@ -37,7 +37,7 @@ class Primitive } /** - * + * Отображение поля таблицы в целое число * @package core */ class Int4 extends Primitive { @@ -54,7 +54,7 @@ class Int4 extends Primitive { class FKey extends Int4 {} /** - * - + * Отображение поля таблицы в дату - время */ class Date extends Primitive { diff --git a/core/query/meta.php b/core/query/meta.php index 8a350dd..0086fac 100644 --- a/core/query/meta.php +++ b/core/query/meta.php @@ -1,7 +1,7 @@ update(); Query->select(), Query->insert();!! - * statement + * Компиляция в UPDATE + * TODO: Разные типы запросов Query->update(); Query->select(), Query->insert();!! + * Возвраащают statement */ public function update($values) { @@ -193,7 +193,7 @@ class Query } /** - * INSERT + * Компиляция в INSERT */ public function insert($values) { diff --git a/core/query/table.php b/core/query/table.php index 582b85e..0566a24 100644 --- a/core/query/table.php +++ b/core/query/table.php @@ -1,7 +1,7 @@ getContentRec($files) as $file) { $content = file_get_contents ($file); $text = stripText($content); // $title = self::getTitle ($content); $title = pathinfo($file, PATHINFO_BASENAME); // echo $file, "\n"; - // + // Список слов в документе $list = tokenize($text); foreach ($list as $word) { $preword = self::clean($word); @@ -49,7 +49,7 @@ class Index $index = $this->index[$preword]; if ( ! in_array ($this->count, $index)) $this->index[$preword] [] = $this->count; } else { - // 2 + // Не записываем слова длинна которых меньше 2 if (strlen($preword) > 1) { $this->index[$preword] = array ($this->count); } @@ -62,12 +62,12 @@ class Index } /** - * + * Сохранение результата поиска */ function saveData ($file) { $file = fopen($file, "w"); - // + // Количество слов и текстов fwrite ($file, pack("SS", count($this->index), count($this->text))); foreach ($this->index as $word => $value) { $length = strlen($word); diff --git a/core/search/lexer.php b/core/search/lexer.php index 016ac7b..b9707ef 100644 --- a/core/search/lexer.php +++ b/core/search/lexer.php @@ -1,7 +1,7 @@ offset >= strlen($this->src); } /** - * + * Односимвольный токен */ private function easyToken () { $ch = $this->getChar (); @@ -66,7 +66,7 @@ class Lexer } /** - * + * Возвращает следующий токен */ public function getToken () { diff --git a/core/search/search.php b/core/search/search.php index 29d65a8..49dd2b5 100644 --- a/core/search/search.php +++ b/core/search/search.php @@ -4,7 +4,7 @@ require_once 'core/search/lexer.php'; require_once 'core/functions.php'; /** - * + * Поиск в индексе */ class Search { @@ -80,9 +80,9 @@ class Search } /** - * @param int $type - * @param function $op - * @param function $next + * @param int $type Тип лексемы + * @param function $op Функция при совпадении типа лексемы при запросе + * @param function $next Следующий обработчик запроса */ function binaryOp ($type, $op, $next) { diff --git a/core/search/searcher.php b/core/search/searcher.php index 4e0f8ff..38f7af2 100644 --- a/core/search/searcher.php +++ b/core/search/searcher.php @@ -10,14 +10,14 @@ class Searcher { protected $search; public function __construct () { - // getWordStat?? + // Может передавать обьект метод по умлочанию getWordStat?? $this->search = new Search (array ($this, 'getWord')); } /** - * + * Читает содержимое индексного файла * - * @param string $file + * @param string $file Имя файла */ function setSource ($fileName) { @@ -44,7 +44,7 @@ class Searcher { } } - // + // По слову возвращаем список файлов и слово public function getWord ($word) { $preword = Stemmer::russian($word); // Index?? -> clean @@ -55,7 +55,7 @@ class Searcher { } /** - * + * Список документов в которых встечается слово * */ function getResult (&$query) @@ -74,10 +74,10 @@ class Searcher { } /** - * + * Часть документа в котором встречается слово * - * @param $word - * @param $text + * @param $word Слово + * @param $text Текст содержащий слово */ function getSlice ($word, $text) { @@ -89,7 +89,7 @@ class Searcher { } /** - * + * Поиск по запросу * */ function search ($query) diff --git a/core/search/stemmer.php b/core/search/stemmer.php index c48391e..42fa1df 100644 --- a/core/search/stemmer.php +++ b/core/search/stemmer.php @@ -27,7 +27,7 @@ class Stemmer { static private function rv($word) { - $vowels = array('','','','','','','','',''); + $vowels = array('а','е','и','о','у','ы','э','ю','я'); $flag = 0; $rv = ''; $start = ''; @@ -59,7 +59,7 @@ class Stemmer { static function has_aya ($word, $suffix) { - return (substr($word,-strlen($suffix)-CHAR_LENGTH,CHAR_LENGTH)=='' || substr($word,-strlen($suffix)-CHAR_LENGTH,CHAR_LENGTH)==''); + return (substr($word,-strlen($suffix)-CHAR_LENGTH,CHAR_LENGTH)=='а' || substr($word,-strlen($suffix)-CHAR_LENGTH,CHAR_LENGTH)=='я'); } static function cut_suffix ($word, $suffix) @@ -69,26 +69,26 @@ class Stemmer { static private function step1($word) { - $perfective1 = array('', '', ''); + $perfective1 = array('в', 'вши', 'вшись'); foreach ($perfective1 as $suffix) { if (self::has_suffix($word, $suffix) && self::has_aya ($word, $suffix)) { return self::cut_suffix($word, $suffix); } } - $perfective2 = array('','','','',''); + $perfective2 = array('ив','ивши','ившись','ывши','ывшись'); foreach ($perfective2 as $suffix) { if (self::has_suffix($word, $suffix)) { return self::cut_suffix($word, $suffix); } } - $reflexive = array('', ''); + $reflexive = array('ся', 'сь'); $word = self::substitute($word, $reflexive); - $adjective = array('','','','','','','','','','','','','','','','','','','','','','','','','',''); - $participle2 = array('','','','',''); - $participle1 = array('','',''); + $adjective = array('ее','ие','ые','ое','ими','ыми','ей','ий','ый','ой','ем','им','ым','ом','его','ого','ему','ому','их','ых','ую','юю','ая','яя','ою','ею'); + $participle2 = array('ем','нн','вш','ющ','щ'); + $participle1 = array('ивш','ывш','ующ'); foreach ($adjective as $suffix) { if (self::has_suffix($word, $suffix)) { $word = self::cut_suffix($word, $suffix); @@ -101,17 +101,17 @@ class Stemmer { } } - $verb1 = array('','','','','','','','','','','','','','','','',''); + $verb1 = array('ла','на','ете','йте','ли','й','л','ем','н','ло','но','ет','ют','ны','ть','ешь','нно'); foreach ($verb1 as $suffix) if (self::has_suffix($word, $suffix) && self::has_aya ($word, $suffix)) return self::cut_suffix($word, $suffix); - $verb2 = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); + $verb2 = array('ила','ыла','ена','ейте','уйте','ите','или','ыли','ей','уй','ил','ыл','им','ым','ен','ило','ыло','ено','ят','ует','уют','ит','ыт','ены','ить','ыть','ишь','ую','ю'); foreach ($verb2 as $suffix) if (self::has_suffix($word, $suffix)) return self::cut_suffix($word, $suffix); - $noun = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); + $noun = array('а','ев','ов','ие','ье','е','иями','ями','ами','еи','ии','и','ией','ей','ой','ий','й','иям','ям','ием','ем','ам','ом','о','у','ах','иях','ях','ы','ь','ию','ью','ю','ия','ья','я'); foreach ($noun as $suffix) { if (self::has_suffix($word, $suffix)) return self::cut_suffix($word, $suffix); @@ -122,14 +122,14 @@ class Stemmer { static private function step2($word) { - if (substr($word,-CHAR_LENGTH,CHAR_LENGTH) == '') + if (substr($word,-CHAR_LENGTH,CHAR_LENGTH) == 'и') $word = substr($word, 0, strlen($word)-CHAR_LENGTH); return $word; } static private function step3($word) { - $vowels = array('','','','','','','','',''); + $vowels = array('а','е','и','о','у','ы','э','ю','я'); $flag = 0; $r1 = ''; $r2 = ''; @@ -152,7 +152,7 @@ class Stemmer { if ($flag=1 && array_search(substr($r1,$i,CHAR_LENGTH), $vowels) === false) $flag=2; } - $derivational=array('', ''); + $derivational=array('ост', 'ость'); foreach ($derivational as $suffix) if (substr($r2,-(strlen($suffix))) == $suffix) $word=substr($word, 0, strlen($r2)-strlen($suffix)); @@ -161,19 +161,19 @@ class Stemmer { static private function step4($word) { - if (substr($word,-CHAR_LENGTH*2)=='') + if (substr($word,-CHAR_LENGTH*2)=='нн') $word=substr($word, 0, strlen($word)-CHAR_LENGTH); else { - $superlative=array('', ''); + $superlative=array('ейш', 'ейше'); foreach ($superlative as $suffix) if (substr($word,-(strlen($suffix))) == $suffix) $word = substr($word, 0, strlen($word) - strlen($suffix)); - if (substr($word,-CHAR_LENGTH*2) == '') + if (substr($word,-CHAR_LENGTH*2) == 'нн') $word = substr($word, 0, strlen($word) - CHAR_LENGTH); } - // should there be a guard flag? can't think of a russian word that ends with or anyways, though the algorithm states this is an "otherwise" case - if (substr($word,-CHAR_LENGTH,CHAR_LENGTH) == '') + // should there be a guard flag? can't think of a russian word that ends with ейшь or ннь anyways, though the algorithm states this is an "otherwise" case + if (substr($word,-CHAR_LENGTH,CHAR_LENGTH) == 'ь') $word=substr($word, 0, strlen($word)-CHAR_LENGTH); return $word; } diff --git a/core/settings.php b/core/settings.php index f72ed8e..35de901 100644 --- a/core/settings.php +++ b/core/settings.php @@ -3,13 +3,13 @@ require_once 'core/collection.php'; /** - * - * + * Класс реестра + * Реестр организован как ассоциативный многомерный массив * array( 'name1' => parameters1, 'name2' => parameters1, ... ) * - * name1, name2 ... - - * parameters1, parameters1 - - * + * name1, name2 ... - Имена модулей + * parameters1, parameters1 - Массивы с параметрами модуля + * Имя необходимо чтобы потом легко было удалить ненужные ветки дерева */ class Settings extends Collection { @@ -20,7 +20,7 @@ class Settings extends Collection } /** - * + * Чтение настроек из файла * * @param File $file * @@ -29,7 +29,7 @@ class Settings extends Collection public function read() { if ( !file_exists ($this->file)) return false; - // include_once . + // Не include_once т.к читать настройки можно несколько раз include($this->file); if (!is_array($settings)) { throw new Exception($this->file); @@ -38,7 +38,7 @@ class Settings extends Collection } /** - * ( ) + * Запись ключа в реестр (Реестр это могомерный массив) */ public function writeKey(array $key, $value) { @@ -61,7 +61,7 @@ class Settings extends Collection } /** - * + * Обновляет массив в соответствии со значением */ protected function merge(array &$data, $value) { @@ -76,8 +76,8 @@ class Settings extends Collection } /** - * - * @param $args + * Чтение ключа из реестра + * @param $args Путь к значению ключа */ public function readKey(array $key) { @@ -106,8 +106,8 @@ class Settings extends Collection } /** - * ( ) - * @param $key + * Чтение ключа из реестра (Собирает все ключи с определенным значением во всех модулях) + * @param $key Путь к значению ключа внутри модуля */ public function readKeyList() { @@ -145,7 +145,7 @@ class Settings extends Collection } /** - * ( store) + * Запись настроек в файл (Может переименовать в store) * * @param File $file * @@ -158,7 +158,7 @@ class Settings extends Collection } /** - * + * Список модулей */ public function getModules() { diff --git a/core/setup.php b/core/setup.php index 350b728..cba50ef 100644 --- a/core/setup.php +++ b/core/setup.php @@ -4,12 +4,12 @@ require_once 'core/path.php'; require_once 'creole/util/sql/SQLStatementExtractor.php'; /** - * + * Обработка файлов для установки */ class Setup { /** - * PHP + * Содержимое PHP файла */ static function fileContent($file, array $tpl) { @@ -21,7 +21,7 @@ class Setup } /** - * + * Копирует файлы шаблонной директории */ static function copyTemplatePath($srcPath, $dstPath, array $tpl, $tplFile = 'tpl') { @@ -31,12 +31,12 @@ class Setup foreach ($files as $file) { if (Path::getExtension($file) == $tplFile) { - // + // Шаблон $dst = $out->append($path->relPath (Path::skipExtension($file))); Path::prepare($dst); file_put_contents($dst, self::fileContent($file, $tpl)); } else { - // + // Обычный файл $dst = $out->append($path->relPath ($file)); Path::prepare($dst); copy($file, $dst); @@ -45,7 +45,7 @@ class Setup } /** - * SQL + * Выполнение Списка SQL команд */ static function batchSQL(Connection $conn, $file) { diff --git a/core/shortcut.php b/core/shortcut.php index 5b841cb..99c06d6 100644 --- a/core/shortcut.php +++ b/core/shortcut.php @@ -1,7 +1,7 @@ SpellHelper ?? */ class Spell @@ -52,7 +52,7 @@ class Spell } /** - * + * Вызывает функцию для каждого найденного слова */ function eachWord ($call, $string) { @@ -66,7 +66,7 @@ class Spell } /** - * + * Проверяет слово на соответствие со словарем * */ function doWord (&$string, $begin, $end) @@ -84,7 +84,7 @@ class Spell } /** - * + * Часть текста содержащий неправильное слово */ function getError ($string) { diff --git a/core/tabletree.php b/core/tabletree.php index cc41c0f..4f63c71 100644 --- a/core/tabletree.php +++ b/core/tabletree.php @@ -1,7 +1,7 @@ 1), array ('name' => 2), array ('name' => 1))) => array (1, 2) * @end example */ function key_unique_values ($name, $table) { - // + // Ищем уникальные значения для заданного ключа $keys = array (); foreach ($table as $row) { if (!in_array ($row[$name], $keys)) @@ -29,10 +29,10 @@ function key_unique_values ($name, $table) { } /** - * - * @param $array - * @param $key - * @return + * Сортировка двумерного массива по заданному ключу + * @param $array Массив + * @param $key Имя ключа по значению которого будет идти сравнение + * @return Отсортированный массив */ function sortOn($array, $key, $fn = '__cmp') { usort ($array, rcurry($fn, $key)); @@ -42,15 +42,15 @@ function sortOn($array, $key, $fn = '__cmp') { /** - * - * @param $level Array - * @param $table - * @param $fn + * Обходит таблицу как дерево + * @param $level Array Уровни вложенности + * @param $table Таблица + * @param $fn Функция которая применяется к каждой ветке дерева * $fn ($name, $index, $rows, $cc) - * @param $name - * @param $index - * @param $rows - * @parma $cc + * @param $name Ключ уровня + * @param $index Значение ключа уровня + * @param $rows Все столбцы текущго уровня + * @parma $cc Столбцы более низкого уровня */ function tableTreeWalk($level, $table, $fn) { if (empty ($level)) return $table; diff --git a/core/tales.php b/core/tales.php index f5a8510..a4f28d0 100644 --- a/core/tales.php +++ b/core/tales.php @@ -1,7 +1,7 @@ registerPrefix('date', array('DateTime_Tales', 'date')); $registry->registerPrefix('time', array('DateTime_Tales', 'time')); diff --git a/core/tools/exceltable.php b/core/tools/exceltable.php index 47e1320..dc65a4f 100644 --- a/core/tools/exceltable.php +++ b/core/tools/exceltable.php @@ -31,7 +31,7 @@ class Excel_DateTime } /** - * + * Клетка таблицы */ class TableCell { @@ -46,7 +46,7 @@ class TableCell } /** - * + * Ряд таблицы */ class TableRow { @@ -66,7 +66,7 @@ class TableRow } /** - * + * Таблица */ class ExcelTable { @@ -84,7 +84,7 @@ class ExcelTable } /** - * + * Записать значение в клетку с заданными координатами */ function setCell($x, $y, $value) { @@ -98,7 +98,7 @@ class ExcelTable } /** - * + * Заполняет ряд начиная с указанного столбца значениями из массива */ function setRow($row, $index, array $data) { @@ -113,9 +113,9 @@ class ExcelTable } /** - * - * @param $row integer - * @parma $value real + * Устанавливает высоту ряда + * @param $row integer Номер ряда + * @parma $value real Высота ряда */ function setRowHeight ($row, $value) { @@ -125,9 +125,9 @@ class ExcelTable } /** - * - * @param $row integer - * @parma $name string + * Устанавливает стиль ряда + * @param $row integer Номер ряда + * @parma $name string Имя стиля */ function setRowStyle ($row, $name) { @@ -137,10 +137,10 @@ class ExcelTable } /** - * - * @param $row - * @param $cell - * @param $merge + * Обьединяет клетки в строке + * @param $row Номер ряда + * @param $cell Номер столбца + * @param $merge Количество клеток для обьединения */ function setCellMerge ($row, $cell, $merge) { @@ -151,10 +151,10 @@ class ExcelTable } /** - * - * @param $row integer - * @param $y integer - * @parma $name string + * Устанавливает стиль для клеток ряда + * @param $row integer Номер ряда + * @param $y integer Номер столбца + * @parma $name string Имя стиля */ function setCellStyle ($row, $y, $name) { @@ -163,7 +163,7 @@ class ExcelTable } /** - * + * Добавляет строку к таблице */ function addRow($index = 1, array $data = array("")) { @@ -175,7 +175,7 @@ class ExcelTable } /** - * + * Количество строк в таблице * * @return int */ @@ -185,7 +185,7 @@ class ExcelTable } /** - * + * Количество столбцов в строке * * @return int */ @@ -195,8 +195,8 @@ class ExcelTable } /** - * - * @param $n integer + * Разделяет таблицу на две части по вертикали + * @param $n integer Количество столбцов слева */ function splitVertical($n) { @@ -204,8 +204,8 @@ class ExcelTable } /** - * - * @param $n integer + * Разделяет таблицу на две части по горизонтали + * @param $n integer Количество столбцов сверху */ function splitHorizontal($n) { @@ -214,7 +214,7 @@ class ExcelTable /** - * + * Количество столбцов в таблице * * @return int */ @@ -229,7 +229,7 @@ class ExcelTable } /** - * () + * Генерация клетки таблицы (Переработать) */ function createCell ($ncell, XMLWriter $doc, $j, $value, $setIndex) { $doc->startElement("Cell"); @@ -266,7 +266,7 @@ class ExcelTable } /** - * + * Генерация таблицы */ public function createTable (XMLWriter $doc) { $doc->startElement('Worksheet'); @@ -279,7 +279,7 @@ class ExcelTable $doc->writeAttribute('ss:ExpandedColumnCount', $columns); $doc->writeAttribute('ss:ExpandedRowCount', $rows); - // !!!!!!! + // Переписать цыкл !!!!!!! for ($i = 1; $i <= $rows; $i++) { $doc->startElement('Row'); if (isset($this->rows[$i])) { @@ -292,7 +292,7 @@ class ExcelTable } $nrow = $this->rows[$i]; - // + // Флаг индикатор подстановки номера столбца $setIndex = false; for ($j = 1; $j <= $columns; $j++) { @@ -339,7 +339,7 @@ class ExcelTable } /** - * + * Документ */ class ExcelDocument { static $ns = "urn:schemas-microsoft-com:office:spreadsheet"; @@ -351,10 +351,10 @@ class ExcelDocument { } /** - * - * @param $name string - * @param $values array - * @param $type + * Добавление стиля к документу + * @param $name string Имя стиля + * @param $values array Параметры стиля + * @param $type Тип стиля */ function setStyle ($name, array $values, $type = 'Interior') { @@ -365,7 +365,7 @@ class ExcelDocument { } /** - * + * Генерация стилей */ private function createStyles (XMLWriter $doc) { $doc->startElement('Styles'); @@ -373,7 +373,7 @@ class ExcelDocument { $doc->startElement('Style'); $doc->writeAttribute('ss:ID', $name); foreach ($sn as $type => $s) { - // Borders - + // Стиль Borders - составной if ($type == 'Borders') { $doc->startElement('Borders'); foreach ($s as $border) { @@ -398,7 +398,7 @@ class ExcelDocument { } /** - * + * Преобразует переводы строки в спец символы */ function clean ($s) { assert(is_string($s)); @@ -407,7 +407,7 @@ class ExcelDocument { } /** - * Office 2003 XML + * Сохраняет таблицу в формате Office 2003 XML * http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats */ function save($filename) diff --git a/core/tools/templateimage.php b/core/tools/templateimage.php index 1e37989..825a5c2 100644 --- a/core/tools/templateimage.php +++ b/core/tools/templateimage.php @@ -3,7 +3,7 @@ require_once 'core/tools/drawing.php'; /** - * + * Формат для композиции изображений */ class TemplateImage { @@ -47,7 +47,7 @@ class TemplateImage } /** - * + * Путь к изображению */ function resourcePath($path) { @@ -57,7 +57,7 @@ class TemplateImage } /** - * + * Путь у шрифтам */ function fontPath($path) { @@ -85,7 +85,7 @@ class TemplateImage } /** - * + * Создает изображение из файла */ function imagefromfile($file) { @@ -151,7 +151,7 @@ class TemplateImage } /** - * + * Перекодировка текста */ function encode($text) { @@ -184,7 +184,7 @@ class TemplateImage } /** - * + * Генерирует изображение из шаблона */ function render($file = null) { diff --git a/core/tools/translit.php b/core/tools/translit.php index 02829a7..1ca001c 100644 --- a/core/tools/translit.php +++ b/core/tools/translit.php @@ -1,14 +1,14 @@ "zh", ""=>"ts", ""=>"ch", ""=>"sh", - ""=>"shch",""=>"", ""=>"yu", ""=>"ya", - ""=>"ZH", ""=>"TS", ""=>"CH", ""=>"SH", - ""=>"SHCH",""=>"", ""=>"YU", ""=>"YA", - ""=>"i", ""=>"Yi", ""=>"ie", ""=>"Ye" + "ж"=>"zh", "ц"=>"ts", "ч"=>"ch", "ш"=>"sh", + "щ"=>"shch","ь"=>"", "ю"=>"yu", "я"=>"ya", + "Ж"=>"ZH", "Ц"=>"TS", "Ч"=>"CH", "Ш"=>"SH", + "Щ"=>"SHCH","Ь"=>"", "Ю"=>"YU", "Я"=>"YA", + "ї"=>"i", "Ї"=>"Yi", "є"=>"ie", "Є"=>"Ye" )); return $st; } diff --git a/core/tree/dbtree.php b/core/tree/dbtree.php index 0420fdd..ad83ab3 100644 --- a/core/tree/dbtree.php +++ b/core/tree/dbtree.php @@ -296,7 +296,7 @@ class CDBTree return $this->db->query($this->sql) or trigger_error("phpDbTree error: " . $this->db->error() , E_USER_ERROR); } - // + // Перемещение всех детей ветки в другую ветку function moveChildren($ID, $newParentId) { @@ -310,11 +310,11 @@ class CDBTree if ($leftIdP < $leftId && $rightIdP > $rightId && $levelP < $level-1) { // _update($this->table, array(), ) $this->sql = 'UPDATE ' . $this->table . ' SET ' - // + // Меняем уровень . $this->level . '=' . _case(_between($this->left, $leftId, $rightId), $this->level . sprintf('%+d', -($level-1) +$levelP) , $this->level) - // + // Меняем границы . $this->left . '=' . _case(_beetween($this->left, $rightId+1, $rightIdP-1), $this->left . '-' . $rightId-$leftId+1 , _case(_between($this->left, $leftId, $rightId), $this->left . '+' . ((($rightIdP-$rightId-$level+$levelP) /2) *2+$level-$levelP-1) , $this->left)) diff --git a/core/tree/sort.php b/core/tree/sort.php index 505838e..cefd3e3 100644 --- a/core/tree/sort.php +++ b/core/tree/sort.php @@ -1,11 +1,11 @@ sortBy($data, 'name'); */ @@ -17,7 +17,7 @@ class NestedSetSort { public function __construct() { } - // Nested Set + // Преобразуем Nested Set в дерево и сортируем private function listTree(array $tree, $offset, $level) { $result = array(); for ($i = $offset; $i < sizeof($tree); $i++) { @@ -38,19 +38,19 @@ class NestedSetSort { return array($result, $i); } - // + // Сравнение двух элементов private function compare($a, $b) { $a1 = $this->data[$a[0]][$this->sortBy]; $b1 = $this->data[$b[0]][$this->sortBy]; return strcmp($a1, $b1); } - // + // Сортировка списка private function sortList(array &$list, $data) { usort($list, array($this, 'compare')); } - // + // Создает дерево в виде списка private function reorder(array $tree) { foreach($tree as $node) { $this->result[] = $this->data[$node[0]]; @@ -68,7 +68,7 @@ class NestedSetSort { return $order[0]; } - // + // Сортировка по заданному полю public function sortBy(array $data, $sortBy) { $this->data = $data; $this->sortBy = $sortBy; diff --git a/core/validator/rule/alpha.php b/core/validator/rule/alpha.php index 55e3ec3..fc8f39d 100644 --- a/core/validator/rule/alpha.php +++ b/core/validator/rule/alpha.php @@ -3,13 +3,13 @@ require_once 'abstract.php'; /** - * + * Проверка на число */ class Rule_Alpha extends Rule_Abstract { public function getErrorMsg() { - return " "; + return "Поле должно содержать только буквы"; } public function isValid(Collection $container, $status = null) diff --git a/core/validator/rule/code.php b/core/validator/rule/code.php index ca25b84..8126cd8 100644 --- a/core/validator/rule/code.php +++ b/core/validator/rule/code.php @@ -3,13 +3,13 @@ require_once 'abstract.php'; /** - * + * Проверка формата электронной почты */ class Rule_Code extends Rule_Abstract { public function getErrorMsg() { - return " "; + return "Неправильно указан персональный код"; } function checkCode($code) { diff --git a/core/validator/rule/count.php b/core/validator/rule/count.php index 05abfe9..e7c8145 100644 --- a/core/validator/rule/count.php +++ b/core/validator/rule/count.php @@ -3,7 +3,7 @@ require_once 'abstract.php'; /** - * + * Проверка формата даты */ class Rule_Count extends Rule_Abstract { @@ -12,7 +12,7 @@ class Rule_Count extends Rule_Abstract public function getErrorMsg() { - return " {$this->size} {$this->max}"; + return "Количество записей должно быть не менне {$this->size} и не более {$this->max}"; } function not_empty($s) { diff --git a/core/validator/rule/date.php b/core/validator/rule/date.php index bab8769..b8b3fe8 100644 --- a/core/validator/rule/date.php +++ b/core/validator/rule/date.php @@ -3,7 +3,7 @@ require_once 'abstract.php'; /** - * + * Проверка формата даты */ class Rule_Date extends Rule_Abstract { @@ -11,7 +11,7 @@ class Rule_Date extends Rule_Abstract public function getErrorMsg() { - return " "; + return "Неверный формат даты"; } public function isValid(Collection $container, $status = null) diff --git a/core/validator/rule/email.php b/core/validator/rule/email.php index 78dce1f..f0048b2 100644 --- a/core/validator/rule/email.php +++ b/core/validator/rule/email.php @@ -3,13 +3,13 @@ require_once 'abstract.php'; /** - * + * Проверка формата электронной почты */ class Rule_Email extends Rule_Abstract { public function getErrorMsg() { - return " "; + return "Неверный формат электронной почты"; } public function isValid(Collection $container, $status = null) diff --git a/core/validator/rule/emaillist.php b/core/validator/rule/emaillist.php index a8ebc89..39599c4 100644 --- a/core/validator/rule/emaillist.php +++ b/core/validator/rule/emaillist.php @@ -3,13 +3,13 @@ require_once 'abstract.php'; /** - * + * Проверка формата электронной почты */ class Rule_EmailList extends Rule_Abstract { public function getErrorMsg() { - return " "; + return "Неверный формат электронной почты"; } public function isValid(Collection $container, $status = null) { diff --git a/core/validator/rule/match.php b/core/validator/rule/match.php index 6b6d070..5d6804d 100644 --- a/core/validator/rule/match.php +++ b/core/validator/rule/match.php @@ -3,7 +3,7 @@ require_once 'abstract.php'; /** - * + * Проверка на равентство двух полей */ class Rule_Match extends Rule_Abstract { @@ -11,7 +11,7 @@ class Rule_Match extends Rule_Abstract public function getErrorMsg() { - return " "; + return "Поля не совпадают"; } /* public function __construct($field, $refField, $errorMsg) diff --git a/core/validator/rule/notnull.php b/core/validator/rule/notnull.php index 4ac0629..947fea7 100644 --- a/core/validator/rule/notnull.php +++ b/core/validator/rule/notnull.php @@ -6,7 +6,7 @@ class Rule_Notnull extends Rule_Abstract { public function getErrorMsg() { - return " "; + return "Поле не должно быть пустым"; } public function isValid(Collection $container, $status = null) diff --git a/core/validator/rule/numeric.php b/core/validator/rule/numeric.php index f7505d7..2d9a945 100644 --- a/core/validator/rule/numeric.php +++ b/core/validator/rule/numeric.php @@ -3,13 +3,13 @@ require_once 'abstract.php'; /** - * + * Проверка на число */ class Rule_Numeric extends Rule_Abstract { public function getErrorMsg() { - return " "; + return "Значение поля должно быть числом"; } public function isValid(Collection $container, $status = null) diff --git a/core/validator/rule/time.php b/core/validator/rule/time.php index cfe8a15..c97c49c 100644 --- a/core/validator/rule/time.php +++ b/core/validator/rule/time.php @@ -3,7 +3,7 @@ require_once 'abstract.php'; /** - * + * Проверка формата времени */ class Rule_Time extends Rule_Abstract { @@ -11,7 +11,7 @@ class Rule_Time extends Rule_Abstract public function getErrorMsg() { - return " "; + return "Неверный формат времени"; } static function checktime($hour, $minute) diff --git a/core/validator/rule/unique.php b/core/validator/rule/unique.php index 3a53cb8..9fe6e03 100644 --- a/core/validator/rule/unique.php +++ b/core/validator/rule/unique.php @@ -3,7 +3,7 @@ require_once 'abstract.php'; /** - * + * Проверка формата времени */ class Rule_Unique extends Rule_Abstract { diff --git a/core/validator/validator.php b/core/validator/validator.php index 856e953..efdb618 100644 --- a/core/validator/validator.php +++ b/core/validator/validator.php @@ -1,17 +1,17 @@ fieldname, 'validate' => ruletext), ...) - * fieldname - - * ruletext - . + * fieldname - Имя переменой для проверки + * ruletext - Описание правила см. формат правила ниже */ public function addRuleList(array $input) { @@ -31,25 +31,25 @@ class Validator 'code' => 'Rule_Code' ); - // - // 'rule1|rule2,param1=value1|rule3,param1=value1,param2=value2' + // Разбор правила проверки + // Формат правила 'rule1|rule2,param1=value1|rule3,param1=value1,param2=value2' foreach ($input as $value) { - // + // Список правил if (! isset($value['validate'])) continue; $rules = explode("|", $value['validate']); foreach ($rules as $rule) { - // + // Список параметров правила $rule_param = explode(",", $rule); $name = array_shift($rule_param); if (isset($type[$name])) { $constructor = $type[$name]; // "Rule_" . ucfirst($name) - $rule = new $constructor($value['name'], false); // + $rule = new $constructor($value['name'], false); // Нужны шаблонные сообщения для правил if (isset($value['context'])) { $rule->setContext($value['context']); } foreach ($rule_param as $param) { - // + // Имя и значение параметра list($name, $value) = explode("=", $param); $rule->$name = $value; } diff --git a/core/view/compositeview.php b/core/view/compositeview.php index dea9378..05892ac 100644 --- a/core/view/compositeview.php +++ b/core/view/compositeview.php @@ -2,14 +2,14 @@ class _View_Composite // AbstractCompositeView { - protected $_section = array(); // - // - protected $_stylesheet = array(); // - protected $_script = array(); // + protected $_section = array(); // Вложенные шаблоны + // Блоки + protected $_stylesheet = array(); // Массив стилей текущего шаблона + protected $_script = array(); // Массив скриптов текущего шаблона protected $_scriptstring = array(); protected $_startup = array(); - protected $_title = null; // + protected $_title = null; // Заголовок текущего шаблона public $alias = array(); function __construct() @@ -17,10 +17,10 @@ class _View_Composite // AbstractCompositeView } /** - * + * Связывет переменную с вложенным шаблоном * - * @param string $section - * @param CompositeView $view + * @param string $section переменная шаблона + * @param CompositeView $view вложенный шаблон */ public function setView($section, /*CompositeView*/ $view) { @@ -38,9 +38,9 @@ class _View_Composite // AbstractCompositeView } /** - * + * Добавляет скипт к текущему шаблону * - * @param string $name + * @param string $name путь к скрипту */ public function addScript($name) { @@ -48,9 +48,9 @@ class _View_Composite // AbstractCompositeView } /** - * + * Добавляет код скипта к текущему шаблону * - * @param string $name javascript + * @param string $name строка javascript кода */ public function addScriptRaw($name, $startup = false) { @@ -62,9 +62,9 @@ class _View_Composite // AbstractCompositeView } /** - * + * Добавляет стили к текущему шаблону * - * @param string $name + * @param string $name путь к стилю */ public function addStyleSheet($name) { @@ -72,9 +72,9 @@ class _View_Composite // AbstractCompositeView } /** - * + * Рекурсивно извлекает из значение свойства обьекта * - * @param string $list + * @param string $list Имя свойства * @param boolean $flatten */ private function doTree($list, $flatten = true) { @@ -86,7 +86,7 @@ class _View_Composite // AbstractCompositeView } /** - * + * Массив имен файлов скриптов * * return array */ @@ -105,7 +105,7 @@ class _View_Composite // AbstractCompositeView } /** - * + * Строка со скриптом * * @return string */ @@ -124,7 +124,7 @@ class _View_Composite // AbstractCompositeView } /** - * + * Массив имен файлов стилей * * return array */ @@ -134,7 +134,7 @@ class _View_Composite // AbstractCompositeView } /** - * + * Обработка всех вложенных шаблонов * * @return string */ @@ -146,7 +146,7 @@ class _View_Composite // AbstractCompositeView } /** - * + * Установка заголовка шаблона * * @param string $title */ @@ -161,7 +161,7 @@ class _View_Composite // AbstractCompositeView } /** - * + * Общая строка заголовка */ public function getTitle() { @@ -183,7 +183,7 @@ class _View_Composite // AbstractCompositeView $debug = ($debug) ? 'debug=1' : ''; $path = parse_url(WWW_PATH, PHP_URL_PATH); $list = array_reverse($list); - // !!! + // Группы нужно передвавать как параметр !!! $groups = array( 'table' => array($path . '/js/table.js', $path . '/js/listtable.js', $path . '/js/page.js', $path . '/js/pagemenu.js'), @@ -208,7 +208,7 @@ class _View_Composite // AbstractCompositeView } /** - * + * Обработка шаблона * * @return string */ @@ -218,7 +218,7 @@ class _View_Composite // AbstractCompositeView $alias = $this->doTree('alias'); // require_once 'minify.php'; - // + // Скрипты и стили $this->set('scripts', array_unique($this->groupFiles($this->resolveAlias($alias, $this->getScripts()), false))); $this->set('stylesheet', array_unique($this->groupFiles($this->resolveAlias($alias, $this->getStyleSheet()), false))); @@ -242,7 +242,7 @@ class _View_Composite // AbstractCompositeView function loadImports($importFile) { - // + // Подключение стилей и скриптов if (file_exists($importFile)) { $import = file_get_contents($importFile); $files = explode("\n", $import); diff --git a/core/view/view.php b/core/view/view.php index a508705..bacc54e 100644 --- a/core/view/view.php +++ b/core/view/view.php @@ -1,6 +1,6 @@ items[] = array('href' => $href, 'name' => ucfirst($name)); // menu_item } } /** - * - * @return + * Массив ссылок + * @return Массив */ function getItems() { diff --git a/core/widgets/pagemenu.php b/core/widgets/pagemenu.php index 1a1f56f..98100a5 100644 --- a/core/widgets/pagemenu.php +++ b/core/widgets/pagemenu.php @@ -4,7 +4,7 @@ require_once 'core/widgets/widget.php'; require_once 'core/widgets/menu.php'; /** - * + * Компонент для генерации меню */ class PageMenu extends Widget { diff --git a/core/widgets/pages.php b/core/widgets/pages.php index 7bd8551..2f667bc 100644 --- a/core/widgets/pages.php +++ b/core/widgets/pages.php @@ -3,7 +3,7 @@ require_once 'core/widgets/widget.php'; /** - * + * Отображение постраничности */ class Pages extends Widget // Selector { diff --git a/core/widgets/search.php b/core/widgets/search.php index 3ef9a05..2682bd7 100644 --- a/core/widgets/search.php +++ b/core/widgets/search.php @@ -18,8 +18,8 @@ class SearchDialog extends Dialog function postMake() { - $form = new TForm (); // - $form->addFieldList ($this->fields); // + $form = new TForm (); // Показывем форму + $form->addFieldList ($this->fields); // Разделить форму поиска и редактирования $this->view->form = $form; $this->view->action = $this->action; diff --git a/core/widgets/tree.php b/core/widgets/tree.php index 659aac2..1faea59 100644 --- a/core/widgets/tree.php +++ b/core/widgets/tree.php @@ -3,7 +3,7 @@ require_once 'core/widgets/widget.php'; /** - * + * Компонент для генерации Дерева */ class Tree extends Widget { @@ -11,7 +11,7 @@ class Tree extends Widget { $this->template = "tree"; } - // + // Добавление ветки дерева } ?> \ No newline at end of file diff --git a/core/widgets/widget.php b/core/widgets/widget.php index 96dcb36..95ef5ff 100644 --- a/core/widgets/widget.php +++ b/core/widgets/widget.php @@ -11,12 +11,12 @@ function forceUrl($name) } /** - * - * - * PHP - (, , ) - * HTML - - * CSS - - * Javascript - + * Класс для генерации и управления активными компонентами страницы + * Компонент состоит из следующих частей + * PHP - Управление компонентом (Генерация, Инициализация, Обработка событий) + * HTML - Необходимые шаблоны + * CSS - Стили + * Javascript - Клиентская часть управления компонентом */ class Widget { @@ -43,7 +43,7 @@ class Widget } /** - * + * Генерация кода инициализации компонента на стороне клиента */ public function getCodeBefore() { @@ -69,7 +69,7 @@ class Widget } /** - * + * Генерация компонента */ function make(Controller $parent) { diff --git a/core/zipfile.php b/core/zipfile.php index 03f58b3..e615890 100644 --- a/core/zipfile.php +++ b/core/zipfile.php @@ -6,7 +6,7 @@ .*/ /** - * ZipArchive + * Расширение класса ZipArchive с возможность архивирования директории */ class ZipFile extends ZipArchive {