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


PHP Registry::ifGet方法代码示例

本文整理汇总了PHP中Tygh\Registry::ifGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::ifGet方法的具体用法?PHP Registry::ifGet怎么用?PHP Registry::ifGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tygh\Registry的用法示例。


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

示例1: connect

 /**
  * Connects to the database server
  * @param  string  $user     user name
  * @param  string  $passwd   password
  * @param  string  $host     host name
  * @param  string  $database database name
  * @param  array   $params   connection params
  * @return boolean true on success, false otherwise
  */
 public static function connect($user, $passwd, $host, $database, $params = array())
 {
     if (empty($params['dbc_name'])) {
         $params['dbc_name'] = 'main';
     }
     $params['table_prefix'] = $params['dbc_name'] == 'main' ? Registry::get('config.table_prefix') : $params['table_prefix'];
     if (empty(self::$_dbs[$params['dbc_name']])) {
         $_db_class = Registry::ifGet('config.database_backend', 'mysqli');
         $_db_class = '\\Tygh\\Backend\\Database\\' . ucfirst($_db_class);
         self::$_dbs[$params['dbc_name']] = array('db' => new $_db_class(), 'table_prefix' => $params['table_prefix']);
         $result = self::$_dbs[$params['dbc_name']]['db']->connect($user, $passwd, $host, $database);
         if (!$result) {
             self::$_dbs[$params['dbc_name']] = null;
         }
     } else {
         $result = true;
     }
     if ($result) {
         self::$_db =& self::$_dbs[$params['dbc_name']]['db'];
         self::$_table_prefix = self::$_dbs[$params['dbc_name']]['table_prefix'];
         if (empty($params['names'])) {
             $params['names'] = 'utf8';
         }
         if (empty($params['group_concat_max_len'])) {
             $params['group_concat_max_len'] = 3000;
             // 3Kb
         }
         self::$_db->initCommand(self::quote("SET NAMES ?s, sql_mode = ?s, SESSION group_concat_max_len = ?i", $params['names'], '', $params['group_concat_max_len']));
     }
     return $result;
 }
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:40,代码来源:Database.php

示例2: fn_rus_kupivkredit_pre_add_to_cart

function fn_rus_kupivkredit_pre_add_to_cart(&$product_data, &$cart, &$auth, &$update)
{
    if (Registry::ifGet('addons.rus_kupivkredit.status', 'D') == 'A' && Registry::get('runtime.action') == 'kvk_activate') {
        $payment_methods = fn_get_payment_methods($auth);
        foreach ($payment_methods as $p => $data) {
            if (!empty($data['processor']) && stristr($data['processor'], 'Kupivkredit')) {
                $cart['payment_id'] = $data['payment_id'];
            }
        }
    }
}
开发者ID:ambient-lounge,项目名称:site,代码行数:11,代码来源:func.php

