Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Marook on January 20, 2008, 11:47:42 PM

Title: Advanced Recent Posts / Topics
Post by: Marook on January 20, 2008, 11:47:42 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1069)

This mod alters the recent posts. Now you will see the message icon, the number of views additional to the standard items (Author, Categorie, Date and Subject).

Update 1.1 (dedicated to BlueDevil ;))
Title: Re: Advanced Recent Posts
Post by: FragaCampos on January 21, 2008, 08:34:36 AM
Thanks it works like a charm ;)
Title: Re: Advanced Recent Posts
Post by: nikiobicata on January 21, 2008, 08:35:45 AM
After i instalet nothnig hapens ? This mod is automatic ? or ?
Title: Re: Advanced Recent Posts
Post by: nick09 on January 21, 2008, 09:41:30 AM
Quote from: nikiobicata on January 21, 2008, 08:35:45 AM
After i instalet nothnig hapens ? This mod is automatic ? or ?

look at the data center(stats).
Title: Re: Advanced Recent Posts
Post by: Angelotus on January 21, 2008, 09:59:50 AM
Is there an SSI version as well? Just copy and paste and make a ssi function for it??
Title: Re: Advanced Recent Posts
Post by: Mick. on January 21, 2008, 10:34:31 AM
Is there a way to only display the topic once instead of many times?  I mean...in a TP Recent Block,it shows the topic once even if its been replied numerous times. On SMF recent,it shows numerous times. I'd like to change that.

Am i making any sense?
Title: Re: Advanced Recent Posts
Post by: Labros on January 21, 2008, 10:36:13 AM
how to add in babylon theme ???? :(
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 10:50:26 AM
O wow... many many questions ;)
@ BlueDevil : RecentPosts means Posts not Recent Threads ;) I don't know if there is a function to display only topics... wait for the next version, i'll be working on it.
@ Angelotus : There is no SSI function available yet, but its on my todo-list now ;)
@ Labros : Open the install.xml, scroll down until the file BoardIndex.php is opened, Do all the changes to your Boardindex.php from the babylon theme.

If you don't get success, post your Boardindex.php and i will add the changes...
Title: Re: Advanced Recent Posts
Post by: -SyN- on January 21, 2008, 10:59:28 AM
Works for me.

Installed it on my custom theme with ease!

http://www.club-syndicate.net/v3.2/index.php?action=forum

Btw my thanks to the author of this mod.
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 11:02:51 AM
yeah, cool ;)
Title: Re: Advanced Recent Posts
Post by: Labros on January 21, 2008, 11:10:16 AM
Quote from: Marook on January 21, 2008, 10:50:26 AM
@ Labros : Open the install.xml, scroll down until the file BoardIndex.php is opened, Do all the changes to your Boardindex.php from the babylon theme.

If you don't get success, post your Boardindex.php and i will add the changes...

Τhanks Marook, i dont find the first part of modification. in my Boardindex.php !!!

<table cellpadding="0" cellspacing="0" width="100%" border="0">
Title: Re: Advanced Recent Posts
Post by: nikiobicata on January 21, 2008, 11:11:07 AM
this mod is not working with my smf

nothing happens in stat

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.data.bg%2F08%2F01%2F21%2F770522_t.jpg&hash=a5f33bc9cd64bae9f4cc565c69b28d70bf6d320f) (http://img.data.bg/i.php?id=770522)

my theme is def
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 11:15:18 AM
You have to enable the recent post list.. Go to AdminCP -> Current Theme and enter the number of posts to be shown at Number of recent posts to display on board index:
Title: Re: Advanced Recent Posts
Post by: Labros on January 21, 2008, 11:17:55 AM
QuoteIf you don't get success, post your Boardindex.php and i will add the changes...

this is the file Marook,thanks again my friend :)
Title: Re: Advanced Recent Posts
Post by: nikiobicata on January 21, 2008, 11:22:36 AM
tnx Marook  it works  :)
Title: Re: Advanced Recent Posts
Post by: Mick. on January 21, 2008, 11:54:54 AM
Thanx Marook.  I installed it and it works flawlessly.


Hehehehe.....

What if instead of showing the number of "views" it shows the number of replies?
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 12:28:18 PM
@Labros : http://www.marook-online.de/smf/index.php/id,7c08470600.html
This should work... i've did not test it, because i don't have babyblon theme installed...

@ BlueDevil : i'm working on it ;) just a second...
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 12:32:10 PM
@ BlueDevil :

open sourcedir/Recent.php and find :

LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon, t.numViews

and change it to

LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon, t.numReplies


then find

'views' => $row['numViews'],

and change it to

'views' => $row['numReplies'],


That should work...
Title: Re: Advanced Recent Posts
Post by: Mick. on January 21, 2008, 12:36:06 PM
I did exactly as told but it still looks the same with the number of views. Not number of replies.

Title: Re: Advanced Recent Posts
Post by: Labros on January 21, 2008, 12:37:00 PM
Quote from: Marook on January 21, 2008, 12:28:18 PM
@Labros : http://www.marook-online.de/smf/index.php/id,7c08470600.html
This should work... i've did not test it, because i don't have babyblon theme installed...


my friend, it works !!! THANK YOY AGAIN.
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 12:43:24 PM
@ BlueDevil, try refreshing the page CTRL+F5 resp. SHIFT+F5.... sometimes SMF caches a bit to much ;)

I tested it on your site, it works...

Topic: Happy Bday Strobin!  (Read 8 times)

and on boardindex you see

Re: Happy Bday Strobin! 1

You only have to replace the caption 'Views' with 'Replies'...

open BoardIndex.php and find

       <td class="column-title" style="text-align:right;color:#ffffff;">', $txt[301] ,'</td>


and replace it with

       <td class="column-title" style="text-align:right;color:#ffffff;">', $txt[110] ,'</td>

Title: Re: Advanced Recent Posts
Post by: Mick. on January 21, 2008, 12:46:47 PM
I did still the same.
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 12:52:38 PM
trust me ;)
Title: Re: Advanced Recent Posts
Post by: Mick. on January 21, 2008, 01:02:55 PM
Quote from: Marook on January 21, 2008, 12:52:38 PM
trust me ;)

LOL....it still shows "Views" not "Replies".
Title: Re: Advanced Recent Posts
Post by: perro88 on January 21, 2008, 01:44:24 PM
nice mod thanks
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 02:21:04 PM
you're welcome perro ;)
@ BlackDevil, do you mean the caption? The word "Views" ?? If so, look at this (http://www.simplemachines.org/community/index.php?topic=217922.msg1391596#msg1391596) Post ;)
Title: Re: Advanced Recent Posts
Post by: teaser on January 21, 2008, 06:30:24 PM
Hey,

Why does it show me "xx" alt="" />" under the subject.
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 06:34:13 PM
don't know...something went wrong ;)
Post a picture and the BoardIndex.php i'll fix it...
Title: Re: Advanced Recent Posts
Post by: teaser on January 21, 2008, 06:50:44 PM
here the image:

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi31.tinypic.com%2F15yt821.jpg&hash=3d3748248c784bc07c3d136c22b846a10d84605d)<--- really bad crop. :-)

Here is the boardindex.php

<?php
// Version: 1.1; BoardIndex

