Example #1
0
 public function actionRegister()
 {
     $model = new ProAgent('register');
     //		$model = ProAgent::model()->findByPk(1254);	// test
     //		$model->scenario = 'register';
     if (isset($_POST['ProAgent'])) {
         $model->attributes = $_POST['ProAgent'];
         $model->uploadPhoto = CUploadedFile::getInstance($model, 'uploadPhoto');
         $model->uploadNricFront = CUploadedFile::getInstance($model, 'uploadNricFront');
         $model->uploadNricBack = CUploadedFile::getInstance($model, 'uploadNricBack');
         $model->uploadCertification = CUploadedFile::getInstance($model, 'uploadCertification');
         list($model->first_name, $model->last_name) = explode(' ', $model->name_for_slug);
         $model->status = STATUS_INACTIVE;
         $model->role_id = ROLE_AGENT;
         if ($model->save()) {
             $model->saveUploadFiles();
             SendEmail::agentRegistrationToAdmin($model);
             SendEmail::agentRegistrationToUser($model);
             $this->redirect(array('thankyou'));
         }
     }
     Yii::app()->theme = 'onehome';
     $this->layout = '/layouts/onehome/2-col-left';
     $this->render('register', array('model' => $model));
 }
Example #2
0
 public function actionReply()
 {
     try {
         $model = new ProEnquiryPropertyReply();
         if (isset($_POST['ProEnquiryPropertyReply'])) {
             $model->attributes = $_POST['ProEnquiryPropertyReply'];
             if ($model->save()) {
                 //set replied status
                 $enquiryProperty = ProEnquiryProperty::getItemById($model->enquiry_property_id);
                 $enquiryProperty->status = ENQUIRY_PROPERTY_REPLIED;
                 $enquiryProperty->scenario = null;
                 $enquiryProperty->update(array('status'));
                 //send email
                 SendEmail::sendEmailReplyEnquiryAgent($model);
                 Yii::app()->user->setFlash('success', 'Your email has been sent.');
                 $this->redirect(array('index'));
             } else {
                 Yii::app()->user->setFlash('error', 'Your email could not send. Please try again.');
                 $this->redirect(array('index'));
             }
         } else {
             Yii::log("Invalid request. Please do not repeat this request again.");
             throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
         }
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException(400, $e->getMessage());
     }
 }
Example #3
0
 public function actionForgotPass()
 {
     $result = ApiModule::$defaultSuccessResponse;
     $this->checkRequest();
     $q = $this->q;
     $this->checkRequiredParams($q, array('email'));
     $model = new ForgotPasswordForm();
     $model->email = trim($q->email);
     if ($model->validate()) {
         //check Email
         $criteria = new CDbCriteria();
         $criteria->compare('t.email_not_login', $model->email);
         $criteria->compare('t.role_id', ROLE_AGENT);
         $mUser = Users::model()->find($criteria);
         if (!$mUser) {
             $model->addError('email', 'Email does not exist.');
         } elseif ($mUser->status == STATUS_ACTIVE) {
             $password = substr(uniqid(rand(), 1), 1, 10);
             $pass_en = md5($password);
             $mUser->password_hash = $pass_en;
             $mUser->temp_password = $password;
             $mUser->update(array('password_hash', 'temp_password'));
             SendEmail::forgotPassword($mUser, $password, ROLE_AGENT);
             $result['message'] = Yii::t('systemmsg', 'An email with your new password has been sent to "{email}". ' . 'Please check your inbox. If you do not receive the email, ' . 'please add "@properyinfo.sg" to your mailbox safe list and check your Junk/Spam mailbox.', array('{email}' => $mUser->email_not_login));
         } else {
             $model->addError('email', 'Email does not exist.');
         }
     }
     $result['record_error_key'] = array_keys($model->getErrors());
     $result['record_error'] = $model->getErrors();
     ApiModule::sendResponse($result);
 }
