From abd514139f9b01e657b831549d0d16a96cf691a1 Mon Sep 17 00:00:00 2001 From: origami11 Date: Mon, 5 Jun 2017 10:18:28 +0300 Subject: [PATCH 1/5] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Validator/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php index fe3ea2e..d838d65 100644 --- a/src/Validator/Validator.php +++ b/src/Validator/Validator.php @@ -61,7 +61,7 @@ class Validator_Validator $ruleObj->$p_name = $p_value; } $this->addRule($ruleObj); - } else { + } else if (!empty($rule)) { throw new Exception('Unknown validation rule "' . $rule . "'"); } } From dd08a235c0abfd681390cec191cd16056ecda797 Mon Sep 17 00:00:00 2001 From: origami11 Date: Fri, 23 Jun 2017 15:51:38 +0300 Subject: [PATCH 2/5] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D1=89=D0=B8?= =?UTF-8?q?=D0=BA=20=D0=B4=D0=BB=D1=8F=20=D1=81=D0=B0=D0=B9=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Installer.php | 14 ++++++++------ src/Database/JsonInstall.php | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Controller/Installer.php b/src/Controller/Installer.php index dcc4562..2c17f9a 100644 --- a/src/Controller/Installer.php +++ b/src/Controller/Installer.php @@ -69,6 +69,7 @@ class Controller_Installer { $result = array(); $setup = $this->getSetupFile($name); + if (file_exists($setup) && ($this->isChanged($name) || $force)) { $registry = $this->_registry; $settings = new Settings($setup); @@ -91,20 +92,21 @@ class Controller_Installer $result[]=$res; } } - } - // Обновление версии меню - $registry->removeKey($name); - $registry->writeKey(array($name), $settings->get('settings')); - $registry->writeKey(array($name), + // Обновление версии меню + $registry->removeKey($name); + $registry->writeKey(array($name), $settings->get('settings')); + $registry->writeKey(array($name), array('version' => $version_new, 'time' => filemtime($setup))); + } + $registry->write(); } return $result; } - function install($dbinit_path,$dbfill_path=null){ + function install($dbinit_path, $dbfill_path = null) { $json_installer = new Database_JsonInstall($this->db_manager); $json_installer->install($dbinit_path,$dbfill_path); } diff --git a/src/Database/JsonInstall.php b/src/Database/JsonInstall.php index ee62cf3..54a7d6f 100644 --- a/src/Database/JsonInstall.php +++ b/src/Database/JsonInstall.php @@ -14,11 +14,11 @@ class Database_JsonInstall { if (is_string($dbinit_file)) { $initActions = json_decode($dbinit_file, true); if (!$initActions) { - echo "Invalid dbinit.json ".$dbinit_file; + echo "Invalid ".$dbinit_path; return 0; } } else { - echo "No dbinit.json"; + echo "No ".$dbinit_path; return 0; } From a3c988b2c3f12436f37f72206a98141a5c9f8ece Mon Sep 17 00:00:00 2001 From: origami11 Date: Tue, 25 Jul 2017 11:02:11 +0300 Subject: [PATCH 3/5] =?UTF-8?q?=D0=91=D0=B0=D0=B3=20=D1=81=20=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0.=20=D0=90=D0=BB?= =?UTF-8?q?=D1=8C=D1=82=D0=B5=D1=80=D0=BD=D0=B0=D1=82=D0=B8=D0=B2=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D0=BE=D1=87=D1=82=D0=B0.=20=D0=92=D1=8B?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/Action.php | 3 +- src/Form/Form.php | 1 + src/MailAlt.php | 90 +++++++++++++++++++++++++++++++++++++ src/Validator/Validator.php | 1 + 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 src/MailAlt.php diff --git a/src/Controller/Action.php b/src/Controller/Action.php index 9c72537..9d5753f 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -211,7 +211,8 @@ class Controller_Action public function nUrl($name, array $param = array()) { /*.Filter_ActionAccess.*/$access = $this->access; - if ($access != null || $access->checkAction($name)) { + + if ($access == null || $access->checkAction($name)) { return lcurry(array($this, 'postUrl'), $name, $param); } return null; diff --git a/src/Form/Form.php b/src/Form/Form.php index 3ea0a59..f0e6922 100644 --- a/src/Form/Form.php +++ b/src/Form/Form.php @@ -302,6 +302,7 @@ class Form_Form extends View_View { 'hidden' => 'THidden', 'radio' => 'TSelectOne', 'filebrowser' => 'TComponentBrowserInput', + 'documents' => 'TComponentBrowserInput', ); } diff --git a/src/MailAlt.php b/src/MailAlt.php new file mode 100644 index 0000000..f8761f6 --- /dev/null +++ b/src/MailAlt.php @@ -0,0 +1,90 @@ +mailer = new PHPMailer(); + $this->mailer->CharSet = 'UTF-8'; + } + + /** + * Установка отправителя + */ + function from($name) + { + $this->mailer->setFrom($name); + } + + /** + * Установка получателя + */ + function to($name) // recipient + { + $this->mailer->addAddress($name); + } + + function replyTo($name) // recipient + { + $this->mailer->AddReplyTo($name); + } + + /** + * Установка получателей копии + */ + function copy($name) // recipient cc + { + $this->addCC($name); + } + + function notify($notify) + { + $this->_notify = $notify; + } + + /** + * Тема письма + */ + function subject($subject) + { + $this->mailer->Subject = $subject; + } + + /** + * Текст письма + */ + function setContent($text) + { + $this->mailer->Body = $text; + } + + function setType($text) + { + $this->mailer->isHTML($text == 'text/html'); + } + + /** + * Кодировка текста в письме + */ + function setEncoding($encoding) + { + $this->encoding = $encoding; + } + + /** + * Добавление вложения из файла + */ + function addAttachment($filename, $name = false) + { + $this->mailer->addAttachment($filename, $name); + } + + /** + * Отправка почты + */ + function send() + { + return $this->mailer->send(); + } +} diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php index 5a3bc4c..c429efe 100644 --- a/src/Validator/Validator.php +++ b/src/Validator/Validator.php @@ -44,6 +44,7 @@ class Validator_Validator // Список правил if (! isset($value['validate'])) continue; $rules = explode("|", $value['validate']); + foreach ($rules as $rule) { // Список параметров правила $rule_param = explode(",", $rule); From e46867b1348cd22659315da34fd1405c0b89e75b Mon Sep 17 00:00:00 2001 From: origami11 Date: Mon, 2 Oct 2017 14:16:49 +0300 Subject: [PATCH 4/5] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=BE?= =?UTF-8?q?=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20=D0=B5=D1=81=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BE=D1=82=D0=BA=D1=80=D1=8B=D0=B2=D0=B0=D0=B5?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D1=84=D0=B0=D0=B9=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Excel/Document.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Excel/Document.php b/src/Excel/Document.php index e46ff31..365dba3 100644 --- a/src/Excel/Document.php +++ b/src/Excel/Document.php @@ -76,7 +76,9 @@ class Excel_Document { function save($filename) { $doc = new XMLWriter(); - $doc->openURI($filename); + if (!$doc->openURI($filename)) { + throw new Exception("unknown file " . $filename); + } $doc->setIndent(false); $doc->startDocument('1.0','utf-8'); $doc->startElement('Workbook'); From 32510683954d97d043ce77666f2ae3dd0ee06c5e Mon Sep 17 00:00:00 2001 From: origami11 Date: Mon, 2 Oct 2017 14:19:11 +0300 Subject: [PATCH 5/5] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Validator/Rule/Code.php | 2 +- src/Validator/Rule/Count.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Validator/Rule/Code.php b/src/Validator/Rule/Code.php index 54514e2..2bcfbf8 100644 --- a/src/Validator/Rule/Code.php +++ b/src/Validator/Rule/Code.php @@ -3,7 +3,7 @@ /** * Проверка формата электронной почты */ -class Validator_Rule_Code extends Rule_Abstract +class Validator_Rule_Code extends Validator_Rule_Abstract { public function getErrorMsg() { diff --git a/src/Validator/Rule/Count.php b/src/Validator/Rule/Count.php index f8c1800..2afd612 100644 --- a/src/Validator/Rule/Count.php +++ b/src/Validator/Rule/Count.php @@ -3,7 +3,7 @@ /** * Проверка формата даты */ -class Validator_Rule_Count extends Rule_Abstract +class Validator_Rule_Count extends Validator_Rule_Abstract { public $size = 1; public $max = false;