From 7bbccea3b07c461e54b421078d132d2cac233ba1 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: Tue, 30 Jan 2018 15:31:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=B5=D1=81=20=D0=BA=D0=BB?= =?UTF-8?q?=D0=B0=D1=81=D1=81=20=D0=B2=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B9=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/Database.php | 4 +-- src/Form/Field.php | 50 +++++++++++++++++++++++++++++++++++ src/Form/Form.php | 66 ++++++---------------------------------------- src/MailAlt.php | 7 ++++- src/View/Page.php | 3 ++- 5 files changed, 68 insertions(+), 62 deletions(-) create mode 100644 src/Form/Field.php diff --git a/src/Database.php b/src/Database.php index 2ddc1f4..836a54a 100644 --- a/src/Database.php +++ b/src/Database.php @@ -126,7 +126,7 @@ class Database extends PDO $sql = "INSERT INTO $table (" . implode(",", array_keys($values)) . ") VALUES (" . implode(",", array_keys($prep)). ")"; - if($return_id){ + if ($return_id) { if ($this->isPostgres()){ $sql = $sql." RETURNING $index"; } @@ -139,7 +139,7 @@ class Database extends PDO if ($this->isPostgres()) { return $result[$index]; } else { - $result = $this->fetchOneArray("SELECT $index AS lastid FROM $table WHERE OID = last_insert_rowid()"); + $result = $this->fetchOneArray("SELECT $index AS lastid FROM $table WHERE OID = last_insert_rowid()"); return $result['lastid']; } } diff --git a/src/Form/Field.php b/src/Form/Field.php new file mode 100644 index 0000000..6736ea7 --- /dev/null +++ b/src/Form/Field.php @@ -0,0 +1,50 @@ +default = null; + if (isset($input['validate'])) { + $this->require = strpos($input['validate'], 'require') !== false; + } + if (isset($input['fieldset'])) { + $this->fieldset = $input['fieldset']; + } + // Инициализация свойст обьетка + foreach (array('label', 'name', 'type', 'description') as $name) { + if (isset($input[$name])) { + $this->$name = $input[$name]; + } + } + } + + function setValue(/*.any.*/$value) + { + $this->value = $value; + } + + function getId() + { + return $this->name . '_label'; + } +} diff --git a/src/Form/Form.php b/src/Form/Form.php index 458e8fa..130b3b9 100644 --- a/src/Form/Form.php +++ b/src/Form/Form.php @@ -1,62 +1,12 @@ default = null; - if (isset($input['validate'])) { - $this->require = strpos($input['validate'], 'require') !== false; - } - if (isset($input['fieldset'])) { - $this->fieldset = $input['fieldset']; - } - // Инициализация свойст обьетка - foreach (array('label', 'name', 'type', 'description') as $name) { - if (isset($input[$name])) { - $this->$name = $input[$name]; - } - } - } - - function setValue(/*.any.*/$value) - { - $this->value = $value; - } - - function getId() - { - return $this->name . '_label'; - } -} - /** * Поле ввода Input */ -class TInput extends TField { +class TInput extends Form_Field { } -class TCheckbox extends TField +class TCheckbox extends Form_Field { public $checked = false; function setValue($value) @@ -67,7 +17,7 @@ class TCheckbox extends TField } -class TSelect extends TField +class TSelect extends Form_Field { public $options = array(); @@ -140,14 +90,14 @@ class TQuestionType extends TSelect /** * Поле с датой */ -class TDate extends TField +class TDate extends Form_Field { } /** * Поле с цветом */ -class TColor extends TField +class TColor extends Form_Field { } @@ -155,7 +105,7 @@ class TColor extends TField /** * Текстовое поле */ -class TTextArea extends TField +class TTextArea extends Form_Field { function setValue($value) { @@ -166,11 +116,11 @@ class TTextArea extends TField /** * Поле для ввода пароля */ -class TSecret extends TField +class TSecret extends Form_Field { } -class TUpload extends TField +class TUpload extends Form_Field { } diff --git a/src/MailAlt.php b/src/MailAlt.php index f8761f6..2c8c017 100644 --- a/src/MailAlt.php +++ b/src/MailAlt.php @@ -3,6 +3,7 @@ class MailAlt { public $mailer; + public $_notify; function __construct() { $this->mailer = new PHPMailer(); @@ -35,7 +36,7 @@ class MailAlt */ function copy($name) // recipient cc { - $this->addCC($name); + $this->mailer->addCC($name); } function notify($notify) @@ -87,4 +88,8 @@ class MailAlt { return $this->mailer->send(); } + + function eml() { + return $this->mailer->getSentMIMEMessage(); + } } diff --git a/src/View/Page.php b/src/View/Page.php index 847061c..a280f26 100644 --- a/src/View/Page.php +++ b/src/View/Page.php @@ -48,11 +48,12 @@ class View_Page extends View_View function replaceContent($match, $offset) { //$result = phptal_component($match, $offset); + /*.Controller_Component.*/$component = null; if(class_exists("Controller_Site")){ //Если мы в CMS2 $component = Controller_Site::loadComponent($match); - }else{ + } else { global $db, $registry; // $component = Controller_Component::loadComponent($match, $db, $registry); }