From cf8b2d17e8f2b27f63645f432530772180b736a0 Mon Sep 17 00:00:00 2001 From: chriskl Date: Thu, 2 Jan 2003 03:42:08 +0000 Subject: [PATCH] Check for config file mismatches. Greatly improve language handling. Fixed bug in italian file. --- conf/config.inc.php-dist | 13 ++++++------- lang/english.php | 4 +++- lang/italian.php | 4 ++-- libraries/lib.inc.php | 25 ++++++++++++++++++++++++- public_html/intro.php | 4 ++-- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/conf/config.inc.php-dist b/conf/config.inc.php-dist index e8b7fee4..e489357a 100644 --- a/conf/config.inc.php-dist +++ b/conf/config.inc.php-dist @@ -4,17 +4,17 @@ * Central WebDB configuration. As a user you may modify the * settings here for your particular configuration. * - * $Id: config.inc.php-dist,v 1.5 2002/12/24 07:38:23 chriskl Exp $ + * $Id: config.inc.php-dist,v 1.6 2003/01/02 03:42:08 chriskl Exp $ */ // Set error reporting level error_reporting(E_ALL); // App settings - $appName = 'WebDB'; - $appIntro = 'Welcome to WebDB.'; $appBase = '../public_html'; - $appVersion = '0.6'; + + // Language setting. eg 'english', 'polish', etc. + $appLanguage = 'english'; /* * GUI settings @@ -55,9 +55,8 @@ * Don't modify anything below this line * *****************************************/ - // Language - include_once('../lang/english.php'); - + $appConfVersion = 1; + // Main library include_once('../libraries/lib.inc.php'); diff --git a/lang/english.php b/lang/english.php index 49ab46e0..757c44f2 100755 --- a/lang/english.php +++ b/lang/english.php @@ -4,13 +4,15 @@ * Language template file for WebDB. Use this to base language * files. * - * $Id: english.php,v 1.25 2003/01/02 02:27:47 chriskl Exp $ + * $Id: english.php,v 1.26 2003/01/02 03:42:08 chriskl Exp $ */ $appLang = 'English'; $appCharset = 'ISO-8859-1'; + $strIntro = 'Welcome to WebDB.'; $strNoFrames = 'You need a frames-enabled browser to use this application.'; + $strBadConfig = 'Your config.inc.php is out of date. You will need to regenerate it from the new config.inc.php-dist.'; $strLogin = 'Login'; $strLoginFailed = 'Login failed'; $strNoTables = 'No tables found.'; diff --git a/lang/italian.php b/lang/italian.php index 2392f888..2201d4a1 100644 --- a/lang/italian.php +++ b/lang/italian.php @@ -3,7 +3,7 @@ * Italian language template, based on the english language template file for WebDB. * @maintainer Calogero Calì [] * - * $Id: italian.php,v 1.3 2002/12/24 02:44:21 chriskl Exp $ + * $Id: italian.php,v 1.4 2003/01/02 03:42:08 chriskl Exp $ */ $appLang = 'Italiano'; @@ -41,7 +41,7 @@ $strPrev = 'Precedente'; $strNext = 'Successivo'; $strFailed = 'Fallito'; - $strNotLoaded = 'Non è stato compilato un adeguato supporto ai database nell'installazione di PHP'; + $strNotLoaded = 'Non è stato compilato un adeguato supporto ai database nell\'installazione di PHP'; // Users - Utenti $strUsername = 'Username'; diff --git a/libraries/lib.inc.php b/libraries/lib.inc.php index f234ab77..3b154fb4 100644 --- a/libraries/lib.inc.php +++ b/libraries/lib.inc.php @@ -3,9 +3,32 @@ /** * Function library read in upon startup * - * $Id: lib.inc.php,v 1.6 2002/12/27 17:25:56 chriskl Exp $ + * $Id: lib.inc.php,v 1.7 2003/01/02 03:42:08 chriskl Exp $ */ + // Application name + $appName = 'WebDB'; + + // Application version + $appVersion = '0.7'; + + // Configuration file version. If this is greater than that in config.inc.php, then + // the app will refuse to run. This and $appConfVersion should be incremented whenever + // backwards incompatible changes are made to config.inc.php-dist. + $appBaseConfVersion = 1; + + // Language settings. Always include english.php, since it's the master + // language file, and then overwrite it with the user-specified language. + $appLanguage = strtolower($appLanguage); + include_once('../lang/english.php'); + include_once("../lang/{$appLanguage}.php"); + + // Check for config file version mismatch + if (!isset($appConfVersion) || $appBaseConfVersion > $appConfVersion) { + echo $strBadConfig; + exit; + } + // Create Misc class references include_once('../classes/Misc.php'); $misc = new Misc(); diff --git a/public_html/intro.php b/public_html/intro.php index dd1c05d2..002fbace 100755 --- a/public_html/intro.php +++ b/public_html/intro.php @@ -3,7 +3,7 @@ /** * Intro screen * - * $Id: intro.php,v 1.8 2003/01/02 02:27:47 chriskl Exp $ + * $Id: intro.php,v 1.9 2003/01/02 03:42:08 chriskl Exp $ */ // Include application functions @@ -19,7 +19,7 @@

-

+

-- 2.39.5