Version Description
/ 10.12.2020 = * Add security fixes
Download this release
Release Info
Developer | supsystic.com |
Plugin | Contact Form by Supsystic |
Version | 1.7.6 |
Comparing to | |
See all releases |
Code changes from version 1.7.5 to 1.7.6
- cfs.php +1 -1
- classes/controller.php +16 -12
- classes/req.php +98 -35
- config.php +1 -1
- css/bootstrap-simple.css +0 -5
- css/bootstrap.min.css +6 -0
- modules/forms/js/admin.forms.edit.js +7 -1
- modules/forms/models/forms.php +1 -1
- modules/forms/views/forms.php +41 -41
- modules/forms/views/tpl/formsEditAdminCodeOpts.php +1 -1
- modules/mail/engines/PHPMailerAutoload.php +0 -49
- modules/mail/engines/class.phpmailer.php +0 -4039
- modules/mail/engines/class.phpmaileroauth.php +0 -197
- modules/mail/engines/class.phpmaileroauthgoogle.php +0 -77
- modules/mail/engines/class.pop3.php +0 -407
- modules/mail/engines/class.smtp.php +0 -1249
- modules/mail/engines/get_oauth_token.php +0 -162
- modules/mail/mod.php +4 -10
- modules/templates/mod.php +7 -10
- readme.txt +4 -1
cfs.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Contact Form by Supsystic
|
4 |
* Description: Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
|
5 |
-
* Version: 1.7.
|
6 |
* Author: supsystic.com
|
7 |
* Author URI: https://supsystic.com
|
8 |
* Text Domain: contact-form-by-supsystic
|
2 |
/**
|
3 |
* Plugin Name: Contact Form by Supsystic
|
4 |
* Description: Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
|
5 |
+
* Version: 1.7.6
|
6 |
* Author: supsystic.com
|
7 |
* Author URI: https://supsystic.com
|
8 |
* Text Domain: contact-form-by-supsystic
|
classes/controller.php
CHANGED
@@ -53,7 +53,7 @@ abstract class controllerCfs {
|
|
53 |
if(importCfs($parentModule->getModDir(). 'models'. DS. $name. '.php')) {
|
54 |
$className = toeGetClassNameCfs($name. 'Model');
|
55 |
}
|
56 |
-
|
57 |
if($className) {
|
58 |
$model = new $className();
|
59 |
$model->setCode( $this->getCode() );
|
@@ -65,11 +65,11 @@ abstract class controllerCfs {
|
|
65 |
if(empty($name)) $name = $this->getCode();
|
66 |
$parentModule = frameCfs::_()->getModule( $this->getCode() );
|
67 |
$className = '';
|
68 |
-
|
69 |
if(importCfs($parentModule->getModDir(). 'views'. DS. $name. '.php')) {
|
70 |
$className = toeGetClassNameCfs($name. 'View');
|
71 |
}
|
72 |
-
|
73 |
if($className) {
|
74 |
$view = new $className();
|
75 |
$view->setCode( $this->getCode() );
|
@@ -137,11 +137,11 @@ abstract class controllerCfs {
|
|
137 |
$res = new responseCfs();
|
138 |
$res->ignoreShellData();
|
139 |
$model = $this->getModel();
|
140 |
-
|
141 |
-
$page = (int) reqCfs::getVar('page');
|
142 |
-
$rowsLimit = (int) reqCfs::getVar('rows');
|
143 |
-
$orderBy = reqCfs::getVar('sidx');
|
144 |
-
$sortOrder = reqCfs::getVar('sord');
|
145 |
|
146 |
// Our custom search
|
147 |
$search = reqCfs::getVar('search');
|
@@ -150,11 +150,15 @@ abstract class controllerCfs {
|
|
150 |
$v = trim($v);
|
151 |
if(empty($v)) continue;
|
152 |
if($k == 'text_like') {
|
|
|
|
|
153 |
$v = $this->_prepareTextLikeSearch( $v );
|
154 |
if(!empty($v)) {
|
155 |
$model->addWhere(array('additionalCondition' => $v));
|
156 |
}
|
157 |
} else {
|
|
|
|
|
158 |
$model->addWhere(array($k => $v));
|
159 |
}
|
160 |
}
|
@@ -162,8 +166,8 @@ abstract class controllerCfs {
|
|
162 |
// jqGrid search
|
163 |
$isSearch = reqCfs::getVar('_search');
|
164 |
if($isSearch) {
|
165 |
-
$searchField = trim(reqCfs::getVar('searchField'));
|
166 |
-
$searchString = trim(reqCfs::getVar('searchString'));
|
167 |
if(!empty($searchField) && !empty($searchString)) {
|
168 |
// For some cases - we will need to modify search keys and/or values before put it to the model
|
169 |
$model->addWhere(array(
|
@@ -185,14 +189,14 @@ abstract class controllerCfs {
|
|
185 |
$limitStart = $rowsLimit * $page - $rowsLimit; // do not put $limit*($page - 1)
|
186 |
if($limitStart < 0)
|
187 |
$limitStart = 0;
|
188 |
-
|
189 |
$data = $model
|
190 |
->setLimit($limitStart. ', '. $rowsLimit)
|
191 |
->setOrderBy( $this->_prepareSortOrder($orderBy) )
|
192 |
->setSortOrder( $sortOrder )
|
193 |
->setSimpleGetFields()
|
194 |
->getFromTbl();
|
195 |
-
|
196 |
$data = $this->_prepareListForTbl( $data );
|
197 |
$res->addData('page', $page);
|
198 |
$res->addData('total', $totalPages);
|
53 |
if(importCfs($parentModule->getModDir(). 'models'. DS. $name. '.php')) {
|
54 |
$className = toeGetClassNameCfs($name. 'Model');
|
55 |
}
|
56 |
+
|
57 |
if($className) {
|
58 |
$model = new $className();
|
59 |
$model->setCode( $this->getCode() );
|
65 |
if(empty($name)) $name = $this->getCode();
|
66 |
$parentModule = frameCfs::_()->getModule( $this->getCode() );
|
67 |
$className = '';
|
68 |
+
|
69 |
if(importCfs($parentModule->getModDir(). 'views'. DS. $name. '.php')) {
|
70 |
$className = toeGetClassNameCfs($name. 'View');
|
71 |
}
|
72 |
+
|
73 |
if($className) {
|
74 |
$view = new $className();
|
75 |
$view->setCode( $this->getCode() );
|
137 |
$res = new responseCfs();
|
138 |
$res->ignoreShellData();
|
139 |
$model = $this->getModel();
|
140 |
+
|
141 |
+
$page = (int) sanitize_text_field(reqCfs::getVar('page'));
|
142 |
+
$rowsLimit = (int) sanitize_text_field(reqCfs::getVar('rows'));
|
143 |
+
$orderBy = sanitize_text_field(reqCfs::getVar('sidx'));
|
144 |
+
$sortOrder = sanitize_text_field(reqCfs::getVar('sord'));
|
145 |
|
146 |
// Our custom search
|
147 |
$search = reqCfs::getVar('search');
|
150 |
$v = trim($v);
|
151 |
if(empty($v)) continue;
|
152 |
if($k == 'text_like') {
|
153 |
+
$k = sanitize_text_field($k);
|
154 |
+
$v = sanitize_text_field($v);
|
155 |
$v = $this->_prepareTextLikeSearch( $v );
|
156 |
if(!empty($v)) {
|
157 |
$model->addWhere(array('additionalCondition' => $v));
|
158 |
}
|
159 |
} else {
|
160 |
+
$k = sanitize_text_field($k);
|
161 |
+
$v = sanitize_text_field($v);
|
162 |
$model->addWhere(array($k => $v));
|
163 |
}
|
164 |
}
|
166 |
// jqGrid search
|
167 |
$isSearch = reqCfs::getVar('_search');
|
168 |
if($isSearch) {
|
169 |
+
$searchField = sanitize_text_field(trim(reqCfs::getVar('searchField')));
|
170 |
+
$searchString = sanitize_text_field(trim(reqCfs::getVar('searchString')));
|
171 |
if(!empty($searchField) && !empty($searchString)) {
|
172 |
// For some cases - we will need to modify search keys and/or values before put it to the model
|
173 |
$model->addWhere(array(
|
189 |
$limitStart = $rowsLimit * $page - $rowsLimit; // do not put $limit*($page - 1)
|
190 |
if($limitStart < 0)
|
191 |
$limitStart = 0;
|
192 |
+
|
193 |
$data = $model
|
194 |
->setLimit($limitStart. ', '. $rowsLimit)
|
195 |
->setOrderBy( $this->_prepareSortOrder($orderBy) )
|
196 |
->setSortOrder( $sortOrder )
|
197 |
->setSimpleGetFields()
|
198 |
->getFromTbl();
|
199 |
+
|
200 |
$data = $this->_prepareListForTbl( $data );
|
201 |
$res->addData('page', $page);
|
202 |
$res->addData('total', $totalPages);
|
classes/req.php
CHANGED
@@ -17,6 +17,33 @@ class reqCfs {
|
|
17 |
* @param mixed $default default value - will be returned if $name wasn't found
|
18 |
* @return mixed value of a variable, if didn't found - $default (NULL by default)
|
19 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
static public function getVar($name, $from = 'all', $default = NULL) {
|
21 |
$from = strtolower($from);
|
22 |
if($from == 'all') {
|
@@ -26,29 +53,51 @@ class reqCfs {
|
|
26 |
$from = 'post';
|
27 |
}
|
28 |
}
|
29 |
-
|
30 |
switch($from) {
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
if(isset($
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
case 'cookie':
|
53 |
if(isset($_COOKIE[$name])) {
|
54 |
$value = $_COOKIE[$name];
|
@@ -56,7 +105,7 @@ class reqCfs {
|
|
56 |
$value = explode('_JSON:', $value);
|
57 |
$value = utilsCfs::jsonDecode(array_pop($value));
|
58 |
}
|
59 |
-
|
60 |
}
|
61 |
break;
|
62 |
}
|
@@ -68,6 +117,11 @@ class reqCfs {
|
|
68 |
}
|
69 |
static public function setVar($name, $val, $in = 'input', $params = array()) {
|
70 |
$in = strtolower($in);
|
|
|
|
|
|
|
|
|
|
|
71 |
switch($in) {
|
72 |
case 'get':
|
73 |
$_GET[$name] = $val;
|
@@ -114,18 +168,27 @@ class reqCfs {
|
|
114 |
static public function get($what) {
|
115 |
$what = strtolower($what);
|
116 |
switch($what) {
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
return $
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
130 |
return NULL;
|
131 |
}
|
17 |
* @param mixed $default default value - will be returned if $name wasn't found
|
18 |
* @return mixed value of a variable, if didn't found - $default (NULL by default)
|
19 |
*/
|
20 |
+
|
21 |
+
|
22 |
+
static public function sanitize_array( &$array, $parentKey = '' ) {
|
23 |
+
$allowed = '<div><span><pre><p><br><hr><hgroup><h1><h2><h3><h4><h5><h6>
|
24 |
+
<ul><ol><li><dl><dt><dd><strong><em><b><i><u>
|
25 |
+
<img><a><abbr><address><blockquote><area><audio><video>
|
26 |
+
<form><fieldset><label><input><textarea>
|
27 |
+
<caption><table><tbody><td><tfoot><th><thead><tr>
|
28 |
+
<iframe><select><option>';
|
29 |
+
$keys = array('sub_txt_confirm_mail_message', 'sub_txt_subscriber_mail_subject', 'sub_txt_subscriber_mail_message', 'sub_new_message', 'field_wrapper');
|
30 |
+
foreach ($array as $key => &$value) {
|
31 |
+
if (in_array($key, $keys)) {
|
32 |
+
if (!is_array($value)) {
|
33 |
+
$value = strip_tags($value, $allowed);
|
34 |
+
}
|
35 |
+
} else {
|
36 |
+
if( !is_array($value) ) {
|
37 |
+
$value = sanitize_text_field($value);
|
38 |
+
} else {
|
39 |
+
self::sanitize_array($value);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
return $array;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
static public function getVar($name, $from = 'all', $default = NULL) {
|
48 |
$from = strtolower($from);
|
49 |
if($from == 'all') {
|
53 |
$from = 'post';
|
54 |
}
|
55 |
}
|
56 |
+
|
57 |
switch($from) {
|
58 |
+
case 'get':
|
59 |
+
if(isset($_GET[$name])) {
|
60 |
+
if (is_array($_GET[$name])) {
|
61 |
+
return self::sanitize_array($_GET[$name]);
|
62 |
+
} else {
|
63 |
+
return sanitize_text_field($_GET[$name]);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
break;
|
67 |
+
case 'post':
|
68 |
+
if(isset($_POST[$name])) {
|
69 |
+
if (is_array($_POST[$name])) {
|
70 |
+
return self::sanitize_array($_POST[$name]);
|
71 |
+
} else {
|
72 |
+
return sanitize_text_field($_POST[$name]);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
break;
|
76 |
+
case 'file':
|
77 |
+
case 'files':
|
78 |
+
$name = sanitize_file_name($name);
|
79 |
+
if(isset($_FILES[$name])) {
|
80 |
+
return $_FILES[$name];
|
81 |
+
}
|
82 |
+
break;
|
83 |
+
case 'session':
|
84 |
+
if(isset($_SESSION[$name])) {
|
85 |
+
if (is_array($_SESSION[$name])) {
|
86 |
+
return self::sanitize_array($_SESSION[$name]);
|
87 |
+
} else {
|
88 |
+
return sanitize_text_field($_SESSION[$name]);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
break;
|
92 |
+
case 'server':
|
93 |
+
if(isset($_SERVER[$name])) {
|
94 |
+
if (is_array($_SERVER[$name])) {
|
95 |
+
return self::sanitize_array($_SERVER[$name]);
|
96 |
+
} else {
|
97 |
+
return sanitize_text_field($_SERVER[$name]);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
break;
|
101 |
case 'cookie':
|
102 |
if(isset($_COOKIE[$name])) {
|
103 |
$value = $_COOKIE[$name];
|
105 |
$value = explode('_JSON:', $value);
|
106 |
$value = utilsCfs::jsonDecode(array_pop($value));
|
107 |
}
|
108 |
+
return sanitize_text_field($value);
|
109 |
}
|
110 |
break;
|
111 |
}
|
117 |
}
|
118 |
static public function setVar($name, $val, $in = 'input', $params = array()) {
|
119 |
$in = strtolower($in);
|
120 |
+
if (is_array($val)) {
|
121 |
+
$val = $this->sanitize_array($val);
|
122 |
+
} else {
|
123 |
+
$val = sanitize_text_field($val);
|
124 |
+
}
|
125 |
switch($in) {
|
126 |
case 'get':
|
127 |
$_GET[$name] = $val;
|
168 |
static public function get($what) {
|
169 |
$what = strtolower($what);
|
170 |
switch($what) {
|
171 |
+
case 'get':
|
172 |
+
if (is_array($_GET)) {
|
173 |
+
return self::sanitize_array($_GET);
|
174 |
+
} else {
|
175 |
+
return sanitize_text_field($_GET);
|
176 |
+
}
|
177 |
+
break;
|
178 |
+
case 'post':
|
179 |
+
if (is_array($_POST)) {
|
180 |
+
return self::sanitize_array($_POST);
|
181 |
+
} else {
|
182 |
+
return sanitize_text_field($_POST);
|
183 |
+
}
|
184 |
+
break;
|
185 |
+
case 'session':
|
186 |
+
if (is_array($_SESSION)) {
|
187 |
+
return self::sanitize_array($_SESSION);
|
188 |
+
} else {
|
189 |
+
return sanitize_text_field($_SESSION);
|
190 |
+
}
|
191 |
+
break;
|
192 |
}
|
193 |
return NULL;
|
194 |
}
|
config.php
CHANGED
@@ -48,7 +48,7 @@
|
|
48 |
define('CFS_EOL', "\n");
|
49 |
|
50 |
define('CFS_PLUGIN_INSTALLED', true);
|
51 |
-
define('CFS_VERSION', '1.7.
|
52 |
define('CFS_USER', 'user');
|
53 |
|
54 |
define('CFS_CLASS_PREFIX', 'cfsc');
|
48 |
define('CFS_EOL', "\n");
|
49 |
|
50 |
define('CFS_PLUGIN_INSTALLED', true);
|
51 |
+
define('CFS_VERSION', '1.7.6');
|
52 |
define('CFS_USER', 'user');
|
53 |
|
54 |
define('CFS_CLASS_PREFIX', 'cfsc');
|
css/bootstrap-simple.css
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Bootstrap v3.3.6 (http://getbootstrap.com)
|
3 |
-
* Copyright 2011-2015 Twitter, Inc.
|
4 |
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
5 |
-
*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */.container,.container-fluid{margin-right:auto;margin-left:auto;padding-right:15px;padding-left:15px}caption,th{text-align:left}.table,legend{margin-bottom:20px}.table,label{max-width:100%}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}fieldset,legend{padding:0;border:0}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777}.table{width:100%}fieldset{min-width:0;margin:0}legend{display:block;width:100%;font-size:21px;line-height:inherit;color:#333;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=radio]:focus,input[type=checkbox]:focus,input[type=file]:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}
|
|
|
|
|
|
|
|
|
|
css/bootstrap.min.css
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Bootstrap v3.4.1 (https://getbootstrap.com/)
|
3 |
+
* Copyright 2011-2019 Twitter, Inc.
|
4 |
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
5 |
+
*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;-moz-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:"Glyphicons Halflings";src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format("embedded-opentype"),url(../fonts/glyphicons-halflings-regular.woff2) format("woff2"),url(../fonts/glyphicons-halflings-regular.woff) format("woff"),url(../fonts/glyphicons-halflings-regular.ttf) format("truetype"),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format("svg")}.glyphicon{position:relative;top:1px;display:inline-block;font-family:"Glyphicons Halflings";font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none;margin-left:-5px}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:"\2014 \00A0"}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:""}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:"\00A0 \2014"}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.row-no-gutters{margin-right:0;margin-left:0}.row-no-gutters [class*=col-]{padding-right:0;padding-left:0}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=checkbox]:focus,input[type=file]:focus,input[type=radio]:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s,-webkit-box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{background-color:transparent;border:0}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=datetime-local].form-control,input[type=month].form-control,input[type=time].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],.input-group-sm input[type=time],input[type=date].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm,input[type=time].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],.input-group-lg input[type=time],input[type=date].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg,input[type=time].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid transparent;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);opacity:.65;-webkit-box-shadow:none;box-shadow:none}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;background-image:none;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;background-image:none;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;background-image:none;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;background-image:none;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;background-image:none;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;background-image:none;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1);-webkit-overflow-scrolling:touch}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-right:15px;margin-top:8px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-right:-15px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);margin-top:8px;margin-bottom:8px}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{padding-right:15px;padding-left:15px;border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0%;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out,-o-transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-style:normal;font-weight:400;line-height:1.42857143;line-break:auto;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;font-size:12px;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-style:normal;font-weight:400;line-height:1.42857143;line-break:auto;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;font-size:14px;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover>.arrow{border-width:11px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:-webkit-transform .6s ease-in-out;transition:transform .6s ease-in-out;transition:transform .6s ease-in-out,-webkit-transform .6s ease-in-out,-o-transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);left:0}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);left:0}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);left:0}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);background-color:rgba(0,0,0,0);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;outline:0;filter:alpha(opacity=90);opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:"\2039"}.carousel-control .icon-next:before{content:"\203a"}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}}
|
6 |
+
/*# sourceMappingURL=bootstrap.min.css.map */
|
modules/forms/js/admin.forms.edit.js
CHANGED
@@ -412,7 +412,13 @@ function cfsFinishEditFormLabel(label) {
|
|
412 |
if(!res.error) {
|
413 |
var $labelHtml = jQuery('#cfsFormEditableLabel')
|
414 |
, $labelTxt = jQuery('#cfsFormEditableLabelTxt');
|
415 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
416 |
$labelTxt.hide( g_cfsAnimationSpeed ).data('ready', 0);
|
417 |
$labelHtml.show( g_cfsAnimationSpeed );
|
418 |
jQuery('#cfsFormEditableLabelShell').data('edit-on', 0);
|
412 |
if(!res.error) {
|
413 |
var $labelHtml = jQuery('#cfsFormEditableLabel')
|
414 |
, $labelTxt = jQuery('#cfsFormEditableLabelTxt');
|
415 |
+
|
416 |
+
var labelFormattedText = jQuery.trim($labelTxt.val());
|
417 |
+
if (/script/i.test(labelFormattedText)) {
|
418 |
+
labelFormattedText = '';
|
419 |
+
}
|
420 |
+
$labelHtml.html( labelFormattedText );
|
421 |
+
|
422 |
$labelTxt.hide( g_cfsAnimationSpeed ).data('ready', 0);
|
423 |
$labelHtml.show( g_cfsAnimationSpeed );
|
424 |
jQuery('#cfsFormEditableLabelShell').data('edit-on', 0);
|
modules/forms/models/forms.php
CHANGED
@@ -822,7 +822,7 @@ class formsModelCfs extends modelCfs {
|
|
822 |
public function updateLabel($d = array()) {
|
823 |
$d['id'] = isset($d['id']) ? (int) $d['id'] : 0;
|
824 |
if(!empty($d['id'])) {
|
825 |
-
$d['label'] = isset($d['label']) ? trim($d['label']) : '';
|
826 |
if(!empty($d['label'])) {
|
827 |
return $this->updateById(array(
|
828 |
'label' => $d['label']
|
822 |
public function updateLabel($d = array()) {
|
823 |
$d['id'] = isset($d['id']) ? (int) $d['id'] : 0;
|
824 |
if(!empty($d['id'])) {
|
825 |
+
$d['label'] = isset($d['label']) ? sanitize_text_field(trim($d['label'])) : '';
|
826 |
if(!empty($d['label'])) {
|
827 |
return $this->updateById(array(
|
828 |
'label' => $d['label']
|
modules/forms/views/forms.php
CHANGED
@@ -10,7 +10,7 @@ class formsViewCfs extends viewCfs {
|
|
10 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
11 |
frameCfs::_()->addScript('admin.forms.list', $this->getModule()->getModPath(). 'js/admin.forms.list.js');
|
12 |
frameCfs::_()->addJSVar('admin.forms.list', 'cfsTblDataUrl', uriCfs::mod('forms', 'getListForTbl', array('reqType' => 'ajax')));
|
13 |
-
|
14 |
$this->assign('addNewLink', frameCfs::_()->getModule('options')->getTabUrl('forms_add_new'));
|
15 |
return parent::getContent('formsAdmin');
|
16 |
}
|
@@ -19,7 +19,7 @@ class formsViewCfs extends viewCfs {
|
|
19 |
frameCfs::_()->addStyle('admin.forms', $this->getModule()->getModPath(). 'css/admin.forms.css');
|
20 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
21 |
frameCfs::_()->getModule('templates')->loadMagicAnims();
|
22 |
-
|
23 |
$changeFor = (int) reqCfs::getVar('change_for', 'get');
|
24 |
//frameCfs::_()->addJSVar('admin.forms', 'cfsChangeFor', array($changeFor));
|
25 |
if($changeFor) {
|
@@ -35,7 +35,7 @@ class formsViewCfs extends viewCfs {
|
|
35 |
->setSortOrder('ASC')
|
36 |
->getSimpleList(array('active' => 1, 'original_id' => 0))));
|
37 |
$this->assign('changeFor', $changeFor);
|
38 |
-
|
39 |
return parent::getContent('formsAddNewAdmin');
|
40 |
}
|
41 |
public function modifyBreadcrumbsForChangeTpl($crumbs) {
|
@@ -51,13 +51,13 @@ class formsViewCfs extends viewCfs {
|
|
51 |
return __('Cannot find required Form', CFS_LANG_CODE);
|
52 |
}
|
53 |
dispatcherCfs::doAction('beforeFormEdit', $form);
|
54 |
-
|
55 |
dispatcherCfs::addAction('afterAdminBreadcrumbs', array($this, 'showEditFormFormControls'));
|
56 |
dispatcherCfs::addAction('adminBreadcrumbsClassAdd', array($this, 'adminBreadcrumbsClassAdd'));
|
57 |
if(empty($form['ab_id'])) {
|
58 |
dispatcherCfs::addFilter('mainBreadcrumbs', array($this, 'changeMainBreadCrumbsClb'));
|
59 |
}
|
60 |
-
|
61 |
// !remove this!!!!
|
62 |
//$form['params']['opts_attrs']['bg_number'] = 2;
|
63 |
/*$form['params']['opts_attrs'] = array(
|
@@ -70,7 +70,7 @@ class formsViewCfs extends viewCfs {
|
|
70 |
// !remove this!!!!
|
71 |
if(!is_array($form['params']))
|
72 |
$form['params'] = array();
|
73 |
-
|
74 |
frameCfs::_()->getModule('templates')->loadJqueryUi();
|
75 |
frameCfs::_()->getModule('templates')->loadSortable();
|
76 |
frameCfs::_()->getModule('templates')->loadCodemirror();
|
@@ -78,14 +78,14 @@ class formsViewCfs extends viewCfs {
|
|
78 |
//frameCfs::_()->getModule('templates')->loadSerializeJson();
|
79 |
if ( ! class_exists( '_WP_Editors', false ) )
|
80 |
require( ABSPATH . WPINC . '/class-wp-editor.php' );
|
81 |
-
|
82 |
$fieldTypes = $this->getModule()->getFieldTypes();
|
83 |
$cfsAddNewUrl = frameCfs::_()->getModule('options')->getTabUrl('forms_add_new');
|
84 |
frameCfs::_()->addStyle('admin.forms', $this->getModule()->getModPath(). 'css/admin.forms.css');
|
85 |
frameCfs::_()->addScript('admin.forms.fields', $this->getModule()->getModPath(). 'js/admin.forms.fields.js');
|
86 |
frameCfs::_()->addJSVar('admin.forms.fields', 'cfsFormTypes', $fieldTypes);
|
87 |
frameCfs::_()->addJSVar('admin.forms.fields', 'cfsAllCountries', fieldAdapterCfs::getCountries());
|
88 |
-
|
89 |
frameCfs::_()->addScript('admin.forms.submit', $this->getModule()->getModPath(). 'js/admin.forms.submit.js');
|
90 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
91 |
frameCfs::_()->addScript('admin.forms.edit', $this->getModule()->getModPath(). 'js/admin.forms.edit.js');
|
@@ -93,9 +93,9 @@ class formsViewCfs extends viewCfs {
|
|
93 |
exit();*/
|
94 |
frameCfs::_()->addJSVar('admin.forms.edit', 'cfsForm', $form);
|
95 |
frameCfs::_()->addJSVar('admin.forms.edit', 'cfsAddNewUrl', $cfsAddNewUrl);
|
96 |
-
|
97 |
frameCfs::_()->addScript('wp.tabs', CFS_JS_PATH. 'wp.tabs.js');
|
98 |
-
|
99 |
$bgType = array(
|
100 |
'none' => __('None', CFS_LANG_CODE),
|
101 |
'img' => __('Image', CFS_LANG_CODE),
|
@@ -103,7 +103,7 @@ class formsViewCfs extends viewCfs {
|
|
103 |
);
|
104 |
|
105 |
$this->assign('csvExportUrl', uriCfs::mod('forms', 'exportCsv', array('id' => $id)));
|
106 |
-
|
107 |
$this->assign('adminEmail', get_bloginfo('admin_email'));
|
108 |
$this->assign('isPro', frameCfs::_()->getModule('supsystic_promo')->isPro());
|
109 |
$this->assign('mainLink', frameCfs::_()->getModule('supsystic_promo')->getMainLink());
|
@@ -119,28 +119,28 @@ class formsViewCfs extends viewCfs {
|
|
119 |
|
120 |
$tabs = array(
|
121 |
'cfsFormTpl' => array(
|
122 |
-
'title' => __('Design', CFS_LANG_CODE),
|
123 |
'content' => $this->getMainFormTplTab(),
|
124 |
'fa_icon' => 'fa-picture-o',
|
125 |
'sort_order' => 0),
|
126 |
'cfsFormFields' => array(
|
127 |
-
'title' => __('Fields', CFS_LANG_CODE),
|
128 |
'content' => $this->getMainFormFieldsTab(),
|
129 |
'fa_icon' => 'fa-list',
|
130 |
'sort_order' => 10),
|
131 |
'cfsSubmitOpts' => array(
|
132 |
-
'title' => __('Submit Options', CFS_LANG_CODE),
|
133 |
'content' => $this->getMainFormSubmitOptsTab(),
|
134 |
'fa_icon' => 'fa-envelope-o',
|
135 |
'sort_order' => 20),
|
136 |
'cfsFormStatistics' => array(
|
137 |
-
'title' => __('Statistics', CFS_LANG_CODE),
|
138 |
'content' => $this->getMainFormStatisticsOptsTab(),
|
139 |
'fa_icon' => 'fa-line-chart',
|
140 |
'sort_order' => 100,
|
141 |
),
|
142 |
'cfsFormEditors' => array(
|
143 |
-
'title' => __('CSS / HTML Code', CFS_LANG_CODE),
|
144 |
'content' => $this->getMainFormCodeTab(),
|
145 |
'fa_icon' => 'fa-code',
|
146 |
'sort_order' => 999),
|
@@ -206,14 +206,14 @@ class formsViewCfs extends viewCfs {
|
|
206 |
$this->assign('regRolesForSelect', $this->getAvailableUserRolesForSelect());
|
207 |
$this->assign('submitOptsAddTabs', array(
|
208 |
'cfsFormSubmitEditTabPublish' => array(
|
209 |
-
'title' => __('Publish Content', CFS_LANG_CODE),
|
210 |
'content' => $this->_getMainFormPublishContentTab(),
|
211 |
'fa_icon' => 'fa-thumb-tack',
|
212 |
'sort_order' => 0,
|
213 |
),
|
214 |
-
|
215 |
'cfsFormSubmitEditTabRegistration' => array(
|
216 |
-
'title' => __('Registration', CFS_LANG_CODE),
|
217 |
'content' => $this->_getMainFormRegistrationTab(),
|
218 |
'fa_icon' => 'fa-user-plus',
|
219 |
'sort_order' => 10,
|
@@ -226,7 +226,7 @@ class formsViewCfs extends viewCfs {
|
|
226 |
$res = array();
|
227 |
$allRoles = $wp_roles->roles;
|
228 |
$editableRoles = apply_filters('editable_roles', $allRoles);
|
229 |
-
|
230 |
if(!empty($editableRoles)) {
|
231 |
foreach($editableRoles as $role => $data) {
|
232 |
if(in_array($role, array('administrator', 'editor'))) continue;
|
@@ -258,7 +258,7 @@ class formsViewCfs extends viewCfs {
|
|
258 |
if(!empty($allGoogleMaps)) {
|
259 |
foreach($allGoogleMaps as $m) {
|
260 |
$allGoogleMapsForSelect[ $m['id'] ] = $m['title'];
|
261 |
-
}
|
262 |
}
|
263 |
$this->assign('allGoogleMapsForSelect', $allGoogleMapsForSelect);
|
264 |
}
|
@@ -288,16 +288,16 @@ class formsViewCfs extends viewCfs {
|
|
288 |
}
|
289 |
public function getFrontendStyles() {
|
290 |
return array(
|
291 |
-
CFS_CODE. '.frontend.bootstrap.
|
292 |
CFS_CODE. '.frontend.forms' => $this->getModule()->getModPath(). 'css/frontend.forms.css',
|
293 |
);
|
294 |
}
|
295 |
public function showForm($params) {
|
296 |
frameCfs::_()->getModule('templates')->loadCoreJs();
|
297 |
$id = $params['id'];
|
298 |
-
|
299 |
$id = dispatcherCfs::applyFilters('formIdBeforeShow', $id);
|
300 |
-
|
301 |
$form = $this->getModel()->getById( $id );
|
302 |
if(!empty($form)) {
|
303 |
dispatcherCfs::doAction('formBeforeShow', $form);
|
@@ -316,7 +316,7 @@ class formsViewCfs extends viewCfs {
|
|
316 |
}
|
317 |
frameCfs::_()->addScript(CFS_CODE. '.modernizr', $this->getModule()->getModPath(). 'js/forms.modernizr.min.js');
|
318 |
frameCfs::_()->addScript(CFS_CODE. '.frontend.forms', $this->getModule()->getModPath(). 'js/frontend.forms.js');
|
319 |
-
|
320 |
//frameCfs::_()->addJSVar(CFS_CODE. '.frontend.forms', 'cfsForms_'. $this->_renderFormIter, $this->_prepareForFront($form));
|
321 |
//frameCfs::_()->addJSVar(CFS_CODE. '.frontend.forms', 'cfsFormsRenderFormIter', array('lastIter' => $this->_renderFormIter));
|
322 |
$this->_renderFormIter++;
|
@@ -353,7 +353,7 @@ class formsViewCfs extends viewCfs {
|
|
353 |
}
|
354 |
}
|
355 |
$removeParamsKeys = array('sub_aweber_listname', 'sub_aweber_adtracking', 'sub_mailchimp_api_key', 'sub_mailchimp_lists', 'sub_ar_form_action',
|
356 |
-
'sub_sga_id', 'sub_sga_list_id', 'sub_sga_activate_code', 'sub_gr_api_key', 'sub_ac_api_url', 'sub_ac_api_key',
|
357 |
'sub_ac_lists', 'sub_mr_lists', 'sub_gr_api_key', 'sub_gr_lists', 'cycle_day', 'sub_ic_app_id', 'sub_ic_app_user', 'sub_ic_app_pass', 'sub_ic_lists',
|
358 |
'sub_ck_api_key', 'sub_mem_acc_id', 'sub_mem_pud_key', 'sub_mem_priv_key', 'test_email', 'sub_sb_api_key',
|
359 |
'sub_aw_c_key', 'sub_aw_c_secret');
|
@@ -414,24 +414,24 @@ class formsViewCfs extends viewCfs {
|
|
414 |
$form = $this->getModel()->getById($form);
|
415 |
}
|
416 |
$this->_initTwig();
|
417 |
-
|
418 |
$form = dispatcherCfs::applyFilters('beforeFormRender', $form);
|
419 |
|
420 |
$form['params']['tpl']['form_start'] = $this->generateFormStart( $form );
|
421 |
$form['params']['tpl']['fields'] = $this->generateFields( $form );
|
422 |
$form['params']['tpl']['form_end'] = $this->generateFormEnd( $form );
|
423 |
-
|
424 |
$form['css'] .= $this->_generateCommonFormCss( $form );
|
425 |
-
|
426 |
$form['css'] = $this->_replaceTagsWithTwig( $form['css'], $form );
|
427 |
$form['html'] = $this->_replaceTagsWithTwig( $form['html'], $form );
|
428 |
-
|
429 |
$form['html'] .= $this->_generateImgsPreload( $form );
|
430 |
-
|
431 |
$form['css'] = dispatcherCfs::applyFilters('formCss', $form['css'], $form, $params);
|
432 |
$form['html'] = dispatcherCfs::applyFilters('formHtml', $form['html'], $form, $params);
|
433 |
-
// $replaceStyleTag can be used for compability with other plugins minify functionality:
|
434 |
-
// it will not recognize css in js data as style whye rendering on server side,
|
435 |
// but will be replaced back to normal <style> tag in JS, @see js/frontend.forms.js
|
436 |
return $this->_twig->render(
|
437 |
($replaceStyleTag ? '<span style="display: none;" id="cfsFormStylesHidden_'. $form['view_id']. '">' : '<style type="text/css" id="'. $form['view_html_id']. '_style">')
|
@@ -445,7 +445,7 @@ class formsViewCfs extends viewCfs {
|
|
445 |
$res = '';
|
446 |
$res .= '#[SHELL_ID] { width: '. $form['params']['tpl']['width']. $form['params']['tpl']['width_measure']. '}';
|
447 |
if(isset($form['params'], $form['params']['tpl'], $form['params']['tpl']['form_sent_msg_color'])
|
448 |
-
&& !empty($form['params']['tpl']['form_sent_msg_color'])
|
449 |
) {
|
450 |
$res .= '#[SHELL_ID] .cfsSuccessMsg { color: '. $form['params']['tpl']['form_sent_msg_color']. ' !important}';
|
451 |
}
|
@@ -579,7 +579,7 @@ class formsViewCfs extends viewCfs {
|
|
579 |
}
|
580 |
}
|
581 |
}
|
582 |
-
|
583 |
// $isRadioCheckList fields have multiple labeled selections inside - them simply does not need main label selection
|
584 |
// For all other - generate unique ID if it's required - here
|
585 |
if(strpos($fieldWrapper, '[field_id]') !== false && !$isRadioCheckList) { // Need field ID
|
@@ -624,8 +624,8 @@ class formsViewCfs extends viewCfs {
|
|
624 |
}
|
625 |
|
626 |
$inputHtml = str_replace(
|
627 |
-
$replaceFrom,
|
628 |
-
$replaceTo,
|
629 |
$fieldWrapper);
|
630 |
}
|
631 |
}
|
@@ -673,10 +673,10 @@ class formsViewCfs extends viewCfs {
|
|
673 |
private function _replaceTagsWithTwig($string, $form) {
|
674 |
$string = preg_replace('/\[if (.+)\]/iU', '{% if forms.params.tpl.$1 %}', $string);
|
675 |
$string = preg_replace('/\[elseif (.+)\]/iU', '{% elseif forms.params.tpl.$1 %}', $string);
|
676 |
-
|
677 |
$replaceFrom = array('SHELL_ID', 'ID', 'endif', 'else');
|
678 |
$replaceTo = array($form['view_html_id'], $form['view_id'], '{% endif %}', '{% else %}');
|
679 |
-
// Standard shortcode processor didn't worked for us here - as it is developed for posts,
|
680 |
// not for direct "do_shortcode" call, so we created own embed shortcode processor
|
681 |
if(isset($form['params']) && isset($form['params']['tpl'])) {
|
682 |
foreach($form['params']['tpl'] as $key => $val) {
|
@@ -741,7 +741,7 @@ class formsViewCfs extends viewCfs {
|
|
741 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
742 |
frameCfs::_()->addScript('admin.forms.contacts.list', $this->getModule()->getModPath(). 'js/admin.forms.contacts.list.js');
|
743 |
frameCfs::_()->addJSVar('admin.forms.contacts.list', 'cfsTblDataUrl', uriCfs::mod('forms', 'getContactsListForTbl', array('reqType' => 'ajax', 'fid' => $fid)));
|
744 |
-
|
745 |
$allForms = $this->getModel()->getFromTbl();
|
746 |
$allFormsForSelect = array();
|
747 |
$formsFields = array();
|
@@ -767,7 +767,7 @@ class formsViewCfs extends viewCfs {
|
|
767 |
}
|
768 |
}
|
769 |
frameCfs::_()->addJSVar('admin.forms.contacts.list', 'cfsFormFields', $formsFields);
|
770 |
-
|
771 |
$this->assign('addNewLink', frameCfs::_()->getModule('options')->getTabUrl('forms_add_new'));
|
772 |
$this->assign('allFormsForSelect', $allFormsForSelect);
|
773 |
$this->assign('fid', $fid);
|
10 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
11 |
frameCfs::_()->addScript('admin.forms.list', $this->getModule()->getModPath(). 'js/admin.forms.list.js');
|
12 |
frameCfs::_()->addJSVar('admin.forms.list', 'cfsTblDataUrl', uriCfs::mod('forms', 'getListForTbl', array('reqType' => 'ajax')));
|
13 |
+
|
14 |
$this->assign('addNewLink', frameCfs::_()->getModule('options')->getTabUrl('forms_add_new'));
|
15 |
return parent::getContent('formsAdmin');
|
16 |
}
|
19 |
frameCfs::_()->addStyle('admin.forms', $this->getModule()->getModPath(). 'css/admin.forms.css');
|
20 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
21 |
frameCfs::_()->getModule('templates')->loadMagicAnims();
|
22 |
+
|
23 |
$changeFor = (int) reqCfs::getVar('change_for', 'get');
|
24 |
//frameCfs::_()->addJSVar('admin.forms', 'cfsChangeFor', array($changeFor));
|
25 |
if($changeFor) {
|
35 |
->setSortOrder('ASC')
|
36 |
->getSimpleList(array('active' => 1, 'original_id' => 0))));
|
37 |
$this->assign('changeFor', $changeFor);
|
38 |
+
|
39 |
return parent::getContent('formsAddNewAdmin');
|
40 |
}
|
41 |
public function modifyBreadcrumbsForChangeTpl($crumbs) {
|
51 |
return __('Cannot find required Form', CFS_LANG_CODE);
|
52 |
}
|
53 |
dispatcherCfs::doAction('beforeFormEdit', $form);
|
54 |
+
|
55 |
dispatcherCfs::addAction('afterAdminBreadcrumbs', array($this, 'showEditFormFormControls'));
|
56 |
dispatcherCfs::addAction('adminBreadcrumbsClassAdd', array($this, 'adminBreadcrumbsClassAdd'));
|
57 |
if(empty($form['ab_id'])) {
|
58 |
dispatcherCfs::addFilter('mainBreadcrumbs', array($this, 'changeMainBreadCrumbsClb'));
|
59 |
}
|
60 |
+
|
61 |
// !remove this!!!!
|
62 |
//$form['params']['opts_attrs']['bg_number'] = 2;
|
63 |
/*$form['params']['opts_attrs'] = array(
|
70 |
// !remove this!!!!
|
71 |
if(!is_array($form['params']))
|
72 |
$form['params'] = array();
|
73 |
+
|
74 |
frameCfs::_()->getModule('templates')->loadJqueryUi();
|
75 |
frameCfs::_()->getModule('templates')->loadSortable();
|
76 |
frameCfs::_()->getModule('templates')->loadCodemirror();
|
78 |
//frameCfs::_()->getModule('templates')->loadSerializeJson();
|
79 |
if ( ! class_exists( '_WP_Editors', false ) )
|
80 |
require( ABSPATH . WPINC . '/class-wp-editor.php' );
|
81 |
+
|
82 |
$fieldTypes = $this->getModule()->getFieldTypes();
|
83 |
$cfsAddNewUrl = frameCfs::_()->getModule('options')->getTabUrl('forms_add_new');
|
84 |
frameCfs::_()->addStyle('admin.forms', $this->getModule()->getModPath(). 'css/admin.forms.css');
|
85 |
frameCfs::_()->addScript('admin.forms.fields', $this->getModule()->getModPath(). 'js/admin.forms.fields.js');
|
86 |
frameCfs::_()->addJSVar('admin.forms.fields', 'cfsFormTypes', $fieldTypes);
|
87 |
frameCfs::_()->addJSVar('admin.forms.fields', 'cfsAllCountries', fieldAdapterCfs::getCountries());
|
88 |
+
|
89 |
frameCfs::_()->addScript('admin.forms.submit', $this->getModule()->getModPath(). 'js/admin.forms.submit.js');
|
90 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
91 |
frameCfs::_()->addScript('admin.forms.edit', $this->getModule()->getModPath(). 'js/admin.forms.edit.js');
|
93 |
exit();*/
|
94 |
frameCfs::_()->addJSVar('admin.forms.edit', 'cfsForm', $form);
|
95 |
frameCfs::_()->addJSVar('admin.forms.edit', 'cfsAddNewUrl', $cfsAddNewUrl);
|
96 |
+
|
97 |
frameCfs::_()->addScript('wp.tabs', CFS_JS_PATH. 'wp.tabs.js');
|
98 |
+
|
99 |
$bgType = array(
|
100 |
'none' => __('None', CFS_LANG_CODE),
|
101 |
'img' => __('Image', CFS_LANG_CODE),
|
103 |
);
|
104 |
|
105 |
$this->assign('csvExportUrl', uriCfs::mod('forms', 'exportCsv', array('id' => $id)));
|
106 |
+
|
107 |
$this->assign('adminEmail', get_bloginfo('admin_email'));
|
108 |
$this->assign('isPro', frameCfs::_()->getModule('supsystic_promo')->isPro());
|
109 |
$this->assign('mainLink', frameCfs::_()->getModule('supsystic_promo')->getMainLink());
|
119 |
|
120 |
$tabs = array(
|
121 |
'cfsFormTpl' => array(
|
122 |
+
'title' => __('Design', CFS_LANG_CODE),
|
123 |
'content' => $this->getMainFormTplTab(),
|
124 |
'fa_icon' => 'fa-picture-o',
|
125 |
'sort_order' => 0),
|
126 |
'cfsFormFields' => array(
|
127 |
+
'title' => __('Fields', CFS_LANG_CODE),
|
128 |
'content' => $this->getMainFormFieldsTab(),
|
129 |
'fa_icon' => 'fa-list',
|
130 |
'sort_order' => 10),
|
131 |
'cfsSubmitOpts' => array(
|
132 |
+
'title' => __('Submit Options', CFS_LANG_CODE),
|
133 |
'content' => $this->getMainFormSubmitOptsTab(),
|
134 |
'fa_icon' => 'fa-envelope-o',
|
135 |
'sort_order' => 20),
|
136 |
'cfsFormStatistics' => array(
|
137 |
+
'title' => __('Statistics', CFS_LANG_CODE),
|
138 |
'content' => $this->getMainFormStatisticsOptsTab(),
|
139 |
'fa_icon' => 'fa-line-chart',
|
140 |
'sort_order' => 100,
|
141 |
),
|
142 |
'cfsFormEditors' => array(
|
143 |
+
'title' => __('CSS / HTML Code', CFS_LANG_CODE),
|
144 |
'content' => $this->getMainFormCodeTab(),
|
145 |
'fa_icon' => 'fa-code',
|
146 |
'sort_order' => 999),
|
206 |
$this->assign('regRolesForSelect', $this->getAvailableUserRolesForSelect());
|
207 |
$this->assign('submitOptsAddTabs', array(
|
208 |
'cfsFormSubmitEditTabPublish' => array(
|
209 |
+
'title' => __('Publish Content', CFS_LANG_CODE),
|
210 |
'content' => $this->_getMainFormPublishContentTab(),
|
211 |
'fa_icon' => 'fa-thumb-tack',
|
212 |
'sort_order' => 0,
|
213 |
),
|
214 |
+
|
215 |
'cfsFormSubmitEditTabRegistration' => array(
|
216 |
+
'title' => __('Registration', CFS_LANG_CODE),
|
217 |
'content' => $this->_getMainFormRegistrationTab(),
|
218 |
'fa_icon' => 'fa-user-plus',
|
219 |
'sort_order' => 10,
|
226 |
$res = array();
|
227 |
$allRoles = $wp_roles->roles;
|
228 |
$editableRoles = apply_filters('editable_roles', $allRoles);
|
229 |
+
|
230 |
if(!empty($editableRoles)) {
|
231 |
foreach($editableRoles as $role => $data) {
|
232 |
if(in_array($role, array('administrator', 'editor'))) continue;
|
258 |
if(!empty($allGoogleMaps)) {
|
259 |
foreach($allGoogleMaps as $m) {
|
260 |
$allGoogleMapsForSelect[ $m['id'] ] = $m['title'];
|
261 |
+
}
|
262 |
}
|
263 |
$this->assign('allGoogleMapsForSelect', $allGoogleMapsForSelect);
|
264 |
}
|
288 |
}
|
289 |
public function getFrontendStyles() {
|
290 |
return array(
|
291 |
+
CFS_CODE. '.frontend.bootstrap.cfs' => CFS_CSS_PATH. 'bootstrap.min.css',
|
292 |
CFS_CODE. '.frontend.forms' => $this->getModule()->getModPath(). 'css/frontend.forms.css',
|
293 |
);
|
294 |
}
|
295 |
public function showForm($params) {
|
296 |
frameCfs::_()->getModule('templates')->loadCoreJs();
|
297 |
$id = $params['id'];
|
298 |
+
|
299 |
$id = dispatcherCfs::applyFilters('formIdBeforeShow', $id);
|
300 |
+
|
301 |
$form = $this->getModel()->getById( $id );
|
302 |
if(!empty($form)) {
|
303 |
dispatcherCfs::doAction('formBeforeShow', $form);
|
316 |
}
|
317 |
frameCfs::_()->addScript(CFS_CODE. '.modernizr', $this->getModule()->getModPath(). 'js/forms.modernizr.min.js');
|
318 |
frameCfs::_()->addScript(CFS_CODE. '.frontend.forms', $this->getModule()->getModPath(). 'js/frontend.forms.js');
|
319 |
+
|
320 |
//frameCfs::_()->addJSVar(CFS_CODE. '.frontend.forms', 'cfsForms_'. $this->_renderFormIter, $this->_prepareForFront($form));
|
321 |
//frameCfs::_()->addJSVar(CFS_CODE. '.frontend.forms', 'cfsFormsRenderFormIter', array('lastIter' => $this->_renderFormIter));
|
322 |
$this->_renderFormIter++;
|
353 |
}
|
354 |
}
|
355 |
$removeParamsKeys = array('sub_aweber_listname', 'sub_aweber_adtracking', 'sub_mailchimp_api_key', 'sub_mailchimp_lists', 'sub_ar_form_action',
|
356 |
+
'sub_sga_id', 'sub_sga_list_id', 'sub_sga_activate_code', 'sub_gr_api_key', 'sub_ac_api_url', 'sub_ac_api_key',
|
357 |
'sub_ac_lists', 'sub_mr_lists', 'sub_gr_api_key', 'sub_gr_lists', 'cycle_day', 'sub_ic_app_id', 'sub_ic_app_user', 'sub_ic_app_pass', 'sub_ic_lists',
|
358 |
'sub_ck_api_key', 'sub_mem_acc_id', 'sub_mem_pud_key', 'sub_mem_priv_key', 'test_email', 'sub_sb_api_key',
|
359 |
'sub_aw_c_key', 'sub_aw_c_secret');
|
414 |
$form = $this->getModel()->getById($form);
|
415 |
}
|
416 |
$this->_initTwig();
|
417 |
+
|
418 |
$form = dispatcherCfs::applyFilters('beforeFormRender', $form);
|
419 |
|
420 |
$form['params']['tpl']['form_start'] = $this->generateFormStart( $form );
|
421 |
$form['params']['tpl']['fields'] = $this->generateFields( $form );
|
422 |
$form['params']['tpl']['form_end'] = $this->generateFormEnd( $form );
|
423 |
+
|
424 |
$form['css'] .= $this->_generateCommonFormCss( $form );
|
425 |
+
|
426 |
$form['css'] = $this->_replaceTagsWithTwig( $form['css'], $form );
|
427 |
$form['html'] = $this->_replaceTagsWithTwig( $form['html'], $form );
|
428 |
+
|
429 |
$form['html'] .= $this->_generateImgsPreload( $form );
|
430 |
+
|
431 |
$form['css'] = dispatcherCfs::applyFilters('formCss', $form['css'], $form, $params);
|
432 |
$form['html'] = dispatcherCfs::applyFilters('formHtml', $form['html'], $form, $params);
|
433 |
+
// $replaceStyleTag can be used for compability with other plugins minify functionality:
|
434 |
+
// it will not recognize css in js data as style whye rendering on server side,
|
435 |
// but will be replaced back to normal <style> tag in JS, @see js/frontend.forms.js
|
436 |
return $this->_twig->render(
|
437 |
($replaceStyleTag ? '<span style="display: none;" id="cfsFormStylesHidden_'. $form['view_id']. '">' : '<style type="text/css" id="'. $form['view_html_id']. '_style">')
|
445 |
$res = '';
|
446 |
$res .= '#[SHELL_ID] { width: '. $form['params']['tpl']['width']. $form['params']['tpl']['width_measure']. '}';
|
447 |
if(isset($form['params'], $form['params']['tpl'], $form['params']['tpl']['form_sent_msg_color'])
|
448 |
+
&& !empty($form['params']['tpl']['form_sent_msg_color'])
|
449 |
) {
|
450 |
$res .= '#[SHELL_ID] .cfsSuccessMsg { color: '. $form['params']['tpl']['form_sent_msg_color']. ' !important}';
|
451 |
}
|
579 |
}
|
580 |
}
|
581 |
}
|
582 |
+
|
583 |
// $isRadioCheckList fields have multiple labeled selections inside - them simply does not need main label selection
|
584 |
// For all other - generate unique ID if it's required - here
|
585 |
if(strpos($fieldWrapper, '[field_id]') !== false && !$isRadioCheckList) { // Need field ID
|
624 |
}
|
625 |
|
626 |
$inputHtml = str_replace(
|
627 |
+
$replaceFrom,
|
628 |
+
$replaceTo,
|
629 |
$fieldWrapper);
|
630 |
}
|
631 |
}
|
673 |
private function _replaceTagsWithTwig($string, $form) {
|
674 |
$string = preg_replace('/\[if (.+)\]/iU', '{% if forms.params.tpl.$1 %}', $string);
|
675 |
$string = preg_replace('/\[elseif (.+)\]/iU', '{% elseif forms.params.tpl.$1 %}', $string);
|
676 |
+
|
677 |
$replaceFrom = array('SHELL_ID', 'ID', 'endif', 'else');
|
678 |
$replaceTo = array($form['view_html_id'], $form['view_id'], '{% endif %}', '{% else %}');
|
679 |
+
// Standard shortcode processor didn't worked for us here - as it is developed for posts,
|
680 |
// not for direct "do_shortcode" call, so we created own embed shortcode processor
|
681 |
if(isset($form['params']) && isset($form['params']['tpl'])) {
|
682 |
foreach($form['params']['tpl'] as $key => $val) {
|
741 |
frameCfs::_()->addScript('admin.forms', $this->getModule()->getModPath(). 'js/admin.forms.js');
|
742 |
frameCfs::_()->addScript('admin.forms.contacts.list', $this->getModule()->getModPath(). 'js/admin.forms.contacts.list.js');
|
743 |
frameCfs::_()->addJSVar('admin.forms.contacts.list', 'cfsTblDataUrl', uriCfs::mod('forms', 'getContactsListForTbl', array('reqType' => 'ajax', 'fid' => $fid)));
|
744 |
+
|
745 |
$allForms = $this->getModel()->getFromTbl();
|
746 |
$allFormsForSelect = array();
|
747 |
$formsFields = array();
|
767 |
}
|
768 |
}
|
769 |
frameCfs::_()->addJSVar('admin.forms.contacts.list', 'cfsFormFields', $formsFields);
|
770 |
+
|
771 |
$this->assign('addNewLink', frameCfs::_()->getModule('options')->getTabUrl('forms_add_new'));
|
772 |
$this->assign('allFormsForSelect', $allFormsForSelect);
|
773 |
$this->assign('fid', $fid);
|
modules/forms/views/tpl/formsEditAdminCodeOpts.php
CHANGED
@@ -13,4 +13,4 @@
|
|
13 |
<fieldset>
|
14 |
<legend><?php _e('HTML code')?></legend>
|
15 |
<?php echo htmlCfs::textarea('html', array('value' => esc_html($this->form['html']), 'attrs' => 'id="cfsFormHtmlEditor"'))?>
|
16 |
-
</fieldset>
|
13 |
<fieldset>
|
14 |
<legend><?php _e('HTML code')?></legend>
|
15 |
<?php echo htmlCfs::textarea('html', array('value' => esc_html($this->form['html']), 'attrs' => 'id="cfsFormHtmlEditor"'))?>
|
16 |
+
</fieldset>
|
modules/mail/engines/PHPMailerAutoload.php
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* PHPMailer SPL autoloader.
|
4 |
-
* PHP Version 5
|
5 |
-
* @package PHPMailer
|
6 |
-
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
7 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
8 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
9 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
10 |
-
* @author Brent R. Matzelle (original founder)
|
11 |
-
* @copyright 2012 - 2014 Marcus Bointon
|
12 |
-
* @copyright 2010 - 2012 Jim Jagielski
|
13 |
-
* @copyright 2004 - 2009 Andy Prevost
|
14 |
-
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
15 |
-
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
16 |
-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE.
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHPMailer SPL autoloader.
|
22 |
-
* @param string $classname The name of the class to load
|
23 |
-
*/
|
24 |
-
function PHPMailerAutoload($classname)
|
25 |
-
{
|
26 |
-
//Can't use __DIR__ as it's only in PHP 5.3+
|
27 |
-
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
|
28 |
-
if (is_readable($filename)) {
|
29 |
-
require $filename;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
|
34 |
-
//SPL autoloading was introduced in PHP 5.1.2
|
35 |
-
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
36 |
-
spl_autoload_register('PHPMailerAutoload', true, true);
|
37 |
-
} else {
|
38 |
-
spl_autoload_register('PHPMailerAutoload');
|
39 |
-
}
|
40 |
-
} else {
|
41 |
-
/**
|
42 |
-
* Fall back to traditional autoload for old PHP versions
|
43 |
-
* @param string $classname The name of the class to load
|
44 |
-
*/
|
45 |
-
function __autoload($classname)
|
46 |
-
{
|
47 |
-
PHPMailerAutoload($classname);
|
48 |
-
}
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mail/engines/class.phpmailer.php
DELETED
@@ -1,4039 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* PHPMailer - PHP email creation and transport class.
|
4 |
-
* PHP Version 5
|
5 |
-
* @package PHPMailer
|
6 |
-
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
7 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
8 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
9 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
10 |
-
* @author Brent R. Matzelle (original founder)
|
11 |
-
* @copyright 2012 - 2014 Marcus Bointon
|
12 |
-
* @copyright 2010 - 2012 Jim Jagielski
|
13 |
-
* @copyright 2004 - 2009 Andy Prevost
|
14 |
-
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
15 |
-
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
16 |
-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE.
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHPMailer - PHP email creation and transport class.
|
22 |
-
* @package PHPMailer
|
23 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
24 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
25 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
26 |
-
* @author Brent R. Matzelle (original founder)
|
27 |
-
*/
|
28 |
-
class PHPMailer
|
29 |
-
{
|
30 |
-
/**
|
31 |
-
* The PHPMailer Version number.
|
32 |
-
* @var string
|
33 |
-
*/
|
34 |
-
public $Version = '5.2.22';
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Email priority.
|
38 |
-
* Options: null (default), 1 = High, 3 = Normal, 5 = low.
|
39 |
-
* When null, the header is not set at all.
|
40 |
-
* @var integer
|
41 |
-
*/
|
42 |
-
public $Priority = null;
|
43 |
-
|
44 |
-
/**
|
45 |
-
* The character set of the message.
|
46 |
-
* @var string
|
47 |
-
*/
|
48 |
-
public $CharSet = 'iso-8859-1';
|
49 |
-
|
50 |
-
/**
|
51 |
-
* The MIME Content-type of the message.
|
52 |
-
* @var string
|
53 |
-
*/
|
54 |
-
public $ContentType = 'text/plain';
|
55 |
-
|
56 |
-
/**
|
57 |
-
* The message encoding.
|
58 |
-
* Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
|
59 |
-
* @var string
|
60 |
-
*/
|
61 |
-
public $Encoding = '8bit';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Holds the most recent mailer error message.
|
65 |
-
* @var string
|
66 |
-
*/
|
67 |
-
public $ErrorInfo = '';
|
68 |
-
|
69 |
-
/**
|
70 |
-
* The From email address for the message.
|
71 |
-
* @var string
|
72 |
-
*/
|
73 |
-
public $From = 'root@localhost';
|
74 |
-
|
75 |
-
/**
|
76 |
-
* The From name of the message.
|
77 |
-
* @var string
|
78 |
-
*/
|
79 |
-
public $FromName = 'Root User';
|
80 |
-
|
81 |
-
/**
|
82 |
-
* The Sender email (Return-Path) of the message.
|
83 |
-
* If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
|
84 |
-
* @var string
|
85 |
-
*/
|
86 |
-
public $Sender = '';
|
87 |
-
|
88 |
-
/**
|
89 |
-
* The Return-Path of the message.
|
90 |
-
* If empty, it will be set to either From or Sender.
|
91 |
-
* @var string
|
92 |
-
* @deprecated Email senders should never set a return-path header;
|
93 |
-
* it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
|
94 |
-
* @link https://tools.ietf.org/html/rfc5321#section-4.4 RFC5321 reference
|
95 |
-
*/
|
96 |
-
public $ReturnPath = '';
|
97 |
-
|
98 |
-
/**
|
99 |
-
* The Subject of the message.
|
100 |
-
* @var string
|
101 |
-
*/
|
102 |
-
public $Subject = '';
|
103 |
-
|
104 |
-
/**
|
105 |
-
* An HTML or plain text message body.
|
106 |
-
* If HTML then call isHTML(true).
|
107 |
-
* @var string
|
108 |
-
*/
|
109 |
-
public $Body = '';
|
110 |
-
|
111 |
-
/**
|
112 |
-
* The plain-text message body.
|
113 |
-
* This body can be read by mail clients that do not have HTML email
|
114 |
-
* capability such as mutt & Eudora.
|
115 |
-
* Clients that can read HTML will view the normal Body.
|
116 |
-
* @var string
|
117 |
-
*/
|
118 |
-
public $AltBody = '';
|
119 |
-
|
120 |
-
/**
|
121 |
-
* An iCal message part body.
|
122 |
-
* Only supported in simple alt or alt_inline message types
|
123 |
-
* To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
|
124 |
-
* @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
|
125 |
-
* @link http://kigkonsult.se/iCalcreator/
|
126 |
-
* @var string
|
127 |
-
*/
|
128 |
-
public $Ical = '';
|
129 |
-
|
130 |
-
/**
|
131 |
-
* The complete compiled MIME message body.
|
132 |
-
* @access protected
|
133 |
-
* @var string
|
134 |
-
*/
|
135 |
-
protected $MIMEBody = '';
|
136 |
-
|
137 |
-
/**
|
138 |
-
* The complete compiled MIME message headers.
|
139 |
-
* @var string
|
140 |
-
* @access protected
|
141 |
-
*/
|
142 |
-
protected $MIMEHeader = '';
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Extra headers that createHeader() doesn't fold in.
|
146 |
-
* @var string
|
147 |
-
* @access protected
|
148 |
-
*/
|
149 |
-
protected $mailHeader = '';
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Word-wrap the message body to this number of chars.
|
153 |
-
* Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
|
154 |
-
* @var integer
|
155 |
-
*/
|
156 |
-
public $WordWrap = 0;
|
157 |
-
|
158 |
-
/**
|
159 |
-
* Which method to use to send mail.
|
160 |
-
* Options: "mail", "sendmail", or "smtp".
|
161 |
-
* @var string
|
162 |
-
*/
|
163 |
-
public $Mailer = 'mail';
|
164 |
-
|
165 |
-
/**
|
166 |
-
* The path to the sendmail program.
|
167 |
-
* @var string
|
168 |
-
*/
|
169 |
-
public $Sendmail = '/usr/sbin/sendmail';
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Whether mail() uses a fully sendmail-compatible MTA.
|
173 |
-
* One which supports sendmail's "-oi -f" options.
|
174 |
-
* @var boolean
|
175 |
-
*/
|
176 |
-
public $UseSendmailOptions = true;
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Path to PHPMailer plugins.
|
180 |
-
* Useful if the SMTP class is not in the PHP include path.
|
181 |
-
* @var string
|
182 |
-
* @deprecated Should not be needed now there is an autoloader.
|
183 |
-
*/
|
184 |
-
public $PluginDir = '';
|
185 |
-
|
186 |
-
/**
|
187 |
-
* The email address that a reading confirmation should be sent to, also known as read receipt.
|
188 |
-
* @var string
|
189 |
-
*/
|
190 |
-
public $ConfirmReadingTo = '';
|
191 |
-
|
192 |
-
/**
|
193 |
-
* The hostname to use in the Message-ID header and as default HELO string.
|
194 |
-
* If empty, PHPMailer attempts to find one with, in order,
|
195 |
-
* $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value
|
196 |
-
* 'localhost.localdomain'.
|
197 |
-
* @var string
|
198 |
-
*/
|
199 |
-
public $Hostname = '';
|
200 |
-
|
201 |
-
/**
|
202 |
-
* An ID to be used in the Message-ID header.
|
203 |
-
* If empty, a unique id will be generated.
|
204 |
-
* You can set your own, but it must be in the format "<id@domain>",
|
205 |
-
* as defined in RFC5322 section 3.6.4 or it will be ignored.
|
206 |
-
* @see https://tools.ietf.org/html/rfc5322#section-3.6.4
|
207 |
-
* @var string
|
208 |
-
*/
|
209 |
-
public $MessageID = '';
|
210 |
-
|
211 |
-
/**
|
212 |
-
* The message Date to be used in the Date header.
|
213 |
-
* If empty, the current date will be added.
|
214 |
-
* @var string
|
215 |
-
*/
|
216 |
-
public $MessageDate = '';
|
217 |
-
|
218 |
-
/**
|
219 |
-
* SMTP hosts.
|
220 |
-
* Either a single hostname or multiple semicolon-delimited hostnames.
|
221 |
-
* You can also specify a different port
|
222 |
-
* for each host by using this format: [hostname:port]
|
223 |
-
* (e.g. "smtp1.example.com:25;smtp2.example.com").
|
224 |
-
* You can also specify encryption type, for example:
|
225 |
-
* (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465").
|
226 |
-
* Hosts will be tried in order.
|
227 |
-
* @var string
|
228 |
-
*/
|
229 |
-
public $Host = 'localhost';
|
230 |
-
|
231 |
-
/**
|
232 |
-
* The default SMTP server port.
|
233 |
-
* @var integer
|
234 |
-
* @TODO Why is this needed when the SMTP class takes care of it?
|
235 |
-
*/
|
236 |
-
public $Port = 25;
|
237 |
-
|
238 |
-
/**
|
239 |
-
* The SMTP HELO of the message.
|
240 |
-
* Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find
|
241 |
-
* one with the same method described above for $Hostname.
|
242 |
-
* @var string
|
243 |
-
* @see PHPMailer::$Hostname
|
244 |
-
*/
|
245 |
-
public $Helo = '';
|
246 |
-
|
247 |
-
/**
|
248 |
-
* What kind of encryption to use on the SMTP connection.
|
249 |
-
* Options: '', 'ssl' or 'tls'
|
250 |
-
* @var string
|
251 |
-
*/
|
252 |
-
public $SMTPSecure = '';
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Whether to enable TLS encryption automatically if a server supports it,
|
256 |
-
* even if `SMTPSecure` is not set to 'tls'.
|
257 |
-
* Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
|
258 |
-
* @var boolean
|
259 |
-
*/
|
260 |
-
public $SMTPAutoTLS = true;
|
261 |
-
|
262 |
-
/**
|
263 |
-
* Whether to use SMTP authentication.
|
264 |
-
* Uses the Username and Password properties.
|
265 |
-
* @var boolean
|
266 |
-
* @see PHPMailer::$Username
|
267 |
-
* @see PHPMailer::$Password
|
268 |
-
*/
|
269 |
-
public $SMTPAuth = false;
|
270 |
-
|
271 |
-
/**
|
272 |
-
* Options array passed to stream_context_create when connecting via SMTP.
|
273 |
-
* @var array
|
274 |
-
*/
|
275 |
-
public $SMTPOptions = array();
|
276 |
-
|
277 |
-
/**
|
278 |
-
* SMTP username.
|
279 |
-
* @var string
|
280 |
-
*/
|
281 |
-
public $Username = '';
|
282 |
-
|
283 |
-
/**
|
284 |
-
* SMTP password.
|
285 |
-
* @var string
|
286 |
-
*/
|
287 |
-
public $Password = '';
|
288 |
-
|
289 |
-
/**
|
290 |
-
* SMTP auth type.
|
291 |
-
* Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified
|
292 |
-
* @var string
|
293 |
-
*/
|
294 |
-
public $AuthType = '';
|
295 |
-
|
296 |
-
/**
|
297 |
-
* SMTP realm.
|
298 |
-
* Used for NTLM auth
|
299 |
-
* @var string
|
300 |
-
*/
|
301 |
-
public $Realm = '';
|
302 |
-
|
303 |
-
/**
|
304 |
-
* SMTP workstation.
|
305 |
-
* Used for NTLM auth
|
306 |
-
* @var string
|
307 |
-
*/
|
308 |
-
public $Workstation = '';
|
309 |
-
|
310 |
-
/**
|
311 |
-
* The SMTP server timeout in seconds.
|
312 |
-
* Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
|
313 |
-
* @var integer
|
314 |
-
*/
|
315 |
-
public $Timeout = 300;
|
316 |
-
|
317 |
-
/**
|
318 |
-
* SMTP class debug output mode.
|
319 |
-
* Debug output level.
|
320 |
-
* Options:
|
321 |
-
* * `0` No output
|
322 |
-
* * `1` Commands
|
323 |
-
* * `2` Data and commands
|
324 |
-
* * `3` As 2 plus connection status
|
325 |
-
* * `4` Low-level data output
|
326 |
-
* @var integer
|
327 |
-
* @see SMTP::$do_debug
|
328 |
-
*/
|
329 |
-
public $SMTPDebug = 0;
|
330 |
-
|
331 |
-
/**
|
332 |
-
* How to handle debug output.
|
333 |
-
* Options:
|
334 |
-
* * `echo` Output plain-text as-is, appropriate for CLI
|
335 |
-
* * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
|
336 |
-
* * `error_log` Output to error log as configured in php.ini
|
337 |
-
*
|
338 |
-
* Alternatively, you can provide a callable expecting two params: a message string and the debug level:
|
339 |
-
* <code>
|
340 |
-
* $mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
|
341 |
-
* </code>
|
342 |
-
* @var string|callable
|
343 |
-
* @see SMTP::$Debugoutput
|
344 |
-
*/
|
345 |
-
public $Debugoutput = 'echo';
|
346 |
-
|
347 |
-
/**
|
348 |
-
* Whether to keep SMTP connection open after each message.
|
349 |
-
* If this is set to true then to close the connection
|
350 |
-
* requires an explicit call to smtpClose().
|
351 |
-
* @var boolean
|
352 |
-
*/
|
353 |
-
public $SMTPKeepAlive = false;
|
354 |
-
|
355 |
-
/**
|
356 |
-
* Whether to split multiple to addresses into multiple messages
|
357 |
-
* or send them all in one message.
|
358 |
-
* Only supported in `mail` and `sendmail` transports, not in SMTP.
|
359 |
-
* @var boolean
|
360 |
-
*/
|
361 |
-
public $SingleTo = false;
|
362 |
-
|
363 |
-
/**
|
364 |
-
* Storage for addresses when SingleTo is enabled.
|
365 |
-
* @var array
|
366 |
-
* @TODO This should really not be public
|
367 |
-
*/
|
368 |
-
public $SingleToArray = array();
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Whether to generate VERP addresses on send.
|
372 |
-
* Only applicable when sending via SMTP.
|
373 |
-
* @link https://en.wikipedia.org/wiki/Variable_envelope_return_path
|
374 |
-
* @link http://www.postfix.org/VERP_README.html Postfix VERP info
|
375 |
-
* @var boolean
|
376 |
-
*/
|
377 |
-
public $do_verp = false;
|
378 |
-
|
379 |
-
/**
|
380 |
-
* Whether to allow sending messages with an empty body.
|
381 |
-
* @var boolean
|
382 |
-
*/
|
383 |
-
public $AllowEmpty = false;
|
384 |
-
|
385 |
-
/**
|
386 |
-
* The default line ending.
|
387 |
-
* @note The default remains "\n". We force CRLF where we know
|
388 |
-
* it must be used via self::CRLF.
|
389 |
-
* @var string
|
390 |
-
*/
|
391 |
-
public $LE = "\n";
|
392 |
-
|
393 |
-
/**
|
394 |
-
* DKIM selector.
|
395 |
-
* @var string
|
396 |
-
*/
|
397 |
-
public $DKIM_selector = '';
|
398 |
-
|
399 |
-
/**
|
400 |
-
* DKIM Identity.
|
401 |
-
* Usually the email address used as the source of the email.
|
402 |
-
* @var string
|
403 |
-
*/
|
404 |
-
public $DKIM_identity = '';
|
405 |
-
|
406 |
-
/**
|
407 |
-
* DKIM passphrase.
|
408 |
-
* Used if your key is encrypted.
|
409 |
-
* @var string
|
410 |
-
*/
|
411 |
-
public $DKIM_passphrase = '';
|
412 |
-
|
413 |
-
/**
|
414 |
-
* DKIM signing domain name.
|
415 |
-
* @example 'example.com'
|
416 |
-
* @var string
|
417 |
-
*/
|
418 |
-
public $DKIM_domain = '';
|
419 |
-
|
420 |
-
/**
|
421 |
-
* DKIM private key file path.
|
422 |
-
* @var string
|
423 |
-
*/
|
424 |
-
public $DKIM_private = '';
|
425 |
-
|
426 |
-
/**
|
427 |
-
* DKIM private key string.
|
428 |
-
* If set, takes precedence over `$DKIM_private`.
|
429 |
-
* @var string
|
430 |
-
*/
|
431 |
-
public $DKIM_private_string = '';
|
432 |
-
|
433 |
-
/**
|
434 |
-
* Callback Action function name.
|
435 |
-
*
|
436 |
-
* The function that handles the result of the send email action.
|
437 |
-
* It is called out by send() for each email sent.
|
438 |
-
*
|
439 |
-
* Value can be any php callable: http://www.php.net/is_callable
|
440 |
-
*
|
441 |
-
* Parameters:
|
442 |
-
* boolean $result result of the send action
|
443 |
-
* string $to email address of the recipient
|
444 |
-
* string $cc cc email addresses
|
445 |
-
* string $bcc bcc email addresses
|
446 |
-
* string $subject the subject
|
447 |
-
* string $body the email body
|
448 |
-
* string $from email address of sender
|
449 |
-
* @var string
|
450 |
-
*/
|
451 |
-
public $action_function = '';
|
452 |
-
|
453 |
-
/**
|
454 |
-
* What to put in the X-Mailer header.
|
455 |
-
* Options: An empty string for PHPMailer default, whitespace for none, or a string to use
|
456 |
-
* @var string
|
457 |
-
*/
|
458 |
-
public $XMailer = '';
|
459 |
-
|
460 |
-
/**
|
461 |
-
* Which validator to use by default when validating email addresses.
|
462 |
-
* May be a callable to inject your own validator, but there are several built-in validators.
|
463 |
-
* @see PHPMailer::validateAddress()
|
464 |
-
* @var string|callable
|
465 |
-
* @static
|
466 |
-
*/
|
467 |
-
public static $validator = 'auto';
|
468 |
-
|
469 |
-
/**
|
470 |
-
* An instance of the SMTP sender class.
|
471 |
-
* @var SMTP
|
472 |
-
* @access protected
|
473 |
-
*/
|
474 |
-
protected $smtp = null;
|
475 |
-
|
476 |
-
/**
|
477 |
-
* The array of 'to' names and addresses.
|
478 |
-
* @var array
|
479 |
-
* @access protected
|
480 |
-
*/
|
481 |
-
protected $to = array();
|
482 |
-
|
483 |
-
/**
|
484 |
-
* The array of 'cc' names and addresses.
|
485 |
-
* @var array
|
486 |
-
* @access protected
|
487 |
-
*/
|
488 |
-
protected $cc = array();
|
489 |
-
|
490 |
-
/**
|
491 |
-
* The array of 'bcc' names and addresses.
|
492 |
-
* @var array
|
493 |
-
* @access protected
|
494 |
-
*/
|
495 |
-
protected $bcc = array();
|
496 |
-
|
497 |
-
/**
|
498 |
-
* The array of reply-to names and addresses.
|
499 |
-
* @var array
|
500 |
-
* @access protected
|
501 |
-
*/
|
502 |
-
protected $ReplyTo = array();
|
503 |
-
|
504 |
-
/**
|
505 |
-
* An array of all kinds of addresses.
|
506 |
-
* Includes all of $to, $cc, $bcc
|
507 |
-
* @var array
|
508 |
-
* @access protected
|
509 |
-
* @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
|
510 |
-
*/
|
511 |
-
protected $all_recipients = array();
|
512 |
-
|
513 |
-
/**
|
514 |
-
* An array of names and addresses queued for validation.
|
515 |
-
* In send(), valid and non duplicate entries are moved to $all_recipients
|
516 |
-
* and one of $to, $cc, or $bcc.
|
517 |
-
* This array is used only for addresses with IDN.
|
518 |
-
* @var array
|
519 |
-
* @access protected
|
520 |
-
* @see PHPMailer::$to @see PHPMailer::$cc @see PHPMailer::$bcc
|
521 |
-
* @see PHPMailer::$all_recipients
|
522 |
-
*/
|
523 |
-
protected $RecipientsQueue = array();
|
524 |
-
|
525 |
-
/**
|
526 |
-
* An array of reply-to names and addresses queued for validation.
|
527 |
-
* In send(), valid and non duplicate entries are moved to $ReplyTo.
|
528 |
-
* This array is used only for addresses with IDN.
|
529 |
-
* @var array
|
530 |
-
* @access protected
|
531 |
-
* @see PHPMailer::$ReplyTo
|
532 |
-
*/
|
533 |
-
protected $ReplyToQueue = array();
|
534 |
-
|
535 |
-
/**
|
536 |
-
* The array of attachments.
|
537 |
-
* @var array
|
538 |
-
* @access protected
|
539 |
-
*/
|
540 |
-
protected $attachment = array();
|
541 |
-
|
542 |
-
/**
|
543 |
-
* The array of custom headers.
|
544 |
-
* @var array
|
545 |
-
* @access protected
|
546 |
-
*/
|
547 |
-
protected $CustomHeader = array();
|
548 |
-
|
549 |
-
/**
|
550 |
-
* The most recent Message-ID (including angular brackets).
|
551 |
-
* @var string
|
552 |
-
* @access protected
|
553 |
-
*/
|
554 |
-
protected $lastMessageID = '';
|
555 |
-
|
556 |
-
/**
|
557 |
-
* The message's MIME type.
|
558 |
-
* @var string
|
559 |
-
* @access protected
|
560 |
-
*/
|
561 |
-
protected $message_type = '';
|
562 |
-
|
563 |
-
/**
|
564 |
-
* The array of MIME boundary strings.
|
565 |
-
* @var array
|
566 |
-
* @access protected
|
567 |
-
*/
|
568 |
-
protected $boundary = array();
|
569 |
-
|
570 |
-
/**
|
571 |
-
* The array of available languages.
|
572 |
-
* @var array
|
573 |
-
* @access protected
|
574 |
-
*/
|
575 |
-
protected $language = array();
|
576 |
-
|
577 |
-
/**
|
578 |
-
* The number of errors encountered.
|
579 |
-
* @var integer
|
580 |
-
* @access protected
|
581 |
-
*/
|
582 |
-
protected $error_count = 0;
|
583 |
-
|
584 |
-
/**
|
585 |
-
* The S/MIME certificate file path.
|
586 |
-
* @var string
|
587 |
-
* @access protected
|
588 |
-
*/
|
589 |
-
protected $sign_cert_file = '';
|
590 |
-
|
591 |
-
/**
|
592 |
-
* The S/MIME key file path.
|
593 |
-
* @var string
|
594 |
-
* @access protected
|
595 |
-
*/
|
596 |
-
protected $sign_key_file = '';
|
597 |
-
|
598 |
-
/**
|
599 |
-
* The optional S/MIME extra certificates ("CA Chain") file path.
|
600 |
-
* @var string
|
601 |
-
* @access protected
|
602 |
-
*/
|
603 |
-
protected $sign_extracerts_file = '';
|
604 |
-
|
605 |
-
/**
|
606 |
-
* The S/MIME password for the key.
|
607 |
-
* Used only if the key is encrypted.
|
608 |
-
* @var string
|
609 |
-
* @access protected
|
610 |
-
*/
|
611 |
-
protected $sign_key_pass = '';
|
612 |
-
|
613 |
-
/**
|
614 |
-
* Whether to throw exceptions for errors.
|
615 |
-
* @var boolean
|
616 |
-
* @access protected
|
617 |
-
*/
|
618 |
-
protected $exceptions = false;
|
619 |
-
|
620 |
-
/**
|
621 |
-
* Unique ID used for message ID and boundaries.
|
622 |
-
* @var string
|
623 |
-
* @access protected
|
624 |
-
*/
|
625 |
-
protected $uniqueid = '';
|
626 |
-
|
627 |
-
/**
|
628 |
-
* Error severity: message only, continue processing.
|
629 |
-
*/
|
630 |
-
const STOP_MESSAGE = 0;
|
631 |
-
|
632 |
-
/**
|
633 |
-
* Error severity: message, likely ok to continue processing.
|
634 |
-
*/
|
635 |
-
const STOP_CONTINUE = 1;
|
636 |
-
|
637 |
-
/**
|
638 |
-
* Error severity: message, plus full stop, critical error reached.
|
639 |
-
*/
|
640 |
-
const STOP_CRITICAL = 2;
|
641 |
-
|
642 |
-
/**
|
643 |
-
* SMTP RFC standard line ending.
|
644 |
-
*/
|
645 |
-
const CRLF = "\r\n";
|
646 |
-
|
647 |
-
/**
|
648 |
-
* The maximum line length allowed by RFC 2822 section 2.1.1
|
649 |
-
* @var integer
|
650 |
-
*/
|
651 |
-
const MAX_LINE_LENGTH = 998;
|
652 |
-
|
653 |
-
/**
|
654 |
-
* Constructor.
|
655 |
-
* @param boolean $exceptions Should we throw external exceptions?
|
656 |
-
*/
|
657 |
-
public function __construct($exceptions = null)
|
658 |
-
{
|
659 |
-
if ($exceptions !== null) {
|
660 |
-
$this->exceptions = (boolean)$exceptions;
|
661 |
-
}
|
662 |
-
}
|
663 |
-
|
664 |
-
/**
|
665 |
-
* Destructor.
|
666 |
-
*/
|
667 |
-
public function __destruct()
|
668 |
-
{
|
669 |
-
//Close any open SMTP connection nicely
|
670 |
-
$this->smtpClose();
|
671 |
-
}
|
672 |
-
|
673 |
-
/**
|
674 |
-
* Call mail() in a safe_mode-aware fashion.
|
675 |
-
* Also, unless sendmail_path points to sendmail (or something that
|
676 |
-
* claims to be sendmail), don't pass params (not a perfect fix,
|
677 |
-
* but it will do)
|
678 |
-
* @param string $to To
|
679 |
-
* @param string $subject Subject
|
680 |
-
* @param string $body Message Body
|
681 |
-
* @param string $header Additional Header(s)
|
682 |
-
* @param string $params Params
|
683 |
-
* @access private
|
684 |
-
* @return boolean
|
685 |
-
*/
|
686 |
-
private function mailPassthru($to, $subject, $body, $header, $params)
|
687 |
-
{
|
688 |
-
//Check overloading of mail function to avoid double-encoding
|
689 |
-
if (ini_get('mbstring.func_overload') & 1) {
|
690 |
-
$subject = $this->secureHeader($subject);
|
691 |
-
} else {
|
692 |
-
$subject = $this->encodeHeader($this->secureHeader($subject));
|
693 |
-
}
|
694 |
-
|
695 |
-
//Can't use additional_parameters in safe_mode, calling mail() with null params breaks
|
696 |
-
//@link http://php.net/manual/en/function.mail.php
|
697 |
-
if (ini_get('safe_mode') or !$this->UseSendmailOptions or is_null($params)) {
|
698 |
-
$result = @mail($to, $subject, $body, $header);
|
699 |
-
} else {
|
700 |
-
$result = @mail($to, $subject, $body, $header, $params);
|
701 |
-
}
|
702 |
-
return $result;
|
703 |
-
}
|
704 |
-
/**
|
705 |
-
* Output debugging info via user-defined method.
|
706 |
-
* Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
|
707 |
-
* @see PHPMailer::$Debugoutput
|
708 |
-
* @see PHPMailer::$SMTPDebug
|
709 |
-
* @param string $str
|
710 |
-
*/
|
711 |
-
protected function edebug($str)
|
712 |
-
{
|
713 |
-
if ($this->SMTPDebug <= 0) {
|
714 |
-
return;
|
715 |
-
}
|
716 |
-
//Avoid clash with built-in function names
|
717 |
-
if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
|
718 |
-
call_user_func($this->Debugoutput, $str, $this->SMTPDebug);
|
719 |
-
return;
|
720 |
-
}
|
721 |
-
switch ($this->Debugoutput) {
|
722 |
-
case 'error_log':
|
723 |
-
//Don't output, just log
|
724 |
-
error_log($str);
|
725 |
-
break;
|
726 |
-
case 'html':
|
727 |
-
//Cleans up output a bit for a better looking, HTML-safe output
|
728 |
-
echo htmlentities(
|
729 |
-
preg_replace('/[\r\n]+/', '', $str),
|
730 |
-
ENT_QUOTES,
|
731 |
-
'UTF-8'
|
732 |
-
)
|
733 |
-
. "<br>\n";
|
734 |
-
break;
|
735 |
-
case 'echo':
|
736 |
-
default:
|
737 |
-
//Normalize line breaks
|
738 |
-
$str = preg_replace('/\r\n?/ms', "\n", $str);
|
739 |
-
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
|
740 |
-
"\n",
|
741 |
-
"\n \t ",
|
742 |
-
trim($str)
|
743 |
-
) . "\n";
|
744 |
-
}
|
745 |
-
}
|
746 |
-
|
747 |
-
/**
|
748 |
-
* Sets message type to HTML or plain.
|
749 |
-
* @param boolean $isHtml True for HTML mode.
|
750 |
-
* @return void
|
751 |
-
*/
|
752 |
-
public function isHTML($isHtml = true)
|
753 |
-
{
|
754 |
-
if ($isHtml) {
|
755 |
-
$this->ContentType = 'text/html';
|
756 |
-
} else {
|
757 |
-
$this->ContentType = 'text/plain';
|
758 |
-
}
|
759 |
-
}
|
760 |
-
|
761 |
-
/**
|
762 |
-
* Send messages using SMTP.
|
763 |
-
* @return void
|
764 |
-
*/
|
765 |
-
public function isSMTP()
|
766 |
-
{
|
767 |
-
$this->Mailer = 'smtp';
|
768 |
-
}
|
769 |
-
|
770 |
-
/**
|
771 |
-
* Send messages using PHP's mail() function.
|
772 |
-
* @return void
|
773 |
-
*/
|
774 |
-
public function isMail()
|
775 |
-
{
|
776 |
-
$this->Mailer = 'mail';
|
777 |
-
}
|
778 |
-
|
779 |
-
/**
|
780 |
-
* Send messages using $Sendmail.
|
781 |
-
* @return void
|
782 |
-
*/
|
783 |
-
public function isSendmail()
|
784 |
-
{
|
785 |
-
$ini_sendmail_path = ini_get('sendmail_path');
|
786 |
-
|
787 |
-
if (!stristr($ini_sendmail_path, 'sendmail')) {
|
788 |
-
$this->Sendmail = '/usr/sbin/sendmail';
|
789 |
-
} else {
|
790 |
-
$this->Sendmail = $ini_sendmail_path;
|
791 |
-
}
|
792 |
-
$this->Mailer = 'sendmail';
|
793 |
-
}
|
794 |
-
|
795 |
-
/**
|
796 |
-
* Send messages using qmail.
|
797 |
-
* @return void
|
798 |
-
*/
|
799 |
-
public function isQmail()
|
800 |
-
{
|
801 |
-
$ini_sendmail_path = ini_get('sendmail_path');
|
802 |
-
|
803 |
-
if (!stristr($ini_sendmail_path, 'qmail')) {
|
804 |
-
$this->Sendmail = '/var/qmail/bin/qmail-inject';
|
805 |
-
} else {
|
806 |
-
$this->Sendmail = $ini_sendmail_path;
|
807 |
-
}
|
808 |
-
$this->Mailer = 'qmail';
|
809 |
-
}
|
810 |
-
|
811 |
-
/**
|
812 |
-
* Add a "To" address.
|
813 |
-
* @param string $address The email address to send to
|
814 |
-
* @param string $name
|
815 |
-
* @return boolean true on success, false if address already used or invalid in some way
|
816 |
-
*/
|
817 |
-
public function addAddress($address, $name = '')
|
818 |
-
{
|
819 |
-
return $this->addOrEnqueueAnAddress('to', $address, $name);
|
820 |
-
}
|
821 |
-
|
822 |
-
/**
|
823 |
-
* Add a "CC" address.
|
824 |
-
* @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
|
825 |
-
* @param string $address The email address to send to
|
826 |
-
* @param string $name
|
827 |
-
* @return boolean true on success, false if address already used or invalid in some way
|
828 |
-
*/
|
829 |
-
public function addCC($address, $name = '')
|
830 |
-
{
|
831 |
-
return $this->addOrEnqueueAnAddress('cc', $address, $name);
|
832 |
-
}
|
833 |
-
|
834 |
-
/**
|
835 |
-
* Add a "BCC" address.
|
836 |
-
* @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
|
837 |
-
* @param string $address The email address to send to
|
838 |
-
* @param string $name
|
839 |
-
* @return boolean true on success, false if address already used or invalid in some way
|
840 |
-
*/
|
841 |
-
public function addBCC($address, $name = '')
|
842 |
-
{
|
843 |
-
return $this->addOrEnqueueAnAddress('bcc', $address, $name);
|
844 |
-
}
|
845 |
-
|
846 |
-
/**
|
847 |
-
* Add a "Reply-To" address.
|
848 |
-
* @param string $address The email address to reply to
|
849 |
-
* @param string $name
|
850 |
-
* @return boolean true on success, false if address already used or invalid in some way
|
851 |
-
*/
|
852 |
-
public function addReplyTo($address, $name = '')
|
853 |
-
{
|
854 |
-
return $this->addOrEnqueueAnAddress('Reply-To', $address, $name);
|
855 |
-
}
|
856 |
-
|
857 |
-
/**
|
858 |
-
* Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer
|
859 |
-
* can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still
|
860 |
-
* be modified after calling this function), addition of such addresses is delayed until send().
|
861 |
-
* Addresses that have been added already return false, but do not throw exceptions.
|
862 |
-
* @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
|
863 |
-
* @param string $address The email address to send, resp. to reply to
|
864 |
-
* @param string $name
|
865 |
-
* @throws phpmailerException
|
866 |
-
* @return boolean true on success, false if address already used or invalid in some way
|
867 |
-
* @access protected
|
868 |
-
*/
|
869 |
-
protected function addOrEnqueueAnAddress($kind, $address, $name)
|
870 |
-
{
|
871 |
-
$address = trim($address);
|
872 |
-
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
|
873 |
-
if (($pos = strrpos($address, '@')) === false) {
|
874 |
-
// At-sign is misssing.
|
875 |
-
$error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
|
876 |
-
$this->setError($error_message);
|
877 |
-
$this->edebug($error_message);
|
878 |
-
if ($this->exceptions) {
|
879 |
-
throw new phpmailerException($error_message);
|
880 |
-
}
|
881 |
-
return false;
|
882 |
-
}
|
883 |
-
$params = array($kind, $address, $name);
|
884 |
-
// Enqueue addresses with IDN until we know the PHPMailer::$CharSet.
|
885 |
-
if ($this->has8bitChars(substr($address, ++$pos)) and $this->idnSupported()) {
|
886 |
-
if ($kind != 'Reply-To') {
|
887 |
-
if (!array_key_exists($address, $this->RecipientsQueue)) {
|
888 |
-
$this->RecipientsQueue[$address] = $params;
|
889 |
-
return true;
|
890 |
-
}
|
891 |
-
} else {
|
892 |
-
if (!array_key_exists($address, $this->ReplyToQueue)) {
|
893 |
-
$this->ReplyToQueue[$address] = $params;
|
894 |
-
return true;
|
895 |
-
}
|
896 |
-
}
|
897 |
-
return false;
|
898 |
-
}
|
899 |
-
// Immediately add standard addresses without IDN.
|
900 |
-
return call_user_func_array(array($this, 'addAnAddress'), $params);
|
901 |
-
}
|
902 |
-
|
903 |
-
/**
|
904 |
-
* Add an address to one of the recipient arrays or to the ReplyTo array.
|
905 |
-
* Addresses that have been added already return false, but do not throw exceptions.
|
906 |
-
* @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo'
|
907 |
-
* @param string $address The email address to send, resp. to reply to
|
908 |
-
* @param string $name
|
909 |
-
* @throws phpmailerException
|
910 |
-
* @return boolean true on success, false if address already used or invalid in some way
|
911 |
-
* @access protected
|
912 |
-
*/
|
913 |
-
protected function addAnAddress($kind, $address, $name = '')
|
914 |
-
{
|
915 |
-
if (!in_array($kind, array('to', 'cc', 'bcc', 'Reply-To'))) {
|
916 |
-
$error_message = $this->lang('Invalid recipient kind: ') . $kind;
|
917 |
-
$this->setError($error_message);
|
918 |
-
$this->edebug($error_message);
|
919 |
-
if ($this->exceptions) {
|
920 |
-
throw new phpmailerException($error_message);
|
921 |
-
}
|
922 |
-
return false;
|
923 |
-
}
|
924 |
-
if (!$this->validateAddress($address)) {
|
925 |
-
$error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address";
|
926 |
-
$this->setError($error_message);
|
927 |
-
$this->edebug($error_message);
|
928 |
-
if ($this->exceptions) {
|
929 |
-
throw new phpmailerException($error_message);
|
930 |
-
}
|
931 |
-
return false;
|
932 |
-
}
|
933 |
-
if ($kind != 'Reply-To') {
|
934 |
-
if (!array_key_exists(strtolower($address), $this->all_recipients)) {
|
935 |
-
array_push($this->$kind, array($address, $name));
|
936 |
-
$this->all_recipients[strtolower($address)] = true;
|
937 |
-
return true;
|
938 |
-
}
|
939 |
-
} else {
|
940 |
-
if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
|
941 |
-
$this->ReplyTo[strtolower($address)] = array($address, $name);
|
942 |
-
return true;
|
943 |
-
}
|
944 |
-
}
|
945 |
-
return false;
|
946 |
-
}
|
947 |
-
|
948 |
-
/**
|
949 |
-
* Parse and validate a string containing one or more RFC822-style comma-separated email addresses
|
950 |
-
* of the form "display name <address>" into an array of name/address pairs.
|
951 |
-
* Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available.
|
952 |
-
* Note that quotes in the name part are removed.
|
953 |
-
* @param string $addrstr The address list string
|
954 |
-
* @param bool $useimap Whether to use the IMAP extension to parse the list
|
955 |
-
* @return array
|
956 |
-
* @link http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
|
957 |
-
*/
|
958 |
-
public function parseAddresses($addrstr, $useimap = true)
|
959 |
-
{
|
960 |
-
$addresses = array();
|
961 |
-
if ($useimap and function_exists('imap_rfc822_parse_adrlist')) {
|
962 |
-
//Use this built-in parser if it's available
|
963 |
-
$list = imap_rfc822_parse_adrlist($addrstr, '');
|
964 |
-
foreach ($list as $address) {
|
965 |
-
if ($address->host != '.SYNTAX-ERROR.') {
|
966 |
-
if ($this->validateAddress($address->mailbox . '@' . $address->host)) {
|
967 |
-
$addresses[] = array(
|
968 |
-
'name' => (property_exists($address, 'personal') ? $address->personal : ''),
|
969 |
-
'address' => $address->mailbox . '@' . $address->host
|
970 |
-
);
|
971 |
-
}
|
972 |
-
}
|
973 |
-
}
|
974 |
-
} else {
|
975 |
-
//Use this simpler parser
|
976 |
-
$list = explode(',', $addrstr);
|
977 |
-
foreach ($list as $address) {
|
978 |
-
$address = trim($address);
|
979 |
-
//Is there a separate name part?
|
980 |
-
if (strpos($address, '<') === false) {
|
981 |
-
//No separate name, just use the whole thing
|
982 |
-
if ($this->validateAddress($address)) {
|
983 |
-
$addresses[] = array(
|
984 |
-
'name' => '',
|
985 |
-
'address' => $address
|
986 |
-
);
|
987 |
-
}
|
988 |
-
} else {
|
989 |
-
list($name, $email) = explode('<', $address);
|
990 |
-
$email = trim(str_replace('>', '', $email));
|
991 |
-
if ($this->validateAddress($email)) {
|
992 |
-
$addresses[] = array(
|
993 |
-
'name' => trim(str_replace(array('"', "'"), '', $name)),
|
994 |
-
'address' => $email
|
995 |
-
);
|
996 |
-
}
|
997 |
-
}
|
998 |
-
}
|
999 |
-
}
|
1000 |
-
return $addresses;
|
1001 |
-
}
|
1002 |
-
|
1003 |
-
/**
|
1004 |
-
* Set the From and FromName properties.
|
1005 |
-
* @param string $address
|
1006 |
-
* @param string $name
|
1007 |
-
* @param boolean $auto Whether to also set the Sender address, defaults to true
|
1008 |
-
* @throws phpmailerException
|
1009 |
-
* @return boolean
|
1010 |
-
*/
|
1011 |
-
public function setFrom($address, $name = '', $auto = true)
|
1012 |
-
{
|
1013 |
-
$address = trim($address);
|
1014 |
-
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
|
1015 |
-
// Don't validate now addresses with IDN. Will be done in send().
|
1016 |
-
if (($pos = strrpos($address, '@')) === false or
|
1017 |
-
(!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and
|
1018 |
-
!$this->validateAddress($address)) {
|
1019 |
-
$error_message = $this->lang('invalid_address') . " (setFrom) $address";
|
1020 |
-
$this->setError($error_message);
|
1021 |
-
$this->edebug($error_message);
|
1022 |
-
if ($this->exceptions) {
|
1023 |
-
throw new phpmailerException($error_message);
|
1024 |
-
}
|
1025 |
-
return false;
|
1026 |
-
}
|
1027 |
-
$this->From = $address;
|
1028 |
-
$this->FromName = $name;
|
1029 |
-
if ($auto) {
|
1030 |
-
if (empty($this->Sender)) {
|
1031 |
-
$this->Sender = $address;
|
1032 |
-
}
|
1033 |
-
}
|
1034 |
-
return true;
|
1035 |
-
}
|
1036 |
-
|
1037 |
-
/**
|
1038 |
-
* Return the Message-ID header of the last email.
|
1039 |
-
* Technically this is the value from the last time the headers were created,
|
1040 |
-
* but it's also the message ID of the last sent message except in
|
1041 |
-
* pathological cases.
|
1042 |
-
* @return string
|
1043 |
-
*/
|
1044 |
-
public function getLastMessageID()
|
1045 |
-
{
|
1046 |
-
return $this->lastMessageID;
|
1047 |
-
}
|
1048 |
-
|
1049 |
-
/**
|
1050 |
-
* Check that a string looks like an email address.
|
1051 |
-
* @param string $address The email address to check
|
1052 |
-
* @param string|callable $patternselect A selector for the validation pattern to use :
|
1053 |
-
* * `auto` Pick best pattern automatically;
|
1054 |
-
* * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
|
1055 |
-
* * `pcre` Use old PCRE implementation;
|
1056 |
-
* * `php` Use PHP built-in FILTER_VALIDATE_EMAIL;
|
1057 |
-
* * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements.
|
1058 |
-
* * `noregex` Don't use a regex: super fast, really dumb.
|
1059 |
-
* Alternatively you may pass in a callable to inject your own validator, for example:
|
1060 |
-
* PHPMailer::validateAddress('user@example.com', function($address) {
|
1061 |
-
* return (strpos($address, '@') !== false);
|
1062 |
-
* });
|
1063 |
-
* You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
|
1064 |
-
* @return boolean
|
1065 |
-
* @static
|
1066 |
-
* @access public
|
1067 |
-
*/
|
1068 |
-
public static function validateAddress($address, $patternselect = null)
|
1069 |
-
{
|
1070 |
-
if (is_null($patternselect)) {
|
1071 |
-
$patternselect = self::$validator;
|
1072 |
-
}
|
1073 |
-
if (is_callable($patternselect)) {
|
1074 |
-
return call_user_func($patternselect, $address);
|
1075 |
-
}
|
1076 |
-
//Reject line breaks in addresses; it's valid RFC5322, but not RFC5321
|
1077 |
-
if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) {
|
1078 |
-
return false;
|
1079 |
-
}
|
1080 |
-
if (!$patternselect or $patternselect == 'auto') {
|
1081 |
-
//Check this constant first so it works when extension_loaded() is disabled by safe mode
|
1082 |
-
//Constant was added in PHP 5.2.4
|
1083 |
-
if (defined('PCRE_VERSION')) {
|
1084 |
-
//This pattern can get stuck in a recursive loop in PCRE <= 8.0.2
|
1085 |
-
if (version_compare(PCRE_VERSION, '8.0.3') >= 0) {
|
1086 |
-
$patternselect = 'pcre8';
|
1087 |
-
} else {
|
1088 |
-
$patternselect = 'pcre';
|
1089 |
-
}
|
1090 |
-
} elseif (function_exists('extension_loaded') and extension_loaded('pcre')) {
|
1091 |
-
//Fall back to older PCRE
|
1092 |
-
$patternselect = 'pcre';
|
1093 |
-
} else {
|
1094 |
-
//Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
|
1095 |
-
if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
|
1096 |
-
$patternselect = 'php';
|
1097 |
-
} else {
|
1098 |
-
$patternselect = 'noregex';
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
}
|
1102 |
-
switch ($patternselect) {
|
1103 |
-
case 'pcre8':
|
1104 |
-
/**
|
1105 |
-
* Uses the same RFC5322 regex on which FILTER_VALIDATE_EMAIL is based, but allows dotless domains.
|
1106 |
-
* @link http://squiloople.com/2009/12/20/email-address-validation/
|
1107 |
-
* @copyright 2009-2010 Michael Rushton
|
1108 |
-
* Feel free to use and redistribute this code. But please keep this copyright notice.
|
1109 |
-
*/
|
1110 |
-
return (boolean)preg_match(
|
1111 |
-
'/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
|
1112 |
-
'((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
|
1113 |
-
'(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
|
1114 |
-
'([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
|
1115 |
-
'(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
|
1116 |
-
'(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
|
1117 |
-
'|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
|
1118 |
-
'|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
|
1119 |
-
'|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
|
1120 |
-
$address
|
1121 |
-
);
|
1122 |
-
case 'pcre':
|
1123 |
-
//An older regex that doesn't need a recent PCRE
|
1124 |
-
return (boolean)preg_match(
|
1125 |
-
'/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
|
1126 |
-
'[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
|
1127 |
-
'(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
|
1128 |
-
'@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
|
1129 |
-
'(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
|
1130 |
-
'[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
|
1131 |
-
'::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
|
1132 |
-
'[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
|
1133 |
-
'::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
|
1134 |
-
'|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
|
1135 |
-
$address
|
1136 |
-
);
|
1137 |
-
case 'html5':
|
1138 |
-
/**
|
1139 |
-
* This is the pattern used in the HTML5 spec for validation of 'email' type form input elements.
|
1140 |
-
* @link http://www.whatwg.org/specs/web-apps/current-work/#e-mail-state-(type=email)
|
1141 |
-
*/
|
1142 |
-
return (boolean)preg_match(
|
1143 |
-
'/^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}' .
|
1144 |
-
'[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD',
|
1145 |
-
$address
|
1146 |
-
);
|
1147 |
-
case 'noregex':
|
1148 |
-
//No PCRE! Do something _very_ approximate!
|
1149 |
-
//Check the address is 3 chars or longer and contains an @ that's not the first or last char
|
1150 |
-
return (strlen($address) >= 3
|
1151 |
-
and strpos($address, '@') >= 1
|
1152 |
-
and strpos($address, '@') != strlen($address) - 1);
|
1153 |
-
case 'php':
|
1154 |
-
default:
|
1155 |
-
return (boolean)filter_var($address, FILTER_VALIDATE_EMAIL);
|
1156 |
-
}
|
1157 |
-
}
|
1158 |
-
|
1159 |
-
/**
|
1160 |
-
* Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the
|
1161 |
-
* "intl" and "mbstring" PHP extensions.
|
1162 |
-
* @return bool "true" if required functions for IDN support are present
|
1163 |
-
*/
|
1164 |
-
public function idnSupported()
|
1165 |
-
{
|
1166 |
-
// @TODO: Write our own "idn_to_ascii" function for PHP <= 5.2.
|
1167 |
-
return function_exists('idn_to_ascii') and function_exists('mb_convert_encoding');
|
1168 |
-
}
|
1169 |
-
|
1170 |
-
/**
|
1171 |
-
* Converts IDN in given email address to its ASCII form, also known as punycode, if possible.
|
1172 |
-
* Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet.
|
1173 |
-
* This function silently returns unmodified address if:
|
1174 |
-
* - No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form)
|
1175 |
-
* - Conversion to punycode is impossible (e.g. required PHP functions are not available)
|
1176 |
-
* or fails for any reason (e.g. domain has characters not allowed in an IDN)
|
1177 |
-
* @see PHPMailer::$CharSet
|
1178 |
-
* @param string $address The email address to convert
|
1179 |
-
* @return string The encoded address in ASCII form
|
1180 |
-
*/
|
1181 |
-
public function punyencodeAddress($address)
|
1182 |
-
{
|
1183 |
-
// Verify we have required functions, CharSet, and at-sign.
|
1184 |
-
if ($this->idnSupported() and
|
1185 |
-
!empty($this->CharSet) and
|
1186 |
-
($pos = strrpos($address, '@')) !== false) {
|
1187 |
-
$domain = substr($address, ++$pos);
|
1188 |
-
// Verify CharSet string is a valid one, and domain properly encoded in this CharSet.
|
1189 |
-
if ($this->has8bitChars($domain) and @mb_check_encoding($domain, $this->CharSet)) {
|
1190 |
-
$domain = mb_convert_encoding($domain, 'UTF-8', $this->CharSet);
|
1191 |
-
if (($punycode = defined('INTL_IDNA_VARIANT_UTS46') ?
|
1192 |
-
idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46) :
|
1193 |
-
idn_to_ascii($domain)) !== false) {
|
1194 |
-
return substr($address, 0, $pos) . $punycode;
|
1195 |
-
}
|
1196 |
-
}
|
1197 |
-
}
|
1198 |
-
return $address;
|
1199 |
-
}
|
1200 |
-
|
1201 |
-
/**
|
1202 |
-
* Create a message and send it.
|
1203 |
-
* Uses the sending method specified by $Mailer.
|
1204 |
-
* @throws phpmailerException
|
1205 |
-
* @return boolean false on error - See the ErrorInfo property for details of the error.
|
1206 |
-
*/
|
1207 |
-
public function send()
|
1208 |
-
{
|
1209 |
-
try {
|
1210 |
-
if (!$this->preSend()) {
|
1211 |
-
return false;
|
1212 |
-
}
|
1213 |
-
return $this->postSend();
|
1214 |
-
} catch (phpmailerException $exc) {
|
1215 |
-
$this->mailHeader = '';
|
1216 |
-
$this->setError($exc->getMessage());
|
1217 |
-
if ($this->exceptions) {
|
1218 |
-
throw $exc;
|
1219 |
-
}
|
1220 |
-
return false;
|
1221 |
-
}
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
/**
|
1225 |
-
* Prepare a message for sending.
|
1226 |
-
* @throws phpmailerException
|
1227 |
-
* @return boolean
|
1228 |
-
*/
|
1229 |
-
public function preSend()
|
1230 |
-
{
|
1231 |
-
try {
|
1232 |
-
$this->error_count = 0; // Reset errors
|
1233 |
-
$this->mailHeader = '';
|
1234 |
-
|
1235 |
-
// Dequeue recipient and Reply-To addresses with IDN
|
1236 |
-
foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) {
|
1237 |
-
$params[1] = $this->punyencodeAddress($params[1]);
|
1238 |
-
call_user_func_array(array($this, 'addAnAddress'), $params);
|
1239 |
-
}
|
1240 |
-
if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
|
1241 |
-
throw new phpmailerException($this->lang('provide_address'), self::STOP_CRITICAL);
|
1242 |
-
}
|
1243 |
-
|
1244 |
-
// Validate From, Sender, and ConfirmReadingTo addresses
|
1245 |
-
foreach (array('From', 'Sender', 'ConfirmReadingTo') as $address_kind) {
|
1246 |
-
$this->$address_kind = trim($this->$address_kind);
|
1247 |
-
if (empty($this->$address_kind)) {
|
1248 |
-
continue;
|
1249 |
-
}
|
1250 |
-
$this->$address_kind = $this->punyencodeAddress($this->$address_kind);
|
1251 |
-
if (!$this->validateAddress($this->$address_kind)) {
|
1252 |
-
$error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind;
|
1253 |
-
$this->setError($error_message);
|
1254 |
-
$this->edebug($error_message);
|
1255 |
-
if ($this->exceptions) {
|
1256 |
-
throw new phpmailerException($error_message);
|
1257 |
-
}
|
1258 |
-
return false;
|
1259 |
-
}
|
1260 |
-
}
|
1261 |
-
|
1262 |
-
// Set whether the message is multipart/alternative
|
1263 |
-
if ($this->alternativeExists()) {
|
1264 |
-
$this->ContentType = 'multipart/alternative';
|
1265 |
-
}
|
1266 |
-
|
1267 |
-
$this->setMessageType();
|
1268 |
-
// Refuse to send an empty message unless we are specifically allowing it
|
1269 |
-
if (!$this->AllowEmpty and empty($this->Body)) {
|
1270 |
-
throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
|
1271 |
-
}
|
1272 |
-
|
1273 |
-
// Create body before headers in case body makes changes to headers (e.g. altering transfer encoding)
|
1274 |
-
$this->MIMEHeader = '';
|
1275 |
-
$this->MIMEBody = $this->createBody();
|
1276 |
-
// createBody may have added some headers, so retain them
|
1277 |
-
$tempheaders = $this->MIMEHeader;
|
1278 |
-
$this->MIMEHeader = $this->createHeader();
|
1279 |
-
$this->MIMEHeader .= $tempheaders;
|
1280 |
-
|
1281 |
-
// To capture the complete message when using mail(), create
|
1282 |
-
// an extra header list which createHeader() doesn't fold in
|
1283 |
-
if ($this->Mailer == 'mail') {
|
1284 |
-
if (count($this->to) > 0) {
|
1285 |
-
$this->mailHeader .= $this->addrAppend('To', $this->to);
|
1286 |
-
} else {
|
1287 |
-
$this->mailHeader .= $this->headerLine('To', 'undisclosed-recipients:;');
|
1288 |
-
}
|
1289 |
-
$this->mailHeader .= $this->headerLine(
|
1290 |
-
'Subject',
|
1291 |
-
$this->encodeHeader($this->secureHeader(trim($this->Subject)))
|
1292 |
-
);
|
1293 |
-
}
|
1294 |
-
|
1295 |
-
// Sign with DKIM if enabled
|
1296 |
-
if (!empty($this->DKIM_domain)
|
1297 |
-
&& !empty($this->DKIM_selector)
|
1298 |
-
&& (!empty($this->DKIM_private_string)
|
1299 |
-
|| (!empty($this->DKIM_private) && file_exists($this->DKIM_private))
|
1300 |
-
)
|
1301 |
-
) {
|
1302 |
-
$header_dkim = $this->DKIM_Add(
|
1303 |
-
$this->MIMEHeader . $this->mailHeader,
|
1304 |
-
$this->encodeHeader($this->secureHeader($this->Subject)),
|
1305 |
-
$this->MIMEBody
|
1306 |
-
);
|
1307 |
-
$this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
|
1308 |
-
str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
|
1309 |
-
}
|
1310 |
-
return true;
|
1311 |
-
} catch (phpmailerException $exc) {
|
1312 |
-
$this->setError($exc->getMessage());
|
1313 |
-
if ($this->exceptions) {
|
1314 |
-
throw $exc;
|
1315 |
-
}
|
1316 |
-
return false;
|
1317 |
-
}
|
1318 |
-
}
|
1319 |
-
|
1320 |
-
/**
|
1321 |
-
* Actually send a message.
|
1322 |
-
* Send the email via the selected mechanism
|
1323 |
-
* @throws phpmailerException
|
1324 |
-
* @return boolean
|
1325 |
-
*/
|
1326 |
-
public function postSend()
|
1327 |
-
{
|
1328 |
-
try {
|
1329 |
-
// Choose the mailer and send through it
|
1330 |
-
switch ($this->Mailer) {
|
1331 |
-
case 'sendmail':
|
1332 |
-
case 'qmail':
|
1333 |
-
return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
|
1334 |
-
case 'smtp':
|
1335 |
-
return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
|
1336 |
-
case 'mail':
|
1337 |
-
return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
|
1338 |
-
default:
|
1339 |
-
$sendMethod = $this->Mailer.'Send';
|
1340 |
-
if (method_exists($this, $sendMethod)) {
|
1341 |
-
return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
|
1342 |
-
}
|
1343 |
-
|
1344 |
-
return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
|
1345 |
-
}
|
1346 |
-
} catch (phpmailerException $exc) {
|
1347 |
-
$this->setError($exc->getMessage());
|
1348 |
-
$this->edebug($exc->getMessage());
|
1349 |
-
if ($this->exceptions) {
|
1350 |
-
throw $exc;
|
1351 |
-
}
|
1352 |
-
}
|
1353 |
-
return false;
|
1354 |
-
}
|
1355 |
-
|
1356 |
-
/**
|
1357 |
-
* Send mail using the $Sendmail program.
|
1358 |
-
* @param string $header The message headers
|
1359 |
-
* @param string $body The message body
|
1360 |
-
* @see PHPMailer::$Sendmail
|
1361 |
-
* @throws phpmailerException
|
1362 |
-
* @access protected
|
1363 |
-
* @return boolean
|
1364 |
-
*/
|
1365 |
-
protected function sendmailSend($header, $body)
|
1366 |
-
{
|
1367 |
-
// CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
|
1368 |
-
if (!empty($this->Sender) and self::isShellSafe($this->Sender)) {
|
1369 |
-
if ($this->Mailer == 'qmail') {
|
1370 |
-
$sendmailFmt = '%s -f%s';
|
1371 |
-
} else {
|
1372 |
-
$sendmailFmt = '%s -oi -f%s -t';
|
1373 |
-
}
|
1374 |
-
} else {
|
1375 |
-
if ($this->Mailer == 'qmail') {
|
1376 |
-
$sendmailFmt = '%s';
|
1377 |
-
} else {
|
1378 |
-
$sendmailFmt = '%s -oi -t';
|
1379 |
-
}
|
1380 |
-
}
|
1381 |
-
|
1382 |
-
// TODO: If possible, this should be changed to escapeshellarg. Needs thorough testing.
|
1383 |
-
$sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender);
|
1384 |
-
|
1385 |
-
if ($this->SingleTo) {
|
1386 |
-
foreach ($this->SingleToArray as $toAddr) {
|
1387 |
-
if (!@$mail = popen($sendmail, 'w')) {
|
1388 |
-
throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
1389 |
-
}
|
1390 |
-
fputs($mail, 'To: ' . $toAddr . "\n");
|
1391 |
-
fputs($mail, $header);
|
1392 |
-
fputs($mail, $body);
|
1393 |
-
$result = pclose($mail);
|
1394 |
-
$this->doCallback(
|
1395 |
-
($result == 0),
|
1396 |
-
array($toAddr),
|
1397 |
-
$this->cc,
|
1398 |
-
$this->bcc,
|
1399 |
-
$this->Subject,
|
1400 |
-
$body,
|
1401 |
-
$this->From
|
1402 |
-
);
|
1403 |
-
if ($result != 0) {
|
1404 |
-
throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
1405 |
-
}
|
1406 |
-
}
|
1407 |
-
} else {
|
1408 |
-
if (!@$mail = popen($sendmail, 'w')) {
|
1409 |
-
throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
1410 |
-
}
|
1411 |
-
fputs($mail, $header);
|
1412 |
-
fputs($mail, $body);
|
1413 |
-
$result = pclose($mail);
|
1414 |
-
$this->doCallback(
|
1415 |
-
($result == 0),
|
1416 |
-
$this->to,
|
1417 |
-
$this->cc,
|
1418 |
-
$this->bcc,
|
1419 |
-
$this->Subject,
|
1420 |
-
$body,
|
1421 |
-
$this->From
|
1422 |
-
);
|
1423 |
-
if ($result != 0) {
|
1424 |
-
throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
|
1425 |
-
}
|
1426 |
-
}
|
1427 |
-
return true;
|
1428 |
-
}
|
1429 |
-
|
1430 |
-
/**
|
1431 |
-
* Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.
|
1432 |
-
*
|
1433 |
-
* Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
|
1434 |
-
* @param string $string The string to be validated
|
1435 |
-
* @see https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report
|
1436 |
-
* @access protected
|
1437 |
-
* @return boolean
|
1438 |
-
*/
|
1439 |
-
protected static function isShellSafe($string)
|
1440 |
-
{
|
1441 |
-
// Future-proof
|
1442 |
-
if (escapeshellcmd($string) !== $string
|
1443 |
-
or !in_array(escapeshellarg($string), array("'$string'", "\"$string\""))
|
1444 |
-
) {
|
1445 |
-
return false;
|
1446 |
-
}
|
1447 |
-
|
1448 |
-
$length = strlen($string);
|
1449 |
-
|
1450 |
-
for ($i = 0; $i < $length; $i++) {
|
1451 |
-
$c = $string[$i];
|
1452 |
-
|
1453 |
-
// All other characters have a special meaning in at least one common shell, including = and +.
|
1454 |
-
// Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here.
|
1455 |
-
// Note that this does permit non-Latin alphanumeric characters based on the current locale.
|
1456 |
-
if (!ctype_alnum($c) && strpos('@_-.', $c) === false) {
|
1457 |
-
return false;
|
1458 |
-
}
|
1459 |
-
}
|
1460 |
-
|
1461 |
-
return true;
|
1462 |
-
}
|
1463 |
-
|
1464 |
-
/**
|
1465 |
-
* Send mail using the PHP mail() function.
|
1466 |
-
* @param string $header The message headers
|
1467 |
-
* @param string $body The message body
|
1468 |
-
* @link http://www.php.net/manual/en/book.mail.php
|
1469 |
-
* @throws phpmailerException
|
1470 |
-
* @access protected
|
1471 |
-
* @return boolean
|
1472 |
-
*/
|
1473 |
-
protected function mailSend($header, $body)
|
1474 |
-
{
|
1475 |
-
$toArr = array();
|
1476 |
-
foreach ($this->to as $toaddr) {
|
1477 |
-
$toArr[] = $this->addrFormat($toaddr);
|
1478 |
-
}
|
1479 |
-
$to = implode(', ', $toArr);
|
1480 |
-
|
1481 |
-
$params = null;
|
1482 |
-
//This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
|
1483 |
-
if (!empty($this->Sender) and $this->validateAddress($this->Sender)) {
|
1484 |
-
// CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
|
1485 |
-
if (self::isShellSafe($this->Sender)) {
|
1486 |
-
$params = sprintf('-f%s', $this->Sender);
|
1487 |
-
}
|
1488 |
-
}
|
1489 |
-
if (!empty($this->Sender) and !ini_get('safe_mode') and $this->validateAddress($this->Sender)) {
|
1490 |
-
$old_from = ini_get('sendmail_from');
|
1491 |
-
ini_set('sendmail_from', $this->Sender);
|
1492 |
-
}
|
1493 |
-
$result = false;
|
1494 |
-
if ($this->SingleTo and count($toArr) > 1) {
|
1495 |
-
foreach ($toArr as $toAddr) {
|
1496 |
-
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
|
1497 |
-
$this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
|
1498 |
-
}
|
1499 |
-
} else {
|
1500 |
-
$result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
|
1501 |
-
$this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From);
|
1502 |
-
}
|
1503 |
-
if (isset($old_from)) {
|
1504 |
-
ini_set('sendmail_from', $old_from);
|
1505 |
-
}
|
1506 |
-
if (!$result) {
|
1507 |
-
throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
|
1508 |
-
}
|
1509 |
-
return true;
|
1510 |
-
}
|
1511 |
-
|
1512 |
-
/**
|
1513 |
-
* Get an instance to use for SMTP operations.
|
1514 |
-
* Override this function to load your own SMTP implementation
|
1515 |
-
* @return SMTP
|
1516 |
-
*/
|
1517 |
-
public function getSMTPInstance()
|
1518 |
-
{
|
1519 |
-
if (!is_object($this->smtp)) {
|
1520 |
-
$this->smtp = new SMTP;
|
1521 |
-
}
|
1522 |
-
return $this->smtp;
|
1523 |
-
}
|
1524 |
-
|
1525 |
-
/**
|
1526 |
-
* Send mail via SMTP.
|
1527 |
-
* Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
|
1528 |
-
* Uses the PHPMailerSMTP class by default.
|
1529 |
-
* @see PHPMailer::getSMTPInstance() to use a different class.
|
1530 |
-
* @param string $header The message headers
|
1531 |
-
* @param string $body The message body
|
1532 |
-
* @throws phpmailerException
|
1533 |
-
* @uses SMTP
|
1534 |
-
* @access protected
|
1535 |
-
* @return boolean
|
1536 |
-
*/
|
1537 |
-
protected function smtpSend($header, $body)
|
1538 |
-
{
|
1539 |
-
$bad_rcpt = array();
|
1540 |
-
if (!$this->smtpConnect($this->SMTPOptions)) {
|
1541 |
-
throw new phpmailerException($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
|
1542 |
-
}
|
1543 |
-
if (!empty($this->Sender) and $this->validateAddress($this->Sender)) {
|
1544 |
-
$smtp_from = $this->Sender;
|
1545 |
-
} else {
|
1546 |
-
$smtp_from = $this->From;
|
1547 |
-
}
|
1548 |
-
if (!$this->smtp->mail($smtp_from)) {
|
1549 |
-
$this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
|
1550 |
-
throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
|
1551 |
-
}
|
1552 |
-
|
1553 |
-
// Attempt to send to all recipients
|
1554 |
-
foreach (array($this->to, $this->cc, $this->bcc) as $togroup) {
|
1555 |
-
foreach ($togroup as $to) {
|
1556 |
-
if (!$this->smtp->recipient($to[0])) {
|
1557 |
-
$error = $this->smtp->getError();
|
1558 |
-
$bad_rcpt[] = array('to' => $to[0], 'error' => $error['detail']);
|
1559 |
-
$isSent = false;
|
1560 |
-
} else {
|
1561 |
-
$isSent = true;
|
1562 |
-
}
|
1563 |
-
$this->doCallback($isSent, array($to[0]), array(), array(), $this->Subject, $body, $this->From);
|
1564 |
-
}
|
1565 |
-
}
|
1566 |
-
|
1567 |
-
// Only send the DATA command if we have viable recipients
|
1568 |
-
if ((count($this->all_recipients) > count($bad_rcpt)) and !$this->smtp->data($header . $body)) {
|
1569 |
-
throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
|
1570 |
-
}
|
1571 |
-
if ($this->SMTPKeepAlive) {
|
1572 |
-
$this->smtp->reset();
|
1573 |
-
} else {
|
1574 |
-
$this->smtp->quit();
|
1575 |
-
$this->smtp->close();
|
1576 |
-
}
|
1577 |
-
//Create error message for any bad addresses
|
1578 |
-
if (count($bad_rcpt) > 0) {
|
1579 |
-
$errstr = '';
|
1580 |
-
foreach ($bad_rcpt as $bad) {
|
1581 |
-
$errstr .= $bad['to'] . ': ' . $bad['error'];
|
1582 |
-
}
|
1583 |
-
throw new phpmailerException(
|
1584 |
-
$this->lang('recipients_failed') . $errstr,
|
1585 |
-
self::STOP_CONTINUE
|
1586 |
-
);
|
1587 |
-
}
|
1588 |
-
return true;
|
1589 |
-
}
|
1590 |
-
|
1591 |
-
/**
|
1592 |
-
* Initiate a connection to an SMTP server.
|
1593 |
-
* Returns false if the operation failed.
|
1594 |
-
* @param array $options An array of options compatible with stream_context_create()
|
1595 |
-
* @uses SMTP
|
1596 |
-
* @access public
|
1597 |
-
* @throws phpmailerException
|
1598 |
-
* @return boolean
|
1599 |
-
*/
|
1600 |
-
public function smtpConnect($options = null)
|
1601 |
-
{
|
1602 |
-
if (is_null($this->smtp)) {
|
1603 |
-
$this->smtp = $this->getSMTPInstance();
|
1604 |
-
}
|
1605 |
-
|
1606 |
-
//If no options are provided, use whatever is set in the instance
|
1607 |
-
if (is_null($options)) {
|
1608 |
-
$options = $this->SMTPOptions;
|
1609 |
-
}
|
1610 |
-
|
1611 |
-
// Already connected?
|
1612 |
-
if ($this->smtp->connected()) {
|
1613 |
-
return true;
|
1614 |
-
}
|
1615 |
-
|
1616 |
-
$this->smtp->setTimeout($this->Timeout);
|
1617 |
-
$this->smtp->setDebugLevel($this->SMTPDebug);
|
1618 |
-
$this->smtp->setDebugOutput($this->Debugoutput);
|
1619 |
-
$this->smtp->setVerp($this->do_verp);
|
1620 |
-
$hosts = explode(';', $this->Host);
|
1621 |
-
$lastexception = null;
|
1622 |
-
|
1623 |
-
foreach ($hosts as $hostentry) {
|
1624 |
-
$hostinfo = array();
|
1625 |
-
if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
|
1626 |
-
// Not a valid host entry
|
1627 |
-
continue;
|
1628 |
-
}
|
1629 |
-
// $hostinfo[2]: optional ssl or tls prefix
|
1630 |
-
// $hostinfo[3]: the hostname
|
1631 |
-
// $hostinfo[4]: optional port number
|
1632 |
-
// The host string prefix can temporarily override the current setting for SMTPSecure
|
1633 |
-
// If it's not specified, the default value is used
|
1634 |
-
$prefix = '';
|
1635 |
-
$secure = $this->SMTPSecure;
|
1636 |
-
$tls = ($this->SMTPSecure == 'tls');
|
1637 |
-
if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
|
1638 |
-
$prefix = 'ssl://';
|
1639 |
-
$tls = false; // Can't have SSL and TLS at the same time
|
1640 |
-
$secure = 'ssl';
|
1641 |
-
} elseif ($hostinfo[2] == 'tls') {
|
1642 |
-
$tls = true;
|
1643 |
-
// tls doesn't use a prefix
|
1644 |
-
$secure = 'tls';
|
1645 |
-
}
|
1646 |
-
//Do we need the OpenSSL extension?
|
1647 |
-
$sslext = defined('OPENSSL_ALGO_SHA1');
|
1648 |
-
if ('tls' === $secure or 'ssl' === $secure) {
|
1649 |
-
//Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
|
1650 |
-
if (!$sslext) {
|
1651 |
-
throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
|
1652 |
-
}
|
1653 |
-
}
|
1654 |
-
$host = $hostinfo[3];
|
1655 |
-
$port = $this->Port;
|
1656 |
-
$tport = (integer)$hostinfo[4];
|
1657 |
-
if ($tport > 0 and $tport < 65536) {
|
1658 |
-
$port = $tport;
|
1659 |
-
}
|
1660 |
-
if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
|
1661 |
-
try {
|
1662 |
-
if ($this->Helo) {
|
1663 |
-
$hello = $this->Helo;
|
1664 |
-
} else {
|
1665 |
-
$hello = $this->serverHostname();
|
1666 |
-
}
|
1667 |
-
$this->smtp->hello($hello);
|
1668 |
-
//Automatically enable TLS encryption if:
|
1669 |
-
// * it's not disabled
|
1670 |
-
// * we have openssl extension
|
1671 |
-
// * we are not already using SSL
|
1672 |
-
// * the server offers STARTTLS
|
1673 |
-
if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
|
1674 |
-
$tls = true;
|
1675 |
-
}
|
1676 |
-
if ($tls) {
|
1677 |
-
if (!$this->smtp->startTLS()) {
|
1678 |
-
throw new phpmailerException($this->lang('connect_host'));
|
1679 |
-
}
|
1680 |
-
// We must resend EHLO after TLS negotiation
|
1681 |
-
$this->smtp->hello($hello);
|
1682 |
-
}
|
1683 |
-
if ($this->SMTPAuth) {
|
1684 |
-
if (!$this->smtp->authenticate(
|
1685 |
-
$this->Username,
|
1686 |
-
$this->Password,
|
1687 |
-
$this->AuthType,
|
1688 |
-
$this->Realm,
|
1689 |
-
$this->Workstation
|
1690 |
-
)
|
1691 |
-
) {
|
1692 |
-
throw new phpmailerException($this->lang('authenticate'));
|
1693 |
-
}
|
1694 |
-
}
|
1695 |
-
return true;
|
1696 |
-
} catch (phpmailerException $exc) {
|
1697 |
-
$lastexception = $exc;
|
1698 |
-
$this->edebug($exc->getMessage());
|
1699 |
-
// We must have connected, but then failed TLS or Auth, so close connection nicely
|
1700 |
-
$this->smtp->quit();
|
1701 |
-
}
|
1702 |
-
}
|
1703 |
-
}
|
1704 |
-
// If we get here, all connection attempts have failed, so close connection hard
|
1705 |
-
$this->smtp->close();
|
1706 |
-
// As we've caught all exceptions, just report whatever the last one was
|
1707 |
-
if ($this->exceptions and !is_null($lastexception)) {
|
1708 |
-
throw $lastexception;
|
1709 |
-
}
|
1710 |
-
return false;
|
1711 |
-
}
|
1712 |
-
|
1713 |
-
/**
|
1714 |
-
* Close the active SMTP session if one exists.
|
1715 |
-
* @return void
|
1716 |
-
*/
|
1717 |
-
public function smtpClose()
|
1718 |
-
{
|
1719 |
-
if (is_a($this->smtp, 'SMTP')) {
|
1720 |
-
if ($this->smtp->connected()) {
|
1721 |
-
$this->smtp->quit();
|
1722 |
-
$this->smtp->close();
|
1723 |
-
}
|
1724 |
-
}
|
1725 |
-
}
|
1726 |
-
|
1727 |
-
/**
|
1728 |
-
* Set the language for error messages.
|
1729 |
-
* Returns false if it cannot load the language file.
|
1730 |
-
* The default language is English.
|
1731 |
-
* @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr")
|
1732 |
-
* @param string $lang_path Path to the language file directory, with trailing separator (slash)
|
1733 |
-
* @return boolean
|
1734 |
-
* @access public
|
1735 |
-
*/
|
1736 |
-
public function setLanguage($langcode = 'en', $lang_path = '')
|
1737 |
-
{
|
1738 |
-
// Backwards compatibility for renamed language codes
|
1739 |
-
$renamed_langcodes = array(
|
1740 |
-
'br' => 'pt_br',
|
1741 |
-
'cz' => 'cs',
|
1742 |
-
'dk' => 'da',
|
1743 |
-
'no' => 'nb',
|
1744 |
-
'se' => 'sv',
|
1745 |
-
);
|
1746 |
-
|
1747 |
-
if (isset($renamed_langcodes[$langcode])) {
|
1748 |
-
$langcode = $renamed_langcodes[$langcode];
|
1749 |
-
}
|
1750 |
-
|
1751 |
-
// Define full set of translatable strings in English
|
1752 |
-
$PHPMAILER_LANG = array(
|
1753 |
-
'authenticate' => 'SMTP Error: Could not authenticate.',
|
1754 |
-
'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
|
1755 |
-
'data_not_accepted' => 'SMTP Error: data not accepted.',
|
1756 |
-
'empty_message' => 'Message body empty',
|
1757 |
-
'encoding' => 'Unknown encoding: ',
|
1758 |
-
'execute' => 'Could not execute: ',
|
1759 |
-
'file_access' => 'Could not access file: ',
|
1760 |
-
'file_open' => 'File Error: Could not open file: ',
|
1761 |
-
'from_failed' => 'The following From address failed: ',
|
1762 |
-
'instantiate' => 'Could not instantiate mail function.',
|
1763 |
-
'invalid_address' => 'Invalid address: ',
|
1764 |
-
'mailer_not_supported' => ' mailer is not supported.',
|
1765 |
-
'provide_address' => 'You must provide at least one recipient email address.',
|
1766 |
-
'recipients_failed' => 'SMTP Error: The following recipients failed: ',
|
1767 |
-
'signing' => 'Signing Error: ',
|
1768 |
-
'smtp_connect_failed' => 'SMTP connect() failed.',
|
1769 |
-
'smtp_error' => 'SMTP server error: ',
|
1770 |
-
'variable_set' => 'Cannot set or reset variable: ',
|
1771 |
-
'extension_missing' => 'Extension missing: '
|
1772 |
-
);
|
1773 |
-
if (empty($lang_path)) {
|
1774 |
-
// Calculate an absolute path so it can work if CWD is not here
|
1775 |
-
$lang_path = dirname(__FILE__). DIRECTORY_SEPARATOR . 'language'. DIRECTORY_SEPARATOR;
|
1776 |
-
}
|
1777 |
-
//Validate $langcode
|
1778 |
-
if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) {
|
1779 |
-
$langcode = 'en';
|
1780 |
-
}
|
1781 |
-
$foundlang = true;
|
1782 |
-
$lang_file = $lang_path . 'phpmailer.lang-' . $langcode . '.php';
|
1783 |
-
// There is no English translation file
|
1784 |
-
if ($langcode != 'en') {
|
1785 |
-
// Make sure language file path is readable
|
1786 |
-
if (!is_readable($lang_file)) {
|
1787 |
-
$foundlang = false;
|
1788 |
-
} else {
|
1789 |
-
// Overwrite language-specific strings.
|
1790 |
-
// This way we'll never have missing translation keys.
|
1791 |
-
$foundlang = include $lang_file;
|
1792 |
-
}
|
1793 |
-
}
|
1794 |
-
$this->language = $PHPMAILER_LANG;
|
1795 |
-
return (boolean)$foundlang; // Returns false if language not found
|
1796 |
-
}
|
1797 |
-
|
1798 |
-
/**
|
1799 |
-
* Get the array of strings for the current language.
|
1800 |
-
* @return array
|
1801 |
-
*/
|
1802 |
-
public function getTranslations()
|
1803 |
-
{
|
1804 |
-
return $this->language;
|
1805 |
-
}
|
1806 |
-
|
1807 |
-
/**
|
1808 |
-
* Create recipient headers.
|
1809 |
-
* @access public
|
1810 |
-
* @param string $type
|
1811 |
-
* @param array $addr An array of recipient,
|
1812 |
-
* where each recipient is a 2-element indexed array with element 0 containing an address
|
1813 |
-
* and element 1 containing a name, like:
|
1814 |
-
* array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
|
1815 |
-
* @return string
|
1816 |
-
*/
|
1817 |
-
public function addrAppend($type, $addr)
|
1818 |
-
{
|
1819 |
-
$addresses = array();
|
1820 |
-
foreach ($addr as $address) {
|
1821 |
-
$addresses[] = $this->addrFormat($address);
|
1822 |
-
}
|
1823 |
-
return $type . ': ' . implode(', ', $addresses) . $this->LE;
|
1824 |
-
}
|
1825 |
-
|
1826 |
-
/**
|
1827 |
-
* Format an address for use in a message header.
|
1828 |
-
* @access public
|
1829 |
-
* @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
|
1830 |
-
* like array('joe@example.com', 'Joe User')
|
1831 |
-
* @return string
|
1832 |
-
*/
|
1833 |
-
public function addrFormat($addr)
|
1834 |
-
{
|
1835 |
-
if (empty($addr[1])) { // No name provided
|
1836 |
-
return $this->secureHeader($addr[0]);
|
1837 |
-
} else {
|
1838 |
-
return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . ' <' . $this->secureHeader(
|
1839 |
-
$addr[0]
|
1840 |
-
) . '>';
|
1841 |
-
}
|
1842 |
-
}
|
1843 |
-
|
1844 |
-
/**
|
1845 |
-
* Word-wrap message.
|
1846 |
-
* For use with mailers that do not automatically perform wrapping
|
1847 |
-
* and for quoted-printable encoded messages.
|
1848 |
-
* Original written by philippe.
|
1849 |
-
* @param string $message The message to wrap
|
1850 |
-
* @param integer $length The line length to wrap to
|
1851 |
-
* @param boolean $qp_mode Whether to run in Quoted-Printable mode
|
1852 |
-
* @access public
|
1853 |
-
* @return string
|
1854 |
-
*/
|
1855 |
-
public function wrapText($message, $length, $qp_mode = false)
|
1856 |
-
{
|
1857 |
-
if ($qp_mode) {
|
1858 |
-
$soft_break = sprintf(' =%s', $this->LE);
|
1859 |
-
} else {
|
1860 |
-
$soft_break = $this->LE;
|
1861 |
-
}
|
1862 |
-
// If utf-8 encoding is used, we will need to make sure we don't
|
1863 |
-
// split multibyte characters when we wrap
|
1864 |
-
$is_utf8 = (strtolower($this->CharSet) == 'utf-8');
|
1865 |
-
$lelen = strlen($this->LE);
|
1866 |
-
$crlflen = strlen(self::CRLF);
|
1867 |
-
|
1868 |
-
$message = $this->fixEOL($message);
|
1869 |
-
//Remove a trailing line break
|
1870 |
-
if (substr($message, -$lelen) == $this->LE) {
|
1871 |
-
$message = substr($message, 0, -$lelen);
|
1872 |
-
}
|
1873 |
-
|
1874 |
-
//Split message into lines
|
1875 |
-
$lines = explode($this->LE, $message);
|
1876 |
-
//Message will be rebuilt in here
|
1877 |
-
$message = '';
|
1878 |
-
foreach ($lines as $line) {
|
1879 |
-
$words = explode(' ', $line);
|
1880 |
-
$buf = '';
|
1881 |
-
$firstword = true;
|
1882 |
-
foreach ($words as $word) {
|
1883 |
-
if ($qp_mode and (strlen($word) > $length)) {
|
1884 |
-
$space_left = $length - strlen($buf) - $crlflen;
|
1885 |
-
if (!$firstword) {
|
1886 |
-
if ($space_left > 20) {
|
1887 |
-
$len = $space_left;
|
1888 |
-
if ($is_utf8) {
|
1889 |
-
$len = $this->utf8CharBoundary($word, $len);
|
1890 |
-
} elseif (substr($word, $len - 1, 1) == '=') {
|
1891 |
-
$len--;
|
1892 |
-
} elseif (substr($word, $len - 2, 1) == '=') {
|
1893 |
-
$len -= 2;
|
1894 |
-
}
|
1895 |
-
$part = substr($word, 0, $len);
|
1896 |
-
$word = substr($word, $len);
|
1897 |
-
$buf .= ' ' . $part;
|
1898 |
-
$message .= $buf . sprintf('=%s', self::CRLF);
|
1899 |
-
} else {
|
1900 |
-
$message .= $buf . $soft_break;
|
1901 |
-
}
|
1902 |
-
$buf = '';
|
1903 |
-
}
|
1904 |
-
while (strlen($word) > 0) {
|
1905 |
-
if ($length <= 0) {
|
1906 |
-
break;
|
1907 |
-
}
|
1908 |
-
$len = $length;
|
1909 |
-
if ($is_utf8) {
|
1910 |
-
$len = $this->utf8CharBoundary($word, $len);
|
1911 |
-
} elseif (substr($word, $len - 1, 1) == '=') {
|
1912 |
-
$len--;
|
1913 |
-
} elseif (substr($word, $len - 2, 1) == '=') {
|
1914 |
-
$len -= 2;
|
1915 |
-
}
|
1916 |
-
$part = substr($word, 0, $len);
|
1917 |
-
$word = substr($word, $len);
|
1918 |
-
|
1919 |
-
if (strlen($word) > 0) {
|
1920 |
-
$message .= $part . sprintf('=%s', self::CRLF);
|
1921 |
-
} else {
|
1922 |
-
$buf = $part;
|
1923 |
-
}
|
1924 |
-
}
|
1925 |
-
} else {
|
1926 |
-
$buf_o = $buf;
|
1927 |
-
if (!$firstword) {
|
1928 |
-
$buf .= ' ';
|
1929 |
-
}
|
1930 |
-
$buf .= $word;
|
1931 |
-
|
1932 |
-
if (strlen($buf) > $length and $buf_o != '') {
|
1933 |
-
$message .= $buf_o . $soft_break;
|
1934 |
-
$buf = $word;
|
1935 |
-
}
|
1936 |
-
}
|
1937 |
-
$firstword = false;
|
1938 |
-
}
|
1939 |
-
$message .= $buf . self::CRLF;
|
1940 |
-
}
|
1941 |
-
|
1942 |
-
return $message;
|
1943 |
-
}
|
1944 |
-
|
1945 |
-
/**
|
1946 |
-
* Find the last character boundary prior to $maxLength in a utf-8
|
1947 |
-
* quoted-printable encoded string.
|
1948 |
-
* Original written by Colin Brown.
|
1949 |
-
* @access public
|
1950 |
-
* @param string $encodedText utf-8 QP text
|
1951 |
-
* @param integer $maxLength Find the last character boundary prior to this length
|
1952 |
-
* @return integer
|
1953 |
-
*/
|
1954 |
-
public function utf8CharBoundary($encodedText, $maxLength)
|
1955 |
-
{
|
1956 |
-
$foundSplitPos = false;
|
1957 |
-
$lookBack = 3;
|
1958 |
-
while (!$foundSplitPos) {
|
1959 |
-
$lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
|
1960 |
-
$encodedCharPos = strpos($lastChunk, '=');
|
1961 |
-
if (false !== $encodedCharPos) {
|
1962 |
-
// Found start of encoded character byte within $lookBack block.
|
1963 |
-
// Check the encoded byte value (the 2 chars after the '=')
|
1964 |
-
$hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
|
1965 |
-
$dec = hexdec($hex);
|
1966 |
-
if ($dec < 128) {
|
1967 |
-
// Single byte character.
|
1968 |
-
// If the encoded char was found at pos 0, it will fit
|
1969 |
-
// otherwise reduce maxLength to start of the encoded char
|
1970 |
-
if ($encodedCharPos > 0) {
|
1971 |
-
$maxLength = $maxLength - ($lookBack - $encodedCharPos);
|
1972 |
-
}
|
1973 |
-
$foundSplitPos = true;
|
1974 |
-
} elseif ($dec >= 192) {
|
1975 |
-
// First byte of a multi byte character
|
1976 |
-
// Reduce maxLength to split at start of character
|
1977 |
-
$maxLength = $maxLength - ($lookBack - $encodedCharPos);
|
1978 |
-
$foundSplitPos = true;
|
1979 |
-
} elseif ($dec < 192) {
|
1980 |
-
// Middle byte of a multi byte character, look further back
|
1981 |
-
$lookBack += 3;
|
1982 |
-
}
|
1983 |
-
} else {
|
1984 |
-
// No encoded character found
|
1985 |
-
$foundSplitPos = true;
|
1986 |
-
}
|
1987 |
-
}
|
1988 |
-
return $maxLength;
|
1989 |
-
}
|
1990 |
-
|
1991 |
-
/**
|
1992 |
-
* Apply word wrapping to the message body.
|
1993 |
-
* Wraps the message body to the number of chars set in the WordWrap property.
|
1994 |
-
* You should only do this to plain-text bodies as wrapping HTML tags may break them.
|
1995 |
-
* This is called automatically by createBody(), so you don't need to call it yourself.
|
1996 |
-
* @access public
|
1997 |
-
* @return void
|
1998 |
-
*/
|
1999 |
-
public function setWordWrap()
|
2000 |
-
{
|
2001 |
-
if ($this->WordWrap < 1) {
|
2002 |
-
return;
|
2003 |
-
}
|
2004 |
-
|
2005 |
-
switch ($this->message_type) {
|
2006 |
-
case 'alt':
|
2007 |
-
case 'alt_inline':
|
2008 |
-
case 'alt_attach':
|
2009 |
-
case 'alt_inline_attach':
|
2010 |
-
$this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
|
2011 |
-
break;
|
2012 |
-
default:
|
2013 |
-
$this->Body = $this->wrapText($this->Body, $this->WordWrap);
|
2014 |
-
break;
|
2015 |
-
}
|
2016 |
-
}
|
2017 |
-
|
2018 |
-
/**
|
2019 |
-
* Assemble message headers.
|
2020 |
-
* @access public
|
2021 |
-
* @return string The assembled headers
|
2022 |
-
*/
|
2023 |
-
public function createHeader()
|
2024 |
-
{
|
2025 |
-
$result = '';
|
2026 |
-
|
2027 |
-
if ($this->MessageDate == '') {
|
2028 |
-
$this->MessageDate = self::rfcDate();
|
2029 |
-
}
|
2030 |
-
$result .= $this->headerLine('Date', $this->MessageDate);
|
2031 |
-
|
2032 |
-
// To be created automatically by mail()
|
2033 |
-
if ($this->SingleTo) {
|
2034 |
-
if ($this->Mailer != 'mail') {
|
2035 |
-
foreach ($this->to as $toaddr) {
|
2036 |
-
$this->SingleToArray[] = $this->addrFormat($toaddr);
|
2037 |
-
}
|
2038 |
-
}
|
2039 |
-
} else {
|
2040 |
-
if (count($this->to) > 0) {
|
2041 |
-
if ($this->Mailer != 'mail') {
|
2042 |
-
$result .= $this->addrAppend('To', $this->to);
|
2043 |
-
}
|
2044 |
-
} elseif (count($this->cc) == 0) {
|
2045 |
-
$result .= $this->headerLine('To', 'undisclosed-recipients:;');
|
2046 |
-
}
|
2047 |
-
}
|
2048 |
-
|
2049 |
-
$result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
|
2050 |
-
|
2051 |
-
// sendmail and mail() extract Cc from the header before sending
|
2052 |
-
if (count($this->cc) > 0) {
|
2053 |
-
$result .= $this->addrAppend('Cc', $this->cc);
|
2054 |
-
}
|
2055 |
-
|
2056 |
-
// sendmail and mail() extract Bcc from the header before sending
|
2057 |
-
if ((
|
2058 |
-
$this->Mailer == 'sendmail' or $this->Mailer == 'qmail' or $this->Mailer == 'mail'
|
2059 |
-
)
|
2060 |
-
and count($this->bcc) > 0
|
2061 |
-
) {
|
2062 |
-
$result .= $this->addrAppend('Bcc', $this->bcc);
|
2063 |
-
}
|
2064 |
-
|
2065 |
-
if (count($this->ReplyTo) > 0) {
|
2066 |
-
$result .= $this->addrAppend('Reply-To', $this->ReplyTo);
|
2067 |
-
}
|
2068 |
-
|
2069 |
-
// mail() sets the subject itself
|
2070 |
-
if ($this->Mailer != 'mail') {
|
2071 |
-
$result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject)));
|
2072 |
-
}
|
2073 |
-
|
2074 |
-
// Only allow a custom message ID if it conforms to RFC 5322 section 3.6.4
|
2075 |
-
// https://tools.ietf.org/html/rfc5322#section-3.6.4
|
2076 |
-
if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) {
|
2077 |
-
$this->lastMessageID = $this->MessageID;
|
2078 |
-
} else {
|
2079 |
-
$this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname());
|
2080 |
-
}
|
2081 |
-
$result .= $this->headerLine('Message-ID', $this->lastMessageID);
|
2082 |
-
if (!is_null($this->Priority)) {
|
2083 |
-
$result .= $this->headerLine('X-Priority', $this->Priority);
|
2084 |
-
}
|
2085 |
-
if ($this->XMailer == '') {
|
2086 |
-
$result .= $this->headerLine(
|
2087 |
-
'X-Mailer',
|
2088 |
-
'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer)'
|
2089 |
-
);
|
2090 |
-
} else {
|
2091 |
-
$myXmailer = trim($this->XMailer);
|
2092 |
-
if ($myXmailer) {
|
2093 |
-
$result .= $this->headerLine('X-Mailer', $myXmailer);
|
2094 |
-
}
|
2095 |
-
}
|
2096 |
-
|
2097 |
-
if ($this->ConfirmReadingTo != '') {
|
2098 |
-
$result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');
|
2099 |
-
}
|
2100 |
-
|
2101 |
-
// Add custom headers
|
2102 |
-
foreach ($this->CustomHeader as $header) {
|
2103 |
-
$result .= $this->headerLine(
|
2104 |
-
trim($header[0]),
|
2105 |
-
$this->encodeHeader(trim($header[1]))
|
2106 |
-
);
|
2107 |
-
}
|
2108 |
-
if (!$this->sign_key_file) {
|
2109 |
-
$result .= $this->headerLine('MIME-Version', '1.0');
|
2110 |
-
$result .= $this->getMailMIME();
|
2111 |
-
}
|
2112 |
-
|
2113 |
-
return $result;
|
2114 |
-
}
|
2115 |
-
|
2116 |
-
/**
|
2117 |
-
* Get the message MIME type headers.
|
2118 |
-
* @access public
|
2119 |
-
* @return string
|
2120 |
-
*/
|
2121 |
-
public function getMailMIME()
|
2122 |
-
{
|
2123 |
-
$result = '';
|
2124 |
-
$ismultipart = true;
|
2125 |
-
switch ($this->message_type) {
|
2126 |
-
case 'inline':
|
2127 |
-
$result .= $this->headerLine('Content-Type', 'multipart/related;');
|
2128 |
-
$result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
|
2129 |
-
break;
|
2130 |
-
case 'attach':
|
2131 |
-
case 'inline_attach':
|
2132 |
-
case 'alt_attach':
|
2133 |
-
case 'alt_inline_attach':
|
2134 |
-
$result .= $this->headerLine('Content-Type', 'multipart/mixed;');
|
2135 |
-
$result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
|
2136 |
-
break;
|
2137 |
-
case 'alt':
|
2138 |
-
case 'alt_inline':
|
2139 |
-
$result .= $this->headerLine('Content-Type', 'multipart/alternative;');
|
2140 |
-
$result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
|
2141 |
-
break;
|
2142 |
-
default:
|
2143 |
-
// Catches case 'plain': and case '':
|
2144 |
-
$result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
|
2145 |
-
$ismultipart = false;
|
2146 |
-
break;
|
2147 |
-
}
|
2148 |
-
// RFC1341 part 5 says 7bit is assumed if not specified
|
2149 |
-
if ($this->Encoding != '7bit') {
|
2150 |
-
// RFC 2045 section 6.4 says multipart MIME parts may only use 7bit, 8bit or binary CTE
|
2151 |
-
if ($ismultipart) {
|
2152 |
-
if ($this->Encoding == '8bit') {
|
2153 |
-
$result .= $this->headerLine('Content-Transfer-Encoding', '8bit');
|
2154 |
-
}
|
2155 |
-
// The only remaining alternatives are quoted-printable and base64, which are both 7bit compatible
|
2156 |
-
} else {
|
2157 |
-
$result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
|
2158 |
-
}
|
2159 |
-
}
|
2160 |
-
|
2161 |
-
if ($this->Mailer != 'mail') {
|
2162 |
-
$result .= $this->LE;
|
2163 |
-
}
|
2164 |
-
|
2165 |
-
return $result;
|
2166 |
-
}
|
2167 |
-
|
2168 |
-
/**
|
2169 |
-
* Returns the whole MIME message.
|
2170 |
-
* Includes complete headers and body.
|
2171 |
-
* Only valid post preSend().
|
2172 |
-
* @see PHPMailer::preSend()
|
2173 |
-
* @access public
|
2174 |
-
* @return string
|
2175 |
-
*/
|
2176 |
-
public function getSentMIMEMessage()
|
2177 |
-
{
|
2178 |
-
return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody;
|
2179 |
-
}
|
2180 |
-
|
2181 |
-
/**
|
2182 |
-
* Create unique ID
|
2183 |
-
* @return string
|
2184 |
-
*/
|
2185 |
-
protected function generateId() {
|
2186 |
-
return md5(uniqid(time()));
|
2187 |
-
}
|
2188 |
-
|
2189 |
-
/**
|
2190 |
-
* Assemble the message body.
|
2191 |
-
* Returns an empty string on failure.
|
2192 |
-
* @access public
|
2193 |
-
* @throws phpmailerException
|
2194 |
-
* @return string The assembled message body
|
2195 |
-
*/
|
2196 |
-
public function createBody()
|
2197 |
-
{
|
2198 |
-
$body = '';
|
2199 |
-
//Create unique IDs and preset boundaries
|
2200 |
-
$this->uniqueid = $this->generateId();
|
2201 |
-
$this->boundary[1] = 'b1_' . $this->uniqueid;
|
2202 |
-
$this->boundary[2] = 'b2_' . $this->uniqueid;
|
2203 |
-
$this->boundary[3] = 'b3_' . $this->uniqueid;
|
2204 |
-
|
2205 |
-
if ($this->sign_key_file) {
|
2206 |
-
$body .= $this->getMailMIME() . $this->LE;
|
2207 |
-
}
|
2208 |
-
|
2209 |
-
$this->setWordWrap();
|
2210 |
-
|
2211 |
-
$bodyEncoding = $this->Encoding;
|
2212 |
-
$bodyCharSet = $this->CharSet;
|
2213 |
-
//Can we do a 7-bit downgrade?
|
2214 |
-
if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) {
|
2215 |
-
$bodyEncoding = '7bit';
|
2216 |
-
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
|
2217 |
-
$bodyCharSet = 'us-ascii';
|
2218 |
-
}
|
2219 |
-
//If lines are too long, and we're not already using an encoding that will shorten them,
|
2220 |
-
//change to quoted-printable transfer encoding for the body part only
|
2221 |
-
if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) {
|
2222 |
-
$bodyEncoding = 'quoted-printable';
|
2223 |
-
}
|
2224 |
-
|
2225 |
-
$altBodyEncoding = $this->Encoding;
|
2226 |
-
$altBodyCharSet = $this->CharSet;
|
2227 |
-
//Can we do a 7-bit downgrade?
|
2228 |
-
if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) {
|
2229 |
-
$altBodyEncoding = '7bit';
|
2230 |
-
//All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit
|
2231 |
-
$altBodyCharSet = 'us-ascii';
|
2232 |
-
}
|
2233 |
-
//If lines are too long, and we're not already using an encoding that will shorten them,
|
2234 |
-
//change to quoted-printable transfer encoding for the alt body part only
|
2235 |
-
if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) {
|
2236 |
-
$altBodyEncoding = 'quoted-printable';
|
2237 |
-
}
|
2238 |
-
//Use this as a preamble in all multipart message types
|
2239 |
-
$mimepre = "This is a multi-part message in MIME format." . $this->LE . $this->LE;
|
2240 |
-
switch ($this->message_type) {
|
2241 |
-
case 'inline':
|
2242 |
-
$body .= $mimepre;
|
2243 |
-
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
|
2244 |
-
$body .= $this->encodeString($this->Body, $bodyEncoding);
|
2245 |
-
$body .= $this->LE . $this->LE;
|
2246 |
-
$body .= $this->attachAll('inline', $this->boundary[1]);
|
2247 |
-
break;
|
2248 |
-
case 'attach':
|
2249 |
-
$body .= $mimepre;
|
2250 |
-
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, '', $bodyEncoding);
|
2251 |
-
$body .= $this->encodeString($this->Body, $bodyEncoding);
|
2252 |
-
$body .= $this->LE . $this->LE;
|
2253 |
-
$body .= $this->attachAll('attachment', $this->boundary[1]);
|
2254 |
-
break;
|
2255 |
-
case 'inline_attach':
|
2256 |
-
$body .= $mimepre;
|
2257 |
-
$body .= $this->textLine('--' . $this->boundary[1]);
|
2258 |
-
$body .= $this->headerLine('Content-Type', 'multipart/related;');
|
2259 |
-
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
2260 |
-
$body .= $this->LE;
|
2261 |
-
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, '', $bodyEncoding);
|
2262 |
-
$body .= $this->encodeString($this->Body, $bodyEncoding);
|
2263 |
-
$body .= $this->LE . $this->LE;
|
2264 |
-
$body .= $this->attachAll('inline', $this->boundary[2]);
|
2265 |
-
$body .= $this->LE;
|
2266 |
-
$body .= $this->attachAll('attachment', $this->boundary[1]);
|
2267 |
-
break;
|
2268 |
-
case 'alt':
|
2269 |
-
$body .= $mimepre;
|
2270 |
-
$body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
|
2271 |
-
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
|
2272 |
-
$body .= $this->LE . $this->LE;
|
2273 |
-
$body .= $this->getBoundary($this->boundary[1], $bodyCharSet, 'text/html', $bodyEncoding);
|
2274 |
-
$body .= $this->encodeString($this->Body, $bodyEncoding);
|
2275 |
-
$body .= $this->LE . $this->LE;
|
2276 |
-
if (!empty($this->Ical)) {
|
2277 |
-
$body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
|
2278 |
-
$body .= $this->encodeString($this->Ical, $this->Encoding);
|
2279 |
-
$body .= $this->LE . $this->LE;
|
2280 |
-
}
|
2281 |
-
$body .= $this->endBoundary($this->boundary[1]);
|
2282 |
-
break;
|
2283 |
-
case 'alt_inline':
|
2284 |
-
$body .= $mimepre;
|
2285 |
-
$body .= $this->getBoundary($this->boundary[1], $altBodyCharSet, 'text/plain', $altBodyEncoding);
|
2286 |
-
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
|
2287 |
-
$body .= $this->LE . $this->LE;
|
2288 |
-
$body .= $this->textLine('--' . $this->boundary[1]);
|
2289 |
-
$body .= $this->headerLine('Content-Type', 'multipart/related;');
|
2290 |
-
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
2291 |
-
$body .= $this->LE;
|
2292 |
-
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
|
2293 |
-
$body .= $this->encodeString($this->Body, $bodyEncoding);
|
2294 |
-
$body .= $this->LE . $this->LE;
|
2295 |
-
$body .= $this->attachAll('inline', $this->boundary[2]);
|
2296 |
-
$body .= $this->LE;
|
2297 |
-
$body .= $this->endBoundary($this->boundary[1]);
|
2298 |
-
break;
|
2299 |
-
case 'alt_attach':
|
2300 |
-
$body .= $mimepre;
|
2301 |
-
$body .= $this->textLine('--' . $this->boundary[1]);
|
2302 |
-
$body .= $this->headerLine('Content-Type', 'multipart/alternative;');
|
2303 |
-
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
2304 |
-
$body .= $this->LE;
|
2305 |
-
$body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
|
2306 |
-
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
|
2307 |
-
$body .= $this->LE . $this->LE;
|
2308 |
-
$body .= $this->getBoundary($this->boundary[2], $bodyCharSet, 'text/html', $bodyEncoding);
|
2309 |
-
$body .= $this->encodeString($this->Body, $bodyEncoding);
|
2310 |
-
$body .= $this->LE . $this->LE;
|
2311 |
-
$body .= $this->endBoundary($this->boundary[2]);
|
2312 |
-
$body .= $this->LE;
|
2313 |
-
$body .= $this->attachAll('attachment', $this->boundary[1]);
|
2314 |
-
break;
|
2315 |
-
case 'alt_inline_attach':
|
2316 |
-
$body .= $mimepre;
|
2317 |
-
$body .= $this->textLine('--' . $this->boundary[1]);
|
2318 |
-
$body .= $this->headerLine('Content-Type', 'multipart/alternative;');
|
2319 |
-
$body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
|
2320 |
-
$body .= $this->LE;
|
2321 |
-
$body .= $this->getBoundary($this->boundary[2], $altBodyCharSet, 'text/plain', $altBodyEncoding);
|
2322 |
-
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
|
2323 |
-
$body .= $this->LE . $this->LE;
|
2324 |
-
$body .= $this->textLine('--' . $this->boundary[2]);
|
2325 |
-
$body .= $this->headerLine('Content-Type', 'multipart/related;');
|
2326 |
-
$body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
|
2327 |
-
$body .= $this->LE;
|
2328 |
-
$body .= $this->getBoundary($this->boundary[3], $bodyCharSet, 'text/html', $bodyEncoding);
|
2329 |
-
$body .= $this->encodeString($this->Body, $bodyEncoding);
|
2330 |
-
$body .= $this->LE . $this->LE;
|
2331 |
-
$body .= $this->attachAll('inline', $this->boundary[3]);
|
2332 |
-
$body .= $this->LE;
|
2333 |
-
$body .= $this->endBoundary($this->boundary[2]);
|
2334 |
-
$body .= $this->LE;
|
2335 |
-
$body .= $this->attachAll('attachment', $this->boundary[1]);
|
2336 |
-
break;
|
2337 |
-
default:
|
2338 |
-
// Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types
|
2339 |
-
//Reset the `Encoding` property in case we changed it for line length reasons
|
2340 |
-
$this->Encoding = $bodyEncoding;
|
2341 |
-
$body .= $this->encodeString($this->Body, $this->Encoding);
|
2342 |
-
break;
|
2343 |
-
}
|
2344 |
-
|
2345 |
-
if ($this->isError()) {
|
2346 |
-
$body = '';
|
2347 |
-
} elseif ($this->sign_key_file) {
|
2348 |
-
try {
|
2349 |
-
if (!defined('PKCS7_TEXT')) {
|
2350 |
-
throw new phpmailerException($this->lang('extension_missing') . 'openssl');
|
2351 |
-
}
|
2352 |
-
// @TODO would be nice to use php://temp streams here, but need to wrap for PHP < 5.1
|
2353 |
-
$file = tempnam(sys_get_temp_dir(), 'mail');
|
2354 |
-
if (false === file_put_contents($file, $body)) {
|
2355 |
-
throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
|
2356 |
-
}
|
2357 |
-
$signed = tempnam(sys_get_temp_dir(), 'signed');
|
2358 |
-
//Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
|
2359 |
-
if (empty($this->sign_extracerts_file)) {
|
2360 |
-
$sign = @openssl_pkcs7_sign(
|
2361 |
-
$file,
|
2362 |
-
$signed,
|
2363 |
-
'file://' . realpath($this->sign_cert_file),
|
2364 |
-
array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
|
2365 |
-
null
|
2366 |
-
);
|
2367 |
-
} else {
|
2368 |
-
$sign = @openssl_pkcs7_sign(
|
2369 |
-
$file,
|
2370 |
-
$signed,
|
2371 |
-
'file://' . realpath($this->sign_cert_file),
|
2372 |
-
array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
|
2373 |
-
null,
|
2374 |
-
PKCS7_DETACHED,
|
2375 |
-
$this->sign_extracerts_file
|
2376 |
-
);
|
2377 |
-
}
|
2378 |
-
if ($sign) {
|
2379 |
-
@unlink($file);
|
2380 |
-
$body = file_get_contents($signed);
|
2381 |
-
@unlink($signed);
|
2382 |
-
//The message returned by openssl contains both headers and body, so need to split them up
|
2383 |
-
$parts = explode("\n\n", $body, 2);
|
2384 |
-
$this->MIMEHeader .= $parts[0] . $this->LE . $this->LE;
|
2385 |
-
$body = $parts[1];
|
2386 |
-
} else {
|
2387 |
-
@unlink($file);
|
2388 |
-
@unlink($signed);
|
2389 |
-
throw new phpmailerException($this->lang('signing') . openssl_error_string());
|
2390 |
-
}
|
2391 |
-
} catch (phpmailerException $exc) {
|
2392 |
-
$body = '';
|
2393 |
-
if ($this->exceptions) {
|
2394 |
-
throw $exc;
|
2395 |
-
}
|
2396 |
-
}
|
2397 |
-
}
|
2398 |
-
return $body;
|
2399 |
-
}
|
2400 |
-
|
2401 |
-
/**
|
2402 |
-
* Return the start of a message boundary.
|
2403 |
-
* @access protected
|
2404 |
-
* @param string $boundary
|
2405 |
-
* @param string $charSet
|
2406 |
-
* @param string $contentType
|
2407 |
-
* @param string $encoding
|
2408 |
-
* @return string
|
2409 |
-
*/
|
2410 |
-
protected function getBoundary($boundary, $charSet, $contentType, $encoding)
|
2411 |
-
{
|
2412 |
-
$result = '';
|
2413 |
-
if ($charSet == '') {
|
2414 |
-
$charSet = $this->CharSet;
|
2415 |
-
}
|
2416 |
-
if ($contentType == '') {
|
2417 |
-
$contentType = $this->ContentType;
|
2418 |
-
}
|
2419 |
-
if ($encoding == '') {
|
2420 |
-
$encoding = $this->Encoding;
|
2421 |
-
}
|
2422 |
-
$result .= $this->textLine('--' . $boundary);
|
2423 |
-
$result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
|
2424 |
-
$result .= $this->LE;
|
2425 |
-
// RFC1341 part 5 says 7bit is assumed if not specified
|
2426 |
-
if ($encoding != '7bit') {
|
2427 |
-
$result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
|
2428 |
-
}
|
2429 |
-
$result .= $this->LE;
|
2430 |
-
|
2431 |
-
return $result;
|
2432 |
-
}
|
2433 |
-
|
2434 |
-
/**
|
2435 |
-
* Return the end of a message boundary.
|
2436 |
-
* @access protected
|
2437 |
-
* @param string $boundary
|
2438 |
-
* @return string
|
2439 |
-
*/
|
2440 |
-
protected function endBoundary($boundary)
|
2441 |
-
{
|
2442 |
-
return $this->LE . '--' . $boundary . '--' . $this->LE;
|
2443 |
-
}
|
2444 |
-
|
2445 |
-
/**
|
2446 |
-
* Set the message type.
|
2447 |
-
* PHPMailer only supports some preset message types, not arbitrary MIME structures.
|
2448 |
-
* @access protected
|
2449 |
-
* @return void
|
2450 |
-
*/
|
2451 |
-
protected function setMessageType()
|
2452 |
-
{
|
2453 |
-
$type = array();
|
2454 |
-
if ($this->alternativeExists()) {
|
2455 |
-
$type[] = 'alt';
|
2456 |
-
}
|
2457 |
-
if ($this->inlineImageExists()) {
|
2458 |
-
$type[] = 'inline';
|
2459 |
-
}
|
2460 |
-
if ($this->attachmentExists()) {
|
2461 |
-
$type[] = 'attach';
|
2462 |
-
}
|
2463 |
-
$this->message_type = implode('_', $type);
|
2464 |
-
if ($this->message_type == '') {
|
2465 |
-
//The 'plain' message_type refers to the message having a single body element, not that it is plain-text
|
2466 |
-
$this->message_type = 'plain';
|
2467 |
-
}
|
2468 |
-
}
|
2469 |
-
|
2470 |
-
/**
|
2471 |
-
* Format a header line.
|
2472 |
-
* @access public
|
2473 |
-
* @param string $name
|
2474 |
-
* @param string $value
|
2475 |
-
* @return string
|
2476 |
-
*/
|
2477 |
-
public function headerLine($name, $value)
|
2478 |
-
{
|
2479 |
-
return $name . ': ' . $value . $this->LE;
|
2480 |
-
}
|
2481 |
-
|
2482 |
-
/**
|
2483 |
-
* Return a formatted mail line.
|
2484 |
-
* @access public
|
2485 |
-
* @param string $value
|
2486 |
-
* @return string
|
2487 |
-
*/
|
2488 |
-
public function textLine($value)
|
2489 |
-
{
|
2490 |
-
return $value . $this->LE;
|
2491 |
-
}
|
2492 |
-
|
2493 |
-
/**
|
2494 |
-
* Add an attachment from a path on the filesystem.
|
2495 |
-
* Never use a user-supplied path to a file!
|
2496 |
-
* Returns false if the file could not be found or read.
|
2497 |
-
* @param string $path Path to the attachment.
|
2498 |
-
* @param string $name Overrides the attachment name.
|
2499 |
-
* @param string $encoding File encoding (see $Encoding).
|
2500 |
-
* @param string $type File extension (MIME) type.
|
2501 |
-
* @param string $disposition Disposition to use
|
2502 |
-
* @throws phpmailerException
|
2503 |
-
* @return boolean
|
2504 |
-
*/
|
2505 |
-
public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
|
2506 |
-
{
|
2507 |
-
try {
|
2508 |
-
if (!@is_file($path)) {
|
2509 |
-
throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
|
2510 |
-
}
|
2511 |
-
|
2512 |
-
// If a MIME type is not specified, try to work it out from the file name
|
2513 |
-
if ($type == '') {
|
2514 |
-
$type = self::filenameToType($path);
|
2515 |
-
}
|
2516 |
-
|
2517 |
-
$filename = basename($path);
|
2518 |
-
if ($name == '') {
|
2519 |
-
$name = $filename;
|
2520 |
-
}
|
2521 |
-
|
2522 |
-
$this->attachment[] = array(
|
2523 |
-
0 => $path,
|
2524 |
-
1 => $filename,
|
2525 |
-
2 => $name,
|
2526 |
-
3 => $encoding,
|
2527 |
-
4 => $type,
|
2528 |
-
5 => false, // isStringAttachment
|
2529 |
-
6 => $disposition,
|
2530 |
-
7 => 0
|
2531 |
-
);
|
2532 |
-
|
2533 |
-
} catch (phpmailerException $exc) {
|
2534 |
-
$this->setError($exc->getMessage());
|
2535 |
-
$this->edebug($exc->getMessage());
|
2536 |
-
if ($this->exceptions) {
|
2537 |
-
throw $exc;
|
2538 |
-
}
|
2539 |
-
return false;
|
2540 |
-
}
|
2541 |
-
return true;
|
2542 |
-
}
|
2543 |
-
|
2544 |
-
/**
|
2545 |
-
* Return the array of attachments.
|
2546 |
-
* @return array
|
2547 |
-
*/
|
2548 |
-
public function getAttachments()
|
2549 |
-
{
|
2550 |
-
return $this->attachment;
|
2551 |
-
}
|
2552 |
-
|
2553 |
-
/**
|
2554 |
-
* Attach all file, string, and binary attachments to the message.
|
2555 |
-
* Returns an empty string on failure.
|
2556 |
-
* @access protected
|
2557 |
-
* @param string $disposition_type
|
2558 |
-
* @param string $boundary
|
2559 |
-
* @return string
|
2560 |
-
*/
|
2561 |
-
protected function attachAll($disposition_type, $boundary)
|
2562 |
-
{
|
2563 |
-
// Return text of body
|
2564 |
-
$mime = array();
|
2565 |
-
$cidUniq = array();
|
2566 |
-
$incl = array();
|
2567 |
-
|
2568 |
-
// Add all attachments
|
2569 |
-
foreach ($this->attachment as $attachment) {
|
2570 |
-
// Check if it is a valid disposition_filter
|
2571 |
-
if ($attachment[6] == $disposition_type) {
|
2572 |
-
// Check for string attachment
|
2573 |
-
$string = '';
|
2574 |
-
$path = '';
|
2575 |
-
$bString = $attachment[5];
|
2576 |
-
if ($bString) {
|
2577 |
-
$string = $attachment[0];
|
2578 |
-
} else {
|
2579 |
-
$path = $attachment[0];
|
2580 |
-
}
|
2581 |
-
|
2582 |
-
$inclhash = md5(serialize($attachment));
|
2583 |
-
if (in_array($inclhash, $incl)) {
|
2584 |
-
continue;
|
2585 |
-
}
|
2586 |
-
$incl[] = $inclhash;
|
2587 |
-
$name = $attachment[2];
|
2588 |
-
$encoding = $attachment[3];
|
2589 |
-
$type = $attachment[4];
|
2590 |
-
$disposition = $attachment[6];
|
2591 |
-
$cid = $attachment[7];
|
2592 |
-
if ($disposition == 'inline' && array_key_exists($cid, $cidUniq)) {
|
2593 |
-
continue;
|
2594 |
-
}
|
2595 |
-
$cidUniq[$cid] = true;
|
2596 |
-
|
2597 |
-
$mime[] = sprintf('--%s%s', $boundary, $this->LE);
|
2598 |
-
//Only include a filename property if we have one
|
2599 |
-
if (!empty($name)) {
|
2600 |
-
$mime[] = sprintf(
|
2601 |
-
'Content-Type: %s; name="%s"%s',
|
2602 |
-
$type,
|
2603 |
-
$this->encodeHeader($this->secureHeader($name)),
|
2604 |
-
$this->LE
|
2605 |
-
);
|
2606 |
-
} else {
|
2607 |
-
$mime[] = sprintf(
|
2608 |
-
'Content-Type: %s%s',
|
2609 |
-
$type,
|
2610 |
-
$this->LE
|
2611 |
-
);
|
2612 |
-
}
|
2613 |
-
// RFC1341 part 5 says 7bit is assumed if not specified
|
2614 |
-
if ($encoding != '7bit') {
|
2615 |
-
$mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, $this->LE);
|
2616 |
-
}
|
2617 |
-
|
2618 |
-
if ($disposition == 'inline') {
|
2619 |
-
$mime[] = sprintf('Content-ID: <%s>%s', $cid, $this->LE);
|
2620 |
-
}
|
2621 |
-
|
2622 |
-
// If a filename contains any of these chars, it should be quoted,
|
2623 |
-
// but not otherwise: RFC2183 & RFC2045 5.1
|
2624 |
-
// Fixes a warning in IETF's msglint MIME checker
|
2625 |
-
// Allow for bypassing the Content-Disposition header totally
|
2626 |
-
if (!(empty($disposition))) {
|
2627 |
-
$encoded_name = $this->encodeHeader($this->secureHeader($name));
|
2628 |
-
if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $encoded_name)) {
|
2629 |
-
$mime[] = sprintf(
|
2630 |
-
'Content-Disposition: %s; filename="%s"%s',
|
2631 |
-
$disposition,
|
2632 |
-
$encoded_name,
|
2633 |
-
$this->LE . $this->LE
|
2634 |
-
);
|
2635 |
-
} else {
|
2636 |
-
if (!empty($encoded_name)) {
|
2637 |
-
$mime[] = sprintf(
|
2638 |
-
'Content-Disposition: %s; filename=%s%s',
|
2639 |
-
$disposition,
|
2640 |
-
$encoded_name,
|
2641 |
-
$this->LE . $this->LE
|
2642 |
-
);
|
2643 |
-
} else {
|
2644 |
-
$mime[] = sprintf(
|
2645 |
-
'Content-Disposition: %s%s',
|
2646 |
-
$disposition,
|
2647 |
-
$this->LE . $this->LE
|
2648 |
-
);
|
2649 |
-
}
|
2650 |
-
}
|
2651 |
-
} else {
|
2652 |
-
$mime[] = $this->LE;
|
2653 |
-
}
|
2654 |
-
|
2655 |
-
// Encode as string attachment
|
2656 |
-
if ($bString) {
|
2657 |
-
$mime[] = $this->encodeString($string, $encoding);
|
2658 |
-
if ($this->isError()) {
|
2659 |
-
return '';
|
2660 |
-
}
|
2661 |
-
$mime[] = $this->LE . $this->LE;
|
2662 |
-
} else {
|
2663 |
-
$mime[] = $this->encodeFile($path, $encoding);
|
2664 |
-
if ($this->isError()) {
|
2665 |
-
return '';
|
2666 |
-
}
|
2667 |
-
$mime[] = $this->LE . $this->LE;
|
2668 |
-
}
|
2669 |
-
}
|
2670 |
-
}
|
2671 |
-
|
2672 |
-
$mime[] = sprintf('--%s--%s', $boundary, $this->LE);
|
2673 |
-
|
2674 |
-
return implode('', $mime);
|
2675 |
-
}
|
2676 |
-
|
2677 |
-
/**
|
2678 |
-
* Encode a file attachment in requested format.
|
2679 |
-
* Returns an empty string on failure.
|
2680 |
-
* @param string $path The full path to the file
|
2681 |
-
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
|
2682 |
-
* @throws phpmailerException
|
2683 |
-
* @access protected
|
2684 |
-
* @return string
|
2685 |
-
*/
|
2686 |
-
protected function encodeFile($path, $encoding = 'base64')
|
2687 |
-
{
|
2688 |
-
try {
|
2689 |
-
if (!is_readable($path)) {
|
2690 |
-
throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
|
2691 |
-
}
|
2692 |
-
$magic_quotes = get_magic_quotes_runtime();
|
2693 |
-
if ($magic_quotes) {
|
2694 |
-
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
2695 |
-
set_magic_quotes_runtime(false);
|
2696 |
-
} else {
|
2697 |
-
//Doesn't exist in PHP 5.4, but we don't need to check because
|
2698 |
-
//get_magic_quotes_runtime always returns false in 5.4+
|
2699 |
-
//so it will never get here
|
2700 |
-
ini_set('magic_quotes_runtime', false);
|
2701 |
-
}
|
2702 |
-
}
|
2703 |
-
$file_buffer = file_get_contents($path);
|
2704 |
-
$file_buffer = $this->encodeString($file_buffer, $encoding);
|
2705 |
-
if ($magic_quotes) {
|
2706 |
-
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
2707 |
-
set_magic_quotes_runtime($magic_quotes);
|
2708 |
-
} else {
|
2709 |
-
ini_set('magic_quotes_runtime', $magic_quotes);
|
2710 |
-
}
|
2711 |
-
}
|
2712 |
-
return $file_buffer;
|
2713 |
-
} catch (Exception $exc) {
|
2714 |
-
$this->setError($exc->getMessage());
|
2715 |
-
return '';
|
2716 |
-
}
|
2717 |
-
}
|
2718 |
-
|
2719 |
-
/**
|
2720 |
-
* Encode a string in requested format.
|
2721 |
-
* Returns an empty string on failure.
|
2722 |
-
* @param string $str The text to encode
|
2723 |
-
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
|
2724 |
-
* @access public
|
2725 |
-
* @return string
|
2726 |
-
*/
|
2727 |
-
public function encodeString($str, $encoding = 'base64')
|
2728 |
-
{
|
2729 |
-
$encoded = '';
|
2730 |
-
switch (strtolower($encoding)) {
|
2731 |
-
case 'base64':
|
2732 |
-
$encoded = chunk_split(base64_encode($str), 76, $this->LE);
|
2733 |
-
break;
|
2734 |
-
case '7bit':
|
2735 |
-
case '8bit':
|
2736 |
-
$encoded = $this->fixEOL($str);
|
2737 |
-
// Make sure it ends with a line break
|
2738 |
-
if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
|
2739 |
-
$encoded .= $this->LE;
|
2740 |
-
}
|
2741 |
-
break;
|
2742 |
-
case 'binary':
|
2743 |
-
$encoded = $str;
|
2744 |
-
break;
|
2745 |
-
case 'quoted-printable':
|
2746 |
-
$encoded = $this->encodeQP($str);
|
2747 |
-
break;
|
2748 |
-
default:
|
2749 |
-
$this->setError($this->lang('encoding') . $encoding);
|
2750 |
-
break;
|
2751 |
-
}
|
2752 |
-
return $encoded;
|
2753 |
-
}
|
2754 |
-
|
2755 |
-
/**
|
2756 |
-
* Encode a header string optimally.
|
2757 |
-
* Picks shortest of Q, B, quoted-printable or none.
|
2758 |
-
* @access public
|
2759 |
-
* @param string $str
|
2760 |
-
* @param string $position
|
2761 |
-
* @return string
|
2762 |
-
*/
|
2763 |
-
public function encodeHeader($str, $position = 'text')
|
2764 |
-
{
|
2765 |
-
$matchcount = 0;
|
2766 |
-
switch (strtolower($position)) {
|
2767 |
-
case 'phrase':
|
2768 |
-
if (!preg_match('/[\200-\377]/', $str)) {
|
2769 |
-
// Can't use addslashes as we don't know the value of magic_quotes_sybase
|
2770 |
-
$encoded = addcslashes($str, "\0..\37\177\\\"");
|
2771 |
-
if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
|
2772 |
-
return ($encoded);
|
2773 |
-
} else {
|
2774 |
-
return ("\"$encoded\"");
|
2775 |
-
}
|
2776 |
-
}
|
2777 |
-
$matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
|
2778 |
-
break;
|
2779 |
-
/** @noinspection PhpMissingBreakStatementInspection */
|
2780 |
-
case 'comment':
|
2781 |
-
$matchcount = preg_match_all('/[()"]/', $str, $matches);
|
2782 |
-
// Intentional fall-through
|
2783 |
-
case 'text':
|
2784 |
-
default:
|
2785 |
-
$matchcount += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
|
2786 |
-
break;
|
2787 |
-
}
|
2788 |
-
|
2789 |
-
//There are no chars that need encoding
|
2790 |
-
if ($matchcount == 0) {
|
2791 |
-
return ($str);
|
2792 |
-
}
|
2793 |
-
|
2794 |
-
$maxlen = 75 - 7 - strlen($this->CharSet);
|
2795 |
-
// Try to select the encoding which should produce the shortest output
|
2796 |
-
if ($matchcount > strlen($str) / 3) {
|
2797 |
-
// More than a third of the content will need encoding, so B encoding will be most efficient
|
2798 |
-
$encoding = 'B';
|
2799 |
-
if (function_exists('mb_strlen') && $this->hasMultiBytes($str)) {
|
2800 |
-
// Use a custom function which correctly encodes and wraps long
|
2801 |
-
// multibyte strings without breaking lines within a character
|
2802 |
-
$encoded = $this->base64EncodeWrapMB($str, "\n");
|
2803 |
-
} else {
|
2804 |
-
$encoded = base64_encode($str);
|
2805 |
-
$maxlen -= $maxlen % 4;
|
2806 |
-
$encoded = trim(chunk_split($encoded, $maxlen, "\n"));
|
2807 |
-
}
|
2808 |
-
} else {
|
2809 |
-
$encoding = 'Q';
|
2810 |
-
$encoded = $this->encodeQ($str, $position);
|
2811 |
-
$encoded = $this->wrapText($encoded, $maxlen, true);
|
2812 |
-
$encoded = str_replace('=' . self::CRLF, "\n", trim($encoded));
|
2813 |
-
}
|
2814 |
-
|
2815 |
-
$encoded = preg_replace('/^(.*)$/m', ' =?' . $this->CharSet . "?$encoding?\\1?=", $encoded);
|
2816 |
-
$encoded = trim(str_replace("\n", $this->LE, $encoded));
|
2817 |
-
|
2818 |
-
return $encoded;
|
2819 |
-
}
|
2820 |
-
|
2821 |
-
/**
|
2822 |
-
* Check if a string contains multi-byte characters.
|
2823 |
-
* @access public
|
2824 |
-
* @param string $str multi-byte text to wrap encode
|
2825 |
-
* @return boolean
|
2826 |
-
*/
|
2827 |
-
public function hasMultiBytes($str)
|
2828 |
-
{
|
2829 |
-
if (function_exists('mb_strlen')) {
|
2830 |
-
return (strlen($str) > mb_strlen($str, $this->CharSet));
|
2831 |
-
} else { // Assume no multibytes (we can't handle without mbstring functions anyway)
|
2832 |
-
return false;
|
2833 |
-
}
|
2834 |
-
}
|
2835 |
-
|
2836 |
-
/**
|
2837 |
-
* Does a string contain any 8-bit chars (in any charset)?
|
2838 |
-
* @param string $text
|
2839 |
-
* @return boolean
|
2840 |
-
*/
|
2841 |
-
public function has8bitChars($text)
|
2842 |
-
{
|
2843 |
-
return (boolean)preg_match('/[\x80-\xFF]/', $text);
|
2844 |
-
}
|
2845 |
-
|
2846 |
-
/**
|
2847 |
-
* Encode and wrap long multibyte strings for mail headers
|
2848 |
-
* without breaking lines within a character.
|
2849 |
-
* Adapted from a function by paravoid
|
2850 |
-
* @link http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
|
2851 |
-
* @access public
|
2852 |
-
* @param string $str multi-byte text to wrap encode
|
2853 |
-
* @param string $linebreak string to use as linefeed/end-of-line
|
2854 |
-
* @return string
|
2855 |
-
*/
|
2856 |
-
public function base64EncodeWrapMB($str, $linebreak = null)
|
2857 |
-
{
|
2858 |
-
$start = '=?' . $this->CharSet . '?B?';
|
2859 |
-
$end = '?=';
|
2860 |
-
$encoded = '';
|
2861 |
-
if ($linebreak === null) {
|
2862 |
-
$linebreak = $this->LE;
|
2863 |
-
}
|
2864 |
-
|
2865 |
-
$mb_length = mb_strlen($str, $this->CharSet);
|
2866 |
-
// Each line must have length <= 75, including $start and $end
|
2867 |
-
$length = 75 - strlen($start) - strlen($end);
|
2868 |
-
// Average multi-byte ratio
|
2869 |
-
$ratio = $mb_length / strlen($str);
|
2870 |
-
// Base64 has a 4:3 ratio
|
2871 |
-
$avgLength = floor($length * $ratio * .75);
|
2872 |
-
|
2873 |
-
for ($i = 0; $i < $mb_length; $i += $offset) {
|
2874 |
-
$lookBack = 0;
|
2875 |
-
do {
|
2876 |
-
$offset = $avgLength - $lookBack;
|
2877 |
-
$chunk = mb_substr($str, $i, $offset, $this->CharSet);
|
2878 |
-
$chunk = base64_encode($chunk);
|
2879 |
-
$lookBack++;
|
2880 |
-
} while (strlen($chunk) > $length);
|
2881 |
-
$encoded .= $chunk . $linebreak;
|
2882 |
-
}
|
2883 |
-
|
2884 |
-
// Chomp the last linefeed
|
2885 |
-
$encoded = substr($encoded, 0, -strlen($linebreak));
|
2886 |
-
return $encoded;
|
2887 |
-
}
|
2888 |
-
|
2889 |
-
/**
|
2890 |
-
* Encode a string in quoted-printable format.
|
2891 |
-
* According to RFC2045 section 6.7.
|
2892 |
-
* @access public
|
2893 |
-
* @param string $string The text to encode
|
2894 |
-
* @param integer $line_max Number of chars allowed on a line before wrapping
|
2895 |
-
* @return string
|
2896 |
-
* @link http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 Adapted from this comment
|
2897 |
-
*/
|
2898 |
-
public function encodeQP($string, $line_max = 76)
|
2899 |
-
{
|
2900 |
-
// Use native function if it's available (>= PHP5.3)
|
2901 |
-
if (function_exists('quoted_printable_encode')) {
|
2902 |
-
return quoted_printable_encode($string);
|
2903 |
-
}
|
2904 |
-
// Fall back to a pure PHP implementation
|
2905 |
-
$string = str_replace(
|
2906 |
-
array('%20', '%0D%0A.', '%0D%0A', '%'),
|
2907 |
-
array(' ', "\r\n=2E", "\r\n", '='),
|
2908 |
-
rawurlencode($string)
|
2909 |
-
);
|
2910 |
-
return preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
|
2911 |
-
}
|
2912 |
-
|
2913 |
-
/**
|
2914 |
-
* Backward compatibility wrapper for an old QP encoding function that was removed.
|
2915 |
-
* @see PHPMailer::encodeQP()
|
2916 |
-
* @access public
|
2917 |
-
* @param string $string
|
2918 |
-
* @param integer $line_max
|
2919 |
-
* @param boolean $space_conv
|
2920 |
-
* @return string
|
2921 |
-
* @deprecated Use encodeQP instead.
|
2922 |
-
*/
|
2923 |
-
public function encodeQPphp(
|
2924 |
-
$string,
|
2925 |
-
$line_max = 76,
|
2926 |
-
/** @noinspection PhpUnusedParameterInspection */ $space_conv = false
|
2927 |
-
) {
|
2928 |
-
return $this->encodeQP($string, $line_max);
|
2929 |
-
}
|
2930 |
-
|
2931 |
-
/**
|
2932 |
-
* Encode a string using Q encoding.
|
2933 |
-
* @link http://tools.ietf.org/html/rfc2047
|
2934 |
-
* @param string $str the text to encode
|
2935 |
-
* @param string $position Where the text is going to be used, see the RFC for what that means
|
2936 |
-
* @access public
|
2937 |
-
* @return string
|
2938 |
-
*/
|
2939 |
-
public function encodeQ($str, $position = 'text')
|
2940 |
-
{
|
2941 |
-
// There should not be any EOL in the string
|
2942 |
-
$pattern = '';
|
2943 |
-
$encoded = str_replace(array("\r", "\n"), '', $str);
|
2944 |
-
switch (strtolower($position)) {
|
2945 |
-
case 'phrase':
|
2946 |
-
// RFC 2047 section 5.3
|
2947 |
-
$pattern = '^A-Za-z0-9!*+\/ -';
|
2948 |
-
break;
|
2949 |
-
/** @noinspection PhpMissingBreakStatementInspection */
|
2950 |
-
case 'comment':
|
2951 |
-
// RFC 2047 section 5.2
|
2952 |
-
$pattern = '\(\)"';
|
2953 |
-
// intentional fall-through
|
2954 |
-
// for this reason we build the $pattern without including delimiters and []
|
2955 |
-
case 'text':
|
2956 |
-
default:
|
2957 |
-
// RFC 2047 section 5.1
|
2958 |
-
// Replace every high ascii, control, =, ? and _ characters
|
2959 |
-
$pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
|
2960 |
-
break;
|
2961 |
-
}
|
2962 |
-
$matches = array();
|
2963 |
-
if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
|
2964 |
-
// If the string contains an '=', make sure it's the first thing we replace
|
2965 |
-
// so as to avoid double-encoding
|
2966 |
-
$eqkey = array_search('=', $matches[0]);
|
2967 |
-
if (false !== $eqkey) {
|
2968 |
-
unset($matches[0][$eqkey]);
|
2969 |
-
array_unshift($matches[0], '=');
|
2970 |
-
}
|
2971 |
-
foreach (array_unique($matches[0]) as $char) {
|
2972 |
-
$encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
|
2973 |
-
}
|
2974 |
-
}
|
2975 |
-
// Replace every spaces to _ (more readable than =20)
|
2976 |
-
return str_replace(' ', '_', $encoded);
|
2977 |
-
}
|
2978 |
-
|
2979 |
-
/**
|
2980 |
-
* Add a string or binary attachment (non-filesystem).
|
2981 |
-
* This method can be used to attach ascii or binary data,
|
2982 |
-
* such as a BLOB record from a database.
|
2983 |
-
* @param string $string String attachment data.
|
2984 |
-
* @param string $filename Name of the attachment.
|
2985 |
-
* @param string $encoding File encoding (see $Encoding).
|
2986 |
-
* @param string $type File extension (MIME) type.
|
2987 |
-
* @param string $disposition Disposition to use
|
2988 |
-
* @return void
|
2989 |
-
*/
|
2990 |
-
public function addStringAttachment(
|
2991 |
-
$string,
|
2992 |
-
$filename,
|
2993 |
-
$encoding = 'base64',
|
2994 |
-
$type = '',
|
2995 |
-
$disposition = 'attachment'
|
2996 |
-
) {
|
2997 |
-
// If a MIME type is not specified, try to work it out from the file name
|
2998 |
-
if ($type == '') {
|
2999 |
-
$type = self::filenameToType($filename);
|
3000 |
-
}
|
3001 |
-
// Append to $attachment array
|
3002 |
-
$this->attachment[] = array(
|
3003 |
-
0 => $string,
|
3004 |
-
1 => $filename,
|
3005 |
-
2 => basename($filename),
|
3006 |
-
3 => $encoding,
|
3007 |
-
4 => $type,
|
3008 |
-
5 => true, // isStringAttachment
|
3009 |
-
6 => $disposition,
|
3010 |
-
7 => 0
|
3011 |
-
);
|
3012 |
-
}
|
3013 |
-
|
3014 |
-
/**
|
3015 |
-
* Add an embedded (inline) attachment from a file.
|
3016 |
-
* This can include images, sounds, and just about any other document type.
|
3017 |
-
* These differ from 'regular' attachments in that they are intended to be
|
3018 |
-
* displayed inline with the message, not just attached for download.
|
3019 |
-
* This is used in HTML messages that embed the images
|
3020 |
-
* the HTML refers to using the $cid value.
|
3021 |
-
* Never use a user-supplied path to a file!
|
3022 |
-
* @param string $path Path to the attachment.
|
3023 |
-
* @param string $cid Content ID of the attachment; Use this to reference
|
3024 |
-
* the content when using an embedded image in HTML.
|
3025 |
-
* @param string $name Overrides the attachment name.
|
3026 |
-
* @param string $encoding File encoding (see $Encoding).
|
3027 |
-
* @param string $type File MIME type.
|
3028 |
-
* @param string $disposition Disposition to use
|
3029 |
-
* @return boolean True on successfully adding an attachment
|
3030 |
-
*/
|
3031 |
-
public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
|
3032 |
-
{
|
3033 |
-
if (!@is_file($path)) {
|
3034 |
-
$this->setError($this->lang('file_access') . $path);
|
3035 |
-
return false;
|
3036 |
-
}
|
3037 |
-
|
3038 |
-
// If a MIME type is not specified, try to work it out from the file name
|
3039 |
-
if ($type == '') {
|
3040 |
-
$type = self::filenameToType($path);
|
3041 |
-
}
|
3042 |
-
|
3043 |
-
$filename = basename($path);
|
3044 |
-
if ($name == '') {
|
3045 |
-
$name = $filename;
|
3046 |
-
}
|
3047 |
-
|
3048 |
-
// Append to $attachment array
|
3049 |
-
$this->attachment[] = array(
|
3050 |
-
0 => $path,
|
3051 |
-
1 => $filename,
|
3052 |
-
2 => $name,
|
3053 |
-
3 => $encoding,
|
3054 |
-
4 => $type,
|
3055 |
-
5 => false, // isStringAttachment
|
3056 |
-
6 => $disposition,
|
3057 |
-
7 => $cid
|
3058 |
-
);
|
3059 |
-
return true;
|
3060 |
-
}
|
3061 |
-
|
3062 |
-
/**
|
3063 |
-
* Add an embedded stringified attachment.
|
3064 |
-
* This can include images, sounds, and just about any other document type.
|
3065 |
-
* Be sure to set the $type to an image type for images:
|
3066 |
-
* JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
|
3067 |
-
* @param string $string The attachment binary data.
|
3068 |
-
* @param string $cid Content ID of the attachment; Use this to reference
|
3069 |
-
* the content when using an embedded image in HTML.
|
3070 |
-
* @param string $name
|
3071 |
-
* @param string $encoding File encoding (see $Encoding).
|
3072 |
-
* @param string $type MIME type.
|
3073 |
-
* @param string $disposition Disposition to use
|
3074 |
-
* @return boolean True on successfully adding an attachment
|
3075 |
-
*/
|
3076 |
-
public function addStringEmbeddedImage(
|
3077 |
-
$string,
|
3078 |
-
$cid,
|
3079 |
-
$name = '',
|
3080 |
-
$encoding = 'base64',
|
3081 |
-
$type = '',
|
3082 |
-
$disposition = 'inline'
|
3083 |
-
) {
|
3084 |
-
// If a MIME type is not specified, try to work it out from the name
|
3085 |
-
if ($type == '' and !empty($name)) {
|
3086 |
-
$type = self::filenameToType($name);
|
3087 |
-
}
|
3088 |
-
|
3089 |
-
// Append to $attachment array
|
3090 |
-
$this->attachment[] = array(
|
3091 |
-
0 => $string,
|
3092 |
-
1 => $name,
|
3093 |
-
2 => $name,
|
3094 |
-
3 => $encoding,
|
3095 |
-
4 => $type,
|
3096 |
-
5 => true, // isStringAttachment
|
3097 |
-
6 => $disposition,
|
3098 |
-
7 => $cid
|
3099 |
-
);
|
3100 |
-
return true;
|
3101 |
-
}
|
3102 |
-
|
3103 |
-
/**
|
3104 |
-
* Check if an inline attachment is present.
|
3105 |
-
* @access public
|
3106 |
-
* @return boolean
|
3107 |
-
*/
|
3108 |
-
public function inlineImageExists()
|
3109 |
-
{
|
3110 |
-
foreach ($this->attachment as $attachment) {
|
3111 |
-
if ($attachment[6] == 'inline') {
|
3112 |
-
return true;
|
3113 |
-
}
|
3114 |
-
}
|
3115 |
-
return false;
|
3116 |
-
}
|
3117 |
-
|
3118 |
-
/**
|
3119 |
-
* Check if an attachment (non-inline) is present.
|
3120 |
-
* @return boolean
|
3121 |
-
*/
|
3122 |
-
public function attachmentExists()
|
3123 |
-
{
|
3124 |
-
foreach ($this->attachment as $attachment) {
|
3125 |
-
if ($attachment[6] == 'attachment') {
|
3126 |
-
return true;
|
3127 |
-
}
|
3128 |
-
}
|
3129 |
-
return false;
|
3130 |
-
}
|
3131 |
-
|
3132 |
-
/**
|
3133 |
-
* Check if this message has an alternative body set.
|
3134 |
-
* @return boolean
|
3135 |
-
*/
|
3136 |
-
public function alternativeExists()
|
3137 |
-
{
|
3138 |
-
return !empty($this->AltBody);
|
3139 |
-
}
|
3140 |
-
|
3141 |
-
/**
|
3142 |
-
* Clear queued addresses of given kind.
|
3143 |
-
* @access protected
|
3144 |
-
* @param string $kind 'to', 'cc', or 'bcc'
|
3145 |
-
* @return void
|
3146 |
-
*/
|
3147 |
-
public function clearQueuedAddresses($kind)
|
3148 |
-
{
|
3149 |
-
$RecipientsQueue = $this->RecipientsQueue;
|
3150 |
-
foreach ($RecipientsQueue as $address => $params) {
|
3151 |
-
if ($params[0] == $kind) {
|
3152 |
-
unset($this->RecipientsQueue[$address]);
|
3153 |
-
}
|
3154 |
-
}
|
3155 |
-
}
|
3156 |
-
|
3157 |
-
/**
|
3158 |
-
* Clear all To recipients.
|
3159 |
-
* @return void
|
3160 |
-
*/
|
3161 |
-
public function clearAddresses()
|
3162 |
-
{
|
3163 |
-
foreach ($this->to as $to) {
|
3164 |
-
unset($this->all_recipients[strtolower($to[0])]);
|
3165 |
-
}
|
3166 |
-
$this->to = array();
|
3167 |
-
$this->clearQueuedAddresses('to');
|
3168 |
-
}
|
3169 |
-
|
3170 |
-
/**
|
3171 |
-
* Clear all CC recipients.
|
3172 |
-
* @return void
|
3173 |
-
*/
|
3174 |
-
public function clearCCs()
|
3175 |
-
{
|
3176 |
-
foreach ($this->cc as $cc) {
|
3177 |
-
unset($this->all_recipients[strtolower($cc[0])]);
|
3178 |
-
}
|
3179 |
-
$this->cc = array();
|
3180 |
-
$this->clearQueuedAddresses('cc');
|
3181 |
-
}
|
3182 |
-
|
3183 |
-
/**
|
3184 |
-
* Clear all BCC recipients.
|
3185 |
-
* @return void
|
3186 |
-
*/
|
3187 |
-
public function clearBCCs()
|
3188 |
-
{
|
3189 |
-
foreach ($this->bcc as $bcc) {
|
3190 |
-
unset($this->all_recipients[strtolower($bcc[0])]);
|
3191 |
-
}
|
3192 |
-
$this->bcc = array();
|
3193 |
-
$this->clearQueuedAddresses('bcc');
|
3194 |
-
}
|
3195 |
-
|
3196 |
-
/**
|
3197 |
-
* Clear all ReplyTo recipients.
|
3198 |
-
* @return void
|
3199 |
-
*/
|
3200 |
-
public function clearReplyTos()
|
3201 |
-
{
|
3202 |
-
$this->ReplyTo = array();
|
3203 |
-
$this->ReplyToQueue = array();
|
3204 |
-
}
|
3205 |
-
|
3206 |
-
/**
|
3207 |
-
* Clear all recipient types.
|
3208 |
-
* @return void
|
3209 |
-
*/
|
3210 |
-
public function clearAllRecipients()
|
3211 |
-
{
|
3212 |
-
$this->to = array();
|
3213 |
-
$this->cc = array();
|
3214 |
-
$this->bcc = array();
|
3215 |
-
$this->all_recipients = array();
|
3216 |
-
$this->RecipientsQueue = array();
|
3217 |
-
}
|
3218 |
-
|
3219 |
-
/**
|
3220 |
-
* Clear all filesystem, string, and binary attachments.
|
3221 |
-
* @return void
|
3222 |
-
*/
|
3223 |
-
public function clearAttachments()
|
3224 |
-
{
|
3225 |
-
$this->attachment = array();
|
3226 |
-
}
|
3227 |
-
|
3228 |
-
/**
|
3229 |
-
* Clear all custom headers.
|
3230 |
-
* @return void
|
3231 |
-
*/
|
3232 |
-
public function clearCustomHeaders()
|
3233 |
-
{
|
3234 |
-
$this->CustomHeader = array();
|
3235 |
-
}
|
3236 |
-
|
3237 |
-
/**
|
3238 |
-
* Add an error message to the error container.
|
3239 |
-
* @access protected
|
3240 |
-
* @param string $msg
|
3241 |
-
* @return void
|
3242 |
-
*/
|
3243 |
-
protected function setError($msg)
|
3244 |
-
{
|
3245 |
-
$this->error_count++;
|
3246 |
-
if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
|
3247 |
-
$lasterror = $this->smtp->getError();
|
3248 |
-
if (!empty($lasterror['error'])) {
|
3249 |
-
$msg .= $this->lang('smtp_error') . $lasterror['error'];
|
3250 |
-
if (!empty($lasterror['detail'])) {
|
3251 |
-
$msg .= ' Detail: '. $lasterror['detail'];
|
3252 |
-
}
|
3253 |
-
if (!empty($lasterror['smtp_code'])) {
|
3254 |
-
$msg .= ' SMTP code: ' . $lasterror['smtp_code'];
|
3255 |
-
}
|
3256 |
-
if (!empty($lasterror['smtp_code_ex'])) {
|
3257 |
-
$msg .= ' Additional SMTP info: ' . $lasterror['smtp_code_ex'];
|
3258 |
-
}
|
3259 |
-
}
|
3260 |
-
}
|
3261 |
-
$this->ErrorInfo = $msg;
|
3262 |
-
}
|
3263 |
-
|
3264 |
-
/**
|
3265 |
-
* Return an RFC 822 formatted date.
|
3266 |
-
* @access public
|
3267 |
-
* @return string
|
3268 |
-
* @static
|
3269 |
-
*/
|
3270 |
-
public static function rfcDate()
|
3271 |
-
{
|
3272 |
-
// Set the time zone to whatever the default is to avoid 500 errors
|
3273 |
-
// Will default to UTC if it's not set properly in php.ini
|
3274 |
-
date_default_timezone_set(@date_default_timezone_get());
|
3275 |
-
return date('D, j M Y H:i:s O');
|
3276 |
-
}
|
3277 |
-
|
3278 |
-
/**
|
3279 |
-
* Get the server hostname.
|
3280 |
-
* Returns 'localhost.localdomain' if unknown.
|
3281 |
-
* @access protected
|
3282 |
-
* @return string
|
3283 |
-
*/
|
3284 |
-
protected function serverHostname()
|
3285 |
-
{
|
3286 |
-
$result = 'localhost.localdomain';
|
3287 |
-
if (!empty($this->Hostname)) {
|
3288 |
-
$result = $this->Hostname;
|
3289 |
-
} elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) {
|
3290 |
-
$result = $_SERVER['SERVER_NAME'];
|
3291 |
-
} elseif (function_exists('gethostname') && gethostname() !== false) {
|
3292 |
-
$result = gethostname();
|
3293 |
-
} elseif (php_uname('n') !== false) {
|
3294 |
-
$result = php_uname('n');
|
3295 |
-
}
|
3296 |
-
return $result;
|
3297 |
-
}
|
3298 |
-
|
3299 |
-
/**
|
3300 |
-
* Get an error message in the current language.
|
3301 |
-
* @access protected
|
3302 |
-
* @param string $key
|
3303 |
-
* @return string
|
3304 |
-
*/
|
3305 |
-
protected function lang($key)
|
3306 |
-
{
|
3307 |
-
if (count($this->language) < 1) {
|
3308 |
-
$this->setLanguage('en'); // set the default language
|
3309 |
-
}
|
3310 |
-
|
3311 |
-
if (array_key_exists($key, $this->language)) {
|
3312 |
-
if ($key == 'smtp_connect_failed') {
|
3313 |
-
//Include a link to troubleshooting docs on SMTP connection failure
|
3314 |
-
//this is by far the biggest cause of support questions
|
3315 |
-
//but it's usually not PHPMailer's fault.
|
3316 |
-
return $this->language[$key] . ' https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting';
|
3317 |
-
}
|
3318 |
-
return $this->language[$key];
|
3319 |
-
} else {
|
3320 |
-
//Return the key as a fallback
|
3321 |
-
return $key;
|
3322 |
-
}
|
3323 |
-
}
|
3324 |
-
|
3325 |
-
/**
|
3326 |
-
* Check if an error occurred.
|
3327 |
-
* @access public
|
3328 |
-
* @return boolean True if an error did occur.
|
3329 |
-
*/
|
3330 |
-
public function isError()
|
3331 |
-
{
|
3332 |
-
return ($this->error_count > 0);
|
3333 |
-
}
|
3334 |
-
|
3335 |
-
/**
|
3336 |
-
* Ensure consistent line endings in a string.
|
3337 |
-
* Changes every end of line from CRLF, CR or LF to $this->LE.
|
3338 |
-
* @access public
|
3339 |
-
* @param string $str String to fixEOL
|
3340 |
-
* @return string
|
3341 |
-
*/
|
3342 |
-
public function fixEOL($str)
|
3343 |
-
{
|
3344 |
-
// Normalise to \n
|
3345 |
-
$nstr = str_replace(array("\r\n", "\r"), "\n", $str);
|
3346 |
-
// Now convert LE as needed
|
3347 |
-
if ($this->LE !== "\n") {
|
3348 |
-
$nstr = str_replace("\n", $this->LE, $nstr);
|
3349 |
-
}
|
3350 |
-
return $nstr;
|
3351 |
-
}
|
3352 |
-
|
3353 |
-
/**
|
3354 |
-
* Add a custom header.
|
3355 |
-
* $name value can be overloaded to contain
|
3356 |
-
* both header name and value (name:value)
|
3357 |
-
* @access public
|
3358 |
-
* @param string $name Custom header name
|
3359 |
-
* @param string $value Header value
|
3360 |
-
* @return void
|
3361 |
-
*/
|
3362 |
-
public function addCustomHeader($name, $value = null)
|
3363 |
-
{
|
3364 |
-
if ($value === null) {
|
3365 |
-
// Value passed in as name:value
|
3366 |
-
$this->CustomHeader[] = explode(':', $name, 2);
|
3367 |
-
} else {
|
3368 |
-
$this->CustomHeader[] = array($name, $value);
|
3369 |
-
}
|
3370 |
-
}
|
3371 |
-
|
3372 |
-
/**
|
3373 |
-
* Returns all custom headers.
|
3374 |
-
* @return array
|
3375 |
-
*/
|
3376 |
-
public function getCustomHeaders()
|
3377 |
-
{
|
3378 |
-
return $this->CustomHeader;
|
3379 |
-
}
|
3380 |
-
|
3381 |
-
/**
|
3382 |
-
* Create a message body from an HTML string.
|
3383 |
-
* Automatically inlines images and creates a plain-text version by converting the HTML,
|
3384 |
-
* overwriting any existing values in Body and AltBody.
|
3385 |
-
* Do not source $message content from user input!
|
3386 |
-
* $basedir is prepended when handling relative URLs, e.g. <img src="/images/a.png"> and must not be empty
|
3387 |
-
* will look for an image file in $basedir/images/a.png and convert it to inline.
|
3388 |
-
* If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email)
|
3389 |
-
* If you don't want to apply these transformations to your HTML, just set Body and AltBody directly.
|
3390 |
-
* @access public
|
3391 |
-
* @param string $message HTML message string
|
3392 |
-
* @param string $basedir Absolute path to a base directory to prepend to relative paths to images
|
3393 |
-
* @param boolean|callable $advanced Whether to use the internal HTML to text converter
|
3394 |
-
* or your own custom converter @see PHPMailer::html2text()
|
3395 |
-
* @return string $message The transformed message Body
|
3396 |
-
*/
|
3397 |
-
public function msgHTML($message, $basedir = '', $advanced = false)
|
3398 |
-
{
|
3399 |
-
preg_match_all('/(src|background)=["\'](.*)["\']/Ui', $message, $images);
|
3400 |
-
if (array_key_exists(2, $images)) {
|
3401 |
-
if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
|
3402 |
-
// Ensure $basedir has a trailing /
|
3403 |
-
$basedir .= '/';
|
3404 |
-
}
|
3405 |
-
foreach ($images[2] as $imgindex => $url) {
|
3406 |
-
// Convert data URIs into embedded images
|
3407 |
-
if (preg_match('#^data:(image[^;,]*)(;base64)?,#', $url, $match)) {
|
3408 |
-
$data = substr($url, strpos($url, ','));
|
3409 |
-
if ($match[2]) {
|
3410 |
-
$data = base64_decode($data);
|
3411 |
-
} else {
|
3412 |
-
$data = rawurldecode($data);
|
3413 |
-
}
|
3414 |
-
$cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
|
3415 |
-
if ($this->addStringEmbeddedImage($data, $cid, 'embed' . $imgindex, 'base64', $match[1])) {
|
3416 |
-
$message = str_replace(
|
3417 |
-
$images[0][$imgindex],
|
3418 |
-
$images[1][$imgindex] . '="cid:' . $cid . '"',
|
3419 |
-
$message
|
3420 |
-
);
|
3421 |
-
}
|
3422 |
-
continue;
|
3423 |
-
}
|
3424 |
-
if (
|
3425 |
-
// Only process relative URLs if a basedir is provided (i.e. no absolute local paths)
|
3426 |
-
!empty($basedir)
|
3427 |
-
// Ignore URLs containing parent dir traversal (..)
|
3428 |
-
&& (strpos($url, '..') === false)
|
3429 |
-
// Do not change urls that are already inline images
|
3430 |
-
&& substr($url, 0, 4) !== 'cid:'
|
3431 |
-
// Do not change absolute URLs, including anonymous protocol
|
3432 |
-
&& !preg_match('#^[a-z][a-z0-9+.-]*:?//#i', $url)
|
3433 |
-
) {
|
3434 |
-
$filename = basename($url);
|
3435 |
-
$directory = dirname($url);
|
3436 |
-
if ($directory == '.') {
|
3437 |
-
$directory = '';
|
3438 |
-
}
|
3439 |
-
$cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2
|
3440 |
-
if (strlen($directory) > 1 && substr($directory, -1) != '/') {
|
3441 |
-
$directory .= '/';
|
3442 |
-
}
|
3443 |
-
if ($this->addEmbeddedImage(
|
3444 |
-
$basedir . $directory . $filename,
|
3445 |
-
$cid,
|
3446 |
-
$filename,
|
3447 |
-
'base64',
|
3448 |
-
self::_mime_types((string)self::mb_pathinfo($filename, PATHINFO_EXTENSION))
|
3449 |
-
)
|
3450 |
-
) {
|
3451 |
-
$message = preg_replace(
|
3452 |
-
'/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
|
3453 |
-
$images[1][$imgindex] . '="cid:' . $cid . '"',
|
3454 |
-
$message
|
3455 |
-
);
|
3456 |
-
}
|
3457 |
-
}
|
3458 |
-
}
|
3459 |
-
}
|
3460 |
-
$this->isHTML(true);
|
3461 |
-
// Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
|
3462 |
-
$this->Body = $this->normalizeBreaks($message);
|
3463 |
-
$this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
|
3464 |
-
if (!$this->alternativeExists()) {
|
3465 |
-
$this->AltBody = 'To view this email message, open it in a program that understands HTML!' .
|
3466 |
-
self::CRLF . self::CRLF;
|
3467 |
-
}
|
3468 |
-
return $this->Body;
|
3469 |
-
}
|
3470 |
-
|
3471 |
-
/**
|
3472 |
-
* Convert an HTML string into plain text.
|
3473 |
-
* This is used by msgHTML().
|
3474 |
-
* Note - older versions of this function used a bundled advanced converter
|
3475 |
-
* which was been removed for license reasons in #232.
|
3476 |
-
* Example usage:
|
3477 |
-
* <code>
|
3478 |
-
* // Use default conversion
|
3479 |
-
* $plain = $mail->html2text($html);
|
3480 |
-
* // Use your own custom converter
|
3481 |
-
* $plain = $mail->html2text($html, function($html) {
|
3482 |
-
* $converter = new MyHtml2text($html);
|
3483 |
-
* return $converter->get_text();
|
3484 |
-
* });
|
3485 |
-
* </code>
|
3486 |
-
* @param string $html The HTML text to convert
|
3487 |
-
* @param boolean|callable $advanced Any boolean value to use the internal converter,
|
3488 |
-
* or provide your own callable for custom conversion.
|
3489 |
-
* @return string
|
3490 |
-
*/
|
3491 |
-
public function html2text($html, $advanced = false)
|
3492 |
-
{
|
3493 |
-
if (is_callable($advanced)) {
|
3494 |
-
return call_user_func($advanced, $html);
|
3495 |
-
}
|
3496 |
-
return html_entity_decode(
|
3497 |
-
trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
|
3498 |
-
ENT_QUOTES,
|
3499 |
-
$this->CharSet
|
3500 |
-
);
|
3501 |
-
}
|
3502 |
-
|
3503 |
-
/**
|
3504 |
-
* Get the MIME type for a file extension.
|
3505 |
-
* @param string $ext File extension
|
3506 |
-
* @access public
|
3507 |
-
* @return string MIME type of file.
|
3508 |
-
* @static
|
3509 |
-
*/
|
3510 |
-
public static function _mime_types($ext = '')
|
3511 |
-
{
|
3512 |
-
$mimes = array(
|
3513 |
-
'xl' => 'application/excel',
|
3514 |
-
'js' => 'application/javascript',
|
3515 |
-
'hqx' => 'application/mac-binhex40',
|
3516 |
-
'cpt' => 'application/mac-compactpro',
|
3517 |
-
'bin' => 'application/macbinary',
|
3518 |
-
'doc' => 'application/msword',
|
3519 |
-
'word' => 'application/msword',
|
3520 |
-
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
3521 |
-
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
3522 |
-
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
|
3523 |
-
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
3524 |
-
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
3525 |
-
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
|
3526 |
-
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
3527 |
-
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
3528 |
-
'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
|
3529 |
-
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
3530 |
-
'class' => 'application/octet-stream',
|
3531 |
-
'dll' => 'application/octet-stream',
|
3532 |
-
'dms' => 'application/octet-stream',
|
3533 |
-
'exe' => 'application/octet-stream',
|
3534 |
-
'lha' => 'application/octet-stream',
|
3535 |
-
'lzh' => 'application/octet-stream',
|
3536 |
-
'psd' => 'application/octet-stream',
|
3537 |
-
'sea' => 'application/octet-stream',
|
3538 |
-
'so' => 'application/octet-stream',
|
3539 |
-
'oda' => 'application/oda',
|
3540 |
-
'pdf' => 'application/pdf',
|
3541 |
-
'ai' => 'application/postscript',
|
3542 |
-
'eps' => 'application/postscript',
|
3543 |
-
'ps' => 'application/postscript',
|
3544 |
-
'smi' => 'application/smil',
|
3545 |
-
'smil' => 'application/smil',
|
3546 |
-
'mif' => 'application/vnd.mif',
|
3547 |
-
'xls' => 'application/vnd.ms-excel',
|
3548 |
-
'ppt' => 'application/vnd.ms-powerpoint',
|
3549 |
-
'wbxml' => 'application/vnd.wap.wbxml',
|
3550 |
-
'wmlc' => 'application/vnd.wap.wmlc',
|
3551 |
-
'dcr' => 'application/x-director',
|
3552 |
-
'dir' => 'application/x-director',
|
3553 |
-
'dxr' => 'application/x-director',
|
3554 |
-
'dvi' => 'application/x-dvi',
|
3555 |
-
'gtar' => 'application/x-gtar',
|
3556 |
-
'php3' => 'application/x-httpd-php',
|
3557 |
-
'php4' => 'application/x-httpd-php',
|
3558 |
-
'php' => 'application/x-httpd-php',
|
3559 |
-
'phtml' => 'application/x-httpd-php',
|
3560 |
-
'phps' => 'application/x-httpd-php-source',
|
3561 |
-
'swf' => 'application/x-shockwave-flash',
|
3562 |
-
'sit' => 'application/x-stuffit',
|
3563 |
-
'tar' => 'application/x-tar',
|
3564 |
-
'tgz' => 'application/x-tar',
|
3565 |
-
'xht' => 'application/xhtml+xml',
|
3566 |
-
'xhtml' => 'application/xhtml+xml',
|
3567 |
-
'zip' => 'application/zip',
|
3568 |
-
'mid' => 'audio/midi',
|
3569 |
-
'midi' => 'audio/midi',
|
3570 |
-
'mp2' => 'audio/mpeg',
|
3571 |
-
'mp3' => 'audio/mpeg',
|
3572 |
-
'mpga' => 'audio/mpeg',
|
3573 |
-
'aif' => 'audio/x-aiff',
|
3574 |
-
'aifc' => 'audio/x-aiff',
|
3575 |
-
'aiff' => 'audio/x-aiff',
|
3576 |
-
'ram' => 'audio/x-pn-realaudio',
|
3577 |
-
'rm' => 'audio/x-pn-realaudio',
|
3578 |
-
'rpm' => 'audio/x-pn-realaudio-plugin',
|
3579 |
-
'ra' => 'audio/x-realaudio',
|
3580 |
-
'wav' => 'audio/x-wav',
|
3581 |
-
'bmp' => 'image/bmp',
|
3582 |
-
'gif' => 'image/gif',
|
3583 |
-
'jpeg' => 'image/jpeg',
|
3584 |
-
'jpe' => 'image/jpeg',
|
3585 |
-
'jpg' => 'image/jpeg',
|
3586 |
-
'png' => 'image/png',
|
3587 |
-
'tiff' => 'image/tiff',
|
3588 |
-
'tif' => 'image/tiff',
|
3589 |
-
'eml' => 'message/rfc822',
|
3590 |
-
'css' => 'text/css',
|
3591 |
-
'html' => 'text/html',
|
3592 |
-
'htm' => 'text/html',
|
3593 |
-
'shtml' => 'text/html',
|
3594 |
-
'log' => 'text/plain',
|
3595 |
-
'text' => 'text/plain',
|
3596 |
-
'txt' => 'text/plain',
|
3597 |
-
'rtx' => 'text/richtext',
|
3598 |
-
'rtf' => 'text/rtf',
|
3599 |
-
'vcf' => 'text/vcard',
|
3600 |
-
'vcard' => 'text/vcard',
|
3601 |
-
'xml' => 'text/xml',
|
3602 |
-
'xsl' => 'text/xml',
|
3603 |
-
'mpeg' => 'video/mpeg',
|
3604 |
-
'mpe' => 'video/mpeg',
|
3605 |
-
'mpg' => 'video/mpeg',
|
3606 |
-
'mov' => 'video/quicktime',
|
3607 |
-
'qt' => 'video/quicktime',
|
3608 |
-
'rv' => 'video/vnd.rn-realvideo',
|
3609 |
-
'avi' => 'video/x-msvideo',
|
3610 |
-
'movie' => 'video/x-sgi-movie'
|
3611 |
-
);
|
3612 |
-
if (array_key_exists(strtolower($ext), $mimes)) {
|
3613 |
-
return $mimes[strtolower($ext)];
|
3614 |
-
}
|
3615 |
-
return 'application/octet-stream';
|
3616 |
-
}
|
3617 |
-
|
3618 |
-
/**
|
3619 |
-
* Map a file name to a MIME type.
|
3620 |
-
* Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
|
3621 |
-
* @param string $filename A file name or full path, does not need to exist as a file
|
3622 |
-
* @return string
|
3623 |
-
* @static
|
3624 |
-
*/
|
3625 |
-
public static function filenameToType($filename)
|
3626 |
-
{
|
3627 |
-
// In case the path is a URL, strip any query string before getting extension
|
3628 |
-
$qpos = strpos($filename, '?');
|
3629 |
-
if (false !== $qpos) {
|
3630 |
-
$filename = substr($filename, 0, $qpos);
|
3631 |
-
}
|
3632 |
-
$pathinfo = self::mb_pathinfo($filename);
|
3633 |
-
return self::_mime_types($pathinfo['extension']);
|
3634 |
-
}
|
3635 |
-
|
3636 |
-
/**
|
3637 |
-
* Multi-byte-safe pathinfo replacement.
|
3638 |
-
* Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
|
3639 |
-
* Works similarly to the one in PHP >= 5.2.0
|
3640 |
-
* @link http://www.php.net/manual/en/function.pathinfo.php#107461
|
3641 |
-
* @param string $path A filename or path, does not need to exist as a file
|
3642 |
-
* @param integer|string $options Either a PATHINFO_* constant,
|
3643 |
-
* or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
|
3644 |
-
* @return string|array
|
3645 |
-
* @static
|
3646 |
-
*/
|
3647 |
-
public static function mb_pathinfo($path, $options = null)
|
3648 |
-
{
|
3649 |
-
$ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
|
3650 |
-
$pathinfo = array();
|
3651 |
-
if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
|
3652 |
-
if (array_key_exists(1, $pathinfo)) {
|
3653 |
-
$ret['dirname'] = $pathinfo[1];
|
3654 |
-
}
|
3655 |
-
if (array_key_exists(2, $pathinfo)) {
|
3656 |
-
$ret['basename'] = $pathinfo[2];
|
3657 |
-
}
|
3658 |
-
if (array_key_exists(5, $pathinfo)) {
|
3659 |
-
$ret['extension'] = $pathinfo[5];
|
3660 |
-
}
|
3661 |
-
if (array_key_exists(3, $pathinfo)) {
|
3662 |
-
$ret['filename'] = $pathinfo[3];
|
3663 |
-
}
|
3664 |
-
}
|
3665 |
-
switch ($options) {
|
3666 |
-
case PATHINFO_DIRNAME:
|
3667 |
-
case 'dirname':
|
3668 |
-
return $ret['dirname'];
|
3669 |
-
case PATHINFO_BASENAME:
|
3670 |
-
case 'basename':
|
3671 |
-
return $ret['basename'];
|
3672 |
-
case PATHINFO_EXTENSION:
|
3673 |
-
case 'extension':
|
3674 |
-
return $ret['extension'];
|
3675 |
-
case PATHINFO_FILENAME:
|
3676 |
-
case 'filename':
|
3677 |
-
return $ret['filename'];
|
3678 |
-
default:
|
3679 |
-
return $ret;
|
3680 |
-
}
|
3681 |
-
}
|
3682 |
-
|
3683 |
-
/**
|
3684 |
-
* Set or reset instance properties.
|
3685 |
-
* You should avoid this function - it's more verbose, less efficient, more error-prone and
|
3686 |
-
* harder to debug than setting properties directly.
|
3687 |
-
* Usage Example:
|
3688 |
-
* `$mail->set('SMTPSecure', 'tls');`
|
3689 |
-
* is the same as:
|
3690 |
-
* `$mail->SMTPSecure = 'tls';`
|
3691 |
-
* @access public
|
3692 |
-
* @param string $name The property name to set
|
3693 |
-
* @param mixed $value The value to set the property to
|
3694 |
-
* @return boolean
|
3695 |
-
* @TODO Should this not be using the __set() magic function?
|
3696 |
-
*/
|
3697 |
-
public function set($name, $value = '')
|
3698 |
-
{
|
3699 |
-
if (property_exists($this, $name)) {
|
3700 |
-
$this->$name = $value;
|
3701 |
-
return true;
|
3702 |
-
} else {
|
3703 |
-
$this->setError($this->lang('variable_set') . $name);
|
3704 |
-
return false;
|
3705 |
-
}
|
3706 |
-
}
|
3707 |
-
|
3708 |
-
/**
|
3709 |
-
* Strip newlines to prevent header injection.
|
3710 |
-
* @access public
|
3711 |
-
* @param string $str
|
3712 |
-
* @return string
|
3713 |
-
*/
|
3714 |
-
public function secureHeader($str)
|
3715 |
-
{
|
3716 |
-
return trim(str_replace(array("\r", "\n"), '', $str));
|
3717 |
-
}
|
3718 |
-
|
3719 |
-
/**
|
3720 |
-
* Normalize line breaks in a string.
|
3721 |
-
* Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
|
3722 |
-
* Defaults to CRLF (for message bodies) and preserves consecutive breaks.
|
3723 |
-
* @param string $text
|
3724 |
-
* @param string $breaktype What kind of line break to use, defaults to CRLF
|
3725 |
-
* @return string
|
3726 |
-
* @access public
|
3727 |
-
* @static
|
3728 |
-
*/
|
3729 |
-
public static function normalizeBreaks($text, $breaktype = "\r\n")
|
3730 |
-
{
|
3731 |
-
return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
|
3732 |
-
}
|
3733 |
-
|
3734 |
-
/**
|
3735 |
-
* Set the public and private key files and password for S/MIME signing.
|
3736 |
-
* @access public
|
3737 |
-
* @param string $cert_filename
|
3738 |
-
* @param string $key_filename
|
3739 |
-
* @param string $key_pass Password for private key
|
3740 |
-
* @param string $extracerts_filename Optional path to chain certificate
|
3741 |
-
*/
|
3742 |
-
public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '')
|
3743 |
-
{
|
3744 |
-
$this->sign_cert_file = $cert_filename;
|
3745 |
-
$this->sign_key_file = $key_filename;
|
3746 |
-
$this->sign_key_pass = $key_pass;
|
3747 |
-
$this->sign_extracerts_file = $extracerts_filename;
|
3748 |
-
}
|
3749 |
-
|
3750 |
-
/**
|
3751 |
-
* Quoted-Printable-encode a DKIM header.
|
3752 |
-
* @access public
|
3753 |
-
* @param string $txt
|
3754 |
-
* @return string
|
3755 |
-
*/
|
3756 |
-
public function DKIM_QP($txt)
|
3757 |
-
{
|
3758 |
-
$line = '';
|
3759 |
-
for ($i = 0; $i < strlen($txt); $i++) {
|
3760 |
-
$ord = ord($txt[$i]);
|
3761 |
-
if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
|
3762 |
-
$line .= $txt[$i];
|
3763 |
-
} else {
|
3764 |
-
$line .= '=' . sprintf('%02X', $ord);
|
3765 |
-
}
|
3766 |
-
}
|
3767 |
-
return $line;
|
3768 |
-
}
|
3769 |
-
|
3770 |
-
/**
|
3771 |
-
* Generate a DKIM signature.
|
3772 |
-
* @access public
|
3773 |
-
* @param string $signHeader
|
3774 |
-
* @throws phpmailerException
|
3775 |
-
* @return string The DKIM signature value
|
3776 |
-
*/
|
3777 |
-
public function DKIM_Sign($signHeader)
|
3778 |
-
{
|
3779 |
-
if (!defined('PKCS7_TEXT')) {
|
3780 |
-
if ($this->exceptions) {
|
3781 |
-
throw new phpmailerException($this->lang('extension_missing') . 'openssl');
|
3782 |
-
}
|
3783 |
-
return '';
|
3784 |
-
}
|
3785 |
-
$privKeyStr = !empty($this->DKIM_private_string) ? $this->DKIM_private_string : file_get_contents($this->DKIM_private);
|
3786 |
-
if ('' != $this->DKIM_passphrase) {
|
3787 |
-
$privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
|
3788 |
-
} else {
|
3789 |
-
$privKey = openssl_pkey_get_private($privKeyStr);
|
3790 |
-
}
|
3791 |
-
//Workaround for missing digest algorithms in old PHP & OpenSSL versions
|
3792 |
-
//@link http://stackoverflow.com/a/11117338/333340
|
3793 |
-
if (version_compare(PHP_VERSION, '5.3.0') >= 0 and
|
3794 |
-
in_array('sha256WithRSAEncryption', openssl_get_md_methods(true))) {
|
3795 |
-
if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
|
3796 |
-
openssl_pkey_free($privKey);
|
3797 |
-
return base64_encode($signature);
|
3798 |
-
}
|
3799 |
-
} else {
|
3800 |
-
$pinfo = openssl_pkey_get_details($privKey);
|
3801 |
-
$hash = hash('sha256', $signHeader);
|
3802 |
-
//'Magic' constant for SHA256 from RFC3447
|
3803 |
-
//@link https://tools.ietf.org/html/rfc3447#page-43
|
3804 |
-
$t = '3031300d060960864801650304020105000420' . $hash;
|
3805 |
-
$pslen = $pinfo['bits'] / 8 - (strlen($t) / 2 + 3);
|
3806 |
-
$eb = pack('H*', '0001' . str_repeat('FF', $pslen) . '00' . $t);
|
3807 |
-
|
3808 |
-
if (openssl_private_encrypt($eb, $signature, $privKey, OPENSSL_NO_PADDING)) {
|
3809 |
-
openssl_pkey_free($privKey);
|
3810 |
-
return base64_encode($signature);
|
3811 |
-
}
|
3812 |
-
}
|
3813 |
-
openssl_pkey_free($privKey);
|
3814 |
-
return '';
|
3815 |
-
}
|
3816 |
-
|
3817 |
-
/**
|
3818 |
-
* Generate a DKIM canonicalization header.
|
3819 |
-
* @access public
|
3820 |
-
* @param string $signHeader Header
|
3821 |
-
* @return string
|
3822 |
-
*/
|
3823 |
-
public function DKIM_HeaderC($signHeader)
|
3824 |
-
{
|
3825 |
-
$signHeader = preg_replace('/\r\n\s+/', ' ', $signHeader);
|
3826 |
-
$lines = explode("\r\n", $signHeader);
|
3827 |
-
foreach ($lines as $key => $line) {
|
3828 |
-
list($heading, $value) = explode(':', $line, 2);
|
3829 |
-
$heading = strtolower($heading);
|
3830 |
-
$value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces
|
3831 |
-
$lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value
|
3832 |
-
}
|
3833 |
-
$signHeader = implode("\r\n", $lines);
|
3834 |
-
return $signHeader;
|
3835 |
-
}
|
3836 |
-
|
3837 |
-
/**
|
3838 |
-
* Generate a DKIM canonicalization body.
|
3839 |
-
* @access public
|
3840 |
-
* @param string $body Message Body
|
3841 |
-
* @return string
|
3842 |
-
*/
|
3843 |
-
public function DKIM_BodyC($body)
|
3844 |
-
{
|
3845 |
-
if ($body == '') {
|
3846 |
-
return "\r\n";
|
3847 |
-
}
|
3848 |
-
// stabilize line endings
|
3849 |
-
$body = str_replace("\r\n", "\n", $body);
|
3850 |
-
$body = str_replace("\n", "\r\n", $body);
|
3851 |
-
// END stabilize line endings
|
3852 |
-
while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
|
3853 |
-
$body = substr($body, 0, strlen($body) - 2);
|
3854 |
-
}
|
3855 |
-
return $body;
|
3856 |
-
}
|
3857 |
-
|
3858 |
-
/**
|
3859 |
-
* Create the DKIM header and body in a new message header.
|
3860 |
-
* @access public
|
3861 |
-
* @param string $headers_line Header lines
|
3862 |
-
* @param string $subject Subject
|
3863 |
-
* @param string $body Body
|
3864 |
-
* @return string
|
3865 |
-
*/
|
3866 |
-
public function DKIM_Add($headers_line, $subject, $body)
|
3867 |
-
{
|
3868 |
-
$DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms
|
3869 |
-
$DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
|
3870 |
-
$DKIMquery = 'dns/txt'; // Query method
|
3871 |
-
$DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
|
3872 |
-
$subject_header = "Subject: $subject";
|
3873 |
-
$headers = explode($this->LE, $headers_line);
|
3874 |
-
$from_header = '';
|
3875 |
-
$to_header = '';
|
3876 |
-
$date_header = '';
|
3877 |
-
$current = '';
|
3878 |
-
foreach ($headers as $header) {
|
3879 |
-
if (strpos($header, 'From:') === 0) {
|
3880 |
-
$from_header = $header;
|
3881 |
-
$current = 'from_header';
|
3882 |
-
} elseif (strpos($header, 'To:') === 0) {
|
3883 |
-
$to_header = $header;
|
3884 |
-
$current = 'to_header';
|
3885 |
-
} elseif (strpos($header, 'Date:') === 0) {
|
3886 |
-
$date_header = $header;
|
3887 |
-
$current = 'date_header';
|
3888 |
-
} else {
|
3889 |
-
if (!empty($$current) && strpos($header, ' =?') === 0) {
|
3890 |
-
$$current .= $header;
|
3891 |
-
} else {
|
3892 |
-
$current = '';
|
3893 |
-
}
|
3894 |
-
}
|
3895 |
-
}
|
3896 |
-
$from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
|
3897 |
-
$to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
|
3898 |
-
$date = str_replace('|', '=7C', $this->DKIM_QP($date_header));
|
3899 |
-
$subject = str_replace(
|
3900 |
-
'|',
|
3901 |
-
'=7C',
|
3902 |
-
$this->DKIM_QP($subject_header)
|
3903 |
-
); // Copied header fields (dkim-quoted-printable)
|
3904 |
-
$body = $this->DKIM_BodyC($body);
|
3905 |
-
$DKIMlen = strlen($body); // Length of body
|
3906 |
-
$DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body
|
3907 |
-
if ('' == $this->DKIM_identity) {
|
3908 |
-
$ident = '';
|
3909 |
-
} else {
|
3910 |
-
$ident = ' i=' . $this->DKIM_identity . ';';
|
3911 |
-
}
|
3912 |
-
$dkimhdrs = 'DKIM-Signature: v=1; a=' .
|
3913 |
-
$DKIMsignatureType . '; q=' .
|
3914 |
-
$DKIMquery . '; l=' .
|
3915 |
-
$DKIMlen . '; s=' .
|
3916 |
-
$this->DKIM_selector .
|
3917 |
-
";\r\n" .
|
3918 |
-
"\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" .
|
3919 |
-
"\th=From:To:Date:Subject;\r\n" .
|
3920 |
-
"\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" .
|
3921 |
-
"\tz=$from\r\n" .
|
3922 |
-
"\t|$to\r\n" .
|
3923 |
-
"\t|$date\r\n" .
|
3924 |
-
"\t|$subject;\r\n" .
|
3925 |
-
"\tbh=" . $DKIMb64 . ";\r\n" .
|
3926 |
-
"\tb=";
|
3927 |
-
$toSign = $this->DKIM_HeaderC(
|
3928 |
-
$from_header . "\r\n" .
|
3929 |
-
$to_header . "\r\n" .
|
3930 |
-
$date_header . "\r\n" .
|
3931 |
-
$subject_header . "\r\n" .
|
3932 |
-
$dkimhdrs
|
3933 |
-
);
|
3934 |
-
$signed = $this->DKIM_Sign($toSign);
|
3935 |
-
return $dkimhdrs . $signed . "\r\n";
|
3936 |
-
}
|
3937 |
-
|
3938 |
-
/**
|
3939 |
-
* Detect if a string contains a line longer than the maximum line length allowed.
|
3940 |
-
* @param string $str
|
3941 |
-
* @return boolean
|
3942 |
-
* @static
|
3943 |
-
*/
|
3944 |
-
public static function hasLineLongerThanMax($str)
|
3945 |
-
{
|
3946 |
-
//+2 to include CRLF line break for a 1000 total
|
3947 |
-
return (boolean)preg_match('/^(.{'.(self::MAX_LINE_LENGTH + 2).',})/m', $str);
|
3948 |
-
}
|
3949 |
-
|
3950 |
-
/**
|
3951 |
-
* Allows for public read access to 'to' property.
|
3952 |
-
* @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
3953 |
-
* @access public
|
3954 |
-
* @return array
|
3955 |
-
*/
|
3956 |
-
public function getToAddresses()
|
3957 |
-
{
|
3958 |
-
return $this->to;
|
3959 |
-
}
|
3960 |
-
|
3961 |
-
/**
|
3962 |
-
* Allows for public read access to 'cc' property.
|
3963 |
-
* @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
3964 |
-
* @access public
|
3965 |
-
* @return array
|
3966 |
-
*/
|
3967 |
-
public function getCcAddresses()
|
3968 |
-
{
|
3969 |
-
return $this->cc;
|
3970 |
-
}
|
3971 |
-
|
3972 |
-
/**
|
3973 |
-
* Allows for public read access to 'bcc' property.
|
3974 |
-
* @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
3975 |
-
* @access public
|
3976 |
-
* @return array
|
3977 |
-
*/
|
3978 |
-
public function getBccAddresses()
|
3979 |
-
{
|
3980 |
-
return $this->bcc;
|
3981 |
-
}
|
3982 |
-
|
3983 |
-
/**
|
3984 |
-
* Allows for public read access to 'ReplyTo' property.
|
3985 |
-
* @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
3986 |
-
* @access public
|
3987 |
-
* @return array
|
3988 |
-
*/
|
3989 |
-
public function getReplyToAddresses()
|
3990 |
-
{
|
3991 |
-
return $this->ReplyTo;
|
3992 |
-
}
|
3993 |
-
|
3994 |
-
/**
|
3995 |
-
* Allows for public read access to 'all_recipients' property.
|
3996 |
-
* @note: Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
3997 |
-
* @access public
|
3998 |
-
* @return array
|
3999 |
-
*/
|
4000 |
-
public function getAllRecipientAddresses()
|
4001 |
-
{
|
4002 |
-
return $this->all_recipients;
|
4003 |
-
}
|
4004 |
-
|
4005 |
-
/**
|
4006 |
-
* Perform a callback.
|
4007 |
-
* @param boolean $isSent
|
4008 |
-
* @param array $to
|
4009 |
-
* @param array $cc
|
4010 |
-
* @param array $bcc
|
4011 |
-
* @param string $subject
|
4012 |
-
* @param string $body
|
4013 |
-
* @param string $from
|
4014 |
-
*/
|
4015 |
-
protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from)
|
4016 |
-
{
|
4017 |
-
if (!empty($this->action_function) && is_callable($this->action_function)) {
|
4018 |
-
$params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
|
4019 |
-
call_user_func_array($this->action_function, $params);
|
4020 |
-
}
|
4021 |
-
}
|
4022 |
-
}
|
4023 |
-
|
4024 |
-
/**
|
4025 |
-
* PHPMailer exception handler
|
4026 |
-
* @package PHPMailer
|
4027 |
-
*/
|
4028 |
-
class phpmailerException extends Exception
|
4029 |
-
{
|
4030 |
-
/**
|
4031 |
-
* Prettify error message output
|
4032 |
-
* @return string
|
4033 |
-
*/
|
4034 |
-
public function errorMessage()
|
4035 |
-
{
|
4036 |
-
$errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
|
4037 |
-
return $errorMsg;
|
4038 |
-
}
|
4039 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mail/engines/class.phpmaileroauth.php
DELETED
@@ -1,197 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* PHPMailer - PHP email creation and transport class.
|
4 |
-
* PHP Version 5.4
|
5 |
-
* @package PHPMailer
|
6 |
-
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
7 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
8 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
9 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
10 |
-
* @author Brent R. Matzelle (original founder)
|
11 |
-
* @copyright 2012 - 2014 Marcus Bointon
|
12 |
-
* @copyright 2010 - 2012 Jim Jagielski
|
13 |
-
* @copyright 2004 - 2009 Andy Prevost
|
14 |
-
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
15 |
-
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
16 |
-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE.
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHPMailerOAuth - PHPMailer subclass adding OAuth support.
|
22 |
-
* @package PHPMailer
|
23 |
-
* @author @sherryl4george
|
24 |
-
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
|
25 |
-
*/
|
26 |
-
class PHPMailerOAuth extends PHPMailer
|
27 |
-
{
|
28 |
-
/**
|
29 |
-
* The OAuth user's email address
|
30 |
-
* @var string
|
31 |
-
*/
|
32 |
-
public $oauthUserEmail = '';
|
33 |
-
|
34 |
-
/**
|
35 |
-
* The OAuth refresh token
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
public $oauthRefreshToken = '';
|
39 |
-
|
40 |
-
/**
|
41 |
-
* The OAuth client ID
|
42 |
-
* @var string
|
43 |
-
*/
|
44 |
-
public $oauthClientId = '';
|
45 |
-
|
46 |
-
/**
|
47 |
-
* The OAuth client secret
|
48 |
-
* @var string
|
49 |
-
*/
|
50 |
-
public $oauthClientSecret = '';
|
51 |
-
|
52 |
-
/**
|
53 |
-
* An instance of the PHPMailerOAuthGoogle class.
|
54 |
-
* @var PHPMailerOAuthGoogle
|
55 |
-
* @access protected
|
56 |
-
*/
|
57 |
-
protected $oauth = null;
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Get a PHPMailerOAuthGoogle instance to use.
|
61 |
-
* @return PHPMailerOAuthGoogle
|
62 |
-
*/
|
63 |
-
public function getOAUTHInstance()
|
64 |
-
{
|
65 |
-
if (!is_object($this->oauth)) {
|
66 |
-
$this->oauth = new PHPMailerOAuthGoogle(
|
67 |
-
$this->oauthUserEmail,
|
68 |
-
$this->oauthClientSecret,
|
69 |
-
$this->oauthClientId,
|
70 |
-
$this->oauthRefreshToken
|
71 |
-
);
|
72 |
-
}
|
73 |
-
return $this->oauth;
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Initiate a connection to an SMTP server.
|
78 |
-
* Overrides the original smtpConnect method to add support for OAuth.
|
79 |
-
* @param array $options An array of options compatible with stream_context_create()
|
80 |
-
* @uses SMTP
|
81 |
-
* @access public
|
82 |
-
* @return bool
|
83 |
-
* @throws phpmailerException
|
84 |
-
*/
|
85 |
-
public function smtpConnect($options = array())
|
86 |
-
{
|
87 |
-
if (is_null($this->smtp)) {
|
88 |
-
$this->smtp = $this->getSMTPInstance();
|
89 |
-
}
|
90 |
-
|
91 |
-
if (is_null($this->oauth)) {
|
92 |
-
$this->oauth = $this->getOAUTHInstance();
|
93 |
-
}
|
94 |
-
|
95 |
-
// Already connected?
|
96 |
-
if ($this->smtp->connected()) {
|
97 |
-
return true;
|
98 |
-
}
|
99 |
-
|
100 |
-
$this->smtp->setTimeout($this->Timeout);
|
101 |
-
$this->smtp->setDebugLevel($this->SMTPDebug);
|
102 |
-
$this->smtp->setDebugOutput($this->Debugoutput);
|
103 |
-
$this->smtp->setVerp($this->do_verp);
|
104 |
-
$hosts = explode(';', $this->Host);
|
105 |
-
$lastexception = null;
|
106 |
-
|
107 |
-
foreach ($hosts as $hostentry) {
|
108 |
-
$hostinfo = array();
|
109 |
-
if (!preg_match('/^((ssl|tls):\/\/)*([a-zA-Z0-9\.-]*):?([0-9]*)$/', trim($hostentry), $hostinfo)) {
|
110 |
-
// Not a valid host entry
|
111 |
-
continue;
|
112 |
-
}
|
113 |
-
// $hostinfo[2]: optional ssl or tls prefix
|
114 |
-
// $hostinfo[3]: the hostname
|
115 |
-
// $hostinfo[4]: optional port number
|
116 |
-
// The host string prefix can temporarily override the current setting for SMTPSecure
|
117 |
-
// If it's not specified, the default value is used
|
118 |
-
$prefix = '';
|
119 |
-
$secure = $this->SMTPSecure;
|
120 |
-
$tls = ($this->SMTPSecure == 'tls');
|
121 |
-
if ('ssl' == $hostinfo[2] or ('' == $hostinfo[2] and 'ssl' == $this->SMTPSecure)) {
|
122 |
-
$prefix = 'ssl://';
|
123 |
-
$tls = false; // Can't have SSL and TLS at the same time
|
124 |
-
$secure = 'ssl';
|
125 |
-
} elseif ($hostinfo[2] == 'tls') {
|
126 |
-
$tls = true;
|
127 |
-
// tls doesn't use a prefix
|
128 |
-
$secure = 'tls';
|
129 |
-
}
|
130 |
-
//Do we need the OpenSSL extension?
|
131 |
-
$sslext = defined('OPENSSL_ALGO_SHA1');
|
132 |
-
if ('tls' === $secure or 'ssl' === $secure) {
|
133 |
-
//Check for an OpenSSL constant rather than using extension_loaded, which is sometimes disabled
|
134 |
-
if (!$sslext) {
|
135 |
-
throw new phpmailerException($this->lang('extension_missing').'openssl', self::STOP_CRITICAL);
|
136 |
-
}
|
137 |
-
}
|
138 |
-
$host = $hostinfo[3];
|
139 |
-
$port = $this->Port;
|
140 |
-
$tport = (integer)$hostinfo[4];
|
141 |
-
if ($tport > 0 and $tport < 65536) {
|
142 |
-
$port = $tport;
|
143 |
-
}
|
144 |
-
if ($this->smtp->connect($prefix . $host, $port, $this->Timeout, $options)) {
|
145 |
-
try {
|
146 |
-
if ($this->Helo) {
|
147 |
-
$hello = $this->Helo;
|
148 |
-
} else {
|
149 |
-
$hello = $this->serverHostname();
|
150 |
-
}
|
151 |
-
$this->smtp->hello($hello);
|
152 |
-
//Automatically enable TLS encryption if:
|
153 |
-
// * it's not disabled
|
154 |
-
// * we have openssl extension
|
155 |
-
// * we are not already using SSL
|
156 |
-
// * the server offers STARTTLS
|
157 |
-
if ($this->SMTPAutoTLS and $sslext and $secure != 'ssl' and $this->smtp->getServerExt('STARTTLS')) {
|
158 |
-
$tls = true;
|
159 |
-
}
|
160 |
-
if ($tls) {
|
161 |
-
if (!$this->smtp->startTLS()) {
|
162 |
-
throw new phpmailerException($this->lang('connect_host'));
|
163 |
-
}
|
164 |
-
// We must resend HELO after tls negotiation
|
165 |
-
$this->smtp->hello($hello);
|
166 |
-
}
|
167 |
-
if ($this->SMTPAuth) {
|
168 |
-
if (!$this->smtp->authenticate(
|
169 |
-
$this->Username,
|
170 |
-
$this->Password,
|
171 |
-
$this->AuthType,
|
172 |
-
$this->Realm,
|
173 |
-
$this->Workstation,
|
174 |
-
$this->oauth
|
175 |
-
)
|
176 |
-
) {
|
177 |
-
throw new phpmailerException($this->lang('authenticate'));
|
178 |
-
}
|
179 |
-
}
|
180 |
-
return true;
|
181 |
-
} catch (phpmailerException $exc) {
|
182 |
-
$lastexception = $exc;
|
183 |
-
$this->edebug($exc->getMessage());
|
184 |
-
// We must have connected, but then failed TLS or Auth, so close connection nicely
|
185 |
-
$this->smtp->quit();
|
186 |
-
}
|
187 |
-
}
|
188 |
-
}
|
189 |
-
// If we get here, all connection attempts have failed, so close connection hard
|
190 |
-
$this->smtp->close();
|
191 |
-
// As we've caught all exceptions, just report whatever the last one was
|
192 |
-
if ($this->exceptions and !is_null($lastexception)) {
|
193 |
-
throw $lastexception;
|
194 |
-
}
|
195 |
-
return false;
|
196 |
-
}
|
197 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mail/engines/class.phpmaileroauthgoogle.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* PHPMailer - PHP email creation and transport class.
|
4 |
-
* PHP Version 5.4
|
5 |
-
* @package PHPMailer
|
6 |
-
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
7 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
8 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
9 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
10 |
-
* @author Brent R. Matzelle (original founder)
|
11 |
-
* @copyright 2012 - 2014 Marcus Bointon
|
12 |
-
* @copyright 2010 - 2012 Jim Jagielski
|
13 |
-
* @copyright 2004 - 2009 Andy Prevost
|
14 |
-
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
15 |
-
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
16 |
-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE.
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHPMailerOAuthGoogle - Wrapper for League OAuth2 Google provider.
|
22 |
-
* @package PHPMailer
|
23 |
-
* @author @sherryl4george
|
24 |
-
* @author Marcus Bointon (@Synchro) <phpmailer@synchromedia.co.uk>
|
25 |
-
* @link https://github.com/thephpleague/oauth2-client
|
26 |
-
*/
|
27 |
-
class PHPMailerOAuthGoogle
|
28 |
-
{
|
29 |
-
private $oauthUserEmail = '';
|
30 |
-
private $oauthRefreshToken = '';
|
31 |
-
private $oauthClientId = '';
|
32 |
-
private $oauthClientSecret = '';
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @param string $UserEmail
|
36 |
-
* @param string $ClientSecret
|
37 |
-
* @param string $ClientId
|
38 |
-
* @param string $RefreshToken
|
39 |
-
*/
|
40 |
-
public function __construct(
|
41 |
-
$UserEmail,
|
42 |
-
$ClientSecret,
|
43 |
-
$ClientId,
|
44 |
-
$RefreshToken
|
45 |
-
) {
|
46 |
-
$this->oauthClientId = $ClientId;
|
47 |
-
$this->oauthClientSecret = $ClientSecret;
|
48 |
-
$this->oauthRefreshToken = $RefreshToken;
|
49 |
-
$this->oauthUserEmail = $UserEmail;
|
50 |
-
}
|
51 |
-
|
52 |
-
private function getProvider()
|
53 |
-
{
|
54 |
-
return new League\OAuth2\Client\Provider\Google([
|
55 |
-
'clientId' => $this->oauthClientId,
|
56 |
-
'clientSecret' => $this->oauthClientSecret
|
57 |
-
]);
|
58 |
-
}
|
59 |
-
|
60 |
-
private function getGrant()
|
61 |
-
{
|
62 |
-
return new \League\OAuth2\Client\Grant\RefreshToken();
|
63 |
-
}
|
64 |
-
|
65 |
-
private function getToken()
|
66 |
-
{
|
67 |
-
$provider = $this->getProvider();
|
68 |
-
$grant = $this->getGrant();
|
69 |
-
return $provider->getAccessToken($grant, ['refresh_token' => $this->oauthRefreshToken]);
|
70 |
-
}
|
71 |
-
|
72 |
-
public function getOauth64()
|
73 |
-
{
|
74 |
-
$token = $this->getToken();
|
75 |
-
return base64_encode("user=" . $this->oauthUserEmail . "\001auth=Bearer " . $token . "\001\001");
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mail/engines/class.pop3.php
DELETED
@@ -1,407 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* PHPMailer POP-Before-SMTP Authentication Class.
|
4 |
-
* PHP Version 5
|
5 |
-
* @package PHPMailer
|
6 |
-
* @link https://github.com/PHPMailer/PHPMailer/
|
7 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
8 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
9 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
10 |
-
* @author Brent R. Matzelle (original founder)
|
11 |
-
* @copyright 2012 - 2014 Marcus Bointon
|
12 |
-
* @copyright 2010 - 2012 Jim Jagielski
|
13 |
-
* @copyright 2004 - 2009 Andy Prevost
|
14 |
-
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
15 |
-
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
16 |
-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE.
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHPMailer POP-Before-SMTP Authentication Class.
|
22 |
-
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
|
23 |
-
* Does not support APOP.
|
24 |
-
* @package PHPMailer
|
25 |
-
* @author Richard Davey (original author) <rich@corephp.co.uk>
|
26 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
27 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
28 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
29 |
-
*/
|
30 |
-
class POP3
|
31 |
-
{
|
32 |
-
/**
|
33 |
-
* The POP3 PHPMailer Version number.
|
34 |
-
* @var string
|
35 |
-
* @access public
|
36 |
-
*/
|
37 |
-
public $Version = '5.2.17';
|
38 |
-
|
39 |
-
/**
|
40 |
-
* Default POP3 port number.
|
41 |
-
* @var integer
|
42 |
-
* @access public
|
43 |
-
*/
|
44 |
-
public $POP3_PORT = 110;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Default timeout in seconds.
|
48 |
-
* @var integer
|
49 |
-
* @access public
|
50 |
-
*/
|
51 |
-
public $POP3_TIMEOUT = 30;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* POP3 Carriage Return + Line Feed.
|
55 |
-
* @var string
|
56 |
-
* @access public
|
57 |
-
* @deprecated Use the constant instead
|
58 |
-
*/
|
59 |
-
public $CRLF = "\r\n";
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Debug display level.
|
63 |
-
* Options: 0 = no, 1+ = yes
|
64 |
-
* @var integer
|
65 |
-
* @access public
|
66 |
-
*/
|
67 |
-
public $do_debug = 0;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* POP3 mail server hostname.
|
71 |
-
* @var string
|
72 |
-
* @access public
|
73 |
-
*/
|
74 |
-
public $host;
|
75 |
-
|
76 |
-
/**
|
77 |
-
* POP3 port number.
|
78 |
-
* @var integer
|
79 |
-
* @access public
|
80 |
-
*/
|
81 |
-
public $port;
|
82 |
-
|
83 |
-
/**
|
84 |
-
* POP3 Timeout Value in seconds.
|
85 |
-
* @var integer
|
86 |
-
* @access public
|
87 |
-
*/
|
88 |
-
public $tval;
|
89 |
-
|
90 |
-
/**
|
91 |
-
* POP3 username
|
92 |
-
* @var string
|
93 |
-
* @access public
|
94 |
-
*/
|
95 |
-
public $username;
|
96 |
-
|
97 |
-
/**
|
98 |
-
* POP3 password.
|
99 |
-
* @var string
|
100 |
-
* @access public
|
101 |
-
*/
|
102 |
-
public $password;
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Resource handle for the POP3 connection socket.
|
106 |
-
* @var resource
|
107 |
-
* @access protected
|
108 |
-
*/
|
109 |
-
protected $pop_conn;
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Are we connected?
|
113 |
-
* @var boolean
|
114 |
-
* @access protected
|
115 |
-
*/
|
116 |
-
protected $connected = false;
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Error container.
|
120 |
-
* @var array
|
121 |
-
* @access protected
|
122 |
-
*/
|
123 |
-
protected $errors = array();
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Line break constant
|
127 |
-
*/
|
128 |
-
const CRLF = "\r\n";
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Simple static wrapper for all-in-one POP before SMTP
|
132 |
-
* @param $host
|
133 |
-
* @param integer|boolean $port The port number to connect to
|
134 |
-
* @param integer|boolean $timeout The timeout value
|
135 |
-
* @param string $username
|
136 |
-
* @param string $password
|
137 |
-
* @param integer $debug_level
|
138 |
-
* @return boolean
|
139 |
-
*/
|
140 |
-
public static function popBeforeSmtp(
|
141 |
-
$host,
|
142 |
-
$port = false,
|
143 |
-
$timeout = false,
|
144 |
-
$username = '',
|
145 |
-
$password = '',
|
146 |
-
$debug_level = 0
|
147 |
-
) {
|
148 |
-
$pop = new POP3;
|
149 |
-
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Authenticate with a POP3 server.
|
154 |
-
* A connect, login, disconnect sequence
|
155 |
-
* appropriate for POP-before SMTP authorisation.
|
156 |
-
* @access public
|
157 |
-
* @param string $host The hostname to connect to
|
158 |
-
* @param integer|boolean $port The port number to connect to
|
159 |
-
* @param integer|boolean $timeout The timeout value
|
160 |
-
* @param string $username
|
161 |
-
* @param string $password
|
162 |
-
* @param integer $debug_level
|
163 |
-
* @return boolean
|
164 |
-
*/
|
165 |
-
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
|
166 |
-
{
|
167 |
-
$this->host = $host;
|
168 |
-
// If no port value provided, use default
|
169 |
-
if (false === $port) {
|
170 |
-
$this->port = $this->POP3_PORT;
|
171 |
-
} else {
|
172 |
-
$this->port = (integer)$port;
|
173 |
-
}
|
174 |
-
// If no timeout value provided, use default
|
175 |
-
if (false === $timeout) {
|
176 |
-
$this->tval = $this->POP3_TIMEOUT;
|
177 |
-
} else {
|
178 |
-
$this->tval = (integer)$timeout;
|
179 |
-
}
|
180 |
-
$this->do_debug = $debug_level;
|
181 |
-
$this->username = $username;
|
182 |
-
$this->password = $password;
|
183 |
-
// Reset the error log
|
184 |
-
$this->errors = array();
|
185 |
-
// connect
|
186 |
-
$result = $this->connect($this->host, $this->port, $this->tval);
|
187 |
-
if ($result) {
|
188 |
-
$login_result = $this->login($this->username, $this->password);
|
189 |
-
if ($login_result) {
|
190 |
-
$this->disconnect();
|
191 |
-
return true;
|
192 |
-
}
|
193 |
-
}
|
194 |
-
// We need to disconnect regardless of whether the login succeeded
|
195 |
-
$this->disconnect();
|
196 |
-
return false;
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Connect to a POP3 server.
|
201 |
-
* @access public
|
202 |
-
* @param string $host
|
203 |
-
* @param integer|boolean $port
|
204 |
-
* @param integer $tval
|
205 |
-
* @return boolean
|
206 |
-
*/
|
207 |
-
public function connect($host, $port = false, $tval = 30)
|
208 |
-
{
|
209 |
-
// Are we already connected?
|
210 |
-
if ($this->connected) {
|
211 |
-
return true;
|
212 |
-
}
|
213 |
-
|
214 |
-
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
|
215 |
-
//Rather than suppress it with @fsockopen, capture it cleanly instead
|
216 |
-
set_error_handler(array($this, 'catchWarning'));
|
217 |
-
|
218 |
-
if (false === $port) {
|
219 |
-
$port = $this->POP3_PORT;
|
220 |
-
}
|
221 |
-
|
222 |
-
// connect to the POP3 server
|
223 |
-
$this->pop_conn = fsockopen(
|
224 |
-
$host, // POP3 Host
|
225 |
-
$port, // Port #
|
226 |
-
$errno, // Error Number
|
227 |
-
$errstr, // Error Message
|
228 |
-
$tval
|
229 |
-
); // Timeout (seconds)
|
230 |
-
// Restore the error handler
|
231 |
-
restore_error_handler();
|
232 |
-
|
233 |
-
// Did we connect?
|
234 |
-
if (false === $this->pop_conn) {
|
235 |
-
// It would appear not...
|
236 |
-
$this->setError(array(
|
237 |
-
'error' => "Failed to connect to server $host on port $port",
|
238 |
-
'errno' => $errno,
|
239 |
-
'errstr' => $errstr
|
240 |
-
));
|
241 |
-
return false;
|
242 |
-
}
|
243 |
-
|
244 |
-
// Increase the stream time-out
|
245 |
-
stream_set_timeout($this->pop_conn, $tval, 0);
|
246 |
-
|
247 |
-
// Get the POP3 server response
|
248 |
-
$pop3_response = $this->getResponse();
|
249 |
-
// Check for the +OK
|
250 |
-
if ($this->checkResponse($pop3_response)) {
|
251 |
-
// The connection is established and the POP3 server is talking
|
252 |
-
$this->connected = true;
|
253 |
-
return true;
|
254 |
-
}
|
255 |
-
return false;
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Log in to the POP3 server.
|
260 |
-
* Does not support APOP (RFC 2828, 4949).
|
261 |
-
* @access public
|
262 |
-
* @param string $username
|
263 |
-
* @param string $password
|
264 |
-
* @return boolean
|
265 |
-
*/
|
266 |
-
public function login($username = '', $password = '')
|
267 |
-
{
|
268 |
-
if (!$this->connected) {
|
269 |
-
$this->setError('Not connected to POP3 server');
|
270 |
-
}
|
271 |
-
if (empty($username)) {
|
272 |
-
$username = $this->username;
|
273 |
-
}
|
274 |
-
if (empty($password)) {
|
275 |
-
$password = $this->password;
|
276 |
-
}
|
277 |
-
|
278 |
-
// Send the Username
|
279 |
-
$this->sendString("USER $username" . self::CRLF);
|
280 |
-
$pop3_response = $this->getResponse();
|
281 |
-
if ($this->checkResponse($pop3_response)) {
|
282 |
-
// Send the Password
|
283 |
-
$this->sendString("PASS $password" . self::CRLF);
|
284 |
-
$pop3_response = $this->getResponse();
|
285 |
-
if ($this->checkResponse($pop3_response)) {
|
286 |
-
return true;
|
287 |
-
}
|
288 |
-
}
|
289 |
-
return false;
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Disconnect from the POP3 server.
|
294 |
-
* @access public
|
295 |
-
*/
|
296 |
-
public function disconnect()
|
297 |
-
{
|
298 |
-
$this->sendString('QUIT');
|
299 |
-
//The QUIT command may cause the daemon to exit, which will kill our connection
|
300 |
-
//So ignore errors here
|
301 |
-
try {
|
302 |
-
@fclose($this->pop_conn);
|
303 |
-
} catch (Exception $e) {
|
304 |
-
//Do nothing
|
305 |
-
};
|
306 |
-
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* Get a response from the POP3 server.
|
310 |
-
* $size is the maximum number of bytes to retrieve
|
311 |
-
* @param integer $size
|
312 |
-
* @return string
|
313 |
-
* @access protected
|
314 |
-
*/
|
315 |
-
protected function getResponse($size = 128)
|
316 |
-
{
|
317 |
-
$response = fgets($this->pop_conn, $size);
|
318 |
-
if ($this->do_debug >= 1) {
|
319 |
-
echo "Server -> Client: $response";
|
320 |
-
}
|
321 |
-
return $response;
|
322 |
-
}
|
323 |
-
|
324 |
-
/**
|
325 |
-
* Send raw data to the POP3 server.
|
326 |
-
* @param string $string
|
327 |
-
* @return integer
|
328 |
-
* @access protected
|
329 |
-
*/
|
330 |
-
protected function sendString($string)
|
331 |
-
{
|
332 |
-
if ($this->pop_conn) {
|
333 |
-
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
|
334 |
-
echo "Client -> Server: $string";
|
335 |
-
}
|
336 |
-
return fwrite($this->pop_conn, $string, strlen($string));
|
337 |
-
}
|
338 |
-
return 0;
|
339 |
-
}
|
340 |
-
|
341 |
-
/**
|
342 |
-
* Checks the POP3 server response.
|
343 |
-
* Looks for for +OK or -ERR.
|
344 |
-
* @param string $string
|
345 |
-
* @return boolean
|
346 |
-
* @access protected
|
347 |
-
*/
|
348 |
-
protected function checkResponse($string)
|
349 |
-
{
|
350 |
-
if (substr($string, 0, 3) !== '+OK') {
|
351 |
-
$this->setError(array(
|
352 |
-
'error' => "Server reported an error: $string",
|
353 |
-
'errno' => 0,
|
354 |
-
'errstr' => ''
|
355 |
-
));
|
356 |
-
return false;
|
357 |
-
} else {
|
358 |
-
return true;
|
359 |
-
}
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Add an error to the internal error store.
|
364 |
-
* Also display debug output if it's enabled.
|
365 |
-
* @param $error
|
366 |
-
* @access protected
|
367 |
-
*/
|
368 |
-
protected function setError($error)
|
369 |
-
{
|
370 |
-
$this->errors[] = $error;
|
371 |
-
if ($this->do_debug >= 1) {
|
372 |
-
echo '<pre>';
|
373 |
-
foreach ($this->errors as $error) {
|
374 |
-
print_r($error);
|
375 |
-
}
|
376 |
-
echo '</pre>';
|
377 |
-
}
|
378 |
-
}
|
379 |
-
|
380 |
-
/**
|
381 |
-
* Get an array of error messages, if any.
|
382 |
-
* @return array
|
383 |
-
*/
|
384 |
-
public function getErrors()
|
385 |
-
{
|
386 |
-
return $this->errors;
|
387 |
-
}
|
388 |
-
|
389 |
-
/**
|
390 |
-
* POP3 connection error handler.
|
391 |
-
* @param integer $errno
|
392 |
-
* @param string $errstr
|
393 |
-
* @param string $errfile
|
394 |
-
* @param integer $errline
|
395 |
-
* @access protected
|
396 |
-
*/
|
397 |
-
protected function catchWarning($errno, $errstr, $errfile, $errline)
|
398 |
-
{
|
399 |
-
$this->setError(array(
|
400 |
-
'error' => "Connecting to the POP3 server raised a PHP warning: ",
|
401 |
-
'errno' => $errno,
|
402 |
-
'errstr' => $errstr,
|
403 |
-
'errfile' => $errfile,
|
404 |
-
'errline' => $errline
|
405 |
-
));
|
406 |
-
}
|
407 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mail/engines/class.smtp.php
DELETED
@@ -1,1249 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* PHPMailer RFC821 SMTP email transport class.
|
4 |
-
* PHP Version 5
|
5 |
-
* @package PHPMailer
|
6 |
-
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
|
7 |
-
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
|
8 |
-
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
|
9 |
-
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
|
10 |
-
* @author Brent R. Matzelle (original founder)
|
11 |
-
* @copyright 2014 Marcus Bointon
|
12 |
-
* @copyright 2010 - 2012 Jim Jagielski
|
13 |
-
* @copyright 2004 - 2009 Andy Prevost
|
14 |
-
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
15 |
-
* @note This program is distributed in the hope that it will be useful - WITHOUT
|
16 |
-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE.
|
18 |
-
*/
|
19 |
-
|
20 |
-
/**
|
21 |
-
* PHPMailer RFC821 SMTP email transport class.
|
22 |
-
* Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.
|
23 |
-
* @package PHPMailer
|
24 |
-
* @author Chris Ryan
|
25 |
-
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
26 |
-
*/
|
27 |
-
class SMTP
|
28 |
-
{
|
29 |
-
/**
|
30 |
-
* The PHPMailer SMTP version number.
|
31 |
-
* @var string
|
32 |
-
*/
|
33 |
-
const VERSION = '5.2.17';
|
34 |
-
|
35 |
-
/**
|
36 |
-
* SMTP line break constant.
|
37 |
-
* @var string
|
38 |
-
*/
|
39 |
-
const CRLF = "\r\n";
|
40 |
-
|
41 |
-
/**
|
42 |
-
* The SMTP port to use if one is not specified.
|
43 |
-
* @var integer
|
44 |
-
*/
|
45 |
-
const DEFAULT_SMTP_PORT = 25;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* The maximum line length allowed by RFC 2822 section 2.1.1
|
49 |
-
* @var integer
|
50 |
-
*/
|
51 |
-
const MAX_LINE_LENGTH = 998;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Debug level for no output
|
55 |
-
*/
|
56 |
-
const DEBUG_OFF = 0;
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Debug level to show client -> server messages
|
60 |
-
*/
|
61 |
-
const DEBUG_CLIENT = 1;
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Debug level to show client -> server and server -> client messages
|
65 |
-
*/
|
66 |
-
const DEBUG_SERVER = 2;
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Debug level to show connection status, client -> server and server -> client messages
|
70 |
-
*/
|
71 |
-
const DEBUG_CONNECTION = 3;
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Debug level to show all messages
|
75 |
-
*/
|
76 |
-
const DEBUG_LOWLEVEL = 4;
|
77 |
-
|
78 |
-
/**
|
79 |
-
* The PHPMailer SMTP Version number.
|
80 |
-
* @var string
|
81 |
-
* @deprecated Use the `VERSION` constant instead
|
82 |
-
* @see SMTP::VERSION
|
83 |
-
*/
|
84 |
-
public $Version = '5.2.17';
|
85 |
-
|
86 |
-
/**
|
87 |
-
* SMTP server port number.
|
88 |
-
* @var integer
|
89 |
-
* @deprecated This is only ever used as a default value, so use the `DEFAULT_SMTP_PORT` constant instead
|
90 |
-
* @see SMTP::DEFAULT_SMTP_PORT
|
91 |
-
*/
|
92 |
-
public $SMTP_PORT = 25;
|
93 |
-
|
94 |
-
/**
|
95 |
-
* SMTP reply line ending.
|
96 |
-
* @var string
|
97 |
-
* @deprecated Use the `CRLF` constant instead
|
98 |
-
* @see SMTP::CRLF
|
99 |
-
*/
|
100 |
-
public $CRLF = "\r\n";
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Debug output level.
|
104 |
-
* Options:
|
105 |
-
* * self::DEBUG_OFF (`0`) No debug output, default
|
106 |
-
* * self::DEBUG_CLIENT (`1`) Client commands
|
107 |
-
* * self::DEBUG_SERVER (`2`) Client commands and server responses
|
108 |
-
* * self::DEBUG_CONNECTION (`3`) As DEBUG_SERVER plus connection status
|
109 |
-
* * self::DEBUG_LOWLEVEL (`4`) Low-level data output, all messages
|
110 |
-
* @var integer
|
111 |
-
*/
|
112 |
-
public $do_debug = self::DEBUG_OFF;
|
113 |
-
|
114 |
-
/**
|
115 |
-
* How to handle debug output.
|
116 |
-
* Options:
|
117 |
-
* * `echo` Output plain-text as-is, appropriate for CLI
|
118 |
-
* * `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output
|
119 |
-
* * `error_log` Output to error log as configured in php.ini
|
120 |
-
*
|
121 |
-
* Alternatively, you can provide a callable expecting two params: a message string and the debug level:
|
122 |
-
* <code>
|
123 |
-
* $smtp->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};
|
124 |
-
* </code>
|
125 |
-
* @var string|callable
|
126 |
-
*/
|
127 |
-
public $Debugoutput = 'echo';
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Whether to use VERP.
|
131 |
-
* @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
|
132 |
-
* @link http://www.postfix.org/VERP_README.html Info on VERP
|
133 |
-
* @var boolean
|
134 |
-
*/
|
135 |
-
public $do_verp = false;
|
136 |
-
|
137 |
-
/**
|
138 |
-
* The timeout value for connection, in seconds.
|
139 |
-
* Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
|
140 |
-
* This needs to be quite high to function correctly with hosts using greetdelay as an anti-spam measure.
|
141 |
-
* @link http://tools.ietf.org/html/rfc2821#section-4.5.3.2
|
142 |
-
* @var integer
|
143 |
-
*/
|
144 |
-
public $Timeout = 300;
|
145 |
-
|
146 |
-
/**
|
147 |
-
* How long to wait for commands to complete, in seconds.
|
148 |
-
* Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2
|
149 |
-
* @var integer
|
150 |
-
*/
|
151 |
-
public $Timelimit = 300;
|
152 |
-
|
153 |
-
/**
|
154 |
-
* @var array patterns to extract smtp transaction id from smtp reply
|
155 |
-
* Only first capture group will be use, use non-capturing group to deal with it
|
156 |
-
* Extend this class to override this property to fulfil your needs.
|
157 |
-
*/
|
158 |
-
protected $smtp_transaction_id_patterns = array(
|
159 |
-
'exim' => '/[0-9]{3} OK id=(.*)/',
|
160 |
-
'sendmail' => '/[0-9]{3} 2.0.0 (.*) Message/',
|
161 |
-
'postfix' => '/[0-9]{3} 2.0.0 Ok: queued as (.*)/'
|
162 |
-
);
|
163 |
-
|
164 |
-
/**
|
165 |
-
* The socket for the server connection.
|
166 |
-
* @var resource
|
167 |
-
*/
|
168 |
-
protected $smtp_conn;
|
169 |
-
|
170 |
-
/**
|
171 |
-
* Error information, if any, for the last SMTP command.
|
172 |
-
* @var array
|
173 |
-
*/
|
174 |
-
protected $error = array(
|
175 |
-
'error' => '',
|
176 |
-
'detail' => '',
|
177 |
-
'smtp_code' => '',
|
178 |
-
'smtp_code_ex' => ''
|
179 |
-
);
|
180 |
-
|
181 |
-
/**
|
182 |
-
* The reply the server sent to us for HELO.
|
183 |
-
* If null, no HELO string has yet been received.
|
184 |
-
* @var string|null
|
185 |
-
*/
|
186 |
-
protected $helo_rply = null;
|
187 |
-
|
188 |
-
/**
|
189 |
-
* The set of SMTP extensions sent in reply to EHLO command.
|
190 |
-
* Indexes of the array are extension names.
|
191 |
-
* Value at index 'HELO' or 'EHLO' (according to command that was sent)
|
192 |
-
* represents the server name. In case of HELO it is the only element of the array.
|
193 |
-
* Other values can be boolean TRUE or an array containing extension options.
|
194 |
-
* If null, no HELO/EHLO string has yet been received.
|
195 |
-
* @var array|null
|
196 |
-
*/
|
197 |
-
protected $server_caps = null;
|
198 |
-
|
199 |
-
/**
|
200 |
-
* The most recent reply received from the server.
|
201 |
-
* @var string
|
202 |
-
*/
|
203 |
-
protected $last_reply = '';
|
204 |
-
|
205 |
-
/**
|
206 |
-
* Output debugging info via a user-selected method.
|
207 |
-
* @see SMTP::$Debugoutput
|
208 |
-
* @see SMTP::$do_debug
|
209 |
-
* @param string $str Debug string to output
|
210 |
-
* @param integer $level The debug level of this message; see DEBUG_* constants
|
211 |
-
* @return void
|
212 |
-
*/
|
213 |
-
protected function edebug($str, $level = 0)
|
214 |
-
{
|
215 |
-
if ($level > $this->do_debug) {
|
216 |
-
return;
|
217 |
-
}
|
218 |
-
//Avoid clash with built-in function names
|
219 |
-
if (!in_array($this->Debugoutput, array('error_log', 'html', 'echo')) and is_callable($this->Debugoutput)) {
|
220 |
-
call_user_func($this->Debugoutput, $str, $level);
|
221 |
-
return;
|
222 |
-
}
|
223 |
-
switch ($this->Debugoutput) {
|
224 |
-
case 'error_log':
|
225 |
-
//Don't output, just log
|
226 |
-
error_log($str);
|
227 |
-
break;
|
228 |
-
case 'html':
|
229 |
-
//Cleans up output a bit for a better looking, HTML-safe output
|
230 |
-
echo htmlentities(
|
231 |
-
preg_replace('/[\r\n]+/', '', $str),
|
232 |
-
ENT_QUOTES,
|
233 |
-
'UTF-8'
|
234 |
-
)
|
235 |
-
. "<br>\n";
|
236 |
-
break;
|
237 |
-
case 'echo':
|
238 |
-
default:
|
239 |
-
//Normalize line breaks
|
240 |
-
$str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str);
|
241 |
-
echo gmdate('Y-m-d H:i:s') . "\t" . str_replace(
|
242 |
-
"\n",
|
243 |
-
"\n \t ",
|
244 |
-
trim($str)
|
245 |
-
)."\n";
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
/**
|
250 |
-
* Connect to an SMTP server.
|
251 |
-
* @param string $host SMTP server IP or host name
|
252 |
-
* @param integer $port The port number to connect to
|
253 |
-
* @param integer $timeout How long to wait for the connection to open
|
254 |
-
* @param array $options An array of options for stream_context_create()
|
255 |
-
* @access public
|
256 |
-
* @return boolean
|
257 |
-
*/
|
258 |
-
public function connect($host, $port = null, $timeout = 30, $options = array())
|
259 |
-
{
|
260 |
-
static $streamok;
|
261 |
-
//This is enabled by default since 5.0.0 but some providers disable it
|
262 |
-
//Check this once and cache the result
|
263 |
-
if (is_null($streamok)) {
|
264 |
-
$streamok = function_exists('stream_socket_client');
|
265 |
-
}
|
266 |
-
// Clear errors to avoid confusion
|
267 |
-
$this->setError('');
|
268 |
-
// Make sure we are __not__ connected
|
269 |
-
if ($this->connected()) {
|
270 |
-
// Already connected, generate error
|
271 |
-
$this->setError('Already connected to a server');
|
272 |
-
return false;
|
273 |
-
}
|
274 |
-
if (empty($port)) {
|
275 |
-
$port = self::DEFAULT_SMTP_PORT;
|
276 |
-
}
|
277 |
-
// Connect to the SMTP server
|
278 |
-
$this->edebug(
|
279 |
-
"Connection: opening to $host:$port, timeout=$timeout, options=".var_export($options, true),
|
280 |
-
self::DEBUG_CONNECTION
|
281 |
-
);
|
282 |
-
$errno = 0;
|
283 |
-
$errstr = '';
|
284 |
-
if ($streamok) {
|
285 |
-
$socket_context = stream_context_create($options);
|
286 |
-
set_error_handler(array($this, 'errorHandler'));
|
287 |
-
$this->smtp_conn = stream_socket_client(
|
288 |
-
$host . ":" . $port,
|
289 |
-
$errno,
|
290 |
-
$errstr,
|
291 |
-
$timeout,
|
292 |
-
STREAM_CLIENT_CONNECT,
|
293 |
-
$socket_context
|
294 |
-
);
|
295 |
-
restore_error_handler();
|
296 |
-
} else {
|
297 |
-
//Fall back to fsockopen which should work in more places, but is missing some features
|
298 |
-
$this->edebug(
|
299 |
-
"Connection: stream_socket_client not available, falling back to fsockopen",
|
300 |
-
self::DEBUG_CONNECTION
|
301 |
-
);
|
302 |
-
set_error_handler(array($this, 'errorHandler'));
|
303 |
-
$this->smtp_conn = fsockopen(
|
304 |
-
$host,
|
305 |
-
$port,
|
306 |
-
$errno,
|
307 |
-
$errstr,
|
308 |
-
$timeout
|
309 |
-
);
|
310 |
-
restore_error_handler();
|
311 |
-
}
|
312 |
-
// Verify we connected properly
|
313 |
-
if (!is_resource($this->smtp_conn)) {
|
314 |
-
$this->setError(
|
315 |
-
'Failed to connect to server',
|
316 |
-
$errno,
|
317 |
-
$errstr
|
318 |
-
);
|
319 |
-
$this->edebug(
|
320 |
-
'SMTP ERROR: ' . $this->error['error']
|
321 |
-
. ": $errstr ($errno)",
|
322 |
-
self::DEBUG_CLIENT
|
323 |
-
);
|
324 |
-
return false;
|
325 |
-
}
|
326 |
-
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
327 |
-
// SMTP server can take longer to respond, give longer timeout for first read
|
328 |
-
// Windows does not have support for this timeout function
|
329 |
-
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
330 |
-
$max = ini_get('max_execution_time');
|
331 |
-
// Don't bother if unlimited
|
332 |
-
if ($max != 0 && $timeout > $max) {
|
333 |
-
@set_time_limit($timeout);
|
334 |
-
}
|
335 |
-
stream_set_timeout($this->smtp_conn, $timeout, 0);
|
336 |
-
}
|
337 |
-
// Get any announcement
|
338 |
-
$announce = $this->get_lines();
|
339 |
-
$this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
|
340 |
-
return true;
|
341 |
-
}
|
342 |
-
|
343 |
-
/**
|
344 |
-
* Initiate a TLS (encrypted) session.
|
345 |
-
* @access public
|
346 |
-
* @return boolean
|
347 |
-
*/
|
348 |
-
public function startTLS()
|
349 |
-
{
|
350 |
-
if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) {
|
351 |
-
return false;
|
352 |
-
}
|
353 |
-
|
354 |
-
//Allow the best TLS version(s) we can
|
355 |
-
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
|
356 |
-
|
357 |
-
//PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT
|
358 |
-
//so add them back in manually if we can
|
359 |
-
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
|
360 |
-
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
361 |
-
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
|
362 |
-
}
|
363 |
-
|
364 |
-
// Begin encrypted connection
|
365 |
-
if (!stream_socket_enable_crypto(
|
366 |
-
$this->smtp_conn,
|
367 |
-
true,
|
368 |
-
$crypto_method
|
369 |
-
)) {
|
370 |
-
return false;
|
371 |
-
}
|
372 |
-
return true;
|
373 |
-
}
|
374 |
-
|
375 |
-
/**
|
376 |
-
* Perform SMTP authentication.
|
377 |
-
* Must be run after hello().
|
378 |
-
* @see hello()
|
379 |
-
* @param string $username The user name
|
380 |
-
* @param string $password The password
|
381 |
-
* @param string $authtype The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5, XOAUTH2)
|
382 |
-
* @param string $realm The auth realm for NTLM
|
383 |
-
* @param string $workstation The auth workstation for NTLM
|
384 |
-
* @param null|OAuth $OAuth An optional OAuth instance (@see PHPMailerOAuth)
|
385 |
-
* @return bool True if successfully authenticated.* @access public
|
386 |
-
*/
|
387 |
-
public function authenticate(
|
388 |
-
$username,
|
389 |
-
$password,
|
390 |
-
$authtype = null,
|
391 |
-
$realm = '',
|
392 |
-
$workstation = '',
|
393 |
-
$OAuth = null
|
394 |
-
) {
|
395 |
-
if (!$this->server_caps) {
|
396 |
-
$this->setError('Authentication is not allowed before HELO/EHLO');
|
397 |
-
return false;
|
398 |
-
}
|
399 |
-
|
400 |
-
if (array_key_exists('EHLO', $this->server_caps)) {
|
401 |
-
// SMTP extensions are available. Let's try to find a proper authentication method
|
402 |
-
|
403 |
-
if (!array_key_exists('AUTH', $this->server_caps)) {
|
404 |
-
$this->setError('Authentication is not allowed at this stage');
|
405 |
-
// 'at this stage' means that auth may be allowed after the stage changes
|
406 |
-
// e.g. after STARTTLS
|
407 |
-
return false;
|
408 |
-
}
|
409 |
-
|
410 |
-
self::edebug('Auth method requested: ' . ($authtype ? $authtype : 'UNKNOWN'), self::DEBUG_LOWLEVEL);
|
411 |
-
self::edebug(
|
412 |
-
'Auth methods available on the server: ' . implode(',', $this->server_caps['AUTH']),
|
413 |
-
self::DEBUG_LOWLEVEL
|
414 |
-
);
|
415 |
-
|
416 |
-
if (empty($authtype)) {
|
417 |
-
foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) {
|
418 |
-
if (in_array($method, $this->server_caps['AUTH'])) {
|
419 |
-
$authtype = $method;
|
420 |
-
break;
|
421 |
-
}
|
422 |
-
}
|
423 |
-
if (empty($authtype)) {
|
424 |
-
$this->setError('No supported authentication methods found');
|
425 |
-
return false;
|
426 |
-
}
|
427 |
-
self::edebug('Auth method selected: '.$authtype, self::DEBUG_LOWLEVEL);
|
428 |
-
}
|
429 |
-
|
430 |
-
if (!in_array($authtype, $this->server_caps['AUTH'])) {
|
431 |
-
$this->setError("The requested authentication method \"$authtype\" is not supported by the server");
|
432 |
-
return false;
|
433 |
-
}
|
434 |
-
} elseif (empty($authtype)) {
|
435 |
-
$authtype = 'LOGIN';
|
436 |
-
}
|
437 |
-
switch ($authtype) {
|
438 |
-
case 'PLAIN':
|
439 |
-
// Start authentication
|
440 |
-
if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
|
441 |
-
return false;
|
442 |
-
}
|
443 |
-
// Send encoded username and password
|
444 |
-
if (!$this->sendCommand(
|
445 |
-
'User & Password',
|
446 |
-
base64_encode("\0" . $username . "\0" . $password),
|
447 |
-
235
|
448 |
-
)
|
449 |
-
) {
|
450 |
-
return false;
|
451 |
-
}
|
452 |
-
break;
|
453 |
-
case 'LOGIN':
|
454 |
-
// Start authentication
|
455 |
-
if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
|
456 |
-
return false;
|
457 |
-
}
|
458 |
-
if (!$this->sendCommand("Username", base64_encode($username), 334)) {
|
459 |
-
return false;
|
460 |
-
}
|
461 |
-
if (!$this->sendCommand("Password", base64_encode($password), 235)) {
|
462 |
-
return false;
|
463 |
-
}
|
464 |
-
break;
|
465 |
-
case 'XOAUTH2':
|
466 |
-
//If the OAuth Instance is not set. Can be a case when PHPMailer is used
|
467 |
-
//instead of PHPMailerOAuth
|
468 |
-
if (is_null($OAuth)) {
|
469 |
-
return false;
|
470 |
-
}
|
471 |
-
$oauth = $OAuth->getOauth64();
|
472 |
-
|
473 |
-
// Start authentication
|
474 |
-
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
|
475 |
-
return false;
|
476 |
-
}
|
477 |
-
break;
|
478 |
-
case 'NTLM':
|
479 |
-
/*
|
480 |
-
* ntlm_sasl_client.php
|
481 |
-
* Bundled with Permission
|
482 |
-
*
|
483 |
-
* How to telnet in windows:
|
484 |
-
* http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
|
485 |
-
* PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
|
486 |
-
*/
|
487 |
-
require_once 'extras/ntlm_sasl_client.php';
|
488 |
-
$temp = new stdClass;
|
489 |
-
$ntlm_client = new ntlm_sasl_client_class;
|
490 |
-
//Check that functions are available
|
491 |
-
if (!$ntlm_client->initialize($temp)) {
|
492 |
-
$this->setError($temp->error);
|
493 |
-
$this->edebug(
|
494 |
-
'You need to enable some modules in your php.ini file: '
|
495 |
-
. $this->error['error'],
|
496 |
-
self::DEBUG_CLIENT
|
497 |
-
);
|
498 |
-
return false;
|
499 |
-
}
|
500 |
-
//msg1
|
501 |
-
$msg1 = $ntlm_client->typeMsg1($realm, $workstation); //msg1
|
502 |
-
|
503 |
-
if (!$this->sendCommand(
|
504 |
-
'AUTH NTLM',
|
505 |
-
'AUTH NTLM ' . base64_encode($msg1),
|
506 |
-
334
|
507 |
-
)
|
508 |
-
) {
|
509 |
-
return false;
|
510 |
-
}
|
511 |
-
//Though 0 based, there is a white space after the 3 digit number
|
512 |
-
//msg2
|
513 |
-
$challenge = substr($this->last_reply, 3);
|
514 |
-
$challenge = base64_decode($challenge);
|
515 |
-
$ntlm_res = $ntlm_client->NTLMResponse(
|
516 |
-
substr($challenge, 24, 8),
|
517 |
-
$password
|
518 |
-
);
|
519 |
-
//msg3
|
520 |
-
$msg3 = $ntlm_client->typeMsg3(
|
521 |
-
$ntlm_res,
|
522 |
-
$username,
|
523 |
-
$realm,
|
524 |
-
$workstation
|
525 |
-
);
|
526 |
-
// send encoded username
|
527 |
-
return $this->sendCommand('Username', base64_encode($msg3), 235);
|
528 |
-
case 'CRAM-MD5':
|
529 |
-
// Start authentication
|
530 |
-
if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
|
531 |
-
return false;
|
532 |
-
}
|
533 |
-
// Get the challenge
|
534 |
-
$challenge = base64_decode(substr($this->last_reply, 4));
|
535 |
-
|
536 |
-
// Build the response
|
537 |
-
$response = $username . ' ' . $this->hmac($challenge, $password);
|
538 |
-
|
539 |
-
// send encoded credentials
|
540 |
-
return $this->sendCommand('Username', base64_encode($response), 235);
|
541 |
-
default:
|
542 |
-
$this->setError("Authentication method \"$authtype\" is not supported");
|
543 |
-
return false;
|
544 |
-
}
|
545 |
-
return true;
|
546 |
-
}
|
547 |
-
|
548 |
-
/**
|
549 |
-
* Calculate an MD5 HMAC hash.
|
550 |
-
* Works like hash_hmac('md5', $data, $key)
|
551 |
-
* in case that function is not available
|
552 |
-
* @param string $data The data to hash
|
553 |
-
* @param string $key The key to hash with
|
554 |
-
* @access protected
|
555 |
-
* @return string
|
556 |
-
*/
|
557 |
-
protected function hmac($data, $key)
|
558 |
-
{
|
559 |
-
if (function_exists('hash_hmac')) {
|
560 |
-
return hash_hmac('md5', $data, $key);
|
561 |
-
}
|
562 |
-
|
563 |
-
// The following borrowed from
|
564 |
-
// http://php.net/manual/en/function.mhash.php#27225
|
565 |
-
|
566 |
-
// RFC 2104 HMAC implementation for php.
|
567 |
-
// Creates an md5 HMAC.
|
568 |
-
// Eliminates the need to install mhash to compute a HMAC
|
569 |
-
// by Lance Rushing
|
570 |
-
|
571 |
-
$bytelen = 64; // byte length for md5
|
572 |
-
if (strlen($key) > $bytelen) {
|
573 |
-
$key = pack('H*', md5($key));
|
574 |
-
}
|
575 |
-
$key = str_pad($key, $bytelen, chr(0x00));
|
576 |
-
$ipad = str_pad('', $bytelen, chr(0x36));
|
577 |
-
$opad = str_pad('', $bytelen, chr(0x5c));
|
578 |
-
$k_ipad = $key ^ $ipad;
|
579 |
-
$k_opad = $key ^ $opad;
|
580 |
-
|
581 |
-
return md5($k_opad . pack('H*', md5($k_ipad . $data)));
|
582 |
-
}
|
583 |
-
|
584 |
-
/**
|
585 |
-
* Check connection state.
|
586 |
-
* @access public
|
587 |
-
* @return boolean True if connected.
|
588 |
-
*/
|
589 |
-
public function connected()
|
590 |
-
{
|
591 |
-
if (is_resource($this->smtp_conn)) {
|
592 |
-
$sock_status = stream_get_meta_data($this->smtp_conn);
|
593 |
-
if ($sock_status['eof']) {
|
594 |
-
// The socket is valid but we are not connected
|
595 |
-
$this->edebug(
|
596 |
-
'SMTP NOTICE: EOF caught while checking if connected',
|
597 |
-
self::DEBUG_CLIENT
|
598 |
-
);
|
599 |
-
$this->close();
|
600 |
-
return false;
|
601 |
-
}
|
602 |
-
return true; // everything looks good
|
603 |
-
}
|
604 |
-
return false;
|
605 |
-
}
|
606 |
-
|
607 |
-
/**
|
608 |
-
* Close the socket and clean up the state of the class.
|
609 |
-
* Don't use this function without first trying to use QUIT.
|
610 |
-
* @see quit()
|
611 |
-
* @access public
|
612 |
-
* @return void
|
613 |
-
*/
|
614 |
-
public function close()
|
615 |
-
{
|
616 |
-
$this->setError('');
|
617 |
-
$this->server_caps = null;
|
618 |
-
$this->helo_rply = null;
|
619 |
-
if (is_resource($this->smtp_conn)) {
|
620 |
-
// close the connection and cleanup
|
621 |
-
fclose($this->smtp_conn);
|
622 |
-
$this->smtp_conn = null; //Makes for cleaner serialization
|
623 |
-
$this->edebug('Connection: closed', self::DEBUG_CONNECTION);
|
624 |
-
}
|
625 |
-
}
|
626 |
-
|
627 |
-
/**
|
628 |
-
* Send an SMTP DATA command.
|
629 |
-
* Issues a data command and sends the msg_data to the server,
|
630 |
-
* finializing the mail transaction. $msg_data is the message
|
631 |
-
* that is to be send with the headers. Each header needs to be
|
632 |
-
* on a single line followed by a <CRLF> with the message headers
|
633 |
-
* and the message body being separated by and additional <CRLF>.
|
634 |
-
* Implements rfc 821: DATA <CRLF>
|
635 |
-
* @param string $msg_data Message data to send
|
636 |
-
* @access public
|
637 |
-
* @return boolean
|
638 |
-
*/
|
639 |
-
public function data($msg_data)
|
640 |
-
{
|
641 |
-
//This will use the standard timelimit
|
642 |
-
if (!$this->sendCommand('DATA', 'DATA', 354)) {
|
643 |
-
return false;
|
644 |
-
}
|
645 |
-
|
646 |
-
/* The server is ready to accept data!
|
647 |
-
* According to rfc821 we should not send more than 1000 characters on a single line (including the CRLF)
|
648 |
-
* so we will break the data up into lines by \r and/or \n then if needed we will break each of those into
|
649 |
-
* smaller lines to fit within the limit.
|
650 |
-
* We will also look for lines that start with a '.' and prepend an additional '.'.
|
651 |
-
* NOTE: this does not count towards line-length limit.
|
652 |
-
*/
|
653 |
-
|
654 |
-
// Normalize line breaks before exploding
|
655 |
-
$lines = explode("\n", str_replace(array("\r\n", "\r"), "\n", $msg_data));
|
656 |
-
|
657 |
-
/* To distinguish between a complete RFC822 message and a plain message body, we check if the first field
|
658 |
-
* of the first line (':' separated) does not contain a space then it _should_ be a header and we will
|
659 |
-
* process all lines before a blank line as headers.
|
660 |
-
*/
|
661 |
-
|
662 |
-
$field = substr($lines[0], 0, strpos($lines[0], ':'));
|
663 |
-
$in_headers = false;
|
664 |
-
if (!empty($field) && strpos($field, ' ') === false) {
|
665 |
-
$in_headers = true;
|
666 |
-
}
|
667 |
-
|
668 |
-
foreach ($lines as $line) {
|
669 |
-
$lines_out = array();
|
670 |
-
if ($in_headers and $line == '') {
|
671 |
-
$in_headers = false;
|
672 |
-
}
|
673 |
-
//Break this line up into several smaller lines if it's too long
|
674 |
-
//Micro-optimisation: isset($str[$len]) is faster than (strlen($str) > $len),
|
675 |
-
while (isset($line[self::MAX_LINE_LENGTH])) {
|
676 |
-
//Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on
|
677 |
-
//so as to avoid breaking in the middle of a word
|
678 |
-
$pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' ');
|
679 |
-
//Deliberately matches both false and 0
|
680 |
-
if (!$pos) {
|
681 |
-
//No nice break found, add a hard break
|
682 |
-
$pos = self::MAX_LINE_LENGTH - 1;
|
683 |
-
$lines_out[] = substr($line, 0, $pos);
|
684 |
-
$line = substr($line, $pos);
|
685 |
-
} else {
|
686 |
-
//Break at the found point
|
687 |
-
$lines_out[] = substr($line, 0, $pos);
|
688 |
-
//Move along by the amount we dealt with
|
689 |
-
$line = substr($line, $pos + 1);
|
690 |
-
}
|
691 |
-
//If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1
|
692 |
-
if ($in_headers) {
|
693 |
-
$line = "\t" . $line;
|
694 |
-
}
|
695 |
-
}
|
696 |
-
$lines_out[] = $line;
|
697 |
-
|
698 |
-
//Send the lines to the server
|
699 |
-
foreach ($lines_out as $line_out) {
|
700 |
-
//RFC2821 section 4.5.2
|
701 |
-
if (!empty($line_out) and $line_out[0] == '.') {
|
702 |
-
$line_out = '.' . $line_out;
|
703 |
-
}
|
704 |
-
$this->client_send($line_out . self::CRLF);
|
705 |
-
}
|
706 |
-
}
|
707 |
-
|
708 |
-
//Message data has been sent, complete the command
|
709 |
-
//Increase timelimit for end of DATA command
|
710 |
-
$savetimelimit = $this->Timelimit;
|
711 |
-
$this->Timelimit = $this->Timelimit * 2;
|
712 |
-
$result = $this->sendCommand('DATA END', '.', 250);
|
713 |
-
//Restore timelimit
|
714 |
-
$this->Timelimit = $savetimelimit;
|
715 |
-
return $result;
|
716 |
-
}
|
717 |
-
|
718 |
-
/**
|
719 |
-
* Send an SMTP HELO or EHLO command.
|
720 |
-
* Used to identify the sending server to the receiving server.
|
721 |
-
* This makes sure that client and server are in a known state.
|
722 |
-
* Implements RFC 821: HELO <SP> <domain> <CRLF>
|
723 |
-
* and RFC 2821 EHLO.
|
724 |
-
* @param string $host The host name or IP to connect to
|
725 |
-
* @access public
|
726 |
-
* @return boolean
|
727 |
-
*/
|
728 |
-
public function hello($host = '')
|
729 |
-
{
|
730 |
-
//Try extended hello first (RFC 2821)
|
731 |
-
return (boolean)($this->sendHello('EHLO', $host) or $this->sendHello('HELO', $host));
|
732 |
-
}
|
733 |
-
|
734 |
-
/**
|
735 |
-
* Send an SMTP HELO or EHLO command.
|
736 |
-
* Low-level implementation used by hello()
|
737 |
-
* @see hello()
|
738 |
-
* @param string $hello The HELO string
|
739 |
-
* @param string $host The hostname to say we are
|
740 |
-
* @access protected
|
741 |
-
* @return boolean
|
742 |
-
*/
|
743 |
-
protected function sendHello($hello, $host)
|
744 |
-
{
|
745 |
-
$noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
|
746 |
-
$this->helo_rply = $this->last_reply;
|
747 |
-
if ($noerror) {
|
748 |
-
$this->parseHelloFields($hello);
|
749 |
-
} else {
|
750 |
-
$this->server_caps = null;
|
751 |
-
}
|
752 |
-
return $noerror;
|
753 |
-
}
|
754 |
-
|
755 |
-
/**
|
756 |
-
* Parse a reply to HELO/EHLO command to discover server extensions.
|
757 |
-
* In case of HELO, the only parameter that can be discovered is a server name.
|
758 |
-
* @access protected
|
759 |
-
* @param string $type - 'HELO' or 'EHLO'
|
760 |
-
*/
|
761 |
-
protected function parseHelloFields($type)
|
762 |
-
{
|
763 |
-
$this->server_caps = array();
|
764 |
-
$lines = explode("\n", $this->helo_rply);
|
765 |
-
|
766 |
-
foreach ($lines as $n => $s) {
|
767 |
-
//First 4 chars contain response code followed by - or space
|
768 |
-
$s = trim(substr($s, 4));
|
769 |
-
if (empty($s)) {
|
770 |
-
continue;
|
771 |
-
}
|
772 |
-
$fields = explode(' ', $s);
|
773 |
-
if (!empty($fields)) {
|
774 |
-
if (!$n) {
|
775 |
-
$name = $type;
|
776 |
-
$fields = $fields[0];
|
777 |
-
} else {
|
778 |
-
$name = array_shift($fields);
|
779 |
-
switch ($name) {
|
780 |
-
case 'SIZE':
|
781 |
-
$fields = ($fields ? $fields[0] : 0);
|
782 |
-
break;
|
783 |
-
case 'AUTH':
|
784 |
-
if (!is_array($fields)) {
|
785 |
-
$fields = array();
|
786 |
-
}
|
787 |
-
break;
|
788 |
-
default:
|
789 |
-
$fields = true;
|
790 |
-
}
|
791 |
-
}
|
792 |
-
$this->server_caps[$name] = $fields;
|
793 |
-
}
|
794 |
-
}
|
795 |
-
}
|
796 |
-
|
797 |
-
/**
|
798 |
-
* Send an SMTP MAIL command.
|
799 |
-
* Starts a mail transaction from the email address specified in
|
800 |
-
* $from. Returns true if successful or false otherwise. If True
|
801 |
-
* the mail transaction is started and then one or more recipient
|
802 |
-
* commands may be called followed by a data command.
|
803 |
-
* Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
|
804 |
-
* @param string $from Source address of this message
|
805 |
-
* @access public
|
806 |
-
* @return boolean
|
807 |
-
*/
|
808 |
-
public function mail($from)
|
809 |
-
{
|
810 |
-
$useVerp = ($this->do_verp ? ' XVERP' : '');
|
811 |
-
return $this->sendCommand(
|
812 |
-
'MAIL FROM',
|
813 |
-
'MAIL FROM:<' . $from . '>' . $useVerp,
|
814 |
-
250
|
815 |
-
);
|
816 |
-
}
|
817 |
-
|
818 |
-
/**
|
819 |
-
* Send an SMTP QUIT command.
|
820 |
-
* Closes the socket if there is no error or the $close_on_error argument is true.
|
821 |
-
* Implements from rfc 821: QUIT <CRLF>
|
822 |
-
* @param boolean $close_on_error Should the connection close if an error occurs?
|
823 |
-
* @access public
|
824 |
-
* @return boolean
|
825 |
-
*/
|
826 |
-
public function quit($close_on_error = true)
|
827 |
-
{
|
828 |
-
$noerror = $this->sendCommand('QUIT', 'QUIT', 221);
|
829 |
-
$err = $this->error; //Save any error
|
830 |
-
if ($noerror or $close_on_error) {
|
831 |
-
$this->close();
|
832 |
-
$this->error = $err; //Restore any error from the quit command
|
833 |
-
}
|
834 |
-
return $noerror;
|
835 |
-
}
|
836 |
-
|
837 |
-
/**
|
838 |
-
* Send an SMTP RCPT command.
|
839 |
-
* Sets the TO argument to $toaddr.
|
840 |
-
* Returns true if the recipient was accepted false if it was rejected.
|
841 |
-
* Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
|
842 |
-
* @param string $address The address the message is being sent to
|
843 |
-
* @access public
|
844 |
-
* @return boolean
|
845 |
-
*/
|
846 |
-
public function recipient($address)
|
847 |
-
{
|
848 |
-
return $this->sendCommand(
|
849 |
-
'RCPT TO',
|
850 |
-
'RCPT TO:<' . $address . '>',
|
851 |
-
array(250, 251)
|
852 |
-
);
|
853 |
-
}
|
854 |
-
|
855 |
-
/**
|
856 |
-
* Send an SMTP RSET command.
|
857 |
-
* Abort any transaction that is currently in progress.
|
858 |
-
* Implements rfc 821: RSET <CRLF>
|
859 |
-
* @access public
|
860 |
-
* @return boolean True on success.
|
861 |
-
*/
|
862 |
-
public function reset()
|
863 |
-
{
|
864 |
-
return $this->sendCommand('RSET', 'RSET', 250);
|
865 |
-
}
|
866 |
-
|
867 |
-
/**
|
868 |
-
* Send a command to an SMTP server and check its return code.
|
869 |
-
* @param string $command The command name - not sent to the server
|
870 |
-
* @param string $commandstring The actual command to send
|
871 |
-
* @param integer|array $expect One or more expected integer success codes
|
872 |
-
* @access protected
|
873 |
-
* @return boolean True on success.
|
874 |
-
*/
|
875 |
-
protected function sendCommand($command, $commandstring, $expect)
|
876 |
-
{
|
877 |
-
if (!$this->connected()) {
|
878 |
-
$this->setError("Called $command without being connected");
|
879 |
-
return false;
|
880 |
-
}
|
881 |
-
//Reject line breaks in all commands
|
882 |
-
if (strpos($commandstring, "\n") !== false or strpos($commandstring, "\r") !== false) {
|
883 |
-
$this->setError("Command '$command' contained line breaks");
|
884 |
-
return false;
|
885 |
-
}
|
886 |
-
$this->client_send($commandstring . self::CRLF);
|
887 |
-
|
888 |
-
$this->last_reply = $this->get_lines();
|
889 |
-
// Fetch SMTP code and possible error code explanation
|
890 |
-
$matches = array();
|
891 |
-
if (preg_match("/^([0-9]{3})[ -](?:([0-9]\\.[0-9]\\.[0-9]) )?/", $this->last_reply, $matches)) {
|
892 |
-
$code = $matches[1];
|
893 |
-
$code_ex = (count($matches) > 2 ? $matches[2] : null);
|
894 |
-
// Cut off error code from each response line
|
895 |
-
$detail = preg_replace(
|
896 |
-
"/{$code}[ -]".($code_ex ? str_replace('.', '\\.', $code_ex).' ' : '')."/m",
|
897 |
-
'',
|
898 |
-
$this->last_reply
|
899 |
-
);
|
900 |
-
} else {
|
901 |
-
// Fall back to simple parsing if regex fails
|
902 |
-
$code = substr($this->last_reply, 0, 3);
|
903 |
-
$code_ex = null;
|
904 |
-
$detail = substr($this->last_reply, 4);
|
905 |
-
}
|
906 |
-
|
907 |
-
$this->edebug('SERVER -> CLIENT: ' . $this->last_reply, self::DEBUG_SERVER);
|
908 |
-
|
909 |
-
if (!in_array($code, (array)$expect)) {
|
910 |
-
$this->setError(
|
911 |
-
"$command command failed",
|
912 |
-
$detail,
|
913 |
-
$code,
|
914 |
-
$code_ex
|
915 |
-
);
|
916 |
-
$this->edebug(
|
917 |
-
'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply,
|
918 |
-
self::DEBUG_CLIENT
|
919 |
-
);
|
920 |
-
return false;
|
921 |
-
}
|
922 |
-
|
923 |
-
$this->setError('');
|
924 |
-
return true;
|
925 |
-
}
|
926 |
-
|
927 |
-
/**
|
928 |
-
* Send an SMTP SAML command.
|
929 |
-
* Starts a mail transaction from the email address specified in $from.
|
930 |
-
* Returns true if successful or false otherwise. If True
|
931 |
-
* the mail transaction is started and then one or more recipient
|
932 |
-
* commands may be called followed by a data command. This command
|
933 |
-
* will send the message to the users terminal if they are logged
|
934 |
-
* in and send them an email.
|
935 |
-
* Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
|
936 |
-
* @param string $from The address the message is from
|
937 |
-
* @access public
|
938 |
-
* @return boolean
|
939 |
-
*/
|
940 |
-
public function sendAndMail($from)
|
941 |
-
{
|
942 |
-
return $this->sendCommand('SAML', "SAML FROM:$from", 250);
|
943 |
-
}
|
944 |
-
|
945 |
-
/**
|
946 |
-
* Send an SMTP VRFY command.
|
947 |
-
* @param string $name The name to verify
|
948 |
-
* @access public
|
949 |
-
* @return boolean
|
950 |
-
*/
|
951 |
-
public function verify($name)
|
952 |
-
{
|
953 |
-
return $this->sendCommand('VRFY', "VRFY $name", array(250, 251));
|
954 |
-
}
|
955 |
-
|
956 |
-
/**
|
957 |
-
* Send an SMTP NOOP command.
|
958 |
-
* Used to keep keep-alives alive, doesn't actually do anything
|
959 |
-
* @access public
|
960 |
-
* @return boolean
|
961 |
-
*/
|
962 |
-
public function noop()
|
963 |
-
{
|
964 |
-
return $this->sendCommand('NOOP', 'NOOP', 250);
|
965 |
-
}
|
966 |
-
|
967 |
-
/**
|
968 |
-
* Send an SMTP TURN command.
|
969 |
-
* This is an optional command for SMTP that this class does not support.
|
970 |
-
* This method is here to make the RFC821 Definition complete for this class
|
971 |
-
* and _may_ be implemented in future
|
972 |
-
* Implements from rfc 821: TURN <CRLF>
|
973 |
-
* @access public
|
974 |
-
* @return boolean
|
975 |
-
*/
|
976 |
-
public function turn()
|
977 |
-
{
|
978 |
-
$this->setError('The SMTP TURN command is not implemented');
|
979 |
-
$this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
|
980 |
-
return false;
|
981 |
-
}
|
982 |
-
|
983 |
-
/**
|
984 |
-
* Send raw data to the server.
|
985 |
-
* @param string $data The data to send
|
986 |
-
* @access public
|
987 |
-
* @return integer|boolean The number of bytes sent to the server or false on error
|
988 |
-
*/
|
989 |
-
public function client_send($data)
|
990 |
-
{
|
991 |
-
$this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
|
992 |
-
return fwrite($this->smtp_conn, $data);
|
993 |
-
}
|
994 |
-
|
995 |
-
/**
|
996 |
-
* Get the latest error.
|
997 |
-
* @access public
|
998 |
-
* @return array
|
999 |
-
*/
|
1000 |
-
public function getError()
|
1001 |
-
{
|
1002 |
-
return $this->error;
|
1003 |
-
}
|
1004 |
-
|
1005 |
-
/**
|
1006 |
-
* Get SMTP extensions available on the server
|
1007 |
-
* @access public
|
1008 |
-
* @return array|null
|
1009 |
-
*/
|
1010 |
-
public function getServerExtList()
|
1011 |
-
{
|
1012 |
-
return $this->server_caps;
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
/**
|
1016 |
-
* A multipurpose method
|
1017 |
-
* The method works in three ways, dependent on argument value and current state
|
1018 |
-
* 1. HELO/EHLO was not sent - returns null and set up $this->error
|
1019 |
-
* 2. HELO was sent
|
1020 |
-
* $name = 'HELO': returns server name
|
1021 |
-
* $name = 'EHLO': returns boolean false
|
1022 |
-
* $name = any string: returns null and set up $this->error
|
1023 |
-
* 3. EHLO was sent
|
1024 |
-
* $name = 'HELO'|'EHLO': returns server name
|
1025 |
-
* $name = any string: if extension $name exists, returns boolean True
|
1026 |
-
* or its options. Otherwise returns boolean False
|
1027 |
-
* In other words, one can use this method to detect 3 conditions:
|
1028 |
-
* - null returned: handshake was not or we don't know about ext (refer to $this->error)
|
1029 |
-
* - false returned: the requested feature exactly not exists
|
1030 |
-
* - positive value returned: the requested feature exists
|
1031 |
-
* @param string $name Name of SMTP extension or 'HELO'|'EHLO'
|
1032 |
-
* @return mixed
|
1033 |
-
*/
|
1034 |
-
public function getServerExt($name)
|
1035 |
-
{
|
1036 |
-
if (!$this->server_caps) {
|
1037 |
-
$this->setError('No HELO/EHLO was sent');
|
1038 |
-
return null;
|
1039 |
-
}
|
1040 |
-
|
1041 |
-
// the tight logic knot ;)
|
1042 |
-
if (!array_key_exists($name, $this->server_caps)) {
|
1043 |
-
if ($name == 'HELO') {
|
1044 |
-
return $this->server_caps['EHLO'];
|
1045 |
-
}
|
1046 |
-
if ($name == 'EHLO' || array_key_exists('EHLO', $this->server_caps)) {
|
1047 |
-
return false;
|
1048 |
-
}
|
1049 |
-
$this->setError('HELO handshake was used. Client knows nothing about server extensions');
|
1050 |
-
return null;
|
1051 |
-
}
|
1052 |
-
|
1053 |
-
return $this->server_caps[$name];
|
1054 |
-
}
|
1055 |
-
|
1056 |
-
/**
|
1057 |
-
* Get the last reply from the server.
|
1058 |
-
* @access public
|
1059 |
-
* @return string
|
1060 |
-
*/
|
1061 |
-
public function getLastReply()
|
1062 |
-
{
|
1063 |
-
return $this->last_reply;
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
/**
|
1067 |
-
* Read the SMTP server's response.
|
1068 |
-
* Either before eof or socket timeout occurs on the operation.
|
1069 |
-
* With SMTP we can tell if we have more lines to read if the
|
1070 |
-
* 4th character is '-' symbol. If it is a space then we don't
|
1071 |
-
* need to read anything else.
|
1072 |
-
* @access protected
|
1073 |
-
* @return string
|
1074 |
-
*/
|
1075 |
-
protected function get_lines()
|
1076 |
-
{
|
1077 |
-
// If the connection is bad, give up straight away
|
1078 |
-
if (!is_resource($this->smtp_conn)) {
|
1079 |
-
return '';
|
1080 |
-
}
|
1081 |
-
$data = '';
|
1082 |
-
$endtime = 0;
|
1083 |
-
stream_set_timeout($this->smtp_conn, $this->Timeout);
|
1084 |
-
if ($this->Timelimit > 0) {
|
1085 |
-
$endtime = time() + $this->Timelimit;
|
1086 |
-
}
|
1087 |
-
while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
|
1088 |
-
$str = @fgets($this->smtp_conn, 515);
|
1089 |
-
$this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
|
1090 |
-
$this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
|
1091 |
-
$data .= $str;
|
1092 |
-
// If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
|
1093 |
-
if ((isset($str[3]) and $str[3] == ' ')) {
|
1094 |
-
break;
|
1095 |
-
}
|
1096 |
-
// Timed-out? Log and break
|
1097 |
-
$info = stream_get_meta_data($this->smtp_conn);
|
1098 |
-
if ($info['timed_out']) {
|
1099 |
-
$this->edebug(
|
1100 |
-
'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
|
1101 |
-
self::DEBUG_LOWLEVEL
|
1102 |
-
);
|
1103 |
-
break;
|
1104 |
-
}
|
1105 |
-
// Now check if reads took too long
|
1106 |
-
if ($endtime and time() > $endtime) {
|
1107 |
-
$this->edebug(
|
1108 |
-
'SMTP -> get_lines(): timelimit reached ('.
|
1109 |
-
$this->Timelimit . ' sec)',
|
1110 |
-
self::DEBUG_LOWLEVEL
|
1111 |
-
);
|
1112 |
-
break;
|
1113 |
-
}
|
1114 |
-
}
|
1115 |
-
return $data;
|
1116 |
-
}
|
1117 |
-
|
1118 |
-
/**
|
1119 |
-
* Enable or disable VERP address generation.
|
1120 |
-
* @param boolean $enabled
|
1121 |
-
*/
|
1122 |
-
public function setVerp($enabled = false)
|
1123 |
-
{
|
1124 |
-
$this->do_verp = $enabled;
|
1125 |
-
}
|
1126 |
-
|
1127 |
-
/**
|
1128 |
-
* Get VERP address generation mode.
|
1129 |
-
* @return boolean
|
1130 |
-
*/
|
1131 |
-
public function getVerp()
|
1132 |
-
{
|
1133 |
-
return $this->do_verp;
|
1134 |
-
}
|
1135 |
-
|
1136 |
-
/**
|
1137 |
-
* Set error messages and codes.
|
1138 |
-
* @param string $message The error message
|
1139 |
-
* @param string $detail Further detail on the error
|
1140 |
-
* @param string $smtp_code An associated SMTP error code
|
1141 |
-
* @param string $smtp_code_ex Extended SMTP code
|
1142 |
-
*/
|
1143 |
-
protected function setError($message, $detail = '', $smtp_code = '', $smtp_code_ex = '')
|
1144 |
-
{
|
1145 |
-
$this->error = array(
|
1146 |
-
'error' => $message,
|
1147 |
-
'detail' => $detail,
|
1148 |
-
'smtp_code' => $smtp_code,
|
1149 |
-
'smtp_code_ex' => $smtp_code_ex
|
1150 |
-
);
|
1151 |
-
}
|
1152 |
-
|
1153 |
-
/**
|
1154 |
-
* Set debug output method.
|
1155 |
-
* @param string|callable $method The name of the mechanism to use for debugging output, or a callable to handle it.
|
1156 |
-
*/
|
1157 |
-
public function setDebugOutput($method = 'echo')
|
1158 |
-
{
|
1159 |
-
$this->Debugoutput = $method;
|
1160 |
-
}
|
1161 |
-
|
1162 |
-
/**
|
1163 |
-
* Get debug output method.
|
1164 |
-
* @return string
|
1165 |
-
*/
|
1166 |
-
public function getDebugOutput()
|
1167 |
-
{
|
1168 |
-
return $this->Debugoutput;
|
1169 |
-
}
|
1170 |
-
|
1171 |
-
/**
|
1172 |
-
* Set debug output level.
|
1173 |
-
* @param integer $level
|
1174 |
-
*/
|
1175 |
-
public function setDebugLevel($level = 0)
|
1176 |
-
{
|
1177 |
-
$this->do_debug = $level;
|
1178 |
-
}
|
1179 |
-
|
1180 |
-
/**
|
1181 |
-
* Get debug output level.
|
1182 |
-
* @return integer
|
1183 |
-
*/
|
1184 |
-
public function getDebugLevel()
|
1185 |
-
{
|
1186 |
-
return $this->do_debug;
|
1187 |
-
}
|
1188 |
-
|
1189 |
-
/**
|
1190 |
-
* Set SMTP timeout.
|
1191 |
-
* @param integer $timeout
|
1192 |
-
*/
|
1193 |
-
public function setTimeout($timeout = 0)
|
1194 |
-
{
|
1195 |
-
$this->Timeout = $timeout;
|
1196 |
-
}
|
1197 |
-
|
1198 |
-
/**
|
1199 |
-
* Get SMTP timeout.
|
1200 |
-
* @return integer
|
1201 |
-
*/
|
1202 |
-
public function getTimeout()
|
1203 |
-
{
|
1204 |
-
return $this->Timeout;
|
1205 |
-
}
|
1206 |
-
|
1207 |
-
/**
|
1208 |
-
* Reports an error number and string.
|
1209 |
-
* @param integer $errno The error number returned by PHP.
|
1210 |
-
* @param string $errmsg The error message returned by PHP.
|
1211 |
-
*/
|
1212 |
-
protected function errorHandler($errno, $errmsg)
|
1213 |
-
{
|
1214 |
-
$notice = 'Connection: Failed to connect to server.';
|
1215 |
-
$this->setError(
|
1216 |
-
$notice,
|
1217 |
-
$errno,
|
1218 |
-
$errmsg
|
1219 |
-
);
|
1220 |
-
$this->edebug(
|
1221 |
-
$notice . ' Error number ' . $errno . '. "Error notice: ' . $errmsg,
|
1222 |
-
self::DEBUG_CONNECTION
|
1223 |
-
);
|
1224 |
-
}
|
1225 |
-
|
1226 |
-
/**
|
1227 |
-
* Will return the ID of the last smtp transaction based on a list of patterns provided
|
1228 |
-
* in SMTP::$smtp_transaction_id_patterns.
|
1229 |
-
* If no reply has been received yet, it will return null.
|
1230 |
-
* If no pattern has been matched, it will return false.
|
1231 |
-
* @return bool|null|string
|
1232 |
-
*/
|
1233 |
-
public function getLastTransactionID()
|
1234 |
-
{
|
1235 |
-
$reply = $this->getLastReply();
|
1236 |
-
|
1237 |
-
if (empty($reply)) {
|
1238 |
-
return null;
|
1239 |
-
}
|
1240 |
-
|
1241 |
-
foreach($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) {
|
1242 |
-
if(preg_match($smtp_transaction_id_pattern, $reply, $matches)) {
|
1243 |
-
return $matches[1];
|
1244 |
-
}
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
return false;
|
1248 |
-
}
|
1249 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mail/engines/get_oauth_token.php
DELETED
@@ -1,162 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Get an OAuth2 token from Google.
|
4 |
-
* * Install this script on your server so that it's accessible
|
5 |
-
* as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
|
6 |
-
* e.g.: http://localhost/phpmail/get_oauth_token.php
|
7 |
-
* * Ensure dependencies are installed with 'composer install'
|
8 |
-
* * Set up an app in your Google developer console
|
9 |
-
* * Set the script address as the app's redirect URL
|
10 |
-
* If no refresh token is obtained when running this file, revoke access to your app
|
11 |
-
* using link: https://accounts.google.com/b/0/IssuedAuthSubTokens and run the script again.
|
12 |
-
* This script requires PHP 5.4 or later
|
13 |
-
* PHP Version 5.4
|
14 |
-
*/
|
15 |
-
|
16 |
-
namespace League\OAuth2\Client\Provider;
|
17 |
-
|
18 |
-
require 'vendor/autoload.php';
|
19 |
-
|
20 |
-
use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
|
21 |
-
use League\OAuth2\Client\Token\AccessToken;
|
22 |
-
use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
|
23 |
-
use Psr\Http\Message\ResponseInterface;
|
24 |
-
|
25 |
-
session_start();
|
26 |
-
|
27 |
-
//If this automatic URL doesn't work, set it yourself manually
|
28 |
-
$redirectUri = isset($_SERVER['HTTPS']) ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
29 |
-
//$redirectUri = 'http://localhost/phpmailer/get_oauth_token.php';
|
30 |
-
|
31 |
-
//These details obtained are by setting up app in Google developer console.
|
32 |
-
$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com';
|
33 |
-
$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP';
|
34 |
-
|
35 |
-
class Google extends AbstractProvider
|
36 |
-
{
|
37 |
-
use BearerAuthorizationTrait;
|
38 |
-
|
39 |
-
const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'id';
|
40 |
-
|
41 |
-
/**
|
42 |
-
* @var string If set, this will be sent to google as the "access_type" parameter.
|
43 |
-
* @link https://developers.google.com/accounts/docs/OAuth2WebServer#offline
|
44 |
-
*/
|
45 |
-
protected $accessType;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* @var string If set, this will be sent to google as the "hd" parameter.
|
49 |
-
* @link https://developers.google.com/accounts/docs/OAuth2Login#hd-param
|
50 |
-
*/
|
51 |
-
protected $hostedDomain;
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @var string If set, this will be sent to google as the "scope" parameter.
|
55 |
-
* @link https://developers.google.com/gmail/api/auth/scopes
|
56 |
-
*/
|
57 |
-
protected $scope;
|
58 |
-
|
59 |
-
public function getBaseAuthorizationUrl()
|
60 |
-
{
|
61 |
-
return 'https://accounts.google.com/o/oauth2/auth';
|
62 |
-
}
|
63 |
-
|
64 |
-
public function getBaseAccessTokenUrl(array $params)
|
65 |
-
{
|
66 |
-
return 'https://accounts.google.com/o/oauth2/token';
|
67 |
-
}
|
68 |
-
|
69 |
-
public function getResourceOwnerDetailsUrl(AccessToken $token)
|
70 |
-
{
|
71 |
-
return ' ';
|
72 |
-
}
|
73 |
-
|
74 |
-
protected function getAuthorizationParameters(array $options)
|
75 |
-
{
|
76 |
-
if (is_array($this->scope)) {
|
77 |
-
$separator = $this->getScopeSeparator();
|
78 |
-
$this->scope = implode($separator, $this->scope);
|
79 |
-
}
|
80 |
-
|
81 |
-
$params = array_merge(
|
82 |
-
parent::getAuthorizationParameters($options),
|
83 |
-
array_filter([
|
84 |
-
'hd' => $this->hostedDomain,
|
85 |
-
'access_type' => $this->accessType,
|
86 |
-
'scope' => $this->scope,
|
87 |
-
// if the user is logged in with more than one account ask which one to use for the login!
|
88 |
-
'authuser' => '-1'
|
89 |
-
])
|
90 |
-
);
|
91 |
-
return $params;
|
92 |
-
}
|
93 |
-
|
94 |
-
protected function getDefaultScopes()
|
95 |
-
{
|
96 |
-
return [
|
97 |
-
'email',
|
98 |
-
'openid',
|
99 |
-
'profile',
|
100 |
-
];
|
101 |
-
}
|
102 |
-
|
103 |
-
protected function getScopeSeparator()
|
104 |
-
{
|
105 |
-
return ' ';
|
106 |
-
}
|
107 |
-
|
108 |
-
protected function checkResponse(ResponseInterface $response, $data)
|
109 |
-
{
|
110 |
-
if (!empty($data['error'])) {
|
111 |
-
$code = 0;
|
112 |
-
$error = $data['error'];
|
113 |
-
|
114 |
-
if (is_array($error)) {
|
115 |
-
$code = $error['code'];
|
116 |
-
$error = $error['message'];
|
117 |
-
}
|
118 |
-
|
119 |
-
throw new IdentityProviderException($error, $code, $data);
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
protected function createResourceOwner(array $response, AccessToken $token)
|
124 |
-
{
|
125 |
-
return new GoogleUser($response);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
|
130 |
-
//Set Redirect URI in Developer Console as [https/http]://<yourdomain>/<folder>/get_oauth_token.php
|
131 |
-
$provider = new Google(
|
132 |
-
array(
|
133 |
-
'clientId' => $clientId,
|
134 |
-
'clientSecret' => $clientSecret,
|
135 |
-
'redirectUri' => $redirectUri,
|
136 |
-
'scope' => array('https://mail.google.com/'),
|
137 |
-
'accessType' => 'offline'
|
138 |
-
)
|
139 |
-
);
|
140 |
-
|
141 |
-
if (!isset($_GET['code'])) {
|
142 |
-
// If we don't have an authorization code then get one
|
143 |
-
$authUrl = $provider->getAuthorizationUrl();
|
144 |
-
$_SESSION['oauth2state'] = $provider->getState();
|
145 |
-
header('Location: ' . $authUrl);
|
146 |
-
exit;
|
147 |
-
// Check given state against previously stored one to mitigate CSRF attack
|
148 |
-
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {
|
149 |
-
unset($_SESSION['oauth2state']);
|
150 |
-
exit('Invalid state');
|
151 |
-
} else {
|
152 |
-
// Try to get an access token (using the authorization code grant)
|
153 |
-
$token = $provider->getAccessToken(
|
154 |
-
'authorization_code',
|
155 |
-
array(
|
156 |
-
'code' => $_GET['code']
|
157 |
-
)
|
158 |
-
);
|
159 |
-
|
160 |
-
// Use this to get a new access token if the old one expires
|
161 |
-
echo 'Refresh Token: ' . $token->getRefreshToken();
|
162 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mail/mod.php
CHANGED
@@ -71,16 +71,10 @@ class mailCfs extends moduleCfs {
|
|
71 |
}
|
72 |
private function _connectPhpMailer() {
|
73 |
global $wp_version;
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
}
|
79 |
-
} else {
|
80 |
-
if(!function_exists('PHPMailerAutoload')) {
|
81 |
-
require_once( $this->getModDir(). 'engines'. DS. 'PHPMailerAutoload.php');
|
82 |
-
}
|
83 |
-
}
|
84 |
}
|
85 |
public function sendSendMailMail($to, $subject, $message, $fromName = '', $fromEmail = '', $replyToName = '', $replyToEmail = '', $additionalHeaders = array(), $additionalParameters = array()) {
|
86 |
$this->_getSendMailMailer();
|
71 |
}
|
72 |
private function _connectPhpMailer() {
|
73 |
global $wp_version;
|
74 |
+
if (!class_exists('PHPMailer', false)) {
|
75 |
+
require_once ( ABSPATH . WPINC . '/PHPMailer/PHPMailer.php' );
|
76 |
+
require_once ( ABSPATH . WPINC . '/PHPMailer/Exception.php' );
|
77 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
public function sendSendMailMail($to, $subject, $message, $fromName = '', $fromEmail = '', $replyToName = '', $replyToEmail = '', $additionalHeaders = array(), $additionalParameters = array()) {
|
80 |
$this->_getSendMailMailer();
|
modules/templates/mod.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
class templatesCfs extends moduleCfs {
|
3 |
protected $_styles = array();
|
4 |
private $_cdnUrl = '';
|
5 |
-
|
6 |
public function __construct($d) {
|
7 |
parent::__construct($d);
|
8 |
$this->getCdnUrl(); // Init CDN URL
|
@@ -59,8 +59,8 @@ class templatesCfs extends moduleCfs {
|
|
59 |
'siteUrl' => CFS_SITE_URL,
|
60 |
'imgPath' => CFS_IMG_PATH,
|
61 |
'cssPath' => CFS_CSS_PATH,
|
62 |
-
'loader' => CFS_LOADER_IMG,
|
63 |
-
'close' => CFS_IMG_PATH. 'cross.gif',
|
64 |
'ajaxurl' => $ajaxurl,
|
65 |
'options' => frameCfs::_()->getModule('options')->getAllowedPublicOptions(),
|
66 |
'CFS_CODE' => CFS_CODE,
|
@@ -97,8 +97,8 @@ class templatesCfs extends moduleCfs {
|
|
97 |
}
|
98 |
public function loadCoreCss() {
|
99 |
$this->_styles = array(
|
100 |
-
'styleCfs' => array('path' => CFS_CSS_PATH. 'style.css', 'for' => 'admin'),
|
101 |
-
'supsystic-uiCfs' => array('path' => CFS_CSS_PATH. 'supsystic-ui.css', 'for' => 'admin'),
|
102 |
'dashicons' => array('for' => 'admin'),
|
103 |
'bootstrap-alerts' => array('path' => CFS_CSS_PATH. 'bootstrap-alerts.css', 'for' => 'admin'),
|
104 |
'icheck' => array('path' => CFS_CSS_PATH. 'jquery.icheck.css', 'for' => 'admin'),
|
@@ -204,16 +204,13 @@ class templatesCfs extends moduleCfs {
|
|
204 |
static $loaded = false;
|
205 |
if(!$loaded) {
|
206 |
$this->loadBootstrapPartialOnlyCss();
|
207 |
-
frameCfs::_()->addScript('bootstrap', CFS_JS_PATH. 'bootstrap.min.js');
|
208 |
-
frameCfs::_()->addStyle('jasny-bootstrap', CFS_CSS_PATH. 'jasny-bootstrap.min.css');
|
209 |
-
frameCfs::_()->addScript('jasny-bootstrap', CFS_JS_PATH. 'jasny-bootstrap.min.js');
|
210 |
$loaded = true;
|
211 |
}
|
212 |
}
|
213 |
public function loadBootstrapPartialOnlyCss() {
|
214 |
static $loaded = false;
|
215 |
if(!$loaded) {
|
216 |
-
frameCfs::_()->addStyle('bootstrap
|
217 |
$loaded = true;
|
218 |
}
|
219 |
}
|
@@ -242,7 +239,7 @@ class templatesCfs extends moduleCfs {
|
|
242 |
public function loadBootstrapSimple() {
|
243 |
static $loaded = false;
|
244 |
if(!$loaded) {
|
245 |
-
frameCfs::_()->addStyle('bootstrap-
|
246 |
$loaded = true;
|
247 |
}
|
248 |
}
|
2 |
class templatesCfs extends moduleCfs {
|
3 |
protected $_styles = array();
|
4 |
private $_cdnUrl = '';
|
5 |
+
|
6 |
public function __construct($d) {
|
7 |
parent::__construct($d);
|
8 |
$this->getCdnUrl(); // Init CDN URL
|
59 |
'siteUrl' => CFS_SITE_URL,
|
60 |
'imgPath' => CFS_IMG_PATH,
|
61 |
'cssPath' => CFS_CSS_PATH,
|
62 |
+
'loader' => CFS_LOADER_IMG,
|
63 |
+
'close' => CFS_IMG_PATH. 'cross.gif',
|
64 |
'ajaxurl' => $ajaxurl,
|
65 |
'options' => frameCfs::_()->getModule('options')->getAllowedPublicOptions(),
|
66 |
'CFS_CODE' => CFS_CODE,
|
97 |
}
|
98 |
public function loadCoreCss() {
|
99 |
$this->_styles = array(
|
100 |
+
'styleCfs' => array('path' => CFS_CSS_PATH. 'style.css', 'for' => 'admin'),
|
101 |
+
'supsystic-uiCfs' => array('path' => CFS_CSS_PATH. 'supsystic-ui.css', 'for' => 'admin'),
|
102 |
'dashicons' => array('for' => 'admin'),
|
103 |
'bootstrap-alerts' => array('path' => CFS_CSS_PATH. 'bootstrap-alerts.css', 'for' => 'admin'),
|
104 |
'icheck' => array('path' => CFS_CSS_PATH. 'jquery.icheck.css', 'for' => 'admin'),
|
204 |
static $loaded = false;
|
205 |
if(!$loaded) {
|
206 |
$this->loadBootstrapPartialOnlyCss();
|
|
|
|
|
|
|
207 |
$loaded = true;
|
208 |
}
|
209 |
}
|
210 |
public function loadBootstrapPartialOnlyCss() {
|
211 |
static $loaded = false;
|
212 |
if(!$loaded) {
|
213 |
+
frameCfs::_()->addStyle('bootstrap-cfs', CFS_CSS_PATH. 'bootstrap.min.css');
|
214 |
$loaded = true;
|
215 |
}
|
216 |
}
|
239 |
public function loadBootstrapSimple() {
|
240 |
static $loaded = false;
|
241 |
if(!$loaded) {
|
242 |
+
frameCfs::_()->addStyle('bootstrap-cfs', CFS_CSS_PATH. 'bootstrap.min.css');
|
243 |
$loaded = true;
|
244 |
}
|
245 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: supsystic.com
|
3 |
Tags: captcha, contact, contact form, contact form builder, contact form maker, contact form manager, contact form plugin, contact forms, contact us, custom form, feedback form, form, forms, forms creator, forms plugin, survey, quiz, subscription form, popup form
|
4 |
Tested up to: 5.5
|
5 |
-
Stable tag: 1.7.
|
6 |
|
7 |
Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
|
8 |
|
@@ -203,6 +203,9 @@ Using Contact Form plugin on your WordPress site, you start a really responsive
|
|
203 |
Contact Form admin interface
|
204 |
== Changelog ==
|
205 |
|
|
|
|
|
|
|
206 |
= 1.7.5 / 15.09.2020 =
|
207 |
* Add support WP 5.5
|
208 |
|
2 |
Contributors: supsystic.com
|
3 |
Tags: captcha, contact, contact form, contact form builder, contact form maker, contact form manager, contact form plugin, contact forms, contact us, custom form, feedback form, form, forms, forms creator, forms plugin, survey, quiz, subscription form, popup form
|
4 |
Tested up to: 5.5
|
5 |
+
Stable tag: 1.7.6
|
6 |
|
7 |
Contact Form Builder with drag-and-drop editor to create responsive, mobile ready contact forms in a second. Custom fields and contact form templates
|
8 |
|
203 |
Contact Form admin interface
|
204 |
== Changelog ==
|
205 |
|
206 |
+
= 1.7.6 / 10.12.2020 =
|
207 |
+
* Add security fixes
|
208 |
+
|
209 |
= 1.7.5 / 15.09.2020 =
|
210 |
* Add support WP 5.5
|
211 |
|