Exemple #1
0
 public function sendEmail()
 {
     try {
         $emails = explode(',', $this->_correo);
         $to = [];
         foreach ($emails as $email) {
             $params = ['mail' => ['requerido' => 1, 'validador' => 'esEmail', 'mensaje' => utf8_encode('El correo no es válido.')]];
             $destinatario = ['name' => $email, 'mail' => $email];
             $form = new Validator($destinatario, $params);
             if ($form->validate() === false) {
                 throw new Exception('El correo ' . $email . ' no es válido.');
             }
             $to[] = $destinatario;
         }
         $this->_template = ParserTemplate::parseTemplate($this->_template, $this->_info);
         // $subject = '', $body = '', $to = array(), $cc = array(), $bcc = array(), $att = array()
         if (Mailer::sendMail($this->_subject, $this->_template, $to, $this->_cc)) {
             return true;
         } else {
             return false;
         }
     } catch (phpmailerException $e) {
         $this->_PDOConn->rollBack();
         return false;
     }
 }
Exemple #2
0
 function add()
 {
     $this->booking = new Booking_Class();
     $this->booking->booking_id = 'BK' . date("ymdHis");
     $this->booking->name = $_POST['name'];
     $this->booking->email = $_POST['email'];
     $this->booking->phone_number = $_POST['phone'];
     $this->booking->source_point = $_POST['source'];
     $this->booking->destination_point = $_POST['destination'];
     $this->booking->time_of_travel = $_POST['time'];
     $this->booking->date_of_travel = $_POST['date'];
     $this->booking->number_of_adult_passenger = $_POST['adults'];
     $this->booking->number_of_child_passenger = $_POST['children'];
     $this->booking->message = $_POST['message'];
     if ($this->model->saveBooking($this->booking)) {
         $from_email = "*****@*****.**";
         $mail = new Mail();
         $mail->to = $this->booking->email;
         $mail->subject = 'Booking Successfull';
         $mail->message = 'Booking with ' . $this->booking->booking_id . ' is successful';
         $mail->headers = "From: Sanjib <{$from_email}>\r\n";
         Mailer::sendMail($mail);
         $this->view->msg = 'BS';
         $this->view->booking = $this->booking;
     } else {
         $this->view->msg = 'Booking Unsuccessfull!!';
     }
     header('location: ' . URL . 'booking/getbooking/' . $this->booking->booking_id);
 }
Exemple #3
0
 public function sendMail($template)
 {
     $template->replaceVars($this->data);
     if (Mailer::sendMail($this->data['FirstName'] . ' ' . $this->data['LastName'], $this->data['Email'], $template)) {
         $this->increaseSentCount();
         return true;
     }
     return false;
 }
 public function onSetAnswer(FrontController $sender, Statement $st)
 {
     $users = $st->getSubscribers();
     if ($users) {
         require_once ST_DIR . '/Classes/Mailer.php';
         $mailer = new Mailer();
         $vars = array('answer' => strip_tags($st->getAnswer()), 'st_link' => FrontController::getURLByRoute('view', array('id' => $st->getId()), true), 'title' => $st->getTitle(), 'status' => $st->getStatusName());
         foreach ($users as $user) {
             $vars['username'] = $user->name;
             $vars['unSubscribeLink'] = $this->_getSubscribeLink($user->email, $user->user_id, $st->getId());
             $mailer->sendMail('SubscribeStatementSetAnswer', $user->email, $vars);
         }
     }
 }
 public function send()
 {
     Yii::import('application.admin.models.Settings');
     if ($this->validate()) {
         $s = new Settings();
         $m = $this->message;
         if (!in_array($this->title, array('Сообщение об ошибке', 'Сообщение по рекламе', 'Сообщение о сотрудничестве', 'Другое'))) {
             $this->title = 'Другое';
         }
         $m .= '<br> от пользователя ' . $this->name . '(' . $this->email . ')';
         Mailer::sendMail(array('email' => $s->feedbackEmail), $m, $this->title);
         return true;
     }
     return false;
 }
Exemple #6
0
 public static function sendMailFromAgentThird($correo, $mensaje, $archivo = false)
 {
     $emails = explode(',', $correo);
     $to = array();
     foreach ($emails as $email) {
         $mail = $email;
         $destinatario = array('name' => $email, 'mail' => $email);
         if (($email = FilterInput::FilterValue($email, 'email', true)) === false) {
             throw new Exception('El correo ' . $mail . ' no es válido.');
         }
         $to[] = $destinatario;
     }
     $data = array('one' => $mensaje['one'], 'two' => $mensaje['two'], 'three' => $mensaje['three'], 'four' => $mensaje['four'], 'five' => $mensaje['five'], 'six' => $mensaje['six'], 'seven' => $mensaje['seven'], 'eight' => $mensaje['eight'], 'nine' => $mensaje['nine'], 'ten' => $mensaje['ten']);
     $tpl = ParserTemplate::parseTemplate('envio_inventario_third.html', $data);
     $correos = array(array('mail' => '*****@*****.**', 'name' => 'Jesús'), array('mail' => '*****@*****.**', 'name' => 'Vico'));
     if (Mailer::sendMail('Encuesta ONE / Tercer Review', $tpl, $to, '', $correos)) {
         return array('success' => true, 'message' => 'Correo enviado.');
     }
 }
Exemple #7
0
/**
 * send mail by system built-in sendmail commands
 * @para string $to, receiver's email address
 * @para string $subject, email's subject
 * @para string $body, message body
 * return array(0=>true|false, 1=>array('error'=>'...'));
 */
