I have managed to reduce wc3 validation errors from 117 to 56. However at this point, there are various errors produced by:
http://validator.w3.…politicaboricua.com
1- Chat Block
2- tRSSNews Block
3- PN FlashGames random game block
I would like to focus on these now, altough I have other errors related with some flash embedding.
CHAT CODE:
define("_CHAT_TITLE","Flash Chat Server de Politica Boricua");
define("_CHAT_NOW","Chatear Ahora");
define("_CHAT_USERLIST","Personas en el chat: ");
define("_CHAT_NONE_USER","Nadie");
define("_CHAT_THEREARE","Hay...");
define("_CHAT_CONNECTIONS","personas conectadas al chat server");
define("_CHAT_ROOMS","Salas");
define("_CHAT_LOGON_USERS","Logeados");
$ModName = "chat";
include "modules/$ModName/config.php";
$content = "";
$userListStr = "";
//$room_id = "";
$room = array();
$online_file = $chat_data_path."online.txt";
if (!file_exists($online_file))
{
echo "Can't find $online_file";
}
else if (!$trow = file($online_file))
{
echo "Read $online_file error";
}
else
{
$room_data = explode("|", $trow[0]);
if (count($room_data) == 3)
{
$room['connections'] = intval($room_data[0]);
$room['logon_users'] = intval($room_data[1]);
$room['room_numbers'] = intval($room_data[2]);
}
$d = dir($chat_data_path);
while (false !== ($entry = $d->read()))
{
$rest = substr($entry, 0, 5);
if ($rest == "room_")
{
if (file_exists($chat_data_path.$entry))
{
$f_users = file($chat_data_path.$entry);
for ($i = 0; $i < count($f_users); $i ++)
{
$f_line = trim($f_users[$i]);
if ($f_line != "")
{
$userListStr = ($userListStr == "") ? $f_line : $userListStr. ", " . $f_line;
}
}
}
}
}
$d->close();
$userListStr = ($userListStr == "") ? _CHAT_NONE_USER : $userListStr;
}
$c_connections = $room['connections'];
$c_rooms = $room['room_numbers'];
$c_logon_users = $room['logon_users'];
$content = " \n";
$content .= " \n";
$content .= " \n";
$content .= _CHAT_THEREARE . " " . $c_connections . " "._CHAT_CONNECTIONS;
$content .= "". _CHAT_THEREARE . " " . $c_rooms. " ". _CHAT_ROOMS;
$content .= "". _CHAT_THEREARE . " " . $c_logon_users . " "._CHAT_LOGON_USERS;
$content .= "". _CHAT_USERLIST . " " . $userListStr . "";
$content .= "Puedes accesar el chat haciendo CLICK AQUI!!";
$content .= "";
echo $content;
echo "";
EOT;
-------------------------------
and last the pnFlashGames random game code:
// $Id: randomgame.php,v 1.1.1.1.2.1 2005/03/11 13:47:29 source Exp $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program 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.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Lee Eason
// Purpose of file: Show high scores from each game
// ----------------------------------------------------------------------
/************************************************
Displays a random game from the DB and the top X scores from that game
************************************************/
/**
* initialise block
*/
function pnFlashGames_randomgameblock_init()
{
// Security
pnSecAddSchema('pnFlashGames::Blocks', 'randomgame::Block title');
}
/**
* get information on block
*/
function pnFlashGames_randomgameblock_info()
{
// Values
return array('text_type' => 'RandomGame',
'module' => 'pnFlashGames',
'text_type_long' => 'Show random game',
'allow_multiple' => true,
'form_content' => false,
'form_refresh' => false,
'show_preview' => true);
}
/**
* display block
*/
function pnFlashGames_randomgameblock_display($blockinfo)
{
// Security check
if (!pnSecAuthAction(0,
'pnFlashGames::Blocks',
"randomgame::$blockinfo[title]",
ACCESS_READ)) {
return "";
}
// Get variables from content block
$vars = pnBlockVarsFromContent($blockinfo['content']);
if(!isset($vars['numHighScores'])){
$vars['numHighScores'] = 3;
}
if(!isset($vars['category'])){
$vars['category'] = 0;
}
// Database information
pnModDBInfoLoad('pnFlashGames');
list($dbconn) = pnDBGetConn();
$pntable =pnDBGetTables();
$scorestable = $pntable['pnFlashGames_scores'];
$scorescolumn = &$pntable['pnFlashGames_scores_column'];
$gamestable = $pntable['pnFlashGames_games'];
$gamescolumn = &$pntable['pnFlashGames_games_column'];
$categories = $pntable['pnFlashGames_categories'];
$categoriescolumn = &$pntable['pnFlashGames_categories_column'];
$catGames = $pntable['pnFlashGames_memberships'];
$catGamesColumn = &$pntable['pnFlashGames_memberships_column'];
if($vars['category']!=0){
//choose from a specific category
$where = "WHERE $gamescolumn[status]=1 AND $categoriescolumn[cid]={$vars[category]}";
}else{
$where = "WHERE ($gamescolumn[status]=1)";
}
// Query - Select a random game from the DB
$SQL = "SELECT $gamescolumn[id],
$gamescolumn[name],
$gamescolumn[timesPlayed],
$gamescolumn[gamefile],
$gamescolumn[status]
FROM $gamestable
LEFT JOIN $catGames ON $gamescolumn[id]=$catGamesColumn[gid]
LEFT OUTER JOIN $categories ON $catGamesColumn[cid]=$categoriescolumn[cid]
$where
GROUP BY $gamescolumn[id]
ORDER BY MD5(rand())
LIMIT 1";
$games = $dbconn->Execute($SQL);
if ($dbconn->ErrorNo() != 0) {
$blockinfo['content'] = $SQL."".mysql_error();
return themesideblock($blockinfo);
}
if ($result->EOF) {
//No highscores yet
$blockinfo['content'] = _PNFG_NOGAMES;
return themesideblock($blockinfo);
}
// Load the userapi to make highscore retrieval easier
if (!pnModAPILoad('pnFlashGames', 'user')) {
$output->Text(_LOADFAILED);
return $output->GetOutput();
}
// Create output object
$output = new pnHTML();
//$output->Text($SQL); //show the SQL statement in the block
for (; !$games->EOF; $games->MoveNext()) {
list($gid, $game, $timesPlayed, $gamefile) = $games->fields;
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->URL(pnModURL('pnFlashGames',
'user',
'display',
array('id' => $gid)),
"".$game."");
$output->LineBreak();
//Try and find the thumbnail screenshot for this game
//
if(file_exists(dirname($gamefile)."/".basename($gamefile, ".swf").".swf")){
$imgname = basename($gamefile, ".swf");
if(file_exists(dirname($gamefile)."/".$imgname.".gif")){
//that file exists
$img = dirname($gamefile)."/".$imgname.".gif";
$border = "0";
}else if(file_exists(dirname($gamefile)."/".$imgname.".jpg")){
//that file exists
$img = dirname($gamefile)."/".$imgname.".jpg";
$border = "0";
}else{
$img = "modules/pnFlashGames/games/noimage.gif";
$border = "1";
}
}else{
//If it's not a flash-game then it is a java-game. The extention here is .html
$imgname = basename($gamefile, ".zip");
if(file_exists(dirname($gamefile)."/".$imgname.".gif")){
//that file exists
$img = dirname($gamefile)."/".$imgname.".gif";
$border = "0";
}else if(file_exists(dirname($gamefile)."/".$imgname.".jpg")){
//that file exists
$img = dirname($gamefile)."/".$imgname.".jpg";
$border = "0";
}else{
$img = "modules/pnFlashGames/games/noimage.gif";
$border = "1";
}
}
/*
$link = pnModURL('pnFlashGames',
'user',
'display',
array("id" => $gid));
$output->Text("");
*/
$displayvars = array();
if($vars['category']!=0){
$displayvars["cid"] = $vars['category'];
}
$displayvars["id"] = $gid;
$output->URL(pnModURL('pnFlashGames',
'user',
'display',
$displayvars),
"");
$output->Linebreak();
//Get the highscores for this game
$highscores = pnModAPIFunc('pnFlashGames',
'user',
'getHighscores',
array('gid' => $gid,
'numScores' => $vars['numHighScores']));
if(count($highscores) == 0){
//No highscores yet
$output->Text(""._PNFG_NOHIGHSCORES." ");
$output->LineBreak();
$output->URL(pnModURL('pnFlashGames',
'user',
'display',
array('gid' => $gid)),
_PNFG_SETONE);
$output->LineBreak();
// NEW NEW NEW --Schnutz--
}else{
foreach($highscores as $highscore){
extract($highscore);
$output->Text($rank.". ".$username.": ".$score);
$output->LineBreak();
}
}
$output->LineBreak();
}
//$output->Linebreak(2);
$output->URL(pnModURL('pnFlashGames',
'user',
'main',
array()),
_PNFG_RANDOMGAME_GAMESLINK);
//$output->Text($SQL); //show the SQL statement in the block
// Populate block info and pass to theme
$blockinfo['content'] = $output->GetOutput();
return themesideblock($blockinfo);
}
/**
* modify block settings
*/
function pnFlashGames_randomgameblock_modify($blockinfo)
{
// Create output object
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
// Get current content
$vars = pnBlockVarsFromContent($blockinfo['content']);
// Defaults
if (empty($vars['numHighScores'])) {
$vars['numHighScores'] = 3; //default is to show 3 high scores per game in the block
}
if (empty($vars['category'])){
$vars['category'] = 0;
}
// Category to pull games from
pnModAPILoad('pnFlashGames', 'user');
$categories = pnModAPIFunc('pnFlashGames', 'user', 'getcategories');
if(count($categories) > 0){
$catselect = "All";
foreach($categories as $category){
$catselect .= "{$category[name]}";
}
$catselect .= "";
$row = array();
$output->SetOutputMode(_PNH_RETURNOUTPUT);
$row[] = $output->Text(_PNFG_CATEGORY);
$row[] = $output->Text($catselect);
$output->SetOutputMode(_PNH_KEEPOUTPUT);
}
// Add row
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->TableAddRow($row, 'left');
$output->SetInputMode(_PNH_PARSEINPUT);
// Number of high scores per game
$row = array();
$output->SetOutputMode(_PNH_RETURNOUTPUT);
$row[] = $output->Text(_PNFG_NUMSCORESPERGAME.":");
$row[] = $output->FormText('numHighScores',
pnVarPrepForDisplay($vars['numHighScores']),
5,
5);
$output->SetOutputMode(_PNH_KEEPOUTPUT);
// Add row
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->TableAddRow($row, 'left');
$output->SetInputMode(_PNH_PARSEINPUT);
$output->SetOutputMode(_PNH_KEEPOUTPUT);
// Return output
return $output->GetOutput();
}
/**
* update block settings
*/
function pnFlashGames_randomgameblock_update($blockinfo)
{
$vars['numHighScores'] = pnVarCleanFromInput('numHighScores');
$vars['category'] = pnVarCleanFromInput('category');
$blockinfo['content'] = pnBlockVarsToContent($vars);
return $blockinfo;
}
---------------
Well,
TIA
edited by: edfel, May 23, 2006 - 12:21 AM
