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


PHP db_string_equal_to函数代码示例

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


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

示例1: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (!array_key_exists('param', $map)) {
         $map['param'] = '';
     }
     if (!array_key_exists('extra', $map)) {
         $map['extra'] = '';
     }
     $max = array_key_exists('max', $map) ? intval($map['max']) : 100;
     require_code('banners');
     $b_type = $map['param'];
     $myquery = 'SELECT * FROM ' . get_table_prefix() . 'banners WHERE ((((the_type<>1) OR ((campaign_remaining>0) AND ((expiry_date IS NULL) or (expiry_date>' . strval(time()) . ')))) AND ' . db_string_not_equal_to('name', '') . ')) AND validated=1 AND ' . db_string_equal_to('b_type', $b_type) . ' ORDER BY name';
     $banners = $GLOBALS['SITE_DB']->query($myquery, 200);
     $assemble = new ocp_tempcode();
     if (count($banners) > $max) {
         shuffle($banners);
         $banners = array_slice($banners, 0, $max);
     }
     foreach ($banners as $i => $banner) {
         $bd = show_banner($banner['name'], $banner['b_title_text'], get_translated_tempcode($banner['caption']), $banner['img_url'], '', $banner['site_url'], $banner['b_type']);
         $more_coming = $i < count($banners) - 1;
         $assemble->attach(do_template('BLOCK_MAIN_BANNER_WAVE_BWRAP', array('EXTRA' => $map['extra'], 'TYPE' => $map['param'], 'BANNER' => $bd, 'MORE_COMING' => $more_coming)));
     }
     return do_template('BLOCK_MAIN_BANNER_WAVE', array('EXTRA' => $map['extra'], 'TYPE' => $map['param'], 'ASSEMBLE' => $assemble));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:main_banner_wave.php

示例2: get_page_warning_details

/**
 * A page is not validated, so show a warning.
 *
 * @param  ID_TEXT		The zone the page is being loaded from
 * @param  ID_TEXT		The codename of the page
 * @param  tempcode		The edit URL (blank if no edit access)
 * @return tempcode		The warning
 */
function get_page_warning_details($zone, $codename, $edit_url)
{
    $warning_details = new ocp_tempcode();
    if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
        access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
    }
    $uv_warning = do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT');
    // Wear sun cream
    if (!$edit_url->is_empty()) {
        $menu_links = $GLOBALS['SITE_DB']->query('SELECT DISTINCT i_menu FROM ' . get_table_prefix() . 'menu_items WHERE ' . db_string_equal_to('i_url', $zone . ':' . $codename) . ' OR ' . db_string_equal_to('i_url', '_SEARCH:' . $codename));
        if (count($menu_links) != 0) {
            $menu_items_linking = new ocp_tempcode();
            foreach ($menu_links as $menu_link) {
                if (!$menu_items_linking->is_empty()) {
                    $menu_items_linking->attach(do_lang_tempcode('LIST_SEP'));
                }
                $menu_edit_url = build_url(array('page' => 'admin_menus', 'type' => 'edit', 'id' => $menu_link['i_menu']), get_module_zone('admin_menus'));
                $menu_items_linking->attach(hyperlink($menu_edit_url, $menu_link['i_menu'], false, true));
            }
            $uv_warning = do_lang_tempcode('UNVALIDATED_TEXT_STAFF', $menu_items_linking);
        }
    }
    $warning_details->attach(do_template('WARNING_TABLE', array('WARNING' => $uv_warning)));
    return $warning_details;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:site2.php