function sendMail($to, $subject, $body, $from = '', $local = 0)
{
    $rtnarr = array();
    if ($local == 0) {
        $from = $from == '' ? $_CONFIG['adminmail'] : $from;
        $mailstr = 'To:' . $to . '\\n';
        $mailstr .= 'Subject:' . $subject . '\\n';
        $mailstr .= 'Content-Type:text/html;charset=UTF-8\\n';
        $mailstr .= 'From:' . $from . '\\n';
        $mailstr .= '\\n';
        $mailstr .= $body . '\\n';
        $tmpfile = "/tmp/" . GConf::get('agentalias') . ".user.reg.mail.tmp";
        system('/bin/echo -e "' . $mailstr . '" > ' . $tmpfile);
        system('/bin/cat ' . $tmpfile . ' | /usr/sbin/sendmail -t &');
        $rtnarr[0] = true;
    } else {
        if ($local == 1) {
            global $_CONFIG;
            include $_CONFIG['appdir'] . "/mod/mailer.class.php";
            $_CONFIG['mail_smtp_server'] = "smtp.163.com";
            $_CONFIG['mail_smtp_username'] = "******";
            $_CONFIG['mail_smtp_password'] = "******";
            $_CONFIG['isauth'] = true;
            $_CONFIG['mail_smtp_fromuser'] = $_CONFIG['mail_smtp_username'];
            $mail = new Mailer($_CONFIG['mail_smtp_server'], 25, $_CONFIG['isauth'], $_CONFIG['mail_smtp_username'], $_CONFIG['mail_smtp_password']);
            $mail->debug = true;
            $from == '' ? 'bangco@' . $_CONFIG['agentname'] : $from;
            if ($_CONFIG['isauth']) {
                $from = $_CONFIG['mail_smtp_fromuser'];
            }
            #print __FILE__.": from:$from";
            $rtnarr[0] = $mail->sendMail($to, $from, $subject, $body, 'HTML');
        }
    }
    return $rtnarr;
}
 if (empty($data)) {
     $response->addError('ERROR_WRONG_DATA', __('twgadmin_wrong_api_data'));
 }
 if ($mode == 'post') {
     if ($object == 'users') {
         foreach ($data as $user) {
             if (!empty($user['user_id'])) {
                 if ($_REQUEST['action'] == 'update') {
                     $result = false;
                     $user_data = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i", $user['user_id']);
                     $notify_user = !empty($user['notify_updated_user']) && $user['notify_updated_user'] == 'Y' ? true : false;
                     if (!empty($user['status']) && !$user['is_complete_data']) {
                         $result = db_query("UPDATE ?:users SET status = ?s WHERE user_id = ?i", $user['status'], $user['user_id']);
                         $force_notification = fn_get_notification_rules(array('notify_user' => $noify_user));
                         if (!empty($force_notification['C']) && $user['status'] == 'A' && $user_data['status'] == 'D') {
                             Mailer::sendMail(array('to' => $user_data['email'], 'from' => 'company_users_department', 'data' => array('user_data' => $user_data), 'tpl' => 'profiles/profile_activated.tpl', 'company_id' => $user_data['company_id']), fn_check_user_type_admin_area($user_data['user_type']) ? 'A' : 'C', $user_data['lang_code']);
                         }
                     }
                     $temp_auth = null;
                     $result = fn_twg_api_update_user($user, $temp_auth, $notify_user);
                     if (!$result) {
                         $msg = str_replace('[object_id]', $user['user_id'], __('twgadmin_wrong_api_object_data'));
                         $response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'users', __('twgadmin_wrong_api_object_data')));
                     }
                 } elseif ($_REQUEST['action'] == 'delete') {
                     if (!fn_delete_user($user['user_id'])) {
                         $msg = str_replace('[object_id]', $user['user_id'], __('twgadmin_wrong_api_object_data'));
                         $response->addError('ERROR_OBJECT_DELETE', str_replace('[object]', 'users', __('twgadmin_wrong_api_object_data')));
                     }
                 }
             } else {
 /**
  * Content::processNewsletter()
  * 
  * @return
  */
 public function processNewsletter()
 {
     Filter::checkPost('subject', Core::$word->NL_SUBJECT);
     Filter::checkPost('body', Core::$word->NL_BODY);
     Filter::checkPost('recipient', Core::$word->NL_RCPT);
     if (empty(Filter::$msgs)) {
         $to = sanitize($_POST['recipient']);
         $subject = sanitize($_POST['subject']);
         $body = cleanOut($_POST['body']);
         $numSent = 0;
         $failedRecipients = array();
         switch ($to) {
             case "all":
                 require_once BASEPATH . "lib/class_mailer.php";
                 $mailer = Mailer::sendMail();
                 $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
                 $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE id != 1";
                 $userrow = Registry::get("Database")->fetch_all($sql);
                 $replacements = array();
                 if ($userrow) {
                     if (empty($_FILES['attachment']['name'])) {
                         $attachement = '';
                     } else {
                         move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
                         $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
                     }
                     foreach ($userrow as $cols) {
                         $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
                     }
                     $decorator = new Swift_Plugins_DecoratorPlugin($replacements);
                     $mailer->registerPlugin($decorator);
                     $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
                     foreach ($userrow as $row) {
                         $message->setTo(array($row->email => $row->name));
                         $numSent++;
                         $mailer->send($message, $failedRecipients);
                     }
                     unset($row);
                 }
                 break;
             case "newsletter":
                 require_once BASEPATH . "lib/class_mailer.php";
                 $mailer = Mailer::sendMail();
                 $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
                 $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE newsletter = '1' AND id != 1";
                 $userrow = Registry::get("Database")->fetch_all($sql);
                 $replacements = array();
                 if ($userrow) {
                     if (empty($_FILES['attachment']['name'])) {
                         $attachement = '';
                     } else {
                         move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
                         $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
                     }
                     foreach ($userrow as $cols) {
                         $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
                     }
                     $decorator = new Swift_Plugins_DecoratorPlugin($replacements);
                     $mailer->registerPlugin($decorator);
                     $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
                     if (!empty($_FILES['attachment']['name'])) {
                         move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
                         $attachement = $_FILES['attachment']['name'];
                     }
                     foreach ($userrow as $row) {
                         $message->setTo(array($row->email => $row->name));
                         $numSent++;
                         $mailer->send($message, $failedRecipients);
                     }
                     unset($row);
                 }
                 break;
             case "free":
                 require_once BASEPATH . "lib/class_mailer.php";
                 $mailer = Mailer::sendMail();
                 $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100));
                 $sql = "SELECT email,CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE membership_id = 0 AND id != 1";
                 $userrow = Registry::get("Database")->fetch_all($sql);
                 $replacements = array();
                 if ($userrow) {
                     if (empty($_FILES['attachment']['name'])) {
                         $attachement = '';
                     } else {
                         move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
                         $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
                     }
                     foreach ($userrow as $cols) {
                         $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
                     }
                     $decorator = new Swift_Plugins_DecoratorPlugin($replacements);
                     $mailer->registerPlugin($decorator);
                     $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
                     foreach ($userrow as $row) {
                         $message->setTo(array($row->email => $row->name));
                         $numSent++;
                         $mailer->send($message, $failedRecipients);
                     }
                     unset($row);
                 }
                 break;
             case "paid":
                 require_once BASEPATH . "lib/class_mailer.php";
                 $mailer = Mailer::sendMail();
                 $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100));
                 $sql = "SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE membership_id <> 0 AND id != 1";
                 $userrow = Registry::get("Database")->fetch_all($sql);
                 $replacements = array();
                 if ($userrow) {
                     if (empty($_FILES['attachment']['name'])) {
                         $attachement = '';
                     } else {
                         move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
                         $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
                     }
                     foreach ($userrow as $cols) {
                         $replacements[$cols->email] = array('[NAME]' => $cols->name, '[ATTACHMENT]', '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
                     }
                     $decorator = new Swift_Plugins_DecoratorPlugin($replacements);
                     $mailer->registerPlugin($decorator);
                     $message = Swift_Message::newInstance()->setSubject($subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
                     foreach ($userrow as $row) {
                         $message->setTo(array($row->email => $row->name));
                         $numSent++;
                         $mailer->send($message, $failedRecipients);
                     }
                 }
                 break;
             default:
                 require_once BASEPATH . "lib/class_mailer.php";
                 $mailer = Mailer::sendMail();
                 $row = Registry::get("Database")->first("SELECT email, CONCAT(fname,' ',lname) as name FROM " . Users::uTable . " WHERE email LIKE '%" . sanitize($to) . "%'");
                 if ($row) {
                     if (empty($_FILES['attachment']['name'])) {
                         $attachement = '';
                     } else {
                         move_uploaded_file($_FILES['attachment']['tmp_name'], UPLOADS . 'attachments/' . $_FILES['attachment']['name']);
                         $attachement = '<a href="' . SITEURL . '/uploads/attachments/' . $_FILES['attachment']['name'] . '">' . Core::$word->NL_ATTACH . '</a>';
                     }
                     $newbody = str_replace(array('[NAME]', '[ATTACHMENT]', '[SITE_NAME]', '[URL]'), array($row->name, $attachement, Registry::get("Core")->site_name, Registry::get("Core")->site_url), $body);
                     $message = Swift_Message::newInstance()->setSubject($subject)->setTo(array($to => $row->name))->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($newbody, 'text/html');
                     $numSent++;
                     $mailer->send($message, $failedRecipients);
                 }
                 break;
         }
         if ($numSent) {
             $json['type'] = 'success';
             $json['title'] = Core::$word->SUCCESS;
             $json['message'] = Core::$word->NL_SENT;
         } else {
             $json['type'] = 'error';
             $json['title'] = Core::$word->ERROR;
             $res = '';
             $res .= '<ul>';
             foreach ($failedRecipients as $failed) {
                 $res .= '<li>' . $failed . '</li>';
             }
             $res .= '</ul>';
             $json['message'] = Core::$word->NL_ALERT . $res;
             unset($failed);
         }
         print json_encode($json);
     } else {
         $json['type'] = 'error';
         $json['title'] = Core::$word->SYSTEM_ERR;
         $json['message'] = Filter::msgSingleStatus();
         print json_encode($json);
     }
 }
