mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 09:13:02 +02:00
use the order of categories.uppercats for retrieving the local directory,
and not the ascending order of category ids (if you alterate manually the database by moving an old category under a new one). git-svn-id: http://piwigo.org/svn/branches/release-1_3@271 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -259,7 +259,7 @@ function get_cat_info( $id )
|
||||
global $page;
|
||||
|
||||
$cat = array();
|
||||
|
||||
|
||||
$query = 'SELECT nb_images,id_uppercat,comment,site_id,galleries_url,dir';
|
||||
$query.= ',date_last,uploadable,status,visible,representative_picture_id';
|
||||
$query.= ',uppercats';
|
||||
@@ -331,15 +331,20 @@ function get_local_dir( $category_id )
|
||||
$uppercats = $row['uppercats'];
|
||||
}
|
||||
|
||||
$query = 'SELECT dir';
|
||||
$upper_array = explode( ',', $uppercats );
|
||||
|
||||
$database_dirs = array();
|
||||
$query = 'SELECT id,dir';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'categories';
|
||||
$query.= ' WHERE id IN ('.$uppercats.')';
|
||||
$query.= ' ORDER BY id ASC';
|
||||
$query.= ';';
|
||||
$result = mysql_query( $query );
|
||||
while( $row = mysql_fetch_array( $result ) )
|
||||
{
|
||||
$local_dir.= $row['dir'].'/';
|
||||
$database_dirs[$row['id']] = $row['dir'];
|
||||
}
|
||||
foreach ( $upper_array as $id ) {
|
||||
$local_dir.= $database_dirs[$id].'/';
|
||||
}
|
||||
|
||||
return $local_dir;
|
||||
|
||||
Reference in New Issue
Block a user