diff --git a/category.php b/category.php index 1a74a912f..6a0b7a651 100644 --- a/category.php +++ b/category.php @@ -64,18 +64,6 @@ else $page['start'] = $_GET['start']; } -// Sometimes, a "num" is provided in the URL. It is the number -// of the picture to show. This picture must be in the thumbnails page. -// We have to find the right $page['start'] that show the num picture -// in this category -if ( isset( $_GET['num'] ) - and is_numeric( $_GET['num'] ) - and $_GET['num'] >= 0 ) -{ - $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] ); - $page['start']*= $user['nb_image_page']; -} - initialize_category(); // caddie filling :-) diff --git a/include/category_default.inc.php b/include/category_default.inc.php index 0965b331e..fd04181e9 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -39,7 +39,7 @@ $array_cat_directories = array(); $query = ' SELECT DISTINCT(id),path,file,date_available - ,tn_ext,name,filesize,storage_category_id,average_rate + ,tn_ext,name,filesize,storage_category_id,average_rate,hit FROM '.IMAGES_TABLE.' AS i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id '.$page['where'].' @@ -108,6 +108,11 @@ while ($row = mysql_fetch_array($result)) { $name = '('.$row['average_rate'].') '.$name; } + else + if ($page['cat'] == 'most_visited') + { + $name = '('.$row['hit'].') '.$name; + } if ($page['cat'] == 'search') { diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 4f41d858c..bff44f620 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -82,7 +82,7 @@ function create_navigation_bar($url, $nb_element, $start, { $navbar.= ''.$lang['first_page']; + $navbar.= '" class="'.$link_class.'" rel="start">'.$lang['first_page']; $navbar.= ''; } else @@ -96,7 +96,7 @@ function create_navigation_bar($url, $nb_element, $start, $previous = $start - $nb_element_page; $navbar.= ''.$lang['previous_page']; + $navbar.= '" class="'.$link_class.'" rel="prev">'.$lang['previous_page']; $navbar.= ''; } else @@ -130,7 +130,16 @@ function create_navigation_bar($url, $nb_element, $start, $temp_start = ($i - 1) * $nb_element_page; $navbar.= ' '.$i.''; + $navbar.= '" class="'.$link_class.'"'; + if ($i == $cur_page - 1) + { + $navbar.= ' rel="prev"'; + } + if ($i == $cur_page + 1) + { + $navbar.= ' rel="next"'; + } + $navbar.='>'.$i.''; } else { @@ -159,7 +168,7 @@ function create_navigation_bar($url, $nb_element, $start, $next = $start + $nb_element_page; $navbar.= ''.$lang['next_page'].''; + $navbar.= '" class="'.$link_class.'" rel="next">'.$lang['next_page'].''; } else { 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 )); } diff --git a/template/yoga/icon/first.png b/template/yoga/icon/first.png new file mode 100644 index 000000000..2b8db1cff Binary files /dev/null and b/template/yoga/icon/first.png differ diff --git a/template/yoga/icon/last.png b/template/yoga/icon/last.png new file mode 100644 index 000000000..12e1367a7 Binary files /dev/null and b/template/yoga/icon/last.png differ diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index d28632ca0..ceafa6a96 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -14,7 +14,7 @@
- {L_SLIDESHOW} + {L_SLIDESHOW} {L_PICTURE_METADATA} {lang:representative} @@ -34,13 +34,20 @@
@@ -65,12 +72,12 @@ - + - + @@ -146,7 +153,7 @@

{rate.SENTENCE} : -{rate.rate_option.SEPARATOR} {rate.rate_option.OPTION} +{rate.rate_option.SEPARATOR} {rate.rate_option.OPTION}