示例3: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('galleries');
     require_code('galleries');
     require_css('galleries');
     require_css('side_blocks');
     $parent_id = array_key_exists('param', $map) ? $map['param'] : 'root';
     $zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('galleries');
     $show_empty = array_key_exists('show_empty', $map) ? $map['show_empty'] == '1' : false;
     $depth = array_key_exists('depth', $map) ? intval($map['depth']) : 0;
     // If depth is 1 then we go down 1 level. Only 0 or 1 is supported.
     // For all galleries off the root gallery
     $query = 'SELECT name,fullname FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'galleries WHERE ' . db_string_equal_to('parent_id', $parent_id) . ' AND name NOT LIKE \'' . db_encode_like('download\\_%') . '\' ORDER BY add_date';
     $galleries = $GLOBALS['SITE_DB']->query($query, 300);
     if ($depth == 0) {
         $content = $this->inside($zone, $galleries, 'BLOCK_SIDE_ROOT_GALLERIES_LINE', $show_empty);
     } else {
         $content = new ocp_tempcode();
         foreach ($galleries as $gallery) {
             if ($show_empty || gallery_has_content($gallery['name'])) {
                 $subgalleries = $GLOBALS['SITE_DB']->query_select('galleries', array('name', 'fullname'), array('parent_id' => $gallery['name']), 'ORDER BY add_date', 300);
                 $nest = $this->inside($zone, $subgalleries, 'BLOCK_SIDE_ROOT_GALLERIES_LINE_DEPTH', $show_empty);
                 $caption = get_translated_text($gallery['fullname']);
                 $content->attach(do_template('BLOCK_SIDE_ROOT_GALLERIES_LINE_CONTAINER', array('_GUID' => 'e50b84369b5e2146c4fab4fddc84bf0a', 'ID' => $gallery['name'], 'CAPTION' => $caption, 'CONTENTS' => $nest)));
             }
         }
     }
     $_title = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $parent_id));
     if (!is_null($_title)) {
         $title = get_translated_text($_title);
     } else {
         $title = '';
     }
     return do_template('BLOCK_SIDE_ROOT_GALLERIES', array('_GUID' => 'ed420ce9d1b1dde95eb3fd8473090228', 'TITLE' => $title, 'ID' => $parent_id, 'DEPTH' => $depth != 0, 'CONTENT' => $content));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:41,代码来源:side_root_galleries.php

示例4: run

 /**
  * Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
  *
  * @return tempcode  The snippet
  */
 function run()
 {
     $val = get_param('name');
     $test = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $val), 'g.id');
     if (is_null($test)) {
         return new ocp_tempcode();
     }
     return make_string_tempcode(str_replace(array('&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;'), array('"', '"', '"', '"'), html_entity_decode(do_lang('ALREADY_EXISTS', escape_html($val)), ENT_QUOTES)));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:14,代码来源:exists_usergroup.php

示例5: ocf_get_topic_where

/**
 * Get an SQL 'WHERE' clause for the posts in a topic.
 *
 * @param  AUTO_LINK		The ID of the topic we are getting details of.
 * @param  ?MEMBER		The member doing the lookup (NULL: current member).
 * @return string			The WHERE clause.
 */
