From: <ny...@us...> - 2008-03-12 12:59:34
|
Update of /cvsroot/tikiwiki/tiki In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18964 Modified Files: Tag: BRANCH-1-10 tiki-list_file_gallery.php Log Message: [FIX] use for instead of foreach in recursive functions, to be sure to have a separate array iterator cursor for each execution of the function Index: tiki-list_file_gallery.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/tiki-list_file_gallery.php,v retrieving revision 1.50.2.12 retrieving revision 1.50.2.13 diff -u -d -r1.50.2.12 -r1.50.2.13 --- tiki-list_file_gallery.php 11 Mar 2008 15:17:54 -0000 1.50.2.12 +++ tiki-list_file_gallery.php 12 Mar 2008 12:59:34 -0000 1.50.2.13 @@ -731,10 +731,14 @@ // function add2tree(&$tree, &$galleries, &$gallery_id, &$gallery_path, &$expanded, $cur_id = -1) { static $total = 1; + static $nb_galleries = 0; $i = 0; $current_path = array(); $path_found = false; - foreach ( $galleries as $gk => $gv ) { + + if ( $nb_galleries == 0 ) $nb_galleries = count($galleries); + for ( $gk = 0 ; $gk < $nb_galleries ; $gk++ ) { + $gv =& $galleries[$gk]; if ( $gv['parentId'] == $cur_id && $gv['id'] != $cur_id ) { $tree[$i] = &$galleries[$gk]; $tree[$i]['link_var'] = 'galleryId'; |