本文整理汇总了PHP中fn_get_session_data函数 的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_session_data函数的具体用法?PHP fn_get_session_data怎么用?PHP fn_get_session_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_session_data函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fn_wishlist_sucess_user_login
function fn_wishlist_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, 'W', 'U');
}
}
}
开发者ID:askzap, 项目名称:ultimate, 代码行数:9, 代码来源:func.php
示例2: fn_set_notification
}
}
if ($_REQUEST['user_data']['email'] !== $_REQUEST['user_data']['email2']) {
fn_set_notification('W', __('warning'), __('error_validator_password', array('[field2]' => __('email'), '[field]' => __('validate_email'))));
$is_valid_user_data = false;
}
fn_restore_processed_user_password($_REQUEST['user_data'], $_POST['user_data']);
$res = fn_update_user($auth['user_id'], $_REQUEST['user_data'], $auth, !empty($_REQUEST['ship_to_another']), true);
if ($res) {
list($user_id, $profile_id) = $res;
// Cleanup user info stored in cart
if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['user_data'])) {
$_SESSION['cart']['user_data'] = fn_array_merge($_SESSION['cart']['user_data'], $_REQUEST['user_data']);
}
// Delete anonymous authentication
if ($cu_id = fn_get_session_data('cu_id') && !empty($auth['user_id'])) {
fn_delete_session_data('cu_id');
}
Session::regenerateId();
if (!empty($_REQUEST['return_url'])) {
return array(CONTROLLER_STATUS_OK, $_REQUEST['return_url']);
}
} else {
fn_save_post_data('user_data');
fn_delete_notification('changes_saved');
}
if (!empty($user_id) && !$is_update) {
$redirect_url = "profiles.success_add";
} else {
$redirect_url = "profiles." . (!empty($user_id) ? "update" : "add") . "?";
if (Registry::get('settings.General.user_multiple_profiles') == 'Y') {
开发者ID:OneataBogdan, 项目名称:lead_coriolan, 代码行数:31, 代码来源:profiles.php
示例3: fn_ls_check_all_option_variants_inventories
function fn_ls_check_all_option_variants_inventories($product_id, $product_options = array())
{
$options_variants_inventories = fn_product_variants_inventar($product_id, $product_options);
$fieldsOptionsVariantsLinksToProducts = "?:product_options.option_id, c.variant_id, d.product_id AS linked_prodict_id, d.product_nr, c.set_by_user, p.amount";
$conditionOptionsVariantsLinksToProducts = db_quote(' (?:product_options.product_id = ?i OR (?:product_options.product_id=0 AND n.product_id = ?i))', $_REQUEST['product_id'], $_REQUEST['product_id']);
$joinOptionsVariantsLinksToProducts = db_quote(' LEFT JOIN ?:product_global_option_links n ON ?:product_options.option_id = n.option_id ');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:product_option_variants c ON ?:product_options.option_id = c.option_id');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:product_option_variants_link d ON c.variant_id = d.option_variant_id');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:products p ON p.product_id = d.product_id');
$optsVariantsLinksToProducts = db_get_array("SELECT " . $fieldsOptionsVariantsLinksToProducts . " FROM ?:product_options " . $joinOptionsVariantsLinksToProducts . " WHERE " . $conditionOptionsVariantsLinksToProducts . " GROUP BY c.variant_id, ?:product_options.option_id" . " ORDER BY ?:product_options.position, c.position");
$optsVariantsLinksToProductsArray = array();
$optionVariantsToProductArray = array();
$optionVariantsToProductArrayStrings = array();
$options_variants_user_set_array = array();
$linked_product_amount = array();
$cart_user_id = $_SESSION['auth']['user_id'];
if (!$cart_user_id) {
$cart_user_id = fn_get_session_data('cu_id');
}
$cartProductInfo = db_get_array("SELECT extra, amount FROM ?:user_session_products WHERE product_id =?i AND user_id=?i", $product_id, intval($cart_user_id));
//$ordersProductInfo = db_get_array("SELECT ?:order_details.extra, ?:order_details.amount FROM ?:orders JOIN ?:order_details ON ?:order_details.order_id =?:orders.order_id WHERE ?:order_details.product_id =?i AND ?:orders.status IN ('O','B','F','P')", $product_id);
$productTransactionsInfoArray = array();
foreach ($cartProductInfo as $cartProductI) {
$extraUnserializedInfo = unserialize($cartProductI["extra"]);
foreach ($extraUnserializedInfo['product_options'] as $k1 => $v1) {
if (isset($productTransactionsInfoArray[$v1])) {
$productTransactionsInfoArray[$v1] += $cartProductI["amount"];
} else {
$productTransactionsInfoArray[$v1] = $cartProductI["amount"];
}
}
}
//var_dump($productTransactionsInfoArray);echo"<br/>_____<br/>";
// foreach($ordersProductInfo as $orderProductInfo){
// $extraUnserializedInfo = unserialize($orderProductInfo["extra"]);
//
// foreach($extraUnserializedInfo['product_options'] as $k1=>$v1){
// if(isset($productTransactionsInfoArray[$v1])){
// $productTransactionsInfoArray[$v1] += $orderProductInfo["amount"];
// }else{
// $productTransactionsInfoArray[$v1] = $orderProductInfo["amount"];
// }
// }
// }
//var_dump($productTransactionsInfoArray);echo"<br/>_____<br/>";
foreach ($optsVariantsLinksToProducts as $optVariantsLinksToProduct) {
if ($optVariantsLinksToProduct['amount'] >= $optVariantsLinksToProduct['product_nr']) {
$options_variants_inventories[$optVariantsLinksToProduct['option_id']][$optVariantsLinksToProduct['variant_id']] = $optVariantsLinksToProduct['amount'] - $productTransactionsInfoArray[$optVariantsLinksToProduct['variant_id']];
} else {
$options_variants_inventories[$optVariantsLinksToProduct['option_id']][$optVariantsLinksToProduct['variant_id']] = 0;
}
}
//var_dump($options_variants_inventories);
return $options_variants_inventories;
}
开发者ID:OneataBogdan, 项目名称:lead_coriolan, 代码行数:55, 代码来源:fn.catalog.php
示例4: fn_save_cart_content
function fn_save_cart_content(&$cart, $user_id, $type = 'C', $user_type = 'R')
{
if (empty($user_id)) {
if (fn_get_session_data('cu_id')) {
$user_id = fn_get_session_data('cu_id');
} else {
$user_id = fn_crc32(uniqid(TIME));
fn_set_session_data('cu_id', $user_id, COOKIE_ALIVE_TIME);
}
$user_type = 'U';
}
if (!empty($user_id)) {
$condition = db_quote("user_id = ?i AND type = ?s AND user_type = ?s", $user_id, $type, $user_type);
if (fn_allowed_for('ULTIMATE')) {
$condition .= fn_get_company_condition('?:user_session_products.company_id');
}
db_query("DELETE FROM ?:user_session_products WHERE " . $condition);
if (!empty($cart['products']) && is_array($cart['products'])) {
$_cart_prods = $cart['products'];
foreach ($_cart_prods as $_item_id => $_prod) {
$_cart_prods[$_item_id]['user_id'] = $user_id;
$_cart_prods[$_item_id]['timestamp'] = TIME;
$_cart_prods[$_item_id]['type'] = $type;
$_cart_prods[$_item_id]['user_type'] = $user_type;
$_cart_prods[$_item_id]['item_id'] = $_item_id;
$_cart_prods[$_item_id]['item_type'] = 'P';
$_cart_prods[$_item_id]['extra'] = serialize($_prod);
$_cart_prods[$_item_id]['amount'] = empty($_cart_prods[$_item_id]['amount']) ? 1 : $_cart_prods[$_item_id]['amount'];
$_cart_prods[$_item_id]['session_id'] = Session::getId();
$ip = fn_get_ip();
$_cart_prods[$_item_id]['ip_address'] = fn_ip_to_db($ip['host']);
if (fn_allowed_for('ULTIMATE')) {
$_cart_prods[$_item_id]['company_id'] = Registry::get('runtime.company_id');
}
if (!empty($_cart_prods[$_item_id])) {
db_query('REPLACE INTO ?:user_session_products ?e', $_cart_prods[$_item_id]);
}
}
}
fn_set_hook('save_cart', $cart, $user_id, $type);
}
return true;
}
开发者ID:heg-arc-ne, 项目名称:cscart, 代码行数:43, 代码来源:fn.cart.php
示例5: getNearPickpoints
protected function getNearPickpoints($pickup_points)
{
$key = md5($this->_shipping_info['shipping_id'] . implode('_', $this->_shipping_info['service_params']['deliveries']) . trim($this->_shipping_info['package_info']['location']['address']) . trim($this->_shipping_info['package_info']['location']['city']));
$near_pickoints = fn_get_session_data($key);
if (empty($near_pickoints)) {
$address = preg_split('/[ ,]+/', trim($this->_shipping_info['package_info']['location']['address']));
$address[] = trim($this->_shipping_info['package_info']['location']['city']);
$url = "https://geocode-maps.yandex.ru/1.x/";
$data = array('geocode' => implode('+', $address), 'format' => 'json', 'results' => 2, 'sco' => 'longlat');
$response = Http::post($url, $data);
$response = json_decode($response, true);
$response = $response['response']['GeoObjectCollection'];
if ($response['metaDataProperty']['GeocoderResponseMetaData']['found'] > 0) {
$object = reset($response['featureMember']);
$object = $object['GeoObject'];
$ll_address = explode(' ', $object['Point']['pos']);
}
$lat_pickoints = array();
$lng_pickoints = array();
$near_pickoints = array();
foreach ($pickup_points as $point) {
$lat_pickoints[$point['id']] = $point['lat'];
$lng_pickoints[$point['id']] = $point['lng'];
$near_pickoints[$point['id']] = sqrt(pow($lat_pickoints[$point['id']] - $ll_address[1], 2) + pow($lng_pickoints[$point['id']] - $ll_address[0], 2));
}
asort($near_pickoints);
fn_set_session_data($key, $near_pickoints, YD_CACHE_SESSION);
}
return $near_pickoints;
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:30, 代码来源:Yandex.php
示例6: db_quote
$fieldsOptionsVariantsLinksToProducts = "?:product_options.option_id, c.variant_id, d.product_id AS linked_prodict_id, c.set_by_user, p.amount";
$conditionOptionsVariantsLinksToProducts = db_quote(' (?:product_options.product_id = ?i OR (?:product_options.product_id=0 AND n.product_id = ?i))', $product_id, $product_id);
$joinOptionsVariantsLinksToProducts = db_quote(' LEFT JOIN ?:product_global_option_links n ON ?:product_options.option_id = n.option_id ');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:product_option_variants c ON ?:product_options.option_id = c.option_id');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:product_option_variants_link d ON c.variant_id = d.option_variant_id');
$joinOptionsVariantsLinksToProducts .= db_quote(' JOIN ?:products p ON p.product_id = d.product_id');
$optsVariantsLinksToProducts = db_get_array("SELECT " . $fieldsOptionsVariantsLinksToProducts . " FROM ?:product_options " . $joinOptionsVariantsLinksToProducts . " WHERE " . $conditionOptionsVariantsLinksToProducts . " GROUP BY c.variant_id, ?:product_options.option_id" . " ORDER BY ?:product_options.position, c.position");
$optsVariantsLinksToProductsArray = array();
$optionVariantsToProductArray = array();
$optionVariantsToProductArrayStrings = array();
$optionVariantsToProductArrayStrings = array();
$options_variants_user_set_array = array();
$linked_product_amount = array();
$cart_user_id = $_SESSION['auth']['user_id'];
if (!$cart_user_id) {
$cart_user_id = fn_get_session_data('cu_id');
}
$cartProductInfo = db_get_array("SELECT extra, amount FROM ?:user_session_products WHERE product_id =?i AND user_id=?i", $product_id, intval($cart_user_id));
//$ordersProductInfo = db_get_array("SELECT ?:order_details.extra, ?:order_details.amount FROM ?:orders JOIN ?:order_details ON ?:order_details.order_id =?:orders.order_id WHERE ?:order_details.product_id =?i AND ?:orders.status IN ('O','B','F','P')", $product_id);
$productTransactionsInfoArray = array();
foreach ($cartProductInfo as $cartProductI) {
$extraUnserializedInfo = unserialize($cartProductI["extra"]);
foreach ($extraUnserializedInfo['product_options'] as $k1 => $v1) {
if (isset($productTransactionsInfoArray[$v1])) {
$productTransactionsInfoArray[$v1] += $cartProductI["amount"];
} else {
$productTransactionsInfoArray[$v1] = $cartProductI["amount"];
}
}
}
//var_dump($productTransactionsInfoArray);echo"<br/>_____<br/>";
开发者ID:OneataBogdan, 项目名称:lead_coriolan, 代码行数:31, 代码来源:products.post.php
示例7: urlencode
if ($mode == 'index') {
// Check for feedback request
if ((!Registry::get('runtime.company_id') || Registry::get('runtime.simple_ultimate')) && (Registry::get('settings.General.feedback_type') == 'auto' || fn_allowed_for('ULTIMATE:FREE')) && fn_is_expired_storage_data('send_feedback', SECONDS_IN_DAY * 30)) {
$redirect_url = 'feedback.send?action=auto&redirect_url=' . urlencode(Registry::get('config.current_url'));
return array(CONTROLLER_STATUS_REDIRECT, $redirect_url);
}
$time_periods = array(DateTimeHelper::PERIOD_TODAY, DateTimeHelper::PERIOD_YESTERDAY, DateTimeHelper::PERIOD_THIS_MONTH, DateTimeHelper::PERIOD_LAST_MONTH, DateTimeHelper::PERIOD_THIS_YEAR, DateTimeHelper::PERIOD_LAST_YEAR);
$time_period = DateTimeHelper::getPeriod(DateTimeHelper::PERIOD_MONTH_AGO_TILL_NOW);
// Predefined period selected
if (isset($_REQUEST['time_period']) && in_array($_REQUEST['time_period'], $time_periods)) {
$time_period = DateTimeHelper::getPeriod($_REQUEST['time_period']);
fn_set_session_data('dashboard_selected_period', serialize(array('period' => $_REQUEST['time_period'])));
} elseif (isset($_REQUEST['time_from'], $_REQUEST['time_to'])) {
$time_period = DateTimeHelper::createCustomPeriod('@' . $_REQUEST['time_from'], '@' . $_REQUEST['time_to']);
fn_set_session_data('dashboard_selected_period', serialize(array('from' => $time_period['from']->format(DateTime::ISO8601), 'to' => $time_period['to']->format(DateTime::ISO8601))));
} elseif ($timeframe = fn_get_session_data('dashboard_selected_period')) {
$timeframe = unserialize($timeframe);
if (isset($timeframe['period']) && in_array($timeframe['period'], $time_periods)) {
$time_period = DateTimeHelper::getPeriod($timeframe['period']);
} elseif (isset($timeframe['from'], $timeframe['to'])) {
$time_period = DateTimeHelper::createCustomPeriod($timeframe['from'], $timeframe['to']);
}
}
$timestamp_from = $time_period['from']->getTimestamp();
$timestamp_to = $time_period['to']->getTimestamp();
$time_difference = $timestamp_to - $timestamp_from;
$is_day = $timestamp_to - $timestamp_from <= SECONDS_IN_DAY ? true : false;
$stats = '';
if (!defined('HTTPS')) {
$stats .= base64_decode('PGltZyBzcmM9Imh0dHA6Ly93d3cuY3MtY2FydC5jb20vaW1hZ2VzL2JhY2tncm91bmQuZ2lmIiBoZWlnaHQ9IjEiIHdpZHRoPSIxIiBhbHQ9IiIgLz4=');
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:31, 代码来源:index.php
示例8: fn_twg_api_customer_login
function fn_twg_api_customer_login($user_login, $password)
{
$auth_params = array('user_login' => $user_login, 'password' => $password);
list($status, $user_data, $user_login, $password, $salt) = fn_auth_routines($auth_params, array());
if ($status === false) {
return false;
}
if (empty($user_data) || fn_generate_salted_password($password, $salt) != $user_data['password'] || empty($password)) {
fn_log_event('users', 'failed_login', array('user' => $user_login));
return false;
}
$_SESSION['auth'] = fn_fill_auth($user_data);
// Set last login time
db_query("UPDATE ?:users SET ?u WHERE user_id = ?i", array('last_login' => TIME), $user_data['user_id']);
$_SESSION['auth']['this_login'] = TIME;
$_SESSION['auth']['ip'] = $_SERVER['REMOTE_ADDR'];
// Log user successful login
fn_log_event('users', 'session', array('user_id' => $user_data['user_id']));
if ($cu_id = fn_get_session_data('cu_id')) {
$cart = array();
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, $user_data['user_id']);
return $user_data;
}
开发者ID:arpad9, 项目名称:bygmarket, 代码行数:27, 代码来源:func.php
示例9: fn_save_cart_content
function fn_save_cart_content(&$cart, $user_id, $type = 'C', $user_type = 'R')
{
if (empty($user_id)) {
if (fn_get_session_data('cu_id')) {
$user_id = fn_get_session_data('cu_id');
} else {
$user_id = fn_crc32(uniqid(TIME));
fn_set_session_data('cu_id', $user_id, COOKIE_ALIVE_TIME);
}
$user_type = 'U';
}
if (!empty($user_id)) {
$condition = db_quote("user_id = ?i AND type = ?s AND user_type = ?s", $user_id, $type, $user_type);
if (fn_allowed_for('ULTIMATE')) {
$condition .= fn_get_company_condition('?:user_session_products.company_id');
}
//var_dump($ls_individual_estimations);die();
db_query("DELETE FROM ?:user_session_products WHERE " . $condition);
// $cart_products = $_SESSION['cart']['products'];
// //get linked products and its details
// fn_ls_get_linked_products($cart_products);
// //get common linked products order total
// fn_ls_linked_products_order_total($cart_products); //pass here only linked products that are in cart
//
// fn_linked_products_in_cart_amount($cart_products);
//
// //$new_estimations = fn_ls_delivery_estimation_total($cart_products);
//
// //var_dump($new_estimations);echo"<br/>________<br/>";die();
//
// $ls_individual_estimations = array();
//
// foreach ($cart_products as $combination_hash => $product) {
// //shipping estimation for individual products
// $ls_individual_estimations[$combination_hash] = fn_ls_delivery_estimation($product, $combination_hash, 0);
// //check if the estimation is Sunday
// if (date("D", $ls_individual_estimations[$combination_hash]) === 'Sun') {
// //add one more day to the estimation
// $ls_individual_estimations[$combination_hash] = $ls_individual_estimations[$combination_hash] + (24 * 60 * 60);
// }
// }
// var_dump($ls_individual_estimations);
// die();
$ls_individual_estimations = array();
foreach ($cart['products'] as $combination_hash => $product) {
if ($cart['new_estimations']['individual_estimations'][$combination_hash]) {
$ls_individual_estimations[$combination_hash] = $cart['new_estimations']['individual_estimations'][$combination_hash];
}
}
if (!empty($cart['products']) && is_array($cart['products'])) {
$_cart_prods = $cart['products'];
foreach ($_cart_prods as $_item_id => $_prod) {
$_cart_prods[$_item_id]['user_id'] = $user_id;
$_cart_prods[$_item_id]['timestamp'] = TIME;
$_cart_prods[$_item_id]['type'] = $type;
$_cart_prods[$_item_id]['user_type'] = $user_type;
$_cart_prods[$_item_id]['item_id'] = $_item_id;
$_cart_prods[$_item_id]['item_type'] = 'P';
$_cart_prods[$_item_id]['extra'] = serialize($_prod);
//$_cart_prods[$_item_id]['price'] = $_prod['price'];
$_cart_prods[$_item_id]['amount'] = empty($_cart_prods[$_item_id]['amount']) ? 1 : $_cart_prods[$_item_id]['amount'];
$_cart_prods[$_item_id]['session_id'] = Session::getId();
if ($ls_individual_estimations[$_item_id]) {
$_cart_prods[$_item_id]['ls_shipping_estimation'] = $ls_individual_estimations[$_item_id];
}
$ip = fn_get_ip();
$_cart_prods[$_item_id]['ip_address'] = $ip['host'];
if (fn_allowed_for('ULTIMATE')) {
$_cart_prods[$_item_id]['company_id'] = Registry::get('runtime.company_id');
}
if (!empty($_cart_prods[$_item_id])) {
db_query('REPLACE INTO ?:user_session_products ?e', $_cart_prods[$_item_id]);
}
}
}
fn_set_hook('save_cart', $cart, $user_id, $type);
}
return true;
}
开发者ID:OneataBogdan, 项目名称:lead_coriolan, 代码行数:79, 代码来源:fn.cart.php
示例10: fn_init_localization
/**
* Init localizations
*
* @param array $params request parameters
* @return boolean true if localizations exists, false otherwise
*/
function fn_init_localization($params)
{
if (AREA != 'C') {
return array(INIT_STATUS_OK);
}
$locs = db_get_hash_array("SELECT localization_id, custom_weight_settings, weight_symbol, weight_unit FROM ?:localizations WHERE status = 'A'", 'localization_id');
if (!empty($locs)) {
if (!empty($_REQUEST['lc']) && !empty($locs[$_REQUEST['lc']])) {
$cart_localization = $_REQUEST['lc'];
} elseif (($l = fn_get_session_data('cart_localization')) && !empty($locs[$l])) {
$cart_localization = $l;
} else {
$_ip = fn_get_ip(true);
$_country = fn_get_country_by_ip($_ip['host']);
$_lngs = db_get_hash_single_array("SELECT lang_code, 1 as 'l' FROM ?:languages WHERE status = 'A'", array('lang_code', 'l'));
$_language = fn_get_browser_language($_lngs);
$cart_localization = db_get_field("SELECT localization_id, COUNT(localization_id) as c FROM ?:localization_elements WHERE (element = ?s AND element_type = 'C') OR (element = ?s AND element_type = 'L') GROUP BY localization_id ORDER BY c DESC LIMIT 1", $_country, $_language);
if (empty($cart_localization) || empty($locs[$cart_localization])) {
$cart_localization = db_get_field("SELECT localization_id FROM ?:localizations WHERE status = 'A' AND is_default = 'Y'");
}
}
if (empty($cart_localization)) {
reset($locs);
$cart_localization = key($locs);
}
if ($cart_localization != fn_get_session_data('cart_localization')) {
fn_set_session_data('cart_localization', $cart_localization, COOKIE_ALIVE_TIME);
}
if ($locs[$cart_localization]['custom_weight_settings'] == 'Y') {
Registry::set('config.localization.weight_symbol', $locs[$cart_localization]['weight_symbol']);
Registry::set('config.localization.weight_unit', $locs[$cart_localization]['weight_unit']);
}
fn_define('CART_LOCALIZATION', $cart_localization);
}
return array(INIT_STATUS_OK);
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:42, 代码来源:fn.init.php
示例11: getSimpleRates
/**
* Process simple request to shipping service server
*
* @return string Server response
*/
public function getSimpleRates()
{
$data = $this->getRequestData();
$key = md5($data['data']);
$sdek_data = fn_get_session_data($key);
$data_string = json_encode($data['data']);
if (empty($sdek_data)) {
$response = Http::post($data['url'], $data['data'], array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
fn_set_session_data($key, $response);
} else {
$response = $sdek_data;
}
return $response;
}
开发者ID:askzap, 项目名称:ask-zap, 代码行数:19, 代码来源:Sdek.php
示例12: _registerBlockCache
/**
* Registers block cache
* @param string $cache_name Cache name
* @param array $block_scheme Block scheme data
*/
private static function _registerBlockCache($cache_name, $block_scheme)
{
if (isset($block_scheme['cache'])) {
$additional_level = '';
$default_handlers = fn_get_schema('block_manager', 'block_cache_properties');
if (isset($block_scheme['cache']['update_handlers']) && is_array($block_scheme['cache']['update_handlers'])) {
$handlers = $block_scheme['cache']['update_handlers'];
} else {
$handlers = array();
}
$cookie_data = fn_get_session_data();
$cookie_data['all'] = $cookie_data;
$additional_level .= self::_generateAdditionalCacheLevel($block_scheme['cache'], 'request_handlers', $_REQUEST);
$additional_level .= self::_generateAdditionalCacheLevel($block_scheme['cache'], 'session_handlers', $_SESSION);
$additional_level .= self::_generateAdditionalCacheLevel($block_scheme['cache'], 'cookie_handlers', $cookie_data);
$additional_level .= self::_generateAdditionalCacheLevel($block_scheme['cache'], 'auth_handlers', $_SESSION['auth']);
$additional_level .= '|path=' . Registry::get('config.current_path');
$additional_level .= Embedded::isEnabled() ? '|embedded' : '';
$additional_level = !empty($additional_level) ? md5($additional_level) : '';
$handlers = array_merge($handlers, $default_handlers['update_handlers']);
$cache_level = isset($block_scheme['cache']['cache_level']) ? $block_scheme['cache']['cache_level'] : Registry::cacheLevel('html_blocks');
Registry::registerCache($cache_name, $handlers, $cache_level . '__' . $additional_level);
}
}
开发者ID:OneataBogdan, 项目名称:lead_coriolan, 代码行数:29, 代码来源:RenderManager.php
示例13: getIndex
public function getIndex($address)
{
$address = preg_split('/[ ,-]+/', trim($address));
$address = implode('+', $address);
$key_address = md5($address);
$response = fn_get_session_data($key_address);
if (empty($response)) {
$url = "https://geocode-maps.yandex.ru/1.x/";
$data = array('geocode' => $address, 'format' => 'json', 'results' => 1);
$response = Http::post($url, $data);
fn_set_session_data($key_address, $response, YD_CACHE_DAY);
}
$response = json_decode($response, true);
$address_line = $this->findElmArray($response, 'AddressLine');
$address_line = reset($address_line);
$result = '';
$url = $this->url_api . 'getIndex';
if (!empty($address_line) && !empty($this->client_ids)) {
$data = array('client_id' => $this->client_ids['client_id'], 'sender_id' => $this->client_ids['sender_ids'], 'address' => $address_line);
$data['secret_key'] = $this->generateSecretKey('getIndex', $data);
$result = $this->getStatic($data['secret_key']);
if (empty($result)) {
$result = $this->request($url, $data);
$this->setStatic($data['secret_key'], $result);
}
}
return $result;
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:28, 代码来源:YandexDelivery.php
示例14: getSimpleRates
/**
* Process simple request to shipping service server
*
* @return string Server response
*/
public function getSimpleRates()
{
$data = $this->getRequestData();
$key = md5(serialize($data['data']));
$pecom_data = fn_get_session_data($key);
if (empty($pecom_data)) {
$response = Http::get($data['url'], $data['data']);
$response = json_decode($response, true);
fn_set_session_data($key, $response);
} else {
$response = $pecom_data;
}
return $response;
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:19, 代码来源:Pecom.php
示例15: die
<?php
use Tygh\Registry;
if (!defined('AREA')) {
die('Access denied');
}
if (defined('PAYMENT_NOTIFICATION')) {
if ($mode == 'return' && !empty($_REQUEST['merchant_order_id'])) {
include_once 'heartland/Hps.php';
$merchant_order_id = heartlandplace_order($_REQUEST['merchant_order_id']);
$order_info = fn_get_session_data('order_info');
$config = new HpsServicesConfig();
$config->secretApiKey = fn_get_session_data('secretkey');
$config->versionNumber = '2102';
$config->developerId = '002914';
$chargeService = new HpsCreditService($config);
$address = new HpsAddress();
$address->address = $order_info['b_address'];
$address->city = $order_info['b_city'];
$address->state = $order_info['b_state'];
$address->zip = preg_replace('/[^0-9]/', '', $order_info['b_zipcode']);
$address->country = $order_info['b_country'];
$validCardHolder = new HpsCardHolder();
$validCardHolder->firstName = $order_info['b_firstname'];
$validCardHolder->lastName = $order_info['b_lastname'];
$validCardHolder->address = $address;
$validCardHolder->phoneNumber = preg_replace('/[^0-9]/', '', $order_info['b_phone']);
$suToken = new HpsTokenData();
$suToken->tokenValue = $_REQUEST['securesubmit_token'];
try {
$pp_response = array('reason_text' => '', 'order_status' => 'F');
开发者ID:hps, 项目名称:heartland-cscart-plugin, 代码行数:31, 代码来源:heartland.php
示例16: die
* 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. *
****************************************************************************/
// [norton] [add_bean_bag_filling]
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
$cart =& $_SESSION['cart'];
//fn_set_notification('I', 'mode', print_r($mode,true));
if ($mode == 'cart') {
$current_postcode = fn_get_session_data('postcode');
if (!empty($_REQUEST['postcode']) && $_REQUEST['postcode'] == 'valid' && empty($current_postcode)) {
fn_set_session_data('postcode', 'valid', SECONDS_IN_HOUR);
}
}
// if($mode== 'add2')
// {
// fn_set_notification('I', 'mode', print_r($_REQUEST,true));
// }
// //
// Delete discount coupon
//
if ($mode == 'add_bean_bag_filling' or $mode == 'add') {
// if (empty($auth['user_id']) && Registry::get('settings.General.allow_anonymous_shopping') != 'Y') {
// return array(CONTROLLER_STATUS_REDIRECT, "auth.login_form?return_url=" . urlencode($_SERVER['HTTP_REFERER']));
// }
开发者ID:ambient-lounge, 项目名称:site, 代码行数:31, 代码来源:checkout.post.php
示例17: fn_login_user
/**
* Log in user using only user id
*
* @param int $user_id User identifier
* @param bool $regenerate_session_id Need regenerate session id. Default false.
* @return string
* return 0 - we can't find user with provided user_id
* return 1 - user was successfully logged
* return 2 - user disabled
*/
function fn_login_user($user_id = 0, $regenerate_session_id = false)
{
$udata = array();
$auth =& Tygh::$app['session']['auth'];
$condition = '';
$result = LOGIN_STATUS_USER_NOT_FOUND;
/**
* Change parameter for login user
*
* @param int $user_id User identifier
* @param array $udata User data
* @param array $auth Authentication data
* @param array $condition String containing SQL-query condition possibly prepended with a logical operator (AND or OR)
*/
fn_set_hook('login_user_pre', $user_id, $udata, $auth, $condition);
if (!empty($user_id)) {
if ($regenerate_session_id) {
Tygh::$app['session']->regenerateID();
$auth =& Tygh::$app['session']['auth'];
}
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(Tygh::$app['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(Tygh::$app['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();
/**
* Modifies the result after login user
*
* @param int $user_id User identifier
* @param int $cu_id Cart user identifier
* @param array $udata User data
* @param array $auth Authentication data
* @param array $condition String containing SQL-query condition possibly prepended with a logical operator (AND or OR)
* @param string $result Result user login
*/
fn_set_hook('login_user_post', $user_id, $cu_id, $udata, $auth, $condition, $result);
return $result;
}
开发者ID:ambient-lounge, 项目名称:site, 代码行数:77, 代码来源:fn.users.php
示例18: registerBlockCacheIfNeeded
/**
* Registers block cache
*
* @param string $cache_name Cache name
* @param array $block_schema Block schema data
* @param array $block_data Block data from DB
*
* @return bool Whether cache have been registered or not
*/
public static function registerBlockCacheIfNeeded($cache_name, $block_schema, $block_data)
{
// @TODO: remove Registry calls and use RenderManager::$_location instead. This method should be non-static.
$dispatch = Registry::get('runtime.controller') . '.' . Registry::get('runtime.mode');
// Use parameters for current dispatch with fallback to common params
if (!empty($block_schema['cache_overrides_by_dispatch'][$dispatch])) {
$cache_params = $block_schema['cache_overrides_by_dispatch'][$dispatch];
} elseif (!empty($block_schema['cache'])) {
$cache_params = $block_schema['cache'];
} else {
return false;
}
$cookie_data = fn_get_session_data();
$cookie_data['all'] = $cookie_data;
$callable_handlers_variables = compact('block_schema', 'block_data');
$disable_cache = false;
// Check conditions that disable block caching
if (!empty($cache_params['disable_cache_when'])) {
$disable_cache |= self::findHandlerParamsAtData($cache_params['disable_cache_when'], 'request_handlers', $_REQUEST);
$disable_cache |= self::findHandlerParamsAtData($cache_params['disable_cache_when'], 'session_handlers', $_SESSION);
$disable_cache |= self::findHandlerParamsAtData($cache_params['disable_cache_when'], 'cookie_handlers', $cookie_data);
$disable_cache |= self::findHandlerParamsAtData($cache_params['disable_cache_when'], 'auth_handlers', $_SESSION['auth']);
// Disable cache if any of callable handlers returns true
if (!empty($cache_params['disable_cache_when']['callable_handlers'])) {
self::execCallableHandlers(function ($handler_name, $handler_result) use(&$disable_cache) {
$disable_cache |= $handler_result;
}, (array) $cache_params['disable_cache_when']['callable_handlers'], $callable_handlers_variables);
}
}
if ($disable_cache) {
return false;
}
// Generate suffix to cache key using dependencies specified at schema
$cache_key_suffix = '';
$generate_additional_level = function ($param_name, $param_value) use(&$cache_key_suffix) {
$cache_key_suffix .= '|' . $param_name . '=' . md5(serialize($param_value));
};
self::findHandlerParamsAtData($cache_params, 'request_handlers', $_REQUEST, $generate_additional_level);
self::findHandlerParamsAtData($cache_params, 'session_handlers', $_SESSION, $generate_additional_level);
self::findHandlerParamsAtData($cache_params, 'cookie_handlers', $cookie_data, $generate_additional_level);
self::findHandlerParamsAtData($cache_params, 'auth_handlers', $_SESSION['auth'], $generate_additional_level);
if (!empty($cache_params['callable_handlers'])) {
self::execCallableHandlers($generate_additional_level, (array) $cache_params['callable_handlers'], $callable_handlers_variables);
}
$cache_key_suffix .= '|path=' . Registry::get('config.current_path');
$cache_key_suffix .= Embedded::isEnabled() ? '|embedded' : '';
$cache_key_suffix = empty($cache_key_suffix) ? '' : md5($cache_key_suffix);
$default_update_handlers = fn_get_schema('block_manager', 'block_cache_properties');
if (isset($cache_params['update_handlers']) && is_array($cache_params['update_handlers'])) {
$handlers = array_merge($cache_params['update_handlers'], $default_update_handlers['update_handlers']);
} else {
$handlers = $default_update_handlers['update_handlers'];
}
$cache_level = isset($cache_params['cache_level']) ? $cache_params['cache_level'] : Registry::cacheLevel('html_blocks');
Registry::registerCache($cache_name, $handlers, $cache_level . '__' . $cache_key_suffix);
// Check conditions that trigger block cache regeneration
$regenerate_cache = false;
if (!empty($cache_params['regenerate_cache_when'])) {
$regenerate_cache |= self::findHandlerParamsAtData($cache_params['regenerate_cache_when'], 'request_handlers', $_REQUEST);
$regenerate_cache |= self::findHandlerParamsAtData($cache_params['regenerate_cache_when'], 'session_handlers', $_SESSION);
$regenerate_cache |= self::findHandlerParamsAtData($cache_params['regenerate_cache_when'], 'cookie_handlers', $cookie_data);
$regenerate_cache |= self::findHandlerParamsAtData($cache_params['regenerate_cache_when'], 'auth_handlers', $_SESSION['auth']);
// Regenerate cache if any of callable handlers returns true
if (!empty($cache_params['regenerate_cache_when']['callable_handlers'])) {
self::execCallableHandlers(function ($handler_name, $handler_result) use(&$regenerate_cache) {
$regenerate_cache |= $handler_result;
}, (array) $cache_params['regenerate_cache_when']['callable_handlers'], $callable_handlers_variables);
}
}
if ($regenerate_cache) {
Registry::del($cache_name);
}
return true;
}
开发者ID:arpad9, 项目名称:bygmarket, 代码行数:83, 代码来源:RenderManager.php
jcmsalves/kotlin-playground: Kotlin Android samples/template project
阅读:1016| 2022-08-13
bradtraversy/iweather: Ionic 3 mobile weather app
阅读:1648| 2022-08-30
魔兽世界怀旧服已经开启两个多月了,但作为一个猎人玩家,抓到“断牙”,已经成为了一
阅读:1064| 2022-11-06
JLPM22/MinecraftUnity: Simple Minecraft recreation made with Unity for education
阅读:458| 2022-08-16
trulyspinach/UGUI-Material-Design-Icon: A vector image plugin for Unity3D GUI to
阅读:851| 2022-08-18
1.progressbar进程控制条主要的属性:Max,Min,Step与Timer一起使用 while(pb1.Posi
阅读:637| 2022-07-18
NLKNguyen/papercolor-theme: Light Dark Vim color schemes inspired by Google'
阅读:1145| 2022-08-17
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:518| 2022-08-16
相信不少果粉在对自己的设备进行某些操作时,都会碰到Respring,但这个 Respring 到底
阅读:388| 2022-11-06
kikito/stateful.lua: Stateful classes for Lua
阅读:273| 2022-08-16
请发表评论