aboutsummaryrefslogtreecommitdiffstats
path: root/include/section_init.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-07-23 00:56:22 +0000
committerrvelices <rv-github@modusoptimus.com>2008-07-23 00:56:22 +0000
commitcde423fc86a8aaa6054179ca17e534f53df1a422 (patch)
tree6d206d674d38e19db20a4600d57569c7701e3b0b /include/section_init.inc.php
parent031148319ba7eb57cd66c816e772d413d1ef6bfa (diff)
- normalize behaviour of query search versus std search (now both return items already sorted and permission checked); also more optimized sql queries (in some cases)
git-svn-id: http://piwigo.org/svn/trunk@2451 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/section_init.inc.php')
-rw-r--r--include/section_init.inc.php27
1 files changed, 6 insertions, 21 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index d8b2f62c2..053607dfd 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -332,31 +332,16 @@ SELECT DISTINCT image_id
{
include_once( PHPWG_ROOT_PATH .'include/functions_search.inc.php' );
- $search_result = get_search_results($page['search']);
- if ( !empty($search_result['items']) and !isset($search_result['as_is']) )
- {
- $query = '
-SELECT DISTINCT(id)
- FROM '.IMAGES_TABLE.'
- INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
- WHERE id IN ('.implode(',', $search_result['items']).')
- '.$forbidden.'
- '.$conf['order_by'].'
-;';
- $page['items'] = array_from_query($query, 'id');
- }
- else
- {
- $page['items'] = $search_result['items'];
- if ( isset($search_result['qs']) )
- {//save the details of the query search
- $page['qsearch_details'] = $search_result['qs'];
- }
+ $search_result = get_search_results($page['search'], @$page['super_order_by'] );
+ if ( isset($search_result['qs']) )
+ {//save the details of the query search
+ $page['qsearch_details'] = $search_result['qs'];
}
$page = array_merge(
$page,
array(
+ 'items' => $search_result['items'],
'title' => '<a href="'.duplicate_index_url(array('start'=>0)).'">'
.l10n('search_result').'</a>',
)
@@ -378,7 +363,7 @@ SELECT image_id
(
array
(
- 'visible_images' => 'image_id'
+ 'visible_images' => 'id'
),
'AND'
).'