Exemple #10
0
function fn_qwintry_update_shipment($shipment_data, $shipment_id = 0, $group_key = 0, $all_products = false, $force_notification = array())
{
    if (!empty($shipment_id)) {
        $arow = db_query("UPDATE ?:shipments SET tracking_number = ?s, carrier = ?s WHERE shipment_id = ?i", $shipment_data['tracking_number'], $shipment_data['carrier'], $shipment_id);
        if ($arow === false) {
            fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('shipment'))), '', '404');
            $shipment_id = false;
        }
    } else {
        if (empty($shipment_data['order_id']) || empty($shipment_data['shipping_id'])) {
            return false;
        }
        $order_info = fn_get_order_info($shipment_data['order_id'], false, true, true);
        $use_shipments = Settings::instance()->getValue('use_shipments', '', $order_info['company_id']) == 'Y' ? true : false;
        if (!$use_shipments && empty($shipment_data['tracking_number']) && empty($shipment_data['tracking_number'])) {
            return false;
        }
        if ($all_products) {
            foreach ($order_info['product_groups'] as $group) {
                foreach ($group['products'] as $item_key => $product) {
                    if (!empty($product['extra']['group_key'])) {
                        if ($group_key == $product['extra']['group_key']) {
                            $shipment_data['products'][$item_key] = $product['amount'];
                        }
                    } elseif ($group_key == 0) {
                        $shipment_data['products'][$item_key] = $product['amount'];
                    }
                }
            }
        }
        if (!empty($shipment_data['products']) && fn_check_shipped_products($shipment_data['products'])) {
            fn_set_hook('create_shipment', $shipment_data, $order_info, $group_key, $all_products);
            foreach ($shipment_data['products'] as $key => $amount) {
                if (isset($order_info['products'][$key])) {
                    $amount = intval($amount);
                    if ($amount > $order_info['products'][$key]['amount'] - $order_info['products'][$key]['shipped_amount']) {
                        $shipment_data['products'][$key] = $order_info['products'][$key]['amount'] - $order_info['products'][$key]['shipped_amount'];
                    }
                }
            }
            if (fn_check_shipped_products($shipment_data['products'])) {
                $shipment_data['timestamp'] = time();
                $shipment_id = db_query("INSERT INTO ?:shipments ?e", $shipment_data);
                foreach ($shipment_data['products'] as $key => $amount) {
                    if ($amount == 0) {
                        continue;
                    }
                    $_data = array('item_id' => $key, 'shipment_id' => $shipment_id, 'order_id' => $shipment_data['order_id'], 'product_id' => $order_info['products'][$key]['product_id'], 'amount' => $amount);
                    db_query("INSERT INTO ?:shipment_items ?e", $_data);
                }
                if (fn_check_permissions('orders', 'update_status', 'admin') && !empty($shipment_data['order_status'])) {
                    fn_change_order_status($shipment_data['order_id'], $shipment_data['order_status']);
                }
                /**
                 * Called after new shipment creation.
                 *
                 * @param array $shipment_data Array of shipment data.
                 * @param array $order_info Shipment order info
                 * @param int $group_key Group number
                 * @param bool $all_products
                 * @param int $shipment_id Created shipment identifier
                 */
                fn_set_hook('create_shipment_post', $shipment_data, $order_info, $group_key, $all_products, $shipment_id);
                if (!empty($force_notification['C'])) {
                    $shipment = array('shipment_id' => $shipment_id, 'timestamp' => $shipment_data['timestamp'], 'shipping' => db_get_field('SELECT shipping FROM ?:shipping_descriptions WHERE shipping_id = ?i AND lang_code = ?s', $shipment_data['shipping_id'], $order_info['lang_code']), 'tracking_number' => $shipment_data['tracking_number'], 'carrier' => $shipment_data['carrier'], 'comments' => $shipment_data['comments'], 'items' => $shipment_data['products']);
                    Mailer::sendMail(array('to' => $order_info['email'], 'from' => 'company_orders_department', 'data' => array('shipment' => $shipment, 'order_info' => $order_info), 'tpl' => 'shipments/shipment_products.tpl', 'company_id' => $order_info['company_id']), 'C', $order_info['lang_code']);
                }
                fn_set_notification('N', __('notice'), __('shipment_has_been_created'));
            }
        } else {
            fn_set_notification('E', __('error'), __('products_for_shipment_not_selected'));
        }
    }
    return $shipment_id;
}
Exemple #11
0
 /**
  * User::activateAccount()
  * 
  * @return
  */
 public function activateAccount()
 {
     $data['active'] = "y";
     self::$db->update(self::uTable, $data, "id = " . Filter::$id);
     require_once BASEPATH . "lib/class_mailer.php";
     $row = Registry::get("Core")->getRowById(Content::eTable, 16);
     $usr = Registry::get("Core")->getRowById(self::uTable, Filter::$id);
     $body = str_replace(array('[NAME]', '[URL]', '[SITE_NAME]'), array($usr->fname . ' ' . $usr->lname, SITEURL, Registry::get("Core")->site_name), $row->body);
     $newbody = cleanOut($body);
     $mailer = Mailer::sendMail();
     $message = Swift_Message::newInstance()->setSubject($row->subject)->setTo(array($usr->email => $usr->username))->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($newbody, 'text/html');
     if ($data['active'] == "y") {
         $json['type'] = 'success';
         $json['title'] = Core::$word->SUCCESS;
         $json['message'] = Core::$word->UR_ACCOK;
         print json_encode($json);
     } else {
         $json['type'] = 'error';
         $json['title'] = Core::$word->ERROR;
         $json['message'] = Core::$word->UR_ACCERR;
         print json_encode($json);
     }
 }
        $email_body = <<<EOF
