Thanks Garciat for extension.
Translated into Polish:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<!--
/**
* @copyright topic_title_on_index Copyright (C) 2008 hcs
* @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
* @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
* @package topic_title_on_index
*/
-->
<extension engine="1.0">
<id>topic_title_on_index</id>
<title>Topic title on forum index </title>
<version>1.0.0 Beta</version>
<description>Replace the Last Post link on the index page for the name of the topic instead of the date format.</description>
<author>hcs</author>
<minversion>1.3</minversion>
<maxtestedon>1.3.2</maxtestedon>
<hooks>
<hook id="in_qr_get_cats_and_forums"><![CDATA[
$query['SELECT'] .=', t.subject, u.id as poster_id';
$query['JOINS'][] = array(
'LEFT JOIN' => 'topics AS t',
'ON' => 'f.last_post_id=t.last_post_id'
);
$query['JOINS'][] = array(
'LEFT JOIN' => 'users AS u',
'ON' => 'f.last_poster=u.username'
);
]]></hook>
<hook id="in_start"><![CDATA[
function words($string, $words)
{
return implode(" ", array_slice(explode(' ', $string), 0, $words)) . '...';
}
function relative_time($timestamp)
{
$d = time() - $timestamp;
if ($d < 60)
return $d." sekund".(($d==1)?'e':'y')." temu";
else
{
$d = floor($d / 60);
if($d < 60)
return $d." minut".(($d==1)?'e':'y')." temu";
else
{
$d = floor($d / 60);
if($d < 24)
return $d." godzin".(($d==1)?'e':'y')." temu";
else
{
$d = floor($d / 24);
if($d < 7)
return $d." d".(($d==1)?'zień':'ni')." temu";
else
{
$d = floor($d / 7);
if($d < 4)
return $d." t".(($d==1)?'ydzień':'ygodnie')." temu";
}//Week
}//Day
}//Hour
}//Minute
}
$words = 4;
]]></hook>
<hook id="in_normal_row_pre_display"><![CDATA[
if(strpos($forum_page['item_body']['info']['lastpost'], $lang_index['No post info']) === false && strpos($forum_page['item_body']['info']['lastpost'], $lang_common['Never']) === false)
$forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">'.$lang_index['Last post'].'</span> <strong><a href="'.forum_link($forum_url['post'], $cur_forum['last_post_id']).'">'.forum_htmlencode(words($cur_forum['subject'], $words)).'</a></strong> <cite>'.relative_time($cur_forum['last_post']).' '.sprintf($lang_index['Last poster'], '<a href="'.forum_link($forum_url['user'], $cur_forum['poster_id']).'">'.forum_htmlencode($cur_forum['last_poster']).'</a>').'</cite></li>';
]]></hook>
</hooks>
</extension>
EDIT: Sorry found some bugs in language. Polish is so hard and its immposible to do all correclty with this logic.
EDIT2:
Corrected, this time I hope it works correclty, Polish people check it please .
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">
<!--
/**
* @copyright topic_title_on_index Copyright (C) 2008 hcs
* @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
* @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
* @package topic_title_on_index
*/
-->
<extension engine="1.0">
<id>topic_title_on_index</id>
<title>Topic title on forum index </title>
<version>1.0.0 Beta</version>
<description>Replace the Last Post link on the index page for the name of the topic instead of the date format.</description>
<author>hcs</author>
<minversion>1.3</minversion>
<maxtestedon>1.3.2</maxtestedon>
<hooks>
<hook id="in_qr_get_cats_and_forums"><![CDATA[
$query['SELECT'] .=', t.subject, u.id as poster_id';
$query['JOINS'][] = array(
'LEFT JOIN' => 'topics AS t',
'ON' => 'f.last_post_id=t.last_post_id'
);
$query['JOINS'][] = array(
'LEFT JOIN' => 'users AS u',
'ON' => 'f.last_poster=u.username'
);
]]></hook>
<hook id="in_start"><![CDATA[
function words($string, $words)
{
return implode(" ", array_slice(explode(' ', $string), 0, $words)) . '...';
}
function relative_time($timestamp)
{
$ago = ' temu';
$d = time() - $timestamp;
if ($d < 60)
if ($d==1)
return $d. " sekunde" .$ago;
elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
return $d. " sekundy" .$ago;
else
return $d. " sekund" .$ago;
else
{
$d = floor($d / 60);
if($d < 60)
if ($d==1)
return $d. " minute" .$ago;
elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
return $d. " minuty" .$ago;
else
return $d. " minut" .$ago;
else
{
$d = floor($d / 60);
if($d < 24)
if ($d==1)
return $d. " godzine" .$ago;
elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
return $d. " godziny" .$ago;
else
return $d. " godzin" .$ago;
else
{
$d = floor($d / 24);
if($d < 7)
return $d." d".(($d==1)?'zień':'ni')." temu";
else
{
$d = floor($d / 7);
if($d < 4)
if ($d==1)
return $d. " tydzień" .$ago;
elseif (($d%10)>=2 && ($d%10)<=4 && ($d < 12 || $d > 14))
return $d. " tygodnie" .$ago;
else
return $d. " tygodni" .$ago;
}//Week
}//Day
}//Hour
}//Minute
}
$words = 4;
]]></hook>
<hook id="in_normal_row_pre_display"><![CDATA[
if(strpos($forum_page['item_body']['info']['lastpost'], $lang_index['No post info']) === false && strpos($forum_page['item_body']['info']['lastpost'], $lang_common['Never']) === false)
$forum_page['item_body']['info']['lastpost'] = '<li class="info-lastpost"><span class="label">'.$lang_index['Last post'].'</span> <strong><a href="'.forum_link($forum_url['post'], $cur_forum['last_post_id']).'">'.forum_htmlencode(words($cur_forum['subject'], $words)).'</a></strong> <cite>'.relative_time($cur_forum['last_post']).' '.sprintf($lang_index['Last poster'], '<a href="'.forum_link($forum_url['user'], $cur_forum['poster_id']).'">'.forum_htmlencode($cur_forum['last_poster']).'</a>').'</cite></li>';
]]></hook>
</hooks>
</extension>
Garciat like Polish language? ;P
I made for myself some helpfull notes:
1 sekunde
2-4 sekundy
5-21 sekund
22-24 sekundy
25-31 sekund
32-34 sekundy
1 minute
2-4 minuty
5-21 minut
22-24 minuty
25-31 minut
32-34 minuty
1 godzine
2-4 godziny
5-21 godzin
22-24 godziny
25-31 godzin
32-34 godziny
1 dzień
1+ dni
1 tydzień
2-4 tygodnie
5-21 tygodni
22-24 tygodnie
25-31 tygodni
32-34 tygodnie