Example #1
0
<?php

try {
    if (!isset($vars['post']) || !isal_num($vars['post'])) {
        header("Location: /");
    }
    $Archive = new Archive();
    $Archive->setId($vars['post']);
    if (!$_SESSION['login']) {
        $Archive->setPublic(1);
    }
    $Comments = new ArchiveComments();
    $Comments->setFilename("/public/Comments/");
    $Comments->setPage($vars['page'], "page");
    $Comments->setPostId($vars['post']);
    $Archive->BuildData();
    $Comments->BuildData();
    //
    if ($_POST['post_submit'] == "true") {
        if (!isset($_SESSION['userid']) && isal_num($_SESSION['userid'])) {
            $error[] = "User ID Session variable is missing";
        }
        if (!isset($vars['post']) && isal_num($vars['post'])) {
            $error[] = "Post ID GET variable is missing";
        }
        if (strlen($_POST['comment']) < 10) {
            $error[] = "Comment must be longer than 10 characters long";
        }
        if (!count($error)) {
            $var = array("user_id" => $_SESSION['userid'], "post_id" => $_POST['post'], "comment" => $_POST['comment']);
            $Comments->Insert($var);
Example #2
0
<?php

try {
    $Archive = new Archive();
    $Archive->setId($vars['id']);
    if (!$_COOKIE['login']) {
        $Archive->setPublic(1);
    }
    $Comments = new ArchiveComments();
    $Comments->setPostId($vars['id']);
    $Comments->setFilename("/admin/PostComments/");
    $Comments->setPage($vars['page'], "page");
    $ArchiveCategories = new ArchiveCategories();
    $Archive->BuildData();
    $Comments->BuildData();
    $ArchiveCategories->BuildData();
    //
    $smarty->assign(array("page_name" => "News&nbsp;:&nbsp;Comment", "load" => "posts/view/post_comments.tpl", "loadindex" => "posts/view/post_index.tpl", "filename" => $Archive->getFilename(), "archive_index" => $Archive->getIndex(), "archiveCategory_index" => $ArchiveCategories->getRecords(), "records" => $Archive->getRecords(), "comment_records" => $Comments->getRecords(), "page_list" => $Comments->getCountDisplay()));
    $smarty->display('admin/body/index.tpl');
} catch (Exception $e) {
    print "Exception: " . $e->getMessage();
}