Esempio n. 1
0
 public function get_thread()
 {
     return get_thread_by_id($this->thread);
 }
Esempio n. 2
0
include_once '../../../includes/user.php';
include_once '../../../includes/topic.php';
include_once '../../../includes/thread.php';
include_once '../../../includes/post.php';
include_once '../../../includes/parsedown.php';
include_once '../../../includes/htmlpurifier/HTMLPurifier.auto.php';
session_start();
if (isset($_SESSION['user'])) {
    if (isset($_POST['create-thread'])) {
        if (isset($_GET['id'])) {
            $thread = get_thread_by_id(create_thread($_POST['title'], get_topic_by_id($_GET['id'])));
            $parsedown = new Parsedown();
            $htmlpurifierconfig = HTMLPurifier_Config::createDefault();
            $purifier = new HTMLPurifier($htmlpurifierconfig);
            create_post($thread, $_SESSION['user'], $purifier->purify($parsedown->text($_POST['text'])));
            header("HTTP/1.1 303 See Other");
            header("Location: /forum/thread/?id=" . $thread->get_id());
        } else {
            $thread = get_thread_by_id(create_thread($_POST['title']));
            $htmlpurifierconfig = HTMLPurifier_Config::createDefault();
            $purifier = new HTMLPurifier($htmlpurifierconfig);
            create_post($thread, $_SESSION['user'], $purifier->purify($parsedown->text($_POST['text'])));
            header("HTTP/1.1 303 See Other");
            header("Location: /forum/thread/?id=" . $thread->get_id());
        }
    } else {
        header("HTTP/1.1 400 Bad Request");
    }
} else {
    header("HTTP/1.1 400 Bad Request");
}
Esempio n. 3
0
<html>
  <head>
    <title>Seventh Root - Thread</title>
    <?php 
include '../../includes/stylesheets.php';
?>
  </head>
  <body>
    <div id="main">
      <?php 
include '../../includes/logo.php';
if (isset($_SESSION['user'])) {
    include '../../includes/navigation.php';
} else {
    include '../../includes/navigation_beforelogin.php';
}
$id = NULL;
if (isset($_GET['id'])) {
    $id = $_GET['id'];
}
if ($id !== NULL) {
    echo '<div class="path">' . "\n";
    get_thread_by_id($id)->print_path();
    echo '</div>' . "\n";
    get_thread_by_id($id)->draw();
}
?>
    </div>
  </body>
</html>
Esempio n. 4
0
<?php

include_once '../../../includes/user.php';
include_once '../../../includes/topic.php';
include_once '../../../includes/thread.php';
include_once '../../../includes/post.php';
include_once '../../../includes/parsedown.php';
include_once '../../../includes/htmlpurifier/HTMLPurifier.auto.php';
session_start();
if (isset($_GET['id']) && isset($_POST['post_id']) && isset($_SESSION['user']) && isset($_POST['reply'])) {
    $thread_id = $_GET['id'];
    $post_id = $_POST['post_id'];
    $user = $_SESSION['user'];
    $parsedown = new Parsedown();
    $reply = $parsedown->text($_POST['reply']);
    $htmlpurifierconfig = HTMLPurifier_Config::createDefault();
    $purifier = new HTMLPurifier($htmlpurifierconfig);
    $reply = $purifier->purify($reply);
    create_post(get_thread_by_id($thread_id), $user, $reply, get_post_by_id($post_id));
    header("HTTP/1.1 303 See Other");
    header("Location: /forum/thread/?id=" . $thread_id);
} else {
    header("HTTP/1.1 400 Bad Request");
}
Esempio n. 5
0
    <?php 
include '../../../includes/stylesheets.php';
?>
  </head>
  <body>
    <div id="main">
      <?php 
include '../../../includes/logo.php';
if (isset($_SESSION['user'])) {
    include '../../../includes/navigation.php';
    $post_id = NULL;
    if (isset($_GET['post_id'])) {
        $post_id = $_GET['post_id'];
    }
    $thread_id = NULL;
    if (isset($_GET['thread_id'])) {
        $thread_id = $_GET['thread_id'];
    }
    if ($post_id !== NULL && $thread_id !== NULL) {
        get_thread_by_id($thread_id)->print_path();
        print_reply_form($thread_id, $post_id);
    }
} else {
    include '../../../includes/navigation_beforelogin.php';
    echo 'You may not reply to posts without logging in.';
}
?>
    </div>
  </body>
</html>