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 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
40 // Some security stuff...
41 if ((!defined('__SECURITY')) || (!isAdmin())) {
45 // Add description as navigation point
46 addMenuDescription('admin', __FILE__);
48 // Get a list with current language files
49 $langFiles = getArrayFromDirectory('inc/language/', '', false, false, array('_de.php'), '.php', '@(\.|\.\.)$@', true, getCurrentLanguage());
51 // By default nothing is checked, which is isn't right...
54 // Get valid languages
55 $validLanguages = getValidLanguages(getCurrentLanguage());
57 // Check for all languages except current language
58 foreach ($validLanguages as $lang) {
59 // Now check for all files
60 foreach ($langFiles as $langFile) {
62 $prefix = explode('_', $langFile);
65 // If we have a prefix append the underscore
66 if ((!empty($prefix)) && ($prefix != $langFile)) {
67 // Add underscore for prefix files
70 // Keep it empty for general language file
74 // Construct english include filename
75 $INC = sprintf("inc/language/%s%s.php", $prefix, $lang);
77 // Is the file readable?
78 if (isIncludeReadable($INC)) {
79 // Readable so compare both
80 if (ifLanguageFilesCompares('inc/language/' . $langFile, $INC, $lang)) {
81 // Compares so prepare content
83 'source' => $langFile,
84 'target' => basename($INC),
88 $OUT .= loadTemplate('admin_repair_lang_row_compares', true, $content);
90 // Generate difference output only if count is smaller/equals 100 entries
91 $diffContent = '<ul>';
92 if (count($GLOBALS['lang_diff'][$INC]) <= 100) {
93 // Display them, it is not more than 100 entries difference
94 foreach ($GLOBALS['lang_diff'][$INC] as $key => $value) {
95 $diffContent .= '<li>' . $key . '=' . encodeEntities($value) . '</li>';
98 // To much to display!
99 $diffContent .= '<li>{--ADMIN_REPAIR_LANGUAGE_TO_MUCH--}</li>';
101 $diffContent .= '</ul>';
106 'source' => $langFile,
107 'diff_content' => $diffContent,
110 // Compares, all fine
111 $OUT .= loadTemplate('admin_repair_lang_row_diff', true, $content);
114 // Not readable, prepare content
121 $OUT .= loadTemplate('admin_repair_lang_row_404', true, $content);
129 'file_count' => count($langFiles),
130 'total_diff' => $GLOBALS['lang_diff_count']['total'],
131 'total_msgs' => $GLOBALS['msg_count'][getCurrentLanguage()],
134 // Load main template
135 loadTemplate('admin_repair_lang', false, $content);