Правильное название модели в компонентах. Альтернативная почта
This commit is contained in:
parent
a48bce8552
commit
c680b8c322
5 changed files with 98 additions and 14 deletions
|
|
@ -131,14 +131,6 @@ class Controller_Component
|
||||||
return Path::join($this->webPath[0], 'templates', 'modern');
|
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
|
* @param string $name
|
||||||
|
|
@ -146,8 +138,7 @@ class Controller_Component
|
||||||
*/
|
*/
|
||||||
public function getModel($name)
|
public function getModel($name)
|
||||||
{
|
{
|
||||||
require_once ($this->getModelPath ($name));
|
$modelName = "Mapper_" . $name;
|
||||||
$modelName = $name . "Mapper";
|
|
||||||
$model = new $modelName();
|
$model = new $modelName();
|
||||||
$model->db = $this->db;
|
$model->db = $this->db;
|
||||||
return $model;
|
return $model;
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class Controller_Installer
|
||||||
$this->_registry->removeKey($name);
|
$this->_registry->removeKey($name);
|
||||||
$this->_registry->write();
|
$this->_registry->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Устанавливает обновления если есть
|
// Устанавливает обновления если есть
|
||||||
function doUpdates($name, $force = false) // Установка модуля
|
function doUpdates($name, $force = false) // Установка модуля
|
||||||
{
|
{
|
||||||
|
|
@ -83,6 +84,7 @@ class Controller_Installer
|
||||||
$version_old = "0.0";
|
$version_old = "0.0";
|
||||||
$registry->writeKey(array($name), array());
|
$registry->writeKey(array($name), array());
|
||||||
}
|
}
|
||||||
|
// echo $version_old, $settings->get('version');
|
||||||
if (version_compare($version_old, $settings->get('version'), "!=")) {
|
if (version_compare($version_old, $settings->get('version'), "!=")) {
|
||||||
$sql = $settings->get('sql');
|
$sql = $settings->get('sql');
|
||||||
if (is_array($sql)) {
|
if (is_array($sql)) {
|
||||||
|
|
|
||||||
|
|
@ -302,6 +302,7 @@ class Form_Form extends View_View {
|
||||||
'hidden' => 'THidden',
|
'hidden' => 'THidden',
|
||||||
'radio' => 'TSelectOne',
|
'radio' => 'TSelectOne',
|
||||||
'filebrowser' => 'TComponentBrowserInput',
|
'filebrowser' => 'TComponentBrowserInput',
|
||||||
|
'documents' => 'TComponentBrowserInput',
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
89
src/MailAlt.php
Normal file
89
src/MailAlt.php
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class MailAlt
|
||||||
|
{
|
||||||
|
protected $mailer;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -44,6 +44,7 @@ class Validator_Validator
|
||||||
// Список правил
|
// Список правил
|
||||||
if (! isset($value['validate'])) continue;
|
if (! isset($value['validate'])) continue;
|
||||||
$rules = explode("|", $value['validate']);
|
$rules = explode("|", $value['validate']);
|
||||||
|
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
// Список параметров правила
|
// Список параметров правила
|
||||||
$rule_param = explode(",", $rule);
|
$rule_param = explode(",", $rule);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue