function uninstall()
 {
     global $application;
     $tables = Configuration::getTables();
     $columns = $tables['store_settings']['columns'];
     $query = new DB_Delete('store_settings');
     $query->WhereValue($columns['name'], DB_EQ, STOREFRONT_ACTIVE_SKIN);
     $application->db->getDB_Result($query);
 }
 function deleteFPLinksFromCategory($category_id, $fp_ids)
 {
     global $application;
     $tables = $this->getTables();
     $fp_table = $tables['fp_links']['columns'];
     $query = new DB_Delete('fp_links');
     $query->WhereValue($fp_table['category_id'], DB_EQ, $category_id);
     $query->WhereAND();
     $query->Where($fp_table['fp_id'], DB_IN, "(" . implode(", ", $fp_ids) . ")");
     $application->db->PrepareSQL($query);
     return $application->db->DB_Exec();
 }
 function deleteRPLinksFromProduct($product_id, $rp_ids)
 {
     global $application;
     $tables = $this->getTables();
     $rp_table = $tables['rp_links']['columns'];
     $query = new DB_Delete('rp_links');
     $query->WhereValue($rp_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($rp_table['rp_id'], DB_IN, "(" . implode(", ", $rp_ids) . ")");
     $application->db->PrepareSQL($query);
     return $application->db->DB_Exec();
 }
 function dropMessageGroupByMetaId($prefix)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['resource_labels']['columns'];
     $query = new DB_Delete('resource_labels');
     $query->WhereValue($tr['res_prefix'], DB_EQ, $prefix);
     $application->db->getDB_Result($query);
 }
 /**
  * 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);
 }
 function dropActivationKey($val, $type = 'key_value')
 {
     if (!in_array($type, array('key_value', 'customer_account')) or !is_string($val)) {
         return false;
     }
     global $application;
     $tables = $this->getTables();
     $keys_table = $tables['ca_activation_keys']['columns'];
     $query = new DB_Delete('ca_activation_keys');
     $query->WhereValue($keys_table[$type], DB_EQ, $val);
     $application->db->PrepareSQL($query);
     return $application->db->DB_Exec();
 }
Esempio n. 7
0
 /**
  *
  */
 function clearDB($session_id = "")
 {
     global $application;
     if (!$session_id) {
         $session_id = session_id();
     }
     $tables = $this->getTables();
     $table = 'crypto_keys';
     $k = $tables[$table]['columns'];
     $query = new DB_Delete('crypto_keys');
     $query->WhereValue($k["id"], DB_EQ, $session_id);
     $application->db->getDB_Result($query);
 }
 function delFilesFromProduct($product_id, $files_ids)
 {
     global $application;
     $tables = $this->getTables();
     $file_table = $tables['pf_files']['columns'];
     $query = new DB_Select();
     $query->addSelectField($file_table['file_path']);
     $query->WhereValue($file_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($file_table['file_id'], DB_IN, '(\'' . implode('\',\'', $files_ids) . '\')');
     $query->WhereAND();
     $query->WhereValue($file_table['is_uploaded'], DB_EQ, 'Y');
     $res = $application->db->getDB_Result($query);
     $this->unlinkFiles($res);
     $query = new DB_Delete('pf_files');
     $query->WhereValue($file_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($file_table['file_id'], DB_IN, '(\'' . implode('\',\'', $files_ids) . '\')');
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
     return;
 }
 function clearAttributesForCardType($type)
 {
     global $application;
     $tables = Configuration::getTables();
     $attributes = $tables['credit_card_attributes_to_types']['columns'];
     $query = new DB_Delete('credit_card_attributes_to_types');
     $query->WhereValue($attributes['type'], DB_EQ, $type);
     $application->db->getDB_Result($query);
 }
Esempio n. 10
0
/**
 * Removes option by name. Prevents removal of protected Avactis options.
 *
 * @package Avactis
 * @subpackage Option
 * @since 4.7.5
 *
 *
 * @param string $option Name of option to remove.
 */
function asc_delete_option($option)
{
    global $application;
    $option = trim($option);
    if (empty($option)) {
        return false;
    }
    $result = asc_get_option($option);
    if ($result) {
        $tables = Configuration::getTables();
        $tr = $tables['options']['columns'];
        $db_delete = new DB_Delete('options');
        $db_delete->WhereValue($tr['option_name'], DB_EQ, $option);
        $application->db->PrepareSQL($db_delete);
        $application->db->DB_Exec();
        /**
         * Fires after a specific option has been deleted.
         *
         * The dynamic portion of the hook name, `$option`, refers to the option name.
         *
         * @param string $option Name of the deleted option.
         */
        do_action("asc_delete_option_{$option}", $option);
        return true;
    } else {
        return '';
    }
}
 /**
  * deletes set and it's rates from DB
  *
  * @param int $sid
  */
 function deleteSetFromDB($sid)
 {
     global $application;
     // delete file, if present
     $set = $this->getSet($sid);
     if (isset($set[0]['filename'])) {
         $fullpath = $application->getAppIni("PRODUCT_FILES_DIR") . "TaxRateByZip_CSVs/" . $set[0]['filename'];
         if (is_file($fullpath)) {
             unlink($fullpath);
         }
     }
     // delete set
     $tables = TaxRateByZip::getTables();
     $table = "tax_zip_sets";
     $columns = $tables[$table]['columns'];
     $query = new DB_Delete($table);
     $query->WhereValue($columns['id'], DB_EQ, $sid);
     $application->db->getDB_Result($query);
     // delete set rates
     $this->clearSetInDB($sid);
 }
Esempio n. 12
0
 /**
  * @ describe the function Modules_Manager->uninstallModule.
  * @param ModuleInfo $moduleInfo
  */
 function uninstallModule($moduleInfo)
 {
     global $application;
     if ($moduleInfo->name == 'Modules_Manager') {
         return;
         //  it can't reinstall itself
     }
     // start module insatllation,
     // use the static method call install()
     $modname = $moduleInfo->name;
     $this->includeAPIFileOnce($modname);
     call_user_func(array($modname, 'uninstall'));
     //  delete from the specified module list
     $tables = $this->getTables();
     $module_tbl = 'module';
     $module_columns = $tables[$module_tbl]['columns'];
     $module_class_tbl = 'module_class';
     $module_class_columns = $tables[$module_class_tbl]['columns'];
     $db_select = new DB_Select();
     $db_select->addSelectTable($module_tbl);
     $db_select->addSelectField($module_columns['id']);
     $db_select->WhereValue($module_columns['name'], DB_EQ, $moduleInfo->name);
     list(list($moduleId)) = $application->db->getDB_Result($db_select, QUERY_RESULT_NUM);
     $getAllExtensionTables = array_keys($modname::getTables());
     foreach ($getAllExtensionTables as $table) {
         if (DB_MySQL::DB_isTableExists($application->getAppIni('DB_TABLE_PREFIX') . $table)) {
             $del_query = new DB_Table_Delete($table);
             $application->db->getDB_Result($del_query);
         }
     }
     /*Remove extension directory if this is an extension -- BEGIN */
     $directory = $application->getAppIni('PATH_ADD_MODULES_DIR') . strtolower($moduleInfo->name) . "/";
     if (is_dir($directory)) {
         modApiFunc('Shell', 'removeDirectory', $directory);
     }
     /*Remove extension directory if this is an extension -- END */
     // delete all linked records from module_class
     $db_delete = new DB_Delete($module_class_tbl);
     $db_delete->WhereValue($module_class_columns['module_id'], DB_EQ, $moduleId);
     $application->db->getDB_Result($db_delete);
     // delete a record from module
     $db_delete = new DB_Delete($module_tbl);
     $db_delete->WhereValue($module_columns['id'], DB_EQ, $moduleId);
     $application->db->getDB_Result($db_delete);
     CCacheFactory::clearAll();
 }
 function removeEmails($num, $emails_count)
 {
     global $application;
     $tables = $this->getTables();
     $table = 'newsletter_temp';
     $query = new DB_Delete($table);
     $query->WhereValue($tables[$table]['columns']['recipient_num'], DB_EQ, $num);
     $query->DeleteOrder($tables[$table]['columns']['recipient_id'], 'ASC');
     $query->DeleteLimit($emails_count);
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
 }
 /**
  * Clears the table Inventory Tracking for one product.
  * (If necessary, it can be rewritten for clearing the table Inventory
  * Tracking for several products).
  *
  * @param string $parent_entity - entity name
  * @param int $entity_id - ID of the entity the table should be cleared for.
  * @return bool; true if the table is cleared, false otherwise
  */
 function __clearITForEntity($parent_entity, $entity_id)
 {
     global $application;
     $tables = $this->getTables();
     $it_table = $tables['po_inventory']['columns'];
     $query = new DB_Delete('po_inventory');
     $query->WhereValue($it_table['parent_entity'], DB_EQ, $parent_entity);
     $query->WhereAND();
     $query->WhereValue($it_table['entity_id'], DB_EQ, $entity_id);
     $application->db->PrepareSQL($query);
     if ($application->db->DB_Exec()) {
         //            $this->updateOptionsSettingsForEntity($parent_entity,$entity_id,array('IT_ACTUAL'=>'Y'));
         return true;
     } else {
         return false;
     }
 }
Esempio n. 15
0
 function deleteTaxRate($id)
 {
     global $application;
     $tables = $this->getTables();
     $tr = $tables['tax_rates']['columns'];
     $query = new DB_Delete('tax_rates');
     $query->WhereValue($tr['id'], DB_EQ, $id);
     $application->db->getDB_Result($query);
 }
 function delImagesFromProduct($product_id, $images_ids, $del_from_server)
 {
     global $application;
     $tables = $this->getTables();
     $imgs_table = $tables['pi_images']['columns'];
     $query = new DB_Select();
     $query->addSelectField($imgs_table['image_path']);
     $query->addSelectField($imgs_table['thumb_path']);
     $query->WhereValue($imgs_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($imgs_table['image_id'], DB_IN, '(\'' . implode('\',\'', $images_ids) . '\')');
     $res = $application->db->getDB_Result($query);
     if (strcmp($del_from_server, 'yes') == 0) {
         $this->unlinkFiles($res);
     }
     $query = new DB_Delete('pi_images');
     $query->deleteMultiLangField($imgs_table['alt_text'], $imgs_table['image_id'], 'Product_Images');
     $query->WhereValue($imgs_table['product_id'], DB_EQ, $product_id);
     $query->WhereAND();
     $query->Where($imgs_table['image_id'], DB_IN, '(\'' . implode('\',\'', $images_ids) . '\')');
     $application->db->getDB_Result($query);
     return;
 }
 function removeCustomInfoTag($tagname)
 {
     global $application;
     $tagname = '{' . $tagname . '}';
     $tables = $this->getTables();
     $ni = $tables['notification_infotags']['columns'];
     $i2a = $tables['infotags_to_action']['columns'];
     // checking if the infotag exists
     $query = new DB_Select();
     $query->addSelectField($ni['id'], 'id');
     $query->WhereValue($ni['name'], DB_EQ, $tagname);
     $result = $application->db->getDB_Result($query);
     if (empty($result)) {
         return;
     }
     foreach ($result as $tag) {
         $id = $tag['id'];
         $query = new DB_Delete('infotags_to_action');
         $query->WhereValue($i2a['ni_id'], DB_EQ, $id);
         $application->db->getDB_Result($query);
         $query = new DB_Delete('notification_infotags');
         $query->WhereValue($ni['id'], DB_EQ, $id);
         $application->db->getDB_Result($query);
     }
 }
 function setLetterTopics($letter_id, $topics_ids)
 {
     global $application;
     if (!is_array($topics_ids)) {
         $topics_ids = array($topics_ids);
     }
     $tables = $this->getTables();
     $ntables = modApiFunc('Newsletter', 'getTables');
     $ltable = 'newsletter_topics';
     $lcolumns =& $ntables[$ltable]['columns'];
     $dquery = new DB_Delete($ltable);
     $dquery->WhereValue($lcolumns['letter_id'], DB_EQ, $letter_id);
     $application->db->getDB_Result($dquery);
     $iquery = new DB_Multiple_Insert($ltable);
     $iquery->setModifiers(DB_IGNORE);
     $iquery->setInsertFields(array('letter_id', 'topic_id'));
     foreach ($topics_ids as $topic_id) {
         $iquery->addInsertValuesArray(array('letter_id' => $letter_id, 'topic_id' => $topic_id));
     }
     $application->db->getDB_Result($iquery);
 }
Esempio n. 19
0
 /**
  * Deletes old records in the news table.
  * After that <= NEWS_MAX_COUNT records remain.
  */
 function deleteOldNews()
 {
     global $application;
     $tables = $this->getTables();
     $columns = $tables['news']['columns'];
     # select the latest date piece of news among the remain ones in the table...
     $query = new DB_Select('news');
     $query->addSelectField($columns['date'], 'NewsDate');
     $query->SelectOrder($columns['date'], 'DESC');
     $query->SelectLimit($this->settings[NEWS_MAX_COUNT] - 1, 1);
     $result = $application->db->getDB_Result($query);
     if ($result == NULL) {
         return;
     }
     # ...delete all the latest news @ check this line
     $query = new DB_Delete('news');
     $query->WhereValue($columns['date'], DB_LT, $result[0]['NewsDate']);
     $query->WhereAND();
     $query->WhereValue($columns['type'], DB_EQ, 'avactis');
     $application->db->getDB_Result($query);
 }
 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 string $event_name
  * @param string $handler_class
  * @param string $handler_method
  */
 function removeEventHandler($event_name, $handler_class, $handler_method)
 {
     global $application;
     $tables = EventsManager::getTables();
     $tbl_events = $tables['events_manager']['columns'];
     $query = new DB_Delete('events_manager');
     $query->WhereValue($tbl_events['event_name'], DB_EQ, $event_name);
     $query->WhereAND();
     $query->WhereValue($tbl_events['handler_class'], DB_EQ, $handler_class);
     $query->WhereAND();
     $query->WhereValue($tbl_events['handler_method'], DB_EQ, $handler_method);
     $application->db->getDB_Result($query);
 }
Esempio n. 22
0
 function update_pm_sm_currency_settings($module_id, $module_settings)
 {
     global $application;
     loadCoreFile('db_multiple_insert.php');
     //The list of modules,which should become selected.
     $tables = Checkout::getTables();
     //                                                     pm_sm_accepted_currencies
     //    pm_sm_currency_acceptance_rules.
     $cpsac = $tables['checkout_pm_sm_accepted_currencies']['columns'];
     $query = new DB_Delete('checkout_pm_sm_accepted_currencies');
     $query->WhereValue($cpsac['module_id'], DB_EQ, $module_id);
     $application->db->getDB_Result($query);
     $cpscar = $tables['checkout_pm_sm_currency_acceptance_rules']['columns'];
     $query = new DB_Delete('checkout_pm_sm_currency_acceptance_rules');
     $query->WhereValue($cpscar['module_id'], DB_EQ, $module_id);
     $application->db->getDB_Result($query);
     //                      (      )                                   pm_sm_accepted_currencies
     //    pm_sm_currency_acceptance_rules.
     if (sizeof($module_settings["accepted_currencies"]) > 0) {
         $query = new DB_Multiple_Insert('checkout_pm_sm_accepted_currencies');
         $query->setInsertFields(array($cpsac['module_id'], $cpsac['currency_code'], $cpsac['currency_status']));
         foreach ($module_settings["accepted_currencies"] as $info) {
             $row = array($cpsac['module_id'] => $module_id, $cpsac['currency_code'] => $info['currency_code'], $cpsac['currency_status'] => $info['currency_status']);
             $query->addInsertValuesArray($row);
         }
         $application->db->PrepareSQL($query);
         $application->db->DB_Exec();
     }
     if (sizeof($module_settings["currency_acceptance_rules"]) > 0) {
         $query = new DB_Multiple_Insert('checkout_pm_sm_currency_acceptance_rules');
         $query->setInsertFields(array($cpscar['module_id'], $cpscar['rule_name'], $cpscar['rule_selected']));
         foreach ($module_settings["currency_acceptance_rules"] as $info) {
             $row = array($cpscar['module_id'] => $module_id, $cpscar['rule_name'] => $info['rule_name'], $cpscar['rule_selected'] => $info['rule_selected']);
             $query->addInsertValuesArray($row);
         }
         $application->db->PrepareSQL($query);
         $application->db->DB_Exec();
     }
 }
Esempio n. 23
0
 function removePages($csv)
 {
     global $application;
     loadCoreFile('csv_parser.php');
     $csv_parser = new CSV_Parser();
     $tables = MenuManager::getTables();
     $table = 'admin_pages';
     $columns = $tables[$table]['columns'];
     list($flt, $pages) = $csv_parser->parse_file($csv);
     if (count($pages) > 0) {
         foreach ($pages as $key => $page) {
             $query = new DB_Delete($table);
             $query->WhereValue($columns['identifier'], DB_EQ, $page["identifier"]);
             $application->db->getDB_Result($query);
         }
     }
 }