public function run() { $site = new SiteController(); switch ($_SERVER["REQUEST_URI"]) { case '/': case '/home': return $site->actionIndex(); break; case '/profile': return $site->actionProfile(); break; case '/login': return $site->actionLogin(); break; case '/signup': return $site->actionSignup(); break; case '/email-unique': return $site->actionEmailUnique(); break; case '/verify-password': return $site->actionVerifyPassword(); break; case '/logout': return $site->actionLogout(); break; case '/400': $error = new ErrorController(400); return $error->actionIndex(); break; case '/403': $error = new ErrorController(403); return $error->actionIndex(); break; default: $error = new ErrorController(404); return $error->actionIndex(); break; } }
$controller = new CommentsController(); $controller->store(); break; case "comment.edit": $controller = new CommentsController(); $controller->edit(); break; case "comment.update": $controller = new CommentsController(); $controller->update(); break; case "comment.destroy": $controller = new CommentsController(); $controller->destroy(); break; //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// default: throw new ModelNotFoundException(); break; } } catch (ModelNotFoundException $e) { $controller = new ErrorController(); $controller->error404(); } catch (InsufficientPrivilegesException $e) { $controller = new ErrorController(); $controller->error401(); } catch (Exception $e) { $controller = new ErrorController(); $controller->error500($e); }
break; case "about": $controller = new AboutController(); $controller->show(); break; case "moviesuggest": $controller = new MovieSuggestController(); $controller->show(); break; case "search": $controller = new SearchController(); $controller->search(); break; case 'downloadposter': $file = "./images/poster/origionals/" . $_GET['filename']; header('Content-Type: application/octet-stream'); header('Content-Transfer-Encoding: Binary'); header('Content-disposition: attachment; filename="' . basename($file) . '"'); readfile($file); break; default: throw new ModelNotFoundException(); break; } } catch (ModelNotFoundException $e) { $controller = new ErrorController(); $controller->error404(); } catch (InsufficentPrivelegesException $e) { $controller = new ErrorController(); $controller->error401(); }