<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[PunBB Forums - PunBB 1.2 modifications, plugins and integrations]]></title>
	<link rel="self" href="http://punbb.informer.com/forums/feed/atom/forum/35/"/>
	<updated>2009-11-21T20:47:33Z</updated>
	<generator>PunBB</generator>
	<id>http://punbb.informer.com/forums/</id>
		<entry>
			<title type="html"><![CDATA[Feed Aggregator Plugin 1.0]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/15525/feed-aggregator-plugin-10/new/posts/"/>
			<summary type="html"><![CDATA[<p>##<br />##<br />##&nbsp; &nbsp; &nbsp; &nbsp; Mod title:&nbsp; Feed Aggregator<br />##<br />##&nbsp; &nbsp; &nbsp; Mod version:&nbsp; 1.0<br />##&nbsp; &nbsp;Works on PunBB:&nbsp; 1.2.4<br />##&nbsp; &nbsp; &nbsp;Release date:&nbsp; 2007-04-12<br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Author:&nbsp; Manuel Ortega (manuel@ortega.cl)<br />##<br />##&nbsp; &nbsp; &nbsp; Description:&nbsp; Add post automatically via RSS /Atom<br />##<br />##&nbsp; &nbsp;Affected files:&nbsp; no<br />##<br />##&nbsp; &nbsp; &nbsp; &nbsp;Affects DB:&nbsp; yes<br />##<br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Notes:&nbsp; Use SimplePie (<a href="http://simplepie.org">http://simplepie.org</a>) and crontab<br />##<br />##&nbsp; &nbsp; Installation: <br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- Copy all files to plugins/ folder<br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- Go to Administration -&gt; Plugins / Feed Aggregator<br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- Click Install button<br />##<br />##&nbsp; &nbsp; &nbsp; &nbsp;DISCLAIMER:&nbsp; Please note that &quot;mods&quot; are not officially supported by<br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PunBB. Installation of this modification is done at your<br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; own risk. Backup your forum database and any and all<br />##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; applicable files before proceeding.<br />##<br />##</p><p>Screenshot: <a href="http://www.punres.org/files/projects/pr_373/rid_639/fa_v1.0_screenshot.png">http://www.punres.org/files/projects/pr &#133; enshot.png</a><br />Demo: <a href="http://adi.ing.uchile.cl/~mortega/punbb_124/viewforum.php?id=2">http://adi.ing.uchile.cl/~mortega/punbb &#133; m.php?id=2</a><br />Download: <a href="http://www.punres.org/files.php?pid=373">http://www.punres.org/files.php?pid=373</a></p><p>sorry for my english <img src="http://punbb.informer.com/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></summary>
			<author>
				<name><![CDATA[quaker]]></name>
				<uri>http://punbb.informer.com/forums/user/5993/</uri>
			</author>
			<updated>2009-11-21T20:47:33Z</updated>
			<id>http://punbb.informer.com/forums/topic/15525/feed-aggregator-plugin-10/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[newsbot - post RSS news]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/13529/newsbot-post-rss-news/new/posts/"/>
			<summary type="html"><![CDATA[<p>hey there...<br />I wanted to have rss news in my forums, one per topic so they can be commented and discussed. I think this is cool cause it allows you to keep a newsarchive on your forums.</p><p>ok... originaly i wrote the code to use myself with some settings mixed up inside the code, bad programing practive i know. Also the variable names, wich are very descriptive were writen in portuguese.</p><p>i went through the script and adapted it, the original version is working like a charm on my forums. I didnt test the modified version though so its possible that it has some kind of bug, i think not <img src="http://punbb.informer.com/forums/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>If you need it just try it out, if you get some errors report them and i fix the problem.</p><p>You have to create a new table on your database and define some setings. The feed urls should be inserted in that table. The sql to create the table is in the code as a comment</p><br /><p>OK, so this is how i put this working:<br />i created a folder in punbbroot and put this file there, you can name it whatever you feel like. I also put magpie and a modified copy of search_idx.php.<br />You can dload magpie <a href="http://magpierss.sourceforge.net/">here</a>.<br />since this only works with mysql and i didnt had access to the database class, my modified search_idx.php has all the $db-&gt;function() replaced by the equivalent nativve mysql function. Like, $db-&gt;query() is replaced by mysql_query().</p><p>Ok... i know this is bad programing practice, i just wanted to have it working.<br />Anyway... any questions or trouble reply to this message.</p><div class="codebox"><pre><code>&lt;?php

//configuration=================================================================
//database===========================================
$db_host = &#039;&#039;;
$db_name = &#039;&#039;;
$db_username = &#039;&#039;;
$db_password = &#039;&#039;;

//other===============================================
$newstbot_name=&#039;&#039;; //name of the user that make the news post
$newsbot_id=&#039;&#039;;  //id of that user
$newsforum_id=&#039;&#039;; //the id of the forum where you wan the news to go
$follow_link_text=&#039;Read more at&#039;; //change this if you want to display some other text
//==============================================================================

/*
sql for creating the extra table you need

create table feedsources(
id         int,
feed_url     varchar(255),
updated     int DEFAULT 0
);

*/


require(&#039;magpierss/rss_fetch.inc&#039;);
define(constantebot,1);
require &quot;search_idx.php&quot;;


mysql_connect($db_host, $db_username, $db_password);
mysql_select_db($db_name);


$sql_get_feeds=&quot;select id, feed_url, updated from feedsources&quot;;
$resultado=mysql_query($sql_get_feeds);

$ii=0;
while ( $row=mysql_fetch_array($resultado) ){
    $feed_array[$ii][&quot;feed&quot;]=$row[&quot;feed_url&quot;];
    $feed_array[$ii][&quot;id&quot;]=$row[&quot;id&quot;];
    $feed_array[$ii][&quot;updated&quot;]=$row[&quot;updated&quot;];
    $ii++;
}

$num_posts=0;

foreach ($feed_array as $feed_array_element){
    
    $feed_last_update        =    $feed_array_element[&quot;updated&quot;];
    $url                =    $feed_array_element[&quot;feed&quot;];
    $feed_id            =    $feed_array_element[&quot;id&quot;];
    $rss                 =    fetch_rss($url);    

    $new_last_update = $feed_last_update;
    
    foreach ( $rss-&gt;items as $item ) {
    
                $timenow    = time();
                $date_string     = $item[&quot;pubdate&quot;];
                $date_posted     = strtotime($date_string);
                
                if($date_posted &gt; $new_last_update){
                    $new_last_update=$date_posted;
                }
                
                if($date_posted &lt;= $feed_last_update){
                    
                    break;
                }
                
                $num_posts++;
                $topic_subject        =    $item[&#039;title&#039;];
                $poster            =     $newstbot_name;
                $topic_forum_id        =    $newsforum_id;
                $poster_id        =    $newsbot_id;;

                $post_message        =     mysql_escape_string($item[&#039;description&#039;]);
                $post_message        =    $post_message.
                &quot;&lt;br /&gt;&lt;br /&gt;&lt;a href=\&quot;&quot;.$item[&quot;link&quot;].&quot;\&quot;&gt;$follow_link_text&lt;/a&gt;&quot;;
                
    
                
                $sql=&quot;
                    insert into topics
                        (subject,
                        poster,
                        posted,
                        forum_id,
                        last_post_id,
                        last_poster)
                    values
                        (&#039;$topic_subject&#039;,
                        &#039;$poster&#039;,
                        $timenow,
                        $topic_forum_id,
                        $timenow,
                        &#039;$poster&#039;)&quot;;
                        
                mysql_query($sql);
                
                $topic_id = mysql_insert_id();
                
                $sql=&quot;
                    insert into posts                
                        (poster,
                        poster_id,
                        message,
                        hide_smilies,
                        posted,
                        topic_id)
                    values
                        (&#039;$poster&#039;,
                        $poster_id,&#039;&quot;
                        .&quot;$post_message&quot;
                        .&quot;&#039;,
                        1,
                        $timenow,
                        $topic_id)&quot;;
                
                mysql_query($sql);
                $last_post_id = mysql_insert_id();
         
                $sql=&quot;update topics set last_post_id=$last_post_id, last_post=$date_posted where id=$topic_id&quot;;
                echo &quot;$sql &lt;br&gt;&quot;;
                mysql_query($sql);
                
                $sql=&quot;
                    update forums
                    set
                        num_posts=num_posts+1,
                        num_topics=num_topics+1,
                        last_post=$timenow,
                        last_post_id=$last_post_id,
                        last_poster=&#039;$poster&#039;
                        
                    where
                        id=$topic_forum_id&quot;;
                
                mysql_query($sql);

                                $post_message=strip_tags($post_message);
                update_search_index(&#039;post&#039;, $last_post_id, $post_message);
                               
                
                
        }
        
        $sql2=&quot;update feedsources set updated=$new_last_update where id=$feed_id&quot;;
        mysql_query($sql2);
        echo &quot;$sql2 &lt;br&gt;&quot;;
        
    }
    
    $sql3=&quot;update users set num_posts=num_posts+$num_posts where id=$newsbot_id&quot;;
    mysql_query($sql3);
?&gt;</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[chovy]]></name>
				<uri>http://punbb.informer.com/forums/user/7146/</uri>
			</author>
			<updated>2009-11-21T20:40:28Z</updated>
			<id>http://punbb.informer.com/forums/topic/13529/newsbot-post-rss-news/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Notify moderator of each post]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/22537/notify-moderator-of-each-post/new/posts/"/>
			<summary type="html"><![CDATA[<p>Does anybody know how to modify 1.2 so that I can get a copy of each post?</p><p>Thanks.</p>]]></summary>
			<author>
				<name><![CDATA[nibl]]></name>
				<uri>http://punbb.informer.com/forums/user/22735/</uri>
			</author>
			<updated>2009-11-21T02:37:53Z</updated>
			<id>http://punbb.informer.com/forums/topic/22537/notify-moderator-of-each-post/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[HOWTO] - Upgrade mod compatibility for 1.2.*]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/10518/howto-upgrade-mod-compatibility-for-12/new/posts/"/>
			<summary type="html"><![CDATA[<p>Lots of people have been asking for mods to be &quot;upgraded&quot; to work on the current version of PunBB. However in most cases there is not really a need to ask for this. All you need to do is:</p><p>1. Open install_mod.php<br />2. Find line 12<br />3. Add the version of the forum you are using to the version array<br />4. Save and upload</p><p>That&#039;s it.</p><p>Your version array should then look something like this...</p><div class="codebox"><pre><code>$punbb_versions    = array(&#039;1.2.8&#039;, &#039;1.2.9&#039;, &#039;1.2.10&#039;);</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[tokar86a]]></name>
				<uri>http://punbb.informer.com/forums/user/1862/</uri>
			</author>
			<updated>2009-11-16T16:30:41Z</updated>
			<id>http://punbb.informer.com/forums/topic/10518/howto-upgrade-mod-compatibility-for-12/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Adding BBCode]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/22524/adding-bbcode/new/posts/"/>
			<summary type="html"><![CDATA[<p>Hello,</p><p>I&#039;m wanting to add a bbcode of [center][/center], so I can center texts &amp; stuff, to the existing bbcode that I already have, how might I go about doing this?</p><p>Here is a screen shot of what my existing code looks like:<br /><span class="postimg"><img src="http://www.thestkclan.net/bbcode.jpg" alt="http://www.thestkclan.net/bbcode.jpg" /></span></p><p>I appreciate the help...</p><p>Kind Regards,<br />Juston</p>]]></summary>
			<author>
				<name><![CDATA[Slavok]]></name>
				<uri>http://punbb.informer.com/forums/user/22672/</uri>
			</author>
			<updated>2009-11-16T12:26:47Z</updated>
			<id>http://punbb.informer.com/forums/topic/22524/adding-bbcode/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[chatbox. question about security.]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/22516/chatbox-question-about-security/new/posts/"/>
			<summary type="html"><![CDATA[<p>i&#039;m notice that my chatbox allow people to post javascript code.<br />for example this code.<br />&lt;BODY onLoad=&quot;javascript: alert(&#039;On Load event fired!&#039;)&quot;&gt; <br />or <br />&lt;A href=&quot;javascript: alert(&#039;Clicked on link!&#039;)&quot;&gt;Click here!&lt;/A&gt; <br />or <br />&lt;script&gt;&lt;/script&gt;<br />for the security reason, how can i disable javascript in chatbox?</p><p>here is my chatbox.php</p><div class="codebox"><pre><code>/***********************************************************************

  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

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

define(&#039;PUN_ALT4&#039;,1);
if (!defined(&#039;PUN_ROOT&#039;)) define(&#039;PUN_ROOT&#039;,&#039;./&#039;);


require PUN_ROOT.&#039;include/common.php&#039;;
require PUN_ROOT.&#039;include/parser.php&#039;;

$lang_common[&#039;lang_encoding&#039;] = &#039;utf-8&#039;;
header(&#039;Content-type: text/html; charset=utf-8&#039;);

if (!$pun_config[&#039;cb_pbb_version&#039;])
    message(&#039;Poki BB Chatbox is not installed correctly. Please make sure you have launch install_mod.php&#039;);

if ($pun_user[&#039;g_read_board&#039;] == &#039;0&#039;)
    message($lang_common[&#039;No view&#039;]);

// Load the chatbox.php and post.php language file
require PUN_ROOT.&#039;lang/&#039;.$pun_user[&#039;language&#039;].&#039;/chatbox.php&#039;;
require PUN_ROOT.&#039;lang/&#039;.$pun_user[&#039;language&#039;].&#039;/post.php&#039;;

// if it&#039;s ajax
if (isset($_GET[&#039;ajax&#039;]))
{

    // Send no-cache headers
    header(&#039;Expires: Thu, 21 Jul 1977 07:30:00 GMT&#039;);    // When yours truly first set eyes on this world! :)
    header(&#039;Last-Modified: &#039;.gmdate(&#039;D, d M Y H:i:s&#039;).&#039; GMT&#039;);
    header(&#039;Cache-Control: post-check=0, pre-check=0&#039;, false);
    header(&#039;Pragma: no-cache&#039;);        // For HTTP/1.0 compability
    
    if ($_GET[&#039;action&#039;] == &#039;add&#039;)
    {
        // Start with a clean slate
        $error = $pun_config[&#039;cb_space&#039;].$pun_config[&#039;cb_ajax_errors&#039;];
        $error = str_replace(&#039;&lt;pun_error&gt;&#039;, $lang_chatbox[&#039;Error Title&#039;], $error);
        $error = str_replace(&#039;&lt;pun_date&gt;&#039;, format_time(time()), $error);
        
        //exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($value, 0), $error));
    
        // Make sure form_user is correct
        if (($pun_user[&#039;is_guest&#039;] &amp;&amp; $_GET[&#039;form_user&#039;] != &#039;Guest&#039;) || (!$pun_user[&#039;is_guest&#039;] &amp;&amp; $_GET[&#039;form_user&#039;] != $pun_user[&#039;username&#039;]))
            exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_common[&#039;Bad request&#039;], 0), $error));
        
        // Do we have permission to post?
        if ($pun_user[&#039;g_post_chatbox&#039;] != &#039;1&#039;)
            exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_chatbox[&#039;No Post Permission&#039;], 0), $error));

        // Flood protection
        if (!$pun_user[&#039;is_guest&#039;] &amp;&amp; $pun_user[&#039;last_post_chatbox&#039;] != &#039;&#039; &amp;&amp; (time() - $pun_user[&#039;last_post_chatbox&#039;]) &lt; $pun_user[&#039;g_post_flood_chatbox&#039;])
            exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_post[&#039;Flood start&#039;].&#039; &#039;.$pun_user[&#039;g_post_flood_chatbox&#039;].&#039; &#039;.$lang_post[&#039;flood end&#039;], 0), $error));
    
        if ($pun_user[&#039;is_guest&#039;])
        {
$result = $db-&gt;query(&#039;SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox, g.g_color FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg AS m INNER JOIN &#039;.$db-&gt;prefix.&#039;users AS u ON u.id=m.poster_id INNER JOIN &#039;.$db-&gt;prefix.&#039;groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT &#039;.$pun_config[&#039;cb_max_msg&#039;]) or error(&#039;Unable to fetch messages&#039;, __FILE__, __LINE__, $db-&gt;error());
            $cur_post = $db-&gt;fetch_assoc($result);
            
            if ((time() - $cur_post[&#039;posted&#039;]) &lt; $pun_user[&#039;g_post_flood_chatbox&#039;])
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_post[&#039;Flood start&#039;].&#039; &#039;.$pun_user[&#039;g_post_flood_chatbox&#039;].&#039; &#039;.$lang_post[&#039;flood end&#039;], 0), $error));
        }
        
        // If the user is logged in we get the username and e-mail from $pun_user
        if (!$pun_user[&#039;is_guest&#039;])
        {
            $username = $pun_user[&#039;username&#039;];
            $email = $pun_user[&#039;email&#039;];
        }
        // Otherwise it should be in $_GET
        else
        {
            $username = trim($_GET[&#039;req_username&#039;]);
            $email = strtolower(trim(($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039;) ? $_GET[&#039;req_email&#039;] : $_GET[&#039;email&#039;]));
    
            // Load the register.php/profile.php language files
            require PUN_ROOT.&#039;lang/&#039;.$pun_user[&#039;language&#039;].&#039;/prof_reg.php&#039;;
            require PUN_ROOT.&#039;lang/&#039;.$pun_user[&#039;language&#039;].&#039;/register.php&#039;;
    
            // It&#039;s a guest, so we have to validate the username
            if (strlen($username) &lt; 2)
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_prof_reg[&#039;Username too short&#039;], 0), $error));
            else if (!strcasecmp($username, &#039;Guest&#039;) || !strcasecmp($username, $lang_common[&#039;Guest&#039;]))
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_prof_reg[&#039;Username guest&#039;], 0), $error));
            else if (preg_match(&#039;/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/&#039;, $username))
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_prof_reg[&#039;Username IP&#039;], 0), $error));
    
            if ((strpos($username, &#039;[&#039;) !== false || strpos($username, &#039;]&#039;) !== false) &amp;&amp; strpos($username, &#039;\&#039;&#039;) !== false &amp;&amp; strpos($username, &#039;&quot;&#039;) !== false)
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_prof_reg[&#039;Username reserved chars&#039;], 0), $error));
            if (preg_match(&#039;#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i&#039;, $username))
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_prof_reg[&#039;Username BBCode&#039;], 0), $error));
    
            // Check username for any censored words
            $temp = censor_words($username);
            if ($temp != $username)
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_register[&#039;Username censor&#039;], 0), $error));
    
            // Check that the username (or a too similar username) is not already registered
            $result = $db-&gt;query(&#039;SELECT username FROM &#039;.$db-&gt;prefix.&#039;users WHERE username=\&#039;&#039;.$db-&gt;escape($username).&#039;\&#039; OR username=\&#039;&#039;.$db-&gt;escape(preg_replace(&#039;/[^\w]/&#039;, &#039;&#039;, $username)).&#039;\&#039;&#039;) or error(&#039;Unable to fetch user info&#039;, __FILE__, __LINE__, $db-&gt;error());
            if ($db-&gt;num_rows($result))
            {
                $busy = $db-&gt;result($result);
                exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_register[&#039;Username dupe 1&#039;].&#039; &#039;.pun_htmlspecialchars($busy).&#039;. &#039;.$lang_register[&#039;Username dupe 2&#039;], 0), $error));
            }
    
            if ($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039; || $email != &#039;&#039;)
            {
                require PUN_ROOT.&#039;include/email.php&#039;;
                if (!is_valid_email($email))
                    exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_common[&#039;Invalid e-mail&#039;], 0), $error));
            }            
            
        }
    
        // Clean up message from POST
        $message = str_replace(&#039;-|-&#039;, &#039;+&#039;, pun_linebreaks(pun_trim($_GET[&#039;req_message&#039;])));
        
        if ($message == &#039;&#039;)
            exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_chatbox[&#039;Error No message&#039;], 0), $error));
        else if (strlen($message) &gt; $pun_config[&#039;cb_msg_maxlength&#039;])
            exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($lang_chatbox[&#039;Error Too long message&#039;], 0), $error));
        else if ($pun_config[&#039;p_message_all_caps&#039;] == &#039;0&#039; &amp;&amp; strtoupper($message) == $message &amp;&amp; $pun_user[&#039;g_id&#039;] &gt; PUN_MOD)
            $message = ucwords(strtolower($message));
    
        $errors = &#039;&#039;;
        // Validate BBCode syntax
        if ($pun_config[&#039;p_message_bbcode&#039;] == &#039;1&#039; &amp;&amp; strpos($message, &#039;[&#039;) !== false &amp;&amp; strpos($message, &#039;]&#039;) !== false)
            $message = preparse_bbcode($message, $errors);
            
        if ($errors != &#039;&#039;)
        exit(&#039;error:chat&#039;.str_replace(&#039;&lt;pun_error_text&gt;&#039;, parse_message($errors[0], 0), $error));


        $now = time();

        if (!$pun_user[&#039;is_guest&#039;])
        {
            // Insert message
            $db-&gt;query(&#039;INSERT INTO &#039;.$db-&gt;prefix.&#039;chatbox_msg (poster, poster_id, poster_ip, message, posted) VALUES(\&#039;&#039;.$db-&gt;escape($username).&#039;\&#039;, &#039;.$pun_user[&#039;id&#039;].&#039;, \&#039;&#039;.get_remote_address().&#039;\&#039;, \&#039;&#039;.$db-&gt;escape($message).&#039;\&#039;, &#039;.$now.&#039;)&#039;) or error(&#039;Unable to post message&#039;, __FILE__, __LINE__, $db-&gt;error());

            // Increment his/her chatbox post count
              $low_prio = ($db_type == &#039;mysql&#039;) ? &#039;LOW_PRIORITY &#039; : &#039;&#039;;
              $db-&gt;query(&#039;UPDATE &#039;.$low_prio.$db-&gt;prefix.&#039;users SET num_posts_chatbox=num_posts_chatbox+1, last_post_chatbox=&#039;.$now.&#039; WHERE id=&#039;.$pun_user[&#039;id&#039;]) or error(&#039;Unable to update user&#039;, __FILE__, __LINE__, $db-&gt;error());

        }
        else
        {
            // Insert message
            $email_sql = ($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039; || $email != &#039;&#039;) ? &#039;\&#039;&#039;.$email.&#039;\&#039;&#039; : &#039;NULL&#039;;
            $db-&gt;query(&#039;INSERT INTO &#039;.$db-&gt;prefix.&#039;chatbox_msg (poster, poster_id, poster_ip, poster_email, message, posted) VALUES(\&#039;&#039;.$db-&gt;escape($username).&#039;\&#039;, &#039;.$pun_user[&#039;id&#039;].&#039;, \&#039;&#039;.get_remote_address().&#039;\&#039;, &#039;.$email_sql.&#039;, \&#039;&#039;.$db-&gt;escape($message).&#039;\&#039;, &#039;.$now.&#039;)&#039;) or error(&#039;Unable to post message&#039;, __FILE__, __LINE__, $db-&gt;error());
        }

        $count = $db-&gt;query(&#039;SELECT COUNT(id) FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg&#039;) or error(&#039;Unable to fetch chatbox post count&#039;, __FILE__, __LINE__, $db-&gt;error());
        $num_post = $db-&gt;result($count);
        
        $limit = ($num_post-$pun_config[&#039;cb_max_msg&#039;] &lt;= 0) ? 0 : $num_post-$pun_config[&#039;cb_max_msg&#039;];
        
        
        $result = $db-&gt;query(&#039;SELECT id,posted FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg ORDER BY posted ASC LIMIT &#039;.$limit) or error(&#039;Unable to select post to delete&#039;, __FILE__, __LINE__, $db-&gt;error());
        while ($del_msg = $db-&gt;fetch_assoc($result))
        {
        $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg WHERE id = &#039;.$del_msg[&#039;id&#039;].&#039; LIMIT 1&#039;) or error(&#039;Unable to delete post&#039;, __FILE__, __LINE__, $db-&gt;error());
        }
        
        $_GET[&#039;req_message&#039;] = NULL;
    }

        $cur_msg_txt = &#039;&#039;;
        $response = &#039;&#039;;
        $count_id = array();

        $last_msg_time = intval($_GET[&#039;last_msg&#039;]);
        //$messages = $db-&gt;query(&#039;SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg AS m INNER JOIN &#039;.$db-&gt;prefix.&#039;users AS u ON u.id=m.poster_id INNER JOIN &#039;.$db-&gt;prefix.&#039;groups AS g ON g.g_id=u.group_id WHERE m.posted &gt; &#039;.$last_msg_time.&#039; ORDER BY m.posted DESC LIMIT &#039;.$pun_config[&#039;cb_max_msg&#039;]) or error(&#039;Unable to fetch messages&#039;, __FILE__, __LINE__, $db-&gt;error());
        $messages = $db-&gt;query(&#039;SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg AS m INNER JOIN &#039;.$db-&gt;prefix.&#039;users AS u ON u.id=m.poster_id INNER JOIN &#039;.$db-&gt;prefix.&#039;groups AS g ON g.g_id=u.group_id WHERE m.posted &gt; &#039;.$last_msg_time.&#039; ORDER BY m.posted DESC LIMIT 0,50&#039;) or error(&#039;Unable to fetch messages&#039;, __FILE__, __LINE__, $db-&gt;error());

        $i = 0;
        while ($cur_msg = $db-&gt;fetch_assoc($messages))
        {    
        $i++;
        if ($i == 1)
        {
            // Get newest timestamp
            $response = $cur_msg[&#039;posted&#039;];
        }
        $cur_msg_txt .= $pun_config[&#039;cb_space&#039;].$cur_msg[&#039;g_title_chatbox&#039;].$pun_config[&#039;cb_disposition&#039;];
        
if ($cur_msg[&#039;g_id&#039;] != PUN_GUEST)
        $cur_msg_txt = str_replace(&#039;&lt;pun_username&gt;&#039;, &#039;&lt;a href=&quot;profile.php?id=&#039;.$cur_msg[&#039;id&#039;].&#039;&quot;&gt;&lt;span style=&quot;color: &#039;.$cur_msg[&#039;g_color&#039;].&#039;&quot;&gt;&#039;.pun_htmlspecialchars($cur_msg[&#039;poster&#039;]).&#039;&lt;/span&gt;&lt;/a&gt;&#039;, $cur_msg_txt);
    else
        $cur_msg_txt = str_replace(&#039;&lt;pun_username&gt;&#039;, pun_htmlspecialchars($cur_msg[&#039;poster&#039;]), $cur_msg_txt);
        
        $cur_msg_txt = str_replace(&#039;&lt;pun_date&gt;&#039;, format_time($cur_msg[&#039;posted&#039;]), $cur_msg_txt);
                
            if ($cur_msg[&#039;g_id&#039;] != PUN_GUEST)
        $cur_msg_txt = str_replace(&#039;&lt;pun_nbpost&gt;&#039;, $cur_msg[&#039;num_posts_chatbox&#039;], $cur_msg_txt);
        else
        {
        
        if (!isset($count_id[$cur_msg[&#039;poster&#039;]]))
        {
        $like_command = ($db_type == &#039;pgsql&#039;) ? &#039;ILIKE&#039; : &#039;LIKE&#039;;
        
        $count = $db-&gt;query(&#039;SELECT COUNT(id) FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg WHERE poster &#039;.$like_command.&#039; \&#039;&#039;.$db-&gt;escape(str_replace(&#039;*&#039;, &#039;%&#039;, $cur_msg[&#039;poster&#039;])).&#039;\&#039;&#039;) or error(&#039;Unable to fetch user chatbox post count&#039;, __FILE__, __LINE__, $db-&gt;error());
        $num_post = $db-&gt;result($count);
        $count_id[$cur_msg[&#039;poster&#039;]] = $num_post;
        }
        else
        $num_post = $count_id[$cur_msg[&#039;poster&#039;]];
        
        $cur_msg_txt = str_replace(&#039;&lt;pun_nbpost&gt;&#039;, $num_post, $cur_msg_txt);
        }
        
        $cur_msg_txt = str_replace(&#039;&lt;pun_nbpost_txt&gt;&#039;, $lang_chatbox[&#039;Posts&#039;], $cur_msg_txt);
        
            if ($pun_user[&#039;g_id&#039;] &lt; PUN_GUEST)
          {
        $cur_msg_admin = &#039; [ &lt;a href=&quot;chatbox.php?del=&#039;.$cur_msg[&#039;m_id&#039;].&#039;&quot;&gt;Delete&lt;/a&gt; | &lt;a href=&quot;chatbox.php?get_host=&#039;.$cur_msg[&#039;m_id&#039;].&#039;&quot;&gt;&#039;.$cur_msg[&#039;poster_ip&#039;].&#039;&lt;/a&gt;&#039;;
        if ($cur_msg[&#039;poster_email&#039;])
                $cur_msg_admin .= &#039; | &lt;a href=&quot;mailto:&#039;.$cur_msg[&#039;poster_email&#039;].&#039;&quot;&gt;&#039;.$lang_common[&#039;E-mail&#039;].&#039;&lt;/a&gt; ]&#039;;
            else
              $cur_msg_admin .= &#039; ] &#039;;
            }
        else
        $cur_msg_admin = &#039;&#039;;
        
        $cur_msg_txt = str_replace(&#039;&lt;pun_admin&gt;&#039;, $cur_msg_admin, $cur_msg_txt);
        $cur_msg_txt = str_replace(&#039;&lt;pun_message&gt;&#039;, parse_message($cur_msg[&#039;message&#039;], 0), $cur_msg_txt);
        
        $response .= $cur_msg_txt . &quot;\n&quot;;
    }
    if (!$response)
        $response = $last_msg_time;
    
    $response = pun_trim($response);
    
    exit($response);

}

// This particular function doesn&#039;t require forum-based moderator access. It can be used
// by all moderators and admins.

if (isset($_GET[&#039;del&#039;]))
{
    if ($pun_user[&#039;g_id&#039;] &gt; PUN_MOD)
        message($lang_common[&#039;No permission&#039;]);

        $id = intval($_GET[&#039;del&#039;]);
        if ($id &lt; 1)
            message($lang_common[&#039;Bad request&#039;]);


$result = $db-&gt;query(&#039;Delete From &#039;.$db-&gt;prefix.&#039;chatbox_msg WHERE id=&#039;.$id.&#039;&#039;) or error(&#039;Unable to fetch post IP address&#039;, __FILE__, __LINE__, $db-&gt;error()); 
}


if (isset($_GET[&#039;get_host&#039;]))
{
    if ($pun_user[&#039;g_id&#039;] &gt; PUN_MOD)
        message($lang_common[&#039;No permission&#039;]);

    // Is get_host an IP address or a post ID?
    if (preg_match(&#039;/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/&#039;, $_GET[&#039;get_host&#039;]))
        $ip = $_GET[&#039;get_host&#039;];
    else
    {
        $get_host = intval($_GET[&#039;get_host&#039;]);
        if ($get_host &lt; 1)
            message($lang_common[&#039;Bad request&#039;]);

        $result = $db-&gt;query(&#039;SELECT poster_ip FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg WHERE id=&#039;.$get_host) or error(&#039;Unable to fetch post IP address&#039;, __FILE__, __LINE__, $db-&gt;error());
        if (!$db-&gt;num_rows($result))
            message($lang_common[&#039;Bad request&#039;]);

        $ip = $db-&gt;result($result);
    }

    message(&#039;The IP address is: &#039;.$ip.&#039;&lt;br /&gt;The host name is: &#039;.@gethostbyaddr($ip).&#039;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;admin_users.php?show_users=&#039;.$ip.&#039;&quot;&gt;Show more users for this IP&lt;/a&gt;&#039;);
}

$page_title = pun_htmlspecialchars($lang_chatbox[&#039;Page_title&#039;]);
define(&#039;PUN_ALLOW_INDEX&#039;, 1);
require PUN_ROOT.&#039;header.php&#039;;

if ($pun_user[&#039;g_read_chatbox&#039;] != &#039;1&#039;)
  message($lang_chatbox[&#039;No Read Permission&#039;]);

// Did someone just hit &quot;Submit&quot;?
if (isset($_POST[&#039;form_sent&#039;]))
{

    // Make sure form_user is correct
    if (($pun_user[&#039;is_guest&#039;] &amp;&amp; $_POST[&#039;form_user&#039;] != &#039;Guest&#039;) || (!$pun_user[&#039;is_guest&#039;] &amp;&amp; $_POST[&#039;form_user&#039;] != $pun_user[&#039;username&#039;]))
        message($lang_common[&#039;Bad request&#039;]);

  // Do we have permission to post?
  if ($pun_user[&#039;g_post_chatbox&#039;] != &#039;1&#039;)
    message($lang_chatbox[&#039;No Post Permission&#039;]);

  // Start with a clean slate
  $errors = array();

    // Flood protection
    if (!$pun_user[&#039;is_guest&#039;] &amp;&amp; $pun_user[&#039;last_post_chatbox&#039;] != &#039;&#039; &amp;&amp; (time() - $pun_user[&#039;last_post_chatbox&#039;]) &lt; $pun_user[&#039;g_post_flood_chatbox&#039;])
        $errors[] = $lang_post[&#039;Flood start&#039;].&#039; &#039;.$pun_user[&#039;g_post_flood_chatbox&#039;].&#039; &#039;.$lang_post[&#039;flood end&#039;];

  if ($pun_user[&#039;is_guest&#039;])
  {
    $result = $db-&gt;query(&#039;SELECT id, poster_ip, posted FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg WHERE poster_ip=\&#039;&#039;.get_remote_address().&#039;\&#039; ORDER BY posted DESC LIMIT 1&#039;) or error(&#039;Unable to fetch messages for flood protection&#039;, __FILE__, __LINE__, $db-&gt;error());
    $cur_post = $db-&gt;fetch_assoc($result);

    if ((time() - $cur_post[&#039;posted&#039;]) &lt; $pun_user[&#039;g_post_flood_chatbox&#039;])
          $errors[] = $lang_post[&#039;Flood start&#039;].&#039; &#039;.$pun_user[&#039;g_post_flood_chatbox&#039;].&#039; &#039;.$lang_post[&#039;flood end&#039;];
  }

  // If the user is logged in we get the username and e-mail from $pun_user
    if (!$pun_user[&#039;is_guest&#039;])
    {
        $username = $pun_user[&#039;username&#039;];
        $email = $pun_user[&#039;email&#039;];
    }

    // Otherwise it should be in $_POST
    else
    {
        $username = trim($_POST[&#039;req_username&#039;]);
        $email = strtolower(trim(($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039;) ? $_POST[&#039;req_email&#039;] : $_POST[&#039;email&#039;]));

        // Load the register.php/profile.php language files
        require PUN_ROOT.&#039;lang/&#039;.$pun_user[&#039;language&#039;].&#039;/prof_reg.php&#039;;
        require PUN_ROOT.&#039;lang/&#039;.$pun_user[&#039;language&#039;].&#039;/register.php&#039;;

        // It&#039;s a guest, so we have to validate the username
        if (strlen($username) &lt; 2)
            $errors[] = $lang_prof_reg[&#039;Username too short&#039;];
        else if (!strcasecmp($username, &#039;Guest&#039;) || !strcasecmp($username, $lang_common[&#039;Guest&#039;]))
            $errors[] = $lang_prof_reg[&#039;Username guest&#039;];
        else if (preg_match(&#039;/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/&#039;, $username))
            $errors[] = $lang_prof_reg[&#039;Username IP&#039;];

        if ((strpos($username, &#039;[&#039;) !== false || strpos($username, &#039;]&#039;) !== false) &amp;&amp; strpos($username, &#039;\&#039;&#039;) !== false &amp;&amp; strpos($username, &#039;&quot;&#039;) !== false)
            $errors[] = $lang_prof_reg[&#039;Username reserved chars&#039;];
        if (preg_match(&#039;#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i&#039;, $username))
            $errors[] = $lang_prof_reg[&#039;Username BBCode&#039;];

        // Check username for any censored words
        $temp = censor_words($username);
        if ($temp != $username)
            $errors[] = $lang_register[&#039;Username censor&#039;];

        // Check that the username (or a too similar username) is not already registered
        $result = $db-&gt;query(&#039;SELECT username FROM &#039;.$db-&gt;prefix.&#039;users WHERE username=\&#039;&#039;.$db-&gt;escape($username).&#039;\&#039; OR username=\&#039;&#039;.$db-&gt;escape(preg_replace(&#039;/[^\w]/&#039;, &#039;&#039;, $username)).&#039;\&#039;&#039;) or error(&#039;Unable to fetch user info&#039;, __FILE__, __LINE__, $db-&gt;error());
        if ($db-&gt;num_rows($result))
        {
            $busy = $db-&gt;result($result);
            $errors[] = $lang_register[&#039;Username dupe 1&#039;].&#039; &#039;.pun_htmlspecialchars($busy).&#039;. &#039;.$lang_register[&#039;Username dupe 2&#039;];
        }

        if ($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039; || $email != &#039;&#039;)
        {
            require PUN_ROOT.&#039;include/email.php&#039;;
            if (!is_valid_email($email))
                $errors[] = $lang_common[&#039;Invalid e-mail&#039;];
        }
    }

    // Clean up message from POST
    $message = pun_linebreaks(pun_trim($_POST[&#039;req_message&#039;]));

    if ($message == &#039;&#039;)
        $errors[] = $lang_chatbox[&#039;Error No message&#039;];
    else if (strlen($message) &gt; $pun_config[&#039;cb_msg_maxlength&#039;])
        $errors[] = $lang_chatbox[&#039;Error Too long message&#039;];
    else if ($pun_config[&#039;p_message_all_caps&#039;] == &#039;0&#039; &amp;&amp; strtoupper($message) == $message &amp;&amp; $pun_user[&#039;g_id&#039;] &gt; PUN_MOD)
        $message = ucwords(strtolower($message));

    // Validate BBCode syntax
    if ($pun_config[&#039;p_message_bbcode&#039;] == &#039;1&#039; &amp;&amp; strpos($message, &#039;[&#039;) !== false &amp;&amp; strpos($message, &#039;]&#039;) !== false)
    {
        $message = preparse_bbcode($message, $errors);
    }

    // Did everything go according to plan?
    if (empty($errors))
    {
    $now = time();

        if (!$pun_user[&#039;is_guest&#039;])
        {
            // Insert message
            $db-&gt;query(&#039;INSERT INTO &#039;.$db-&gt;prefix.&#039;chatbox_msg (poster, poster_id, poster_ip, message, posted) VALUES(\&#039;&#039;.$db-&gt;escape($username).&#039;\&#039;, &#039;.$pun_user[&#039;id&#039;].&#039;, \&#039;&#039;.get_remote_address().&#039;\&#039;, \&#039;&#039;.$db-&gt;escape($message).&#039;\&#039;, &#039;.$now.&#039;)&#039;) or error(&#039;Unable to post message&#039;, __FILE__, __LINE__, $db-&gt;error());

          // Increment his/her chatbox post count
              $low_prio = ($db_type == &#039;mysql&#039;) ? &#039;LOW_PRIORITY &#039; : &#039;&#039;;
              $db-&gt;query(&#039;UPDATE &#039;.$low_prio.$db-&gt;prefix.&#039;users SET num_posts_chatbox=num_posts_chatbox+1, last_post_chatbox=&#039;.$now.&#039; WHERE id=&#039;.$pun_user[&#039;id&#039;]) or error(&#039;Unable to update user&#039;, __FILE__, __LINE__, $db-&gt;error());

        }
        else
        {
            // Insert message
            $email_sql = ($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039; || $email != &#039;&#039;) ? &#039;\&#039;&#039;.$email.&#039;\&#039;&#039; : &#039;NULL&#039;;
            $db-&gt;query(&#039;INSERT INTO &#039;.$db-&gt;prefix.&#039;chatbox_msg (poster, poster_id, poster_ip, poster_email, message, posted) VALUES(\&#039;&#039;.$db-&gt;escape($username).&#039;\&#039;, &#039;.$pun_user[&#039;id&#039;].&#039;, \&#039;&#039;.get_remote_address().&#039;\&#039;, &#039;.$email_sql.&#039;, \&#039;&#039;.$db-&gt;escape($message).&#039;\&#039;, &#039;.$now.&#039;)&#039;) or error(&#039;Unable to post message&#039;, __FILE__, __LINE__, $db-&gt;error());
        }

    $count = $db-&gt;query(&#039;SELECT COUNT(id) FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg&#039;) or error(&#039;Unable to fetch chatbox post count&#039;, __FILE__, __LINE__, $db-&gt;error());
    $num_post = $db-&gt;result($count);

    $limit = ($num_post-$pun_config[&#039;cb_max_msg&#039;] &lt;= 0) ? 0 : $num_post-$pun_config[&#039;cb_max_msg&#039;];


    $result = $db-&gt;query(&#039;SELECT id,posted FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg ORDER BY posted ASC LIMIT &#039;.$limit) or error(&#039;Unable to select post to delete&#039;, __FILE__, __LINE__, $db-&gt;error());
    while ($del_msg = $db-&gt;fetch_assoc($result))
    {
      $db-&gt;query(&#039;DELETE FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg WHERE id = &#039;.$del_msg[&#039;id&#039;].&#039; LIMIT 1&#039;) or error(&#039;Unable to delete post&#039;, __FILE__, __LINE__, $db-&gt;error());
    }

      $_POST[&#039;req_message&#039;] = NULL;
  }

}

// If there are errors, we display them
if (!empty($errors))
{

?&gt;
&lt;div id=&quot;posterror&quot; class=&quot;block&quot;&gt;
    &lt;h2&gt;&lt;span&gt;&lt;?php echo $lang_post[&#039;Post errors&#039;] ?&gt;&lt;/span&gt;&lt;/h2&gt;
    &lt;div class=&quot;box&quot;&gt;
        &lt;div class=&quot;inbox&quot;&gt;
            &lt;p&gt;&lt;?php echo $lang_post[&#039;Post errors info&#039;] ?&gt;&lt;/p&gt;
            &lt;ul&gt;
&lt;?php

    while (list(, $cur_error) = each($errors))
        echo &quot;\t\t\t\t&quot;.&#039;&lt;li&gt;&lt;strong&gt;&#039;.$cur_error.&#039;&lt;/strong&gt;&lt;/li&gt;&#039;.&quot;\n&quot;;
?&gt;
            &lt;/ul&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;?php

}

?&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/prototype.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/chatbox.js&quot;&gt;&lt;/script&gt;
&lt;div class=&quot;block&quot;&gt;
  &lt;h2&gt;
    &lt;span&gt;
&lt;span class=&quot;conr&quot; &gt;&lt;img alt=&quot;&quot; style=&quot;display:none;&quot; id=&quot;loading&quot; src=&quot;img/loading.gif&quot; /&gt;&lt;/span&gt;
    
&lt;?php echo $lang_chatbox[&#039;Chatbox&#039;] ?&gt;&lt;/span&gt;
  &lt;/h2&gt;
    &lt;div class=&quot;box&quot;&gt;
        &lt;div id=&quot;chatbox&quot; class=&quot;inbox&quot; style=&quot;overflow:auto;height:&lt;?php echo $pun_config[&#039;cb_height&#039;] ?&gt;px;&quot;&gt;
&lt;?php

$cur_msg_txt = &#039;&#039;;
$last_msg_time = &#039;&#039;;
$count_id = array();

$result = $db-&gt;query(&#039;SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox, g.g_color FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg AS m INNER JOIN &#039;.$db-&gt;prefix.&#039;users AS u ON u.id=m.poster_id INNER JOIN &#039;.$db-&gt;prefix.&#039;groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT &#039;.$pun_config[&#039;cb_max_msg&#039;]) or error(&#039;Unable to fetch messages&#039;, __FILE__, __LINE__, $db-&gt;error());
$i = 0;
while ($cur_msg = $db-&gt;fetch_assoc($result))
  {
    $i++;
    if ($i == 1)
    {
        // Get newest timestamp
        $last_msg_time = $cur_msg[&#039;posted&#039;];
    }
    $cur_msg_txt = $pun_config[&#039;cb_space&#039;].$cur_msg[&#039;g_title_chatbox&#039;].$pun_config[&#039;cb_disposition&#039;].$cur_msg_txt;

if ($cur_msg[&#039;g_id&#039;] != PUN_GUEST)
        $cur_msg_txt = str_replace(&#039;&lt;pun_username&gt;&#039;, &#039;&lt;a href=&quot;profile.php?id=&#039;.$cur_msg[&#039;id&#039;].&#039;&quot;&gt;&lt;span style=&quot;color: &#039;.$cur_msg[&#039;g_color&#039;].&#039;&quot;&gt;&#039;.pun_htmlspecialchars($cur_msg[&#039;poster&#039;]).&#039;&lt;/span&gt;&lt;/a&gt;&#039;, $cur_msg_txt);
    else
      $cur_msg_txt = str_replace(&#039;&lt;pun_username&gt;&#039;, pun_htmlspecialchars($cur_msg[&#039;poster&#039;]), $cur_msg_txt);

    $cur_msg_txt = str_replace(&#039;&lt;pun_date&gt;&#039;, format_time($cur_msg[&#039;posted&#039;]), $cur_msg_txt);
    
        if ($cur_msg[&#039;g_id&#039;] != PUN_GUEST)
      $cur_msg_txt = str_replace(&#039;&lt;pun_nbpost&gt;&#039;, $cur_msg[&#039;num_posts_chatbox&#039;], $cur_msg_txt);
    else
    {

      if (!isset($count_id[$cur_msg[&#039;poster&#039;]]))
      {
        $like_command = ($db_type == &#039;pgsql&#039;) ? &#039;ILIKE&#039; : &#039;LIKE&#039;;
        
        $count = $db-&gt;query(&#039;SELECT COUNT(id) FROM &#039;.$db-&gt;prefix.&#039;chatbox_msg WHERE poster &#039;.$like_command.&#039; \&#039;&#039;.$db-&gt;escape(str_replace(&#039;*&#039;, &#039;%&#039;, $cur_msg[&#039;poster&#039;])).&#039;\&#039;&#039;) or error(&#039;Unable to fetch user chatbox post count&#039;, __FILE__, __LINE__, $db-&gt;error());
        $num_post = $db-&gt;result($count);
        $count_id[$cur_msg[&#039;poster&#039;]] = $num_post;
      }
      else
        $num_post = $count_id[$cur_msg[&#039;poster&#039;]];

      $cur_msg_txt = str_replace(&#039;&lt;pun_nbpost&gt;&#039;, $num_post, $cur_msg_txt);
    }

    $cur_msg_txt = str_replace(&#039;&lt;pun_nbpost_txt&gt;&#039;, $lang_chatbox[&#039;Posts&#039;], $cur_msg_txt);

        if ($pun_user[&#039;g_id&#039;] &lt; PUN_GUEST)
      {
      $cur_msg_admin = &#039; [ &lt;a href=&quot;chatbox.php?del=&#039;.$cur_msg[&#039;m_id&#039;].&#039;&quot;&gt;Delete&lt;/a&gt; | &lt;a href=&quot;chatbox.php?get_host=&#039;.$cur_msg[&#039;m_id&#039;].&#039;&quot;&gt;&#039;.$cur_msg[&#039;poster_ip&#039;].&#039;&lt;/a&gt;&#039;;
      if ($cur_msg[&#039;poster_email&#039;])
              $cur_msg_admin .= &#039; | &lt;a href=&quot;mailto:&#039;.$cur_msg[&#039;poster_email&#039;].&#039;&quot;&gt;&#039;.$lang_common[&#039;E-mail&#039;].&#039;&lt;/a&gt; ]&#039;;
          else
            $cur_msg_admin .= &#039; ] &#039;;
        }
    else
      $cur_msg_admin = &#039;&#039;;

      $cur_msg_txt = str_replace(&#039;&lt;pun_admin&gt;&#039;, $cur_msg_admin, $cur_msg_txt);
      $cur_msg_txt = str_replace(&#039;&lt;pun_message&gt;&#039;, parse_message($cur_msg[&#039;message&#039;], 0), $cur_msg_txt);

  }
if (!$cur_msg_txt)
  echo $lang_chatbox[&#039;No Message&#039;];
else
  echo &quot;\t\t\t&quot;.$cur_msg_txt.&quot;\n&quot;;
?&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    
&lt;?php
if ($pun_user[&#039;g_post_chatbox&#039;] == &#039;1&#039;)
  {
    $cur_index = 1;
  ?&gt;
            &lt;form id=&quot;post&quot; method=&quot;post&quot; name=&quot;post&quot; action=&quot;chatbox.php&quot;&gt;

         &lt;input type=&quot;hidden&quot; name=&quot;form_sent&quot; value=&quot;1&quot; /&gt;
         &lt;input type=&quot;hidden&quot; name=&quot;form_user&quot; id=&quot;form_user&quot; value=&quot;&lt;?php echo (!$pun_user[&#039;is_guest&#039;]) ? pun_htmlspecialchars($pun_user[&#039;username&#039;]) : &#039;Guest&#039;; ?&gt;&quot; /&gt;
&lt;?php

if ($pun_user[&#039;is_guest&#039;])
{
    $email_label = ($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039;) ? &#039;&lt;strong&gt;&#039;.$lang_common[&#039;E-mail&#039;].&#039;:&lt;/strong&gt;&#039; : $lang_common[&#039;E-mail&#039;];
    $email_form_name = ($pun_config[&#039;p_force_guest_email&#039;] == &#039;1&#039;) ? &#039;req_email&#039; : &#039;email&#039;;

    if($email_form_name = &#039;req_email&#039;)
        echo &quot;\t&quot;.&#039;&lt;input type=&quot;hidden&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;&quot; /&gt;&#039;.&quot;\n&quot;;
    else
        echo &quot;\t&quot;.&#039;&lt;input type=&quot;hidden&quot; name=&quot;req_email&quot; id=&quot;req_email&quot; value=&quot;&quot; /&gt;&#039;.&quot;\n&quot;;

?&gt;
          &lt;strong&gt;&lt;?php echo $lang_post[&#039;Guest name&#039;] ?&gt;:&lt;/strong&gt;&lt;br /&gt;&lt;input class=&quot;textbox&quot; type=&quot;text&quot; name=&quot;req_username&quot; id=&quot;req_username&quot; value=&quot;&lt;?php if (isset($_POST[&#039;req_username&#039;])) echo pun_htmlspecialchars($username); ?&gt;&quot; size=&quot;20&quot; maxlength=&quot;25&quot; tabindex=&quot;&lt;?php echo $cur_index++ ?&gt;&quot; /&gt; 
          &lt;?php echo $email_label ?&gt; &lt;input class=&quot;textbox&quot; type=&quot;text&quot; name=&quot;&lt;?php echo $email_form_name ?&gt;&quot; id=&quot;&lt;?php echo $email_form_name ?&gt;&quot; value=&quot;&lt;?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?&gt;&quot; size=&quot;20&quot; maxlength=&quot;50&quot; tabindex=&quot;&lt;?php echo $cur_index++ ?&gt;&quot; /&gt;&lt;br /&gt; 
&lt;?php

}
else
{
?&gt;
          &lt;input type=&quot;hidden&quot; name=&quot;req_username&quot; id=&quot;req_username&quot; value=&quot;&quot; /&gt; 
          &lt;input type=&quot;hidden&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;&quot; /&gt; 
          &lt;input type=&quot;hidden&quot; name=&quot;req_email&quot; id=&quot;req_email&quot; value=&quot;&quot; /&gt;

&lt;?php

}

?&gt;&lt;br /&gt;
&lt;div id=&quot;posterror2&quot; class=&quot;block&quot;&gt;
    &lt;h2&gt;&lt;span&gt;&lt;?php echo $lang_common[&#039;Message&#039;] ?&gt;&lt;/span&gt;&lt;/h2&gt;
    &lt;div class=&quot;box&quot;&gt;
        &lt;div style=&quot;padding: 10px 15px 10px 10px;&quot; class=&quot;inbox&quot;&gt;
                        &lt;textarea name=&quot;req_message&quot; id=&quot;req_message&quot; class=&quot;textbox&quot; rows=&quot;20&quot; style=&quot;width: 100%;&quot; tabindex=&quot;&lt;?php echo $cur_index++ ?&gt;&quot;&gt;&lt;?php echo isset($_POST[&#039;req_message&#039;]) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : &#039;&#039;); ?&gt;&lt;/textarea&gt;&lt;br /&gt;
&lt;?php /* punToolBar */
if (file_exists(PUN_ROOT.&#039;cache/cache_puntoolbar.php&#039;)) {
    include PUN_ROOT.&#039;cache/cache_puntoolbar.php&#039;;
} else {
    require_once PUN_ROOT.&#039;include/cache_puntoolbar.php&#039;;
    generate_ptb_cache();
    require PUN_ROOT.&#039;cache/cache_puntoolbar.php&#039;;
}
?&gt;
             &lt;br /&gt;&lt;strong&gt;&lt;?php echo $lang_chatbox[&#039;Message&#039;] ?&gt;:&lt;/strong&gt; 

             &lt;input class=&quot;button&quot; type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;&lt;?php echo $lang_chatbox[&#039;Btn Send&#039;] ?&gt;&quot; accesskey=&quot;s&quot; tabindex=&quot;&lt;?php echo $cur_index++ ?&gt;&quot; /&gt;
&lt;br /&gt;
Be Smart. Don&#039;t post personal information about yourself, your phone number, or your address in Chat.

&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
    &lt;div style=&quot;padding: 5px;&quot; class=&quot;box&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    &lt;!--
    // This button is utterly useless, unless we have javascript enabled. As such, we won&#039;t display it until then.
    document.write(&#039;&lt;?php echo $lang_chatbox[&#039;Autoscroll&#039;] ?&gt;: &lt;input type=&quot;checkbox&quot; id=&quot;autoscroll&quot; value=&quot;&quot; checked  tabindex=&quot;&lt;?php echo $cur_index++ ?&gt;&quot; /&gt;&#039;);

document.getElementById(&quot;post&quot;).req_message.focus();

    // --&gt;
    &lt;/script&gt;&lt;/div&gt;
    &lt;/form&gt;
  &lt;?php
  }
else
  echo $lang_chatbox[&#039;No Post Permission&#039;];
?&gt;
&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
    // Begin getting messages
    var LastMsg = &#039;&lt;?php echo $last_msg_time; ?&gt;&#039;;
    $(&#039;autoscroll&#039;).value = &#039;true&#039;;
    get_messages();
    checker = new PeriodicalExecuter(get_messages, &lt;?php echo $pun_config[&#039;cb_ajax_refresh&#039;]; ?&gt;);
&lt;/script&gt;

&lt;?php

require PUN_ROOT.&#039;footer.php&#039;;</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[MCommunity]]></name>
				<uri>http://punbb.informer.com/forums/user/18694/</uri>
			</author>
			<updated>2009-11-14T07:40:37Z</updated>
			<id>http://punbb.informer.com/forums/topic/22516/chatbox-question-about-security/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[BBcode question]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/22424/bbcode-question/new/posts/"/>
			<summary type="html"><![CDATA[<p>i want to ask is there have someone know how to make a private bbcode?<br />for example [private]text[/private]. with this bbcode, only registered user can read it.</p>]]></summary>
			<author>
				<name><![CDATA[MCommunity]]></name>
				<uri>http://punbb.informer.com/forums/user/18694/</uri>
			</author>
			<updated>2009-10-30T11:07:40Z</updated>
			<id>http://punbb.informer.com/forums/topic/22424/bbcode-question/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How do I get this template onto my punbb forums?]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/22375/how-do-i-get-this-template-onto-my-punbb-forums/new/posts/"/>
			<summary type="html"><![CDATA[<p>It&#039;s called &quot;php subsilver&quot;</p><p>It&#039;s really nice... I want it on my punbb forums</p><p>My version is 1.2.17</p><p>can someone link me to a DL? D;</p><p>And tell me how to download or link me to a tut?</p>]]></summary>
			<author>
				<name><![CDATA[tomjacko]]></name>
				<uri>http://punbb.informer.com/forums/user/13088/</uri>
			</author>
			<updated>2009-10-29T17:32:45Z</updated>
			<id>http://punbb.informer.com/forums/topic/22375/how-do-i-get-this-template-onto-my-punbb-forums/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[[ASK] Adding Image To Header PunBB 1.2.x]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/22391/ask-adding-image-to-header-punbb-12x/new/posts/"/>
			<summary type="html"><![CDATA[<p>How i can change the header?</p><p>Thx...</p>]]></summary>
			<author>
				<name><![CDATA[Slavok]]></name>
				<uri>http://punbb.informer.com/forums/user/15575/</uri>
			</author>
			<updated>2009-10-29T14:33:12Z</updated>
			<id>http://punbb.informer.com/forums/topic/22391/ask-adding-image-to-header-punbb-12x/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Integrating logins]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/4932/integrating-logins/new/posts/"/>
			<summary type="html"><![CDATA[<p>I&#039;m trying to integrate punBB into my own site, and it is going well, howver I do not wish to have two seperate registrations and logins.&nbsp; I was wondering if anyone else out there has had experience with integrating their own registrations and logins with punBB.&nbsp; Has anyone developed a mod for something like this?</p><p>Thanks!<br />-Geoff</p>]]></summary>
			<author>
				<name><![CDATA[tommi]]></name>
				<uri>http://punbb.informer.com/forums/user/2042/</uri>
			</author>
			<updated>2009-10-24T10:09:45Z</updated>
			<id>http://punbb.informer.com/forums/topic/4932/integrating-logins/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Change button style]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/19254/change-button-style/new/posts/"/>
			<summary type="html"><![CDATA[<p>I have made a class for all the buttons, but I&#039;m having problem with the &quot;Go&quot; button for Jump To forum in the footer.&nbsp; I have inserted a class in the cache.php, but the class still does not come up.&nbsp; I&#039;m wondering if there is another place that I need to insert the class.&nbsp; Thanks for you help</p>]]></summary>
			<author>
				<name><![CDATA[saadulla89]]></name>
				<uri>http://punbb.informer.com/forums/user/13185/</uri>
			</author>
			<updated>2009-10-15T02:17:38Z</updated>
			<id>http://punbb.informer.com/forums/topic/19254/change-button-style/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[nice urls / mod_rewrite / seo]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/7340/nice-urls-modrewrite-seo/new/posts/"/>
			<summary type="html"><![CDATA[<p>Hello,<br />i want to release my first mod to the community.<br />Search Engines like Google don&#039;t like URLs like:<br /><strong>viewtopic.php?id=123</strong><br />With my mod the URLs look like:<br /><strong>heading-of-the-topic-vt123.php</strong></p><p>Profiles are flx-vp123.php</p><p>To avoid duplicate content lots of things are disallowed in robots.txt.</p><p>You can see this mod in action on <strong><a href="http://www.html-forum.net">http://www.html-forum.net</a></strong> (german)<br />robots.txt is <a href="http://www.html-forum.net/robots.txt">here</a>.</p><p>Installation will probably take ~5 minutes.</p><p>It will be released tomorrow.</p><p>I&#039;d like some feedback <img src="http://punbb.informer.com/forums/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>Greetz,<br />flx</p>]]></summary>
			<author>
				<name><![CDATA[saadulla89]]></name>
				<uri>http://punbb.informer.com/forums/user/3466/</uri>
			</author>
			<updated>2009-10-15T01:16:39Z</updated>
			<id>http://punbb.informer.com/forums/topic/7340/nice-urls-modrewrite-seo/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[multilanguage forum and category names and forum descriptions]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/19456/multilanguage-forum-and-category-names-and-forum-descriptions/new/posts/"/>
			<summary type="html"><![CDATA[<p>multilanguage forum and category names and forum descriptions: <a href="http://www.punres.org/viewtopic.php?id=4876">http://www.punres.org/viewtopic.php?id=4876</a></p><p>see also <a href="http://punbb.informer.com/forums/topic/19369/punbb-tatar-language-pack/">http://punbb.informer.com/forums/topic/ &#133; uage-pack/</a></p><p>also here one more related mod made by me:<br /><a href="http://www.punres.org/viewtopic.php?id=4858">http://www.punres.org/viewtopic.php?id=4858</a> &quot;guest language change&quot;</p><p>you can see them both at <a href="http://tmforum.awardspace.com">http://tmforum.awardspace.com</a></p>]]></summary>
			<author>
				<name><![CDATA[saadulla89]]></name>
				<uri>http://punbb.informer.com/forums/user/13314/</uri>
			</author>
			<updated>2009-10-15T01:14:04Z</updated>
			<id>http://punbb.informer.com/forums/topic/19456/multilanguage-forum-and-category-names-and-forum-descriptions/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Thank You MOD]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/17714/thank-you-mod/new/posts/"/>
			<summary type="html"><![CDATA[<p>I want to kindly request a ThankYou MOD for PunBB. There should be a html &quot;Thank you&quot; link below each post. Guests, Members, Mods and Admins (all) should be able to click those thank you links below each post if they like the post and want to show their appreciation. If Guests click the link for a post, it should show below that post: &quot;X Guest(s) say(s): Thank you.&quot; X is the number of guests who have clicked thanks for that particular post. And if members or mods or admin click the Thank you link, it should show their names, &quot;Username1, Username2... say(s): Thank you.&quot; where username1, username2 etc. are the usernames of the logged in members who click thank you for that post.</p><p>Both vBulletin and Phpbb have a Thank You mod and I found previously that it is greatly used by the forum members. It was one of the most popular MODs I had. They normally don&#039;t want to type a reply to a post but still they say thank you on so many posts. It is very encouraging to the posters also and promotes more participation and gives a community feeling. Can anyone kindly design this MOD? Thank you.</p>]]></summary>
			<author>
				<name><![CDATA[saadulla89]]></name>
				<uri>http://punbb.informer.com/forums/user/11629/</uri>
			</author>
			<updated>2009-10-12T23:00:53Z</updated>
			<id>http://punbb.informer.com/forums/topic/17714/thank-you-mod/new/posts/</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Request style "Crystal Blue"]]></title>
			<link rel="alternate" href="http://punbb.informer.com/forums/topic/22344/request-style-crystal-blue/new/posts/"/>
			<summary type="html"><![CDATA[<p>Request style &quot;Crystal Blue&quot;!</p><p>Thanks!</p>]]></summary>
			<author>
				<name><![CDATA[x6IT32]]></name>
				<uri>http://punbb.informer.com/forums/user/21824/</uri>
			</author>
			<updated>2009-10-06T17:36:46Z</updated>
			<id>http://punbb.informer.com/forums/topic/22344/request-style-crystal-blue/new/posts/</id>
		</entry>
</feed>
