Ejemplo n.º 1
0
 // 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;
 }
 ($hook = get_hook('ex_pre_forum_output')) ? eval($hook) : null;
 $output_func = 'output_' . $type;
Ejemplo n.º 2
0
    if ($cur_topic['is_subscribed']) {
        $forum_page['main_head_options']['unsubscribe'] = '<span><a class="sub-option" href="' . forum_link($forum_url['unsubscribe'], array($id, generate_form_token('unsubscribe' . $id . $forum_user['id']))) . '"><em>' . $lang_topic['Unsubscribe'] . '</em></a></span>';
    } else {
        $forum_page['main_head_options']['subscribe'] = '<span><a class="sub-option" href="' . forum_link($forum_url['subscribe'], array($id, generate_form_token('subscribe' . $id . $forum_user['id']))) . '" title="' . $lang_topic['Subscribe info'] . '">' . $lang_topic['Subscribe'] . '</a></span>';
    }
}
if ($forum_page['is_admmod']) {
    $forum_page['main_foot_options'] = array('move' => '<span class="first-item"><a class="mod-option" href="' . forum_link($forum_url['move'], array($cur_topic['forum_id'], $id)) . '">' . $lang_topic['Move'] . '</a></span>', 'delete' => '<span><a class="mod-option" href="' . forum_link($forum_url['delete'], $cur_topic['first_post_id']) . '">' . $lang_topic['Delete topic'] . '</a></span>', 'close' => $cur_topic['closed'] == '1' ? '<span><a class="mod-option" href="' . forum_link($forum_url['open'], array($cur_topic['forum_id'], $id, generate_form_token('open' . $id))) . '">' . $lang_topic['Open'] . '</a></span>' : '<span><a class="mod-option" href="' . forum_link($forum_url['close'], array($cur_topic['forum_id'], $id, generate_form_token('close' . $id))) . '">' . $lang_topic['Close'] . '</a></span>', 'sticky' => $cur_topic['sticky'] == '1' ? '<span><a class="mod-option" href="' . forum_link($forum_url['unstick'], array($cur_topic['forum_id'], $id, generate_form_token('unstick' . $id))) . '">' . $lang_topic['Unstick'] . '</a></span>' : '<span><a class="mod-option" href="' . forum_link($forum_url['stick'], array($cur_topic['forum_id'], $id, generate_form_token('stick' . $id))) . '">' . $lang_topic['Stick'] . '</a></span>');
    if ($cur_topic['num_replies'] != 0) {
        $forum_page['main_foot_options']['moderate_topic'] = '<span><a class="mod-option" href="' . forum_sublink($forum_url['moderate_topic'], $forum_url['page'], $forum_page['page'], array($cur_topic['forum_id'], $id)) . '">' . $lang_topic['Moderate topic'] . '</a></span>';
    }
}
// Setup breadcrumbs
$forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), array($cur_topic['forum_name'], forum_link($forum_url['forum'], array($cur_topic['forum_id'], sef_friendly($cur_topic['forum_name'])))), array($cur_topic['subject'], forum_link($forum_url['topic'], array($id, sef_friendly($cur_topic['subject'])))));
// Setup main heading
$forum_page['main_title'] = ($cur_topic['closed'] == '1' ? $lang_topic['Topic closed'] . ' ' : '') . '<a class="permalink" href="' . forum_link($forum_url['topic'], array($id, sef_friendly($cur_topic['subject']))) . '" rel="bookmark" title="' . $lang_topic['Permalink topic'] . '">' . forum_htmlencode($cur_topic['subject']) . '</a>';
if ($forum_page['num_pages'] > 1) {
    $forum_page['main_head_pages'] = sprintf($lang_common['Page info'], $forum_page['page'], $forum_page['num_pages']);
}
($hook = get_hook('vt_pre_header_load')) ? eval($hook) : null;
// Allow indexing if this is a permalink
if (!$pid) {
    define('FORUM_ALLOW_INDEX', 1);
}
define('FORUM_PAGE', 'viewtopic');
require FORUM_ROOT . 'header.php';
// START SUBST - <!-- forum_main -->
ob_start();
($hook = get_hook('vt_main_output_start')) ? eval($hook) : null;
?>
	<div class="main-head">
