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


PHP fn_fill_auth函数代码示例

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


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

示例1: apiUpdateOrder

 public static function apiUpdateOrder($order, $response)
 {
     if (!defined('ORDER_MANAGEMENT')) {
         define('ORDER_MANAGEMENT', true);
     }
     if (!empty($order['status'])) {
         $statuses = fn_get_statuses(STATUSES_ORDER, false, true);
         if (!isset($statuses[$order['status']])) {
             $response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'orders', __('twgadmin_wrong_api_object_data')));
         } else {
             fn_change_order_status($order['order_id'], $order['status']);
         }
     }
     $cart = array();
     fn_clear_cart($cart, true);
     $customer_auth = fn_fill_auth(array(), array(), false, 'C');
     fn_form_cart($order['order_id'], $cart, $customer_auth);
     $cart['order_id'] = $order['order_id'];
     // update only profile data
     $profile_data = fn_check_table_fields($order, 'user_profiles');
     $cart['user_data'] = fn_array_merge($cart['user_data'], $profile_data);
     $cart['user_data'] = fn_array_merge($cart['user_data'], $order);
     fn_calculate_cart_content($cart, $customer_auth, 'A', true, 'I');
     if (!empty($order['details'])) {
         db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $order['details'], $order['order_id']);
     }
     if (!empty($order['notes'])) {
         $cart['notes'] = $order['notes'];
     }
     fn_update_payment_surcharge($cart, $customer_auth);
     list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, 'save');
     return array($order_id, $process_payment);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:33,代码来源:TwigmoOrder.php

