From 93fb07841fad34e25ff1e7d5d353dcb7433d094d Mon Sep 17 00:00:00 2001 From: rvelices Date: Sun, 21 Sep 2008 11:06:20 +0000 Subject: - fix function get_fulldirs - works correctly eent for wrong params (virtual cats) - fix functions_metadata.php - could not be included from inside another function git-svn-id: http://piwigo.org/svn/trunk@2560 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 17 ++++------------- admin/include/functions_metadata.php | 9 ++++----- 2 files changed, 8 insertions(+), 18 deletions(-) (limited to 'admin') diff --git a/admin/include/functions.php b/admin/include/functions.php index 8453dad73..af98d1cb3 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -798,24 +798,14 @@ 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']; - } + $cat_dirs = simple_hash_from_query($query, 'id', 'dir'); // caching galleries_url $query = ' SELECT id, galleries_url FROM '.SITES_TABLE.' ;'; - $result = pwg_query($query); - $galleries_url = array(); - while ($row = mysql_fetch_array($result)) - { - $galleries_url[$row['id']] = $row['galleries_url']; - } + $galleries_url = simple_hash_from_query($query, 'id', 'galleries_url'); // categories : id, site_id, uppercats $categories = array(); @@ -823,7 +813,8 @@ SELECT id, galleries_url $query = ' SELECT id, uppercats, site_id FROM '.CATEGORIES_TABLE.' - WHERE id IN ( + WHERE dir IS NOT NULL + AND id IN ( '.wordwrap(implode(', ', $cat_ids), 80, "\n").') ;'; $result = pwg_query($query); diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php index 51867b448..c4bab5a9b 100644 --- a/admin/include/functions_metadata.php +++ b/admin/include/functions_metadata.php @@ -23,11 +23,10 @@ include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); -$page['datefields'] = array('date_creation', 'date_available'); function get_sync_iptc_data($file) { - global $conf, $page; + global $conf; $map = $conf['use_iptc_mapping']; @@ -35,7 +34,7 @@ function get_sync_iptc_data($file) foreach ($iptc as $pwg_key => $value) { - if (in_array($pwg_key, $page['datefields'])) + if (in_array($pwg_key, array('date_creation', 'date_available'))) { if (preg_match('/(\d{4})(\d{2})(\d{2})/', $value, $matches)) { @@ -71,13 +70,13 @@ function get_sync_iptc_data($file) function get_sync_exif_data($file) { - global $conf, $page; + global $conf; $exif = get_exif_data($file, $conf['use_exif_mapping']); foreach ($exif as $pwg_key => $value) { - if (in_array($pwg_key, $page['datefields'])) + if (in_array($pwg_key, array('date_creation', 'date_available'))) { if (preg_match('/^(\d{4}).(\d{2}).(\d{2})/', $value, $matches)) { -- cgit v1.2.3