function send_forum_subscriptions($topic_info, $new_tid)
{
    global $forum_config, $forum_db, $forum_url, $lang_common;
    $return = ($hook = get_hook('fn_send_forum_subscriptions_start')) ? eval($hook) : null;
    if ($return != null) {
        return;
    }
    if ($forum_config['o_subscriptions'] != '1') {
        return;
    }
    // Get any subscribed users that should be notified (banned users are excluded)
    $query = array('SELECT' => 'u.id, u.email, u.notify_with_post, u.language', 'FROM' => 'users AS u', 'JOINS' => array(array('INNER JOIN' => 'forum_subscriptions AS fs', 'ON' => 'u.id=fs.user_id'), array('LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id=' . $topic_info['forum_id'] . ' AND fp.group_id=u.group_id)'), array('LEFT JOIN' => 'online AS o', 'ON' => 'u.id=o.user_id'), array('LEFT JOIN' => 'bans AS b', 'ON' => 'u.username=b.username')), 'WHERE' => 'b.username IS NULL AND (fp.read_forum IS NULL OR fp.read_forum=1) AND fs.forum_id=' . $topic_info['forum_id'] . ' AND u.id!=' . $topic_info['poster_id']);
    ($hook = get_hook('fn_send_forum_subscriptions_qr_get_users_to_notify')) ? eval($hook) : null;
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $subscribers = array();
    while ($row = $forum_db->fetch_assoc($result)) {
        $subscribers[] = $row;
    }
    if (!empty($subscribers)) {
        if (!defined('FORUM_EMAIL_FUNCTIONS_LOADED')) {
            require FORUM_ROOT . 'include/email.php';
        }
        $notification_emails = array();
        // Loop through subscribed users and send e-mails
        foreach ($subscribers as $cur_subscriber) {
            // Is the subscription e-mail for $cur_subscriber['language'] cached or not?
            if (!isset($notification_emails[$cur_subscriber['language']]) && file_exists(FORUM_ROOT . 'lang/' . $cur_subscriber['language'] . '/mail_templates/new_topic.tpl')) {
                // Load the "new topic" template
                $mail_tpl = forum_trim(file_get_contents(FORUM_ROOT . 'lang/' . $cur_subscriber['language'] . '/mail_templates/new_topic.tpl'));
                // Load the "new topic full" template (with first post included)
                $mail_tpl_full = forum_trim(file_get_contents(FORUM_ROOT . 'lang/' . $cur_subscriber['language'] . '/mail_templates/new_topic_full.tpl'));
                // The first row contains the subject (it also starts with "Subject:")
                $first_crlf = strpos($mail_tpl, "\n");
                $mail_subject = forum_trim(substr($mail_tpl, 8, $first_crlf - 8));
                $mail_message = forum_trim(substr($mail_tpl, $first_crlf));
                $first_crlf = strpos($mail_tpl_full, "\n");
                $mail_subject_full = forum_trim(substr($mail_tpl_full, 8, $first_crlf - 8));
                $mail_message_full = forum_trim(substr($mail_tpl_full, $first_crlf));
                $mail_subject = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_subject);
                $mail_message = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_message);
                $mail_message = str_replace('<topic_starter>', $topic_info['poster'], $mail_message);
                $mail_message = str_replace('<topic_subject>', '\'' . $topic_info['subject'] . '\'', $mail_message);
                $mail_message = str_replace('<topic_url>', forum_link($forum_url['topic'], array($new_tid, sef_friendly($topic_info['subject']))), $mail_message);
                $mail_message = str_replace('<unsubscribe_url>', forum_link($forum_url['forum_unsubscribe'], array($topic_info['forum_id'], generate_form_token('forum_unsubscribe' . $topic_info['forum_id'] . $cur_subscriber['id']))), $mail_message);
                $mail_message = str_replace('<board_mailer>', sprintf($lang_common['Forum mailer'], $forum_config['o_board_title']), $mail_message);
                $mail_subject_full = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_subject_full);
                $mail_message_full = str_replace('<forum_name>', '\'' . $topic_info['forum_name'] . '\'', $mail_message_full);
                $mail_message_full = str_replace('<topic_starter>', $topic_info['poster'], $mail_message_full);
                $mail_message_full = str_replace('<topic_subject>', '\'' . $topic_info['subject'] . '\'', $mail_message_full);
                $mail_message_full = str_replace('<message>', $topic_info['message'], $mail_message_full);
                $mail_message_full = str_replace('<topic_url>', forum_link($forum_url['topic'], $new_tid), $mail_message_full);
                $mail_message_full = str_replace('<unsubscribe_url>', forum_link($forum_url['forum_unsubscribe'], array($topic_info['forum_id'], generate_form_token('forum_unsubscribe' . $topic_info['forum_id'] . $cur_subscriber['id']))), $mail_message_full);
                $mail_message_full = str_replace('<board_mailer>', sprintf($lang_common['Forum mailer'], $forum_config['o_board_title']), $mail_message_full);
                $notification_emails[$cur_subscriber['language']][0] = $mail_subject;
                $notification_emails[$cur_subscriber['language']][1] = $mail_message;
                $notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;
                $notification_emails[$cur_subscriber['language']][3] = $mail_message_full;
                $mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;
            }
            // We have to double check here because the templates could be missing
            // Make sure the e-mail address format is valid before sending
            if (isset($notification_emails[$cur_subscriber['language']]) && is_valid_email($cur_subscriber['email'])) {
                if ($cur_subscriber['notify_with_post'] == '0') {
                    forum_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);
                } else {
                    forum_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);
                }
            }
        }
    }
    ($hook = get_hook('fn_send_forum_subscriptions_end')) ? eval($hook) : null;
}
Ejemplo n.º 4
0
$forum_page['form_action'] = forum_link($forum_url['edit'], $id);
$forum_page['form_attributes'] = array();
$forum_page['hidden_fields'] = array('form_sent' => '<input type="hidden" name="form_sent" value="1" />', 'csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />');
// Setup help
$forum_page['main_head_options'] = array();
if ($forum_config['p_message_bbcode'] == '1') {
    $forum_page['text_options']['bbcode'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'bbcode') . '" title="' . sprintf($lang_common['Help page'], $lang_common['BBCode']) . '">' . $lang_common['BBCode'] . '</a></span>';
}
if ($forum_config['p_message_img_tag'] == '1') {
    $forum_page['text_options']['img'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'img') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Images']) . '">' . $lang_common['Images'] . '</a></span>';
}
if ($forum_config['o_smilies'] == '1') {
    $forum_page['text_options']['smilies'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'smilies') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Smilies']) . '">' . $lang_common['Smilies'] . '</a></span>';
}
// Setup breadcrumbs
$forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), array($cur_post['forum_name'], forum_link($forum_url['forum'], array($cur_post['fid'], sef_friendly($cur_post['forum_name'])))), array($cur_post['subject'], forum_link($forum_url['topic'], array($cur_post['tid'], sef_friendly($cur_post['subject'])))), $id == $cur_post['first_post_id'] ? $lang_post['Edit topic'] : $lang_post['Edit reply']);
($hook = get_hook('ed_pre_header_load')) ? eval($hook) : null;
define('FORUM_PAGE', 'postedit');
require FORUM_ROOT . 'header.php';
// START SUBST - <!-- forum_main -->
ob_start();
($hook = get_hook('ed_main_output_start')) ? eval($hook) : null;
?>
	<div class="main-head">
		<h2 class="hn"><span><?php 
echo $id == $cur_post['first_post_id'] ? $lang_post['Edit topic'] : $lang_post['Edit reply'];
?>
</span></h2>
	</div>
<?php 
// If preview selected and there are no errors
Ejemplo n.º 5
0
    $forum_page['group_count'] = $forum_page['item_count'] = $forum_page['item_num'] = 0;
    $forum_page['old_reports'] = true;
    ?>
	<div class="main-subhead">
		<h2 class="hn"><span><?php 
    echo $lang_admin_reports['Read reports heading'];
    echo $forum_db->num_rows($result) ? '' : ' ' . $lang_admin_reports['No new reports'];
    ?>
</span></h2>
	</div>
	<div class="main-content main-frm">
