diff options
author | jwangen <jwangen> | 2002-09-26 15:34:09 +0000 |
---|---|---|
committer | jwangen <jwangen> | 2002-09-26 15:34:09 +0000 |
commit | e83d767bc9527ab20c7932ed359dc2d6a383d837 (patch) | |
tree | c315b894428f16f5f27ce53390990f5540ddd63d /init.inc.php | |
parent | 153e93b99820f19b1e264191c139bb9062d9c9e4 (diff) | |
download | phpicalendar-e83d767bc9527ab20c7932ed359dc2d6a383d837.tar.gz phpicalendar-e83d767bc9527ab20c7932ed359dc2d6a383d837.tar.bz2 phpicalendar-e83d767bc9527ab20c7932ed359dc2d6a383d837.zip |
Modified the language include so it doesn't break if the file doesn't exist
Added warning to let the user know why the language they chose didn't
show up. Made $language be passed to strtolower() before being used so if
the user capitalizes the first character it still finds the file.
Diffstat (limited to 'init.inc.php')
-rw-r--r-- | init.inc.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/init.inc.php b/init.inc.php index 3363990..08f3862 100644 --- a/init.inc.php +++ b/init.inc.php @@ -9,9 +9,18 @@ if(phpversion() >= "4.2.0") include('./config.inc.php'); -// define supported languages -include("./languages/$language.inc.php"); +// language support +$language = strtolower($language); +$lang_file = "./languages/$language.inc.php"; +if (file_exists($lang_file)) { + include($lang_file); +} else { +// Not sure if we should print this warning or not. It would inform the user +// why the language isn't working. + print "File \"$lang_file\" does not exist, defaulting to English<br><br>"; + include("./languages/english.inc.php"); +} // $cal_displayname is $cal_filename with occurrences of "32" replaced with " " // $cal_filename should always be the filename of the calendar without .ics |