Exemplo n.º 1
0
switch ($admin->get('currentpage')) {
    /**
     * Pages, here we add new pages
     */
    case "pages":
        if (isset($_GET['mp_id']) && isset($_GET['mp_to']) && isset($_GET['mp_from'])) {
            //Check if sort and id matches
            $admin->movePage($_GET['mp_id'], $_GET['mp_from'], $_GET['mp_to']);
            //Sorting will be made with ajax, so perhaps die here?
            //die();
        } else {
            if (isset($_POST['addpage'])) {
                if (!isset($_POST['name']) || $_POST['name'] == "") {
                    $error = "Please fill in the name of the page";
                } else {
                    if ($admin->insertNewPage($_POST['name'], $_POST['position'], $_POST['position_item'])) {
                        $success = "Added the page <b>" . $_POST['name'] . "</b> to the site!";
                    } else {
                        $error = "Could not add page due to unknown error..";
                    }
                }
            } else {
                if (isset($_POST['editpages'])) {
                    $pagearray = $admin->getSiteMenuArray(true);
                    for ($i = 0;; $i++) {
                        $b = "pages_" . $i;
                        if (!isset($_POST[$b])) {
                            break;
                        }
                        if (isset($_POST[$b]['remove']) && $_POST[$b]['remove'] == "remove") {
                            $admin->removePage($_POST[$b]['id']);