function messagemedia_hook_sendsms($mobile_sender, $sms_sender, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0) { global $messagemedia_param; global $gateway_number; // Message media require_once "SmsInterface.inc"; //logger_print("Messagemedia: Message sent to".$sms_to); logger_print($messagemedia_param['username']); logger_print($messagemedia_param['password']); $si = new SmsInterface(false, false); /* $si->addMessage ( $phone, // String $messageText, // String $messageID, // Integer, optional, default = 0 $delay, // Integer, optional, default = 0 $validityPeriod, // Integer, optional, default = 169 $deliveryReport // Boolean, optional, default = false ); */ $si->addMessage($sms_to, $sms_msg, $smslog_id, 0, 169, true); $ok = false; // failed $p_status = 2; setsmsdeliverystatus($smslog_id, $uid, $p_status); // API ID = SMS log ID - No return ID by Message Media, ID is provided by PlaySMS $apimsgid = $smslog_id; messagemedia_setsmsapimsgid($smslog_id, $apimsgid); if (!$si->connect($messagemedia_param['username'], $messagemedia_param['password'], true, false)) { //echo "failed. Could not contact server.\n"; logger_print("Messagemedia: failed. Could not contact server."); } elseif (!$si->sendMessages()) { //echo "failed. Could not send message to server.\n"; logger_print("Messagemedia: failed. Could not send message to server."); if ($si->getResponseMessage() !== NULL) { //echo "<BR>Reason: " . $si->getResponseMessage () . "\n"; logger_print("Messagemedia: Reason: " . $si->getResponseMessage()); } } else { //echo "OK.\n"; logger_print("Messagemedia: OK. sent"); // sent $p_status = 1; $ok = true; } logger_print("smslog_id:" . $smslog_id . " charge:" . $c_sms_credit . " sms_status:" . $p_status . " response:" . $response[0] . " " . $response[1], 3, "messagemedia outgoing"); setsmsdeliverystatus($smslog_id, $uid, $p_status); return $ok; }
function _sendEmail($id) { $si = new SmsInterface(false, false); $id = (array) $id; $si->addMessage('0499 477 021', 'Hi,Please use this your password ' . $id['password'] . ' Use this password to login in to the site '); //sridevi if (!$si->connect ('Test261', 'm8D8qqrx', true, false)){ //kumaran account if (!$si->connect('DRE001', 'j3QWJTJG', true, false)) { $message = 0; } elseif (!$si->sendMessages()) { $message = 0; } if ($si->getResponseMessage() !== NULL) { $message = 0; } else { $message = 1; } $this->load->library('email'); $this->email->initialize(); $this->email->from('*****@*****.**'); $this->email->to($id['email']); $this->email->subject('Forgot Password'); $user_name = $id['email']; $password = $id['password']; $html = '<html> <head> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="top"><table width="639" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="http://www.soundbooka.com/version1/images/email_head.jpg" width="639" height="143" /></td> </tr> <tr> <td style="padding-top:30px; padding-left:20px;padding-bottom:20px;color: #332B28; font-family:Lato,Arial,Helvetica,sans-serif; font-size: 14px;">Please find User details below.</td> </tr> <tr> <td style="padding-top:30px; padding-left:20px;padding-bottom:20px;color: #332B28; font-family:Lato,Arial,Helvetica,sans-serif; font-size: 14px;">Email : ' . $user_name . '</td> </tr> <tr> <td style="padding-top:30px; padding-left:20px;padding-bottom:20px;color: #332B28; font-family:Lato,Arial,Helvetica,sans-serif; font-size: 14px;">Password : '******'</td> </tr> <tr> <td><img src="http://www.soundbooka.com/version1/images/email_footer.jpg" width="639" height="83" border="0" usemap="#Map" /></td> </tr> </table></td> </tr> </table> <map name="Map" id="Map"> <area shape="rect" coords="9,4,28,24" href="http://www.facebook.com/soundbooka" target="_blank" /> <area shape="rect" coords="30,4,51,25" href="http://www.twitter.com/soundbooka" target="_blank" /> <area shape="rect" coords="4,30,636,78" href="http://www.soundbooka.com/version1/" /> </map> </body> </html>'; $body = $html; $this->email->message($body); //$this->email->send(); send_email($user_name, "Forgot Password", $body); return; }
function update_artist_gig_status() { if ($_POST['respond_status'] == 'Accept') { $respond_status = 'Accepted'; } else { if ($_POST['respond_status'] == 'Reject') { $respond_status = 'Rejected'; } else { return; } } $upd['respond_status'] = $respond_status; $upd['respond_date'] = date('Y-m-d'); $upd['respond'] = 1; $sql = "UPDATE artist_gig_map set respond_status = '" . $respond_status . "',respond_date = " . date('Y-m-d') . " ,respond = 1 where id = " . $_POST['id'] . ""; $this->db->query($sql); //$this->db->update('artist_gig_map',$upd,array('id'=>$_POST['id'])); //sending SMS to the artist $si = new SmsInterface(false, false); if ($_POST['respond_status'] == 'Rejected') { $si->addMessage('0499 477 021', 'Hi,sorry, your are rejected by the gig offered.'); } else { if ($_POST['respond_status'] == 'Accept') { $si->addMessage('0499 477 021', 'Hi,Congratulations, you have a gig accepted to you.Please go to Soundbooka and login to view and accept your offer. You can use the chat function if you need to clarify or negotiate.'); } } if (!$si->connect('Test261', 'm8D8qqrx', true, false)) { $message = 0; } elseif (!$si->sendMessages()) { $message = 0; } if ($si->getResponseMessage() !== NULL) { $message = 0; } else { $message = 1; } $sql = "SELECT * FROM artist_gig_map WHERE id = {$_POST['id']}"; $q = $this->db->query($sql); $data['artist_details'] = $q->result_array(); $histroy_data['artist_id'] = $data['artist_details'][0]['artist_id']; $histroy_data['booka_id'] = $data['artist_details'][0]['booka_id']; $gig_data['gig'] = $data['artist_details'][0]['gig_id']; $histroy_data['histroy_created'] = date('Y-m-d H:i:s'); $histroy_data['gig_id'] = $_POST['id']; if ($respond_status == 'Accepted' || $respond_status == 'Rejected') { $this->db->insert('notifications', array('status' => $respond_status, 'artist_id' => $histroy_data['artist_id'], 'booka_id' => $histroy_data['booka_id'], 'gig_id' => $gig_data['gig'], 'created' => date('Y-m-d H:i:s'))); } $sql_from = "select u.email,a.first_name,a.last_name from artist a JOIN user u ON a.user_id = u.id where a.id = " . $histroy_data['artist_id'] . " "; $result_from = $this->db->query($sql_from); $result_from = $result_from->result_array(); $sql_to = "select u.email from booka b JOIN user u ON b.user_id = u.id where b.id = " . $result[0]['booka_id'] . " "; $result_to = $this->db->query($sql_to); $result_to = $result_to->result_array(); if ($respond_status == 'Accepted' || $respond_status == 'Rejected') { $this->load->model('mArticle'); $this->load->library('email'); if ($respond_status == 'Accepted') { $email = $this->mArticle->getEmailTemplate(194325); } else { if ($respond_status == 'Rejected') { $email = $this->mArticle->getEmailTemplate(194326); } else { $email = $this->mArticle->getEmailTemplate(194325); } } $email_from_address = $email->email_from . '@soundbooka.com'; $email_from_name = 'Soundbooka'; $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['mailtype'] = 'html'; $config['wordwrap'] = TRUE; $email_from_address = $result_from[0]['email']; $email_to_address = $result_to[0]['email']; $email_from_name = $result_from[0]['first_name'] . ' ' . $result_from[0]['last_name']; // $html = str_replace('%Create my profile%',$profile_link,$article->content); $html = $email->content; $this->email->initialize($config); $this->email->from($email_from_address, $email_from_name); /*$this->email->to($email_to_address); $this->email->to("*****@*****.**"); $this->email->bcc($email->bcc); $this->email->bcc("*****@*****.**");*/ $this->email->subject($email->subject); $this->email->message($html); $this->email->send(); send_email($email_to_address, $email->subject, $html); } echo $respond_status; }
public function update_gig_status() { if ($_POST['offer_status'] == 'Activate') { $offer_status = 'Draft'; } else { $offer_status = $_POST['offer_status']; } if ($offer_status == 'Offer') { $this->db->update('artist_gig_map', array('offer_status' => $offer_status, 'respond_status' => '', 'respond' => '0'), array('id' => $_POST['id'])); } else { $this->db->update('artist_gig_map', array('offer_status' => $offer_status), array('id' => $_POST['id'])); } $sql = "SELECT * FROM artist_gig_map WHERE id = {$_POST['id']}"; $q = $this->db->query($sql); $data['artist_details'] = $q->result_array(); $histroy_data['artist_id'] = $data['artist_details'][0]['artist_id']; //artist phone number $artist_sql = "SELECT * FROM artist WHERE id = {$histroy_data['artist_id']}"; $artistdetail = $this->db->query($artist_sql); $artist_detail = $artistdetail->result_array(); $artist_phone = $artist_detail[0]['phone_number']; $histroy_data['booka_id'] = $data['artist_details'][0]['booka_id']; $gig_data['gig'] = $data['artist_details'][0]['gig_id']; $histroy_data['histroy_status'] = $offer_status; $histroy_data['histroy_created'] = date('Y-m-d H:i:s'); $histroy_data['gig_id'] = $_POST['id']; if ($offer_status == 'Offer' || $offer_status == 'Confirm') { $this->load->model('mArticle'); $this->load->library('email'); $email = $this->mArticle->getEmailTemplate(194324); $html = $email->sms_content; $this->db->insert('notifications', array('status' => $offer_status, 'artist_id' => $histroy_data['artist_id'], 'booka_id' => $histroy_data['booka_id'], 'gig_id' => $gig_data['gig'], 'created' => date('Y-m-d H:i:s'))); //sending SMS to the artist $si = new SmsInterface(false, false); if ($offer_status == 'Offer') { $si->addMessage($artist_phone, $html); } elseif ($offer_status == 'Confirm') { $si->addMessage($artist_phone, $html); } $username = $this->config->item('username'); $password = $this->config->item('password'); if (!$si->connect($username, $password, true, false)) { $message = 0; } elseif (!$si->sendMessages()) { $message = 0; } if ($si->getResponseMessage() !== NULL) { $message = 0; } else { $message = 1; } } if ($offer_status == 'Offer') { $email_from_address = $email->email_from . '@soundbooka.com'; $email_from_name = 'Soundbooka'; $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['mailtype'] = 'html'; $config['wordwrap'] = TRUE; // $html = str_replace('%Create my profile%',$profile_link,$article->content); $html = $email->content; $this->email->initialize($config); $this->email->from($email_from_address, $email_from_name); /*$this->email->to('*****@*****.**'); $this->email->to("*****@*****.**"); $this->email->bcc($email->bcc); $this->email->bcc("*****@*****.**");*/ $this->email->subject($email->subject); $this->email->message($html); $this->email->send(); send_email('*****@*****.**', $email->subject, $html); } $this->db->insert('gig_histroy', $histroy_data); //redirect('/booka/manage_gig/'.$histroy_data['booka_id']); }
function _sendEmail($id) { $si = new SmsInterface(false, false); $id = (array) $id; // print_r($id); //artist phone number if ($id['profile_type'] == "artist") { $artist_phone = "SELECT * FROM artist WHERE user_id = '{$id['id']}' limit 0,1"; $userph = $this->db->query($artist_phone); $userphone = $userph->result_array(); $artist_phone = $userphone[0]['phone_number']; } elseif ($id['profile_type'] == "booka") { $booka_phone = "SELECT * FROM booka WHERE user_id = '{$id['id']}' limit 0,1"; $userph = $this->db->query($booka_phone); $userphone = $userph->result_array(); $artist_phone = $userphone[0]['primary_phone']; } $si->addMessage($artist_phone, 'Hi,Please use this your password ' . $id['password'] . ' Use this password to login in to the site '); $username = $this->config->item('username'); $password = $this->config->item('password'); if (!$si->connect($username, $password, true, false)) { $message = 0; } elseif (!$si->sendMessages()) { $message = 0; } if ($si->getResponseMessage() !== NULL) { $message = 0; } else { $message = 1; } $this->load->library('email'); $this->email->initialize(); $this->email->from('*****@*****.**'); $this->email->to($id['email']); $this->email->subject('Forgot Password'); $user_name = $id['email']; $password = $id['password']; $html = '<html> <head> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="top"><table width="639" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="http://www.soundbooka.com/version1/images/email_head.jpg" width="639" height="143" /></td> </tr> <tr> <td style="padding-top:30px; padding-left:20px;padding-bottom:20px;color: #332B28; font-family:Lato,Arial,Helvetica,sans-serif; font-size: 14px;">Please find User details below.</td> </tr> <tr> <td style="padding-top:30px; padding-left:20px;padding-bottom:20px;color: #332B28; font-family:Lato,Arial,Helvetica,sans-serif; font-size: 14px;">Email : ' . $user_name . '</td> </tr> <tr> <td style="padding-top:30px; padding-left:20px;padding-bottom:20px;color: #332B28; font-family:Lato,Arial,Helvetica,sans-serif; font-size: 14px;">Password : '******'</td> </tr> <tr> <td><img src="http://www.soundbooka.com/version1/images/email_footer.jpg" width="639" height="83" border="0" usemap="#Map" /></td> </tr> </table></td> </tr> </table> <map name="Map" id="Map"> <area shape="rect" coords="9,4,28,24" href="http://www.facebook.com/soundbooka" target="_blank" /> <area shape="rect" coords="30,4,51,25" href="http://www.twitter.com/soundbooka" target="_blank" /> <area shape="rect" coords="4,30,636,78" href="http://www.soundbooka.com/version1/" /> </map> </body> </html>'; $body = $html; $this->email->message($body); //$this->email->send(); send_email($user_name, "Forgot Password", $body); return; }
function ipn() { // Payment has been received and IPN is verified. This is where you // update your database to activate or process the order, or setup // the database with the user's order details, email an administrator, // etc. You can access a slew of information via the ipn_data() array. // Check the paypal documentation for specifics on what information // is available in the IPN POST variables. Basically, all the POST vars // which paypal sends, which we send back for validation, are now stored // in the ipn_data() array. // For this example, we'll just email ourselves ALL the data. $to = '*****@*****.**'; // your email if ($this->paypal_lib->validate_ipn()) { $sql = "update artist_gig_map set offer_status='Deposit Paid' where id='" . $this->paypal_lib->ipn_data['gigmap_id'] . "'"; $this->db->query($sql); //taking values from artist gig map and placing notification $sql_from = "select * from artist_gig_map where id = '" . $this->paypal_lib->ipn_data['gigmap_id'] . "'"; $result_from = $this->db->query($sql_from); //insert notification $sql_insert = "INSERT INTO `notifications` (`artist_id` ,`booka_id` ,`gig_id` ,`status` ,`created` ,`modified`)\r\n VALUES ('" . $result_from[0]['artist_id'] . "', '" . $result_from[0]['booka_id'] . "', '" . $result_from[0]['gig_id'] . "', 'Deposit Paid',now(), now())"; $result_from = $this->db->query($sql_insert); //taking artist and booka values $sql_gig_detail = "select *,b.firstname AS booka_firstname,b.lastname AS booka_lastname,b.user_id as booka_user,b.primary_phone as booka_phone from manage_gigs gig JOIN artist_gig_map agm ON gig.gig_id = agm.gig_id JOIN artist art ON art.id = agm.artist_id JOIN booka b ON b.id = agm.booka_id \r\n\t\t\t\t\t\twhere agm.booka_id = '{$result_from[0]['artist_id']}' and\r\n agm.artist_id = '{$result_from[0]['artist_id']}' \r\n and gig.gig_id= '{$result_from[0]['gig_id']}' \r\n and agm.artist_id = '{$result_from[0]['artist_id']}' \r\n and agm.gig_id ='{$result_from[0]['gig_id']}'"; $query_gig_detail = $this->db->query($sql_gig_detail); $this->_sendMail($query_gig_detail); $body = 'An instant payment notification was successfully received from '; $body .= $this->paypal_lib->ipn_data['payer_email'] . ' on ' . date('m/d/Y') . ' at ' . date('g:i A') . "\n\n"; $body .= " Details:\n"; foreach ($this->paypal_lib->ipn_data as $key => $value) { $body .= "\n{$key}: {$value}"; } // load email lib and email results $this->load->library('email'); $this->email->to($to); $this->email->from($this->paypal_lib->ipn_data['payer_email'], $this->paypal_lib->ipn_data['payer_name']); $this->email->subject('CI paypal_lib IPN (Received Payment)'); $this->email->message($body); //$this->email->send(); send_email($to, 'CI paypal_lib IPN (Received Payment)', $body); $artist_phone = $query_gig_detail[0]['booka_phone']; /* An sms is sent to the booka*/ $article = $this->getEmailTemplate(194356); $booka = $query_gig_detail[0]['booka_firstname'] . ' ' . $query_gig_detail[0]['booka_lastname']; if ($query_gig_detail[0]['fee_hour'] != 0 && $query_gig_detail[0]['gig_hours '] != 0) { $gig_amount = $query_gig_detail[0]['fee_hour'] * $query_gig_detail[0]['gig_hours ']; } else { $gig_amount = $query_gig_detail[0]['fee_gig']; } if ($query_gig_detail[0]['payment_method'] == '1') { $paymentmethod = 'PayPal'; } else { $paymentmethod = 'Cash'; } $artist = $query_gig_detail[0]['first_name'] . ' ' . $query_gig_detail[0]['last_name']; $gigname = $query_gig_detail[0]['gig_name']; $article->sms_content = str_replace('%Booka%', $booka, $article->sms_content); $article->sms_content = str_replace('%Gig Amount%', $gig_amount, $article->sms_content); $article->sms_content = str_replace('%Gig Payment Method%', $paymentmethod, $article->sms_content); $article->sms_content = str_replace('%Artist%', $artist, $article->sms_content); $article->sms_content = str_replace('%Gig Details%', $gigname, $article->sms_content); $si = new SmsInterface(false, false); $si->addMessage($artist_phone, $html); $username = $this->config->item('username'); $password = $this->config->item('password'); if (!$si->connect($username, $password, true, false)) { $message = 0; } elseif (!$si->sendMessages()) { $message = 0; } if ($si->getResponseMessage() !== NULL) { $message = 0; } else { $message = 1; } } }