/** Send en bestemt artikkel på e-post */
    protected function send_email($row)
    {
        $this->email->text('Hei,

Siden du ikke lengre er med i avisfirmaet "' . $row['ff_name'] . '" har din artikkel blitt slettet fordi den ikke tilhørte noen utgivelse. I tilfelle du kanskje ønsker å beholde teksten fra artikkelen, sender vi den på e-post.

Avisfirma: ' . $row['ff_name'] . ' <' . ess::$s['path'] . '/ff/?ff_id=' . $row['ff_id'] . '>

Tittel: ' . $row['ffna_title'] . '
Opprettet: ' . ess::$b->date->get($row['ffna_created_time'])->format(date::FORMAT_SEC) . ($row['ffna_updated_time'] ? '
Sist oppdatert: ' . ess::$b->date->get($row['ffna_updated_time'])->format(date::FORMAT_SEC) : '') . ($row['ffna_published'] ? '
Publisert: ' . ess::$b->date->get($row['ffna_published_time'])->format(date::FORMAT_SEC) : '') . '
Pris: ' . game::format_cash($row['ffna_price']) . '

Innhold:

-- START --
' . $row['ffna_text'] . '
-- SLUTT --

--
Kofradia.no
Denne e-posten er sendt til ' . $row['u_email'] . ' som ' . ($row['up_access_level'] == 0 ? 'tidligere tilhørte' : 'tilhører') . ' ' . $row['up_name'] . '
' . ess::$s['path']);
        $this->email->format();
        mailer::add_emails($this->email, $row['u_email'], "Din tidligere artikkel: {$row['ffna_title']} - Kofradia", true);
        putlog("CREWCHAN", "AVISARTIKKEL SLETTET: E-post planlagt for utsendelse. %c4Mailer scriptet må kjøres!");
    }
Exemple #2
0
 public static function getInstance()
 {
     if (!self::$m_pInstance) {
         self::$m_pInstance = new mailer();
     }
     return self::$m_pInstance;
 }
 /**
  * 发送邮件
  */
 public function send($limit = 5)
 {
     $this->clear();
     //根据优先级排序获取
     $mails = $this->where(array('lock_expiry' => array('lt', time())))->order('priority DESC,id,err_num')->limit($limit)->select();
     if (!$mails) {
         return false;
     }
     //增加一次发送错误并且把锁定时间延长避免多个发送请求冲突
     $qids = array();
     foreach ($mails as $_mail) {
         $qids[] = $_mail['id'];
     }
     $this->where(array('id' => array('in', $qids)))->save(array('err_num' => array('exp', 'err_num+1'), 'lock_expiry' => array('exp', 'lock_expiry+' . $this->_send_lock)));
     //发送
     $mailer = mailer::get_instance();
     foreach ($mails as $_mail) {
         if ($mailer->send($_mail['mail_to'], $_mail['mail_subject'], $_mail['mail_body'])) {
             //删除队列
             $this->delete($_mail['id']);
         } else {
             //失败暂不处理
         }
     }
 }
 public function ajax_mail_test() {
     $email = $this->_get('email', 'trim');
     !$email && $this->ajaxReturn(0);
     //发送
     $mailer = mailer::get_instance();
     if ($mailer->send($email, L('send_test_email_subject'), L('send_test_email_body'))) {
         $this->ajaxReturn(1);
     } else {
         $this->ajaxReturn(0);
     }
 }
 public function ajax_mail_test()
 {
     $email = $this->_get('email', 'trim');
     !$email && $this->ajaxReturn(0);
     //发送
     $mailer = mailer::get_instance();
     if ($mailer->send($email, '这是一封测试邮件', '这是一封飞天侠秒杀程序自动发送的测试邮件')) {
         $this->ajaxReturn(1);
     } else {
         $this->ajaxReturn(0);
     }
 }
 public function ajax_mail_test()
 {
     $email = $this->_get('email', 'trim');
     !$email && $this->ajaxReturn(0);
     //发送
     $mailer = mailer::get_instance();
     if ($mailer->send($email, '这是一封测试邮件', '您好,此邮件由杨他他淘宝客皮卷淘宝客程序系统发送,请勿回复,收到此邮件证明你的邮箱已配置正确,技术支持论坛:http://bbs.yangtata.com。感谢对杨他他论坛的支持!')) {
         $this->ajaxReturn(1);
     } else {
         $this->ajaxReturn(0);
     }
 }
Exemple #7
0
 function send()
 {
     $Message = new mContact();
     $Message->__post();
     if ($Message->validate()) {
         $Customer = new mCustomer();
         $Customer->email = $Message->email;
         if ($Customer->load()) {
             $Message->customer = $Customer->id();
         }
         //Save and send
         $Message->save();
         $Email = new mailer();
         $Email->sendContactForm($Message);
         $Email->sendAdminContactConfirm($Message);
         $this->display('sent');
     } else {
         data('send-error', 'The form is not complete');
         $this->display('form');
     }
 }
Exemple #8
0
 function html($to, $toName, $from, $fromName, $subject, $body)
 {
     $mail = new mailer();
     if (defined('mail_from')) {
         $mail->From = mail_from;
         $mail->AddReplyTo($from, $fromName);
     } else {
         $mail->From = $from;
     }
     $mail->FromName = $fromName;
     $mail->IsHTML(true);
     $mail->Subject = $subject;
     $mail->Body = $body;
     switch (gettype($to)) {
         case 'string':
             $mail->AddAddress($to, $toName);
             break;
         case 'array':
             foreach ($to as $toKey => $thisTo) {
                 $mail->AddAddress($thisTo, $toName[$toKey]);
             }
             break;
         default:
             trigger_error('invalid type for address field');
     }
     if (!$mail->Send()) {
         trigger_error("Message could not be sent. Mailer Error: " . $mail->ErrorInfo);
     }
 }
Exemple #9
0
function recalcRecipients($post)
{
    $objResponse = new xajaxResponse();
    if (trim($post)) {
        require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/mailer.php';
        if (get_magic_quotes_runtime() || get_magic_quotes_gpc()) {
            $post = stripslashes($post);
        }
        $post = iconv('CP1251', 'UTF-8', $post);
        $_post = json_decode($post, true);
        foreach ($_post as $k => $v) {
            if ($v['name'] == 'attachedfiles_session') {
                continue;
            }
            $result[$v['name']] = iconv('UTF-8', 'CP1251', $v['value']);
        }
        $url = http_build_query($result);
        parse_str($url, $output);
        $mailer = new mailer();
        $filter = $mailer->loadPOST($output);
        $cnt = $mailer->getCountRecipients(array('frl', 'emp'), $filter);
        if ($filter['filter_emp'] > 0 && $filter['filter_frl'] > 0) {
            $sum = array_sum($cnt);
        } elseif ($filter['filter_emp'] > 0) {
            $sum = $cnt[0];
        } elseif ($filter['filter_frl'] > 0) {
            $sum = $cnt[1];
        } else {
            $sum = array_sum($cnt);
        }
        $sum = $mailer->calcSumRecipientsCount($filter, $cnt);
        $text = number_format($sum, 0, ',', ' ') . ' ' . ending($sum, 'человек', 'человека', 'человек');
        $objResponse->assign('all_recipients_count', 'innerHTML', $text);
        $objResponse->assign('emp_recipients_count', 'innerHTML', number_format($cnt[0], 0, ',', ' '));
        $objResponse->assign('frl_recipients_count', 'innerHTML', number_format($cnt[1], 0, ',', ' '));
    }
    return $objResponse;
}
Exemple #10
0
 public function exec($data)
 {
     $response_array = array();
     $name = ucwords($data['name']);
     $email = $data['email'];
     $phone = $data['phone'] != "" ? $data['phone'] : "-";
     $message = $data['message'];
     //        NOTIFY RECEIVER BY EMAIL
     //        Generate Email BODY
     $html = file_get_contents(BASE_PATH . 'email_template/contact');
     $html = htmlspecialchars($html);
     $html = str_replace('[NAME]', $name, $html);
     $html = str_replace('[EMAIL]', $email, $html);
     $html = str_replace('[PHONE]', $phone, $html);
     $html = str_replace('[MESSAGE]', $message, $html);
     $html = html_entity_decode($html);
     $body = $html;
     //        Send Email
     $mailer = new mailer();
     $mailer->IsSMTP();
     // set mailer to use SMTP
     $mailer->Port = EMAIL_PORT;
     $mailer->Host = EMAIL_HOST;
     // specify main and backup server
     $mailer->SMTPAuth = true;
     // turn on SMTP authentication
     $mailer->Username = NOREPLY_EMAIL;
     // SMTP username
     $mailer->Password = NOREPLY_PASS;
     // SMTP password
     $mailer->From = NOREPLY_EMAIL;
     $mailer->FromName = SUPPORT_NAME;
     $mailer->AddReplyTo($email, $name);
     $mailer->AddAddress(CONTACT_EMAIL);
     $mailer->IsHTML(true);
     $mailer->Subject = "NEW message from {$email} via 1STG Contact Form.";
     $mailer->Body = $body;
     if (!$mailer->Send()) {
         $response_array['r'] = "false";
         $response_array['msg'] = "Technical Error: " . $mailer->ErrorInfo;
     } else {
         $response_array['r'] = "true";
         $response_array['msg'] = "Your message has been successfully submit.";
     }
     return $response_array;
 }
 /**
  * Form to email a member
  *
  * @author Jason Warner <*****@*****.**>
  * @since RC1
  **/
 function execute()
 {
     $this->set_title($this->lang->email_email);
     $this->tree($this->lang->email_email);
     if (!$this->perms->auth('email_use')) {
         return $this->message($this->lang->email_email, $this->lang->email_no_perm);
     }
     if (!isset($this->post['submit'])) {
         $this->get['to'] = isset($this->get['to']) ? intval($this->get['to']) : '';
         if ($this->get['to']) {
             $target = $this->db->fetch("SELECT user_name FROM {$this->pre}users WHERE user_id={$this->get['to']}");
             if (!isset($target['user_name']) || $this->get['to'] == USER_GUEST_UID) {
                 return $this->message($this->lang->email_email, $this->lang->email_no_member);
             }
             $this->get['to'] = $target['user_name'];
         }
         return eval($this->template('EMAIL_MAIN'));
     } else {
         if (empty($this->post['to']) || empty($this->post['message']) || empty($this->post['subject'])) {
             return $this->message($this->lang->email_email, $this->lang->email_no_fields);
         }
         $target = $this->db->fetch("SELECT user_id, user_email, user_email_form FROM {$this->pre}users WHERE user_name='{$this->post['to']}'");
         if (!$target['user_email_form']) {
             return $this->message($this->lang->email_email, $this->lang->email_blocked);
         }
         if (!isset($target['user_id']) || $target['user_id'] == USER_GUEST_UID) {
             return $this->message($this->lang->email_email, $this->lang->email_no_member);
         }
         include './lib/mailer.php';
         $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
         $mailer->setSubject("{$this->sets['forum_name']} - {$this->post['subject']}");
         $mailer->setMessage("This mail has been sent by {$this->user['user_name']} via {$this->sets['forum_name']}\n\n" . stripslashes($this->post['message']));
         $mailer->setRecipient($target['user_email']);
         $mailer->setServer($this->sets['mailserver']);
         $mailer->doSend();
         return $this->message($this->lang->email_email, $this->lang->email_sent);
     }
 }
 function send_mail()
 {
     if (!isset($this->post['groups'])) {
         $this->post['groups'] = array();
     }
     include '../lib/mailer.php';
     $mailer = new mailer($this->sets['admin_incoming'], $this->sets['admin_outgoing'], $this->sets['forum_name'], false);
     $mailer->setSubject($this->post['subject']);
     $message = stripslashes($this->post['message']) . "\n";
     $message .= '___________________' . "\n";
     $message .= $this->sets['forum_name'] . "\n";
     $message .= $this->sets['loc_of_board'] . "\n";
     $mailer->setMessage($message);
     $mailer->setServer($this->sets['mailserver']);
     $i = 0;
     $members = $this->db->query("SELECT user_email FROM {$this->pre}users" . $this->group_query($this->post['groups']));
     while ($sub = $this->db->nqfetch($members)) {
         $mailer->setBcc($sub['user_email']);
         $i++;
     }
     $mailer->doSend();
     return $this->message('Mass Mail', 'Your message has been sent to ' . $i . ' members.');
 }
Exemple #13
0
 /**
  * 
  * @access public
  * @param id
  * 
  */
 public function sendAlert($id)
 {
     $mail = new mailer();
     $user = new users();
     // send alert email !
     $row = $user->getUser($id);
     $emailTo = $row['user'];
     $to[] = $emailTo;
     $subject = "Alert: Hours spent have exceeded planned hours";
     $mail->setSubject($subject);
     $text = "Hello " . $emailTo . ",\n\t\t\t\t\t\t\t\t\n\t\t\tThis is a friendly reminder that you have surpassed\n\t\t\t\t\t\t\t\t\n\t\t\tthe estimated hours for this project. While we \n\t\t\t\t\t\t\t\t\t\n\t\t\tunderstand it is impossible to meet every deadline\n\t\t\t\t\t\t\t\t\t\n\t\t\twe encourage you to be as diligent as possible with\n\t\t\t\t\t\t\t\t\t\n\t\t\tyour workload.";
     $mail->setText($text);
     $mail->sendMail($to);
 }
         $sql_data_array['entry_zone_id'] = '0';
         $sql_data_array['entry_state'] = $state;
     }
 }
 if ($_POST['action'] == 'update') {
     $check_query = xos_db_query("select address_book_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . (int) $_GET['edit'] . "' and customers_id = '" . (int) $_SESSION['customer_id'] . "' limit 1");
     if (xos_db_num_rows($check_query) == 1) {
         xos_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "address_book_id = '" . (int) $_GET['edit'] . "' and customers_id ='" . (int) $_SESSION['customer_id'] . "'");
         if (ACCOUNT_COMPANY == 'true' && xos_not_null($company_tax_id)) {
             $sql_data_array2['customers_group_ra'] = '1';
             xos_db_perform(TABLE_CUSTOMERS, $sql_data_array2, 'update', "customers_id ='" . (int) $_SESSION['customer_id'] . "'");
             if (SEND_EMAILS == 'true') {
                 // if you would *not* like to have an email when a tax id number has been entered in
                 // the appropriate field, comment out this section. The alert in admin is raised anyway
                 $alert_email_text = sprintf(EMAIL_TEXT_TAX_ID_ADDED, $firstname, $lastname, $company);
                 $email_to_store_owner = new mailer(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT_TAX_ID_ADDED, '', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
                 if (!$email_to_store_owner->send()) {
                     $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_store_owner->ErrorInfo));
                 }
             }
         }
         // reregister session variables
         if (isset($_POST['primary']) && $_POST['primary'] == 'on' || $_GET['edit'] == $_SESSION['customer_default_address_id']) {
             if (ACCOUNT_GENDER == 'true') {
                 $_SESSION['customer_gender'] = $gender;
             }
             $_SESSION['customer_first_name'] = $firstname;
             $_SESSION['customer_lastname'] = $lastname;
             $_SESSION['customer_country_id'] = $country;
             $_SESSION['customer_zone_id'] = $zone_id > 0 ? (int) $zone_id : '0';
             $_SESSION['customer_default_address_id'] = (int) $_GET['edit'];
Exemple #15
0
<?php

require_once "classes/config.php";
require_once "classes/payed.php";
require_once "classes/pay_place.php";
require_once "classes/commune.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/user_content.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/wallet/walletAlpha.php';
require_once "classes/log.php";
//#0027582  аждую минуту обрабатывать запросы на размешение в карусели
pay_place::cronRequest();
//  аждые пол часа обновл¤ем статус рассылок
if (date('i') == 30) {
    require_once "classes/mailer.php";
    $mailer = new mailer();
    $mailer->updateStatusSending();
}
// ночные нестыковки во времени при переходе в следующий день #0021788
if (!in_array((int) date('Hi'), array(2358, 2359))) {
    payed::UpdateProUsers();
}
//@todo: непон¤тно дл¤ чего?
//если юзер провисел 10 сек с момента публикации
//то помечаем его как просмотренный хот¤ его мог никто и неувидеть!
$pp = new pay_place();
$pp->getDoneShow(0);
$user_content = new user_content();
$user_content->releaseDelayedStreams();
$user_content->getQueueCounts();
$user_content->getStreamsQueueCounts();
Exemple #16
0
 function before_parse()
 {
     if (empty($this->params['short'])) {
         // вызвано не возле короткой формы логина, а в теле страницы
         // процедура изменения пароля
         if (!empty($_GET['k']) && isset($_POST['newpass']) && isset($_POST['accpass'])) {
             $sql = 'sql:user?u_passre=\'' . $_GET['k'] . '\' $shrink=yes auto_query=no';
             $res = $GLOBALS[CM]->run($sql);
             if ($res) {
                 if (empty($_POST['newpass']) || $_POST['newpass'] != $_POST['accpass']) {
                     $this->pg = str_replace('<!--err:changepass-->', 'Пароли не совпадают', $this->pg);
                     return false;
                     // пусто или не совпадает
                 } else {
                     $GLOBALS[CM]->run($sql, 'update', array('u_passre' => '', 'u_pwd' => $_POST['newpass']));
                     $this->pg = $this->tpl['changed'];
                     return true;
                     // пароль изменен
                 }
             }
         }
     } else {
         // вызвано возле формы логина кнопкой "напомнить"
         if (empty($_POST['passremail'])) {
             $this->pg = str_replace('<!--err:passremail-->', '', $this->pg);
             // если его не зачищать, то ява-скрипт отобразит блок, чтобы показать результат
         } else {
             // проверить наличие данного емыла в базе
             $sql = 'sql:user?u_email=\'' . $_POST['passremail'] . '\' $shrink=yes auto_query=no';
             $res = $GLOBALS[CM]->run($sql);
             if (!$res) {
                 $this->pg = str_replace('<!--err:passremail-->', 'Пользователь с таким e-mail не найден.', $this->pg);
                 return false;
                 // емыл не найден
             } elseif (!empty($res['u_lock']) && $res['u_lock'] != '') {
                 $this->pg = str_replace('<!--err:passremail-->', 'Пользователь заблокирован', $this->pg);
                 return false;
                 // акк заблокирован
             }
             // создать секретный код для беспарольного входа и отправить его на емыл юзера
             if (empty($res['u_passre'])) {
                 $res['u_passre'] = substr(uniqid(mt_rand()), 0, 24);
                 $GLOBALS[CM]->run($sql, 'update', array('u_passre' => $res['u_passre']));
             }
             $ml = new mailer(array('tpl' => $this->params['email_tpl']));
             $ml->send($res, $res['u_email']);
             $this->pg = str_replace('<!--err:passremail-->', 'Письмо отправлено', $this->pg);
             return true;
             // пароль отправлен
         }
     }
     $tmp = new iControl(array('pg' => $this->pg));
     $tmp->get_maked();
     $this->pg = $tmp->pg;
     unset($tmp);
     //parent::onValid();
 }
Exemple #17
0
 if (validate::postDataNotEmpty()) {
     $_POST['subject'] = htmlspecialchars($_POST['subject'], ENT_QUOTES, CONF_DEFAULT_CHARSET);
     !validate::validateEmail($_POST['email']) ? $arrErrors[] = ERROR_EMAIL : null;
     strlen($_POST['subject']) < 5 ? $arrErrors[] = ERROR_SUBJECT_SHORT : null;
     strlen($_POST['message']) < 10 ? $arrErrors[] = ERROR_MESSAGE_SHORT : null;
     if (SECURE_CAPTCHA) {
         $securimage = new securimage();
         !$securimage->check($_POST['keystring']) ? $arrErrors[] = ERROR_CAPTCHA : null;
     }
 } else {
     $arrErrors[] = ERROR_EMPTY_FIELDS;
 }
 ///////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////
 if (!$arrErrors) {
     $mailer = new mailer();
     // массив для замены в шаблоне
     CONF_MAIL_FORMAT_HTML ? $message = nl2br($_POST['message']) : ($message =& $_POST['message']);
     $mailer->setAddReplace(array('%FEEDBACK%' => &$message));
     // проверяем, если есть дополнительный словарь тем, то используем его
     $toAddress = isset($arrAddDict['FeedbackSubject']) && ($address = array_search($_POST['subject'], $arrAddDict['FeedbackSubject']['values'])) ? $address : CONF_MAIL_ADMIN_EMAIL;
     // пытамеся отправить сообщение
     if (!$mailer->sendEmail($_POST['email'], $_POST['email'], $_POST['email'], $toAddress, $toAddress, $_POST['subject'], 'feedback.txt')) {
         $arrErrors[] = ERROR_SEND_EMAIL;
     } else {
         messages::messageChangeSaved(MESSAGE_WAS_SEND, false, chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?ut=' . $_SESSION['sd_user'][DB_PREFIX . 'conf']['user_type'] . '&amp;do=feedback'));
     }
 }
 $return_data['subject'] = !empty($_POST['subject']) ? $_POST['subject'] : '';
 $return_data['email'] = !empty($_POST['email']) ? $_POST['email'] : '';
 $return_data['message'] = !empty($_POST['message']) ? $_POST['message'] : '';
Exemple #18
0
             $smarty_order = new Smarty();
             $smarty_order->template_dir = DIR_FS_SMARTY . 'catalog/templates/';
             $smarty_order->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/';
             $smarty_order->config_dir = DIR_FS_SMARTY . 'catalog/';
             $smarty_order->cache_dir = DIR_FS_SMARTY . 'catalog/cache/';
             $smarty_order->left_delimiter = '[@{';
             $smarty_order->right_delimiter = '}@]';
             if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') {
                 $smarty_order->assign('order_comments', $comments);
             }
             $smarty_order->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => $languages['code'], 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG_IMAGES . 'email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'date_ordered' => xos_order_status_email_date_long($check_status['date_purchased']), 'order_id' => $oID, 'order_status' => $order_status['orders_status_name'], 'link_invoice' => xos_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL')));
             $smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_html');
             $output_order_status_email_html = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_html.tpl');
             $smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_text');
             $output_order_status_email_text = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_text.tpl');
             $email_to_customer = new mailer($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $output_order_status_email_html, $output_order_status_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SHOP_LOGO);
             if (!$email_to_customer->send()) {
                 $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_customer->ErrorInfo), 'error');
             }
         }
         $customer_notified = '1';
     }
     xos_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int) $oID . "', '" . xos_db_input($status) . "', now(), '" . xos_db_input($customer_notified) . "', '" . xos_db_input($comments) . "')");
     $order_updated = true;
 }
 if ($order_updated == true) {
     $messageStack->add_session('header', SUCCESS_ORDER_UPDATED, 'success');
 } else {
     $messageStack->add_session('header', WARNING_ORDER_NOT_UPDATED, 'warning');
 }
 xos_redirect(xos_href_link(FILENAME_ORDERS, xos_get_all_get_params(array('action')) . 'action=edit'));
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         $send_extra_order_emails_to = SEND_EXTRA_ORDER_EMAILS_TO;
         $decoded_send_extra_order_emails_to = html_entity_decode($send_extra_order_emails_to, ENT_QUOTES, 'UTF-8');
         $recipients = explode(',', $decoded_send_extra_order_emails_to);
         for ($i = 0, $n = count($recipients); $i < $n; $i++) {
             $address = '';
             $name = '';
             $pieces = explode('<', $recipients[$i]);
             if (count($pieces) == 2) {
                 $address = trim($pieces[1], " >");
                 $name = trim($pieces[0]);
             } elseif (count($pieces) == 1) {
                 $pos = stripos($pieces[0], '@');
                 $address = $pos ? trim($pieces[0], " >") : '';
             }
             $email_to_other_people = new mailer($name, $address, sprintf(EMAIL_TEXT_SUBJECT_OTHER, $insert_id, xos_date_format(DATE_FORMAT_SHORT)), $output_order_email_html, $output_order_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SHOP_LOGO);
             if (!$email_to_other_people->send()) {
                 $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_other_people->ErrorInfo));
             }
         }
     }
 }
 // load the after_process function from the payment modules
 $payment_modules->after_process();
 $_SESSION['cart']->reset(true);
 // unregister session variables used during checkout
 unset($_SESSION['sendto']);
 unset($_SESSION['billto']);
 unset($_SESSION['shipping']);
 unset($_SESSION['payment']);
 unset($_SESSION['comments']);
