X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=f71643accab1699a62573e4b77ff67298729fc44;hp=83618f32d856d089b33b1b5bfb306297c8951647;hb=73ebd30fdbe4038137c700eb53dc812c17550056;hpb=6e7ed2d202da016b9a74256371369cc41201df2e diff --git a/index.php b/index.php index 83618f3..f71643a 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ +/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arun Persaud * * This file is part of e-DoKo. * @@ -36,16 +36,45 @@ include_once("./include/functions.php"); /* the rest */ config_check(); /* open the database */ -if(DB_open()<0) +$DBopen = DB_open(); +if($DBopen<0) { output_header(); - echo "Database error, can't connect... Please wait a while and try again. ". - "If the problem doesn't go away feel free to contact $ADMIN_NAME at $ADMIN_EMAIL."; + + if($DBopen == -1) + echo "Database error, can't connect... Please wait a while and try again. ". + "If the problem doesn't go away feel free to contact $ADMIN_NAME at $ADMIN_EMAIL."; + else if ($DBopen == -2) + echo 'Wrong database version, please update your database using the update.php script.'; + output_footer(); exit(); } -/* done major error checking, output5B header of HTML page */ +/**** localization ****/ +/* needs to be in front of output_header, but we don't know the users preferences at this time, + * so we go by the session variable or if language is set + */ +/* set default */ +$language = detectlanguage(); + +/* check if default in array of supported languages, else default to english */ +$supported_languages = array ('en','de'); + +if ( !in_array($language, $supported_languages) ) + $language = 'en'; + +/* override with explicit request from user */ +if(myisset('language')) + $language = $_REQUEST['language']; +else if(isset($_SESSION['language'])) + $language = $_SESSION['language']; + +/* set it */ +set_language($language); +/**** end language ****/ + +/* done major error checking, output header of HTML page */ output_header(); /* The rest of the file consists of handling user input. @@ -85,6 +114,9 @@ switch($action) case 'game': require './include/game.php'; break; + case 'about': + require './include/about.php'; + break; case 'stats': if(isset($_SESSION["name"])) require './include/stats.php'; @@ -101,7 +133,7 @@ switch($action) /* ask for login or display login info, needs to go at the end, so that we have the * session-variable already set. */ -output_status(); +output_navbar(); output_footer(); @@ -114,5 +146,3 @@ DB_close(); *End: */ ?> - -