public function executeSendChatMessage(sfWebRequest $request)
 {
     $posting_id = $request->getParameter('posting_id');
     $sender_id = $_SESSION['userId'];
     $member_ids = $request->getParameter('member_ids');
     $message = $request->getParameter('message');
     $member_ids = json_decode($member_ids);
     $member_ids = (array) $member_ids;
     $member_ids[] = $sender_id;
     $rs = CustomHangout::checkUserLogin($member_ids);
     $online_users = array();
     foreach ($rs as $v) {
         $online_users[] = $v['member_id'];
     }
     $results = array();
     foreach ($member_ids as $member_id) {
         $params = array();
         $params['member_id'] = $member_id;
         $params['sender_id'] = $sender_id;
         $params['message'] = $message;
         $params['is_read'] = in_array($member_id, $online_users) ? 'TRUE' : 'FALSE';
         $params['posting_id'] = $posting_id;
         $params['is_friend'] = 'FALSE';
         $results[$member_id] = Messages::sendChatMessage($params);
     }
     die(print_r($results));
 }
 public function executeForgotPassword(sfWebRequest $request)
 {
     $email_address = $_POST['email_'];
     $email_address = trim($email_address);
     if (!$this->checkEmailAddress($email_address)) {
         die('Please enter a valid email address!');
     }
     $member = Member::checkMemberInfo('email', $email_address);
     if ($member->count() > 0) {
         Member::resetPassword($email_address);
         $Body = " <div style='font-family:tahoma;font-size:12px;'>\n                <p>\n                     You have requested to reset your password. Below is your new password, you can login to your account and change the password.<br/>\n                     If you are not the account holder, please ignore this message.\n                     <br/>\n                     <br/>\n                     New Password : 123456                                          \n                </p>\n                </div>\n                  ";
         CustomHangout::email($email_address, $Body, 'HangOutToday', 'Request: Reset Password');
         die('An email notification has been sent to your email address.');
     } else {
         die('Email address entered does not exist!');
     }
 }
 public function executeSaveChanges(sfWebRequest $request)
 {
     try {
         $q = Postings::getPostingInfo($_REQUEST['posting_id']);
         $q->gender_type = $_REQUEST['gender_type'];
         $q->date_to_hangout = date("Y-m-d", strtotime($_REQUEST['startdt_hangout']));
         $q->num_ppl = $_REQUEST['num_ppl'];
         $q->posting_enddt = $this->calculatePostingEndDate($_REQUEST['posting_enddt'], $_REQUEST['starttime'], $_REQUEST['startdt_hangout']);
         $q->age_range_1 = $_REQUEST['age_range_1'];
         $q->age_range_2 = $_REQUEST['age_range_2'];
         $q->starttime = $_REQUEST['starttime'];
         $q->endtime = $_REQUEST['endtime'];
         $q->posting_title = $_REQUEST['posting_title'];
         $q->posting_desc = $_REQUEST['posting_desc'];
         $q->enddate_hangout = date("Y-m-d", strtotime($_REQUEST['enddt_hangout']));
         $q->save();
         $hotlistMembers = HotList::getHotListMembers($_REQUEST['posting_id'], $_SESSION['userId']);
         $Member = new Member();
         $Member->setId($_SESSION['userId']);
         $nick_name = $Member->getMemberInfo('nick_name');
         foreach ($hotlistMembers as $v) {
             $body = '
                 <div style="font-family:tahoma;font-size:12px;">
                     Hi <b>' . $v->getMember()->getNickName() . '</b>,
                     <br/><br/>
                     <p>
                         <b> ' . $nick_name . ' </b> has made some changes on a post with title "<b>' . $v->getPostings()->getPostingTitle() . '</b>".
                     </p>
                     <br/>
                     Thank you
                     <br/>                    
                 </div>';
             CustomHangout::email($v->getMember()->getEmail(), $body, 'HangOutToday', 'HangOutToday Notification');
         }
         die(true);
     } catch (Exception $e) {
         die(false);
     }
 }
    public function executeUpdateRequestStatus(sfWebRequest $request)
    {
        $userId = $_SESSION['userId'];
        $stat = $_POST['stat'];
        $friendship_id = $_POST['friendship_id'];
        Friendship::updateRequestStatus($stat, $friendship_id);
        $q1 = Doctrine::getTable('Friendship')->findOneBy("id", $friendship_id);
        $q2 = Doctrine::getTable('Member')->findOneBy("id", $q1->member_id);
        $q3 = Doctrine::getTable('Member')->findOneBy("id", $userId);
        if ($stat == 2) {
            $body = '<div style="font-family:tahoma;font-size:12px;">
                    Hi <b>' . $q2->nick_name . '</b>,
                    <br/>
                    <p>
                        <b> ' . $q3->nick_name . ' </b> has added you as their friend!
                    </p>

                    <blockqoute>
                        <div>
                        You can log onto your account and send messages to each other at any time.
                        </div>
                    </blockqoute>
                    <br/>                    
                </div>';
        } else {
            $body = '<div style="font-family:tahoma;font-size:12px;">
                    Hi <b>' . $q2->nick_name . '</b>,
                    <br/>
                    <p>
                        <b> ' . $q3->nick_name . ' </b> has decided not to add you as their friend at this time.
                    </p>

                    <blockqoute>
                        <div>
                        Don’t let that discourage you.  Log onto your account and respond to or create your own postings and meet a new friend today.
                        </div>
                    </blockqoute>
                    <br/>                    
                </div>';
        }
        $recipient = $q2->email;
        CustomHangout::email($recipient, $body, 'HangOutToday', 'HangOutToday Notification');
        die;
    }
示例#5
0
<?php

require_once 'C:/wamp/www/hangout2/config/ProjectConfiguration.class.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', false);
sfContext::createInstance($configuration)->dispatch();
CustomHangout::alert001();