104 public function __construct($embedded =
false, $subject = null, $mail = null)
108 $this->embedded = $embedded;
109 $this->sendername = isset($_POST[
'sendername'])
110 ?
stsl($_POST[
'sendername']) :
'';
111 $this->senderphone = isset($_POST[
'senderphone'])
112 ?
stsl($_POST[
'senderphone']) :
'';
113 $this->sender = isset($_POST[
'sender'])
114 ?
stsl($_POST[
'sender']) :
'';
115 $this->getlast = isset($_POST[
'getlast'])
116 ?
stsl($_POST[
'getlast']) :
'';
117 $this->cap = isset($_POST[
'cap'])
118 ?
stsl($_POST[
'cap']) :
'';
120 if (isset($_POST[
'subject'])) {
121 $this->subject =
stsl($_POST[
'subject']);
122 } elseif (isset($_GET[
'xh_mailform_subject'])) {
123 $this->subject =
stsl($_GET[
'xh_mailform_subject']);
124 } elseif (isset($subject)) {
125 $this->subject = $subject;
127 $this->subject = sprintf($tx[
'mailform'][
'subject_default'],
sv(
'SERVER_NAME'));
131 $this->mailform = isset($_POST[
'xh_mailform'])
132 ?
stsl($_POST[
'xh_mailform']) :
'';
134 $this->mailform = isset($_POST[
'mailform'])
135 ?
stsl($_POST[
'mailform']) :
'';
137 $this->mail = isset($mail) ? $mail :
new Mail();
153 if ($this->getlast != $this->cap
154 && trim($cf[
'mailform'][
'captcha']) ==
'true' 156 $o .=
XH_message(
'warning', $tx[
'mailform'][
'captchafalse']);
158 if ($this->mailform ==
'') {
159 $o .=
XH_message(
'warning', $tx[
'mailform'][
'mustwritemessage']);
161 if (!$this->mail->isValidAddress($this->sender) || $this->subject ==
'') {
162 $o .=
XH_message(
'warning', $tx[
'mailform'][
'notaccepted']);
179 $this->mail->setTo($cf[
'mailform'][
'email']);
180 $this->mail->addHeader(
'From', $this->sender);
181 $this->mail->addHeader(
'X-Remote',
sv(
'REMOTE_ADDR'));
182 $this->mail->setSubject($this->subject);
183 $this->mail->setMessage(
184 $tx[
'mailform'][
'sendername'] . $this->sendername .
"\n" 185 . $tx[
'mailform'][
'senderphone'] . $this->senderphone .
"\n\n" 188 $sent = $this->mail->send();
210 static $again =
false;
217 $anchor =
'<div id="xh_mailform"></div>';
218 if ($action ==
'send') {
220 if (!
$o && $this->submit()) {
221 $o .= $anchor .
XH_message(
'success', $tx[
'mailform'][
'send']);
223 $o .= $anchor .
XH_message(
'fail', $tx[
'mailform'][
'notsend'])
227 $o = $anchor . $this->render();
246 $random = rand(10000, 99999);
247 $url = $sn . ($this->embedded ?
'?' .
$su :
'');
248 $o =
'<form class="xh_mailform" action="' . $url
249 .
'#xh_mailform" method="post">' .
"\n";
250 if (!$this->embedded) {
251 $o .=
'<input type="hidden" name="function" value="mailform">' .
"\n";
253 if (isset($cf[
'mailform'][
'captcha'])
254 && trim($cf[
'mailform'][
'captcha']) ==
'true' 256 $o .=
'<input type="hidden" name="getlast" value="' . $random .
'">' 259 $o .=
'<input type="hidden" name="action" value="send">' .
"\n";
262 $o .=
'<div>' .
"\n" .
'<label for="xh_mailform_sendername">' 263 . $tx[
'mailform'][
'sendername'] .
'</label>' .
'<br>' .
"\n" 264 .
'<input type="text" class="text" size="35" name="sendername"' 265 .
' id="xh_mailform_sendername" value="' 266 .
XH_hsc($this->sendername).
'">' .
"\n" 268 .
'<div>' .
"\n" .
'<label for="xh_mailform_senderphone">' 269 . $tx[
'mailform'][
'senderphone'] .
'</label>' .
'<br>' .
"\n" 270 .
'<input type="tel" class="text" size="35" name="senderphone"' 271 .
' id="xh_mailform_senderphone" value="' 272 .
XH_hsc($this->senderphone).
'">' .
"\n" 274 .
'<div>' .
"\n" .
'<label for="xh_mailform_sender">' 275 . $tx[
'mailform'][
'sender'] .
'</label>' .
'<br>' .
"\n" 276 .
'<input type="email" class="text" size="35" name="sender"' 277 .
' id="xh_mailform_sender" value="' 278 .
XH_hsc($this->sender).
'" required="required">' .
"\n" 280 .
'<div>' .
"\n" .
'<label for="xh_mailform_subject">' 281 . $tx[
'mailform'][
'subject'] .
'</label>'.
'<br>' .
"\n" 282 .
'<input type="text" class="text" size="35" name="subject"' 283 .
' id="xh_mailform_subject" value="' 284 .
XH_hsc($this->subject).
'" required="required">' .
"\n" 289 $name = $this->embedded ?
'xh_mailform' :
'mailform';
290 $o .=
'<textarea rows="12" cols="40" name="' . $name
291 .
'" required="required" title="' . $tx[
'mailform'][
'message'] .
'">' 292 .
XH_hsc($this->mailform) .
'</textarea>';
295 if (isset($cf[
'mailform'][
'captcha'])
296 && trim($cf[
'mailform'][
'captcha']) ==
'true' 298 $o .=
'<p>' . $tx[
'mailform'][
'captcha'] .
'</p>' .
"\n" 299 .
'<input type="text" name="cap" class="xh_captcha_input"' 300 .
' required="required">' 301 .
"\n" .
'<span class="xh_captcha_code">' .
"\n" 302 . $random .
'</span>' .
"\n";
306 $o .=
'<div class="xh_break">' .
"\n" 307 .
'<input type="submit" class="submit" value="' 308 . $tx[
'mailform'][
'sendbutton'] .
'">' 309 .
"\n" .
'</div>' .
"\n" .
'</form>' .
"\n";
XH_logMessage($type, $module, $category, $description)
XH_message($type, $message)