+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL Start: 02/12/2004 *
+ * =================== Last change: 02/12/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : what-repair_lang.php *
+ * -------------------------------------------------------------------- *
+ * Short description : "Repairs" the language system *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : "Repariert" das Sprachsystem *
+ * -------------------------------------------------------------------- *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * Needs to be in all Files and every File needs "svn propset *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
+} // END - if
+
+// Add description as navigation point
+addMenuDescription('admin', __FILE__);
+
+// Get a list with current language files
+$langFiles = getArrayFromDirectory('inc/language/', '', false, false, array('_de.php'), '.php', '@(\.|\.\.)$@', true, getCurrentLanguage());
+
+// By default nothing is checked, which is isn't right...
+$SW = 2; $OUT = '';
+
+// Get valid languages
+$validLanguages = getValidLanguages(getCurrentLanguage());
+
+// Check for all languages except current language
+foreach ($validLanguages as $lang) {
+ // Now check for all files
+ foreach ($langFiles as $langFile) {
+ // Get prefix
+ $prefix = explode('_', $langFile);
+ $prefix = $prefix[0];
+
+ // If we have a prefix append the underscore
+ if ((!empty($prefix)) && ($prefix != $langFile)) {
+ // Add underscore for prefix files
+ $prefix .= '_';
+ } else {
+ // Keep it empty for general language file
+ $prefix = '';
+ }
+
+ // Construct english include filename
+ $INC = sprintf("inc/language/%s%s.php", $prefix, $lang);
+
+ // Is the file readable?
+ if (isIncludeReadable($INC)) {
+ // Readable so compare both
+ if (ifLanguageFilesCompares('inc/language/' . $langFile, $INC, $lang)) {
+ // Compares so prepare content
+ $content = array(
+ 'source' => $langFile,
+ 'target' => basename($INC),
+ 'sw' => $SW,
+ );
+
+ // Compares, all fine
+ $OUT .= loadTemplate('admin_repair_lang_row_compares', true, $content);
+ } else {
+ // Generate difference output only if count is smaller/equals 100 entries
+ $diffContent = '<ul>';
+ if (count($GLOBALS['lang_diff'][$INC]) <= 100) {
+ // Display them, it is not more than 100 entries difference
+ foreach ($GLOBALS['lang_diff'][$INC] as $key => $value) {
+ $diffContent .= '<li>' . $key . '=' . htmlentities($value) . '</li>';
+ } // END - foreach
+ } else {
+ // To much to display!
+ $diffContent .= '<li>{--ADMIN_REPAIR_LANGUAGE_TO_MUCH--}</li>';
+ }
+ $diffContent .= '</ul>';
+
+ // Prepare content
+ $content = array(
+ 'source' => $langFile,
+ 'target' => basename($INC),
+ 'diff_count' => translateComma(getLanguageComparisonDifference($INC)),
+ 'diff_content' => $diffContent,
+ 'sw' => $SW,
+ );
+
+ // Compares, all fine
+ $OUT .= loadTemplate('admin_repair_lang_row_diff', true, $content);
+ }
+ } else {
+ // Not readable, prepare content
+ $content = array(
+ 'file' => basename($INC),
+ 'lang' => $lang,
+ 'sw' => $SW,
+ );
+
+ // Load template
+ $OUT .= loadTemplate('admin_repair_lang_row_404', true, $content);
+ }
+
+ // Switch color
+ $SW = 3 - $SW;
+ } // END - foreach
+} // END - foreach
+
+// Preapre content
+$content = array(
+ 'rows' => $OUT,
+ 'file_count' => translateComma(count($langFiles)),
+ 'total_diff' => translateComma($GLOBALS['lang_diff_count']['total']),
+ 'total_msgs' => translateComma($GLOBALS['msg_count'][getCurrentLanguage()]),
+);
+
+// Load main template
+loadTemplate('admin_repair_lang', false, $content);
+
+// [EOF]
+?>