- SQL query refactoring
- deletion of "mode" var in URL for searchs git-svn-id: http://piwigo.org/svn/trunk@454 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
16b2b85934
commit
d119cf3344
1 changed files with 16 additions and 16 deletions
32
picture.php
32
picture.php
|
@ -54,13 +54,13 @@ if ( 0 )
|
|||
}
|
||||
|
||||
// retrieving the number of the picture in its category (in order)
|
||||
$query = 'SELECT DISTINCT(id)';
|
||||
$query.= ' FROM '.IMAGES_TABLE;
|
||||
$query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic';
|
||||
$query.= ' ON id = ic.image_id';
|
||||
$query.= $page['where'];
|
||||
$query.= $conf['order_by'];
|
||||
$query.= ';';
|
||||
$query = '
|
||||
SELECT DISTINCT(id)
|
||||
FROM '.IMAGES_TABLE.'
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
|
||||
'.$page['where'].'
|
||||
'.$conf['order_by'].'
|
||||
;';
|
||||
$result = mysql_query( $query );
|
||||
$page['num'] = 0;
|
||||
$row = mysql_fetch_array( $result );
|
||||
|
@ -87,12 +87,13 @@ if ( $page['num'] == $page['cat_nb_images'] - 1 )
|
|||
$next = 0;
|
||||
}
|
||||
|
||||
$query = 'SELECT *';
|
||||
$query.= ' FROM '.IMAGES_TABLE;
|
||||
$query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic';
|
||||
$query.= ' ON id=ic.image_id';
|
||||
$query.= $page['where'];
|
||||
$query.= $conf['order_by'];
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM '.IMAGES_TABLE.'
|
||||
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id
|
||||
'.$page['where'].'
|
||||
'.$conf['order_by'].'
|
||||
';
|
||||
|
||||
if ( $prev < 0 )
|
||||
{
|
||||
|
@ -142,7 +143,6 @@ for ( $i = 0; $i < $nb_row; $i++ )
|
|||
if ( $page['cat'] == 'search' )
|
||||
{
|
||||
$picture[$j]['url'].= '&search='.$_GET['search'];
|
||||
$picture[$j]['url'].= '&mode='.$_GET['mode'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ $url_home = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&';
|
|||
$url_home.= 'num='.$page['num'];
|
||||
if ( $page['cat'] == 'search' )
|
||||
{
|
||||
$url_home.= "&search=".$_GET['search'].'&mode='.$_GET['mode'];
|
||||
$url_home.= "&search=".$_GET['search'];
|
||||
}
|
||||
|
||||
$url_admin = PHPWG_ROOT_PATH.'admin.php?page=picture_modify';
|
||||
|
@ -530,7 +530,7 @@ if ( $conf['show_comments'] )
|
|||
$url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id'];
|
||||
if ( $page['cat'] == 'search' )
|
||||
{
|
||||
$url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
|
||||
$url.= '&search='.$_GET['search'];
|
||||
}
|
||||
if( !isset( $_GET['start'] )
|
||||
or !is_numeric( $_GET['start'] )
|
||||
|
|
Loading…
Reference in a new issue