Index: branches/rsr.v5.1.dev/web/punbb/help.php
===================================================================
--- branches/rsr.v5.1.dev/web/punbb/help.php	(revision 1)
+++ branches/rsr.v5.1.dev/web/punbb/help.php	(revision 3)
@@ -1,31 +1,14 @@
 <?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
-
-************************************************************************/
-
+/**
+ * Copyright (C) 2008-2011 FluxBB
+ * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
+ * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
+ */
 
 // Tell header.php to use the help template
 define('PUN_HELP', 1);
 
-define('PUN_ROOT', './');
+define('PUN_ROOT', dirname(__FILE__).'/');
 require PUN_ROOT.'include/common.php';
 
@@ -39,122 +22,130 @@
 
 
-$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$lang_help['Help'];
+$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_help['Help']);
+define('PUN_ACTIVE_PAGE', 'help');
 require PUN_ROOT.'header.php';
 
 ?>
-<h2><?php echo $lang_common['BBCode'] ?></h2>
+<h2><span><?php echo $lang_help['BBCode'] ?></span></h2>
 <div class="box">
 	<div class="inbox">
-		<p><a name="bbcode"></a><?php echo $lang_help['BBCode info 1'] ?></p><br />
+		<p><a name="bbcode"></a><?php echo $lang_help['BBCode info 1'] ?></p>
 		<p><?php echo $lang_help['BBCode info 2'] ?></p>
 	</div>
 </div>
-<h2><?php echo $lang_help['Text style'] ?></h2>
+<h2><span><?php echo $lang_help['Text style'] ?></span></h2>
 <div class="box">
