aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-07-26 20:42:48 +0000
committerz0rglub <z0rglub@piwigo.org>2004-07-26 20:42:48 +0000
commitd119cf334414bdf58e819cb5c6a842abe0d63e51 (patch)
tree3c75f08d996972c35a45f0872277b28d90ccf71e
parent16b2b8593403d381432c919441672474cc762c34 (diff)
- 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
-rw-r--r--picture.php32
1 files changed, 16 insertions, 16 deletions
diff --git a/picture.php b/picture.php
index 6f1c7c149..6a1fa28de 100644
--- a/picture.php
+++ b/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'].= '&amp;search='.$_GET['search'];
- $picture[$j]['url'].= '&amp;mode='.$_GET['mode'];
}
}
@@ -150,7 +150,7 @@ $url_home = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&amp;';
$url_home.= 'num='.$page['num'];
if ( $page['cat'] == 'search' )
{
- $url_home.= "&amp;search=".$_GET['search'].'&amp;mode='.$_GET['mode'];
+ $url_home.= "&amp;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'].'&amp;image_id='.$_GET['image_id'];
if ( $page['cat'] == 'search' )
{
- $url.= '&amp;search='.$_GET['search'].'&amp;mode='.$_GET['mode'];
+ $url.= '&amp;search='.$_GET['search'];
}
if( !isset( $_GET['start'] )
or !is_numeric( $_GET['start'] )