コード例 #1
0
ファイル: xclams.php プロジェクト: NguyenThanhDung/ntd.vn
const ACTION_POST_COMMENT = 5;
const ACTION_EDIT_COMMENT_FORM = 6;
const ACTION_SUBMIT_EDITED_COMMENT = 7;
const ACTION_DELETE_COMMENT = 8;
session_start();
date_default_timezone_set("Asia/Saigon");
$loggedUser = isset($_SESSION["loggedUser"]) ? $_SESSION["loggedUser"] : false;
$action = isset($_GET["action"]) ? $_GET["action"] : ACTION_NONE;
$includedPage = "list";
$message = false;
$editingXclam = false;
if ($loggedUser) {
    switch ($action) {
        case ACTION_POST_XCLAM:
            if ($loggedUser->GetType() == UserType::ADMIN && isset($_POST["content"])) {
                XclamManager::PostXclam($_POST["content"]);
            }
            break;
        case ACTION_EDIT_XCLAM_FORM:
            if ($loggedUser->GetType() == UserType::ADMIN) {
                $id = isset($_GET["id"]) ? $_GET["id"] : false;
                $editingXclam = XclamManager::GetXclamById($id);
                if ($id && $editingXclam) {
                    $includedPage = "edit_xclam";
                }
            }
            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;