<?php
exit();
// Comment the line above to enable this tool

$modules = array(
	"articles",
	"banners", // don't has lang file
	"comments",
	"contact",
	"downloads",
	"faqs",
	"fileman",
	"forum",
	"links",
	"messages",
	"news",
	"picofday",
	"polls"
);

// read directory
$langs = array();
$dir = opendir("../lang/") or die( "An error ocurred while reading lang folder" );
while( ($file = readdir($dir))!==false )
{
    if($file!="." && $file!="..") {
		if( ereg( "^msg_([a-z]+)\.php$", $file, $regs ) ) {
			if( $regs[1] != "enus" ) $langs[$regs[1]] = $file;
		}
	}
}
closedir($dir);

$total_errors = 0;

reset( $langs );
while( $row = each($langs) )
{
	print "<font color=\"Blue\"><b>{$row[0]} - {$row[1]} </b></font>";
	unset( $lang );
	include( "../lang/msg_enus.php" );
	$lang_enus = $lang;
	unset( $lang );
	include( "../lang/{$row[1]}" );
	$clangerrors = 0;
	$errors = 0;
	while( $test = each($lang_enus) )
	{
		if( !isset($lang[$test[0]]) )
		{
			if( $clangerrors++ == 0 )
				print "<br><font color=\"Blue\">../lang/{$row[1]}</font>";
			print "<br>Item not found: ".$test[0]." (".htmlspecialchars($test[1]).")";
			++$errors; ++$total_errors;
		}
	}

	reset( $modules );
	while( $mod = each($modules) )
	{
		unset( $lang );
		include( "../modules/{$mod[1]}/lang/msg_enus.php" );
		$lang_enus = $lang;
		unset( $lang );
		include( "../modules/{$mod[1]}/lang/{$row[1]}" );
		$clangerrors = 0;
		reset( $lang_enus );
		while( $test = each($lang_enus) )
		{
			if( !isset($lang[$test[0]]) )
			{
				if( $clangerrors++ == 0 )
					print "<br><font color=\"Blue\">../modules/{$mod[1]}/lang/{$row[1]}</font>";
				print "<br>Item not found: ".$test[0]." (".htmlspecialchars($test[1]).")";
				++$errors; ++$total_errors;
			}
		}
	}
	if( $errors ) print "<br><font color=\"Red\">$errors</font><br>";
	else print "<font color=\"Green\"><b>OK</b></font><br>";
	
	
/*	
	reset( $modules );
	$errors = 0;
	while( $mod = each($modules) )
	{
		include( "../modules/{$mod[1]}/lang/msg_enus.php" );
		$lang_enus = $lang;
		unset( $lang );
		include( "../modules/{$mod[1]}/lang/{$row[1]}" );
		$clangerrors = 0;
		reset( $lang_enus );
		while( $test = each($lang_enus) )
		{
			if( !isset($lang[$test[0]]) )
			{
				if( $clangerrors++ == 0 )
					print "<br><font color=\"Blue\">../modules/{$mod[1]}/lang/{$row[1]}</font>";
				print "<br>Item not found: ".$test[0]." (".htmlspecialchars($test[1]).")";
				++$errors; ++$total_errors;
			}
		}
	}
	if( $errors ) print "<br><font color=\"Red\">$errors</font><br>";
	else print "<font color=\"Green\"><b>OK</b></font><br>";
*/
}

if( $total_errors ) print "<br><font color=\"Red\">$total_errors</font><br>";
else print "<font color=\"Green\"><b>All lang files OK</b></font><br>";



?>



