Ejemplo n.º 1
0
		FROM ' . POSTS_TABLE . "\n\t\tWHERE topic_id = {$topic_id}\n\t\t\tAND post_time >= {$min_post_time}\n\t\t\t\tAND " . $src_content_visibility->get_visibility_sql('post', $forum_id);
    $result = $db->sql_query($sql);
    $total_posts = (int) $db->sql_fetchfield('num_posts');
    $db->sql_freeresult($result);
    $limit_posts_time = "AND p.post_time >= {$min_post_time} ";
    if (isset($_POST['sort'])) {
        $start = 0;
    }
} else {
    $total_posts = $topic_replies + 1;
    $limit_posts_time = '';
}
// Was a highlight request part of the URI?
$highlight_match = $highlight = '';
if ($hilit_words) {
    $highlight_match = src_clean_search_string($hilit_words);
    $highlight = urlencode($highlight_match);
    $highlight_match = str_replace('\\*', '\\w+?', preg_quote($highlight_match, '#'));
    $highlight_match = preg_replace('#(?<=^|\\s)\\\\w\\*\\?(?=\\s|$)#', '\\w+?', $highlight_match);
    $highlight_match = str_replace(' ', '|', $highlight_match);
}
// Make sure $start is set to the last page if it exceeds the amount
$start = $pagination->validate_start($start, $config['posts_per_page'], $total_posts);
// General Viewtopic URL for return links
$viewtopic_url = append_sid("{$src_root_path}viewtopic.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}" . ($start == 0 ? '' : "&amp;start={$start}") . (strlen($u_sort_param) ? "&amp;{$u_sort_param}" : '') . ($highlight_match ? "&amp;hilit={$highlight}" : ''));
// Are we watching this topic?
$s_watching_topic = array('link' => '', 'link_toggle' => '', 'title' => '', 'title_toggle' => '', 'is_watching' => false);
if ($config['allow_topic_notify']) {
    $notify_status = isset($topic_data['notify_status']) ? $topic_data['notify_status'] : null;
    watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']);
    // Reset forum notification if forum notify is set
Ejemplo n.º 2
0
					FROM ' . ATTACHMENTS_TABLE . '
					WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . '
						AND in_message = 0
					ORDER BY filetime DESC, post_msg_id ASC';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $attachments[$row['post_msg_id']][] = $row;
                }
                $db->sql_freeresult($result);
            }
        }
        if ($hilit) {
            // Remove bad highlights
            $hilit_array = array_filter(explode('|', $hilit), 'strlen');
            foreach ($hilit_array as $key => $value) {
                $hilit_array[$key] = src_clean_search_string($value);
                $hilit_array[$key] = str_replace('\\*', '\\w*?', preg_quote($hilit_array[$key], '#'));
                $hilit_array[$key] = preg_replace('#(^|\\s)\\\\w\\*\\?(\\s|$)#', '$1\\w+?$2', $hilit_array[$key]);
            }
            $hilit = implode('|', $hilit_array);
        }
        /**
         * Modify the rowset data
         *
         * @event core.search_modify_rowset
         * @var	array	attachments				Array with posts attachments data
         * @var	string	hilit					String to highlight
         * @var	array	rowset					Array with the search results data
         * @var	string	show_results			String indicating the show results mode
         * @var	array	topic_tracking_info		Array with the topics tracking data
         * @var	string	u_hilit					Highlight string to be injected into URL