<?php 
    while ($cur_report = $forum_db->fetch_assoc($result)) {
        $reporter = $cur_report['reporter'] != '' ? '<a href="' . forum_link($forum_url['user'], $cur_report['reported_by']) . '">' . forum_htmlencode($cur_report['reporter']) . '</a>' : $lang_admin_reports['Deleted user'];
        $forum = $cur_report['forum_name'] != '' ? '<a href="' . forum_link($forum_url['forum'], array($cur_report['forum_id'], sef_friendly($cur_report['forum_name']))) . '">' . forum_htmlencode($cur_report['forum_name']) . '</a>' : $lang_admin_reports['Deleted forum'];
        $topic = $cur_report['subject'] != '' ? '<a href="' . forum_link($forum_url['topic'], array($cur_report['topic_id'], sef_friendly($cur_report['subject']))) . '">' . forum_htmlencode($cur_report['subject']) . '</a>' : $lang_admin_reports['Deleted topic'];
        $message = str_replace("\n", '<br />', forum_htmlencode($cur_report['message']));
        $post_id = $cur_report['pid'] != '' ? '<a href="' . forum_link($forum_url['post'], $cur_report['pid']) . '">Post #' . $cur_report['pid'] . '</a>' : $lang_admin_reports['Deleted post'];
        $zapped_by = $cur_report['zapped_by'] != '' ? '<a href="' . forum_link($forum_url['user'], $cur_report['zapped_by_id']) . '">' . forum_htmlencode($cur_report['zapped_by']) . '</a>' : $lang_admin_reports['Deleted user'];
        ($hook = get_hook('arp_report_pre_display')) ? eval($hook) : null;
        ?>
			<div class="ct-set report data-set set<?php 
        echo ++$forum_page['item_count'];
        ?>
">
				<div class="ct-box data-box">
					<h3 class="ct-legend hn"><strong><?php 
        echo ++$forum_page['item_num'];
        ?>
</strong> <cite class="username"><?php 
        printf($lang_admin_reports['Reported by'], $reporter);
Ejemplo n.º 6
0
 public function get_simtopics($topic_subject, $forum_id, $topic_id)
 {
     // IMPORT GLOBALS
     global $forum_db, $db_type, $forum_user, $forum_url, $stop_list_fancy_simtopics, $forum_config, $lang_fancy_simtopics;
     // WORK ONLY ON MYSQL
     if (!in_array($db_type, array('mysqli', 'mysql'))) {
         return '';
     }
     $stop_list = array();
     // PER-LANG stoplist
     if (!isset($stop_list_fancy_simtopics)) {
         $stop_list_fancy_simtopics = array();
     }
     // CONSTRUCT PER-FORUM STOPWORDS VAR NAME
     $_stop_words_var = 'stop_list_fancy_simtopics_' . intval($forum_id, 10);
     // PER-FORUM stoplist
     if (isset($GLOBALS[$_stop_words_var]) && is_array($GLOBALS[$_stop_words_var])) {
         // MERGE STOP-WORDS
         $stop_list = array_merge($stop_list_fancy_simtopics, $GLOBALS[$_stop_words_var]);
     } else {
         $stop_list = $stop_list_fancy_simtopics;
     }
     // NUM TO SHOW
     $num_show = intval($forum_config['o_fancy_simtopics_num_topics'], 10) > 0 ? intval($forum_config['o_fancy_simtopics_num_topics'], 10) : 0;
     if ($num_show < 1) {
         return '';
     }
     // TIME TO SHOW
     $time_show_query_part = '';
     $time_show = intval($forum_config['o_fancy_simtopics_time_topics'], 10) > 0 ? time() - intval($forum_config['o_fancy_simtopics_time_topics'], 10) * 86400 : 0;
     if ($time_show > 1) {
         $time_show_query_part = 'AND t.posted > ' . $time_show;
     }
     // CLEAR SUBJECT
     $topic_subject = $this->clear_topics_subject($topic_subject, $stop_list, $forum_user['language']);
     // DONT SEARCH In THIS FORUMS
     $skip_forums_query_part = '';
     $skip_forums_ids = $this->get_forum_id_without_searches();
     if (!empty($skip_forums_ids)) {
         $skip_forums_query_part = 'AND t.forum_id NOT IN (' . implode(',', $skip_forums_ids) . ')';
     }
     // SEARCH ONE FORUM
     $header = $lang_fancy_simtopics['Header'];
     $search_one_forum_query_part = '';
     if ($forum_config['o_fancy_simtopics_one_forum'] == '1' && $forum_id > 0) {
         $search_one_forum_query_part = 'AND t.forum_id=' . $forum_id;
         $header = $lang_fancy_simtopics['Header One Forum'];
     }
     // BUILD QUERY
     $query = array('SELECT' => 't.id, t.subject, t.closed, MATCH (subject) AGAINST (\'' . $forum_db->escape($topic_subject) . '\') AS score', 'FROM' => 'topics AS t', 'JOINS' => array(array('INNER JOIN' => 'forums AS f', 'ON' => 'f.id=t.forum_id'), array('LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id=f.id AND fp.group_id=' . $forum_user['g_id'] . ')')), 'WHERE' => 't.id != ' . $topic_id . ' AND t.moved_to IS NULL ' . $search_one_forum_query_part . ' ' . $skip_forums_query_part . ' ' . $time_show_query_part . ' AND MATCH (subject) AGAINST (\'' . $forum_db->escape($topic_subject) . '\') >= 0.5', 'ORDER' => 'score DESC', 'LIMIT' => $num_show);
     ($hook = get_hook('fancy_simtopics_get_query')) ? eval($hook) : null;
     $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
     // BUILD LINK LIST
     $topic_links = array();
     while ($sim_topic = $forum_db->fetch_assoc($result)) {
         $li_class = $sim_topic['closed'] ? 'class="fancy_closed"' : '';
         $topic_links[] = '<li ' . $li_class . '><a href="' . forum_link($forum_url['topic'], array($sim_topic['id'], sef_friendly($sim_topic['subject']))) . '">' . forum_htmlencode($sim_topic['subject']) . '</a></li>';
         ($hook = get_hook('fancy_simtopics_in_row_end')) ? eval($hook) : null;
     }
     return !empty($topic_links) ? sprintf('<div id="fancy_simtopics_block" class="brd crumbs"><h3>' . $header . '</h3><ul>%s</ul></div>', implode(' ', $topic_links)) : '';
 }
Ejemplo n.º 7
0
function om_warnings_display_warning(&$forum_page, $cur_warning)
{
    global $forum_url, $lang_om_warnings;
    // Prepare warning data
    $forum_page['warning_info'] = array();
    $forum_page['warning_info']['warn_name'] = '<span>' . sprintf($lang_om_warnings['Warning name'], forum_htmlencode($cur_warning['warn_name'])) . '</span>';
    $forum_page['warning_info']['points'] = '<span>' . sprintf($lang_om_warnings['Warning points'], $cur_warning['points']) . '</span>';
    $forum_page['warning_info']['reporter'] = '<span>' . sprintf($lang_om_warnings['Reported by'], $cur_warning['reporter'] != '' ? '<a href="' . forum_link($forum_url['user'], $cur_warning['reporter_id']) . '">' . forum_htmlencode($cur_warning['reporter']) . '</a>' : $lang_om_warnings['Deleted reporter']) . '</span>';
    $forum_page['warning_info']['created'] = '<span>' . sprintf($lang_om_warnings['Created'], format_time($cur_warning['created'])) . '</span>';
    $forum_page['warning_info']['expire'] = '<span>' . sprintf($lang_om_warnings['Expire'], isset($cur_warning['expire_date']) ? format_time($cur_warning['expire_date']) : $lang_om_warnings['Never']) . '</span>';
    $user = $cur_warning['username'] != '' ? '<a href="' . forum_link($forum_url['user'], $cur_warning['user_id']) . '">' . forum_htmlencode($cur_warning['username']) . '</a>' : $lang_om_warnings['Deleted reporter'];
    $forum = $cur_warning['forum_name'] != '' ? '<a href="' . forum_link($forum_url['forum'], array($cur_warning['forum_id'], sef_friendly($cur_warning['forum_name']))) . '">' . forum_htmlencode($cur_warning['forum_name']) . '</a>' : $lang_om_warnings['Deleted forum'];
    $topic = $cur_warning['subject'] != '' ? '<a href="' . forum_link($forum_url['topic'], array($cur_warning['topic_id'], sef_friendly($cur_warning['subject']))) . '">' . forum_htmlencode($cur_warning['subject']) . '</a>' : $lang_om_warnings['Deleted topic'];
    $post = $cur_warning['pid'] != '' ? '<a href="' . forum_link($forum_url['post'], $cur_warning['pid']) . '">' . sprintf($lang_om_warnings['Post'], $cur_warning['pid']) . '</a>' : $lang_om_warnings['Deleted post'];
    $message = str_replace("\n", '</p><p>', forum_htmlencode($cur_warning['message']));
    $is_expired = $cur_warning['expire_date'] != null && $cur_warning['expire_date'] < $forum_page['now'];
    $post_path = sprintf('%s  &rarr; %s  &rarr;  %s', $forum, $topic, $post);
    if ($cur_warning['forum_name'] == null && $cur_warning['topic_id'] == null && $cur_warning['pid'] == null) {
        $post_path = $lang_om_warnings['No post'];
    }
    // Setup output
    ($hook = get_hook('om_warnings_fn_display_warning_pre_display')) ? eval($hook) : null;
    ?>
		<div class="ct-set <?php 
    echo $is_expired ? 'data-set' : 'warn-set';
    ?>
 report set<?php 
    echo ++$forum_page['item_count'];
    ?>
">
			<div class="ct-box <?php 
    echo $is_expired ? 'data-box' : 'warn-box';
    ?>
">
				<h3 class="ct-legend hn"><strong><?php 
    echo ++$forum_page['item_num'];
    ?>
</strong> <cite class="username"><?php 
    printf($lang_om_warnings['User'], $user);
    ?>
</cite>
					<?php 
    echo implode("\n\t\t\t\t\t", $forum_page['warning_info']) . "\n";
    ?>
				</h3>
				<h4 class="hn"><?php 
    echo $post_path;
    ?>
</h4>
				<p><?php 
    echo $message;
    ?>
</p>
<?php 
    if ($forum_page['om_warnings_admin']) {
        ?>
				<p class="item-select"><input type="checkbox" id="fld<?php 
        echo ++$forum_page['fld_count'];
        ?>
" name="warn[<?php 
        echo $cur_warning['id'];
        ?>
]" value="<?php 
        echo $cur_warning['id'];
        ?>
" /> <label for="fld<?php 
        echo $forum_page['fld_count'];
        ?>
"><?php 
        echo $lang_om_warnings['Select report'];
        ?>
</label></p>
<?php 
    }
    ($hook = get_hook('om_warnings_list_warning_block')) ? eval($hook) : null;
    ?>
			</div>
		</div>
<?php 
}
Ejemplo n.º 8
0
                                        // If it's in GET, we need to make sure it's valid.
                                        if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('forum_unsubscribe' . $forum_id . $forum_user['id']))) {
                                            csrf_confirm_form();
                                        }
                                        ($hook = get_hook('mi_forum_unsubscribe_selected')) ? eval($hook) : null;
                                        // Make sure the user can view the forum
                                        $query = array('SELECT' => 'f.forum_name', 'FROM' => 'forums AS f', 'JOINS' => array(array('LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id=f.id AND fp.group_id=' . $forum_user['g_id'] . ')')), 'WHERE' => '(fp.read_forum IS NULL OR fp.read_forum=1) AND f.id=' . $forum_id);
                                        ($hook = get_hook('mi_forum_unsubscribe_qr_check_subscribed')) ? eval($hook) : null;
                                        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                                        $forum_name = $forum_db->result($result);
                                        if (!$forum_name) {
                                            message($lang_misc['Not subscribed']);
                                        }
                                        $query = array('DELETE' => 'forum_subscriptions', 'WHERE' => 'user_id=' . $forum_user['id'] . ' AND forum_id=' . $forum_id);
                                        ($hook = get_hook('mi_unsubscribe_qr_delete_subscription')) ? eval($hook) : null;
                                        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                                        $forum_flash->add_info($lang_misc['Unsubscribe redirect']);
                                        ($hook = get_hook('mi_forum_unsubscribe_pre_redirect')) ? eval($hook) : null;
                                        redirect(forum_link($forum_url['forum'], array($forum_id, sef_friendly($forum_name))), $lang_misc['Unsubscribe redirect']);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
