<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — Integration issue]]></title>
		<link>https://punbb.informer.com/forums/topic/12198/integration-issue/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/12198/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Integration issue.]]></description>
		<lastBuildDate>Fri, 30 Jun 2006 08:19:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Integration issue]]></title>
			<link>https://punbb.informer.com/forums/post/72027/#p72027</link>
			<description><![CDATA[<p>No one that has a solution so i can get my read more link open up in a new window, and not in the viewtopic.php</p>]]></description>
			<author><![CDATA[null@example.com (lhffan)]]></author>
			<pubDate>Fri, 30 Jun 2006 08:19:18 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/72027/#p72027</guid>
		</item>
		<item>
			<title><![CDATA[Integration issue]]></title>
			<link>https://punbb.informer.com/forums/post/71928/#p71928</link>
			<description><![CDATA[<p>I have used Connorhd´s miniportal quide on the wiki and created a new index.php, renamed the old index.php to forum.php and all works fine. But i wanted to extend the indexpage so i also used TGO´s extended external.php as you can find below:</p><p><a href="http://punbb.org/forums/viewtopic.php?id=7552">http://punbb.org/forums/viewtopic.php?id=7552</a></p><p>What i have done is the following from start to end:</p><p>renamed index.php to forum.php<br />created a new index.php that calls external.php (to get short news)<br />the read more link on the index.php calls show_news.php<br />created a new file called new show_news.php (a copy of the new index.php) (to get longer news) it calls to extern.php</p><p>The files (3)<br />INDEX.PHP<br /></p><div class="codebox"><pre><code>&lt;?php
 
define(&#039;PUN_ROOT&#039;, &#039;./&#039;);
define(&#039;PUN_QUIET_VISIT&#039;, 1);
require PUN_ROOT.&#039;include/common.php&#039;;
 
$page_title = pun_htmlspecialchars($pun_config[&#039;o_board_title&#039;]);
define(&#039;PUN_ALLOW_INDEX&#039;, 1);
require PUN_ROOT.&#039;header.php&#039;;
require PUN_ROOT.&#039;include/parser.php&#039;;
 
function pun_news($fid=&#039;&#039;, $show=15, $truncate=1)
{
    global $lang_common, $db, $pun_config, $db_prefix;
    $max_subject_length = 30;
    $show_max_topics = 50;
    $fid = intval($fid);
    $order_by = &#039;t.posted&#039;;
    $forum_sql = &#039;&#039;;
    // Was a forum ID supplied?
    if ( $fid ) $forum_sql = &#039;f.id=&#039;.$fid.&#039; AND &#039;;
    $show = intval($show);
    if ($show &lt; 1 || $show &gt; $show_max_topics)
    $show = 15;
    $saveddate=&quot;&quot;;
    // Fetch $show topics
    $result = $db-&gt;query(&#039;SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM &#039;.$db_prefix.&#039;topics AS t INNER JOIN &#039;.$db_prefix.&#039;forums AS f ON t.forum_id=f.id WHERE f.id=&#039;.$fid.&#039; AND t.moved_to IS NULL ORDER BY &#039;.$order_by.&#039; DESC&#039;) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());
    $show_count = 0;
    if ( !$db-&gt;num_rows($result) ) return $output;
    while ( ($show_count &lt; $show) &amp;&amp; ($cur_topic = $db-&gt;fetch_assoc($result)) ) {
        $temp = &#039;&#039;;
        if ($pun_config[&#039;o_censoring&#039;] == &#039;1&#039;)
            $cur_topic[&#039;subject&#039;] = censor_words($cur_topic[&#039;subject&#039;]);
        if (pun_strlen($cur_topic[&#039;subject&#039;]) &gt; $max_subject_length)
            $subject_truncated = trim(substr($cur_topic[&#039;subject&#039;], 0, ($max_subject_length-5))).&#039; ...&#039;;
        else
            $subject_truncated = $cur_topic[&#039;subject&#039;];
        $newsheading = &#039;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/viewtopic.php?id=&#039;.$cur_topic[&#039;id&#039;].&#039;&amp;action=new&quot; title=&quot;&#039;.pun_htmlspecialchars($cur_topic[&#039;subject&#039;]).&#039;&quot;&gt;&#039;.pun_htmlspecialchars($subject_truncated).&#039;&lt;/a&gt; - &lt;em&gt;Posted by &#039;.$cur_topic[&#039;poster&#039;].&#039; at &#039;.date(&#039;h:i A&#039;, $cur_topic[&#039;posted&#039;]).&#039;&lt;/em&gt;&lt;br&gt;&#039;;
        // Group posts by date    
        $thisdate = date(&#039;l, d F Y&#039;, $cur_topic[&#039;posted&#039;]);
        if ($thisdate != $saveddate) 
 
        {
            if ($saveddate)
            {
                $temp .= &quot;&lt;/div&gt;&lt;/div&gt;&quot;;
            }
            $temp .= &#039;&lt;div class=&quot;block&quot;&gt;&lt;h2&gt;&lt;span&gt;&#039;.$thisdate.&#039;&lt;/span&gt;&lt;/h2&gt;&lt;div class=&quot;box&quot;&gt;&lt;div class=&quot;inbox&quot;&gt;&lt;p&gt;&#039;;
            $saveddate = $thisdate;
        }
        else {
            $temp .= &#039;&lt;div class=&quot;inbox&quot;&gt;&lt;p&gt;&#039;;
        }
        $temp .= $newsheading.&#039;&lt;/p&gt;&lt;p&gt;&#039;;
        $id = $cur_topic[&#039;id&#039;];
        $msg = $db-&gt;query(&#039;SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM &#039;.$db_prefix.&#039;posts WHERE topic_id=&#039;.$id.&#039; LIMIT 1&#039;) or error(&#039;Unable to fetch post info&#039;, __FILE__, __LINE__, $db-&gt;error());
            if ( !$db-&gt;num_rows($msg) ) continue;
        $cur_post = $db-&gt;fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        if ($truncate == 1)
        {
        $paragraph = preg_split(&quot;/s*n+/&quot;, $cur_post[&#039;message&#039;]);
            if (isset($paragraph[1])) {
                $cur_post[&#039;message&#039;] = $paragraph[0] . &quot;...&quot;;
            }
        }
        $cur_post[&#039;message&#039;] = parse_message($cur_post[&#039;message&#039;], 0);
        $temp .= $cur_post[&#039;message&#039;];
        $temp .= &quot;&lt;/p&gt;&lt;/div&gt;&quot;;
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;
    } // end of while
    $output .= &quot;&lt;/div&gt;&lt;/div&gt;&quot;;
    return $output;
}
?&gt;
&lt;div class=&quot;nyheter&quot;&gt;
&lt;div class=&quot;block&quot;&gt;
   &lt;h2&gt;&lt;span&gt;Nyheter&lt;/span&gt;&lt;/h2&gt;
     &lt;div class=&quot;box&quot;&gt;
&lt;?php  //inkludera 5 senaste headlines från forum kategori 3
include(&#039;http://xxx.jokiaho.se/.forum/extern.php?action=new&amp;show=5&amp;fid=3&#039;);
?&gt;
     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;nyheter&quot;&gt;
&lt;div class=&quot;block&quot;&gt;
   &lt;h2&gt;&lt;span&gt;Övriga Nyheter&lt;/span&gt;&lt;/h2&gt;
     &lt;div class=&quot;box&quot;&gt;
&lt;?php  //inkludera 5 senaste headlines från forum kategori 5
include(&#039;http://xxx.jokiaho.se/.forum/extern.php?action=new&amp;show=5&amp;fid=5&#039;);
?&gt;
     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt; 

&lt;?php //inkluderar 2st nyheter från forum kategori 5+3 och lägger till en läs mer länk samt möjlighet att kommentera
  include(&#039;http://www.xxx.jokiaho.se/.forum/extern.php?action=news&amp;show=2&amp;fid=3,5&amp;summary=yes&#039;);
?&gt;

&lt;?php
echo pun_news(1, 5, 0);
 
require PUN_ROOT.&#039;footer.php&#039;;</code></pre></div><p>EXTERN.PHP (MODDED)<br /></p><div class="codebox"><pre><code>&lt;?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************


  INSTRUCTIONS

  This script is used to include information about your board from
  pages outside the forums and to syndicate news about recent
  discussions via RSS. The script can display a list of recent
  discussions (sorted by post or last post time), a list of
  active users or a collection of general board statistics. The
  script can be called directly via an URL (for RSS), from a PHP
  include command or through the use of Server Side Includes (SSI).

  The scripts behaviour is controlled via variables supplied in the
  URL to the script. The different variables are: action (what to
  output), show (how many topics to display), fid (the ID or ID&#039;s of
  the forum(s) to poll for topics), nfid (the ID or ID&#039;s of forums
  that should be excluded) and type (output as HTML or RSS). The
  only mandatory variable is action. Possible/default values are:

    action: active (show most recently active topics) (HTML or RSS)
            new (show newest topics) (HTML or RSS)
            online (show users online) (HTML)
            online_full (as above, but includes a full list) (HTML)
            stats (show board statistics) (HTML)

    show:   Any integer value between 1 and 50. This variables is
            ignored for RSS output. The default is 15.

    fid:    One or more forum ID&#039;s (comma-separated). If ignored,
            topics from all guest-readable forums will be polled.

    nfid:   One or more forum ID&#039;s (comma-separated) that are to be
            excluded. E.g. the ID of a a test forum.

    type:   RSS. Anything else means HTML output.

  Here are some examples using PHP include().

    Show the 15 most recently active topics from all forums:
    include(&#039;http://host.com/forums/extern.php?action=active&#039;);

    Show the 10 newest topics from forums with ID 5, 6 and 7:
    include(&#039;http://host.com/forums/extern.php?action=new&amp;show=10&amp;fid=5,6,7&#039;);

    Show users online:
    include(&#039;http://host.com/forums/extern.php?action=online&#039;);

    Show users online with full listing of users:
    include(&#039;http://host.com/forums/extern.php?action=online_full&#039;);

    Show board statistics:
    include(&#039;http://host.com/forums/extern.php?action=stats&#039;);

  Here are some examples using SSI.

    Show the 5 newest topics from forums with ID 11 and 22:
    &lt;!--#include virtual=&quot;forums/extern.php?action=new&amp;show=5&amp;fid=11,22&quot; --&gt;

    Show board statistics:
    &lt;!--#include virtual=&quot;forums/extern.php?action=stats&quot; --&gt;

  And finally some examples using extern.php to output an RSS 0.91
  feed.

    Output the 15 most recently active topics:
    http://host.com/extern.php?action=active&amp;type=RSS

    Output the 15 newest topics from forum with ID=2:
    http://host.com/extern.php?action=active&amp;type=RSS&amp;fid=2

  Below you will find some variables you can edit to tailor the
  scripts behaviour to your needs.


/***********************************************************************/

// The maximum number of topics that will be displayed
$show_max_topics = 60;

// The length at which topic subjects will be truncated (for HTML output)
$max_subject_length = 30;

// If you exceed max number of allowed topics, how many to display?
$show_default_topics = 10;

// Define the location of your punBB install
$forums = &quot;.forum&quot;;

/***********************************************************************/

// DO NOT EDIT ANYTHING BELOW THIS LINE! (unless you know what you are doing)


define(&#039;PUN_ROOT&#039;, &#039;./&#039;);
@include PUN_ROOT.&#039;config.php&#039;;
require PUN_ROOT.&#039;include/parser.php&#039;;

// If PUN isn&#039;t defined, config.php is missing or corrupt
if (!defined(&#039;PUN&#039;))
    exit(&#039;The file \&#039;config.php\&#039; doesn\&#039;t exist or is corrupt. Please run install.php to install PunBB first.&#039;);


// Make sure PHP reports all errors except E_NOTICE
error_reporting(E_ALL ^ E_NOTICE);

// Turn off magic_quotes_runtime
set_magic_quotes_runtime(0);


// Load the functions script
require PUN_ROOT.&#039;include/functions.php&#039;;

// Load DB abstraction layer and try to connect
require PUN_ROOT.&#039;include/dblayer/common_db.php&#039;;

// Load cached config
@include PUN_ROOT.&#039;cache/cache_config.php&#039;;
if (!defined(&#039;PUN_CONFIG_LOADED&#039;))
{
    require PUN_ROOT.&#039;include/cache.php&#039;;
    generate_config_cache();
    require PUN_ROOT.&#039;cache/cache_config.php&#039;;
}

// Make sure we (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;);


// Attempt to load the common language file
@include PUN_ROOT.&#039;lang/&#039;.$pun_config[&#039;o_default_lang&#039;].&#039;/common.php&#039;;
if (!isset($lang_common))
    exit(&#039;There is no valid language pack \&#039;&#039;.$pun_config[&#039;o_default_lang&#039;].&#039;\&#039; installed. Please reinstall a language of that name.&#039;);

if (!isset($_GET[&#039;action&#039;]))
    exit(&#039;No parameters supplied. See extern.php for instructions.&#039;);


//
// Converts the CDATA end sequence ]]&gt; into ]]&gt;
//
function escape_cdata($str)
{
    return str_replace(&#039;]]&gt;&#039;, &#039;]]&gt;&#039;, $str);
}


//
// Show recent discussions
//
if ($_GET[&#039;action&#039;] == &#039;active&#039; || $_GET[&#039;action&#039;] == &#039;new&#039;)
{
    $order_by = ($_GET[&#039;action&#039;] == &#039;active&#039;) ? &#039;t.last_post&#039; : &#039;t.posted&#039;;
    $forum_sql = &#039;&#039;;

    // Was any specific forum ID&#039;s supplied?
    if (isset($_GET[&#039;fid&#039;]) &amp;&amp; $_GET[&#039;fid&#039;] != &#039;&#039;)
    {
        $fids = explode(&#039;,&#039;, trim($_GET[&#039;fid&#039;]));
        $fids = array_map(&#039;intval&#039;, $fids);

        if (!empty($fids))
            $forum_sql = &#039; AND f.id IN(&#039;.implode(&#039;,&#039;, $fids).&#039;)&#039;;
    }

    // Any forum ID&#039;s to exclude?
    if (isset($_GET[&#039;nfid&#039;]) &amp;&amp; $_GET[&#039;nfid&#039;] != &#039;&#039;)
    {
        $nfids = explode(&#039;,&#039;, trim($_GET[&#039;nfid&#039;]));
        $nfids = array_map(&#039;intval&#039;, $nfids);

        if (!empty($nfids))
            $forum_sql = &#039; AND f.id NOT IN(&#039;.implode(&#039;,&#039;, $nfids).&#039;)&#039;;
    }

    // Should we output this as RSS?
    if (isset($_GET[&#039;type&#039;]) &amp;&amp; strtoupper($_GET[&#039;type&#039;]) == &#039;RSS&#039;)
    {
        $rss_description = ($_GET[&#039;action&#039;] == &#039;active&#039;) ? $lang_common[&#039;RSS Desc Active&#039;] : $lang_common[&#039;RSS Desc New&#039;];
        $url_action = ($_GET[&#039;action&#039;] == &#039;active&#039;) ? &#039;&amp;action=new&#039; : &#039;&#039;;

        // Send XML/no cache headers
        header(&#039;Content-Type: text/xml&#039;);
        header(&#039;Expires: &#039;.gmdate(&#039;D, d M Y H:i:s&#039;).&#039; GMT&#039;);
        header(&#039;Cache-Control: must-revalidate, post-check=0, pre-check=0&#039;);
        header(&#039;Pragma: public&#039;);

        // It&#039;s time for some syndication!
        echo &#039;&lt;?xml version=&quot;1.0&quot; encoding=&quot;&#039;.$lang_common[&#039;lang_encoding&#039;].&#039;&quot;?&gt;&#039;.&quot;\r\n&quot;;
        echo &#039;&lt;!DOCTYPE rss PUBLIC &quot;-//Netscape Communications//DTD RSS 0.91//EN&quot; &quot;http://my.netscape.com/publish/formats/rss-0.91.dtd&quot;&gt;&#039;.&quot;\r\n&quot;;
        echo &#039;&lt;rss version=&quot;0.91&quot;&gt;&#039;.&quot;\r\n&quot;;
        echo &#039;&lt;channel&gt;&#039;.&quot;\r\n&quot;;
        echo &quot;\t&quot;.&#039;&lt;title&gt;&#039;.pun_htmlspecialchars($pun_config[&#039;o_board_title&#039;]).&#039;&lt;/title&gt;&#039;.&quot;\r\n&quot;;
        echo &quot;\t&quot;.&#039;&lt;link&gt;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/&lt;/link&gt;&#039;.&quot;\r\n&quot;;
        echo &quot;\t&quot;.&#039;&lt;description&gt;&#039;.pun_htmlspecialchars($rss_description.&#039; &#039;.$pun_config[&#039;o_board_title&#039;]).&#039;&lt;/description&gt;&#039;.&quot;\r\n&quot;;
        echo &quot;\t&quot;.&#039;&lt;language&gt;en-us&lt;/language&gt;&#039;.&quot;\r\n&quot;;

        // Fetch 15 topics
        $result = $db-&gt;query(&#039;SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM &#039;.$db-&gt;prefix.&#039;topics AS t INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_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;.$forum_sql.&#039; ORDER BY &#039;.$order_by.&#039; DESC LIMIT 15&#039;) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());

        while ($cur_topic = $db-&gt;fetch_assoc($result))
        {
            if ($pun_config[&#039;o_censoring&#039;] == &#039;1&#039;)
                $cur_topic[&#039;subject&#039;] = censor_words($cur_topic[&#039;subject&#039;]);

            echo &quot;\t&quot;.&#039;&lt;item&gt;&#039;.&quot;\r\n&quot;;
            echo &quot;\t\t&quot;.&#039;&lt;title&gt;&#039;.pun_htmlspecialchars($cur_topic[&#039;subject&#039;]).&#039;&lt;/title&gt;&#039;.&quot;\r\n&quot;;
            echo &quot;\t\t&quot;.&#039;&lt;link&gt;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/viewtopic.php?id=&#039;.$cur_topic[&#039;id&#039;].$url_action.&#039;&lt;/link&gt;&#039;.&quot;\r\n&quot;;
            echo &quot;\t\t&quot;.&#039;&lt;description&gt;&lt;![CDATA[&#039;.escape_cdata($lang_common[&#039;Forum&#039;].&#039;: &lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/viewforum.php?id=&#039;.$cur_topic[&#039;fid&#039;].&#039;&quot;&gt;&#039;.$cur_topic[&#039;forum_name&#039;].&#039;&lt;/a&gt;&lt;br /&gt;&#039;.&quot;\r\n&quot;.$lang_common[&#039;Author&#039;].&#039;: &#039;.$cur_topic[&#039;poster&#039;].&#039;&lt;br /&gt;&#039;.&quot;\r\n&quot;.$lang_common[&#039;Posted&#039;].&#039;: &#039;.date(&#039;r&#039;, $cur_topic[&#039;posted&#039;]).&#039;&lt;br /&gt;&#039;.&quot;\r\n&quot;.$lang_common[&#039;Last post&#039;].&#039;: &#039;.date(&#039;r&#039;, $cur_topic[&#039;last_post&#039;])).&#039;]]&gt;&lt;/description&gt;&#039;.&quot;\r\n&quot;;
            echo &quot;\t&quot;.&#039;&lt;/item&gt;&#039;.&quot;\r\n&quot;;
        }

        echo &#039;&lt;/channel&gt;&#039;.&quot;\r\n&quot;;
        echo &#039;&lt;/rss&gt;&#039;;
    }


    // Output regular HTML
    else
    {
        $show = isset($_GET[&#039;show&#039;]) ? intval($_GET[&#039;show&#039;]) : 15;
        if ($show &lt; 1 || $show &gt; 50)
            $show = 15;

        // Fetch $show topics
        $result = $db-&gt;query(&#039;SELECT t.id, t.subject FROM &#039;.$db-&gt;prefix.&#039;topics AS t INNER JOIN &#039;.$db-&gt;prefix.&#039;forums AS f ON f.id=t.forum_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;.$forum_sql.&#039; ORDER BY &#039;.$order_by.&#039; DESC LIMIT &#039;.$show) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());

        while ($cur_topic = $db-&gt;fetch_assoc($result))
        {
            if ($pun_config[&#039;o_censoring&#039;] == &#039;1&#039;)
                $cur_topic[&#039;subject&#039;] = censor_words($cur_topic[&#039;subject&#039;]);

            if (pun_strlen($cur_topic[&#039;subject&#039;]) &gt; $max_subject_length)
                $subject_truncated = pun_htmlspecialchars(trim(substr($cur_topic[&#039;subject&#039;], 0, ($max_subject_length-5)))).&#039; …&#039;;
            else
                $subject_truncated = pun_htmlspecialchars($cur_topic[&#039;subject&#039;]);

            echo &#039;&lt;li&gt;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/news_show.php?id=&#039;.$cur_topic[&#039;id&#039;].&#039;&amp;action=new&quot; title=&quot;&#039;.pun_htmlspecialchars($cur_topic[&#039;subject&#039;]).&#039;&quot;&gt;&#039;.$subject_truncated.&#039;&lt;/a&gt;&lt;/li&gt;&#039;.&quot;\n&quot;;
        }
    }

    return;
}


//
// Show users online
//
else if ($_GET[&#039;action&#039;] == &#039;online&#039; || $_GET[&#039;action&#039;] == &#039;online_full&#039;)
{
    // Load the index.php language file
    require PUN_ROOT.&#039;lang/&#039;.$pun_config[&#039;o_default_lang&#039;].&#039;/index.php&#039;;
    
    // Fetch users online info and generate strings for output
    $num_guests = $num_users = 0;
    $users = array();
    $result = $db-&gt;query(&#039;SELECT user_id, ident FROM &#039;.$db-&gt;prefix.&#039;online WHERE idle=0 ORDER BY ident&#039;, true) or error(&#039;Unable to fetch online list&#039;, __FILE__, __LINE__, $db-&gt;error());

    while ($pun_user_online = $db-&gt;fetch_assoc($result))
    {
        if ($pun_user_online[&#039;user_id&#039;] &gt; 1)
        {
            $users[] = &#039;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/profile.php?id=&#039;.$pun_user_online[&#039;user_id&#039;].&#039;&quot;&gt;&#039;.pun_htmlspecialchars($pun_user_online[&#039;ident&#039;]).&#039;&lt;/a&gt;&#039;;
            ++$num_users;
        }
        else
            ++$num_guests;
    }

    echo $lang_index[&#039;Guests online&#039;].&#039;: &#039;.$num_guests.&#039;&lt;br /&gt;&#039;;

    if ($_GET[&#039;action&#039;] == &#039;online_full&#039;)
        echo $lang_index[&#039;Users online&#039;].&#039;: &#039;.implode(&#039;, &#039;, $users).&#039;&lt;br /&gt;&#039;;
    else
        echo $lang_index[&#039;Users online&#039;].&#039;: &#039;.$num_users.&#039;&lt;br /&gt;&#039;;

    return;
}


//
// Show board statistics
//
else if ($_GET[&#039;action&#039;] == &#039;stats&#039;)
{
    // Load the index.php language file
    require PUN_ROOT.&#039;lang/&#039;.$pun_config[&#039;o_default_lang&#039;].&#039;/index.php&#039;;

    // Collect some statistics from the database
    $result = $db-&gt;query(&#039;SELECT COUNT(id)-1 FROM &#039;.$db-&gt;prefix.&#039;users&#039;) or error(&#039;Unable to fetch total user count&#039;, __FILE__, __LINE__, $db-&gt;error());
    $stats[&#039;total_users&#039;] = $db-&gt;result($result);

    $result = $db-&gt;query(&#039;SELECT id, username FROM &#039;.$db-&gt;prefix.&#039;users ORDER BY registered DESC LIMIT 1&#039;) or error(&#039;Unable to fetch newest registered user&#039;, __FILE__, __LINE__, $db-&gt;error());
    $stats[&#039;last_user&#039;] = $db-&gt;fetch_assoc($result);

    $result = $db-&gt;query(&#039;SELECT SUM(num_topics), SUM(num_posts) FROM &#039;.$db-&gt;prefix.&#039;forums&#039;) or error(&#039;Unable to fetch topic/post count&#039;, __FILE__, __LINE__, $db-&gt;error());
    list($stats[&#039;total_topics&#039;], $stats[&#039;total_posts&#039;]) = $db-&gt;fetch_row($result);

    echo $lang_index[&#039;No of users&#039;].&#039;: &#039;.$stats[&#039;total_users&#039;].&#039;&lt;br /&gt;&#039;;
    echo $lang_index[&#039;Newest user&#039;].&#039;: &lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/profile.php?id=&#039;.$stats[&#039;last_user&#039;][&#039;id&#039;].&#039;&quot;&gt;&#039;.pun_htmlspecialchars($stats[&#039;last_user&#039;][&#039;username&#039;]).&#039;&lt;/a&gt;&lt;br /&gt;&#039;;
    echo $lang_index[&#039;No of topics&#039;].&#039;: &#039;.$stats[&#039;total_topics&#039;].&#039;&lt;br /&gt;&#039;;
    echo $lang_index[&#039;No of posts&#039;].&#039;: &#039;.$stats[&#039;total_posts&#039;];

    return;
}

//
// Use this to display &#039;news&#039; - the recent topics from a specific forum
// expanded to include the first post text, posters, comments, etc.
//

else if ($_GET[&#039;action&#039;] == &#039;news&#039;)
{
    $order_by = ($_GET[&#039;action&#039;] == &#039;active&#039;) ? &#039;t.last_post&#039; : &#039;t.posted&#039;;
    $forum_sql = &#039;&#039;;

    // Get the forum id(s) you&#039;d like to post news from
    if (isset($_GET[&#039;fid&#039;]) &amp;&amp; $_GET[&#039;fid&#039;] != &#039;&#039;)
    {
        $fids = explode(&#039;,&#039;, trim($_GET[&#039;fid&#039;]));
        $fids = array_map(&#039;intval&#039;, $fids);

        if (!empty($fids))
            $forum_sql = &#039; AND f.id IN(&#039;.implode(&#039;,&#039;, $fids).&#039;)&#039;;
    }

    // RSS support not implemented, if anyone wants to do it, feel free..
    if (isset($_GET[&#039;type&#039;]) &amp;&amp; strtoupper($_GET[&#039;type&#039;]) == &#039;RSS&#039;)
    {    
    }
    // Regular HTML output
    else
    {
        $show = isset($_GET[&#039;show&#039;]) ? intval($_GET[&#039;show&#039;]) : $show_default_topics;
        if ($show &lt; 1 || $show &gt; $show_max_topics)
            $show = $show_default_topics;        

        $result = $db-&gt;query(&#039;SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.num_replies, t.num_views, f.id AS fid, f.forum_name FROM &#039;.$db_prefix.&#039;topics AS t INNER JOIN &#039;.$db_prefix.&#039;forums AS f ON t.forum_id=f.id WHERE t.moved_to IS NULL &#039;.$forum_sql.&#039; ORDER BY &#039;.$order_by.&#039; DESC LIMIT &#039;.$show.&#039; &#039;) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());
        $show_count = 0;

        if(!$db-&gt;num_rows($result))
        {
            echo &quot;No news to display&quot;;
        }
        else
        {

            while ( ($show_count &lt; $show) &amp;&amp; ($cur_topic = $db-&gt;fetch_assoc($result)) ) 
            {
                echo &quot;&lt;div class=\&quot;newsblock\&quot;&gt;&quot;;
                $temp = &#039;&#039;;
                if ($pun_config[&#039;o_censoring&#039;] == &#039;1&#039;)
                    $cur_topic[&#039;subject&#039;] = censor_words($cur_topic[&#039;subject&#039;]);
                if (pun_strlen($cur_topic[&#039;subject&#039;]) &gt; $max_subject_length)
                    $subject_truncated = trim(substr($cur_topic[&#039;subject&#039;], 0, ($max_subject_length-5))).&#039; ...&#039;;
                else
                    $subject_truncated = $cur_topic[&#039;subject&#039;];

                // Simplify frequently required display information
                $thisdate = date(&#039;Y-m-d  H:i&#039;, $cur_topic[&#039;posted&#039;]);
                $poster = $cur_topic[&#039;poster&#039;];
                $comments = $cur_topic[&#039;num_replies&#039;];
                $views = $cur_topic[&#039;num_views&#039;];

                // If using headlines, then after first item only show headlines...
                if(isset($_GET[&#039;headlines&#039;]) &amp;&amp; $show_count &gt; 0)
                {
                    echo &#039;&lt;p class=&quot;newsheadline&quot;&gt;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/viewtopic.php?id=&#039;.$cur_topic[&#039;id&#039;].&#039;&quot;&gt;&#039;.$subject_truncated.&quot;&lt;/a&gt; ($comments)&lt;/p&gt; \n&quot;;
                }
                else
                {
                    // DISPLAY FOR TITLE OF NEWS
                    echo &#039;&lt;h2&gt;&#039;.$subject_truncated.&quot;&lt;/h2&gt; \n&quot;;
                    $id = $cur_topic[&#039;id&#039;];
                    $msg = $db-&gt;query(&#039;SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM &#039;.$db_prefix.&#039;posts WHERE topic_id=&#039;.$id.&#039; LIMIT 1&#039;) or error(&#039;Unable to fetch post info&#039;, __FILE__, __LINE__, $db-&gt;error());
                    if ( !$db-&gt;num_rows($msg) ) continue;

                    $cur_post = $db-&gt;fetch_assoc($msg);
                    $posterid = $cur_post[&#039;poster_id&#039;];    

                    // DISPLAY FOR &quot;Posted on DATE by POSTER&quot;
                    echo &#039;&lt;h4&gt;&#039;.$thisdate.&#039;&lt;/h4&gt;&#039; . &#039;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/viewtopic.php?id=&#039;.$cur_topic[&#039;id&#039;].&#039;&quot;&gt;&lt;h4&gt;Diskutera&lt;/a&gt;&lt;/h4&gt;&lt;br /&gt;&#039;.&quot;\n&quot;;                    $truncate = isset($_GET[&#039;summary&#039;]) ? 1 : 0;
                    if ($truncate == 1)
                    {
                        $paragraph = preg_split(&quot;/\s*\n+/&quot;, $cur_post[&#039;message&#039;]);
                        if (isset($paragraph[1])) 
                        {
                            $cur_post[&#039;message&#039;] = $paragraph[0] . &quot;...&quot;;
                        }
                    }

                    $message = parse_message($cur_post[&#039;message&#039;], 0);            
                    echo &#039;&#039;.$message;
                    if ($truncate == 1) { echo &#039;&lt;br /&gt;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/news_show.php?id=&#039;.$cur_topic[&#039;id&#039;].&#039;&quot;&gt;Läs mer...&lt;/a&gt;&#039;; }
                    echo &#039;&lt;br /&gt;&#039;.&quot;\n&quot;;

                    //echo &#039;&lt;p class=&quot;newsextra&quot;&gt;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/viewtopic.php?id=&#039;.$cur_topic[&#039;id&#039;].&#039;&quot;&gt;Diskutera&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&#039;.&quot;\n&quot;;
                }
                echo &quot;&lt;/div&gt;&quot;; // end newsblock div
                $show_count++;
            }
        }
    }
}
else
    exit(&#039;Bad request&#039;);</code></pre></div><p>NEWS_SHOW.PHP (A slightly modded version of my index.php)<br /></p><div class="codebox"><pre><code>&lt;?php
 
define(&#039;PUN_ROOT&#039;, &#039;./&#039;);
define(&#039;PUN_QUIET_VISIT&#039;, 1);
require PUN_ROOT.&#039;include/common.php&#039;;
 
$page_title = pun_htmlspecialchars($pun_config[&#039;o_board_title&#039;]);
define(&#039;PUN_ALLOW_INDEX&#039;, 1);
require PUN_ROOT.&#039;header.php&#039;;
require PUN_ROOT.&#039;include/parser.php&#039;;
 
function pun_news($fid=&#039;&#039;, $show=15, $truncate=1)
{
    global $lang_common, $db, $pun_config, $db_prefix;
    $max_subject_length = 30;
    $show_max_topics = 50;
    $fid = intval($fid);
    $order_by = &#039;t.posted&#039;;
    $forum_sql = &#039;&#039;;
    // Was a forum ID supplied?
    if ( $fid ) $forum_sql = &#039;f.id=&#039;.$fid.&#039; AND &#039;;
    $show = intval($show);
    if ($show &lt; 1 || $show &gt; $show_max_topics)
    $show = 15;
    $saveddate=&quot;&quot;;
    // Fetch $show topics
    $result = $db-&gt;query(&#039;SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM &#039;.$db_prefix.&#039;topics AS t INNER JOIN &#039;.$db_prefix.&#039;forums AS f ON t.forum_id=f.id WHERE f.id=&#039;.$fid.&#039; AND t.moved_to IS NULL ORDER BY &#039;.$order_by.&#039; DESC&#039;) or error(&#039;Unable to fetch topic list&#039;, __FILE__, __LINE__, $db-&gt;error());
    $show_count = 0;
    if ( !$db-&gt;num_rows($result) ) return $output;
    while ( ($show_count &lt; $show) &amp;&amp; ($cur_topic = $db-&gt;fetch_assoc($result)) ) {
        $temp = &#039;&#039;;
        if ($pun_config[&#039;o_censoring&#039;] == &#039;1&#039;)
            $cur_topic[&#039;subject&#039;] = censor_words($cur_topic[&#039;subject&#039;]);
        if (pun_strlen($cur_topic[&#039;subject&#039;]) &gt; $max_subject_length)
            $subject_truncated = trim(substr($cur_topic[&#039;subject&#039;], 0, ($max_subject_length-5))).&#039; ...&#039;;
        else
            $subject_truncated = $cur_topic[&#039;subject&#039;];
        $newsheading = &#039;&lt;a href=&quot;&#039;.$pun_config[&#039;o_base_url&#039;].&#039;/viewtopic.php?id=&#039;.$cur_topic[&#039;id&#039;].&#039;&amp;action=new&quot; title=&quot;&#039;.pun_htmlspecialchars($cur_topic[&#039;subject&#039;]).&#039;&quot;&gt;&#039;.pun_htmlspecialchars($subject_truncated).&#039;&lt;/a&gt; - &lt;em&gt;Posted by &#039;.$cur_topic[&#039;poster&#039;].&#039; at &#039;.date(&#039;h:i A&#039;, $cur_topic[&#039;posted&#039;]).&#039;&lt;/em&gt;&lt;br&gt;&#039;;
        // Group posts by date    
        $thisdate = date(&#039;l, d F Y&#039;, $cur_topic[&#039;posted&#039;]);
        if ($thisdate != $saveddate) 
 
        {
            if ($saveddate)
            {
                $temp .= &quot;&lt;/div&gt;&lt;/div&gt;&quot;;
            }
            $temp .= &#039;&lt;div class=&quot;block&quot;&gt;&lt;h2&gt;&lt;span&gt;&#039;.$thisdate.&#039;&lt;/span&gt;&lt;/h2&gt;&lt;div class=&quot;box&quot;&gt;&lt;div class=&quot;inbox&quot;&gt;&lt;p&gt;&#039;;
            $saveddate = $thisdate;
        }
        else {
            $temp .= &#039;&lt;div class=&quot;inbox&quot;&gt;&lt;p&gt;&#039;;
        }
        $temp .= $newsheading.&#039;&lt;/p&gt;&lt;p&gt;&#039;;
        $id = $cur_topic[&#039;id&#039;];
        $msg = $db-&gt;query(&#039;SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM &#039;.$db_prefix.&#039;posts WHERE topic_id=&#039;.$id.&#039; LIMIT 1&#039;) or error(&#039;Unable to fetch post info&#039;, __FILE__, __LINE__, $db-&gt;error());
            if ( !$db-&gt;num_rows($msg) ) continue;
        $cur_post = $db-&gt;fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        if ($truncate == 1)
        {
        $paragraph = preg_split(&quot;/s*n+/&quot;, $cur_post[&#039;message&#039;]);
            if (isset($paragraph[1])) {
                $cur_post[&#039;message&#039;] = $paragraph[0] . &quot;...&quot;;
            }
        }
        $cur_post[&#039;message&#039;] = parse_message($cur_post[&#039;message&#039;], 0);
        $temp .= $cur_post[&#039;message&#039;];
        $temp .= &quot;&lt;/p&gt;&lt;/div&gt;&quot;;
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;
    } // end of while
    $output .= &quot;&lt;/div&gt;&lt;/div&gt;&quot;;
    return $output;
}


?&gt;
&lt;div class=&quot;nyheter&quot;&gt;
&lt;div class=&quot;block&quot;&gt;
   &lt;h2&gt;&lt;span&gt;Nyheter&lt;/span&gt;&lt;/h2&gt;
     &lt;div class=&quot;box&quot;&gt;
&lt;?php  //inkludera 5 senaste headlines från forum kategori 3
include(&#039;http://xxx.jokiaho.se/.forum/extern.php?action=new&amp;show=5&amp;fid=3&#039;);
?&gt;
     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;nyheter&quot;&gt;
&lt;div class=&quot;block&quot;&gt;
   &lt;h2&gt;&lt;span&gt;Övriga Nyheter&lt;/span&gt;&lt;/h2&gt;
     &lt;div class=&quot;box&quot;&gt;
&lt;?php  //inkludera 5 senaste headlines från forum kategori 5
include(&#039;http://xxx.jokiaho.se/.forum/extern.php?action=new&amp;show=5&amp;fid=5&#039;);
?&gt;
     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt; 

&lt;?php //inkluderar 2st nyheter från forum kategori 5+3 och lägger till en läs mer länk samt möjlighet att kommentera
  include(&#039;http://www.xxx.jokiaho.se/.forum/extern.php?action=news&amp;show=1&amp;fid=3,5&#039;);
?&gt;

&lt;?php
echo pun_news(1, 5, 0);
 
require PUN_ROOT.&#039;footer.php&#039;;</code></pre></div><p>Somwhere when i click on news_show.php the error accures, it doesn´t matter on what link on the page you click, the page is loading the same news item.</p>]]></description>
			<author><![CDATA[null@example.com (lhffan)]]></author>
			<pubDate>Thu, 29 Jun 2006 04:28:30 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/71928/#p71928</guid>
		</item>
	</channel>
</rss>
