<?php if (rTicket::checkPost($Cont->PFX)) { // send email $M = D()->mail->Entry(); $M->page_id = $Cont; if ($Cont->SET['sender']->v) { $M->sender = $Cont->SET['sender']->v; } $subject = (string) $Cont->text('mailSubject'); $M->subject = $subject ? $subject : (string) Page()->title(); foreach ($Cont->SET['elements'] as $id => $element) { if ($element['type']->v === 'description' || !isset($_POST[$id])) { continue; } $M->text .= (string) $Cont->text($id . '_name') . ': ' . $_POST[$id] . "\n"; } $M->html = nl2br($M->text); $recipients = preg_split('/,|;|\\s/', $Cont->SET['form_email']->v); foreach ($recipients as $recipient) { if (strpos($recipient, '@')) { $M->addTo($recipient, $recipient); } } $M->send(); // save to db if ($Cont->SET['toTable']->v) { $table = 'mailform_' . preg_replace('/[^0-9a-z_]/', '', $Cont->SET['toTable']->v); !D()->{$table} && D()->addTable($table); $T = D()->{$table}; if (!$T->log_id) {
imagedestroy($img); exit; } /* form sent */ // check captcha if (isset($_POST['_qg_rTicket'])) { $ticket = $_POST['_qg_rTicket']; $sess = $_SESSION['qg']['rTicket'][$ticket]; if (isset($sess['captcha'])) { $captcha = $_POST['_qg_captcha']; if ($sess['captcha'] !== $captcha) { return; } } } if (!rTicket::checkPost('cmspid_' . $Cont->id)) { return; } // send email $M = D()->mail->Entry(); $M->page_id = $Cont; if ($Cont->SET['sender']->v) { $M->sender = $Cont->SET['sender']->v; } $subject = (string) $Cont->text('mailSubject'); $M->subject = $subject ? $subject : (string) Page()->title(); foreach ($Cont->SET['elements'] as $id => $element) { if ($element['type']->v === 'description' || !isset($_POST[$id])) { continue; } $M->text .= (string) $Cont->text($id . '_name') . ': ' . $_POST[$id] . "\n";