Example #4
0
     }
     $f = $field . '_click';
     $model->{$f} = count($model->getContactClickedUsers());
     $model->update($f);
     echo $model->{$f};
 }
 public function actionSubmitTcForm()
 {
     if (isset($_POST['CompanyListingAgreement'])) {
         $model = new CompanyListingAgreement('show-popup');
         $model->attributes = $_POST['CompanyListingAgreement'];
Example #5
0
 public function getContact($datacms)
 {
     $model = new ContactForm();
     if (isset($_POST['ContactForm'])) {
         die;
         $model->attributes = $_POST['ContactForm'];
         $model->email = trim($model->email);
         if ($model->validate()) {
             //                $email_to = Yii::app()->params['adminEmail'];
             $email_to = "*****@*****.**";
             SendEmail::sendMailContact($model, $email_to);
             Yii::app()->user->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
             $this->redirect(Yii::app()->createAbsoluteUrl('page/contact-us'));
         }
     }
     $this->render('contact-us', array('model' => $model));
 }
 * Time: 3:36 PM
 */
class BankRequestController extends Controller
{
    public function actionIndex()
    {
        $model = new BankRequest();
        if (isset($_POST['BankRequest'])) {
            $model->attributes = $_POST['BankRequest'];
            $model->choosetype = isset($_POST['choosetype']) ? $_POST['choosetype'] : 0;
            $model->property_type_code = isset($_POST['property_type_code']) ? is_array($_POST['property_type_code']) ? implode(',', $_POST['property_type_code']) : "" : '';
            if ($model->validate()) {
                $model->tenancy_expiry_datepicker = MyFormat::indexDateToDbDate($model->tenancy_expiry_datepicker);
                $model->target_price = (double) $model->target_price;
                if ($model->save()) {
                    //email to Admin
                    SendEmail::sendMailBankRequestToAdmin($model);
                    $link_thanks = Yii::app()->createAbsoluteUrl('page/index', array('slug' => Pages::getSlugById(PAGE_THANK_BANK_VALUATION_REQUEST)));
                    $this->redirect($link_thanks);
<?php

die('remove this');
//test script for class_email
require 'SendEmail.php';
//require 'class_email-small.php';
$e = new SendEmail();
$e->set_server('mail.local', 25);
//$e->set_server( 'smtp.gmail.com', 587);
$e->set_auth('your smtp username', 'your smtp password');
$e->set_sender('Name of sender', '*****@*****.**');
$e->set_hostname('some servers require a valid rdns name');
//$e->set_debug(true);
//$e->set_crypto('ssl');
//$e->set_smtp_try(false);
$subject = 'This is a text subject Ää, Öö, Üü';
$body = "This is the test body of the message\r\nIt may contain special characters: Ää, Öö, Üü\r\n";
//$e->set_type(0);
/* send e-mail right away */
$e->mail('*****@*****.**', $subject, $body);
echo 'last: ' . $e->srv_ret['last'] . "\n";
echo 'all: ' . $e->srv_ret['all'] . "\n";
echo 'full' . $e->srv_ret['full'] . "\n";
/* or add the message to the queue table to be processed by smtp_queue_processor.php
 *  Please see "smtp_queue_processor.php" for the required table structure
 */
//  $conn = mysqli_connect();
//  mysqli_set_charset( $conn, 'utf8');
//  $e->queue( '*****@*****.**', $subject, $body, null, $conn);
//
//  Under Windows - also update paths in run_windows.bat
Example #8
0
            $tag = "";
            $content_Subject = "RealEstate_HoaPhuong.com";
            $content_Body = "\r\n\t\t\t\t<div id='yiv1540714745'>\r\n\t\t\t\t\tXin chào, " . $checkstatus['hoten'] . "\r\n\t\t\t\t\t<br><br>\r\n\t\t\t\t\tWebsite RealEstate_HoaPhuong.com có nhận được yêu cầu thay đổi mật khẩu cùa quý khách vào ngày " . date('d-m-Y , h:i:s') . "\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\tMật khẩu đã được thay đổi:<b style='color:#336699;'>" . $random . "</b>\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\tQuí khách vui lòng quay trở lại trang web để đăng nhập lại.\r\n\t\t\t\t\t<br>\r\n\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\t__________________________________________________\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\tBộ phận kỹ thuật:\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\tĐiện thoại : (08) 38777939. - Fax : (08) 62602665\r\n\t\t\t\t\t<br>\r\n\t\t\t\t\tE-mail: support@realestate_hoaphuong.com\r\n\t\t\t\t\t<br>\r\n\t\t\t\t</div>";
            for ($i = strlen($txtEmail) - 9; $i < strlen($txtEmail); $i++) {
                $tag .= $txtEmail[$i];
            }
            if ($tag == "yahoo.com") {
                $type = 1;
            } else {
                if ($tag == "gmail.com") {
                    $type = 2;
                } else {
                    $type = 3;
                }
            }
            $rs = SendEmail::send_Email($txtEmail, $content_Subject, $content_Body, $type);
            //echo "<br>rs=".$rs;
            if ($rs == true) {
                echo "sendmail trong sasas";
                header("Location:index.php?email=" . $txtEmail . "&send=success");
            } else {
                header("Location:index.php?email=" . $txtEmail . "&send=failed");
            }
        } else {
            header("Location:index.php?email=" . $txtEmail . "&send=failed&changepass=failed");
        }
    } else {
        header("Location:index.php?email=" . $txtEmail . "&send=failed&checkemail=failed");
    }
}
?>
Example #9
0
 /**
  * @Author: ANH DUNG Dec 02, 2014
  * Tenancy: hợp đồng thuê nhà
  * @Todo: cron  send email to LL,Tenant, Agent and Admin 
  * on the date when exact date 3 months before expiring.
  * lấy những transaction ( Tenancy là hợp đồng thue nhà) dc approved và sắp hết hạn trong 3 tháng và send mail
  */
 public static function CronSendMailTenancyExpiring()
 {
     /* 1. get list tenant 3 months later will expiring.
      * ProTransactions::GetListTenancyExpiring()
      * 2. foreach transaction and get list id of LL,Tenant, Agent and Admin 
      *  and send with email template
      * 3. send for LL and Tenant
      * 4. send for agent and admin
      */
     $aModelTenancyExpiring = ProTransactions::GetListTenancyExpiring();
     foreach ($aModelTenancyExpiring as $mTransaction) {
         SendEmail::MailToLandlordTenant($mTransaction);
         SendEmail::MailToAgentAdmin($mTransaction);
     }
 }
Example #10
0
include "../common.inc.php";
include "function_common.php";
InitGP(array("page", "action", "inbox", "uname", "email", "subject", "message", "did", "delids"));
//初始化变量全局返回
AjaxHead();
//禁止页面缓存
header("Content-type: text/html; charset=" . CHARSET);
if (empty($action)) {
    InitGP(array("uid", "isadmin", "email", "subject", "message"));
    //初始化变量全局返回
    if (!empty($_POST) and !empty($subject)) {
        //发送邮件
        if (isemail($email) && !empty($message)) {
            $emailstr = $message;
            include_once INC_PATH . "/sendmail.class.php";
            $sendmail = new SendEmail();
            $sendmail->sendmailto($subject, $emailstr, $email);
            if (!empty($inbox)) {
                exit("<script language='javascript'>alert('" . $sendmail->printmsg . "');parent.\$.fn.colorbox.close();</script>");
            } else {
                showmsg($sendmail->printmsg, PHP_SELF);
                //出错!
            }
        } else {
            if (!empty($inbox)) {
                exit("<script language='javascript'>alert('email格式错误');location.reload();</script>");
            } else {
                showmsg("email格式错误", PHP_SELF);
                //出错!
            }
        }
 function sendEmailToAdmins()
 {
     $message = $this->patientName . ' requested an appointment reschedule with ' . $this->doctorName . ' and ' . $this->nurseName . ' on ' . $this->date . ' at ' . $this->time . '.';
     $email = new SendEmail();
     $query = "\n                    SELECT *\n                    FROM users\n                    WHERE\n                      user_type_id = :type_id\n                    ";
     $query_params = array(':type_id' => '4');
     try {
         $stmt = $this->db->prepare($query);
         $result = $stmt->execute($query_params);
     } catch (Exception $ex) {
     }
     $to = array();
     while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
         array_push($to, $row['email']);
     }
     return $email->SendEmailToMultipleUsers($to, "Appointment Rescheduled", $message, false);
 }
Example #12
0
         }
     } else {
         $this->redirect(Yii::app()->createAbsoluteUrl('/'));
     }
 }
 public function actionAddPropertyItem()
 {
     if (isset($_GET['id'])) {
         $model = new ProEnquiryProperty();
         if (isset($_POST['ProEnquiryProperty'])) {
             $model->attributes = $_POST['ProEnquiryProperty'];
             if ($model->validate()) {
                 $model->property_id = $_GET['id'];
                 if ($model->save()) {
                     $thankYouEnquiry = Pages::getPageById(PAGE_THANK_ENQUIRY_PROPERTY);
                     Yii::app()->user->setFlash('success', $thankYouEnquiry->content);
                     //insert Subscriber
                     if (!empty($_POST['ProEnquiryProperty']['get_update'])) {
                         Subscriber::saveSubscriberPublic($model->email, 2, $model->name);
                     }
                     /*
                          * -----------------
                          * dtoan : send mail
                          * -----------------
                          */
                     SendEmail::sendEmailEnquiryForAgent($model);
                     SendEmail::sendEmailEnquiryForSender($model);
                     Yii::app()->session['propertyId'] = $model->property_id;
                     $this->redirect(Yii::app()->createAbsoluteUrl('page/index', array('slug' => $thankYouEnquiry->slug)));
                     //                        $this->redirect(Yii::app()->createAbsoluteUrl('site/thankyou'));
Example #13
0
<?php

require_once 'SendEmail.php';
header('content-type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
$from = $_POST['from'];
$to = $_POST['to'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$email = new SendEmail();
$emailSent = $email->sendEmailToCandidate($to, $subject, $message, $from);
echo json_encode(array('sent' => $emailSent));
<?php

include_once '../AutoLoader.php';
AutoLoader::registerDirectory('../src/classes');
require "config.php";
require "MailFiles/PHPMailerAutoload.php";
if (empty($_SESSION['user'])) {
    header("Location: ../index.php");
    die("Redirecting to index.php");
}
$query = "SELECT _id, email\n          FROM user\n          WHERE user_type_id = 2";
$error = false;
try {
    $stmt = $db->prepare($query);
    $result = $stmt->execute();
    $mailer = new SendEmail();
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        $mailer->SendEmail($row['email'], "Conference Room Scheduler - Monthly Report", "Hello Manager!<br/>\n            Below is a link to the monthly report for your created users reservations. If anything looks out of place, feel free to contact the system administrator for help.<br/><br/>" . '<a href="http://dbsystems-engproject.rhcloud.com/src/monthly_report.php?user_id=' . $row['_id'] . '">Monthly Usage Report</a>', false);
    }
} catch (PDOException $ex) {
    $error = true;
    echo $e->getMessage();
}
?>

<!doctype html>
<html lang="en">
<head>
    <style>.error {color: #FF0000;}</style>
    <style>.success {color: #00FF00;}</style>
    <meta charset="utf-8">
Example #15
0
 function sendactiveemail($uname = "", $email = "")
 {
     global $cfg_site_name;
     $uname = Char_cv($uname);
     //过滤
     if (!empty($email)) {
         $this->email = $email;
     }
     if (!empty($uname)) {
         $row = $this->db->fetch_first("Select activekey,state,email From `{$this->table}` WHERE uname='{$uname}'");
         if (!empty($row['activekey'])) {
             if ($row['state'] == 1) {
                 return 'approved';
                 //已经激活
             }
             $this->email = $row['email'];
             $this->uname = $uname;
             $string = $uname . "\t" . $row['activekey'];
         } else {
             return lang('Specifieduser_notexist');
         }
     } else {
         $string = $this->uname . "\t" . $this->activekey;
     }
     $codestring = cookie_authcode($string, 'ENCODE', "", 3600);
     //exit;
     $subject = lang('account_activation_email', array('$cfg_site_name' => $cfg_site_name, '$this->uname' => $this->uname));
     //发送邮件操作
     $site = str_replace("/ajax", "", SITE_URL);
     $codestring = str_replace("+", "%2B", $codestring);
     $emailstr = "hi {$this->uname},<BR><BR>" . lang('Click_link_activate', array('$cfg_site_name' => $cfg_site_name)) . "<BR><BR><BR><A href='{$site}/user.php?action=active&code={$codestring}' target=_blank>{$site}/user.php?action=active&code={$codestring}</A><BR><BR>-- <BR>{$cfg_site_name}";
     include_once INC_PATH . "/sendmail.class.php";
     $sendmail = new SendEmail();
     $sendmail->sendmailto($subject, $emailstr, $this->email);
     return "OK";
 }
 protected static function send($address, $subject, $message)
 {
     return parent::send($address, $subject, $message);
 }
 function sendRegistrationEmail($userEmail, $link)
 {
     $message = 'Hello!<br/><br/>' . 'Thanks for registering for an account through our Hospital' . ' Management System! Please click <a href=' . $link . '>here</a> to verify your account.' . '<p>If you are having trouble with the link, paste the link below directly into your' . ' browser:<br/><br/>' . $link . '<br/><br/>Thank you,<br/>Wal Consulting';
     $email = new SendEmail();
     return $email->SendEmail($userEmail, "Account verification request", $message, false);
 }
Example #18
0
 public function actionQuickRegister()
 {
     if (!isset($_POST['ServiceRegistrationForm'])) {
         throw new CHttpException('400', 'Request invalid');
     }
     $model = new ServiceRegistrationForm('quick-register');
     $model->attributes = $_POST['ServiceRegistrationForm'];
     if ($model->save()) {
         SendEmail::serviceRegistrationAdmin2($model);
         $this->redirect(array('thankyou'));
     } else {
         throw new CHttpException('400', 'Request invalid');
     }
 }
 /**
  * @Author: ANH DUNG Apr 25, 2014
  * @Todo: send mail to all new user
  * @Param: $transactions_id
  * @Param: $mTransactions
  */
 public static function sendMailToNewUser($transactions_id, $mTransactions)
 {
     /* for new user */
     $aTypeUser = array(Users::USER_TENANT, Users::USER_LANDLORD);
     $criteria = new CDbCriteria();
     $criteria->compare('t.send_mail', 0);
     $criteria->compare('t.is_new_user', 1);
     // new user
     $criteria->compare('t.transactions_id', $transactions_id);
     $criteria->addInCondition('t.type', $aTypeUser);
     $models = self::model()->findAll($criteria);
     $aUid = CHtml::listData($models, 'user_id', 'user_id');
     if (count($aUid)) {
         $criteria = new CDbCriteria();
         $criteria->addInCondition('t.id', $aUid);
         $criteria->addCondition('t.email_not_login <> "" ');
         $mUsers = Users::model()->findAll($criteria);
         if (count($mUsers)) {
             foreach ($mUsers as $mUser) {
                 SendEmail::LandlordTenant($mUser);
                 //                    $mUser->send_mail=1;
                 //                    $mUser->update(array('send_mail'));
             }
         }
     }
     /* for old user */
     $criteria = new CDbCriteria();
     $criteria->compare('t.send_mail', 0);
     $criteria->compare('t.is_new_user', 0);
     // old user
     $criteria->compare('t.transactions_id', $transactions_id);
     $criteria->addInCondition('t.type', $aTypeUser);
     $models = self::model()->findAll($criteria);
     $aUid = CHtml::listData($models, 'user_id', 'user_id');
     if (count($aUid)) {
         $criteria = new CDbCriteria();
         $criteria->addInCondition('t.id', $aUid);
         $criteria->addCondition('t.email_not_login <> "" ');
         $mUsers = Users::model()->findAll($criteria);
         if (count($mUsers)) {
             foreach ($mUsers as $mUser) {
                 SendEmail::LandlordTenantOld($mUser, $mTransactions);
             }
         }
     }
     self::updateSendMail($transactions_id);
 }
 function sendEmailToNurse()
 {
     $message = 'Hello!<br/><br/>' . $this->patientName . ' requested an appointment with you on ' . $this->date . ' at ' . $this->time . '. The doctor will be ' . $this->doctorName . '.<br/><br/>Thank you,<br/>Wal Consulting';
     $email = new SendEmail();
     return $email->SendEmail($this->nurseEmail, "Appointment Confirmation", $message, false);
 }
 function sendEmailToUser($userEmail, $name)
 {
     $message = 'Hello, ' . $name . '!<br/><br/>' . 'You recently deleted an appointment.<br/><br/>Thank you,<br/>Wal Consulting';
     $email = new SendEmail();
     return $email->SendEmail($userEmail, "Appointment Deleted", $message, false);
 }
Example #22
0
            print "<script language='javascript'>alert('验证码错误');history.go(-1);</script>";
            exit;
        }
        $value = DB::fetch_first("Select * From " . DB::table("users") . " WHERE email='" . $email . "' and uname='" . $username . "'");
        if (!empty($value)) {
            //发送邮件到邮箱
            $string = $value['uname'] . "\t" . $value['activekey'] . "\t" . $value['email'];
            $codestring = cookie_authcode($string, 'ENCODE', "", 3600 * 24);
            //exit;
            $subject = "{$cfg_site_name} 会员 {$value['uname']}重设密码";
            //发送邮件操作
            $site = SITE_URL;
            $codestring = str_replace("+", "%2B", $codestring);
            $emailstr = "hi {$value['uname']},<BR><BR>您在{$cfg_site_name}申请了重设密码,请点击下面的链接,然后根据页面提示完成密码重设:<BR><BR><BR><A href='{$site}/user.php?action=newpass&code={$codestring}' target=_blank>{$site}/user.php?action=newpass&code={$codestring}</A><BR><BR>-- <BR>{$cfg_site_name}";
            include_once INC_PATH . "/sendmail.class.php";
            $sendmail = new SendEmail();
            $sendmail->sendmailto($subject, $emailstr, $value['email']);
            include template('resetp_SendEmail');
            //显示邮件已经发送到邮箱
            exit;
        } else {
            print "<script language='javascript'>alert('用户名和邮箱不区配');history.go(-1);</script>";
            exit;
        }
    } else {
        include template('ForgotPassword');
        //包含输出指定模板
    }
} elseif ($action == 'newpass') {
    //重置密码
    InitGP(array("code", "password", "password2", "commit"));
Example #23
0
                     $criteria->compare('t.role_id', ROLE_REGISTER_MEMBER);
                     $criteria->compare('t.application_id', FE);
                     $mUser = Users::model()->find($criteria);
                     if (!$mUser) {
                         $model->addError('email', 'Email does not exist.');
                     } elseif ($mUser->status == STATUS_ACTIVE) {
                         $password = substr(uniqid(rand(), 1), 1, 10);
                         $pass_en = md5($password);
                         $mUser->password_hash = $pass_en;
                         $mUser->temp_password = $password;
                         $mUser->update(array('password_hash', 'temp_password'));
                         SendEmail::forgotPassword($mUser, $password, ROLE_REGISTER_MEMBER);
                         Yii::app()->user->setFlash('success', "An email with your new password has been sent to " . $mUser->email . "\r\r                                                <br/>Please check your inbox.\r\r                                                <br/>If you do not receive the email, please add \"@properyinfo.sg\" to your mailbox safe list and check your Junk/Spam mailbox.");
                         if (isset($_POST['back'])) {
                             $this->redirect(Yii::app()->createAbsoluteUrl('site/login'));
                         }
                     } else {
                         $model->addError('email', 'Email does not exist.');
                     }
                 }
             }
             $this->render('forgot_password/forgot_password', array('model' => $model));
         }
     } catch (Exception $exc) {
         throw new CHttpException(404, 'Invalid request. Please do not repeat this request again.');
     }
 }
 public function actionError()
 {
     if ($error = Yii::app()->errorHandler->error) {
         if (Yii::app()->request->isAjaxRequest) {
             echo $error['message'];
<?php

include_once '../AutoLoader.php';
AutoLoader::registerDirectory('../src/classes');
require "config.php";
require "MailFiles/PHPMailerAutoload.php";
$query = "SELECT _id\n          FROM reservation \n          WHERE conference_room_id = :room_id \n               AND date = :get_date\n               AND time_slot_id = :timeslot";
$query_params = array(':room_id' => $_GET['room_id'], ':get_date' => $_GET['date'], ':timeslot' => $_GET['time_slot']);
try {
    $stmt = $db->prepare($query);
    $result = $stmt->execute($query_params);
} catch (PDOException $ex) {
    die("Failed to run query: " . $ex->getMessage());
}
$row = $stmt->fetch();
$insertStatement = "INSERT INTO waitlist (`blocking_reservation_id`, `user_id`) \n                    VALUES (:reservation_id, :user_id)";
$insertParams = array(':reservation_id' => $row['_id'], ':user_id' => $_SESSION['user']['_id']);
try {
    $stmt = $db->prepare($insertStatement);
    $result = $stmt->execute($insertParams);
    $mailer = new SendEmail();
    $mailer->SendEmail($_SESSION['user']['email'], "Conference Room Scheduler", "You have been added to a waitlist.<br/>If the room becomes available, you will be notified immediately.", false);
    header("Location: home.php");
    die("Redirecting to home.php");
} catch (PDOException $ex) {
    echo "query: " . $insertStatement . "</br>";
    print_r($insertParams);
    echo "<br/>exception: " . $ex->getMessage();
}
Example #25
0
/** Main function to send email if necessary */
function sendemail($handler, $projectid)
{
    include 'config/config.php';
    include_once 'include/common.php';
    require_once 'include/pdo.php';
    require_once 'models/build.php';
    require_once 'models/project.php';
    require_once 'models/buildgroup.php';
    $Project = new Project();
    $Project->Id = $projectid;
    $Project->Fill();
    $sendEmail = null;
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
        include_once 'local/sendemail.php';
        $sendEmail = new SendEmail();
        $sendEmail->SetProjectId($projectid);
    }
    // If we shouldn't sent any emails we stop
    if ($Project->EmailBrokenSubmission == 0) {
        return;
    }
    // If the handler has a buildid (it should), we use it
    if (isset($handler->BuildId) && $handler->BuildId > 0) {
        $buildid = $handler->BuildId;
    } else {
        // Get the build id
        $name = $handler->getBuildName();
        $stamp = $handler->getBuildStamp();
        $sitename = $handler->getSiteName();
        $buildid = get_build_id($name, $stamp, $projectid, $sitename);
    }
    if ($buildid < 0) {
        return;
    }
    //add_log("Buildid ".$buildid,"sendemail ".$Project->Name,LOG_INFO);
    //  Check if the group as no email
    $Build = new Build();
    $Build->Id = $buildid;
    $groupid = $Build->GetGroup();
    $BuildGroup = new BuildGroup();
    $BuildGroup->SetId($groupid);
    // If we specified no email we stop here
    if ($BuildGroup->GetSummaryEmail() == 2) {
        return;
    }
    $emailCommitters = $BuildGroup->GetEmailCommitters();
    $errors = check_email_errors($buildid, $Project->EmailTestTimingChanged, $Project->TestTimeMaxStatus, !$Project->EmailRedundantFailures);
    // We have some fixes
    if ($errors['hasfixes']) {
        $Build->FillFromId($Build->Id);
        // Get the list of person who should get the email
        $lookup_result = lookup_emails_to_send($errors, $buildid, $projectid, $Build->Type, true, $emailCommitters);
        $userids = $lookup_result['userids'];
        foreach ($userids as $userid) {
            $emailtext = array();
            $emailtext['nfixes'] = 0;
            // Check if an email has been sent already for this user
            foreach ($errors['fixes'] as $fixkey => $nfixes) {
                if ($nfixes == 0) {
                    continue;
                }
                if (!check_email_sent($userid, $buildid, $fixkey)) {
                    $emailtext['category'][$fixkey] = $nfixes;
                    $emailtext['nfixes'] = 1;
                }
            }
            // Send the email
            if ($emailtext['nfixes'] == 1) {
                send_email_fix_to_user($userid, $emailtext, $Build, $Project);
            }
        }
    }
    // No error we return
    if (!$errors['errors']) {
        return;
    }
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
        $sendEmail->BuildId = $Build->Id;
        $sendEmail->Errors = $errors;
    }
    // If we should send a summary email
    if ($BuildGroup->GetSummaryEmail() == 1) {
        // Send the summary email
        sendsummaryemail($projectid, $groupid, $errors, $buildid);
        if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
            $sendEmail->SendSummary();
        }
        return;
    }
    $Build->FillFromId($Build->Id);
    // Send build error
    if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/sendemail.php')) {
        $sendEmail->SendBuildError();
    }
    // Lookup the list of people who should get the email, both registered
    // users *and* committers:
    //
    $lookup_result = lookup_emails_to_send($errors, $buildid, $projectid, $Build->Type, false, $emailCommitters);
    // Loop through the *registered* users:
    //
    $userids = $lookup_result['userids'];
    foreach ($userids as $userid) {
        send_error_email($userid, '', $sendEmail, $errors, $Build, $Project);
    }
    // Loop through "other" users, if necessary:
    //
    // ...people who committed code, but are *not* registered CDash users, but
    // only if the 'emailcommitters' field is on for this build group.
    //
    if ($emailCommitters) {
        $committeremails = $lookup_result['committeremails'];
        foreach ($committeremails as $committeremail) {
            send_error_email(0, $committeremail, $sendEmail, $errors, $Build, $Project, getHandlerErrorKeyPrefix($handler));
        }
    }
}
             if ($model = $this->loadModelVendorPurchaserDetail($id)) {
                 //                    $model->need_delete = 1;
                 //                    $model->update(array('need_delete'));
                 if ($model->delete()) {
                     Yii::log("Delete record " . print_r($model->attributes, true), 'info');
                 }
             }
         } else {
             Yii::log("Invalid request. Please do not repeat this request again.");
             throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
         }
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }
 /**
  * @Author: ANH DUNG Mar 28, 2014
  * @Todo: load model ProTransactionsVendorPurchaserDetail
  * @Param: $id is pk
  * @Return: model
  */
 public function loadModelVendorPurchaserDetail($id, $modelName = 'ProTransactionsVendorPurchaserDetail')
 {
     try {
         $model_ = call_user_func(array($modelName, 'model'));
         $model = $model_->findByPk($id);
         if ($model === null) {
             Yii::log("The requested page does not exist.");
             throw new CHttpException(404, 'The requested page does not exist.');
Example #27
0
 public function actionRequestBankEvaluation()
 {
     try {
         $this->pageTitle = 'Request Bank Evaluation - ' . Yii::app()->params['title'];
         $this->layout = 'application.views.layouts.ajax_width_auto';
         $model = new BankRequest('blank_valuation_request');
         $model->transaction_id = $_GET['transaction_id'];
         $this->OverideModel($model);
         if (isset($_POST['BankRequest'])) {
             $model->attributes = $_POST['BankRequest'];
             $model->choosetype = isset($_POST['choosetype']) ? $_POST['choosetype'] : 0;
             $model->property_type_code = isset($_POST['property_type_code']) ? is_array($_POST['property_type_code']) ? implode(',', $_POST['property_type_code']) : "" : '';
             $model->validate();
             if (!$model->hasErrors()) {
                 $model->tenancy_expiry_datepicker = MyFormat::indexDateToDbDate($model->tenancy_expiry_datepicker);
                 if ($model->save()) {
                     //email to Admin
                     SendEmail::sendMailBankRequestToAdmin($model);
                     die('<script type="text/javascript">parent.$.fancybox.close();</script>');
                     //                        die('<script type="text/javascript">parent.$.fancybox.close(); parent.fnUpdateGridView("#list-tenancy-grid");</script>');
                 }
             }
         }
         $this->render('RequestBankEvaluation', array('model' => $model));
     } catch (Exception $exc) {
         echo $exc->getMessage();
     }
 }
Example #28
0
        $message = str_replace("{10}", $envioDTO->getDescBanco(), $message);
        $message = str_replace("{11}", $envioDTO->getNumVoucher(), $message);
        $message = str_replace("{12}", $envioDTO->getFechaPago(), $message);
        $message = str_replace("{13}", $envioDTO->getMontoPago(), $message);
        $message = str_replace("{14}", $envioDTO->getDetalleCompra(), $message);
        $message = str_replace("{15}", $envioDTO->getDescEmpresaEnvio(), $message);
        $message = str_replace("{16}", $envioDTO->getNombreDestinatario(), $message);
        $message = str_replace("{17}", $envioDTO->getCedulaDestinatario(), $message);
        $message = str_replace("{18}", $envioDTO->getDireccionDestino(), $message);
        $message = str_replace("{19}", $envioDTO->getCiudadDestino(), $message);
        $message = str_replace("{20}", $envioDTO->getEstadoDestino(), $message);
        $message = str_replace("{21}", $envioDTO->getTlfCelularDestinatario(), $message);
        $message = str_replace("{22}", $envioDTO->getTlfLocalDestinatario(), $message);
        $message = str_replace("{23}", $envioDTO->getObservacionesEnvio(), $message);
        $message = str_replace("{24}", $envioDTO->getIdEncriptado(), $message);
        SendEmail::sendMail($_POST["email"], SendEmail::$SUBJECT_PAGO_REGISTRADO, $message);
    } else {
        $response = 1;
    }
}
?>
<script type="text/javascript">
	if(<?php 
echo $response;
?>
 == 0){
		var msg = 'Gracias por completar la información, en breve le será enviado un email con todos los datos para su archivo.';
		alert(msg);
		window.location = "index.php";
	} else if(<?php 
echo $response;
        $recurrenceId = $db->lastInsertId();
        $typeId = "SELECT increment_string FROM recurrence r JOIN recurrence_type rt ON r.recurrence_type_id = rt._id WHERE r._id = " . $recurrenceId;
        $stmt = $db->prepare($typeId);
        $result = $stmt->execute();
        $row = $stmt->fetch();
        $incrementString = $row['increment_string'];
        $currentDate = strtotime($_GET['date']);
        $recurrenceEndDate = strtotime($_GET['rec_end']);
        while ($currentDate <= $recurrenceEndDate) {
            $insertParams = array(':user_id' => $_GET['user_id'], ':conference_room_id' => $_GET['room_id'], ':time_slot_id' => $_GET['time_slot'], ':recurrence_id' => $recurrenceId, ':date_val' => date("Y-n-d", $currentDate));
            try {
                $stmt = $db->prepare($insertStatement);
                $result = $stmt->execute($insertParams);
            } catch (PDOException $ex) {
                $error = true;
                echo "query: " . $insertStatement . "</br>";
                print_r($insertParams);
                echo "<br/>exception: " . $ex->getMessage();
            }
            $currentDate = strtotime($incrementString, $currentDate);
        }
        if (!$error) {
            $mailer = new SendEmail();
            $mailer->SendEmail($_SESSION['user']['email'], "Conference Room Scheduler", "A new reservation has been scheduled for you!<br/>To view your reservations, please use the following link:<br/><br/>http://dbsystems-engproject.rhcloud.com/src/view_meetings.php?type=me", false);
            header("Location: home.php");
            die("Redirecting to home.php");
        }
    }
} else {
    echo "You have hit the max number of reservations! Unable to schedule another.";
}
Example #30
0
         return;
     }
     $ImageHelper = new ImageHelper();
     $ImageHelper->folder = '/' . self::$folderUpload . '/' . $modelCat->id . '/avatar';
     $ImageHelper->deleteFile($ImageHelper->folder . '/' . $modelCat->{$nameField});
     foreach ($aSize as $key => $value) {
         $ImageHelper->deleteFile($ImageHelper->folder . '/' . $key . '/' . $modelCat->{$nameField});
     }
 }
 /*