cotonti.com : Recent items standalone https://www.cotonti.com Последние сообщения в теме Cotonti en Thu, 09 Oct 2025 07:48:50 -0000 foxhound

Thanks, never thought of checking the trunk.]]>
ср, 25 ноя 2009 20:12:11 -0000
pieter ]]> ср, 25 ноя 2009 15:38:06 -0000 esclkm ср, 25 ноя 2009 12:48:43 -0000 Dayver this plug? :/]]> ср, 25 ноя 2009 07:44:16 -0000 foxhound So, I edited the plugin a bit, it looks like this:
<?PHP
/* ====================
[BEGIN_SED_EXTPLUGIN]
Code=recentitems
Part=main
File=recentitems
Hooks=standalone
Order=10
[END_SED_EXTPLUGIN]
==================== */

/**
 * Recent pages and topics in forums
 *
 * @package Cotonti
 * @version 0.0.3
 * @author Neocrome, Cotonti Team
 * @copyright Copyright (c) Cotonti Team 2008-2009
 * @license BSD
 */

defined('SED_CODE') or die('Wrong URL');

/* ============ MASKS FOR THE HTML OUTPUTS =========== */

$recentitems = new XTemplate(sed_skinfile('recentitems', true));

$plu_empty = $L['None']."<br />";
if(empty($cfg['plugin']['recentitems']['redundancy']))
{
	$cfg['plugin']['recentitems']['redundancy'] = 2;
}