function template_main()
{
global $context$settings$options$txt$scripturl$modSettings;


//Display ads on the board index
if (function_exists("show_boardAds"))
{
$ads show_boardAds();
if(!empty($ads))
if($ads['type']==0)
echo $ads['content'];
else
eval($ads['content']);
unset($ads);
}
// Show some statistics next to the link tree if SP1 info is off.
echo '
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="bottom">'
theme_linktree(), '</td>
<td align="right">'
;
if (!$settings['show_sp1_info'])
echo '
'
$txt[19], ': '$context['common_stats']['total_members'], ' &nbsp;&#38;#8226;&nbsp; '$txt[95], ': '$context['common_stats']['total_posts'], ' &nbsp;&#38;#8226;&nbsp; '$txt[64], ': '$context['common_stats']['total_topics'], '
'
, ($settings['show_latest_member'] ? '<br />' $txt[201] . ' <b>' $context['common_stats']['latest_member']['link'] . '</b>' $txt[581] : '');
echo '
</td>
</tr>
</table>'
;

// Show the news fader?  (assuming there are things to show...)
if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
{
echo '
<table border="0" width="100%" class="tborder" cellspacing="' 
, ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' '0' '" cellpadding="4" style="margin-bottom: 2ex;">
<tr>
<td class="catbg"> &nbsp;'
$txt[102], '</td>
</tr>
<tr>
<td valign="middle" align="center" height="60">'
;

// Prepare all the javascript settings.
echo '
<div id="smfFadeScroller" style="width: 90%; padding: 2px;"><b>'
$context['news_lines'][0], '</b></div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
// The fading delay (in ms.)
var smfFadeDelay = '
, empty($settings['newsfader_time']) ? 5000 $settings['newsfader_time'], ';
// Fade from... what text color? To which background color?
var smfFadeFrom = {"r": 0, "g": 0, "b": 0}, smfFadeTo = {"r": 255, "g": 255, "b": 255};
// Surround each item with... anything special?
var smfFadeBefore = "<b>", smfFadeAfter = "</b>";

var foreColor, backEl, backColor;

if (typeof(document.getElementById(\'smfFadeScroller\').currentStyle) != "undefined")
{
foreColor = document.getElementById(\'smfFadeScroller\').currentStyle.color.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};

backEl = document.getElementById(\'smfFadeScroller\');
while (backEl.currentStyle.backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined")
backEl = backEl.parentNode;

backColor = backEl.currentStyle.backgroundColor.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeTo = {"r": eval("0x" + backColor[1]), "g": eval("0x" + backColor[2]), "b": eval("0x" + backColor[3])};
}
else if (typeof(window.opera) == "undefined" && typeof(document.defaultView) != "undefined")
{
foreColor = document.defaultView.getComputedStyle(document.getElementById(\'smfFadeScroller\'), null).color.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};

backEl = document.getElementById(\'smfFadeScroller\');
while (document.defaultView.getComputedStyle(backEl, null).backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined" && typeof(backEl.parentNode.tagName) != "undefined")
backEl = backEl.parentNode;

backColor = document.defaultView.getComputedStyle(backEl, null).backgroundColor.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeTo = {"r": parseInt(backColor[1]), "g": parseInt(backColor[2]), "b": parseInt(backColor[3])};
}

// List all the lines of the news for display.
var smfFadeContent = new Array(
"'
implode('",
"'
$context['fader_news_lines']), '"
);
// ]]></script>
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/fader.js"></script>
</td>
</tr>
</table>'
;
}

  
// display shoutbox
  
if (function_exists('sbox')) sbox();

/* Each category in categories is made up of:
id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
and boards. (see below.) */
$first true;
foreach ($context['categories'] as $category)
{
echo '
<div class="tborder" style="margin-top: ' 
$first '0;' '1ex;' '' $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'width: 100%;' '''">
<div class="catbg'
$category['new'] ? '2' '''" style="padding: 5px 5px 5px 10px;">';
$first false;

// If this category even can collapse, show a link to collapse it.
if ($category['can_collapse'])
echo '
<a href="'
$category['collapse_href'], '">'$category['collapse_image'], '</a>';

echo '
'
$category['link'], '
</div>'
;

// Assuming the category hasn't been collapsed...
if (!$category['is_collapsed'])
{
echo '
<table border="0" width="100%" cellspacing="1" cellpadding="5" class="bordercolor" style="margin-top: 1px;">'
;

/* Each board in each category's boards has:
new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
children (see below.), link_children (easier to use.), children_new (are they new?),
topics (# of), posts (# of), link, href, and last_post. (see below.) */
foreach ($category['boards'] as $board)
{
echo '
<tr>
<td ' 
, !empty($board['children']) ? 'rowspan="2"' '' ' class="windowbg" width="6%" align="center" valign="top"><a href="'$scripturl'?action=unread;board='$board['id'], '.0">';

// If the board is new, show a strong indicator.
if ($board['new'])
echo '<img src="'$settings['images_url'], '/on.gif" alt="'$txt[333], '" title="'$txt[333], '" />';
// This board doesn't have new posts, but its children do.
elseif ($board['children_new'])
echo '<img src="'$settings['images_url'], '/on2.gif" alt="'$txt[333], '" title="'$txt[333], '" />';
// No new posts at all! The agony!!
else
echo '<img src="'$settings['images_url'], '/off.gif" alt="'$txt[334], '" title="'$txt[334], '" />';

echo '</a>
</td>
<td class="windowbg2">
<b><a href="'
$board['href'], '" name="b'$board['id'], '">'$board['name'], '</a></b><br />
'
$board['description'];

// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
if (!empty($board['moderators']))
echo '
<div style="padding-top: 1px;" class="smalltext"><i>'
count($board['moderators']) == $txt[298] : $txt[299], ': 'implode(', '$board['link_moderators']), '</i></div>';

// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="windowbg" valign="middle" align="center" style="width: 12ex;"><span class="smalltext">
'
$board['posts'], ' '$txt[21], ' <br />
'
$board['topics'],' '$txt[330], '
</span></td>
<td class="windowbg2" valign="middle" width="22%">
<span class="smalltext">'
;

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo ' '$board['last_post']['link'], '<br />
    '
$txt[525], ' '$board['last_post']['member']['link'] , '<br />
'
$board['last_post']['time'];
echo '
</span>
</td>
</tr>'
;
// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
if (!empty($board['children']))
{
// Sort the links into an array with new boards bold so it can be imploded.
$children = array();
/* Each child in each board's children has:
id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
foreach ($board['children'] as $child)
{
$child['link'] = '<a href="' $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' $txt[330] . ': ' $child['topics'] . ', ' $txt[21] . ': ' $child['posts'] . ')">' $child['name'] . '</a>';
$children[] = $child['new'] ? '<b>' $child['link'] . '</b>' $child['link'];
}

echo '
<tr>
<td colspan="4" class="windowbg'
, !empty($settings['seperate_sticky_lock']) ? '3' '''">
<span class="smalltext"><b>'
$txt['parent_boards'], '</b>: 'implode(', '$children), '</span>
</td>
</tr>'
;
}
}
echo '
</table>'
;
}
echo '
</div>'
;
//Display ads Between cats
if (function_exists("show_category"))
{
$ads show_category($category['id']);
if(!empty($ads))
if($ads['type']==0)
echo $ads['content'];
else
eval($ads['content']);
unset($ads);
}

}

if ($context['user']['is_logged'])
{
echo '
<table border="0" width="100%" cellspacing="0" cellpadding="5">
<tr>
<td align="'
, !$context['right_to_left'] ? 'left' 'right''" class="smalltext">
<img src="' 
$settings['images_url'] . '/new_some.gif" alt="" align="middle" /> '$txt[333], '
<img src="' 
$settings['images_url'] . '/new_none.gif" alt="" align="middle" style="margin-left: 4ex;" /> '$txt[334], '
</td>
<td align="'
, !$context['right_to_left'] ? 'right' 'left''">';

// Mark read button.
$mark_read_button = array('markread' => array('text' => 452'image' => 'markread.gif''lang' => true'url' => $scripturl '?action=markasread;sa=all;sesc=' $context['session_id']));

// Show the mark all as read button?
if ($settings['show_mark_read'] && !empty($context['categories']))
echo '
<table cellpadding="0" cellspacing="0" border="0" style="position: relative; top: -5px;">
<tr>
 '
template_button_strip($mark_read_button'top'), '
</tr>
</table>'
;
echo '
</td>
</tr>
</table>'
;
}

// Here's where the "Info Center" starts...
echo '<br />
<div class="tborder" '
$context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' '''>
<div class="catbg" style="padding: 6px; vertical-align: middle; text-align: center; ">
<a href="#" onclick="shrinkHeaderIC(!current_header_ic); return false;"><img id="upshrink_ic" src="'
$settings['images_url'], '/', empty($options['collapse_header_ic']) ? 'collapse.gif' 'expand.gif''" alt="*" title="'$txt['upshrink_description'], '" style="margin-right: 2ex;" align="right" /></a>
'
$txt[685], '
</div>
<div id="upshrinkHeaderIC"'
, empty($options['collapse_header_ic']) ? '' ' style="display: none;"''>
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">'
;

// This is the "Recent Posts" bar.
if (!empty($settings['number_recent_posts']))
{
echo '
<tr>
<td class="titlebg" colspan="2">'
$txt[214], '</td>
</tr>
<tr>
<td class="windowbg" width="20" valign="middle" align="center">
<a href="'
$scripturl'?action=recent"><img src="'$settings['images_url'], '/post/xx.gif" alt="'$txt[214], '" /></a>
</td>
<td class="windowbg2">'
;

// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<b><a href="'
$scripturl'?action=recent">'$txt[214], '</a></b>
<div class="smalltext">
'
$txt[234], ' "'$context['latest_post']['link'], '" '$txt[235], ' ('$context['latest_post']['time'], ')<br />
</div>'
;
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="0" cellspacing="1" width="100%" border="0">
            <tr>
               <td class="catbg2" style="text-align:left;" colspan="2">'
$txt[70] ,'</td>
               <td class="catbg2" style="text-align:right;">'
$txt[301] ,'</td>
               <td class="catbg2" style="text-align:right;">'
$txt[20] ,'</td>
               <td class="catbg2" style="text-align:right;">'
$txt[29] ,'</td>
               <td class="catbg2" style="text-align:right;">'
$txt[317] ,'</td>
             </tr>'
;


/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
$cnt 0;
foreach ($context['latest_posts'] as $post){
         
$cnt++;
         
$class = ($cnt 2) ? 'windowbg' 'windowbg2';
         
        echo 
'
<tr>
                <td class="'
$class'"><img src="'$post['icon'] , '" alt="" /></td>
<td class="'
$class'"" title="'$post['preview'] ,'">'$post['link'], '</td>
<td class="'
$class'"" style="text-align:right;">'$post['views'], '</td>
                <td class="'
$class'"" style="text-align:right;">',$post['board']['link'], '</td>
                <td class="'
$class'"" style="text-align:right;">',$post['poster']['link'], '</td>
<td class="'
$class'"" style="text-align:right;" nowrap="nowrap">'$post['time'], '</td>
</tr>'
;
       }

echo '
</table>'
;
}
echo '
</td>
</tr>'
;
}

// Show information about events, birthdays, and holidays on the calendar.
if ($context['show_calendar'])
{
echo '
<tr>
<td class="titlebg" colspan="2">'
$context['calendar_only_today'] ? $txt['calendar47b'] : $txt['calendar47'], '</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
<a href="'
$scripturl'?action=calendar"><img src="'$settings['images_url'], '/icons/calendar.gif" alt="'$txt['calendar24'], '" /></a>
</td>
<td class="windowbg2" width="100%">
<span class="smalltext">'
;

// Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
if (!empty($context['calendar_holidays']))
echo '
<span style="color: #'
$modSettings['cal_holidaycolor'], ';">'$txt['calendar5'], ' 'implode(', '$context['calendar_holidays']), '</span><br />';

// People's birthdays. Like mine. And yours, I guess. Kidding.
if (!empty($context['calendar_birthdays']))
{
echo '
<span style="color: #'
$modSettings['cal_bdaycolor'], ';">'$context['calendar_only_today'] ? $txt['calendar3'] : $txt['calendar3b'], '</span> ';
/* Each member in calendar_birthdays has:
id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
foreach ($context['calendar_birthdays'] as $member)
echo '
<a href="'
$scripturl'?action=profile;u='$member['id'], '">'$member['is_today'] ? '<b>' ''$member['name'], $member['is_today'] ? '</b>' '', isset($member['age']) ? ' (' $member['age'] . ')' '''</a>'$member['is_last'] ? '<br />' ', ';
}
// Events like community get-togethers.
if (!empty($context['calendar_events']))
{
echo '
<span style="color: #'
$modSettings['cal_eventcolor'], ';">'$context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span> ';
/* Each event in calendar_events should have:
title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
foreach ($context['calendar_events'] as $event)
echo '
'
$event['can_edit'] ? '<a href="' $event['modify_href'] . '" style="color: #FF0000;">*</a> ' ''$event['href'] == '' '' '<a href="' $event['href'] . '">'$event['is_today'] ? '<b>' $event['title'] . '</b>' $event['title'], $event['href'] == '' '' '</a>'$event['is_last'] ? '<br />' ', ';

// Show a little help text to help them along ;).
if ($context['calendar_can_edit'])
echo '
(<a href="'
$scripturl'?action=helpadmin;help=calendar_how_edit" onclick="return reqWin(this.href);">'$txt['calendar_how_edit'], '</a>)';
}
echo '
</span>
</td>
</tr>'
;
}


// Show YaBB SP1 style information...
if ($settings['show_sp1_info'])
{
echo '
<tr>
<td class="titlebg" colspan="2">'
$txt[645], '</td>
</tr>
<tr>
<td class="windowbg" width="20" valign="middle" align="center">
<a href="'
$scripturl'?action=stats"><img src="'$settings['images_url'], '/icons/info.gif" alt="'$txt[645], '" /></a>
</td>
<td class="windowbg2" width="100%">
<span class="middletext">
'
$context['common_stats']['total_posts'], ' '$txt[95], ' '$txt['smf88'], ' '$context['common_stats']['total_topics'], ' '$txt[64], ' '$txt[525], ' '$context['common_stats']['total_members'], ' '$txt[19], '. '$txt[656], ': <b> '$context['common_stats']['latest_member']['link'], '</b>
<br /> ' 
$txt[659] . ': <b>"' $context['latest_post']['link'] . '"</b>  ( ' $context['latest_post']['time'] . ' )<br />
<a href="'
$scripturl'?action=recent">'$txt[234], '</a>'$context['show_stats'] ? '<br />
<a href="' 
$scripturl '?action=stats">' $txt['smf223'] . '</a>' '''
</span>
</td>
</tr>'
;
}

// "Users online" - in order of activity.
echo '
<tr>
<td class="titlebg" colspan="2">'
$txt[158], '</td>
</tr><tr>
<td rowspan="2" class="windowbg" width="20" valign="middle" align="center">
'
$context['show_who'] ? '<a href="' $scripturl '?action=who">' '''<img src="'$settings['images_url'], '/icons/online.gif" alt="'$txt[158], '" />'$context['show_who'] ? '</a>' '''
</td>
<td class="windowbg2" width="100%">'
;

echo '
'
$context['show_who'] ? '<a href="' $scripturl '?action=who">' ''$context['num_guests'], ' '$context['num_guests'] == $txt['guest'] : $txt['guests'], ', ' $context['num_users_online'], ' '$context['num_users_online'] == $txt['user'] : $txt['users'];

// Handle hidden users and buddies.
if (!empty($context['num_users_hidden']) || ($context['show_buddies'] && !empty($context['show_buddies'])))
{
echo ' (';

// Show the number of buddies online?
if ($context['show_buddies'])
echo $context['num_buddies'], ' '$context['num_buddies'] == $txt['buddy'] : $txt['buddies'];

// How about hidden users?
if (!empty($context['num_users_hidden']))
echo $context['show_buddies'] ? ', ' ''$context['num_users_hidden'] . ' ' $txt['hidden'];

echo ')';
}

echo $context['show_who'] ? '</a>' '''
<div class="smalltext">'
;

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online']))
echo '
'
$txt[140], ':<br />'implode(', '$context['list_users_online']);

echo '
<br />
'
$context['show_stats'] && !$settings['show_sp1_info'] ? '<a href="' $scripturl '?action=stats">' $txt['smf223'] . '</a>' '''
</div>
</td>
</tr>
<tr>
<td class="windowbg2" width="100%">
<span class="middletext">
'
$txt['most_online_today'], ': <b>'$modSettings['mostOnlineToday'], '</b>.
'
$txt['most_online_ever'], ': '$modSettings['mostOnline'], ' (' timeformat($modSettings['mostDate']), ')
</span>
</td>
</tr>'
;

// If they are logged in, but SP1 style information is off... show a personal message bar.
if ($context['user']['is_logged'] && !$settings['show_sp1_info'])
{
 echo '
<tr>
<td class="titlebg" colspan="2">'
$txt[159], '</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center">
'
$context['allow_pm'] ? '<a href="' $scripturl '?action=pm">' '''<img src="'$settings['images_url'], '/message_sm.gif" alt="'$txt[159], '" />'$context['allow_pm'] ? '</a>' '''
</td>
<td class="windowbg2" valign="top">
<b><a href="'
$scripturl'?action=pm">'$txt[159], '</a></b>
<div class="smalltext">
'
$txt[660], ' '$context['user']['messages'], ' '$context['user']['messages'] == $txt[471] : $txt[153], '.... '$txt[661], ' <a href="'$scripturl'?action=pm">'$txt[662], '</a> '$txt[663], '
</div>
</td>
</tr>'
;
}

// Show the login bar. (it's only true if they are logged out anyway.)
if ($context['show_login_bar'])
{
echo '
<tr>
<td class="titlebg" colspan="2">'
$txt[34], ' <a href="'$scripturl'?action=reminder" class="smalltext">(' $txt[315] . ')</a></td>
</tr>
<tr>
<td class="windowbg" width="20" align="center">
<a href="'
$scripturl'?action=login"><img src="'$settings['images_url'], '/icons/login.gif" alt="'$txt[34], '" /></a>
</td>
<td class="windowbg2" valign="middle">
<form action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '" style="margin: 0;">
<table border="0" cellpadding="2" cellspacing="0" align="center" width="100%"><tr>
<td valign="middle" align="left">
<label for="user"><b>'
$txt[35], ':</b><br />
<input type="text" name="user" id="user" size="15" /></label>
</td>
<td valign="middle" align="left">
<label for="passwrd"><b>'
$txt[36], ':</b><br />
<input type="password" name="passwrd" id="passwrd" size="15" /></label>
</td>
<td valign="middle" align="left">
<label for="cookielength"><b>'
$txt[497], ':</b><br />
<input type="text" name="cookielength" id="cookielength" size="4" maxlength="4" value="'
$modSettings['cookieTime'], '" /></label>
</td>
<td valign="middle" align="left">
<label for="cookieneverexp"><b>'
$txt[508], ':</b><br />
<input type="checkbox" name="cookieneverexp" id="cookieneverexp" checked="checked" class="check" /></label>
</td>
<td valign="middle" align="left">
<input type="submit" value="'
$txt[34], '" />
</td>
</tr></table>
</form>
</td>
</tr>'
;
}

echo '
</table>
</div>
</div>'
;
}

?>
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 07:01:03 PM
BoardIndex.php seems to be ok, now post sourcedir/Recent.php, but please use my NoPaste (http://www.marook-online.de/index.php/action,nopaste.html) instead of posting it with the code tag. Its laborious to copy & paste the code...
Title: Re: Advanced Recent Posts
Post by: teaser on January 21, 2008, 07:04:04 PM
did it :

http://www.marook-online.de/smf/index.php/id,a2f023bd53.html
Title: Re: Advanced Recent Posts
Post by: Mick. on January 21, 2008, 07:04:59 PM
Hey Marook. I hope the next version or mod is for "recent topics" only as opposed to "recent posts" with the same current lay-out on this mod.


Not that matters but i posted a request:
http://www.simplemachines.org/community/index.php?topic=218049.msg1391786#msg1391786
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 07:23:18 PM
Both files are ok... don't know whats wrong. Can you provide a link to your forum, so i can study the html output ??

@ BlueDevil : i'm working on it ;)
Title: Re: Advanced Recent Posts
Post by: teaser on January 21, 2008, 07:25:19 PM
livedesi.uni.cc

username:demo
pass: demo
Title: Re: Advanced Recent Posts
Post by: Mick. on January 21, 2008, 07:25:41 PM
Quote from: Marook on January 21, 2008, 07:23:18 PM

@ BlueDevil : i'm working on it ;)

Very cool!
Title: Re: Advanced Recent Posts
Post by: Marook on January 21, 2008, 08:03:44 PM
Ok teaser, don't know why but it seems that in your database the whole path to the posticons is already stored. So open BoardIndex.php and find this :

                <td class="', $class, '"><img src="', $post['icon'] , '" alt="" /></td>


and replace with this


                <td class="', $class, '">', $post['icon'] , '</td>

This should work...
Title: Re: Advanced Recent Posts
Post by: teaser on January 21, 2008, 10:43:46 PM
got it. Thanx!
Title: Re: Advanced Recent Posts
Post by: Marook on January 22, 2008, 01:00:59 AM
@ BlueDevil : got it ;)

open $sourcedir/BoardIndex.php and find this

  $context['latest_posts'] = getLastPosts($settings['number_recent_posts']);

comment out this line by adding // (two slashes) in front of it. After that, add these two lines after the out commented line :

require_once($sourcedir . '/../SSI.php');
      $context['latest_posts'] = ssi_recentTopics($settings['number_recent_posts'],null,'');

This already works, but the postimages would be broken so you must alter the BoardIndex.template.php. Find this line

                <td class="', $class, '"><img src="', $post['icon'] , '" alt="" /></td>

and replace it with this one

                <td class="', $class, '">', $post['icon'] , '</td>


//Edit, just saw the number of views will not shown, i will provide tomorrow an update of the mod, where admin can decide whether show recent topics or recent posts...
Title: Re: Advanced Recent Posts
Post by: Mick. on January 22, 2008, 01:10:26 AM
Is this with your mod still installed?
Title: Re: Advanced Recent Posts
Post by: jossanaijr on January 22, 2008, 06:57:56 AM
Coool! Thanks!
Title: Re: Advanced Recent Posts
Post by: Marook on January 23, 2008, 02:09:13 AM
Done ;) Please install the latest version 1.1 to get recent topics !
Title: Re: Advanced Recent Posts / Topics
Post by: Bluey on January 23, 2008, 05:29:46 AM
Hi I installed but get this error when tru to acces the forum boards

Parse error: syntax error, unexpected $end in /home/uams1/public_html/SMF/Themes/default/BoardIndex.template.php on line 577


This is what is on line 577 in boardindex.php

echo '
         </table>
      </div>
   </div>';
}

?>
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on January 23, 2008, 05:41:17 AM
hmmm...please post the whole BoardIndex.template.php file by using my NoPaste (http://www.marook-online.de/index.php/action,nopaste.html). I will try to fix it...
Title: Re: Advanced Recent Posts / Topics
Post by: Bluey on January 23, 2008, 05:54:19 AM
not sure how to use your no paste properly

here is the link it gave me

http://www.marook-online.de/smf/index.php/id,1cc9fca4f5.html
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on January 23, 2008, 06:04:07 AM
you did everything right ;) i fixxed your template...after line 323, a bracket was missing.

You can download your file at http://www.marook-online.de/smf/index.php/id,e679d6762d.html
Title: Re: Advanced Recent Posts / Topics
Post by: Bluey on January 23, 2008, 06:11:10 AM
Thanks Marook...that fixed it.  One littel bracket eh...this php wll be the death of me yet..lol

Thanks again ;)
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on January 23, 2008, 06:20:46 AM
you're welcome...can i see your site ?
Title: Re: Advanced Recent Posts / Topics
Post by: Bluey on January 23, 2008, 06:22:33 AM
Yes sure can it is www.uams.com.au  I don't seem to be seeing the mod though
Title: Re: Advanced Recent Posts / Topics
Post by: Bluey on January 23, 2008, 06:29:54 AM
Fixed it had the number of recent posts to display set at zero so thats exactly what it was doing. Great mod. Thanks again for your help
Title: Re: Advanced Recent Posts / Topics
Post by: FragaCampos on January 23, 2008, 08:42:42 AM
Why can't i see the number of replies? I see only the number of visualizations...
Here: ww.docspt.com
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on January 23, 2008, 08:52:28 AM
you must install the latest version 1.1 to get the replies...
Title: Re: Advanced Recent Posts / Topics
Post by: Mick. on January 23, 2008, 09:41:07 AM
Quote from: Marook on January 23, 2008, 02:09:13 AM
Done ;) Please install the latest version 1.1 to get recent topics !


Marook!   You tha man!

Exactly what i wanted.   You know?  I never liked the idea of repeated posts in the info center.

Thank you for modifying/creating to show topics only.   It works very well.
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on January 23, 2008, 09:52:28 AM
hehe nice to hear you like it ;)
Title: Re: Advanced Recent Posts / Topics
Post by: Drunken Clam on January 23, 2008, 03:43:28 PM
Hey Marook - Great job, works just fine, thanks!  ^5
Title: Re: Advanced Recent Posts / Topics
Post by: FragaCampos on January 23, 2008, 06:05:29 PM
Quote from: Marook on January 23, 2008, 08:52:28 AM
you must install the latest version 1.1 to get the replies...

Sorry... my bad :P
Thanks!
Title: Re: Advanced Recent Posts / Topics
Post by: Ur_Irish_Rose on January 25, 2008, 11:03:04 AM
Awsome Mod :) thank you for making it.

At first I thaught it didnt work but looking back on here it told me how to make it work and how to actually turn it on so that it shows :)

Excellent mod. TY for sharing it :)
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on January 25, 2008, 06:01:16 PM
you're welcome ;)
Title: Re: Advanced Recent Posts / Topics
Post by: ASF on January 27, 2008, 10:55:03 AM
Is there a way to show topic maker as well?
Title: Re: Advanced Recent Posts / Topics
Post by: bbpiper on February 03, 2008, 12:31:32 PM
Would it be possible to put line numbers in the script so that if you have to modify by hand you approx where to paste the code.

I have a another modification conflicting with this one and just want to be sure I put it in the right place.

Thanks!
Title: Re: Advanced Recent Posts / Topics
Post by: Fallen Angel on February 03, 2008, 04:27:50 PM
Hey can any look into my BoardIndex.template.php for DilberMC theme, and try to tell me, even maybe change in it so it works on my board???


??? ???
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 04, 2008, 12:29:48 AM
Where is the problem, looks fine...
Title: Re: Advanced Recent Posts / Topics
Post by: Fallen Angel on February 04, 2008, 01:00:58 PM
Dosent work, but dont know why or how.. *lol*
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 04, 2008, 05:09:35 PM
Any errormessages ?
Title: Re: Advanced Recent Posts / Topics
Post by: Fallen Angel on February 04, 2008, 05:59:57 PM
Nope... No error msg's..... Well going to try again soon.... No worries m8e....
Title: Re: Advanced Recent Posts / Topics
Post by: ACE844 on February 05, 2008, 01:23:32 PM
I actually encounter the same issue as the poster above. I just started my forum, (SMF 1.14, and TP.098) and at the time I tried tp install this; all tests and everything went well and I got no error messages. I was using the default 'core' theme, and the install didn't change either the look or the functionality stated for this mod. I tried an unistall, deletion, re-download-re-up, etc.., with the same results.

I have no idea why or what happened?
ACE844
Title: Re: Advanced Recent Posts / Topics
Post by: Trinny on February 06, 2008, 05:48:19 PM
Same here. I installed, everything went fine, no errors, successfully installed, but there was no change to my recent post area (and yes, I have it set to show the last five). The area is there and functioning as it always has, but the mod made no change at all on any of the three skins that I use.

EDIT: I downloaded the most recent version if that helps.
Title: Re: Advanced Recent Posts / Topics
Post by: Trinny on February 07, 2008, 05:04:55 PM
mmm update. I removed the package and manually installed and it works perfectly. great mod Marook.
Title: Re: Advanced Recent Posts / Topics
Post by: SampleM on February 09, 2008, 08:40:58 AM
Marook, good thing! but what about exluding some boards from recents? for example: add one setting near your mod switch "Excluding Boards ID list by comma: " and admin may hide some unused boards (spam or technical or not hottest). default is nothings, but in code need add recycle bin ID, if have. or may be you know where may input exclude boards?
Title: Re: Advanced Recent Posts / Topics
Post by: jjoel on February 09, 2008, 11:10:22 AM
Ok, Marook, thank you, excelent MOD.

Inté
jjoel
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 10, 2008, 02:22:08 AM
@ SampleM : sounds not bad...putting it on my todo-list ;)
Title: 1. Execute Modification ./Sources/Recent.php Test failed
Post by: lookang on February 10, 2008, 10:37:59 AM
Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.
Install Actions
Installations actions for "Advanced Recent-Posts":
Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Sources/Recent.php    Test failed
2.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test successful
3.    Execute Modification    ./Sources/ModSettings.php    Test successful
4.    Execute Modification    ./Themes/default/languages/ModSettings.english.php    Test successful
5.    Execute Code    add_settings.php

help!
Title: Re: Advanced Recent Posts / Topics
Post by: Spudgun on February 10, 2008, 10:47:06 AM
I have the exact same error as above;

1.    Execute Modification    ./Sources/Recent.php    Test failed
2.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test successful
3.    Execute Modification    ./Sources/ModSettings.php    Test successful
4.    Execute Modification    ./Themes/default/languages/ModSettings.english.php    Test successful

I have gone ahead and installed the mod fine but Replies and Views (statistics) are not showing in recent posts which is a shame as the mod is just what I'm looking for. Could anyone help please?

I have attached Recent.php if anyone has time to have a look. I have too many mods installed to list which is obviously why this mod has not installed cleanly in Recent.php but all work well with each other at the moment.

Kind Regards
Tim.

Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 10, 2008, 11:01:29 AM
Uninstall the membercolor mod and retry installing the adv. recent posts mod... after success you can try to reinstall the membercolor mod.
Title: Re: Advanced Recent Posts / Topics
Post by: Spudgun on February 10, 2008, 11:43:50 AM
Firstly Marook, thanks very much for trying to help, I appreciate this a great deal ;)

I have uninstalled the membercolor mod and this mod. I then installed this mod but was still getting.

1.    Execute Modification    ./Sources/Recent.php    Test failed
2.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test successful
3.    Execute Modification    ./Sources/ModSettings.php    Test successful
4.    Execute Modification    ./Themes/default/languages/ModSettings.english.php    Test successful

I went ahead again and installed the mod regardless then went into admin panel - Forum Maintenance and clicked 'recount all forum totals and statistics'. Still no joy, but as I say thankyou, very kind of you to help.

I have attached Recent.php again with the membercolor mod removed (If uninstalling the mod did indeed remove the code?)

Thanks again
Tim
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 10, 2008, 12:41:53 PM
The membercolor mod code was removed but the changes of my mod aren't removed. Thats the reason why you can't install it. If you have't installed any other mods which are altering the recent.php, delete it and take a fresh one. Or just take this one attached... if you have installed other mods i'll have to install it manually for you..
Title: Re: Advanced Recent Posts / Topics
Post by: Spudgun on February 10, 2008, 12:55:12 PM
Fantastic!

I used the one that you altered and attached and it worked perfectly!

http://www.forums.pondlife.eu/forum/index.php (http://www.forums.pondlife.eu/forum/index.php)

Thank you so much for your help and all you do here. I know from reading forum posts that you guys get very little thanks for the great (unpaid) work you do.

Kind Regards and thanks again.

Tim.
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 10, 2008, 01:28:30 PM
Yeah looks much better that the recent posts... great!
Title: Re: Advanced Recent Posts / Topics
Post by: myaicons on February 10, 2008, 02:38:50 PM
awsome mod!!  great work

dontcha all just love it when someone makes a simple mod that makes such a cool difference...  ;D

.... cant wait for the SSI functions for it !
Title: Re: Advanced Recent Posts / Topics
Post by: lookang on February 11, 2008, 05:12:36 AM
i ftp the new file recent.php into my webby.

i tried to apply the mod but the msg is still

Installations actions for "Advanced Recent-Posts":
Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Sources/Recent.php    Test failed
2.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test successful
3.    Execute Modification    ./Sources/ModSettings.php    Test successful
4.    Execute Modification    ./Themes/default/languages/ModSettings.english.php    Test successful
5.    Execute Code    add_settings.php    

what am i doing wrongly?  :D
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 11, 2008, 06:29:15 AM
which smf version do you use ? is this a fresh recent.php ?
Title: Re: Advanced Recent Posts / Topics
Post by: Beaver on February 12, 2008, 02:26:49 AM
Hi there, i installed SMF 1.1.3 via fantastico then upgraded it

I haven't published my forum in public yet, still constructing it, and now i'm trying to install your mod here. I installed it just fine, all successful , nothing shows, just the old recent .

maybe this helps, in my feature&opt-->layout option at the last line, an empty space shows ,it looks like the text is missing , i can only see the checkbox.........

I had this problem when installing my TP, it's the language , my forum uses english-utf8 , so i had to download the TP.english-utf8.php , maybe this is a similar problem ?

thanks marook
Title: Re: Advanced Recent Posts / Topics
Post by: lookang on February 12, 2008, 09:08:28 AM
forum\Sources\Recent.php

wow, so long


<?php
/**********************************************************************************
* Recent.php                                                                      *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 1.1                                             *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006 by:          Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/
if (!defined('SMF'))
   die('Hacking attempt...');

/*   This file had one very clear purpose.  It is here expressly to find and
   retrieve information about recently posted topics, messages, and the like.

   array getLastPost()
      // !!!

   array getLastPosts(int number_of_posts)
      // !!!

   void RecentPosts()
      // !!!

   void UnreadTopics()
      // !!!
*/

// Get the latest post.
function getLastPost()
{
   global $db_prefix, $user_info, $scripturl, $modSettings, $func;

   // Find it by the board - better to order by board than sort the entire messages table.
   $request = db_query("
      SELECT ml.posterTime, ml.subject, ml.ID_TOPIC, ml.posterName, LEFT(ml.body, 384) AS body, ml.smileysEnabled
      FROM ({$db_prefix}boards AS b, {$db_prefix}messages AS ml)
      WHERE ml.ID_MSG = b.ID_LAST_MSG" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
         AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
         AND $user_info[query_see_board]
      ORDER BY b.ID_MSG_UPDATED DESC
      LIMIT 1", __FILE__, __LINE__);
   if (mysql_num_rows($request) == 0)
      return array();
   $row = mysql_fetch_assoc($request);
   mysql_free_result($request);

   // Censor the subject and post...
   censorText($row['subject']);
   censorText($row['body']);

   $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled']), array('<br />' => '&#10;')));
   if ($func['strlen']($row['body']) > 128)
      $row['body'] = $func['substr']($row['body'], 0, 128) . '...';

   // Send the data.
   return array(
      'topic' => $row['ID_TOPIC'],
      'subject' => $row['subject'],
      'short_subject' => shorten_subject($row['subject'], 24),
      'preview' => $row['body'],
      'time' => timeformat($row['posterTime']),
      'timestamp' => forum_time(true, $row['posterTime']),
      'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.new;topicseen#new',
      'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.new;topicseen#new">' . $row['subject'] . '</a>'
   );
}

function getLastPosts($showlatestcount)
{
   global $scripturl, $txt, $db_prefix, $user_info, $modSettings, $func, $settings, $ID_MEMBER;

   // Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
   // !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
   if (!empty($modSettings['recent_topics']) && $modSettings['recent_topics']){
    $request = db_query("
        SELECT
           m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
           IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
           IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
           IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon, t.numReplies, t.numViews
        FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
           LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
           LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
           LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
        WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($showlatestcount, 5)) . "
           AND t.ID_LAST_MSG = m.ID_MSG
           AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
           AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
           AND $user_info[query_see_board]
           AND ms.ID_MSG = t.ID_FIRST_MSG
        ORDER BY t.ID_LAST_MSG DESC
        LIMIT $showlatestcount", __FILE__, __LINE__);
   } else {
      $request = db_query("
          SELECT
             m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG,
             IFNULL(mem.realName, m.posterName) AS posterName, t.ID_BOARD, b.name AS bName,
             LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon, t.numViews, t.numReplies
          FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
             LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
          WHERE m.ID_MSG >= " . max(0, $modSettings['maxMsgID'] - 20 * $showlatestcount) . "
             AND t.ID_TOPIC = m.ID_TOPIC
             AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
             AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
             AND $user_info[query_see_board]
          ORDER BY m.ID_MSG DESC
          LIMIT $showlatestcount", __FILE__, __LINE__);
   }
   $posts = array();
   while ($row = mysql_fetch_assoc($request))
   {
      // Censor the subject and post for the preview ;).
      censorText($row['subject']);
      censorText($row['body']);

      $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '&#10;')));
      if ($func['strlen']($row['body']) > 128)
         $row['body'] = $func['substr']($row['body'], 0, 128) . '...';

    $class = $row['ID_MEMBER']==$ID_MEMBER ? 'my_' : '';
    if ($row['numReplies']>15){
      $class .= ($row['numReplies'] > 25) ? 'veryhot_post' : 'hot_post';
    } else {
      $class .= 'normal_post';
    }
      // Build the array.
      $posts[] = array(
         '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'],
         'icon' => file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? $settings['images_url'] . '/post/' . $row['icon'] . '.gif' : $settings['default_images_url'] . '/post/' . $row['icon'] . '.gif',
         'views' => $row['numViews'],
         'replies' => $row['numReplies'],
         'class' => $class,
         'poster' => array(
            'id' => $row['ID_MEMBER'],
            'name' => $row['posterName'],
            'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
            'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
         ),
         'subject' => $row['subject'],
         'short_subject' => shorten_subject($row['subject'], 24),
         'preview' => $row['body'],
         'time' => timeformat($row['posterTime']),
         'timestamp' => forum_time(true, $row['posterTime']),
         'raw_timestamp' => $row['posterTime'],
         'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#msg' . $row['ID_MSG'],
         'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>'
      );
   }
   mysql_free_result($request);

   return $posts;
}

// Find the ten most recent posts.
function RecentPosts()
{
   global $txt, $scripturl, $db_prefix, $user_info, $context, $ID_MEMBER, $modSettings, $sourcedir, $board;

   // They're deleting something... just skip back to it.
   if (isset($_GET['delete']))
   {
      checkSession('get');

      // Luckily, removeMessage() checks permissions for us.
      require_once($sourcedir . '/RemoveTopic.php');
      removeMessage((int) $_GET['delete']);

      redirectexit('action=recent');
   }

   loadTemplate('Recent');
   $context['page_title'] = $txt[214];

   if (isset($_REQUEST['start']) && $_REQUEST['start'] > 95)
      $_REQUEST['start'] = 95;

   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 = db_query("
            SELECT name
            FROM {$db_prefix}categories
            WHERE ID_CAT = " . $_REQUEST['c'][0] . "
            LIMIT 1", __FILE__, __LINE__);
         list ($name) = mysql_fetch_row($request);
         mysql_free_result($request);

         if (empty($name))
            fatal_lang_error(1, false);

         $context['linktree'][] = array(
            'url' => $scripturl . '#' . (int) $_REQUEST['c'],
            'name' => $name
         );
      }

      $request = db_query("
         SELECT b.ID_BOARD, b.numPosts
         FROM {$db_prefix}boards AS b
         WHERE b.ID_CAT IN (" . implode(', ', $_REQUEST['c']) . ")
            AND $user_info[query_see_board]", __FILE__, __LINE__);
      $total_cat_posts = 0;
      $boards = array();
      while ($row = mysql_fetch_assoc($request))
      {
         $boards[] = $row['ID_BOARD'];
         $total_cat_posts += $row['numPosts'];
      }
      mysql_free_result($request);

      if (empty($boards))
         fatal_lang_error('error_no_boards_selected', false);

      $query_this_board = 'b.ID_BOARD IN (' . implode(', ', $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 >= ' . max(0, $modSettings['maxMsgID'] - 400 - $_REQUEST['start'] * 7);

      $context['page_index'] = constructPageIndex($scripturl . '?action=recent;c=' . implode(',', $_REQUEST['c']), $_REQUEST['start'], min(100, $total_cat_posts), 10, false);
   }
   elseif (!empty($_REQUEST['boards']))
   {
      $_REQUEST['boards'] = explode(',', $_REQUEST['boards']);
      foreach ($_REQUEST['boards'] as $i => $b)
         $_REQUEST['boards'][$i] = (int) $b;

      $request = db_query("
         SELECT b.ID_BOARD, b.numPosts
         FROM {$db_prefix}boards AS b
         WHERE b.ID_BOARD IN (" . implode(', ', $_REQUEST['boards']) . ")
            AND $user_info[query_see_board]
         LIMIT " . count($_REQUEST['boards']), __FILE__, __LINE__);
      $total_posts = 0;
      $boards = array();
      while ($row = mysql_fetch_assoc($request))
      {
         $boards[] = $row['ID_BOARD'];
         $total_posts += $row['numPosts'];
      }
      mysql_free_result($request);

      if (empty($boards))
         fatal_lang_error('error_no_boards_selected', false);

      $query_this_board = 'b.ID_BOARD IN (' . implode(', ', $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 >= ' . max(0, $modSettings['maxMsgID'] - 500 - $_REQUEST['start'] * 9);

      $context['page_index'] = constructPageIndex($scripturl . '?action=recent;boards=' . implode(',', $_REQUEST['boards']), $_REQUEST['start'], min(100, $total_posts), 10, false);
   }
   elseif (!empty($board))
   {
      $request = db_query("
         SELECT numPosts
         FROM {$db_prefix}boards
         WHERE ID_BOARD = $board
         LIMIT 1", __FILE__, __LINE__);
      list ($total_posts) = mysql_fetch_row($request);
      mysql_free_result($request);

      $query_this_board = 'b.ID_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 >= ' . max(0, $modSettings['maxMsgID'] - 600 - $_REQUEST['start'] * 10);

      $context['page_index'] = constructPageIndex($scripturl . '?action=recent;board=' . $board . '.%d', $_REQUEST['start'], min(100, $total_posts), 10, true);
   }
   else
   {
      $query_this_board = $user_info['query_see_board'] . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
         AND b.ID_BOARD != $modSettings[recycle_board]" : ''). '
         AND m.ID_MSG >= ' . max(0, $modSettings['maxMsgID'] - 100 - $_REQUEST['start'] * 6);

      // !!! This isn't accurate because we ignore the recycle bin.
      $context['page_index'] = constructPageIndex($scripturl . '?action=recent', $_REQUEST['start'], min(100, $modSettings['totalMessages']), 10, false);
   }

   $context['linktree'][] = array(
      'url' => $scripturl . '?action=recent' . (empty($board) ? (empty($_REQUEST['c']) ? '' : ';c=' . (int) $_REQUEST['c']) : ';board=' . $board . '.0'),
      'name' => $context['page_title']
   );

   // Find the 10 most recent messages they can *view*.
   // !!!SLOW This query is really slow still, probably?
   $request = db_query("
      SELECT m.ID_MSG
      FROM ({$db_prefix}messages AS m, {$db_prefix}boards AS b)
      WHERE b.ID_BOARD = m.ID_BOARD
         AND $query_this_board
      ORDER BY m.ID_MSG DESC
      LIMIT $_REQUEST[start], 10", __FILE__, __LINE__);
   $messages = array();
   while ($row = mysql_fetch_assoc($request))
      $messages[] = $row['ID_MSG'];
   mysql_free_result($request);

   // Looks like nothin's happen here... or, at least, nothin' you can see...
   if (empty($messages))
   {
      $context['posts'] = array();
      return;
   }

   // Get all the most recent posts.
   $request = db_query("
      SELECT
         m.ID_MSG, m.subject, m.smileysEnabled, m.posterTime, m.body, m.ID_TOPIC, t.ID_BOARD, b.ID_CAT,
         b.name AS bname, c.name AS cname, t.numReplies, m.ID_MEMBER, m2.ID_MEMBER AS ID_FIRST_MEMBER,
         IFNULL(mem2.realName, m2.posterName) AS firstPosterName, t.ID_FIRST_MSG,
         IFNULL(mem.realName, m.posterName) AS posterName, t.ID_LAST_MSG
      FROM ({$db_prefix}messages AS m, {$db_prefix}messages AS m2, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}categories AS c)
         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)
      WHERE m2.ID_MSG = t.ID_FIRST_MSG
         AND t.ID_TOPIC = m.ID_TOPIC
         AND b.ID_BOARD = t.ID_BOARD
         AND c.ID_CAT = b.ID_CAT
         AND m.ID_MSG IN (" . implode(', ', $messages) . ")
      ORDER BY m.ID_MSG DESC
      LIMIT " . count($messages), __FILE__, __LINE__);
   $counter = $_REQUEST['start'] + 1;
   $context['posts'] = array();
   $board_ids = array('own' => array(), 'any' => array());
   while ($row = mysql_fetch_assoc($request))
   {
      // Censor everything.
      censorText($row['body']);
      censorText($row['subject']);

      // BBC-atize the message.
      $row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);

      // And build the array.
      $context['posts'][$row['ID_MSG']] = array(
         'id' => $row['ID_MSG'],
         'counter' => $counter++,
         'category' => array(
            'id' => $row['ID_CAT'],
            'name' => $row['cname'],
            'href' => $scripturl . '#' . $row['ID_CAT'],
            'link' => '<a href="' . $scripturl . '#' . $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'],
         'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>',
         'start' => $row['numReplies'],
         'subject' => $row['subject'],
         'time' => timeformat($row['posterTime']),
         'timestamp' => forum_time(true, $row['posterTime']),
         'first_poster' => array(
            'id' => $row['ID_FIRST_MEMBER'],
            'name' => $row['firstPosterName'],
            'href' => empty($row['ID_FIRST_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'],
            'link' => empty($row['ID_FIRST_MEMBER']) ? $row['firstPosterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '">' . $row['firstPosterName'] . '</a>'
         ),
         'poster' => array(
            'id' => $row['ID_MEMBER'],
            'name' => $row['posterName'],
            'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
            'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
         ),
         'message' => $row['body'],
         'can_reply' => false,
         'can_mark_notify' => false,
         'can_delete' => false,
         'delete_possible' => ($row['ID_FIRST_MSG'] != $row['ID_MSG'] || $row['ID_LAST_MSG'] == $row['ID_MSG']) && (empty($modSettings['edit_disable_time']) || $row['posterTime'] + $modSettings['edit_disable_time'] * 60 >= time()),
      );

      if ($ID_MEMBER == $row['ID_FIRST_MEMBER'])
         $board_ids['own'][$row['ID_BOARD']][] = $row['ID_MSG'];
      $board_ids['any'][$row['ID_BOARD']][] = $row['ID_MSG'];
   }
   mysql_free_result($request);

   // There might be - and are - different permissions between any and own.
   $permissions = array(
      'own' => array(
         'post_reply_own' => 'can_reply',
         'delete_own' => 'can_delete',
      ),
      'any' => array(
         'post_reply_any' => 'can_reply',
         'mark_any_notify' => 'can_mark_notify',
         'delete_any' => 'can_delete',
      )
   );

   // Now go through all the permissions, looking for boards they can do it on.
   foreach ($permissions as $type => $list)
   {
      foreach ($list as $permission => $allowed)
      {
         // They can do it on these boards...
         $boards = boardsAllowedTo($permission);

         // If 0 is the only thing in the array, they can do it everywhere!
         if (!empty($boards) && $boards[0] == 0)
            $boards = array_keys($board_ids[$type]);

         // Go through the boards, and look for posts they can do this on.
         foreach ($boards as $board_id)
         {
            // Hmm, they have permission, but there are no topics from that board on this page.
            if (!isset($board_ids[$type][$board_id]))
               continue;

            // Okay, looks like they can do it for these posts.
            foreach ($board_ids[$type][$board_id] as $counter)
               if ($type == 'any' || $context['posts'][$counter]['poster']['id'] == $ID_MEMBER)
                  $context['posts'][$counter][$allowed] = true;
         }
      }
   }

   // Some posts - the first posts - can't just be deleted.
   foreach ($context['posts'] as $counter => $dummy)
      $context['posts'][$counter]['can_delete'] &= $context['posts'][$counter]['delete_possible'];
}

// Find unread topics and replies.
function UnreadTopics()
{
   global $board, $txt, $scripturl, $db_prefix, $sourcedir;
   global $ID_MEMBER, $user_info, $context, $settings, $modSettings, $func;

   // Guests can't have unread things, we don't know anything about them.
   is_not_guest();

   // Prefetching + lots of MySQL work = bad mojo.
   if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
   {
      ob_end_clean();
      header('HTTP/1.1 403 Forbidden');
      die;
   }

   $context['showing_all_topics'] = isset($_GET['all']);
   if ($_REQUEST['action'] == 'unread')
      $context['page_title'] = $context['showing_all_topics'] ? $txt['unread_topics_all'] : $txt['unread_topics_visit'];
   else
      $context['page_title'] = $txt['unread_replies'];

   if ($context['showing_all_topics'] && !empty($context['load_average']) && !empty($modSettings['loadavg_allunread']) && $context['load_average'] >= $modSettings['loadavg_allunread'])
      fatal_lang_error('loadavg_allunread_disabled', false);
   elseif ($_REQUEST['action'] != 'unread' && !empty($context['load_average']) && !empty($modSettings['loadavg_unreadreplies']) && $context['load_average'] >= $modSettings['loadavg_unreadreplies'])
      fatal_lang_error('loadavg_unreadreplies_disabled', false);

   // Are we specifying any specific board?
   if (!empty($board))
   {
      $query_this_board = 'ID_BOARD = ' . $board;
      $context['querystring_board_limits'] = ';board=' . $board . '.%d';
   }
   elseif (!empty($_REQUEST['boards']))
   {
      $_REQUEST['boards'] = explode(',', $_REQUEST['boards']);
      foreach ($_REQUEST['boards'] as $i => $b)
         $_REQUEST['boards'][$i] = (int) $b;

      $request = db_query("
         SELECT b.ID_BOARD
         FROM {$db_prefix}boards AS b
         WHERE $user_info[query_see_board]
            AND b.ID_BOARD IN (" . implode(', ', $_REQUEST['boards']) . ")", __FILE__, __LINE__);
      $boards = array();
      while ($row = mysql_fetch_assoc($request))
         $boards[] = $row['ID_BOARD'];
      mysql_free_result($request);

      if (empty($boards))
         fatal_lang_error('error_no_boards_selected');

      $query_this_board = 'ID_BOARD IN (' . implode(', ', $boards) . ')';
      $context['querystring_board_limits'] = ';boards=' . implode(',', $boards) . ';start=%d';
   }
   elseif (!empty($_REQUEST['c']))
   {
      $_REQUEST['c'] = explode(',', $_REQUEST['c']);
      foreach ($_REQUEST['c'] as $i => $c)
         $_REQUEST['c'][$i] = (int) $c;

      $request = db_query("
         SELECT b.ID_BOARD
         FROM {$db_prefix}boards AS b
         WHERE $user_info[query_see_board]
            AND b.ID_CAT IN (" . implode(', ', $_REQUEST['c']) . ")", __FILE__, __LINE__);
      $boards = array();
      while ($row = mysql_fetch_assoc($request))
         $boards[] = $row['ID_BOARD'];
      mysql_free_result($request);

      if (empty($boards))
         fatal_lang_error('error_no_boards_selected');

      $query_this_board = 'ID_BOARD IN (' . implode(', ', $boards) . ')';
      $context['querystring_board_limits'] = ';c=' . implode(',', $_REQUEST['c']) . ';start=%d';
   }
   else
   {
      // Don't bother to show deleted posts!
      $request = db_query("
         SELECT b.ID_BOARD
         FROM {$db_prefix}boards AS b
         WHERE $user_info[query_see_board]" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
            AND b.ID_BOARD != " . (int) $modSettings['recycle_board'] : ''), __FILE__, __LINE__);
      $boards = array();
      while ($row = mysql_fetch_assoc($request))
         $boards[] = $row['ID_BOARD'];
      mysql_free_result($request);

      if (empty($boards))
         fatal_lang_error('error_no_boards_selected');

      $query_this_board = 'ID_BOARD IN (' . implode(', ', $boards) . ')';
      $context['querystring_board_limits'] = ';start=%d';
      $context['no_board_limits'] = true;
   }

   $sort_methods = array(
      'subject' => 'ms.subject',
      'starter' => 'IFNULL(mems.realName, ms.posterName)',
      'replies' => 't.numReplies',
      'views' => 't.numViews',
      'first_post' => 't.ID_TOPIC',
      'last_post' => 't.ID_LAST_MSG'
   );

   // The default is the most logical: newest first.
   if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
   {
      $context['sort_by'] = 'last_post';
      $_REQUEST['sort'] = 't.ID_LAST_MSG';
      $ascending = isset($_REQUEST['asc']);

      $context['querystring_sort_limits'] = $ascending ? ';asc' : '';
   }
   // But, for other methods the default sort is ascending.
   else
   {
      $context['sort_by'] = $_REQUEST['sort'];
      $_REQUEST['sort'] = $sort_methods[$_REQUEST['sort']];
      $ascending = !isset($_REQUEST['desc']);

      $context['querystring_sort_limits'] = ';sort=' . $context['sort_by'] . ($ascending ? '' : ';desc');
   }
   $context['sort_direction'] = $ascending ? 'up' : 'down';

   if (!empty($_REQUEST['c']) && is_array($_REQUEST['c']) && count($_REQUEST['c']) == 1)
   {
      $request = db_query("
         SELECT name
         FROM {$db_prefix}categories
         WHERE ID_CAT = " . (int) $_REQUEST['c'][0] . "
         LIMIT 1", __FILE__, __LINE__);
      list ($name) = mysql_fetch_row($request);
      mysql_free_result($request);

      $context['linktree'][] = array(
         'url' => $scripturl . '#' . (int) $_REQUEST['c'][0],
         'name' => $name
      );
   }

   $context['linktree'][] = array(
      'url' => $scripturl . '?action=' . $_REQUEST['action'] . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits'],
      'name' => $_REQUEST['action'] == 'unread' ? $txt['unread_topics_visit'] : $txt['unread_replies']
   );

   if ($context['showing_all_topics'])
      $context['linktree'][] = array(
         'url' => $scripturl . '?action=' . $_REQUEST['action'] . ';all' . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits'],
         'name' => $txt['unread_topics_all']
      );
   else
      $txt['unread_topics_visit_none'] = strtr($txt['unread_topics_visit_none'], array('?action=unread;all' => '?action=unread;all' . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits']));

   if (WIRELESS)
      $context['sub_template'] = WIRELESS_PROTOCOL . '_recent';
   else
   {
      loadTemplate('Recent');
      $context['sub_template'] = $_REQUEST['action'] == 'unread' ? 'unread' : 'replies';
   }

   // Setup the default topic icons... for checking they exist and the like ;)
   $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
   $context['icon_sources'] = array();
   foreach ($stable_icons as $icon)
      $context['icon_sources'][$icon] = 'images_url';

   $is_topics = $_REQUEST['action'] == 'unread';

   // This part is the same for each query.
   $select_clause = '
            ms.subject AS firstSubject, ms.posterTime AS firstPosterTime, ms.ID_TOPIC, t.ID_BOARD, b.name AS bname,
            t.numReplies, t.numViews, ms.ID_MEMBER AS ID_FIRST_MEMBER, ml.ID_MEMBER AS ID_LAST_MEMBER,
            ml.posterTime AS lastPosterTime, IFNULL(mems.realName, ms.posterName) AS firstPosterName,
            IFNULL(meml.realName, ml.posterName) AS lastPosterName, ml.subject AS lastSubject,
            ml.icon AS lastIcon, ms.icon AS firstIcon, t.ID_POLL, t.isSticky, t.locked, ml.modifiedTime AS lastModifiedTime,
            IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from, LEFT(ml.body, 384) AS lastBody, LEFT(ms.body, 384) AS firstBody,
            ml.smileysEnabled AS lastSmileys, ms.smileysEnabled AS firstSmileys, t.ID_FIRST_MSG, t.ID_LAST_MSG';

   if ($context['showing_all_topics'])
   {
      if (!empty($board))
      {
         $request = db_query("
            SELECT MIN(ID_MSG)
            FROM {$db_prefix}log_mark_read
            WHERE ID_MEMBER = $ID_MEMBER
               AND ID_BOARD = $board", __FILE__, __LINE__);
         list ($earliest_msg) = mysql_fetch_row($request);
         mysql_free_result($request);
      }
      else
      {
         $request = db_query("
            SELECT MIN(lmr.ID_MSG)
            FROM {$db_prefix}boards AS b
               LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
            WHERE $user_info[query_see_board]", __FILE__, __LINE__);
         list ($earliest_msg) = mysql_fetch_row($request);
         mysql_free_result($request);
      }

      // This is needed in case of topics marked unread.
      if (empty($earliest_msg))
         $earliest_msg = 0;
      else
      {
         // Using caching, when possible, to ignore the below slow query.
         if (isset($_SESSION['cached_log_time']) && $_SESSION['cached_log_time'][0] + 45 > time())
            $earliest_msg2 = $_SESSION['cached_log_time'][1];
         else
         {
            // This query is pretty slow, but it's needed to ensure nothing crucial is ignored.
            $request = db_query("
               SELECT MIN(ID_MSG)
               FROM {$db_prefix}log_topics
               WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
            list ($earliest_msg2) = mysql_fetch_row($request);
            mysql_free_result($request);

            // In theory this could be zero, if the first ever post is unread, so fudge it ;)
            if ($earliest_msg2 == 0)
               $earliest_msg2 = -1;

            $_SESSION['cached_log_time'] = array(time(), $earliest_msg2);
         }

         $earliest_msg = min($earliest_msg2, $earliest_msg);
      }
   }

   // !!! Add modifiedTime in for logTime check?

   if ($modSettings['totalMessages'] > 100000 && $context['showing_all_topics'])
   {
      db_query("
         DROP TABLE IF EXISTS {$db_prefix}log_topics_unread", false, false);

      // Let's copy things out of the log_topics table, to reduce searching.
      $have_temp_table = db_query("
         CREATE TEMPORARY TABLE {$db_prefix}log_topics_unread (
            PRIMARY KEY (ID_TOPIC)
         )
         SELECT lt.ID_TOPIC, lt.ID_MSG
         FROM ({$db_prefix}topics AS t, {$db_prefix}log_topics AS lt)
         WHERE lt.ID_TOPIC = t.ID_TOPIC
            AND lt.ID_MEMBER = $ID_MEMBER
            AND t.$query_this_board" . (!empty($earliest_msg) ? "
            AND t.ID_LAST_MSG > $earliest_msg" : ''), false, false) !== false;
   }
   else
      $have_temp_table = false;

   if ($context['showing_all_topics'] && $have_temp_table)
   {
      $request = db_query("
         SELECT COUNT(*), MIN(t.ID_LAST_MSG)
         FROM {$db_prefix}topics AS t
            LEFT JOIN {$db_prefix}log_topics_unread AS lt ON (lt.ID_TOPIC = t.ID_TOPIC)
            LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
         WHERE t.$query_this_board" . ($context['showing_all_topics'] && !empty($earliest_msg) ? "
            AND t.ID_LAST_MSG > $earliest_msg" : "
            AND t.ID_LAST_MSG > $_SESSION[ID_MSG_LAST_VISIT]") . "
            AND IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) < t.ID_LAST_MSG", __FILE__, __LINE__);
      list ($num_topics, $min_message) = mysql_fetch_row($request);
      mysql_free_result($request);

      // Make sure the starting place makes sense and construct the page index.
      $context['page_index'] = constructPageIndex($scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . $context['querystring_board_limits'] . $context['querystring_sort_limits'], $_REQUEST['start'], $num_topics, $modSettings['defaultMaxTopics'], true);
      $context['current_page'] = (int) $_REQUEST['start'] / $modSettings['defaultMaxTopics'];

      $context['links'] = array(
         'first' => $_REQUEST['start'] >= $modSettings['defaultMaxTopics'] ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits'] : '',
         'prev' => $_REQUEST['start'] >= $modSettings['defaultMaxTopics'] ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], $_REQUEST['start'] - $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'next' => $_REQUEST['start'] + $modSettings['defaultMaxTopics'] < $num_topics ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], $_REQUEST['start'] + $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'last' => $_REQUEST['start'] + $modSettings['defaultMaxTopics'] < $num_topics ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], floor(($num_topics - 1) / $modSettings['defaultMaxTopics']) * $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'up' => $scripturl,
      );
      $context['page_info'] = array(
         'current_page' => $_REQUEST['start'] / $modSettings['defaultMaxTopics'] + 1,
         'num_pages' => floor(($num_topics - 1) / $modSettings['defaultMaxTopics']) + 1
      );

      if ($num_topics == 0)
      {
         $context['topics'] = array();
         if ($context['querystring_board_limits'] == ';start=%d')
            $context['querystring_board_limits'] = '';
         else
            $context['querystring_board_limits'] = sprintf($context['querystring_board_limits'], $_REQUEST['start']);
         return;
      }
      else
         $min_message = (int) $min_message;

      $request = db_query("
         SELECT $select_clause
         FROM ({$db_prefix}messages AS ms, {$db_prefix}messages AS ml, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
            LEFT JOIN {$db_prefix}members AS mems ON (mems.ID_MEMBER = ms.ID_MEMBER)
            LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
            LEFT JOIN {$db_prefix}log_topics_unread AS lt ON (lt.ID_TOPIC = t.ID_TOPIC)
            LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
         WHERE t.ID_TOPIC = ms.ID_TOPIC
            AND b.ID_BOARD = t.ID_BOARD
            AND t.$query_this_board
            AND ms.ID_MSG = t.ID_FIRST_MSG
            AND ml.ID_MSG = t.ID_LAST_MSG
            AND t.ID_LAST_MSG >= $min_message
            AND IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) < t.ID_LAST_MSG
         ORDER BY " . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . "
         LIMIT $_REQUEST[start], $modSettings[defaultMaxTopics]", __FILE__, __LINE__);
   }
   elseif ($is_topics)
   {
      $request = db_query("
         SELECT COUNT(*), MIN(t.ID_LAST_MSG)
         FROM {$db_prefix}topics AS t" . ($have_temp_table ? "
            LEFT JOIN {$db_prefix}log_topics_unread AS lt ON (lt.ID_TOPIC = t.ID_TOPIC)" : "
            LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)") . "
            LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
         WHERE t.$query_this_board" . ($context['showing_all_topics'] && !empty($earliest_msg) ? "
            AND t.ID_LAST_MSG > $earliest_msg" : "
            AND t.ID_LAST_MSG > $_SESSION[ID_MSG_LAST_VISIT]") . "
            AND IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) < t.ID_LAST_MSG", __FILE__, __LINE__);
      list ($num_topics, $min_message) = mysql_fetch_row($request);
      mysql_free_result($request);

      // Make sure the starting place makes sense and construct the page index.
      $context['page_index'] = constructPageIndex($scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . $context['querystring_board_limits'] . $context['querystring_sort_limits'], $_REQUEST['start'], $num_topics, $modSettings['defaultMaxTopics'], true);
      $context['current_page'] = (int) $_REQUEST['start'] / $modSettings['defaultMaxTopics'];

      $context['links'] = array(
         'first' => $_REQUEST['start'] >= $modSettings['defaultMaxTopics'] ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits'] : '',
         'prev' => $_REQUEST['start'] >= $modSettings['defaultMaxTopics'] ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], $_REQUEST['start'] - $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'next' => $_REQUEST['start'] + $modSettings['defaultMaxTopics'] < $num_topics ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], $_REQUEST['start'] + $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'last' => $_REQUEST['start'] + $modSettings['defaultMaxTopics'] < $num_topics ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], floor(($num_topics - 1) / $modSettings['defaultMaxTopics']) * $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'up' => $scripturl,
      );
      $context['page_info'] = array(
         'current_page' => $_REQUEST['start'] / $modSettings['defaultMaxTopics'] + 1,
         'num_pages' => floor(($num_topics - 1) / $modSettings['defaultMaxTopics']) + 1
      );

      if ($num_topics == 0)
      {
         $context['topics'] = array();
         if ($context['querystring_board_limits'] == ';start=%d')
            $context['querystring_board_limits'] = '';
         else
            $context['querystring_board_limits'] = sprintf($context['querystring_board_limits'], $_REQUEST['start']);
         return;
      }
      else
         $min_message = (int) $min_message;

      $request = db_query("
         SELECT $select_clause
         FROM ({$db_prefix}messages AS ms, {$db_prefix}messages AS ml, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
            LEFT JOIN {$db_prefix}members AS mems ON (mems.ID_MEMBER = ms.ID_MEMBER)
            LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)" . ($have_temp_table ? "
            LEFT JOIN {$db_prefix}log_topics_unread AS lt ON (lt.ID_TOPIC = t.ID_TOPIC)" : "
            LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)") . "
            LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
         WHERE t.ID_TOPIC = ms.ID_TOPIC
            AND b.ID_BOARD = t.ID_BOARD
            AND t.$query_this_board
            AND ms.ID_MSG = t.ID_FIRST_MSG
            AND ml.ID_MSG = t.ID_LAST_MSG
            AND t.ID_LAST_MSG >= $min_message
            AND IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) < ml.ID_MSG
         ORDER BY " . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . "
         LIMIT $_REQUEST[start], $modSettings[defaultMaxTopics]", __FILE__, __LINE__);
   }
   else
   {
      if ($modSettings['totalMessages'] > 100000)
      {
         db_query("
            DROP TABLE IF EXISTS {$db_prefix}topics_posted_in", false, false);

         db_query("
            DROP TABLE IF EXISTS {$db_prefix}log_topics_posted_in", false, false);

         $sortKey_joins = array(
            'ms.subject' => "
               INNER JOIN {$db_prefix}messages AS ms ON (ms.ID_MSG = t.ID_FIRST_MSG)",
            'IFNULL(mems.realName, ms.posterName)' => "
               INNER JOIN {$db_prefix}messages AS ms ON (ms.ID_MSG = t.ID_FIRST_MSG)
               LEFT JOIN {$db_prefix}members AS mems ON (mems.ID_MEMBER = ms.ID_MEMBER)",
         );

         // The main benefit of this temporary table is not that it's faster; it's that it avoids locks later.
         $have_temp_table = db_query("
            CREATE TEMPORARY TABLE {$db_prefix}topics_posted_in (
               ID_TOPIC mediumint(8) unsigned NOT NULL default '0',
               ID_BOARD smallint(5) unsigned NOT NULL default '0',
               ID_LAST_MSG int(10) unsigned NOT NULL default '0',
               ID_MSG int(10) unsigned NOT NULL default '0',
               PRIMARY KEY (ID_TOPIC)
            )
            SELECT t.ID_TOPIC, t.ID_BOARD, t.ID_LAST_MSG, IFNULL(lmr.ID_MSG, 0) AS ID_MSG" . (!in_array($_REQUEST['sort'], array('t.ID_LAST_MSG', 't.ID_TOPIC')) ? ", $_REQUEST[sort] AS sortKey" : '') . "
            FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
               LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" . (isset($sortKey_joins[$_REQUEST['sort']]) ? $sortKey_joins[$_REQUEST['sort']] : '') . "
            WHERE m.ID_MEMBER = $ID_MEMBER
               AND t.ID_TOPIC = m.ID_TOPIC" . (!empty($board) ? "
               AND t.ID_BOARD = $board" : '') . "
            GROUP BY m.ID_TOPIC", false, false) !== false;

         // If that worked, create a sample of the log_topics table too.
         if ($have_temp_table)
            $have_temp_table = db_query("
               CREATE TEMPORARY TABLE {$db_prefix}log_topics_posted_in (
                  PRIMARY KEY (ID_TOPIC)
               )
               SELECT lt.ID_TOPIC, lt.ID_MSG
               FROM ({$db_prefix}log_topics AS lt, {$db_prefix}topics_posted_in AS pi)
               WHERE lt.ID_MEMBER = $ID_MEMBER
                  AND lt.ID_TOPIC = pi.ID_TOPIC", false, false) !== false;
      }

      if ($have_temp_table)
      {
         $request = db_query("
            SELECT COUNT(*)
            FROM ({$db_prefix}topics_posted_in AS pi)
               LEFT JOIN {$db_prefix}log_topics_posted_in AS lt ON (lt.ID_TOPIC = pi.ID_TOPIC)
            WHERE pi.$query_this_board
               AND IFNULL(lt.ID_MSG, pi.ID_MSG) < pi.ID_LAST_MSG", __FILE__, __LINE__);
         list ($num_topics) = mysql_fetch_row($request);
         mysql_free_result($request);
      }
      else
      {
         $request = db_query("
            SELECT COUNT(DISTINCT t.ID_TOPIC), MIN(t.ID_LAST_MSG)
            FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
               LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
               LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
            WHERE t.$query_this_board
               AND m.ID_TOPIC = t.ID_TOPIC
               AND m.ID_MEMBER = $ID_MEMBER
               AND IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) < t.ID_LAST_MSG", __FILE__, __LINE__);
         list ($num_topics, $min_message) = mysql_fetch_row($request);
         mysql_free_result($request);
      }

      // Make sure the starting place makes sense and construct the page index.
      $context['page_index'] = constructPageIndex($scripturl . '?action=' . $_REQUEST['action'] . $context['querystring_board_limits'] . $context['querystring_sort_limits'], $_REQUEST['start'], $num_topics, $modSettings['defaultMaxTopics'], true);
      $context['current_page'] = (int) $_REQUEST['start'] / $modSettings['defaultMaxTopics'];

      $context['links'] = array(
         'first' => $_REQUEST['start'] >= $modSettings['defaultMaxTopics'] ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], 0) . $context['querystring_sort_limits'] : '',
         'prev' => $_REQUEST['start'] >= $modSettings['defaultMaxTopics'] ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], $_REQUEST['start'] - $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'next' => $_REQUEST['start'] + $modSettings['defaultMaxTopics'] < $num_topics ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], $_REQUEST['start'] + $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'last' => $_REQUEST['start'] + $modSettings['defaultMaxTopics'] < $num_topics ? $scripturl . '?action=' . $_REQUEST['action'] . ($context['showing_all_topics'] ? ';all' : '') . sprintf($context['querystring_board_limits'], floor(($num_topics - 1) / $modSettings['defaultMaxTopics']) * $modSettings['defaultMaxTopics']) . $context['querystring_sort_limits'] : '',
         'up' => $scripturl,
      );
      $context['page_info'] = array(
         'current_page' => $_REQUEST['start'] / $modSettings['defaultMaxTopics'] + 1,
         'num_pages' => floor(($num_topics - 1) / $modSettings['defaultMaxTopics']) + 1
      );

      if ($num_topics == 0)
      {
         $context['topics'] = array();
         if ($context['querystring_board_limits'] == ';start=%d')
            $context['querystring_board_limits'] = '';
         else
            $context['querystring_board_limits'] = sprintf($context['querystring_board_limits'], $_REQUEST['start']);
         return;
      }

      if ($have_temp_table)
         $request = db_query("
            SELECT t.ID_TOPIC
            FROM {$db_prefix}topics_posted_in AS t
               LEFT JOIN {$db_prefix}log_topics_posted_in AS lt ON (lt.ID_TOPIC = t.ID_TOPIC)
            WHERE t.$query_this_board
               AND IFNULL(lt.ID_MSG, t.ID_MSG) < t.ID_LAST_MSG
            ORDER BY " . (in_array($_REQUEST['sort'], array('t.ID_LAST_MSG', 't.ID_TOPIC')) ? $_REQUEST['sort'] : 't.sortKey') . ($ascending ? '' : ' DESC') . "
            LIMIT $_REQUEST[start], $modSettings[defaultMaxTopics]", __FILE__, __LINE__);
      else
         $request = db_query("
            SELECT DISTINCT t.ID_TOPIC
            FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m" . (strpos($_REQUEST['sort'], 'ms.') === false ? '' : ", {$db_prefix}messages AS ms") . ')' . (strpos($_REQUEST['sort'], 'mems.') === false ? '' : "
               LEFT JOIN {$db_prefix}members AS mems ON (mems.ID_MEMBER = ms.ID_MEMBER)") ."
               LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
               LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
            WHERE m.ID_TOPIC = t.ID_TOPIC
               AND m.ID_MEMBER = $ID_MEMBER
               AND t.$query_this_board
               AND t.ID_LAST_MSG >= " . (int) $min_message . "
               AND IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) < t.ID_LAST_MSG" . (strpos($_REQUEST['sort'], 'ms.') !== false ? "
               AND ms.ID_MSG = t.ID_FIRST_MSG" : '') . "
            ORDER BY " . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . "
            LIMIT $_REQUEST[start], $modSettings[defaultMaxTopics]", __FILE__, __LINE__);

      $topics = array();
      while ($row = mysql_fetch_assoc($request))
         $topics[] = $row['ID_TOPIC'];
      mysql_free_result($request);

      // Sanity... where have you gone?
      if (empty($topics))
      {
         $context['topics'] = array();
         if ($context['querystring_board_limits'] == ';start=%d')
            $context['querystring_board_limits'] = '';
         else
            $context['querystring_board_limits'] = sprintf($context['querystring_board_limits'], $_REQUEST['start']);
         return;
      }

      $request = db_query("
         SELECT $select_clause
         FROM ({$db_prefix}messages AS ms, {$db_prefix}messages AS ml, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
            LEFT JOIN {$db_prefix}members AS mems ON (mems.ID_MEMBER = ms.ID_MEMBER)
            LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
            LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
            LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = t.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)
         WHERE t.ID_TOPIC IN (" . implode(', ', $topics) . ")
            AND t.ID_TOPIC = ms.ID_TOPIC
            AND b.ID_BOARD = t.ID_BOARD
            AND ms.ID_MSG = t.ID_FIRST_MSG
            AND ml.ID_MSG = t.ID_LAST_MSG
         ORDER BY " . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . "
         LIMIT " . count($topics), __FILE__, __LINE__);
   }

   $context['topics'] = array();
   $topic_ids = array();
   while ($row = mysql_fetch_assoc($request))
   {
      if ($row['ID_POLL'] > 0 && $modSettings['pollMode'] == '0')
         continue;

      $topic_ids[] = $row['ID_TOPIC'];

      // Clip the strings first because censoring is slow :/. (for some reason?)
      $row['firstBody'] = strip_tags(strtr(parse_bbc($row['firstBody'], $row['firstSmileys'], $row['ID_FIRST_MSG']), array('<br />' => '&#10;')));
      if ($func['strlen']($row['firstBody']) > 128)
         $row[
Title: Re: Advanced Recent Posts / Topics
Post by: Trinny on February 29, 2008, 05:53:44 AM
Mods looks great on firefox, opera, netscape.. but not on IE. It's calling a path for an image as : myforum/post/.gif  but there is no such path in my directory and creating one doesn't solve the issue. This results in red X's when viewing the recent post section in internet explorer. This image is supposed to be the message icon but it isn't functioning properly. Now the actual message icon on the indexes shows fine, just not on the advanced recent posts block. I can't seem to track this critter down, even using firebug. Any ideas?
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on February 29, 2008, 08:56:05 AM
Please attach your recent.php
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on March 07, 2008, 11:07:19 AM
im getting errors when trying to install on 1.1.4 with a modified theme and a couple other mods implemented.

Quote!!Error in Package Installation

At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.
Install Actions
Installations actions for "Advanced Recent-Posts":
Installing this package will perform the following actions:  Type Action Description
1. Execute Modification ./Sources/Recent.php Test failed
2. Execute Modification ./Themes/default/BoardIndex.template.php Test successful
3. Execute Modification ./Sources/ModSettings.php Test successful
4. Execute Modification ./Themes/default/languages/ModSettings.english.php Test successful
5. Execute Code add_settings.php

Title: Re: Advanced Recent Posts / Topics
Post by: Marook on March 07, 2008, 11:27:49 AM
sure, what did you expect ? ;)
Uninstall the other mods and try again...
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on March 08, 2008, 07:07:56 PM
I just realized you made the mod... you cant explain how to manually install the mod??
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on March 08, 2008, 09:48:39 PM
ok I have it installed... but I cant figure how to administrate it or change the settings. :(
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on March 08, 2008, 11:07:09 PM
oh I found it... a single check box that has no label :(
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on March 09, 2008, 07:48:18 AM
You should also have minimum one error in you logfile if the label hasn't a label ;)
Open /Themes/default/languages/ModSettings.{yourlanguage}.php and add this somewhere
between the php tags (<?php & ?>)


$txt['recent_topics'] = 'Show recent topics instead of recent posts';
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on March 09, 2008, 08:55:05 AM
yes I did see that error

how come my recent list doesnt hve the stats (number of replies) like it should. It also doesnt have board name like your sample image does (is that just a difference of Themes?)
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on March 09, 2008, 01:00:24 PM
make sure the mod was installed properly. Check your index.template.php file and the sourcedir/recent.php.. both file needs to be modified by the mod...
Title: Re: Advanced Recent Posts / Topics
Post by: pacc on March 18, 2008, 08:07:46 PM
Help installation

I error

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg297.imageshack.us%2Fimg297%2F3712%2Fadvhr4.th.jpg&hash=1e414bafeafdd6f0ff50d33b98fd48f43525c47e)
Title: Re: Advanced Recent Posts / Topics
Post by: roadrunner33 on March 28, 2008, 04:46:09 AM
Your mod is great.  I like the Topics showing much better than the latest Posts, since we have so many each day.  Thank you!

However, I would like to make one minor change to the mod.  Because some of my Message Icons are animated gifs, having all that 'visual noise' on the front page of the forum is a bit disconcerting.  I would like to nix showing the individual message icons altogether.

I easily see the code $row['smileysEnabled']
in several places, and I assume that all I would need to do is delete those to get rid of their 'row'?

However, what or where is the block of code that I would delete to entirely eliminate the message smileys from showing?  I perused the code inserted above, and apparently missed it.

Thank you, in advance, for your time and effort.
Title: Re: Advanced Recent Posts / Topics
Post by: ASF on March 28, 2008, 11:33:00 PM
Is it possible to have this at the top of the forum index? rather than right at the bottom, im using a custom made theme.

Title: Re: Advanced Recent Posts / Topics
Post by: Marook on March 29, 2008, 11:44:17 AM
@roadrunner : open your boardindex.template.php and somewhere around line 279 you will find this :

                <td class="', $class, '"><img src="', $post['icon'] , '" alt="" /></td>

If you want to show the same icon for every message, change the code above and link to your icon. If you dont want to show any icons just delete this table column.

@ ASF : Sure, just edit your theme...
Title: Re: Advanced Recent Posts / Topics
Post by: ASF on March 29, 2008, 04:47:37 PM
marook

thanks, but i don't know which part to edit?
Title: Re: Advanced Recent Posts / Topics
Post by: roadrunner33 on March 29, 2008, 10:29:00 PM
Thank you, Marook!  I will edit this evening.  Kudos!
Title: Re: Advanced Recent Posts / Topics
Post by: roadrunner33 on March 30, 2008, 04:58:11 AM
Hello again.

I deleted the code snippet above, as you advised, and the message icons did disappear.  However, all the info in the table columns got moved one column to the left, (former icon space shows the subject, Subject shows the views, Board Name shows the author, Author shows the date, etc.), leaving the Date column empty.   ::)

We can do one of two things, I assume.  1) Eliminate the table space, or 2) designate a width of the first table and leave it empty.

It would be fine with me if the message icon table were actually an empty space about 1/4" in width if that would be easier to do than eliminating the column/table entirely.  It would look nice, too, and give some visual white space relief.

Again, thank you for your time.   :)
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on March 30, 2008, 10:54:07 AM
Ok that could be... we have to alter another piece of code....

find (around line 260):


<td class="catbg2" style="text-align:left;" colspan="2">', $txt[70] ,'</td>


and remove the colspan="2"
Title: Re: Advanced Recent Posts / Topics
Post by: roadrunner33 on March 30, 2008, 02:17:24 PM
Thanks for the quick reply.  I'll see to it this evening! 
Title: Re: Advanced Recent Posts / Topics
Post by: roadrunner33 on March 30, 2008, 08:12:47 PM
Okay, done!  Thank you!
Title: Re: Advanced Recent Posts / Topics
Post by: madman71 on March 31, 2008, 04:06:00 PM
Hi!

Will this mod cause excessive CPU usage?

Im trying to pin point which mod is causing my problems.

thanks
Title: Re: Advanced Recent Posts / Topics
Post by: allumius on April 08, 2008, 07:15:42 AM
Please you can help me?

I have de screibbles2 theme
I have installed the mod manually because in automatic it gives a error in Recent.php and BoardIndex.template.php

look the attach please
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on April 08, 2008, 11:46:40 AM
The screenshot shows a TinyPortal Block(!) The mod is used to alter the recent posts of the forum and display it inside the forum....
Title: Re: Advanced Recent Posts / Topics
Post by: allumius on April 08, 2008, 12:05:25 PM
In the forum it happens equally, look

http://www.losamigotes.com/forum/index.php?action=forum
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on April 08, 2008, 12:09:53 PM
No this is not from the forum, this is from tinyportal! My mod doesnt support a tinyportal block! Activate the recent posts feature in admin panel and if the mod was installed successfully you will see the recent topics in the status bar...
Title: Re: Advanced Recent Posts / Topics
Post by: allumius on April 08, 2008, 12:34:58 PM
Please can you modifi my recent.php and boardindextemplate.php??
Title: Re: Advanced Recent Posts / Topics
Post by: ragrob on April 18, 2008, 03:12:28 AM
nice mod thanks!
Title: Re: Advanced Recent Posts / Topics
Post by: Chopper on April 24, 2008, 09:39:30 AM
Is there a way to make this appear at the top of the page rather than at the bottom?
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on April 24, 2008, 11:13:53 AM
you need to alter the boardindex.template.php and copy&paste the whole block to another position you like...
Title: Re: Advanced Recent Posts / Topics
Post by: Kimmie on April 27, 2008, 04:51:46 AM
The mod seemed to install fine (no test failed's), however I have 3 issues..

This error in my error log:

Quote2: Missing argument 3 for db_query(), called in /home/patriotg/public_html/Packages/temp/add_settings.php on line 45 and defined
File: /home/patriotg/public_html/Sources/Subs.php
Line: 238



The collapse icon it added on the right hand side (I am assuming its supposed to be a collapse icon) - when you click the collapse icon it doesnt collapse the area, it merely shoots you back up to the top of the forum (screenshot of this attached). Is that what that icon is supposed to do rather than be a collapse icon?


The setting "Show recent topics instead of recent posts" doesnt work on mine. Mine shows just the recent posts with this option checked.

Any ideas?
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on April 27, 2008, 06:52:20 AM
on which version did you install this mod ?
Title: Re: Advanced Recent Posts / Topics
Post by: Kimmie on April 28, 2008, 07:12:02 AM
Quote from: Marook on April 27, 2008, 06:52:20 AM
on which version did you install this mod ?

1.1.4

update on the "Show Recent Topics Instead Of Recent Posts" - its ok. That setting needs to actually say "Show Recent Topics AND Recent Posts". With that setting checked, it shows both.  ;)

On the errors in my log, this is at the top (if it will help):

http://mysiteurl?action=packages;sa=install2;package=adv-recent-posts11.zip

I received the error twice when the mod was first installed (even though it gave no "test failed" errors while applying it). I have not received the error since - however its an error just the same.
Title: Re: Advanced Recent Posts / Topics
Post by: holly.celeb.fan on May 01, 2008, 12:16:34 AM
Nice mod
Title: Re: Advanced Recent Posts / Topics
Post by: Ramanathan on May 01, 2008, 03:41:52 PM
Hi, really nice mod, congrats to the creator =D.

I've got a weird bug:

Only en IE, in some of the threads, there's no link, only plain text. You can see it happening in the image below with the topic "Gajes del oficio" and "Liquid Tension Experiment 1.0".

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg183.imageshack.us%2Fimg183%2F2702%2Fscreen2rf3.th.png&hash=e0cb3f6fa890511d9fd37242b428fa01aca092fe) (http://img183.imageshack.us/my.php?image=screen2rf3.png)

This happens in default theme and in the other ones I've got installed. I've only centered the text, the rest is unmodified.

SMF Version: 1.1.4 (as today, 1.1.5 and error keeps happening).
Themes: Default, Mystic Jade, Dirge, The Four Colors
URL: www.dilberium.net/forum
User/pass: Testuser / test1234

Code (Default/Boardindex.template.php) Select
// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<b><a href="', $scripturl, '?action=recent">', $txt[214], '</a></b>
<div class="smalltext">
', $txt[234], ' &quot;', $context['latest_post']['link'], '&quot; ', $txt[235], ' (', $context['latest_post']['time'], ')<br />
</div>';
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="0" cellspacing="1" width="100%" border="0">
<tr>
<td class="catbg2" style="text-align:center;"></td>
<td class="catbg2" style="text-align:center;">', $txt[70] ,'</td>
<td class="catbg2" style="text-align:center;">', $txt[110] ,'</td>
<td class="catbg2" style="text-align:center;">', $txt[301] ,'</td>
<td class="catbg2" style="text-align:center;">', $txt[20] ,'</td>
<td class="catbg2" style="text-align:center;">', $txt[29] ,'</td>
<td class="catbg2" style="text-align:center;">', $txt[317] ,'</td>
</tr>';


/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
$cnt = 0;
foreach ($context['latest_posts'] as $post){
$cnt++;
$class = ($cnt % 2) ? 'windowbg' : 'windowbg2';

echo '
<tr>
<td class="', $class, '"" style="text-align:center;"><img src="', $post['icon'] , '" alt="" /></td>
<td class="', $class, '"" style="text-align:center; title="', $post['preview'] ,'">', $post['link'], '</td>
<td class="', $class, '"" style="text-align:center;">', $post['replies'], '</td>
<td class="', $class, '"" style="text-align:center;">', $post['views'], '</td>
<td class="', $class, '"" style="text-align:center;">',$post['board']['link'], '</td>
<td class="', $class, '"" style="text-align:center;">',$post['poster']['link'], '</td>
<td class="', $class, '"" style="text-align:center;" nowrap="nowrap">', $post['time'], '</td>
</tr>';
}

echo '
</table>';
}
echo '
</td>
</tr>';
}


Please, help?

Thanks in advance!

Title: Re: Advanced Recent Posts / Topics
Post by: Marook on May 01, 2008, 10:35:53 PM
Got it ;)
You did a very tiny mistake trying to center the text ;) I just had a look through your source code and found this line :


<td class="windowbg"[color=red]"[/color] style="text-align:center;[color=red]"[/color] title="ese pibe claudio me cae bien "><a href="http://www.dilberium.net/forum/index.php?PHPSESSID=b8e810ac9733a3177b9b5477c11f5c37&amp;topic=493.msg13659;topicseen#msg13659">Gajes del oficio</a></td>
[b]why is tihs piece of code unreadable ???[/b]


The first red colored qoutes needs to be removed...
The seconde red colored qoutes are missing ;)

PS: Sorry but this piece of code can't be displayed properly...dont know why ;(

PPS: Change the following line :

<td class="', $class, '"" style="text-align:center; title="', $post['preview'] ,'">', $post['link'], '</td>


To this line...


<td class="', $class, '" style="text-align:center;" title="', $post['preview'] ,'">', $post['link'], '</td>


and you're done ;)
Greetz Marook
Title: Re: Advanced Recent Posts / Topics
Post by: Ramanathan on May 04, 2008, 03:27:51 PM
Oooooh, you're sooo right, I totally missed the closing " ! As you can see, I'm fairly new at this =P.

I've never noticed that line of code, I will try and fix it...

Thanks so much for both your help and your quick response =).

Once more: Nice mod, Marook.

Saludos,

Laura.



Title: Re: Advanced Recent Posts / Topics
Post by: DareDevil1990 on May 13, 2008, 06:42:04 AM
can u tell me how to install this mod in smf 1.1.5 pleaseeeee
Title: Re: Advanced Recent Posts / Topics
Post by: DareDevil1990 on May 15, 2008, 12:34:01 AM
Quote from: keshav on May 13, 2008, 06:42:04 AM
can u tell me how to install this mod in smf 1.1.5 pleaseeeee

i treid installing the mod manually edtited every thing the post said  laos add_settings.php
but the still its not workig pleasseeee help me people
Title: Re: Advanced Recent Posts / Topics
Post by: ekfaysal on May 21, 2008, 01:17:56 AM
Hi
any chance to update it for smf 2 beta 3 please
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on May 21, 2008, 03:11:03 AM
i will update this mod for 2.0 final only... you have to wait a bit ;)
Title: Re: Advanced Recent Posts / Topics
Post by: InternetMafia on June 08, 2008, 09:55:21 AM
I am using SMF 1.1.4.  Theme works great when I am using the default theme.

However using the avci theme, I have modified the file using the package parser and get a template parse error on line 590.  That is the very last line in the file.

Any ideas?
Title: Re: Advanced Recent Posts / Topics
Post by: ASF on June 18, 2008, 01:08:27 AM
Hi, marook

thanks for the good mod bro, i just want to know, how can i show this at the TOP of the forum instead at the bottom of the forum?

Title: Re: Advanced Recent Posts / Topics
Post by: Marook on June 24, 2008, 06:50:47 AM
It seems the installation of my mod has damaged your Recent.php, pls attach it here or use my NoPaste and just post the link...I'll fix it today evening (GMT+2)
Title: Re: Advanced Recent Posts / Topics
Post by: Achilles991 on July 17, 2008, 08:52:04 AM
How can i set recent posts to show only from one forum? For example only from forum named News...
Title: Re: Advanced Recent Posts / Topics
Post by: Marook on July 17, 2008, 02:25:16 PM
Thats a bit difficult, it needs a custom modification of RecentPosts.php... im busy at the moment to do it... maybe in a few weeks....
Title: Re: Advanced Recent Posts / Topics
Post by: Achilles991 on July 17, 2008, 02:30:19 PM
Ok, i'll be subscribed for this post...
Title: Re: Advanced Recent Posts / Topics
Post by: jordanid on July 21, 2008, 08:44:07 PM
hey marook
thanks for the great mod .. its really awsome
tho , if one of the smf coder make something similiar to top 5 stats like the one on VB would be very great ..

i installed the mod , and works 100%
no Errors
running on the core default theme
but when works on my custom theme

it looks weird
have a look on it
www.jordan-id.com

thanks in advance .
Title: Re: Advanced Recent Posts / Topics
Post by: Kimmie on July 26, 2008, 01:19:59 AM
Hi marook, I am having a bit of trouble getting this installed onto my custom theme. The theme uses its own BoardIndex.Template file. The code that the parser says to find and the actual code in that themes file are different and I was wondering if you could help me :)

I have attached the boardindex file

Thank you in advance :)


nevermind I fixed it on my own
Title: Re: Advanced Recent Posts / Topics
Post by: computerworks on August 19, 2008, 07:11:23 PM
Just upgraded to 1.1.5.

Tried to re-apply the Mod and get failures on the first two tests...

Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    ./Sources/Recent.php    Test failed
2.    Execute Modification    ./Themes/default/BoardIndex.template.php    Test failed
3.    Execute Modification    ./Sources/ModSettings.php    Test successful
4.    Execute Modification    ./Themes/default/languages/ModSettings.english.php    Test successful
5.    Execute Code    add_settings.php    

Can you help us resolve this?

Thanks
Title: Re: Advanced Recent Posts / Topics
Post by: gigz09 on September 12, 2008, 07:40:05 PM
i successfully installed version 1.1 first in 1.1.5 SMF Version, it has no effect, the Recent post doesnt appear in my forum.. likewise when i upgrade it into 1.1.6 SMF Version, even i check its settings it Layout and Options... please help me... thanks
Title: Re: Advanced Recent Posts / Topics
Post by: italo_anonimo on October 07, 2008, 08:41:21 AM
thanks for mod,

if posible exluding some boards from recents? for example: add one setting near your mod switch "Excluding Boards ID list by comma: " or may be you know where may input exclude boards?

thanks
Title: Re: Advanced Recent Posts / Topics
Post by: InternetMafia on October 09, 2008, 06:49:42 AM
Any chance of getting this working on 1.1.6?
Title: Re: Advanced Recent Posts / Topics
Post by: gigz09 on October 13, 2008, 05:06:52 PM
Quote from: InternetMafia on October 09, 2008, 06:49:42 AM
Any chance of getting this working on 1.1.6?

i also want to do this but it doesnt appear in my forum even i activated it.. i really really want this mod.. hope that anyone could help me most especially the author

this is my forum

Electronics TUP (http://electronicstup.gzxlab.com)

test account is
user: test
pass: 369369

thank you..
Title: Re: Advanced Recent Posts / Topics
Post by: mickeyb107 on December 12, 2008, 01:40:48 PM
this mod is excellent makes my boards look so much cleaner... i modified this and works for my

enterprise
andro blue
andro 105 green
helios final tp

i still have to do a few more lol

gigz if you installed correctly make sure you click on theme and where it says:
Number of recent posts to display on board index you change to what you want... i have mine set at 10... not sure if that is your problem but mine was set at 1 so i didnt see any change
Title: Re: Advanced Recent Posts / Topics
Post by: InternetMafia on December 12, 2008, 01:58:29 PM
Probably a stupid question, but does the package parser on the link page allow you to use this with SMF 2.0 Beta 4?
Title: Re: Advanced Recent Posts / Topics
Post by: deathsia on December 12, 2008, 02:12:54 PM
ok since i couldn't find a topic for it i'll post here..the mod "MSN in SMF" keeps giving me this error:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 4 in the jsp file: /v6246/start.jsp
WebUtils cannot be resolved
1: <%@page import="com.emessenger.utils.*"%>
2: <%
3:    String passport = "@hotmail.com";
4:    Cookie c = WebUtils.getCookie(request, "passport");
5:    if (c != null) passport = c.getValue();
6: %>
7: <html>


An error occurred at line: 71 in the jsp file: /v6246/start.jsp
WebUtils cannot be resolved
68: <br /><br />
69: <br>
70: <center>
71: <form method="post" id="login" action="<%=WebUtils.getLoginAction(request.getRemoteAddr(), "/vm070713/login.jsp")%>" onsubmit="setcookies(this)">
72: <table>
73: <tr><td>Passport:</td><td><input type="text" name="passport" id="passport" value="<%=passport%>"/></td></tr>
74: <tr><td>Password:</td><td><input type="password" name="password" id="password" value=""/></td></tr>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.



here's the orginal file: http://www.smfhacks.com/downloads/44msn_en.zip
i don't know what i am doing wrong here...but alittle help would be apreated!
Title: Re: Advanced Recent Posts / Topics
Post by: Burke ♞ Knight on December 12, 2008, 02:15:43 PM
Excuse me, but what does that have to do with this mod?

If there is no thread for a mod here, do not post support issues for it in the thread for another mod. That is just rude.

Post a new thread in support for it.
Or go look for the support thread for it at http://www.smfhacks.com
Title: Re: Advanced Recent Posts / Topics
Post by: im1 on December 16, 2008, 05:27:36 PM
Hey Marook

Im having trouble with your plugin, I installed it succesfully but instead of showind the recent topics/posts now it doesnt show anything at all now.

Can you tell me what the problem is? I though I could uninstall it and then reinstall it hoping it would fix itself but when I uninstall it gives me a FAILED error on the file..
    ./Sources/ModSettings.php

So I dont know what to do now =S
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on January 22, 2009, 06:43:27 PM
I have installed this mod and it works great

however, I would like to know how to do one thing...

when it shows the message icon on the left side of the recent topic list, I would like for it to show the message icon  that was used on the post that started the thread.  As it is now, it will show the message icon that was used with the last post in the thread, which more often than not is the default message icon "standard"   I see that if I look at a board and see teh lists of thread in that board that it will show the message icon that was used to start the thread, so I am hoping that this means that it can be done for the recent topic list also. *crossing fingers*

can someone please help me accomplish this?

Thank you, Harv
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on January 29, 2009, 09:35:51 AM
no one? anyone?
Please?
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on January 30, 2009, 12:06:56 PM
ok I updated this mod to the latest version and I had certain boards blocked so they didnt show in the recent list... here is the code I was using for that:

AND t.ID_TOPIC = m.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
AND $user_info[query_see_board]
AND b.ID_BOARD != 176
AND b.ID_BOARD != 182
AND b.ID_BOARD != 177
AND b.ID_BOARD != 146
AND b.ID_BOARD != 148
AND b.ID_BOARD != 113
AND b.ID_BOARD != 174


BUT... those boards now show in the recent topic list even though the code to block is there. Please help?
Title: Re: Advanced Recent Posts / Topics
Post by: davebonner on February 03, 2009, 08:57:43 AM
really good mod   , but is there a way to show member colors on it tnanks
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on March 01, 2009, 05:29:12 PM
Quote from: Harvester on January 30, 2009, 12:06:56 PM
ok I updated this mod to the latest version and I had certain boards blocked so they didnt show in the recent list... here is the code I was using for that:

AND t.ID_TOPIC = m.ID_TOPIC
AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
AND $user_info[query_see_board]
AND b.ID_BOARD != 176
AND b.ID_BOARD != 182
AND b.ID_BOARD != 177
AND b.ID_BOARD != 146
AND b.ID_BOARD != 148
AND b.ID_BOARD != 113
AND b.ID_BOARD != 174


BUT... those boards now show in the recent topic list even though the code to block is there. Please help?

Posted this question a month ago.

Really would like some help with this please
Title: Re: Advanced Recent Posts / Topics
Post by: Harvester on March 04, 2009, 08:03:54 PM
Is this mod no longer getting supported by the creator? Ive been waiting a month to an answer as to why after I installed this mod i can no longer keep certain boards from displaying in the recent topic/post list. I really need to be able to accomplish thisl. I have several boards that I do not want to show up in the recent topic/post list.

Please help??
Title: Trouble with Adv Rec Posts :s
Post by: trashgeek on May 11, 2009, 02:57:41 PM
I try to install but after i upload the mod and put my server info to set chmod 777 for the specified files gives me this message

Fatal error: require() [function.require]: Failed opening required '/home/a4772786/public_html/Packages/temp/./add_settings.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a4772786/public_html/Sources/Packages.php on line 556

before this i see this screen:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg512.imageshack.us%2Fimg512%2F5425%2Fsdsda.jpg&hash=ea4243963925d9784564e00338860e3ebe6beaa3)
Title: Re: Advanced Recent Posts / Topics
Post by: Neverhurry on May 21, 2009, 11:07:01 AM
Hello,

i have installed the mod, and love it, but how can i put the Advanced Recent Topics to the top of the page? Can anybody help? Thank you!!!

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.cinask.com%2FSmileys%2Fskype%2Fthanks.gif&hash=88edc56ffffe4016f0ed23642e76e188615528dd)
Title: Re: Advanced Recent Posts / Topics
Post by: picos on May 26, 2009, 09:05:41 AM
Has anyone managed to get this working with smf 2.0 rc 11?  The install instruction do not match the default files when you search for the code to replace.
Title: Re: Advanced Recent Posts / Topics
Post by: aw06 on June 18, 2009, 12:55:43 AM
Love this mod... is it possible to eidt the code so that it will display a clickable show new icon beside the post ... (https://www.simplemachines.org/community/Themes/smsite/images/english-utf8/new.gif)
Title: Re: Advanced Recent Posts / Topics
Post by: aw06 on June 18, 2009, 10:52:56 AM
I also notice .. i have to mod set to show recent topics and not recent post .. but whenever somebody makes a reply to a post it picks it up, just that it doesnt add Re:

I also picks up anything that is sent to the recycle bin :-\
Title: Re: Advanced Recent Posts / Topics
Post by: Atoa on June 19, 2009, 10:03:35 AM
There's no verios of this mod for 2.0 rc 1-1?

too bad for me D:
I liked this one
Title: Re: Advanced Recent Posts / Topics
Post by: aw06 on June 19, 2009, 04:25:43 PM
one of the best mods im running 8)
Title: Re: Advanced Recent Posts / Topics
Post by: aw06 on June 20, 2009, 05:44:40 PM
Quote from: aw06 on June 18, 2009, 10:52:56 AM
I also notice .. i have to mod set to show recent topics and not recent post .. but whenever somebody makes a reply to a post it picks it up, just that it doesnt add Re:

It also picks up anything that is sent to the recycle bin :-\

Bump ....

Also check http://www.simplemachines.org/community/index.php?topic=319077.msg2119992#msg2119992
Title: Reducing the "Date" column
Post by: robertoed on July 30, 2009, 03:15:28 PM
Hi!
It seems a great component and I read all this thread but I have a problem, Texas !

My forums are in english ans spanish, therefore large topics and titles...
I read this forums and according to your indications deleted correctly the icons forums to clear space... Now HOW and WHERE can I reduce the "Date" column to show ONLY date without the hour... that's means to reduce theat column to the width of "Yestderday"..

What to do ?

Roberto
http://www.ebaforums.com/

PS: the problem which were here before was solved uploading the source BoardIndex file... also reading this excellent thread... as the component !
Title: Re: Advanced Recent Posts / Topics
Post by: DragonKith on September 25, 2009, 07:47:38 PM
I just recently tried to install the Advanced Recent Posts /Topics Module i followed everything to a T and once i modified all of the files it told me to do and once i did that upload the files back into the correct directories and i install the module and it told me there was two files that failed and i put everything in the way it told me to do.Can someone help me i am so lost could it be the theme i am using by chance ?
Title: Re: Advanced Recent Posts / Topics
Post by: aw06 on September 29, 2009, 02:09:08 AM
If this mod is no longet supported i think it should be closed, the mod creator has not logged in for years now ...

anyway, can sombody figure out how to block messages from the trash bin from showing ...
Title: Re: Advanced Recent Posts
Post by: siegfred on October 07, 2009, 12:11:53 PM
Quote from: Marook on January 21, 2008, 11:15:18 AM
You have to enable the recent post list.. Go to AdminCP -> Current Theme and enter the number of posts to be shown at Number of recent posts to display on board index:

Works beautifully!

Thanks!
Title: Re: Advanced Recent Posts / Topics
Post by: aw06 on October 14, 2009, 02:40:54 PM
Quote from: aw06 on September 29, 2009, 02:09:08 AM
If this mod is no longet supported i think it should be closed, the mod creator has not logged in for years now ...

anyway, can sombody figure out how to block messages from the trash bin from showing ...

BUMP !!!!!!!!!!!!!!!11
Title: Re: Advanced Recent Posts / Topics
Post by: qubbah on October 29, 2009, 05:06:27 AM
how can we change msgicon to be like
Topic you have posted in
Normal Topic
Hot Topic (More than 10 replies)
Very Hot Topic (More than 15 replies)    
Locked Topic
Sticky Topic
Poll
Title: Re: Advanced Recent Posts / Topics
Post by: Kimmen on January 09, 2010, 07:27:01 PM
Can someone update this? i would really like to have it on my site, i use SMF2 RC2.  :)
Title: Re: Advanced Recent Posts / Topics
Post by: ayteck on December 30, 2010, 05:15:01 PM
no support for this mod? i need it for 2.0 RC3 :(
Title: Re: Advanced Recent Posts / Topics
Post by: aw06 on January 14, 2011, 12:28:01 AM
Well i have Advanced Recent Posts / Topics installed .. all it does is remove the Re: when i select show topics and not replies .. but it basically shows all the replies..

Any ideas?
Title: Re: Advanced Recent Posts / Topics
Post by: Arkadaş on January 22, 2011, 02:23:21 AM
Recent Topics in this part of the last issues of Hi friends instead of the number of impressions how can we respond.
The number of responses you're not appearing in the picture I want the number of impressions. Thank you in advance for your help

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg34.imageshack.us%2Fimg34%2F7853%2F22471154.jpg&hash=9541aebd3fdb4e5c495eee9993ab8fb29cc5f8ab)
Title: Re: Advanced Recent Posts / Topics
Post by: pzyhô on May 02, 2011, 02:29:31 PM
Can someone update this for 2.0 rc5 ? :)

with the features "total views + Total posts" of specific Thread

i think im not the only who want this for 2.0
Title: Re: Advanced Recent Posts / Topics
Post by: Kimmen on May 03, 2011, 05:08:06 AM
I tried the parser for RC4 Security patch, and the code in Source/Recent.php is not the same as in the parser, so i do not proceed.
Title: Re: Advanced Recent Posts / Topics
Post by: Angie on Dialysis on May 04, 2011, 11:04:20 PM
Is there any way to have a special modification of this mod (which are are using currently for our 1.1.13 SMF board) so that admins can choose WHICH boards they want to show in the recent post box? I want to be able to have no game threads show on the front (no thread games threads) but just all support and news and medically related boards only showing in recent posts.

Is it possible?
Title: Re: Advanced Recent Posts / Topics
Post by: pzyhô on May 05, 2011, 04:24:24 PM
Quote from: Kimmen on May 03, 2011, 05:08:06 AM
I tried the parser for RC4 Security patch, and the code in Source/Recent.php is not the same as in the parser, so i do not proceed.

if it would be the same i can do it by myself but its not the same so someone should make a New "Select-from-where" for the recent.php

i dont know how todo that, thats the problem <.<
Title: Re: Advanced Recent Posts / Topics
Post by: Biology Forums on May 08, 2011, 02:25:33 PM
Hi everyone,

How do I make this panel so that the icon it shows represents the icon chosen by the author of the thread rather than the last user's response?

(https://www.simplemachines.org/community/index.php?action=dlattach;topic=433299.0;attach=175472;image)
Title: Re: Advanced Recent Posts / Topics
Post by: ercijuana on April 11, 2013, 03:21:40 PM
./Sources/Recent.php at this changes couldnt do in 2.0.4 i cant found this codes in this file.

Find
Quoteglobal $scripturl, $txt, $db_prefix, $user_info, $modSettings, $func;

   // Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
   // !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
   $request = db_query("
      SELECT
         m.posterTime, m.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG,
         IFNULL(mem.realName, m.posterName) AS posterName, t.ID_BOARD, b.name AS bName,
         LEFT(m.body, 384) AS body, m.smileysEnabled
      FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
         LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
      WHERE m.ID_MSG >= " . max(0, $modSettings['maxMsgID'] - 20 * $showlatestcount) . "
         AND t.ID_TOPIC = m.ID_TOPIC
         AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
         AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
         AND $user_info[query_see_board]
      ORDER BY m.ID_MSG DESC
      LIMIT $showlatestcount", __FILE__, __LINE__);
Title: Re: Advanced Recent Posts / Topics
Post by: Saturno86 on August 15, 2017, 06:45:49 PM
podrian actualizar este mod porfavor, se ve bastante bueno
Title: Re: Advanced Recent Posts / Topics
Post by: d3vcho on August 15, 2017, 06:47:54 PM
Quote from: Saturno86 on August 15, 2017, 06:45:49 PM
podrian actualizar este mod porfavor, se ve bastante bueno

This board is English-only, so please do not post in any other language. Anyway, this mod's author haven't been here for a couple of years, I don't think he's going to update the mod.
Title: Re: Advanced Recent Posts / Topics
Post by: Steve on August 15, 2017, 07:30:09 PM
Quote from: d3vcho(); on August 15, 2017, 06:47:54 PMa couple of years

A couple? More like 5 making your supposition even more probable. ;)
Title: Re: Advanced Recent Posts / Topics
Post by: d3vcho on August 15, 2017, 07:33:54 PM
Quote from: Steve on August 15, 2017, 07:30:09 PM
A couple? More like 5 making your supposition even more probable. ;)

My brain is lazy lately, probably he meant "a few" instesd of "a couple" :P