($hook = get_hook('mi_new_action')) ? eval($hook) : null;
message($lang_common['Bad request']);
Ejemplo n.º 9
0
// Setup help
$forum_page['text_options'] = array();
if ($forum_config['p_message_bbcode'] == '1') {
    $forum_page['text_options']['bbcode'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'bbcode') . '" title="' . sprintf($lang_common['Help page'], $lang_common['BBCode']) . '">' . $lang_common['BBCode'] . '</a></span>';
}
if ($forum_config['p_message_img_tag'] == '1') {
    $forum_page['text_options']['img'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'img') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Images']) . '">' . $lang_common['Images'] . '</a></span>';
}
if ($forum_config['o_smilies'] == '1') {
    $forum_page['text_options']['smilies'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'smilies') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Smilies']) . '">' . $lang_common['Smilies'] . '</a></span>';
}
// Setup breadcrumbs
$forum_page['crumbs'][] = array($forum_config['o_board_title'], forum_link($forum_url['index']));
$forum_page['crumbs'][] = array($cur_posting['forum_name'], forum_link($forum_url['forum'], array($cur_posting['id'], sef_friendly($cur_posting['forum_name']))));
if ($tid) {
    $forum_page['crumbs'][] = array($cur_posting['subject'], forum_link($forum_url['topic'], array($tid, sef_friendly($cur_posting['subject']))));
}
$forum_page['crumbs'][] = $tid ? $lang_post['Post reply'] : $lang_post['Post new topic'];
($hook = get_hook('po_pre_header_load')) ? eval($hook) : null;
define('FORUM_PAGE', 'post');
require FORUM_ROOT . 'header.php';
// START SUBST - <!-- forum_main -->
ob_start();
($hook = get_hook('po_main_output_start')) ? eval($hook) : null;
?>
	<div class="main-head">
		<h2 class="hn"><span><?php 
