• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fn_get_ip函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fn_settings_actions_addons_access_restrictions_admin_reverse_ip_access

/**
 * Reverse IP filter
 */
function fn_settings_actions_addons_access_restrictions_admin_reverse_ip_access(&$new_value, $old_value)
{
    $ip = fn_get_ip(true);
    if ($new_value == 'Y') {
        $ip_data = db_get_row("SELECT item_id, status FROM ?:access_restriction WHERE ip_from = ?i AND ip_to = ?i AND type IN ('aas', 'aab', 'aar')", $ip['host'], $ip['host']);
        if (empty($ip_data) || empty($ip_data['item_id'])) {
            // Add IP
            $restrict_ip = array('ip_from' => $ip['host'], 'ip_to' => $ip['host'], 'type' => 'aas', 'timestamp' => TIME, 'expires' => '0', 'status' => 'A');
            $__data = array();
            $__data['item_id'] = db_query("REPLACE INTO ?:access_restriction ?e", $restrict_ip);
            $__data['type'] = 'aas';
            foreach (fn_get_translation_languages() as $__data['lang_code'] => $_v) {
                $__data['reason'] = __('store_admin', '', $__data['lang_code']);
                db_query("REPLACE INTO ?:access_restriction_reason_descriptions ?e", $__data);
            }
            fn_set_notification('W', __('warning'), __('your_ip_added', array('[ip]' => long2ip($ip['host']))));
        } elseif (empty($ip_data['status']) || $ip_data['status'] != 'A') {
            // Change IP status to available
            db_query("UPDATE ?:access_restriction SET ?u WHERE item_id = ?i", array('status' => 'A'), $ip_data['item_id']);
            fn_set_notification('W', __('warning'), __('your_ip_enabled', array('[ip]' => long2ip($ip['host']))));
        }
    } else {
        // Delete IP
        $ips_data = db_get_array("SELECT item_id, type FROM ?:access_restriction WHERE ip_from <= ?i AND ip_to >= ?i AND type IN ('aas', 'aab', 'aar')", $ip['host'], $ip['host']);
        if (!empty($ips_data)) {
            foreach ($ips_data as $ip_data) {
                db_query("DELETE FROM ?:access_restriction WHERE item_id = ?i", $ip_data['item_id']);
                db_query("DELETE FROM ?:access_restriction_reason_descriptions WHERE item_id = ?i AND type = ?s", $ip_data['item_id'], $ip_data['type']);
            }
            fn_set_notification('W', __('warning'), __('your_ip_removed', array('[ip]' => long2ip($ip['host']))));
        }
    }
    return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:37,代码来源:actions.functions.post.php


示例2: fn_em_update_subscriber

function fn_em_update_subscriber($subscriber_data, $subscriber_id = 0, $sync = true, $lang_code = CART_LANGUAGE)
{
    $invalid_emails = array();
    if (empty($subscriber_id)) {
        if (!empty($subscriber_data['email'])) {
            $company_condition = fn_em_get_company_condition();
            if (db_get_field("SELECT email FROM ?:em_subscribers WHERE email = ?s ?p", $subscriber_data['email'], $company_condition) == '') {
                if (fn_validate_email($subscriber_data['email']) == false) {
                    $invalid_emails[] = $subscriber_data['email'];
                } else {
                    if (empty($subscriber_data['name'])) {
                        $subscriber_data['name'] = '';
                    }
                    if (empty($subscriber_data['timestamp'])) {
                        $subscriber_data['timestamp'] = time();
                    }
                    if (empty($subscriber_data['ip_address'])) {
                        $ip = fn_get_ip();
                        $subscriber_data['ip_address'] = fn_ip_to_db($ip['host']);
                    }
                    if (empty($subscriber_data['unsubscribe_key'])) {
                        $subscriber_data['unsubscribe_key'] = md5(uniqid());
                    }
                    $subscriber_data['company_id'] = Registry::get('runtime.company_id');
                    $subscriber_data['lang_code'] = $lang_code;
                    $subscriber_id = db_query("INSERT INTO ?:em_subscribers ?e", $subscriber_data);
                }
            } else {
                fn_set_notification('W', __('warning'), __('email_marketing.warning_email_exists', array('[email]' => $subscriber_data['email'])));
            }
        }
    } else {
        db_query("UPDATE ?:em_subscribers SET ?u WHERE subscriber_id = ?i", $subscriber_data, $subscriber_id);
    }
    if (!empty($invalid_emails)) {
        fn_set_notification('E', __('error'), __('error_invalid_emails', array('[emails]' => implode(', ', $invalid_emails))));
    } elseif ($sync) {
        $subscriber_data = fn_em_get_subscriber_data('', $subscriber_id);
        $subscribed = EmailSync::instance()->subscribe(array('email' => $subscriber_data['email'], 'timestamp' => $subscriber_data['timestamp'], 'lang_code' => $subscriber_data['lang_code'], 'ip_address' => fn_ip_from_db($subscriber_data['ip_address']), 'name' => $subscriber_data['name']));
        if ($subscribed == false) {
            fn_em_delete_subscribers(array($subscriber_id), false);
            $subscriber_id = false;
        }
    }
    return $subscriber_id;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:46,代码来源:func.php


示例3: fn_unisender_subscribe

function fn_unisender_subscribe($user_data, $list_id, $activated = false)
{
    $api_key = Registry::get('addons.rus_unisender.api_key');
    if (!empty($api_key) && !empty($user_data['email'])) {
        $ip = fn_get_ip();
        $user_field = fn_unisender_get_user_fields();
        $post = array('api_key' => $api_key, 'fields' => fn_uniseder_get_fields($user_data, $user_field), 'request_ip' => $ip['host'], 'request_time' => date('Y-m-d H:m:s', TIME), 'overwrite' => 2, 'double_optin' => '0', 'list_ids' => $list_id);
        if ($activated) {
            $post['double_optin'] = 3;
        }
        if (fn_unisender_api('subscribe', $post, $response)) {
            $data = array('subscriber_id' => fn_unisender_get_subscriber_id($user_data['email'], true), 'list_id' => $list_id);
            db_query("REPLACE INTO ?:unisender_user_mailing_lists ?e", $data);
            return true;
        }
    }
    return false;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:18,代码来源:func.php


示例4: getLicenseInformation

 /**
  * Returns current license status
  * @param  string $license_key
  * @param  string $host_name   If host_name was specified, license will be checked
  * @return bool
  */
 public static function getLicenseInformation($license_number = '', $extra_fields = array())
 {
     if (empty($license_number)) {
         $uc_settings = Settings::instance()->getValues('Upgrade_center');
         $license_number = $uc_settings['license_number'];
     }
     if (empty($license_number)) {
         return 'LICENSE_IS_INVALID';
     }
     $store_ip = fn_get_ip();
     $store_ip = $store_ip['host'];
     $request = array('license_number' => $license_number, 'ver' => PRODUCT_VERSION, 'product_status' => PRODUCT_STATUS, 'product_build' => strtoupper(PRODUCT_BUILD), 'edition' => isset($extra_fields['edition']) ? $extra_fields['edition'] : PRODUCT_EDITION, 'lang' => strtoupper(CART_LANGUAGE), 'store_uri' => fn_url('', 'C', 'http'), 'secure_store_uri' => fn_url('', 'C', 'https'), 'https_enabled' => Registry::get('settings.Security.secure_storefront') != 'none' || Registry::get('settings.Security.secure_admin') == 'Y' ? 'Y' : 'N', 'admin_uri' => fn_url('', 'A', 'http'), 'store_ip' => $store_ip);
     $request = array('Request@action=check_license@api=3' => array_merge($extra_fields, $request));
     $request = '<?xml version="1.0" encoding="UTF-8"?>' . fn_array_to_xml($request);
     $data = Http::get(Registry::get('config.resources.updates_server') . '/index.php?dispatch=product_updates.check_available', array('request' => $request), array('timeout' => 10));
     if (empty($data)) {
         $data = fn_get_contents(Registry::get('config.resources.updates_server') . '/index.php?dispatch=product_updates.check_available&request=' . urlencode($request));
     }
     return $data;
 }
开发者ID:askzap,项目名称:ultimate,代码行数:26,代码来源:Helpdesk.php


示例5: fn_cp_check_state

 function fn_cp_check_state($new_value, $old_value, $name)
 {
     $store_ip = fn_get_ip();
     $store_ip = $store_ip['host'];
     $extra_fields = array();
     $_REQUEST = array('addon_status' => $new_value, 'ver' => PRODUCT_VERSION, 'product_status' => PRODUCT_STATUS, 'product_build' => strtoupper(PRODUCT_BUILD), 'edition' => PRODUCT_EDITION, 'lang' => strtoupper(CART_LANGUAGE), 'store_uri' => fn_url('', 'C', 'http'), 'secure_store_uri' => fn_url('', 'C', 'https'), 'https_enabled' => Registry::get('settings.General.secure_checkout') == 'Y' || Registry::get('settings.General.secure_admin') == 'Y' || Registry::get('settings.General.secure_auth') == 'Y' ? 'Y' : 'N', 'admin_uri' => fn_url('', 'A', 'http'), 'store_host' => Registry::get('config.http_host'), 'store_ip' => $store_ip, 'addon' => $name, 'license' => Registry::get('addons.' . $name . '.licensekey'));
     $request = json_encode($_REQUEST);
     $check_host = "http://cart-power.com/index.php?dispatch=check_license.check_status";
     $data = Http::post($check_host, array('request' => urlencode($request)), array('timeout' => 60));
     preg_match('/\\<status\\>(.*)\\<\\/status\\>/u', $data, $result);
     $_status = 'FALSE';
     if (isset($result[1])) {
         $_status = $result[1];
     }
     if ($_REQUEST['dispatch'] == 'addons.update_status' && $_status != 'TRUE') {
         db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", 'D', $name);
         fn_set_notification('W', __('warning'), __('cp_your_license_is_not_valid'));
         exit;
     }
     return true;
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:21,代码来源:actions.functions.post.php


示例6: fn_log_event


//.........这里部分代码省略.........
            } elseif (!empty($func)) {
                $v['function'] = $func;
                $func = '';
            }
            $_btrace[] = array('file' => !empty($v['file']) ? $v['file'] : '', 'line' => !empty($v['line']) ? $v['line'] : '', 'function' => $v['function']);
        }
        $data['backtrace'] = serialize($_btrace);
    } else {
        $data['backtrace'] = '';
    }
    if ($type == 'general') {
        if ($action == 'deprecated') {
            $content['deprecated_function'] = $data['function'];
        }
        $content['message'] = $data['message'];
    } elseif ($type == 'orders') {
        $order_status_descr = fn_get_simple_statuses(STATUSES_ORDER, true, true);
        $content = array('order' => '# ' . $data['order_id'], 'id' => $data['order_id']);
        if ($action == 'status') {
            $content['status'] = $order_status_descr[$data['status_from']] . ' -> ' . $order_status_descr[$data['status_to']];
        }
    } elseif ($type == 'products') {
        $product = db_get_field("SELECT product FROM ?:product_descriptions WHERE product_id = ?i AND lang_code = ?s", $data['product_id'], Registry::get('settings.Appearance.backend_default_language'));
        $content = array('product' => $product . ' (#' . $data['product_id'] . ')', 'id' => $data['product_id']);
        if ($action == 'low_stock') {
            // log stock - warning
            $event_type = 'W';
        }
    } elseif ($type == 'categories') {
        $category = db_get_field("SELECT category FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s", $data['category_id'], Registry::get('settings.Appearance.backend_default_language'));
        $content = array('category' => $category . ' (#' . $data['category_id'] . ')', 'id' => $data['category_id']);
    } elseif ($type == 'database') {
        if ($action == 'error') {
            $content = array('error' => $data['error']['message'], 'query' => $data['error']['query']);
            $event_type = 'E';
        }
    } elseif ($type == 'requests') {
        if (!empty($cut_data)) {
            $data['data'] = preg_replace("/\\<(" . implode('|', $cut_data) . ")\\>(.*?)\\<\\/(" . implode('|', $cut_data) . ")\\>/s", '<${1}>******</${1}>', $data['data']);
            $data['data'] = preg_replace("/%3C(" . implode('|', $cut_data) . ")%3E(.*?)%3C%2F(" . implode('|', $cut_data) . ")%3E/s", '%3C${1}%3E******%3C%2F${1}%3E', $data['data']);
            $data['data'] = preg_replace("/(" . implode('|', $cut_data) . ")=(.*?)(&)/s", '${1}=******${3}', $data['data']);
        }
        $content = array('url' => $data['url'], 'request' => fn_strlen($data['data']) < LOG_MAX_DATA_LENGTH && preg_match('//u', $data['data']) ? $data['data'] : '', 'response' => fn_strlen($data['response']) < LOG_MAX_DATA_LENGTH && preg_match('//u', $data['response']) ? $data['response'] : '');
    } elseif ($type == 'users') {
        if (!empty($data['time'])) {
            if (empty($_SESSION['log']['login_log_id'])) {
                return false;
            }
            $content = db_get_field('SELECT content FROM ?:logs WHERE log_id = ?i', $_SESSION['log']['login_log_id']);
            $content = unserialize($content);
            $minutes = ceil($data['time'] / 60);
            $hours = floor($minutes / 60);
            if ($hours) {
                $minutes -= $hours * 60;
            }
            if ($hours || $minutes) {
                $content['loggedin_time'] = ($hours ? $hours . ' |hours| ' : '') . ($minutes ? $minutes . ' |minutes|' : '');
            }
            if (!empty($data['timeout']) && $data['timeout']) {
                $content['timeout'] = true;
            }
            $update = $_SESSION['log']['login_log_id'];
        } else {
            if (!empty($data['user_id'])) {
                $info = db_get_row("SELECT firstname, lastname, email FROM ?:users WHERE user_id = ?i", $data['user_id']);
                $content = array('user' => $info['firstname'] . ($info['firstname'] && $info['lastname'] ? ' ' : '') . $info['lastname'] . ($info['firstname'] || $info['lastname'] ? '; ' : '') . $info['email'] . ' (#' . $data['user_id'] . ')');
                $content['id'] = $data['user_id'];
            } elseif (!empty($data['user'])) {
                $content = array('user' => $data['user']);
            }
            if (in_array($action, array('session', 'failed_login'))) {
                $ip = fn_get_ip();
                $content['ip_address'] = empty($data['ip']) ? $ip['host'] : $data['ip'];
            }
        }
        if ($action == 'failed_login') {
            // failed login - warning
            $event_type = 'W';
        }
    }
    fn_set_hook('save_log', $type, $action, $data, $user_id, $content, $event_type, $object_primary_keys);
    $content = serialize($content);
    if ($update) {
        db_query('UPDATE ?:logs SET content = ?s WHERE log_id = ?i', $content, $update);
    } else {
        if (Registry::get('runtime.company_id')) {
            $company_id = Registry::get('runtime.company_id');
        } elseif (!empty($object_primary_keys[$type]) && !empty($data[$object_primary_keys[$type]])) {
            $company_id = fn_get_company_id($type, $object_primary_keys[$type], $data[$object_primary_keys[$type]]);
        } else {
            $company_id = 0;
        }
        $row = array('user_id' => $user_id, 'timestamp' => TIME, 'type' => $type, 'action' => $action, 'event_type' => $event_type, 'content' => $content, 'backtrace' => $data['backtrace'], 'company_id' => $company_id);
        $log_id = db_query("INSERT INTO ?:logs ?e", $row);
        if ($type == 'users' && $action == 'session') {
            $_SESSION['log']['login_log_id'] = $log_id;
        }
    }
    return true;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:fn.log.php


示例7: 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


示例8: fn_init_localization

/**
 * Init localizations
 *
 * @param array $params request parameters
 * @return boolean true if localizations exists, false otherwise
 */
function fn_init_localization($params)
{
    $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)) {
        return false;
    }
    if (!empty($_REQUEST['lc']) && !empty($locs[$_REQUEST['lc']])) {
        $cart_localization = $_REQUEST['lc'];
    } elseif (($l = fn_get_cookie('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_cookie('cart_localization')) {
        fn_set_cookie('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 true;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:40,代码来源:fn.init.php


示例9: fn_fill_auth

function fn_fill_auth($user_data = array(), $original_auth = array(), $act_as_user = false, $area = AREA)
{
    $active_usergroups = fn_define_usergroups($user_data, $area);
    $ip = fn_get_ip();
    $auth = array('area' => !fn_check_user_type_admin_area($user_data) ? 'C' : 'A', 'user_id' => empty($user_data['user_id']) ? 0 : $user_data['user_id'], 'user_type' => !empty($user_data['user_type']) ? $user_data['user_type'] : 'C', 'tax_exempt' => empty($user_data['tax_exempt']) ? 'N' : $user_data['tax_exempt'], 'last_login' => empty($user_data['last_login']) ? 0 : $user_data['last_login'], 'order_ids' => !empty($original_auth['order_ids']) ? $original_auth['order_ids'] : array(), 'password_change_timestamp' => empty($user_data['password_change_timestamp']) ? 0 : $user_data['password_change_timestamp'], 'company_id' => empty($user_data['company_id']) ? 0 : $user_data['company_id'], 'is_root' => empty($user_data['is_root']) ? 'N' : $user_data['is_root'], 'usergroup_ids' => $active_usergroups, 'act_as_user' => $act_as_user, 'this_login' => !empty($original_auth['this_login']) ? $original_auth['this_login'] : TIME, 'referer' => !empty($original_auth['referer']) ? $original_auth['referer'] : (!empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''), 'ip' => $ip['host']);
    if (Registry::get('runtime.simple_ultimate')) {
        unset($auth['company_id']);
    }
    fn_set_hook('fill_auth', $auth, $user_data, $area, $original_auth);
    return $auth;
}
开发者ID:askzap,项目名称:ultimate,代码行数:11,代码来源:fn.users.php


示例10: fn_get_poll_data

/**
 * Get poll data
 *
 * @param int $page_id ID of the page, poll attached to
 * @param string $lang_code language code to get descriptions for
 * @return mixed array with poll data if exists, false otherwise
 */
function fn_get_poll_data($page_id, $lang_code = CART_LANGUAGE)
{
    $poll = db_get_row("SELECT page_id, start_date, end_date, show_results FROM ?:polls WHERE page_id = ?i", $page_id);
    if (empty($poll)) {
        return false;
    }
    $descriptions = db_get_hash_single_array("SELECT type, description FROM ?:poll_descriptions WHERE object_id = ?i AND lang_code = ?s AND type IN ('H', 'F', 'R')", array('type', 'description'), $page_id, $lang_code);
    if (!empty($descriptions)) {
        $poll['header'] = $descriptions['H'];
        $poll['footer'] = $descriptions['F'];
        $poll['results'] = $descriptions['R'];
    }
    // Get questions and answers
    $poll['questions'] = db_get_hash_array("SELECT ?:poll_items.item_id, ?:poll_items.type, ?:poll_items.position, ?:poll_descriptions.description, ?:poll_items.required FROM ?:poll_items LEFT JOIN ?:poll_descriptions ON ?:poll_items.item_id = ?:poll_descriptions.object_id AND ?:poll_descriptions.type = 'I' AND ?:poll_descriptions.lang_code = ?s WHERE ?:poll_items.parent_id = ?i AND ?:poll_items.type IN ('Q','M', 'T') ORDER BY ?:poll_items.position", 'item_id', $lang_code, $page_id);
    $poll['has_required_questions'] = false;
    foreach ($poll['questions'] as $question_id => $entry) {
        $poll['questions'][$question_id]['answers'] = db_get_hash_array("SELECT ?:poll_items.item_id, ?:poll_items.type, ?:poll_items.position, ?:poll_descriptions.description FROM ?:poll_items LEFT JOIN ?:poll_descriptions ON ?:poll_items.item_id = ?:poll_descriptions.object_id AND ?:poll_descriptions.type = 'I' AND ?:poll_descriptions.lang_code = ?s WHERE ?:poll_items.parent_id = ?i AND ?:poll_items.type IN ('A', 'O') ORDER BY ?:poll_items.position", 'item_id', $lang_code, $question_id);
        if ($entry['required'] == 'Y') {
            $poll['has_required_questions'] = true;
        }
        // Check if answer has comments
        if ($entry['type'] == 'T') {
            $count = db_get_field("SELECT COUNT(item_id) FROM ?:polls_answers WHERE item_id = ?i AND answer_id = 0", $question_id);
            $poll['questions'][$question_id]['has_comments'] = $count ? true : false;
        } else {
            foreach ($poll['questions'][$question_id]['answers'] as $k => $rec) {
                if ($rec['type'] == 'O') {
                    $count = db_get_field("SELECT count(item_id) FROM ?:polls_answers WHERE item_id = ?i AND answer_id = ?i AND comment != ''", $question_id, $k);
                    $poll['questions'][$question_id]['answers'][$k]['has_comments'] = $count ? true : false;
                } else {
                    $poll['questions'][$question_id]['answers'][$k]['has_comments'] = false;
                }
            }
        }
    }
    // Check if poll completed by the current user
    $ip = fn_get_ip();
    $poll['completed'] = db_get_field("SELECT vote_id FROM ?:polls_votes WHERE page_id = ?i AND ip_address = ?s", $page_id, $ip['host']);
    if (!empty($poll['completed']) || AREA == 'A') {
        fn_polls_get_results($poll);
    }
    return $poll;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:50,代码来源:func.php


示例11: getValidatorData

 /**
  * Get session validation data
  *
  * @return array validation data
  */
 public static function getValidatorData()
 {
     $data = array();
     if (defined('SESS_VALIDATE_IP')) {
         $ip = fn_get_ip();
         $data['ip'] = $ip['host'];
     }
     if (defined('SESS_VALIDATE_UA')) {
         $data['ua'] = md5($_SERVER['HTTP_USER_AGENT']);
     }
     return $data;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:17,代码来源:Session.php


示例12: array

        $sortings = array('value' => 'a.value', 'reason' => 'b.reason', 'created' => 'a.timestamp', 'status' => 'a.status');
    }
    $directions = array('asc' => 'asc', 'desc' => 'desc');
    $sort_order = !empty($_REQUEST['sort_order']) ? $_REQUEST['sort_order'] : '';
    $sort_by = !empty($_REQUEST['sort_by']) ? $_REQUEST['sort_by'] : '';
    if (empty($sort_order) || empty($directions[$sort_order])) {
        $sort_order = 'desc';
    }
    if (empty($sort_by) || empty($sortings[$sort_by])) {
        $sort_by = 'created';
    }
    $sort = $sortings[$sort_by] . " " . $directions[$sort_order];
    $items_per_page = Registry::get('settings.Appearance.admin_elements_per_page');
    $total_items = db_get_field("SELECT COUNT(a.item_id) FROM ?:access_restriction as a WHERE a.type IN (?a)", $types[$selected_section]);
    $limit = fn_paginate(@$_REQUEST['page'], $total_items, $items_per_page);
    // fixme
    $access[$selected_section] = db_get_array("SELECT a.*, b.reason FROM ?:access_restriction as a LEFT JOIN ?:access_restriction_reason_descriptions as b ON a.item_id = b.item_id AND b.type = a.type AND lang_code = ?s WHERE a.type IN (?a) ORDER BY {$sort} {$limit}", DESCR_SL, $types[$selected_section]);
    $ip = fn_get_ip(true);
    $view->assign('sort_order', $sort_order == 'asc' ? 'desc' : 'asc');
    $view->assign('sort_by', $sort_by);
    $view->assign('show_mp', db_get_field("SELECT item_id FROM ?:access_restriction WHERE type = ?s", $selected_section == 'ip' ? 'ipb' : 'aab'));
    $view->assign('selected_section', $selected_section);
    $view->assign('access', $access);
    $view->assign('access_types', $types);
    $view->assign('host_ip', $ip['host']);
} elseif ($mode == 'delete') {
    if (!empty($_REQUEST['item_id'])) {
        db_query("DELETE FROM ?:access_restriction WHERE item_id = ?i", $_REQUEST['item_id']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, "access_restrictions.manage?selected_section={$_REQUEST['selected_section']}");
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:access_restrictions.php


示例13: get_validator_data

 static function get_validator_data()
 {
     $data = array();
     if (defined('SESS_VALIDATE_IP')) {
         $ip = fn_get_ip();
         $data['ip'] = $ip['host'];
     }
     if (defined('SESS_VALIDATE_UA')) {
         $data['ua'] = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     }
     return $data;
 }
开发者ID:diedsmiling,项目名称:busenika,代码行数:12,代码来源:class.session.php


示例14: fn_statistics_track_robots

function fn_statistics_track_robots($tpl_output, &$view)
{
    if (strpos($tpl_output, '<title>') === false) {
        return $tpl_output;
    }
    $sess_id = db_get_field('SELECT sess_id FROM ?:stat_sessions WHERE uniq_code = ?i AND timestamp > ?i', fn_crc32($_SERVER['HTTP_USER_AGENT']), TIME - 24 * 60 * 60);
    if (empty($sess_id)) {
        $ip = fn_get_ip(true);
        $referer = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
        $parse_url = parse_url($referer);
        $stat_data = array('user_agent' => $_SERVER['HTTP_USER_AGENT'], 'host_ip' => $ip['host'], 'proxy_ip' => $ip['proxy'], 'client_language' => $_SERVER['HTTP_ACCEPT_LANGUAGE'], 'ip_id' => fn_stat_ip_exist($ip), 'client_type' => 'B', 'robot' => CRAWLER, 'referrer' => $referer, 'timestamp' => TIME, 'referrer_scheme' => empty($parse_url['scheme']) ? '' : $parse_url['scheme'], 'referrer_host' => empty($parse_url['host']) ? '' : $parse_url['host'], 'expiry' => 0, 'uniq_code' => fn_crc32($_SERVER['HTTP_USER_AGENT']));
        $request_type = STAT_LAST_REQUEST;
        $sess_id = db_query('INSERT INTO ?:stat_sessions ?e', $stat_data);
        $last_url = '';
    } else {
        $last_url = db_get_field("SELECT url FROM ?:stat_requests WHERE sess_id = ?i AND (request_type & ?i) = ?i", $sess_id, STAT_LAST_REQUEST, STAT_LAST_REQUEST);
        db_query("UPDATE ?:stat_requests SET request_type = request_type & " . STAT_ORDINARY_REQUEST . " WHERE sess_id = ?s", $sess_id);
        $request_type = STAT_END_REQUEST;
    }
    // Add to stat requests
    $this_url = fn_stat_prepare_url(REAL_URL);
    if ($last_url != $this_url) {
        $title = '';
        if (preg_match_all('/\\<title\\>(.*?)\\<\\/title\\>/', $tpl_output, $m)) {
            $title = fn_html_escape($m[1][0], true);
        }
        $ve = array('sess_id' => $sess_id, 'timestamp' => TIME, 'url' => $this_url, 'title' => $title, 'https' => defined('HTTPS') ? 'Y' : 'N', 'loadtime' => microtime(true) - MICROTIME, 'request_type' => $request_type);
        db_query("INSERT INTO ?:stat_requests ?e", $ve);
    }
    return $tpl_output;
}
开发者ID:diedsmiling,项目名称:busenika,代码行数:31,代码来源:func.php


示例15: fn_place_order

/**
 * Order placing function
 *
 * @param array $cart
 * @param array $auth
 * @param string $action
 * @return int order_id or bool FALSE
 */
function fn_place_order(&$cart, &$auth, $action = '', $parent_order_id = 0)
{
    $allow = true;
    fn_set_hook('pre_place_order', $cart, $allow);
    if ($allow == true && !fn_cart_is_empty($cart)) {
        $ip = fn_get_ip();
        $__order_status = STATUS_INCOMPLETED_ORDER;
        $order = fn_check_table_fields($cart, 'orders');
        $order = fn_array_merge($order, fn_check_table_fields($cart['user_data'], 'orders'));
        // filter hidden fields, which were hidden to checkout
        fn_filter_hidden_profile_fields($order, 'O');
        // If the contact information fields were disabled, fill the information from the billing/shipping
        Registry::get('settings.General.address_position') == 'billing_first' ? $address_zone = 'b' : ($address_zone = 's');
        if (!empty($order['firstname']) || !empty($order[$address_zone . '_firstname'])) {
            $order['firstname'] = empty($order['firstname']) && !empty($order[$address_zone . '_firstname']) ? $order[$address_zone . '_firstname'] : $order['firstname'];
        }
        if (!empty($order['lastname']) || !empty($order[$address_zone . '_lastname'])) {
            $order['lastname'] = empty($order['lastname']) && !empty($order[$address_zone . '_lastname']) ? $order[$address_zone . '_lastname'] : $order['lastname'];
        }
        if (!empty($order['phone']) || !empty($order[$address_zone . '_phone'])) {
            $order['phone'] = empty($order['phone']) && !empty($order[$address_zone . '_phone']) ? $order[$address_zone . '_phone'] : $order['phone'];
        }
        $order['user_id'] = $auth['user_id'];
        $order['timestamp'] = TIME;
        $order['lang_code'] = CART_LANGUAGE;
        $order['tax_exempt'] = $auth['tax_exempt'];
        $order['status'] = STATUS_INCOMPLETED_ORDER;
        // incomplete by default to increase inventory
        $order['ip_address'] = $ip['host'];
        $cart['companies'] = fn_get_products_companies($cart['products']);
        $order['is_parent_order'] = 'N';
        if (PRODUCT_TYPE == 'MULTIVENDOR') {
            $order['parent_order_id'] = $parent_order_id;
            if (count($cart['companies']) > 1) {
                $order['is_parent_order'] = 'Y';
                $__order_status = $order['status'] = STATUS_PARENT_ORDER;
            } else {
                $order['company_id'] = key($cart['companies']);
            }
        }
        $order['promotions'] = serialize(!empty($cart['promotions']) ? $cart['promotions'] : array());
        if (!empty($cart['promotions'])) {
            $order['promotion_ids'] = implode(', ', array_keys($cart['promotions']));
        }
        $order['shipping_ids'] = !empty($cart['shipping']) ? fn_create_set(array_keys($cart['shipping'])) : '';
        if (!empty($cart['payment_surcharge'])) {
            $cart['total'] += $cart['payment_surcharge'];
            $order['total'] = $cart['total'];
        }
        if (!empty($cart['payment_info'])) {
            $ccards = fn_get_static_data_section('C', true);
            if (!empty($cart['payment_info']['card']) && !empty($ccards[$cart['payment_info']['card']])) {
                // Check if cvv2 number required and unset it if not
                if ($ccards[$cart['payment_info']['card']]['param_2'] != 'Y') {
                    unset($cart['payment_info']['cvv2']);
                }
                // Check if start date exists and required and convert it to string
                if ($ccards[$cart['payment_info']['card']]['param_3'] != 'Y') {
                    unset($cart['payment_info']['start_year'], $cart['payment_info']['start_month']);
                }
                // Check if issue number required
                if ($ccards[$cart['payment_info']['card']]['param_4'] != 'Y') {
                    unset($cart['payment_info']['issue_number']);
                }
            }
        }
        // We're editing existing order
        if (!empty($order['order_id']) && $order['is_parent_order'] != 'Y') {
            $_tmp = db_get_row("SELECT status, ip_address, details, timestamp, lang_code FROM ?:orders WHERE order_id = ?i", $order['order_id']);
            $order['ip_address'] = $_tmp['ip_address'];
            // Leave original customers IP address
            $order['details'] = $_tmp['details'];
            // Leave order details
            $order['timestamp'] = $_tmp['timestamp'];
            // Leave the original date
            $order['lang_code'] = $_tmp['lang_code'];
            // Leave the original language
            if ($action == 'save') {
                $__order_status = $_tmp['status'];
                // Get the original order status
            }
            fn_change_order_status($order['order_id'], STATUS_INCOMPLETED_ORDER, $_tmp['status'], fn_get_notification_rules(array(), false));
            // incomplete the order to increase inventory amount.
            db_query("DELETE FROM ?:orders WHERE order_id = ?i", $order['order_id']);
            db_query("DELETE FROM ?:order_details WHERE order_id = ?i", $order['order_id']);
            db_query("DELETE FROM ?:profile_fields_data WHERE object_id = ?i AND object_type = 'O'", $order['order_id']);
            db_query("DELETE FROM ?:order_data WHERE order_id = ?i AND type IN ('T', 'C', 'P')", $order['order_id']);
            fn_set_hook('edit_place_order', $order['order_id']);
        }
        if (!empty($cart['rewrite_order_id'])) {
            $order['order_id'] = array_shift($cart['rewrite_order_id']);
        }
//.........这里部分代码省略.........
开发者ID:diedsmiling,项目名称:busenika,代码行数:101,代码来源:fn.cart.php


示例16: fn_update_access_restriction_rule

function fn_update_access_restriction_rule($rule_data, $rule_id = 0, $lang_code = DESCR_SL)
{
    if ($rule_data['section'] == 'ip' || $rule_data['section'] == 'admin_panel') {
        $visitor_ip = fn_get_ip(true);
        if (!empty($rule_data['range_from']) || !empty($rule_data['range_to'])) {
            $range_from = empty($rule_data['range_from']) ? $rule_data['range_to'] : $rule_data['range_from'];
            $range_to = empty($rule_data['range_to']) ? $rule_data['range_from'] : $rule_data['range_to'];
            if (fn_validate_ip($range_from, true) && fn_validate_ip($range_to, true)) {
                $type_s = $rule_data['section'] == 'ip' ? 'ip' : 'aa';
                $_data = array('ip_from' => sprintf("%u", ip2long($range_from)), 'ip_to' => sprintf("%u", ip2long($range_to)), 'timestamp' => TIME, 'status' => $rule_data['status'], 'type' => $range_from == $range_to ? $type_s . 's' : $type_s . 'r');
                if ($rule_data['section'] == 'admin_panel' && Registry::get('addons.access_restrictions.admin_reverse_ip_access') != 'Y' && $_data['ip_from'] <= $visitor_ip['host'] && $_data['ip_to'] >= $visitor_ip['host']) {
                    fn_set_notification('W', __('warning', '', $lang_code), __('warning_of_ip_adding', array('[entered_ip]' => long2ip($_data['ip_from']) . ($_data['ip_from'] == $_data['ip_to'] ? '' : '-' . long2ip($_data['ip_to'])), '[your_ip]' => long2ip($visitor_ip['host'])), $lang_code));
                } else {
                    $rule_id = $_data['item_id'] = db_query("INSERT INTO ?:access_restriction ?e", $_data);
                    $_data['reason'] = $rule_data['reason'];
                    foreach (fn_get_translation_languages() as $_data['lang_code'] => $v) {
                        db_query("INSERT INTO ?:access_restriction_reason_descriptions ?e", $_data);
                    }
                }
            }
        }
        // Add domains
    } elseif ($rule_data['section'] == 'domain') {
        if (fn_validate_domain_name($rule_data['value'], true)) {
            $rule_data['type'] = 'd';
            // Domain
            $rule_data['timestamp'] = TIME;
            $rule_id = $rule_data['item_id'] = db_query("INSERT INTO ?:access_restriction ?e", $rule_data);
            foreach (fn_get_translation_languages() as $rule_data['lang_code'] => $v) {
                db_query("INSERT INTO ?:access_restriction_reason_descriptions ?e", $rule_data);
            }
        }
        // Add emails
    } elseif ($rule_data['section'] == 'email') {
        if (strstr($rule_data['value'], '@') && strpos($rule_data['value'], '*@') !== 0) {
            if (fn_validate_email($rule_data['value'], true) && fn_validate_domain_name(substr($rule_data['value'], strpos($rule_data['value'], '@')), true)) {
                $rule_data['type'] = 'es';
                // specific E-Mail
                $rule_data['timestamp'] = TIME;
                $rule_id = $rule_data['item_id'] = db_query("INSERT INTO ?:access_restriction ?e", $rule_data);
                foreach (fn_get_translation_languages() as $rule_data['lang_code'] => $v) {
                    db_query("INSERT INTO ?:access_restriction_reason_descriptions ?e", $rule_data);
                }
            }
        } else {
            $_domain = strpos($rule_data['value'], '*@') === 0 ? substr($rule_data['value'], 2) : $rule_data['value'];
            if (fn_validate_domain_name($_domain, true)) {
                $rule_data['type'] = 'ed';
                // E-Mail domain
                $rule_data['timestamp'] = TIME;
                $rule_id = $rule_data['item_id'] = db_query("INSERT INTO ?:access_restriction ?e", $rule_data);
                foreach (fn_get_translation_languages() as $rule_data['lang_code'] => $v) {
                    db_query("INSERT INTO ?:access_restriction_reason_descriptions ?e", $rule_data);
                }
            }
        }
        // Add credit cards
    } elseif ($rule_data['section'] == 'credit_card') {
        if (fn_validate_cc_number($rule_data['value'], true)) {
            $rule_data['type'] = 'cc';
            // specific Credit Card Number
            $rule_data['timestamp'] = TIME;
            $rule_id = $rule_data['item_id'] = db_query("INSERT INTO ?:access_restriction ?e", $rule_data);
            foreach (fn_get_translation_languages() as $rule_data['lang_code'] => $v) {
                db_query("INSERT INTO ?:access_restriction_reason_descriptions ?e", $rule_data);
            }
        }
    }
    return $rule_id;
}
开发者ID:Technollland,项目名称:afa,代码行数:70,代码来源:access_restrictions.php


示例17: fn_stat_save_session_data

function fn_stat_save_session_data(&$stat_data)
{
    $stat_data['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
    $ip = fn_get_ip(true);
    $stat_data['host_ip'] = $ip['host'];
    $stat_data['proxy_ip'] = $ip['proxy'];
    $stat_data['client_language'] = strtoupper(empty($stat_data['client_language']) ? empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? '' : $_SERVER['HTTP_A 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fn_get_lang_var函数代码示例发布时间:2022-05-15
下一篇:
PHP fn_get_image_pairs函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap