Ejemplo n.º 1
0
| Author: Frederick MC Chan (Hien)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once file_exists('maincore.php') ? 'maincore.php' : __DIR__ . "/../../maincore.php";
if (!db_exists(DB_FORUMS)) {
    redirect(BASEDIR . "error.php?code=404");
}
require_once THEMES . "templates/header.php";
if (file_exists(INFUSIONS . "forum/locale/" . LOCALESET . "forum.php")) {
    include INFUSIONS . "forum/locale/" . LOCALESET . "forum.php";
} else {
    include INFUSIONS . "forum/locale/English/forum.php";
}
require_once INFUSIONS . "forum/classes/Forum.php";
require_once INFUSIONS . "forum/classes/Functions.php";
require_once INFUSIONS . "forum/forum_include.php";
include INFUSIONS . "forum/templates/forum_main.php";
include INCLUDES . "infusions_include.php";
$forum_settings = get_settings('forum');
$forum = new PHPFusion\Forums\Forum();
$forum->set_ForumInfo();
$info = $forum->getForumInfo();
render_forum($info);
require_once THEMES . "templates/footer.php";
Ejemplo n.º 2
0
function get_forum($forum_id = 0, $forum_branch = 0)
{
    return PHPFusion\Forums\Forum::get_forum($forum_id, $forum_branch);
}
Ejemplo n.º 3
0
 $thread_data = array('forum_id' => isset($_POST['forum_id']) ? form_sanitizer($_POST['forum_id'], 0, "forum_id") : 0, 'thread_id' => 0, 'thread_subject' => isset($_POST['thread_subject']) ? form_sanitizer($_POST['thread_subject'], '', 'thread_subject') : '', 'thread_author' => $userdata['user_id'], 'thread_views' => 0, 'thread_lastpost' => time(), 'thread_lastpostid' => 0, 'thread_lastuser' => $userdata['user_id'], 'thread_postcount' => 1, 'thread_poll' => 0, 'thread_sticky' => isset($_POST['thread_sticky']) ? TRUE : FALSE, 'thread_locked' => isset($_POST['thread_sticky']) ? TRUE : FALSE, 'thread_hidden' => 0);
 $post_data = array('forum_id' => isset($_POST['forum_id']) ? form_sanitizer($_POST['forum_id'], 0, "forum_id") : 0, "forum_cat" => 0, 'thread_id' => 0, 'post_id' => 0, 'post_message' => isset($_POST['post_message']) ? form_sanitizer($_POST['post_message'], '', 'post_message') : '', 'post_showsig' => isset($_POST['post_showsig']) ? TRUE : FALSE, 'post_smileys' => !isset($_POST['post_smileys']) || isset($_POST['post_message']) && preg_match("#(\\[code\\](.*?)\\[/code\\]|\\[geshi=(.*?)\\](.*?)\\[/geshi\\]|\\[php\\](.*?)\\[/php\\])#si", $_POST['post_message']) ? FALSE : TRUE, 'post_author' => $userdata['user_id'], 'post_datestamp' => time(), 'post_ip' => USER_IP, 'post_ip_type' => USER_IP_TYPE, 'post_edituser' => 0, 'post_edittime' => 0, 'post_editreason' => '', 'post_hidden' => 0, 'notify_me' => isset($_POST['notify_me']) ? TRUE : FALSE, 'post_locked' => 0);
 // go for a new thread posting.
 // check data
 // and validate
 // do not run attach, and do not run poll.
 if (isset($_POST['post_newthread']) && $defender->safe()) {
     require_once INCLUDES . "flood_include.php";
     // all data is sanitized here.
     if (!flood_control("post_datestamp", DB_FORUM_POSTS, "post_author='" . $userdata['user_id'] . "'")) {
         // have notice
         // get the forum data.
         // run permissions for posting
         //
         if (PHPFusion\Forums\Functions::verify_forum($thread_data['forum_id'])) {
             $forum = new PHPFusion\Forums\Forum();
             $forum_data = dbarray(dbquery("SELECT f.*, f2.forum_name AS forum_cat_name\n\t\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n\t\t\t\t\tWHERE f.forum_id='" . intval($thread_data['forum_id']) . "'\n\t\t\t\t\tAND " . groupaccess('f.forum_access') . "\n\t\t\t\t\t"));
             if ($forum_data['forum_type'] == 1) {
                 redirect(INFUSIONS . "forum/index.php");
             }
             define_forum_mods($forum_data);
             // Use the new permission settings
             $forum->setForumPermission($forum_data);
             $permission = $forum->getForumPermission();
             $forum_data['lock_edit'] = $forum_settings['forum_edit_lock'] == 1 ? TRUE : FALSE;
             if ($permission['can_post'] && $permission['can_access']) {
                 $post_data['forum_cat'] = $forum_data['forum_cat'];
                 // create a new thread.
                 dbquery_insert(DB_FORUM_THREADS, $thread_data, 'save', array('primary_key' => 'thread_id', 'keep_session' => TRUE));
                 $post_data['thread_id'] = dblastid();
                 dbquery_insert(DB_FORUM_POSTS, $post_data, 'save', array('primary_key' => 'post_id', 'keep_session' => TRUE));