当前位置: 首页>>代码示例>>PHP>>正文


PHP fn_get_default_company_id函数代码示例

本文整理汇总了PHP中fn_get_default_company_id函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_default_company_id函数的具体用法?PHP fn_get_default_company_id怎么用?PHP fn_get_default_company_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fn_get_default_company_id函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: groupProductsList

 /**
  * Prepare products list for get shippings
  *
  * @param  array $products Products list with products data
  * @param  array $location User location
  * @return array Product groups
  */
 public static function groupProductsList($products, $location)
 {
     $groups = array();
     foreach ($products as $key_product => $product) {
         if (fn_allowed_for('ULTIMATE')) {
             $company_id = Registry::ifGet('runtime.company_id', fn_get_default_company_id());
         } else {
             $company_id = $product['company_id'];
         }
         if (empty($groups[$company_id])) {
             $origination = self::_getOriginationData($company_id);
             $groups[$company_id] = array('name' => $origination['name'], 'company_id' => (int) $company_id, 'origination' => $origination, 'location' => $location);
         }
         $groups[$company_id]['products'][$key_product] = $product;
     }
     fn_set_hook('shippings_group_products_list', $products, $groups);
     foreach ($groups as $key_group => $group) {
         $groups[$key_group]['package_info'] = self::_getPackageInfo($group);
         $groups[$key_group]['package_info_full'] = self::_getPackageInfo($group, true);
         unset($groups[$key_group]['origination']);
         unset($groups[$key_group]['location']);
         $all_edp_free_shipping = true;
         $all_free_shipping = true;
         $free_shipping = true;
         $shipping_no_required = true;
         foreach ($group['products'] as $product) {
             if ($product['is_edp'] != 'Y' || $product['edp_shipping'] == 'Y') {
                 $all_edp_free_shipping = false;
                 // shipping is required when having non-EDP products with shipping
                 if (empty($product['shipping_no_required']) || $product['shipping_no_required'] != 'Y') {
                     $shipping_no_required = false;
                 }
                 if (empty($product['free_shipping']) || $product['free_shipping'] != 'Y') {
                     $free_shipping = false;
                 }
             }
             if (empty($product['free_shipping']) || $product['free_shipping'] != 'Y') {
                 $all_free_shipping = false;
             }
         }
         $groups[$key_group]['all_edp_free_shipping'] = $all_edp_free_shipping;
         $groups[$key_group]['all_free_shipping'] = $all_free_shipping;
         $groups[$key_group]['free_shipping'] = $free_shipping;
         $groups[$key_group]['shipping_no_required'] = $shipping_no_required;
     }
     return array_values($groups);
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:54,代码来源:Shippings.php

示例2: fn_google_export_add_feature

function fn_google_export_add_feature($new_features, $parent_feature_id, $show_process = false, $lang = DEFAULT_LANGUAGE)
{
    static $company_id = 0;
    if (!$company_id) {
        $company_id = fn_get_default_company_id();
    }
    foreach ($new_features as $feature_name => $feature_data) {
        foreach ($feature_data as $feature_type => $feature_variants) {
            if (fn_allowed_for('ULTIMATE')) {
                $f_id = db_query("INSERT INTO ?:product_features" . " (feature_type, categories_path, parent_id, display_on_product, display_on_catalog, status, position, comparison, company_id)" . " VALUES" . " (?s, '', ?i, 0, 0, 'A', 0, 'N', ?i)", $feature_type, $parent_feature_id, $company_id);
                fn_share_object_to_all('product_features', $f_id);
            } else {
                $f_id = db_query("INSERT INTO ?:product_features" . " (feature_type, categories_path, parent_id, display_on_product, display_on_catalog, status, position, comparison)" . " VALUES" . " (?s, '', ?i, 0, 0, 'A', 0, 'N')", $feature_type, $parent_feature_id);
            }
            db_query("INSERT INTO ?:product_features_descriptions" . " (feature_id, description, full_description, prefix, suffix, lang_code)" . " VALUES" . " (?i, ?s, '', '', '', ?s)", $f_id, $feature_name, $lang);
            if ($show_process) {
                fn_echo(' .');
            }
            fn_google_export_add_feature_variants($f_id, $feature_variants, $show_process);
        }
    }
}
开发者ID:askzap,项目名称:ultimate,代码行数:22,代码来源:func.php

示例3: correctCompanyID

 public function correctCompanyID(&$params)
 {
     if (fn_allowed_for('ULTIMATE')) {
         if (empty($params['company_id'])) {
             $params['company_id'] = fn_get_default_company_id();
         }
     } elseif (fn_allowed_for('MULTIVENDOR')) {
         $params['company_id'] = 0;
     }
 }
开发者ID:askzap,项目名称:ultimate,代码行数:10,代码来源:Payments.php

示例4: fn_facebook_prepare_meta_data

function fn_facebook_prepare_meta_data($provider_data, $params)
{
    $addon_settings = Settings::instance()->getValues('social_buttons', 'ADDON');
    if (fn_allowed_for('ULTIMATE')) {
        $company_id = Registry::ifGet('runtime.company_id', fn_get_default_company_id());
        $site_name = fn_get_company_name($company_id);
    }
    if ($params['object'] == 'products') {
        $product = Registry::get('view')->getTemplateVars('product');
        $return = array('type' => !empty($product['facebook_product_type']) ? $product['facebook_product_type'] : '', 'title' => fn_sb_format_page_title(), 'url' => fn_url('products.view?product_id=' . $params['object_id']), 'image' => !empty($product['main_pair']['detailed']['http_image_path']) ? $product['main_pair']['detailed']['http_image_path'] : '', 'site_name' => !empty($site_name) ? $site_name : Registry::get('settings.Company.company_name'), 'app_id' => !empty($addon_settings['facebook']['facebook_app_id']) ? $addon_settings['facebook']['facebook_app_id'] : '');
    } elseif ($params['object'] == 'pages') {
        $page = Registry::get('view')->getTemplateVars('page');
        $logos = fn_get_logos();
        if (fn_allowed_for('ULTIMATE')) {
            $logos = fn_get_logos($company_id);
        }
        $return = array('type' => !empty($page['facebook_obj_type']) ? $page['facebook_obj_type'] : '', 'title' => $page['page'], 'url' => !empty($page['link']) ? $page['link'] : fn_url('pages.view?product_id=' . $params['object_id']), 'image' => $logos['theme']['image']['http_image_path'], 'site_name' => !empty($site_name) ? $site_name : Registry::get('settings.Company.company_name'), 'app_id' => !empty($addon_settings['facebook']['facebook_app_id']) ? $addon_settings['facebook']['facebook_app_id'] : '');
    }
    return $return;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:20,代码来源:func.php

示例5: content_55ccecdbacf151_52396674

    function content_55ccecdbacf151_52396674($_smarty_tpl)
    {
        fn_preload_lang_vars(array('vendor'));
        if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] && (!$_smarty_tpl->tpl_vars['selected']->value || fn_allowed_for("MULTIVENDOR")) && !$_smarty_tpl->tpl_vars['disable_company_picker']->value) {
            ?>
    <?php 
            $_smarty_tpl->tpl_vars['selected'] = new Smarty_variable($_smarty_tpl->tpl_vars['runtime']->value['company_id'], null, 0);
        }
        ?>

<?php 
        if (!$_smarty_tpl->tpl_vars['selected']->value) {
            ?>
    <?php 
            if ($_smarty_tpl->tpl_vars['zero_company_id_name_lang_var']->value) {
                ?>
        <?php 
                $_smarty_tpl->tpl_vars['selected'] = new Smarty_variable("0", null, 0);
                ?>
    <?php 
            } else {
                ?>
        <?php 
                $_smarty_tpl->tpl_vars['selected'] = new Smarty_variable(fn_get_default_company_id(), null, 0);
                ?>
    <?php 
            }
        }
        ?>

<?php 
        if ($_smarty_tpl->tpl_vars['reload_form']->value) {
            ?>
    <?php 
            $_smarty_tpl->tpl_vars['js_action'] = new Smarty_variable("fn_reload_form(elm);", null, 0);
        }
        ?>

<?php 
        $_smarty_tpl->_capture_stack[0][] = array("c_body", null, null);
        ob_start();
        ?>
    <input type="hidden" name="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['name']->value, ENT_QUOTES, 'UTF-8');
        ?>
" id="<?php 
        echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['id']->value) === null || $tmp === '' ? "company_id" : $tmp, ENT_QUOTES, 'UTF-8');
        ?>
