mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-05-06 05:22:37 +02:00
- feature 280: code simplification
git-svn-id: http://piwigo.org/svn/trunk@1022 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
19
category.php
19
category.php
@@ -51,6 +51,14 @@ if (isset($page['cat']) and is_numeric($page['cat']))
|
||||
{
|
||||
check_restrictions($page['cat']);
|
||||
}
|
||||
//----------------------------------------------- change of image dispaly order
|
||||
if ( isset($_GET['image_order']) )
|
||||
{
|
||||
setcookie( 'pwg_image_order',
|
||||
$_GET['image_order']>0 ? $_GET['image_order'] : '', 0 );
|
||||
redirect( PHPWG_ROOT_PATH.'category.php'.
|
||||
get_query_string_diff(array('image_order')) );
|
||||
}
|
||||
//-------------------------------------------------------------- initialization
|
||||
// detection of the start picture to display
|
||||
if ( !isset( $_GET['start'] )
|
||||
@@ -412,16 +420,9 @@ if ( isset ( $page['cat'] ) )
|
||||
// image order
|
||||
$template->assign_block_vars( 'preferred_image_order', array() );
|
||||
|
||||
if ( isset($_GET['image_order']) )
|
||||
{
|
||||
$order_idx = $_GET['image_order'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$order_idx = isset($_COOKIE['pwg_image_order']) ?
|
||||
$order_idx = isset($_COOKIE['pwg_image_order']) ?
|
||||
$_COOKIE['pwg_image_order'] : 0;
|
||||
}
|
||||
|
||||
|
||||
$orders = get_category_preferred_image_orders();
|
||||
for ( $i = 0; $i < count($orders); $i++)
|
||||
{
|
||||
|
||||
@@ -617,22 +617,17 @@ SELECT COUNT(DISTINCT(id)) AS count
|
||||
create_navigation_bar( $url, $page['cat_nb_images'], $page['start'],
|
||||
$user['nb_image_page'], 'back' );
|
||||
}
|
||||
|
||||
|
||||
if ($page['cat'] != 'most_visited' and $page['cat'] != 'best_rated')
|
||||
{
|
||||
$available_image_orders = get_category_preferred_image_orders();
|
||||
|
||||
|
||||
$order_idx=0;
|
||||
if ( isset($_GET['image_order']) )
|
||||
{
|
||||
$order_idx = $_GET['image_order'];
|
||||
setcookie( 'pwg_image_order', $order_idx, 0 );
|
||||
}
|
||||
else if ( isset($_COOKIE['pwg_image_order']) )
|
||||
if ( isset($_COOKIE['pwg_image_order']) )
|
||||
{
|
||||
$order_idx = $_COOKIE['pwg_image_order'];
|
||||
}
|
||||
|
||||
|
||||
if ( $order_idx > 0 )
|
||||
{
|
||||
$order = $available_image_orders[$order_idx][1];
|
||||
|
||||
Reference in New Issue
Block a user