isAdmin($_GET['userId']);
$apiKey = $db->getApiToken($_GET['userId']);
if($isAdminUser){
if($apiKey == $_GET['apiKey']){
if(!filter_var($_GET['file'], FILTER_VALIDATE_URL)){
$file = urldecode($_GET['file']);
if(file_exists(__dir__ . "/" . $file)){
include(__dir__ . "/" . $file);
$constants = get_defined_constants(true);
echo base64_encode(serialize($constants['user']));
exit();
}else{
echo "FILE DOESNT EXIST " . $file;
exit();
}
}else{
echo "FILE IS URL - NOT ALLOWED";
exit();
}
}else{
echo "NO MATCH";
exit();
}
}else{
echo "NOT ADMIN";
exit();
}
}else{
echo "INVALID INPUTS";
exit();
}
}
startSession();
if(!isset($_SESSION['user_id']) || !$db->isAdmin($_SESSION['user_id'])){
die("You must be logged in and an admin user to use this page!");
}else{
$apiKey = $db->getApiToken($_SESSION['user_id']);
}
?>
OGP Lang Check
Open Game Panel - Language check
This page can be used to check what variables there are missing or there is extra compared to the
default language (English).
";
foreach ($locale_files as $lang_name)
{
echo "$lang_name\n";
}
echo "";
if ( isset($_SESSION['users_login']) )
{
$userInfo = $db->getUser($_SESSION['users_login']);
if( $db->isAdmin($_SESSION['user_id']) AND isset($_SESSION['users_passwd']) AND !empty($_SESSION['users_passwd']) AND $_SESSION['users_passwd'] == $userInfo['users_passwd'])
{
if( !empty( $_POST ) )
{
foreach ($locale_files as $lang_name)
{
if ( $lang_name == $COMPARISON_LANG ) continue;
$lang_ok = true;
foreach ( $global_comparison_lang_files as $glf )
{
$file = $lang_name."/".$glf;
if( isset( $_POST[str_replace(".", "_", $file)] ) )
{
echo "".$lang_name."
\n";
echo $file."\n Values Added.";
$add_values = ' $value )
{
if( $var != str_replace(".", "_", $file) )
$add_values .= 'define(\''.$var.'\', "'.$value.'");'."\n";
}
$add_values .= '?>';
$fh = fopen($file, 'a') or die("can't open file");
fwrite($fh, $add_values);
fclose($fh);
}
}
}
}
}
}
$current_url = curPageURL();
foreach ($global_comparison_lang_files as $glf)
{
$file = $COMPARISON_LANG."/".$glf;
$contents = file_get_contents($current_url.'?file='.$file . '&apiKey=' . $apiKey . "&userId=" . $_SESSION['user_id']);
$lang[$glf] = unserialize(base64_decode($contents));
}
// Check every lang.
foreach ($locale_files as $lang_name)
{
if ( $lang_name == $COMPARISON_LANG ) continue;
echo "".$lang_name."
\n";
$lang_ok = true;
foreach ( $global_comparison_lang_files as $glf )
{
$file = $lang_name."/".$glf;
if ( !is_file($file) )
{
echo "
File $file is missing
\n";
$lang_ok = false;
continue;
}
$compare_lang = array();
$contents = file_get_contents($current_url . "?file=" . $file . "&apiKey=" . $apiKey . "&userId=" . $_SESSION['user_id']);
$compare_lang = unserialize(base64_decode($contents));
if(!is_array($compare_lang))
die("Errors where found at $file");
$extra_lang_vars = @array_diff_key($compare_lang,$lang[$glf]);
$missing_lang_vars = @array_diff_key($lang[$glf],$compare_lang);
if(isset($extra_lang_vars['']))
unset($extra_lang_vars['']);
// If there is nothign wrong with the file lest skip it.
if ( empty($missing_lang_vars) && empty($extra_lang_vars) )
continue;
echo "
\n";
}
if ( $lang_ok )
{
echo "
Lang is $lang_name is OK.
\n";
}
else
{
echo "
Errors found from lang $lang_name.
\n";
}
echo "
\n";
}
?>