Ejemplo n.º 1
0
 public function deletepost($id)
 {
     global $lang_common, $lang_post, $pd;
     if ($this->user->g_read_board == '0') {
         message($lang_common['No view'], '403');
     }
     // Fetch some informations about the post, the topic and the forum
     $cur_post = $this->model->get_info_delete($id);
     if ($this->config['o_censoring'] == '1') {
         $cur_post['subject'] = censor_words($cur_post['subject']);
     }
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_post['moderators'] != '' ? unserialize($cur_post['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;
     $is_topic_post = $id == $cur_post['first_post_id'] ? true : false;
     // Do we have permission to edit this post?
     if (($this->user->g_delete_posts == '0' || $this->user->g_delete_topics == '0' && $is_topic_post || $cur_post['poster_id'] != $this->user->id || $cur_post['closed'] == '1') && !$is_admmod) {
         message($lang_common['No permission'], '403');
     }
     if ($is_admmod && $this->user->g_id != FEATHER_ADMIN && in_array($cur_post['poster_id'], get_admin_ids())) {
         message($lang_common['No permission'], '403');
     }
     // Load the delete.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/delete.php';
     if ($this->feather->request()->isPost()) {
         $this->model->handle_deletion($is_topic_post, $id, $cur_post['tid'], $cur_post['fid']);
     }
     $page_title = array(feather_escape($this->config['o_board_title']), $lang_delete['Delete post']);
     define('FEATHER_ACTIVE_PAGE', 'delete');
     $this->header->setTitle($page_title)->display();
     require FEATHER_ROOT . 'include/parser.php';
     $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
     $this->feather->render('delete.php', array('lang_common' => $lang_common, 'lang_delete' => $lang_delete, 'cur_post' => $cur_post, 'id' => $id, 'is_topic_post' => $is_topic_post));
     $this->footer->display();
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
/**
 * function run_censor()
 * A function to run the censorship of words
 * if the censor session array is not set this will set it
 *
 * @param  array $convoArr - the conversation array
 * @return array $convoArr (censored)
 */
function run_censor($convoArr)
{
    if (!isset($_SESSION['pgo_word_censor'])) {
        initialise_censor($convoArr['conversation']['bot_id']);
    }
    $convoArr['send_to_user'] = censor_words($convoArr['send_to_user']);
    return $convoArr;
}
Ejemplo n.º 4
0
 public function editpost($id)
 {
     global $lang_common, $lang_prof_reg, $lang_post, $lang_register;
     if ($this->user->g_read_board == '0') {
         message($lang_common['No view'], '403');
     }
     // Fetch some informations about the post, the topic and the forum
     $cur_post = $this->model->get_info_edit($id);
     // Sort out who the moderators are and if we are currently a moderator (or an admin)
     $mods_array = $cur_post['moderators'] != '' ? unserialize($cur_post['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;
     $can_edit_subject = $id == $cur_post['first_post_id'];
     if ($this->config['o_censoring'] == '1') {
         $cur_post['subject'] = censor_words($cur_post['subject']);
         $cur_post['message'] = censor_words($cur_post['message']);
     }
     // Do we have permission to edit this post?
     if (($this->user->g_edit_posts == '0' || $cur_post['poster_id'] != $this->user->id || $cur_post['closed'] == '1') && !$is_admmod) {
         message($lang_common['No permission'], '403');
     }
     if ($is_admmod && $this->user->g_id != FEATHER_ADMIN && in_array($cur_post['poster_id'], get_admin_ids())) {
         message($lang_common['No permission'], '403');
     }
     // Load the post.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/post.php';
     // Load the bbeditor.php language file
     require FEATHER_ROOT . 'lang/' . $this->user->language . '/bbeditor.php';
     // Start with a clean slate
     $errors = array();
     if ($this->feather->request()->isPost()) {
         // Let's see if everything went right
         $errors = $this->model->check_errors_before_edit($id, $can_edit_subject, $errors);
         // Setup some variables before post
         $post = $this->model->setup_variables($cur_post, $is_admmod, $can_edit_subject, $errors);
         // Did everything go according to plan?
         if (empty($errors) && !$this->request->post('preview')) {
             // Edit the post
             $this->model->edit_post($id, $can_edit_subject, $post, $cur_post, $is_admmod);
             redirect(get_link('post/' . $id . '/#p' . $id), $lang_post['Post redirect']);
         }
     } else {
         $post = '';
     }
     $page_title = array(feather_escape($this->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('FEATHER_ACTIVE_PAGE', 'edit');
     $this->header->setTitle($page_title)->setFocusElement($focus_element)->setRequiredFields($required_fields)->display();
     if ($this->request->post('preview')) {
         require_once FEATHER_ROOT . 'include/parser.php';
         $preview_message = parse_message($post['message'], $post['hide_smilies']);
     } else {
         $preview_message = '';
     }
     $this->feather->render('edit.php', array('lang_common' => $lang_common, 'cur_post' => $cur_post, 'lang_post' => $lang_post, 'errors' => $errors, 'preview_message' => $preview_message, 'id' => $id, 'feather_config' => $this->config, 'feather_user' => $this->user, 'checkboxes' => $this->model->get_checkboxes($can_edit_subject, $is_admmod, $cur_post, 1), 'feather' => $this->feather, 'can_edit_subject' => $can_edit_subject, 'post' => $post, 'lang_bbeditor' => $lang_bbeditor));
     $this->footer->display();
 }
Ejemplo n.º 5
0
 public function check_errors_before_edit($id, $can_edit_subject, $errors)
 {
     global $lang_post, $pd;
     // If it's a topic it must contain a subject
     if ($can_edit_subject) {
         $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'];
         }
     }
     // 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;
 }
Ejemplo n.º 6
0
    function renderComment($id, $user, $timestamp, $comment, $file, $action = "view")
    {
        $delete = '';
        if ($action == "moderate") {
            global $ICONS;
            $delete = "<a class='commentdelete' href='./+moderate&file={$file}&delComment={$id}'>{$ICONS['Delete']['large']}</a>";
        }
        $name = getUserFullName($user);
        $comment = censor_words($comment);
        $ret = <<<RET
<div class="share_comment">
<fieldset>
<span class="share_comment_info">
Posted By: {$name} on {$timestamp}
</span>
<br/><span class="share_comment_content">
{$comment}
</span>
{$delete}</fieldset>
</div>
RET;
        return $ret;
    }
Ejemplo n.º 7
0
 $q_message = preg_replace('%\\[img(?:=(?:[^\\[]*?))?\\]((ht|f)tps?://)([^\\s<"]*?)\\[/img\\]%U', '\\1\\3', $q_message);
 // If we split up the message before we have to concatenate it together again (code tags)
 if (isset($inside)) {
     $outside = explode("", $q_message);
     $q_message = '';
     $num_tokens = count($outside);
     for ($i = 0; $i < $num_tokens; ++$i) {
         $q_message .= $outside[$i];
         if (isset($inside[$i])) {
             $q_message .= '[code]' . $inside[$i] . '[/code]';
         }
     }
     unset($inside);
 }
 if ($luna_config['o_censoring'] == '1') {
     $q_message = censor_words($q_message);
 }
 $q_message = luna_htmlspecialchars($q_message);
 // If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends)
 if (strpos($q_poster, '[') !== false || strpos($q_poster, ']') !== false) {
     if (strpos($q_poster, '\'') !== false) {
         $q_poster = '"' . $q_poster . '"';
     } else {
         $q_poster = '\'' . $q_poster . '\'';
     }
 } else {
     // Get the characters at the start and end of $q_poster
     $ends = substr($q_poster, 0, 1) . substr($q_poster, -1, 1);
     // Deal with quoting "Username" or 'Username' (becomes '"Username"' or "'Username'")
     if ($ends == '\'\'') {
         $q_poster = '"' . $q_poster . '"';
Ejemplo n.º 8
0
     if ($panther_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$panther_user['is_admmod']) {
         $errors[] = $lang_post['All caps message'];
     }
 }
 // Validate BBCode syntax
 if ($panther_config['p_message_bbcode'] == '1') {
     require PANTHER_ROOT . 'include/parser.php';
     $message = $parser->preparse_bbcode($message, $errors);
 }
 if (empty($errors)) {
     if ($message == '') {
         $errors[] = $lang_post['No message'];
     } else {
         if ($panther_config['o_censoring'] == '1') {
             // Censor message to see if that causes problems
             $censored_message = panther_trim(censor_words($message));
             if ($censored_message == '') {
                 $errors[] = $lang_post['No message after censoring'];
             }
         }
     }
 }
 $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0';
 $stick_topic = isset($_POST['stick_topic']) ? '1' : '0';
 $add_poll = isset($_POST['add_poll']) && $cur_post['post_polls'] != '0' && $panther_user['g_post_polls'] == '1' && $panther_config['o_polls'] == '1' ? '1' : '0';
 if (!$is_admmod) {
     $stick_topic = $cur_post['sticky'];
 }
 // Replace four-byte characters (MySQL cannot handle them)
 $message = strip_bad_multibyte_chars($message);
 // Did everything go according to plan?
Ejemplo n.º 9
0
} else {
    $sql = 'SELECT `t`.`id`, ' . '`t`.`poster`, ' . '`t`.`has_poll`, ' . '`t`.`subject`, ' . '`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`, ' . '`lt`.`log_time`, ' . '`lf`.`mark_read`, ' . '`p`.`poster_id` AS `has_posted` ' . 'FROM `' . $db->prefix . 'topics` AS `t` ' . 'LEFT JOIN `' . $db->prefix . 'log_topics` AS `lt` ' . 'ON `lt`.`user_id`=' . $pun_user['id'] . ' AND `lt`.`topic_id`=`t`.`id` ' . 'LEFT JOIN `' . $db->prefix . 'log_forums` AS `lf` ' . 'ON `lf`.`forum_id`=`t`.`forum_id` AND `lf`.`user_id`=' . $pun_user['id'] . ' ' . 'LEFT JOIN `' . $db->prefix . 'posts` AS `p` ' . 'ON `t`.`id`=`p`.`topic_id` AND `p`.`poster_id`=' . $pun_user['id'] . ' ' . 'WHERE `t`.`forum_id`=' . $id . ' ' . 'GROUP BY `t`.`id` ' . 'ORDER BY `sticky` DESC, ' . (1 == $cur_forum['sort_by'] ? 'posted' : 'last_post') . ' DESC ' . 'LIMIT ' . $start_from . ', ' . $pun_user['disp_topics'];
}
//- REAL MARK TOPIC AS READ
$result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
// If there are topics in this forum.
$topics = array();
if ($db->num_rows($result)) {
    while ($cur_topic = $db->fetch_assoc($result)) {
        // Pagination in topics on index page.
        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
        if (1 < $num_pages_topic) {
            $cur_topic['paging_links'] = paginate($num_pages_topic, -1, 'viewtopic.php?id=' . $cur_topic['id']);
        }
        if ($pun_config['o_censoring'] == 1) {
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        }
        $topics[] = $cur_topic;
    }
}
//+ Language
require_once PUN_ROOT . 'lang/' . $pun_user['language'] . '/forum.php';
//- Language
// Template Manager aka Smarty
// Механизм проверки ящика сообщений, отчетов...
require_once PUN_ROOT . 'wap/header.php';
$page_title = $pun_config['o_board_title'] . ' / ' . $cur_forum['forum_name'];
$smarty->assign('page_title', $page_title);
if ($pun_config['o_quickjump'] == 1) {
    $forum_id = $id;
    $smarty->assign('quickjump', include PUN_ROOT . 'include/wap_quickjump.php');
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
0
                             message($lang_prof_reg['Username reserved chars']);
                         } else {
                             if (preg_match('#\\[b\\]|\\[/b\\]|\\[u\\]|\\[/u\\]|\\[i\\]|\\[/i\\]|\\[color|\\[/color\\]|\\[quote\\]|\\[quote=|\\[/quote\\]|\\[code\\]|\\[/code\\]|\\[img\\]|\\[/img\\]|\\[url|\\[/url\\]|\\[email|\\[/email\\]#i', $username)) {
                                 message($lang_prof_reg['Username BBCode']);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 // Check username for any censored words
 if ($pun_config['o_censoring'] == '1') {
     // If the censored username differs from the username
     if (censor_words($username) != $username) {
         message($lang_register['Username censor']);
     }
 }
 // Image verifcation
 if ($pun_config['o_regs_verify_image'] == '1') {
     session_start();
     // Make sure what they submitted is not empty
     if (trim($_POST['req_image']) == '') {
         message($lang_register['Text mismatch']);
     }
     if (strtolower(trim($_POST['req_image'])) != strtolower($_SESSION['text'])) {
         message($lang_register['Text mismatch']);
     }
 }
 // Check that the username (or a too similar username) is not already registered
Ejemplo n.º 12
0
    ?>
</dd>
							<dt><?php 
    echo $lang_profile['AOL IM'];
    ?>
: </dt>
							<dd><?php 
    echo $user['aim'] != '' ? pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['aim']) : $user['aim']) : $lang_profile['Unknown'];
    ?>
</dd>
							<dt><?php 
    echo $lang_profile['Yahoo'];
    ?>
: </dt>
							<dd><?php 
    echo $user['yahoo'] != '' ? pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['yahoo']) : $user['yahoo']) : $lang_profile['Unknown'];
    ?>
</dd>
						</dl>
						<div class="clearer"></div>
					</div>
				</fieldset>
			</div>
			<div class="inform">
				<fieldset>
				<legend><?php 
    echo $lang_profile['Section personality'];
    ?>
</legend>
					<div class="infldset">
						<dl>
Ejemplo n.º 13
0
 }
 if ($user['icq'] != '') {
     $user_messaging[] = '<dt>' . $lang_profile['ICQ'] . '</dt>';
     $user_messaging[] = '<dd>' . $user['icq'] . '</dd>';
 }
 if ($user['msn'] != '') {
     $user_messaging[] = '<dt>' . $lang_profile['MSN'] . '</dt>';
     $user_messaging[] = '<dd>' . pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['msn']) : $user['msn']) . '</dd>';
 }
 if ($user['aim'] != '') {
     $user_messaging[] = '<dt>' . $lang_profile['AOL IM'] . '</dt>';
     $user_messaging[] = '<dd>' . pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['aim']) : $user['aim']) . '</dd>';
 }
 if ($user['yahoo'] != '') {
     $user_messaging[] = '<dt>' . $lang_profile['Yahoo'] . '</dt>';
     $user_messaging[] = '<dd>' . pun_htmlspecialchars($pun_config['o_censoring'] == '1' ? censor_words($user['yahoo']) : $user['yahoo']) . '</dd>';
 }
 $user_personality = array();
 if ($pun_config['o_avatars'] == '1') {
     $avatar_field = generate_avatar_markup($id);
     if ($avatar_field != '') {
         $user_personality[] = '<dt>' . $lang_profile['Avatar'] . '</dt>';
         $user_personality[] = '<dd>' . $avatar_field . '</dd>';
     }
 }
 if ($pun_config['o_signatures'] == '1') {
     if (isset($parsed_signature)) {
         $user_personality[] = '<dt>' . $lang_profile['Signature'] . '</dt>';
         $user_personality[] = '<dd><div class="postsignature postmsg">' . $parsed_signature . '</div></dd>';
     }
 }
