Example #1
0
 public function display($id = null, $name = null, $page = null, $pid = null)
 {
     global $lang_common, $lang_post, $lang_topic, $lang_bbeditor, $pd;
     if ($this->user->g_read_board == '0') {
         message($lang_common['No view'], '403');
     }
     // Load the viewtopic.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/topic.php';
     // Load the post.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/post.php';
     // Antispam feature
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/antispam.php';
     $index_questions = rand(0, count($lang_antispam_questions) - 1);
     // BBcode toolbar feature
     require FEATHER_ROOT . 'lang/' . $this->user['language'] . '/bbeditor.php';
     // Load the viewtopic.php model file
     require_once FEATHER_ROOT . 'model/viewtopic.php';
     // Fetch some informations about the topic TODO
     $cur_topic = $this->model->get_info_topic($id);
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_topic['moderators'] != '' ? unserialize($cur_topic['moderators']) : array();
     $is_admmod = $this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false;
     if ($is_admmod) {
         $admin_ids = get_admin_ids();
     }
     // Can we or can we not post replies?
     $post_link = $this->model->get_post_link($id, $cur_topic['closed'], $cur_topic['post_replies'], $is_admmod);
     // Add/update this topic in our list of tracked topics
     if (!$this->user->is_guest) {
         $tracked_topics = get_tracked_topics();
         $tracked_topics['topics'][$id] = time();
         set_tracked_topics($tracked_topics);
     }
     // Determine the post offset (based on $_GET['p'])
     $num_pages = ceil(($cur_topic['num_replies'] + 1) / $this->user->disp_posts);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->user->disp_posts * ($p - 1);
     $url_topic = url_friendly($cur_topic['subject']);
     $url_forum = url_friendly($cur_topic['forum_name']);
     // Generate paging links
     $paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'topic/' . $id . '/' . $url_topic . '/#');
     if ($this->config['o_censoring'] == '1') {
         $cur_topic['subject'] = censor_words($cur_topic['subject']);
     }
     $quickpost = $this->model->is_quickpost($cur_topic['post_replies'], $cur_topic['closed'], $is_admmod);
     $subscraction = $this->model->get_subscraction($cur_topic['is_subscribed'], $id);
     // Add relationship meta tags
     $page_head = $this->model->get_page_head($id, $num_pages, $p, $url_topic);
     $page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_topic['forum_name']), feather_escape($cur_topic['subject']));
     define('FEATHER_ALLOW_INDEX', 1);
     define('FEATHER_ACTIVE_PAGE', 'viewtopic');
     $this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->setPageHead($page_head)->display();
     $forum_id = $cur_topic['forum_id'];
     require FEATHER_ROOT . 'include/parser.php';
     $this->feather->render('viewtopic.php', array('id' => $id, 'p' => $p, 'post_data' => $this->model->print_posts($id, $start_from, $cur_topic, $is_admmod), 'lang_common' => $lang_common, 'lang_topic' => $lang_topic, 'lang_post' => $lang_post, 'lang_bbeditor' => $lang_bbeditor, 'cur_topic' => $cur_topic, 'subscraction' => $subscraction, 'is_admmod' => $is_admmod, 'feather_config' => $this->config, 'paging_links' => $paging_links, 'post_link' => $post_link, 'start_from' => $start_from, 'lang_antispam' => $lang_antispam, 'pid' => $pid, 'quickpost' => $quickpost, 'index_questions' => $index_questions, 'lang_antispam_questions' => $lang_antispam_questions, 'url_forum' => $url_forum, 'url_topic' => $url_topic, 'feather' => $this->feather));
     // Increment "num_views" for topic
     $this->model->increment_views($id);
     $this->footer->display('viewtopic', $id, $p, $pid, $cur_topic['forum_id'], $num_pages);
 }
Example #2
0
function generate_quickjump_cache($group_id = false)
{
    global $lang_common;
    $groups = array();
    // If a group_id was supplied, we generate the quick jump cache for that group only
    if ($group_id !== false) {
        // Is this group even allowed to read forums?
        $read_board = \DB::for_table('groups')->where('g_id', $group_id)->find_one_col('g_read_board');
        $groups[$group_id] = $read_board;
    } else {
        // A group_id was not supplied, so we generate the quick jump cache for all groups
        $select_quickjump_all_groups = array('g_id', 'g_read_board');
        $result = \DB::for_table('groups')->select_many($select_quickjump_all_groups)->find_many();
        foreach ($result as $row) {
            $groups[$row['g_id']] = $row['g_read_board'];
        }
    }
    // Loop through the groups in $groups and output the cache for each of them
    foreach ($groups as $group_id => $read_board) {
        // Output quick jump as PHP code
        $output = '<?php' . "\n\n" . 'if (!defined(\'FEATHER\')) exit;' . "\n" . 'define(\'FEATHER_QJ_LOADED\', 1);' . "\n" . '$forum_id = isset($forum_id) ? $forum_id : 0;' . "\n\n" . '?>';
        if ($read_board == '1') {
            $select_generate_quickjump_cache = array('cid' => 'c.id', 'c.cat_name', 'fid' => 'f.id', 'f.forum_name', 'f.redirect_url');
            $where_generate_quickjump_cache = array(array('fp.read_forum' => 'IS NULL'), array('fp.read_forum' => '1'));
            $order_by_generate_quickjump_cache = array('c.disp_position', 'c.id', 'f.disp_position');
            $result = \DB::for_table('categories')->table_alias('c')->select_many($select_generate_quickjump_cache)->inner_join('forums', array('c.id', '=', 'f.cat_id'), 'f')->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')->left_outer_join('forum_perms', array('fp.group_id', '=', $group_id), null, true)->where_any_is($where_generate_quickjump_cache)->where_null('f.redirect_url')->order_by_many($order_by_generate_quickjump_cache)->find_many();
            if ($result) {
                $output .= "\t\t\t\t" . '<form id="qjump" method="get" action="">' . "\n\t\t\t\t\t" . '<div><label><span><?php echo $lang_common[\'Jump to\'] ?>' . '<br /></span>' . "\n\t\t\t\t\t" . '<select name="id" onchange="window.location=(\'' . get_link('forum/') . '\'+this.options[this.selectedIndex].value)">' . "\n";
                $cur_category = 0;
                foreach ($result as $cur_forum) {
                    if ($cur_forum['cid'] != $cur_category) {
                        // A new category since last iteration?
                        if ($cur_category) {
                            $output .= "\t\t\t\t\t\t" . '</optgroup>' . "\n";
                        }
                        $output .= "\t\t\t\t\t\t" . '<optgroup label="' . feather_escape($cur_forum['cat_name']) . '">' . "\n";
                        $cur_category = $cur_forum['cid'];
                    }
                    $redirect_tag = $cur_forum['redirect_url'] != '' ? ' &gt;&gt;&gt;' : '';
                    $output .= "\t\t\t\t\t\t\t" . '<option value="' . $cur_forum['fid'] . '/' . url_friendly($cur_forum['forum_name']) . '/' . '"<?php echo ($forum_id == ' . $cur_forum['fid'] . ') ? \' selected="selected"\' : \'\' ?>>' . feather_escape($cur_forum['forum_name']) . $redirect_tag . '</option>' . "\n";
                }
                $output .= "\t\t\t\t\t\t" . '</optgroup>' . "\n\t\t\t\t\t" . '</select></label>' . "\n\t\t\t\t\t" . '<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />' . "\n\t\t\t\t\t" . '</div>' . "\n\t\t\t\t" . '</form>' . "\n";
            }
        }
        featherbb_write_cache_file('cache_quickjump_' . $group_id . '.php', $output);
    }
}
Example #3
0
 public function display($id, $name = null, $page = null)
 {
     global $lang_common, $lang_forum;
     if ($this->user->g_read_board == '0') {
         message($lang_common['No view'], '403');
     }
     if ($id < 1) {
         message($lang_common['Bad request'], '404');
     }
     // Load the viewforum.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/forum.php';
     // Fetch some informations about the forum
     $cur_forum = $this->model->get_info_forum($id);
     // Is this a redirect forum? In that case, redirect!
     if ($cur_forum['redirect_url'] != '') {
         header('Location: ' . $cur_forum['redirect_url']);
         exit;
     }
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
     $is_admmod = $this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false;
     $sort_by = $this->model->sort_forum_by($cur_forum['sort_by']);
     // Can we or can we not post new topics?
     if ($cur_forum['post_topics'] == '' && $this->user->g_post_topics == '1' || $cur_forum['post_topics'] == '1' || $is_admmod) {
         $post_link = "\t\t\t" . '<p class="postlink conr"><a href="' . get_link('post/new-topic/' . $id . '/') . '">' . $lang_forum['Post topic'] . '</a></p>' . "\n";
     } else {
         $post_link = '';
     }
     // Determine the topic offset (based on $page)
     $num_pages = ceil($cur_forum['num_topics'] / $this->user->disp_topics);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->user->disp_topics * ($p - 1);
     $url_forum = url_friendly($cur_forum['forum_name']);
     // Generate paging links
     $paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'forum/' . $id . '/' . $url_forum . '/#');
     $forum_actions = $this->model->get_forum_actions($id, $this->config['o_forum_subscriptions'], $cur_forum['is_subscribed']);
     $page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_forum['forum_name']));
     define('FEATHER_ALLOW_INDEX', 1);
     define('FEATHER_ACTIVE_PAGE', 'viewforum');
     $page_head = $this->model->get_page_head($id, $num_pages, $p, $url_forum);
     $this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->setPageHead($page_head)->display();
     $this->feather->render('viewforum.php', array('id' => $id, 'forum_data' => $this->model->print_topics($id, $sort_by, $start_from), 'lang_common' => $lang_common, 'lang_forum' => $lang_forum, 'cur_forum' => $cur_forum, 'paging_links' => $paging_links, 'post_link' => $post_link, 'is_admmod' => $is_admmod, 'start_from' => $start_from, 'url_forum' => $url_forum, 'forum_actions' => $forum_actions));
     $this->footer->display('viewforum', $id, $p, '', $id, $num_pages);
 }
Example #4
0
 public function display($id, $name = null, $page = null)
 {
     global $lang_common, $lang_forum, $lang_misc;
     if ($this->user->g_read_board == '0') {
         message($lang_common['No view'], '403');
     }
     // Load the viewforum.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/forum.php';
     // Load the misc.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/misc.php';
     // Make sure that only admmods allowed access this page
     $moderators = $this->model->get_moderators($id);
     $mods_array = $moderators != '' ? unserialize($moderators) : array();
     if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
         message($lang_common['No permission'], '403');
     }
     // Fetch some info about the forum
     $cur_forum = $this->model->get_forum_info($id);
     // Is this a redirect forum? In that case, abort!
     if ($cur_forum['redirect_url'] != '') {
         message($lang_common['Bad request'], '404');
     }
     $sort_by = $this->model->forum_sort_by($cur_forum['sort_by']);
     // Determine the topic offset (based on $_GET['p'])
     $num_pages = ceil($cur_forum['num_topics'] / $this->user->disp_topics);
     $p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
     $start_from = $this->user->disp_topics * ($p - 1);
     $url_forum = url_friendly($cur_forum['forum_name']);
     // Generate paging links
     $paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'moderate/forum/' . $id . '/#');
     $page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_forum['forum_name']));
     define('FEATHER_ACTIVE_PAGE', 'moderate');
     $this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->display();
     $this->feather->render('moderate/moderator_forum.php', array('lang_common' => $lang_common, 'lang_misc' => $lang_misc, 'id' => $id, 'p' => $p, 'url_forum' => $url_forum, 'cur_forum' => $cur_forum, 'paging_links' => $paging_links, 'feather_config' => $this->config, 'lang_forum' => $lang_forum, 'topic_data' => $this->model->display_topics($id, $sort_by, $start_from), 'start_from' => $start_from));
     $this->footer->display();
 }