示例2: actionComplete

 /**
  * Setup complete action
  *
  * @param array $params Request variables
  *
  * @return bool Always true
  */
 public function actionComplete($params = array())
 {
     $validator = new Validator();
     $app = App::instance();
     fn_define('CART_LANGUAGE', $app->getCurrentLangCode());
     fn_define('DESCR_SL', $app->getCurrentLangCode());
     $database = $app->getFromStorage('database_settings');
     if (!empty($database)) {
         $result = $validator->isMysqlSettingsValid($database['host'], $database['name'], $database['user'], $database['password'], $database['table_prefix'], $database['database_backend'], false);
         if ($result) {
             // Delete installer after store was installed.
             fn_rm(Registry::get('config.dir.root') . '/install');
             session_destroy();
             $this->_prepareHttpData();
             Session::init($params);
             $user_data = array('user_id' => 1, 'user_type' => 'A', 'area' => 'A', 'login' => 'admin', 'is_root' => 'Y', 'company_id' => 0);
             $_SESSION['auth'] = fn_fill_auth($user_data, array(), false, 'A');
             if (is_file(Registry::get('config.dir.root') . '/install/index.php')) {
                 $_SESSION['notifications']['installer'] = array('type' => 'W', 'title' => 'warning', 'message' => 'delete_install_folder', 'message_state' => 'S', 'new' => true, 'extra' => '', 'init_message' => true);
             }
             $redirect_url = Registry::get('config.http_location') . '/' . Registry::get('config.admin_index') . '?welcome';
             fn_redirect($redirect_url);
         }
     }
     fn_redirect('install/index.php');
     return true;
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:34,代码来源:SetupController.php

示例3: fn_exim_google_export_format_price

function fn_exim_google_export_format_price($product_price, $product_id = 0)
{
    static $auth;
    if (empty($auth)) {
        $auth = fn_fill_auth();
    }
    $product = fn_get_product_data($product_id, $auth, CART_LANGUAGE, false, false, false, false, false, false, false);
    fn_promotion_apply('catalog', $product, $auth);
    $_discount = 0;
    if (!empty($product['discount'])) {
        $_discount = $product['discount'];
    }
    return fn_format_price($product_price - $_discount, CART_PRIMARY_CURRENCY, null, false);
}
开发者ID:askzap,项目名称:ultimate,代码行数:14,代码来源:products.functions.php

示例4: fn_form_cart

function fn_form_cart($order_id, &$cart, &$auth)
{
    $order_info = fn_get_order_info($order_id, false, false);
    if (empty($order_info)) {
        fn_set_notification('E', __('error'), __('object_not_found', array('[object]' => __('order'))), '', '404');
        return false;
    }
    // Fill the cart
    foreach ($order_info['products'] as $_id => $item) {
        $_item = array($item['product_id'] => array('amount' => $item['amount'], 'product_options' => !empty($item['extra']['product_options']) ? $item['extra']['product_options'] : array(), 'price' => $item['original_price'], 'stored_discount' => 'Y', 'stored_price' => 'Y', 'discount' => !empty($item['extra']['discount']) ? $item['extra']['discount'] : 0, 'original_amount' => $item['amount'], 'original_product_data' => array('cart_id' => $_id, 'amount' => $item['amount'])));
        if (isset($item['extra'])) {
            $_item[$item['product_id']]['extra'] = $item['extra'];
        }
        fn_add_product_to_cart($_item, $cart, $auth);
    }
    // Workaround for the add-ons that do not add a product to cart unless the parent product is already added.
    if (count($order_info['products']) > count($cart['products'])) {
        foreach ($order_info['products'] as $_id => $item) {
            if (empty($cart['products'][$_id])) {
                $_item = array($item['product_id'] => array('amount' => $item['amount'], 'product_options' => !empty($item['extra']['product_options']) ? $item['extra']['product_options'] : array(), 'price' => $item['original_price'], 'stored_discount' => 'Y', 'stored_price' => 'Y', 'discount' => !empty($item['extra']['discount']) ? $item['extra']['discount'] : 0, 'original_amount' => $item['amount'], 'original_product_data' => array('cart_id' => $_id, 'amount' => $item['amount'])));
                if (isset($item['extra'])) {
                    $_item[$item['product_id']]['extra'] = $item['extra'];
                }
                fn_add_product_to_cart($_item, $cart, $auth);
            }
        }
    }
    // Restore custom files
    $dir_path = 'order_data/' . $order_id;
    if (Storage::instance('custom_files')->isExist($dir_path)) {
        Storage::instance('custom_files')->copy($dir_path, 'sess_data');
    }
    $cart['payment_id'] = $order_info['payment_id'];
    $cart['stored_taxes'] = 'Y';
    $cart['stored_discount'] = 'Y';
    $cart['taxes'] = $order_info['taxes'];
    $cart['promotions'] = !empty($order_info['promotions']) ? $order_info['promotions'] : array();
    $cart['shipping'] = !empty($order_info['shipping']) ? $order_info['shipping'] : array();
    $cart['stored_shipping'] = array();
    foreach ($cart['shipping'] as $sh_id => $v) {
        if (!empty($v['rates'])) {
            $cart['stored_shipping'][$sh_id] = array_sum($v['rates']);
        }
    }
    if (!empty($order_info['product_groups'])) {
        $cart['product_groups'] = $order_info['product_groups'];
        foreach ($order_info['product_groups'] as $group) {
            if (!empty($group['chosen_shippings'])) {
                foreach ($group['chosen_shippings'] as $key => $chosen_shipping) {
                    foreach ($group['shippings'] as $shipping_id => $shipping) {
                        if ($shipping_id == $chosen_shipping['shipping_id']) {
                            $cart['chosen_shipping'][$chosen_shipping['group_key']] = $shipping_id;
                        }
                    }
                }
            }
        }
    } else {
        $cart['product_groups'] = array();
    }
    $cart['order_timestamp'] = $order_info['timestamp'];
    $cart['notes'] = $order_info['notes'];
    $cart['details'] = $order_info['details'];
    $cart['payment_info'] = @$order_info['payment_info'];
    $cart['profile_id'] = $order_info['profile_id'];
    // Add order discount
    if (floatval($order_info['subtotal_discount'])) {
        $cart['stored_subtotal_discount'] = 'Y';
        $cart['subtotal_discount'] = $cart['original_subtotal_discount'] = fn_format_price($order_info['subtotal_discount']);
    }
    // Fill the cart with the coupons
    if (!empty($order_info['coupons'])) {
        $cart['coupons'] = $order_info['coupons'];
    }
    // Set the customer if exists
    $_data = array();
    if (!empty($order_info['user_id'])) {
        $_data = db_get_row("SELECT user_id, user_login as login FROM ?:users WHERE user_id = ?i", $order_info['user_id']);
    }
    $auth = fn_fill_auth($_data, array(), false, 'C');
    $auth['tax_exempt'] = $order_info['tax_exempt'];
    // Fill customer info
    $cart['user_data'] = fn_array_merge(fn_check_table_fields($order_info, 'users'), fn_check_table_fields($order_info, 'user_profiles'));
    if (!empty($order_info['fields'])) {
        $cart['user_data']['fields'] = $order_info['fields'];
    }
    fn_add_user_data_descriptions($cart['user_data']);
    fn_set_hook('form_cart', $order_info, $cart, $auth);
    return true;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:90,代码来源:fn.cart.php

示例5: fn_process_paypal_ipn

function fn_process_paypal_ipn($order_id, $data)
{
    $order_info = fn_get_order_info($order_id);
    if (!empty($order_info) && !empty($data['txn_id']) && (empty($order_info['payment_info']['txn_id']) || $data['payment_status'] != 'Completed' || $data['payment_status'] == 'Completed' && $order_info['payment_info']['txn_id'] !== $data['txn_id'])) {
        //Can't check refund transactions.
        if (isset($data['txn_type']) && !fn_validate_paypal_order_info($data, $order_info)) {
            return false;
        }
        $pp_settings = fn_get_paypal_settings();
        fn_clear_cart($cart, true);
        $customer_auth = fn_fill_auth(array(), array(), false, 'C');
        fn_form_cart($order_id, $cart, $customer_auth);
        if ($pp_settings['override_customer_info'] == 'Y') {
            $cart['user_data'] = fn_paypal_get_customer_info($data);
        }
        $cart['order_id'] = $order_id;
        $cart['payment_info'] = $order_info['payment_info'];
        $cart['payment_info']['protection_eligibility'] = !empty($data['protection_eligibility']) ? $data['protection_eligibility'] : '';
        $cart['payment_id'] = $order_info['payment_id'];
        if (!empty($data['memo'])) {
            //Save customer notes
            $cart['notes'] = $data['memo'];
        }
        if ($data['payment_status'] == 'Completed') {
            //save uniq ipn id to avoid double ipn processing
            $cart['payment_info']['txn_id'] = $data['txn_id'];
        }
        if (!empty($data['payer_email'])) {
            $cart['payment_info']['customer_email'] = $data['payer_email'];
        }
        if (!empty($data['payer_id'])) {
            $cart['payment_info']['client_id'] = $data['payer_id'];
        }
        //Sometimes, for some reasons cart_id in product products calculated incorrectle, so we need recalculate it.
        $cart['change_cart_products'] = true;
        fn_calculate_cart_content($cart, $customer_auth);
        $cart['payment_info']['order_status'] = $pp_settings['pp_statuses'][strtolower($data['payment_status'])];
        list($order_id, ) = fn_update_order($cart, $order_id);
        if ($order_id) {
            fn_change_order_status($order_id, $pp_settings['pp_statuses'][strtolower($data['payment_status'])]);
            if (fn_allowed_for('MULTIVENDOR')) {
                $child_order_ids = db_get_fields("SELECT order_id FROM ?:orders WHERE parent_order_id = ?i", $order_id);
                if (!empty($child_order_ids)) {
                    foreach ($child_order_ids as $child_order_id) {
                        fn_update_order_payment_info($child_order_id, $cart['payment_info']);
                    }
                }
            }
        }
        return true;
    }
}
开发者ID:askzap,项目名称:ultimate,代码行数:52,代码来源:func.php

示例6: fn_qwintry_fn_form_cart

function fn_qwintry_fn_form_cart($order_info)
{
    fn_clear_cart($cart, true);
    $customer_auth = fn_fill_auth();
    fn_form_cart($order_info['order_id'], $cart, $customer_auth, array());
    list($cart_products, ) = fn_calculate_cart_content($cart, $customer_auth, 'E', false, 'F', false);
    if (!empty($cart_products)) {
        foreach ($cart_products as $k => $v) {
            fn_gather_additional_product_data($cart_products[$k], false, false, true, false);
        }
    }
    $cart['products'] = $cart_products;
    return $cart;
}
开发者ID:qwintry,项目名称:logistics-cscart,代码行数:14,代码来源:func.php

示例7: fn_login_user

/**
 * Log in user using only user id
 * return 0 - we can't find user with provided user_id
 * return 1 - user was successfully loggined
 * return 2 - user disabled
 *
 */
function fn_login_user($user_id = '')
{
    $udata = array();
    $auth =& $_SESSION['auth'];
    $condition = '';
    $result = LOGIN_STATUS_USER_NOT_FOUND;
    fn_set_hook('login_user_pre', $user_id, $udata, $auth, $condition);
    if (!empty($user_id)) {
        if (fn_allowed_for('ULTIMATE')) {
            if (Registry::get('settings.Stores.share_users') == 'N' && AREA != 'A') {
                $condition .= fn_get_company_condition('?:users.company_id');
            }
        }
        $udata = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i AND status = 'A'" . $condition, $user_id);
        if (empty($udata)) {
            $udata = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i AND user_type IN ('A', 'V', 'P')", $user_id);
        }
        unset($_SESSION['status']);
        $auth = fn_fill_auth($udata, $auth);
        if (!empty($udata)) {
            fn_set_hook('sucess_user_login', $udata, $auth);
            if (AREA == 'C') {
                if ($cu_id = fn_get_session_data('cu_id')) {
                    fn_clear_cart($cart);
                    fn_save_cart_content($cart, $cu_id, 'C', 'U');
                    fn_delete_session_data('cu_id');
                }
                fn_init_user_session_data($_SESSION, $udata['user_id']);
            }
            // Set last login time
            db_query("UPDATE ?:users SET ?u WHERE user_id = ?i", array('last_login' => TIME), $user_id);
            // Log user successful login
            fn_log_event('users', 'session', array('user_id' => $user_id));
            $result = LOGIN_STATUS_OK;
        } else {
            $result = LOGIN_STATUS_USER_DISABLED;
        }
    } else {
        $auth = fn_fill_auth($udata, $auth);
        $result = LOGIN_STATUS_USER_NOT_FOUND;
    }
    fn_init_user();
    fn_set_hook('login_user_post', $user_id, $cu_id, $udata, $auth, $condition, $result);
    return $result;
}
开发者ID:askzap,项目名称:ultimate,代码行数:52,代码来源:fn.users.php

示例8: fn_get_company_condition

 if (fn_allowed_for('MULTIVENDOR') && $mode == 'act_as_user') {
     $condition = fn_get_company_condition('?:users.company_id');
 }
 $user_data = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i {$condition}", $_REQUEST['user_id']);
 if (!empty($user_data)) {
     if (!empty($_REQUEST['area'])) {
         $area = $_REQUEST['area'];
     } else {
         $area = fn_check_user_type_admin_area($user_data) ? 'A' : 'C';
     }
     if (fn_allowed_for('MULTIVENDOR')) {
         if ($user_data['user_type'] == 'V') {
             $area = $area == 'A' ? 'V' : $area;
         }
     }
     $sess_data = array('auth' => fn_fill_auth($user_data, array(), true, $area), 'last_status' => empty($_SESSION['last_status']) ? '' : $_SESSION['last_status']);
     if (Registry::get('settings.General.store_mode') == 'Y') {
         $sess_data['store_access_key'] = Registry::get('settings.General.store_access_key');
     }
     $areas = array('A' => 'admin', 'V' => 'vendor', 'C' => 'customer');
     fn_init_user_session_data($sess_data, $_REQUEST['user_id'], true);
     $old_sess_id = Session::getId();
     $redirect_url = !empty($_REQUEST['redirect_url']) ? $_REQUEST['redirect_url'] : '';
     if ($area != 'C') {
         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
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:profiles.php

示例9: db_query

}
//
// Recover password mode
//
if ($mode == 'recover_password') {
    // Cleanup expired keys
    db_query("DELETE FROM ?:ekeys WHERE ttl > 0 AND ttl < ?i", TIME);
    // FIXME: should be moved to another place
    if (!empty($_REQUEST['ekey'])) {
        $u_id = db_get_field("SELECT object_id FROM ?:ekeys WHERE ekey = ?s AND object_type = 'U' AND ttl > ?i", $_REQUEST['ekey'], TIME);
        if (!empty($u_id)) {
            $udata = db_get_row("SELECT user_id, user_type, tax_exempt, last_login, password_change_timestamp FROM ?:users WHERE user_id = ?i AND status = 'A'", $u_id);
            // Delete this key
            db_query("DELETE FROM ?:ekeys WHERE ekey = ?s", $_REQUEST['ekey']);
            if (!empty($udata)) {
                $auth = fn_fill_auth($udata, isset($auth['order_ids']) ? $auth['order_ids'] : array());
                if (AREA == 'C') {
                    if ($cu_id = fn_get_cookie('cu_id')) {
                        fn_clear_cart($cart);
                        fn_save_cart_content($cart, $cu_id, 'C', 'U');
                        fn_delete_cookies('cu_id');
                    }
                    fn_init_user_session_data($_SESSION, $udata['user_id']);
                }
                fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('text_change_password'));
                return array(CONTROLLER_STATUS_OK, "profiles.update");
            } else {
                fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_account_disabled'));
                return array(CONTROLLER_STATUS_OK, $index_script);
            }
        } else {
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:auth.php

示例10: fn_get_user_type_description

        $view->assign('user_type_description', fn_get_user_type_description($search['user_type']));
    }
    $view->assign('user_types', fn_get_user_types());
    $view->assign('countries', fn_get_countries(CART_LANGUAGE, true));
    $view->assign('states', fn_get_all_states());
    $view->assign('usergroups', fn_get_usergroups('F', DESCR_SL));
} elseif ($mode == 'act_as_user') {
    if (fn_is_restricted_admin($_REQUEST) == true) {
        return array(CONTROLLER_STATUS_DENIED);
    }
    $condition = fn_get_company_condition();
    $user_data = db_get_row("SELECT * FROM ?:users WHERE user_id = ?i {$condition}", $_REQUEST['user_id']);
    if (!empty($user_data)) {
        $user_type = empty($_REQUEST['area']) ? $user_data['user_type'] == 'A' ? 'A' : 'C' : $_REQUEST['area'];
        // 'area' variable was used for loging in to the area different from the user type.
        $sess_data = array('auth' => fn_fill_auth($user_data, array(), true, $user_type));
        fn_init_user_session_data($sess_data, $_REQUEST['user_id']);
        Session::save(Session::get_id(), $sess_data, $user_type);
        return array(CONTROLLER_STATUS_REDIRECT, $user_type == 'A' ? Registry::get('config.admin_index') : Registry::get('config.customer_index'));
    }
} elseif ($mode == 'picker') {
    $params = $_REQUEST;
    $params['exclude_user_types'] = array('A', 'S');
    $params['skip_view'] = 'Y';
    list($users, $search) = fn_get_users($params, $auth, Registry::get('settings.Appearance.admin_elements_per_page'));
    $view->assign('users', $users);
    $view->assign('search', $search);
    $view->assign('countries', fn_get_countries(CART_LANGUAGE, true));
    $view->assign('states', fn_get_all_states());
    $view->assign('usergroups', fn_get_usergroups('F', CART_LANGUAGE));
    $view->display('pickers/users_picker_contents.tpl');
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:profiles.php

示例11: update

 public function update($id, $params)
 {
     fn_define('ORDER_MANAGEMENT', true);
     $data = array();
     $valid_params = true;
     $status = Response::STATUS_BAD_REQUEST;
     if ($valid_params) {
         fn_clear_cart($cart, true);
         $customer_auth = fn_fill_auth(array(), array(), false, 'C');
         $cart_status = md5(serialize($cart));
         // Order info was not found or customer does not have enought permissions
         if (fn_form_cart($id, $cart, $customer_auth) && $cart_status != md5(serialize($cart))) {
             unset($params['product_groups']);
             if (empty($params['shipping_id'])) {
                 $shipping = reset($cart['shipping']);
                 if (!empty($shipping['shipping_id'])) {
                     $params['shipping_id'] = $shipping['shipping_id'];
                 }
             }
             $cart['order_id'] = $id;
             fn_calculate_cart_content($cart, $customer_auth);
             if (!empty($params['user_id'])) {
                 $cart['user_data'] = fn_get_user_info($params['user_id']);
             } elseif (!empty($params)) {
                 $cart['user_data'] = array_merge($cart['user_data'], $params);
             }
             if (!empty($cart['product_groups']) && !empty($params['shipping_id'])) {
                 foreach ($cart['product_groups'] as $key => $group) {
                     foreach ($group['shippings'] as $shipping_id => $shipping) {
                         if ($params['shipping_id'] == $shipping['shipping_id']) {
                             $cart['chosen_shipping'][$key] = $shipping_id;
                             break;
                         }
                     }
                 }
             }
             if (!empty($params['payment_id'])) {
                 if (!empty($params['payment_info'])) {
                     $cart['payment_info'] = $params['payment_info'];
                 } elseif ($params['payment_id'] != $cart['payment_id']) {
                     $cart['payment_info'] = array();
                 }
                 $cart['payment_id'] = $params['payment_id'];
             }
             if (!empty($params['products'])) {
                 $cart['products'] = $params['products'];
             }
             fn_calculate_cart_content($cart, $customer_auth);
             if (!empty($cart) && empty($cart['shipping_failed'])) {
                 $cart['parent_order_id'] = 0;
                 fn_update_payment_surcharge($cart, $customer_auth);
                 list($order_id, $order_status) = fn_update_order($cart, $id);
                 if ($order_id) {
                     if (!empty($params['status']) && fn_check_permissions('orders', 'update_status', 'admin')) {
                         fn_change_order_status($order_id, $params['status'], '', fn_get_notification_rules($params, false));
                     } elseif (!empty($order_status)) {
                         fn_change_order_status($order_id, $order_status, '', fn_get_notification_rules($params, false));
                     }
                     $status = Response::STATUS_OK;
                     $data = array('order_id' => $order_id);
                 }
             }
         }
     }
     return array('status' => $status, 'data' => $data);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:66,代码来源:Orders.php

示例12: authenticate

 /**
  * Tries to authenticate user
  *
  * @return bool True on success, false otherwise
  */
 protected function authenticate()
 {
     $user_data = $this->getUserData();
     $this->auth = $_SESSION['auth'] = fn_fill_auth($user_data);
     // Return value must be bool
     return !empty($this->auth['user_id']);
 }
开发者ID:askzap,项目名称:ultimate,代码行数:12,代码来源:Api.php

示例13: authenticate

 /**
  * Tries to authenticate user
  *
  * @return bool True on success, false otherwise
  */
 private function authenticate()
 {
     $user_data = $this->getUserData();
     $this->auth = fn_fill_auth($user_data);
     // Return value must be bool
     return !empty($this->auth['user_id']);
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:12,代码来源:Api.php

示例14: die

* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Ebay\Ebay;
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$_SESSION['cart'] = isset($_SESSION['cart']) ? $_SESSION['cart'] : array();
$cart =& $_SESSION['cart'];
if (empty($cart)) {
    fn_clear_cart($cart, true);
}
$_SESSION['customer_auth'] = isset($_SESSION['customer_auth']) ? $_SESSION['customer_auth'] : array();
$customer_auth =& $_SESSION['customer_auth'];
if (empty($customer_auth)) {
    $customer_auth = fn_fill_auth(array(), array(), false, 'C');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($mode == 'update') {
        if ($template_id = fn_update_ebay_template($_REQUEST['template_data'], $_REQUEST['template_id'])) {
            return array(CONTROLLER_STATUS_OK, 'ebay.update?template_id=' . $template_id);
        } else {
            fn_save_post_data('template_data');
            fn_delete_notification('changes_saved');
        }
        return array(CONTROLLER_STATUS_OK, 'ebay.add');
    }
    if ($mode == 'm_delete') {
        foreach ($_REQUEST['template_ids'] as $template_id) {
            fn_delete_ebay_template($template_id);
        }
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:ebay.php

示例15: fn_exim_google_format_field

function fn_exim_google_format_field($data, $type, $product_id = 0, $option = '')
{
    if ($type == 'product') {
        return substr(strip_tags($data), 0, 80);
    } elseif ($type == 'product_type') {
        return !empty($option) ? $option : 'other';
    } elseif ($type == 'condition') {
        return !empty($option) ? $option : 'New';
    } elseif ($type == 'quantity') {
        if (Registry::get('settings.General.inventory_tracking') != 'Y') {
            return '';
        }
        $tracking = db_get_field("SELECT tracking FROM ?:products WHERE product_id = ?i", $product_id);
        if ($tracking == 'D') {
            return '';
        }
        if ($tracking == 'O') {
            $data = db_get_field("SELECT SUM(amount) FROM ?:product_options_inventory WHERE product_id = ?i AND amount >= 0", $product_id);
            if (empty($data)) {
                $data = 0;
            }
        }
        if ($data < 0 && Registry::get('settings.General.allow_negative_amount') == 'Y') {
            $data = '';
        }
        return $data;
    } elseif ($type == 'price') {
        $_discount = 0;
        if ($option == 'Y') {
            $auth = fn_fill_auth();
            $product = fn_get_product_data($product_id, $auth, CART_LANGUAGE, true, true, false, false, false);
            fn_promotion_apply('catalog', $product, $auth);
            if (!empty($product['discount'])) {
                $_discount = $product['discount'];
            }
        }
        return fn_format_price($data - $_discount);
    } elseif ($type == 'weight') {
        $data = floatval($data);
        if ($data > 0) {
            $weight_symbol = '';
            $gr_in_unit = Registry::get('settings.General.weight_symbol_grams');
            if (in_array(Registry::get('settings.General.weight_symbol'), fn_exim_google_get_weight_units())) {
                $weight_symbol = ' ' . Registry::get('settings.General.weight_symbol');
            } elseif (!empty($gr_in_unit) && (double) $gr_in_unit > 0) {
                $weight_symbol = ' grams';
                $data = $data * (double) $gr_in_unit;
            }
            $w = fn_format_price($data);
            if (floor($w) == $w) {
                $w = floor($w);
            }
            $data = $w . $weight_symbol;
        } else {
            $data = '';
        }
        return $data;
    } else {
        return strip_tags(str_replace(array('<br>', '<br />', '<BR>', '<BR />'), "\\n", $data));
    }
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:61,代码来源:google.php


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