<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if ($this->authorize()) { if (isset($this->registry->params['id']) && isset($this->registry->params['item']) && $this->upid <= 2) { if (isset($this->registry->params['itemAction']) == 'delete') { // start tree class $tree = new NestedTreeAdmin($this->registry->core . 'menu_items', $this->registry->params['item'], 'item'); // Update menu item table. $item = $tree->getCategory(); if ($item) { $result = $this->getResult('item_id', $this->registry->core . 'menu_items', null, array('where' => 'url_id=' . $item['url_id'])); if ($result) { $num_rows = count($result); } else { $pass = false; } // if just one url depends on this item then delete it. if ($num_rows == 1) { $result = $this->remove($this->registry->core . 'menu_urls', 'url_id=' . $item['url_id']); $pass = $result ? true : false; } } if ($num_rows) { $result = $tree->remove($this->registry->params['item']); $pass = $result ? true : false; } if ($pass) { $params['TYPE'] = 'pass'; $params['MESSAGE'] = '<h2>Menu item was successfully deleted.</h2>';