Exemple #1
0
 public function submit()
 {
     $uriGetParam = isset($_GET['uri']) ? trim($_GET['uri'], '/') : '/';
     if ($uriGetParam != '/') {
         $urlArgs = explode('/', $uriGetParam);
         $uriLength = count($urlArgs);
     } else {
         $uriLength = 0;
     }
     $adminPage = new AdminPage();
     $lastPos = $uriLength - 1;
     $lastLastPos = $uriLength - 2;
     if ($uriLength > 0) {
         $this->displayBreadcrumb($urlArgs[0], $urlArgs);
     }
     if ($uriLength == 0) {
         $adminPage->dashboard();
     } else {
         if ($uriLength == 1) {
             $validPages = array("items", "files", "categories", "tags", "pages");
             if (in_array($urlArgs[$lastPos], $validPages)) {
                 $adminPage->all($urlArgs[$lastPos]);
             } else {
                 if ($urlArgs[$lastPos] == "users") {
                     $adminPage->manageUsers();
                 } else {
                     echo "404";
                 }
             }
         } else {
             if ($uriLength == 2) {
                 if ($urlArgs[$lastLastPos] == "items") {
                     if ($urlArgs[$lastPos] == "add_item") {
                         $adminPage->addItem();
                     } else {
                         $adminPage->editItem($urlArgs[$lastPos]);
                     }
                 } else {
                     if ($urlArgs[$lastLastPos] == "files") {
                         if ($urlArgs[$lastPos] == "add_file") {
                             $adminPage->uploadFile();
                         } else {
                             $adminPage->editFile($urlArgs[$lastPos]);
                         }
                     } else {
                         if ($urlArgs[$lastLastPos] == "categories") {
                             if ($urlArgs[$lastPos] == "add_category") {
                                 $adminPage->addCategory();
                             } else {
                                 $adminPage->editCategory($urlArgs[$lastPos]);
                             }
                         } else {
                             if ($urlArgs[$lastLastPos] == "tags") {
                                 if ($urlArgs[$lastPos] == "add_tag") {
                                     $adminPage->addTag();
                                 } else {
                                     $adminPage->editTag($urlArgs[$lastPos]);
                                 }
                             } else {
                                 if ($urlArgs[$lastLastPos] == "pages") {
                                     if ($urlArgs[$lastPos] == "add_page") {
                                         $adminPage->addPage();
                                     } else {
                                         $adminPage->editPage($urlArgs[$lastPos]);
                                     }
                                 } else {
                                     if ($urlArgs[$lastLastPos] == "users") {
                                         if ($urlArgs[$lastPos] == "add_user") {
                                             $adminPage->addPage();
                                         } else {
                                             $adminPage->userPage($urlArgs[$lastPos]);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }