diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-01-27 01:11:43 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-01-27 01:11:43 +0000 |
commit | a8fd5ee6cf5cf061ed0ff789d6030290b3418be5 (patch) | |
tree | 7c31e61422551c2c0672cd43611729f70202bfae /picture.php | |
parent | 10329e517b22671f002bcb2929ebb54a09f22573 (diff) |
improvement: got rid of num= _GET param in category.php (use only start=) so
that links to category for search engines are the same as in category
pagination
feature 77: standard navigation link : HTML Link types
improvement: add go to first and last image buttons in picture page
improvement: do not increase image hit in picture.php when rating, adding to
favorites, caddie, ...
improvement: show number of hits in most_visited (as best_rated shows the rate)
git-svn-id: http://piwigo.org/svn/trunk@1014 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'picture.php')
-rw-r--r-- | picture.php | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/picture.php b/picture.php index a9655f712..11353de52 100644 --- a/picture.php +++ b/picture.php @@ -43,12 +43,18 @@ if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) check_restrictions( $page['cat'] ); } //---------------------------------------- incrementation of the number of hits -$query = ' -UPDATE '.IMAGES_TABLE.' - SET hit = hit+1 - WHERE id = '.$_GET['image_id'].' -;'; -@pwg_query( $query ); +if ( count(array_intersect( + array_keys($_GET), + array('add_fav', 'caddie', 'rate', 'representative', 'del') ) + )==0 ) +{ + $query = ' + UPDATE '.IMAGES_TABLE.' + SET hit = hit+1 + WHERE id = '.$_GET['image_id'].' + ;'; + @pwg_query( $query ); +} //-------------------------------------------------------------- initialization initialize_category( 'picture' ); // retrieving the number of the picture in its category (in order) @@ -69,8 +75,35 @@ while ($row = mysql_fetch_array($result)) $belongs = true; break; } + if ($page['num']==0) + { + $url_first_last = PHPWG_ROOT_PATH.'picture.php'; + $url_first_last.= get_query_string_diff(array('image_id','add_fav', + 'slideshow','rate')); + $url_first_last.= '&image_id='; + $template->assign_block_vars( + 'first', + array( + 'U_IMG' => $url_first_last . $row['id'], + )); + } $page['num']++; } +if ($page['cat_nb_images']>0 and $page['num'] < $page['cat_nb_images'] - 1) +{ + mysql_data_seek($result, $page['cat_nb_images'] - 1); + $row = mysql_fetch_array($result); + $url_first_last = PHPWG_ROOT_PATH.'picture.php'; + $url_first_last.= get_query_string_diff(array('image_id','add_fav', + 'slideshow','rate')); + $url_first_last.= '&image_id='; + $template->assign_block_vars( + 'last', + array( + 'U_IMG' => $url_first_last . $row['id'], + )); +} + // if this image_id doesn't correspond to this category, an error message is // displayed, and execution is stopped if (!$belongs) @@ -247,8 +280,14 @@ foreach (array('prev', 'current', 'next') as $i) $picture[$i]['url'].= '&image_id='.$row['id']; } -$url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&'; -$url_up.= 'num='.$page['num']; +$url_up = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat']; +$url_up_start = floor( $page['num'] / $user['nb_image_page'] ); +$url_up_start *= $user['nb_image_page']; +if ($url_up_start>0) +{ + $url_up .= '&start='.$url_up_start; +} + if ( $page['cat'] == 'search' ) { $url_up.= "&search=".$_GET['search']; @@ -642,7 +681,8 @@ if ($has_prev) array( 'TITLE_IMG' => $picture['prev']['name'], 'IMG' => $picture['prev']['thumbnail'], - 'U_IMG' => $picture['prev']['url'] + 'U_IMG' => $picture['prev']['url'], + 'U_IMG_SRC' => $picture['prev']['src'] )); } @@ -653,7 +693,8 @@ if ($has_next) array( 'TITLE_IMG' => $picture['next']['name'], 'IMG' => $picture['next']['thumbnail'], - 'U_IMG' => $picture['next']['url'] + 'U_IMG' => $picture['next']['url'], + 'U_IMG_SRC' => $picture['next']['src'] // allow navigator to preload )); } |