diff options
author | plegall <plg@piwigo.org> | 2004-12-25 19:33:36 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2004-12-25 19:33:36 +0000 |
commit | 4c8d18de5b904eddaa900deca20c7d6f7ac928d1 (patch) | |
tree | 0eb36bf58ca6f4ae7018f13ecb64705fc09ca299 /admin/include/functions_metadata.php | |
parent | 30d71ba9cb7870ae2ee2fba58d1bc157159484e5 (diff) |
- user permissions ask update at each admin page generation. Table
user_forbidden must be updated only if current user is not in
administrative section
- bug fixed : category.php, error on page title when non category selected
- admin/search : bug on variable $PHP_SELF, replaced by $_SERVER['PHP_SELF']
- admin/user_perm : inheritence management. When a category become
authorized, all parent categories become authorized, when a category
become forbidden, all child category become forbidden
- no more recursivity in delete_categories function
- new function get_fs_directories for future new method of synchronization
- new function get_uppercat_ids replacing several pieces of code doing the
same
- new function get_fulldirs used for metadata function get_filelist and
future new method of synchronization
- new function get_fs for future new method of synchronization
- typo correction on lang item "about_message"
- no link to category privacy status management on user permission anymore
(giving the menu item instead)
git-svn-id: http://piwigo.org/svn/trunk@657 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/include/functions_metadata.php | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php index 023ab219e..39b3bf450 100644 --- a/admin/include/functions_metadata.php +++ b/admin/include/functions_metadata.php @@ -132,26 +132,11 @@ function update_metadata($files) */ function get_filelist($category_id = '', $recursive = false, $only_new = false) { - $files = array(); - - $query = ' -SELECT id, dir - FROM '.CATEGORIES_TABLE.' - WHERE dir IS NOT NULL -;'; - $result = pwg_query($query); - $cat_dirs = array(); - while ($row = mysql_fetch_array($result)) - { - $cat_dirs[$row['id']] = $row['dir']; - } - - // filling $uppercats_array : to each category id the uppercats list is - // associated - $uppercats_array = array(); + // filling $cat_ids : all categories required + $cat_ids = array(); $query = ' -SELECT id, uppercats +SELECT id FROM '.CATEGORIES_TABLE.' WHERE site_id = 1 AND dir IS NOT NULL'; @@ -175,37 +160,20 @@ SELECT id, uppercats $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { - $uppercats_array[$row['id']] = $row['uppercats']; + array_push($cat_ids, $row['id']); } - if (count($uppercats_array) == 0) + if (count($cat_ids) == 0) { return array(); } - $query = ' -SELECT galleries_url - FROM '.SITES_TABLE.' - WHERE id = 1 -'; - $row = mysql_fetch_array(pwg_query($query)); - $basedir = $row['galleries_url']; - - // filling $cat_fulldirs - $cat_fulldirs = array(); - foreach ($uppercats_array as $cat_id => $uppercats) - { - $uppercats = str_replace(',', '/', $uppercats); - $cat_fulldirs[$cat_id] = $basedir.preg_replace('/(\d+)/e', - "\$cat_dirs['$1']", - $uppercats); - } + $files = array(); $query = ' -SELECT id, file, storage_category_id +SELECT id, path FROM '.IMAGES_TABLE.' - WHERE storage_category_id IN ('.implode(',' - ,array_keys($uppercats_array)).')'; + WHERE storage_category_id IN ('.implode(',', $cat_ids).')'; if ($only_new) { $query.= ' @@ -217,8 +185,7 @@ SELECT id, file, storage_category_id $result = pwg_query($query); while ($row = mysql_fetch_array($result)) { - $files[$row['id']] - = $cat_fulldirs[$row['storage_category_id']].'/'.$row['file']; + $files[$row['id']] = $row['path']; } return $files; |