Foren / Cotonti / Extensions / Support / what's new plugin

Kingsley
#1 26. Oktober 2011, 12:20

dudes..

I know it is a very old plug-in, but seeing there is nothing that can replace it, I still use it. However I have one small problem with it, which I can't seem to find.

Somehow there is an extra title above the page, which I can't remove, example: http://www.killbox1alpha.nl/plug.php?e=whatsnew
The 'What's new in blue, between header menu and the white title.

Can some-one please check and see if I really do need a seeing eye dog? thx in advance..

 

these are the files of the plug-in:

whatsnew.setup.php
 

<?PHP

/* ====================
Seditio - Website engine
Copyright Neocrome
http://www.neocrome.net

[BEGIN_SED]
File=plugins/whatsnew/whatsnew.setup.php
Version=100
Updated=2006-jan-24
Type=Plugin
Author=Neocrome
Description=
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=whatsnew
Name=What's new
Description=Recent things
Version=100
Date=2006-jan-24
Author=Neocrome
Copyright=
Notes=
SQL=
Auth_guests=R
Lock_guests=W12345A
Auth_members=R
Lock_members=W12345A
[END_SED_EXTPLUGIN]

[BEGIN_SED_EXTPLUGIN_CONFIG]
maxlines=01:select:0,1,2,3,4,5,6,7,8,9,10,15,20,25,30,40,50,100:10:Max lines per list
[END_SED_EXTPLUGIN_CONFIG]

==================== */

if (!defined('SED_CODE')) { die('Wrong URL.'); }

?>

whatsnew.php:

<?PHP

/* ====================
Seditio - Website engine
Copyright Neocrome
http://www.neocrome.net

[BEGIN_SED]
File=plugins/whatsnew/whatsnew.php
Version=100
Updated=2006-jan-24
Type=Plugin
Author=Neocrome
Description=
[END_SED]

[BEGIN_SED_EXTPLUGIN]
Code=whatsnew
Part=main
File=whatsnew
Hooks=standalone
Tags=
Minlevel=0
Order=10
[END_SED_EXTPLUGIN]

==================== */

if (!defined('SED_CODE')) { die('Wrong URL.'); }

// Recent pages

$sql = sed_sql_query("SELECT page_id, page_cat, page_title, page_date FROM $db_pages WHERE page_state=0 AND page_cat NOT LIKE 'system' ORDER by page_date DESC LIMIT ".$cfg['plugin']['whatsnew']['maxlines']);

$plugin_body .= "<div id=\"main\">";
$plugin_body .= "<div class=\"mbox-outer\">";
$plugin_body .= "<div class=\"mbox\">";
$plugin_body .= "<h2>".$L['plu_title']."</h2>";
$plugin_body .= "<div class=\"content\">";


$plugin_body .= "<h3 class=\"coltop1\" style=\"border:0; padding-left:20px; padding-top:15px; width:916px; height: 30px; margin-bottom:0px; margin-left:1px;\">".$L['plu_title_pages']."</h3>";
$plugin_body .= "<table class=\"cells\"><tr>";
$plugin_body .= "<td style=\"width:40%;\" class=\"coltop\">".$L['Page']."</td>";
$plugin_body .= "<td style=\"width:25%;\" class=\"coltop\">".$L['Category']."</td>";
$plugin_body .= "<td style=\"width:35%;\" class=\"coltop\" colspan=\"2\">".$L['Updated']."</td></tr>";

$ii = 1;

while ($row = sed_sql_fetcharray($sql))
	{
	if (sed_auth('page', $row['page_cat'], 'R'))
		{
		$plugin_body .= "<tr><td><a href=\"page.php?id=".$row['page_id']."\">".sed_cc($row['page_title'])."</a></td>";
		$plugin_body .= "<td><a href=\"list.php?c=".$row['page_cat']."\">".$sed_cat[$row['page_cat']]['title']."</a></td>";
		$plugin_body .= "<td style=\"text-align:center;\">".date($cfg['dateformat'], $row['page_date'] + $usr['timezone'] * 3600)."</td>";
		$plugin_body .= "<td style=\"text-align:center;\">".sed_build_timegap($row['page_date'], $sys['now_offset'])."</td></tr>";
		$ii++;
		}
	}

$plugin_body .= "</table>";

// Recent posts