Ejemplo n.º 14
0
     }
     $user_info[] = array('title' => $lang_topic['Registered'], 'value' => format_time($cur_post['registered'], true));
     if ($panther_config['o_show_post_count'] == '1' || $panther_user['is_admmod']) {
         $user_info[] = array('title' => $lang_topic['Posts'], 'value' => forum_number_format($cur_post['num_posts']));
     }
     // Now let's deal with the contact links (Email and URL)
     if (($cur_post['email_setting'] == '0' && !$panther_user['is_guest'] || $panther_user['is_admmod']) && $panther_user['g_send_email'] == '1') {
         $user_contacts[] = array('class' => 'email', 'href' => 'mailto:' . $cur_post['email'], 'title' => $lang_common['Email']);
     } else {
         if ($cur_post['email_setting'] == '1' && !$panther_user['is_guest'] && $panther_user['g_send_email'] == '1') {
             $user_contacts[] = array('class' => 'email', 'href' => panther_link($panther_url['email'], array($cur_post['poster_id'])), 'title' => $lang_common['Email']);
         }
     }
     if ($cur_post['url'] != '') {
         if ($panther_config['o_censoring'] == '1') {
             $cur_post['url'] = censor_words($cur_post['url']);
         }
         $user_contacts[] = array('class' => 'website', 'href' => $cur_post['url'], 'rel' => 'nofollow', 'title' => $lang_topic['Website']);
     }
 }
 if ($panther_user['is_admin'] || $panther_user['g_moderator'] == '1' && $panther_user['g_mod_promote_users'] == '1') {
     if ($cur_post['g_promote_next_group']) {
         $user_info[] = array('title' => $lang_topic['Promote user'], 'href' => panther_link($panther_url['profile_promote'], array($cur_post['poster_id'], $cur_post['id'], $csrf_token)));
     }
 }
 if ($panther_user['is_admmod']) {
     $user_info[] = array('title' => $lang_topic['IP address logged'], 'href' => panther_link($panther_url['get_host'], array($cur_post['id'])), 'label' => $cur_post['poster_ip']);
     if ($cur_post['admin_note'] != '') {
         $user_info[] = array('title' => $lang_topic['Note'], 'value' => $cur_post['admin_note']);
     }
 }