Example #5
0
            $db->update('topics', $update, 'id=:id', $data);
            ($hook = get_extensions('delete_poll_after_deletion')) ? eval($hook) : null;
            redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll deleted redirect']);
        }
        ($hook = get_extensions('delete_poll_before_header')) ? eval($hook) : null;
        $page_title = array($panther_config['o_board_title'], $lang_poll['Delete poll']);
        define('PANTHER_ACTIVE_PAGE', 'index');
        require PANTHER_ROOT . 'header.php';
        $tpl = load_template('delete_poll.tpl');
        echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_delete'], array($id)), 'csrf_token' => generate_csrf_token()));
    } else {
        if (isset($_GET['reset'])) {
            if (isset($_POST['form_sent'])) {
                confirm_referrer('poll_misc.php');
                $update = array('voters' => '', 'votes' => '');
                $data = array(':id' => $cur_topic['pid']);
                $db->update('polls', $update, 'id=:id', $data);
                redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll reset redirect']);
            }
            $page_title = array($panther_config['o_board_title'], $lang_poll['Reset poll']);
            define('PANTHER_ACTIVE_PAGE', 'index');
            require PANTHER_ROOT . 'header.php';
            ($hook = get_extensions('reset_poll_before_display')) ? eval($hook) : null;
            $tpl = load_template('reset_poll.tpl');
            echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_reset'], array($id)), 'csrf_token' => generate_csrf_token()));
        } else {
            message($lang_common['Bad request']);
        }
    }
}
require PANTHER_ROOT . 'footer.php';
Example #6
0
        $results = array();
        foreach ($search_set as $cur_search) {
            if ($panther_config['o_censoring'] == '1') {
                $cur_search['subject'] = censor_words($cur_search['subject']);
            }
            if ($show_as == 'posts') {
                ++$post_count;
                if ($panther_config['o_censoring'] == '1') {
                    $cur_search['message'] = censor_words($cur_search['message']);
                }
                $results[] = array('pid' => $cur_search, 'message' => $parser->parse_message($cur_search['message'], $cur_search['hide_smilies']), 'posted' => format_time($cur_search['pposted']), 'topic_url' => panther_link($panther_url['topic'], array($cur_search['tid'], url_friendly($cur_search['subject']))), 'post_url' => panther_link($panther_url['post'], array($cur_search['pid'])), 'post_no' => $start_from + $post_count, 'post_count' => $post_count, 'forum' => array('url' => panther_link($panther_url['forum'], array($cur_search['forum_id'], url_friendly($cur_search['forum_name']))), 'name' => $cur_search['forum_name']), 'subject' => $cur_search['subject'], 'poster' => $cur_search['poster_id'] > 1 ? colourize_group($cur_search['pposter'], $cur_search['group_id'], $cur_search['poster_id']) : '', 'post_id' => $cur_search['pid'], 'first_post_id' => $cur_search['first_post_id'], 'num_replies' => forum_number_format($cur_search['num_replies']), 'viewed' => !$panther_user['is_guest'] && $cur_search['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']) ? false : true);
            } else {
                ++$topic_count;
                $url_subject = url_friendly($cur_search['subject']);
                $num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $panther_user['disp_posts']);
                $results[$cur_search['tid']] = array('count' => ++$topic_count, 'topic_count' => forum_number_format($topic_count + $start_from), 'cur_search' => $cur_search, 'topic_poster' => $cur_search['up_id'] > 1 ? colourize_group($cur_search['poster'], $cur_search['up_group_id'], $cur_search['up_id']) : colourize_group($cur_search['poster'], PANTHER_GUEST), 'subject' => $cur_search['subject'], 'sticky' => $cur_search['sticky'], 'closed' => $cur_search['closed'], 'question' => $cur_search['question'], 'topic_link' => panther_link($panther_url['topic'], array($cur_search['tid'], $url_subject)), 'num_pages' => $num_pages_topic, 'pagination' => paginate($num_pages_topic, -1, $panther_url['topic_paginate'], array($cur_search['tid'], $url_subject)), 'new' => !$panther_user['is_guest'] && $cur_search['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']) ? '1' : '0', 'last_post_avatar' => generate_avatar_markup($cur_search['uid'], $cur_search['email'], $cur_search['use_gravatar'], array(32, 32)), 'last_post_link' => panther_link($panther_url['post'], array($cur_search['last_post_id'])), 'last_post' => format_time($cur_search['last_post']), 'last_poster' => $cur_search['uid'] > 1 ? colourize_group($cur_search['last_poster'], $cur_search['group_id'], $cur_search['uid']) : colourize_group($cur_search['last_poster'], PANTHER_GUEST), 'num_replies' => forum_number_format($cur_search['num_replies']), 'forum' => array('url' => panther_link($panther_url['forum'], array($cur_search['forum_id'], url_friendly($cur_search['forum_name']))), 'name' => $cur_search['forum_name']));
                if ($results[$cur_search['tid']]['new'] == '1') {
                    $results[$cur_search['tid']]['new_link'] = panther_link($panther_url['topic_new_posts'], array($cur_search['tid'], $url_subject));
                }
            }
        }
        $tpl = load_template('search_results.tpl');
        echo $tpl->render(array('forum_actions' => $forum_actions, 'index_link' => panther_link($panther_url['index']), 'lang_common' => $lang_common, 'search_link' => panther_link($panther_url['search']), 'show_as' => $show_as, 'lang_search' => $lang_search, 'lang_topic' => $lang_topic, 'lang_forum' => $lang_forum, 'pagination' => paginate($num_pages, $p, $panther_url['search_pagination'], array($search_id)), 'crumbs_text' => $crumbs_text, 'results' => $results, 'panther_config' => $panther_config));
        require PANTHER_ROOT . 'footer.php';
    } else {
        message($lang_search['No hits']);
    }
}
($hook = get_extensions('search_form_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $lang_search['Search']);
$focus_element = array('search', 'keywords');
Example #7
0
            //Reporting now made fun =)
            if (!stopforumspam_report($panther_config['o_sfs_api'], $cur_post['poster_ip'], $email, $cur_post['poster'], $cur_post['message'])) {
                message($lang_common['Unable to add spam data']);
            }
        }
    }
    if ($is_topic_post) {
        // Delete the topic and all of its posts
        delete_topic($cur_post['tid']);
        update_forum($cur_post['fid']);
        ($hook = get_extensions('delete_after_delete')) ? eval($hook) : null;
        redirect(panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), $lang_delete['Topic del redirect']);
    } else {
        // Delete just this one post
        delete_post($id, $cur_post['tid']);
        update_forum($cur_post['fid']);
        // Redirect towards the previous post
        $data = array(':tid' => $cur_post['tid'], ':id' => $id);
        $ps = $db->select('posts', 'id', $data, 'topic_id=:tid AND id < :id', 'id DESC LIMIT 1');
        $post_id = $ps->fetchColumn();
        ($hook = get_extensions('delete_after_delete')) ? eval($hook) : null;
        redirect(panther_link($panther_url['post'], array($post_id)), $lang_delete['Post del redirect']);
    }
}
require PANTHER_ROOT . 'include/parser.php';
$page_title = array($panther_config['o_board_title'], $lang_delete['Delete post']);
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$tpl = load_template('delete.tpl');
echo $tpl->render(array('lang_common' => $lang_common, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), 'post_link' => panther_link($panther_url['post'], array($id)), 'cur_post' => $cur_post, 'lang_delete' => $lang_delete, 'form_action' => panther_link($panther_url['delete'], array($id)), 'csrf_token' => generate_csrf_token(), 'is_topic_post' => $is_topic_post, 'posted' => format_time($cur_post['posted']), 'is_admmod' => $is_admmod, 'panther_config' => $panther_config, 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies'])));
require PANTHER_ROOT . 'footer.php';
Example #8
0
    foreach ($ps as $attachment) {
        $attachments[] = array('id' => $attachment['id'], 'icon' => attach_icon($attachment['extension']), 'link' => panther_link($panther_url['attachment'], array($attachment['id'])), 'name' => $attachment['filename'], 'size' => sprintf($lang_post['Attachment size'], file_size($attachment['size'])), 'downloads' => sprintf($lang_post['Attachment downloads'], forum_number_format($attachment['downloads'])));
    }
}
($hook = get_extensions('edit_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $lang_post['Edit post']);
$required_fields = array('req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
$focus_element = array('edit', 'req_message');
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$checkboxes = array();
if ($can_edit_subject && $is_admmod) {
    $checkboxes[] = array('name' => 'stick_topic', 'title' => $lang_common['Stick topic'], 'checked' => isset($_POST['form_sent']) && isset($_POST['stick_topic']) || !isset($_POST['form_sent']) && $cur_post['sticky'] == '1' ? true : false);
}
if ($can_edit_subject && $cur_post['post_polls'] != '0' && $panther_user['g_post_polls'] == '1' && $panther_config['o_polls'] == '1') {
    $checkboxes[] = array('name' => 'add_poll', 'title' => $lang_post['Add poll'], 'checked' => isset($_POST['add_poll']) ? true : false);
}
if ($panther_config['o_smilies'] == '1') {
    $checkboxes[] = array('name' => 'hide_smilies', 'title' => $lang_post['Hide smilies'], 'checked' => isset($_POST['form_sent']) && isset($_POST['hide_smilies']) || !isset($_POST['form_sent']) && $cur_post['hide_smilies'] == '1' ? true : false);
}
if ($is_admmod) {
    $checkboxes[] = array('id' => 'silent_edit', 'name' => 'silent', 'title' => $lang_post['Silent edit'], 'checked' => isset($_POST['form_sent']) && isset($_POST['silent']) || !isset($_POST['form_sent']) ? true : false);
}
$render = array('errors' => $errors, 'lang_post' => $lang_post, 'lang_common' => $lang_common, 'preview' => isset($_POST['preview']) ? true : false, 'can_edit_subject' => $can_edit_subject, 'subject' => isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject'], 'can_upload' => $can_upload, 'can_delete' => $can_delete, 'panther_user' => $panther_user, 'max_size' => $max_size, 'attachments' => $attachments, 'is_admmod' => $is_admmod, 'edit_reason' => isset($_POST['edit_reason']) ? $_POST['edit_reason'] : $cur_post['edit_reason'], 'checkboxes' => $checkboxes, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), 'cur_post' => $cur_post, 'topic_link' => panther_link($panther_url['topic'], array($cur_post['tid'], url_friendly($cur_post['subject']))), 'form_action' => panther_link($panther_url['edit_edit'], array($id)), 'csrf_token' => generate_csrf_token(), 'message' => isset($_POST['req_message']) ? $message : $cur_post['message'], 'panther_config' => $panther_config, 'quickpost_links' => array('form_action' => panther_link($panther_url['new_reply'], array($id)), 'csrf_token' => generate_csrf_token('post.php'), 'bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies'))));
if (isset($_POST['preview'])) {
    require_once PANTHER_ROOT . 'include/parser.php';
    $render['preview'] = $parser->parse_message($message, $hide_smilies);
}
$tpl = load_template('edit.tpl');
echo $tpl->render($render);
require PANTHER_ROOT . 'footer.php';
Example #9
0
            $ps = $db->select('topics', 'num_replies', $topic_data, 'id=:id');
            $num_replies = $ps->fetchColumn();
            $update = array('num_replies' => $num_replies + 1, 'last_post' => $posted, 'last_post_id' => $last_id, 'last_poster' => $poster);
            $db->update('topics', $update, 'id=:id', $topic_data);
            update_search_index('post', $post_id, $post['message']);
            update_forum($post['forum_id']);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post approved redirect']);
        }
    } else {
        if ($is_topic_post) {
            permanently_delete_topic($post['topic_id']);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Topic deleted redirect']);
        } else {
            permanently_delete_post($post_id);
            redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post deleted redirect']);
        }
    }
}
$ps = $db->run('SELECT t.id AS topic_id, t.forum_id, p.poster, p.poster_id, p.posted, p.message, p.id AS pid, p.hide_smilies, t.subject, f.forum_name FROM ' . $db->prefix . 'posts AS p LEFT JOIN ' . $db->prefix . 'topics AS t ON p.topic_id=t.id LEFT JOIN ' . $db->prefix . 'forums AS f ON t.forum_id=f.id WHERE p.deleted=1 OR t.deleted=1 ORDER BY p.posted DESC');
require PANTHER_ROOT . 'include/parser.php';
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Deleted']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('deleted');
$posts = array();
foreach ($ps as $cur_post) {
    $posts[] = array('id' => $cur_post['pid'], 'posted' => format_time($cur_post['posted']), 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']), 'poster' => $cur_post['poster'] != '' ? array('href' => panther_link($panther_url['profile'], array($cur_post['poster_id'], url_friendly($cur_post['poster']))), 'poster' => $cur_post['poster']) : '', 'forum' => $cur_post['forum_name'] != '' ? array('href' => panther_link($panther_url['forum'], array($cur_post['forum_id'], url_friendly($cur_post['forum_name']))), 'forum_name' => $cur_post['forum_name']) : '', 'topic' => $cur_post['subject'] != '' ? array('href' => panther_link($panther_url['topic'], array($cur_post['topic_id'], url_friendly($cur_post['subject']))), 'subject' => $cur_post['subject']) : '', 'post' => $cur_post['pid'] != '' ? array('href' => panther_link($panther_url['post'], array($cur_post['pid'])), 'post' => sprintf($lang_admin_deleted['Post ID'], $cur_post['pid'])) : '');
}
$tpl = load_template('admin_deleted.tpl');
echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_deleted' => $lang_admin_deleted, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_deleted']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/deleted.php'), 'posts' => $posts));
require PANTHER_ROOT . 'footer.php';
Example #10
0
         $db->insert('announcements', $insert);
         $id = $db->lastInsertId($db->prefix . 'announcements');
         $redirect_msg = $lang_admin_announcements['added redirect'];
     } else {
         if ($id < 1) {
             message($lang_common['Bad request']);
         }
         $data = array(':id' => $id);
         $db->update('announcements', $insert, 'id=:id', $data);
         $redirect_msg = $lang_admin_announcements['edit redirect'];
     }
     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
         require PANTHER_ROOT . 'include/cache.php';
     }
     generate_announcements_cache();
     redirect(panther_link($panther_url['announcement_fid'], array($id, $forums[0], url_friendly($title))), $redirect_msg);
 } else {
     if ($action == 'delete') {
         $id = isset($_POST['id']) ? intval($_POST['id']) : 0;
         if ($id < 1) {
             message($lang_common['Bad request']);
         }
         $data = array(':id' => $id);
         $db->delete('announcements', 'id=:id', $data);
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require PANTHER_ROOT . 'include/cache.php';
         }
         redirect(panther_link($panther_url['admin_announcements']), $lang_admin_announcements['delete redirect']);
     } else {
         message($lang_common['Bad request']);
     }
