本文整理汇总了PHP中fn_attach_image_pairs函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_attach_image_pairs函数的具体用法?PHP fn_attach_image_pairs怎么用?PHP fn_attach_image_pairs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_attach_image_pairs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fn_update_paypal_settings
function fn_update_paypal_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('paypal_logo', 'paypal_logo', $company_id);
if (isset($company_ids)) {
foreach ($company_ids as $logo_id) {
fn_clone_image_pairs($logo_id, $company_id, 'paypal_logo');
}
}
}
开发者ID:askzap,项目名称:ultimate,代码行数:25,代码来源:func.php
示例2: fn_advanced_menu_update_category_pre
function fn_advanced_menu_update_category_pre(&$category_data, $category_id, $lang_code)
{
if (isset($category_data['advanced_menu'])) {
$category_data['advanced_menu'] = serialize($category_data['advanced_menu']);
}
if (!empty($category_id)) {
fn_attach_image_pairs('menu_image', 'menu', $category_id, $lang_code);
}
}
开发者ID:ambient-lounge,项目名称:site,代码行数:9,代码来源:func.php
示例3: update
public function update($id, $params)
{
$data = array();
$status = Response::STATUS_BAD_REQUEST;
unset($params['category_id']);
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
$category_id = fn_update_category($params, $id, $lang_code);
$this->prepareImages($params, $id);
$updated = fn_attach_image_pairs('category_main', 'category', $id, DESCR_SL);
if ($category_id || $updated) {
if ($updated && fn_notification_exists('extra', '404')) {
fn_delete_notification('404');
}
$status = Response::STATUS_OK;
$data = array('category_id' => $id);
}
return array('status' => $status, 'data' => $data);
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:18,代码来源:Categories.php
示例4: fn_update_product_option
//.........这里部分代码省略.........
db_query("UPDATE ?:product_options_descriptions SET ?u WHERE option_id = ?i AND lang_code = ?s", $option_data, $option_id, $lang_code);
}
if (fn_allowed_for('ULTIMATE')) {
// options of shared product under the shared store hasn't a company_id. No necessary for updating.
if (!empty($option_data['company_id'])) {
fn_ult_update_share_object($option_id, 'product_options', $option_data['company_id']);
}
if (!empty($option_data['product_id'])) {
fn_ult_share_product_option($option_id, $option_data['product_id']);
}
}
if (!empty($option_data['variants'])) {
$var_ids = array();
// Generate special variants structure for checkbox (2 variants, 1 hidden)
if ($option_data['option_type'] == 'C') {
$option_data['variants'] = array_slice($option_data['variants'], 0, 1);
// only 1 variant should be here
reset($option_data['variants']);
$_k = key($option_data['variants']);
$option_data['variants'][$_k]['position'] = 1;
// checked variant
$v_id = db_get_field("SELECT variant_id FROM ?:product_option_variants WHERE option_id = ?i AND position = 0", $option_id);
$option_data['variants'][] = array('position' => 0, 'variant_id' => $v_id);
}
$variant_images = array();
foreach ($option_data['variants'] as $k => $v) {
if ((!isset($v['variant_name']) || $v['variant_name'] == '') && $option_data['option_type'] != 'C') {
continue;
}
// Update product options variants
if (isset($v['modifier'])) {
$v['modifier'] = floatval($v['modifier']);
if (floatval($v['modifier']) > 0) {
$v['modifier'] = '+' . $v['modifier'];
}
}
if (isset($v['weight_modifier'])) {
$v['weight_modifier'] = floatval($v['weight_modifier']);
if (floatval($v['weight_modifier']) > 0) {
$v['weight_modifier'] = '+' . $v['weight_modifier'];
}
}
// if (isset($v['set_by_user'])) {
//
// }
$v['option_id'] = $option_id;
if (empty($v['variant_id']) || !empty($v['variant_id']) && !db_get_field("SELECT variant_id FROM ?:product_option_variants WHERE variant_id = ?i", $v['variant_id'])) {
$v['variant_id'] = db_query("INSERT INTO ?:product_option_variants ?e", $v);
foreach (fn_get_translation_languages() as $v['lang_code'] => $_v) {
db_query("INSERT INTO ?:product_option_variants_descriptions ?e", $v);
}
} else {
db_query("DELETE FROM ?:product_option_variants_disabled WHERE product_id=?i AND option_id =?i AND variant_id=?i", $option_data['extraProductId'], $option_id, $v['variant_id']);
if ($v['status'] == 'Y') {
$vd = array('product_id' => $option_data['extraProductId'], 'option_id' => $option_id, 'variant_id' => $v['variant_id']);
db_query("INSERT INTO ?:product_option_variants_disabled ?e", $vd);
unset($v['status']);
}
db_query("UPDATE ?:product_option_variants SET ?u WHERE variant_id = ?i", $v, $v['variant_id']);
db_query("UPDATE ?:product_option_variants_descriptions SET ?u WHERE variant_id = ?i AND lang_code = ?s", $v, $v['variant_id'], $lang_code);
}
$var_ids[] = $v['variant_id'];
if ($option_data['option_type'] == 'C') {
fn_delete_image_pairs($v['variant_id'], 'variant_image');
// force deletion of variant image for "checkbox" option
} else {
$variant_images[$k] = $v['variant_id'];
}
}
if ($option_data['option_type'] != 'C' && !empty($variant_images)) {
fn_attach_image_pairs('variant_image', 'variant_image', 0, $lang_code, $variant_images);
}
// Delete obsolete variants
$condition = !empty($var_ids) ? db_quote('AND variant_id NOT IN (?n)', $var_ids) : '';
$deleted_variants = db_get_fields("SELECT variant_id FROM ?:product_option_variants WHERE option_id = ?i {$condition}", $option_id, $var_ids);
if (!empty($deleted_variants)) {
db_query("DELETE FROM ?:product_option_variants WHERE variant_id IN (?n)", $deleted_variants);
db_query("DELETE FROM ?:product_option_variants_descriptions WHERE variant_id IN (?n)", $deleted_variants);
foreach ($deleted_variants as $v_id) {
fn_delete_image_pairs($v_id, 'variant_image');
}
}
}
if (!fn_allowed_for('ULTIMATE:FREE')) {
// Rebuild exceptions
if (!empty($create) && !empty($option_data['product_id'])) {
fn_update_exceptions($option_data['product_id']);
}
}
/**
* Update product option (running after fn_update_product_option() function)
*
* @param array $option_data Array with option data
* @param int $option_id Option identifier
* @param array $deleted_variants Array with deleted variants ids
* @param string $lang_code Language code to add/update option for
*/
fn_set_hook('update_product_option_post', $option_data, $option_id, $deleted_variants, $lang_code);
return $option_id;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:fn.catalog.php
示例5: fn_update_shipping
/**
* Create/Update shipping name
*
* @param array $shipping_data shipping info
* @param int $shipping_id shipping identifier
* @param string $lang_code 2-letter language code (e.g. 'en', 'ru', etc.)
* @return string Shipping name if shipping identifier is not null; false otherwise
*/
function fn_update_shipping($shipping_data, $shipping_id, $lang_code = DESCR_SL)
{
if (!empty($shipping_data['shipping']) || !empty($shipping_id)) {
$shipping_data['localization'] = empty($shipping_data['localization']) ? '' : fn_implode_localizations($shipping_data['localization']);
$shipping_data['tax_ids'] = !empty($shipping_data['tax_ids']) ? fn_create_set($shipping_data['tax_ids']) : '';
$shipping_data['usergroup_ids'] = empty($shipping_data['usergroup_ids']) ? USERGROUP_ALL : (is_array($shipping_data['usergroup_ids']) ? implode(',', $shipping_data['usergroup_ids']) : $shipping_data['usergroup_ids']);
unset($shipping_data['shipping_id']);
if (isset($shipping_data['rate_calculation']) && $shipping_data['rate_calculation'] == 'M') {
$shipping_data['service_id'] = 0;
$shipping_data['service_params'] = array();
}
if (isset($shipping_data['service_params'])) {
$shipping_data['service_params'] = serialize($shipping_data['service_params']);
}
fn_set_hook('update_shipping', $shipping_data, $shipping_id, $lang_code);
if (!empty($shipping_id)) {
$action = 'update';
$arow = db_query("UPDATE ?:shippings SET ?u WHERE shipping_id = ?i", $shipping_data, $shipping_id);
db_query("UPDATE ?:shipping_descriptions SET ?u WHERE shipping_id = ?i AND lang_code = ?s", $shipping_data, $shipping_id, $lang_code);
if ($arow === false) {
fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('shipping'))), '', '404');
$shipping_id = false;
}
} else {
$action = 'add';
$shipping_id = $shipping_data['shipping_id'] = db_query("INSERT INTO ?:shippings ?e", $shipping_data);
foreach (fn_get_translation_languages() as $shipping_data['lang_code'] => $_v) {
db_query("INSERT INTO ?:shipping_descriptions ?e", $shipping_data);
}
}
fn_set_hook('update_shipping_post', $shipping_data, $shipping_id, $lang_code, $action);
if ($shipping_id) {
fn_attach_image_pairs('shipping', 'shipping', $shipping_id, $lang_code);
if (!empty($shipping_data['rates'])) {
fn_update_shipping_rates($shipping_data, $shipping_id);
}
}
}
return $shipping_id;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:48,代码来源:fn.cart.php
示例6: fn_update_product_feature
function fn_update_product_feature($feature_data, $feature_id, $lang_code = DESCR_SL)
{
$deleted_variants = array();
// If this feature belongs to the group, get categories assignment from this group
if (!empty($feature_data['parent_id'])) {
$gdata = db_get_row("SELECT categories_path, display_on_product, display_on_catalog FROM ?:product_features WHERE feature_id = ?i", $feature_data['parent_id']);
$feature_data = fn_array_merge($feature_data, $gdata);
}
if (!intval($feature_id)) {
// check for intval as we use "0G" for new group
$feature_data['feature_id'] = $feature_id = db_query("INSERT INTO ?:product_features ?e", $feature_data);
foreach (Registry::get('languages') as $feature_data['lang_code'] => $_d) {
db_query("INSERT INTO ?:product_features_descriptions ?e", $feature_data);
}
} else {
db_query("UPDATE ?:product_features SET ?u WHERE feature_id = ?i", $feature_data, $feature_id);
db_query('UPDATE ?:product_features_descriptions SET ?u WHERE feature_id = ?i AND lang_code = ?s', $feature_data, $feature_id, $lang_code);
}
// If this feature is group, set its categories to all children
if ($feature_data['feature_type'] == 'G') {
$u = array('categories_path' => $feature_data['categories_path'], 'display_on_product' => $feature_data['display_on_product'], 'display_on_catalog' => $feature_data['display_on_catalog']);
db_query("UPDATE ?:product_features SET ?u WHERE parent_id = ?i", $u, $feature_id);
}
// Delete variants for simple features
if (strpos('SMNE', $feature_data['feature_type']) === false) {
$var_ids = db_get_fields("SELECT variant_id FROM ?:product_feature_variants WHERE feature_id = ?i", $feature_id);
if (!empty($var_ids)) {
db_query("DELETE FROM ?:product_feature_variants WHERE variant_id IN (?n)", $var_ids);
db_query("DELETE FROM ?:product_feature_variant_descriptions WHERE variant_id IN (?n)", $var_ids);
db_query("DELETE FROM ?:product_features_values WHERE variant_id IN (?n)", $var_ids);
foreach ($var_ids as $v_id) {
fn_delete_image_pairs($v_id, 'feature_variant');
}
}
} elseif (!empty($feature_data['variants'])) {
$var_ids = array();
foreach ($feature_data['variants'] as $k => $v) {
if (empty($v['variant'])) {
continue;
}
$v['feature_id'] = $feature_id;
if (empty($v['variant_id'])) {
$v['variant_id'] = db_query("INSERT INTO ?:product_feature_variants ?e", $v);
foreach (Registry::get('languages') as $v['lang_code'] => $_v) {
db_query("INSERT INTO ?:product_feature_variant_descriptions ?e", $v);
}
} else {
db_query("UPDATE ?:product_feature_variants SET ?u WHERE variant_id = ?i", $v, $v['variant_id']);
db_query("UPDATE ?:product_feature_variant_descriptions SET ?u WHERE variant_id = ?i AND lang_code = ?s", $v, $v['variant_id'], $lang_code);
}
if ($feature_data['feature_type'] == 'N') {
// number
db_query('UPDATE ?:product_features_values SET ?u WHERE variant_id = ?i AND lang_code = ?s', array('value_int' => $v['variant']), $v['variant_id'], $lang_code);
}
$var_ids[$k] = $v['variant_id'];
$feature_data['variants'][$k]['variant_id'] = $v['variant_id'];
// for addons
}
if (!empty($var_ids)) {
fn_attach_image_pairs('variant_image', 'feature_variant', 0, $lang_code, $var_ids);
}
// Delete obsolete variants
$deleted_variants = db_get_fields("SELECT variant_id FROM ?:product_feature_variants WHERE feature_id = ?i AND variant_id NOT IN (?n)", $feature_id, $var_ids);
if (!empty($deleted_variants)) {
db_query("DELETE FROM ?:product_feature_variants WHERE variant_id IN (?n)", $deleted_variants);
db_query("DELETE FROM ?:product_feature_variant_descriptions WHERE variant_id IN (?n)", $deleted_variants);
db_query("DELETE FROM ?:product_features_values WHERE variant_id IN (?n)", $deleted_variants);
foreach ($deleted_variants as $v_id) {
fn_delete_image_pairs($v_id, 'feature_variant');
}
}
}
fn_set_hook('update_product_feature', $feature_data, $feature_id, $deleted_variants, $lang_code);
return $feature_id;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:75,代码来源:product_features.php
示例7: foreach
if ($mode == 'add_combinations') {
if (is_array($_REQUEST['add_inventory'])) {
foreach ($_REQUEST['add_inventory'] as $k => $v) {
$combination_hash = fn_generate_cart_id($_REQUEST['product_id'], array('product_options' => $_REQUEST['add_options_combination'][$k]));
$combination = fn_get_options_combination($_REQUEST['add_options_combination'][$k]);
$product_code = fn_get_product_code($_REQUEST['product_id'], $_REQUEST['add_options_combination'][$k]);
$_data = array('product_id' => $_REQUEST['product_id'], 'combination_hash' => $combination_hash, 'combination' => $combination, 'product_code' => !empty($product_code) ? $product_code : '');
$_data = fn_array_merge($v, $_data);
db_query("REPLACE INTO ?:product_options_inventory ?e", $_data);
}
}
$suffix = ".inventory?product_id={$_REQUEST['product_id']}";
}
if ($mode == 'update_combinations') {
// Updating images
fn_attach_image_pairs('combinations', 'product_option', 0, CART_LANGUAGE, array());
$inventory = db_get_hash_array("SELECT * FROM ?:product_options_inventory WHERE product_id = ?i", 'combination_hash', $_REQUEST['product_id']);
foreach ($inventory as $i) {
$inventory_ids[] = $i['combination_hash'];
}
fn_attach_aditional_image_pairs('product_option_add_additional', 'product_option', 0, CART_LANGUAGE, $inventory_ids);
if (!empty($_REQUEST['inventory'])) {
foreach ($_REQUEST['inventory'] as $k => $v) {
db_query("UPDATE ?:product_options_inventory SET ?u WHERE combination_hash = ?s", $v, $k);
if ($inventory[$k]['amount'] <= 0 && $v['amount'] > 0) {
fn_send_product_notifications($_REQUEST['product_id']);
}
}
}
$suffix = ".inventory?product_id={$_REQUEST['product_id']}";
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:product_options.php
示例8: die
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
fn_trusted_vars("processor_params", "payment_data");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($mode == 'update') {
$payment_id = fn_attach_image_pairs('path_stamp', 'stamp', $_REQUEST['payment_id'], DESCR_SL);
}
return array(CONTROLLER_STATUS_OK, "payments.manage");
}
if ($mode == 'update' || $mode == 'manage') {
$processors = Tygh::$app['view']->getTemplateVars('payment_processors');
if (!empty($processors)) {
$rus_payments = array();
foreach (fn_get_schema('rus_payments', 'processors') as $rus_payment) {
$rus_payments[$rus_payment['processor']] = $rus_payment;
}
foreach ($processors as &$processor) {
$processor['position'] = 'default_' . $processor['processor'];
if (!empty($rus_payments[$processor['processor']])) {
$processor['russian'] = 'Y';
$processor['type'] = 'R';
开发者ID:askzap,项目名称:ask-zap,代码行数:31,代码来源:payments.post.php
示例9: fn_banners_update_banner
function fn_banners_update_banner($data, $banner_id, $lang_code = DESCR_SL)
{
if (isset($data['timestamp'])) {
$data['timestamp'] = fn_parse_date($data['timestamp']);
}
$data['localization'] = empty($data['localization']) ? '' : fn_implode_localizations($data['localization']);
if (!empty($banner_id)) {
db_query("UPDATE ?:banners SET ?u WHERE banner_id = ?i", $data, $banner_id);
db_query("UPDATE ?:banner_descriptions SET ?u WHERE banner_id = ?i AND lang_code = ?s", $data, $banner_id, $lang_code);
$banner_image_id = fn_get_banner_image_id($banner_id, $lang_code);
$banner_image_exist = !empty($banner_image_id);
$banner_is_multilang = Registry::get('addons.banners.banner_multilang') == 'Y';
$image_is_update = fn_banners_need_image_update();
if ($banner_is_multilang) {
if ($banner_image_exist && $image_is_update) {
fn_delete_image_pairs($banner_image_id, 'promo');
db_query("DELETE FROM ?:banner_images WHERE banner_id = ?i AND lang_code = ?s", $banner_id, $lang_code);
$banner_image_exist = false;
}
} else {
if (isset($data['url'])) {
db_query("UPDATE ?:banner_descriptions SET url = ?s WHERE banner_id = ?i", $data['url'], $banner_id);
}
}
if ($image_is_update && !$banner_image_exist) {
$banner_image_id = db_query("INSERT INTO ?:banner_images (banner_id, lang_code) VALUE(?i, ?s)", $banner_id, $lang_code);
}
$pair_data = fn_attach_image_pairs('banners_main', 'promo', $banner_image_id, $lang_code);
if (!$banner_is_multilang && !$banner_image_exist) {
fn_banners_image_all_links($banner_id, $pair_data, $lang_code);
}
} else {
$banner_id = $data['banner_id'] = db_query("REPLACE INTO ?:banners ?e", $data);
foreach (Languages::getAll() as $data['lang_code'] => $v) {
db_query("REPLACE INTO ?:banner_descriptions ?e", $data);
}
if (fn_banners_need_image_update()) {
$data_banner_image = array('banner_id' => $banner_id, 'lang_code' => $lang_code);
$banner_image_id = db_get_next_auto_increment_id('banner_images');
$pair_data = fn_attach_image_pairs('banners_main', 'promo', $banner_image_id, $lang_code);
if (!empty($pair_data)) {
db_query("INSERT INTO ?:banner_images ?e", $data_banner_image);
fn_banners_image_all_links($banner_id, $pair_data, $lang_code);
}
}
}
return $banner_id;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:48,代码来源:func.php
示例10: fn_update_configurator_group
function fn_update_configurator_group($data, $group_id, $lang_code = DESCR_SL)
{
if (!empty($group_id)) {
db_query('UPDATE ?:conf_groups SET ?u WHERE group_id = ?i', $data, $group_id);
db_query('UPDATE ?:conf_group_descriptions SET ?u WHERE group_id = ?i AND lang_code = ?s', $data, $group_id, $lang_code);
} else {
$group_id = $data['group_id'] = db_query('INSERT INTO ?:conf_groups ?e', $data);
foreach ((array) Registry::get('languages') as $data['lang_code'] => $_v) {
db_query("INSERT INTO ?:conf_group_descriptions ?e", $data);
}
}
// Updating category images
fn_attach_image_pairs('configurator_main', 'conf_group', $group_id, $lang_code);
// Update group products
db_query("DELETE FROM ?:conf_group_products WHERE group_id = ?i", $group_id);
if (!empty($data['product_ids'])) {
$p_ids = explode(',', $data['product_ids']);
foreach ($p_ids as $p_id) {
db_query("INSERT INTO ?:conf_group_products (group_id, product_id) VALUES (?i, ?i)", $group_id, $p_id);
}
}
return $group_id;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:23,代码来源:configurator.php
示例11: fn_projects_update_page_post
function fn_projects_update_page_post($page_data, $page_id, $lang_code, $create, $old_page_data)
{
if (!empty($page_data['page_type']) && $page_data['page_type'] == PAGE_TYPE_PROJECTS) {
fn_attach_image_pairs('projects_image', 'projects', $page_id, $lang_code);
db_query("REPLACE INTO ?:projects_authors ?e", array('page_id' => $page_id, 'user_id' => $_SESSION['auth']['user_id']));
}
}
开发者ID:ambient-lounge,项目名称:site,代码行数:7,代码来源:func.php
示例12: fn_update_shipping
function fn_update_shipping($data, $shipping_id, $lang_code = DESCR_SL)
{
$data['localization'] = empty($data['localization']) ? '' : fn_implode_localizations($data['localization']);
$data['tax_ids'] = !empty($data['tax_ids']) ? fn_create_set($data['tax_ids']) : '';
$data['usergroup_ids'] = empty($data['usergroup_ids']) ? '' : implode(',', $data['usergroup_ids']);
fn_set_hook('update_shipping', $data, $shipping_id, $lang_code);
if (!empty($shipping_id)) {
db_query("UPDATE ?:shippings SET ?u WHERE shipping_id = ?i", $data, $shipping_id);
db_query("UPDATE ?:shipping_descriptions SET ?u WHERE shipping_id = ?i AND lang_code = ?s", $data, $shipping_id, $lang_code);
} else {
$shipping_id = $data['shipping_id'] = db_query("INSERT INTO ?:shippings ?e", $data);
foreach ((array) Registry::get('languages') as $data['lang_code'] => $_v) {
db_query("INSERT INTO ?:shipping_descriptions ?e", $data);
}
}
if ($shipping_id) {
fn_attach_image_pairs('shipping', 'shipping', $shipping_id, $lang_code);
}
return $shipping_id;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:20,代码来源:shippings.php
示例13: fn_create_logo
/**
* Adds logo
* @param array $logo_data logo data (layout_id, image path, type)
* @param integer $company_id company ID
* @return integer ID of created logo
*/
function fn_create_logo($logo_data, $company_id = null)
{
$condition = '';
if (!empty($logo_data['layout_id'])) {
$condition .= db_quote(" AND layout_id = ?i", $logo_data['layout_id']);
}
if (!empty($company_id)) {
$condition .= db_quote(" AND company_id = ?i", $company_id);
}
$logo_id = db_get_field("SELECT logo_id FROM ?:logos WHERE type = ?s ?p", $logo_data['type'], $condition);
if (empty($logo_id)) {
$logo_id = db_query("INSERT INTO ?:logos ?e", array('type' => $logo_data['type'], 'layout_id' => !empty($logo_data['layout_id']) ? $logo_data['layout_id'] : 0, 'company_id' => $company_id));
}
if (!empty($logo_data['image_path'])) {
if (file_exists($logo_data['image_path'])) {
$_REQUEST['logotypes_image_data'] = array(array('type' => 'M', 'object_id' => $logo_id));
$_REQUEST['type_logotypes_image_icon'] = array('server');
$_REQUEST['file_logotypes_image_icon'] = array($logo_data['image_path']);
fn_attach_image_pairs('logotypes', 'logos');
}
}
return $logo_id;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:29,代码来源:fn.common.php
示例14: _saveUploadedLogos
/**
* Save uploaded logo and favicon and return array of their urls
* @return Array of Strings
*/
private static function _saveUploadedLogos()
{
$logo_names = array('logo', 'favicon');
$options = array();
foreach ($logo_names as $logo_name) {
$pair_ids = fn_attach_image_pairs($logo_name, 'twg_logos');
if (!empty($pair_ids)) {
$image_id = TwigmoImage::getImageId(array('pair_id' => reset($pair_ids), 'object_type' => 'twg_logos'));
$image_data = fn_get_image($image_id, 'twg_logos');
$options[$logo_name . '_url'] = $image_data['http_image_path'];
}
}
return $options;
}
开发者ID:askzap,项目名称:ultimate,代码行数:18,代码来源:TwigmoSettings.php
示例15: fn_update_store_location
function fn_update_store_location($store_location_data, $store_location_id, $lang_code = DESCR_SL)
{
$store_location_data['localization'] = empty($store_location_data['localization']) ? '' : fn_implode_localizations($store_location_data['localization']);
if (empty($store_location_id)) {
if (empty($store_location_data['position'])) {
$store_location_data['position'] = db_get_field('SELECT MAX(position) FROM ?:store_locations');
$store_location_data['position'] += 10;
}
$store_location_id = db_query('INSERT INTO ?:store_locations ?e', $store_location_data);
$store_location_data['store_location_id'] = $store_location_id;
foreach (fn_get_translation_languages() as $store_location_data['lang_code'] => $v) {
db_query("INSERT INTO ?:store_location_descriptions ?e", $store_location_data);
}
} else {
db_query('UPDATE ?:store_locations SET ?u WHERE store_location_id = ?i', $store_location_data, $store_location_id);
db_query('UPDATE ?:store_location_descriptions SET ?u WHERE store_location_id = ?i AND lang_code = ?s', $store_location_data, $store_location_id, $lang_code);
}
// Update main images pair
fn_attach_image_pairs('store_locations', 'store_locations', $store_location_id, $lang_code);
// Update additional images
fn_attach_image_pairs('store_locations_additional', 'store_locations', $store_location_id, $lang_code);
// Adding new additional images
fn_attach_image_pairs('store_locations_add_additional', 'store_locations', $store_location_id, $lang_code);
//die($store_location_id);
return $store_location_id;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:26,代码来源:func.php
示例16: fn_update_watermark_image_settings
function fn_update_watermark_image_settings($wt_settings, $company_id = null, $attached_image_id = null)
{
if (!($setting_id = Settings::instance()->getId('watermark', ''))) {
$setting_id = Settings::instance()->update(array('name' => 'watermark', 'section_id' => 0, 'section_tab_id' => 0, 'type' => 'A', 'position' => 0, 'is_global' => 'N', 'handler' => ''));
}
Settings::instance()->updateValueById($setting_id, serialize($wt_settings), $company_id);
if ($wt_settings['type'] == 'G') {
$_REQUEST['wt_image_image_data'][0]['image_alt'] = '';
$_REQUEST['wt_image_image_data'][0]['detailed_alt'] = '';
$image_id = !empty($company_id) ? $company_id : WATERMARK_IMAGE_ID;
if (!is_null($attached_image_id)) {
fn_clone_image_pairs($image_id, $attached_image_id, 'watermark');
} else {
$pair_ids = fn_attach_image_pairs('wt_image', 'watermark', $image_id);
if (!empty($pair_ids)) {
$attached_image_id = $image_id;
}
}
}
return $attached_image_id;
}
开发者ID:askzap,项目名称:ultimate,代码行数:21,代码来源:addons.pre.php
示例17: fn_blog_update_page_post
function fn_blog_update_page_post($page_data, $page_id, $lang_code, $create, $old_page_data)
{
if (!empty($page_data['page_type']) && $page_data['page_type'] == PAGE_TYPE_BLOG) {
fn_attach_image_pairs('blog_image', 'blog', $page_id, $lang_code);
db_query("REPLACE INTO ?:blog_authors ?e", array('page_id' => $page_id, 'user_id' => Tygh::$app['session']['auth']['user_id']));
}
}
开发者ID:ambient-lounge,项目名称:site,代码行数:7,代码来源:func.php
示例18: fn_set_notification
fn_set_notification('N', __('notice'), __('text_products_added'));
}
}
$suffix = ".manage" . (empty($p_ids) ? "" : "?pid[]=" . implode('&pid[]=', $p_ids));
}
//
// Processing multiple updating of product elements
//
if ($mode == 'm_update') {
// Update multiple products data
if (!empty($_REQUEST['products_data'])) {
if (fn_allowed_for('MULTIVENDOR') && !fn_company_products_check(array_keys($_REQUEST['products_data']))) {
return array(CONTROLLER_STATUS_DENIED);
}
// Update images
fn_attach_image_pairs('product_main', 'product', 0, DESCR_SL);
foreach ($_REQUEST['products_data'] as $k => $v) {
if (!empty($v['product'])) {
// Checking for required fields for new product
if (fn_allowed_for('ULTIMATE,MULTIVENDOR') && Registry::get('runtime.company_id')) {
unset($v['company_id']);
}
fn_companies_filter_company_product_categories($_REQUEST, $v);
if (!empty($v['category_ids'])) {
$v['category_ids'] = explode(',', $v['category_ids']);
}
fn_update_product($v, $k, DESCR_SL);
// Updating products position in category
if (isset($v['position']) && !empty($_REQUEST['category_id'])) {
db_query("UPDATE ?:products_categories SET position = ?i WHERE category_id = ?i AND product_id = ?i", $v['position'], $_REQUEST['category_id'], $k);
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:31,代码来源:products.php
示例19: fn_import_images
/**
* Import image pair
*
* @param string $prefix path prefix
* @param string $image_file thumbanil path or filename
* @param string $detailed_path detailed image path or filename
* @param string $type pair type
* @param int $object_id ID of object to attach images to
* @param string $object name of object to attach images to
* @return boolean true if images were imported
*/
function fn_import_images($prefix, $image_file, $detailed_file, $type, $object_id, $object)
{
if (!empty($object_id)) {
$_REQUEST["server_import_image_icon"] = '';
$_REQUEST["type_import_image_icon"] = '';
// Get image alternative text if exists
if (!empty($image_file) && strpos($image_file, '#') !== false) {
list($image_file, $image_alt) = explode('#', $image_file);
}
if (!empty($detailed_file) && strpos($detailed_file, '#') !== false) {
list($detailed_file, $detailed_alt) = explode('#', $detailed_file);
}
$_REQUEST["type_import_image_icon"] = array('server');
$_REQUEST["type_import_image_detailed"] = array('server');
if (($image_file = fn_find_file($prefix, $image_file)) !== false) {
$_REQUEST["file_import_image_icon"] = array(str_ireplace(DIR_ROOT, '', $image_file));
} else {
$_REQUEST["file_import_image_icon"] = array();
}
if (($detailed_file = fn_find_file($prefix, $detailed_file)) !== false) {
$_REQUEST["file_import_image_detailed"] = array(str_ireplace(DIR_ROOT, '', $detailed_file));
} else {
$_REQUEST["file_import_image_detailed"] = array();
}
$_REQUEST['import_image_data'] = array(array('type' => $type, 'image_alt' => !empty($image_alt) ? unserialize($image_alt) : '', 'detailed_alt' => !empty($detailed_alt) ? unserialize($detailed_alt) : ''));
return fn_attach_image_pairs('import', $object, $object_id);
}
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:39,代码来源:exim.php
示例20: die
<?php
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
$_REQUEST['user_id'] = empty($_REQUEST['user_id']) ? 0 : (int) $_REQUEST['user_id'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
//
// Create/update staff member
//
if ($mode == 'update') {
fn_trusted_vars('user_data');
$user_id = fn_staff_update_staff_member_data($_REQUEST['user_data'], $_REQUEST['user_id'], DESCR_SL);
if (!empty($user_id)) {
fn_attach_image_pairs('staff_member_main', 'staff', $user_id, DESCR_SL);
$suffix = ".update?user_id={$user_id}";
} else {
$suffix = '.manage';
}
}
//
// Delete product
//
if ($mode == 'delete') {
if (!empty($_REQUEST['user_id'])) {
$result = fn_staff_delete_staff_member($_REQUEST['user_id']);
if ($result) {
fn_set_notification('N', __('notice'), __('text_staff_member_has_been_deleted'));
} else {
return array(CONTROLLER_STATUS_REDIRECT, 'staff.update?user_id=' . $_REQUEST['user_id']);
开发者ID:MrAlejandro,项目名称:cs_cart,代码行数:31,代码来源:staff.php
注:本文中的fn_attach_image_pairs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论