Exemple #20
0
echo $message['eproject']['avg_answer'][0];
?>
" />
                        </div>
                    </div>
                    <span class="b-layout__txt">&#160;&mdash;&#160;</span>
                    <div class="b-combo b-combo_inline-block">
                        <div class="b-combo__input b-combo__input_width_135">
                            <input id="c3" class="b-combo__input-text b-combo-digital-input" name="eproject_avg_answer[1]" type="text" size="80" value="<?php 
echo $message['eproject']['avg_answer'][1];
?>
" />
                        </div>
                    </div>
                    <span class="b-layout__txt b-layout__txt_fontsize_11 b-layout__txt_inline-block b-layout__txt_padtop_5" <?php 
echo mailer::checkEmptyRange($message, 'eproject', 'avg_answer') ? "style='display:none'" : '';
?>
>&#160;&#160;любое количество</span>
                </td>
            </tr>
        </table>
        <table class="b-layout__table b-layout__table_width_full" cellpadding="0" cellspacing="0" border="0">
            <tr class="b-layout__tr">
                <td class="b-layout__left b-layout__left_width_120">
                    <div class="b-layout__txt b-layout__txt_lineheight_13">Расчитаны на<br />исполнителей</div>
                </td>
                <td class="b-layout__right">
                    <div class="b-check b-check_padbot_5">
                        <input id="eproject_executor0" class="b-check__input" name="eproject_executor[0]" type="checkbox" value="1" <?php 
