Exemple #1
0
 public function delete_comment($id)
 {
     $ide = new IDE();
     $this->load->model("home_model");
     $comment = $this->home_model->getComment($id);
     if (empty($comment)) {
         $ide->redirect(WEBSITE . "/index.php/home");
     } else {
         if ($ide->isAdmin()) {
             $this->home_model->deleteComment($id);
             $ide->redirect(WEBSITE . "/index.php/home/view/" . $comment[0]['news_id']);
         } else {
             $characters = $this->home_model->getCharacters();
             if (in_array($comment[0]['author'], $characters[0])) {
                 $this->home_model->deleteComment($id);
                 $ide->redirect(WEBSITE . "/index.php/home/view/" . $comment[0]['news_id']);
             } else {
                 $ide->redirect(WEBSITE . "/index.php/home/view/" . $comment[0]['news_id']);
             }
         }
     }
 }
Exemple #2
0
    } else {
        echo error(validation_errors());
        echo form_open(WEBSITE . "/index.php/home/view/" . $id);
        echo "<br /><label>Character</label><select name='character'>";
        foreach ($characters as $character) {
            echo "<option value='" . $character['name'] . "'>" . $character['name'] . "</option>";
        }
        echo "</select><br /><br />";
        echo "<textarea style='width: 99%;' name='body'>" . @$_POST['body'] . "</textarea>";
        echo "<input type='submit' value='Comment'>";
        echo "</form>";
    }
}
echo "<center>" . $pages . "</center>";
foreach ($comments as $comment) {
    if ($ide->isAdmin()) {
        $delete = "<a href='#' onClick=\"if(confirm('Are you sure you want to delete this comment?')) window.location.href='" . WEBSITE . "/index.php/home/delete_comment/" . $comment['id'] . "';\" ><img src='" . WEBSITE . "/public/images/false.gif'></a>";
    } else {
        if ($ide->isLogged()) {
            if (in_array($comment['author'], $characters[0])) {
                $delete = "<a href='#' onClick=\"if(confirm('Are you sure you want to delete this comment?')) window.location.href='" . WEBSITE . "/index.php/home/delete_comment/" . $comment['id'] . "';\" ><img src='" . WEBSITE . "/public/images/false.gif'></a>";
            } else {
                $delete = "";
            }
        } else {
            $delete = "";
        }
    }
    echo "<div class='comment'>";
    echo "<div class='commentBody'>" . $comment['body'] . "</div>";
    echo "<div class='commentFooter'>" . $delete . " Posted on: " . UNIX_TimeStamp($comment['time']) . " by <a href='" . WEBSITE . "/index.php/character/view/" . $comment['author'] . "'>" . $comment['author'] . "</a></div>";
Exemple #3
0
 public function delete_thread($id)
 {
     $ide = new IDE();
     $ide->requireLogin();
     $this->load->model("forum_model");
     $data['thread'] = $this->forum_model->getThreadInfo($id);
     $data['characters'] = $this->forum_model->getCharacters();
     $data['board'] = $this->forum_model->getBoardInfo($data['thread'][0]['board_id']);
     $data['isModerator'] = $this->forum_model->isModerator($data['board'][0]['moderators'], $data['characters']);
     if ($data['isModerator'] == false and $ide->isAdmin() == false) {
         $ide->redirect(WEBSITE . "/index.php/forum");
     }
     $this->forum_model->deleteThread($id);
     $ide->redirect(WEBSITE . "/index.php/forum/board/" . $data['thread'][0]['board_id']);
 }
<?php

require "config.php";
$ide = new IDE();
echo "<h1>Forum boards on " . $config['server_name'] . "</h1>";
echo "<div class='forumHistory'|<a href='" . WEBSITE . "/index.php/forum'>Forum</a> >> <a href='" . WEBSITE . "/index.php/forum/board/" . $board[0]['id'] . "'>" . $board[0]['name'] . "</a> >> <a href='" . WEBSITE . "/index.php/forum/thread/" . $thread[0]['id'] . "'>" . $thread[0]['name'] . "</a></div>";
echo "<div class='boardPages'>" . $pages . "</div>";
if ($board[0]['closed'] != 1) {
    if (!$ide->isLogged()) {
        alert("You need to be logged in to access options.");
    }
}
if ($ide->isLogged()) {
    if ($isModerator or $ide->isAdmin()) {
        echo "<fieldset class='moderatingPanel'>";
        echo "<legend>Moderating panel</legend>";
        echo "<a href='#' onClick=\"if(confirm('Are you sure you want to delete this thread?')) window.location.href='" . WEBSITE . "/index.php/forum/delete_thread/" . $id . "';\">Delete thread</a>";
        echo "</fieldset>";
    }
}
if ($board[0]['closed'] == 1 or $thread[0]['closed'] == 1) {
    echo "<a href='" . WEBSITE . "/index.php/forum/reply/" . $thread[0]['id'] . "'><img style='margin-bottom: -10px;' src='" . WEBSITE . "/public/images/forum/closedReply.png'></a>";
} else {
    echo "<a href='" . WEBSITE . "/index.php/forum/reply/" . $thread[0]['id'] . "'><img style='margin-bottom: -10px;' src='" . WEBSITE . "/public/images/forum/reply.png'></a>";
}
foreach ($posts as $post) {
    echo "<div class='forumPost'>";
    echo "<div class='forumPostDate'>#" . $post['id'] . " &nbsp; &nbsp; Posted on: " . UNIX_TimeStamp($post['time']) . " &nbsp; (" . ago($post['time']) . ")</div>";
    echo "<table width='100%'>";
    echo "<div class='postTitle'>" . $post['title'] . "</div>";
    echo "<td valign='top' class='forumPostLeft' width='15%'>";