\t\t\tEr is een nieuwe aanvraag binnengekomen van de site CheckJeStress.nl:<br><br>
\t\t\tPersoonsinformatie:<br>
\t\t\t<ul>
\t\t\t\t{$naam}<br>
\t\t\t\t{$email}
\t\t\t</ul>
\t\t\t<br>
\t\t\tDeze persoon heeft interesse in de volgende zaken:
\t\t\t<ul>{$aanvinkvelden}</ul>
\t\t\tDeze persoon liet het volgende bericht achter:<br>
\t\t\t<ul>{$bericht}</ul>;
EOF;
        include '../resources/includes/PHPMailer/mail.php';
        $mail = new Mailer($page->getConfig()['email']);
        $mail->sendMail([$to], $email_subject, $email_body, $email_body);
        $message = <<<EOF
\t\t\tHartelijk bedankt voor het versturen van uw contactformulier!<br>
\t\t\tEr zal zo spoedig mogelijk contact met u op worden genomen.<br>
\t\t\t<a href="">Klik hier</a> om terug te keren naar de homepage.
EOF;
    }
}
$page->body = <<<CONTENT
\t<div class="content">
\t  <section class="text water" id="first">
\t    <div class="row">
\t      <div class="medium-10 medium-centered columns">
\t        <div class="medium-9 columns medium-offset-3">
\t          <h5>Contact</h1>
\t\t\t  \t\t<p>{$message}</p>
 /**
  * Membership::membershipCron()
  * 
  * @param mixed $days
  * @return
  */
 function membershipCron($days)
 {
     $sql = "SELECT u.id, CONCAT(u.fname,' ',u.lname) as name, u.email, u.membership_id, u.trial_used, m.title, m.days," . "\n DATE_FORMAT(u.mem_expire, '%d %b %Y') as edate" . "\n FROM " . Users::uTable . " as u" . "\n LEFT JOIN " . self::mTable . " AS m ON m.id = u.membership_id" . "\n WHERE u.active = 'y' AND u.membership_id !=0" . "\n AND TO_DAYS(u.mem_expire) - TO_DAYS(NOW()) = '" . (int) $days . "'";
     $listrow = $db->fetch_all($sql);
     require_once BASEPATH . "lib/class_mailer.php";
     if ($listrow) {
         switch ($days) {
             case 7:
                 $mailer = Mailer::sendMail();
                 $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
                 $trow = Registry::get("Core")->getRowById(Content::eTable, 8);
                 $body = cleanOut($trow->body);
                 $replacements = array();
                 foreach ($listrow as $cols) {
                     $replacements[$cols->email] = array('[NAME]' => $cols->name, '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
                 }
                 $decorator = new Swift_Plugins_DecoratorPlugin($replacements);
                 $mailer->registerPlugin($decorator);
                 $message = Swift_Message::newInstance()->setSubject($trow->subject)->setFrom(array(Registry::get("Core")->site_email => Registry::get("Core")->site_name))->setBody($body, 'text/html');
                 foreach ($listrow as $row) {
                     $message->setTo(array($row->email => $row->name));
                     $mailer->send($message);
                 }
                 unset($row);
                 break;
             case 0:
                 $mailer = Mailer::sendMail();
                 $mailer->registerPlugin(new Swift_Plugins_AntiFloodPlugin(100, 30));
                 $trow = Registry::get("Core")->getRowById(Content::eTable, 9);
                 $body = cleanOut($trow->body);
                 $replacements = array();
                 foreach ($listrow as $cols) {
                     $replacements[$cols->email] = array('[NAME]' => $cols->name, '[SITE_NAME]' => Registry::get("Core")->site_name, '[URL]' => Registry::get("Core")->site_url);
                 }
                 $decorator = new Swift_Plugins_DecoratorPlugin($replacements);
                 $mailer->registerPlugin($decorator);
                 $message = Swift_Message::newInstance()->setSubject($trow->subject)->setFrom(array($core->site_email => $core->site_name))->setBody($body, 'text/html');
                 foreach ($listrow as $row) {
                     $message->setTo(array($row->email => $row->name));
                     $data = array('membership_id' => 0, 'mem_expire' => "0000-00-00 00:00:00");
                     self::$db->update(Users::uTable, $data, "id = " . $row->id);
                     $mailer->send($message);
                 }
                 unset($row);
                 break;
         }
     }
 }
Exemple #14
0
    private function sendConfirmationMail($hash)
    {
	$mail = new Mailer();
	$mail->setHost('wp381.webpack.hosteurope.de');
	$mail->setUsername('wp11164385-noreply');
	$mail->setPassword('Mg!ht+opJ');
	$mail->setAuth(true);
	$subject = 'Der Bestätigungslink zu Ihrer Registrierung bei MolBiomed der Uni Bonn';
	$to = Request::getInstance()->getPostRequests('ag_username');
	$mailText = 'Herzlichen Dank für Ihr Interesse an unserem Studienprogramm und Ihre Registrierung! Zur Aktivierung Ihrer Anmeldung klicken Sie bitte auf folgenden Link:'."\n\n";

	if(LOCAL)
	    $mailText .= "http://www.limes.lan/index.php?registrieren=".$hash;
	else
	    $mailText .= "http://www.molbiomed-bewerbung.de/index.php?registrieren=".$hash;

	$mailText .= "\n\n";
	$mailText .="Datenschutzerklärung\n\n";
	$mailText .="Die Rheinische Friedrich-Wilhelms-Universität Bonn legt großen Wert auf den Schutz Ihrer personenbezogenen Daten. Die Verarbeitung dieser Daten erfolgt durch das Koordinationsbüro der Universität Bonn im Rahmen der gesetzlichen Bestimmungen des Landesdatenschutzgesetzes NRW. Die im Online-Formular abgefragten personenbezogenen Daten werden ausschließlich zum Zweck der Abwicklung des Bewerbungsverfahrens erhoben, gespeichert und genutzt. Eine Übermittlung der Daten an andere Stellen innerhalb der Universität erfolgt im Rahmen der gesetzlichen Bestimmungen ebenfalls nur, soweit dies zur Abwicklung des Bewerbungsverfahrens erforderlich ist.\n\n";
	$mailText .="Mit freundlichen Grüßen, \n\n";
	$mailText .="Ihr Team \nder Molekularen Biomedizin\nder Rheinischen Friedrich-Wilhelms Universität Bonn\n\n";

	$mailText .= "____________________________\n\nProf. Dr. Thorsten Lang\nLIMES Institute\nMembrane Biochemistry\nCarl-Troll-Straße 31\n53115 Bonn \n";



	$from = '*****@*****.**';
	$mail->sendMail($to, $subject, utf8_decode($mailText), $from);

    }
Exemple #15
0
function addUserFromCommerce()
{
    $AppModel = new Model();
    $Utente = new UtenteModel();
    $Uform = new UtenteForm();
    $Dbase = new DatabaseModel();
    $Dform = new DatabaseForm();
    $Assoc = new AssociazioneModel();
    $Aform = new AssociazioneForm();
    $request = Slim::getInstance()->request();
    $user = json_decode($request->getBody());
    //Utente
    $Uform->email = trim_string($user->email);
    $Uform->id_utente = null;
    $pwd = Password::randomPassword();
    $Uform->passwd = Password::hashPassword($pwd);
    $Uform->nome = $user->nome;
    $numdb = (int) $user->num_db;
    //TODO: Check for empty number of databases
    $id_utente = $AppModel->getIdUtente($Uform->email);
    $piva = trim_string($user->piva);
    $dbprogr = $AppModel->getNumDB($user->email);
    $INI = $dbprogr;
    $FIN = $dbprogr + $numdb;
    /////////////////////////////////////////////////////////////////////////check if fields are not empty///////////////////////////////
    if (!empty($user->email) && !empty($user->piva) && !empty($user->num_db)) {
        try {
            ///////////////////////////////////////////////////checks if user exist already or no ///////////////////////////////////////
            if (empty($id_utente)) {
                $Utente->saveDb($Uform, 1, 1);
                $testo = "<p>Salve {$user->email},</p>\r\n                            <p>i tuoi dati di accesso presso <b>" . NAME . ":</b><br><br>\r\n                            <b>Nome utente</b>: {$user->email}<br>\r\n                            <b>Password:</b> {$pwd}</p>\r\n                            <p>Una volta effettuato l'accesso ti verrà richiesto di cambiare la password tramite l'apposita funzionalità</p>\r\n                            <p>Adesso puoi effettuare il login al seguente indirizzo: <a href=\"" . URL . "index.php?section=login\">" . URL . "index.php?section=login</a></p>";
                Mailer::sendMail($user->email, NAME, EMAIL, false, NAME . ' - Utente e password', $testo);
                //////////////////////////////////////////////////////////////creates number of databases rquested/////////////////////////////////////////////////
                $Dform->alias = (string) $user->ragsoc;
                $dbnames = createDBName($INI, $FIN, $piva);
                foreach ($dbnames as $key => $value) {
                    $id_database = $AppModel->getIdDb($value);
                    if (empty($id_database)) {
                        $Dform->nome = $value;
                        $Dform->codice = explode("_", $value)[1];
                        if (!$Dbase->esisteDatabase($Dform->nome)) {
                            $Dbase->saveDb($Dform);
                            if (!file_exists(PATH_BASE . DS . CSV . DS . $Dform->codice) && !is_dir(PATH_BASE . DS . CSV . DS . $Dform->codice)) {
                                mkdir(PATH_BASE . DS . CSV . DS . $Dform->codice, 0777, true);
                            }
                        }
                    }
                    $Aform->id_utente = $AppModel->getIdUtente($user->email);
                    $Aform->id_database = $AppModel->getIdDb($Dform->nome);
                    // use name inserted into db ...not something else
                    $Aform->id_associazione = $Assoc->getIDAssociazione($Aform->id_database, $Aform->id_utente);
                    $Aform->data_scadenza = (string) $user->data_scadenza;
                    if (!$Assoc->controllaUnicita($Aform->id_utente, $Aform->id_database, $Aform->id_associazione)) {
                        $Assoc->saveDb($Aform, 1, 1);
                    }
                    // Check if flight is set, enable menu and impose other conditions.
                    if ($user->tipo_gest == '1') {
                        $Dbase->setAuth($AppModel->getIdDb($Dform->nome), 3, 1);
                        $Dbase->ImpostazioneFlight($Dform->nome);
                    }
                }
                //check for errors
                $AppModel->updateNumDB($Uform->email, $numdb);
                //  TODO: Use error checks to send different jsons that is 1 .error in utente, 2. error in database 3.associazione
                $status = array("statuscode" => 200, "response" => array("success" => true, "msg" => "Richiesta eseguita con successo. E stato creato un utente, un database e un abbinamento/associazione.", "data" => array()));
                echo json_encode($status);
            } else {
                // if user doesn't exist
                // 3. send email
                //2. create db,
                //create assocciazione with all
                $Dform->alias = (string) $user->ragsoc;
                $dbnames = createDBName($INI, $FIN, $piva);
                foreach ($dbnames as $key => $value) {
                    $id_database = $AppModel->getIdDb($value);
                    if (empty($id_database)) {
                        $Dform->nome = $value;
                        $Dform->codice = explode("_", $value)[1];
                        if (!$Dbase->esisteDatabase($Dform->nome)) {
                            $Dbase->saveDb($Dform);
                            if (!file_exists(PATH_BASE . DS . CSV . DS . $Dform->codice) && !is_dir(PATH_BASE . DS . CSV . DS . $Dform->codice)) {
                                mkdir(PATH_BASE . DS . CSV . DS . $Dform->codice, 0777, true);
                            }
                        }
                        // else check for errors
                    }
                    //$checkdbname = $Dbase->getDatabase($id_database);
                    // check if database exist already
                    // if so try create associasion
                    //else create db and create association
                    $Aform->id_utente = $AppModel->getIdUtente($user->email);
                    $Aform->id_database = $AppModel->getIdDb($Dform->nome);
                    // use name inserted into db ...not something else
                    $Aform->id_associazione = $Assoc->getIDAssociazione($Aform->id_database, $Aform->id_utente);
                    $Aform->data_scadenza = (string) $user->data_scadenza;
                    if (!$Assoc->controllaUnicita($Aform->id_utente, $Aform->id_database, $Aform->id_associazione)) {
                        $Assoc->saveDb($Aform, 1, 1);
                    }
                    // user alreadey exist  send check if database exist and check if associzoine exist then send email
                    $testo = "<p>Salve {$user->email},</p>\r\n                           <p>La sua richiesta è stata accettata. Abbiamo abbinato una nuova basi di dati a questo utente.</p>\r\n                            <p>i tuoi dati di accesso presso <b>" . NAME . ":</b><br>\r\n                            <p>Si potrebbe usare le tue credenziali già esistente per accedere.</p>\r\n                            <p></p>\r\n                            <p>Adesso puoi effettuare il login al seguente indirizzo: <a href=\"" . URL . "index.php?section=login\">" . URL . "index.php?section=login</a></p>";
                    Mailer::sendMail($user->email, NAME, EMAIL, false, NAME . ' - Utente e password', $testo);
                    // Check if flight is set, enable menu and impose other conditions.
                    if ($user->tipo_gest == '1') {
                        $Dbase->setAuth($AppModel->getIdDb($Dform->nome), 3, 1);
                        $Dbase->ImpostazioneFlight($Dform->nome);
                    }
                }
                // for each
                $AppModel->updateNumDB($Uform->email, $numdb);
                //  TODO: Use error checks to send different jsons that is 1 .error in utente, 2. error in database 3.associazione
                $status = array("statuscode" => 200, "response" => array("success" => true, "msg" => "Richiesta eseguita con successo.E stato creato un database e un abbinamento/associazione. ", "data" => array()));
                echo json_encode($status);
            }
            // else
        } catch (Exception $e) {
            $status = array("statuscode" => 200, "response" => array("success" => false, "msg" => "Iscrizione negato, email/utente già esistente!", "errmsg" => $e->getMessage(), "data" => null));
            echo json_encode($status);
        }
    } else {
        $status = array("statuscode" => 200, "response" => array("success" => false, "msg" => "I campi email, numero di database e partita IVA  non possono  essere vuoti", "data" => null));
        echo json_encode($status);
    }
}
Exemple #16
0
?>
" title = "Shorten URLs quickly!"> <h1 class = "title"> stelin </h1> </a>
			<?php 
// If the request is a valid one
if (isset($_SESSION['status'])) {
    // If something is wrong display the error message
    if ($_SESSION['status'] < 200 || $_SESSION['status'] > 299) {
        $status = $_SESSION['status'];
        $status_message = $_SESSION['status_message'];
        echo "<h3 class='error'> Errrr.. Something is not right! </h3>";
        echo "<textarea class = 'textarea' rows='2' cols='60' readonly> {$status} - {$status_message}. Try again! </textarea>";
    } else {
        $link = $_SESSION['link'];
        // If the user has entered an email address and also the email feature is enabled, send an email
        if (Email::$enabled && isset($_SESSION['email'])) {
            Mailer::sendMail();
        }
        echo "<h1 class='success'>That was smooth! Here is you link:</h1>";
        echo "<textarea class = 'textarea' rows='2' cols='60' readonly> {$link} </textarea>";
    }
    // Clear the session (except twitter_name)
    Session::unsetGeneralSession();
} else {
    Session::unsetGeneralSession();
    header('Location: ' . Server::$root);
    die;
}
?>
		</div>
	</body>
	
function processRegoSubmission()
{
    // $out = new OUTPUTj(0,"","Registration currently not available");
    // echo $out->toJSON();
    // return false;
    $json = $_POST["json"];
    if ($json || $_POST["reference"]) {
        if ($json != "") {
            //create new object with json data
            $rego = new Registration($json);
            //check if json data exists
            if ($rego->exists()) {
                $out = new OUTPUTj(0, "", "This registration information already exists!");
                echo $out->toJSON();
                return false;
            }
            //json to objects
            $rego->parseJSON();
            //make sure the json converted is valid
            if ($rego->isValid() == false) {
                $out = new OUTPUTj(0, "", $rego->errMsg);
                echo $out->toJSON();
                return false;
            }
            //$out = new OUTPUTj(0,"","Registration is temporarily unavailable!");
            //echo $out->toJSON();
            //return false;
            //$rego->toString();
            if ($rego->commitDB()) {
                $ref = $rego->Reference;
                //send sms
                try {
                    //we try this as we dont want to show error if sms fails
                    //we still want to show the registration information
                    //check for aussie mobile prefix
                    if (substr($rego->Phone, 0, 5) == "+6104" || substr($rego->Phone, 0, 4) == "+614") {
                        $sms = new SMS();
                        if ($sms->access_token) {
                            $messageId = $sms->send($rego->Phone, 'Hi ' . $rego->Firstname . ', your ref: ' . $ref . '. View your rego @ http://tinyurl.com/h4glqrk?ref=' . $ref . '\\n\\nDaiHoi Melbourne2016 Team.');
                            if ($messageId) {
                                $rego->updateSMSMessageId($rego->Reference, $messageId);
                            }
                        }
                    }
                } catch (Exception $e) {
                    //should log error in db
                }
                //we send email
                try {
                    //we try this as we dont want to show error if email fails
                    //we still want to show the registration information
                    $show_viet_section = 0;
                    if (startsWith($rego->Phone, "+84") || startsWith($rego->Phone, "84") || endsWith($rego->Church, "Vietnam")) {
                        $show_viet_section = 1;
                    }
                    $message = $rego->getRego($ref);
                    $email = new Mailer();
                    $email->sendMail($rego->Email, 'DaiHoi 2016 Registration [' . $ref . '] for: ' . $rego->FullName(), $message, $show_viet_section);
                } catch (Exception $e) {
                    //should log error in db
                }
                $out = new OUTPUTj(1, $ref, $rego->errMsg);
                echo $out->toJSON();
            } else {
                $out = new OUTPUTj(0, "", $rego->errMsg);
                echo $out->toJSON();
            }
        }
    }
}
Exemple #18
0
/**
 * Write a wrapper function that
 * 1.  Adds users
 * 2. Adds database
 * 3. Creates association between users and database using existing models
 * Added more checks 14/09/2015 . Must be rewritten if there is time.
 */
function addUser()
{
    $request = Slim::getInstance()->request();
    $user = json_decode($request->getBody());
    $AppModel = new Model();
    $Utente = new UtenteModel();
    $Uform = new UtenteForm();
    $Dbase = new DatabaseModel();
    $Dform = new DatabaseForm();
    $Assoc = new AssociazioneModel();
    $Aform = new AssociazioneForm();
    //Utente
    $Uform->email = trim_string($user->email);
    $Uform->id_utente = null;
    $pwd = Password::randomPassword();
    $Uform->passwd = Password::hashPassword($pwd);
    //Database
    $piva = (string) trim_string($user->piva);
    $Dform->nome = INIDB_WKI . "{$piva}";
    $Dform->alias = !empty($user->ragsoc) ? $user->ragsoc : $user->piva;
    $Dform->codice = $user->piva;
    //$Dform->id_database =  $AppModel->getIdDb($Dform->nome);
    $Dform->id_database = $AppModel->getIdDbbyCodice($Dform->codice);
    $id_utente = $AppModel->getIdUtente($Uform->email);
    if (!empty($user->email) && !empty($user->piva)) {
        try {
            if (empty($id_utente)) {
                ///////////////////////////// User doesn't exist, save user and send and email with password//////////////////////////////////////////////////
                if ($Utente->saveDb($Uform, 1, 1)) {
                    $testo = "<p>Salve {$user->email},</p>\r\n                                <p>i tuoi dati di accesso presso <b>" . NAME . ":</b><br><br>\r\n                                <b>Nome utente</b>: {$user->email}<br>\r\n                                <b>Password:</b> {$pwd}</p>\r\n                                <p>Una volta effettuato l'accesso ti verrà richiesto di cambiare la password tramite l'apposita funzionalità</p>\r\n                                <p>Adesso puoi effettuare il login al seguente indirizzo: <a href=\"" . URL . "index.php?section=login\">" . URL . "index.php?section=login</a></p>";
                    Mailer::sendMail($user->email, NAME, EMAIL, false, NAME . ' - Utente e password', $testo);
                }
                ///////////////////////////// If database exist already, then create association of user and database and date of expiry//////////////////////////
                if (!empty($Dform->id_database)) {
                    $Aform->id_utente = $AppModel->getIdUtente($user->email);
                    $Aform->id_database = $AppModel->getIdDbbyCodice($Dform->codice);
                    $Aform->data_scadenza = (string) $user->data_scadenza;
                    $Assoc->saveDb($Aform, 1, 1);
                } else {
                    //////////////////////////// If database  does not exist , create datbase and associate it with the user ///////////////////////////////////////////
                    $Dbase->saveDb($Dform);
                    if (!file_exists(PATH_BASE . DS . CSV . DS . $Dform->codice) && !is_dir(PATH_BASE . DS . CSV . DS . $Dform->codice)) {
                        mkdir(PATH_BASE . DS . CSV . DS . $Dform->codice, 0777, true);
                    }
                    $Aform->id_utente = $AppModel->getIdUtente($user->email);
                    $Aform->id_database = $AppModel->getIdDbbyCodice($Dform->codice);
                    $Aform->data_scadenza = (string) $user->data_scadenza;
                    $Assoc->saveDb($Aform, 1, 1);
                }
                ////////////////////////// If request is for complete application(f-light), launch this procedure to modify application ////////////////////////////////////
                if ($user->tipo_gest == '1') {
                    $Dbase->setAuth($AppModel->getIdDbbyCodice($Dform->codice), 3, 1);
                    $Dbase->ImpostazioneFlight($Dform->nome);
                    // maintain name as in name of Database
                }
                //////////////////////// If all this is done we are sure that a user, database and their association has been succefully done so throw out json ///////////
                $status = array("statuscode" => 200, "response" => array("success" => true, "msg" => "E stato creato un utente, database e un  abbinamento/associazione.", "data" => array()));
                echo json_encode($status);
            } else {
                ////////////////////////  We arrived here because user id was found, so we send a message to the user saying we added a database/company to them and they can use old password//////
                $testo = "<p>Salve {$user->email},</p>\r\n                           <p>La sua richiesta è stata accettata. Abbiamo abbinato una nuova basi di dati a questo utente.</p>\r\n                            <p>i tuoi dati di accesso presso <b>" . NAME . ":</b><br>\r\n                            <p>Si potrebbe usare le tue credenziali già esistente per accedere.</p>\r\n                            <p></p>\r\n                            <p>Adesso puoi effettuare il login al seguente indirizzo: <a href=\"" . URL . "index.php?section=login\">" . URL . "index.php?section=login</a></p>";
                $Aform->id_utente = $AppModel->getIdUtente($user->email);
                $Aform->id_database = $AppModel->getIdDbbyCodice($Dform->codice);
                $Aform->data_scadenza = (string) $user->data_scadenza;
                $Dform->id_database = $AppModel->getIdDbbyCodice($Dform->codice);
                ///////////////////////// If a database already exist, we send and email and create and create and association with the user ///////////////////////////////////////////////////
                if (!empty($Dform->id_database)) {
                    Mailer::sendMail($user->email, NAME, EMAIL, false, NAME . ' - Utente e password', $testo);
                    if (!$Assoc->controllaUnicita($Aform->id_utente, $Aform->id_database, $Aform->id_associazione)) {
                        $Assoc->saveDb($Aform, 1, 1);
                        $status = array("statuscode" => 200, "response" => array("success" => true, "msg" => "Un abbinamento/associazione è stato creato.", "data" => array()));
                        echo json_encode($status);
                    } else {
                        $status = array("statuscode" => 200, "response" => array("success" => true, "msg" => "Operazione eseguito con succeso, esiste già un associazione", "data" => array()));
                        echo json_encode($status);
                    }
                    ///////////////////////////// If there is no database, then we create database , send email and create folder and association////////////
                } else {
                    $Dform->id_database = $AppModel->getIdDbbyCodice($Dform->codice);
                    $Dbase->saveDb($Dform);
                    Mailer::sendMail($user->email, NAME, EMAIL, false, NAME . ' - Utente e password', $testo);
                    if (!file_exists(PATH_BASE . DS . CSV . DS . $Dform->codice) && !is_dir(PATH_BASE . DS . CSV . DS . $Dform->codice)) {
                        mkdir(PATH_BASE . DS . CSV . DS . $Dform->codice, 0777, true);
                    }
                    $Assoc->saveDb($Aform, 1, 1);
                    $status = array("statuscode" => 200, "response" => array("success" => true, "msg" => "E stato creato un database e un abbinamento/associazione. ", "data" => array($Dform->id_database)));
                    echo json_encode($status);
                }
            }
        } catch (Exception $e) {
            // TODO: What to return
            $status = array("statuscode" => 200, "response" => array("success" => false, "msg" => "Errori nel inserimento su database o nella creazione della cartella !", "errmsg" => $e->getMessage(), "data" => null));
            echo json_encode($status);
        }
    } else {
        $status = array("statuscode" => 200, "response" => array("success" => false, "msg" => "I campi email e partita IVA  non possono  essere vuoti", "data" => null));
        echo json_encode($status);
    }
}
Exemple #19
0
        $error = true;
        return false;
    }
    pflog('ITN OK');
    pflog("ITN verified for {$itnVerifyRequest}\n");
    if ($error == false and $_POST['payment_status'] == "COMPLETE") {
        $user_id = intval($_POST['custom_int1']);
        $mc_gross = $_POST['amount_gross'];
        $membership_id = $_POST['m_payment_id'];
        $txn_id = $_POST['pf_payment_id'];
        $total = Core::getCart($user_id);
        $v1 = compareFloatNumbers($mc_gross, $total->totalprice, "=");
        if ($v1 == true) {
            $row = $db->first("SELECT * FROM " . Membership::mTable . " WHERE id=" . (int) $membership_id);
            $username = getValueById("username", Users::uTable, (int) $user_id);
            $data = array('txn_id' => $txn_id, 'membership_id' => $row->id, 'user_id' => (int) $user_id, 'rate_amount' => $total->originalprice, 'tax' => $total->totaltax, 'coupon' => $total->coupon, 'total' => $total->totalprice, 'ip' => $_SERVER['REMOTE_ADDR'], 'created' => "NOW()", 'pp' => "PayFast", 'currency' => "ZAR", 'status' => 1);
            $db->insert(Membership::pTable, $data);
            $udata = array('membership_id' => $row->id, 'mem_expire' => $user->calculateDays($row->id), 'trial_used' => $row->trial == 1 ? 1 : 0, 'memused' => 1);
            $db->update(Users::uTable, $udata, "id=" . (int) $user_id);
            /* == Notify Administrator == */
            require_once BASEPATH . "lib/class_mailer.php";
            $row2 = Core::getRowById(Content::eTable, 5);
            $body = str_replace(array('[USERNAME]', '[ITEMNAME]', '[PRICE]', '[STATUS]', '[PP]', '[IP]'), array($username, $row->title, $core->formatMoney($mc_gross), "Completed", "PayPal", $_SERVER['REMOTE_ADDR']), $row2->body);
            $newbody = cleanOut($body);
            $mailer = Mailer::sendMail();
            $message = Swift_Message::newInstance()->setSubject($row2->subject)->setTo(array($core->site_email => $core->site_name))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody, 'text/html');
            $mailer->send($message);
            pflog("Email Notification sent successfuly");
        }
    }
}
Exemple #20
0
    private function sendnewPassord($password, $hash)
    {
	$mail = new Mailer();
	$mail->setHost('wp381.webpack.hosteurope.de');
	$mail->setUsername('wp11164385-noreply');
	$mail->setPassword('Mg!ht+opJ');
	$mail->setAuth(true);
	$subject = 'Ihr neues Passwort für Ihre Bewerbung bei MolBiomed der Uni Bonn';
	$to = Request::getInstance()->getPostRequests('ag_username');
	$mailText = 'Sehr geehrter Bewerber,'."\n\n";
	$mailText .= 'Ihr neues Passwort lautet: '.$password."\n\n";
	$mailText .= 'bitte klicken Sie auf folgenden Link, um es zu aktivieren'."\n\n";

	if(LOCAL)
	    $mailText .= "http://www.limes.lan/index.php?lostPassswort=".$hash;
	else
	    $mailText .= "http://www.molbiomed-bewerbung.de/index.php?lostPassswort=".$hash;

	$mailText .= "\n\n____________________________\n\nProf. Dr. Thorsten Lang\nLIMES Institute\nMembrane Biochemistry\nCarl-Troll-Straße 31\n53115 Bonn \n";

	$from = '*****@*****.**';
	$mail->sendMail($to, $subject, $mailText, $from);
    }