-	<p><?php echo $lang_help['Text style info'] ?></p><br />
-	<div style="padding-left: 4px">
-		[b]<?php echo $lang_help['Bold text'] ?>[/b] <?php echo $lang_help['produces'] ?> <b><?php echo $lang_help['Bold text'] ?></b><br />
-		[u]<?php echo $lang_help['Underlined text'] ?>[/u] <?php echo $lang_help['produces'] ?> <span class="bbu"><?php echo $lang_help['Underlined text'] ?></span><br />
-		[i]<?php echo $lang_help['Italic text'] ?>[/i] <?php echo $lang_help['produces'] ?> <i><?php echo $lang_help['Italic text'] ?></i><br />
-		[color=#FF0000]<?php echo $lang_help['Red text'] ?>[/color] <?php echo $lang_help['produces'] ?> <span style="color: #ff0000"><?php echo $lang_help['Red text'] ?></span><br />
-		[color=blue]<?php echo $lang_help['Blue text'] ?>[/color] <?php echo $lang_help['produces'] ?> <span style="color: blue"><?php echo $lang_help['Blue text'] ?></span>
+	<div class="inbox">
+		<p><?php echo $lang_help['Text style info'] ?></p>
+		<p><code>[b]<?php echo $lang_help['Bold text'] ?>[/b]</code> <?php echo $lang_help['produces'] ?> <samp><strong><?php echo $lang_help['Bold text'] ?></strong></samp></p>
+		<p><code>[u]<?php echo $lang_help['Underlined text'] ?>[/u]</code> <?php echo $lang_help['produces'] ?> <samp><span class="bbu"><?php echo $lang_help['Underlined text'] ?></span></samp></p>
+		<p><code>[i]<?php echo $lang_help['Italic text'] ?>[/i]</code> <?php echo $lang_help['produces'] ?> <samp><em><?php echo $lang_help['Italic text'] ?></em></samp></p>
+		<p><code>[s]<?php echo $lang_help['Strike-through text'] ?>[/s]</code> <?php echo $lang_help['produces'] ?> <samp><span class="bbs"><?php echo $lang_help['Strike-through text'] ?></span></samp></p>
+		<p><code>[del]<?php echo $lang_help['Deleted text'] ?>[/del]</code> <?php echo $lang_help['produces'] ?> <samp><del><?php echo $lang_help['Deleted text'] ?></del></samp></p>
+		<p><code>[ins]<?php echo $lang_help['Inserted text'] ?>[/ins]</code> <?php echo $lang_help['produces'] ?> <samp><ins><?php echo $lang_help['Inserted text'] ?></ins></samp></p>
+		<p><code>[em]<?php echo $lang_help['Emphasised text'] ?>[/em]</code> <?php echo $lang_help['produces'] ?> <samp><em><?php echo $lang_help['Emphasised text'] ?></em></samp></p>
+		<p><code>[color=#FF0000]<?php echo $lang_help['Red text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <samp><span style="color: #ff0000"><?php echo $lang_help['Red text'] ?></span></samp></p>
+		<p><code>[color=blue]<?php echo $lang_help['Blue text'] ?>[/color]</code> <?php echo $lang_help['produces'] ?> <samp><span style="color: blue"><?php echo $lang_help['Blue text'] ?></span></samp></p>
+		<p><code>[h]<?php echo $lang_help['Heading text'] ?>[/h]</code> <?php echo $lang_help['produces'] ?></p> <div class="postmsg"><h5><?php echo $lang_help['Heading text'] ?></h5></div>
 	</div>
 </div>
-<h2><?php echo $lang_help['Links and images'] ?></h2>
+<h2><span><?php echo $lang_help['Links and images'] ?></span></h2>
 <div class="box">
-	<p><?php echo $lang_help['Links info'] ?></p><br />
-	<div style="padding-left: 4px">
-		[url=<?php echo $pun_config['o_base_url'].'/' ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url] <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'].'/' ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a><br />
-		[url]<?php echo $pun_config['o_base_url'].'/' ?>[/url] <?php echo $lang_help['produces'] ?> <a href="<?php echo $pun_config['o_base_url'] ?>"><?php echo $pun_config['o_base_url'].'/' ?></a><br />
-		[email]myname@mydomain.com[/email] <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com">myname@mydomain.com</a><br />
-		[email=myname@mydomain.com]<?php echo $lang_help['My e-mail address'] ?>[/email] <?php echo $lang_help['produces'] ?> <a href="mailto:myname@mydomain.com"><?php echo $lang_help['My e-mail address'] ?></a><br /><br />
+	<div class="inbox">
+		<p><?php echo $lang_help['Links info'] ?></p>
+		<p><code>[url=<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>]<?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a></samp></p>
+		<p><code>[url]<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/') ?></a></samp></p>
+		<p><code>[url=/help.php]<?php echo $lang_help['This help page'] ?>[/url]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo get_base_url(true).'/help.php' ?>"><?php echo $lang_help['This help page'] ?></a></samp></p>
+		<p><code>[email]myname@mydomain.com[/email]</code> <?php echo $lang_help['produces'] ?> <samp><a href="mailto:myname@mydomain.com">myname@mydomain.com</a></samp></p>
+		<p><code>[email=myname@mydomain.com]<?php echo $lang_help['My email address'] ?>[/email]</code> <?php echo $lang_help['produces'] ?> <samp><a href="mailto:myname@mydomain.com"><?php echo $lang_help['My email address'] ?></a></samp></p>
+		<p><code>[topic=1]<?php echo $lang_help['Test topic'] ?>[/topic]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?id=1') ?>"><?php echo $lang_help['Test topic'] ?></a></samp></p>
+		<p><code>[topic]1[/topic]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?id=1') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?id=1') ?></a></samp></p>
+		<p><code>[post=1]<?php echo $lang_help['Test post'] ?>[/post]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?pid=1#p1') ?>"><?php echo $lang_help['Test post'] ?></a></samp></p>
+		<p><code>[post]1[/post]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?pid=1#p1') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/viewtopic.php?pid=1#p1') ?></a></samp></p>
+		<p><code>[forum=1]<?php echo $lang_help['Test forum'] ?>[/forum]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewforum.php?id=1') ?>"><?php echo $lang_help['Test forum'] ?></a></samp></p>
+		<p><code>[forum]1[/forum]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/viewforum.php?id=1') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/viewforum.php?id=1') ?></a></samp></p>
+		<p><code>[user=2]<?php echo $lang_help['Test user'] ?>[/user]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/profile.php?id=2') ?>"><?php echo $lang_help['Test user'] ?></a></samp></p>
+		<p><code>[user]2[/user]</code> <?php echo $lang_help['produces'] ?> <samp><a href="<?php echo pun_htmlspecialchars(get_base_url(true).'/profile.php?id=2') ?>"><?php echo pun_htmlspecialchars(get_base_url(true).'/profile.php?id=2') ?></a></samp></p>
 	</div>
