diff options
author | mistic100 <mistic@piwigo.org> | 2014-01-27 18:05:04 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-01-27 18:05:04 +0000 |
commit | 6fcc5f10df0fbd02877e49aec7b662c64c60acc7 (patch) | |
tree | 5359b9244063c672c9c829c2e54bc935e870567f /admin/include/functions.php | |
parent | 46c2cb6b5f407848ed9bc60812b84f645106fedc (diff) |
Merged revision(s) 26972, 26998 from trunk:
replace more preg_replace callback
........
remove *_version_compare methods in languages & plugins & themes classes, unused and outdated (preg_replace /e modifier)
git-svn-id: http://piwigo.org/svn/branches/2.6@26999 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/include/functions.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php index 1df6e4f45..bdeab47e7 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -576,6 +576,7 @@ SELECT id, id_uppercat, uppercats, rank, global_rank FROM '.CATEGORIES_TABLE.' ORDER BY id_uppercat,rank,name'; + global $cat_map; // used in preg_replace callback $cat_map = array(); $current_rank = 0; @@ -602,13 +603,16 @@ SELECT id, id_uppercat, uppercats, rank, global_rank $datas = array(); + $cat_map_callback = create_function('$m', 'global $cat_map; return $cat_map[$m[1]]["rank"];'); + foreach( $cat_map as $id=>$cat ) { - $new_global_rank = preg_replace( - '/(\d+)/e', - "\$cat_map['$1']['rank']", - str_replace(',', '.', $cat['uppercats'] ) - ); + $new_global_rank = preg_replace_callback( + '/(\d+)/', + $cat_map_callback, + str_replace(',', '.', $cat['uppercats'] ) + ); + if ( $cat['rank_changed'] or $new_global_rank!=$cat['global_rank'] ) @@ -621,6 +625,8 @@ SELECT id, id_uppercat, uppercats, rank, global_rank } } + unset($cat_map); + mass_updates( CATEGORIES_TABLE, array( |