echo $tid ? $lang_post['Post reply'] : $lang_post['Post new topic'];
?>
</span></h2>
	</div>
Ejemplo n.º 10
0
function om_subforums_get_plain($fid)
{
    global $forum_url;
    ($hook = get_hook('om_subforums_fn_get_plain_start')) ? eval($hook) : null;
    $s = array();
    // iterates through subforums and creates links to them
    foreach (om_subforums_get_subforums($fid) as $cur_subforum) {
        $link = forum_link($forum_url['forum'], array($cur_subforum['fid'], sef_friendly($cur_subforum['forum_name'])));
        // $link -> link to subforum
        // $cur_subforum['forum_name'] -> name of forum
        // $cur_subforum['forum_desc'] -> forum description
        $s[] = '<a href="' . $link . '">' . $cur_subforum['forum_name'] . '</a>';
    }
    if (empty($s)) {
        return '';
    }
    ($hook = get_hook('om_subforums_fn_get_plain_pre_return')) ? eval($hook) : null;
    return implode(', ', $s);
}
Ejemplo n.º 11
0
<?php 
    $forum_id = $fid;
    $tpl_temp = forum_trim(ob_get_contents());
    $tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
    ob_end_clean();
    // END SUBST - <!-- forum_main -->
    require FORUM_ROOT . 'footer.php';
}
if (isset($_POST['move_posts_to'])) {
    $move_to_topic = isset($_POST['move_to_topic']) && !empty($_POST['move_to_topic']) ? $_POST['move_to_topic'] : array();
    if (empty($posts)) {
        message($lang_misc['No posts selected']);
    }
    if (!defined('OM_MOVE_POSTS_FUNCTIONS_LOADED')) {
        require $ext_info['path'] . '/functions.php';
    }
    $om_move_posts_max = om_move_posts_load_cache() + 1;
    om_move_posts_generate_cache($om_move_posts_max);
    // Move the posts
    $query = array('UPDATE' => 'posts', 'SET' => 'topic_id=' . $move_to_topic . ', om_move_posts=' . $om_move_posts_max, 'WHERE' => 'id IN(' . implode(',', $posts) . ')');
    if (isset($_POST['change_time'])) {
        $query['SET'] .= ', posted=' . time();
    }
    ($hook = get_hook('move_post_qr_update_post')) ? eval($hook) : null;
    $forum_db->query_build($query) or error(__FILE__, __LINE__);
    sync_topic($tid);
    sync_topic($move_to_topic);
    sync_forum($fid);
    ($hook = get_hook('move_post_end_pre_redirect')) ? eval($hook) : null;
    redirect(forum_link($forum_url['topic'], array($tid, sef_friendly($cur_topic['subject']))), 'Move posts');
}
Ejemplo n.º 12
0
 public function action_alerts_topics_off()
 {
     global $forum_db, $forum_user, $forum_url, $lang_common, $lang_fancy_alerts, $forum_flash, $ext_info;
     if ($forum_user['is_guest']) {
         message($lang_common['No permission']);
     }
     // TOPIC ID
     $tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
     if ($tid < 1) {
         message($lang_common['Bad request']);
     }
     // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid.
     // If it's in GET, we need to make sure it's valid.
     if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('fancy_alerts_topics_off' . $tid . $forum_user['id']))) {
         csrf_confirm_form();
     }
     // LOAD LANG
     if (!isset($lang_fancy_alerts)) {
         if ($forum_user['language'] != 'English' && file_exists($ext_info['path'] . '/lang/' . $forum_user['language'] . '/' . $ext_info['id'] . '.php')) {
             require $ext_info['path'] . '/lang/' . $forum_user['language'] . '/' . $ext_info['id'] . '.php';
         } else {
             require $ext_info['path'] . '/lang/English/' . $ext_info['id'] . '.php';
         }
     }
     // GET TOPIC LAST_POST_TIME AND SUBJECT
     // Make sure the user can view the topic
     $query = array('SELECT' => 'subject, last_post', 'FROM' => 'topics AS t', 'JOINS' => array(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.id=' . $tid . ' AND t.moved_to IS NULL');
     $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
     $cur_topic = $forum_db->fetch_assoc($result);
     if (!$cur_topic) {
         message($lang_common['Bad request']);
     }
     // DEL CURRENT TOPIC ALERTS
     $query = array('DELETE' => 'fancy_alerts_topics', 'WHERE' => 'user_id=' . $forum_user['id'] . ' AND topic_id=' . $tid);
     $forum_db->query_build($query) or error(__FILE__, __LINE__);
     $forum_flash->add_info($lang_fancy_alerts['Alerts Topics off redirect']);
     // REDIRECT TO INDEX
     redirect(forum_link($forum_url['topic'], array($tid, sef_friendly($cur_topic['subject']))), $lang_fancy_alerts['Alerts Topics off redirect']);
 }
Ejemplo n.º 13
0
// Setup form information
$forum_page['frm_info'] = array('<li><span>' . $lang_delete['Forum'] . ':<strong> ' . forum_htmlencode($cur_post['forum_name']) . '</strong></span></li>', '<li><span>' . $lang_delete['Topic'] . ':<strong> ' . forum_htmlencode($cur_post['subject']) . '</strong></span></li>');
// Generate the post heading
$forum_page['post_ident'] = array();
$forum_page['post_ident']['byline'] = '<span class="post-byline">' . sprintf($cur_post['is_topic'] ? $lang_delete['Topic byline'] : $lang_delete['Reply byline'], '<strong>' . forum_htmlencode($cur_post['poster']) . '</strong>') . '</span>';
$forum_page['post_ident']['link'] = '<span class="post-link"><a class="permalink" href="' . forum_link($forum_url['post'], $cur_post['tid']) . '">' . format_time($cur_post['posted']) . '</a></span>';
($hook = get_hook('dl_pre_item_ident_merge')) ? eval($hook) : null;
// Generate the post title
if ($cur_post['is_topic']) {
    $forum_page['item_subject'] = sprintf($lang_delete['Topic title'], $cur_post['subject']);
} else {
    $forum_page['item_subject'] = sprintf($lang_delete['Reply title'], $cur_post['subject']);
}
$forum_page['item_subject'] = forum_htmlencode($forum_page['item_subject']);
// Setup breadcrumbs
$forum_page['crumbs'] = array(array($forum_config['o_board_title'], forum_link($forum_url['index'])), array($cur_post['forum_name'], forum_link($forum_url['forum'], array($cur_post['fid'], sef_friendly($cur_post['forum_name'])))), array($cur_post['subject'], forum_link($forum_url['topic'], array($cur_post['tid'], sef_friendly($cur_post['subject'])))), $cur_post['is_topic'] ? $lang_delete['Delete topic'] : $lang_delete['Delete post']);
($hook = get_hook('dl_pre_header_load')) ? eval($hook) : null;
define('FORUM_PAGE', 'postdelete');
require FORUM_ROOT . 'header.php';
// START SUBST - <!-- forum_main -->
ob_start();
($hook = get_hook('dl_main_output_start')) ? eval($hook) : null;
?>
	<div class="main-content main-frm">
		<div class="ct-box info-box">
			<ul class="info-list">
				<?php 
echo implode("\n\t\t\t\t", $forum_page['frm_info']) . "\n";
?>
			</ul>
		</div>
Ejemplo n.º 14
0
                $forum_page['item_nav']['new'] = '<em class="item-newposts"><a href="' . forum_link($forum_url['topic_new_posts'], array($cur_set['tid'], sef_friendly($cur_set['subject']))) . '" title="' . $lang_forum['New posts info'] . '">' . $lang_forum['New posts'] . '</a></em>';
                $forum_page['item_status']['new'] = 'new';
            }
            ($hook = get_hook('se_results_topics_row_pre_item_nav_merge')) ? eval($hook) : null;
            $forum_page['item_subject']['starter'] = '<span class="item-starter">' . sprintf($lang_forum['Topic starter'], forum_htmlencode($cur_set['poster'])) . '</span>';
            if (!empty($forum_page['item_nav'])) {
                $forum_page['item_subject']['nav'] = '<span class="item-nav">' . sprintf($lang_forum['Topic navigation'], implode('&#160;&#160;', $forum_page['item_nav'])) . '</span>';
            }
            ($hook = get_hook('se_results_topics_row_pre_item_subject_merge')) ? eval($hook) : null;
            $forum_page['item_body']['subject']['desc'] = '<p>' . implode(' ', $forum_page['item_subject']) . '</p>';
            if (empty($forum_page['item_status'])) {
                $forum_page['item_status']['normal'] = 'normal';
            }
            ($hook = get_hook('se_results_topics_pre_item_status_merge')) ? eval($hook) : null;
            $forum_page['item_style'] = ($forum_page['item_count'] % 2 != 0 ? ' odd' : ' even') . ($forum_page['item_count'] == 1 ? ' main-first-item' : '') . (!empty($forum_page['item_status']) ? ' ' . implode(' ', $forum_page['item_status']) : '');
            $forum_page['item_body']['info']['forum'] = '<li class="info-forum"><span class="label">' . $lang_search['Posted in'] . '</span><a href="' . forum_link($forum_url['forum'], array($cur_set['forum_id'], sef_friendly($cur_set['forum_name']))) . '">' . $cur_set['forum_name'] . '</a></li>';
            $forum_page['item_body']['info']['replies'] = '<li class="info-replies"><strong>' . forum_number_format($cur_set['num_replies']) . '</strong> <span class="label">' . ($cur_set['num_replies'] == 1 ? $lang_forum['Reply'] : $lang_forum['Replies']) . '</span></li>';
            $forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">' . $lang_forum['Last post'] . '</span> <strong><a href="' . forum_link($forum_url['post'], $cur_set['last_post_id']) . '">' . format_time($cur_set['last_post']) . '</a></strong> <cite>' . sprintf($lang_forum['by poster'], forum_htmlencode($cur_set['last_poster'])) . '</cite></li>';
            ($hook = get_hook('se_results_topics_row_pre_display')) ? eval($hook) : null;
            ?>
		<div class="main-item<?php 
            echo $forum_page['item_style'];
            ?>
