本文整理汇总了PHP中db_get_field函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_field函数的具体用法?PHP db_get_field怎么用?PHP db_get_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_get_seo_rules
function fn_get_seo_rules($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
$lang_code = fn_get_corrected_seo_lang_code($lang_code);
$global_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' GROUP BY dispatch");
$local_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s", $lang_code);
if ($diff = array_diff($global_total, $local_total)) {
foreach ($diff as $disp) {
fn_create_seo_name(0, 's', str_replace('.', '-', $disp), 0, $disp, DESCR_SL);
}
}
// Init filter
$params = fn_init_view('seo_rules', $params);
// Set default values to input params
$params['page'] = empty($params['page']) ? 1 : $params['page'];
// default page is 1
$condition = '';
if (isset($params['name']) && fn_string_no_empty($params['name'])) {
$condition .= db_quote(" AND name LIKE ?l", "%" . trim($params['name']) . "%");
}
if (isset($params['controller']) && fn_string_no_empty($params['controller'])) {
$condition .= db_quote(" AND dispatch LIKE ?l", "%" . trim($params['controller']) . "%");
}
$limit = '';
if (!empty($items_per_page)) {
$total = db_get_field("SELECT COUNT(*) FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
$limit = fn_paginate($params['page'], $total, $items_per_page);
}
$seo_data = db_get_array("SELECT name, dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p ORDER BY dispatch {$limit}", $lang_code, $condition);
return array($seo_data, $params);
}
示例2: fn_get_seo_redirects
function fn_get_seo_redirects($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
// Init filter
$params = LastView::instance()->update('seo_redirects', $params);
// Set default values to input params
$default_params = array('page' => 1, 'items_per_page' => $items_per_page);
$params = array_merge($default_params, $params);
$condition = '';
if (isset($params['src']) && fn_string_not_empty($params['src'])) {
$condition .= db_quote(" AND src LIKE ?l", "%" . trim($params['src']) . "%");
}
if (!empty($params['type'])) {
$condition .= db_quote(" AND type = ?s", $params['type']);
}
if (!empty($params['lang_code'])) {
$condition .= db_quote(" AND lang_code = ?s", $params['lang_code']);
}
$condition .= fn_get_seo_company_condition('?:seo_redirects.company_id');
$limit = '';
if (!empty($params['items_per_page'])) {
$params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:seo_redirects WHERE 1 ?p", $condition);
$limit = db_paginate($params['page'], $params['items_per_page']);
}
$seo_redirects = db_get_hash_array("SELECT * FROM ?:seo_redirects WHERE 1 ?p ORDER BY src {$limit}", 'redirect_id', $condition);
if (!empty($seo_redirects)) {
foreach ($seo_redirects as $key => $seo_redirect) {
$seo_redirects[$key]['parsed_url'] = fn_generate_seo_url_from_schema($seo_redirect);
}
}
return array($seo_redirects, $params);
}
示例3: fn_update_product_filter
function fn_update_product_filter($filter_data, $filter_id, $lang_code = DESCR_SL)
{
if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) {
if (!empty($filter_id) && !fn_check_company_id('product_filters', 'filter_id', $filter_id)) {
fn_company_access_denied_notification();
return false;
}
if (!empty($filter_id)) {
unset($filter_data['company_id']);
}
}
// Parse filter type
if (strpos($filter_data['filter_type'], 'FF-') === 0 || strpos($filter_data['filter_type'], 'RF-') === 0 || strpos($filter_data['filter_type'], 'DF-') === 0) {
$filter_data['feature_id'] = str_replace(array('RF-', 'FF-', 'DF-'), '', $filter_data['filter_type']);
$filter_data['feature_type'] = db_get_field("SELECT feature_type FROM ?:product_features WHERE feature_id = ?i", $filter_data['feature_id']);
} else {
$filter_data['field_type'] = str_replace(array('R-', 'B-'), '', $filter_data['filter_type']);
$filter_fields = fn_get_product_filter_fields();
}
if (!empty($filter_id)) {
db_query('UPDATE ?:product_filters SET ?u WHERE filter_id = ?i', $filter_data, $filter_id);
db_query('UPDATE ?:product_filter_descriptions SET ?u WHERE filter_id = ?i AND lang_code = ?s', $filter_data, $filter_id, $lang_code);
} else {
$filter_data['filter_id'] = $filter_id = db_query('INSERT INTO ?:product_filters ?e', $filter_data);
foreach (fn_get_translation_languages() as $filter_data['lang_code'] => $_d) {
db_query("INSERT INTO ?:product_filter_descriptions ?e", $filter_data);
}
}
fn_set_hook('update_product_filter', $filter_data, $filter_id, $lang_code);
return $filter_id;
}
示例4: fn_get_banner_name
function fn_get_banner_name($banner_id, $lang_code = CART_LANGUAGE)
{
if (!empty($banner_id)) {
return db_get_field("SELECT banner FROM ?:banner_descriptions WHERE banner_id = ?i AND lang_code = ?s", $banner_id, $lang_code);
}
return false;
}
示例5: processWebHook
public function processWebHook($data)
{
$data = $this->service->processWebHook($data);
if (empty($data['action'])) {
return false;
}
if ($data['action'] == 'subscribe') {
fn_em_update_subscriber($data, 0, false);
} elseif ($data['action'] == 'unsubscribe') {
$subscriber_id = db_get_field("SELECT subscriber_id FROM ?:em_subscribers WHERE email = ?s", $data['email']);
if (!empty($subscriber_id)) {
fn_em_delete_subscribers(array($subscriber_id), false);
}
} elseif ($data['action'] == 'update') {
$subscriber_id = db_get_field("SELECT subscriber_id FROM ?:em_subscribers WHERE email = ?s", $data['old_email']);
if (!empty($subscriber_id)) {
fn_em_update_subscriber($data, $subscriber_id, false);
}
} elseif ($data['action'] == 'email_update') {
$subscriber_id = db_get_field("SELECT subscriber_id FROM ?:em_subscribers WHERE email = ?s", $data['old_email']);
if (!empty($subscriber_id)) {
fn_em_update_subscriber(array('email' => $data['new_email']), $subscriber_id, false);
}
}
}
示例6: fn_twg_exim_get_product_mobile_url
/**
* Gets mobile product url
*
* @param $product_id
* @param string $lang_code
* @return bool
*/
function fn_twg_exim_get_product_mobile_url($product_id, $lang_code = '')
{
$company_id = 0;
$company_url = '';
if (fn_allowed_for('ULTIMATE')) {
if (Registry::get('runtime.company_id')) {
$company_id = Registry::get('runtime.company_id');
} else {
$company_id = db_get_field('SELECT company_id FROM ?:products WHERE product_id = ?i', $product_id);
}
$company_url = '&company_id=' . $company_id;
} else {
$company_url = '';
}
$settings = TwigmoSettings::get('customer_connections.' . $company_id);
$use_twg = !empty($settings['access_id']) && ($settings['use_for_phones'] == 'Y' || $settings['use_for_tablets'] == 'Y');
if ($use_twg && fn_twg_use_https_for_customer($company_id)) {
$protocol = 'https';
} else {
$protocol = 'http';
}
$url = fn_url('products.view?product_id=' . $product_id . $company_url, 'C', $protocol, $lang_code);
fn_set_hook('exim_get_product_url', $url, $product_id, $options, $lang_code);
return $url;
}
示例7: import
public function import($db_already_cloned)
{
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
General::processAddons($this->store_data, __CLASS__);
General::setEmptyProgressBar(General::getUnavailableLangVar('updating_languages'));
General::updateAltLanguages('language_values', 'name');
General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
General::updateAltLanguages('shipping_service_descriptions', 'service_id');
General::updateAltLanguages('privilege_descriptions', 'privilege');
General::updateAltLanguages('privilege_section_descriptions', 'section_id');
General::updateAltLanguages('state_descriptions', 'state_id');
General::updateAltLanguages('country_descriptions', 'code');
General::processBlocks();
General::setEmptyProgressBar();
if (db_get_field("SHOW TABLES LIKE '?:mailing_lists'")) {
db_query("ALTER TABLE ?:mailing_lists DROP `show_on_sidebar`");
}
return true;
}
示例8: import
public function import($db_already_cloned)
{
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
General::backupSettings();
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
$payflow_enabled = db_get_field("SELECT processor_params FROM ?:payments WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')");
if (!empty($payflow_enabled)) {
$payflow_params = unserialize($payflow_enabled);
unset($payflow_params['country']);
$payflow_params['currency'] = 840;
db_query("UPDATE ?:payments SET processor_params = ?s WHERE processor_id = (SELECT processor_id FROM ?:payment_processors WHERE processor_script = 'payflow_pro.php')", serialize($payflow_params));
}
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例9: fn_get_single_map_data
function fn_get_single_map_data($order_info, $auth = null)
{
$data = array();
$data["order_date"] = date('d-m-Y', $order_info['timestamp']);
$data["email"] = $order_info['email'];
$data["customer_name"] = $order_info['firstname'] . ' ' . $order_info['lastname'];
$data["order_id"] = $order_info['order_id'];
$products = $order_info['products'];
$products_arr = array();
$currencies = Registry::get('currencies');
$currency = isset($order_info['secondary_currency']) ? $currencies[$order_info['secondary_currency']] : $currencies[CART_SECONDARY_CURRENCY];
#modified by Hungryweb 12.10.2015
//$data["currency_iso"] = $currency['currency_code'];
$data["currency_iso"] = 'USD';
foreach ($products as $product) {
$product_id = is_array($product) ? $product['product_id'] : intval($product);
$product_data = array();
$product_data['url'] = fn_get_product_url($product_id);
#modified by Hungryweb 12.10.2015
//$product_data['name'] = fn_get_product_name($product_id,CART_LANGUAGE,false);
$product_data['name'] = fn_specific_development_get_category($product['product_id']) . ' ' . fn_get_product_name($product_id, CART_LANGUAGE, false);
$product_data['description'] = db_get_field("SELECT full_description FROM ?:product_descriptions WHERE product_id = ?i AND lang_code = ?s", $product_id, CART_LANGUAGE);
if (isset($product_data['description'])) {
$product_data['description'] = strip_tags(html_entity_decode($product_data['description'], ENT_NOQUOTES, 'UTF-8'));
}
$product_data['image'] = fn_get_product_image_url($product_id);
$price = is_array($product) ? $product['base_price'] : fn_get_product_price($product_id, 1, $auth);
$product_data['price'] = fn_format_rate_value($price, 'F', '2', '.', ',', $currency['coefficient']);
$products_arr[$product_id] = $product_data;
}
$data['products'] = $products_arr;
return $data;
}
示例10: fn_get_seo_rules
function fn_get_seo_rules($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
$condition = fn_get_seo_company_condition('?:seo_names.company_id');
$lang_code = fn_get_corrected_seo_lang_code($lang_code);
$global_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' ?p GROUP BY dispatch", $condition);
$local_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
if ($diff = array_diff($global_total, $local_total)) {
foreach ($diff as $disp) {
fn_create_seo_name(0, 's', str_replace('.', '-', $disp), 0, $disp, '', DESCR_SL);
}
}
// Init filter
$params = LastView::instance()->update('seo_rules', $params);
// Set default values to input params
$default_params = array('page' => 1, 'items_per_page' => $items_per_page);
$params = array_merge($default_params, $params);
if (isset($params['name']) && fn_string_not_empty($params['name'])) {
$condition .= db_quote(" AND name LIKE ?l", "%" . trim($params['name']) . "%");
}
if (isset($params['rule_params']) && fn_string_not_empty($params['rule_params'])) {
$condition .= db_quote(" AND dispatch LIKE ?l", "%" . trim($params['rule_params']) . "%");
}
$limit = '';
if (!empty($params['items_per_page'])) {
$params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
$limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
}
$seo_data = db_get_array("SELECT name, dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p ORDER BY dispatch {$limit}", $lang_code, $condition);
return array($seo_data, $params);
}
示例11: import
public function import($db_already_cloned)
{
General::setProgressTitle(__CLASS__);
if (!$db_already_cloned) {
if (!General::cloneImportedDB($this->store_data)) {
return false;
}
} else {
General::setEmptyProgressBar(__('importing_data'));
General::setEmptyProgressBar(__('importing_data'));
}
General::connectToOriginalDB(array('table_prefix' => General::formatPrefix()));
General::processAddons($this->store_data, __CLASS__);
$main_sql = Registry::get('config.dir.addons') . 'store_import/database/' . $this->main_sql_filename;
if (is_file($main_sql)) {
//Process main sql
if (!db_import_sql_file($main_sql)) {
return false;
}
}
// General::restoreSettings();
if (db_get_field("SELECT status FROM ?:addons WHERE addon = 'searchanise'") != 'D') {
db_query("UPDATE ?:addons SET status = 'D' WHERE addon = 'searchanise'");
fn_set_notification('W', __('warning'), General::getUnavailableLangVar('uc_searchanise_disabled'));
}
General::setActualLangValues();
General::updateAltLanguages('language_values', 'name');
General::updateAltLanguages('ult_language_values', array('name', 'company_id'));
General::updateAltLanguages('settings_descriptions', array('object_id', 'object_type'));
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
General::setEmptyProgressBar();
return true;
}
示例12: processUa
public static function processUa($ua)
{
$result = 'unknown';
if (!file_exists(TWIGMO_UA_RULES_FILE)) {
return $result;
}
$rules = unserialize(fn_get_contents(TWIGMO_UA_RULES_FILE));
if (!is_array($rules)) {
return $result;
}
$ua_meta = self::getUaMeta($ua, $rules);
// Save stat
foreach ($ua_meta as $section => $value) {
$where = array('section' => $section, 'value' => $value, 'month' => date('Y-m-1'));
$count = db_get_field('SELECT count FROM ?:twigmo_ua_stat WHERE ?w', $where);
if ($count) {
db_query('UPDATE ?:twigmo_ua_stat SET count=count+1 WHERE ?w', $where);
} else {
$where['count'] = 1;
db_query('INSERT INTO ?:twigmo_ua_stat ?e', $where);
}
}
if ($ua_meta['device'] and in_array($ua_meta['device'], array('phone', 'tablet'))) {
$result = $ua_meta['device'];
}
return $result;
}
示例13: fn_delete_feature
function fn_delete_feature($feature_id)
{
$feature_type = db_get_field("SELECT feature_type FROM ?:product_features WHERE feature_id = ?i", $feature_id);
if ($feature_type == 'G') {
$fids = db_get_fields("SELECT feature_id FROM ?:product_features WHERE parent_id = ?i", $feature_id);
if (!empty($fids)) {
foreach ($fids as $fid) {
fn_delete_feature($fid);
}
}
}
db_query("DELETE FROM ?:product_features WHERE feature_id = ?i", $feature_id);
db_query("DELETE FROM ?:product_features_descriptions WHERE feature_id = ?i", $feature_id);
db_query("DELETE FROM ?:product_features_values WHERE feature_id = ?i", $feature_id);
$v_ids = db_get_fields("SELECT variant_id FROM ?:product_feature_variants WHERE feature_id = ?i", $feature_id);
// Delete variant images
foreach ($v_ids as $v_id) {
fn_delete_image_pairs($v_id, 'feature_variant');
}
db_query("DELETE FROM ?:product_feature_variants WHERE feature_id = ?i", $feature_id);
db_query("DELETE FROM ?:product_feature_variant_descriptions WHERE variant_id IN (?n)", $v_ids);
$filter_ids = db_get_fields("SELECT filter_id FROM ?:product_filters WHERE feature_id = ?i", $feature_id);
foreach ($filter_ids as $_filter_id) {
fn_delete_product_filter($_filter_id);
}
}
示例14: fn_add_bean_bag_filling_apply_option_modifiers_post
function fn_add_bean_bag_filling_apply_option_modifiers_post($product_options, &$base_value, $type, $orig_options, $orig_value, $fields, $extra)
{
if (AREA == 'A') {
return;
//var_dump($_REQUEST); die();
//var_dump($product_options, $base_value, $type, $orig_options, $orig_value, $fields, $extra); die();
if (!empty($product_options) && $type == 'P') {
$opt = array_pop($product_options);
if ($opt == "346") {
$bean_bag_150 = Registry::get('addons.add_bean_bag_filling.bean_bag_filling_150');
$bean_bag_300 = Registry::get('addons.add_bean_bag_filling.bean_bag_filling_300');
$exist_bean_bag_150 = db_get_field("SELECT product_id FROM ?:products WHERE product_id = ?i", $bean_bag_150);
$exist_bean_bag_300 = db_get_field("SELECT product_id FROM ?:products WHERE product_id = ?i", $bean_bag_300);
$p_prices = db_get_hash_array("SELECT price, product_id FROM ?:product_prices WHERE product_id in (?n)", 'product_id', array($exist_bean_bag_150, $exist_bean_bag_300));
$p_data = db_get_row("SELECT bean_bag_filling_150, bean_bag_filling_300, bean_bag_quantity_150, bean_bag_quantity_300 FROM ?:products WHERE product_id = ?i", $extra['product_data']['product_id']);
$mod_ = 0;
//fn_write_die($p_data);
$price_ = 0;
if (!empty($p_data['bean_bag_quantity_150']) && $p_data['bean_bag_filling_150'] == 'Y' && !empty($exist_bean_bag_150)) {
$mod_ += $p_data['bean_bag_quantity_150'] * $p_prices[$exist_bean_bag_150]['price'];
$price_ += $mod_;
}
if (!empty($p_data['bean_bag_quantity_300']) && $p_data['bean_bag_filling_300'] == 'Y' && !empty($exist_bean_bag_300)) {
$mod_ += $p_data['bean_bag_quantity_300'] * $p_prices[$exist_bean_bag_300]['price'];
$price_ += $mod_;
}
}
$base_value += $price_;
}
return $base_value;
}
//var_dump($base_value); die();
}
示例15: fn_retargeting_get_main_category
function fn_retargeting_get_main_category($product_id, $lang_code = DESCR_SL)
{
$category = '';
if (!empty($product_id)) {
$category = db_get_field("SELECT ?:category_descriptions.category FROM ?:category_descriptions RIGHT JOIN ?:products_categories ON ?:category_descriptions.category_id = ?:products_categories.category_id AND ?:products_categories.product_id = ?i AND link_type = 'M' WHERE lang_code = ?s", $product_id, $lang_code);
}
return $category;
}