} else { echo "Error has occured while drop table Comment</p>"; } //********************* // CREATE TABLE //********************* echo "<p>Creating table...</p>"; echo "<p>"; // Create User table if (UserManager::CreateTable()) { echo "Created <b>User</b> table<br/>"; } else { echo "Error has occured while create table User<br/>"; } // Create Xclam table if (XclamManager::CreateTable()) { echo "Created <b>Xclam</b> table<br/>"; } else { echo "Error has occured while create table Xclam<br/>"; } // Create Comment table if (CommentManager::CreateTable()) { echo "Created <b>Comment</b> table<br/>"; } else { echo "Error has occured while create table Comment<br/>"; } echo "</p>"; echo "<p>Finish.</p>"; ?> </body>
<?php $xclams = XclamManager::GetXclams(1); $xclams_count = count($xclams); $comments = array(); for ($i = 0; $i < $xclams_count; $i++) { $comments[$i] = CommentManager::GetComments(EntryType::XCLAM, $xclams[$i]->GetId()); } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Nguyễn Thành Dũng's Website</title> <link rel="stylesheet" type="text/css" href="style/xclams.css"> <link rel="shortcut icon" href="images/icon.png"> </head> <body> <div id="logo"> <a href="index.php"><img alt="Logo" src="images/logo.png"></a> </div> <div id="account"> <?php if ($loggedUser) { echo "<p><b>" . $loggedUser->GetDisplayName() . "</b> | <a href='account.php?action=logout&source=xclams'>Log out</a></p>";
} } break; case ACTION_SUBMIT_EDITED_XCLAM: if ($loggedUser->GetType() == UserType::ADMIN) { $id = isset($_POST["id"]) ? $_POST["id"] : false; $content = isset($_POST["content"]) ? $_POST["content"] : false; if ($id && $content) { XclamManager::UpdateXclam($id, $content); } } break; case ACTION_DELETE_XCLAM: if ($loggedUser->GetType() == UserType::ADMIN) { if (isset($_GET["id"])) { XclamManager::DeleteXclam($_GET["id"]); } } break; case ACTION_POST_COMMENT: $content = isset($_POST["content"]) ? $_POST["content"] : false; $entryId = isset($_POST["entry_id"]) ? $_POST["entry_id"] : false; if ($content && $entryId) { CommentManager::PostComment($loggedUser, $content, EntryType::XCLAM, $entryId); } break; case ACTION_EDIT_COMMENT_FORM: $id = $_GET["id"]; $editingComment = CommentManager::GetCommentById($id); $includedPage = "edit_comment"; break;