function work($file_name, $connect) { $topic = "myschool"; $reg_ids = ""; $title = $_POST['title']; $time = date("Y-m-d , H:i:s"); $query = "INSERT INTO `images`(`title`, `image`, `time`) VALUES ('{$title}', '{$file_name}', '{$time}')"; $result = mysqli_query($connect, $query); if ($result) { $pid = mysqli_insert_id($connect); $selectQuery = "SELECT * FROM `images` WHERE `sno` = '{$pid}'"; $selectResult = mysqli_query($connect, $selectQuery); if ($selectResult) { if ($row = mysqli_fetch_array($selectResult)) { $message[] = array("result" => "success", "title" => $title, "image" => $file_name, "date" => $row['time']); $messages = array('image' => $message); // TODO uncomment send_push_notification() to send message to devices //var_dump($messages); echo "<br><br>" . json_encode($messages) . "<br><br><br> Add more images if you want.<br>"; send_push_notification($reg_ids, json_encode($messages), $topic); } } } else { echo "<br>Error"; } }
function work($file_name, $connect) { $name = $_POST['name']; $fb_url = ""; $tweet_url = ""; if (isset($_POST['url_fb'])) { $fb_url = $_POST['url_fb']; } if (isset($_POST['url_tweet'])) { $tweet_url = $_POST['url_tweet']; } $time = date("Y-m-d , H:i:s"); $query = "INSERT INTO `contributors`(`name`, `fb_url`, `tweet_url`, `image`) VALUES ('{$name}', '{$fb_url}', '{$tweet_url}', '{$file_name}')"; echo $query; $result = mysqli_query($connect, $query); if ($result) { $pid = mysqli_insert_id($connect); $selectQuery = "SELECT * FROM `contributors` WHERE `pid` = '{$pid}'"; $selectResult = mysqli_query($connect, $selectQuery); var_dump($selectResult); if ($selectResult) { if ($row = mysqli_fetch_array($selectResult)) { $message[] = array("name" => $name, "url_fb" => $fb_url, "url_tweet" => $tweet_url, "image" => $file_name); $messages = array('people' => $message); // TODO uncomment send_push_notification() to send message to devices var_dump($messages); echo "<br>" . json_encode($messages); send_push_notification(json_encode($messages)); } } } else { echo "<br>Error"; } }
function recipient_box_save($post_id) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (!wp_verify_nonce($_POST['recipient_box_content_nonce'], plugin_basename(__FILE__))) { return; } if ('page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) { return; } } else { if (!current_user_can('edit_post', $post_id)) { return; } } $recipient = $_POST['recipient']; update_post_meta($post_id, 'recipient', $recipient); $notified = get_post_meta($post_id, 'notified'); if (empty($notified)) { update_post_meta($post_id, 'notified', "1"); $pushMessage = get_the_title($post_id); $reg_ids = users_gcm_ids($recipient); $message = array("chat" => $pushMessage, "user" => "admin"); send_push_notification($reg_ids, $message); } }
function work($file_name, $connect) { $topic = "myschool"; $reg_ids = ""; $title = $_POST['title']; $name = $_POST['name']; $description = $_POST['message']; $url = ""; if (isset($_POST['url'])) { $url = $_POST['url']; } $time = date("Y-m-d , H:i:s"); $query = "INSERT INTO `posts`(`title`, `description`, `name`, `image`, `url`, `time`) VALUES ('{$title}', '{$description}', '{$name}', '{$file_name}', '{$url}', '{$time}')"; $result = mysqli_query($connect, $query); if ($result) { $pid = mysqli_insert_id($connect); $selectQuery = "SELECT * FROM `posts` WHERE `pid` = '{$pid}'"; $selectResult = mysqli_query($connect, $selectQuery); if ($selectResult) { if ($row = mysqli_fetch_array($selectResult)) { $message[] = array("message" => $description, "name" => $name, "title" => $title, "image" => $file_name, "date" => $row['time'], "url" => $url); $messages = array('post' => $message); // TODO uncomment send_push_notification() to send message to devices //var_dump($messages); //echo "<br>".json_encode($messages); echo send_push_notification($reg_ids, json_encode($messages), $topic); } } } else { echo json_encode(array('result' => "failure", 'response' => "Something went wrong.")); } }
function send_message($user_id, $message, $recipient) { $post_id = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => $user_id, 'post_title' => $message, 'post_status' => 'draft', 'post_type' => 'message')); update_post_meta($post_id, 'recipient', $recipient); update_post_meta($post_id, 'author', $user_id); //send gcm notification $user = get_user_by('id', $user_id); $gcm = array("chat" => $message, "user" => $user->user_login); $reg_id = users_gcm_ids($recipient); send_push_notification($reg_id, $gcm); }
function SendNotificationToNextAttacker($clanID) { $db = new BaseDB(); $sql = "\n SELECT p.GameName, gcmu.gcm_regid\n FROM dbo.OurParticipant AS op INNER JOIN\n dbo.Player AS p ON op.PlayerID = p.PlayerID INNER JOIN\n dbo.gcm_users AS gcmu ON p.GameName = gcmu.game_name\n WHERE op.NextAttacker = 1 AND ClanID = {$clanID}\n "; $result = $db->dbQuery($sql); while ($record = sqlsrv_fetch_array($result, SQLSRV_FETCH_BOTH)) { $registatoin_ids[0] = $record['gcm_regid']; $msg = array("data" => "cal" . $record['GameName'] . " it is your turn to attack!"); send_push_notification($registatoin_ids, $msg); } $db->Free($result); $db->close(); }
function send_feedback_after_comment($comment_id) { $comment = get_comment($comment_id); $author_uname = $comment->comment_author; $raw_message = $comment->comment_content; //get author of original post $post_id = $comment->comment_post_ID; $post = get_post($post_id); $author_id = $post->post_author; //get comment author gravatar $author = get_user_by('login', $author_uname); $author_email = $author->user_email; $gravatar = get_gravatar_url($author_email); $message = array("feedback" => $raw_message, "author" => $author_uname, "icon_url" => $gravatar); send_push_notification(users_gcm_ids($author_id), $message); }
<?php require_once 'loader.php'; $gcmRegID = $_POST["regId"]; // GCM Registration ID got from device $pushMessage = $_POST["message"]; if (isset($gcmRegID) && isset($pushMessage)) { $registatoin_ids = array($gcmRegID); $result = send_push_notification($gcmRegID, $pushMessage); echo $result; }
function send_notification($data) { /* $notify['senderId'] = ; $notify['receiverId'] = ; $notify['nType'] = ; $notify['nTitle'] = ; $notify['nMessage'] = ; */ $type = $data['nType']; switch ($type) { case 'BUYING-CLUB-ADD': $data['nMessage'] = "Hi, <br /> You Have added in my newly created Buying Club <strong>[" . $data['nTitle'] . "]</strong> by " . $data['adminName'] . ".<br />Group Leader email id is " . $data['adminEmail'] . ".<br />Group Leader contact number is " . $data['adminContactNo'] . "."; $data['isEmail'] = true; if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') { $data['isMobMessage'] = true; } else { $data['isMobMessage'] = true; } $data['createDate'] = date('Y-m-d H:i:s'); break; case 'BUYING-CLUB-MODIFY': $data['nMessage'] = "Hi, <br> Buying Club <strong>[" . $data['nTitle'] . "]</strong> has been modified."; $data['isEmail'] = true; if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') { $data['isMobMessage'] = true; } else { $data['isMobMessage'] = true; } $data['createDate'] = date('Y-m-d H:i:s'); break; case 'BUYING-CLUB-MODIFY-NEW': $data['nMessage'] = "Hi, <br> You Have added in my Buying Club <strong>[" . $data['nTitle'] . "]</strong>.<br />My name is " . $data['adminName'] . ".<br />My email id is " . $data['adminEmail'] . ".<br />My contact number is " . $data['adminContactNo'] . "."; $data['isEmail'] = true; if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') { $data['isMobMessage'] = true; } else { $data['isMobMessage'] = true; } $data['createDate'] = date('Y-m-d H:i:s'); break; case 'BUYING-CLUB-MODIFY-DELETE': $data['nMessage'] = "Hi, <br> You are not part of this Buying Club <strong>[" . $data['nTitle'] . "]</strong>"; $data['isEmail'] = true; if ($this->siteconfig->get_value_by_name('SMS_SEND_ALLOW') == 'yes') { $data['isMobMessage'] = true; } else { $data['isMobMessage'] = true; } $data['createDate'] = date('Y-m-d H:i:s'); break; case '': } $data['isRead'] = 0; $data['status'] = 1; if ($data['isMobMessage']) { $smsData['nMessage'] = str_replace('<br />', '', $data['nMessage']); $smsData['nMessage'] = str_replace('<br>', '', $smsData['nMessage']); $smsData['nMessage'] = str_replace('<br/>', '', $smsData['nMessage']); $smsData['nMessage'] = str_replace('<strong>', '', $smsData['nMessage']); $smsData['nMessage'] = str_replace('</strong>', '', $smsData['nMessage']); $smsData['receiverMobileNumber'] = $data['receiverMobileNumber']; if (array_key_exists('senderId', $smsData)) { $smsData['senderId'] = $data['senderId']; } else { $smsData['senderId'] = 0; } if (array_key_exists('receiverId', $smsData)) { $smsData['receiverId'] = $data['receiverId']; } else { $smsData['receiverId'] = 0; } if (array_key_exists('senderMobileNumber', $smsData)) { $smsData['senderMobileNumber'] = $data['senderMobileNumber']; } else { $smsData['senderMobileNumber'] = 0; } $smsData['nType'] = $data['nType']; send_sms_notification($smsData); if (array_key_exists('receiverId', $smsData)) { send_push_notification($smsData); } } if ($data['isEmail']) { //Send Email message unset($data['isEmail']); } unset($data['adminName']); unset($data['isMobMessage']); unset($data['adminEmail']); unset($data['adminContactNo']); unset($data['receiverMobileNumber']); unset($data['senderMobileNumber']); if (array_key_exists('orderId', $data)) { unset($data['orderId']); } $this->user->notification_add($data); }
public function sendpushnotificationsAction() { $this->view->messages = $this->_flashMessenger->getMessages(); $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $title = $this->_request->getParam('title'); $reg = 'APA91bEZVTcqtar_br_cipLae9TyYe26JhsE2jHHnV76K_zWSAAyly2ZW6SCd4-REMgY_lGtHLh-2VvObjlj-pRvHd2932KlKY7anEOKQMyviVLs1A1Y7RYDPNtXwuRqTY7rILdF_LcXvY4GntxKouBU1EUv8E1mCQ'; $title = str_replace("_", " ", $title); $regID = array($reg); // $message="You have registerted successfully"; $message = array("userID" => $this->sessUserInfo->id, "msg" => $title . " is ready to download", "email" => $this->sessUserInfo->user_email); send_push_notification($regID, $message); $this->_flashMessenger->addMessage('<div class="div-success">Notification sent successfully</div>'); $this->_redirect('user/index/issuesavailable/'); }
// $regID = $_REQUEST['data4']; $UserName = getIMEIUserName($sendToIMEI); // $ReceiverName=getIMEIUserName($imei); $message = $UserName . "^" . $sendToIMEI . "^" . $message; $imeiArray = explode('::', $imei); if (strcmp($imeiArray[0], "All") == 0) { $resultUsers = getAllUsersData($imeiArray[1]); } else { $resultUsers = getIMEIUser($imeiArray[0]); } if ($resultUsers != false) { $NumOfUsers = mysql_num_rows($resultUsers); } else { $NumOfUsers = 0; } if ($NumOfUsers > 0) { while ($rowUsers = mysql_fetch_array($resultUsers)) { $gcmRegID = $rowUsers["gcm_regid"]; // GCM Registration ID got from device $pushMessage = $message; if (isset($gcmRegID) && isset($pushMessage)) { $registration_ids = array($gcmRegID); $messageSend = array("message" => $pushMessage); $result = send_push_notification($registration_ids, $messageSend); echo $result; //echo "Message sent."; } } } else { print ""; }
public function activeAction() { $arrayids = array(); $this->usersubscriptions = new Model_DbTable_Usersubscription(); $this->userdetails = new Model_DbTable_Companies(); $modelCategory = new Publisher_Model_DbTable_Books(); $this->notifications = new Admin_Model_DbTable_Notifications(); $modelImage = new Admin_Model_DbTable_ProductImages(); $modelPrice = new Admin_Model_DbTable_ProductPrices(); $creditHistoryObj = new User_Model_DbTable_Chistory(); $this->modelBooks = new Publisher_Model_DbTable_Books(); $notificationdata = $this->notifications->fetchAll('ntype="booksubscription" and status=1'); $bookuploaddata = $this->notifications->fetchAll('ntype="bookupload" and status=1'); $pid = $this->_request->getParam('pid', 0); $id = $this->_request->getParam('id', 0); $transactionHistoryObj = new User_Model_DbTable_Transactionhistory(); if ($id > 0 && $this->modelPublications->isExist($id)) { $data['admin_approve'] = 1; $success = $this->modelPublications->update($data, 'id="' . $id . '"'); if ($success) { $this->usersubscriptionsdata = $this->usersubscriptions->fetchAll('subscription_type >0 and publication_id=' . $pid . ' and start_date!="0000-00-00 00:00:00"'); if (count($this->usersubscriptionsdata) > 0) { if (count($bookuploaddata) > 0) { foreach ($this->usersubscriptionsdata as $row_subdata) { /*echo "publication id : - ".$pid; echo 'subscription_type >0 AND number_of_issues > number_of_downloaded and product_id='.$id.' and user_id="'.$row_userids['id'].'"'; die();*/ $product_details = $this->modelBooks->fetchRow("id='" . $id . "'"); $explode_product_addtime = @explode(" ", $product_details['add_time']); $explode_start_date = @explode(" ", $row_subdata['start_date']); $this->totalactivesubscription = $this->usersubscriptions->fetchAll('subscription_type >0 and publication_id=' . $pid . ' and user_id="' . $row_subdata['user_id'] . '" and start_date IS NULL'); $this->totalactivesubscription_with_startdate = $this->usersubscriptions->fetchAll('subscription_type >0 AND number_of_issues > number_of_downloaded and publication_id=' . $pid . ' and user_id="' . $row_subdata['user_id'] . '" and start_date IS NOT NULL'); $totalactive = count($this->totalactivesubscription) + 1; if ($this->totalactivesubscription_with_startdate[0]['number_of_issues'] > $totalactive && strtotime($product_details['add_time']) > strtotime($row_subdata['start_date'])) { $this->userdata = $this->userdetails->fetchAll('id="' . $row_subdata['user_id'] . '" and status="1"'); $chk_subscription = $this->usersubscriptions->fetchAll('user_id="' . $row_subdata['user_id'] . '" and product_id="' . $id . '"'); if (count($chk_subscription) == 0) { $getBrandInfo = $this->modelBooks->getBrandInfo($product_details['title']); if (!empty($getBrandInfo) && is_numeric($product_details['title'])) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $product_details['title']; } if (!empty($product_details['parent_brand_id']) && $product_details['cat_id'] != '3') { $productInfo = $this->modelBooks->fetchRow('id="' . $product_details['parent_brand_id'] . '"'); $getParentBrandInfo = $this->modelBooks->getBrandInfo($productInfo->title); if (!empty($getParentBrandInfo)) { $titleBrand = $getParentBrandInfo['brand']; } } $productInfo = $this->modelBooks->fetchRow('id="' . $product_details['parent_brand_id'] . '"'); $getParentBrandInfo = $this->modelBooks->getBrandInfo($productInfo->title); if (!empty($getParentBrandInfo)) { //$titleBrand=$titleBrand.' ('.$getParentBrandInfo['brand'].')'; //$titleBrand=$getParentBrandInfo['brand']." - ".$titleBrand; $titleBrand = $getParentBrandInfo['brand']; } $tempDatInsert = array(); $formDataTransApproved = array(); $getdata = $transactionHistoryObj->fetchRow('orderId=' . $row_subdata['order_id'] . ''); $tempDatInsert['userid'] = $row_subdata['user_id']; $tempDatInsert['bookid'] = $id; $tempDatInsert['store_id'] = '226'; $tempDatInsert['price'] = $row_subdata['subscription_price']; $tempDatInsert['quantity'] = '1'; $tempDatInsert['transaction_id'] = $getdata->id; $tempDatInsert['book_name'] = $titleBrand; $tempDatInsert['add_date'] = date('Y-m-d H:i:s'); $tempDatInsert['group_id'] = $this->userdata[0]['group_id']; $tempDatInsert['order_id'] = $row_subdata['order_id']; $tempDatInsert['payment_status'] = '1'; $tempDatInsert['converted_price'] = $row_subdata['subscription_price']; $tempDatInsert['subscription_type'] = $row_subdata['subscription_type']; $tempDatInsert['subscription_store'] = $row_subdata['country']; $tempDatInsert['subscription_language'] = $row_subdata['language']; $tempDatInsert['subscription_name'] = $row_subdata['subscription_name']; $creditHistoryObj->insert($tempDatInsert); $formDataTransApproved = array("orderId" => $row_subdata['order_id'], "transactionType" => $getdata->transactionType, "pan" => $getdata->pan, "purchaseAmount" => $getdata->purchaseAmount, "tranDateTime" => $getdata->tranDateTime, "responseCode" => $getdata->responseCode, "responseDescription" => $getdata->responseDescription, "orderStatus" => $getdata->orderStatus, "approvalCode" => $getdata->approvalCode, "merchantTranId" => $getdata->merchantTranId, "orderDescription" => $getdata->orderDescription, "approvalCodeScr" => $getdata->approvalCodeScr, "currency" => $getdata->currency, "brand" => $getdata->brand, "card_holder_name" => $getdata->card_holder_name, "ThreeDSStatus" => $getdata->ThreeDSStatus, "threeDsVerification" => $getdata->threeDsVerification, "transaction_xml" => $getdata->transaction_xml); $inserted_id = $transactionHistoryObj->insert($formDataTransApproved); $insert_user_sub_details_array = array("order_id" => $row_subdata['order_id'], "product_id" => $id, "publisher_id" => $row_subdata['publisher_id'], "author_id" => $row_subdata['author_id'], "group_id" => $this->userdata[0]['group_id'], "user_id" => $row_subdata['user_id'], "subscription_type" => $row_subdata['subscription_type'], "subscription_name" => $row_subdata['subscription_name'], "subscription_price" => $row_subdata['subscription_price'], "country" => $row_subdata['country'], "language" => $row_subdata['language'], "publication_id" => $row_subdata['publication_id'], "company_id" => $this->userdata[0]['parent_id'], "active_date" => date('Y-m-d H:i:s')); $this->usersubscriptions->insert($insert_user_sub_details_array); $sql1 = "update pclive_products set best_seller=best_seller+1 where id='" . $id . "'"; $result1 = $this->modelBooks->getAdapter()->query($sql1); } $publicationdetails = $this->modelPublications->fetchAll('id=' . $id . ''); $product_price = $modelPrice->fetchAll('product_id="' . $id . '" and country_id=226 and language_id=1'); $getproductimage = $modelImage->fetchAll('product_id="' . $publicationdetails[0]['id'] . '"'); $publisher_info_array = $this->modelPublications->getPublisherInfo($publicationdetails[0]['publisher_id']); $author_info_array = $this->modelPublications->getAuthorInfo($publicationdetails[0]['author_id']); $getBrandInfo = $modelCategory->getBrandInfo($publicationdetails[0]['title']); if (!empty($getBrandInfo)) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $publicationdetails[0]['title']; } $fullname = $this->userdata[0]['first_name'] . ' ' . $this->userdata[0]['last_name']; $description_full = stripslashes($bookuploaddata[0]['message_body']); $description_full = nl2br($description_full); $description = str_replace("{name}", $fullname, $description_full); $description = str_replace("{title}", $titleBrand, $description); if (count($this->usersubscriptionsdata) > 0) { $description = str_replace("{price}", "N/A", $description); } else { if (isset($product_price[0]['price']) && $product_price[0]['price'] != '') { $description = str_replace("{price}", "₦" . $product_price[0]['price'], $description); } } if (count($getproductimage) > 0) { $linkdata = 'http://miprojects2.com.php53-6.ord1-1.websitetestlink.com/projects/evendor/catalogue/detail/id/' . $publicationdetails[0]['id'] . '/store/226/lang/1'; } else { $linkdata = "javascript:void(0);"; } $description = str_replace("{link}", $linkdata, $description); if (count($getproductimage) > 0) { $imagedata = 'http://miprojects2.com.php53-6.ord1-1.websitetestlink.com/projects/evendor/public/uploads/users/' . $getproductimage[0]['image_name_thumb'] . ''; } else { $imagedata = ""; } $description = str_replace("{image}", $imagedata, $description); $publishername = $publisher_info_array['first_name'] . " " . $publisher_info_array['last_name']; $authorname = $author_info_array['first_name'] . " " . $author_info_array['last_name']; $description = str_replace("{publisher}", $publishername, $description); $description = str_replace("{desc}", $publicationdetails[0]['description'], $description); $description = str_replace("{author}", $authorname, $description); $mailhost = SMTP_SERVER; $mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD); $transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig); Zend_Mail::setDefaultTransport($transport); $mail = new Zend_Mail(); $mail->addTo($this->userdata[0]['user_email']); $mail->setSubject(stripslashes($bookuploaddata[0]['title'])); $mail->setBodyHtml($description); $mail->setFrom(SETFROM, SETNAME); //$mail->send(); /*$reg='APA91bEZVTcqtar_br_cipLae9TyYe26JhsE2jHHnV76K_zWSAAyly2ZW6SCd4-REMgY_lGtHLh-2VvObjlj-pRvHd2932KlKY7anEOKQMyviVLs1A1Y7RYDPNtXwuRqTY7rILdF_LcXvY4GntxKouBU1EUv8E1mCQ'; $title = str_replace("_"," ",$title); $regID = array($reg); // $message="You have registerted successfully"; $message = array("userID" =>$row_userids['id'],"msg" =>$bookuploaddata[0]['title']." is ready to download","email" =>$row_userids['user_email']); send_push_notification($regID, $message);*/ if (isset($publicationdetails[0]['file_name']) && $publicationdetails[0]['file_name'] != '' && count($getproductimage) > 0 && count($product_price) > 0) { $get_registeration_id = mysql_query("select * from pclive_deviceID where user_publisher_id='" . $this->userdata[0]['id'] . "' and reg_id!=''"); $res_registeration_id = mysql_fetch_array($get_registeration_id); $reg = $res_registeration_id['reg_id']; $regID = array($reg); // $message="You have registerted successfully"; $message = array("userID" => $this->userdata[0]['id'], "msg" => "publication is ready to download", "email" => $this->userdata[0]['user_email']); if ($res_registration_id['os_type'] == 0) { send_push_notification($regID, $message); } else { send_push_notification_ios($regID, $row_userids['user_email'], $this->userdata[0]['id'], "publication is ready to download"); } } } } } } $this->_flashMessenger->addMessage('<div class="div-success">Product activated successfully</div>'); } else { $this->_flashMessenger->addMessage('<div class="div-error">Sorry!, unable to activate product</div>'); } } $this->_redirect('admin/publications/'); }
public static function send_msg($_chats) { //require("opendb.php"); require_once "function.php"; require_once "user.php"; ChatsManager::addNewChats($_chats); $_gcmid = array(UserManager::getGcmIdById($_chats->recipient)); return send_push_notification($_gcmid, $message = array("price" => $_chats->msg)); //else echo 0; //require("closedb.php"); }
} else { $push = new ApnsPHP_Push(ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION, $config['apns_pem_file_production']); } $push->setRootCertificationAuthority('entrust_root_certification_authority.pem'); $push->connect(); // push to all devices $dbhandle = sqlite_open('tokens.db', 0666, $error); if (!$dbhandle) { die($error); } $query = "SELECT * FROM tokens"; $result = sqlite_query($dbhandle, $query); $rows = sqlite_num_rows($result); for ($i = 0; $i < $rows; $i++) { $row = sqlite_fetch_array($result, SQLITE_NUM); $message = send_push_notification($row[1], $_GET['msg']); $push->add($message); $push->send(); print 'sending ..' . $i . "\n"; } sqlite_close($dbhandle); // Disconnect from the Apple Push Notification Service $push->disconnect(); // Examine the error message container $aErrorQueue = $push->getErrors(); if (!empty($aErrorQueue)) { var_dump($aErrorQueue); } function send_push_notification($token, $msg) { // Instantiate a new Message with a single recipient
function decline_buying_club_order_invite_post() { $orderId = $this->post('orderId'); $productId = $this->post('productId'); $productPriceId = $this->post('productPriceId'); $orderId = $this->post('orderId'); $userId = $this->post('userId'); $notificationId = $this->post('notificationId'); $latitude = $this->post('latitude'); $longitude = $this->post('longitude'); $deviceType = $this->post('deviceType'); $UDID = $this->post('UDID'); $deviceToken = $this->post('deviceToken'); if ($userId == "" || $latitude == "" || $longitude == "" || $deviceType == "" || $UDID == "" || $deviceToken == "" || $orderId == "" || $productId == "" || $productPriceId == "") { $this->response(array('error' => 'Please provide user index,order index,latitude,longitude,device id,device token,product index,product price index !'), 400); return FALSE; } $user = $this->user->get_details_by_id($userId)[0]; if (empty($user)) { $this->response(array('error' => 'Please provide valid user index to process the invitation!'), 400); return FALSE; } $order = $this->order->get_single_order_by_id($orderId); if ($order->userId == $user->userId) { $this->response(array('error' => 'Please provide valid user index to accept the invitation!'), 400); return FALSE; } if (empty($order)) { $this->response(array('error' => 'Please provide valid order index to accept the invitation!'), 400); return FALSE; } $group = $this->user->get_group_by_id($order->groupId); $prod_price_info = $this->product->get_products_price_details_by_id($order->productPriceId); $a = $this->_get_available_order_quantity($orderId); $availQty = $prod_price_info->qty - $a[0]->productQty; $orderInfo = unserialize(base64_decode($order->orderInfo)); if (!$availQty) { $this->response(array('error' => 'Order already completed by other members of this Buying Club.'), 400); return FALSE; } if (!$this->user->user_exists_on_group($userId, $order->groupId)) { $this->response(array('error' => 'You can not process this order because you are not member of this Buying Club.'), 400); return FALSE; } if ($order->parrentOrderID == 0) { $me = $user; foreach ($group->users as $key => $usr) { $mail_template_data = array(); if ($me->userId != $usr->userId) { $data['senderId'] = $userId; $data['receiverId'] = $usr->userId; $data['nType'] = 'BUYING-CLUB-ORDER-DECLINE'; $data['nTitle'] = 'Buying Club order [TIDIIT-OD-' . $order->orderId . '] cancel by <b>' . $me->firstName . ' ' . $me->lastName . '</b>'; $mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ORDER_ID'] = $order->orderId; $mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ADMIN_NAME'] = $me->firstName . ' ' . $me->lastName; $data['nMessage'] = "Hi, <br> Sorry! I can not process this Buying Club order right now.<br>"; $data['nMessage'] .= ""; $data['nMessage'] .= "Thanks <br> Tidiit Team."; $data['isRead'] = 0; $data['status'] = 1; $data['createDate'] = date('Y-m-d H:i:s'); $data['appSource'] = $deviceType; //Send Email message $recv_email = $usr->email; $sender_email = $me->email; $mail_template_view_data = load_default_resources(); $mail_template_view_data['group_order_decline'] = $mail_template_data; global_tidiit_mail($recv_email, "Buying Club order decline at Tidiit Inc Ltd", $mail_template_view_data, 'group_order_decline', $usr->firstName . ' ' . $usr->lastName); $notificationId = $this->user->notification_add($data); $push_not_data['receiverId'] = $group->admin->userId; $push_not_data['nType'] = "BUYING-CLUB-ORDER-DECLINE"; $push_not_data['nTitle'] = 'New Buying Club Order Invitation'; $push_not_data['appSource'] = $deviceType; //$push_not_data['orderId'] = $orderId; $push_not_data['nMessage'] = 'You have invited to Buying Club[' . $group->groupTitle . '] by ' . $group->admin->firstName . ' ' . $group->admin->lastName . '.More details about this notifiaction,Check ' . $defaultResources['MainSiteBaseURL']; send_normal_push_notification($push_not_data); } } $data['receiverId'] = $group->admin->userId; unset($data['nMessage']); $mail_template_view_data = load_default_resources(); $defaultResources = $mail_template_view_data; $mail_template_data = array(); $data['senderId'] = $userId; $data['nType'] = 'BUYING-CLUB-ORDER-DECLINE'; $data['nTitle'] = 'Buying Club order [TIDIIT-OD-' . $order->orderId . '] cancel by <b>' . $me->firstName . ' ' . $me->lastName . '</b>'; $mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ORDER_ID'] = $order->orderId; $mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ADMIN_NAME'] = $me->firstName . ' ' . $me->lastName; $data['nMessage'] = "Hi, <br> Sorry! I can not process this order right now.<br>"; $data['nMessage'] .= "<a href='" . $defaultResources['MainSiteBaseURL'] . "shopping/group-re-order-process/" . base64_encode($orderId * 226201) . "' class='btn btn-warning btn-lg'>Re-order now</a><br><br>"; $mail_template_data['TEMPLATE_GROUP_ORDER_DECLINE_ORDER_ID1'] = $orderId; $data['nMessage'] .= "Thanks <br> Tidiit Team."; $data['isRead'] = 0; $data['status'] = 1; $data['orderId'] = $orderId; $data['productId'] = $productId; $data['productPriceId'] = $productPriceId; $data['createDate'] = date('Y-m-d H:i:s'); $data['appSource'] = $deviceType; //Send Email message $recv_email = $group->admin->email; $sender_email = $me->email; $mail_template_view_data = load_default_resources(); $mail_template_view_data['group_order_decline'] = $mail_template_data; global_tidiit_mail($recv_email, "Buying Club order decline at Tidiit Inc Ltd", $mail_template_view_data, 'group_order_decline_admin', $group->admin->firstName . ' ' . $group->admin->lastName); $notificationId = $this->user->notification_add($data); $declient_data = array(); $declient_data['acceptDeclineState'] = 2; $this->user->notification_edit($declient_data, $notificationId); $this->order->update(array('reOrder' => 1, 'cancelOrderUserId' => $userId), $orderId); /// sendin SMS to Leader $smsMsg = 'Buying Club[' . $group->groupTitle . '] member[' . $usr->firstName . ' ' . $usr->lastName . '] has decline the invitation Tidiit order TIDIIT-OD-' . $order->orderId . '.'; $sms_data = array('nMessage' => $smsMsg, 'receiverMobileNumber' => $orderInfo['group']->admin->mobile, 'senderId' => '', 'receiverId' => $orderInfo["group"]->admin->userId, 'senderMobileNumber' => '', 'nType' => $data['nType']); send_sms_notification($sms_data); $push_not_data['receiverId'] = $group->admin->userId; $push_not_data['nType'] = "BUYING-CLUB-ORDER-DECLINE"; $push_not_data['nTitle'] = 'New Buying Club Order Invitation'; $push_not_data['appSource'] = $deviceType; $push_not_data['notificationId'] = $notificationId; $push_not_data['nMessage'] = 'You have invited to Buying Club[' . $group->groupTitle . '] by ' . $group->admin->firstName . ' ' . $group->admin->lastName . '.More details about this notifiaction,Check ' . $defaultResources['MainSiteBaseURL']; send_push_notification($push_not_data); } $result = array(); $result['message'] = 'Sorry for Buying Club order cancelation!'; success_response_after_post_get($result); }
<?php require_once 'GCM_Loader.php'; $db = new BaseDB(); $message = $_REQUEST["message"]; $clanID = $_REQUEST["clanID"]; $i = 0; $sql = "\n SELECT gcm_regid, game_name FROM dbo.gcm_users WHERE Active = 1 AND clanID = {$clanID}\n "; $result = $db->dbQuery($sql); $data = array(); $registatoin_ids = array(); $i = 0; while ($record = sqlsrv_fetch_array($result, SQLSRV_FETCH_BOTH)) { $registatoin_ids[$i++] = $record['gcm_regid']; } $msg = array("data" => $message); send_push_notification($registatoin_ids, $msg); $db->close();
function storeComplaint($Priority, $myLocation, $User, $message, $Category, $filename) { if ($Category == "traffictable") { $value = "traffic"; } else { if ($Category == "policetable") { $value = "police"; } else { if ($Category == "mescomtable") { $value = "mescom"; } else { if ($Category == "mnpotable") { $value = "mnpo"; } } } } // insert user into database $result = mysql_query("INSERT INTO " . $Category . "(Priority, myLocation, userId,message,image) VALUES('{$Priority}', '{$myLocation}', '{$User}','{$message}','{$filename}')"); // check for successful store if ($result) { // get user details $id = mysql_insert_id(); // last inserted id $result = mysql_query("SELECT * FROM " . $Category . " WHERE image = '{$filename}'") or die(mysql_error()); // return user details if (mysql_num_rows($result) > 0) { $GcmIdresult = mysql_query("SELECT * FROM logintable WHERE Email = '{$User}'") or die(mysql_error()); while ($row = mysql_fetch_assoc($GcmIdresult)) { $gcmRegID = $row['GcmId']; } $registatoin_ids = array($gcmRegID); $completeId = "complete registred ID " . $value . "_" . $id; $message = array("message" => $completeId); $push_notif_result = send_push_notification($registatoin_ids, $message); return mysql_fetch_array($result); } else { return false; } } else { return false; } }
public function approvedAction() { $producturrency = new Admin_Model_DbTable_Countries(); $modelAuthor = new Publisher_Model_DbTable_Publishers(); $tempObj = new Model_DbTable_Checkout(); $creditHistoryObj = new User_Model_DbTable_Chistory(); $transactionHistoryObj = new User_Model_DbTable_Transactionhistory(); $this->modelBooks = new Publisher_Model_DbTable_Books(); $modelImage = new Publisher_Model_DbTable_BookImages(); $modelStore = new Admin_Model_DbTable_Countries(); $productPrice = new Publisher_Model_DbTable_BookPrices(); $productPrice = new Publisher_Model_DbTable_BookPrices(); $groupSubsObj = new Company_Model_DbTable_GroupSubscriptions(); $UsersubObj = new Model_DbTable_Usersubscription(); $userCompanyObj = new Company_Model_DbTable_Companies(); $response = $_POST['xmlmsg']; $xml_string = $_POST['xmlmsg']; $parsedxml = simplexml_load_string(stripslashes($response)); //echo "<pre>"; //print_r($parsedxml); $formDataTransApproved = array(); foreach ($parsedxml as $RESPONSENODE) { //echo $RESPONSENODE."<br/>"; if ($RESPONSENODE->getName() == 'OrderID') { $orderId = $RESPONSENODE; $orderIdForPurchase = $RESPONSENODE; $orderIdss = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'TransactionType') { $transactionType = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'PAN') { $pan = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'PurchaseAmountScr') { $purchaseAmount = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'TranDateTime') { $tranDateTime = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'ResponseCode') { $responseCode = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'ResponseDescription') { $responseDescription = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'OrderStatusScr') { $orderStatus = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'ApprovalCode') { $approvalCode = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'MerchantTranID') { $merchantTranId = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'OrderDescription') { $orderDescription = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'ApprovalCodeScr') { $approvalCodeScr = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'CurrencyScr') { $currency = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'ThreeDSVerificaion') { $threeDsVerification = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'Brand') { $brandname = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'Name') { $card_holder_name = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'ThreeDSStatus') { $ThreeDSStatus = $RESPONSENODE; } if ($RESPONSENODE->getName() == 'MerchantTranID') { $MerchantTranID = $RESPONSENODE; } } $formDataTransApproved = array("orderId" => $orderId, "transactionType" => $transactionType, "pan" => $pan, "purchaseAmount" => $purchaseAmount, "tranDateTime" => $tranDateTime, "responseCode" => $responseCode, "responseDescription" => $responseDescription, "orderStatus" => $orderStatus, "approvalCode" => $approvalCode, "approvalCode" => $approvalCode, "merchantTranId" => $merchantTranId, "orderDescription" => $orderDescription, "approvalCodeScr" => $approvalCodeScr, "currency" => $currency, "brand" => $brandname, "card_holder_name" => $card_holder_name, "ThreeDSStatus" => $ThreeDSStatus, "threeDsVerification" => $threeDsVerification, "transaction_xml" => $xml_string); $inserted_id = $transactionHistoryObj->insert($formDataTransApproved); ############## update table ########################### if ($orderStatus == 'APPROVED') { $orderSt = 1; } else { $orderSt = 0; } $tempTransactionUpdate = array("payment_status" => $orderSt, "transaction_id" => $inserted_id); //$tempObj->update($tempTransactionUpdate,'user_id="'.$user_id.'"'); $creditHistoryObj->update($tempTransactionUpdate, "order_id='" . $orderId . "'"); ########################################################## $total_price = ''; $tempData = $tempObj->fetchAll("order_id='" . $orderId . "' and is_purchase!='1'"); //$tempData = $tempObj->fetchAll("order_id='38115' and is_purchase!='1'"); $css1 = ' style="text-align:center;padding:5px;word-wrap:break-word;color:#fff;max-width: 150px;" '; $order_details = "<table cellpadding='4' cellpadding='1' width='100%' style='background:#656565;;color:#fff;border-collapse:collapse;' border='1' BORDERCOLOR='#000'><tr><td colspan='9'>Your reference Id</td></tr><tr><td colspan='9'>Order ID:" . $orderId . "</td></tr><tr><td colspan='9'>Transaction ID:" . $inserted_id . "</td></tr><tr><td" . $css1 . ">Item Image</td><td" . $css1 . ">Title</td><td" . $css1 . ">Subscribed users</td><td" . $css1 . ">Price</td><td" . $css1 . ">Subscription Details</td><td" . $css1 . ">Number of Issues</td><td" . $css1 . ">Start Date</td><td" . $css1 . ">End Date</td><td" . $css1 . ">Quantity</td></tr>"; $array_new = array(); $new_product_array = array(); foreach ($tempData as $dataDet) { $publication_det = $this->modelBooks->fetchRow("id='" . $dataDet['product_id'] . "'"); if (@in_array($publication_det['publisher_id'], $array_new)) { $new_product_array[$publication_det['publisher_id']][] = array("id" => $dataDet['id'], "product_id" => $dataDet['product_id'], "user_id" => $dataDet['user_id'], "user_type" => $dataDet['user_type'], "store_id" => $dataDet['store_id'], "quntity" => $dataDet['quntity'], "group_id" => $dataDet['group_id'], "order_id" => $dataDet['group_id']); } else { array_push($array_new, $publication_det['publisher_id']); $new_product_array[$publication_det['publisher_id']][] = array("id" => $dataDet['id'], "product_id" => $dataDet['product_id'], "user_id" => $dataDet['user_id'], "user_type" => $dataDet['user_type'], "store_id" => $dataDet['store_id'], "quntity" => $dataDet['quntity'], "group_id" => $dataDet['group_id'], "order_id" => $dataDet['group_id']); } } $modelSubscription = new Publisher_Model_DbTable_Subscriptions(); foreach ($tempData as $dataDet) { $order_idsids = $dataDet['order_id']; $user_ids_mail[] = $dataDet['user_id']; $productPriceInfo = $productPrice->getPriceByStoreId($dataDet['product_id'], $dataDet['store_id']); $subscription_data = $modelSubscription->fetchAll('id="' . $dataDet['subscription_type'] . '"'); if ($dataDet['group_id'] != '' && $dataDet['group_id'] != 0) { $arrayDataGroup = ''; $dateTime = date('Y-m-d H:i:s'); $price = $productPriceInfo['group_price']; $arrayDataGroup = array("publication_id" => $dataDet['product_id'], "group_id" => $dataDet['group_id'], "company_id" => $dataDet['user_id'], "assigned_date" => $dateTime); $groupSubsObj->insert($arrayDataGroup); } else { $price = $productPriceInfo['price']; } $product_details = $this->modelBooks->fetchRow("id='" . $dataDet['product_id'] . "'"); $getBrandInfo = $this->modelBooks->getBrandInfo($product_details['title']); if (!empty($getBrandInfo) && is_numeric($this->{$product_details}['title'])) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $product_details['title']; } if (!empty($product_details['parent_brand_id']) && $product_details['cat_id'] != '3') { $productInfo = $this->modelBooks->fetchRow('id="' . $product_details['parent_brand_id'] . '"'); $getParentBrandInfo = $this->modelBooks->getBrandInfo($productInfo->title); $authorInfo = $modelAuthor->getInfoByPublisherId($product_details['publisher_id']); if (!empty($getParentBrandInfo)) { //$titleBrand=$titleBrand.' ('.$getParentBrandInfo['brand'].')'; //$titleBrand=$getParentBrandInfo['brand']." - ".$titleBrand."<br/>".$authorInfo['publisher']; $titleBrand = $getParentBrandInfo['brand'] . "<br/>" . $authorInfo['publisher']; } } $getCurrencyName = $producturrency->getCurrencyCode($dataDet['store_id']); $authorInfo = $modelAuthor->getInfoByPublisherId($product_details['author_id']); $imageInfo = $modelImage->getImageInfoByProductId($product_details['id']); $sql1 = "update pclive_products set best_seller=best_seller+1 where id='" . $dataDet['product_id'] . "'"; $result1 = $this->modelBooks->getAdapter()->query($sql1); $todaysdate = date('Y-m-d H:i:s'); if ($dataDet['subscription_name'] == 'Weekly') { $date = new DateTime($todaysdate); $date->modify("+7 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Monthly') { $date = new DateTime($todaysdate); $date->modify("+30 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Quarterly') { $date = new DateTime($todaysdate); $date->modify("+90 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Half Yearly') { $date = new DateTime($todaysdate); $date->modify("+182 day"); $end_date = $date->format("Y-m-d H:i:s"); } else { if ($dataDet['subscription_name'] == 'Yearly') { $date = new DateTime($todaysdate); $date->modify("+365 day"); $end_date = $date->format("Y-m-d H:i:s"); } } } } } if (count($subscription_data) > 0) { $price_to_show = $dataDet['subscription_price']; $subtype = $dataDet['subscription_name']; $subscription_issues = $dataDet['subscription_issues']; $todaysdate = $todaysdate; $end_date = $end_date; } else { $price_to_show = $price; $subtype = "N/A"; $subscription_issues = "N/A"; $todaysdate = "N/A"; $end_date = "N/A"; } if ($dataDet['user_type'] == "1") { $finalsubprice = $price_to_show * $dataDet['quntity']; } else { $finalsubprice = $price_to_show; } if ($dataDet['group_id'] != '' && $dataDet['group_id'] != 0) { $subscriptiondatavalues = $UsersubObj->fetchAll('order_id=' . $dataDet['order_id'] . ' and product_id=' . $dataDet['product_id'] . ''); $useremails = ""; foreach ($subscriptiondatavalues as $userdata) { $user_details = $userCompanyObj->fetchRow("id='" . $userdata['user_id'] . "'"); $useremails .= $user_details['user_email'] . ','; } $useremails = rtrim($useremails, ','); } else { $useremails = 'N/A'; } $imageInfo = $modelImage->getImageInfoByProductId($dataDet['product_id']); $quntity_price = $finalsubprice; $price_quan = $producturrency->currencyconverter($getCurrencyName, "NGN", $quntity_price); $price_in = $producturrency->currencyconverter($getCurrencyName, "NGN", $price_to_show); $total_price = $total_price + $price_quan; //if($dataDet['is_purchase']!='1') //{ $order_details .= '<tr> <td' . $css1 . '><img src="' . $this->view->serverUrl() . $this->view->baseUrl() . "/" . USER_UPLOAD_DIR . "thumb1_" . $imageInfo['image_name'] . '"></td> <td' . $css1 . '>' . $titleBrand . '</td> <td' . $css1 . '>' . $useremails . '</td> <td' . $css1 . '>' . $price_in . '</td> <td' . $css1 . '>' . $subtype . '</td> <td' . $css1 . '>' . $subscription_issues . '</td> <td' . $css1 . '>' . $todaysdate . '</td> <td' . $css1 . '>' . $end_date . '</td> <td' . $css1 . '>' . $dataDet['quntity'] . '</td> </tr> '; //} //if($dataDet['is_purchase']!='1') //{ //$quntity_price = $dataDet['quntity']*$price; //$order_details.= "<tr><td>".$titleBrand."</td><td>".$producturrency->currencyconverter($getCurrencyName,"NGN",$price)."</td><td>".$dataDet['quntity']."</td></tr><tr><td colspan='3' align='left'>Sub Total: ₦".@mumber_format($producturrency->currencyconverter($getCurrencyName,"NGN",$quntity_price),2)."</td></tr>"; //} } $order_details .= '<tr><td colspan="6" align="left"> </td><td colspan="2">Sub Total :</td><td> ₦' . $price_quan . '</td></tr>'; $order_details .= "<tr><td colspan='6'> </td><td colspan='2' >Total : </td><td>" . $total_price . "</td></tr>"; $order_details .= "</table>"; $tempObj->delete('order_id="' . $orderIdForPurchase . '"'); //echo $order_details; //exit; ########################################### mail action ############################ $userCompanyObj = new Company_Model_DbTable_Companies(); $storage_company = new Zend_Auth_Storage_Session('company_type'); $company_data = $storage_company->read(); $storage = new Zend_Auth_Storage_Session('account_type'); $data = $storage->read(); if ($data->id) { $user_id = $data->id; } elseif ($company_data->id) { $user_id = $company_data->id; } $user_details = $userCompanyObj->fetchRow("id='" . $user_id . "'"); $mailhost = SMTP_SERVER; $mailconfig = array('ssl' => SMTP_SSL, 'port' => SMTP_PORT, 'auth' => SMTP_AUTH, 'username' => SMTP_USERNAME, 'password' => SMTP_PASSWORD); $transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig); Zend_Mail::setDefaultTransport($transport); $message = '<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Evendor</title> </head> <body style="font-family: \'Calibri\', arial;"> <div id="container" style="width:80%; margin:0 auto;"> <header id="heder"> <div style="padding:15px 0px; background:#000000; color:#fff;"> <a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/" target="_blank"> <img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png" style="border:none;" alt="E-Vendor"> </a> </div> </header> <div style="background:#656565; padding:15px; min-height:200px;color:#fff;"> <span >Hi ' . $user_details['first_name'] . ' ' . $user_details['last_name'] . ',<br/><br/> Your order has been successfully completed.Please check your order details.<br><br></span> ' . $order_details . '<table border="0" cellpadding="5" style="background:#656565;color:#fff;width:100%;" width="100%"><tr><td colspan="2">Transaction message:' . $responseDescription . '</td></tr> <tr><td>Masked PAN:' . $pan . '</td><td>Card Holder Name:' . $card_holder_name . '</td></tr> <tr><td>Transaction Date & Time:' . $tranDateTime . '</td><td>Transactions reference number(MerchantTranID):' . $MerchantTranID . '</td></tr> <tr><td>Transaction Amount:' . $purchaseAmount . '</td><td>Transaction Currency:' . $currency . '</td></tr> <tr><td>Authorization Code:' . $approvalCodeScr . '</td><td>Merchant Name:Evendor</td></tr> <tr><td colspan="2">Site Url : <a style="color:#fff;text-decoration:none;" href="' . $this->view->serverUrl() . $this->view->baseUrl() . '">' . $this->view->serverUrl() . $this->view->baseUrl() . '</a></td></tr></table><br/> <br/><br/><br/> Thank You<br/><br/> Evendor </div> <div style="background:#000000; text-align:center; color:#FFFFFF; font-size:14px; padding:15px;"> © Copyright ' . date("Y") . ' All Rights Reserved By Electronic Vendor Ltd. </div> </div> </body> </html>'; if ($user_details['user_email'] != '') { $mail = new Zend_Mail(); $mail->addTo($user_details['user_email']); //$mail->addTo('*****@*****.**'); $mail->setSubject("Order Approved message."); $mail->setBodyHtml($message); $mail->setFrom(SETFROM, SETNAME); $mail->send(); } ############################## admin Message ################################### $message_admin = '<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Evendor</title> </head> <body style="font-family: \'Calibri\', arial;"> <div id="container" style="width:80%; margin:0 auto;"> <header id="heder"> <div style="padding:15px 0px; background:#000000;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/" target="_blank"><img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png" style="border:none;" alt="E-Vendor"></a></div> </header> <div style="background:#656565; padding:15px; min-height:200px;color:#fff;"> Hi,<br/><br/>' . $user_details['first_name'] . ' ' . $user_details['last_name'] . ' has been successfully ordered.Please see your order details.<br/><br/> ' . $order_details . '<br/>Transaction message:' . $responseDescription . ' <br/>Transaction Date & Time:' . $tranDateTime . '<br/> <br/>Transactions reference number(MerchantTranID):' . $MerchantTranID . '<br/> <br/>Transaction Amount:' . $purchaseAmount . '<br/> <br/>Transaction Currency:' . $currency . '<br/> <br/>Authorization Code:' . $approvalCodeScr . '<br/> <br/>Merchant Name:Evendor<br/> <br/>Site Url : <a style="color:#fff;" href="' . $this->view->serverUrl() . $this->view->baseUrl() . '">' . $this->view->serverUrl() . $this->view->baseUrl() . '</a><br/> <br/><br/><br/> Thank You<br/> Evendor </div> <div style="background:#000000; text-align:center; color:#FFFFFF; font-size:14px; padding:15px;"> <br> © Copyright ' . date("Y") . ' All Rights Reserved By Electronic Vendor Ltd. </div> </div> </body> </html>'; //die($message_admin); ################################################## end admin message ##################### /*if ($user_details['user_email'] != '') { $mail = new Zend_Mail(); //$mail->addTo($user_details['user_email']); $mail->addTo('*****@*****.**'); $mail->setSubject("Order Approved message."); $mail->setBodyHtml($message); $mail->setFrom(SETFROM, SETNAME); $mail->send(); }*/ $get_registeration_id = mysql_query("select * from pclive_deviceID where user_publisher_id='" . $user_details['id'] . "' and reg_id!=''"); while ($res_registeration_id = mysql_fetch_array($get_registeration_id)) { $reg = $res_registeration_id['reg_id']; $regID = array($reg); // $message="You have registerted successfully"; $message = array("userID" => $user_details['id'], "msg" => "publication is ready to download", "email" => $user_details['user_email']); if ($res_registration_id['os_type'] == 0) { send_push_notification($regID, $message); } else { send_push_notification_ios($regID, $user_details['user_email'], $user_details['id'], "publication is ready to download"); } } //$reg='APA91bEZVTcqtar_br_cipLae9TyYe26JhsE2jHHnV76K_zWSAAyly2ZW6SCd4-REMgY_lGtHLh-2VvObjlj-pRvHd2932KlKY7anEOKQMyviVLs1A1Y7RYDPNtXwuRqTY7rILdF_LcXvY4GntxKouBU1EUv8E1mCQ'; if ($company_data->account_type == '1') { $subscriptiondatavalues = $UsersubObj->fetchAll('order_id=' . $orderId . ' and active_date IS NULL'); foreach ($subscriptiondatavalues as $dataDetsubscribe) { $productdetails = $this->modelBooks->fetchRow("id='" . $dataDetsubscribe['product_id'] . "'"); $getBrandInfo = $this->modelBooks->getBrandInfo($productdetails['title']); if (!empty($getBrandInfo) && is_numeric($productdetails['title'])) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $productdetails['title']; } if (!empty($productdetails['parent_brand_id']) && $productdetails['cat_id'] != '3') { $productInfo = $this->modelBooks->fetchRow('id="' . $productdetails['parent_brand_id'] . '"'); $getParentBrandInfo = $this->modelBooks->getBrandInfo($productInfo->title); $authorInfo = $modelAuthor->getInfoByPublisherId($productdetails['publisher_id']); if (!empty($getParentBrandInfo)) { //$titleBrand=$titleBrand.' ('.$getParentBrandInfo['brand'].')'; //$titleBrand=$getParentBrandInfo['brand']." - ".$titleBrand."<br/>".$authorInfo['publisher']; $titleBrand = $getParentBrandInfo['brand'] . "<br/>" . $authorInfo['publisher']; } } $user_details_all = $userCompanyObj->fetchRow("id='" . $dataDetsubscribe['user_id'] . "'"); $message1 = 'Hi ' . $user_details_all['first_name'] . ' ' . $user_details_all['last_name'] . ', you have been subscribed for the ' . $dataDetsubscribe['subscription_name'] . ' subscription for the product ' . $titleBrand . ' in evendor. You can download ' . $dataDetsubscribe['number_of_issues'] . ' issues. Your subscription starts from ' . $dataDetsubscribe['start_date'] . ' and ends on ' . $dataDetsubscribe['end_date'] . '.Please see your order details.<br/><br/> ' . $order_details . ''; if ($user_details_all['user_email'] != '') { $mail = new Zend_Mail(); $mail->addTo($user_details_all['user_email']); //$mail->addTo('*****@*****.**'); $mail->setSubject("Order Approved message."); $mail->setBodyHtml($message1); $mail->setFrom(SETFROM, SETNAME); $mail->send(); } /* $mail = new Zend_Mail(); $mail->addTo('*****@*****.**'); $mail->setSubject("Order Approved message."); $mail->setBodyHtml($message1); $mail->setFrom(SETFROM, SETNAME); $mail->send(); */ $get_registeration_id = mysql_query("select * from pclive_deviceID where user_publisher_id='" . $user_details_all['id'] . "' and reg_id!=''"); while ($res_registeration_id = mysql_fetch_array($get_registeration_id)) { $reg = $res_registeration_id['reg_id']; $regID = array($reg); // $message="You have registerted successfully"; $message = array("userID" => $user_details_all['id'], "msg" => "publication is ready to download", "email" => $user_details_all['user_email']); if ($res_registration_id['os_type'] == 0) { send_push_notification($regID, $message); } else { send_push_notification_ios($regID, $user_details['user_email'], $user_details['id'], "publication is ready to download"); } //send_push_notification($regID, $message); } //$reg='APA91bEZVTcqtar_br_cipLae9TyYe26JhsE2jHHnV76K_zWSAAyly2ZW6SCd4-REMgY_lGtHLh-2VvObjlj-pRvHd2932KlKY7anEOKQMyviVLs1A1Y7RYDPNtXwuRqTY7rILdF_LcXvY4GntxKouBU1EUv8E1mCQ'; /* $reg='APA91bFkjucY1iaCcNprgfIZ_ajoQLv_Ky_jGIH8Y83a3by9fO_ych0yMqG7v9PpJzgttzzbwWZ5SOv6QQV1uYocH4OlyaAsPPi4vvOJILk9YVaVsx2xItJ83_0gXsVDM71LosYKoAqHpdQVx9hXuY5RGXr3LJuzWg'; $regID = array($reg); // $message="You have registerted successfully"; $message = array("userID" =>$user_details_all['id'],"msg" =>"publication is ready to download","email" =>$user_details_all['user_email'],); send_push_notification($regID, $message); */ } } foreach ($new_product_array as $key => $pubVal) { $order_details_publisher = "<table cellpadding='1' width='100%' style='background:#656565;color:#fff;'>\n\t\t\t\t\t\t\t\t\t\t<tr><td>Item</td><td>Price</td><td>Quantity</td></tr>"; foreach ($pubVal as $pub_order_det) { $productPriceInfo = $productPrice->getPriceByStoreId($pub_order_det['product_id'], $pub_order_det['store_id']); if ($pub_order_det['group_id'] != '' && $pub_order_det['group_id'] != 0) { $arrayDataGroup = ''; $dateTime = date('Y-m-d H:i'); $price = $productPriceInfo['group_price']; } else { $price = $productPriceInfo['price']; } $product_details = $this->modelBooks->fetchRow("id='" . $pub_order_det['product_id'] . "'"); $getBrandInfo = $this->modelBooks->getBrandInfo($product_details['title']); if (!empty($getBrandInfo) && is_numeric($this->{$product_details}['title'])) { $titleBrand = $getBrandInfo['brand']; } else { $titleBrand = $product_details['title']; } if (!empty($product_details['parent_brand_id']) && $product_details['cat_id'] != '3') { $productInfo = $this->modelBooks->fetchRow('id="' . $product_details['parent_brand_id'] . '"'); $getParentBrandInfo = $this->modelBooks->getBrandInfo($productInfo->title); if (!empty($getParentBrandInfo)) { //$titleBrand=$titleBrand.' ('.$getParentBrandInfo['brand'].')'; //$titleBrand=$getParentBrandInfo['brand']." - ".$titleBrand; $titleBrand = $getParentBrandInfo['brand']; } } $getCurrencyName = $producturrency->getCurrencyCode($pub_order_det['store_id']); $authorInfo = $modelAuthor->getInfoByPublisherId($product_details['author_id']); $imageInfo = $modelImage->getImageInfoByProductId($product_details['id']); if (count($subscription_data) > 0) { if ($dataDet['group_id'] != '' && $dataDet['group_id'] != 0) { $price_to_show = $subscription_data[0]->group_price_sub; } else { $price_to_show = $subscription_data[0]->individual_price; } } else { $price_to_show = $price; } if ($dataDet['user_type'] == "1") { $finalsubprice = $price_to_show * $dataDet['quntity']; } else { $finalsubprice = $price_to_show; } $quntity_price = $finalsubprice; $price_quan = $producturrency->currencyconverter($getCurrencyName, "NGN", $quntity_price); $price_in = $producturrency->currencyconverter($getCurrencyName, "NGN", $price_to_show); $total_price = $total_price + $price_quan; //if($dataDet['is_purchase']!='1') //{ $order_details_publisher .= "<tr>\n\t\t\t\t\t\t\t\t\t\t<td>" . $titleBrand . "</td>\n\t\t\t\t\t\t\t\t\t\t<td>" . $price_in . "</td>\n\t\t\t\t\t\t\t\t\t\t<td>" . $pub_order_det['quntity'] . "</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td colspan='3' align='left'>Sub Total: ₦" . $price_quan . "</td></tr>"; } $order_details_publisher .= "<tr><td colspan='3'>Total: " . $total_price . "</td></tr>"; $order_details_publisher .= "</table>"; $message_publisher = '<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Evendor</title> </head> <body style="font-family: \'Calibri\', arial;"> <div id="container" style="width:80%; margin:0 auto;"> <header id="heder"> <div style="padding:15px 0px; background:#000000;"><a href="' . $this->view->serverUrl() . $this->view->baseUrl() . '/" target="_blank"><img src="' . $this->view->serverUrl() . $this->view->baseUrl() . '/public/css/default/images/logo.png" style="border:none;" alt="E-Vendor"></a></div> </header> <div style="background:#656565; padding:15px; min-height:200px;color:#fff;"> Hi Publisher,<br/><br/>User has been successfully ordered.Please review order details.<br/><br/> ' . $order_details . '<br/>Transaction message:' . $responseDescription . ' <br/>Transaction Date & Time:' . $tranDateTime . '<br/> <br/>Merchant Name:Evendor<br/> <br/>Site Url : <a style="color:#fff;" href="' . $this->view->serverUrl() . $this->view->baseUrl() . '">' . $this->view->serverUrl() . $this->view->baseUrl() . '</a><br/> <br/><br/><br/> Thank You<br/> Evendor </div> <div style="background:#000000; text-align:center; color:#FFFFFF; font-size:14px; padding:15px;"> <br> © Copyright ' . date("Y") . ' All Rights Reserved By Electronic Vendor Ltd. </div> </div> </body> </html>'; // die($message_publisher); $mail = new Zend_Mail(); $mail->addTo('*****@*****.**'); //$mail->addTo('*****@*****.**'); $mail->setSubject("Order Approved message."); $mail->setBodyHtml($message_publisher); $mail->setFrom(SETFROM, SETNAME); $mail->send(); } $this->_redirect('checkout/displayorder/orderid/' . $orderIdForPurchase); exit; }
<?php require_once 'loader.php'; // return json response $json = array(); $nameUser = $_POST["name"]; $nameEmail = $_POST["email"]; // GCM Registration ID got from device $gcmRegID = $_POST["regId"]; /** * Registering a user device in database * Store reg id in users table */ if (isset($nameUser) && isset($nameEmail) && isset($gcmRegID)) { // Store user details in db $res = storeUser($nameUser, $nameEmail, $gcmRegID); $registatoin_ids = array($gcmRegID); $message = array("product" => "shirt"); $result = send_push_notification($registatoin_ids, $message); echo $result; } else { // user details not found }
public function test_push() { $data = json_encode(['message' => "ajsdlksamkdmsalk:))"]); return send_push_notification($data); }
function assignment_send_push($pushMessage, $post_id, $deadline, $reg_ids) { $fire = new FirebasePush($pushMessage); $fire->sendPushNotification(); $message = array("assignment" => $pushMessage, "assignmentID" => $post_id, "assignmentDeadline" => $deadline); send_push_notification($reg_ids, $message); update_post_meta($post_id, 'notified', "1"); }
public function comment($domain, $productId, Request $request) { $comment_content = $request->comment_content; $product = Product::find($productId); //send one notifcation to author if ($product->author->id != $this->user->id) { $notification = new Notification(); $notification->product_id = $productId; $notification->actor_id = $this->user->id; $notification->receiver_id = Product::find($productId)->author->id; $notification->type = 1; $notification->save(); $publish_data = array("event" => "notification", "data" => ["notification" => $this->notificationTransformer->transform($notification)]); Redis::publish('colorme-channel', json_encode($publish_data)); send_push_notification(json_encode($publish_data)); } $already_sent_noti = array(); //send to all others that involve in the post foreach ($product->comments as $comment) { $commenter_id = $comment->commenter_id; if ($product->author->id != $commenter_id && $commenter_id != $this->user->id && !in_array($commenter_id, $already_sent_noti)) { $notification = new Notification(); $notification->product_id = $productId; $notification->actor_id = $this->user->id; $notification->receiver_id = $commenter_id; $notification->type = 2; $notification->save(); $publish_data = array("event" => "notification", "data" => ["notification" => $this->notificationTransformer->transform($notification)]); Redis::publish('colorme-channel', json_encode($publish_data)); send_push_notification(json_encode($publish_data)); $already_sent_noti[] = $commenter_id; } } $comment = new Comment(); $comment->product_id = $productId; $comment->commenter_id = $this->user->id; $comment->content = $comment_content; $comment->save(); $publish_data = array("event" => "comment", "data" => json_encode(["comment" => $this->commentTransformer->transform($comment), "product_id" => $productId, "user_id" => $this->user->id])); Redis::publish('colorme-channel', json_encode($publish_data)); return $this->respond($comment); }