forumExist() public method

Params: $forum_id (integer) - forum id to check, $group_id (integer) - group id of the user
public forumExist ( $forum_id, $group_id = null )
Ejemplo n.º 1
0
 *  License: MIT
 */
// Set the page name for the active link in navbar
$page = "forum";
$forum = new Forum();
$timeago = new Timeago();
$pagination = new Pagination();
require 'core/includes/paginate.php';
// Get number of topics on a page
if (!isset($_GET['fid']) || !is_numeric($_GET['fid'])) {
    Redirect::to('/forum/error/?error=not_exist');
    die;
}
$fid = (int) $_GET['fid'];
// Does the forum exist, and can the user view it?
$list = $forum->forumExist($fid, $user->data()->group_id);
if (!$list) {
    Redirect::to('/forum/error/?error=not_exist');
    die;
}
// Get page
if (isset($_GET['p'])) {
    if (!is_numeric($_GET['p'])) {
        Redirect::to("/forum");
        die;
    } else {
        if ($_GET['p'] == 1) {
            // Avoid bug in pagination class
            Redirect::to('/forum/view_forum/?fid=' . $fid);
            die;
        }
Ejemplo n.º 2
0
// Set the page name for the active link in navbar
$page = "forum";
// User must be logged in to proceed
if (!$user->isLoggedIn()) {
    Redirect::to('/forum');
    die;
}
$forum = new Forum();
$mentionsParser = new MentionsParser();
if (!isset($_GET['fid']) || !is_numeric($_GET['fid'])) {
    Redirect::to('/forum/error/?error=not_exist');
    die;
}
$fid = (int) $_GET['fid'];
// Does the forum exist, and can the user view it?
$list = $forum->forumExist($fid, $user->data()->group_id);
if (!$list) {
    Redirect::to('/forum/error/?error=not_exist');
    die;
}
// Can the user post a topic in this forum?
$can_reply = $forum->canPostTopic($fid, $user->data()->group_id);
if (!$can_reply) {
    Redirect::to('/forum/view_forum/?fid=' . $fid);
    die;
}
// Deal with any inputted data
if (Input::exists()) {
    if (Token::check(Input::get('token'))) {
        $validate = new Validate();
        $validation = $validate->check($_POST, array('title' => array('required' => true, 'min' => 2, 'max' => 64), 'content' => array('required' => true, 'min' => 2, 'max' => 20480)));