echo $message['eproject']['executor'][0] == 1 ? 'checked' : '';
?>
Exemple #21
0
 public function addagent_exec($data)
 {
     $response_array = array();
     foreach ($data as $key => $value) {
         if ($value == "") {
             $data[$key] = NULL;
         }
     }
     $agent = new user();
     $data['fullname'] = strtoupper($data['fullname']);
     $data['agent_id'] = $agent->generateID();
     $data['tmp_password'] = strtoupper(hash::create('crc32', uniqid(), HASH_PASSWORD_KEY));
     $data['activate_code'] = $agent->generateActivationCode($data['email']);
     $acc_type = $data['acc_type'];
     switch ($acc_type) {
         case "aa":
             $ads_pin_limit = 1;
             $available_pin = 1;
             break;
         case "ad":
             $ads_pin_limit = 15;
             $available_pin = 15;
             break;
         case "ed":
             $ads_pin_limit = 20;
             $available_pin = 20;
             break;
         case "ep":
             $ads_pin_limit = 40;
             $available_pin = 40;
             break;
         default:
             $ads_pin_limit = "unlimited";
             $available_pin = 40;
             break;
     }
     $data['ads_pin_limit'] = $ads_pin_limit;
     $data['available_pin'] = $available_pin;
     $data['address'] = ucwords($data['address']);
     $data['mobile'] = str_replace("-", "", $data['mobile']);
     $data['mobile'] = str_replace(" ", "", $data['mobile']);
     $data['mobile'] = str_replace("+6", "", $data['mobile']);
     $data['mobile'] = "+6" . $data['mobile'];
     if (!empty($data['phone'])) {
         $data['phone'] = str_replace("-", "", $data['phone']);
         $data['phone'] = str_replace(" ", "", $data['phone']);
         $data['phone'] = str_replace("+6", "", $data['phone']);
         $data['phone'] = "+6" . $data['phone'];
     }
     $checkEmail = $agent->checkEmail($data['email']);
     $checkCEmail = $agent->checkCdata($data['email'], $data['cemail']);
     $checkUsername = $data['chkusername'];
     $validUplineSponsor = FALSE;
     $sponsorId = $data['sponsor_id'];
     $uplineId = $data['lv1'];
     if ($sponsorId != $uplineId) {
         $upline_data = $this->db->select("user_accounts", "lv1,lv2,lv3,lv4,lv5,lv6,lv7,lv8,lv9,lv10", "agent_id = '{$uplineId}'", "fetch");
         foreach ($upline_data as $value) {
             if ($value == $sponsorId) {
                 $validUplineSponsor = TRUE;
             }
         }
     } else {
         $validUplineSponsor = TRUE;
     }
     //GENERATE ADS PIN
     if ($acc_type == "aa") {
         $ads_pin = "1000000";
     } else {
         $ads_pin = $agent->getRegPin();
     }
     $data['ads_pin'] = $ads_pin;
     if (!$checkCEmail) {
         $response_array['r'] = "false";
         $response_array['msg'] = "<div><b>Confirm Email</b> not match!</div>";
     } elseif (!$checkEmail) {
         $response_array['r'] = "false";
         $response_array['msg'] = "<div><b>Email</b> already exist!</div>";
     } elseif ($checkUsername == 0) {
         $response_array['r'] = "false";
         $response_array['msg'] = "<div>Please <b>Check Username</b> availability!<div>";
     } elseif ($checkUsername == '-1') {
         $response_array['r'] = "false";
         $response_array['msg'] = "<div><b>Username</b> not available! Please choose another username.<div>";
     } elseif (!$validUplineSponsor) {
         $response_array['r'] = "false";
         $response_array['msg'] = "<div><b>Sponsor ID: {$sponsorId}</b> not related with <b>Upline ID: {$uplineId}</b>. Please make sure <b>Upline ID</b> is under correct <b>Sponsor ID</b> network.<div>";
     } else {
         $link = BASE_PATH . 'join/verify?a=' . $data['activate_code'] . '&s=' . $data['username'];
         unset($data['cemail']);
         unset($data['chkusername']);
         //            Insert into Database
         $this->db->insert("user_accounts", $data);
         //            Generate Email BODY
         $html = file_get_contents(BASE_PATH . 'email_template/activation');
         $html = htmlspecialchars($html);
         $html = str_replace('[USERNAME]', ucfirst($data['username']), $html);
         $html = str_replace('[ACTIVATION_CODE]', $link, $html);
         $html = html_entity_decode($html);
         $body = $html;
         //            Send Email
         $mailer = new mailer();
         $mailer->IsSMTP();
         // set mailer to use SMTP
         $mailer->Port = EMAIL_PORT;
         $mailer->Host = EMAIL_HOST;
         // specify main and backup server
         $mailer->SMTPAuth = true;
         // turn on SMTP authentication
         $mailer->Username = NOREPLY_EMAIL;
         // SMTP username
         $mailer->Password = NOREPLY_PASS;
         // SMTP password
         $mailer->From = NOREPLY_EMAIL;
         $mailer->FromName = SUPPORT_NAME;
         $mailer->AddAddress($data['email']);
         $mailer->IsHTML(true);
         $mailer->Subject = "Email verification to " . $data['email'];
         $mailer->Body = $body;
         if (!$mailer->Send()) {
             $response_array['r'] = "false";
             $response_array['msg'] = "Mailer Error: " . $mailer->ErrorInfo;
         } else {
             $response_array['r'] = "true";
             $response_array['msg'] = BASE_PATH . "mynetwork/addagent_success/" . $data['agent_id'];
         }
     }
     return $response_array;
 }
