function __delRateFromCache($from, $to)
 {
     global $application;
     $tables = $this->getTables();
     $rc_table = $tables['cconv_rates_cache']['columns'];
     $query = new DB_Delete('cconv_rates_cache');
     $query->addWhereOpenSection();
     $query->WhereValue($rc_table['from'], DB_EQ, $from);
     $query->WhereAnd();
     $query->WhereValue($rc_table['to'], DB_EQ, $to);
     $query->addWhereCloseSection();
     $query->WhereOR();
     $query->addWhereOpenSection();
     $query->WhereValue($rc_table['from'], DB_EQ, $to);
     $query->WhereAND();
     $query->WhereValue($rc_table['to'], DB_EQ, $from);
     $query->addWhereCloseSection();
     $application->db->getDB_Result($query);
     return;
 }
 /**
  *
  *
  * @param
  * @return
  */
 function decrypt($name, $encrypted_string)
 {
     if (!$name && !$encrypted_string) {
         return $encrypted_string;
     }
     global $application;
     $session_id = session_id();
     $tables = $this->getTables();
     $table = 'crypto_keys';
     $k = $tables[$table]['columns'];
     $query = new DB_Select();
     $query->addSelectField($k["key"], "crypto_key");
     $query->WhereValue($k["id"], DB_EQ, $session_id);
     $query->WhereAnd();
     $query->WhereValue($k["name"], DB_EQ, $name);
     $result = $application->db->getDB_Result($query);
     if (isset($result[0]['crypto_key']) && $result[0]['crypto_key']) {
         $key = $result[0]['crypto_key'];
         $query = new DB_Delete($table);
         $query->WhereValue($k["id"], DB_EQ, $session_id);
         $query->WhereAnd();
         $query->WhereValue($k["name"], DB_EQ, $name);
         $application->db->getDB_Result($query);
         $blowfish = new Crypt_Blowfish($key);
         $blowfish->setKey($key);
         $string = $blowfish->decrypt($encrypted_string);
     } else {
         return "";
     }
     return $string;
 }
 /**
  * Deletes data of specified variant_info from the order.
  */
 function removePersonInfoOrderData($order_id, $person_info_variant_id)
 {
     global $application;
     $tables = $this->getTables();
     $opd = $tables['order_person_data']['columns'];
     $query = new DB_Delete("order_person_data");
     $query->WhereValue($opd["order_id"], DB_EQ, (int) $order_id);
     $query->WhereAnd();
     $query->WhereValue($opd["variant_id"], DB_EQ, (int) $person_info_variant_id);
     $application->db->getDB_Result($query);
 }
 /**
  * Delete absent administrators from notifications
  *
  * @param $uid user id
  */
 function deleteDeadAdminFromNotifications($uid)
 {
     global $application;
     $tables = $this->getTables();
     $nst = $tables['notification_send_to']['columns'];
     $query = new DB_Delete('notification_send_to');
     $query->WhereValue($nst['email'], DB_EQ, $uid);
     $query->WhereAnd();
     $query->WhereValue($nst['code'], DB_EQ, "EMAIL_ADMINISTRATOR");
     $application->db->getDB_Result($query);
 }