Ejemplo n.º 15
0
    confirm_referrer(array('new_inbox.php', 'viewinbox.php'));
    // Check that $edit looks good
    if ($edit <= 0) {
        message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'));
    }
    $result = $db->query('SELECT sender_id, message, receiver FROM ' . $db->prefix . 'messages WHERE id=' . $edit) or error('Unable to get the informations of the message', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result)) {
        message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'));
    }
    $edit_msg = $db->fetch_assoc($result);
    // If you're not the owner of this message, why do you want to edit it?
    if ($edit_msg['sender_id'] != $luna_user['id'] && !$luna_user['is_admmod'] || $edit_msg['receiver'] == '0' && !$luna_user['is_admmod']) {
        message(__('You do not have permission to access this page.', 'luna'));
    }
    // Insert the message
    $p_message = censor_words($edit_msg['message']);
}
if (isset($_POST['form_sent'])) {
    // The comment button has been pressed
    // Make sure they got here from the site
    confirm_referrer(array('new_inbox.php', 'viewinbox.php'));
    $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0';
    // Make sure form_user is correct
    if ($_POST['form_user'] != $luna_user['username']) {
        message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'));
    }
    // Flood protection by Newman
    if (!isset($_SESSION)) {
        session_start();
    }
    if (isset($_SESION['last_session_request'])) {
Ejemplo n.º 16
0
if ($luna_user['g_read_board'] == '0') {
    message(__('You do not have permission to view this page.', 'luna'), false, '403 Forbidden');
}
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id < 1) {
    message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
}
$action = isset($_GET['action']) ? $_GET['action'] : 0;
// Fetch some info about the comment, the thread and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, fp.comment, fp.create_threads, t.id AS tid, t.subject, t.first_comment_id, t.closed, p.commented, p.commenter, p.commenter_id, p.message, p.hide_smilies FROM ' . $db->prefix . 'comments AS p INNER JOIN ' . $db->prefix . 'threads AS t ON t.id=p.thread_id INNER JOIN ' . $db->prefix . 'forums AS f ON f.id=t.forum_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $luna_user['g_id'] . ') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id=' . $id) or error('Unable to fetch comment info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result)) {
    message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
}
$cur_comment = $db->fetch_assoc($result);
if ($luna_config['o_censoring'] == '1') {
    $cur_comment['subject'] = censor_words($cur_comment['subject']);
}
// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = $cur_comment['moderators'] != '' ? unserialize($cur_comment['moderators']) : array();
$is_admmod = $luna_user['g_id'] == LUNA_ADMIN || $luna_user['g_moderator'] == '1' && array_key_exists($luna_user['username'], $mods_array) ? true : false;
$is_thread_comment = $id == $cur_comment['first_comment_id'] ? true : false;
// Do we have permission to edit this comment?
if (($luna_user['g_delete_comments'] == '0' || $luna_user['g_delete_threads'] == '0' && $is_thread_comment || $cur_comment['commenter_id'] != $luna_user['id'] || $cur_comment['closed'] == '1') && !$is_admmod) {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
if ($is_admmod && $luna_user['g_id'] != LUNA_ADMIN && in_array($cur_comment['commenter_id'], get_admin_ids())) {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
// Soft delete comments
if (isset($_POST['soft_delete'])) {
    // Make sure they got here from the site
Ejemplo n.º 17
0
             }
         }
     }
 }
 // Generate IP information for moderators/administrators
 if ($forum_user['is_admmod']) {
     $forum_page['author_info']['ip'] = '<li><span>' . $lang_topic['IP'] . ' <a href="' . forum_link($forum_url['get_host'], $cur_post['id']) . '">' . $cur_post['poster_ip'] . '</a></span></li>';
 }
 // Generate author contact details
 if ($forum_config['o_show_user_info'] == '1') {
     if (isset($user_data_cache[$cur_post['poster_id']]['post_contacts'])) {
         $forum_page['post_contacts'] = $user_data_cache[$cur_post['poster_id']]['post_contacts'];
     } else {
         if ($cur_post['poster_id'] > 1) {
             if ($cur_post['url'] != '') {
                 $forum_page['post_contacts']['url'] = '<span class="user-url' . (empty($forum_page['post_contacts']) ? ' first-item' : '') . '"><a class="external" href="' . forum_htmlencode($forum_config['o_censoring'] == '1' ? censor_words($cur_post['url']) : $cur_post['url']) . '">' . sprintf($lang_topic['Visit website'], '<span>' . sprintf($lang_topic['User possessive'], forum_htmlencode($cur_post['username'])) . '</span>') . '</a></span>';
             }
             if (($cur_post['email_setting'] == '0' && !$forum_user['is_guest'] || $forum_user['is_admmod']) && $forum_user['g_send_email'] == '1') {
                 $forum_page['post_contacts']['email'] = '<span class="user-email' . (empty($forum_page['post_contacts']) ? ' first-item' : '') . '"><a href="mailto:' . forum_htmlencode($cur_post['email']) . '">' . $lang_topic['E-mail'] . '<span>&#160;' . forum_htmlencode($cur_post['username']) . '</span></a></span>';
             } else {
                 if ($cur_post['email_setting'] == '1' && !$forum_user['is_guest'] && $forum_user['g_send_email'] == '1') {
                     $forum_page['post_contacts']['email'] = '<span class="user-email' . (empty($forum_page['post_contacts']) ? ' first-item' : '') . '"><a href="' . forum_link($forum_url['email'], $cur_post['poster_id']) . '">' . $lang_topic['E-mail'] . '<span>&#160;' . forum_htmlencode($cur_post['username']) . '</span></a></span>';
                 }
             }
         } else {
             if ($cur_post['poster_email'] != '' && !$forum_user['is_guest'] && $forum_user['g_send_email'] == '1') {
                 $forum_page['post_contacts']['email'] = '<span class="user-email' . (empty($forum_page['post_contacts']) ? ' first-item' : '') . '"><a href="mailto:' . forum_htmlencode($cur_post['poster_email']) . '">' . $lang_topic['E-mail'] . '<span>&#160;' . forum_htmlencode($cur_post['username']) . '</span></a></span>';
             }
         }
     }
     ($hook = get_hook('vt_row_pre_post_contacts_merge')) ? eval($hook) : null;
Ejemplo n.º 18
0
             break;
     }
 }
 $result = $db->query($sql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
 // If there are topics in this forum.
 if ($db->num_rows($result)) {
     while ($cur_topic = $db->fetch_assoc($result)) {
         $icon_text = $lang_common['Normal icon'];
         $item_status = '';
         $icon_type = 'icon';
         if ($cur_topic['question'] != '') {
             //var_dump( $cur_topic['question'] );
             //var_dump( $cur_topic['last_post'] );
             // with poll
             if ($pun_config['o_censoring'] == '1') {
                 $cur_topic['question'] = censor_words($cur_topic['question']);
             }
             if ($cur_topic['moved_to'] != 0) {
                 $subject = $lang_forum['Moved'] . ': ' . $lang_polls['Poll'] . ': <a href="viewpoll.php?id=' . $cur_topic['moved_to'] . '">' . pun_htmlspecialchars($cur_topic['question']) . '</a><br /> <span class="byuser"><b>' . pun_htmlspecialchars($cur_topic['subject']) . '</b> ' . $lang_common['by'] . '&nbsp;' . pun_htmlspecialchars($cur_topic['poster']) . '</span>';
             } else {
                 if ($cur_topic['closed'] == '0') {
                     $subject = $lang_polls['Poll'] . ': <a href="viewpoll.php?id=' . $cur_topic['id'] . '">' . pun_htmlspecialchars($cur_topic['question']) . '</a><br /> <span class="byuser"><b>' . pun_htmlspecialchars($cur_topic['subject']) . '</b> ' . $lang_common['by'] . '&nbsp;' . pun_htmlspecialchars($cur_topic['poster']) . '</span>';
                 } else {
                     $subject = $lang_polls['Poll'] . ': <a href="viewpoll.php?id=' . $cur_topic['id'] . '">' . pun_htmlspecialchars($cur_topic['question']) . '</a><br /> <span class="byuser"><b>' . pun_htmlspecialchars($cur_topic['subject']) . '</b> ' . $lang_common['by'] . '&nbsp;' . pun_htmlspecialchars($cur_topic['poster']) . '</span>';
                     $icon_text = $lang_common['Closed icon'];
                     $item_status = 'iclosed';
                 }
             }
             if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null) {
                 $icon_text .= ' ' . $lang_common['New icon'];
                 $item_status .= ' inew';
Ejemplo n.º 19
0
function draw_search_results()
{
    global $search_set, $cur_search, $luna_user, $luna_config, $thread_count, $cur_thread, $subject_status, $last_comment_date, $tracked_threads, $start_from;
    foreach ($search_set as $cur_search) {
        $forum = '<a href="viewforum.php?id=' . $cur_search['forum_id'] . '">' . luna_htmlspecialchars($cur_search['forum_name']) . '</a>';
        if ($luna_config['o_censoring'] == '1') {
            $cur_search['subject'] = censor_words($cur_search['subject']);
        }
        /* if ($show_as == 'comments') {
        			require get_view_path('comment.php');
        		} else { */
        ++$thread_count;
        $status_text = array();
        $item_status = $thread_count % 2 == 0 ? 'roweven' : 'rowodd';
        $icon_type = 'icon';
        $subject = '<a href="thread.php?id=' . $cur_search['tid'] . '#p' . $cur_search['pid'] . '">' . luna_htmlspecialchars($cur_search['subject']) . '</a>';
        $by = '<span class="byuser">' . __('by', 'luna') . ' ' . luna_htmlspecialchars($cur_search['commenter']) . '</span>';
        if ($cur_search['pinned'] == '1') {
            $item_status .= ' pinned-item';
            $status_text[] = '<span class="label label-warning"><span class="fa fa-fw fa-thumb-tack"></span></span>';
        }
        if ($cur_search['closed'] != '0') {
            $status_text[] = '<span class="label label-danger"><span class="fa fa-fw fa-lock"></span></span>';
            $item_status .= ' closed-item';
        }
        if (!$luna_user['is_guest'] && $cur_search['last_comment'] > $luna_user['last_visit'] && (!isset($tracked_threads['threads'][$cur_search['tid']]) || $tracked_threads['threads'][$cur_search['tid']] < $cur_search['last_comment']) && (!isset($tracked_threads['forums'][$cur_search['forum_id']]) || $tracked_threads['forums'][$cur_search['forum_id']] < $cur_search['last_comment'])) {
            $item_status .= ' new-item';
            $icon_type = 'icon icon-new';
            $subject = '<strong>' . $subject . '</strong>';
            $status_text[] = '<a href="thread.php?id=' . $cur_thread['id'] . '&amp;action=new" title="' . __('Go to the first new comment in the thread.', 'luna') . '" class="label label-default label-new"><span class="fa fa-fw fa-bell"></span></a>';
        }
        // Insert the status text before the subject
        $subject = implode(' ', $status_text) . ' ' . $subject;
        $num_pages_thread = ceil(($cur_search['num_replies'] + 1) / $luna_user['disp_comments']);
        if ($num_pages_thread > 1) {
            $subject_multipage = '<span class="pagestext">' . simple_paginate($num_pages_thread, -1, 'thread.php?id=' . $cur_search['tid']) . '</span>';
        } else {
            $subject_multipage = null;
        }
        if ($cur_search['last_commenter_id'] > '1' && $luna_user['g_view_users'] == '1') {
            $last_commenter = '<a href="thread.php?pid=' . $cur_search['last_comment_id'] . '#p' . $cur_search['last_comment_id'] . '">' . format_time($cur_search['last_comment']) . '</a> <span class="byuser">' . __('by', 'luna') . '</span> <a href="profile.php?id=' . $cur_search['last_commenter_id'] . '">' . luna_htmlspecialchars($cur_search['last_commenter']) . '</a>';
        } else {
            $last_commenter = '<a href="thread.php?pid=' . $cur_search['last_comment_id'] . '#p' . $cur_search['last_comment_id'] . '">' . format_time($cur_search['last_comment']) . '</a> <span class="byuser">' . __('by', 'luna') . '</span> ' . luna_htmlspecialchars($cur_search['last_commenter']);
        }
        require get_view_path('search-thread.php');
        // }
    }
}
function get_title($user)
{
    global $forum_db, $forum_config, $forum_bans, $lang_common;
    static $ban_list, $forum_ranks;
    $return = ($hook = get_hook('fn_get_title_start')) ? eval($hook) : null;
    if ($return != null) {
        return $return;
    }
    // If not already built in a previous call, build an array of lowercase banned usernames
    if (empty($ban_list)) {
        $ban_list = array();
        foreach ($forum_bans as $cur_ban) {
            $ban_list[] = utf8_strtolower($cur_ban['username']);
        }
    }
    // If not already loaded in a previous call, load the cached ranks
    if ($forum_config['o_ranks'] == '1' && !defined('FORUM_RANKS_LOADED')) {
        if (file_exists(FORUM_CACHE_DIR . 'cache_ranks.php')) {
            include FORUM_CACHE_DIR . 'cache_ranks.php';
        }
        if (!defined('FORUM_RANKS_LOADED')) {
            if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                require FORUM_ROOT . 'include/cache.php';
            }
            generate_ranks_cache();
            require FORUM_CACHE_DIR . 'cache_ranks.php';
        }
    }
    // If the user has a custom title
    if ($user['title'] != '') {
        $user_title = forum_htmlencode($forum_config['o_censoring'] == '1' ? censor_words($user['title']) : $user['title']);
    } else {
        if (in_array(utf8_strtolower($user['username']), $ban_list)) {
            $user_title = $lang_common['Banned'];
        } else {
            if ($user['g_user_title'] != '') {
                $user_title = forum_htmlencode($user['g_user_title']);
            } else {
                if ($user['g_id'] == FORUM_GUEST) {
                    $user_title = $lang_common['Guest'];
                } else {
                    // Are there any ranks?
                    if ($forum_config['o_ranks'] == '1' && !empty($forum_ranks)) {
                        foreach ($forum_ranks as $cur_rank) {
                            if (intval($user['num_posts']) >= $cur_rank['min_posts']) {
                                $user_title = forum_htmlencode($cur_rank['rank']);
                            }
                        }
                    }
                    // If the user didn't "reach" any rank (or if ranks are disabled), we assign the default
                    if (!isset($user_title)) {
                        $user_title = $lang_common['Member'];
                    }
                }
            }
        }
    }
    ($hook = get_hook('fn_get_title_end')) ? eval($hook) : null;
    return $user_title;
}
Ejemplo n.º 21
0
     $db->query('UPDATE ' . $db->prefix . 'messages SET showed=1 WHERE id=' . $id) or error('Unable to update message info', __FILE__, __LINE__, $db->error());
 }
 if ($cur_post['id'] > 0) {
     $username = '******' . $cur_post['id'] . '">' . pun_htmlspecialchars($cur_post['username']) . '</a>';
     $user_title = get_title($cur_post);
     if ($pun_config['o_censoring'] == 1) {
         $user_title = censor_words($user_title);
     }
     // Format the online indicator
     $is_online = $cur_post['is_online'] == $cur_post['id'] ? '<strong>' . $lang_topic['Online'] . '</strong>' : $lang_topic['Offline'];
     $user_avatar = pun_show_avatar();
     // We only show location, register date, post count and the contact links if "Show user info" is enabled
     if ($pun_config['o_show_user_info'] == 1) {
         if ($cur_post['location']) {
             if ($pun_config['o_censoring'] == 1) {
                 $cur_post['location'] = censor_words($cur_post['location']);
             }
             $user_info[] = '<dd>' . $lang_topic['From'] . ': ' . pun_htmlspecialchars($cur_post['location']);
         }
         $user_info[] = '<dd>' . $lang_common['Registered'] . ': ' . date($pun_config['o_date_format'], $cur_post['registered']);
         if ($pun_config['o_show_post_count'] == 1 || $pun_user['g_id'] < PUN_GUEST) {
             $user_info[] = '<dd>' . $lang_common['Posts'] . ': ' . $cur_post['num_posts'];
         }
         // Now let's deal with the contact links (E-mail and URL)
         if (!$cur_post['email_setting'] && !$pun_user['is_guest'] || $pun_user['g_id'] < PUN_GUEST) {
             $user_contacts[] = '<a href="mailto:' . $cur_post['email'] . '">' . $lang_common['E-mail'] . '</a>';
         } else {
             if ($cur_post['email_setting'] == 1 && !$pun_user['is_guest']) {
                 $user_contacts[] = '<a href="misc.php?email=' . $cur_post['id'] . '">' . $lang_common['E-mail'] . '</a>';
             }
         }
Ejemplo n.º 22
0
<?php 
        } else {
            if ($show_as == 'forums') {
                // Load the forum.php language file
                require FORUM_ROOT . 'lang/' . $forum_user['language'] . '/index.php';
                $forum_page['cur_category'] = $forum_page['cat_count'] = $forum_page['item_count'] = 0;
            }
        }
    }
    $forum_page['item_count'] = 0;
    // Finally, lets loop through the results and output them
    foreach ($search_set as $cur_set) {
        ($hook = get_hook('se_results_loop_start')) ? eval($hook) : null;
        ++$forum_page['item_count'];
        if ($forum_config['o_censoring'] == '1') {
            $cur_set['subject'] = censor_words($cur_set['subject']);
        }
        if ($show_as == 'posts') {
            // Generate the result heading
            $forum_page['post_ident'] = array();
            $forum_page['post_ident']['num'] = '<span class="post-num">' . forum_number_format($forum_page['start_from'] + $forum_page['item_count']) . '</span>';
            $forum_page['post_ident']['byline'] = '<span class="post-byline">' . sprintf($cur_set['pid'] == $cur_set['first_post_id'] ? $lang_topic['Topic byline'] : $lang_topic['Reply byline'], '<strong>' . forum_htmlencode($cur_set['pposter']) . '</strong>') . '</span>';
            $forum_page['post_ident']['link'] = '<span class="post-link"><a class="permalink" rel="bookmark" title="' . $lang_topic['Permalink post'] . '" href="' . forum_link($forum_url['post'], $cur_set['pid']) . '">' . format_time($cur_set['pposted']) . '</a></span>';
            ($hook = get_hook('se_results_posts_row_pre_item_ident_merge')) ? eval($hook) : null;
            // Generate the topic title
            $forum_page['item_subject'] = '<a class="permalink" rel="bookmark" title="' . $lang_topic['Permalink topic'] . '" href="' . forum_link($forum_url['topic'], array($cur_set['tid'], sef_friendly($cur_set['subject']))) . '">' . sprintf($cur_set['pid'] == $cur_set['first_post_id'] ? $lang_topic['Topic title'] : $lang_topic['Reply title'], forum_htmlencode($cur_set['subject'])) . '</a> <small>' . sprintf($lang_topic['Search replies'], forum_number_format($cur_set['num_replies']), '<a href="' . forum_link($forum_url['forum'], array($cur_set['forum_id'], sef_friendly($cur_set['forum_name']))) . '">' . forum_htmlencode($cur_set['forum_name']) . '</a>') . '</small>';
            // Generate author identification
            $forum_page['user_ident'] = $cur_set['poster_id'] > 1 && $forum_user['g_view_users'] == '1' ? '<strong class="username"><a title="' . sprintf($lang_search['Go to profile'], forum_htmlencode($cur_set['pposter'])) . '" href="' . forum_link($forum_url['user'], $cur_set['poster_id']) . '">' . forum_htmlencode($cur_set['pposter']) . '</a></strong>' : '<strong class="username">' . forum_htmlencode($cur_set['pposter']) . '</strong>';
            // Generate the post actions links
            $forum_page['post_actions'] = array();
            $forum_page['post_actions']['forum'] = '<span><a href="' . forum_link($forum_url['forum'], array($cur_set['forum_id'], sef_friendly($cur_set['forum_name']))) . '">' . $lang_search['Go to forum'] . '<span>: ' . forum_htmlencode($cur_set['forum_name']) . '</span></a></span>';
Ejemplo n.º 23
0
 if ($luna_config['o_feed_ttl'] > 0 && ($forum_sql == '' || $forum_name != '' && !isset($_GET['nfid']))) {
     $cache_id = 'feed' . sha1($luna_user['g_id'] . '|' . __('en', 'luna') . '|' . ($order_commented ? '1' : '0') . ($forum_name == '' ? '' : '|' . $fids[0]));
 }
 // Load cached feed
 if (isset($cache_id) && file_exists(LUNA_CACHE_DIR . 'cache_' . $cache_id . '.php')) {
     include LUNA_CACHE_DIR . 'cache_' . $cache_id . '.php';
 }
 $now = time();
 if (!isset($feed) || $cache_expire < $now) {
     // Setup the feed
     $feed = array('title' => $luna_config['o_board_title'] . $forum_name, 'link' => '/index.php', 'description' => sprintf(__('The most recent threads at %s.', 'luna'), $luna_config['o_board_title']), 'items' => array(), 'type' => 'threads');
     // Fetch $show threads
     $result = $db->query('SELECT t.id, t.commenter, t.subject, t.commented, t.last_comment, t.last_commenter, p.message, p.hide_smilies, u.email_setting, u.email, p.commenter_id, p.commenter_email FROM ' . $db->prefix . 'threads AS t INNER JOIN ' . $db->prefix . 'comments AS p ON p.id=' . ($order_commented ? 't.first_comment_id' : 't.last_comment_id') . ' INNER JOIN ' . $db->prefix . 'users AS u ON u.id=p.commenter_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id=' . $luna_user['g_id'] . ') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL' . $forum_sql . ' ORDER BY ' . ($order_commented ? 't.commented' : 't.last_comment') . ' DESC LIMIT ' . (isset($cache_id) ? 50 : $show)) or error('Unable to fetch thread info', __FILE__, __LINE__, $db->error());
     while ($cur_thread = $db->fetch_assoc($result)) {
         if ($luna_config['o_censoring'] == '1') {
             $cur_thread['subject'] = censor_words($cur_thread['subject']);
         }
         $cur_thread['message'] = parse_message($cur_thread['message']);
         $item = array('id' => $cur_thread['id'], 'title' => $cur_thread['subject'], 'link' => '/thread.php?id=' . $cur_thread['id'] . ($order_commented ? '' : '&action=new'), 'description' => $cur_thread['message'], 'author' => array('name' => $order_commented ? $cur_thread['commenter'] : $cur_thread['last_commenter']), 'pubdate' => $order_commented ? $cur_thread['commented'] : $cur_thread['last_comment']);
         if ($cur_thread['commenter_id'] > 1) {
             if ($cur_thread['email_setting'] == '0' && !$luna_user['is_guest']) {
                 $item['author']['email'] = $cur_thread['email'];
             }
             $item['author']['uri'] = '/profile.php?id=' . $cur_thread['commenter_id'];
         } elseif ($cur_thread['commenter_email'] != '' && !$luna_user['is_guest']) {
             $item['author']['email'] = $cur_thread['commenter_email'];
         }
         $feed['items'][] = $item;
     }
     // Output feed as PHP code
     if (isset($cache_id)) {
Ejemplo n.º 24
0
            }
            if ($pun_config['o_censoring'] == '1') {
                $search_set[$i]['subject'] = censor_words($search_set[$i]['subject']);
            }
            if ($show_as == 'posts') {
                $icon = '<div class="icon"><div class="nosize">' . $lang_common['Normal icon'] . '</div></div>' . "\n";
                if ($search_set[$i]['question'] == "" || $search_set[$i]['question'] == 0) {
                    $subject = '<a href="viewtopic.php?id=' . $search_set[$i]['tid'] . '"' . $rel . '>' . pun_htmlspecialchars($search_set[$i]['subject']) . '</a>';
                } else {
                    $subject = $lang_polls['Poll'] . ': <a href="viewtopic.php?id=' . $search_set[$i]['tid'] . '"' . $rel . '>' . pun_htmlspecialchars($search_set[$i]['subject']) . '</a>';
                }
                if (!$pun_user['is_guest'] && $search_set[$i]['last_post'] > $pun_user['last_visit']) {
                    $icon = '<div class="icon inew"><div class="nosize">' . $lang_common['New icon'] . '</div></div>' . "\n";
                }
                if ($pun_config['o_censoring'] == '1') {
                    $search_set[$i]['message'] = censor_words($search_set[$i]['message']);
                }
                $message = str_replace("\n", '<br />', pun_htmlspecialchars($search_set[$i]['message']));
                $pposter = pun_htmlspecialchars($search_set[$i]['pposter']);
                if ($search_set[$i]['poster_id'] > 1) {
                    $pposter = '<strong><a href="/users/' . $search_set[$i]['poster_id'] . '">' . $pposter . '</a></strong>';
                }
                if (pun_strlen($message) >= 1000) {
                    $message .= ' &hellip;';
                }
                $vtpost1 = $i == 0 ? ' vtp1' : '';
                // Switch the background color for every message.
                $bg_switch = $bg_switch ? $bg_switch = false : ($bg_switch = true);
                $vtbg = $bg_switch ? ' rowodd' : ' roweven';
                ?>
<div class="blockpost searchposts<?php 
Ejemplo n.º 25
0
     if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest'])) {
         $errors[] = $lang_prof_reg['Username guest'];
     } else {
         if (preg_match('/[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}/', $username)) {
             $errors[] = $lang_prof_reg['Username IP'];
         }
     }
 }
 if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, "'") !== false && strpos($username, '"') !== false) {
     $errors[] = $lang_prof_reg['Username reserved chars'];
 }
 if (preg_match('#\\[b\\]|\\[/b\\]|\\[u\\]|\\[/u\\]|\\[i\\]|\\[/i\\]|\\[color|\\[/color\\]|\\[quote\\]|\\[quote=|\\[/quote\\]|\\[hide\\]|\\[hide=|\\[/hide\\]|\\[code\\]|\\[/code\\]|\\[img\\]|\\[/img\\]|\\[url|\\[/url\\]|\\[email|\\[/email\\]#i', $username)) {
     $errors[] = $lang_prof_reg['Username BBCode'];
 }
 // Check username for any censored words
 $temp = censor_words($username);
 if ($temp != $username) {
     $errors[] = $lang_register['Username censor'];
 }
 // Check that the username (or a too similar username) is not already registered
 $result = $db->query('SELECT `username` FROM `' . $db->prefix . 'users` WHERE (`username`=\'' . $db->escape($username) . '\' OR `username`=\'' . $db->escape(preg_replace('/[^\\w]/', '', $username)) . '\') AND `id`>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
 if ($db->num_rows($result)) {
     $busy = $db->result($result);
     $errors[] = $lang_register['Username dupe 1'] . ' ' . pun_htmlspecialchars($busy) . '. ' . $lang_register['Username dupe 2'];
 }
 if ($pun_config['p_force_guest_email'] == 1 || $email) {
     include_once PUN_ROOT . 'include/email.php';
     if (!is_valid_email($email)) {
         $errors[] = $lang_common['Invalid e-mail'];
     }
 }
Ejemplo n.º 26
0
         $forum_sql = ' AND t.forum_id NOT IN(' . implode(',', $nfids) . ')';
     }
 }
 // Setup the feed
 $feed = array('title' => $forum_config['o_board_title'] . $forum_name, 'link' => forum_link($forum_url['index']), 'description' => sprintf($lang_common['RSS description'], $forum_config['o_board_title']), 'items' => array(), 'type' => 'topics');
 // Fetch $show topics
 $query = array('SELECT' => 't.id, t.poster, t.posted, t.subject, p.message, p.hide_smilies, u.email_setting, u.email, p.poster_id, p.poster_email', 'FROM' => 'topics AS t', 'JOINS' => array(array('INNER JOIN' => 'posts AS p', 'ON' => 'p.id = t.first_post_id'), array('INNER JOIN' => 'users AS u', 'ON' => 'u.id = p.poster_id'), array('LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id = t.forum_id AND fp.group_id = ' . $forum_user['g_id'] . ')')), 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum = 1) AND t.moved_to IS NULL', 'ORDER BY' => ($sort_by == 'last_post' ? 't.last_post' : 't.posted') . ' DESC', 'LIMIT' => $show);
 if (isset($forum_sql)) {
     $query['WHERE'] .= $forum_sql;
 }
 ($hook = get_hook('ex_qr_get_topics')) ? eval($hook) : null;
 $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
 while ($cur_topic = $forum_db->fetch_assoc($result)) {
     if ($forum_config['o_censoring'] == '1') {
         $cur_topic['subject'] = censor_words($cur_topic['subject']);
         $cur_topic['message'] = censor_words($cur_topic['message']);
     }
     $cur_topic['message'] = parse_message($cur_topic['message'], $cur_topic['hide_smilies']);
     $item = array('id' => $cur_topic['id'], 'title' => $cur_topic['subject'], 'link' => forum_link($forum_url['topic_new_posts'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))), 'description' => $cur_topic['message'], 'author' => array('name' => $cur_topic['poster']), 'pubdate' => $cur_topic['posted']);
     if ($cur_topic['poster_id'] > 1) {
         if ($cur_topic['email_setting'] == '0' && !$forum_user['is_guest']) {
             $item['author']['email'] = $cur_topic['email'];
         }
         $item['author']['uri'] = forum_link($forum_url['user'], $cur_topic['poster_id']);
     } else {
         if ($cur_topic['poster_email'] != '' && !$forum_user['is_guest']) {
             $item['author']['email'] = $cur_topic['poster_email'];
         }
     }
     $feed['items'][] = $item;
     ($hook = get_hook('ex_modify_cur_topic_item')) ? eval($hook) : null;
Ejemplo n.º 27
0
         $post_count = 0;
     }
 }
 // Get topic/forum tracking data
 if (!$panther_user['is_guest']) {
     $tracked_topics = get_tracked_topics();
 }
 $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';