Exemple #22
0
 function send($newsletter_id)
 {
     global $messageStack;
     if (SEND_EMAILS != 'true') {
         $messageStack->add('news_email', ERROR_EMAIL_WAS_NOT_SENT, 'error');
         return false;
     }
     $ids = $_GET['customers_chosen'];
     $mail_query = xos_db_query("select s.subscriber_id, s.subscriber_email_address, s.subscriber_identity_code, c.customers_firstname, c.customers_lastname  from " . TABLE_NEWSLETTER_SUBSCRIBERS . " s left join " . TABLE_CUSTOMERS . " c on s.customers_id = c.customers_id where s.subscriber_id in (" . $ids . ") order by s.customers_id");
     if (empty($this->language_directory)) {
         $lang_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'");
         $lang = xos_db_fetch_array($lang_query);
         $this->language_directory = $lang['directory'];
     }
     //Let's build a message object using the mailer class
     $email_to_subscriber = new mailer();
     $email_from_value = EMAIL_FROM;
     $from = html_entity_decode($email_from_value, ENT_QUOTES, 'UTF-8');
     $address = '';
     $name = '';
     $pieces = explode('<', $from);
     if (count($pieces) == 2) {
         $address = trim($pieces[1], " >");
         $name = trim($pieces[0]);
     } elseif (count($pieces) == 1) {
         $pos = stripos($pieces[0], '@');
         $address = $pos ? trim($pieces[0], " >") : '';
     }
     $email_to_subscriber->From = $address;
     $email_to_subscriber->FromName = $name;
     $email_to_subscriber->WordWrap = '100';
     $email_to_subscriber->Subject = $this->title;
     $smarty_newsletter = new Smarty();
     $smarty_newsletter->template_dir = DIR_FS_SMARTY . 'catalog/templates/';
     $smarty_newsletter->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/';
     $smarty_newsletter->config_dir = DIR_FS_SMARTY . 'catalog/';
     $smarty_newsletter->cache_dir = DIR_FS_SMARTY . 'catalog/cache/';
     $smarty_newsletter->left_delimiter = '[@{';
     $smarty_newsletter->right_delimiter = '}@]';
     $is_html = false;
     if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') {
         $is_html = true;
         $smarty_newsletter->assign(array('nl' => "\n", 'html_params' => HTML_PARAMS, 'xhtml_lang' => !empty($this->language_code) ? $this->language_code : DEFAULT_LANGUAGE, 'charset' => CHARSET, 'base_href' => substr(HTTP_SERVER, -1) == '/' ? HTTP_SERVER : '', 'content_text_htlm' => $this->content_text_htlm, 'content_text_plain' => $this->content_text_plain));
         $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_html');
         $output_newsletter_email_html = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_html.tpl');
         $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text');
         $output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl');
         $email_to_subscriber->isHTML(true);
     } else {
         $smarty_newsletter->assign(array('nl' => "\n", 'content_text_plain' => $this->content_text_plain));
         $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text');
         $output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl');
         $email_to_subscriber->isHTML(false);
     }
     while ($mail = xos_db_fetch_array($mail_query)) {
         $link_unsubscribe = xos_catalog_href_link('newsletter_subscribe.php', 'action=unsubscribe&amp;identity_code=' . $mail['subscriber_identity_code'], 'SSL');
         if ($is_html) {
             $email_to_subscriber->Body = $output_newsletter_email_html . '<a href="' . $link_unsubscribe . '"  target="_blank">' . $link_unsubscribe . '</a>' . "\n" . '</div>' . "\n" . '</body>' . "\n" . '</html>' . "\n";
             $email_to_subscriber->AltBody = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8');
         } else {
             $email_to_subscriber->Body = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8');
         }
         $email_to_subscriber->addAddress($mail['subscriber_email_address'], $mail['customers_firstname'] . ' ' . $mail['customers_lastname']);
         if (!$email_to_subscriber->send()) {
             $messageStack->add('news_email', sprintf(ERROR_PHP_MAILER, $email_to_subscriber->ErrorInfo, '&lt;' . $mail['subscriber_email_address'] . '&gt;'), 'error');
         } else {
             $messageStack->add('news_email', sprintf(NOTICE_EMAIL_SENT_TO, '&lt;' . $mail['subscriber_email_address'] . '&gt;'), 'success');
         }
         $email_to_subscriber->clearAddresses();
     }
     $newsletter_id = xos_db_prepare_input($newsletter_id);
     xos_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1', locked = '0' where newsletters_id = '" . xos_db_input($newsletter_id) . "'");
 }
