diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-05-24 13:45:06 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-05-24 13:45:06 +0000 |
commit | 095b3d81037f5a3b3de44444845651c9c4f5c411 (patch) | |
tree | 6e654a24620a7db2f9d9c5c882fe8fa770473887 /langs/diff.php | |
parent | afeb046afd018f21547cd66d728f5181bb3628c1 (diff) | |
download | www-095b3d81037f5a3b3de44444845651c9c4f5c411.tar www-095b3d81037f5a3b3de44444845651c9c4f5c411.tar.gz www-095b3d81037f5a3b3de44444845651c9c4f5c411.tar.bz2 www-095b3d81037f5a3b3de44444845651c9c4f5c411.tar.xz www-095b3d81037f5a3b3de44444845651c9c4f5c411.zip |
reporting tools
Diffstat (limited to 'langs/diff.php')
-rw-r--r-- | langs/diff.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/langs/diff.php b/langs/diff.php new file mode 100644 index 000000000..f0518d5ad --- /dev/null +++ b/langs/diff.php @@ -0,0 +1,56 @@ +<?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'; +include '../langs.inc.php'; + +$target_file = _lang_file_switch($source_file, $target_lang); + +if (!file_exists($target_file)) { + die('no target'); +} + +$diff = _lang_diff($source_file, $target_file); + +$s = '<a href="report.php">« back to langs report</a>'; +$s .= "<h1>Diff {$source_file} ({$diff['a']}) against {$target_file} ({$diff['b']})</h1>"; + +foreach (array('missing', 'notrans', 'extra') as $type) { + + if (count($diff[$type]) > 0) { + $s .= sprintf('<h2>%d %s:</h2>', count($diff[$type]), $type); + foreach ($diff[$type] as $l) + $s .= sprintf('<blockquote><p><pre>%s</pre></p></blockquote>', htmlentities($l)); + } +} + +?><!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> + <meta name="robot" content="noindex,nofollow,nosnippet"> + <style> + blockquote { background: #eee; padding: 0.1em 1em; } + </style> +</head> +<body> + <?php echo $s; ?> +<hr> +</body> +</html> |