Ejemplo n.º 28
0
 public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod)
 {
     global $lang_topic, $lang_common, $pd;
     $post_data = array();
     $post_count = 0;
     // Keep track of post numbers
     // Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
     $result = DB::for_table('posts')->select('id')->where('topic_id', $topic_id)->order_by('id')->limit($this->user->disp_topics)->offset($start_from)->find_many();
     $post_ids = array();
     foreach ($result as $cur_post_id) {
         $post_ids[] = $cur_post_id['id'];
     }
     if (empty($post_ids)) {
         error('The post table and topic table seem to be out of sync!', __FILE__, __LINE__);
     }
     // Retrieve the posts (and their respective poster/online status)
     $select_print_posts = array('u.email', 'u.title', 'u.url', 'u.location', 'u.signature', 'u.email_setting', 'u.num_posts', 'u.registered', 'u.admin_note', 'p.id', 'username' => 'p.poster', 'p.poster_id', 'p.poster_ip', 'p.poster_email', 'p.message', 'p.hide_smilies', 'p.posted', 'p.edited', 'p.edited_by', 'g.g_id', 'g.g_user_title', 'g.g_promote_next_group', 'is_online' => 'o.user_id');
     $result = DB::for_table('posts')->table_alias('p')->select_many($select_print_posts)->inner_join('users', array('u.id', '=', 'p.poster_id'), 'u')->inner_join('groups', array('g.g_id', '=', 'u.group_id'), 'g')->raw_join('LEFT OUTER JOIN ' . $this->feather->prefix . 'online', "o.user_id!=1 AND o.idle=0 AND o.user_id=u.id", 'o')->where_in('p.id', $post_ids)->order_by('p.id')->find_array();
     foreach ($result as $cur_post) {
         $post_count++;
         $cur_post['user_avatar'] = '';
         $cur_post['user_info'] = array();
         $cur_post['user_contacts'] = array();
         $cur_post['post_actions'] = array();
         $cur_post['is_online_formatted'] = '';
         $cur_post['signature_formatted'] = '';
         // If the poster is a registered user
         if ($cur_post['poster_id'] > 1) {
             if ($this->user->g_view_users == '1') {
                 $cur_post['username_formatted'] = '<a href="' . get_base_url() . '/user/' . $cur_post['poster_id'] . '/">' . feather_escape($cur_post['username']) . '</a>';
             } else {
                 $cur_post['username_formatted'] = feather_escape($cur_post['username']);
             }
             $cur_post['user_title_formatted'] = get_title($cur_post);
             if ($this->config['o_censoring'] == '1') {
                 $cur_post['user_title_formatted'] = censor_words($cur_post['user_title_formatted']);
             }
             // Format the online indicator
             $cur_post['is_online_formatted'] = $cur_post['is_online'] == $cur_post['poster_id'] ? '<strong>' . $lang_topic['Online'] . '</strong>' : '<span>' . $lang_topic['Offline'] . '</span>';
             if ($this->config['o_avatars'] == '1' && $this->user->show_avatars != '0') {
                 if (isset($avatar_cache[$cur_post['poster_id']])) {
                     $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']];
                 } else {
                     $cur_post['user_avatar'] = $avatar_cache[$cur_post['poster_id']] = generate_avatar_markup($cur_post['poster_id']);
                 }
             }
             // We only show location, register date, post count and the contact links if "Show user info" is enabled
             if ($this->config['o_show_user_info'] == '1') {
                 if ($cur_post['location'] != '') {
                     if ($this->config['o_censoring'] == '1') {
                         $cur_post['location'] = censor_words($cur_post['location']);
                     }
                     $cur_post['user_info'][] = '<dd><span>' . $lang_topic['From'] . ' ' . feather_escape($cur_post['location']) . '</span></dd>';
                 }
                 $cur_post['user_info'][] = '<dd><span>' . $lang_topic['Registered'] . ' ' . format_time($cur_post['registered'], true) . '</span></dd>';
                 if ($this->config['o_show_post_count'] == '1' || $this->user->is_admmod) {
                     $cur_post['user_info'][] = '<dd><span>' . $lang_topic['Posts'] . ' ' . forum_number_format($cur_post['num_posts']) . '</span></dd>';
                 }
                 // Now let's deal with the contact links (Email and URL)
                 if (($cur_post['email_setting'] == '0' && !$this->user->is_guest || $this->user->is_admmod) && $this->user->g_send_email == '1') {
                     $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . feather_escape($cur_post['email']) . '">' . $lang_common['Email'] . '</a></span>';
                 } elseif ($cur_post['email_setting'] == '1' && !$this->user->is_guest && $this->user->g_send_email == '1') {
                     $cur_post['user_contacts'][] = '<span class="email"><a href="' . get_link('mail/' . $cur_post['poster_id'] . '/') . '">' . $lang_common['Email'] . '</a></span>';
                 }
                 if ($cur_post['url'] != '') {
                     if ($this->config['o_censoring'] == '1') {
                         $cur_post['url'] = censor_words($cur_post['url']);
                     }
                     $cur_post['user_contacts'][] = '<span class="website"><a href="' . feather_escape($cur_post['url']) . '" rel="nofollow">' . $lang_topic['Website'] . '</a></span>';
                 }
             }
             if ($this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && $this->user->g_mod_promote_users == '1') {
                 if ($cur_post['g_promote_next_group']) {
                     $cur_post['user_info'][] = '<dd><span><a href="' . get_base_url() . '/user/' . $cur_post['poster_id'] . '/action/promote/pid/' . $cur_post['id'] . '">' . $lang_topic['Promote user'] . '</a></span></dd>';
                 }
             }
             if ($this->user->is_admmod) {
                 $cur_post['user_info'][] = '<dd><span><a href="' . get_link('moderate/get-host/post/' . $cur_post['id'] . '/') . '" title="' . feather_escape($cur_post['poster_ip']) . '">' . $lang_topic['IP address logged'] . '</a></span></dd>';
                 if ($cur_post['admin_note'] != '') {
                     $cur_post['user_info'][] = '<dd><span>' . $lang_topic['Note'] . ' <strong>' . feather_escape($cur_post['admin_note']) . '</strong></span></dd>';
                 }
             }
         } else {
             $cur_post['username_formatted'] = feather_escape($cur_post['username']);
             $cur_post['user_title_formatted'] = get_title($cur_post);
             if ($this->user->is_admmod) {
                 $cur_post['user_info'][] = '<dd><span><a href="moderate.php?get_host=' . $cur_post['id'] . '" title="' . feather_escape($cur_post['poster_ip']) . '">' . $lang_topic['IP address logged'] . '</a></span></dd>';
             }
             if ($this->config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$this->user->is_guest && $this->user->g_send_email == '1') {
                 $cur_post['user_contacts'][] = '<span class="email"><a href="mailto:' . feather_escape($cur_post['poster_email']) . '">' . $lang_common['Email'] . '</a></span>';
             }
         }
         // Generation post action array (quote, edit, delete etc.)
         if (!$is_admmod) {
             if (!$this->user->is_guest) {
                 $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . get_link('report/' . $cur_post['id'] . '/') . '">' . $lang_topic['Report'] . '</a></span></li>';
             }
             if ($cur_topic['closed'] == '0') {
                 if ($cur_post['poster_id'] == $this->user->id) {
                     if ($start_from + $post_count == 1 && $this->user->g_delete_topics == '1' || $start_from + $post_count > 1 && $this->user->g_delete_posts == '1') {
                         $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . get_link('edit/' . $cur_post['id'] . '/') . '">' . $lang_topic['Delete'] . '</a></span></li>';
                     }
                     if ($this->user->g_edit_posts == '1') {
                         $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . get_link('edit/' . $cur_post['id'] . '/') . '">' . $lang_topic['Edit'] . '</a></span></li>';
                     }
                 }
                 if ($cur_topic['post_replies'] == '' && $this->user->g_post_replies == '1' || $cur_topic['post_replies'] == '1') {
                     $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . get_link('post/reply/' . $topic_id . '/quote/' . $cur_post['id'] . '/') . '">' . $lang_topic['Quote'] . '</a></span></li>';
                 }
             }
         } else {
             $cur_post['post_actions'][] = '<li class="postreport"><span><a href="' . get_link('report/' . $cur_post['id'] . '/') . '">' . $lang_topic['Report'] . '</a></span></li>';
             if ($this->user->g_id == FEATHER_ADMIN || !in_array($cur_post['poster_id'], $admin_ids)) {
                 $cur_post['post_actions'][] = '<li class="postdelete"><span><a href="' . get_link('delete/' . $cur_post['id'] . '/') . '">' . $lang_topic['Delete'] . '</a></span></li>';
                 $cur_post['post_actions'][] = '<li class="postedit"><span><a href="' . get_link('edit/' . $cur_post['id'] . '/') . '">' . $lang_topic['Edit'] . '</a></span></li>';
             }
             $cur_post['post_actions'][] = '<li class="postquote"><span><a href="' . get_link('post/reply/' . $topic_id . '/quote/' . $cur_post['id'] . '/') . '">' . $lang_topic['Quote'] . '</a></span></li>';
         }
         // Perform the main parsing of the message (BBCode, smilies, censor words etc)
         $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
         // Do signature parsing/caching
         if ($this->config['o_signatures'] == '1' && $cur_post['signature'] != '' && $this->user->show_sig != '0') {
             if (isset($avatar_cache[$cur_post['poster_id']])) {
                 $cur_post['signature_formatted'] = $avatar_cache[$cur_post['poster_id']];
             } else {
                 $cur_post['signature_formatted'] = parse_signature($cur_post['signature']);
                 $avatar_cache[$cur_post['poster_id']] = $cur_post['signature_formatted'];
             }
         }
         $post_data[] = $cur_post;
     }
     return $post_data;
 }