$plugin_body .= "<h3 class=\"coltop1\" style=\"border:0; padding-left:20px; padding-top:15px; width:916px; height: 30px; margin-bottom:0px; margin-left:1px;\">".$L['plu_title_posts']."</h3>";
$plugin_body .= "<table class=\"cells\">";
$plugin_body .= "<td style=\"width:60%;\" class=\"coltop\">".$L['Section']." / ".$L['Topic']."</td>";
$plugin_body .= "<td style=\"width:5%;\" class=\"coltop\">".$L['Posts']."</td>";
$plugin_body .= "<td style=\"width:15%;\" class=\"coltop\">".$L['Author']."</td>";
$plugin_body .= "<td style=\"width:20%;\" class=\"coltop\">".$L['Updated']."</td></tr>";

$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, u.user_id, u.user_name
FROM $db_forum_topics t,
$db_forum_sections s, $db_users u
WHERE t.ft_lastposterid=u.user_id AND t.ft_sectionid=s.fs_id
AND t.ft_movedto=0
ORDER by t.ft_updated DESC LIMIT ".$cfg['plugin']['whatsnew']['maxlines']);

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

		$plugin_body .= "<tr><td>"."<a href=\"forums.php?m=topics&amp;s=".$row['fs_id']."\">".sed_cutstring(stripslashes($row['fs_title']),32)."</a> ";
		$plugin_body .= $cfg['separator']." <a href=\"forums.php?m=posts&amp;q=".$row['ft_id']."&amp;n=last#bottom\">".sed_cc(sed_cutstring(stripslashes($row['ft_title']),40))."</a></td>";
		$plugin_body .= "<td style=\"text-align:center;\">".$row['ft_postcount']."</td>";
		$plugin_body .= "<td style=\"text-align:center;\">".sed_build_user($row['user_id'], sed_cc($row['user_name']))."</td>";
		$plugin_body .= "<td style=\"text-align:center;\">".sed_build_timegap($row['ft_updated'], $sys['now_offset'])."</td></tr>";
		}
	}

$plugin_body .= "</table>";

// Recent comments