" value="<?php 
        echo htmlspecialchars($_smarty_tpl->tpl_vars['selected']->value, ENT_QUOTES, 'UTF-8');
        ?>
">
    <?php 
        if (!$_smarty_tpl->tpl_vars['runtime']->value['simple_ultimate']) {
            ?>
        <?php 
            if ($_smarty_tpl->tpl_vars['runtime']->value['company_id'] || $_smarty_tpl->tpl_vars['disable_company_picker']->value) {
                ?>
            <div class="text-type-value"><?php 
                echo htmlspecialchars(fn_get_company_name($_smarty_tpl->tpl_vars['selected']->value, $_smarty_tpl->tpl_vars['zero_company_id_name_lang_var']->value), ENT_QUOTES, 'UTF-8');
                ?>
</div>
        <?php 
            } else {
                ?>
            <div class="text-type-value ajax-select-wrap <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['meta']->value, ENT_QUOTES, 'UTF-8');
                ?>
">
                <?php 
                if ($_smarty_tpl->tpl_vars['zero_company_id_name_lang_var']->value) {
                    ?>
                    <?php 
                    $_smarty_tpl->tpl_vars['url_extra'] = new Smarty_variable("&show_all=Y&default_label=" . (string) $_smarty_tpl->tpl_vars['zero_company_id_name_lang_var']->value, null, 0);
                    ?>
                <?php 
                }
                ?>
                <?php 
                echo $_smarty_tpl->getSubTemplate("common/ajax_select_object.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('data_url' => "companies.get_companies_list?onclick=" . (string) $_smarty_tpl->tpl_vars['onclick']->value . (string) $_smarty_tpl->tpl_vars['url_extra']->value, 'text' => fn_get_company_name($_smarty_tpl->tpl_vars['selected']->value, $_smarty_tpl->tpl_vars['zero_company_id_name_lang_var']->value), 'result_elm' => ($tmp = @$_smarty_tpl->tpl_vars['id']->value) === null || $tmp === '' ? "company_id" : $tmp, 'id' => (string) $_smarty_tpl->tpl_vars['id']->value . "_selector", 'js_action' => $_smarty_tpl->tpl_vars['js_action']->value), 0);
                ?>

            </div>
        <?php 
            }
            ?>
    <?php 
        }
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
//.........这里部分代码省略.........
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:752ca2cb849c2c0b2ffd0e0fae2e82b65a672378.tygh.company_field.tpl.php

示例6: fn_get_sb_providers_meta_data

function fn_get_sb_providers_meta_data($params)
{
    $addon_settings = Settings::instance()->getValues('social_buttons', 'ADDON');
    $providers_meta_data = array();
    if (fn_allowed_for('ULTIMATE')) {
        $company_id = Registry::ifGet('runtime.company_id', fn_get_default_company_id());
        $site_name = fn_get_company_name($company_id);
    }
    if ($params['object'] == 'products') {
        $product = Tygh::$app['view']->getTemplateVars('product');
        $providers_meta_data['all'] = array('title' => fn_sb_format_page_title(), 'url' => fn_url('products.view?product_id=' . $params['object_id']), 'image' => !empty($product['main_pair']['detailed']['http_image_path']) ? $product['main_pair']['detailed']['http_image_path'] : '', 'image:width' => !empty($product['main_pair']['detailed']['image_x']) ? $product['main_pair']['detailed']['image_x'] : '', 'image:height' => !empty($product['main_pair']['detailed']['image_y']) ? $product['main_pair']['detailed']['image_y'] : '', 'site_name' => !empty($site_name) ? $site_name : Registry::get('settings.Company.company_name'));
    } elseif ($params['object'] == 'pages') {
        $page = Tygh::$app['view']->getTemplateVars('page');
        $logos = fn_get_logos();
        if (fn_allowed_for('ULTIMATE')) {
            $logos = fn_get_logos($company_id);
        }
        $providers_meta_data['all'] = array('title' => $page['page'], 'url' => !empty($page['link']) ? $page['link'] : fn_url('pages.view?product_id=' . $params['object_id']), 'image' => !empty($logos['theme']['image']['http_image_path']) ? $logos['theme']['image']['http_image_path'] : '', 'image:width' => !empty($logos['theme']['image']['image_x']) ? $logos['theme']['image']['image_x'] : '', 'image:height' => !empty($logos['theme']['image']['image_y']) ? $logos['theme']['image']['image_y'] : '', 'site_name' => !empty($site_name) ? $site_name : Registry::get('settings.Company.company_name'));
    }
    if (!empty($addon_settings)) {
        foreach ($addon_settings as $provider_name => $provider_data) {
            $func_name = 'fn_' . $provider_name . '_prepare_meta_data';
            if (is_callable($func_name)) {
                $providers_meta_data[$provider_name] = call_user_func($func_name, $provider_data, $params);
            }
        }
    }
    return $providers_meta_data;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:29,代码来源:func.php

示例7: fn_update_product

/**
 * Adds or updates product
 *
 * @param array $product_data Product data
 * @param int $product_id Product identifier
 * @param string $lang_code Two-letter language code (e.g. 'en', 'ru', etc.)
 * @return mixed ID of created/updated product or false in case of error
 */
function fn_update_product($product_data, $product_id = 0, $lang_code = CART_LANGUAGE)
{
    $can_update = true;
    /**
     * Update product data (running before fn_update_product() function)
     *
     * @param array   $product_data Product data
     * @param int     $product_id   Product identifier
     * @param string  $lang_code    Two-letter language code (e.g. 'en', 'ru', etc.)
     * @param boolean $can_update   Flag, allows addon to forbid to create/update product
     */
    fn_set_hook('update_product_pre', $product_data, $product_id, $lang_code, $can_update);
    if ($can_update == false) {
        return false;
    }
    if (fn_allowed_for('ULTIMATE')) {
        // check that product owner was not changed by store administrator
        if (Registry::get('runtime.company_id') || empty($product_data['company_id'])) {
            $product_company_id = db_get_field('SELECT company_id FROM ?:products WHERE product_id = ?i', $product_id);
            if (!empty($product_company_id)) {
                $product_data['company_id'] = $product_company_id;
            } else {
                if (Registry::get('runtime.company_id')) {
                    $product_company_id = $product_data['company_id'] = Registry::get('runtime.company_id');
                } else {
                    $product_company_id = $product_data['company_id'] = fn_get_default_company_id();
                }
            }
        } else {
            $product_company_id = $product_data['company_id'];
        }
        if (!empty($product_data['category_ids']) && !fn_check_owner_categories($product_company_id, $product_data['category_ids'])) {
            fn_set_notification('E', __('error'), __('product_must_have_owner_category'));
            return false;
        }
        if (fn_ult_is_shared_product($product_id) == 'Y') {
            $_product_id = fn_ult_update_shared_product($product_data, $product_id, Registry::ifGet('runtime.company_id', $product_company_id), $lang_code);
        }
    }
    if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id') && !empty($product_company_id) && Registry::get('runtime.company_id') != $product_company_id && !empty($_product_id)) {
        $product_id = $_product_id;
        $create = false;
    } else {
        $product_data['updated_timestamp'] = time();
        $_data = $product_data;
        if (!empty($product_data['timestamp'])) {
            $_data['timestamp'] = fn_parse_date($product_data['timestamp']);
            // Minimal data for product record
        } elseif (empty($product_id) || isset($product_data['timestamp'])) {
            $_data['timestamp'] = time();
        }
        if (empty($product_id) && Registry::get('runtime.company_id')) {
            $_data['company_id'] = Registry::get('runtime.company_id');
        }
        if (!empty($product_data['avail_since'])) {
            $_data['avail_since'] = fn_parse_date($product_data['avail_since']);
        }
        if (isset($product_data['tax_ids'])) {
            $_data['tax_ids'] = empty($product_data['tax_ids']) ? '' : fn_create_set($product_data['tax_ids']);
        }
        if (isset($product_data['localization'])) {
            $_data['localization'] = empty($product_data['localization']) ? '' : fn_implode_localizations($_data['localization']);
        }
        if (isset($product_data['usergroup_ids'])) {
            $_data['usergroup_ids'] = empty($product_data['usergroup_ids']) ? '0' : implode(',', $_data['usergroup_ids']);
        }
        if (!empty($product_data['list_qty_count']) && $product_data['list_qty_count'] < 0) {
            $_data['list_qty_count'] = 0;
        }
        if (!empty($product_data['qty_step']) && $product_data['qty_step'] < 0) {
            $_data['qty_step'] = 0;
        }
        if (!empty($product_data['min_qty'])) {
            $_data['min_qty'] = fn_ceil_to_step(abs($product_data['min_qty']), $_data['qty_step']);
        }
        if (!empty($product_data['max_qty'])) {
            $_data['max_qty'] = fn_ceil_to_step(abs($product_data['max_qty']), $_data['qty_step']);
        }
        if (Registry::get('settings.General.inventory_tracking') == "N" && isset($_data['tracking'])) {
            unset($_data['tracking']);
        }
        if (Registry::get('settings.General.allow_negative_amount') == 'N' && isset($_data['amount'])) {
            $_data['amount'] = abs($_data['amount']);
        }
        $shipping_params = array();
        if (!empty($product_id)) {
            $shipping_params = db_get_field('SELECT shipping_params FROM ?:products WHERE product_id = ?i', $product_id);
            if (!empty($shipping_params)) {
                $shipping_params = unserialize($shipping_params);
            }
        }
        // Save the product shipping params
//.........这里部分代码省略.........
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:fn.catalog.php

示例8: fn_get_payment_templates

function fn_get_payment_templates($payment = array())
{
    $templates = array();
    $company_id = null;
    if (fn_allowed_for('ULTIMATE')) {
        if (!empty($payment['company_id'])) {
            $company_id = $payment['company_id'];
        } else {
            $company_id = Registry::ifGet('runtime.company_id', fn_get_default_company_id());
        }
    }
    $theme_path = fn_get_theme_path('[themes]/[theme]', 'C', $company_id);
    $_templates = fn_get_dir_contents($theme_path . '/templates/views/orders/components/payments/', false, true, '.tpl');
    foreach ($_templates as $template) {
        $templates[$template] = 'views/orders/components/payments/' . $template;
    }
    // Get addons templates as well
    $path = 'addons/[addon]/views/orders/components/payments/';
    $addons = Registry::get('addons');
    foreach ($addons as $addon_id => $addon) {
        $addon_path = str_replace('[addon]', $addon_id, $path);
        $addon_templates = fn_get_dir_contents($theme_path . '/templates/' . $addon_path, false, true, '.tpl');
        if (!empty($addon_templates)) {
            foreach ($addon_templates as $template) {
                $templates[$template] = $addon_path . $template;
            }
        }
    }
    return $templates;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:30,代码来源:fn.cart.php

示例9: fn_crc32

            Session::setName($areas[$area]);
            $sess_id = Session::regenerateId();
            Session::save($sess_id, $sess_data, $area);
            Session::setName(ACCOUNT_TYPE);
            Session::setId($old_sess_id, false);
        } else {
            // Save unique key for session
            $key = fn_crc32(microtime()) . fn_crc32(microtime() + 1);
            fn_set_storage_data('session_' . $key . '_data', serialize($sess_data));
            if (fn_allowed_for('ULTIMATE')) {
                $company_id_in_url = fn_get_company_id_from_uri($redirect_url);
                if (Registry::get('runtime.company_id') || !empty($user_data['company_id']) || Registry::get('runtime.simple_ultimate') || !empty($company_id_in_url)) {
                    // Redirect to the personal frontend
                    $company_id = !empty($user_data['company_id']) ? $user_data['company_id'] : Registry::get('runtime.company_id');
                    if (!$company_id && Registry::get('runtime.simple_ultimate')) {
                        $company_id = fn_get_default_company_id();
                    } elseif (!$company_id) {
                        $company_id = $company_id_in_url;
                    }
                    $url = $area == 'C' ? fn_link_attach($redirect_url, 'skey=' . $key . '&company_id=' . $company_id) : $redirect_url;
                    return array(CONTROLLER_STATUS_REDIRECT, fn_url($url, $area), true);
                }
            } else {
                $url = fn_link_attach($redirect_url, 'skey=' . $key);
                return array(CONTROLLER_STATUS_REDIRECT, fn_url($url, $area), true);
            }
        }
        return array(CONTROLLER_STATUS_REDIRECT, fn_url($redirect_url, $area));
    }
} elseif ($mode == 'picker') {
    $params = $_REQUEST;
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:profiles.php

示例10: fn_mailru_put_header

function fn_mailru_put_header($filename)
{
    $_SESSION['mailru_export_count'] = 0;
    $shop_name = Registry::get('addons.rus_tovary_mailru.shop_name');
    if (empty($shop_name)) {
        if (fn_allowed_for('ULTIMATE')) {
            $company_id = Registry::ifGet('runtime.company_id', fn_get_default_company_id());
            $shop_name = fn_get_company_name($company_id);
        } else {
            $shop_name = Registry::get('settings.Company.company_name');
        }
    }
    $shop_name = strip_tags($shop_name);
    $yml_header = array('<?xml version="1.0" encoding="' . Registry::get('addons.rus_tovary_mailru.export_encoding') . '"?>', '<torg_price date="' . date('Y-m-d G:i') . '">', '<shop>');
    $yml = array('shopname' => $shop_name, 'company' => Registry::get('settings.Company.company_name'), 'url' => Registry::get('config.http_location'));
    $currencies = Registry::get('currencies');
    if (CART_PRIMARY_CURRENCY != "RUB") {
        $rub_coefficient = !empty($currencies['RUB']) ? $currencies['RUB']['coefficient'] : 1;
        $primary_coefficient = $currencies[CART_PRIMARY_CURRENCY]['coefficient'];
        foreach ($currencies as $cur) {
            if (fn_mailru_check_currencies($cur['currency_code']) && $cur['status'] == 'A') {
                if ($cur['currency_code'] == "RUB") {
                    $coefficient = '1.0000';
                    $yml['currencies']['currency@id=' . $cur['currency_code'] . '@rate=' . $coefficient] = '';
                } else {
                    $coefficient = $cur['coefficient'] * $primary_coefficient / $rub_coefficient;
                    $yml['currencies']['currency@id=' . $cur['currency_code'] . '@rate=' . $coefficient] = '';
                }
            }
        }
    } else {
        foreach ($currencies as $cur) {
            if (fn_mailru_check_currencies($cur['currency_code']) && $cur['status'] == 'A') {
                $yml['currencies']['currency@id=' . $cur['currency_code'] . '@rate=' . $cur['coefficient']] = '';
            }
        }
    }
    $params = array('simple' => false, 'plain' => true);
    if (fn_allowed_for('ULTIMATE') && is_numeric($shop_name)) {
        $params['company_ids'] = $shop_name;
    }
    list($categories_tree, ) = fn_get_categories($params);
    foreach ($categories_tree as $cat) {
        if (isset($cat['category_id'])) {
            $yml['categories']['category@id=' . $cat['category_id'] . '@parentId=' . $cat['parent_id']] = htmlspecialchars($cat['category']);
        }
    }
    $yml_data = implode("\n", $yml_header) . "\n" . fn_mailru_array_to_yml($yml) . "<offers>\n";
    fn_mailru_write_yml($filename, 'w+', $yml_data);
}
开发者ID:ambient-lounge,项目名称:site,代码行数:50,代码来源:func.php

示例11: correctCompanyID

 public function correctCompanyID(&$params)
 {
     if (fn_allowed_for('ULTIMATE')) {
         if (empty($params['company_id'])) {
             $params['company_id'] = fn_get_default_company_id();
         }
     } elseif (fn_allowed_for('MULTIVENDOR')) {
         $runtime_company_id = Registry::get('runtime.company_id');
         // Root admin can set any company ID to the object
         // Vendor admin can't handle company ID
         if ($runtime_company_id != 0 || !isset($params['company_id'])) {
             $params['company_id'] = $runtime_company_id;
         }
     }
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:15,代码来源:Shippings.php

示例12: fn_update_user

/**
 * Add/update user
 *
 * @param int $user_id - user ID to update (empty for new user)
 * @param array $user_data - user data
 * @param array $auth - authentication information
 * @param bool $ship_to_another - flag indicates that shipping and billing fields are different
 * @param bool $notify_user - flag indicates that user should be notified
 * @return array with user ID and profile ID if success, false otherwise
 */
function fn_update_user($user_id, $user_data, &$auth, $ship_to_another, $notify_user)
{
    /**
     * Actions before updating user
     *
     * @param int   $user_id         User ID to update (empty for new user)
     * @param array $user_data       User data
     * @param array $auth            Authentication information
     * @param bool  $ship_to_another Flag indicates that shipping and billing fields are different
     * @param bool  $notify_user     Flag indicates that user should be notified
     */
    fn_set_hook('update_user_pre', $user_id, $user_data, $auth, $ship_to_another, $notify_user);
    array_walk($user_data, 'fn_trim_helper');
    $register_at_checkout = isset($user_data['register_at_checkout']) && $user_data['register_at_checkout'] == 'Y' ? true : false;
    if (fn_allowed_for('ULTIMATE')) {
        if (AREA == 'A' && !empty($user_data['user_type']) && $user_data['user_type'] == 'C' && (empty($user_data['company_id']) || Registry::get('runtime.company_id') && $user_data['company_id'] != Registry::get('runtime.company_id'))) {
            fn_set_notification('W', __('warning'), __('access_denied'));
            return false;
        }
    }
    if (!empty($user_id)) {
        $current_user_data = db_get_row("SELECT user_id, company_id, is_root, status, user_type, user_login, lang_code, password, salt, last_passwords FROM ?:users WHERE user_id = ?i", $user_id);
        if (empty($current_user_data)) {
            fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('user'))), '', '404');
            return false;
        }
        if (!fn_check_editable_permissions($auth, $current_user_data)) {
            fn_set_notification('E', __('error'), __('access_denied'));
            return false;
        }
        if (!empty($user_data['profile_id']) && AREA != 'A') {
            $profile_ids = db_get_fields("SELECT profile_id FROM ?:user_profiles WHERE user_id = ?i", $user_id);
            if (!in_array($user_data['profile_id'], $profile_ids)) {
                fn_set_notification('W', __('warning'), __('access_denied'));
                return false;
            }
        }
        if (fn_allowed_for('ULTIMATE')) {
            if (AREA != 'A' || empty($user_data['company_id'])) {
                //we should set company_id for the frontdend, in the backend company_id received from form
                if ($current_user_data['user_type'] == 'A') {
                    if (!isset($user_data['company_id']) || AREA != 'A' || Registry::get('runtime.company_id')) {
                        // reset administrator's company if it was not set to root
                        $user_data['company_id'] = $current_user_data['company_id'];
                    }
                } elseif (Registry::get('settings.Stores.share_users') == 'Y') {
                    $user_data['company_id'] = $current_user_data['company_id'];
                } else {
                    $user_data['company_id'] = Registry::ifGet('runtime.company_id', 1);
                }
            }
        }
        if (fn_allowed_for('MULTIVENDOR')) {
            if (AREA != 'A') {
                //we should set company_id for the frontend
                $user_data['company_id'] = $current_user_data['company_id'];
            }
        }
        $action = 'update';
    } else {
        $current_user_data = array('status' => AREA != 'A' && Registry::get('settings.General.approve_user_profiles') == 'Y' ? 'D' : (!empty($user_data['status']) ? $user_data['status'] : 'A'), 'user_type' => 'C');
        if (fn_allowed_for('ULTIMATE')) {
            if (!empty($user_data['company_id']) || Registry::get('runtime.company_id') || AREA == 'A') {
                //company_id can be received when we create user account from the backend
                $company_id = !empty($user_data['company_id']) ? $user_data['company_id'] : Registry::get('runtime.company_id');
                if (empty($company_id)) {
                    $company_id = fn_check_user_type_admin_area($user_data['user_type']) ? $user_data['company_id'] : fn_get_default_company_id();
                }
                $user_data['company_id'] = $current_user_data['company_id'] = $company_id;
            } else {
                fn_set_notification('W', __('warning'), __('access_denied'));
                return false;
            }
        }
        $action = 'add';
        $user_data['lang_code'] = !empty($user_data['lang_code']) ? $user_data['lang_code'] : CART_LANGUAGE;
        $user_data['timestamp'] = TIME;
    }
    $original_password = '';
    $current_user_data['password'] = !empty($current_user_data['password']) ? $current_user_data['password'] : '';
    $current_user_data['salt'] = !empty($current_user_data['salt']) ? $current_user_data['salt'] : '';
    // Set the user type
    $user_data['user_type'] = fn_check_user_type($user_data, $current_user_data);
    if (Registry::get('runtime.company_id') && !fn_allowed_for('ULTIMATE') && (!fn_check_user_type_admin_area($user_data['user_type']) || isset($current_user_data['company_id']) && $current_user_data['company_id'] != Registry::get('runtime.company_id'))) {
        fn_set_notification('W', __('warning'), __('access_denied'));
        return false;
    }
    // Check if this user needs login/password
    if (fn_user_need_login($user_data['user_type'])) {
        // Check if user_login already exists
//.........这里部分代码省略.........
开发者ID:askzap,项目名称:ultimate,代码行数:101,代码来源:fn.users.php

示例13: fn_get_default_supplier_id

/**
 * Get default supplier id
 *
 * @param int $company_id Supplier company_id
 * @return int Default supplier id
 */
function fn_get_default_supplier_id($company_id = 0)
{
    if (empty($company_id)) {
        $company_id = Registry::ifGet('runtime.company_id', fn_get_default_company_id());
    }
    return db_get_field("SELECT supplier_id FROM ?:suppliers WHERE status = 'A' AND company_id = ?i ORDER BY supplier_id LIMIT 1", $company_id);
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:13,代码来源:func.php

示例14: fn_update_ebay_template

function fn_update_ebay_template($data, $template_id = 0, $lang_code = CART_LANGUAGE)
{
    if (empty($data['name'])) {
        return false;
    }
    unset($data['template_id']);
    if (fn_allowed_for('ULTIMATE')) {
        // check that template owner was not changed by store administrator
        if (Registry::get('runtime.company_id') || empty($data['company_id'])) {
            $template_company_id = db_get_field('SELECT company_id FROM ?:ebay_templates WHERE template_id = ?i', $template_id);
            if (!empty($template_company_id)) {
                $data['company_id'] = $template_company_id;
            } else {
                if (Registry::get('runtime.company_id')) {
                    $template_company_id = $data['company_id'] = Registry::get('runtime.company_id');
                } else {
                    $template_company_id = $data['company_id'] = fn_get_default_company_id();
                }
            }
        } else {
            $template_company_id = $data['company_id'];
        }
    } else {
        if (Registry::get('runtime.company_id')) {
            $template_company_id = Registry::get('runtime.company_id');
        } else {
            $template_company_id = $data['company_id'];
        }
    }
    if (fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id') && !empty($template_company_id) && Registry::get('runtime.company_id') != $template_company_id) {
        $create = false;
    } else {
        if (isset($data['payment_methods']) && is_array($data['payment_methods'])) {
            $data['payment_methods'] = implode(',', $data['payment_methods']);
        }
        if (empty($data['root_sec_category'])) {
            $data['sec_category'] = '';
        }
        if (!empty($template_id)) {
            db_query('UPDATE ?:ebay_templates SET ?u WHERE template_id = ?i', $data, $template_id);
            db_query('UPDATE ?:ebay_template_descriptions SET ?u WHERE template_id = ?i AND lang_code = ?s', $data, $template_id, $lang_code);
            if (isset($_REQUEST['share_objects']) && isset($_REQUEST['share_objects']['ebay_templates']) && isset($_REQUEST['share_objects']['ebay_templates'][$template_id])) {
                $_products = db_get_fields("SELECT product_id FROM ?:products WHERE company_id NOT IN (?a) AND ebay_template_id = ?i", $_REQUEST['share_objects']['ebay_templates'][$template_id], $template_id);
                if (!empty($_products)) {
                    db_query("UPDATE ?:products SET ebay_template_id = 0 WHERE product_id IN (?a)", $_products);
                }
            }
        } else {
            $data['template_id'] = $template_id = db_query("INSERT INTO ?:ebay_templates ?e", $data);
            if (isset($data['name']) && empty($data['name'])) {
                unset($data['name']);
            }
            if (!empty($data['name'])) {
                foreach (fn_get_translation_languages() as $data['lang_code'] => $_v) {
                    db_query("INSERT INTO ?:ebay_template_descriptions ?e", $data);
                }
            }
        }
        if ($data['use_as_default'] == 'Y') {
            db_query('UPDATE ?:ebay_templates SET use_as_default = ?s WHERE company_id = ?i AND NOT template_id = ?i', 'N', $template_company_id, $template_id);
        }
    }
    return $template_id;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:64,代码来源:func.php


注:本文中的fn_get_default_company_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。