-	<p><a name="img"></a><?php echo $lang_help['Images info'] ?></p>
-	<div>[img]http://www.punbb.org/img/small_logo.png[/img] <?php echo $lang_help['produces'] ?> <img src="http://www.punbb.org/img/small_logo.png" alt="http://www.punbb.org/img/small_logo.png" /></div>
+	<div class="inbox">
+		<p><a name="img"></a><?php echo $lang_help['Images info'] ?></p>
+		<p><code>[img=<?php echo $lang_help['FluxBB bbcode test'] ?>]<?php echo pun_htmlspecialchars(get_base_url(true)) ?>/img/test.png[/img]</code> <?php echo $lang_help['produces'] ?> <samp><img style="height: 21px" src="<?php echo pun_htmlspecialchars(get_base_url(true)) ?>/img/test.png" alt="<?php echo $lang_help['FluxBB bbcode test'] ?>" /></samp></p>
+	</div>
 </div>
-<h2><?php echo $lang_help['Quotes'] ?></h2>
+<h2><span><?php echo $lang_help['Quotes'] ?></span></h2>
 <div class="box">
-	<div style="padding-left: 4px">
-		<?php echo $lang_help['Quotes info'] ?><br /><br />
-		&#160;&#160;&#160;&#160;[quote=James]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br />
-		<?php echo $lang_help['produces quote box'] ?><br /><br />
+	<div class="inbox">
+		<p><?php echo $lang_help['Quotes info'] ?></p>
+		<p><code>[quote=James]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p>
+		<p><?php echo $lang_help['produces quote box'] ?></p>
 		<div class="postmsg">
-			<blockquote><div class="incqbox"><h4>James <?php echo $lang_common['wrote'] ?>:</h4><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote>
+			<div class="quotebox"><cite>James <?php echo $lang_common['wrote'] ?></cite><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div>
 		</div>
-		<br />
-		<?php echo $lang_help['Quotes info 2'] ?><br /><br />
-		&#160;&#160;&#160;&#160;[quote]<?php echo $lang_help['Quote text'] ?>[/quote]<br /><br />
-		<?php echo $lang_help['produces quote box'] ?><br /><br />
+		<p><?php echo $lang_help['Quotes info 2'] ?></p>
+		<p><code>[quote]<?php echo $lang_help['Quote text'] ?>[/quote]</code></p>
+		<p><?php echo $lang_help['produces quote box'] ?></p>
 		<div class="postmsg">
-			<blockquote><div class="incqbox"><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote>
+			<div class="quotebox"><blockquote><div><p><?php echo $lang_help['Quote text'] ?></p></div></blockquote></div>
+		</div>
+		<p><?php echo $lang_help['quote note'] ?></p>
+	</div>
+</div>
+<h2><span><?php echo $lang_help['Code'] ?></span></h2>
+<div class="box">
+	<div class="inbox">
+		<p><?php echo $lang_help['Code info'] ?></p>
+		<p><code>[code]<?php echo $lang_help['Code text'] ?>[/code]</code></p>
+		<p><?php echo $lang_help['produces code box'] ?></p>
+		<div class="postmsg">
+			<div class="codebox"><pre><code><?php echo $lang_help['Code text'] ?></code></pre></div>
 		</div>
 	</div>
 </div>
-<h2><?php echo $lang_help['Code'] ?></h2>
+<h2><span><?php echo $lang_help['Lists'] ?></span></h2>
 <div class="box">
