$Messages->add(sprintf(T_('Tag "%s" has been unlinked from the post "%s".'), '<b>' . $edited_ItemTag->dget('name') . '</b>', '<b>' . $edited_Item->dget('title') . '</b>'), 'success'); } // Redirect so that a reload doesn't write to the DB twice: header_redirect($admin_url . '?ctrl=itemtags&tag_ID=' . $edited_ItemTag->ID . '&action=edit', 303); // Will EXIT // We have EXITed already at this point!! break; case 'merge_confirm': case 'merge_cancel': // Merge previous tag with other tag: // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('tag'); // Check that current user has permission to edit tags: $current_User->check_perm('options', 'edit', true); $old_tag_ID = param('old_tag_ID', 'integer', 0, true); $ItemTagCache =& get_ItemTagCache(); $old_ItemTag =& $ItemTagCache->get_by_ID($old_tag_ID, false); if (empty($edited_ItemTag) || empty($old_ItemTag)) { // Wrong request, Redirect to item tags header_redirect($admin_url . '?ctrl=itemtags', 303); // Will EXIT // We have EXITed already at this point!! } if ($action == 'merge_cancel') { // Merge action has been cancelled, REdirect to edit tag header_redirect($admin_url . '?ctrl=itemtags&action=edit&tag_ID=' . $old_ItemTag->ID, 303); // Will EXIT // We have EXITed already at this point!! } // Delete old tag from the items if they already have new tag // in order to avoid conflicts in the update sql query below
if ($filter_item_ID = get_param('tag_item_ID')) { // add filter for item ID if (is_number($filter_item_ID)) { $sql_item_left_join = 'LEFT JOIN T_items__itemtag AS it2 ON it2.itag_tag_ID = tag_ID'; $sql_item_where = 'it2.itag_itm_ID = ' . $DB->quote($filter_item_ID); $SQL->FROM_add($sql_item_left_join); $SQL->WHERE_and($sql_item_where); $count_SQL->FROM_add($sql_item_left_join); $count_SQL->WHERE_and($sql_item_where); $list_is_filtered = true; } } // Create result set: $Results = new Results($SQL->get(), 'tag_', 'A', NULL, $count_SQL->get()); $Results->title = T_('Tags') . ' (' . $Results->get_total_rows() . ')' . get_manual_link('item-tags-list'); $Results->Cache = get_ItemTagCache(); if ($list_is_filtered) { // List is filtered, offer option to reset filters: $Results->global_icon(T_('Reset all filters!'), 'reset_filters', $admin_url . '?ctrl=itemtags', T_('Reset filters'), 3, 3, array('class' => 'action_icon btn-warning')); } /** * Callback to add filters on top of the result set * * @param Form */ function filter_tags(&$Form) { $Form->text_input('tag_filter', get_param('tag_filter'), 24, T_('Tag'), '', array('maxlength' => 50)); $item_ID_filter_note = ''; if ($filter_item_ID = get_param('tag_item_ID')) { // check item_Id filter. It must be a number