private function _handleGetResults() { $pathS = __DIR__ . '/../../listener/status.db'; $statusArr = FileUtil::loadArray($pathS); $this->results[SMSController::RESULT_STATUS_ARR] = $statusArr; $pathM = __DIR__ . '/../../listener/msgs.db'; $msgsArr = FileUtil::loadArray($pathM); $this->results[SMSController::RESULT_MSGS_ARR] = $msgsArr; }
public function handleRequest() { $this->handleSendMMS(); $this->handleGetStatus(); // notifications $pathS = __DIR__ . '/../../listener/status.db'; $this->results[MMSController::RESULT_STATUS_DB] = FileUtil::loadArray($pathS); // attachments $fnames = FileUtil::getFiles($this->_attachmentsFolder); array_unshift($fnames, ""); // no attachment $this->results[MMSController::RESULT_FNAMES] = $fnames; // images $path = __DIR__ . '/../../MMSImages/mmslistener.db'; $this->results[MMSController::RESULT_MSGS_DB] = FileUtil::loadArray($path); if (isset($_SESSION['id'])) { $this->results[MMSController::RESULT_MSG_ID] = $_SESSION['id']; } }
private function loadFile() { $fileArr = FileUtil::loadArray($this->_fpath); if ($fileArr == NULL || !is_array($fileArr)) { $fileArr = array(); } $indices = array(PaymentFileHandler::INDEX_TRANS_ID, PaymentFileHandler::INDEX_MERCHANT_TRANS_ID, PaymentFileHandler::INDEX_AUTH_CODE, PaymentFileHandler::INDEX_SUB_ID, PaymentFileHandler::INDEX_S_AUTH_CODE, PaymentFileHandler::INDEX_S_MERCHANT_TRANS_ID, PaymentFileHandler::INDEX_S_CONSUMER_ID, PaymentFileHandler::INDEX_S_MERCHANT_SUB_ID); foreach ($indices as $index) { if (!isset($fileArr[$index])) { $fileArr[$index] = array('Select...'); } // save the Select... string $select = array_shift($fileArr[$index]); // limit on the number of entires while (count($fileArr[$index]) > $this->_limit) { array_shift($fileArr[$index]); } // now put the Select.. string back array_unshift($fileArr[$index], $select); } return $fileArr; }
* limitations under the License. */ require __DIR__ . '/../config.php'; require_once __DIR__ . '/../lib/Util/FileUtil.php'; use Att\Api\Util\FileUtil; $statusNotifications = array(); $fileArr = FileUtil::loadArray($statusFile); foreach ($fileArr as $statusNotification) { $dInfoNotification = $statusNotification['deliveryInfoNotification']; $dInfo = $dInfoNotification['deliveryInfo']; $msgId = $dInfoNotification['messageId']; $addr = preg_replace('/\\d\\d\\d($)/', '***${1}', $dInfo['address']); $deliveryStatus = $dInfo['deliveryStatus']; $statusNotifications[] = array($msgId, $addr, $deliveryStatus); } $mmsNotificationsArr = FileUtil::loadArray($imagesDbPath); $mmsNotifications = array(); $nsize = count($mmsNotificationsArr); for ($i = $nsize - $mmsLimit; $i < $nsize; ++$i) { if ($i < 0) { continue; } $mmsNotification = $mmsNotificationsArr[$i]; if (isset($mmsNotification['text'])) { $fpath = __DIR__ . '/../' . $mmsNotification['text']; $mmsNotification['text'] = file_get_contents($fpath); } else { $mmsNotification['text'] = '-'; } $mmsNotifications[] = $mmsNotification; }
* Copyright 2015 AT&T * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require __DIR__ . '/../config.php'; require_once __DIR__ . '/../lib/Util/FileUtil.php'; use Att\Api\Util\FileUtil; $msgs = array(); $msgsArr = FileUtil::loadArray(MSGS_FILE); foreach ($msgsArr as $msgsArrEntry) { $msgs[] = array($msgsArrEntry['MessageId'], $msgsArrEntry['DateTime'], $msgsArrEntry['SenderAddress'], $msgsArrEntry['DestinationAddress'], $msgsArrEntry['DestinationAddress']); } $statuses = array(); $statusesArr = FileUtil::loadArray(STATUS_FILE); foreach ($statusesArr as $statusesArrEntry) { $info = $statusesArrEntry['deliveryInfoNotification']; $dinfo = $info['deliveryInfo']; $statuses[] = array($info['messageId'], $dinfo['address'], $dinfo['deliveryStatus']); } echo json_encode(array('messages' => $msgs, 'deliveryStatus' => $statuses)); /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
use Att\Api\Util\FileUtil; use Att\Api\Util\Util; if (isset($_SESSION['subscriptionExpiry'])) { $tnow = time(); $expiry = $_SESSION['subscriptionExpiry']; if ($tnow >= $expiry) { unset($_SESSION['subscriptionId']); } } if (!isset($_SESSION['subscriptionId'])) { $arr = array('stopPolling' => true); echo json_encode($arr); return; } $subscriptionId = $_SESSION['subscriptionId']; $arr = FileUtil::loadArray(NOTIFICATION_FILE); $vals = array(); foreach ($arr as $msgNotifications) { foreach ($msgNotifications as $subscriptionNotifications) { $subId = $subscriptionNotifications['subscriptionId']; if ($subId != $subscriptionId) { continue; } $callbackData = $subscriptionNotifications['callbackData']; $notificationEvents = $subscriptionNotifications['notificationEvents']; foreach ($notificationEvents as $evt) { $vals[] = Util::convertNulls(array($subId, $callbackData, $evt['messageId'], $evt['conversationThreadId'], $evt['eventType'], $evt['event'], $evt['text'], $evt['isTextTruncated'], $evt['isFavorite'], $evt['isUnread'])); } } } echo json_encode($vals);
public function handleRequest() { // handle transactions $this->handleNewTransaction(); $this->handleTransactionAuthCode(); $this->handleGetTransactionStatus(); $this->handleTransRefund(); // handle subscriptions $this->handleNewSubscription(); $this->handleSubscriptionAuthCode(); $this->handleGetSubscriptionStatus(); $this->handleGetSubscriptionDetails(); $this->handleSubCancel(); $this->handleSubRefund(); // handle part notary $this->handleNotary(); // load file contents $this->setFileResults(); // notification information $this->results['notifications'] = FileUtil::loadArray('notifications.db'); // notary if (isset($_SESSION['notary'])) { $this->results['notary'] = unserialize($_SESSION['notary']); } }
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */ require_once __DIR__ . '/../lib/Util/FileUtil.php'; use Att\Api\Util\FileUtil; $path = __DIR__; $fname = $path . '/status.db'; $postBody = file_get_contents('php://input'); $asArray = true; $messageInfo = json_decode($postBody, $asArray); $statusarr = FileUtil::loadArray($fname); $statusarr[] = $messageInfo; // TODO: Put value into config while (count($statusarr) > 5) { array_shift($statusarr); } FileUtil::saveArray($statusarr, $fname);
<?php require_once __DIR__ . '/lib/Payment/NotificationDetails.php'; require_once __DIR__ . '/lib/Util/FileUtil.php'; use Att\Api\Payment\NotificationDetails; use Att\Api\Util\FileUtil; $rawXml = file_get_contents('php://input'); $details = NotificationDetails::fromXml($rawXml); $arr = array('type' => $details->getNotificationType(), 'timestamp' => $details->getTimestamp(), 'effective' => $details->getEffective(), 'networkOperatorId' => $details->getNetworkOperatorId(), 'ownerIdentifier' => $details->getOwnerIdentifier(), 'purchaseDate' => $details->getPurchaseDate(), 'productIdentifier' => $details->getProductIdentifier(), 'purchaseActivityIdentifier' => $details->getPurchaseActivityIdentifier(), 'instanceIdentifier' => $details->getInstanceIdentifier(), 'minIdentifier' => $details->getMinIdentifier(), 'oldMinIdentifier' => $details->getOldMinIdentifier(), 'sequenceNumber' => $details->getSequenceNumber(), 'reasonCode' => $details->getReasonCode(), 'reasonMessage' => $details->getReasonMessage(), 'vendorPurchaseIdentifier' => $details->getVendorPurchaseIdentifier()); $notifications = FileUtil::loadArray('notifications.db'); $notifications[] = $arr; // limit on the number of entires // TODO: Get limit from config while (count($notifications) > 5) { array_shift($notifications); } FileUtil::saveArray($notifications, 'notifications.db');
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */ require_once __DIR__ . '/../config.php'; require_once __DIR__ . '/../lib/Util/FileUtil.php'; use Att\Api\Util\FileUtil; $postBody = file_get_contents('php://input'); $messageInfo = json_decode($postBody, true); $msgsarr = FileUtil::loadArray(MSGS_FILE); // TODO: Put value into config while (count($msgsarr) > 5) { array_shift($msgsarr); } $msgsarr[] = $messageInfo; FileUtil::saveArray($msgsarr, MSGS_FILE);
<?php require __DIR__ . '/../config.php'; require_once __DIR__ . '/../lib/Util/FileUtil.php'; require_once __DIR__ . '/../lib/Util/Util.php'; use Att\Api\Util\FileUtil; use Att\Api\Util\Util; $postBody = file_get_contents('php://input'); if (strpos($postBody, "<SenderAddress>tel:+") == 0) { exit; } if (!is_dir($imagesPath)) { mkdir($imagesPath); } $messages = FileUtil::loadArray($imagesDbPath); $message = array(); preg_match("@<SenderAddress>tel:(.*)</SenderAddress>@i", $postBody, $matches); $addr = $matches[1]; $message["address"] = preg_replace('/\\d\\d\\d($)/', '***${1}', $addr); preg_match("@<subject>(.*)</subject>@i", $postBody, $matches); $message["subject"] = $matches[1]; $message["date"] = Util::getServerTime(); $message["id"] = count($messages); mkdir($imagesPath . '/' . $message["id"]); $boundaryParts = explode("--Nokia-mm-messageHandler-BoUnDaRy", $postBody); foreach ($boundaryParts as $mimePart) { if (!preg_match("@BASE64@", $mimePart)) { continue; } $mmPart = explode("BASE64", $mimePart); $filename = null;
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */ require_once __DIR__ . '/../lib/Util/FileUtil.php'; use Att\Api\Util\FileUtil; $path = __DIR__; $fname = $path . '/msgs.db'; $postBody = file_get_contents('php://input'); $asArray = true; $messageInfo = json_decode($postBody, $asArray); $msgsarr = FileUtil::loadArray($fname); // TODO: Put value into config while (count($msgsarr) > 5) { array_shift($msgsarr); } $msgsarr[] = $messageInfo; FileUtil::saveArray($msgsarr, $fname);