function doDelete() { global $_TABLES, $LANG_TAG; // Retrieves request vars $tag_ids = TAG_post('tag_ids', true, true); if (!is_array($tag_ids) or count($tag_ids) === 0) { return ''; } $cmd = TAG_post('submit'); if ($cmd != $LANG_TAG['delete_checked'] and $cmd != $LANG_TAG['ban_checked']) { return ''; } $tag_ids = array_map('addslashes', $tag_ids); $tag_ids = "'" . implode("','", $tag_ids) . "'"; // Registers banned words into DB if ($cmd == $LANG_TAG['ban_checked']) { $sql = "INSERT INTO {$_TABLES['tag_badwords']} " . "SELECT tag FROM {$_TABLES['tag_list']} " . "WHERE (tag_id IN ({$tag_ids}))"; $result = DB_query($sql); } // Deletes tags from registered tag list $sql = "DELETE FROM {$_TABLES['tag_list']} " . "WHERE (tag_id IN ({$tag_ids}))"; $result = DB_query($sql); $sql = "DELETE FROM {$_TABLES['tag_map']} " . "WHERE (tag_id IN ({$tag_ids}))"; $result = DB_query($sql); return DB_error() ? TAG_str('delete_fail') : TAG_str('delete_success'); }
function doDelete() { global $_TABLES, $LANG_TAG; $submit = TAG_post('submit'); if ($submit !== $LANG_TAG['submit']) { return ''; } $menus = TAG_getMenuList(); $menu_id = TAG_post('menu_id', TRUE, TRUE); $parent_id = $menus[$menu_id]['parent_id']; $children = $menus[$menu_id]['child']; // Deletes the given menu item $sql = "DELETE FROM {$_TABLES['tag_menu']} " . "WHERE (menu_id = '" . addslashes($menu_id) . "')"; DB_query($sql); // Chnage the parents of child menus if any if (count($children) > 0) { foreach ($children as $child) { $sql = "UPDATE {$_TABLES['tag_menu']} " . "SET parent_id = '" . addslashes($parent_id) . "' " . "WHERE (menu_id = '" . addslashes($child) . "')"; DB_query($sql); } } return DB_error() ? TAG_str('delete_fail') : TAG_str('delete_success'); }
function doDelete() { global $_TABLES, $LANG_TAG; $submit = TAG_post('submit'); if ($submit == $LANG_TAG['add']) { $this->doAdd(); return; } $words = TAG_post('words'); if (!is_array($words) or count($words) === 0) { return ''; } /** * Deletes a bad word from DB */ $words4db = array_map('addslashes', $words); $words4db = "('" . implode("','", $words4db) . "')"; $sql = "DELETE FROM {$_TABLES['tag_badwords']} " . "WHERE (badword IN " . $words4db . ")"; $result = DB_query($sql); /** * Rescans articles and staticpages for tags */ DB_query("DELETE FROM {$_TABLES['tag_list']} "); DB_query("DELETE FROM {$_TABLES['tag_map']} "); TAG_scanAll(); return DB_error() ? TAG_str('delete_fail') : TAG_str('delete_success'); }
TAG_checkAdmin(); // Main $this_script = $_CONF['site_admin_url'] . '/plugins/tag/index.php'; $commands = array('stats', 'badword', 'menuconfig'); $actions = array('view', 'add', 'edit', 'delete', 'doAdd', 'doEdit', 'doDelete'); // Retrieves request vars $cmd = TAG_get('cmd'); if ($cmd === FALSE) { $cmd = TAG_post('cmd'); } if ($cmd === FALSE or !in_array($cmd, $commands)) { $cmd = 'stats'; } $action = TAG_get('action'); if ($action === FALSE) { $action = TAG_post('action', true); } if ($action === FALSE or !in_array($action, $actions)) { $action = 'view'; } // Processes command require_once $cmd . '.class.php'; $class = 'Tag' . ucfirst($cmd); $obj = new $class(); switch ($action) { case 'doAdd': $msg = $obj->doAdd(); break; case 'doEdit': $msg = $obj->doEdit(); break;