Exemple #23
0
            }
        } else {
            $status = array('status' => 405, 'result' => "Wrong HTTP method(" . $_SERVER['REQUEST_METHOD'] . ")");
            print_r(json_encode($status));
            exit;
        }
    }
    //mailgun call requires cleaned email_data
    protected function call_mailgun($email_data)
    {
        $email_service = null;
        $s = null;
        require_once '../sources/mailgun.php';
        $email_service = new mailgun($email_data);
        $s = $email_service->send();
        return $s;
    }
    //mandrill call requires cleaned email_data
    protected function call_mandrill($email_data)
    {
        $email_service = null;
        $s = null;
        require_once '../sources/mandrill.php';
        $email_service = new mandrill($email_data);
        $s = $email_service->send();
        return $s;
    }
}
$postData = filter_var($_POST, FILTER_SANITIZE_STRING);
$sendMail = new mailer($postData);
return @$sendMail->send();
Exemple #24
0
 public function pay()
 {
     if (IS_POST && count($_SESSION['cart']) > 0) {
         $_SESSION['end'] = 0;
         import('Think.ORG.Cart');
         // 导入分页类
         $cart = new Cart();
         $user_address = M('user_address');
         $item_order = M('item_order');
         $order_detail = M('order_detail');
         $item_goods = M('item');
         $this->visitor->info['id'];
         //用户ID
         $this->visitor->info['username'];
         //用户账号
         //生成订单号
         $dingdanhao = date("Y-m-dH-i-s");
         $dingdanhao = str_replace("-", "", $dingdanhao);
         $dingdanhao .= rand(1000, 2000);
         $time = time();
         //订单添加时间
         $address_options = $this->_post('address_options', 'intval');
         //地址  0:刚填的地址 大于0历史的地址
         $shipping_id = $this->_post('shipping_id', 'intval');
         //配送方式
         $postscript = $this->_post('postscript', 'trim');
         //卖家留言
         if (!empty($postscript)) {
             $data['note'] = $postscript;
         }
         if (empty($shipping_id)) {
             $data['freetype'] = 0;
             $data['order_sumPrice'] = $cart->getPrice();
         } else {
             $data['freetype'] = $shipping_id;
             $data['freeprice'] = $this->getFree($shipping_id);
             //取到运费
             $data['order_sumPrice'] = $cart->getPrice() + $this->getFree($shipping_id);
             //echo $cart->getPrice()+$this->getFree($shipping_id);exit;
         }
         $data['orderId'] = $dingdanhao;
         //订单号
         $data['add_time'] = $time;
         //添加时间
         $data['goods_sumPrice'] = $cart->getPrice();
         //商品总额
         $data['color'] = $cart->getColor();
         //商品颜色
         //$data['userId']=$this->visitor->info['id'];//用户ID
         //$data['userName']=$this->visitor->info['username'];//用户名
         $data['userId'] = '123';
         //用户ID
         $data['userName'] = '******';
         //用户名
         if ($address_options == 0) {
             $consignee = $this->_post('consignee', 'trim');
             //真实姓名
             $sheng = $this->_post('sheng', 'trim');
             //省
             $shi = $this->_post('shi', 'trim');
             //市
             $qu = $this->_post('qu', 'trim');
             //区
             $address = $this->_post('address', 'trim');
             //详细地址
             $phone_mob = $this->_post('phone_mob', 'trim');
             //电话号码
             $save_address = $this->_post('save_address', 'trim');
             //是否保存地址
             $data['address_name'] = $consignee;
             //收货人姓名
             $data['mobile'] = $phone_mob;
             //电话号码
             $data['address'] = $sheng . $shi . $qu . $address;
             //地址
             if ($save_address) {
                 $add_address['uid'] = $this->visitor->info['id'];
                 $add_address['consignee'] = $consignee;
                 $add_address['address'] = $address;
                 $add_address['mobile'] = $phone_mob;
                 $add_address['sheng'] = $sheng;
                 $add_address['shi'] = $shi;
                 $add_address['qu'] = $qu;
                 $user_address->data($add_address)->add();
             }
         } else {
             $userId = $this->visitor->info['id'];
             $address = $user_address->where("uid='{$userId}'")->find($address_options);
             //取到地址
             $data['address_name'] = $address['consignee'];
             //收货人姓名
             $data['mobile'] = $address['mobile'];
             //电话号码
             $data['address'] = $address['sheng'] . $address['shi'] . $address['qu'] . $address['address'];
             //地址
         }
         if ($orderid = $item_order->data($data)->add()) {
             $orders['orderId'] = $dingdanhao;
             foreach ($_SESSION['cart'] as $item) {
                 $item_goods->where('id=' . $item['id'])->setDec('goods_stock', $item['num']);
                 $orders['itemId'] = $item['id'];
                 //商品ID
                 $orders['title'] = $item['name'];
                 //商品名称
                 $orders['img'] = $item['img'];
                 //商品图片
                 $orders['price'] = $item['price'];
                 //商品价格
                 $orders['quantity'] = $item['num'];
                 //购买数量
                 $orders['color'] = $item['color'];
                 //购买数量
                 $order_detail->data($orders)->add();
             }
             $cart->clear();
             //清空购物车
             $payment_id = $_POST['payment_id'];
             $item_order = M('item_order')->where(" orderId='{$dingdanhao}'")->find();
             !$item_order && $this->_404();
             $title = '新订单' . $data['goods_sumPrice'] . '元';
             $content = '您收到订单' . $dingdanhao . ',商品' . $orders['quantity'] . '件,总价格' . $data['goods_sumPrice'] . '元。购买者姓名:' . $consignee . '。收货人地址:' . $data['address'];
             $tips_data = M('setting')->where(" name='tips'")->find();
             $emails = unserialize($tips_data['data']);
             if ($payment_id == 2) {
                 $data['status'] = 2;
                 $data['supportmetho'] = 2;
                 $data['support_time'] = time();
                 if (M('item_order')->where("orderId='{$dingdanhao}'")->data($data)->save()) {
                     $_SESSION['end'] = 1;
                     if ($emails && !empty($emails)) {
                         $mailer = mailer::get_instance();
                         $mailer->send($emails, $title, $content);
                     }
                     $this->redirect('Shopcart/index');
                 } else {
                     $this->error('操作失败!');
                 }
             } elseif ($payment_id == 1) {
                 $data['supportmetho'] = 1;
                 $userId = $this->visitor->info['id'];
                 if (M('item_order')->where("and orderId='{$dingdanhao}'")->data($data)->save()) {
                     $alipay = M('alipay')->find();
                     echo "<script>location.href='api/wapalipay/alipayapi.php?WIDseller_email=" . $alipay['alipayname'] . "&WIDout_trade_no=" . $dingdanhao . "&WIDsubject=" . $dingdanhao . "&WIDtotal_fee=" . $item_order['order_sumPrice'] . "'</script>";
                 } else {
                     $this->error('操作失败!');
                 }
             } else {
                 $this->error('操作失败!');
             }
             $this->assign('orderid', $orderid);
             //订单ID
             $this->assign('dingdanhao', $dingdanhao);
             //订单号
             $this->assign('order_sumPrice', $data['order_sumPrice']);
         } else {
             $this->error('生成订单失败!');
         }
     } else {
         if (isset($_GET['orderId'])) {
             $item_order = M('item_order');
             $orderId = $_GET['orderId'];
             //订单号
             $userId = $this->visitor->info['id'];
             $orders = $item_order->where("userId='{$userId}' and orderId='{$orderId}'")->find();
             if (!is_array($orders)) {
                 $this->_404();
             }
             if (empty($orders['supportmetho'])) {
                 $this->assign('orderid', $orders['id']);
                 //订单ID
                 $this->assign('dingdanhao', $orders['orderId']);
                 //订单号
                 $this->assign('order_sumPrice', $orders['order_sumPrice']);
             } else {
                 $alipay = M('alipay')->find();
                 echo "<script>location.href='api/wapalipay/alipayapi.php?WIDseller_email=" . $alipay['alipayname'] . "&WIDout_trade_no=" . $orderId . "&WIDsubject=" . $orderId . "&WIDtotal_fee=" . $orders['order_sumPrice'] . "'</script>";
                 exit;
             }
         } else {
             $this->redirect('Index/index?m=Item&a=index&id=127');
         }
     }
     $this->display();
 }
