บอร์ด SMF 2.0.15 ผมติดตั้ง Mod
Recent Forum Topics 1.2 ![](http://www.thaiseoboard.com/go/ex.png)
แล้วไปทำการแก้ไฟล์ .../Sources/RecentForumTopics.php เพื่อบล็อคบอร์ด 9 กลุ่มโฆษณาไม่ให้แสดงในรายการ
$query_this_board = '{query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}
AND b.id_board != 9.0' : ''). '
AND m.id_msg >= {int:max_id_msg}';
ตั้งค่าให้แสดง 10รายการต่อหน้า x 10หน้า = 100รายการ
หน้าแรก ก่อนการแก้ไข | | | หน้า2+ |
กระทู้ 1 กระทู้ 2 กระทู้ 3 /บอร์ด9 กระทู้ 4 /บอร์ด9 กระทู้ 5 กระทู้ 6 /บอร์ด9 กระทู้ 7 กระทู้ 8 /บอร์ด9 กระทู้ 9 กระทู้ 10 | | | กระทู้ 11 กระทู้ 12 กระทู้ 13 กระทู้ 14 กระทู้ 15 กระทู้ 16 กระทู้ 17 /บอร์ด9 กระทู้ 18 กระทู้ 19 /บอร์ด9 กระทู้ 20 |
หน้าแรก หลังการแก้ไข | | | หน้า2+ |
กระทู้ 1 กระทู้ 2 กระทู้ 5 กระทู้ 7 กระทู้ 9 กระทู้ 10 | | | กระทู้ 15 กระทู้ 16 กระทู้ 18 กระทู้ 20 กระทู้ 21 กระทู้ 22 กระทู้ 23 กระทู้ 24 กระทู้ 25 กระทู้ 26
|
ผลคือสามารถบล็อคได้จริง
-
แต่จำนวนกระทู้ที่นำมาแสดงในหน้าแรกผิดพลาดไม่ครบ 10กระทู้
- หน้า2แสดงครบ10
แต่กระทู้ 11,12,13,14 หายไป(เหมือนระบบคิดว่าเอาไปวางหน้าแรกแล้ว)
- ตั้งแต่หน้า2 เป็นต้นไปแสดงครบ10 / รายการกระทู้ที่นำมาแสดงถูกต้องไม่มีขาดหาย
สรุปคือ จะแก้ยังไงให้หน้าแรกแสดงครบ(ยังบล็อค)และไม่มีกระทู้ที่ถูกตัดขาดน่ะครับ (บอร์ดจริงใช้ 15-20 จึงถูกตัดออกไปเยอะมาก)
.../Sources/RecentForumTopics.php
<?php
/**
* @package Recent Forum Topics
* @version 1.0
* @Author: Pipke(AdemaStudios)
* @copyright Copyright (C) 2014, Pipke
*
* This SMF modification is subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this SMF modification except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*/
// Check Column Fields in Database
function rft_checkColumn($tableName, $columnName)
{
global $db_prefix, $smcFunc;
$check = $smcFunc['db_query']('', 'DESCRIBE {db_prefix}' . $tableName . ' ' . $columnName);
if ($smcFunc['db_num_rows']($check) > 0) {return true;}
return false;
}
// Find the Recent Forum Topics
function rft_mainbasic()
{
global $txt, $settings, $scripturl, $user_info, $context, $modSettings, $sourcedir, $board, $boarddir, $smcFunc;
$rft_per_page = !empty($modSettings['rft_numbertopics']) ? $modSettings['rft_numbertopics'] : 10;
if (isset($_REQUEST['start']) && $_REQUEST['start'] > 95)
$_REQUEST['start'] = 95;
$query_parameters = array();
if (!empty($_REQUEST['c']) && empty($board))
{
$_REQUEST['c'] = explode(',', $_REQUEST['c']);
foreach ($_REQUEST['c'] as $i => $c)
$_REQUEST['c'][$i] = (int) $c;
if (count($_REQUEST['c']) == 1)
{
$request = $smcFunc['db_query']('', '
SELECT name
FROM {db_prefix}categories
WHERE id_cat = {int:id_cat}
LIMIT 1',
array(
'id_cat' => $_REQUEST['c'][0],
)
);
list ($name) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
if (empty($name))
fatal_lang_error('no_access', false);
$context['linktree'][] = array(
'url' => $scripturl . '#c' . (int) $_REQUEST['c'],
'name' => $name
);
}
$request = $smcFunc['db_query']('', '
SELECT b.id_board, b.num_topics
FROM {db_prefix}boards AS b
WHERE b.id_cat IN ({array_int:category_list})
AND {query_see_board}',
array(
'category_list' => $_REQUEST['c'],
)
);
$total_cat_posts = 0;
$boards = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$boards[] = $row['id_board'];
$total_cat_posts += $row['num_topics'];
}
$smcFunc['db_free_result']($request);
if (empty($boards))
fatal_lang_error('error_no_boards_selected');
$query_this_board = 'b.id_board IN ({array_int:boards})';
$query_parameters['boards'] = $boards;
// If this category has a significant number of posts in it...
if ($total_cat_posts > 100 && $total_cat_posts > $modSettings['totalMessages'] / 15)
{
$query_this_board .= '
AND m.id_msg >= {int:max_id_msg}';
$query_parameters['max_id_msg'] = max(0, $modSettings['maxMsgID'] - 400 - $_REQUEST['start'] * 7);
}
$context['page_index'] = constructPageIndex($scripturl . '?action=forum;c=' . implode(',', $_REQUEST['c']), $_REQUEST['start'], min(100, $total_cat_posts), $rft_per_page, false);
}
elseif (!empty($_REQUEST['boards']))
{
$_REQUEST['boards'] = explode(',', $_REQUEST['boards']);
foreach ($_REQUEST['boards'] as $i => $b)
$_REQUEST['boards'][$i] = (int) $b;
$request = $smcFunc['db_query']('', '
SELECT b.id_board, b.num_topics
FROM {db_prefix}boards AS b
WHERE b.id_board IN ({array_int:board_list})
AND {query_see_board}
LIMIT {int:limit}',
array(
'board_list' => $_REQUEST['boards'],
'limit' => count($_REQUEST['boards']),
)
);
$total_posts = 0;
$boards = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$boards[] = $row['id_board'];
$total_posts += $row['num_topics'];
}
$smcFunc['db_free_result']($request);
if (empty($boards))
fatal_lang_error('error_no_boards_selected');
$query_this_board = 'b.id_board IN ({array_int:boards})';
$query_parameters['boards'] = $boards;
// If these boards have a significant number of posts in them...
if ($total_posts > 100 && $total_posts > $modSettings['totalMessages'] / 12)
{
$query_this_board .= '
AND m.id_msg >= {int:max_id_msg}';
$query_parameters['max_id_msg'] = max(0, $modSettings['maxMsgID'] - 500 - $_REQUEST['start'] * 9);
}
$context['page_index'] = constructPageIndex($scripturl . '?action=forum;boards=' . implode(',', $_REQUEST['boards']), $_REQUEST['start'], min(100, $total_posts), $rft_per_page, false);
}
elseif (!empty($board))
{
$request = $smcFunc['db_query']('', '
SELECT num_topics
FROM {db_prefix}boards
WHERE id_board = {int:current_board}
LIMIT 1',
array(
'current_board' => $board,
)
);
list ($total_posts) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$query_this_board = 'b.id_board = {int:board}';
$query_parameters['board'] = $board;
// If this board has a significant number of posts in it...
if ($total_posts > 80 && $total_posts > $modSettings['totalMessages'] / 10)
{
$query_this_board .= '
AND m.id_msg >= {int:max_id_msg}';
$query_parameters['max_id_msg'] = max(0, $modSettings['maxMsgID'] - 600 - $_REQUEST['start'] * 10);
}
$context['page_index'] = constructPageIndex($scripturl . '?action=forum;board=' . $board . '.%1$d', $_REQUEST['start'], min(100, $total_posts), $rft_per_page, true);
}
else
{
$query_this_board = '{query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}
AND b.id_board != 9.0' : ''). '
AND m.id_msg >= {int:max_id_msg}';
$query_parameters['max_id_msg'] = max(0, $modSettings['maxMsgID'] - 100 - $_REQUEST['start'] * 6);
$query_parameters['recycle_board'] = $modSettings['recycle_board'];
$context['page_index'] = constructPageIndex($scripturl . '?action=forum', $_REQUEST['start'], min(100, $modSettings['totalTopics']), $rft_per_page, false);
}
$key = 'recent-' . $user_info['id'] . '-' . md5(serialize(array_diff_key($query_parameters, array('max_id_msg' => 0)))) . '-' . (int) $_REQUEST['start'];
if (($messages = cache_get_data($key, 120)) == false)
{
$done = false;
while (!$done)
{
// Find the ?? most recent messages they can *view*.
// !!!SLOW This query is really slow still, probably?
$request = $smcFunc['db_query']('', '
SELECT m.id_msg
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
INNER JOIN {db_prefix}topics AS t ON (t.' . (!empty($modSettings['rft_subject_topics']) && $modSettings['rft_subject_topics'] == 'last' ? 'id_last_msg' : 'id_first_msg') . ' = m.id_msg)
WHERE ' . $query_this_board . '
AND m.approved = {int:is_approved}
ORDER BY m.id_msg DESC
LIMIT {int:offset}, {int:limit}',
array_merge($query_parameters, array(
'is_approved' => 1,
'offset' => $_REQUEST['start'],
'limit' => $rft_per_page,
))
);
// If we don't have 10 results, try again with an unoptimized version covering all rows, and cache the result.
if (isset($query_parameters['max_id_msg']) && $smcFunc['db_num_rows']($request) < 7)
{
$smcFunc['db_free_result']($request);
$query_this_board = str_replace('AND m.id_msg >= {int:max_id_msg}', '', $query_this_board);
$cache_results = true;
unset($query_parameters['max_id_msg']);
}
else
$done = true;
}
$messages = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$messages[] = $row['id_msg'];
$smcFunc['db_free_result']($request);
if (!empty($cache_results))
cache_put_data($key, $messages, 120);
}
// Nothing here... Or at least, nothing you can see...
if (empty($messages))
{
$context['posts'] = array();
return;
}
// Check if Column 'is_solved' exists from the Topic Solved Mod
$post['is_solved'] = false; // to be sure ;)
$tableName = 'topics';
$columnName = 'is_solved';
$solved_exists = false;
$solved_exists = rft_checkColumn($tableName, $columnName);
// Get all the most recent posts
$request = $smcFunc['db_query']('', '
SELECT
m.id_msg, m.id_msg_modified, m.subject, m.smileys_enabled, m.poster_time AS first_poster_time , m.body, m.id_topic, t.id_board, b.id_cat,
b.name AS bname, c.name AS cname, t.num_replies, t.num_views, m.id_member, m2.id_member AS id_first_member,' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ',
m2.poster_time AS last_poster_time, m.icon AS first_icon,
t.approved, t.unapproved_posts, t.locked, t.is_sticky, t.id_poll,' . ($solved_exists ? ' t.is_solved,' : '') . '
IFNULL(mem2.real_name, m2.poster_name) AS first_poster_name, t.id_first_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_last_msg
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
INNER JOIN {db_prefix}messages AS m2 ON (m2.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}members AS mem2 ON (mem2.id_member = m2.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = m.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = m.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE m.id_msg IN ({array_int:message_list})
ORDER BY m.id_msg DESC
LIMIT ' . count($messages),
array(
'message_list' => $messages,
'current_member' => $user_info['id'],
)
);
$counter = $_REQUEST['start'] + 1;
$context['posts'] = array();
$board_ids = array('own' => array(), 'any' => array());
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
// Censor everything.
censorText($row['subject']);
// BBC-atize the message.
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
$topics[] = $row['id_topic'];
// And build the array.
$context['posts'][$row['id_msg']] = array(
'id' => $row['id_msg'],
'counter' => $counter++,
'alternate' => $counter % 2,
'category' => array(
'id' => $row['id_cat'],
'name' => $row['cname'],
'href' => $scripturl . '#c' . $row['id_cat'],
'link' => '<a href="' . $scripturl . '#c' . $row['id_cat'] . '">' . $row['cname'] . '</a>'
),
'board' => array(
'id' => $row['id_board'],
'name' => $row['bname'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>'
),
'topic' => $row['id_topic'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'],
'linklast' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>',
'linkfirst' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" rel="nofollow">' . $row['subject'] . '</a>',
'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new',
'start' => $row['num_replies'],
'subject' => $row['subject'],
'views' => comma_format($row['num_views']),
'replies' => comma_format($row['num_replies']),
'timefirst' => timeformat($row['first_poster_time']),
'timelast' => timeformat($row['last_poster_time']),
'first_poster' => array(
'id' => $row['id_first_member'],
'name' => $row['first_poster_name'],
'href' => empty($row['id_first_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_first_member'],
'link' => empty($row['id_first_member']) ? $row['first_poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_first_member'] . '">' . $row['first_poster_name'] . '</a>'
),
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'is_own_post' => false,
'new' => $row['new_from'] <= $row['id_msg_modified'],
'new_from' => $row['new_from'],
'newtime' => $row['new_from'],
'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'],
//'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . '#new',
'id_msg_modified' => $row['id_msg_modified'],
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0,
'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'],
'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'],
'icon' => $row['first_icon'],
);
if (!empty($row['is_solved']))
$context['posts'][$row['id_msg']]['is_solved'] = $row['is_solved'];
if ($user_info['id'] == $row['id_first_member'])
$board_ids['own'][$row['id_board']][] = $row['id_msg'];
$board_ids['any'][$row['id_board']][] = $row['id_msg'];
}
$smcFunc['db_free_result']($request);
$request = $smcFunc['db_query']('', '
SELECT DISTINCT id_topic
FROM {db_prefix}messages
WHERE id_topic IN ({array_int:topics})
AND id_member = {int:member}',
array(
'topics' => $topics,
'member' => $user_info['id'],
)
);
$context['posted_topics'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$context['posted_topics'][] = $row['id_topic'];
$smcFunc['db_free_result']($request);
}
.../Sources/Subs-RecentForumTopics.php
<?php
/**
* @package Recent Forum Topics
* @version 1.2
* @Author: Pipke(AdemaStudios)
* @copyright Copyright (C) 2014, Pipke
*
* This SMF modification is subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this SMF modification except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*/
if (!defined('SMF'))
die('Hacking attempt...');
//Hooks
function rft_mod_admin(&$areas)
{
global $txt;
loadLanguage('RecentForumTopics');
$areas['config']['areas']['modsettings']['subsections']['recentforumtopics'] = array($txt['rft_name']);
}
function rft_mod_settings(&$sub_actions)
{
global $context;
$sub_actions['recentforumtopics'] = 'rft_blockSettings';
}
function rft_blockSettings($return_config = false)
{
global $context, $scripturl, $txt;
$config_vars = array(
array('desc', 'rft_topic_solvednote'),
array('desc', 'rft_portalnote'),
array('check', 'rft_enable', 'subtext' => $txt['rft_enable_sub'],),
array('select', 'rft_numbertopics', array('3' => $txt['rft_3'],'4' => $txt['rft_4'],'5' => $txt['rft_5'],'6' => $txt['rft_6'],'7' => $txt['rft_7'],'8' => $txt['rft_8'],'9' => $txt['rft_9'],'10' => $txt['rft_10'],)),
array('check', 'rft_disable_smfrecentposts'),
array('select', 'rft_subject_topics', 'subtext' => $txt['rft_subject_topics_sub'], array('last' => $txt['rft_last'],'first' => $txt['rft_first'],)),
array('select', 'rft_link_topics', 'subtext' => $txt['rft_link_topics_sub'], array('last' => $txt['rft_last'],'first' => $txt['rft_first'],)),
array('check', 'rft_linktree'),
array('check', 'rft_counter_viewnumbers'),
array('int', 'rft_color_viewnumbers', 'subtext' => $txt['rft_color_viewnumbers_sub'], 'preinput' => '#', 'size' => 7),
array('check', 'rft_firstpostlinkicon'),
array('check', 'rft_lastpostlinkicon'),
array('check', 'rft_firstcolumn'),
array('check', 'rft_secondcolumn'),
array('check', 'rft_menubuttons'),
array('check', 'rft_postingicons'),
array('check', 'rft_topic_solved', 'subtext' => $txt['rft_topic_solved_sub']),
array('check', 'rft_portal', 'subtext' => $txt['rft_portal_sub']),
);
if ($return_config)
return $config_vars;
$context['post_url'] = $scripturl . '?action=admin;area=modsettings;save;sa=recentforumtopics';
$context['settings_title'] = $txt['rft_settings_title'];
if (empty($config_vars))
{
$context['settings_save_dont_show'] = true;
$context['settings_message'] = '<div align="center">' . $txt['modification_no_misc_settings'] . '</div>';
return prepareDBSettingContext($config_vars);
}
if (isset($_GET['save']))
{
checkSession();
if ((!empty($_POST['rft_color_viewnumbers'])) && (ctype_alnum($_POST['rft_color_viewnumbers']) === false))
fatal_lang_error('rft_error_color', false);
$save_vars = $config_vars;
saveDBSettings($save_vars);
redirectexit('action=admin;area=modsettings;sa=recentforumtopics');
}
prepareDBSettingContext($config_vars);
}
function rft_load_themes()
{
global $context, $settings, $modSettings;
loadLanguage('RecentForumTopics');
if (in_array($context['current_action'], array('helpadmin', 'printpage')) || WIRELESS) return;
if (!empty($modSettings['rft_enable'])) {
if (!empty($modSettings['rft_disable_smfrecentposts']))
$settings['number_recent_posts'] = 0;
RecentForumTopics_loading();
}
}
//Show on index only (yes to collapse)
function RecentForumTopics_loading()
{
global $context, $sourcedir, $txt, $scripturl, $modSettings, $settings, $boardurl, $boarddir;
$current_action = ''; //all
if (((!empty($_REQUEST['action']) && ($_REQUEST['action'] != 'forum')) && ($_REQUEST['action'] != 'collapse')) || !empty($_REQUEST['topic']) || !empty($_REQUEST['board']) || !empty($_REQUEST['page']) || !empty($_REQUEST['blog']))
$current_action = 'dontshowme';
if (!empty($modSettings['rft_portal']) && (empty($_REQUEST['action'])))
$current_action = 'dontshowme';
if(!empty($current_action))
return;
$context['html_headers'] .= '
<style type="text/css">
.topic_table td.stickybg2
{
background-position: 96% 6px;
}
.topic_table td.lockedbg2
{
background-position: 96% 6px;
}
.topic_table td.locked_sticky2
{
background-position: 96% 6px;
}
</style>';
require_once($sourcedir . '/RecentForumTopics.php');
rft_mainbasic();
loadTemplate('RecentForumTopics');
//$context['page_title'] = $txt['page_title'];
if (!empty($modSettings['rft_linktree']))
$context['linktree'][] = array(
'url' => $scripturl . '?action=forum',
'name' => $txt['rft_name']
);
$context['template_layers'][] = 'rft';
}
/* DUH! WINNING! */
function rft_copyright(&$dummy)
{
global $context;
if (isset($context['current_action']) && $context['current_action'] == 'credits')
$context['copyrights']['mods'][] = 'Recent Forum Topics Mod | <a href="http://www.simplemachines.org/community/index.php?action=profile;u=314795" title="AdemaStudios">© 2014 by Pipke</a>';
}
?>
.../Themes/default/RecentForumTopics.template.php
<?php
/**
* @package Recent Forum Topics
* @version 1.2
* @Author: Pipke(AdemaStudios)
* @copyright Copyright (C) 2014, Pipke
*
* This SMF modification is subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this SMF modification except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*/
function template_rft_above()
{
global $context, $settings, $scripturl, $modSettings, $txt, $boarddir;
echo'
<div class="tborder topic_table" id="messageindex">
<table class="table_grid" cellspacing="0">
<thead>
<tr class="catbg">';
// Are there actually any topics to show?
if (!empty($context['posts']))
{
// The navigation pages and numbers.
$sum=0;
$class ='windowbg';
foreach ($context['posts'] as $sum) {}
if ($modSettings['rft_firstcolumn'] && $modSettings['rft_secondcolumn'])
echo '<th scope="col" class="first_th" width="8%" colspan="2"> </th>';
elseif ((!$modSettings['rft_firstcolumn'] && $modSettings['rft_secondcolumn']) || ($modSettings['rft_firstcolumn'] && !$modSettings['rft_secondcolumn']))
echo '<th scope="col" class="first_th" width="4%" colspan="1"> </th>';
else
$class ='first_th';
if (empty($modSettings['rft_counter_viewnumbers'])){
echo'<th scope="col" class="lefttext ',$class,'" >', $txt['rft_name'], ' / ', $txt['started_by'], ' / ', $txt['rft_in_Board'], '</th>';
}
else {
echo'<th scope="col" class="lefttext ',$class,'" >', $txt['rft_name'], ' <span style="color: #'.$modSettings['rft_color_viewnumbers'].';">« ', $counter = $_REQUEST['start'] + 1 ,' '.$txt['rft_to'].' ', $sum['counter'], ' »</span> / ', $txt['started_by'], ' / ', $txt['rft_in_Board'], '</th>';
}
echo'
<th scope="col" width="15%">', $txt['replies'], ' / ', $txt['views'], '</th>
<th scope="col" class="lefttext last_th" width="24%">', $txt['last_post'], '</th>';
}
// No topics.... just say, "sorry bub".
else
{
echo '
<th scope="col" class="first_th" width="8%"> </th>
<th colspan="3"><strong>', $txt['msg_alert_none'], '</strong></th>
<th scope="col" class="last_th" width="8%"> </th>';
}
echo'
</tr>
</thead>
<div class="pagesection">
<div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], '</div>';
if (($context['user']['is_logged']) && (!empty($modSettings['rft_menubuttons'])))
echo'
<div class="buttonlist floatright">
<ul>
<li><a class="button_strip" href="', $scripturl, '?action=profile;area=showposts"><span>', rtrim($txt['rft_show_all_posts'],"."),'</span></a></li>
<li><a class="button_strip" href="', $scripturl, '?action=unread"><span>', rtrim($txt['unread_since_visit'],"."),'</span></a></li>
<li><a class="button_strip" href="', $scripturl, '?action=unreadreplies"><span>', rtrim($txt['show_unread_replies'],"."), '</span></a></li>
</ul>
</div>
';
echo'
</div>';
// The main thingy
foreach ($context['posts'] as $post)
{
// Check for posts in topics where the user has posted in. (assuming they are logged in!)
if (!empty($modSettings['enableParticipation']) && $context['user']['is_logged'] && !empty($post['topic']))
if (in_array($post['topic'], $context['posted_topics']))
$post['is_own_post'] = true;
// Setup the icons (yeah i know scripting can better i'm lazy)
$icon_postls = ''; // to be sure
// We start with hot and real hot topics uhm autch.
if ($post['is_hot'] && $post['is_very_hot'])
$icon_post1 = 'veryhot';
elseif ($post['is_hot'])
$icon_post1 = 'hot';
else
$icon_post1 = 'normal';
// Poll posts...
if (!empty($post['is_poll']))
$icon_post2 = $icon_post1 . '_poll';
else
$icon_post2 = $icon_post1 . '_post';
// Next we start with locked and sticky topics.
if ($post['is_sticky'] && $post['is_locked'])
$color_class = 'stickybg locked_sticky';
// Sticky topics should get a different color, too.
elseif ($post['is_sticky']) {
$color_class = 'stickybg';
$icon_postls = '_sticky';
}
// Locked topics get special treatment as well.
elseif ($post['is_locked']) {
$color_class = 'lockedbg';
$icon_postls = '_locked';
}
// Almost last, but not least: regular topics.
else {
$color_class = 'windowbg';
$icon_post3 = $icon_post2 . $icon_postls;
}
// Some columns require a different shade of the color class.
$alternate_class = $color_class . '2';
if ($post['is_sticky'] && $post['is_locked'])
$icon_post3 = $icon_post2 . '_locked_sticky';
elseif ($post['is_sticky'])
$icon_post3 = $icon_post2 . '_sticky';
elseif ($post['is_locked'])
$icon_post3 = $icon_post2 . '_locked';
else
$icon_post3 = $icon_post2;
// Set the icon for posted in topics.(is_own_post)
if ($post['is_own_post'])
$icon_post3 = 'my_' . $icon_post3;
// Check for solved topics.
if (!empty($modSettings['rft_topic_solved']) && (!empty($post['is_solved'])))
$post['icon'] = 'topicsolved';
// Template
echo'<tr>';
if ($modSettings['rft_firstcolumn'] && $modSettings['rft_secondcolumn'])
{
echo '
<td class="icon1 ', $color_class, '">
<img src="', $settings['images_url'], '/topic/' . $icon_post3 . '.gif" alt="" />
</td>
<td class="icon2 ', $color_class, '">
<img src="', $settings['images_url'], '/post/', $post['icon'], '.gif" alt="" />
</td>';
}
if ($modSettings['rft_firstcolumn'] && !$modSettings['rft_secondcolumn'])
{
echo '<td class="icon1 ', $color_class, '">
<img src="', $settings['images_url'], '/topic/' . $icon_post3 . '.gif" alt="" />
</td>';
}
if (!$modSettings['rft_firstcolumn'] && $modSettings['rft_secondcolumn'])
{
echo'<td class="icon2 ', $color_class, '">
<img src="', $settings['images_url'], '/post/', $post['icon'], '.gif" alt="" />
</td>';
}
echo '<td class="subject ', $alternate_class, '">';
if (!empty($modSettings['rft_firstpostlinkicon']))
echo'<a href="' . $scripturl . '?topic=' . $post['topic'] , '.0"><img style="float:right; padding: 4px;" src="', $settings['images_url'], '/icons/first_post.gif" alt="', $txt['rft_first_post'], '" title="', $txt['rft_first_post'], '" /></a>';
// link to first or last topic message?
if (!empty($modSettings['rft_link_topics']) && ($modSettings['rft_link_topics'] == 'last'))
echo'', $post['is_sticky'] ? '<strong>' : '', '<span>', $post['linklast'],'</span>', $post['is_sticky'] ? '</strong>' : '';
if (!empty($modSettings['rft_link_topics']) && ($modSettings['rft_link_topics'] == 'first'))
echo'', $post['is_sticky'] ? '<strong>' : '', '<span>', $post['linkfirst'],'</span>', $post['is_sticky'] ? '</strong>' : '';
// Is this post new? (assuming they are logged in!)
if ($post['new'] && $context['user']['is_logged'])
echo '
<a href="', $post['new_href'], '" /></a>';
echo'
<p>', $txt['started_by'], ' ', $post['first_poster']['link'] ,' ', $txt['on'], ' ', $post['timelast'],' ', $txt['in'], ' ', $post['board']['link'], '</p>
</td>
<td class="stats ', $color_class, '">
', $post['replies'], ' ', $txt['replies'], '
<br />
', $post['views'], ' ', $txt['views'], '
</td>
<td class="lastpost ', $alternate_class, '">';
if (!empty($modSettings['rft_lastpostlinkicon']))
echo'<a href="', $post['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" /></a>';
echo'', $txt['by'], ' ', $post['poster']['link'], ' <br /> ', $txt['on'], ' ', $post['timefirst'], '</span>
</td>
</tr>';
}
echo'</table></div><br />';
if (!empty($modSettings['rft_postingicons']))
echo'
<div id="posting_icons" class="floatleft">
<ul class="reset">', !empty($modSettings['enableParticipation']) && $context['user']['is_logged'] ? '
<li class="floatleft"><img src="' . $settings['images_url'] . '/topic/my_normal_post.gif" alt="" align="middle" /> ' . $txt['participation_caption'] . '<br />' : '', '</li>
<li class="floatleft"><img src="' . $settings['images_url'] . '/topic/normal_post.gif" alt="" align="middle" /> ' . $txt['normal_topic'] . '</li>
<li class="floatleft"><img src="' . $settings['images_url'] . '/topic/hot_post.gif" alt="" align="middle" /> ' . $txt['rft_Hot_Topic'] . '</li>
<li class="floatleft"><img src="' . $settings['images_url'] . '/topic/veryhot_post.gif" alt="" align="middle" /> ' . $txt['rft_Very_Hot_Topic'] . '</li>
<li class="floatleft"><img src="' . $settings['images_url'] . '/icons/quick_lock.gif" alt="" align="middle" /> ' . $txt['locked_topic'] . '<br />' . ($modSettings['enableStickyTopics'] == '1' ? '</li>
<li class="floatleft"><img src="' . $settings['images_url'] . '/icons/quick_sticky.gif" alt="" align="middle" /> ' . $txt['sticky_topic'] . '<br />' : '') . ($modSettings['pollMode'] == '1' ? '</li>
<li class="floatleft"><img src="' . $settings['images_url'] . '/topic/normal_poll.gif" alt="" align="middle" /> ' . $txt['poll'] : '') . '</li>
</ul>
</div><span class="clear upperframe"></span>';
// fix/reload 'hook' if collapse boards (for selecting more pages)
if (($current_action = 'index') && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'collapse'))
redirectexit('action=forum');
}
function template_rft_below()
{
// none, not using yet, maybe in future...
}
?>