예제 #1
0
 public function logValidationErrors($send, $errors)
 {
     $error = utils::captureString($errors);
     $sql = "INSERT INTO log_validation_errors (destinations, error, datetime, ip) VALUES ('{$send['destinations']}', '{$error}', NOW() ,INET_ATON('{$this->ip}') ) \n";
     mysql::i()->query($sql);
     $send['destinations'] = utils::formatPhoneNumber($send['originator']);
     $send['body'] = 'There was an error. Please check and try again or call ' . config::get('lost_bag_number');
     utils::recursiveCall('sendSMS', $send, 1);
 }
예제 #2
0
 public function api()
 {
     //unfinished
     echo $sql = "SELECT clientMessageReference FROM log_outbound_sms WHERE received=false AND status='LIVE'  \n";
     //and clientMessageReference = 191
     $q = mysql::i()->query($sql);
     while ($r = mysql::i()->fetch_array($q)) {
         $class = utils::recursiveCall('getSMSStatus', $r, 1);
         //$class->
         sleep(1);
         //unset($class);
     }
 }
예제 #3
0
define("SITE", "");
include_once 'init.inc.php';
$lock = 'nolock';
config::set('process_name', "Text Anywhere - TEST Send SMS");
include_once 'start.inc.php';
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
try {
    $vars['clientMessageReference'] = '999';
    // create new reference using primary key from database
    $vars['destinations'] = '';
    $vars['body'] = 'This is a test message';
    utils::recursiveCall('sendSMS', $vars, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.inc.php';
예제 #4
0
chdir('../');
include_once 'init.inc.php';
config::set('process_name', "Text Anywhere - Test Service");
include_once 'start.inc.php';
//config::set('script_folder',SITE);
//set_include_path(SET_INCLUDE_PATH.PATH.'api'.PATH.'api'.DIR.'textanywhere'.PATH);
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
//include('start.php');
try {
    $vars['returnCSVString'] = false;
    echo getcwd();
    utils::recursiveCall('testService', $vars, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    $status->status(CRITICAL);
}
include 'end.inc.php';
예제 #5
0
<?php

chdir('C:/xampp/htdocs/');
include_once 'init.php';
config::set('process_name', "Text Anywhere - Get Premium SMS Inbound");
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
include 'start.php';
try {
    $vars['returnCSVString'] = false;
    $vars['shortcode'] = '555';
    $vars['keyword'] = 'SOME KEYWORD';
    utils::recursiveCall('getPremiumSMSInbound', $vars, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.php';
예제 #6
0
chdir('../');
include_once 'init.inc.php';
config::set('process_name', "Text Anywhere - Send Premium SMS");
include_once 'start.inc.php';
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
try {
    $log = new log_database();
    $send['rbid'] = '879762236';
    $send['body'] = 'This is a test message';
    $send['clientMessageReference'] = $log->logOutboundSMS($send);
    utils::recursiveCall('sendPremiumSMS', $send, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.inc.php';
예제 #7
0
<?php

chdir('C:/xampp/htdocs/tag/');
include_once 'init.php';
config::set('process_name', "Text Anywhere - Get SMS Status");
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
include 'start.php';
try {
    $vars['returnCSVString'] = false;
    $vars['clientMessageReference'] = '1';
    // create new reference using primary key from database
    utils::recursiveCall('getSMSStatus', $vars, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.php';
예제 #8
0
<?php

chdir('C:/xampp/htdocs/');
include_once 'init.php';
config::set('process_name', "Text Anywhere - Get Credits Left");
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
include 'start.php';
try {
    $vars['returnCSVString'] = false;
    utils::recursiveCall('getCreditsLeft', $vars, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.php';
예제 #9
0
 private function sendSMStoCustomer($row, $message, $expirydate = '')
 {
     $tag_type = strtolower(trim($row['tag_type']));
     debug::output("SMS: {$row['telephone']}, {$row['tag_type']}");
     //$clientMessageReference = $thos->log->logSMS('sendSMS', $telephone);
     $send['destinations'] = utils::formatPhoneNumber($row['telephone']);
     switch ($message) {
         case "INACTIVE":
             switch ($tag_type) {
                 case "paper":
                     $send['body'] = "Tag {$row['tag_no']} has expired. Text PIN RENEW {$row['tag_no']} to renew for 3 months, or text PIN CANCEL {$row['tag_no']}. Text cost £1.50";
                     break;
                 case "plastic":
                     $send['body'] = "Tag {$row['tag_no']} has expired. Text PIN RENEW {$row['tag_no']} to renew for 12 months, or text PIN CANCEL {$row['tag_no']}. Text cost £3.00";
                     //$send['body'] = 'Text YES to renew for 12 months, text cost £tbc, text NO to cancel';
                     break;
                 default:
             }
             break;
         case "DURATION":
             switch ($tag_type) {
                 case "paper":
                     $send['body'] = "Tag {$row['tag_no']} will expire on {$expirydate}. Text PIN RENEW {$row['tag_no']} to renew for 3 months, or text PIN CANCEL {$row['tag_no']}. Text cost £1.50";
                     //$send['body'] = 'Text YES to renew for 3 months, text cost £1.50, text NO to cancel';
                     break;
                 case "plastic":
                     $send['body'] = "Tag {$row['tag_no']} will expire on {$expirydate}. Text PIN RENEW {$row['tag_no']} to renew for 12 months, or text PIN CANCEL {$row['tag_no']}. Text cost £3.00";
                     //$send['body'] = 'Text YES to renew for 12 months, text cost £tbc, text NO to cancel';
                     break;
                 default:
             }
             break;
         default:
     }
     utils::recursiveCall('sendSMS', $send, 1, $live);
 }
예제 #10
0
파일: sms.class.php 프로젝트: Git-Host/sms
 protected function sendSMS($debug = '')
 {
     utils::recursiveCall('sendSMS', $this->send, 1, $debug);
     sleep(1);
 }
예제 #11
0
파일: tag.class.php 프로젝트: Git-Host/sms
 public function checkTagValidityDatabase($tags, $phone_number, $live)
 {
     foreach ($this->valid_tags as $tag) {
         $tag_no = utils::extractTagNo($tag);
         echo $sql = "SELECT * FROM group_tags WHERE tag = '{$tag_no}' \n";
         $q = mysql::i()->query($sql);
         $r = mysql::i()->fetch_array($q);
         if (empty($r)) {
             unset($this->valid_tags[$tag]);
             $this->invalid_tags[$tag] = $tag;
             $send['destinations'] = $phone_number;
             echo $send['body'] = 'Tag ' . $tag . ' is not recognised by our system please. Please check and try again or call ' . config::get('lost_bag_number');
             utils::recursiveCall('sendSMS', $send, 1, $live);
             $valid = false;
         }
         if ($r['action'] == 'USED') {
             unset($this->valid_tags[$tag]);
             $this->invalid_tags[$tag] = $tag;
             $send['destinations'] = $phone_number;
             echo $send['body'] = 'Tag ' . $tag . ' is already in use. Please check and try again or call ' . config::get('lost_bag_number');
             utils::recursiveCall('sendSMS', $send, 1, $live);
             $valid = false;
         }
         $type = $r['tag_type'];
         if ($type == 'paper') {
             $cost += '1.50';
         } else {
             $cost = 0;
         }
         $this->valid_tags[$tag] = $r;
         $this->valid_tags[$tag]['cost'] = $cost;
         //$this->tagData[$tag]['type'] = $type;
         //$this->tagData[$tag]['authorised'] = 1;
         unset($cost);
     }
     //foreach
     //$this->tagData['cost'] = $cost;
     return $valid;
 }
예제 #12
0
<?php

chdir('../');
include_once 'init.inc.php';
$lock = 'nolock';
config::set('process_name', "Inbox - Register Email Address Reminder");
include_once 'start.inc.php';
try {
    $sql = "SELECT * FROM customer WHERE email='' AND approved=1 AND telephone<>'' AND username<>'' \n";
    $q = mysql::i()->query($sql);
    while ($r = mysql::i()->fetch_array($q)) {
        $send['destinations'] = utils::formatPhoneNumber($r['telephone']);
        $send['body'] = "Account {$r['username']} does not have a valid email address to recieve lost bag reports. Please log on to example.com to update your details. Text PIN STOP to cancel";
        utils::recursiveCall('sendSMS', $send, 1);
    }
} catch (emailException $e) {
    debug::output($e->getMessage());
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.inc.php';
예제 #13
0
<?php

chdir('C:/xampp/htdocs/');
include_once 'init.php';
config::set('process_name', "Text Anywhere - Get SMS Reply");
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
include 'start.php';
try {
    $vars['returnCSVString'] = false;
    $vars['clientMessageReference'] = '1';
    // create new reference using primary key from database
    utils::recursiveCall('getSMSReply', $vars, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.php';
예제 #14
0
<?php

chdir('C:/xampp/htdocs/');
include_once 'init.php';
config::set('process_name', "Text Anywhere - Get Subscribers");
if ($_GET['argv1']) {
    $arg = $_GET['argv1'];
} else {
    $arg = $argv[1];
}
switch ($arg) {
    case "test":
        $live = false;
        break;
    case "live":
        $live = true;
        break;
    default:
        $live = false;
}
include 'start.php';
try {
    $vars['returnCSVString'] = false;
    utils::recursiveCall('getSubscribers', $vars, 1, $live);
} catch (Exception $e) {
    debug::output($e->getMessage());
    //$status->status(CRITICAL);
}
include 'end.php';
예제 #15
0
 public function old()
 {
     $originator = $cleanData['originator'];
     $destination = $cleanData['destination'];
     $clientmessagereference = $cleanData['clientmessagereference'];
     $date = $cleanData['date'];
     $time = $cleanData['time'];
     $body = $cleanData['body'];
     $rbid = $cleanData['rbid'];
     $log = new log_database();
     $log->logTagActivation($cleanData);
     $send['returnCSVString'] = false;
     $send['clientBillingReference'] = '0';
     $send['clientMessageReference'] = '1';
     // create new reference using primary key from database
     $send['originator'] = ORIGINATOR;
     $send['destinations'] = '';
     $send['validity'] = '1';
     $send['characterSetID'] = 2;
     $send['replyMethodID'] = 2;
     $send['replyData'] = config::get('ta_replyemail');
     $send['StatusNotificationUrl'] = '';
     if (stristr($body, ORIGINATOR)) {
         $body = trim(str_ireplace(ORIGINATOR, '', $body));
         $tags = explode(',', $body);
         //check PIN ID valid against expected format
         $validity = parent::checkTagValidityBasic($tags);
         if ($validity == false) {
             $send['body'] = 'One or more tags are not being recognised by our system please check and try again.';
             utils::recursiveCall('sendSMS', $send, 1, $live);
             $valid = false;
         } else {
             //check PIN ID valid against database
             $tagData = parent::checkTagValidityDatabase($tags);
             if ($tagData == false) {
                 $send['body'] = 'There seems to be a problem please call XXXXXXX';
                 utils::recursiveCall('sendSMS', $send, 1, $live);
                 $valid = false;
             } else {
                 $cost = $tagData['cost'];
                 $send['body'] = 'Tags are valid and ready to be activated, text YES to proceed or STOP to cancel, text cost &pound;' . $cost . ' for 3 month membership for paper tags. Plastic tags attract a years membership for FREE';
                 utils::recursiveCall('sendSMS', $send, 1, $live);
                 $valid = true;
             }
             //else pins valid
         }
         //pins ok
     } elseif (stristr($body, 'YES')) {
         //creat user account using existing function
         $username = '';
         $password = '';
         $send['body'] = 'Your account has been successfully created, please log in using username ' . $username . ' and password ' . $password . ' to enter your email address.';
         utils::recursiveCall('sendSMS', $send, 1, $live);
         $valid = true;
     } elseif (stristr($body, 'STOP')) {
         //opt out
         //add recipient to suppression list. Use this list to ensure recipient is not contacted accidentily
         echo "add recipient to suppression list. Use this list to ensure recipient is not contacted accidentily";
         $valid = true;
     } else {
         //not a valid response. log details
         echo "not a valid response. log details";
         $valid = false;
     }
     debug::output($send['body']);
 }