X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flanguage.php;h=9bd6f297cdc288c3eeb2306b8b3a42d110c2c308;hp=beced61269f70bdb63054bf7c690e76ba9bf068b;hb=f97a999e0737c0007ae9c3c26dfef49f75a175ac;hpb=75ad748a68473ace540251427a74fb781b1145e9 diff --git a/inc/language.php b/inc/language.php index beced61269..9bd6f297cd 100644 --- a/inc/language.php +++ b/inc/language.php @@ -10,7 +10,12 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Sprache-Lader * * -------------------------------------------------------------------- * - * * + * $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 - 2008 by Roland Haeder * * For more information visit: http://www.mxchange.org * @@ -32,34 +37,43 @@ ************************************************************************/ // Some security stuff... -if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) -{ - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; +if (!defined('__SECURITY')) { + $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; require($INC); } -if (empty($mx_lang)) $mx_lang = DEFAULT_LANG; +// Try to get language from session +$mx_lang = get_session('mx_lang'); + +// Set default language if it is not (yet) set +if (is_null($mx_lang)) $mx_lang = constant('DEFAULT_LANG'); + +// Generate filename +$INC = sprintf("inc/language/%s.php", SQL_ESCAPE($mx_lang)); + +// Generate FQFN +$FQFN = constant('PATH') . $INC; // Look for file -$FILE = sprintf(PATH."inc/language/%s.php", $mx_lang); -if (!file_exists($FILE)) -{ +if (!FILE_READABLE($FQFN)) { // Switch to default (DO NOT CHANGE!!!) - @setcookie("mx_lang", "de", (time() + $CONFIG['online_timeout']), COOKIE_PATH); - $mx_lang = "de"; - $FILE = sprintf(PATH."inc/language/%s.php", $mx_lang); -} + $mx_lang = constant('DEFAULT_LANG'); + set_session('mx_lang', $mx_lang); + $INC = sprintf("inc/language/%s.php", $mx_lang); +} // END - if // Load language file -require($FILE); -unset($FILE); +LOAD_INC_ONCE($INC); // Check for installation mode -if (!mxchange_installed) -{ +if ((isInstalling()) || (!isInstalled()) || (!isAdminRegistered())) { // Load matching language file - require(PATH."inc/language/install_".$mx_lang.".php"); + LOAD_INC('inc/language/install_' . $mx_lang . '.php'); } +// Remove no more needed variables +unset($mx_lang); +unset($INC); + // ?>