if($cfg['plugin']['recentitems']['maxtopics'] > 0 && !$cfg['disable_forums'])
{
	$limit = $cfg['plugin']['recentitems']['maxtopics'];
	$l = $limit * $cfg['plugin']['recentitems']['redundancy'];

	if($cfg['plugin']['recentitems']['fd'] == 'Standard')
	{
		$sql = sed_sql_query("SELECT t.ft_id, t.ft_sectionid, t.ft_title, t.ft_updated, t.ft_postcount, s.fs_id, s.fs_title, s.fs_category
		FROM $db_forum_topics t,$db_forum_sections s
		WHERE t.ft_sectionid=s.fs_id
		AND t.ft_movedto=0 AND t.ft_mode=0
		ORDER by t.ft_updated DESC LIMIT $l");
	}
	/*===Every category the topic attended to. Very detailed, but it looks huge===*/
	elseif($cfg['plugin']['recentitems']['fd'] == 'Subforums with Master Forums')
	{
		$sql = sed_sql_query("SELECT t.ft_id, t.ft_sectionid, t.ft_title, t.ft_updated, t.ft_postcount, s.fs_id, s.fs_masterid, s.fs_mastername, s.fs_title, s.fs_category
		FROM $db_forum_topics t,$db_forum_sections s
		WHERE t.ft_sectionid=s.fs_id
		AND t.ft_movedto=0 AND t.ft_mode=0
		ORDER by t.ft_updated DESC LIMIT $l");
	}
	/*===Only the category which topic has been posted===*/
	elseif($cfg['plugin']['recentitems']['fd'] == 'Parent only')
	{
		$sql = sed_sql_query("SELECT t.ft_id, t.ft_sectionid, t.ft_title, t.ft_updated, t.ft_postcount, s.fs_id, s.fs_title
		FROM $db_forum_topics t,$db_forum_sections s
		WHERE t.ft_sectionid=s.fs_id
		AND t.ft_movedto=0 AND t.ft_mode=0
		ORDER by t.ft_updated DESC LIMIT $l");
	}
	/*===Modern style, only topic, date and postcount===*/
	else
	{
		$sql = sed_sql_query("SELECT t.ft_id, t.ft_title, t.ft_updated, t.ft_postcount, s.fs_id
		FROM $db_forum_topics t,$db_forum_sections s
		WHERE t.ft_sectionid=s.fs_id
		AND t.ft_movedto=0 AND t.ft_mode=0
		ORDER by t.ft_updated DESC LIMIT $l");
	}

	$i = 0;
	while($i < $limit && $row = sed_sql_fetcharray($sql))
	{
		if(sed_auth('forums', $row['fs_id'], 'R'))
		{
			$img = ($usr['id']>0 && $row['ft_updated']>$usr['lastvisit']) ? "<a href=https://www.cotonti.com/\"".sed_url('forums', 'm=posts&q='.$row['ft_id'].'&n=unread', '#unread')."\"><img src=https://www.cotonti.com/\"skins/$skin/img/system/arrow-unread.gif\" alt=\"\" /></a>" : "<a href=https://www.cotonti.com/\"".sed_url('forums', 'm=posts&q='.$row['ft_id'].'&n=last', '#bottom')."\"><img src=https://www.cotonti.com/\"skins/$skin/img/system/arrow-follow.gif\" alt=\"\" /></a> ";

			if($cfg['plugin']['recentitems']['fd'] == 'Standard')
			{
				$build_forum=sed_build_forums($row['fs_id'], sed_cutstring($row['fs_title'],24), sed_cutstring($row['fs_category'],16));
			}
			elseif($cfg['plugin']['recentitems']['fd'] == 'Subforums with Master Forums')
			{
				$build_forum=sed_build_forums($row['fs_id'], sed_cutstring($row['fs_title'],24), sed_cutstring($row['fs_category'],16), true, array($row['fs_masterid'],$row['fs_mastername']));
			}
			elseif($cfg['plugin']['recentitems']['fd'] == 'Parent only')
			{
				$build_forum="<a href=https://www.cotonti.com/\"".sed_url('forums', 'm=topics&s='.$row['fs_id']).'">'.htmlspecialchars(sed_cutstring(stripslashes($row['fs_title']),16))."</a>";
			}
			else
			{
				$build_forum="";
			}

			$recentitems -> assign(array(
				"RI_DATE" => date($cfg['formatmonthdayhourmin'], $row['ft_updated'] + $usr['timezone'] * 3600),
				"RI_IMG" => $img,
				"RI_CAT" => $build_forum,
				"RI_NAME" => "<a href=https://www.cotonti.com/\"".sed_url('forums', 'm=posts&q='.$row['ft_id'].'&n=last', '#bottom').'" title="'.htmlspecialchars(stripslashes($row['ft_title'])).'">'.htmlspecialchars(sed_cutstring(stripslashes($row['ft_title']),25))."</a>",
				"RI_COUNT" => $row['ft_postcount']-1,
			));
			$recentitems -> parse("RECENTFORUMS.RECENTFORUM");

			$i++;
		}
	}
	$recentitems -> parse("RECENTFORUMS");
	$res = $recentitems -> text("RECENTFORUMS");

	$res = (empty($res)) ? $plu_empty : $res;

	$latesttopics = $res;
}

/* ------------------ */

$t-> assign(array(
	"PLUGIN_LATESTTOPICS" => $latesttopics,
));

?>

And I also changed the recentitems.tpl, it looks like this:
<!-- BEGIN: MAIN -->
<!-- BEGIN: MAIN.RECENTFORUMS -->

<table class="cells">

	<tr><td class="coltop" colspan="2">Date</td><td class="coltop">{PHP.skinlang.forumssections.Sections}</td><td class="coltop">{PHP.skinlang.forumssections.Topics}</td><td class="coltop">{PHP.skinlang.forumssections.Posts}</td></tr>

	<!-- BEGIN: MAIN.RECENTFORUM -->

	<tr><td>{RI_IMG} </td><td>{RI_DATE} </td><td>{RI_CAT} </td><td>{RI_NAME} </td><td class="centerall middleall">({RI_COUNT})</td></tr>

	<!-- END: MAIN.RECENTFORUM -->

</table>

<!-- END: MAIN.RECENTFORUMS -->

<!-- END: MAIN -->

I think I am nearly there, all it refuses to do it parse any new topics but other than that it kind of works. Which is already more than I ever managed knowing the php stuff is pretty difficult for me.


Anyone here can help me to get the last bit to work, so it actually parses the latest topics into that page?]]>
ср, 25 ноя 2009 05:56:10 -0000