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
|
<?php
/**
* Report the diff of 's' file
* against matching file in language 'l', if it exists.
*/
$source_file = isset($_GET['s']) ? trim($_GET['s']) : null;
$target_lang = isset($_GET['l']) ? trim($_GET['l']) : null;
if (is_null($source_file) ||
is_null($target_lang)) {
die('kthxbai');
}
if (!file_exists($source_file)) {
die('no source');
}
include 'lib.php';
$target_file = _lang_file_switch($source_file, $target_lang);
if (!file_exists($target_file)) {
die('no target');
}
$source_file = realpath($source_file);
$target_file = realpath($target_file);
if (false === strstr($source_file, '/langs/') ||
false == strstr($target_file, '/langs/')) {
die('no sorry');
}
$diff = _lang_diff($source_file, $target_file);
$s = '<a href="report.php">« back to langs report</a>';
$s .= sprintf('<h1>Differences between %s source and %s target</h1>',
substr($source_file, strpos($source_file, '/langs/')+7), $target_lang);
foreach (array('missing', 'notrans', 'extra') as $type) {
if (count($diff[$type]) > 0) {
$s .= sprintf('<h2>%d %s:</h2>', count($diff[$type]), $type);
$s .= '<pre>';
foreach ($diff[$type] as $l)
$s .= sprintf(";%s\n\n", htmlspecialchars($l));
$s .= '</pre>';
}
}
header('Content-Type: text/html;charset=utf-8');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="robot" content="noindex,nofollow,nosnippet">
<style>
pre { background: #eee; padding: 0.6em; }
</style>
</head>
<body>
<?php echo $s; ?>
<hr>
</body>
</html>
|