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


PHP fn_string_not_empty函数代码示例

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


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

示例1: getVariables

 public static function getVariables($params, $items_per_page = 0, $lang_code = DESCR_SL)
 {
     // Set default values to input params
     $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
     $params = array_merge($default_params, $params);
     $fields = array('lang.value' => true, 'lang.name' => true);
     if (!empty($params['fields'])) {
         $fields = array_merge($fields, $params['fields']);
     }
     $tables = array('?:language_values as lang');
     $left_join = array();
     $condition = array();
     $condition['param1'] = db_quote('lang.lang_code = ?s', $lang_code);
     if (isset($params['q']) && fn_string_not_empty($params['q'])) {
         $condition['param2'] = db_quote('(lang.name LIKE ?l OR lang.value LIKE ?l)', '%' . trim($params['q']) . '%', '%' . trim($params['q']) . '%');
     }
     fn_set_hook('get_language_variable', $fields, $tables, $left_join, $condition, $params);
     $joins = !empty($left_join) ? ' LEFT JOIN ' . implode(', ', $left_join) : '';
     $limit = '';
     if (!empty($params['items_per_page'])) {
         $params['total_items'] = db_get_field('SELECT COUNT(*) FROM ' . implode(', ', $tables) . $joins . ' WHERE ' . implode(' AND ', $condition));
         $limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
     }
     $lang_data = db_get_array('SELECT ' . implode(', ', array_keys($fields)) . ' FROM ' . implode(', ', $tables) . $joins . ' WHERE ' . implode(' AND ', $condition) . ' ORDER BY lang.name ' . $limit);
     return array($lang_data, $params);
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:26,代码来源:Values.php

示例2: fn_get_seo_redirects

function fn_get_seo_redirects($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
    // Init filter
    $params = LastView::instance()->update('seo_redirects', $params);
    // Set default values to input params
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    $condition = '';
    if (isset($params['src']) && fn_string_not_empty($params['src'])) {
        $condition .= db_quote(" AND src LIKE ?l", "%" . trim($params['src']) . "%");
    }
    if (!empty($params['type'])) {
        $condition .= db_quote(" AND type = ?s", $params['type']);
    }
    if (!empty($params['lang_code'])) {
        $condition .= db_quote(" AND lang_code = ?s", $params['lang_code']);
    }
    $condition .= fn_get_seo_company_condition('?:seo_redirects.company_id');
    $limit = '';
    if (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:seo_redirects WHERE 1 ?p", $condition);
        $limit = db_paginate($params['page'], $params['items_per_page']);
    }
    $seo_redirects = db_get_hash_array("SELECT * FROM ?:seo_redirects WHERE 1 ?p ORDER BY src {$limit}", 'redirect_id', $condition);
    if (!empty($seo_redirects)) {
        foreach ($seo_redirects as $key => $seo_redirect) {
            $seo_redirects[$key]['parsed_url'] = fn_generate_seo_url_from_schema($seo_redirect);
        }
    }
    return array($seo_redirects, $params);
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:seo_redirects.php

示例3: fn_get_seo_rules

function fn_get_seo_rules($params = array(), $items_per_page = 0, $lang_code = DESCR_SL)
{
    $condition = fn_get_seo_company_condition('?:seo_names.company_id');
    $lang_code = fn_get_corrected_seo_lang_code($lang_code);
    $global_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' ?p GROUP BY dispatch", $condition);
    $local_total = db_get_fields("SELECT dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
    if ($diff = array_diff($global_total, $local_total)) {
        foreach ($diff as $disp) {
            fn_create_seo_name(0, 's', str_replace('.', '-', $disp), 0, $disp, '', DESCR_SL);
        }
    }
    // Init filter
    $params = LastView::instance()->update('seo_rules', $params);
    // Set default values to input params
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    if (isset($params['name']) && fn_string_not_empty($params['name'])) {
        $condition .= db_quote(" AND name LIKE ?l", "%" . trim($params['name']) . "%");
    }
    if (isset($params['rule_params']) && fn_string_not_empty($params['rule_params'])) {
        $condition .= db_quote(" AND dispatch LIKE ?l", "%" . trim($params['rule_params']) . "%");
    }
    $limit = '';
    if (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p", $lang_code, $condition);
        $limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
    }
    $seo_data = db_get_array("SELECT name, dispatch FROM ?:seo_names WHERE object_id = '0' AND type = 's' AND lang_code = ?s ?p ORDER BY dispatch {$limit}", $lang_code, $condition);
    return array($seo_data, $params);
}
开发者ID:askzap,项目名称:ultimate,代码行数:30,代码来源:seo_rules.php

示例4: fn_get_discussions

function fn_get_discussions($params, $items_per_page)
{
    // Init filter
    $params = LastView::instance()->update('discussion', $params);
    // Set default values to input params
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    // Define fields that should be retrieved
    $fields = array('?:discussion_posts.*', '?:discussion_messages.message', '?:discussion_rating.rating_value', '?:discussion.*');
    // Define sort fields
    $sortings = array('object' => "?:discussion.object_type", 'name' => "?:discussion_posts.name", 'ip_address' => "?:discussion_posts.ip_address", 'timestamp' => "?:discussion_posts.timestamp", 'status' => "?:discussion_posts.status", 'date' => "?:orders.timestamp", 'total' => "?:orders.total");
    $sorting = db_sort($params, $sortings, 'timestamp', 'desc');
    $condition = $join = '';
    if (isset($params['name']) && fn_string_not_empty($params['name'])) {
        $condition .= db_quote(" AND ?:discussion_posts.name LIKE ?l", "%" . trim($params['name']) . "%");
    }
    if (isset($params['message']) && fn_string_not_empty($params['message'])) {
        $condition .= db_quote(" AND ?:discussion_messages.message LIKE ?l", "%" . trim($params['message']) . "%");
    }
    if (!empty($params['type'])) {
        $condition .= db_quote(" AND ?:discussion.type = ?s", $params['type']);
    }
    if (!empty($params['status'])) {
        $condition .= db_quote(" AND ?:discussion_posts.status = ?s", $params['status']);
    }
    if (!empty($params['post_id'])) {
        $condition .= db_quote(" AND ?:discussion_posts.post_id = ?i", $params['post_id']);
    }
    if (isset($params['ip_address']) && fn_string_not_empty($params['ip_address'])) {
        $condition .= db_quote(" AND ?:discussion_posts.ip_address = ?s", fn_ip_to_db(trim($params['ip_address'])));
    }
    if (!empty($params['rating_value'])) {
        $condition .= db_quote(" AND ?:discussion_rating.rating_value = ?i", $params['rating_value']);
    }
    if (!empty($params['object_type'])) {
        $condition .= db_quote(" AND ?:discussion.object_type = ?s", $params['object_type']);
    }
    $condition .= fn_get_discussion_company_condition('?:discussion.company_id');
    if (!empty($params['period']) && $params['period'] != 'A') {
        list($params['time_from'], $params['time_to']) = fn_create_periods($params);
        $condition .= db_quote(" AND (?:discussion_posts.timestamp >= ?i AND ?:discussion_posts.timestamp <= ?i)", $params['time_from'], $params['time_to']);
    }
    $join .= " INNER JOIN ?:discussion ON ?:discussion.thread_id = ?:discussion_posts.thread_id";
    $join .= " INNER JOIN ?:discussion_messages ON ?:discussion_messages.post_id = ?:discussion_posts.post_id";
    $join .= " INNER JOIN ?:discussion_rating ON ?:discussion_rating.post_id = ?:discussion_posts.post_id";
    $limit = '';
    if (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(*) FROM ?:discussion_posts {$join} WHERE 1 {$condition}");
        $limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
    }
    $posts = db_get_array("SELECT " . implode(',', $fields) . " FROM ?:discussion_posts {$join} WHERE 1 {$condition} {$sorting} {$limit}");
    foreach ($posts as $k => $post) {
        if (isset($post['ip_address'])) {
            $posts[$k]['ip_address'] = fn_ip_from_db($post['ip_address']);
        }
    }
    return array($posts, $params);
}
开发者ID:askzap,项目名称:ultimate,代码行数:58,代码来源:discussion_manager.php

示例5: fn_yandex_metrika_oauth_info

/**
 * Handlers
 */
function fn_yandex_metrika_oauth_info()
{
    if (!fn_string_not_empty(Registry::get('addons.rus_yandex_metrika.application_id')) || !fn_string_not_empty(Registry::get('addons.rus_yandex_metrika.application_password'))) {
        return __('yandex_metrika_oauth_info_part1', array('[callback_uri]' => fn_url('yandex_metrika_tools.oauth')));
    } else {
        $client_id = Registry::get('addons.rus_yandex_metrika.application_id');
        return __('yandex_metrika_oauth_info_part2', array('[auth_uri]' => "https://oauth.yandex.ru/authorize?response_type=code&client_id=" . $client_id, '[edit_app_uri]' => "https://oauth.yandex.ru/client/edit/" . $client_id));
    }
}
开发者ID:askzap,项目名称:ask-zap,代码行数:12,代码来源:func.php

示例6: getBlocksForLocation

 /**
  * Get blocks for the twigmo homepage
  * @param  string $dispatch        Dispatch of needed location
  * @param  array  $allowed_objects - array of blocks types
  * @return array  blocks
  */
 public static final function getBlocksForLocation($dispatch, $allowed_objects)
 {
     $allowed_page_types = array('T', 'L', 'F');
     $blocks = array();
     $location = Location::instance(fn_twg_get_default_layout_id())->get($dispatch);
     if (!$location) {
         return $blocks;
     }
     $get_cont_params = array('location_id' => $location['location_id']);
     $container = Container::getList($get_cont_params);
     if (!$container or !$container['CONTENT']) {
         return $blocks;
     }
     $grids_params = array('container_ids' => $container['CONTENT']['container_id']);
     $grids = Grid::getList($grids_params);
     if (!$grids) {
         return $blocks;
     }
     $block_grids = Block::instance()->getList(array('?:bm_snapping.*', '?:bm_blocks.*', '?:bm_blocks_descriptions.*'), Grid::getIds($grids));
     $image_params = TwigmoSettings::get('images.catalog');
     foreach ($block_grids as $block_grid) {
         foreach ($block_grid as $block) {
             if ($block['status'] != 'A' or !in_array($block['type'], $allowed_objects)) {
                 continue;
             }
             $block_data = array('block_id' => $block['block_id'], 'title' => $block['name'], 'hide_header' => isset($block['properties']['hide_header']) ? $block['properties']['hide_header'] : 'N', 'user_class' => $block['user_class']);
             $block_scheme = SchemesManager::getBlockScheme($block['type'], array());
             if ($block['type'] == 'html_block') {
                 // Html block
                 if (isset($block['content']['content']) and fn_string_not_empty($block['content']['content'])) {
                     $block_data['html'] = $block['content']['content'];
                 }
             } elseif (!empty($block_scheme['content']) and !empty($block_scheme['content']['items'])) {
                 // Products and categories: get items
                 $template_variable = 'items';
                 $field = $block_scheme['content']['items'];
                 fn_set_hook('render_block_content_pre', $template_variable, $field, $block_scheme, $block);
                 $items = RenderManager::getValue($template_variable, $field, $block_scheme, $block);
                 // Filter pages - only texts, links and forms posible
                 if ($block['type'] == 'pages') {
                     foreach ($items as $item_id => $item) {
                         if (!in_array($item['page_type'], $allowed_page_types)) {
                             unset($items[$item_id]);
                         }
                     }
                 }
                 if (empty($items)) {
                     continue;
                 }
                 $block_data['total_items'] = count($items);
                 // Images
                 if ($block['type'] == 'products' or $block['type'] == 'categories') {
                     $object_type = $block['type'] == 'products' ? 'product' : 'category';
                     foreach ($items as $items_id => $item) {
                         if (!empty($item['main_pair'])) {
                             $main_pair = $item['main_pair'];
                         } else {
                             $main_pair = fn_get_image_pairs($item[$object_type . '_id'], $object_type, 'M', true, true);
                         }
                         if (!empty($main_pair)) {
                             $items[$items_id]['icon'] = TwigmoImage::getApiImageData($main_pair, $object_type, 'icon', $image_params);
                         }
                     }
                 }
                 // Banners properties
                 if ($block['type'] == 'banners') {
                     $rotation = $block['properties']['template'] == 'addons/banners/blocks/carousel.tpl' ? 'Y' : 'N';
                     $block_data['delay'] = $rotation == 'Y' ? $block['properties']['delay'] : 0;
                     $block_data['hide_navigation'] = isset($block['properties']['navigation']) && $block['properties']['navigation'] == 'N' ? 'Y' : 'N';
                 }
                 $block_data[$block['type']] = Api::getAsList($block['type'], $items);
             }
             $blocks[$block['block_id']] = $block_data;
         }
     }
     return $blocks;
 }
开发者ID:askzap,项目名称:ultimate,代码行数:83,代码来源:TwigmoBlock.php

示例7: fn_get_logs

/**
 * Returns store logs
 *
 * @param array $params Search parameters
 * @param int $items_per_page Logs limit
 * @return array Logs with search parameters
 */
function fn_get_logs($params, $items_per_page = 0)
{
    // Init filter
    $params = LastView::instance()->update('logs', $params);
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    $sortings = array('timestamp' => array('?:logs.timestamp', '?:logs.log_id'), 'user' => array('?:users.lastname', '?:users.firstname'));
    $fields = array('?:logs.*', '?:users.firstname', '?:users.lastname');
    $sorting = db_sort($params, $sortings, 'timestamp', 'desc');
    $join = "LEFT JOIN ?:users USING(user_id)";
    $condition = '';
    if (!empty($params['period']) && $params['period'] != 'A') {
        list($time_from, $time_to) = fn_create_periods($params);
        $condition .= db_quote(" AND (?:logs.timestamp >= ?i AND ?:logs.timestamp <= ?i)", $time_from, $time_to);
    }
    if (isset($params['q_user']) && fn_string_not_empty($params['q_user'])) {
        $condition .= db_quote(" AND (?:users.lastname LIKE ?l OR ?:users.firstname LIKE ?l)", "%" . trim($params['q_user']) . "%", "%" . trim($params['q_user']) . "%");
    }
    if (!empty($params['q_type'])) {
        $condition .= db_quote(" AND ?:logs.type = ?s", $params['q_type']);
    }
    if (!empty($params['q_action'])) {
        $condition .= db_quote(" AND ?:logs.action = ?s", $params['q_action']);
    }
    if (Registry::get('runtime.company_id')) {
        $condition .= db_quote(" AND ?:logs.company_id = ?i", Registry::get('runtime.company_id'));
    }
    fn_set_hook('admin_get_logs', $params, $condition, $join, $sorting);
    $limit = '';
    if (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(DISTINCT(?:logs.log_id)) FROM ?:logs ?p WHERE 1 ?p", $join, $condition);
        $limit = db_paginate($params['page'], $params['items_per_page']);
    }
    $data = db_get_array("SELECT " . join(', ', $fields) . " FROM ?:logs ?p WHERE 1 ?p {$sorting} {$limit}", $join, $condition);
    foreach ($data as $k => $v) {
        $data[$k]['backtrace'] = !empty($v['backtrace']) ? unserialize($v['backtrace']) : array();
        $data[$k]['content'] = !empty($v['content']) ? unserialize($v['content']) : array();
    }
    return array($data, $params);
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:47,代码来源:fn.log.php

示例8: array

    return array(CONTROLLER_STATUS_OK, "hw_404_fixer.manage");
}
if ($mode == 'manage') {
    $params = $_REQUEST;
    $default_params = array('page' => 1, 'items_per_page' => Registry::get('settings.Appearance.admin_products_per_page'));
    if (is_array($params)) {
        $params = array_merge($default_params, $params);
    } else {
        $params = $default_params;
    }
    $fields = array('?:hw_404.*');
    $sortings = array('id' => '?:hw_404.id', 'url' => '?:hw_404.url', 'timestamp' => '?:hw_404.created', 'redirect' => '?:hw_404.redirect', 'hits' => '?:hw_404.hits', 'redirect_type' => '?:hw_404.redirect_type');
    $auth =& $_SESSION['auth'];
    $condition = '1';
    $join = $limit = $group_by = '';
    if (isset($params['q']) && fn_string_not_empty($params['q'])) {
        $condition .= db_quote(' AND ( url LIKE ?l  OR redirect LIKE ?l OR referer LIKE ?l)', '%' . $params['q'] . '%', '%' . $params['q'] . '%', '%' . $params['q'] . '%');
    }
    $company_id = Registry::get('runtime.company_id');
    if ($company_id > 0) {
        $condition .= db_quote(' AND company_id=?i', $company_id);
    }
    #NEW
    if (!isset($_REQUEST['show']) || $_REQUEST['show'] != 'all') {
        $condition .= db_quote(' AND ( redirect=?s OR redirect IS NULL) AND object_id=?i', '', 0);
    }
    $sorting = db_sort($params, $sortings, 'timestamp', 'desc');
    if (!empty($group_by)) {
        $group_by = ' GROUP BY ' . $group_by;
    }
    if (!empty($params['items_per_page'])) {
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:hw_404_fixer.php

示例9: fn_get_news

function fn_get_news($params, $items_per_page = 0, $lang_code = CART_LANGUAGE)
{
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    $fields = array('?:news.*', 'descr.news', 'descr.description');
    // Define sort fields
    $sortings = array('position' => '?:news.position', 'name' => 'descr.news', 'date' => '?:news.date');
    $limit = $condition = '';
    $join = db_quote(" LEFT JOIN ?:news_descriptions AS descr ON descr.news_id = ?:news.news_id AND descr.lang_code = ?s", $lang_code);
    $condition .= AREA == 'A' ? '1 ' : " ?:news.status = 'A'";
    $condition .= fn_get_localizations_condition('?:news.localization');
    // Get additional information about companies
    if (fn_allowed_for('ULTIMATE')) {
        $fields[] = ' ?:companies.company as company';
        $sortings['company'] = 'company';
        $join .= db_quote(" LEFT JOIN ?:companies ON ?:companies.company_id = ?:news.company_id");
    }
    if (isset($params['q']) && fn_string_not_empty($params['q'])) {
        $params['q'] = trim($params['q']);
        if ($params['match'] == 'any') {
            $pieces = fn_explode(' ', $params['q']);
            $search_type = ' OR ';
        } elseif ($params['match'] == 'all') {
            $pieces = fn_explode(' ', $params['q']);
            $search_type = ' AND ';
        } else {
            $pieces = array($params['q']);
            $search_type = '';
        }
        $_condition = array();
        foreach ($pieces as $piece) {
            if (strlen($piece) == 0) {
                continue;
            }
            $tmp = array();
            $tmp[] = db_quote("descr.news LIKE ?l", "%{$piece}%");
            $tmp[] = db_quote("descr.description LIKE ?l", "%{$piece}%");
            $_condition[] = '(' . join(' OR ', $tmp) . ')';
        }
        $_cond = implode($search_type, $_condition);
        if (!empty($_condition)) {
            $condition .= ' AND (' . $_cond . ') ';
        }
    }
    if (!empty($params['period']) && $params['period'] != 'A') {
        list($params['time_from'], $params['time_to']) = fn_create_periods($params);
        $condition .= db_quote(" AND (?:news.date >= ?i AND ?:news.date <= ?i)", $params['time_from'], $params['time_to']);
    }
    if (!empty($params['item_ids'])) {
        $condition .= db_quote(' AND ?:news.news_id IN (?n)', explode(',', $params['item_ids']));
    }
    $limit = '';
    if (!empty($params['limit'])) {
        $limit = db_quote(" LIMIT 0, ?i", $params['limit']);
    } elseif (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(?:news.news_id) FROM ?:news ?p WHERE ?p", $join, $condition);
        $limit = db_paginate($params['page'], $params['items_per_page']);
    }
    fn_set_hook('get_news', $params, $fields, $join, $condition, $sorting, $limit, $lang_code);
    $sorting = db_sort($params, $sortings, 'date', 'desc');
    // Used for Extended search
    if (!empty($params['get_conditions'])) {
        return array($fields, $join, $condition);
    }
    $fields = join(', ', $fields);
    $news = db_get_array("SELECT ?p FROM ?:news ?p WHERE ?p ?p ?p", $fields, $join, $condition, $sorting, $limit);
    /**
     * Get additional data for selected news
     *
     * @param array  $news      news list
     * @param string $lang_code language code
     */
    fn_set_hook('get_news_post', $news, $lang_code);
    return array($news, $params);
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:75,代码来源:func.php

示例10: fn_tags_get_pages

function fn_tags_get_pages(&$params, &$join, &$conditions, &$fields, &$group_by, &$sortings)
{
    if (Registry::get('addons.tags.tags_for_pages') == 'Y') {
        if (isset($params['tag']) && fn_string_not_empty($params['tag'])) {
            $fields[] = '?:tag_links.*, ?:tags.tag, ?:tags.tag_id, ?:tags.timestamp';
            $join .= db_quote(" INNER JOIN ?:tag_links ON ?:pages.page_id = ?:tag_links.object_id");
            $join .= db_quote(" INNER JOIN ?:tags ON ?:tag_links.tag_id = ?:tags.tag_id ?p", fn_get_tags_company_condition('?:tags.company_id'));
            $conditions .= db_quote(" AND (?:tags.tag = ?s) AND ?:tag_links.object_type = 'A' ", trim($params['tag']));
        }
    }
    return true;
}
开发者ID:askzap,项目名称:ultimate,代码行数:12,代码来源:func.php

示例11: fn_tags_get_users

function fn_tags_get_users(&$params, &$fields, &$sortings, &$condition, &$join)
{
    if (isset($params['tag']) && fn_string_not_empty($params['tag'])) {
        $join .= db_quote(" LEFT JOIN ?:tag_links ON ?:users.user_id = ?:tag_links.user_id INNER JOIN ?:tags ON ?:tag_links.tag_id = ?:tags.tag_id ");
        $condition['tags_tag'] = db_quote(" AND ?:tags.tag = ?s", $params['tag']);
    }
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:7,代码来源:func.php

示例12: fn_get_rma_returns

function fn_get_rma_returns($params, $items_per_page = 0)
{
    // Init filter
    $params = LastView::instance()->update('rma', $params);
    // Set default values to input params
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    // Define fields that should be retrieved
    $fields = array('DISTINCT ?:rma_returns.return_id', '?:rma_returns.order_id', '?:rma_returns.timestamp', '?:rma_returns.status', '?:rma_returns.total_amount', '?:rma_property_descriptions.property AS action', '?:users.firstname', '?:users.lastname');
    // Define sort fields
    $sortings = array('return_id' => "?:rma_returns.return_id", 'timestamp' => "?:rma_returns.timestamp", 'order_id' => "?:rma_returns.order_id", 'status' => "?:rma_returns.status", 'amount' => "?:rma_returns.total_amount", 'action' => "?:rma_returns.action", 'customer' => "?:users.lastname");
    $sorting = db_sort($params, $sortings, 'timestamp', 'desc');
    $join = $condition = $group = '';
    if (isset($params['cname']) && fn_string_not_empty($params['cname'])) {
        $arr = fn_explode(' ', $params['cname']);
        foreach ($arr as $k => $v) {
            if (!fn_string_not_empty($v)) {
                unset($arr[$k]);
            }
        }
        if (sizeof($arr) == 2) {
            $condition .= db_quote(" AND ?:users.firstname LIKE ?l AND ?:users.lastname LIKE ?l", "%" . array_shift($arr) . "%", "%" . array_shift($arr) . "%");
        } else {
            $condition .= db_quote(" AND (?:users.firstname LIKE ?l OR ?:users.lastname LIKE ?l)", "%" . trim($params['cname']) . "%", "%" . trim($params['cname']) . "%");
        }
    }
    if (isset($params['email']) && fn_string_not_empty($params['email'])) {
        $condition .= db_quote(" AND ?:users.email LIKE ?l", "%" . trim($params['email']) . "%");
    }
    if (isset($params['rma_amount_from']) && fn_is_numeric($params['rma_amount_from'])) {
        $condition .= db_quote("AND ?:rma_returns.total_amount >= ?d", $params['rma_amount_from']);
    }
    if (isset($params['rma_amount_to']) && fn_is_numeric($params['rma_amount_to'])) {
        $condition .= db_quote("AND ?:rma_returns.total_amount <= ?d", $params['rma_amount_to']);
    }
    if (!empty($params['action'])) {
        $condition .= db_quote(" AND ?:rma_returns.action = ?s", $params['action']);
    }
    if (!empty($params['return_id'])) {
        $condition .= db_quote(" AND ?:rma_returns.return_id = ?i", $params['return_id']);
    }
    if (!empty($params['request_status'])) {
        $condition .= db_quote(" AND ?:rma_returns.status IN (?a)", $params['request_status']);
    }
    if (!empty($params['period']) && $params['period'] != 'A') {
        list($params['time_from'], $params['time_to']) = fn_create_periods($params);
        $condition .= db_quote(" AND (?:rma_returns.timestamp >= ?i AND ?:rma_returns.timestamp <= ?i)", $params['time_from'], $params['time_to']);
    }
    if (!empty($params['order_id'])) {
        $condition .= db_quote(" AND ?:rma_returns.order_id = ?i", $params['order_id']);
    }
    if (isset($params['user_id'])) {
        $condition .= db_quote(" AND ?:rma_returns.user_id = ?i", $params['user_id']);
    }
    if (!empty($params['order_status'])) {
        $condition .= db_quote(" AND ?:orders.status IN (?a)", $params['order_status']);
    }
    if (!empty($params['p_ids']) || !empty($params['product_view_id'])) {
        $arr = strpos($params['p_ids'], ',') !== false || !is_array($params['p_ids']) ? explode(',', $params['p_ids']) : $params['p_ids'];
        if (empty($params['product_view_id'])) {
            $condition .= db_quote(" AND ?:order_details.product_id IN (?n)", $arr);
        } else {
            $condition .= db_quote(" AND ?:order_details.product_id IN (?n)", db_get_fields(fn_get_products(array('view_id' => $params['product_view_id'], 'get_query' => true))));
        }
        $join .= " LEFT JOIN ?:order_details ON ?:order_details.order_id = ?:orders.order_id";
        $group .= db_quote(" GROUP BY ?:rma_returns.return_id HAVING COUNT(?:orders.order_id) >= ?i", count($arr));
    }
    $limit = '';
    if (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(DISTINCT ?:rma_returns.return_id) FROM ?:rma_returns LEFT JOIN ?:rma_return_products ON ?:rma_return_products.return_id = ?:rma_returns.return_id LEFT JOIN ?:rma_property_descriptions ON ?:rma_property_descriptions.property_id = ?:rma_returns.action LEFT JOIN ?:users ON ?:rma_returns.user_id = ?:users.user_id LEFT JOIN ?:orders ON ?:rma_returns.order_id = ?:orders.order_id {$join} WHERE 1 {$condition} {$group}");
        $limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
    }
    $return_requests = db_get_array("SELECT " . implode(', ', $fields) . " FROM ?:rma_returns LEFT JOIN ?:rma_return_products ON ?:rma_return_products.return_id = ?:rma_returns.return_id LEFT JOIN ?:rma_property_descriptions ON (?:rma_property_descriptions.property_id = ?:rma_returns.action AND ?:rma_property_descriptions.lang_code = ?s) LEFT JOIN ?:users ON ?:rma_returns.user_id = ?:users.user_id LEFT JOIN ?:orders ON ?:rma_returns.order_id = ?:orders.order_id {$join} WHERE 1 {$condition} {$group} {$sorting} {$limit}", AREA == 'C' ? CART_LANGUAGE : DESCR_SL);
    LastView::instance()->processResults('rma_returns', $return_requests, $params);
    return array($return_requests, $params);
}
开发者ID:askzap,项目名称:ultimate,代码行数:76,代码来源:rma.post.php

示例13: fn_get_call_requests

function fn_get_call_requests($params = array(), $lang_code = CART_LANGUAGE)
{
    // Init filter
    $params = LastView::instance()->update('call_requests', $params);
    $params = array_merge(array('items_per_page' => 0, 'page' => 1), $params);
    $fields = array('r.*', 'o.status as order_status', 'd.product');
    $joins = array(db_quote("LEFT JOIN ?:users u USING(user_id)"), db_quote("LEFT JOIN ?:orders o USING(order_id)"), db_quote("LEFT JOIN ?:product_descriptions d ON d.product_id = r.product_id AND d.lang_code = ?s", $lang_code));
    $sortings = array('id' => 'r.request_id', 'date' => 'r.timestamp', 'status' => 'r.status', 'name' => 'r.name', 'phone' => 'r.phone', 'user_id' => 'r.user_id', 'user' => array('u.lastname', 'u.firstname'), 'order' => 'r.order_id', 'order_status' => 'o.status');
    $condition = array();
    if (isset($params['id']) && fn_string_not_empty($params['id'])) {
        $params['id'] = trim($params['id']);
        $condition[] = db_quote("r.request_id = ?i", $params['id']);
    }
    if (isset($params['name']) && fn_string_not_empty($params['name'])) {
        $params['name'] = trim($params['name']);
        $condition[] = db_quote("r.name LIKE ?l", '%' . $params['name'] . '%');
    }
    if (isset($params['phone']) && fn_string_not_empty($params['phone'])) {
        $params['phone'] = trim($params['phone']);
        $condition[] = db_quote("r.phone LIKE ?l", '%' . $params['phone'] . '%');
    }
    if (!empty($params['status'])) {
        $condition[] = db_quote("r.status = ?s", $params['status']);
    }
    if (!empty($params['order_status'])) {
        $condition[] = db_quote("o.status = ?s", $params['order_status']);
    }
    if (!empty($params['user_id'])) {
        $condition[] = db_quote("r.user_id = ?s", $params['user_id']);
    }
    if (!empty($params['order_exists'])) {
        $sign = $params['order_exists'] == 'Y' ? '<>' : '=';
        $condition[] = db_quote("r.order_id ?p 0", $sign);
    }
    $fields_str = implode(', ', $fields);
    $joins_str = ' ' . implode(' ', $joins);
    $condition_str = $condition ? ' WHERE ' . implode(' AND ', $condition) : '';
    $sorting_str = db_sort($params, $sortings, 'date', 'desc');
    $limit = '';
    if (!empty($params['items_per_page'])) {
        $params['total_items'] = db_get_field("SELECT COUNT(r.request_id) FROM ?:call_requests r" . $joins_str . $condition_str);
        $limit = db_paginate($params['page'], $params['items_per_page'], $params['total_items']);
    }
    $items = db_get_array("SELECT " . $fields_str . " FROM ?:call_requests r" . $joins_str . $condition_str . $sorting_str . $limit);
    if (!empty($items)) {
        $cart_product_ids = array();
        foreach ($items as &$item) {
            if (!empty($item['cart_products'])) {
                $item['cart_products'] = unserialize($item['cart_products']);
                foreach ($item['cart_products'] as $cart_product) {
                    $cart_product_ids[] = $cart_product['product_id'];
                }
            }
        }
        $cart_product_names = db_get_hash_single_array("SELECT product_id, product FROM ?:product_descriptions WHERE product_id IN(?n) AND lang_code = ?s", array('product_id', 'product'), array_unique($cart_product_ids), $lang_code);
        foreach ($items as &$item) {
            if (!empty($item['cart_products'])) {
                foreach ($item['cart_products'] as &$cart_product) {
                    if (!empty($cart_product_names[$cart_product['product_id']])) {
                        $cart_product['product'] = $cart_product_names[$cart_product['product_id']];
                    }
                }
            }
        }
    }
    return array($items, $params);
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:67,代码来源:func.php

示例14: fn_get_users

/**
 * Getting users list
 *
 * @param  array  $params          Params list
 * @param  array  $auth            Auth
 * @param  int    $items_per_page  Items per page
 * @param  str    $custom_view     Custom view
 * @return array
 */
function fn_get_users($params, &$auth, $items_per_page = 0, $custom_view = '')
{
    /**
     * Actions before getting users list
     *
     * @param array $params         Params list
     * @param array $auth           Auth data
     * @param int   $items_per_page Items per page
     * @param str   $custom_view    Custom view
     */
    fn_set_hook('get_users_pre', $params, $auth, $items_per_page, $custom_view);
    // Init filter
    $_view = !empty($custom_view) ? $custom_view : 'users';
    $params = LastView::instance()->update($_view, $params);
    // Set default values to input params
    $default_params = array('page' => 1, 'items_per_page' => $items_per_page);
    $params = array_merge($default_params, $params);
    // Define fields that should be retrieved
    $fields = array("?:users.user_id", "?:users.user_login", "?:users.is_root", "?:users.timestamp", "?:users.user_type", "?:users.status", "?:users.firstname", "?:users.lastname", "?:users.email", "?:users.company", "?:users.company_id", "?:companies.company as company_name");
    // Define sort fields
    $sortings = array('id' => "?:users.user_id", 'username' => "?:users.user_login", 'email' => "?:users.email", 'name' => array("?:users.lastname", "?:users.firstname"), 'date' => "?:users.timestamp", 'type' => "?:users.user_type", 'status' => "?:users.status", 'company' => "company_name");
    if (isset($params['compact']) && $params['compact'] == 'Y') {
        $union_condition = ' OR ';
    } else {
        $union_condition = ' AND ';
    }
    $condition = array();
    $join = $group = '';
    $group .= " GROUP BY ?:users.user_id";
    if (isset($params['company']) && fn_string_not_empty($params['company'])) {
        $condition['company'] = db_quote(" AND ?:users.company LIKE ?l", "%" . trim($params['company']) . "%");
    }
    if (isset($params['name']) && fn_string_not_empty($params['name'])) {
        $arr = fn_explode(' ', $params['name']);
        foreach ($arr as $k => $v) {
            if (!fn_string_not_empty($v)) {
                unset($arr[$k]);
            }
        }
        if (sizeof($arr) == 2) {
            $condition['name'] = db_quote(" AND (?:users.firstname LIKE ?l AND ?:users.lastname LIKE ?l)", "%" . array_shift($arr) . "%", "%" . array_shift($arr) . "%");
        } else {
            $condition['name'] = db_quote(" AND (?:users.firstname LIKE ?l OR ?:users.lastname LIKE ?l)", "%" . trim($params['name']) . "%", "%" . trim($params['name']) . "%");
        }
    }
    if (isset($params['user_login']) && fn_string_not_empty($params['user_login'])) {
        $condition['user_login'] = db_quote(" {$union_condition} ?:users.user_login LIKE ?l", "%" . trim($params['user_login']) . "%");
    }
    if (!empty($params['tax_exempt'])) {
        $condition['tax_exempt'] = db_quote(" AND ?:users.tax_exempt = ?s", $params['tax_exempt']);
    }
    if (!fn_allowed_for('ULTIMATE:FREE')) {
        if (isset($params['usergroup_id']) && $params['usergroup_id'] != ALL_USERGROUPS) {
            if (!empty($params['usergroup_id'])) {
                $join .= db_quote(" LEFT JOIN ?:usergroup_links ON ?:usergroup_links.user_id = ?:users.user_id AND ?:usergroup_links.usergroup_id = ?i", $params['usergroup_id']);
                $condition['usergroup_links'] = " AND ?:usergroup_links.status = 'A'";
            } else {
                $join .= " LEFT JOIN ?:usergroup_links ON ?:usergroup_links.user_id = ?:users.user_id AND ?:usergroup_links.status = 'A'";
                $condition['usergroup_links'] = " AND ?:usergroup_links.user_id IS NULL";
            }
        }
    }
    if (!empty($params['status'])) {
        $condition['status'] = db_quote(" AND ?:users.status = ?s", $params['status']);
    }
    if (isset($params['email']) && fn_string_not_empty($params['email'])) {
        $condition['email'] = db_quote(" {$union_condition} ?:users.email LIKE ?l", "%" . trim($params['email']) . "%");
    }
    if (isset($params['address']) && fn_string_not_empty($params['address'])) {
        $condition['address'] = db_quote(" AND (?:user_profiles.b_address LIKE ?l OR ?:user_profiles.s_address LIKE ?l)", "%" . trim($params['address']) . "%", "%" . trim($params['address']) . "%");
    }
    if (isset($params['zipcode']) && fn_string_not_empty($params['zipcode'])) {
        $condition['zipcode'] = db_quote(" AND (?:user_profiles.b_zipcode LIKE ?l OR ?:user_profiles.s_zipcode LIKE ?l)", "%" . trim($params['zipcode']) . "%", "%" . trim($params['zipcode']) . "%");
    }
    if (!empty($params['country'])) {
        $condition['country'] = db_quote(" AND (?:user_profiles.b_country LIKE ?l OR ?:user_profiles.s_country LIKE ?l)", "%{$params['country']}%", "%{$params['country']}%");
    }
    if (isset($params['state']) && fn_string_not_empty($params['state'])) {
        $condition['state'] = db_quote(" AND (?:user_profiles.b_state LIKE ?l OR ?:user_profiles.s_state LIKE ?l)", "%" . trim($params['state']) . "%", "%" . trim($params['state']) . "%");
    }
    if (isset($params['city']) && fn_string_not_empty($params['city'])) {
        $condition['city'] = db_quote(" AND (?:user_profiles.b_city LIKE ?l OR ?:user_profiles.s_city LIKE ?l)", "%" . trim($params['city']) . "%", "%" . trim($params['city']) . "%");
    }
    if (!empty($params['user_id'])) {
        $condition['user_id'] = db_quote(' AND ?:users.user_id IN (?n)', $params['user_id']);
    }
    if (!empty($params['p_ids']) || !empty($params['product_view_id'])) {
        $arr = strpos($params['p_ids'], ',') !== false || !is_array($params['p_ids']) ? explode(',', $params['p_ids']) : $params['p_ids'];
        if (empty($params['product_view_id'])) {
            $condition['order_product_id'] = db_quote(" AND ?:order_details.product_id IN (?n)", $arr);
        } else {
//.........这里部分代码省略.........
开发者ID:askzap,项目名称:ultimate,代码行数:101,代码来源:fn.users.php

示例15: fn_ult_get_language_variable

function fn_ult_get_language_variable(&$fields, &$tables, &$left_join, &$condition, &$params)
{
    if (Registry::get('runtime.company_id')) {
        $left_join[] = db_quote("?:ult_language_values ON ?:ult_language_values.name = lang.name AND company_id = ?i AND ?:ult_language_values.lang_code = lang.lang_code", Registry::get('runtime.company_id'));
        unset($fields['lang.value']);
        $fields['IF(?:ult_language_values.value IS NULL, lang.value, ?:ult_language_values.value) as value'] = true;
        if (isset($params['q']) && fn_string_not_empty($params['q'])) {
            $condition['param2'] = db_quote('(IF(?:ult_language_values.name IS NULL, lang.name, ?:ult_language_values.name) LIKE ?l OR IF(?:ult_language_values.value IS NULL, lang.value, ?:ult_language_values.value) LIKE ?l)', '%' . trim($params['q']) . '%', '%' . trim($params['q']) . '%');
        }
    }
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:11,代码来源:fn.ultimate.php


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