function deleteLevel($parent) { global $db; $kids = $db->selectObjects('section', 'parent=' . $parent); foreach ($kids as $kid) { NavigationModule::deleteLevel($kid->id); } $secrefs = $db->selectObjects('sectionref', 'section=' . $parent); foreach ($secrefs as $secref) { $loc = exponent_core_makeLocation($secref->module, $secref->source, $secref->internal); exponent_core_decrementLocationReference($loc, $parent); foreach ($db->selectObjects('locationref', "module='" . $secref->module . "' AND source='" . $secref->source . "' AND internal='" . $secref->internal . "' AND refcount = 0") as $locref) { if (class_exists($locref->module)) { $modclass = $locref->module; $mod = new $modclass(); $mod->deleteIn(exponent_core_makeLocation($locref->module, $locref->source, $locref->internal)); } } $db->delete('locationref', "module='" . $secref->module . "' AND source='" . $secref->source . "' AND internal='" . $secref->internal . "' AND refcount = 0"); } $db->delete('sectionref', 'section=' . $parent); $db->delete('section', 'parent=' . $parent); }
# # This file is part of Exponent # # Exponent is free software; you can redistribute # it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } if ($user->is_acting_admin == 1) { $section = $db->selectObject('section', 'id=' . intval($_GET['id'])); if ($section) { NavigationModule::deleteLevel($section->id); $db->delete('section', 'id=' . $section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); if (isset($_SESSION['nav_cache']['kids'])) { unset($_SESSION['nav_cache']['kids']); } exponent_flow_redirect(); } else { echo SITE_403_HTML; } } else { echo SITE_404_HTML; }