aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-01-11 00:02:03 +0000
committerz0rglub <z0rglub@piwigo.org>2004-01-11 00:02:03 +0000
commit57b44b31467426255377b871f1065ef7a43b2f74 (patch)
tree1e4f49685057d59a3fe2d3bf217a34134a2f77b2
parent1592a942f025c347efc104bd5b05f73f53637a10 (diff)
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
-rw-r--r--include/functions_category.inc.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index cd9b6b503..1cbe30b25 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -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;