Example #11
0
 * License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
 */
if (!defined('PANTHER')) {
    define('PANTHER_ROOT', __DIR__ . '/');
    require PANTHER_ROOT . 'include/common.php';
}
if ($panther_user['g_read_board'] == '0') {
    message($lang_common['No view'], false, '403 Forbidden');
}
// Load the help.php language file
require PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/help.php';
$page_title = array($panther_config['o_board_title'], $lang_help['Help']);
define('PANTHER_ACTIVE_PAGE', 'help');
require PANTHER_ROOT . 'header.php';
// Display the smiley set
require PANTHER_ROOT . 'include/parser.php';
$smiley_groups = array();
foreach ($parser->smilies as $smiley_text => $smiley_img) {
    $smiley_groups[$smiley_img][] = $smiley_text;
}
($hook = get_extensions('help_before_display')) ? eval($hook) : null;
$ps = $db->select('topics', 'subject, id', array(), '', 'id ASC LIMIT 1');
$cur_topic = $ps->fetch();
$ps = $db->select('posts', 'id', array(), '', 'id ASC LIMIT 1');
$cur_post = $ps->fetchColumn();
$ps = $db->select('users', 'id, username, group_id', array(), 'id>1', 'id ASC LIMIT 1');
$user = $ps->fetch();
$forum = $panther_forums[key($panther_forums)];
$tpl = load_template('help.tpl');
echo $tpl->render(array('lang_help' => $lang_help, 'panther_config' => $panther_config, 'lang_common' => $lang_common, 'base_url' => panther_link($panther_url['index']), 'help_page' => panther_link($panther_url['help'], array('url')), 'topic_link' => panther_link($panther_url['topic'], array($cur_topic['id'], url_friendly($cur_topic['subject']))), 'topic_id' => $cur_topic['id'], 'post_id' => $cur_post, 'post_link' => panther_link($panther_url['post'], array($cur_post)), 'forum_id' => $forum['id'], 'forum_link' => panther_link($panther_url['forum'], array($forum['id'], url_friendly($forum['forum_name']))), 'formatted_username' => colourize_group($user['username'], $user['group_id'], $user['id']), 'username' => $user['username'], 'smiley_path' => $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_dir'] : get_base_url() . '/' . $panther_config['o_smilies_path'] . '/', 'smiley_groups' => $smiley_groups));
$db->end_transaction();
Example #12
0
 public function display_search_results($search)
 {
     global $lang_forum, $lang_common, $lang_topic, $lang_search, $pd;
     // Get topic/forum tracking data
     if (!$this->user->is_guest) {
         $tracked_topics = get_tracked_topics();
     }
     $post_count = $topic_count = 0;
     foreach ($search['search_set'] as $cur_search) {
         $forum = '<a href="' . get_link('forum/' . $cur_search['forum_id'] . '/' . url_friendly($cur_search['forum_name']) . '/') . '">' . feather_escape($cur_search['forum_name']) . '</a>';
         $url_topic = url_friendly($cur_search['subject']);
         if ($this->config['o_censoring'] == '1') {
             $cur_search['subject'] = censor_words($cur_search['subject']);
         }
         if ($search['show_as'] == 'posts') {
             ++$post_count;
             $cur_search['icon_type'] = 'icon';
             if (!$this->user->is_guest && $cur_search['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post'])) {
                 $cur_search['item_status'] = 'inew';
                 $cur_search['icon_type'] = 'icon icon-new';
                 $cur_search['icon_text'] = $lang_topic['New icon'];
             } else {
                 $cur_search['item_status'] = '';
                 $cur_search['icon_text'] = '<!-- -->';
             }
             if ($this->config['o_censoring'] == '1') {
                 $cur_search['message'] = censor_words($cur_search['message']);
             }
             $cur_search['message'] = parse_message($cur_search['message'], $cur_search['hide_smilies']);
             $pposter = feather_escape($cur_search['pposter']);
             if ($cur_search['poster_id'] > 1 && $this->user->g_view_users == '1') {
                 $cur_search['pposter_disp'] = '<strong><a href="' . get_link('user/' . $cur_search['poster_id'] . '/') . '">' . $pposter . '</a></strong>';
             } else {
                 $cur_search['pposter_disp'] = '<strong>' . $pposter . '</strong>';
             }
             $this->feather->render('search/posts.php', array('post_count' => $post_count, 'url_topic' => $url_topic, 'cur_search' => $cur_search, 'forum' => $forum, 'lang_common' => $lang_common, 'lang_search' => $lang_search, 'lang_topic' => $lang_topic));
         } else {
             ++$topic_count;
             $status_text = array();
             $cur_search['item_status'] = $topic_count % 2 == 0 ? 'roweven' : 'rowodd';
             $cur_search['icon_type'] = 'icon';
             $subject = '<a href="' . get_link('topic/' . $cur_search['tid'] . '/' . $url_topic . '/') . '">' . feather_escape($cur_search['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_search['poster']) . '</span>';
             if ($cur_search['sticky'] == '1') {
                 $cur_search['item_status'] .= ' isticky';
                 $status_text[] = '<span class="stickytext">' . $lang_forum['Sticky'] . '</span>';
             }
             if ($cur_search['closed'] != '0') {
                 $status_text[] = '<span class="closedtext">' . $lang_forum['Closed'] . '</span>';
                 $cur_search['item_status'] .= ' iclosed';
             }
             if (!$this->user->is_guest && $cur_search['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post'])) {
                 $cur_search['item_status'] .= ' inew';
                 $cur_search['icon_type'] = 'icon icon-new';
                 $subject = '<strong>' . $subject . '</strong>';
                 $subject_new_posts = '<span class="newtext">[ <a href="' . get_link('topic/' . $cur_search['tid'] . '/action/new/') . '" title="' . $lang_common['New posts info'] . '">' . $lang_common['New posts'] . '</a> ]</span>';
             } else {
                 $subject_new_posts = null;
             }
             // Insert the status text before the subject
             $subject = implode(' ', $status_text) . ' ' . $subject;
             $num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $this->user->disp_posts);
             if ($num_pages_topic > 1) {
                 $subject_multipage = '<span class="pagestext">[ ' . paginate($num_pages_topic, -1, 'topic/' . $cur_search['tid'] . '/' . $url_topic . '/#') . ' ]</span>';
             } else {
                 $subject_multipage = null;
             }
             // Should we show the "New posts" and/or the multipage links?
             if (!empty($subject_new_posts) || !empty($subject_multipage)) {
                 $subject .= !empty($subject_new_posts) ? ' ' . $subject_new_posts : '';
                 $subject .= !empty($subject_multipage) ? ' ' . $subject_multipage : '';
             }
             if (!isset($cur_search['start_from'])) {
                 $start_from = 0;
             } else {
                 $start_from = $cur_search['start_from'];
             }
             $this->feather->render('search/topics.php', array('cur_search' => $cur_search, 'start_from' => $start_from, 'topic_count' => $topic_count, 'subject' => $subject, 'forum' => $forum, 'lang_common' => $lang_common));
         }
     }
 }
Example #13
0
 public function check_errors_before_post($fid, $tid, $qid, $pid, $page, $errors)
 {
     global $lang_post, $lang_common, $lang_prof_reg, $lang_register, $lang_antispam, $lang_antispam_questions, $pd;
     // Antispam feature
     if ($this->user->is_guest) {
         // It's a guest, so we have to validate the username
         $errors = check_username(feather_trim($this->request->post('req_username')), $errors);
         $question = $this->request->post('captcha_q') ? trim($this->request->post('captcha_q')) : '';
         $answer = $this->request->post('captcha') ? strtoupper(trim($this->request->post('captcha'))) : '';
         $lang_antispam_questions_array = array();
         foreach ($lang_antispam_questions as $k => $v) {
             $lang_antispam_questions_array[md5($k)] = strtoupper($v);
         }
         if (empty($lang_antispam_questions_array[$question]) || $lang_antispam_questions_array[$question] != $answer) {
             $errors[] = $lang_antispam['Robot test fail'];
         }
     }
     // Flood protection
     if ($this->request->post('preview') != '' && $this->user->last_post != '' && time() - $this->user->last_post < $this->user->g_post_flood) {
         $errors[] = sprintf($lang_post['Flood start'], $this->user->g_post_flood, $this->user->g_post_flood - (time() - $this->user->last_post));
     }
     if ($tid) {
         $subject_tid = DB::for_table('topics')->where('id', $tid)->find_one_col('subject');
         if (!$subject_tid) {
             message($lang_common['Bad request'], '404');
         }
         $url_subject = url_friendly($subject_tid);
     } else {
         $url_subject = '';
     }
     // If it's a new topic
     if ($fid) {
         $subject = feather_trim($this->request->post('req_subject'));
         if ($this->config['o_censoring'] == '1') {
             $censored_subject = feather_trim(censor_words($subject));
         }
         if ($subject == '') {
             $errors[] = $lang_post['No subject'];
         } elseif ($this->config['o_censoring'] == '1' && $censored_subject == '') {
             $errors[] = $lang_post['No subject after censoring'];
         } elseif (feather_strlen($subject) > 70) {
             $errors[] = $lang_post['Too long subject'];
         } elseif ($this->config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$this->user->is_admmod) {
             $errors[] = $lang_post['All caps subject'];
         }
     }
     if ($this->user->is_guest) {
         $email = strtolower(feather_trim($this->config['p_force_guest_email'] == '1' ? $this->request->post('req_email') : $this->request->post('email')));
         // Load the register.php/prof_reg.php language files
         require FEATHER_ROOT . 'lang/' . $this->user->language . '/prof_reg.php';
         require FEATHER_ROOT . 'lang/' . $this->user->language . '/register.php';
         if ($this->config['p_force_guest_email'] == '1' || $email != '') {
             require FEATHER_ROOT . 'include/email.php';
             if (!is_valid_email($email)) {
                 $errors[] = $lang_common['Invalid email'];
             }
             // Check if it's a banned email address
             // we should only check guests because members' addresses are already verified
             if ($this->user->is_guest && is_banned_email($email)) {
                 if ($this->config['p_allow_banned_email'] == '0') {
                     $errors[] = $lang_prof_reg['Banned email'];
                 }
                 $errors['banned_email'] = 1;
                 // Used later when we send an alert email
             }
         }
     }
     // Clean up message from POST
     $message = feather_linebreaks(feather_trim($this->request->post('req_message')));
     // Here we use strlen() not feather_strlen() as we want to limit the post to FEATHER_MAX_POSTSIZE bytes, not characters
     if (strlen($message) > FEATHER_MAX_POSTSIZE) {
         $errors[] = sprintf($lang_post['Too long message'], forum_number_format(FEATHER_MAX_POSTSIZE));
     } elseif ($this->config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$this->user->is_admmod) {
         $errors[] = $lang_post['All caps message'];
     }
     // Validate BBCode syntax
     if ($this->config['p_message_bbcode'] == '1') {
         require FEATHER_ROOT . 'include/parser.php';
         $message = preparse_bbcode($message, $errors);
     }
     if (empty($errors)) {
         if ($message == '') {
             $errors[] = $lang_post['No message'];
         } elseif ($this->config['o_censoring'] == '1') {
             // Censor message to see if that causes problems
             $censored_message = feather_trim(censor_words($message));
             if ($censored_message == '') {
                 $errors[] = $lang_post['No message after censoring'];
             }
         }
     }
     return $errors;
 }
Example #14
0
    exit;
}
?>

