示例#1
0
 private function buildCreateTableQuery()
 {
     $definition = array();
     foreach ($this->fields as $name => $def) {
         $definition[] = "`" . $name . "` " . $def;
     }
     if ($this->primarykey != "") {
         $definition[] = "PRIMARY KEY (`" . $this->primarykey . "`)";
     }
     foreach ($this->indexes as $name => $def) {
         $definition[] = $def;
     }
     $q = "CREATE TABLE `" . $this->name . "` (" . implode(", ", $definition) . ")";
     if ($this->comment != "") {
         $q .= " COMMENT='" . $this->db->escape($this->comment) . "'";
     }
     return $q;
 }
示例#2
0
 /**
  * Funzione per salvare il risultato in propay_transactions e fare il cambio stato ordine
  * @param int transaction_id incrementale da processare
  * @param string Codice risultato (OK, KO, AB...)
  * @param string Esito metodo pagamento
  * @param string Codice dello stato da impostare all'ordine (se vuoto niente callback)
  * @param string Numero ordine da processare
  * @param int ID del metodo di pagamento VM
  * @param string Eventuali commento da aggiungere
  * @return boolean TRUE se andato a buon fine, FALSE in caso contrario
  */
 private function saveAndSendCallback($transaction_id, $result, $esito, $status = "", $order_number = "", $virtuemart_paymentmethod_id = 0, $comment = "")
 {
     // scrivo il risultato nella tabella delle transazioni
     $values = array("result" => $result, "esito" => $esito, "status" => $status);
     if (!$this->db->queryUpdate("#__propay_transactions", $values, "WHERE transaction_id=" . $transaction_id)) {
         return FALSE;
     }
     if ($status != "") {
         $lang = substr($this->LANG->getLanguage(), 0, 2);
         $url = $this->getBaseUrl() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component&lang=' . $lang;
         $data = array("on" => $order_number, "pm" => $virtuemart_paymentmethod_id, "transaction_id" => $transaction_id, "comment" => $comment);
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         $response = curl_exec($ch);
         if ($response === FALSE) {
             $error = curl_error($ch);
             $this->errorLog("Errore nella chiamata pluginnotification: " . $error);
             $result = false;
         } else {
             $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
             // il codice di ritorno positivo è 200
             if ($httpcode == "200") {
                 $result = true;
             } else {
                 $this->errorLog("Errore HTTP nella chiamata pluginnotification! Codice errore: " . $httpcode);
                 $result = false;
             }
         }
         curl_close($ch);
         return $result;
     } else {
         return TRUE;
     }
 }