function getFullPermalink() { require_once "file_manager.php"; $s = FileManager::getServerPath(); $s .= dirname($_SERVER["PHP_SELF"]); $s .= "/"; $s .= $this->getPermalink(); return $s; }
private static function doPostAction($request) { require_once 'post/PostManager.php'; if (isset(self::$currentID) && self::$currentID != null) { self::$currentObject = PostManager::loadPostByPermalink(self::$currentID); } //echo "<p>" . $request["action"] . "</p>"; //DEBUG switch (self::$requestedAction) { //modifica, vota, commenta, elimina, subscribe o aggiungi a una collezione il post case "Read": //echo "<p><font color='green'>" . $request["permalink"] . "</font></p>"; //DEBUG require_once "post/PostPage.php"; PostPage::showPost(self::$currentObject, self::$post_options); break; case "Edit": //echo "<p><font color='green'>REQUEST TO LOAD " . $request["script"] . " by: " . $author->getNickname() . ", with the title of: " . $request["posttitle"] . ", created the day: " . date("d/m/Y", $request["postday"]) . "</font></p>"; //DEBUG require_once "post/PostPage.php"; PostPage::showEditPostForm(self::$currentObject); break; case "Vote": //echo "<p><font color='green'>REQUEST TO LOAD " . $request["script"] . " by: " . $author->getNickname() . ", with the title of: " . $request["posttitle"] . ", created the day: " . date("d/m/Y", $request["postday"]) . "</font></p>"; //DEBUG require_once "post/PostPage.php"; //controllo su vote. if (isset($_GET["vote"])) { if ($_GET["vote"] == "y" || $_GET["vote"] == "yes") { $vote = true; } if ($_GET["vote"] == "n" || $_GET["vote"] == "no") { $vote = false; } if (!isset($_GET["vote"])) { header("location: " . FileManager::appendToRootPath("error.php?error=Oops, il voto da te inserito non è valido.")); } PostManager::votePost(self::$user->getID(), self::$currentObject, $vote); } PostPage::showPost(self::$currentObject, self::$post_options); break; case "Comment": //echo "<p><font color='green'>REQUEST TO LOAD " . $request["script"] . " by: " . $author->getNickname() . ", with the title of: " . $request["posttitle"] . ", created the day: " . date("d/m/Y", $request["postday"]) . "</font></p>"; //DEBUG require_once "post/PostPage.php"; PostPage::showComments(self::$currentObject); break; case "Delete": //echo "<p><font color='green'>REQUEST TO LOAD " . $request["script"] . " by: " . $author->getNickname() . ", with the title of: " . $request["posttitle"] . ", created the day: " . date("d/m/Y", $request["postday"]) . "</font></p>"; //DEBUG require_once "post/PostPage.php"; PostManager::deletePost(self::$currentObject); header("location: " . FileManager::getServerPath()); break; case "Subscribe": //echo "<p><font color='green'>REQUEST TO LOAD " . $request["script"] . " by: " . $author->getNickname() . ", with the title of: " . $request["posttitle"] . ", created the day: " . date("d/m/Y", $request["postday"]) . "</font></p>"; //DEBUG require_once "post/PostPage.php"; PostPage::showContestForm(self::$currentObject); break; case "AddToCollection": //echo "<p><font color='green'>REQUEST TO LOAD " . $request["script"] . " by: " . $author->getNickname() . ", with the title of: " . $request["posttitle"] . ", created the day: " . date("d/m/Y", $request["postday"]) . "</font></p>"; //DEBUG require_once "post/PostPage.php"; PostPage::showCollectionForm(self::$currentObject); break; case "New": require_once "post/PostPage.php"; PostPage::showNewPostForm(); break; case "Search": default: require_once "search/SearchPage.php"; SearchPage::showPostSearchForm(); break; } }