Ejemplo n.º 1
0
 function db_insert()
 {
     global $config;
     $this->payment_test = !empty($this->config['test']) || $this->payment_test;
     $payment = array('payment_module_name' => $this->manifest['name'], 'payment_status' => $this->payment_status, 'payment_provider_id' => $this->payment_provider_id, 'payment_account_id' => $this->payment_account_id, 'payment_account_name' => $this->payment_account_name, 'payment_user_id' => $this->payment_user_id, 'payment_user_name' => $this->payment_user_name, 'payment_dark_matter_paid' => $this->payment_dark_matter_paid, 'payment_dark_matter_gained' => $this->payment_dark_matter_gained, 'payment_amount' => $this->payment_amount, 'payment_currency' => $this->payment_currency, 'payment_external_id' => $this->payment_external_id, 'payment_external_amount' => $this->payment_external_amount, 'payment_external_currency' => $this->payment_external_currency, 'payment_external_date' => $this->payment_external_date, 'payment_test' => $this->payment_test ? 1 : 0, 'payment_comment' => $this->description_generated[PAYMENT_DESCRIPTION_MAX], 'payment_external_lots' => $this->payment_dark_matter_paid / get_mm_cost());
     $replace = false;
     if ($this->payment_id) {
         $payment['payment_id'] = $this->payment_id;
         $replace = true;
     }
     $query = array();
     foreach ($payment as $key => $value) {
         $value = is_string($value) ? '"' . db_escape($value) . '"' : $value;
         $query[] = "`{$key}` = {$value}";
     }
     $this->db->doquery(($replace ? 'REPLACE' : 'INSERT') . ' INTO `{{payment}}` SET ' . implode(',', $query) . ';');
     return $this->db_get_by_id($this->db->db_insert_id());
 }
Ejemplo n.º 2
0
 protected function db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe)
 {
     $provider_id_safe = intval(core_auth::$main_provider->provider_id);
     //$account_id_safe = $this->db->db_escape($this->account_id);
     $account_id_safe = intval($this->account_id);
     $account_name_safe = $this->db->db_escape($this->account_name);
     // $user_id_safe = $this->db->db_escape(core_auth::$user['id']);
     // $user_id_safe = intval(core_auth::$user['id']);
     $user_id_safe = intval($user_id_unsafe);
     $username_safe = !empty(core_auth::$user['username']) ? $this->db->db_escape(core_auth::$user['username']) : '';
     $metamatter = round(floatval($metamatter));
     $comment_safe = $this->db->db_escape($comment);
     $server_name_safe = $this->db->db_escape(SN_ROOT_VIRTUAL);
     $page_url_safe = $this->db->db_escape($_SERVER['SCRIPT_NAME']);
     $this->db->doquery("INSERT INTO {{log_metamatter}} SET\n        `provider_id` = {$provider_id_safe},\n        `account_id` = {$account_id_safe},\n        `account_name` = '{$account_name_safe}',\n        `user_id` = {$user_id_safe},\n        `username` = '{$username_safe}',\n        `reason` = {$change_type},\n        `amount` = {$metamatter},\n        `comment` = '{$comment_safe}',\n        `server_name` = '{$server_name_safe}',\n        `page` = '{$page_url_safe}'\n      ;");
     $result = $this->db->db_insert_id();
     return $result;
 }