tag even though the html does not have any bugs.
Is there a way to tell the parser to stop trying to sanitize the html output? It is rendering the html invalid. To me this looks like a bug.
MediaWiki 1.16.0 PHP 5.2.14 (cgi) MySQL 5.1.48
Here is the code: the closingafter the
at the end of the while statement is getting chopped off.
<?php
/*
* Installation:
* require_once("extensions/PHPBB_ShowForum/PHPBB_ShowForum.php"); in LocalSettings.php
* update $phpbbDBSERVER, $phpbbDBUSER, $phpbbDBUSERPW, $phpbbDBNAME, $phpbb_home, $phpbb_icon_path
* Usage:
* <phpbb_forum>forumID|Number of post|Background Color</phpbb_forum>
*
* @version 0.2 marcolino7
*
* 0.2 - Added Path for the Icon
* Disabled Caching
* 0.1 - Initial Release
*
* http://www.mediawiki.org/wiki/Extension:PHPBB_ShowForum
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" );
die( -1 );
}
// Extension credits that will show up on Special:Version
$wgExtensionCredits['parserhook']['PHPBB_ShowForum'] = array(
'name' => 'PHPBB Show Forum',
'version' => '0.2',
'author' => 'marcolino7, [http://www.mediawiki.org/wiki/User:Marcolino7]',
'description' => 'Link to Show PHPBB Forum in MediaWiki',
'url' => ''
);
$wgExtensionFunctions[] = "wfPHPBBExtension";
function wfPHPBBExtension() {
global $wgParser;
$wgParser->setHook( "phpbb_forum", "showForum" );
}
function showForum( $input, $argv, &$parser) {
$phpbbDBSERVER="localhost";
$phpbbDBUSER="DBUser";
$phpbbDBUSERPW="DBPassword";
$phpbbDBNAME="DBname";
$phpbbDBPrefix="phpbb_";
$phpbb_home = "<your forum home>";
$phpbb_icon_path = "templates/subSilver/images/folder.gif";
# --------------------------------------------
//Disabling Cache
$parser->disableCache();
//Split input in 2 Parameters
list($forumID, $topicID, $postLimit) = split('[|.-]', $input);
$link = mysql_connect($phpbbDBSERVER,$phpbbDBUSER ,$phpbbDBUSERPW);
if ( !$link ) { return "<hr><b>Error while connecting to host \"$phpbbDBSERVER\" !</b><hr>"; }
$db_selected = mysql_select_db($phpbbDBNAME, $link);
if (!$db_selected) {return "<hr><b>Error while selecting database \"$phpbbDBNAME\" !</b><hr>"; }
$sql = "SELECT p.post_subject, p.post_text, p.topic_id, p.post_id, p.post_time, p.forum_id,
p.post_username, u.username as user, u.user_id as id, u.user_avatar as avatar, u.user_avatar_width as width, u.user_avatar_height as height
FROM
". $phpbbDBPrefix ."posts AS p,
". $phpbbDBPrefix ."users AS u
WHERE p.topic_id in ( $topicID )
AND p.poster_id = u.user_id
AND p.forum_id in ( $forumID )
ORDER BY p.post_id DESC
LIMIT 0, $postLimit";
$qryres = mysql_query($sql);
if (!$qryres) { return "<hr><b>Error while MySQL Query :". mysql_error() ;}
$out = "<div id=\"comments\"><h3>Comments</h3><ol class=\"commentlist\">";
$row_count = 0;
//Cycle inside recordset and populate page
while ($row = mysql_fetch_row($qryres))
{
$out = $out . "<li class=\"comment byuser comment-author even thread-even depth-1\" id=\"li-comment\">
<div id=\"comment\"><div class=\"comment-author vcard\">
<img alt='' src=\"".$phpbb_home."download/file.php?".$row[9]."\" class=\"avatar avatar-40 photo\" height=\"".$row[11]."\" width=\"".$row[10]."\" />
<cite class=\"fn\"><a href= \"".$phpbb_home."profile.php?mode=viewprofile&u=".$row[8]."\">".$row[7]."</a></cite> <span class=\"says\">says:</span></div>
<div class=\"comment-meta commentmetadata\"><a href=\"".$phpbb_home."viewtopic.php?f=$forumID&t=".$row[2]."#".$row[3]."\">".$row[0]."</a>
".date("D, d M Y H:i",$row[4])."</div>
<div class=\"comment-body\">".$row[1]."</div></li>
";
} //End While
$out = $out . "</ol><br>Post a Comment</div>";
mysql_free_result($qryres);
return $out;
}
?>