示例3: register

 /**
  * @inheritDoc
  */
 public function register(Container $app)
 {
     // Session component
     $app['session'] = function ($app) {
         $session = new \Tygh\Web\Session($app);
         // Configure conditions of session start
         if (defined('NO_SESSION') && NO_SESSION) {
             $session->start_on_init = false;
             $session->start_on_read = false;
             $session->start_on_write = false;
             return $session;
         }
         // Configure session component
         $session->setSessionNamePrefix('sid_');
         $session->setSessionNameSuffix('_' . substr(md5(Registry::get('config.http_location')), 0, 5));
         $session->setName(ACCOUNT_TYPE);
         $session->setSessionIDSuffix('-' . AREA);
         $session->cache_limiter = 'nocache';
         $session->cookie_lifetime = SESSIONS_STORAGE_ALIVE_TIME;
         $session->cookie_path = Registry::ifGet('config.current_path', '/');
         $host = defined('HTTPS') ? 'https://' . Registry::get('config.https_host') : 'http://' . Registry::get('config.http_host');
         $host = parse_url($host, PHP_URL_HOST);
         if (strpos($host, '.') !== false) {
             // Check if host has www, www2, www4 prefix and remove it
             $host = preg_replace('/^www[0-9]*\\./i', '', $host);
             $host = strpos($host, '.') === 0 ? $host : '.' . $host;
         } else {
             // For local hosts set this to empty value
             $host = '';
         }
         if (!preg_match("/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/", $host, $matches)) {
             $cookie_domain = $host;
         } else {
             $cookie_domain = ini_get('session.cookie_domain');
         }
         $session->cookie_domain = $cookie_domain;
         $session->start_on_init = true;
         $session->start_on_read = true;
         $session->start_on_write = true;
         return $session;
     };
     // Session data storage driver class
     $app['session.storage.class'] = function ($app) {
         $storage_class = Registry::ifGet('config.session_backend', 'database');
         $storage_class = '\\Tygh\\Backend\\Session\\' . ucfirst($storage_class);
         return $storage_class;
     };
     // Session data storage driver instance
     $app['session.storage'] = function ($app) {
         return new $app['session.storage.class'](Registry::get('config'), array('ttl' => SESSION_ONLINE, 'ttl_storage' => SESSIONS_STORAGE_ALIVE_TIME, 'ttl_online' => SESSION_ONLINE));
     };
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:55,代码来源:SessionProvider.php

示例4: groupProductsList

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

示例5: register

 /**
  * @inheritDoc
  */
 public function register(Container $app)
 {
     // Database component
     $app['db'] = function ($app) {
         $database = new Connection($app['db.driver']);
         $connected = $database->connect(Registry::get('config.db_user'), Registry::get('config.db_password'), Registry::get('config.db_host'), Registry::get('config.db_name'), array('table_prefix' => Registry::get('config.table_prefix')));
         if ($connected) {
             Registry::set('runtime.database.skip_errors', false);
         } else {
             throw new DatabaseException('Cannot connect to the database server');
         }
         return $database;
     };
     // Database driver instance
     $app['db.driver'] = function ($app) {
         return new $app['db.driver.class']();
     };
     $app['db.driver.class'] = function ($app) {
         $driver_class = Registry::ifGet('config.database_backend', 'mysqli');
         $driver_class = '\\Tygh\\Backend\\Database\\' . ucfirst($driver_class);
         return $driver_class;
     };
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:26,代码来源:DatabaseProvider.php

示例6: fn_get_sb_providers_meta_data

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

示例7: fn_log_event

function fn_log_event($type, $action, $data = array())
{
    $object_primary_keys = array('users' => 'user_id', 'orders' => 'order_id', 'products' => 'product_id', 'categories' => 'category_id');
    $update = false;
    $content = array();
    $actions = Registry::get('settings.Logging.log_type_' . $type);
    $cut_log = Registry::ifGet('log_cut', false);
    Registry::del('log_cut');
    $cut_data = Registry::ifGet('log_cut_data', false);
    Registry::del('log_cut_data');
    if (empty($actions) || $action && !empty($actions) && empty($actions[$action]) || !empty($cut_log)) {
        return false;
    }
    if (!empty($_SESSION['auth']['user_id'])) {
        $user_id = $_SESSION['auth']['user_id'];
    } else {
        $user_id = 0;
    }
    if ($type == 'users' && $action == 'logout' && !empty($data['user_id'])) {
        $user_id = $data['user_id'];
    }
    if ($user_id) {
        $udata = db_get_row("SELECT firstname, lastname, email FROM ?:users WHERE user_id = ?i", $user_id);
    }
    $event_type = 'N';
    // notice
    if (!empty($data['backtrace'])) {
        $_btrace = array();
        $func = '';
        foreach (array_reverse($data['backtrace']) as $v) {
            if (!empty($v['file'])) {
                $v['file'] = fn_get_rel_dir($v['file']);
            }
            if (empty($v['file'])) {
                $func = $v['function'];
                continue;
            } 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'])) {
//.........这里部分代码省略.........
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:fn.log.php

示例8: fn_resize_image

/**
 * Resizes image
 * @param string $src source image path
 * @param integer $new_width new image width
 * @param integer $new_height new image height
 * @param string $bg_color new image background color
 * @param array $custom_settings custom convertion settings
 * @return array - new image contents and format
 */
function fn_resize_image($src, $new_width = 0, $new_height = 0, $bg_color = '#ffffff', $custom_settings = array())
{
    static $notification_set = false;
    static $gd_settings = array();
    if (empty($gd_settings)) {
        $gd_settings = Settings::instance()->getValues('Thumbnails');
    }
    $settings = !empty($custom_settings) ? $custom_settings : $gd_settings;
    $class = '\\Tygh\\Backend\\Images\\' . ucfirst(Registry::ifGet('config.tweaks.image_resize_lib', 'gd'));
    if (file_exists($src) && (!empty($new_width) || !empty($new_height))) {
        $img_functions = $class::supportedFormats();
        list($width, $height, $mime_type) = fn_get_image_size($src);
        $ext = fn_get_image_extension($mime_type);
        if (empty($width) || empty($height) || empty($ext)) {
            return false;
        }
        if (empty($img_functions[$ext])) {
            if ($notification_set == false) {
                fn_set_notification('E', __('error'), __('error_image_format_not_supported', array('[format]' => $ext)));
                $notification_set = true;
            }
            return false;
        }
        if (empty($new_width) || empty($new_height)) {
            if ($width < $new_width) {
                $new_width = $width;
            }
            if ($height < $new_height) {
                $new_height = $height;
            }
        }
        $dst_width = $new_width;
        $dst_height = $new_height;
        $x = 0;
        $y = 0;
        if (empty($new_height)) {
            // if we passed width only, calculate height
            $dst_height = $new_height = $height / $width * $new_width;
        } elseif (empty($new_width)) {
            // if we passed height only, calculate width
            $dst_width = $new_width = $width / $height * $new_height;
        } else {
            // we passed width and height, we need to fit image in this sizes
            if ($new_width * $height / $width > $dst_height) {
                $new_width = $width * $dst_height / $height;
            }
            $new_height = $height / $width * $new_width;
            if ($new_height * $width / $height > $dst_width) {
                $new_height = $height * $dst_width / $width;
            }
            $new_width = $width / $height * $new_height;
            $x = intval(($dst_width - $new_width) / 2);
            $y = intval(($dst_height - $new_height) / 2);
        }
        $new_width = intval($new_width);
        $new_height = intval($new_height);
        if (!empty($bg_color) && !preg_match('/^#([0-9a-f]{3}){1,2}$/i', $bg_color)) {
            $bg_color = '#ffffff';
        }
        try {
            return $class::resize($src, array('ext' => $ext, 'new_width' => $new_width, 'new_height' => $new_height, 'dst_width' => $dst_width, 'dst_height' => $dst_height, 'width' => $width, 'height' => $height, 'bg_color' => $bg_color, 'convert_to' => $settings['convert_to'], 'jpeg_quality' => $settings['jpeg_quality'], 'x' => $x, 'y' => $y));
        } catch (Exception $e) {
            return array('', $ext);
        }
    }
    return false;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:76,代码来源:fn.images.php

示例9: fn_update_user

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

示例10: allowCache

 /**
  * Returns true if cache used for blocks
  *
  * @static
  * @return bool true if we may use cahce, false otherwise
  */
 public static function allowCache()
 {
     $use_cache = true;
     if (Registry::ifGet('config.tweaks.disable_block_cache', false) || Registry::get('runtime.customizaton_mode.design') || Registry::get('runtime.customizaton_mode.translation') || Development::isEnabled('compile_check')) {
         $use_cache = false;
     }
     return $use_cache;
 }
开发者ID:arpad9,项目名称:bygmarket,代码行数:14,代码来源:RenderManager.php

示例11: fn_check_is_active_menu_item

/**
 * Function checks should the given menu element be marked as active or not
 *
 * @param array $object_data Menu item
 * @param string $object_type Type of menu item (category or page data)
 * @return bool
 */
function fn_check_is_active_menu_item($object_data, $object_type)
{
    $id = null;
    if ($object_type == 'categories') {
        $active_ids = Registry::ifGet('runtime.active_category_ids', array());
        $id = $object_data['category_id'];
    } elseif ($object_type == 'pages') {
        $active_ids = Registry::ifGet('runtime.active_page_ids', array());
        $id = $object_data['page_id'];
    } else {
        return false;
    }
    return in_array($id, $active_ids);
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:21,代码来源:fn.cms.php

示例12: fn_get_payment_templates

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

示例13: foreach

 if (empty($items_schema['func'])) {
     $c_elm = '';
 } else {
     $c_elm = $items_schema['func'];
     foreach ($c_elm as $k => $v) {
         if (strpos($v, '@') !== false) {
             $ind = str_replace('@', '', $v);
             if (!empty($auth[$ind]) || !empty($_REQUEST[$ind])) {
                 $c_elm[$k] = $ind == 'user_id' && empty($_REQUEST[$ind]) ? $auth[$ind] : $_REQUEST[$ind];
             }
         }
     }
 }
 $url = Registry::get('config.current_url');
 if (fn_allowed_for('ULTIMATE') && !Registry::get('runtime.simple_ultimate')) {
     $url = fn_link_attach($url, 'switch_company_id=' . Registry::ifGet('runtime.company_id', 'all'));
     $url = str_replace('&amp;', '&', $url);
     // FIXME: workaround for fn_link_attach return result
 }
 $last_item = array('func' => $c_elm, 'url' => $url, 'icon' => empty($items_schema['icon']) ? '' : $items_schema['icon'], 'text' => empty($items_schema['text']) ? '' : $items_schema['text']);
 $current_hash = fn_crc32(!empty($c_elm) ? implode('', $c_elm) : $items_schema['text']);
 // remove element if it already exists and add it to the end of history
 unset($last_edited_items[$current_hash]);
 $last_edited_items[$current_hash] = $last_item;
 if (count($last_edited_items) > $last_items_cnt) {
     foreach ($last_edited_items as $k => $v) {
         unset($last_edited_items[$k]);
         if (count($last_edited_items) == $last_items_cnt) {
             break;
         }
     }
开发者ID:askzap,项目名称:ask-zap,代码行数:31,代码来源:init.php

示例14: fn_searchanise_get_products_before_select

function fn_searchanise_get_products_before_select(&$params, &$join, &$condition, &$u_condition, &$inventory_condition, &$sortings, &$total, &$items_per_page, &$lang_code, &$having)
{
    // disable by core
    if (AREA == 'A' || fn_se_check_disabled() || !empty($params['having']) || !empty($params['disable_searchanise']) || empty($params['search_performed']) || !empty($params['block_data']) || empty($params['q']) && fn_se_get_simple_setting('use_navigation') !== 'Y' || fn_se_get_import_status(fn_se_get_company_id(), $lang_code) != 'done' || !empty($params['pid']) || !empty($params['b_id']) || !empty($params['item_ids']) || !empty($params['feature']) || !empty($params['downloadable']) || !empty($params['tracking']) || !empty($params['shipping_freight_from']) || !empty($params['shipping_freight_to']) || !empty($params['exclude_pid']) || !empty($params['get_query']) || !empty($params['only_short_fields']) || isset($params['supplier_id']) || isset($params['amount_to']) || isset($params['amount_from']) || isset($params['q']) && Registry::get('settings.General.search_objects') || isset($params['compact']) && $params['compact'] == 'Y' || !empty($_REQUEST['sort_by']) && !in_array($_REQUEST['sort_by'], fn_se_get_valid_sortings()) || !empty($params['force_get_by_ids']) && empty($params['pid']) && empty($params['product_id'])) {
        return;
    }
    // disable by addons
    if (!empty($params['rating']) || !empty($params['bestsellers']) || !empty($params['also_bought_for_product_id']) || !empty($params['for_required_product']) || !empty($params['ppcode']) && $params['ppcode'] == 'Y' || isset($params['tag']) && fn_string_not_empty($params['tag']) || Registry::ifGet('addons.age_verification.status', 'D') == 'A' || Registry::ifGet('addons.vendor_data_premoderation.status', 'D') == 'A' || !empty($params['picker_for']) && $params['picker_for'] == 'gift_certificates') {
        return;
    }
    list($restrict_by, $query_by, $union) = fn_se_prepare_request_params($params);
    //
    // Categories
    //
    if (!empty($params['cid'])) {
        $cids = is_array($params['cid']) ? $params['cid'] : array($params['cid']);
        $c_condition = '';
        if (AREA == 'C') {
            $_c_statuses = array('A', 'H');
            // Show enabled categories
            $cids = db_get_fields("SELECT a.category_id FROM ?:categories as a WHERE a.category_id IN (?n) AND a.status IN (?a)", $cids, $_c_statuses);
            $c_condition = db_quote('AND a.status IN (?a) AND (' . fn_find_array_in_set(Tygh::$app['session']['auth']['usergroup_ids'], 'a.usergroup_ids', true) . ')', $_c_statuses);
        }
        $sub_categories_ids = db_get_fields("SELECT a.category_id FROM ?:categories as a LEFT JOIN ?:categories as b ON b.category_id IN (?n) WHERE a.id_path LIKE CONCAT(b.id_path, '/%') ?p", $cids, $c_condition);
        $sub_categories_ids = fn_array_merge($cids, $sub_categories_ids, false);
        if (empty($sub_categories_ids)) {
            $params['force_get_by_ids'] = true;
            $params['pid'] = $params['product_id'] = 0;
            return;
        }
        if (!empty($params['subcats']) && $params['subcats'] == 'Y') {
            $restrict_by['category_id'] = join('|', $sub_categories_ids);
        } else {
            $restrict_by['category_id'] = join('|', $cids);
        }
    }
    //
    // Sortings
    //
    if (!empty($_REQUEST['search_performed']) && empty($_REQUEST['sort_by']) && SE_USE_RELEVANCE_AS_DEFAULT_SORTING == 'Y') {
        $params['sort_by'] = 'relevance';
        $params['sort_order'] = 'asc';
    }
    if (!empty($params['sort_by']) && !in_array($params['sort_by'], fn_se_get_valid_sortings())) {
        return;
    }
    if ($params['sort_by'] == 'product') {
        $sort_by = 'title';
    } elseif ($params['sort_by'] == 'relevance') {
        $params['sort_order'] = 'asc';
        $sort_by = 'relevance';
    } else {
        $sort_by = $params['sort_by'];
    }
    $sort_order = $params['sort_order'] == 'asc' ? 'asc' : 'desc';
    //
    // Items_per_page
    //
    $items_per_page = empty($params['items_per_page']) ? 10 : (int) $params['items_per_page'];
    if (!empty($params['limit'])) {
        $max_results = $params['limit'];
    } else {
        $max_results = $items_per_page;
    }
    $get_items = true;
    $get_facets = false;
    if (!fn_allowed_for('ULTIMATE:FREE') && AREA == 'C' && !empty($params['dispatch']) && in_array($params['dispatch'], fn_se_get_facet_valid_locations()) && fn_se_check_product_filter_block() == true) {
        $get_facets = true;
    }
    $request_params = array('sortBy' => $sort_by, 'sortOrder' => $sort_order, 'union' => $union, 'queryBy' => $query_by, 'restrictBy' => $restrict_by, 'items' => $get_items == true ? 'true' : 'false', 'facets' => $get_facets == true ? 'true' : 'false', 'maxResults' => $max_results, 'startIndex' => ($params['page'] - 1) * $items_per_page);
    if ($request_params['sortBy'] == 'null') {
        unset($request_params['sortBy']);
    }
    if (!empty($params['q']) && fn_strlen($params['q']) > 0) {
        $request_params['q'] = $params['q'];
        $request_params['suggestions'] = 'true';
        $request_params['query_correction'] = 'false';
        $request_params['suggestionsMaxResults'] = 1;
    } else {
        $request_params['q'] = '';
    }
    $result = fn_searchanise_send_search_request($request_params, $lang_code);
    if ($result == false) {
        //revert to standart sorting
        if ($params['sort_by'] == 'relevance') {
            $params['sort_by'] = '';
        }
        Registry::set('runtime.se_use_relevance_sorting', false);
        return;
    }
    if (!empty($result['suggestions']) && count($result['suggestions']) > 0) {
        $params['suggestion'] = reset($result['suggestions']);
    }
    if (!empty($result['items'])) {
        foreach ($result['items'] as $product) {
            $params['pid'][] = $product['product_id'];
        }
        if ($params['sort_by'] == 'relevance') {
            $sortings['relevance'] = "FIELD(products.product_id, '" . join("','", $params['pid']) . "')";
            $params['sort_order'] = 'asc';
//.........这里部分代码省略.........
开发者ID:ambient-lounge,项目名称:site,代码行数:101,代码来源:func.php

示例15: fn_mailru_put_header

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


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