function updateStatus($errdoc_status) { global $application; $tables = Configuration::getTables(); $columns = $tables['store_settings']['columns']; $query = new DB_Update('store_settings'); $query->addUpdateValue($columns['value'], (int) $errdoc_status); $query->WhereValue($columns['name'], DB_EQ, 'enable_error_document'); $application->db->getDB_Result($query); }
function updateSettings($settings) { global $application; $tables = $this->getTables(); $stable = $tables['frg_settings']['columns']; foreach ($settings as $skey => $sval) { $query = new DB_Update('frg_settings'); $query->addUpdateValue($stable['setting_value'], $sval); $query->WhereValue($stable['setting_key'], DB_EQ, $skey); $application->db->PrepareSQL($query); $application->db->DB_Exec(); } }
function UPDATE_STATE_INFO() { parent::DB_Update('states'); }
function UPDATE_CMS_MENU_ITEM_DATA() { parent::DB_Update('cms_menu_items'); }
/** * Saves the sort of credit card types. * * @return */ function setCreditCardTypesSortOrder($ccTypesSortOrderArray) { global $application; foreach ($ccTypesSortOrderArray as $sort_order => $cc_type_id) { $tables = $this->getTables(); $columns = $tables['credit_card_settings']['columns']; $query = new DB_Update('credit_card_settings'); $query->addUpdateValue($columns['sort_order'], $sort_order); $query->WhereValue($columns['id'], DB_EQ, $cc_type_id); $application->db->getDB_Result($query); } }
function UPDATE_COLOR_SWATCH_NUMBER_LABEL() { parent::DB_Update('color_swatch'); }
function setQuantityDiscountRowActive($rate_id, $rate_status) { global $application; $tables = $this->getTables(); $columns = $tables['quantity_discounts_rates_table']['columns']; $query = new DB_Update('quantity_discounts_rates_table'); $query->addUpdateValue($columns['b_active'], $rate_status); $query->WhereValue($columns['id'], DB_EQ, $rate_id); $application->db->getDB_Result($query); }
/** * Update the value of an option that was already added. * * You do not need to serialize values. If the value needs to be serialized, then * it will be serialized before it is inserted into the database. Remember, * resources can not be serialized or added as an option. * * If the option does not exist, then the option will be added with the option * value, but you will not be able to set whether it is autoloaded. * * @since 4.7.5 * @package Avactis * @subpackage Option * * * @param string $option Option name. * @param mixed $newvalue Option value. */ function asc_update_option($option, $newvalue) { global $application; $option = trim($option); if (empty($option)) { return false; } $result = asc_get_option($option); $old_value = $result; $NewserializeVal = serialize($newvalue); if ($result) { $tables = Configuration::getTables(); $tr = $tables['options']['columns']; $query = new DB_Update('options'); $query->addUpdateValue($tr['option_value'], $NewserializeVal); $query->WhereValue($tr["option_name"], DB_EQ, $option); $application->db->PrepareSQL($query); $application->db->DB_Exec(); /** * Fires after the value of a specific option has been successfully updated. * * @param mixed $old_value The old option value. * @param mixed $value The new option value. */ do_action("asc_update_option_{$option}", $old_value, $newvalue); /** * Fires after the value of an option has been successfully updated. * * @param string $option Name of the updated option. * @param mixed $old_value The old option value. * @param mixed $value The new option value. */ do_action('asc_updated_option', $option, $old_value, $newvalue); return true; } else { asc_add_option($option, $newvalue); } }
/** * * * @param * @return */ function encrypt($name, $string) { if (!$name && !$string) { return $string; } global $application; $session_id = session_id(); $key = md5($session_id . $this->uuid()); $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']) { $query = new DB_Update($table); $query->addUpdateValue($k["key"], $key); $query->addUpdateValue($k['lifetime'], time() + 600); $query->WhereValue($k["id"], DB_EQ, $session_id); $query->WhereAnd(); $query->WhereValue($k["name"], DB_EQ, $name); $application->db->getDB_Result($query); } else { $query = new DB_Insert($table); $query->addInsertValue($session_id, $k['id']); $query->addInsertValue($name, $k['name']); $query->addInsertValue($key, $k['key']); $query->addInsertValue(time() + 600, $k['lifetime']); $application->db->getDB_Result($query); } $blowfish = new Crypt_Blowfish($key); $encrypted_string = $blowfish->encrypt($string); return $encrypted_string; }
function __install_AddAttrsVisibleNames() { global $application; $MR =& $application->getInstance('MessageResources', 'customer-account-messages', 'AdminZone'); $tables = Customer_Account::getTables(); $atg_table = $tables['ca_attrs_to_groups']['columns']; foreach ($this->attr_lang_code as $attr_id => $lang_code) { $query = new DB_Update('ca_attrs_to_groups'); $query->addUpdateValue($atg_table['visible_name'], $MR->getMessage($lang_code)); $query->WhereValue($atg_table['attr_id'], DB_EQ, $attr_id); $application->db->PrepareSQL($query); $application->db->DB_Exec(); } return; }
function UPDATE_ML_RECORD() { parent::DB_Update('multilang_data'); }
/** * Reencrypts temporary data on the server. The step of replacing RSA keys. * It selects encrypted data by chunks from the database. It reencrypts it and * saves back to the temporary table. If all data are reencrypted, returns * b_finished =true in the returned array, false otherwise. * * @param string $rsa_private_key_cryptrsa_format old RSA private key, which * was used to encrypt data, stored in the DB * @param string $new_rsa_public_key_asc_format new RSA public key, which is * used to encrypt data, decrypted by the old RSA private key. */ function ReplaceRSAKeyPairStep2ReencryptTmpData($rsa_private_key_cryptrsa_format, $new_rsa_public_key_asc_format) { global $application; $new_rsa_public_key_cryptrsa_format = modApiFunc("Crypto", "convert_rsa_public_key_from_asc_into_cryptrsa_format", $new_rsa_public_key_asc_format); /** * Read out from the temporary table 500 records at a time (empirical * value). * * Reencrypt by chunks, that have the same Blowfish key, it is about * 10 database records. The decryption of one blowfish key (RSA), if no * mathematical libraries exist, can take 10 sec. * Check the timeout after each chunk - 2 sec. * If no records are left and the timeout is over, exit. * * Write what has been reencrypted to the database. */ $tmp_table_name = "order_person_data" . $this->getTmpTableSuffix(); // TableInfo only, but not data. Refer to the table using AVACTIS. $opd_tmp_info = clone_db_table_info("Checkout", "order_person_data", $tmp_table_name); $opd_tmp = $opd_tmp_info['columns']; # get Person Info data. Total record number. $query = new DB_Select(); $query->addSelectField($query->fCount('*'), 'count'); $query->Where($opd_tmp['b_encrypted'], DB_EQ, "1"); $result = $application->db->getDB_Result($query); $n_total = $result[0]['count']; # get Person Info data. $query = new DB_Select(); $query->addSelectField($opd_tmp['id'], 'id'); $query->addSelectField($opd_tmp['value'], 'value'); $query->addSelectField($opd_tmp['encrypted_secret_key'], 'encrypted_secret_key'); $query->addSelectField($opd_tmp['rsa_public_key_asc_format'], 'rsa_public_key_asc_format'); $query->Where($opd_tmp['b_encrypted'], DB_EQ, "1"); $query->WhereAnd(); $query->Where($opd_tmp['id'], DB_GTE, $this->ReplaceRSAKeyPairStep2ReencryptTmpDataOrderPersonDataId); $query->SelectOrder($opd_tmp['id']); $query->SelectLimit(0, 500); $_person_data = $application->db->getDB_Result($query); if (sizeof($_person_data) == 0) { //No unreencrypted data is left. The reencryption is completed. return array("error_msg" => "", "b_finished" => true, "progress_position" => 1.0); } else { $i = 0; // a number of record from order_person_data $start_time = time(); while (time() - $start_time < 2) { //Process one block with the same blowfish key. $rsa_encrypted_blowfish_key = $_person_data[$i]['encrypted_secret_key']; /* If the loaded Private key doesn't match the Public key storing in the database - output an error message. Don't rewrite anything in the database. */ $old_rsa_public_key_asc_format = $_person_data[$i]['rsa_public_key_asc_format']; $old_rsa_public_key_cryptrsa_format = modApiFunc("Crypto", "convert_rsa_public_key_from_asc_into_cryptrsa_format", $old_rsa_public_key_asc_format); if (modApiFunc("Crypto", "rsa_do_public_key_match_private_key", $old_rsa_public_key_cryptrsa_format, $rsa_private_key_cryptrsa_format) === true) { //BEGIN decrypt blowfish key. $rsa_obj = new Crypt_RSA(); $blowfish_key = $rsa_obj->decrypt($rsa_encrypted_blowfish_key, $rsa_private_key_cryptrsa_format); $new_blowfish_key = modApiFunc("Crypto", "blowfish_gen_blowfish_key"); $new_encrypted_blowfish_key = $rsa_obj->encrypt($new_blowfish_key, $new_rsa_public_key_cryptrsa_format); //END decrypt blowfish key. //Bulk INSERT will increase the rate greatly! for (; $i < sizeof($_person_data) && $_person_data[$i]['encrypted_secret_key'] == $rsa_encrypted_blowfish_key; $i++) { $decrypted_value = modApiFunc("Crypto", "blowfish_decrypt", base64_decode($_person_data[$i]['value']), $blowfish_key); //Store decrypted data: $query = new DB_Update($tmp_table_name); $query->addUpdateValue($opd_tmp['value'], base64_encode(modApiFunc("Crypto", "blowfish_encrypt", $decrypted_value, $new_blowfish_key))); $query->addUpdateValue($opd_tmp['encrypted_secret_key'], $new_encrypted_blowfish_key); $query->addUpdateValue($opd_tmp['rsa_public_key_asc_format'], $new_rsa_public_key_asc_format); $query->WhereValue($opd_tmp['id'], DB_EQ, $_person_data[$i]['id']); $application->db->getDB_Result($query); $this->ReplaceRSAKeyPairStep2ReencryptTmpDataOrderPersonDataId = $_person_data[$i]['id'] + 1; $this->saveState(); //Don't lose reencrypted data and save correct number //of the last processed record. Otherwise the timeout can occur during the //SQL query and data in the session will be incorrect. } if ($i >= sizeof($_person_data)) { break; } } else { //Report an error: keys don't match. $MessageResources =& $application->getInstance('MessageResources'); $msg = $MessageResources->getMessage('CRYPTO_RSA_PUBLIC_PRIVATE_KEYS_MISMATCH_DECRYPT_ERROR'); return array("error_msg" => $msg, "b_finished" => false, "progress_position" => 0.0); } } # get Person Info data. Total record count. $query = new DB_Select(); $query->addSelectField($query->fCount('*'), 'count'); $query->Where($opd_tmp['b_encrypted'], DB_EQ, "1"); $query->WhereAnd(); $query->Where($opd_tmp['id'], DB_LT, $this->ReplaceRSAKeyPairStep2ReencryptTmpDataOrderPersonDataId); $result = $application->db->getDB_Result($query); $n_done = $result[0]['count']; return array("error_msg" => "", "b_finished" => false, "progress_position" => 1.0 * $n_done / $n_total); } }
function NLT_UPDATE_MESSAGE() { parent::DB_Update('newsletter_letters'); }
function disableMRforLayout($layout_path) { global $application; $tables = $this->getTables(); $int_table = $tables['mr_integrity']['columns']; $query = new DB_Update('mr_integrity'); $query->addUpdateValue($int_table['mr_active'], 'N'); $query->WhereValue($int_table['layout_path'], DB_EQ, $layout_path); $result = $application->db->getDB_Result($query); modApiFunc('EventsManager', 'throwEvent', 'ModRewriteChanged'); return; }
function UPDATE_CUSTOM_INPUT_TYPE_VALUES_FOR_PRODUCTS() { parent::DB_Update('product_attributes'); }
function updateImagesSortOrder($product_id, $sort_order) { global $application; $tables = $this->getTables(); $images_table = $tables['pi_images']['columns']; for ($i = 0; $i < count($sort_order); $i++) { $query = new DB_Update('pi_images'); $query->addUpdateValue($images_table['sort_order'], $i); $query->WhereValue($images_table['product_id'], DB_EQ, $product_id); $query->WhereAND(); $query->WhereValue($images_table['image_id'], DB_EQ, $sort_order[$i]); $application->db->PrepareSQL($query); $application->db->DB_Exec(); } return; }
function linkTempEmails($key) { global $application; $tables = Subscriptions::getTables(); $table = 'subscription_temp'; $columns =& $tables[$table]['columns']; $atable = 'email_address'; $acolumns =& $tables[$atable]['columns']; $query = new DB_Update($table); $query->addUpdateTable($atable); $query->addUpdateExpression($columns['email_id'], $acolumns['email_id']); $query->addUpdateValue($columns['state'], SUBSCRIPTION_TEMP_EXISTS); $query->WhereValue($columns['action_key'], DB_EQ, $key); $query->WhereAND(); $query->WhereField($columns['email'], DB_EQ, $acolumns['email']); $application->db->getDB_Result($query); $query = new DB_Update($table); $query->addUpdateValue($columns['state'], SUBSCRIPTION_TEMP_DONT_EXISTS); $query->WhereValue($columns['action_key'], DB_EQ, $key); $query->WhereAND(); $query->WhereValue($columns['state'], DB_EQ, SUBSCRIPTION_TEMP_UNKNOWN); $application->db->getDB_Result($query); }
function dropCustomerPassword($var, $var_type = 'customer_account') { if (!in_array($var_type, array('customer_account', 'customer_id'))) { return false; } global $application; $tables = $this->getTables(); $ca_table = $tables['ca_customers']['columns']; $query = new DB_Select(); $query->addSelectTable('ca_customers'); $query->addSelectField($ca_table['customer_id'], 'customer_id'); $query->addSelectField($ca_table['customer_account'], 'customer_account'); $query->WhereValue($ca_table[$var_type], DB_EQ, $var); $res = $application->db->getDB_Result($query); if (count($res) != 1) { return false; } else { $customer_id = $res[0]['customer_id']; $customer_account = $res[0]['customer_account']; } $query = new DB_Update('ca_customers'); $query->addUpdateValue($ca_table['customer_password'], $this->__genPseudoPasswd()); $query->addUpdateValue($ca_table['customer_status'], 'R'); $query->WhereValue($ca_table['customer_id'], DB_EQ, $customer_id); $application->db->PrepareSQL($query); return $application->db->DB_Exec() and $this->replaceActivationKey($customer_account); }
/** * Sets up module attributes and logs it to the database. * * @param array $Settings - module settings array. The undefined parameter values * remain unchanged. */ function updateSettings($Settings) { global $application; $tables = $this->getTables(); $columns = $tables['pm_paypal_settings']['columns']; foreach ($Settings as $key => $value) { $query = new DB_Update('pm_paypal_settings'); $query->addUpdateValue($columns['value'], serialize($value)); $query->WhereValue($columns['key'], DB_EQ, $key); $application->db->getDB_Result($query); } }
/** * Copies the part of the updateOrder($data) functionality. It is created * only, because updateOrder is too hungus for the small update. */ function updateOrderPersonDataAttribute($order_id, $person_info_variant_id, $person_attribute_id, $b_encrypted, $encrypted_symmetric_secret_key, $rsa_public_key_asc_format, $new_value) { global $application; $tables = $this->getTables(); $opd = $tables['order_person_data']['columns']; $db_update = new DB_Update('order_person_data'); $db_update->addUpdateValue($opd['value'], $new_value); $db_update->addUpdateValue($opd['encrypted_secret_key'], $encrypted_symmetric_secret_key); $db_update->addUpdateValue($opd['rsa_public_key_asc_format'], $rsa_public_key_asc_format); $db_update->WhereValue($opd['order_id'], DB_EQ, $order_id); $db_update->WhereAND(); $db_update->WhereValue($opd['attribute_id'], DB_EQ, $person_attribute_id); $db_update->WhereAND(); $db_update->WhereValue($opd['variant_id'], DB_EQ, $person_info_variant_id); $db_update->WhereAND(); $db_update->WhereValue($opd['b_encrypted'], DB_EQ, $b_encrypted ? "1" : "0"); $application->db->PrepareSQL($db_update); $application->db->DB_Exec(); }
function UPDATE_CUSTOMER_AFFILIATE_ID() { parent::DB_Update('ca_customers'); }
function setManufacturersSortOrder($params) { global $application; $tables = $this->getTables(); $mnfs_table = $tables['manufacturers']['columns']; $new_sort_order = 0; foreach ($params as $mnf_id) { $query = new DB_Update('manufacturers'); $query->addUpdateValue($mnfs_table['sort_order'], $new_sort_order); $query->WhereValue($mnfs_table['manufacturer_id'], DB_EQ, $mnf_id); $application->db->PrepareSQL($query); $application->db->DB_Exec(); $new_sort_order++; } modApiFunc('EventsManager', 'throwEvent', 'ManufacturerSortOrderUpdated', $params); }
function updateModuleStatus($uid, $new_status) { global $application; $tables = TransactionTracking::getTables(); $columns = $tables['transaction_tracking_modules']['columns']; $query = new DB_Update('transaction_tracking_modules'); $query->addUpdateValue($columns["status_active"], $new_status); $query->WhereValue($columns["module_id"], DB_EQ, $uid); $result = $application->db->getDB_Result($query); }
function updateFsRuleArea($data) { global $application; $tables = $this->getTables(); $tr = $tables['scc_fs_rules']['columns']; $query = new DB_Update('scc_fs_rules'); $query->addUpdateValue($tr['prods'], $data["prods"]); $query->addUpdateValue($tr['cats'], $data["cats"]); $query->WhereValue($tr['id'], DB_EQ, $data['fsr_id']); $application->db->getDB_Result($query); }
/** * * * @ * @param * @return */ function updateAdmin($id, $firs_name, $last_name, $e_mail, $options) { global $application; $tables = $this->getTables(); $a = $tables['admin']['columns']; $query = new DB_Update('admin'); $query->addUpdateValue($a['firstname'], $firs_name); $query->addUpdateValue($a['lastname'], $last_name); $query->addUpdateValue($a['email'], $e_mail); $query->addUpdateExpression($a['modified'], $query->fNow()); $admin_options = 0; for ($i = 1; $i <= sizeof($options); $i++) { $admin_options += $options[$i] ? pow(2, $i - 1) : 0; } $query->addUpdateValue($a['options'], $admin_options); $query->WhereValue($a['id'], DB_EQ, $id); $application->db->getDB_Result($query); }
/** * Moves the category. * * @author Alexander Girin * @param integer $newParentCatId the new category id, * to which the category is moved * @param integer $cid the moved category id * @return */ function moveCategory($newParentCatId, $cid) { global $application; $NewParentCatInfo = $this->fetchCategoryInfo($newParentCatId); $CatInfo = $this->fetchCategoryInfo($cid); $catobj = new CCategoryInfo($cid); $CurrentParentCatInfo = $catobj->getCategoryTagValue('parentid'); if ($NewParentCatInfo == FALSE || $CatInfo == FALSE) { return; } $tables = $this->getTables(); $c = $tables['categories']['columns']; # categories is a database table $deltaLevel = -($CatInfo['level'] - 1) + $NewParentCatInfo['level']; if ($NewParentCatInfo['left'] < $CatInfo['left'] && $NewParentCatInfo['right'] > $CatInfo['right'] && $NewParentCatInfo['level'] < $CatInfo['level'] - 1) { $query = new DB_Update('categories'); $query->addUpdateExpression($c['level'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['level'] . sprintf('%+d', $deltaLevel), $c['level'])); $query->addUpdateExpression($c['right'], $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . ($CatInfo['right'] + 1) . ' ' . DB_AND . ' ' . ($NewParentCatInfo['right'] - 1), $c['right'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['right'] . '+' . (($NewParentCatInfo['right'] - $CatInfo['right'] - $CatInfo['level'] + $NewParentCatInfo['level']) / 2 * 2 + $CatInfo['level'] - $NewParentCatInfo['level'] - 1), $c['right']))); $query->addUpdateExpression($c['left'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . ($CatInfo['right'] + 1) . ' ' . DB_AND . ' ' . ($NewParentCatInfo['right'] - 1), $c['left'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['left'] . '+' . (($NewParentCatInfo['right'] - $CatInfo['right'] - $CatInfo['level'] + $NewParentCatInfo['level']) / 2 * 2 + $CatInfo['level'] - $NewParentCatInfo['level'] - 1), $c['left']))); $query->WhereField($c['left'], DB_BETWEEN, "'" . ($NewParentCatInfo['left'] + 1) . "'" . ' ' . DB_AND . " '" . ($NewParentCatInfo['right'] - 1) . "'"); $application->db->getDB_Result($query); } elseif ($NewParentCatInfo['left'] < $CatInfo['left']) { $query = new DB_Update('categories'); $query->addUpdateExpression($c['level'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['level'] . sprintf('%+d', $deltaLevel), $c['level'])); $query->addUpdateExpression($c['left'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $NewParentCatInfo['right'] . ' ' . DB_AND . ' ' . ($CatInfo['left'] - 1), $c['left'] . '+' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['left'] . '-' . ($CatInfo['left'] - $NewParentCatInfo['right']), $c['left']))); $query->addUpdateExpression($c['right'], $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . $NewParentCatInfo['right'] . ' ' . DB_AND . ' ' . $CatInfo['left'], $c['right'] . '+' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['right'] . '-' . ($CatInfo['left'] - $NewParentCatInfo['right']), $c['right']))); $query->WhereField($c['left'], DB_BETWEEN, "'" . $NewParentCatInfo['left'] . "'" . ' ' . DB_AND . " '" . $CatInfo['right'] . "'"); $query->WhereOR(); $query->WhereField($c['right'], DB_BETWEEN, "'" . $NewParentCatInfo['left'] . "'" . ' ' . DB_AND . " '" . $CatInfo['right'] . "'"); $application->db->getDB_Result($query); } else { $query = new DB_Update('categories'); $query->addUpdateExpression($c['level'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['level'] . sprintf('%+d', $deltaLevel), $c['level'])); $query->addUpdateExpression($c['left'], $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['right'] . ' ' . DB_AND . ' ' . $NewParentCatInfo['right'], $c['left'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['left'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['left'] . '+' . ($NewParentCatInfo['right'] - $CatInfo['right'] - 1), $c['left']))); $query->addUpdateExpression($c['right'], $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . ($CatInfo['right'] + 1) . ' ' . DB_AND . ' ' . ($NewParentCatInfo['right'] - 1), $c['right'] . '-' . ($CatInfo['right'] - $CatInfo['left'] + 1), $query->fIf($c['right'] . ' ' . DB_BETWEEN . ' ' . $CatInfo['left'] . ' ' . DB_AND . ' ' . $CatInfo['right'], $c['right'] . '+' . ($NewParentCatInfo['right'] - $CatInfo['right'] - 1), $c['right']))); $query->WhereField($c['left'], DB_BETWEEN, "'" . $CatInfo['left'] . "'" . ' ' . DB_AND . " '" . $NewParentCatInfo['right'] . "'"); $query->WhereOR(); $query->WhereField($c['right'], DB_BETWEEN, "'" . $CatInfo['left'] . "'" . ' ' . DB_AND . " '" . $NewParentCatInfo['right'] . "'"); $application->db->getDB_Result($query); } modApiFunc('EventsManager', 'throwEvent', 'CategoryMoved', array('OLD_PARENT_CATEGORY_ID' => $CurrentParentCatInfo, 'NEW_PARENT_CATEGORY_ID' => $newParentCatId, 'CATEGORY_ID_LIST' => $cid)); }
function UPDATE_EXTENSION_STATUS() { parent::DB_Update('module'); }
function updateMd5ByMetaId($meta_id, $current_md5) { global $application; $tables = $this->getTables(); $tr = $tables['resource_meta']['columns']; $query = new DB_Update('resource_meta'); $query->addUpdateValue($tr['md5'], $current_md5); $query->WhereValue($tr['id'], DB_EQ, $meta_id); $application->db->getDB_Result($query); }
function setModuleActive($module_id, $b_active) { //The condition, where a module doesn't exist in the Checkout table // settings, and setModuleActive is called for it, should //not exist. So you can get to the place only from the page of // module settings, or by automatic operatins into the system // (for example, by adding all_inactive to the table at the begining, // when the table is empty). //In the first case to open the page of settings, the module should // be Selected, and has been added to the setting table before. //In the second case hte function setModuleActive is not called. The flag // Active is passed in within data for the function setSelectedModules. //Delete operations with the falg Active from the function setSelectedModules, // it may take much time. For all modules, which become non-Selected, // should be set the status non-Active. //But to simplify the code, they can be separated. global $application; $tables = Checkout::getTables(); $columns = $tables['checkout_pm_sm_settings']['columns']; $YES = "1"; $NO = "2"; $query = new DB_Update('checkout_pm_sm_settings'); $query->addUpdateExpression($columns['status_active_value_id'], $b_active === true ? $YES : $NO); $query->WhereValue($columns['module_id'], DB_EQ, $module_id); $application->db->getDB_Result($query); //: add the check to update only one string // If zero strings are updated, then an error occurred: the module // doesn't exist in the table. if ($b_active === true) { Checkout::setPM_SM_RequiredCurrencieslist(); } }
/** * @param $update_array array if the IDs of the available methods, * all other methods will be set to 'not available' */ function _updateShippingMethods($update_array) { global $application; $tables = $this->getTables(); $methods_table = $tables['sm_dsr_methods']['columns']; $query = new DB_Update('sm_dsr_methods'); $query->addUpdateValue($methods_table['available'], "N"); $application->db->getDB_Result($query); if (count($update_array) == 0 or !is_array($update_array)) { return; } $query = new DB_Update('sm_dsr_methods'); $query->addUpdateValue($methods_table['available'], "Y"); $query->Where($methods_table['id'], DB_IN, "('" . implode("','", array_keys($update_array)) . "')"); $application->db->getDB_Result($query); return; }