aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/advanced_feature.php3
-rw-r--r--admin/element_set.php29
2 files changed, 29 insertions, 3 deletions
diff --git a/admin/advanced_feature.php b/admin/advanced_feature.php
index 8b0d58aaa..a178b50f1 100644
--- a/admin/advanced_feature.php
+++ b/admin/advanced_feature.php
@@ -65,6 +65,7 @@ $template->assign_vars(
array(
// 'U_ADV_????' => $start_url.'???',
'U_ADV_ELEMENT_NOT_LINKED' => PHPWG_ROOT_PATH.'admin.php?page=element_set&cat=not_linked',
+ 'U_ADV_DUP_FILES' => PHPWG_ROOT_PATH.'admin.php?page=element_set&cat=duplicates',
'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=advanced_feature'
)
);
@@ -74,4 +75,4 @@ $template->assign_vars(
// +-----------------------------------------------------------------------+
$template->assign_var_from_handle('ADMIN_CONTENT', 'advanced_feature');
-?> \ No newline at end of file
+?>
diff --git a/admin/element_set.php b/admin/element_set.php
index 583777ae9..530bbd5f5 100644
--- a/admin/element_set.php
+++ b/admin/element_set.php
@@ -137,7 +137,7 @@ SELECT element_id
}
else if ('not_linked' == $_GET['cat'])
{
- $page['title'] = 'elements not linked to any virtual categories';
+ $page['title'] = l10n('Elements_not_linked');
// we are searching elements not linked to any virtual category
$query = '
@@ -162,7 +162,32 @@ SELECT DISTINCT(image_id)
$page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
}
+else if ('duplicates' == $_GET['cat'])
+{
+ $page['title'] = l10n('Duplicates');
+
+ // we are searching related elements twice or more to physical categories
+ // 1 - Retrieve Files
+ $query = '
+SELECT DISTINCT(file)
+ FROM '.IMAGES_TABLE.'
+ GROUP BY file
+HAVING COUNT(DISTINCT storage_category_id) > 1
+;';
+
+ $duplicate_files = array_from_query($query, 'file');
+ $duplicate_files[]='Nofiles';
+ // 2 - Retrives related picture ids
+ $query = '
+SELECT id, file
+ FROM '.IMAGES_TABLE.'
+WHERE file IN (\''.implode("','", $duplicate_files).'\')
+ORDER BY file, id
+;';
+ $page['cat_elements_id'] = array_from_query($query, 'id');
+ $page['cat_elements_id'][] = 0;
+}
// +-----------------------------------------------------------------------+
// | first element to display |
// +-----------------------------------------------------------------------+
@@ -202,4 +227,4 @@ switch ($_GET['mode'])
break;
}
}
-?> \ No newline at end of file
+?>