">
			<span class="icon <?php 
            echo implode(' ', $forum_page['item_status']);
            ?>
"><!-- --></span>
			<div class="item-subject">
				<?php 
            echo implode("\n\t\t\t\t", $forum_page['item_body']['subject']) . "\n";
Ejemplo n.º 15
0
function generate_quickjump_cache($group_id = false)
{
    global $forum_db, $lang_common, $forum_url, $forum_config, $forum_user, $base_url;
    $return = ($hook = get_hook('ch_fn_generate_quickjump_cache_start')) ? eval($hook) : null;
    if ($return != null) {
        return;
    }
    // If a group_id was supplied, we generate the quickjump cache for that group only
    if ($group_id !== false) {
        $groups[0] = $group_id;
    } else {
        // A group_id was not supplied, so we generate the quickjump cache for all groups
        $query = array('SELECT' => 'g.g_id', 'FROM' => 'groups AS g');
        ($hook = get_hook('ch_fn_generate_quickjump_cache_qr_get_groups')) ? eval($hook) : null;
        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
        $num_groups = $forum_db->num_rows($result);
        for ($i = 0; $i < $num_groups; ++$i) {
            $groups[] = $forum_db->result($result, $i);
        }
    }
    // Loop through the groups in $groups and output the cache for each of them
    foreach ($groups as $group_id) {
        // Output quickjump as PHP code
        $fh = @fopen(FORUM_CACHE_DIR . 'cache_quickjump_' . $group_id . '.php', 'wb');
        if (!$fh) {
            error('Unable to write quickjump cache file to cache directory. Please make sure PHP has write access to the directory \'cache\'.', __FILE__, __LINE__);
        }
        $output = '<?php' . "\n\n" . 'if (!defined(\'FORUM\')) exit;' . "\n" . 'define(\'FORUM_QJ_LOADED\', 1);' . "\n" . '$forum_id = isset($forum_id) ? $forum_id : 0;' . "\n\n" . '?>';
        $output .= '<form id="qjump" method="get" accept-charset="utf-8" action="' . $base_url . '/viewforum.php">' . "\n\t" . '<div class="frm-fld frm-select">' . "\n\t\t" . '<label for="qjump-select"><span><?php echo $lang_common[\'Jump to\'] ?>' . '</span></label><br />' . "\n\t\t" . '<span class="frm-input"><select id="qjump-select" name="id">' . "\n";
        // Get the list of categories and forums from the DB
        $query = array('SELECT' => 'c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.redirect_url', 'FROM' => 'categories AS c', 'JOINS' => array(array('INNER JOIN' => 'forums AS f', 'ON' => 'c.id=f.cat_id'), array('LEFT JOIN' => 'forum_perms AS fp', 'ON' => '(fp.forum_id=f.id AND fp.group_id=' . $group_id . ')')), 'WHERE' => 'fp.read_forum IS NULL OR fp.read_forum=1', 'ORDER BY' => 'c.disp_position, c.id, f.disp_position');
        ($hook = get_hook('ch_fn_generate_quickjump_cache_qr_get_cats_and_forums')) ? eval($hook) : null;
        $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
        $cur_category = 0;
        $forum_count = 0;
        $sef_friendly_names = array();
        while ($cur_forum = $forum_db->fetch_assoc($result)) {
            ($hook = get_hook('ch_fn_generate_quickjump_cache_forum_loop_start')) ? eval($hook) : null;
            if ($cur_forum['cid'] != $cur_category) {
                if ($cur_category) {
                    $output .= "\t\t\t" . '</optgroup>' . "\n";
                }
                $output .= "\t\t\t" . '<optgroup label="' . forum_htmlencode($cur_forum['cat_name']) . '">' . "\n";
                $cur_category = $cur_forum['cid'];
            }
            $sef_friendly_names[$cur_forum['fid']] = sef_friendly($cur_forum['forum_name']);
            $redirect_tag = $cur_forum['redirect_url'] != '' ? ' &gt;&gt;&gt;' : '';
            $output .= "\t\t\t\t" . '<option value="' . $cur_forum['fid'] . '"<?php echo ($forum_id == ' . $cur_forum['fid'] . ') ? \' selected="selected"\' : \'\' ?>>' . forum_htmlencode($cur_forum['forum_name']) . $redirect_tag . '</option>' . "\n";
            $forum_count++;
        }
        $output .= "\t\t\t" . '</optgroup>' . "\n\t\t" . '</select>' . "\n\t\t" . '<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" onclick="return Forum.doQuickjumpRedirect(forum_quickjump_url, sef_friendly_url_array);" /></span>' . "\n\t" . '</div>' . "\n" . '</form>' . "\n";
        $output .= '<script type="text/javascript">' . "\n\t\t" . 'var forum_quickjump_url = "' . forum_link($forum_url['forum']) . '";' . "\n\t\t" . 'var sef_friendly_url_array = new Array(' . $forum_db->num_rows($result) . ');';
        foreach ($sef_friendly_names as $forum_id => $forum_name) {
            $output .= "\n\t" . 'sef_friendly_url_array[' . $forum_id . '] = "' . forum_htmlencode($forum_name) . '";';
        }
        $output .= "\n" . '</script>' . "\n";
        if ($forum_count < 2) {
            $output = '<?php' . "\n\n" . 'if (!defined(\'FORUM\')) exit;' . "\n" . 'define(\'FORUM_QJ_LOADED\', 1);';
        }
        fwrite($fh, $output);
        fclose($fh);
    }
}
Ejemplo n.º 16
0
     if (!empty($forum_page['item_title_status'])) {
         $forum_page['item_title']['status'] = '<span class="item-status">' . sprintf($lang_forum['Item status'], implode(', ', $forum_page['item_title_status'])) . '</span>';
     }
     $forum_page['item_title']['link'] = '<a href="' . forum_link($forum_url['topic'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))) . '">' . forum_htmlencode($cur_topic['subject']) . '</a>';
     ($hook = get_hook('mr_topic_loop_normal_topic_pre_item_title_merge')) ? eval($hook) : null;
     $forum_page['item_body']['subject']['title'] = '<h3 class="hn"><span class="item-num">' . forum_number_format($forum_page['start_from'] + $forum_page['item_count']) . '</span> ' . implode(' ', $forum_page['item_title']) . '</h3>';
     if (empty($forum_page['item_status'])) {
         $forum_page['item_status']['normal'] = 'normal';
     }
     $forum_page['item_pages'] = ceil(($cur_topic['num_replies'] + 1) / $forum_user['disp_posts']);
     if ($forum_page['item_pages'] > 1) {
         $forum_page['item_nav']['pages'] = '<span>' . $lang_forum['Pages'] . '&#160;</span>' . paginate($forum_page['item_pages'], -1, $forum_url['topic'], $lang_common['Page separator'], array($cur_topic['id'], sef_friendly($cur_topic['subject'])));
     }
     // Does this topic contain posts we haven't read? If so, tag it accordingly.
     if (!$forum_user['is_guest'] && $cur_topic['last_post'] > $forum_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'])) {
         $forum_page['item_nav']['new'] = '<em class="item-newposts"><a href="' . forum_link($forum_url['topic_new_posts'], array($cur_topic['id'], sef_friendly($cur_topic['subject']))) . '">' . $lang_forum['New posts'] . '</a></em>';
         $forum_page['item_status']['new'] = 'new';
     }
     ($hook = get_hook('mr_topic_loop_normal_topic_pre_item_nav_merge')) ? eval($hook) : null;
     if (!empty($forum_page['item_nav'])) {
         $forum_page['item_subject']['nav'] = '<span class="item-nav">' . sprintf($lang_forum['Topic navigation'], implode('&#160;&#160;', $forum_page['item_nav'])) . '</span>';
     }
     // Assemble the Topic subject
     $forum_page['item_body']['info']['replies'] = '<li class="info-replies"><strong>' . forum_number_format($cur_topic['num_replies']) . '</strong> <span class="label">' . ($cur_topic['num_replies'] == 1 ? $lang_forum['Reply'] : $lang_forum['Replies']) . '</span></li>';
     if ($forum_config['o_topic_views'] == '1') {
         $forum_page['item_body']['info']['views'] = '<li class="info-views"><strong>' . forum_number_format($cur_topic['num_views']) . '</strong> <span class="label">' . ($cur_topic['num_views'] == 1 ? $lang_forum['View'] : $lang_forum['Views']) . '</span></li>';
     }
     $forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">' . $lang_forum['Last post'] . '</span> <strong><a href="' . forum_link($forum_url['post'], $cur_topic['last_post_id']) . '">' . format_time($cur_topic['last_post']) . '</a></strong> <cite>' . sprintf($lang_forum['by poster'], forum_htmlencode($cur_topic['last_poster'])) . '</cite></li>';
     $forum_page['item_body']['info']['select'] = '<li class="info-select"><input id="fld' . ++$forum_page['fld_count'] . '" type="checkbox" name="topics[]" value="' . $cur_topic['id'] . '" /> <label for="fld' . $forum_page['fld_count'] . '">' . sprintf($lang_forum['Select topic'], forum_htmlencode($cur_topic['subject'])) . '</label></li>';
     ($hook = get_hook('mr_topic_actions_normal_row_pre_output')) ? eval($hook) : null;
 }