Exemple #25
0
 public function sendAbandonedMail(Lender $lender)
 {
     $this->mailer->send('emails.lender.abandoned', ['to' => $lender->getUser()->getEmail(), 'from' => '*****@*****.**', 'subject' => 'Login to Zidisha']);
 }
<?php

_::define_controller('mail', function () {
    // simple mail, not SMTP!
    _::declare_component('mailer');
    $html = 'hello <b>world</b>, go to mi site please <a href="http://google.com">mi site</a>';
    $mail = new mailer('*****@*****.**', '*****@*****.**', 'testing mailer', $html);
    $result = $mail->send();
    if (!$result) {
        die($mail->error_message);
    }
}, true);
 /**
  * Функция отправляет пользователю сообщение о том, что его статья удалена
  *
  * @param (array) $arrData - массив данных статьи
  *
  * @return void
  */
 public function sendUserDeletedArticle(&$arrData)
 {
     /** Получаем данные пользователя **/
     $user = new user();
     if ($uData = $user->getUser("id IN (" . secure::escQuoteData($arrData['id']) . ")")) {
         $mailer = new mailer();
         // массив для замены в шаблоне
         $mailer->setAddReplace(array('%ARTICLE_TITLE%' => $arrData['title'], '%COMMENTS%' => CONF_MAIL_FORMAT_HTML ? nl2br($arrData['comments']) : $arrData['comments']));
         // отправляем письмо администратору
         $mailer->sendEmail(CONF_MAIL_ADMIN_EMAIL, CONF_SITE_NAME, false, $uData['email'], $uData['first_name'], MAIL_MODERATE_ARTICLES_DELETED . ': ' . $arrData['title'], 'user.article.deleted.txt');
         unset($mailer);
         // уничтожаем объект
     }
     unset($user);
     // уничтожаем объект
 }
 /**
  * Handle content posted by a user.
  * This should be called before you try to list new participations (else, freshly submited content won't be shwown)
  * 
  * Valid order is :
  * - $this->handlePost()
  * - list and display validated participations
  * - show participation form ($this->render() )
  *
  * handlePost() does nothing if the participation form has not been submited 
  *
  */
 function handlePost()
 {
     global $thinkedit;
     // if form sent, validate
     if ($this->form->isSent()) {
         $this->content->setArray($_POST);
         $valid_captcha = true;
         if ($this->enable_captcha) {
             require_once ROOT . '/class/captcha.class.php';
             $captcha = new captcha();
             if ($_REQUEST['captcha'] != $captcha->get()) {
                 $valid_captcha = false;
             }
         }
         // first case : invalid content
         if (!$this->content->validate() || !$valid_captcha) {
             $this->form->add('<div class="participation_error">');
             $this->form->add($this->invalid_message);
             $this->form->add('</div>');
         } else {
             // if a captcha was used, reset it in order to have a new one for another message
             if ($this->enable_captcha) {
                 $captcha->reset();
                 unset($_REQUEST['captcha']);
             }
             $failure = false;
             // save content to db
             if (!$this->content->insert()) {
                 $failure = true;
             }
             // add content to curent node
             if (isset($this->parent_node)) {
                 // add content in the container
                 $new_node = $this->parent_node->add($this->content, 'bottom');
                 if (!$new_node) {
                     $failure = true;
                 }
                 /*
                 // update db
                 if (!$new_node->save())
                 {
                 		$failure = true;
                 }
                 */
                 //echo 'publish : ' . $new_node->get('publish');
                 // publish if needed
                 if ($this->enable_moderation) {
                     //echo 'moderation enabled';
                 } else {
                     //echo 'moderation disabled, publishing directly';
                     $new_node->publish();
                 }
                 //echo 'publish after : ' . $new_node->get('publish');
                 /*
                 // move to bottom of curent branch if needed
                 if ($this->move_to_bottom)
                 {
                 		$new_node->moveBottom();
                 		echo 'publish after move to bottom : ' . $new_node->get('publish');
                 }
                 else
                 {
                 		$new_node->rebuild();
                 		echo 'publish after rebuild : ' . $new_node->get('publish');
                 }
                 */
             }
             if ($failure) {
                 $this->form->add('<div class="participation_error">');
                 $this->form->add($this->failure_message);
                 $this->form->add('</div>');
             } else {
                 if (isset($this->notification_email)) {
                     require_once ROOT . '/class/mailer.class.php';
                     $mailer = new mailer();
                     $mailer->isHtml(true);
                     $mailer->setTo($this->notification_email);
                     // todo : find the first email field type in the record to use it as a sender
                     // $mailer->setFrom($this->notification_email);
                     $mailer->setSubject($this->notification_email_subject . $this->content->getTitle());
                     $message = '';
                     foreach ($this->content->field as $field) {
                         $message .= '<b>' . $field->getTitle();
                         $message .= ' : ' . '</b>';
                         $message .= '<br/>';
                         $message .= $field->get();
                         $message .= '<br/>';
                         $message .= '<br/>';
                     }
                     $url = $thinkedit->newUrl();
                     $url->set('node_id', $this->parent_node->getId());
                     $message .= '<a href="' . $url->renderAbsoluteUrl('/edit/structure.php') . '">' . translate('participation_email_admin_link') . '</a>';
                     $mailer->setBody($message);
                     $mailer->send();
                 }
                 $this->form->add('<div class="participation_success">');
                 $this->form->add($this->success_message);
                 $this->form->add('</div>');
             }
         }
     }
 }
 /**
  * Функция отправляет жалобу на комментарий
  *
  * @param array $arrComment - массив данных комментария
  * @param array $arrNews - массив данных новости
  * @param string $recipient - адрес получателя
  *
  * @return bool
  */
 public function sendComplaintComment($arrComment, $arrNews, $recipient)
 {
     $mailer = new mailer();
     // проверяем, кому уходит письмо
     if (CONF_MAIL_ADMIN_EMAIL == $recipient) {
         $newsLink = CONF_SCRIPT_URL . CONF_ADMIN_FILE . '?m=manager&s=news&do=filter&id=' . $arrNews['id'] . '&id_user=&author=&title=&sDate=&eDate=&records=';
     } else {
         $newsLink = chpu::createChpuUrl(CONF_SCRIPT_URL . 'index.php?do=news&amp;action=view&amp;id=' . $arrNews['tId']);
     }
     // массив для замены в шаблоне
     $mailer->setAddReplace(array('%NEWS_TITLE%' => $arrNews['title'], '%NEWS_LINK%' => $newsLink, '%COMPLAINT_DATE%' => date(terms::dateFormatFromSmarty(CONF_DATE_FORMAT, CONF_TIME_FORMAT), strtotime(terms::currentDateTime())), '%COMMENT_DATE%' => date(terms::dateFormatFromSmarty(CONF_DATE_FORMAT, CONF_TIME_FORMAT), strtotime($arrComment['datetime'])), '%AUTHOR%' => $arrComment['name'], '%COMMENT_TEXT%' => CONF_MAIL_FORMAT_HTML ? nl2br($arrComment['text']) : $arrComment['text']));
     // отправляем письмо администратору
     return $mailer->sendEmail(CONF_MAIL_ADMIN_EMAIL, CONF_SITE_NAME, false, $recipient, false, MAIL_SUBJ_NEWS_COMMENTS_COMPLAINT, 'news.comments.complaint.txt');
 }