$sql = sed_sql_query("SELECT c.com_code, c.com_author, c.com_authorid, c.com_date, p.page_title, p.page_cat FROM $db_com as c 
LEFT JOIN $db_pages as p ON CONCAT('p', p.page_id)=c.com_code 
WHERE com_isspecial=0 ORDER by com_date DESC LIMIT ".$cfg['plugin']['whatsnew']['maxlines']);

$plugin_body .= "<h3 class=\"coltop1\" style=\"border:0; padding-left:20px; padding-top:15px; width:916px; height: 30px; margin-bottom:0px; margin-left:1px;\">".$L['plu_title_comments']."</h3>";
$plugin_body .= "<table class=\"cells\">";
$plugin_body .= "<td class=\"coltop\">".$L['Page']."</td>";
$plugin_body .= "<td class=\"coltop\">".$L['Category']."</td>";
$plugin_body .= "<td class=\"coltop\">".$L['Author']."</td>";
$plugin_body .= "<td class=\"coltop\" colspan=\"2\">".$L['Updated']."</td></tr>";

$ii = 1;

while ($row = sed_sql_fetcharray($sql))
	{
	$com_code = $row['com_code'];
	$j = substr($com_code, 0, 1);
	$k = substr($com_code, 1);

	switch($j)
			{
			case 'p':
			$lnk = "<a href=\"page.php?id=$k&amp;comments=1\">".stripslashes($row['page_title'])."</a>";
			$lnk2 = sed_build_catpath($row['page_cat'], "<a href=\"list.php?c=%1\$s\">%2\$s</a>");
			break;

			default:
			$lnk = "<a href=\"index.php\">?</a>";
			$lnk2 = "<a href=\"index.php\">?</a>";
			break;
			}

	$plugin_body .= "<tr><td>".$lnk."</a></td><td>".$lnk2."</a></td>";
	$plugin_body .= "<td>".sed_build_user($row['com_authorid'], sed_cc($row['com_author']))."</a></td>";
	$plugin_body .= "<td style=\"text-align:center;\">".date($cfg['dateformat'], $row['com_date'] + $usr['timezone'] * 3600)."</a></td>";
	$plugin_body .= "<td style=\"text-align:center;\">".sed_build_timegap($row['com_date'], $sys['now_offset'])."</td></tr>";
	}

$plugin_body .= "</table>";

// Recent users

$sql = sed_sql_query("SELECT user_name, user_id, user_country, user_regdate FROM $db_users WHERE user_maingrp>1 ORDER by user_regdate DESC LIMIT ".$cfg['plugin']['whatsnew']['maxlines']);

$plugin_body .= "<h3 class=\"coltop1\" style=\"border:0; padding-left:20px; padding-top:15px; width:916px; height: 30px; margin-bottom:0px; margin-left:1px;;\">".$L['plu_title_users']."</h3>";
$plugin_body .= "<table class=\"cells\">";
$plugin_body .= "<td style=\"width:25%;\" class=\"coltop\">".$L['User']."</td>";
$plugin_body .= "<td style=\"width:25%;\" class=\"coltop\">".$L['Country']."</td>";
$plugin_body .= "<td style=\"width:50%;\" class=\"coltop\" colspan=\"2\">".$L['Registered']."</td></tr>";

while ($row = sed_sql_fetcharray($sql))
	{
	$plugin_body .= "<tr><td>".sed_build_user($row['user_id'], sed_cc(stripslashes($row['user_name'])))."</td>";
	$plugin_body .= "<td>".sed_build_flag($row['user_country'])." ";
	$plugin_body .= sed_build_country($row['user_country'])."</td>";
	$plugin_body .= "<td style=\"text-align:center;\">".date($cfg['dateformat'], $row['user_regdate'] + $usr['timezone'] * 3600)."</a></td>";
	$plugin_body .= "<td style=\"text-align:center;\">".sed_build_timegap($row['user_regdate'],	$sys['now_offset'])."</td></tr>";
	}

$plugin_body .= "</table>";

$plugin_body .= "</div>";
$plugin_body .= "</div>";
$plugin_body .= "</div>";
$plugin_body .= "</div>";
?>



RaisenBran
#2 26. Oktober 2011, 12:47

I'm pretty sure it's not the php but the tpl file for the plugin.

 

It probably looks like this: {TITLE} Just remove it and the blue link will disapear.

Kingsley
#3 26. Oktober 2011, 13:01

there is no tpl file in this plug-in, all the html output is included in the php. As you may have noticed, there is only one title in there, on the correct spot.. Hence, me coming here to see is some-one knows where that is coming from..

Trustmaster
#4 26. Oktober 2011, 13:24

BTW,  Recent Items plugin in Siena has a standalone part which shows you what's new since your last visit or selected period. You can try it here.

May the Source be with you!
Dyllon
#5 26. Oktober 2011, 13:26
In your themes directory you will have plugin.tpl. Even though this plugin doesn't use an individual tpl; it uses plugin.tpl by default. (And through the tag {PLUGIN_TITLE} it will display the title twice). The rest of the plugin is being displayed through the tag {PLUGIN_BODY}.
We are what we repeatedly do. Excellence then, is not an act, but a habit.
Kingsley
#6 26. Oktober 2011, 13:30

@ Trust

still running on Genoa.

@Dyllon

So how do I prevent this plugin from grabbing back on the plugin_title tag?

Dyllon
#7 26. Oktober 2011, 13:33
Where it says $plugin_body = ""; change it to $plugin_title="";
We are what we repeatedly do. Excellence then, is not an act, but a habit.
Kingsley
#8 26. Oktober 2011, 14:49

wel, that fixes the double title, only now the layout is broken ;(

GHengeveld
#9 26. Oktober 2011, 14:58

Line 38, change:

$plugin_body .= "<h2>".$L['plu_title']."</h2>";

To:

$plugin_body .= "<h2 style=\"margin:0;\">".$L['plu_title']."</h2>";

Not the nicest solution (CSS is better) but should work.

Dyllon
#10 26. Oktober 2011, 15:00

That's the biggest downside of having hard coded html in your php files. Unfortunately it will require some tweaking (assuming your using other plugins that require plugin.tpl) for it to come out how you want it displayed.

We are what we repeatedly do. Excellence then, is not an act, but a habit.
Kingsley
#11 26. Oktober 2011, 15:41

@ Gert.. nope, didn't fix it.

@ dyllon

 

As said, it's a very old plug-in, but there isn't really a good replacement for it. Some time ago I tried to fixed it so that it does use a tpl, but my php knowledge is far to small for it to actually work, so I eventually gave up on that.
It's one of the oldest I use, and as far as I know the only one without a tpl (besides those plug-in that don't need one)

Dyllon
#12 26. Oktober 2011, 17:51

If you aren't using plugin.tpl for anything else other than this plugin; Then there is an extremely simple solution:

change your plugin.tpl to look like this:

<!-- BEGIN: MAIN -->

{PLUGIN_TITLE}

{PLUGIN_BODY}

<!-- END: MAIN -->
We are what we repeatedly do. Excellence then, is not an act, but a habit.
Kingsley
#13 26. Oktober 2011, 18:27

minus the plugin_title it works!

A cookie for you my friend..

 

Dyllon
#14 26. Oktober 2011, 21:08
Your welcome :)
We are what we repeatedly do. Excellence then, is not an act, but a habit.