示例#1
0
    //	setup default menuset
    $result = query_full_array("SELECT DISTINCT menuset FROM " . prefix('menu'));
    if (is_array($result)) {
        // default to the first one
        $set = array_shift($result);
        $menuset = $set['menuset'];
    } else {
        $menuset = 'default';
    }
    $_GET['menuset'] = $menuset;
}
$reports = array();
if (isset($_POST['update'])) {
    XSRFdefender('update_menu');
    processMenuBulkActions($reports);
    updateItemsSortorder($reports);
}
if (isset($_GET['delete'])) {
    XSRFdefender('delete_menu');
    $sql = 'SELECT * FROM ' . prefix('menu') . ' WHERE `id`=' . sanitize_numeric($_GET['id']);
    $result = query_single_row($sql);
    if (empty($result)) {
        $reports[] = "<p class='errorbox' >" . gettext('Menu item deleted failed') . "</p>";
    } else {
        $_GET['menuset'] = $menuset = $result['menuset'];
        $sql = 'DELETE FROM ' . prefix('menu') . ' WHERE `id`=' . $result['id'];
        query($sql);
        $sql = 'DELETE FROM ' . prefix('menu') . ' WHERE `menuset`="' . $menuset . '" AND `sort_order` LIKE "' . $result['sort_order'] . '/%"';
        query($sql);
        $reports[] = "<p class='messagebox fade-message'>" . gettext('Menu item deleted') . "</p>";
    }
示例#2
0
    //	setup default menuset
    $result = query_full_array("SELECT DISTINCT menuset FROM " . prefix('menu'));
    if (is_array($result)) {
        // default to the first one
        $set = array_shift($result);
        $menuset = $set['menuset'];
    } else {
        $menuset = 'default';
    }
    $_GET['menuset'] = $menuset;
}
$reports = array();
if (isset($_POST['update'])) {
    XSRFdefender('update_menu');
    if ($_POST['checkallaction'] == 'noaction') {
        $reports[] = updateItemsSortorder();
    } else {
        $report = processMenuBulkActions();
        if ($report) {
            $reports[] = $report;
        } else {
            $reports[] = '<p class="notebox fade-message">' . gettext('Nothing changed') . '</p>';
        }
    }
}
if (isset($_GET['delete'])) {
    XSRFdefender('delete_menu');
    $sql = 'SELECT * FROM ' . prefix('menu') . ' WHERE `id`=' . sanitize_numeric($_GET['id']);
    $result = query_single_row($sql);
    if (empty($result)) {
        $reports[] = "<p class='errorbox' >" . gettext('Menu item deleted failed') . "</p>";