// @license GNU General Public License, version 2 (GPL-2.0)
//
// For full copyright and license information, please see
// the docs/CREDITS.txt file.
//
// -------------------------------------------------------------
// Thanks to arod-1
define('IN_PHPBB', 1);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path='./../';
include($phpbb_root_path . 'common.'.$phpEx);
$mode = $request->variable('mode', '');
$modules = find_modules($phpbb_root_path . 'language/en');
$kkeys = $keys = array();
$langdir = dirname(__FILE__);
if (isset($lang))
{
unset($lang);
}
foreach($modules as $module)
{
require_once("$langdir$module");
if (isset($lang))
{
$kkeys[$module] = $lang;
$keys[] = $module;
unset($lang);
}
}
$equal = $case = $diff = 0;
$output = array();
while ($module = array_shift($keys))
{
$keys_1 = array_keys($kkeys[$module]);
foreach ($keys as $other_module)
{
$keys_2 = array_keys($kkeys[$other_module]);
foreach(array_intersect($keys_1, $keys_2) as $dup)
{
if ($kkeys[$module][$dup] == $kkeys[$other_module][$dup])
{
$compare = "Equal";
$equal++;
}
else if (strcasecmp($kkeys[$module][$dup], $kkeys[$other_module][$dup]) == 0)
{
$compare = "Differ in case";
$case++;
}
else
{
$compare = "'{$kkeys[$module][$dup]}' - '{$kkeys[$other_module][$dup]}'";
$diff++;
}
$color = '';
if ((basename($module) == "common.$phpEx") || (basename($other_module) == "common.$phpEx"))
{
$color = ' style="color:#B00000;"';
}
switch ($mode)
{
case 'module':
$output[$module][] = "" . ((isset($output[$module])) ? ' ' : "$module" ) . " | $dup | $other_module | $compare |
";
break;
default:
$output[$dup][] = "$dup | $module | $other_module | $compare |
";
break;
}
}
}
}//var_dump($output);
echo "By Key By Module
Equal: $equal, Differ in case only: $case, differ in content: $diff
";
switch ($mode)
{
case 'module':
echo "Key | First File | Second File | Difference |
";
foreach ($output as $module => $html)
{
echo implode('', $html);
}
break;
default:
ksort($output);
echo "File | Key | Conflicting File | Difference |
";
foreach ($output as $dup)
{
echo implode('', $dup);
}
break;
}
echo "
";
function find_modules($dirname)
{
$list = glob("$dirname/*.php");
foreach(glob("$dirname/*", GLOB_ONLYDIR) as $name)
{
$list = array_merge($list, find_modules($name));
}
return $list;
}
?>