diff --git a/src/Controller/Component.php b/src/Controller/Component.php index e1ab83c..99ca77c 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -131,14 +131,6 @@ class Controller_Component return Path::join($this->webPath[0], 'templates', 'modern'); } - /** - * @param $name Имя модели - */ - private function getModelPath($name) - { - return Path::join (CMS_PATH, "model", $name . ".php"); - } - /** * Создает модель * @param string $name @@ -146,9 +138,8 @@ class Controller_Component */ public function getModel($name) { - require_once ($this->getModelPath ($name)); - $modelName = $name . "Mapper"; - $model = new $modelName (); + $modelName = "Mapper_" . $name; + $model = new $modelName(); $model->db = $this->db; return $model; } diff --git a/src/Controller/Installer.php b/src/Controller/Installer.php index dcc4562..f7f5147 100644 --- a/src/Controller/Installer.php +++ b/src/Controller/Installer.php @@ -48,7 +48,7 @@ class Controller_Installer foreach ($sql as $version => $install) { if (version_compare($version, $version_new, "<=") && version_compare($version, $version_old, ">")) { $file = Path::join(call_user_func($this->installPath, $name), "sql", $install); - $json_installer->install($file,null); + $json_installer->install($file, null); $result[] = $version; } } @@ -64,6 +64,7 @@ class Controller_Installer $this->_registry->removeKey($name); $this->_registry->write(); } + // Устанавливает обновления если есть function doUpdates($name, $force = false) // Установка модуля { @@ -83,6 +84,7 @@ class Controller_Installer $version_old = "0.0"; $registry->writeKey(array($name), array()); } +// echo $version_old, $settings->get('version'); if (version_compare($version_old, $settings->get('version'), "!=")) { $sql = $settings->get('sql'); if (is_array($sql)) { @@ -104,8 +106,8 @@ class Controller_Installer 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); + $json_installer->install($dbinit_path, $dbfill_path); } } 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..43160cf --- /dev/null +++ b/src/MailAlt.php @@ -0,0 +1,89 @@ +mailer = new PHPMailer(); + } + + /** + * Установка отправителя + */ + 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);