<div class="linkst">
	<div class="inbox">
		<ul class="crumbs">
			<li><a href="<?php 
echo get_base_url();
?>
"><?php 
echo $lang_common['Index'];
?>
</a></li>
			<li><span>ยป&#160;</span><a href="<?php 
echo get_link('forum/' . $cur_post['fid'] . '/' . url_friendly($cur_post['forum_name']) . '/');
?>
"><?php 
echo feather_escape($cur_post['forum_name']);
?>
</a></li>
			<li><span>ยป&#160;</span><a href="<?php 
echo get_link('post/' . $id . '/#p' . $id);
?>
"><?php 
echo feather_escape($cur_post['subject']);
?>
</a></li>
			<li><span>ยป&#160;</span><strong><?php 
echo $lang_misc['Report post'];
?>
Example #15
0
 public function newpost($fid = null, $tid = null, $qid = null)
 {
     global $lang_common, $lang_prof_reg, $lang_antispam_questions, $lang_antispam, $lang_post, $lang_register, $lang_bbeditor;
     // Load the register.php/profile.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/prof_reg.php';
     // Load the register.php/profile.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/register.php';
     // Load the bbeditor.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/bbeditor.php';
     // Antispam feature
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/antispam.php';
     $index_questions = rand(0, count($lang_antispam_questions) - 1);
     // BBcode toolbar feature
     require FEATHER_ROOT . 'lang/' . $this->user['language'] . '/bbeditor.php';
     // If $_POST['username'] is filled, we are facing a bot
     if ($this->request->post('username')) {
         message($lang_common['Bad request'], '404');
     }
     // Fetch some info about the topic and/or the forum
     $cur_posting = $this->model->get_info_post($tid, $fid);
     $is_subscribed = $tid && $cur_posting['is_subscribed'];
     // Is someone trying to post into a redirect forum?
     if ($cur_posting['redirect_url'] != '') {
         message($lang_common['Bad request'], '404');
     }
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_posting['moderators'] != '' ? unserialize($cur_posting['moderators']) : array();
     $is_admmod = $this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false;
     // Do we have permission to post?
     if (($tid && ($cur_posting['post_replies'] == '' && $this->user->g_post_replies == '0' || $cur_posting['post_replies'] == '0') || $fid && ($cur_posting['post_topics'] == '' && $this->user->g_post_topics == '0' || $cur_posting['post_topics'] == '0') || isset($cur_posting['closed']) && $cur_posting['closed'] == '1') && !$is_admmod) {
         message($lang_common['No permission'], '403');
     }
     // Load the post.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/post.php';
     // Start with a clean slate
     $errors = array();
     $post = '';
     if (!$this->user->is_guest) {
         $focus_element[] = $fid ? 'req_subject' : 'req_message';
     } else {
         $required_fields['req_username'] = $lang_post['Guest name'];
         $focus_element[] = 'req_username';
     }
     // Did someone just hit "Submit" or "Preview"?
     if ($this->feather->request()->isPost()) {
         // Include $pid and $page if needed for confirm_referrer function called in check_errors_before_post()
         if ($this->request->post('pid')) {
             $pid = $this->request->post('pid');
         } else {
             $pid = '';
         }
         if ($this->request->post('page')) {
             $page = $this->request->post('page');
         } else {
             $page = '';
         }
         // Let's see if everything went right
         $errors = $this->model->check_errors_before_post($fid, $tid, $qid, $pid, $page, $errors);
         // Setup some variables before post
         $post = $this->model->setup_variables($errors, $is_admmod);
         // Did everything go according to plan?
         if (empty($errors) && !$this->request->post('preview')) {
             require FEATHER_ROOT . 'include/search_idx.php';
             // If it's a reply
             if ($tid) {
                 // Insert the reply, get the new_pid
                 $new = $this->model->insert_reply($post, $tid, $cur_posting, $is_subscribed);
                 // Should we send out notifications?
                 if ($this->config['o_topic_subscriptions'] == '1') {
                     $this->model->send_notifications_reply($tid, $cur_posting, $new['pid'], $post);
                 }
             } elseif ($fid) {
                 // Insert the topic, get the new_pid
                 $new = $this->model->insert_topic($post, $fid);
                 // Should we send out notifications?
                 if ($this->config['o_forum_subscriptions'] == '1') {
                     $this->model->send_notifications_new_topic($post, $cur_posting, $new['tid']);
                 }
             }
             // If we previously found out that the email was banned
             if ($this->user->is_guest && isset($errors['banned_email']) && $this->config['o_mailing_list'] != '') {
                 $this->model->warn_banned_user($post, $new['pid']);
             }
             // If the posting user is logged in, increment his/her post count
             if (!$this->user->is_guest) {
                 $this->model->increment_post_count($post, $new['tid']);
             }
             redirect(get_link('post/' . $new['pid'] . '/#p' . $new['pid']), $lang_post['Post redirect']);
         }
     }
     $quote = '';
     // If a topic ID was specified in the url (it's a reply)
     if ($tid) {
         $action = $lang_post['Post a reply'];
         $form = '<form id="post" method="post" action="' . get_link('post/reply/' . $tid . '/') . '" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
         // If a quote ID was specified in the url
         if (isset($qid)) {
             $quote = $this->model->get_quote_message($qid, $tid);
             $form = '<form id="post" method="post" action="' . get_link('post/reply/' . $tid . '/quote/' . $qid . '/') . '" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
         }
     } elseif ($fid) {
         $action = $lang_post['Post new topic'];
         $form = '<form id="post" method="post" action="' . get_link('post/new-topic/' . $fid . '/') . '" onsubmit="return process_form(this)">';
     } else {
         message($lang_common['Bad request'], '404');
     }
     $url_forum = url_friendly($cur_posting['forum_name']);
     $is_subscribed = $tid && $cur_posting['is_subscribed'];
     if (isset($cur_posting['subject'])) {
         $url_topic = url_friendly($cur_posting['subject']);
     } else {
         $url_topic = '';
     }
     $page_title = array(feather_escape($this->config['o_board_title']), $action);
     $required_fields = array('req_email' => $lang_common['Email'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
     if ($this->user->is_guest) {
         $required_fields['captcha'] = $lang_antispam['Robot title'];
     }
     $focus_element = array('post');
     define('FEATHER_ACTIVE_PAGE', 'post');
     $this->header->setTitle($page_title)->setFocusElement($focus_element)->setRequiredFields($required_fields)->display();
     // Get the current state of checkboxes
     $checkboxes = $this->model->get_checkboxes($fid, $is_admmod, $is_subscribed);
     // Check to see if the topic review is to be displayed
     if ($tid && $this->config['o_topic_review'] != '0') {
         $post_data = $this->model->topic_review($tid);
     } else {
         $post_data = '';
     }
     $this->feather->render('post.php', array('post' => $post, 'tid' => $tid, 'fid' => $fid, 'feather_config' => $this->config, 'feather_user' => $this->user, 'cur_posting' => $cur_posting, 'lang_common' => $lang_common, 'lang_post' => $lang_post, 'lang_antispam' => $lang_antispam, 'lang_antispam_questions' => $lang_antispam_questions, 'lang_bbeditor' => $lang_bbeditor, 'index_questions' => $index_questions, 'checkboxes' => $checkboxes, 'cur_posting' => $cur_posting, 'feather' => $this->feather, 'action' => $action, 'form' => $form, 'post_data' => $post_data, 'url_forum' => $url_forum, 'url_topic' => $url_topic, 'quote' => $quote, 'errors' => $errors, 'lang_bbeditor' => $lang_bbeditor));
     $this->footer->display();
 }
Example #16
0
            $type = 'positive';
            break;
        case $cur_announcement['reputation'] < '0':
            $type = 'negative';
            break;
        default:
            $type = 'zero';
            break;
    }
    $cur_announcement['reputation'] = array('type' => $type, 'title' => sprintf($lang_topic['reputation'], forum_number_format($cur_announcement['reputation'])));
}
if ($cur_announcement['g_image'] != '') {
    $image_dir = $panther_config['o_image_group_dir'] != '' ? $panther_config['o_image_group_dir'] : get_base_url() . '/' . $panther_config['o_image_group_path'] . '/';
    $img_size = @getimagesize($panther_config['o_image_group_path'] . '/' . $cur_announcement['group_id'] . '.' . $cur_announcement['g_image']);
    $group_image = array('src' => $image_dir . $cur_announcement['group_id'] . '.' . $cur_announcement['g_image'], 'size' => $img_size[3], 'alt' => $cur_announcement['g_user_title']);
} else {
    $group_image = array();
}
$announcement_type = $afid != '0' ? 'announcement_fid' : 'announcement';
($hook = get_extensions('announcement_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $cur_announcement['forum_name'], $cur_announcement['subject']);
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$render = array('index_link' => panther_link($panther_url['index']), 'lang_common' => $lang_common, 'forum_link' => panther_link($panther_url['forum'], array($cur_announcement['fid'], url_friendly($cur_announcement['forum_name']))), 'announce_link' => panther_link($panther_url[$announcement_type], array($id, $cur_announcement['fid'], url_friendly($cur_announcement['subject']))), 'cur_announcement' => $cur_announcement, 'username' => colourize_group($cur_announcement['username'], $cur_announcement['group_id'], $cur_announcement['user_id']), 'user_title' => get_title($cur_announcement), 'user_avatar' => $user_avatar, 'message' => $parser->parse_message($cur_announcement['message'], 0), 'panther_config' => $panther_config, 'post_actions' => $post_actions, 'user_info' => $user_info, 'user_contacts' => $user_contacts, 'group_image' => $group_image);
if ($cur_announcement['parent']) {
    $render['parent_link'] = panther_link($panther_url['forum'], array($cur_announcement['parent_forum'], url_friendly($cur_announcement['parent'])));
}
$tpl = load_template('announcement.tpl');
echo $tpl->render($render);
($hook = get_extensions('announcement_after_display')) ? eval($hook) : null;
require PANTHER_ROOT . 'footer.php';
Example #17
0
     }
 }
 // This warning type has been deleted
 $data = array(':id' => $warning_details['user_id']);
 $ps = $db->select('users', 'username, group_id', $data, 'id=:id');
 list($username, $group_id) = $ps->fetch(PDO::FETCH_NUM);
 if ($warning_details['date_expire'] == '0') {
     $warning_expires = sprintf($lang_warnings['Expires'], $lang_warnings['Never']);
 } else {
     if ($warning_details['date_expire'] > time()) {
         $warning_expires = sprintf($lang_warnings['Expires'], format_time($warning_details['date_expire']));
     } else {
         $warning_expires = sprintf($lang_warnings['Expired'], format_time($warning_details['date_expire']));
     }
 }
 $render = array('lang_warnings' => $lang_warnings, 'form_action' => panther_link($panther_url['warnings']), 'issued_to' => colourize_group($username, $group_id, $warning_details['user_id']), 'warning_title' => $warning_title, 'issued' => format_time($warning_details['date_issued']), 'warning_expires' => $warning_expires, 'issued_by' => colourize_group($warning_details['issued_by_username'], $warning_details['issuer_gid'], $warning_details['issued_by']), 'details_link' => panther_link($panther_url['warning_details'], array($warning_id)), 'view_link' => panther_link($panther_url['warning_view'], array($warning_details['user_id'])), 'profile_link' => panther_link($panther_url['profile'], array($warning_details['user_id'], url_friendly($username))), 'username' => $username, 'post_id' => $warning_details['post_id'], 'panther_user' => $panther_user, 'panther_config' => $panther_config, 'csrf_token' => generate_csrf_token(), 'user_id' => $warning_details['user_id'], 'warning_id' => $warning_id);
 require PANTHER_ROOT . 'include/parser.php';
 if ($panther_user['is_admmod']) {
     $note_admin = $parser->parse_message($warning_details['note_admin'], 0);
     $render['admin_note'] = $note_admin == '' ? $lang_warnings['No admin note'] : $note_admin;
 }
 if ($panther_config['o_private_messaging'] == '1') {
     $note_pm = $parser->parse_message($warning_details['note_pm'], 0);
     $render['pm_note'] = $note_pm == '' ? $lang_warnings['No message'] : $note_pm;
 }
 if ($warning_details['post_id']) {
     $render['message'] = $parser->parse_message($warning_details['note_post'], 0);
     $render['post_link'] = panther_link($panther_url['post'], array($warning_details['post_id']));
 }
 define('PANTHER_ACTIVE_PAGE', 'index');
 require PANTHER_ROOT . 'header.php';
