Пример #1
0
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: remove.php,v 1.3 2005/04/03 07:57:14 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$section = null;
if (isset($_GET['id'])) {
    $section = $db->selectObject("section", "id=" . $_GET['id']);
}
if ($section) {
    if (pathos_permissions_check('manage', pathos_core_makeLocation('navigationmodule', '', $section->id))) {
        navigationmodule::removeLevel($section->id);
        $db->decrement("section", "rank", 1, "rank > " . $section->rank . " AND parent=" . $section->parent);
        $section->parent = -1;
        $db->updateObject($section, 'section');
        pathos_flow_redirect();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}
Пример #2
0
 function removeLevel($parent)
 {
     global $db;
     $kids = $db->selectObjects('section', 'parent=' . $parent);
     foreach ($kids as $kid) {
         $kid->parent = -1;
         $db->updateObject($kid, 'section');
         navigationmodule::removeLevel($kid->id);
     }
 }