-
Notifications
You must be signed in to change notification settings - Fork 102
/
index.php
78 lines (77 loc) · 1.78 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
if ( !chdir('../../language') )
die("Impossible to find the language folder");
function get_blanks($lcode,$file)
{
global $locales;
if ( isset($locales[$lcode]) && file_exists('en_us/'.$file) )
{
$res = '<h2>'.$file.' ('.$locales[$lcode].')</h2>';
$fen = function($file){
return include_once('en_us/'.$file);
};
$en = $fen($file);
if ( file_exists($lcode.'/'.$file) )
{
$flang = function($lcode,$file){
return include_once($lcode.'/'.$file);
};
$lang = $flang($lcode,$file);
$diff = array_diff_key($en,$lang);
}
else
{
$diff = $en;
$res .= '<h3>This file in '.$locales[$lcode].' doesn\'t exist</h3>';
}
if ( count($diff) > 0 )
{
$res .= '<p>';
foreach ( $diff as $k => $d )
$res .= "'".$k."' => '".str_replace("'","\'",$d)."',<br>";
$res .= '</p>';
}
else
$res .= '<h3>Nothing needs to be done here!</h3>';
return $res;
}
return "<h2>The language or the file doesn't exist</h2>";
}
?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<select name="language">
<?php
// Will define $locales
include_once('locales.php');
$langs = array();
$dirs = scandir('.');
foreach ( $dirs as $dir )
{
if ( $dir !== '.' && $dir !== '..' && $dir !== 'en_us' && is_dir($dir) )
array_push($langs,$dir);
}
foreach ( $langs as $l )
echo '<option value="'.$l.'">'.$locales[$l].'</option>';
?>
</select>
<input type="submit" value="Find the blanks!">
</form>
<?php
if ( isset($_POST['language']) && in_array($_POST['language'],$langs) )
{
$files = scandir('en_us');
foreach ( $files as $f )
{
if ( $f !== 'en_us.php' && is_file('en_us/'.$f) )
echo get_blanks($_POST['language'],$f).'<hr>';
}
}
?>
</body>
</html>