Example #18
0
    $topic_count = 0;
    foreach ($ps as $cur_topic) {
        $url_subject = url_friendly($cur_topic['subject']);
        // Preg match is slow!
        if ($panther_config['o_censoring'] == '1') {
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        }
        $ghost_topic = !is_null($cur_topic['moved_to']) ? true : false;
        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $panther_user['disp_posts']);
        $topics[$cur_topic['id']] = array('count' => ++$topic_count, 'topic_count' => forum_number_format($topic_count + $start_from), 'cur_topic' => $cur_topic, 'topic_poster' => $cur_topic['up_id'] > 1 ? colourize_group($cur_topic['poster'], $cur_topic['up_group_id'], $cur_topic['up_id']) : colourize_group($cur_topic['poster'], PANTHER_GUEST), 'moved_to' => $cur_topic['moved_to'], 'subject' => $cur_topic['subject'], 'sticky' => $cur_topic['sticky'], 'closed' => $cur_topic['closed'], 'topic_link' => panther_link($panther_url['topic'], array($cur_topic['id'], $url_subject)), 'num_pages' => $num_pages_topic, 'pagination' => paginate($num_pages_topic, -1, $panther_url['topic_paginate'], array($cur_topic['id'], $url_subject)), 'new' => !$ghost_topic && $cur_topic['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$fid]) || $tracked_topics['forums'][$fid] < $cur_topic['last_post']) ? '1' : '0');
        if (is_null($cur_topic['moved_to'])) {
            $topics[$cur_topic['id']]['last_post_avatar'] = generate_avatar_markup($cur_topic['uid'], $cur_topic['email'], $cur_topic['use_gravatar'], array(32, 32));
            $topics[$cur_topic['id']]['last_post_link'] = panther_link($panther_url['post'], array($cur_topic['last_post_id']));
            $topics[$cur_topic['id']]['last_post'] = format_time($cur_topic['last_post']);
            $topics[$cur_topic['id']]['last_poster'] = $cur_topic['uid'] > 1 ? colourize_group($cur_topic['last_poster'], $cur_topic['group_id'], $cur_topic['uid']) : colourize_group($cur_topic['last_poster'], PANTHER_GUEST);
            $topics[$cur_topic['id']]['num_replies'] = forum_number_format($cur_topic['num_replies']);
            if ($panther_config['o_topic_views'] == '1') {
                $topics[$cur_topic['id']]['num_views'] = forum_number_format($cur_topic['num_views']);
            }
        } else {
            $topics[$cur_topic['id']]['topic_link'] = panther_link($panther_url['topic'], array($cur_topic['moved_to'], $url_subject));
        }
        if ($topics[$cur_topic['id']]['new'] == '1') {
            $topics[$cur_topic['id']]['new_link'] = panther_link($panther_url['topic_new_posts'], array($cur_topic['id'], $url_subject));
        }
    }
}
$tpl = load_template('moderate_forum.tpl');
echo $tpl->render(array('lang_common' => $lang_common, 'lang_misc' => $lang_misc, 'lang_forum' => $lang_forum, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['moderate_forum'], array($fid, url_friendly($cur_forum['forum_name']))), 'pagination' => paginate($num_pages, $p, $panther_url['moderate_forum'], array($fid)), 'forum' => $cur_forum, 'form_action' => panther_link($panther_url['moderate_forum'], array($fid)), 'panther_config' => $panther_config, 'csrf_token' => generate_csrf_token(), 'panther_user' => $panther_user, 'topics' => $topics));
($hook = get_extensions('moderate_forum_after_output')) ? eval($hook) : null;
require PANTHER_ROOT . 'footer.php';
Example #19
0
 public function display_topics($fid, $sort_by, $start_from)
 {
     global $lang_forum, $lang_common;
     $topic_data = array();
     // Get topic/forum tracking data
     if (!$this->user->is_guest) {
         $tracked_topics = get_tracked_topics();
     }
     // Retrieve a list of topic IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
     $result = DB::for_table('topics')->select('id')->where('forum_id', $fid)->order_by_expr('sticky DESC, ' . $sort_by)->limit($this->user->disp_topics)->offset($start_from)->find_many();
     // If there are topics in this forum
     if ($result) {
         foreach ($result as $id) {
             $topic_ids[] = $id['id'];
         }
         // Select topics
         $select_display_topics = array('id', 'poster', 'subject', 'posted', 'last_post', 'last_post_id', 'last_poster', 'num_views', 'num_replies', 'closed', 'sticky', 'moved_to');
         // TODO: order_by_expr && result_set
         $result = DB::for_table('topics')->select_many($select_display_topics)->where_in('id', $topic_ids)->order_by_expr('sticky DESC, ' . $sort_by . ', id DESC')->find_many();
         $topic_count = 0;
         foreach ($result as $cur_topic) {
             ++$topic_count;
             $status_text = array();
             $cur_topic['item_status'] = $topic_count % 2 == 0 ? 'roweven' : 'rowodd';
             $cur_topic['icon_type'] = 'icon';
             $url_topic = url_friendly($cur_topic['subject']);
             if (is_null($cur_topic['moved_to'])) {
                 $cur_topic['last_post_disp'] = '<a href="' . get_link('post/' . $cur_topic['last_post_id'] . '/#p' . $cur_topic['last_post_id']) . '">' . format_time($cur_topic['last_post']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['last_poster']) . '</span>';
                 $cur_topic['ghost_topic'] = false;
             } else {
                 $cur_topic['last_post_disp'] = '- - -';
                 $cur_topic['ghost_topic'] = true;
             }
             if ($this->config['o_censoring'] == '1') {
                 $cur_topic['subject'] = censor_words($cur_topic['subject']);
             }
             if ($cur_topic['sticky'] == '1') {
                 $cur_topic['item_status'] .= ' isticky';
                 $status_text[] = '<span class="stickytext">' . $lang_forum['Sticky'] . '</span>';
             }
             if ($cur_topic['moved_to'] != 0) {
                 $cur_topic['subject_disp'] = '<a href="' . get_link('topic/' . $cur_topic['moved_to'] . '/' . $url_topic . '/') . '">' . feather_escape($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['poster']) . '</span>';
                 $status_text[] = '<span class="movedtext">' . $lang_forum['Moved'] . '</span>';
                 $cur_topic['item_status'] .= ' imoved';
             } elseif ($cur_topic['closed'] == '0') {
                 $cur_topic['subject_disp'] = '<a href="' . get_link('topic/' . $cur_topic['id'] . '/' . $url_topic . '/') . '">' . feather_escape($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['poster']) . '</span>';
             } else {
                 $cur_topic['subject_disp'] = '<a href="' . get_link('topic/' . $cur_topic['id'] . '/' . $url_topic . '/') . '">' . feather_escape($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['poster']) . '</span>';
                 $status_text[] = '<span class="closedtext">' . $lang_forum['Closed'] . '</span>';
                 $cur_topic['item_status'] .= ' iclosed';
             }
             if (!$cur_topic['ghost_topic'] && $cur_topic['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$fid]) || $tracked_topics['forums'][$fid] < $cur_topic['last_post'])) {
                 $cur_topic['item_status'] .= ' inew';
                 $cur_topic['icon_type'] = 'icon icon-new';
                 $cur_topic['subject_disp'] = '<strong>' . $cur_topic['subject_disp'] . '</strong>';
                 $subject_new_posts = '<span class="newtext">[ <a href="' . get_link('topic/' . $cur_topic['id'] . '/action/new/') . '" title="' . $lang_common['New posts info'] . '">' . $lang_common['New posts'] . '</a> ]</span>';
             } else {
                 $subject_new_posts = null;
             }
             // Insert the status text before the subject
             $cur_topic['subject_disp'] = implode(' ', $status_text) . ' ' . $cur_topic['subject_disp'];
             $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $this->user->disp_posts);
             if ($num_pages_topic > 1) {
                 $subject_multipage = '<span class="pagestext">[ ' . paginate($num_pages_topic, -1, 'topic/' . $cur_topic['id'] . '/' . $url_topic . '/#') . ' ]</span>';
             } else {
                 $subject_multipage = null;
             }
             // Should we show the "New posts" and/or the multipage links?
             if (!empty($subject_new_posts) || !empty($subject_multipage)) {
                 $cur_topic['subject_disp'] .= !empty($subject_new_posts) ? ' ' . $subject_new_posts : '';
                 $cur_topic['subject_disp'] .= !empty($subject_multipage) ? ' ' . $subject_multipage : '';
             }
             $topic_data[] = $cur_topic;
         }
     }
     return $topic_data;
 }