-	<div style="padding-left: 4px">
-		<?php echo $lang_help['Code info'] ?><br /><br />
-		&#160;&#160;&#160;&#160;[code]<?php echo $lang_help['Code text'] ?>[/code]<br /><br />
-		<?php echo $lang_help['produces code box'] ?><br /><br />
+	<div class="inbox">
+		<p><a name="lists"></a><?php echo $lang_help['List info'] ?></p>
+		<p><code>[list][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code>
+		<br /><span><?php echo $lang_help['produces list'] ?></span></p>
 		<div class="postmsg">
-			<div class="codebox"><div class="incqbox"><h4><?php echo $lang_common['Code'] ?>:</h4><div class="scrollbox" style="height: 4.5em"><pre><?php echo $lang_help['Code text'] ?></pre></div></div></div>
+			<ul><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ul>
+		</div>
+		<p><code>[list=1][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code>
+		<br /><span><?php echo $lang_help['produces decimal list'] ?></span></p>
+		<div class="postmsg">
+			<ol class="decimal"><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ol>
+		</div>
+		<p><code>[list=a][*]<?php echo $lang_help['List text 1'] ?>[/*][*]<?php echo $lang_help['List text 2'] ?>[/*][*]<?php echo $lang_help['List text 3'] ?>[/*][/list]</code>
+		<br /><span><?php echo $lang_help['produces alpha list'] ?></span></p>
+		<div class="postmsg">
+			<ol class="alpha"><li><p><?php echo $lang_help['List text 1'] ?></p></li><li><p><?php echo $lang_help['List text 2'] ?></p></li><li><p><?php echo $lang_help['List text 3'] ?></p></li></ol>
 		</div>
 	</div>
 </div>
-<h2><?php echo $lang_help['Nested tags'] ?></h2>
+<h2><span><?php echo $lang_help['Nested tags'] ?></span></h2>
 <div class="box">
-	<div style="padding-left: 4px">
-		<?php echo $lang_help['Nested tags info'] ?><br /><br />
-		&#160;&#160;&#160;&#160;[b][u]<?php echo $lang_help['Bold, underlined text'] ?>[/u][/b] <?php echo $lang_help['produces'] ?> <span class="bbu"><b><?php echo $lang_help['Bold, underlined text'] ?></b></span><br /><br />
+	<div class="inbox">
+		<p><?php echo $lang_help['Nested tags info'] ?></p>
+		<p><code>[b][u]<?php echo $lang_help['Bold, underlined text'] ?>[/u][/b]</code> <?php echo $lang_help['produces'] ?> <samp><strong><span class="bbu"><?php echo $lang_help['Bold, underlined text'] ?></span></strong></samp></p>
 	</div>
 </div>
-<h2><?php echo $lang_common['Smilies'] ?></h2>
+<h2><span><?php echo $lang_help['Smilies'] ?></span></h2>
 <div class="box">
-	<div style="padding-left: 4px">
-		<a name="smilies"></a><?php echo $lang_help['Smilies info'] ?><br /><br />
+	<div class="inbox">
+		<p><a name="smilies"></a><?php echo $lang_help['Smilies info'] ?></p>
 <?php
 
 // Display the smiley set
-@include_once PUN_ROOT.'cache/cache_smilies.php';
-if (!defined('PUN_CACHE_SMILEY'))
-{
-	require_once PUN_ROOT.'include/cache_smilies.php';
-	generate_smiley_cache();
-	require PUN_ROOT.'cache/cache_smilies.php';
-}
+require PUN_ROOT.'include/parser.php';
 
-$num_smilies = count($smiley_text);
-for ($i = 0; $i < $num_smilies; ++$i)
-{
-	// Is there a smiley at the current index?
-	if (!isset($smiley_text[$i]))
-		continue;
+$smiley_groups = array();
 
-	echo "\t\t".'&#160;&#160;&#160;&#160;'.$smiley_text[$i];
+foreach ($smilies as $smiley_text => $smiley_img)
+	$smiley_groups[$smiley_img][] = $smiley_text;
 
-	// Save the current text and image
-	$cur_img = $smiley_img[$i];
-	$cur_text = $smiley_text[$i];
-
-	// Loop through the rest of the array and see if there are any duplicate images
-	// (more than one text representation for one image)
-	for ($next = $i + 1; $next < $num_smilies; ++$next)
-	{
-		// Did we find a dupe?
-		if (isset($smiley_img[$next]) && $smiley_img[$i] == $smiley_img[$next])
-		{
-			echo ' '.$lang_common['and'].' '.$smiley_text[$next];
-
-			// Remove the dupe so we won't display it twice
-			unset($smiley_text[$next]);
-			unset($smiley_img[$next]);
-		}
-	}
-
-	echo ' '.$lang_help['produces'].' <img src="img/smilies/'.$cur_img.'" alt="'.$cur_text.'" /><br />'."\n";
-}
+foreach ($smiley_groups as $smiley_img => $smiley_texts)
+	echo "\t\t".'<p><code>'.implode('</code> '.$lang_common['and'].' <code>', $smiley_texts).'</code> <span>'.$lang_help['produces'].'</span> <samp><img src="'.pun_htmlspecialchars(get_base_url(true)).'/img/smilies/'.$smiley_img.'" width="15" height="15" alt="'.$smiley_texts[0].'" /></samp></p>'."\n";
 
 ?>
-		<br />
 	</div>
 </div>
