Exemple #1
0
 private function validateResponse()
 {
     validator::loadDictionaries(array('TextAnywhereAPIResponse'));
     validator::validateInput($this->result);
     $this->cleanData = validator::getCleanData();
     $errors = validator::getErrors();
     if (!empty($errors)) {
         $this->logdb->logValidationErrors($this->result, $errors);
         exit;
     }
 }
Exemple #2
0
include_once 'init.inc.php';
config::set('process_name', "AirDB - Process CSV");
include_once 'start.inc.php';
try {
    $file_location = '/airdb.csv';
    debug::output("Processing file: {$file_location}");
    $csv = new csvparser($file_location);
    mysql::i()->query("truncate airports_backup");
    mysql::i()->query("insert into airports_backup select * from airports");
    mysql::i()->query("truncate airports");
    validator::loadDictionaries(array('AirDB'));
    $iata = array('BKN', 'AAS', 'BOO');
    $air = array();
    foreach ($csv as $row) {
        //print_r($row);
        validator::validateInput($row);
        $cleanData = validator::getCleanData();
        $errors = validator::getErrors();
        if (!empty($errors)) {
            print_r($errors);
            exit;
        }
        $cleanData['Airport'] = str_replace(']', '', str_replace('[', '', $cleanData['Airport']));
        $sql = "INSERT INTO airports (ICAO,IATA,place,state,airport,country) VALUES ('{$cleanData['ICAO']}','{$cleanData['IATA']}','{$cleanData['Place']}','{$cleanData['State']}','{$cleanData['Airport']}','{$cleanData['Country']}') ";
        mysql::i()->query($sql);
        //if(in_array($cleanData['IATA'], $iata))continue;
        //print_r($cleanData);
        //print_r($cleanData);
        /*
        		if(in_array($cleanData['IATA'], $air)){
        			if($air[$cleanData['IATA']]['Country'] == 'USA'){
Exemple #3
0
 protected function send()
 {
     $sc = $this->soap->open($this->soapPath);
     $this->vars['method'] = $this->method;
     $method = ucfirst($this->method);
     validator::loadDictionaries(array(ucfirst($this->method)));
     validator::validateInput($this->vars);
     $cleanData = validator::getCleanData();
     $errors = validator::getErrors();
     if (empty($errors)) {
         if ($this->live == true) {
             $result = $sc->__call($method, array($this->params));
             if (!empty($this->vars['body'])) {
                 debug::output('***************LIVE SENDING START***************');
                 debug::output($this->vars['body']);
                 debug::output('***************LIVE SENDING END***************');
             }
             $resultMethod = $method . 'Result';
             //Dynamic method name dependent on the class name
             $this->response = $result->{$resultMethod};
             sleep(10);
             //give the api time to report the message status
             debug::output("\n");
             debug::output('***************LIVE CHECK DELIVERY START***************');
             $smsstatus = new smsstatus($this->vars);
             $this->fault = $smsstatus->database();
             debug::output('***************LIVE CHECK DELIVERY END***************');
         } else {
             //else dev
             //log for DEV
             //print_r($this->params);
             //$this->logdb->updateLogOutboundSMS($this->params);
             if (!empty($this->vars['body'])) {
                 debug::output('***************LIVE SENDING START***************');
                 debug::output($this->vars['body']);
                 debug::output('***************LIVE SENDING END***************');
             }
         }
         //else dev
     } else {
         debug::output("There were errors in the data to be sent");
         $logdb->logValidationErrors($this->vars, $errors);
     }
 }
Exemple #4
0
 private function sendold()
 {
     $sc = $this->soap->open($this->soapPath);
     $this->vars['method'] = $this->method;
     $method = ucfirst($this->method);
     /*echo "VARS: ";
     		print_r($this->vars);
     		echo "END VARS";*/
     validator::loadDictionaries(array(ucfirst($this->method)));
     validator::validateInput($this->vars);
     $cleanData = validator::getCleanData();
     $errors = validator::getErrors();
     /*	echo "clean:";
     			print_r($cleanData);
     			print_r($errors);
     			echo "END clean";*/
     if (empty($errors)) {
         if ($this->live == true) {
             $result = $sc->__call($method, array($this->params));
             $resultMethod = $method . 'Result';
             //Dynamic method name dependent on the class name
             $this->response = $result->{$resultMethod};
             $logf = new log_file('/api/textanywhere/');
             $logf->request($this->method, $this->vars, $this->count);
             $logf->response($this->method, $this->response, $this->count);
         }
         //if live
     } else {
         debug::output("There were errors in the data to be sent");
         $logdb->logValidationErrors($this->vars, $errors);
     }
 }