Example #20
0
 public function print_categories_forums()
 {
     global $lang_common, $lang_index;
     // Get list of forums and topics with new posts since last visit
     if (!$this->user->is_guest) {
         $new_topics = $this->get_new_posts();
     }
     $select_print_categories_forums = array('cid' => 'c.id', 'c.cat_name', 'fid' => 'f.id', 'f.forum_name', 'f.forum_desc', 'f.redirect_url', 'f.moderators', 'f.num_topics', 'f.num_posts', 'f.last_post', 'f.last_post_id', 'f.last_poster');
     $where_print_categories_forums = array(array('fp.read_forum' => 'IS NULL'), array('fp.read_forum' => '1'));
     $order_by_print_categories_forums = array('c.disp_position', 'c.id', 'f.disp_position');
     $result = DB::for_table('categories')->table_alias('c')->select_many($select_print_categories_forums)->inner_join('forums', array('c.id', '=', 'f.cat_id'), 'f')->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')->left_outer_join('forum_perms', array('fp.group_id', '=', $this->user->g_id), null, true)->where_any_is($where_print_categories_forums)->order_by_many($order_by_print_categories_forums)->find_result_set();
     $index_data = array();
     $i = 0;
     foreach ($result as $cur_forum) {
         if ($i == 0) {
             $cur_forum->cur_category = 0;
             $cur_forum->forum_count_formatted = 0;
         }
         $moderators = '';
         if (isset($cur_forum->cur_category)) {
             $cur_cat = $cur_forum->cur_category;
         } else {
             $cur_cat = 0;
         }
         if ($cur_forum->cid != $cur_cat) {
             // A new category since last iteration?
             $cur_forum->forum_count_formatted = 0;
             $cur_forum->cur_category = $cur_forum->cid;
         }
         ++$cur_forum->forum_count_formatted;
         $cur_forum->item_status = $cur_forum->forum_count_formatted % 2 == 0 ? 'roweven' : 'rowodd';
         $forum_field_new = '';
         $cur_forum->icon_type = 'icon';
         // Are there new posts since our last visit?
         if (isset($new_topics[$cur_forum->fid])) {
             $cur_forum->item_status .= ' inew';
             $forum_field_new = '<span class="newtext">[ <a href="' . get_link('search/?action=show_new&amp;fid=' . $cur_forum->fid) . '">' . $lang_common['New posts'] . '</a> ]</span>';
             $cur_forum->icon_type = 'icon icon-new';
         }
         // Is this a redirect forum?
         if ($cur_forum->redirect_url != '') {
             $cur_forum->forum_field = '<h3><span class="redirtext">' . $lang_index['Link to'] . '</span> <a href="' . feather_escape($cur_forum->redirect_url) . '" title="' . $lang_index['Link to'] . ' ' . feather_escape($cur_forum->redirect_url) . '">' . feather_escape($cur_forum->forum_name) . '</a></h3>';
             $cur_forum->num_topics_formatted = $cur_forum->num_posts_formatted = '-';
             $cur_forum->item_status .= ' iredirect';
             $cur_forum->icon_type = 'icon';
         } else {
             $cur_forum->forum_field = '<h3><a href="' . get_link('forum/' . $cur_forum->fid . '/' . url_friendly($cur_forum->forum_name)) . '/' . '">' . feather_escape($cur_forum->forum_name) . '</a>' . (!empty($forum_field_new) ? ' ' . $forum_field_new : '') . '</h3>';
             $cur_forum->num_topics_formatted = $cur_forum->num_topics;
             $cur_forum->num_posts_formatted = $cur_forum->num_posts;
         }
         if ($cur_forum->forum_desc != '') {
             $cur_forum->forum_field .= "\n\t\t\t\t\t\t\t\t" . '<div class="forumdesc">' . $cur_forum->forum_desc . '</div>';
         }
         // If there is a last_post/last_poster
         if ($cur_forum->last_post != '') {
             $cur_forum->last_post_formatted = '<a href="' . get_link('post/' . $cur_forum->last_post_id . '/#p' . $cur_forum->last_post_id) . '">' . format_time($cur_forum->last_post) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_forum->last_poster) . '</span>';
         } elseif ($cur_forum->redirect_url != '') {
             $cur_forum->last_post_formatted = '- - -';
         } else {
             $cur_forum->last_post_formatted = $lang_common['Never'];
         }
         if ($cur_forum->moderators != '') {
             $mods_array = unserialize($cur_forum->moderators);
             $moderators = array();
             foreach ($mods_array as $mod_username => $mod_id) {
                 if ($this->user->g_view_users == '1') {
                     $moderators[] = '<a href="' . get_link('user/' . $mod_id . '/') . '">' . feather_escape($mod_username) . '</a>';
                 } else {
                     $moderators[] = feather_escape($mod_username);
                 }
             }
             $cur_forum->moderators_formatted = "\t\t\t\t\t\t\t\t" . '<p class="modlist">(<em>' . $lang_common['Moderated by'] . '</em> ' . implode(', ', $moderators) . ')</p>' . "\n";
         } else {
             $cur_forum->moderators_formatted = '';
         }
         $index_data[] = $cur_forum;
         ++$i;
     }
     return $index_data;
 }
