Exemplo n.º 1
0
     //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']);
                     $success .= "<br />removed the page " . $_POST[$b]['name'];
                     continue;
                 }
                 if (isset($_POST[$b]['name']) && $_POST[$b]['name'] != $pagearray[$i]['name'] && $_POST[$b]['name'] != "") {
                     $admin->updatePage($_POST[$b]['id'], $_POST[$b]['name']);
                     $success .= "changed page <b>" . $pagearray[$i]['name'] . "</b> name to <b>" . $_POST[$b]['name'] . "</b><br />";
                 }
             }