Exemple #30
0
				</tr>
				<tr>
					<td>Email:</td>
					<td>' . $fields['email']->val . '</td>
				</tr>
				<tr>
					<td>Recapito telefonico:</td>
					<td>' . $fields['telefono']->val . '</td>
				</tr>
				<tr>
					<td>Messaggio:</td>
					<td>' . nl2br(utf8_decode($fields['msg']->val)) . '</td>
				</tr>
			</table>
		<h4 style="border-top:2px dashed #CCC">ATTENZIONE! Non rispondere a questa email. Copiare l\'indirizzo lasciato dal cliente nel messaggio</h4>';
    $mailer = new mailer(HOST, PORT, USER, PASS, NAME);
    // 		$mailer->inviaMail('*****@*****.**',"Richiesta da contatti (".strtoupper($_SESSION['lang']['label']).")",$msg);
    $mailer->inviaMail('*****@*****.**', "Richiesta da contatti (" . strtoupper($_SESSION['lang']['label']) . ")", $msg);
    $mailer->logoutSMTP();
    $_SESSION['err_mail'] = 0;
    header("Location: " . $_SERVER['REQUEST_URI']);
    exit;
}
?>
    <?php 
include TPL_HEADER;
?>
    <section class="pageContent">
    	<?php 
include_once TPL_TITLE;
?>