本文整理汇总了PHP中db_get_fields函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_fields函数的具体用法?PHP db_get_fields怎么用?PHP db_get_fields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_fields函数的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_update_epayph_settings
function fn_update_epayph_settings($settings)
{
if (isset($settings['pp_statuses'])) {
$settings['pp_statuses'] = serialize($settings['pp_statuses']);
}
foreach ($settings as $setting_name => $setting_value) {
Settings::instance()->updateValue($setting_name, $setting_value);
}
//Get company_ids for which we should update logos. If root admin click 'update for all', get all company_ids
if (isset($settings['pp_logo_update_all_vendors']) && $settings['pp_logo_update_all_vendors'] == 'Y') {
$company_ids = db_get_fields('SELECT company_id FROM ?:companies');
$company_id = array_shift($company_ids);
} elseif (!Registry::get('runtime.simple_ultimate')) {
$company_id = Registry::get('runtime.company_id');
} else {
$company_id = 1;
}
//Use company_id as pair_id
fn_attach_image_pairs('epayph_logo', 'epayph_logo', $company_id);
if (isset($company_ids)) {
foreach ($company_ids as $logo_id) {
fn_clone_image_pairs($logo_id, $company_id, 'epayph_logo');
}
}
}
示例3: fn_projects_remove_pages
function fn_projects_remove_pages()
{
$pages = db_get_fields("SELECT page_id FROM ?:pages WHERE page_type = ?s ", PAGE_TYPE_PROJECTS);
foreach ($pages as $page_id) {
fn_delete_page($page_id, $recurse = true);
}
}
示例4: fn_rus_pickpoint_uninstall
function fn_rus_pickpoint_uninstall()
{
$service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'pickpoint');
db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids);
db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids);
db_query('DROP TABLE IF EXISTS ?:rus_pickpoint_postamat');
}
示例5: 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);
}
示例6: backup
/**
* Makes a full backup of store
*
* @return bool true if successfully created
*/
public static function backup($params = array())
{
$tables = db_get_fields('SHOW TABLES');
$default_params = array('compress' => 'zip', 'db_tables' => $tables, 'db_schema' => true, 'db_data' => true, 'move_progress' => true);
$pack_name = !empty($params['pack_name']) ? $params['pack_name'] : date('dMY_His', TIME);
$destination_path = fn_get_cache_path(false) . 'tmp/backup/';
$params = array_merge($default_params, $params);
$files = self::backupFiles($params);
$dump = self::backupDatabase($params);
fn_rm($destination_path . $pack_name);
fn_mkdir($destination_path . $pack_name);
fn_copy($files, $destination_path . $pack_name);
fn_mkdir($destination_path . $pack_name . '/var/restore/');
fn_copy($dump, $destination_path . $pack_name . '/var/restore/');
fn_rm($files);
fn_rm($dump);
if (!empty($params['compress'])) {
fn_set_progress('echo', __('compressing_backup'), false);
$ext = $params['compress'] == 'tgz' ? '.tgz' : '.zip';
$result = fn_compress_files($pack_name . $ext, $pack_name, $destination_path);
fn_rm($destination_path . $pack_name);
if ($result) {
// Move archive to backups directory
$result = fn_rename($destination_path . $pack_name . $ext, Registry::get('config.dir.backups') . $pack_name . $ext);
if ($result) {
return Registry::get('config.dir.backups') . $pack_name . $ext;
}
}
return false;
} else {
return $destination_path . $pack_name;
}
}
示例7: fn_yml_export_update_product_pre
function fn_yml_export_update_product_pre(&$product_data, $product_id, $lang_code, $can_update)
{
if (!empty($product_data['yml2_delivery_options'])) {
foreach ($product_data['yml2_delivery_options'] as $index => $delivery_option) {
if (fn_is_empty($delivery_option)) {
unset($product_data['yml2_delivery_options'][$index]);
}
}
$product_data['yml2_delivery_options'] = array_slice($product_data['yml2_delivery_options'], 0, 5);
$product_data['yml2_delivery_options'] = serialize($product_data['yml2_delivery_options']);
}
$exclude_price_ids = !empty($product_data['yml2_exclude_price_ids']) ? $product_data['yml2_exclude_price_ids'] : array();
$old_price_ids = db_get_fields("SELECT price_id FROM ?:yml_exclude_objects WHERE object_id = ?i AND object_type = 'product'", $product_id);
$data = array();
foreach ($exclude_price_ids as $price_id) {
$data[] = array('price_id' => $price_id, 'object_id' => $product_id, 'object_type' => 'product');
}
if (empty($data)) {
db_query("DELETE FROM ?:yml_exclude_objects WHERE object_id = ?i AND object_type = 'product'", $product_id);
} else {
db_query("INSERT INTO ?:yml_exclude_objects ?m ON DUPLICATE KEY UPDATE price_id=price_id", $data);
$delete_prices_ids = array_diff($old_price_ids, $exclude_price_ids);
if (!empty($delete_prices_ids)) {
db_query("DELETE FROM ?:yml_exclude_objects WHERE price_id IN (?a) AND object_type = 'product'", $delete_prices_ids);
}
}
}
示例8: fn_twigmo_remove_bm
function fn_twigmo_remove_bm()
{
$location_ids = db_get_fields("SELECT `location_id` FROM `?:bm_locations` WHERE `dispatch` LIKE '%twigmo%';");
if (!empty($location_ids)) {
db_query("DELETE FROM `?:bm_locations` WHERE `location_id` IN (?a)", $location_ids);
db_query("DELETE FROM `?:bm_locations_descriptions` WHERE `location_id` IN (?a)", $location_ids);
}
}
示例9: fn_rus_pickup_uninstall
function fn_rus_pickup_uninstall()
{
$service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'pickup');
if (!empty($service_ids)) {
db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids);
db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids);
}
}
示例10: fn_rus_spsr_uninstall
function fn_rus_spsr_uninstall()
{
$service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'spsr');
db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids);
db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids);
db_query('DROP TABLE IF EXISTS ?:rus_spsr_invoices');
db_query('DROP TABLE IF EXISTS ?:rus_spsr_register');
db_query('DROP TABLE IF EXISTS ?:rus_spsr_invoices_items');
db_query('ALTER TABLE ?:products DROP spsr_product_type');
}
示例11: fn_rus_russianpost_uninstall
function fn_rus_russianpost_uninstall()
{
$objects = fn_rus_russianpost_schema();
foreach ($objects as $object) {
$service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', $object['module']);
if (!empty($service_ids)) {
db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids);
db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids);
}
}
}
示例12: fn_set_allowed_company_ids
function fn_set_allowed_company_ids(&$conditions)
{
if (Registry::get('runtime.company_id') && !Registry::get('runtime.simple_ultimate')) {
$company_customers_ids = implode(',', db_get_fields("SELECT user_id FROM ?:orders WHERE company_id = ?i", Registry::get('runtime.company_id')));
if (Registry::get('settings.Stores.share_users') == 'Y' && !empty($company_customers_ids)) {
$conditions[] = "(users.company_id = " . Registry::get('runtime.company_id') . " OR users.user_id IN ({$company_customers_ids}))";
} else {
$conditions[] = "users.company_id = " . Registry::get('runtime.company_id');
}
}
}
示例13: fn_rus_sdek_uninstall
function fn_rus_sdek_uninstall()
{
$service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'sdek');
db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids);
db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids);
db_query('DROP TABLE IF EXISTS ?:rus_cities_sdek');
db_query('DROP TABLE IF EXISTS ?:rus_city_sdek_descriptions');
db_query('DROP TABLE IF EXISTS ?:rus_sdek_products');
db_query('DROP TABLE IF EXISTS ?:rus_sdek_register');
db_query('DROP TABLE IF EXISTS ?:rus_sdek_status');
}
示例14: fn_rus_dellin_uninstall
function fn_rus_dellin_uninstall()
{
$service_ids = db_get_fields('SELECT service_id FROM ?:shipping_services WHERE module = ?s', 'dellin');
if (!empty($service_ids)) {
db_query('DELETE FROM ?:shipping_services WHERE service_id IN (?a)', $service_ids);
db_query('DELETE FROM ?:shipping_service_descriptions WHERE service_id IN (?a)', $service_ids);
}
db_query('DROP TABLE IF EXISTS ?:rus_dellin_cities');
$file_dir = fn_get_files_dir_path() . "dellin/";
fn_rm($file_dir);
}
示例15: fn_import_check_translations_lang_code
function fn_import_check_translations_lang_code(&$primary_object_id, &$object, &$processed_data, &$skip_record)
{
static $valid_codes = array();
if (empty($valid_codes)) {
$valid_codes = db_get_fields('SELECT lang_code FROM ?:languages');
}
if (!in_array($object['lang_code'], $valid_codes)) {
$skip_record = true;
$processed_data['S']++;
}
}