Example #21
0
        $checkboxes[] = array('name' => 'hide_smilies', 'checked' => isset($_POST['hide_smilies']) ? true : false, 'title' => $lang_post['Hide smilies']);
    }
}
// Check to see if the topic review is to be displayed
$posts = array();
if ($tid && $panther_config['o_topic_review'] != '0') {
    require_once PANTHER_ROOT . 'include/parser.php';
    $data = array(':id' => $tid);
    $ps = $db->run('SELECT p.poster, p.message, p.hide_smilies, p.posted, u.group_id FROM ' . $db->prefix . 'posts AS p LEFT JOIN ' . $db->prefix . 'users AS u ON (p.poster=u.username) WHERE p.topic_id=:id ORDER BY p.id DESC LIMIT ' . $panther_config['o_topic_review'], $data);
    foreach ($ps as $cur_post) {
        $posts[] = array('username' => colourize_group($cur_post['poster'], $cur_post['group_id']), 'posted' => format_time($cur_post['posted']), 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']));
    }
}
$render = array('lang_common' => $lang_common, 'lang_post' => $lang_post, 'posts' => $posts, 'errors' => $errors, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_posting['id'], url_friendly($cur_posting['forum_name']))), 'cur_posting' => $cur_posting, 'POST' => $_POST, 'action' => $action, 'fid' => $fid, 'tid' => $tid, 'csrf_token' => generate_csrf_token(), 'panther_config' => $panther_config, 'message' => isset($_POST['req_message']) ? $orig_message : (isset($quote) ? $quote : ''), 'panther_user' => $panther_user, 'can_upload' => $can_upload, 'checkboxes' => $checkboxes, 'quickpost_links' => array('bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies'))));
if (isset($cur_posting['subject'])) {
    $render['topic_link'] = panther_link($panther_url['topic'], array($tid, url_friendly($cur_posting['subject'])));
}
if (isset($_POST['preview'])) {
    require_once PANTHER_ROOT . 'include/parser.php';
    $render['preview'] = $parser->parse_message($message, $hide_smilies);
}
if ($panther_user['is_guest']) {
    $email_form_name = $panther_config['p_force_guest_email'] == '1' ? 'req_email' : 'email';
    $render['username'] = isset($username) ? $username : '';
    $render['email'] = isset($_POST[$email_form_name]) ? $email : '';
    $render['email_form_name'] = $email_form_name;
}
if ($can_upload) {
    $render['max_size'] = $max_size;
}
if (!empty($panther_robots) && $panther_user['g_robot_test'] == '1') {
Example #22
0
         }
         if ($cur_row['given_by'] == '') {
             $cur_row['given_by'] = PANTHER_GUEST;
         }
         if ($cur_row['given_to'] == '') {
             $cur_row['given_to'] = PANTHER_GUEST;
         }
         if ($section == 'rep_received') {
             $username = colourize_group($cur_row['username'], $cur_row['group_id'], $cur_row['given_by']);
         } else {
             $username = colourize_group($cur_row['username'], $cur_row['group_id'], $cur_row['given_to']);
         }
         $reputation[] = array('given' => format_time($cur_row['time_given']), 'user' => $username, 'vote' => $cur_row['vote'], 'id' => $cur_row['id'], 'subject' => $cur_row['subject'], 'link' => panther_link($panther_url['post'], array($cur_row['post_id'])));
     }
     $tpl = load_template('profile_reputation.tpl');
     echo $tpl->render(array('lang_profile' => $lang_profile, 'lang_common' => $lang_common, 'panther_config' => $panther_config, 'index_link' => panther_link($panther_url['index']), 'profile_link' => panther_link($panther_url['profile'], array($id, url_friendly($user['username']))), 'user' => $user, 'rep_section' => $lang_profile[ucfirst($section)], 'pagination' => paginate($num_pages, $page, $panther_url['profile_' . strtolower($section)], array($id)), 'section' => $section, 'panther_user' => $panther_user, 'id' => $id, 'page' => $page, 'reputation' => $reputation));
 } else {
     if ($section == 'privacy') {
         $page_title = array($panther_config['o_board_title'], $lang_common['Profile'], $lang_profile['Section privacy']);
         define('PANTHER_ACTIVE_PAGE', 'profile');
         require PANTHER_ROOT . 'header.php';
         generate_profile_menu('privacy');
         $tpl = load_template('profile_privacy.tpl');
         echo $tpl->render(array('lang_profile' => $lang_profile, 'lang_common' => $lang_common, 'lang_prof_reg' => $lang_prof_reg, 'csrf_token' => generate_csrf_token(), 'form_action' => panther_link($panther_url['profile_privacy'], array($id)), 'panther_config' => $panther_config, 'panther_user' => $panther_user, 'user' => $user));
     } else {
         if ($section == 'admin') {
             if (!$panther_user['is_admmod'] || $panther_user['g_moderator'] == '1' && $panther_user['g_mod_ban_users'] == '0') {
                 message($lang_common['Bad request'], false, '403 Forbidden');
             }
             $posting_ban = format_posting_ban_expiration($user['posting_ban'] - time(), $lang_profile);
             $page_title = array($panther_config['o_board_title'], $lang_common['Profile'], $lang_profile['Section admin']);
Example #23
0
    ($hook = get_extensions('poll_vote_before_validation')) ? eval($hook) : null;
    if (in_array($panther_user['id'], $voters)) {
        message($lang_poll['Already voted']);
    }
    if ($cur_poll['type'] == '1') {
        $vote = isset($_POST['vote']) ? intval($_POST['vote']) : -1;
        if ($vote < 0) {
            message($lang_common['Bad request'], false, '404 Not Found');
        }
        // Increment the amount of votes for this option
        $votes[$vote] = isset($votes[$vote]) ? $votes[$vote]++ : 1;
    } else {
        $vote = isset($_POST['options']) && is_array($_POST['options']) ? array_map('intval', $_POST['options']) : array();
        if (empty($vote)) {
            message($lang_common['Bad request'], false, '404 Not Found');
        }
        foreach ($vote as $key => $value) {
            // If the value isn't nothing, and it's a valid option, increment the votes
            if (!empty($value) && isset($options[$key])) {
                $votes[$key] = isset($votes[$key]) ? $votes[$key]++ : 1;
            }
        }
    }
    $voters[] = $panther_user['id'];
    $update = array('votes' => serialize($votes), 'voters' => serialize($voters));
    $data = array(':id' => $cur_poll['pid']);
    $db->update('polls', $update, 'id=:id', $data);
    redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_poll['subject']))), $lang_poll['Vote success']);
} else {
    message($lang_common['Bad request'], false, '404 Not Found');
}
Example #24
0
function generate_announcements_cache()
{
    global $db;
    $output = array();
    $ps = $db->select('forums', 'id', array(), 'redirect_url IS NULL', 'disp_position');
    $ps->setFetchMode(PDO::FETCH_COLUMN, 0);
    foreach ($ps as $cur_fid) {
        // One forum can have many announcements
        if (!isset($output[$cur_fid])) {
            $output[$cur_fid] = array();
        }
        $ps1 = $db->select('announcements', 'subject, id, forum_id, user_id, message', array(), '', 'id DESC');
        if (!$ps1->rowCount()) {
            continue;
        }
        foreach ($ps1 as $cur_announce) {
            $forums = explode(',', $cur_announce['forum_id']);
            if (in_array($cur_fid, $forums) || in_array(0, $forums)) {
                // Cache the preg replace now to avoid it from eating up valuable time when displaying the forum
                $cur_announce['url_subject'] = url_friendly($cur_announce['subject']);
                $output[$cur_fid][] = $cur_announce;
            }
        }
    }
    $content = '<?php' . "\n\n" . 'if (!defined(\'PANTHER\')) exit;' . "\n" . "\n\n" . '$panther_announcements = ' . var_export($output, true) . ';' . "\n\n" . '?>';
    panther_write_cache_file('cache_announcements.php', $content);
}
Example #25
0
            $signature_cache[$cur_post['poster_id']] = $signature;
        }
    } else {
        $signature = '';
    }
    $attachments = array();
    if ($download && isset($results[$cur_post['id']]) && count($results[$cur_post['id']]) > 0) {
        foreach ($results[$cur_post['id']] as $cur_attach) {
            $attachments[] = array('icon' => attach_icon(attach_get_extension($cur_attach['filename'])), 'link' => panther_link($panther_url['attachment'], array($cur_attach['id'])), 'name' => $cur_attach['filename'], 'size' => sprintf($lang_topic['Attachment size'], file_size($cur_attach['size'])), 'downloads' => sprintf($lang_topic['Attachment downloads'], forum_number_format($cur_attach['downloads'])));
        }
    }
    $posts[] = array('id' => $cur_post['id'], 'count' => $post_count++, 'number' => $start_from + $post_count, 'link' => panther_link($panther_url['post'], array($cur_post['id'])), 'posted' => format_time($cur_post['posted']), 'username' => $username, 'user_title' => $user_title, 'poster_id' => $cur_post['poster_id'], 'poster_reputation' => $cur_post['poster_reputation'], 'user_avatar' => $user_avatar, 'group_image' => $group_image, 'edited' => $cur_post['edited'] ? format_time($cur_post['edited']) : '', 'edited_by' => $cur_post['edited_by'], 'edit_reason' => $cur_post['edit_reason'], 'attachments' => $attachments, 'message' => $cur_post['message'], 'signature' => $signature, 'is_online' => $cur_post['is_online'], 'user_info' => $user_info, 'user_contacts' => $user_contacts, 'group_image' => $group_image, 'post_actions' => $post_actions, 'actions' => $actions);
}
$render['posts'] = $posts;
if ($cur_topic['parent']) {
    $render['parent_link'] = panther_link($panther_url['forum'], array($cur_topic['parent_forum'], url_friendly($cur_topic['parent'])));
}
($hook = get_extensions('topic_before_users_online')) ? eval($hook) : null;
if ($panther_config['o_users_online'] == '1') {
    require PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/online.php';
    $guests_in_topic = $users = array();
    $online = $db->run('SELECT o.user_id, o.ident, o.currently, o.logged, u.group_id FROM ' . $db->prefix . 'online AS o INNER JOIN ' . $db->prefix . 'users AS u ON u.id=o.user_id WHERE o.currently LIKE \'%viewtopic.php%\' AND o.idle = 0');
    foreach ($online as $user_online) {
        if (strpos($user_online['currently'], '&p=') !== false) {
            preg_match('~&p=(.*)~', $user_online['currently'], $replace);
            $user_online['currently'] = str_replace($replace[0], '', $user_online['currently']);
        }
        $tid = filter_var($user_online['currently'], FILTER_SANITIZE_NUMBER_INT);
        if (strpos($user_online['currently'], '?pid') !== false) {
            if (in_array($tid, $post_ids)) {
                if ($user_online['user_id'] == 1) {
Example #26
0
 $now = time();
 if (!isset($feed) || $cache_expire < $now) {
     // Setup the feed
     $feed = array('title' => $panther_config['o_board_title'] . $forum_name, 'link' => panther_link($panther_url['index']), 'description' => sprintf($lang_common['RSS description'], $panther_config['o_board_title']), 'items' => array(), 'type' => 'topics');
     // Fetch $show topics
     $select = array_merge($select, $data);
     $ps = $db->run('SELECT t.id, t.poster, t.subject, t.forum_id, t.posted, t.last_post, t.last_poster, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email FROM ' . $db->prefix . 'topics AS t INNER JOIN ' . $db->prefix . 'posts AS p ON p.id=' . ($order_posted ? 't.first_post_id' : 't.last_post_id') . ' INNER JOIN ' . $db->prefix . 'users AS u ON u.id=p.poster_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id=?) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL' . $forum_sql . ' ORDER BY ' . ($order_posted ? 't.posted' : 't.last_post') . ' DESC LIMIT ' . (isset($cache_id) ? 50 : $show), $select);
     foreach ($ps as $cur_topic) {
         if ($panther_forums[$cur_topic['forum_id']]['password'] != '' && check_forum_login_cookie($cur_topic['forum_id'], $panther_forums[$cur_topic['forum_id']]['password'], true) === false || $panther_forums[$cur_topic['forum_id']]['protected'] == '1' && !$panther_user['is_admmod']) {
             continue;
         }
         if ($panther_config['o_censoring'] == '1') {
             $cur_topic['subject'] = censor_words($cur_topic['subject']);
         }
         $cur_topic['message'] = $parser->parse_message($cur_topic['message'], $cur_topic['hide_smilies']);
         $item = array('id' => $cur_topic['id'], 'title' => $cur_topic['subject'], 'link' => panther_htmlspecialchars_decode(panther_link($panther_url[$order_posted ? 'topic' : 'topic_new_posts'], array($cur_topic['id'], url_friendly($cur_topic['subject'])))), 'description' => $cur_topic['message'], 'author' => array('name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster']), 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post']);
         if ($cur_topic['poster_id'] > 1) {
             if ($cur_topic['email_setting'] == '0' && !$panther_user['is_guest']) {
                 $item['author']['email'] = $cur_topic['email'];
             }
             $item['author']['uri'] = panther_link($panther_url['profile'], array($cur_topic['poster_id']));
         } else {
             if ($cur_topic['poster_email'] != '' && !$panther_user['is_guest']) {
                 $item['author']['email'] = $cur_topic['poster_email'];
             }
         }
         $feed['items'][] = $item;
     }
     // Output feed as PHP code
     if (isset($cache_id)) {
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
Example #27
0
 public function print_topics($forum_id, $sort_by, $start_from)
 {
     global $lang_common, $lang_forum;
     // Get topic/forum tracking data
     if (!$this->user->is_guest) {
         $tracked_topics = get_tracked_topics();
     }
     // Retrieve a list of topic IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
     $result = DB::for_table('topics')->select('id')->where('forum_id', $forum_id)->order_by_desc('sticky')->order_by_expr($sort_by)->order_by_desc('id')->limit($this->user->disp_topics)->offset($start_from)->find_many();
     $forum_data = array();
     // If there are topics in this forum
     if ($result) {
         $topic_ids = array();
         foreach ($result as $cur_topic_id) {
             $topic_ids[] = $cur_topic_id['id'];
         }
         // Fetch list of topics to display on this page
         if ($this->user->is_guest || $this->config['o_show_dot'] == '0') {
             // Without "the dot"
             $select_print_topics = array('id', 'poster', 'subject', 'posted', 'last_post', 'last_post_id', 'last_poster', 'num_views', 'num_replies', 'closed', 'sticky', 'moved_to');
             $result = DB::for_table('topics')->select_many($select_print_topics)->where_in('id', $topic_ids)->order_by_desc('sticky')->order_by_expr($sort_by)->order_by_desc('id')->find_many();
         } else {
             // With "the dot"
             $select_print_topics = array('has_posted' => 'p.poster_id', 't.id', 't.subject', 't.poster', 't.posted', 't.last_post', 't.last_post_id', 't.last_poster', 't.num_views', 't.num_replies', 't.closed', 't.sticky', 't.moved_to');
             $result = DB::for_table('topics')->table_alias('t')->select_many($select_print_topics)->left_outer_join('posts', array('t.id', '=', 'p.topic_id'), 'p')->left_outer_join('posts', array('p.poster_id', '=', $this->user->id), null, true)->where_in('t.id', $topic_ids)->group_by('t.id')->order_by_desc('sticky')->order_by_expr($sort_by)->order_by_desc('id')->find_many();
         }
         $topic_count = 0;
         foreach ($result as $cur_topic) {
             ++$topic_count;
             $status_text = array();
             $cur_topic['item_status'] = $topic_count % 2 == 0 ? 'roweven' : 'rowodd';
             $cur_topic['icon_type'] = 'icon';
             $url_subject = url_friendly($cur_topic['subject']);
             if (is_null($cur_topic['moved_to'])) {
                 $cur_topic['last_post_formatted'] = '<a href="' . get_link('post/' . $cur_topic['last_post_id'] . '/#p' . $cur_topic['last_post_id']) . '">' . format_time($cur_topic['last_post']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['last_poster']) . '</span>';
             } else {
                 $cur_topic['last_post_formatted'] = '- - -';
             }
             if ($this->config['o_censoring'] == '1') {
                 $cur_topic['subject'] = censor_words($cur_topic['subject']);
             }
             if ($cur_topic['sticky'] == '1') {
                 $cur_topic['item_status'] .= ' isticky';
                 $status_text[] = '<span class="stickytext">' . $lang_forum['Sticky'] . '</span>';
             }
             if ($cur_topic['moved_to'] != 0) {
                 $cur_topic['subject_formatted'] = '<a href="' . get_link('topic/' . $cur_topic['moved_to'] . '/' . $url_subject . '/') . '">' . feather_escape($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['poster']) . '</span>';
                 $status_text[] = '<span class="movedtext">' . $lang_forum['Moved'] . '</span>';
                 $cur_topic['item_status'] .= ' imoved';
             } elseif ($cur_topic['closed'] == '0') {
                 $cur_topic['subject_formatted'] = '<a href="' . get_link('topic/' . $cur_topic['id'] . '/' . $url_subject . '/') . '">' . feather_escape($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['poster']) . '</span>';
             } else {
                 $cur_topic['subject_formatted'] = '<a href="' . get_link('topic/' . $cur_topic['id'] . '/' . $url_subject . '/') . '">' . feather_escape($cur_topic['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_topic['poster']) . '</span>';
                 $status_text[] = '<span class="closedtext">' . $lang_forum['Closed'] . '</span>';
                 $cur_topic['item_status'] .= ' iclosed';
             }
             if (!$this->user->is_guest && $cur_topic['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_topic['id']]) || $tracked_topics['topics'][$cur_topic['id']] < $cur_topic['last_post']) && (!isset($tracked_topics['forums'][$forum_id]) || $tracked_topics['forums'][$forum_id] < $cur_topic['last_post']) && is_null($cur_topic['moved_to'])) {
                 $cur_topic['item_status'] .= ' inew';
                 $cur_topic['icon_type'] = 'icon icon-new';
                 $cur_topic['subject_formatted'] = '<strong>' . $cur_topic['subject_formatted'] . '</strong>';
                 $subject_new_posts = '<span class="newtext">[ <a href="' . get_link('topic/' . $cur_topic['id'] . '/action/new/') . '" title="' . $lang_common['New posts info'] . '">' . $lang_common['New posts'] . '</a> ]</span>';
             } else {
                 $subject_new_posts = null;
             }
             // Insert the status text before the subject
             $cur_topic['subject_formatted'] = implode(' ', $status_text) . ' ' . $cur_topic['subject_formatted'];
             // Should we display the dot or not? :)
             if (!$this->user->is_guest && $this->config['o_show_dot'] == '1') {
                 if ($cur_topic['has_posted'] == $this->user->id) {
                     $cur_topic['subject_formatted'] = '<strong class="ipost">ยท&#160;</strong>' . $cur_topic['subject_formatted'];
                     $cur_topic['item_status'] .= ' iposted';
                 }
             }
             $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $this->user->disp_posts);
             if ($num_pages_topic > 1) {
                 $subject_multipage = '<span class="pagestext">[ ' . paginate($num_pages_topic, -1, 'topic/' . $cur_topic['id'] . '/' . $url_subject . '/#') . ' ]</span>';
             } else {
                 $subject_multipage = null;
             }
             // Should we show the "New posts" and/or the multipage links?
             if (!empty($subject_new_posts) || !empty($subject_multipage)) {
                 $cur_topic['subject_formatted'] .= !empty($subject_new_posts) ? ' ' . $subject_new_posts : '';
                 $cur_topic['subject_formatted'] .= !empty($subject_multipage) ? ' ' . $subject_multipage : '';
             }
             $forum_data[] = $cur_topic;
         }
     }
     return $forum_data;
 }
Example #28
0
     include FORUM_CACHE_DIR . 'cache_' . $cache_id . '.php';
 }
 $now = time();
 if (!isset($feed) || $cache_expire < $now) {
     // Setup the feed
     $feed = array('title' => $feather_config['o_board_title'] . $forum_name, 'link' => '/index.php', 'description' => sprintf($lang_common['RSS description'], $feather_config['o_board_title']), 'items' => array(), 'type' => 'topics');
     // Fetch $show topics
     $select_print_posts = array('t.id', 't.poster', 't.subject', 't.posted', 't.last_post', 't.last_poster', 'p.message', 'p.hide_smilies', 'u.email_setting', 'u.email', 'p.poster_id', 'p.poster_email');
     $where_print_posts = array(array('fp.read_forum' => 'IS NULL'), array('fp.read_forum' => '1'));
     $result = $result->select_many($select_print_posts)->inner_join('posts', array('p.id', '=', $order_posted ? 't.first_post_id' : 't.last_post_id'), 'p')->inner_join('users', array('u.id', '=', 'p.poster_id'), 'u')->left_outer_join('forum_perms', array('fp.forum_id', '=', 't.forum_id'), 'fp')->left_outer_join('forum_perms', array('fp.group_id', '=', $feather->user->g_id), null, true)->where_any_is($where_print_posts)->where_null('t.moved_to')->order_by($order_posted ? 't.posted' : 't.last_post')->limit(isset($cache_id) ? 50 : $show)->find_array();
     foreach ($result as $cur_topic) {
         if ($feather_config['o_censoring'] == '1') {
             $cur_topic['subject'] = censor_words($cur_topic['subject']);
         }
         $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']);
         $item = array('id' => $cur_topic['id'], 'title' => $cur_topic['subject'], 'link' => get_link('topic/' . $cur_topic['id'] . '/' . url_friendly($cur_topic['subject']) . '/') . ($order_posted ? '' : '/action/new/'), 'description' => $cur_topic['message'], 'author' => array('name' => $order_posted ? $cur_topic['poster'] : $cur_topic['last_poster']), 'pubdate' => $order_posted ? $cur_topic['posted'] : $cur_topic['last_post']);
         if ($cur_topic['poster_id'] > 1) {
             if ($cur_topic['email_setting'] == '0' && !$feather->user->is_guest) {
                 $item['author']['email'] = $cur_topic['email'];
             }
             $item['author']['uri'] = get_link('user/' . $cur_topic['poster_id'] . '/');
         } elseif ($cur_topic['poster_email'] != '' && !$feather->user->is_guest) {
             $item['author']['email'] = $cur_topic['poster_email'];
         }
         $feed['items'][] = $item;
     }
     // Output feed as PHP code
     if (isset($cache_id)) {
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
Example #29
0
        ?>
					<div class="inform">
						<fieldset>
							<legend><?php 
        printf($lang_admin_reports['Zapped subhead'], format_time($report['zapped']), $report['zapped_by'] != '' ? '<a href="' . get_link('user/' . $report['zapped_by_id'] . '/') . '">' . feather_escape($report['zapped_by']) . '</a>' : $lang_admin_reports['NA']);
        ?>
</legend>
							<div class="infldset">
								<table class="aligntop">
									<tr>
										<th scope="row"><?php 
        printf($lang_admin_reports['Reported by'], $report['reporter'] != '' ? '<a href="' . get_link('users/' . $report['reported_by'] . '/') . '">' . feather_escape($report['reporter']) . '</a>' : $lang_admin_reports['Deleted user']);
        ?>
</th>
										<td class="location"><?php 
        echo breadcrumbs(array($report['forum_name'] => get_link('forum/' . $report['forum_id'] . '/' . url_friendly($report['forum_name']) . '/'), $report['subject'] => get_link('forum/' . $report['topic_id'] . '/' . url_friendly($report['subject'])), sprintf($lang_admin_reports['Post ID'], $report['pid']) => get_link('post/' . $report['pid'] . '/#p' . $report['pid'])));
        ?>
</td>
									</tr>
									<tr>
										<th scope="row"><?php 
        echo $lang_admin_reports['Reason'];
        ?>
</th>
										<td><?php 
        echo str_replace("\n", '<br />', feather_escape($report['message']));
        ?>
</td>
									</tr>
								</table>
							</div>
Example #30
0
     }
 }
 // Make sure we have a valid language string
 if (isset($_POST['language'])) {
     $language = preg_replace('%[\\.\\\\/]%', '', $_POST['language']);
     if (!file_exists(PANTHER_ROOT . 'lang/' . $language . '/common.php')) {
         message($lang_common['Bad request'], false, '404 Not Found');
     }
 } else {
     $language = $panther_config['o_default_lang'];
 }
 $timezone = isset($_POST['timezone']) ? round($_POST['timezone'], 1) : '';
 $dst = isset($_POST['dst']) ? 1 : 0;
 $email_setting = isset($_POST['email_setting']) && ($_POST['email_setting'] > 0 && $_POST['email_setting'] < 2) ? intval($_POST['email_setting']) : $panther_config['o_default_email_setting'];
 ($hook = get_extensions('register_after_validation')) ? eval($hook) : null;
 $url_username = url_friendly($username);
 // Did everything go according to plan?
 if (empty($errors)) {
     // Insert the new user into the database. We do this now to get the last inserted ID for later use
     $now = time();
     $initial_group_id = $panther_config['o_regs_verify'] == '0' ? $panther_config['o_default_user_group'] : PANTHER_UNVERIFIED;
     $password_hash = panther_hash($password1 . $password_salt);
     // Add the user
     $insert = array('username' => $username, 'group_id' => $initial_group_id, 'password' => $password_hash, 'salt' => $password_salt, 'email' => $email1, 'email_setting' => $email_setting, 'timezone' => $timezone, 'dst' => $dst, 'language' => $language, 'style' => $panther_config['o_default_style'], 'registered' => $now, 'registration_ip' => get_remote_address(), 'last_visit' => $now);
     $db->insert('users', $insert);
     $new_uid = $db->lastInsertId($db->prefix . 'users');
     $login_key = generate_login_key($new_uid);
     if ($panther_config['o_regs_verify'] == '0') {
         // Regenerate the users info cache
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require PANTHER_ROOT . 'include/cache.php';