Exemple #21
0
         $jn['type'] = 'success';
         $jn['message'] = 'Thank you payment completed';
         print json_encode($jn);
         /* == Notify Administrator == */
         require_once BASEPATH . "lib/class_mailer.php";
         $row2 = Core::getRowById(Content::eTable, 5);
         $body = str_replace(array('[USERNAME]', '[ITEMNAME]', '[PRICE]', '[STATUS]', '[PP]', '[IP]'), array($user->username, $row->title, $core->formatMoney($amount_charged), "Completed", "Stripe", $_SERVER['REMOTE_ADDR']), $row2->body);
         $newbody = cleanOut($body);
         $mailer = Mailer::sendMail();
         $message = Swift_Message::newInstance()->setSubject($row2->subject)->setTo(array($core->site_email => $core->site_name))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody, 'text/html');
         $mailer->send($message);
         /* == Notify User == */
         $row3 = Core::getRowById(Content::eTable, 15);
         $body2 = str_replace(array('[USERNAME]', '[MNAME]', '[VALID]'), array($user->username, $row->title, $udata['mem_expire']), $row3->body);
         $newbody2 = cleanOut($body2);
         $mailer2 = Mailer::sendMail();
         $message2 = Swift_Message::newInstance()->setSubject($row3->subject)->setTo(array($user->email => $user->username))->setFrom(array($core->site_email => $core->site_name))->setBody($newbody2, 'text/html');
         $mailer2->send($message2);
         $db->delete(Content::crTable, "uid = " . $user->uid);
     } else {
         $json['type'] = 'error';
         $json['message'] = "Invalid Transaction detected";
         print json_encode($json);
     }
 } catch (Stripe_CardError $e) {
     //$json = json_decode($e);
     $body = $e->getJsonBody();
     $err = $body['error'];
     $json['type'] = 'error';
     Filter::$msgs['status'] = 'Status is: ' . $e->getHttpStatus() . "\n";
     Filter::$msgs['type'] = 'Type is: ' . $err['type'] . "\n";
Exemple #22
0
<?php

session_start();
require_once '../../../classes/Constan.php';
require_once '../../../classes/Encryption.php';
require_once '../../../classes/Server.php';
require_once '../../../classes/Request.php';
require_once '../../../classes/Mailer.php';
require_once '../../../classes/Google/autoload.php';
require_once '../../../classes/class.phpmailer.php';
//las últimas versiones también vienen con autoload
$request = Request::reqFull();
$client = new Google_Client();
$mailer = new Mailer($client);
$origen = '*****@*****.**';
$alias = 'MARTIN';
$destino = $request['email'];
$asunto = 'ACTIVACIÓN DE CUENTA';
$mensaje = "http://" . Server::getServerHost() . '/usuarios/modules/users/back/controller/unlock.php?user='******'user'] . '&time=' . $request['time'];
$res = $mailer->sendMail($origen, $alias, $destino, $asunto, $mensaje);
header('Location:../login.php');
?>