Ejemplo n.º 29
0
function parse_signature($text)
{
    global $pun_config, $lang_common, $pun_user;
    if ($pun_config['o_censoring'] == '1') {
        $text = censor_words($text);
    }
    $text = pun_htmlspecialchars($text);
    if ($pun_config['o_make_links'] == '1') {
        $text = do_clickable($text);
    }
    if ($pun_config['o_smilies_sig'] == '1' && $pun_user['show_smilies'] != '0') {
        $text = do_smilies($text);
    }
    if ($pun_config['p_sig_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) {
        $text = do_bbcode($text);
        if ($pun_config['p_sig_img_tag'] == '1') {
            //			$text = preg_replace('#\[img\]((ht|f)tps?://)([^\s<"]*?)\.(jpg|jpeg|png|gif)\[/img\]#e', 'handle_img_tag(\'$1$3.$4\', true)', $text);
            $text = preg_replace('#\\[img\\]((ht|f)tps?://)([^\\s<"]*?)\\[/img\\]#e', 'handle_img_tag(\'$1$3\', true)', $text);
        }
    }
    // Deal with newlines, tabs and multiple spaces
    $pattern = array("\n", "\t", '  ', '  ');
    $replace = array('<br />', '&nbsp; &nbsp; ', '&nbsp; ', ' &nbsp;');
    $text = str_replace($pattern, $replace, $text);
    return $text;
}
Ejemplo n.º 30
0
require PUN_ROOT . 'include/common.php';
if ($pun_user['g_read_board'] == '0') {
    message($lang_common['No view'], false, '403 Forbidden');
}
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id < 1) {
    message($lang_common['Bad request'], false, '404 Not Found');
}
// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.first_post_id, t.closed, p.posted, p.poster, p.poster_id, p.message, p.hide_smilies FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'topics AS t ON t.id=p.topic_id INNER JOIN ' . $db->prefix . 'forums AS f ON f.id=t.forum_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $pun_user['g_id'] . ') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id=' . $id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if (!$db->num_rows($result)) {
    message($lang_common['Bad request'], false, '404 Not Found');
}
$cur_post = $db->fetch_assoc($result);
if ($pun_config['o_censoring'] == '1') {
    $cur_post['subject'] = censor_words($cur_post['subject']);
}
// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = $cur_post['moderators'] != '' ? unserialize($cur_post['moderators']) : array();
$is_admmod = $pun_user['g_id'] == PUN_ADMIN || $pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array) ? true : false;
$is_topic_post = $id == $cur_post['first_post_id'] ? true : false;
// Do we have permission to edit this post?
if (($pun_user['g_delete_posts'] == '0' || $pun_user['g_delete_topics'] == '0' && $is_topic_post || $cur_post['poster_id'] != $pun_user['id'] || $cur_post['closed'] == '1') && !$is_admmod) {
    message($lang_common['No permission'], false, '403 Forbidden');
}
if ($is_admmod && $pun_user['g_id'] != PUN_ADMIN && in_array($cur_post['poster_id'], get_admin_ids())) {
    message($lang_common['No permission'], false, '403 Forbidden');
}
// Load the delete.php language file
require PUN_ROOT . 'lang/' . $pun_user['language'] . '/delete.php';
if (isset($_POST['delete'])) {