aboutsummaryrefslogtreecommitdiffstats
path: root/admin/tags.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/tags.php')
-rw-r--r--admin/tags.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/admin/tags.php b/admin/tags.php
index 412a57b14..16dea3661 100644
--- a/admin/tags.php
+++ b/admin/tags.php
@@ -138,6 +138,19 @@ DELETE
}
// +-----------------------------------------------------------------------+
+// | delete orphan tags |
+// +-----------------------------------------------------------------------+
+
+if (isset($_GET['action']) and 'delete_orphans' == $_GET['action'])
+{
+ check_pwg_token();
+
+ delete_orphan_tags();
+ $_SESSION['page_infos'] = array(l10n('Orphan tags deleted'));
+ redirect(get_root_url().'admin.php?page=tags');
+}
+
+// +-----------------------------------------------------------------------+
// | add a tag |
// +-----------------------------------------------------------------------+
@@ -200,6 +213,31 @@ $template->assign(
);
// +-----------------------------------------------------------------------+
+// | orphan tags |
+// +-----------------------------------------------------------------------+
+
+$orphan_tags = get_orphan_tags();
+
+$orphan_tag_names = array();
+foreach ($orphan_tags as $tag)
+{
+ array_push($orphan_tag_names, $tag['name']);
+}
+
+if (count($orphan_tag_names) > 0)
+{
+ array_push(
+ $page['warnings'],
+ sprintf(
+ l10n('You have %d orphan tags: %s.').' <a href="%s">'.l10n('Delete orphan tags').'</a>',
+ count($orphan_tag_names),
+ implode(', ', $orphan_tag_names),
+ get_root_url().'admin.php?page=tags&amp;action=delete_orphans&amp;pwg_token='.get_pwg_token()
+ )
+ );
+}
+
+// +-----------------------------------------------------------------------+
// | form creation |
// +-----------------------------------------------------------------------+