2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 02/12/2004 *
4 * =================== Last change: 02/12/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-repair_lang.php *
8 * -------------------------------------------------------------------- *
9 * Short description : "Repairs" the language system *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : "Repariert" das Sprachsystem *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 // Get a list with current language files
47 $langFiles = getArrayFromDirectory('inc/language/', '', false, false, array('_de.php'), '.php', '@(\.|\.\.)$@', true, getCurrentLanguage());
49 // By default nothing is checked, which is isn't right...
52 // Get valid languages
53 $validLanguages = getValidLanguages(getCurrentLanguage());
55 // Check for all languages except current language
56 foreach ($validLanguages as $lang) {
57 // Now check for all files
58 foreach ($langFiles as $langFile) {
60 $prefix = explode('_', $langFile);
63 // If we have a prefix append the underscore
64 if ((!empty($prefix)) && ($prefix != $langFile)) {
65 // Add underscore for prefix files
68 // Keep it empty for general language file
72 // Construct english include filename
73 $INC = sprintf("inc/language/%s%s.php", $prefix, $lang);
75 // Is the file readable?
76 if (isIncludeReadable($INC)) {
77 // Readable so compare both
78 if (ifLanguageFilesCompares('inc/language/' . $langFile, $INC, $lang)) {
79 // Compares so prepare content
81 'source' => $langFile,
82 'target' => basename($INC),
86 $OUT .= loadTemplate('admin_repair_lang_row_compares', true, $content);
88 // Generate difference output only if count is smaller/equals 100 entries
89 $diffContent = '<ul>';
90 if (count($GLOBALS['lang_diff'][$INC]) <= 100) {
91 // Display them, it is not more than 100 entries difference
92 foreach ($GLOBALS['lang_diff'][$INC] as $key => $value) {
93 $diffContent .= '<li>' . $key . '=' . encodeEntities($value) . '</li>';
96 // To much to display!
97 $diffContent .= '<li>{--ADMIN_REPAIR_LANGUAGE_TO_MUCH--}</li>';
99 $diffContent .= '</ul>';
104 'source' => $langFile,
105 'diff_content' => $diffContent,
108 // Compares, all fine
109 $OUT .= loadTemplate('admin_repair_lang_row_diff', true, $content);
112 // Not readable, prepare content
119 $OUT .= loadTemplate('admin_repair_lang_row_404', true, $content);
127 'file_count' => count($langFiles),
128 'total_diff' => $GLOBALS['lang_diff_count']['total'],
129 'total_msgs' => $GLOBALS['msg_count'][getCurrentLanguage()],
132 // Load main template
133 loadTemplate('admin_repair_lang', false, $content);