function ocf_get_topic_where($topic_id, $member_id = NULL)
{
    if (is_null($member_id)) {
        $member_id = get_member();
    }
    $where = 'p_topic_id=' . strval((int) $topic_id);
    if (is_guest()) {
        $where .= ' AND p_intended_solely_for IS NULL';
    } elseif (!has_specific_permission($member_id, 'view_other_pt')) {
        $where .= ' AND (p_intended_solely_for=' . strval((int) $member_id) . ' OR p_poster=' . strval((int) $member_id) . ' OR p_intended_solely_for IS NULL)';
    }
    if (!has_specific_permission($member_id, 'see_unvalidated')) {
        $where .= ' AND (p_validated=1 OR ((p_poster<>' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ' OR ' . db_string_equal_to('p_ip_address', get_ip_address()) . ') AND p_poster=' . strval((int) $member_id) . '))';
    }
    return $where;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:23,代码来源:ocf_topics.php

示例6: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (get_forum_type() != 'ocf') {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'forumview')) {
         return NULL;
     }
     if (is_guest()) {
         return NULL;
     }
     $condition = 'l_time<t_cache_last_time OR (l_time IS NULL AND t_cache_last_time>' . strval(time() - 60 * 60 * 24 * intval(get_option('post_history_days'))) . ')';
     $query = ' FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics top LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (top.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND top.t_cache_first_post=t.id WHERE (' . $condition . ') AND t_forum_id IS NOT NULL ' . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' ORDER BY t_cache_last_time DESC';
     $rows = $GLOBALS['FORUM_DB']->query('SELECT *,top.id AS t_id ' . $query, $max);
     $categories = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0'));
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) {
             $id = strval($row['id']);
             $author = $row['t_cache_first_username'];
             $news_date = date($date_string, $row['t_cache_first_time']);
             $edit_date = date($date_string, $row['t_cache_last_time']);
             if ($edit_date == $news_date) {
                 $edit_date = '';
             }
             $news_title = xmlentities($row['t_cache_first_title']);
             $_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']);
             $summary = xmlentities($_summary->evaluate());
             $news = '';
             $category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA');
             $category_raw = strval($row['t_forum_id']);
             $view_url = build_url(array('page' => 'topicview', 'id' => $row['t_id']), get_module_zone('topicview'));
             if ($prefix == 'RSS_') {
                 $if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['t_id'])));
             } else {
                 $if_comments = new ocp_tempcode();
             }
             $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
         }
     }
     require_lang('ocf');
     return array($content, do_lang('TOPICS_UNREAD'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:ocf_unread_topics.php

示例7: clear_ocp_autosave

/**
 * Declare that an action succeeded - delete safety autosave cookies.
 */
function clear_ocp_autosave()
{
    $or_list = '';
    foreach (array_keys($_COOKIE) as $key) {
        if (substr($key, 0, 13) == 'ocp_autosave_') {
            require_code('users_active_actions');
            // Has to do both, due to inconsistencies with how PHP reads and sets cookies -- reading de-urlencodes (although not strictly needed), whilst setting does not urlencode; may differ between versions
            ocp_setcookie(urlencode($key), '0', true);
            ocp_setcookie($key, '0', true);
            if ($or_list != '') {
                $or_list .= ' OR ';
            }
            $or_list .= db_string_equal_to('a_key', $key);
        }
    }
    if ($or_list != '') {
        $GLOBALS['SITE_DB']->query('DELETE FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'autosave WHERE a_time<' . strval(time() - 60 * 60 * 24) . ' OR (a_member_id=' . strval(intval(get_member())) . ' AND (' . $or_list . '))');
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:22,代码来源:autosave.php

示例8: run

 /**
  * Standard modular run function for symbol hooks. Searches for tasks to perform.
  *
  * @param  array		Symbol parameters
  * @return string		Result
  */
 function run($param)
 {
     $value = '';
     if (array_key_exists(0, $param)) {
         $limit = array_key_exists(1, $param) ? intval($param[1]) : NULL;
         $resolve = array_key_exists(2, $param) ? $param[2] : '';
         // Content-type to associate back to, and fetch the ID for
         $rating_type = array_key_exists(3, $param) ? $param[3] : '';
         // If non empty, it will get the highest rated first
         $done = 0;
         $table = 'catalogue_fields f JOIN ' . get_table_prefix() . 'catalogue_efv_short s ON f.id=s.cf_id AND ' . db_string_equal_to('cf_type', 'reference') . ' OR cf_type LIKE \'' . db_encode_like('ck_%') . '\'';
         $select = array('ce_id');
         $order_by = '';
         if ($resolve != '') {
             $table .= ' JOIN ' . get_table_prefix() . 'catalogue_entry_linkage ON ' . db_string_equal_to('content_type', $param[2]) . ' AND catalogue_entry_id=ce_id';
             $select[] = 'content_id';
             if ($rating_type != '') {
                 $select[] = '(SELECT AVG(rating) FROM ' . get_table_prefix() . 'rating WHERE ' . db_string_equal_to('rating_for_type', $rating_type) . ' AND rating_for_id=content_id) AS compound_rating';
                 $order_by = 'ORDER BY compound_rating DESC';
             }
         }
         $results = $GLOBALS['SITE_DB']->query_select($table, $select, array('cv_value' => $param[0]), $order_by);
         foreach ($results as $result) {
             if ($value != '') {
                 $value .= ',';
             }
             if ($resolve != '') {
                 $value .= $result['content_id'];
             } else {
                 $value .= strval($result['ce_id']);
             }
             $done++;
             if (!is_null($limit) && $done == $limit) {
                 break;
             }
         }
     }
     return $value;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:45,代码来源:CATALOGUE_ENTRY_BACKREFS.php

示例9: get_products

 /**
  * Get the products handled by this eCommerce hook.
  *
  * IMPORTANT NOTE TO PROGRAMMERS: This function may depend only on the database, and not on get_member() or any GET/POST values.
  *  Such dependencies will break IPN, which works via a Guest and no dependable environment variables. It would also break manual transactions from the Admin Zone.
  *
  * @param  boolean	Whether to make sure the language for item_name is the site default language (crucial for when we read/go to third-party sales systems and use the item_name as a key).
  * @param  ?ID_TEXT	Product being searched for (NULL: none).
  * @param  boolean 	Whether $search refers to the product name rather than the product_id.
  * @return array		A map of product name to list of product details.
  */
 function get_products($site_lang = false, $search = NULL, $search_titles_not_ids = false)
 {
     $products = array();
     require_lang('shopping');
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     if (!is_null($search)) {
         $where = '1=1';
         if (!$search_titles_not_ids) {
             $l = do_lang('CART_ORDER', '', NULL, NULL, $site_lang ? get_site_default_lang() : user_lang());
             if (substr($search, 0, strlen($l)) != $l) {
                 return array();
             }
             $where .= ' AND id=' . strval(intval(substr($search, strlen($l))));
         }
     } else {
         $where = '(' . db_string_equal_to('order_status', 'ORDER_STATUS_awaiting_payment') . ' OR ' . db_string_equal_to('order_status', 'ORDER_STATUS_payment_received') . ')';
     }
     if (is_null($search)) {
         $count = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'shopping_order WHERE ' . $where);
         if ($count > 50) {
             return array();
         }
         // Too many to list
     }
     $start = 0;
     do {
         $orders = $GLOBALS['SITE_DB']->query('SELECT id,tot_price FROM ' . get_table_prefix() . 'shopping_order WHERE ' . $where, 500);
         foreach ($orders as $order) {
             $products[do_lang('CART_ORDER', strval($order['id']), NULL, NULL, $site_lang ? get_site_default_lang() : user_lang())] = array(PRODUCT_ORDERS, $order['tot_price'], 'handle_product_orders', array(), do_lang('CART_ORDER', strval($order['id']), NULL, NULL, $site_lang ? get_site_default_lang() : user_lang()));
         }
         $start += 500;
     } while (count($orders) == 500);
     return $products;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:47,代码来源:cart_orders.php

示例10: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (!array_key_exists('param', $map)) {
         $map['param'] = '';
     }
     require_code('banners');
     require_lang('banners');
     $b_type = $map['param'];
     $myquery = 'SELECT * FROM ' . get_table_prefix() . 'banners WHERE validated=1 AND ' . db_string_equal_to('b_type', $b_type) . ' AND (expiry_date IS NULL OR expiry_date>' . strval(time()) . ') ORDER BY hits_from+hits_to DESC';
     $_banners = $GLOBALS['SITE_DB']->query($myquery, 200);
     $assemble = new ocp_tempcode();
     $banners = array();
     foreach ($_banners as $banner) {
         $description = get_translated_tempcode($banner['caption']);
         $bd = show_banner($banner['name'], $banner['b_title_text'], $description, $banner['img_url'], '', $banner['site_url'], $banner['b_type']);
         $banners[] = array('BANNER' => $bd, 'NAME' => $banner['name'], 'URL' => $banner['site_url'], 'DESCRIPTION' => $description, 'HITSFROM' => strval($banner['hits_from']), 'HITSTO' => strval($banner['hits_to']), 'VIEWSFROM' => strval($banner['views_from']), 'VIEWSTO' => strval($banner['views_to']), 'ADDDATE' => strval($banner['add_date']), 'SUBMITTER' => strval($banner['submitter']));
     }
     if (has_actual_page_access(NULL, 'cms_banners', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_banners')) {
         $submit_url = build_url(array('page' => 'cms_banners', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_banners'));
     } else {
         $submit_url = new ocp_tempcode();
     }
     return do_template('BLOCK_MAIN_TOPSITES', array('TYPE' => $map['param'], 'BANNERS' => $banners, 'SUBMIT_URL' => $submit_url));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:30,代码来源:main_topsites.php

示例11: ocf_list_multi_moderations

/**
 * List all the multi moderations that may be used in a certain forum.
 *
 * @param  ?AUTO_LINK	The forum we are listing for (NULL: private topics).
 * @return array 			List of multi moderations.
 */
function ocf_list_multi_moderations($forum_id)
{
    if (!addon_installed('ocf_multi_moderations')) {
        return array();
    }
    if (is_null($forum_id)) {
        return array();
    }
    $rows = $GLOBALS['FORUM_DB']->query_select('f_multi_moderations m LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND m.mm_name=t.id', array('mm_forum_multi_code', 'm.id', 'm.mm_name', 'text_original AS _mm_name'), NULL, 'ORDER BY text_original');
    $out = array();
    if (count($rows) == 0) {
        return $out;
    }
    $lots_of_forums = $GLOBALS['FORUM_DB']->query_value('f_forums', 'COUNT(*)') > 200;
    if (!$lots_of_forums) {
        $all_forums = collapse_2d_complexity('id', 'f_parent_forum', $GLOBALS['FORUM_DB']->query_select('f_forums', array('id', 'f_parent_forum')));
    }
    foreach ($rows as $row) {
        if ($GLOBALS['RECORD_LANG_STRINGS_CONTENT'] || is_null($row['_mm_name'])) {
            $row['_mm_name'] = get_translated_text($row['mm_name'], $GLOBALS['FORUM_DB']);
        }
        require_code('ocfiltering');
        if ($lots_of_forums) {
            $sql = ocfilter_to_sqlfragment($row['mm_forum_multi_code'], 'id', 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']);
            if (!is_null($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE id=' . strval($forum_id) . ' AND (' . $sql . ')'))) {
                $out[$row['id']] = $row['_mm_name'];
            }
        } else {
            $idlist = ocfilter_to_idlist_using_memory($row['mm_forum_multi_code'], $all_forums, 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']);
            if (in_array($forum_id, $idlist)) {
                $out[$row['id']] = $row['_mm_name'];
            }
        }
    }
    return $out;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:42,代码来源:ocf_moderation.php

示例12: show_orders

 /**
  * UI to show all orders
  *
  * @return tempcode	The interface.
  */
 function show_orders()
 {
     require_code('shopping');
     $title = get_page_title('ORDER_LIST');
     $filter = get_param('filter', NULL);
     $search = get_param('search', '', true);
     $cond = "WHERE 1=1";
     if ($filter == 'undispatched') {
         $cond .= " AND t1.order_status='ORDER_STATUS_payment_received'";
         $title = get_page_title('UNDISPATCHED_ORDER_LIST');
     }
     $extra_join = '';
     if (!is_null($search) && $search != '') {
         $GLOBALS['NO_DB_SCOPE_CHECK'] = true;
         $cond .= " AND (t1.id LIKE '" . db_encode_like(str_replace('#', '', $search) . '%') . "' OR t2.m_username LIKE '" . db_encode_like(str_replace('#', '', $search) . '%') . "')";
         $extra_join = ' JOIN ' . get_table_prefix() . 'f_members t2 ON t2.id=t1.c_member';
     }
     breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('ORDERS'))));
     $orders = array();
     //pagination
     $start = get_param_integer('start', 0);
     $max = get_param_integer('max', 10);
     require_code('templates_results_browser');
     require_code('templates_results_table');
     $sortables = array('t1.id' => do_lang_tempcode('ECOM_ORDER'), 't1.add_date' => do_lang_tempcode('ORDERED_DATE'), 't1.c_member' => do_lang_tempcode('ORDERED_BY'), 't1.tot_price' => do_lang_tempcode('ORDER_PRICE_AMT'), 't3.included_tax' => do_lang_tempcode('TAX_PAID'), 't1.order_status' => do_lang_tempcode('STATUS'), 't1.transaction_id' => do_lang_tempcode('TRANSACTION_ID'));
     $query_sort = explode(' ', get_param('sort', 't1.add_date ASC'), 2);
     if (count($query_sort) == 1) {
         $query_sort[] = 'ASC';
     }
     list($sortable, $sort_order) = $query_sort;
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     $fields_title = results_field_title(array(do_lang_tempcode('ECOM_ORDER'), do_lang_tempcode('THE_PRICE'), do_lang_tempcode('TAX_PAID'), do_lang_tempcode('ORDERED_DATE'), do_lang_tempcode('ORDERED_BY'), do_lang_tempcode('TRANSACTION_ID'), do_lang_tempcode('STATUS'), do_lang_tempcode('ACTIONS')), $sortables, 'sort', $sortable . ' ' . $sort_order);
     global $NO_DB_SCOPE_CHECK;
     $NO_DB_SCOPE_CHECK = true;
     $max_rows = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'shopping_order t1' . $extra_join . ' LEFT JOIN ' . get_table_prefix() . 'shopping_order_details t3 ON t1.id=t3.order_id ' . $cond);
     $results_browser = results_browser(do_lang_tempcode('ORDERS'), NULL, $start, 'start', $max, 'max', $max_rows, NULL, 'show_orders', true, true);
     $rows = $GLOBALS['SITE_DB']->query('SELECT t1.*,(t3.p_quantity*t3.included_tax) as tax FROM ' . get_table_prefix() . 'shopping_order t1' . $extra_join . ' LEFT JOIN ' . get_table_prefix() . 'shopping_order_details t3 ON t1.id=t3.order_id ' . $cond . ' GROUP BY t1.id ORDER BY ' . db_string_equal_to('t1.order_status', 'ORDER_STATUS_cancelled') . ',' . $sortable . ' ' . $sort_order, $max, $start);
     $order_entries = new ocp_tempcode();
     foreach ($rows as $row) {
         if ($row['purchase_through'] == 'cart') {
             $order_det_url = build_url(array('page' => '_SELF', 'type' => 'order_det', 'id' => $row['id']), '_SELF');
             $order_title = do_lang('CART_ORDER', strval($row['id']));
         } else {
             $res = $GLOBALS['SITE_DB']->query_select('shopping_order_details', array('p_id', 'p_name'), array('order_id' => $row['id']));
             if (!array_key_exists(0, $res)) {
                 continue;
             }
             // DB corruption
             $product_det = $res[0];
             $order_title = do_lang('PURCHASE_ORDER', strval($row['id']));
             $order_det_url = build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $product_det['p_id']), get_module_zone('catalogues'));
         }
         $submitted_by = $GLOBALS['FORUM_DRIVER']->get_username($row['c_member']);
         $order_status = do_lang($row['order_status']);
         $ordr_act_submit = build_url(array('page' => '_SELF', 'type' => 'order_act', 'id' => $row['id']), '_SELF');
         $actions = do_template('ADMIN_ORDER_ACTIONS', array('ORDER_TITLE' => $order_title, 'ORDR_ACT_URL' => $ordr_act_submit, 'ORDER_STATUS' => $order_status));
         $url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['c_member']), get_module_zone('members'));
         $member = hyperlink($url, $submitted_by, false, true, do_lang('CUSTOMER'));
         $view_url = build_url(array('page' => '_SELF', 'type' => 'order_det', 'id' => $row['id']), '_SELF');
         $order_date = hyperlink($view_url, get_timezoned_date($row['add_date'], true, false, true, true));
         $transaction_details_link = build_url(array('page' => '_SELF', 'type' => 'order_det', 'id' => $row['id']), '_SELF');
         if ($row['transaction_id'] != '') {
             $transaction_details_link = build_url(array('page' => 'admin_ecommerce', 'type' => 'logs', 'product' => $order_title, 'id' => $row['id']), get_module_zone('admin_ecommerce'));
             $transaction_id = hyperlink($transaction_details_link, strval($row['transaction_id']));
         } else {
             $transaction_id = do_lang_tempcode('INCOMPLETED_TRANCACTION');
         }
         $order_entries->attach(results_entry(array(escape_html($order_title), ecommerce_get_currency_symbol() . escape_html(float_format($row['tot_price'], 2)), escape_html(float_format($row['tax'], 2)), $order_date, $member, $transaction_id, $order_status, $actions), false, NULL));
     }
     $width = array('110', '70', '80', '200', '120', '180', '180', '200');
     $results_table = results_table(do_lang_tempcode('ORDERS'), 0, 'start', $max_rows, 'max', $max_rows, $fields_title, $order_entries, $sortables, $sortable, $sort_order, 'sort', NULL, $width, 'cart');
     if (is_null($order_entries)) {
         inform_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $hidden = build_keep_form_fields('_SELF', true, array('filter'));
     $search_url = get_self_url(true);
     return do_template('ECOM_ADMIN_ORDERS_SCREEN', array('TITLE' => $title, 'CURRENCY' => get_option('currency'), 'ORDERS' => $orders, 'RESULTS_BROWSER' => $results_browser, 'RESULT_TABLE' => $results_table, 'SEARCH_URL' => $search_url, 'HIDDEN' => $hidden, 'SEARCH_VAL' => $search));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:87,代码来源:admin_orders.php

示例13: get_sort_order

 /**
  * Read in the sort order currently active, and a suffix to the select statement to allow it to work. Apply security.
  *
  * @return array			A quarter: The sort order, The sort order (for backwards sorting), SQL suffix for select statement for images, SQL suffix for select statement for videos
  */
 function get_sort_order()
 {
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     $NON_CANONICAL_PARAMS[] = 'select';
     $NON_CANONICAL_PARAMS[] = 'video_select';
     $sort = get_param('sort', 'add_date DESC');
     if ($sort == 'random ASC') {
         $sort = 'add_date ASC';
     }
     if ($sort != 'fixed_random ASC' && $sort != 'compound_rating DESC' && $sort != 'compound_rating ASC' && $sort != 'add_date DESC' && $sort != 'add_date ASC' && $sort != 'url DESC' && $sort != 'url ASC' && $sort != 'title DESC' && $sort != 'title ASC') {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     list($_sort, $_dir) = explode(' ', $sort, 2);
     $sort_backwards = $_sort . ' ' . ($_dir == 'ASC' ? 'DESC' : 'ASC');
     if ($sort == 'compound_rating ASC' || $sort == 'compound_rating DESC') {
         $suffix_images = ',(SELECT AVG(rating) FROM ' . get_table_prefix() . 'rating WHERE ' . db_string_equal_to('rating_for_type', 'images') . ' AND rating_for_id=e.id) AS compound_rating';
         $suffix_videos = ',(SELECT AVG(rating) FROM ' . get_table_prefix() . 'rating WHERE ' . db_string_equal_to('rating_for_type', 'videos') . ' AND rating_for_id=e.id) AS compound_rating';
     } elseif ($sort == 'fixed_random ASC') {
         $suffix_images = ',(MOD(id,3.142)) AS fixed_random';
         $suffix_videos = ',(MOD(id,3.142)) AS fixed_random';
     } else {
         $suffix_images = '';
         $suffix_videos = '';
     }
     return array($sort, $sort_backwards, $suffix_images, $suffix_videos);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:32,代码来源:galleries.php

示例14: find_topic_id_for_topic_identifier

 /**
  * Get the topic ID from a topic identifier in the specified forum. It is used by comment topics, which means that the unique-topic-name assumption holds valid.
  *
  * @param  string			The forum name / ID
  * @param  SHORT_TEXT	The topic identifier
  * @return ?integer		The topic ID (NULL: not found)
  */
 function find_topic_id_for_topic_identifier($forum, $topic_identifier)
 {
     if (is_integer($forum)) {
         $forum_id = $forum;
     } else {
         $forum_id = $this->forum_id_from_name($forum);
     }
     $query = 'SELECT tid FROM ' . $this->connection->get_table_prefix() . 'topics WHERE t_bid=' . strval((int) $forum_id);
     $query .= ' AND (' . db_string_equal_to('t_description', $topic_identifier) . ' OR t_description LIKE \'%: #' . db_encode_like($topic_identifier) . '\')';
     return $this->connection->query_value_null_ok_full($query);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:aef.php

示例15: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_code('catalogues');
     require_lang('main_google_map');
     // Set up config/defaults
     if (!array_key_exists('title', $map)) {
         $map['title'] = '';
     }
     if (!array_key_exists('region', $map)) {
         $map['region'] = '';
     }
     if (!array_key_exists('latitude', $map)) {
         $map['latitude'] = '0';
     }
     if (!array_key_exists('longitude', $map)) {
         $map['longitude'] = '0';
     }
     $mapwidth = array_key_exists('width', $map) ? $map['width'] : '100%';
     $mapheight = array_key_exists('height', $map) ? $map['height'] : '300px';
     $api_key = array_key_exists('api_key', $map) ? $map['api_key'] : '';
     $set_zoom = array_key_exists('zoom', $map) ? $map['zoom'] : '3';
     $set_center = array_key_exists('center', $map) ? $map['center'] : '0';
     $set_show_links = array_key_exists('show_links', $map) ? $map['show_links'] : '1';
     $cluster = array_key_exists('cluster', $map) ? $map['cluster'] : '0';
     if (!array_key_exists('catalogue', $map)) {
         $map['catalogue'] = '';
     }
     if (!array_key_exists('longfield', $map)) {
         $map['longfield'] = 'Longitude';
     }
     if (!array_key_exists('latfield', $map)) {
         $map['latfield'] = 'Latitude';
     }
     $min_latitude = array_key_exists('min_latitude', $map) ? $map['min_latitude'] : '';
     $max_latitude = array_key_exists('max_latitude', $map) ? $map['max_latitude'] : '';
     $min_longitude = array_key_exists('min_longitude', $map) ? $map['min_longitude'] : '';
     $max_longitude = array_key_exists('max_longitude', $map) ? $map['max_longitude'] : '';
     $longitude_key = $map['longfield'];
     $latitude_key = $map['latfield'];
     $catalogue_name = $map['catalogue'];
     $star_entry = array_key_exists('star_entry', $map) ? $map['star_entry'] : '';
     $max_results = array_key_exists('max_results', $map) && $map['max_results'] != '' ? intval($map['max_results']) : 1000;
     $icon = array_key_exists('icon', $map) ? $map['icon'] : '';
     if (!array_key_exists('filter_category', $map)) {
         $map['filter_category'] = '';
     }
     if (!array_key_exists('filter_rating', $map)) {
         $map['filter_rating'] = '';
     }
     if (!array_key_exists('filter_term', $map)) {
         $map['filter_term'] = '';
     }
     if (!array_key_exists('filter_hours', $map)) {
         $map['filter_hours'] = '';
     }
     $data = array();
     if ($catalogue_name != '') {
         // Data query
         $query = 'SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'catalogue_entries WHERE ce_validated=1 AND ' . db_string_equal_to('c_name', $catalogue_name);
         // Filtering
         if ($map['filter_category'] != '') {
             require_code('ocfiltering');
             $query .= ' AND (' . ocfilter_to_sqlfragment($map['filter_category'], 'id', 'catalogue_categories', 'cc_parent_id', 'cc_id', 'id') . ')';
         }
         if ($map['filter_hours'] != '') {
             $query .= ' AND ce_add_date>' . strval(time() - 60 * 60 * intval($map['filter_hours']));
         }
         if ($map['filter_rating'] != '') {
             $query .= ' AND (SELECT AVG(rating) FROM rating WHERE ' . db_string_equal_to('rating_for_type', 'catalogue_entry') . ' AND rating_for_id=id)>' . strval(intval($map['filter_rating']));
         }
         // Info about our catalogue
         $catalogue_rows = $GLOBALS['SITE_DB']->query_select('catalogues', array('*'), array('c_name' => $catalogue_name), '', 1);
         if (!array_key_exists(0, $catalogue_rows)) {
             return paragraph('Could not find the catalogue named "' . escape_html($catalogue_name) . '".', '', 'nothing_here');
         }
         $catalogue_row = $catalogue_rows[0];
         // Get results
         $entries_to_show = array();
         if ($star_entry != '') {
             $entries_to_show = array_merge($entries_to_show, $GLOBALS['SITE_DB']->query($query . ' AND id=' . strval(intval($star_entry))));
             $query .= ' AND id<>' . strval(intval($star_entry));
         }
         $entries_to_show = array_merge($entries_to_show, $GLOBALS['SITE_DB']->query($query . ' ORDER BY ce_add_date DESC', $max_results));
         if (count($entries_to_show) == 0 && ($min_latitude == '' || $max_latitude == '' || $min_longitude == '' || $max_longitude == '')) {
             //return paragraph(do_lang_tempcode('NO_ENTRIES'),'','nothing_here');
         }
         // Make marker data Javascript-friendly
         foreach ($entries_to_show as $i => $entry_row) {
             $entry_row['allow_rating'] = 0;
             // Performance: So rating is not loaded
             $details = get_catalogue_entry_map($entry_row, $catalogue_row, 'CATEGORY', $catalogue_name, NULL);
             $two_d_list = $details['FIELDS_2D'];
             $longitude = NULL;
             $latitude = NULL;
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:main_google_map.php


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