Beispiel #1
0
 protected function conn()
 {
     isset($this->username);
     isset($this->password);
     if (!$this->db instanceof PDO) {
         $this->db = DB_Connect::getInstance($this->dsn, $this->username, $this->password);
     }
 }
Beispiel #2
0
set_include_path($ini_path);
// Include functions.
require_once 'functions.php';
$registry = new Registry();
/*{START_INI_DIR}*/
$registry->ini_dir = realpath(__SITE_PATH . '/../../uthando/ini');
/*{END_INI_DIR}*/
$registry->config = new Config($registry, array('path' => $registry->ini_dir . '/uthando.ini.php'));
$registry->ushop_config = new Config($registry, array('path' => $registry->ini_dir . '/ushop.ini.php'));
$core = $registry->config->get('core', 'DATABASE') . '.';
$user = $registry->config->get('user', 'DATABASE') . '.';
try {
    // connect user to database.
    $dsn = array('hostspec' => $registry->config->get('hostspec', 'DATABASE'), 'phptype' => $registry->config->get('phptype', 'DATABASE'), 'database' => $registry->config->get('user', 'DATABASE'));
    $dsn = array_merge($dsn, $registry->config->get('DATABASE_USER'));
    $db = DB_Connect::getInstance($dsn['phptype'] . ":host=" . $dsn['hostspec'] . ";dbname=" . $dsn['database'], $dsn['username'], $dsn['password']);
    $paypal = new Payment_Paypal_IPN($registry);
    if ($paypal->validateIPN()) {
        $verified = array();
        // check invoice.
        if (isset($paypal->ipn_data['invoice'])) {
            $stmt = $db->prepare("\n\t\t\t\tSELECT order_id\n\t\t\t\tFROM " . $user . "ushop_orders\n\t\t\t\tWHERE invoice = :invoice\n\t\t\t\tLIMIT 1\n\t\t\t");
            $stmt->execute(array(':invoice' => $paypal->ipn_data['invoice']));
            $res = $stmt->fetch(PDO::FETCH_OBJ);
            $verified['order_id'] = $res->order_id;
        } else {
            $verified['order_id'] = false;
        }
        // check payment status
        if ($paypal->ipn_data['payment_status'] == "Completed") {
            $verified['payment_status'] = true;