<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[PunBB Forums - disapperaring content in RSS feed after alteration of post date]]></title>
		<link>http://punbb.informer.com/forums/topic/21824/disapperaring-content-in-rss-feed-after-alteration-of-post-date/</link>
		<description><![CDATA[The most recent posts in disapperaring content in RSS feed after alteration of post date.]]></description>
		<lastBuildDate>Wed, 08 Jul 2009 12:52:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: disapperaring content in RSS feed after alteration of post date]]></title>
			<link>http://punbb.informer.com/forums/post/128904/#p128904</link>
			<description><![CDATA[<p>Dear Kowalski&nbsp; Thanks a lot!</p><p>That solved the problem.</p>]]></description>
			<author><![CDATA[dummy@example.com (tillermandimitri)]]></author>
			<pubDate>Wed, 08 Jul 2009 12:52:12 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/128904/#p128904</guid>
		</item>
		<item>
			<title><![CDATA[Re: disapperaring content in RSS feed after alteration of post date]]></title>
			<link>http://punbb.informer.com/forums/post/128901/#p128901</link>
			<description><![CDATA[<p>The specified code works correctly. The problem you have described above appears when you change creation date of the topic in the table &quot;topics&quot; and don&#039;t change creation data of post in the table &quot;posts&quot;. That&#039;s why this </p><div class="codebox"><pre><code>$db-&gt;query(&#039;SELECT t.last_post, t.id, t.posted AS tposted, t.subject, t.poster, p.message, p.hide_smilies, p.posted AS pposted, f.forum_name AS forum, c.cat_name AS category 
    FROM &#039;.$db-&gt;prefix.&#039;topics t 
    LEFT JOIN &#039;.$db-&gt;prefix.&#039;posts p ON (p.topic_id=t.id AND t.posted=p.posted) 
    INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_id 
    LEFT JOIN &#039;.$db-&gt;prefix.&#039;categories AS c ON f.cat_id=c.id 
    LEFT JOIN &#039;.$db-&gt;prefix.&#039;forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) 
    WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL 
    ORDER BY last_post DESC 
    LIMIT &#039;.$postslimit)</code></pre></div><p>can&#039;t get post message.</p>]]></description>
			<author><![CDATA[dummy@example.com (Kovalski)]]></author>
			<pubDate>Wed, 08 Jul 2009 11:47:27 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/128901/#p128901</guid>
		</item>
		<item>
			<title><![CDATA[Re: disapperaring content in RSS feed after alteration of post date]]></title>
			<link>http://punbb.informer.com/forums/post/128748/#p128748</link>
			<description><![CDATA[<div class="quotebox"><cite>Slavok wrote:</cite><blockquote><p>As I can understand from your explanation, there are two possible reasons why the message could disappear: because of post&#039;s date or truncating message. Please, post more information about how your RSS is created.</p></blockquote></div><p>The code of the file creating the RSS feed is the following:</p><div class="codebox"><pre><code>&lt;?php

define(&#039;PUN_ROOT&#039;, &#039;./&#039;);
define(&#039;PUN_QUIET_VISIT&#039;, 1);
require_once PUN_ROOT.&#039;include/common.php&#039;;
require_once PUN_ROOT.&#039;include/parser.php&#039;;
require_once PUN_ROOT.&#039;include/user/feed_functions.php&#039;;
require PUN_ROOT.&#039;lang/&#039;.$pun_user[&#039;language&#039;].&#039;/feed.php&#039;;

//------------------------------------------------------------//

// Make sure guests have permission to read the forums
$result = $db-&gt;query(&#039;SELECT g_read_board FROM &#039;.$db-&gt;prefix.&#039;groups WHERE g_id=3&#039;) or error(&#039;Unable to fetch group info&#039;, __FILE__, __LINE__, $db-&gt;error());

if ($db-&gt;result($result) == &#039;0&#039;)
{
    exit(&#039;No permission&#039;);
}

//------------------------------------------------------------//

// Turn off magic_quotes_runtime
set_magic_quotes_runtime(0);

$show = &#039;topic&#039;;
$postslimit = &#039;25&#039;;
$maxchars = &#039;250&#039;;
$forumuri = $pun_config[&#039;o_base_url&#039;].&#039;/&#039;;
$modsdir = $pun_config[&#039;o_base_url&#039;].&#039;/&#039;;
$imagedir = $pun_config[&#039;o_base_url&#039;].&#039;/img/icons/&#039;;

//------------------------------------------------------------//

if (isset($_GET[&#039;cid&#039;]) &amp;&amp; trim($_GET[&#039;cid&#039;]) != &#039;&#039;)
{
    $feedreq = &#039; AND c.id=&#039;.intval($_GET[&#039;cid&#039;]);
    $add = &#039;?cid=&#039;.intval($_GET[&#039;cid&#039;]);
}
else if (isset($_GET[&#039;fid&#039;]) &amp;&amp; trim($_GET[&#039;fid&#039;]) != &#039;&#039;)
{
    $feedreq = &#039; AND f.id=&#039;.intval($_GET[&#039;fid&#039;]);
    $add = &#039;?fid=&#039;.intval($_GET[&#039;fid&#039;]);
}
else if (isset($_GET[&#039;pfid&#039;]) &amp;&amp; trim($_GET[&#039;pfid&#039;]) != &#039;&#039;)
{
    $feedreq = &#039; AND f.parent_forum_id=&#039;.intval($_GET[&#039;pfid&#039;]);
    $add = &#039;?pfid=&#039;.intval($_GET[&#039;pfid&#039;]);
}
else if (isset($_GET[&#039;tid&#039;]) &amp;&amp; trim($_GET[&#039;tid&#039;]) != &#039;&#039;)
{
    $feedreq = &#039; AND t.id=&#039;.intval($_GET[&#039;tid&#039;]);
    $add = &#039;?tid=&#039;.intval($_GET[&#039;tid&#039;]);
}
else
{
    $feedreq = &#039;&#039;;
    $add = &#039;&#039;;
}

if ($show != &#039;post&#039;)
{
    $result = $db-&gt;query(&#039;SELECT t.last_post, t.id, t.posted AS tposted, t.subject, t.poster, p.message, p.hide_smilies, p.posted AS pposted, f.forum_name AS forum, c.cat_name AS category FROM &#039;.$db-&gt;prefix.&#039;topics t LEFT JOIN &#039;.$db-&gt;prefix.&#039;posts p ON (p.topic_id=t.id AND t.posted=p.posted) INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_id LEFT JOIN &#039;.$db-&gt;prefix.&#039;categories AS c ON f.cat_id=c.id LEFT JOIN &#039;.$db-&gt;prefix.&#039;forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL&#039;.$feedreq.&#039; ORDER BY last_post DESC LIMIT &#039;.$postslimit) or error(&#039;Unable to fetch forum topics&#039;, __FILE__, __LINE__, $db-&gt;error());
}
else
{
    $result = $db-&gt;query(&#039;SELECT t.last_post, p.id, p.message, p.poster, p.posted AS pposted, p.hide_smilies, t.posted AS tposted, t.subject, f.forum_name AS forum, c.cat_name AS category FROM &#039;.$db-&gt;prefix.&#039;posts p LEFT JOIN &#039;.$db-&gt;prefix.&#039;topics t ON p.topic_id=t.id INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_id LEFT JOIN &#039;.$db-&gt;prefix.&#039;categories AS c ON f.cat_id=c.id LEFT JOIN &#039;.$db-&gt;prefix.&#039;forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL&#039;.$feedreq.&#039; ORDER BY last_post DESC LIMIT &#039;.$postslimit) or error(&#039;Unable to fetch forum posts&#039;, __FILE__, __LINE__, $db-&gt;error());
}

//------------------------------------------------------------//

list($lastpost) = $db-&gt;fetch_row($result);
//pg_result_seek($result, 0);
mysql_data_seek($result, 0);

$x = &#039;0&#039;;
$servertag = isset($_SERVER[&#039;HTTP_IF_NONE_MATCH&#039;]) ? trim($_SERVER[&#039;HTTP_IF_NONE_MATCH&#039;]) : &#039;&#039;;

ob_start();

if (!$lastpost)
{
    makeheader($none, $add);
    noposts($none);
}
else if ($servertag != $lastpost)
{
    while ($cur = $db-&gt;fetch_assoc($result))
    {
        if ($x == &#039;0&#039;)
        {
            makeheader($cur, $add);
            $x++;
            $tag = $cur[&#039;last_post&#039;];
        }
        makeposts($cur, $show, $maxchars);
    }
    echo &#039;&lt;/channel&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;/rss&gt;&#039;.&quot;\n&quot;;
}

$feed = ob_get_contents();
ob_end_clean();

//------------------------------------------------------------//

if ($x == &#039;0&#039;)
{
    header(&#039;HTTP/1.1 304 Not Modified&#039;);
    header(&#039;Last-Modified: &#039;.gmdate(&#039;D, d M Y H:i:s&#039;, $lastpost).&#039; GMT&#039;);
    header(&#039;Date: &#039;.gmdate(&#039;D, d M Y H:i:s&#039;).&#039; GMT&#039;);
    header(&#039;Content-Length: 0&#039;);
    header(&#039;Etag: &#039;.$lastpost);
}
else
{
    header(&#039;Etag: &#039;.$lastpost);

    if (stristr($_SERVER[&quot;HTTP_ACCEPT&quot;], &quot;application/xml&quot;))
    {
        header (&#039;Content-Type: application/rss+xml; charset=&#039;.$lang_common[&#039;lang_encoding&#039;]);
    }
    else
    {
        header (&#039;Content-type: text/xml; charset=&#039;.$lang_common[&#039;lang_encoding&#039;]);
    }
    echo $feed;
}

//------------------------------------------------------------//

function makeheader($cur, $add)
{
    global $pun_config, $lang_common, $lang_feed, $modsdir, $imagedir, $forumuri;

    $language = strtolower(substr($pun_config[&#039;o_default_lang&#039;], 0, 2));
    $script = basename($_SERVER[&#039;PHP_SELF&#039;]);
    $board_title = pun_htmlspecialchars($pun_config[&#039;o_board_title&#039;]);

    echo &#039;&lt;?xml version=&quot;1.0&quot; encoding=&quot;&#039;.$lang_common[&#039;lang_encoding&#039;].&#039;&quot;?&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;rss version=&quot;2.0&quot; xmlns:atom=&quot;&#039;.$lang_feed[&#039;Atom uri&#039;].&#039;&quot;&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;channel&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;title&gt;&#039;.$board_title.&#039; &#039;.$lang_feed[&#039;RSS feed&#039;].&#039;&lt;/title&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;link&gt;&#039;.$forumuri.&#039;&lt;/link&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;generator&gt;&#039;.$lang_feed[&#039;RSS generator&#039;].$lang_feed[&#039;Version&#039;].&#039;&lt;/generator&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;description&gt;&#039;.$board_title.&#039;&lt;/description&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;language&gt;&#039;.$language.&#039;&lt;/language&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;docs&gt;&#039;.$lang_feed[&#039;RSS uri&#039;].&#039;&lt;/docs&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;atom:link href=&quot;&#039;.$modsdir.$script.$add.&#039;&quot; rel=&quot;self&quot; type=&quot;application/rss+xml&quot;/&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;copyright&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.$lang_feed[&#039;Copyright&#039;].&quot;\n\t&quot;.$board_title.&quot;\n\t&quot;.$forumuri.&quot;\n&quot;;
    echo &#039;&lt;/copyright&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;ttl&gt;60&lt;/ttl&gt;&#039;.&quot;\n&quot;;
}

function noposts($none)
{
    global $pun_config, $lang_common, $lang_feed, $modsdir, $imagedir, $forumuri;

    echo &#039;&lt;item&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;title&gt;&#039;.$lang_feed[&#039;No posts&#039;].&#039;&lt;/title&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;link&gt;&#039;.$forumuri.&#039;&lt;/link&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;guid isPermaLink=&quot;false&quot;&gt;&#039;.$forumuri.&#039;&lt;/guid&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;description&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t\t&quot;.$lang_feed[&#039;No posts info&#039;].&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;/description&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;/item&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;/channel&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;/rss&gt;&#039;.&quot;\n&quot;;
}

function makeposts($cur, $show, $maxchars)
{
    global $pun_config, $lang_common, $lang_feed, $modsdir, $imagedir, $forumuri;

    if ($show != &#039;post&#039;)
    {
        $link = $forumuri.&#039;viewtopic.php?id=&#039;.strval($cur[&#039;id&#039;]);
    }
    else
    {
        $link = $forumuri.&#039;viewtopic.php?pid=&#039;.strval($cur[&#039;id&#039;]).&#039;#p&#039;.strval($cur[&#039;id&#039;]);
    }

    $author = pun_htmlspecialchars($cur[&#039;poster&#039;]);

    if (strpos($cur[&#039;message&#039;], &#039;[video]&#039;) !== false || strpos($cur[&#039;message&#039;], &#039;[mp3]&#039;) !== false)
    {
        $message = str_replace(array(&#039;[video]&#039;, &#039;[/video]&#039;, &#039;[mp3]&#039;, &#039;[/mp3]&#039;), array(&#039;[url]&#039;, &#039;[/url]&#039;, &#039;[url]&#039;, &#039;[/url]&#039;), $cur[&#039;message&#039;]);
    }
    else
    {
        $message = $cur[&#039;message&#039;];
    }

    $post = gmdate(&#039;d M Y H:i:s&#039;, $cur[&#039;last_post&#039;]);
    $topic = gmdate(&#039;d M Y H:i:s&#039;, $cur[&#039;tposted&#039;]);

    if (pun_strlen($message) &gt; $maxchars)
    {
        $message = &#039;&lt;![CDATA[ &#039;.$lang_feed[&#039;Author&#039;].$author.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.parse_message(pun_htmlspecialchars($message), $cur[&#039;hide_smilies&#039;]).&#039; ]]&gt;&#039;;
    }
    else
    {
        $message = &#039;&lt;![CDATA[ &#039;.$lang_feed[&#039;Author&#039;].$author.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.parse_message(pun_htmlspecialchars($message), $cur[&#039;hide_smilies&#039;]).&#039; ]]&gt;&#039;;
    }

    echo &#039;&lt;item&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;title&gt;&#039;.pun_htmlspecialchars($cur[&#039;subject&#039;]).&#039;&lt;/title&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;link&gt;&#039;.pun_htmlspecialchars($link).&#039;&lt;/link&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;guid isPermaLink=&quot;false&quot;&gt;&#039;.strval($cur[&#039;id&#039;]).&#039;@&#039;.$forumuri.&#039;&lt;/guid&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;pubDate&gt;&#039;.strval(date(&quot;r&quot;, $cur[&#039;tposted&#039;])).&#039;&lt;/pubDate&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;category&gt;&#039;.pun_htmlspecialchars($cur[&#039;category&#039;].&#039; : &#039;.$cur[&#039;forum&#039;]).&#039;&lt;/category&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;description&gt;&#039;.&quot;\n&quot;;
    echo &quot;\t\t&quot;.$message.&quot;\n&quot;;
    echo &quot;\t&quot;.&#039;&lt;/description&gt;&#039;.&quot;\n&quot;;
    echo &#039;&lt;/item&gt;&#039;.&quot;\n&quot;;
}

//------------------------------------------------------------//

?&gt;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (tillermandimitri)]]></author>
			<pubDate>Wed, 01 Jul 2009 12:09:19 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/128748/#p128748</guid>
		</item>
		<item>
			<title><![CDATA[Re: disapperaring content in RSS feed after alteration of post date]]></title>
			<link>http://punbb.informer.com/forums/post/128717/#p128717</link>
			<description><![CDATA[<p>As I can understand from your explanation, there are two possible reasons why the message could disappear: because of post&#039;s date or truncating message. Please, post more information about how your RSS is created.</p>]]></description>
			<author><![CDATA[dummy@example.com (Slavok)]]></author>
			<pubDate>Mon, 29 Jun 2009 08:44:51 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/128717/#p128717</guid>
		</item>
		<item>
			<title><![CDATA[disapperaring content in RSS feed after alteration of post date]]></title>
			<link>http://punbb.informer.com/forums/post/128680/#p128680</link>
			<description><![CDATA[<p>I am using punbb on my webpage merely as a Blog and create a RSS feed with RSS.php. After that I display the latest topics with a widget called FeedSweep on the entry page as a sort of &quot;news&quot; section. Most topics only have one post, (i.e like a Blog).</p><p>Sometimes I need to change the post date of the posts in order to insert a post respectively topic between two preexisitng posts, since in my widget they appear in chronological order. Because I did not find how to modify the post date directly within the punbb - interface, I do that directly in the SQL database of punbb (which forces me to translate the date into integer (10). In punbb that works nice and if I display the index of topics the result is as expected.</p><p>However the RSS feed I collect from RSS.php &quot;looses&quot; the message of the post and only displays the post date (as modified), the author, the subject. Again, this does not happen if I leave the post date as generated automically by punbb.</p><p>I may add that I slightly modified the RSS.php in order to avoid truncation of the message, because I want this to be done by my widget (Feedsweep). For this in line 200 I inserted the same as in line 204 so that the test regarding the length of the message is useless. I know this is not very elegant, but having no PHP programming knowledge I thought this to be the safest method. <br />So instead of:<br /></p><div class="codebox"><pre><code>if (pun_strlen($message) &gt; $maxchars)
    {
        $message = &#039;&lt;![CDATA[ &#039;.$lang_feed[&#039;Author&#039;].$author.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.$lang_feed[&#039;Topic created&#039;].$topic.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.$lang_feed[&#039;Topic updated&#039;].$post.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.parse_message(pun_htmlspecialchars(truncate($message, $maxchars)), $cur[&#039;hide_smilies&#039;]).$lang_feed[&#039;Truncated&#039;].&#039; ]]&gt;&#039;;
    }
    else
    {
        $message = &#039;&lt;![CDATA[ &#039;.$lang_feed[&#039;Author&#039;].$author.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.$lang_feed[&#039;Topic created&#039;].$topic.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.$lang_feed[&#039;Topic updated&#039;].$post.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.parse_message(pun_htmlspecialchars($message), $cur[&#039;hide_smilies&#039;]).&#039; ]]&gt;&#039;;
    }</code></pre></div><p>I have:</p><div class="codebox"><pre><code>if (pun_strlen($message) &gt; $maxchars)
    {
        $message = &#039;&lt;![CDATA[ &#039;.$lang_feed[&#039;Author&#039;].$author.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.parse_message(pun_htmlspecialchars($message), $cur[&#039;hide_smilies&#039;]).&#039; ]]&gt;&#039;;
    }
    else
    {
        $message = &#039;&lt;![CDATA[ &#039;.$lang_feed[&#039;Author&#039;].$author.&#039;&lt;br/&gt;&#039;.&quot;\n\t\t&quot;.parse_message(pun_htmlspecialchars($message), $cur[&#039;hide_smilies&#039;]).&#039; ]]&gt;&#039;;
    }</code></pre></div><p>Any idea why the message of the post disappears?<br />The forum is located at <a href="http://www.zoara.ch/forums/viewforum.php?id=2.">http://www.zoara.ch/forums/viewforum.php?id=2.</a></p><p>The widget showing the RSS feed at <a href="http://www.zoara.ch/">http://www.zoara.ch/</a></p>]]></description>
			<author><![CDATA[dummy@example.com (tillermandimitri)]]></author>
			<pubDate>Thu, 25 Jun 2009 20:44:45 +0000</pubDate>
			<guid>http://punbb.informer.com/forums/post/128680/#p128680</guid>
		</item>
	</channel>
</rss>
