Example #1
0
 public function showBoard($boardId)
 {
     $board = forum_board::load($boardId);
     /** @var rights_container $rights */
     $rights = iv::get('rights');
     if (!$board->public_read && !$rights->has('forum', $board->id)) {
         throw new Exception('Sie haben keinen Zugriff auf dieses Forum!');
     }
     $flags = $rights->flags('forum', $board->id);
     $board->writable = iv::get('user') && ($board->public_write || $flags['write']);
     $board->subs = $board->getBoards();
     $board->threads = $board->getThreads();
     $this->context['breadcrumb'] = $board->breadcrumb();
     $this->context['boards'] = array($board);
     template('forum/boards')->display($this->context);
 }
Example #2
0
} elseif (!empty($_GET['edit'])) {
    if (!($posting = db()->forum_post->row($_GET['edit'])->assoc())) {
        throw new Exception('Posting not found');
    }
    $thread = forum_thread::load($posting['thread']);
    $board = $thread->loadBoard();
    if ($user->id != $posting['create_by'] || !$user) {
        $board->checkRights('moderate');
    }
    if (!empty($_POST['title']) && !empty($_POST['text'])) {
        db()->forum_post->updateRow(array('title' => $_POST['title'], 'text_raw' => $_POST['text']), $posting['id']);
        throw new redirect(PAGE_SELF . '&thread=' . $thread->id);
    }
    $forumView->edit($posting, $thread);
} elseif (!empty($_GET['create'])) {
    $board = forum_board::load($_GET['create']);
    $board->checkRights('write');
    if (!empty($_POST['title']) && !empty($_POST['text'])) {
        $threadId = $board->write($_POST['title'], $_POST['text']);
        throw new redirect(PAGE_SELF . '&thread=' . $threadId);
    }
    $forumView->createThread($board);
} elseif (!empty($_GET['reply'])) {
    $thread = forum_thread::load($_GET['reply']);
    $board = $thread->loadBoard();
    $board->checkRights('reply');
    if ($thread->closed) {
        $board->checkRights('moderate');
    }
    if (!empty($_POST['title']) && !empty($_POST['text'])) {
        $thread->reply($_POST['title'], $_POST['text']);
Example #3
0
 public function update()
 {
     $data = db()->query("SELECT MAX(id) AS last_post, count(*) AS count_posts FROM forum_post WHERE thread = %d", $this->id)->assoc();
     db()->forum_thread->updateRow($data, $this->id);
     $this->board->update();
 }