Ejemplo n.º 17
0
     if ($cur_forum['forum_desc'] != '') {
         $forum_page['item_subject']['desc'] = $cur_forum['forum_desc'];
     }
     $forum_page['item_subject']['redirect'] = '<span>' . $lang_index['External forum'] . '</span>';
     ($hook = get_hook('in_redirect_row_pre_item_subject_merge')) ? eval($hook) : null;
     if (!empty($forum_page['item_subject'])) {
         $forum_page['item_body']['subject']['desc'] = '<p>' . implode(' ', $forum_page['item_subject']) . '</p>';
     }
     // Forum topic and post count
     $forum_page['item_body']['info']['topics'] = '<li class="info-topics"><span class="label">' . $lang_index['No topic info'] . '</span></li>';
     $forum_page['item_body']['info']['posts'] = '<li class="info-posts"><span class="label">' . $lang_index['No post info'] . '</span></li>';
     $forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">' . $lang_index['No lastpost info'] . '</span></li>';
     ($hook = get_hook('in_redirect_row_pre_display')) ? eval($hook) : null;
 } else {
     // Setup the title and link to the forum
     $forum_page['item_title']['title'] = '<a href="' . forum_link($forum_url['forum'], array($cur_forum['fid'], sef_friendly($cur_forum['forum_name']))) . '"><span>' . forum_htmlencode($cur_forum['forum_name']) . '</span></a>';
     // Are there new posts since our last visit?
     if (!$forum_user['is_guest'] && $cur_forum['last_post'] > $forum_user['last_visit'] && (empty($tracked_topics['forums'][$cur_forum['fid']]) || $cur_forum['last_post'] > $tracked_topics['forums'][$cur_forum['fid']])) {
         // There are new posts in this forum, but have we read all of them already?
         foreach ($new_topics[$cur_forum['fid']] as $check_topic_id => $check_last_post) {
             if ((empty($tracked_topics['topics'][$check_topic_id]) || $tracked_topics['topics'][$check_topic_id] < $check_last_post) && (empty($tracked_topics['forums'][$cur_forum['fid']]) || $tracked_topics['forums'][$cur_forum['fid']] < $check_last_post)) {
                 $forum_page['item_status']['new'] = 'new';
                 $forum_page['item_title']['status'] = '<small>' . sprintf($lang_index['Forum has new'], '<a href="' . forum_link($forum_url['search_new_results'], $cur_forum['fid']) . '" title="' . $lang_index['New posts title'] . '">' . $lang_index['Forum new posts'] . '</a>') . '</small>';
                 break;
             }
         }
     }
     ($hook = get_hook('in_normal_row_pre_item_title_merge')) ? eval($hook) : null;
     $forum_page['item_body']['subject']['title'] = '<h3 class="hn">' . implode(' ', $forum_page['item_title']) . '</h3>';
     // Setup the forum description and mod list
     if ($cur_forum['forum_desc'] != '') {
Ejemplo n.º 18
0
                            $topic_id = intval($_GET['unsubscribe']);
                            if ($topic_id < 1) {
                                message($lang_common['Bad request']);
                            }
                            // We validate the CSRF token. If it's set in POST and we're at this point, the token is valid.
                            // If it's in GET, we need to make sure it's valid.
                            if (!isset($_POST['csrf_token']) && (!isset($_GET['csrf_token']) || $_GET['csrf_token'] !== generate_form_token('unsubscribe' . $topic_id . $forum_user['id']))) {
                                csrf_confirm_form();
                            }
                            ($hook = get_hook('mi_unsubscribe_selected')) ? eval($hook) : null;
                            $query = array('SELECT' => 't.subject', 'FROM' => 'topics AS t', 'JOINS' => array(array('INNER JOIN' => 'subscriptions AS s', 'ON' => 's.user_id=' . $forum_user['id'] . ' AND s.topic_id=t.id')), 'WHERE' => 't.id=' . $topic_id);
                            ($hook = get_hook('mi_unsubscribe_qr_check_subscribed')) ? eval($hook) : null;
                            $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                            if (!$forum_db->num_rows($result)) {
                                message($lang_misc['Not subscribed']);
                            }
                            $subject = $forum_db->result($result);
                            $query = array('DELETE' => 'subscriptions', 'WHERE' => 'user_id=' . $forum_user['id'] . ' AND topic_id=' . $topic_id);
                            ($hook = get_hook('mi_unsubscribe_qr_delete_subscription')) ? eval($hook) : null;
                            $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                            ($hook = get_hook('mi_unsubscribe_pre_redirect')) ? eval($hook) : null;
                            redirect(forum_link($forum_url['topic'], array($topic_id, sef_friendly($subject))), $lang_misc['Unsubscribe redirect']);
                        }
                    }
                }
            }
        }
    }
}
($hook = get_hook('mi_new_action')) ? eval($hook) : null;
message($lang_common['Bad request']);