Правильное название модели в компонентах. Альтернативная почта
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -302,6 +302,7 @@ class Form_Form extends View_View {
|
|||
'hidden' => 'THidden',
|
||||
'radio' => 'TSelectOne',
|
||||
'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;
|
||||
$rules = explode("|", $value['validate']);
|
||||
|
||||
foreach ($rules as $rule) {
|
||||
// Список параметров правила
|
||||
$rule_param = explode(",", $rule);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue