inc/modules/admin/what-repair_amnu.php -text
inc/modules/admin/what-repair_cats.php -text
inc/modules/admin/what-repair_gmnu.php -text
+inc/modules/admin/what-repair_lang.php -text
inc/modules/admin/what-repair_mmnu.php -text
inc/modules/admin/what-send_bonus.php -text
inc/modules/admin/what-send_newsletter.php -text
templates/de/html/admin/admin_refbanner_edit_row.tpl -text
templates/de/html/admin/admin_refbanner_row.tpl -text
templates/de/html/admin/admin_reg_form.tpl -text
+templates/de/html/admin/admin_repair_lang.tpl -text
+templates/de/html/admin/admin_repair_lang_row_404.tpl -text
+templates/de/html/admin/admin_repair_lang_row_compares.tpl -text
+templates/de/html/admin/admin_repair_lang_row_diff.tpl -text
templates/de/html/admin/admin_reset_pass_done.tpl -text
templates/de/html/admin/admin_reset_password.tpl -text
templates/de/html/admin/admin_reset_password_form.tpl -text
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switc
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
// Some security stuff...
if (!defined('__SECURITY')) {
die();
-}
+} // END - if
// Version number
-setThisExtensionVersion('0.1.6');
+setThisExtensionVersion('0.1.7');
// Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6'));
+setExtensionVersionHistory(array('0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7'));
switch (getExtensionMode()) {
case 'register': // Do stuff when installation is running (modules.php?module=admin is called)
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Scripte umbenannt, damit diese nicht mit <u>ext-menu</u> konfliktieren");
break;
+
+ case '0.1.7': // SQL queries for v0.1.7
+ addAdminMenuSql('repair','repair_lang','Sprachsystem', 'Findet nicht übersetzte Sprachelemente in allen Scripten. Dies kann eventuell sehr lange dauern. Haben Sie bitte solange Geduld.',5);
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes("Sprachdateien sind nun auch "reparierbar" - nicht durch das Script, das findet nur die nicht übersetzten Zeichenketten, sondern durch den Menschen.");
+ break;
} // END - switch
break;
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
} // END - switch
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
break;
default: // Unknown extension mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode()));
break;
}
// Reads a directory recursively by default and searches for files not matching
// an exclusion pattern. You can now keep the exclusion pattern empty for reading
// a whole directory.
-function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true) {
+function getArrayFromDirectory ($baseDir, $prefix, $fileIncludeDirs = false, $addBaseDir = true, $excludeArray = array(), $extension = '.php', $excludePattern = '@(\.|\.\.)$@', $recursive = true, $suffix = '') {
// Add default entries we should exclude
$excludeArray[] = '.';
$excludeArray[] = '..';
// Skip this file
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid prefix in file " . $baseFile . ", prefix=" . $prefix);
continue;
+ } elseif ((!empty($suffix)) && (substr($baseFile, -(strlen($suffix . $extension)), (strlen($suffix . $extension))) != $suffix . $extension)) {
+ // Skip wrong suffix as well
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "Invalid suffix in file " . $baseFile . ", suffix=" . $suffix);
+ continue;
} elseif (!isFileReadable($FQFN)) {
// Not readable so skip it
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "File " . $FQFN . " is not readable!");
closedir($dirPointer);
// Sort array
- asort($files);
+ sort($files);
// Return array with include files
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, '- Left!');
// Is the language string found?
if (isMessageIdValid($messageId)) {
// Language array element found in small_letters
- $return = $GLOBALS['messages'][$messageId];
+ $return = $GLOBALS['messages'][getCurrentLanguage()][$messageId];
} else {
// Missing language constant
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Missing message string %s detected.", $messageId));
// Init messages
function initMessages () {
- $GLOBALS['messages'] = array();
+ $GLOBALS['messages'][getLanguage()] = array();
}
-// Add message
+// Add messages
function addMessages ($messages) {
// Merge both
- $GLOBALS['messages'] = merge_array($GLOBALS['messages'], $messages);
+ $GLOBALS['messages'][getCurrentLanguage()] = merge_array($GLOBALS['messages'][getCurrentLanguage()], $messages);
+
+ // Don't count them if we don't want it
+ if (isset($GLOBALS['count'])) return;
+
+ // And count them
+ if (isset($GLOBALS['msg_count'][getCurrentLanguage()])) {
+ $GLOBALS['msg_count'][getCurrentLanguage()] += count($messages);
+ } else {
+ $GLOBALS['msg_count'][getCurrentLanguage()] = count($messages);
+ }
}
// Checks wether given message id is valid
function isMessageIdValid ($messageId) {
- return (isset($GLOBALS['messages'][$messageId]));
+ return (isset($GLOBALS['messages'][getCurrentLanguage()][$messageId]));
}
-// "Getter for current language
+// Getter for current language
function getCurrentLanguage () {
return $GLOBALS['language'];
}
+// Setter for current language
+function setCurrentLanguage ($language) {
+ $GLOBALS['language'] = (string) $language;
+}
+
// "Getter" for language
function getLanguage () {
// Default is 'de'. DO NOT CHANGE THIS!!!
// Set default return value to default language from config
if (isConfigEntrySet('DEFAULT_LANG')) $ret = getConfig('DEFAULT_LANG');
- // Init variable
- $lang = '';
-
// Is the variable set
if (isGetRequestElementSet('mx_lang')) {
// Accept only first 2 chars
- $lang = substr(getRequestElement('mx_lang'), 0, 2);
+ $ret = substr(getRequestElement('mx_lang'), 0, 2);
} elseif (isset($GLOBALS['language'])) {
// Use cached
$ret = getCurrentLanguage();
- } elseif (!empty($lang)) {
- // Check if main language file does exist
- if (isIncludeReadable('inc/language/' . $lang . '.php')) {
- // Okay found, so let's update cookies
- setLanguage($lang);
- } // END - if
} elseif (isSessionVariableSet('mx_lang')) {
// Return stored value from cookie
$ret = getSession('mx_lang');
}
// Cache entry
- $GLOBALS['language'] = $ret;
+ setCurrentLanguage($ret);
// Return value
return $ret;
loadIncludeOnce($languageInclude);
} else {
// Not readable!
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Language file %s not found or readable.", $languageInclude));
+ logDebugMessage(__FUNCTION__, __LINE__, sprintf("Language file %s not found or readable.", $languageInclude));
}
}
+// Getter for an array of valid languages with no except by default
+function getValidLanguages ($except = '') {
+ // @TODO These are all valid languages, again hard-coded
+ $langs = array('de' => 'de', 'en' => 'en');
+
+ // Should we keep one out?
+ if (!empty($except)) {
+ // Remove this
+ unset($langs[$except]);
+ } // END - if
+
+ // Return the array
+ return $langs;
+}
+
+// Compares two language files
+function ifLanguageFilesCompares ($source, $target, $targetLanguage) {
+ // Init differences
+ $GLOBALS['lang_diff'][$target] = array();
+ $GLOBALS['lang_diff_count'][$target] = 0;
+ if (!isset($GLOBALS['lang_diff_count']['total'])) $GLOBALS['lang_diff_count']['total'] = 0;
+
+ // *Does* match by default
+ $matches = true;
+
+ // Is one not readable?
+ if (!isIncludeReadable($source)) {
+ // Please report this bug!
+ debug_report_bug(__FUNCTION__ . ': Source file ' . $source . ' is not readable.');
+ } elseif (!isIncludeReadable($target)) {
+ // Please report this bug!
+ debug_report_bug(__FUNCTION__ . ': Target file ' . $target . ' is not readable.');
+ } elseif ($targetLanguage == getCurrentLanguage()) {
+ // Must be different
+ debug_report_bug(__FUNCTION__ . ': Target language ' . $targetLanguage . ' is same as current.');
+ }
+
+ // Backup current messages/language
+ $backupLang = getCurrentLanguage();
+ $messages[$backupLang] = $GLOBALS['messages'][$backupLang];
+ $GLOBALS['messages'][$backupLang] = array();
+
+ // Both are readable so include current language file
+ $GLOBALS['count'] = false;
+ loadInclude($source);
+ $GLOBALS['msgs'][$source] = $GLOBALS['messages'][$backupLang];
+ unset($GLOBALS['count']);
+
+ // Set target language
+ setCurrentLanguage($targetLanguage);
+
+ // Do we have an array?
+ if (!isset($GLOBALS['messages'][$targetLanguage])) {
+ // Then create it to avoid notice
+ $GLOBALS['messages'][$targetLanguage] = array();
+ $GLOBALS['msg_count'][$targetLanguage] = 0;
+ } // END - if
+
+ // Load target language file
+ loadInclude($target);
+ $GLOBALS['msgs'][$target] = $GLOBALS['messages'][$targetLanguage];
+
+ // Set backup back
+ setCurrentLanguage($backupLang);
+ $GLOBALS['messages'][$backupLang] = $messages[$backupLang];
+ unset($messages[$backupLang]);
+
+ // Do they mismatch?
+ if ((count($GLOBALS['msgs'][$source])) != (count($GLOBALS['msgs'][$target]))) {
+ // Does not match
+ $matches = false;
+
+ // Check all differences
+ foreach ($GLOBALS['msgs'][$source] as $key => $value) {
+ // Don't we have it?
+ if (!isset($GLOBALS['msgs'][$target][$key])) {
+ // Then add is as difference
+ $GLOBALS['lang_diff'][$target][$key] = $value;
+
+ // ... and count it
+ $GLOBALS['lang_diff_count'][$target]++;
+ $GLOBALS['lang_diff_count']['total']++;
+ } // END - if
+ } // END - foreach
+ } // END - if
+
+ // Return result
+ return $matches;
+}
+
+// Getter for getting difference of target file
+function getLanguageComparisonDifference ($target) {
+ return $GLOBALS['lang_diff_count'][$target];
+}
+
// [EOF]
?>
'ADMIN_REPAIR_CATS_NOTHING' => "Keine Kategorie-Auswahlenn gefunden! Vermutlich sind keine Mitglieder registriert?",
'ADMIN_REPAIR_ENTRIES_FIXED' => "Es wurden <span class=\"data\">%s</span> Einträge repariert.",
'ADMIN_REPAIR_NOTHING_FIXED' => "Es wurden keine Einträge repariert.",
+ 'ADMIN_REPAIR_LANGUAGE_TO_MUCH' => "Es sind mehr als 100 nicht existierende Elemente in der Zielsprachdatei gefunden worden.",
+ 'ADMIN_REPAIR_LANG_TITLE' => "Analyse an den Sprachdateien",
));
// [EOF]
--- /dev/null
+<?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]
+?>
--- /dev/null
+<div align="center">
+<div class="admin_table dashed">
+ <div class="admin_title bottom2">
+ <strong>{--ADMIN_REPAIR_LANG_TITLE--}</strong>
+ </div>
+ <div align="left">
+ $content[rows]
+ </div>
+ <div class="admin_footer">
+ Es wurden <span class="data">$content[file_count]</span> Sprachdateien
+ analysiert. Dabei wurden <span class="data">$content[total_msgs]</span>
+ Sprachelemente untersucht und <span class="data">$content[total_diff]</span>
+ Unterschiede an allen gefundenen Dateien entdeckt.
+ </div>
+</div>
+</div>
--- /dev/null
+<div class="switch_sw$content[sw] bottom2">
+ <div>
+ Das Sprachpaket <span class="data">$content[file]</span> (Sprache:
+ <span class="data">$content[lang]</span>) wurde nicht gefunden.
+ </div>
+</div>
--- /dev/null
+<div class="switch_sw$content[sw] bottom2">
+ <div>
+ Das Sprachpaket <span class="data">$content[target]</span> hat genau so viele Einträge wie <span class="data">$content[source]</span>.
+ </div>
+</div>
--- /dev/null
+<div class="switch_sw$content[sw] bottom2">
+ <div>
+ Das Sprachpaket <span class="data">$content[target]</span> hat <span class="data">$content[diff_count]</span> Unterschiede zu <span class="data">$content[source]</span>:
+ </div>
+ <div>
+ <strong>Nicht gefundene Sprachelemente:</strong>
+ <span class="data">$content[diff_content]</span>
+ </div>
+</div>