X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=691e11374aa48d0966df8185f51eb6bff95d423e;hp=d92f4787d9755b5c266faa276f88f8eddd2861b5;hb=2bd1c94dd7e712bb2cc8e2c16fb317bd0169c59c;hpb=e2d7a3291f85403b4faf6f8be7e30caeefb0c1a3 diff --git a/index.php b/index.php index d92f478..691e113 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,23 @@ + * + * This file is part of e-DoKo. + * + * e-DoKo 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 3 of the License, or + * (at your option) any later version. + * + * e-DoKo 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 e-DoKo. If not, see . + * + */ + error_reporting(E_ALL); /* start a session, if it is not already running. @@ -17,16 +36,51 @@ 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 + */ +if(myisset('language') || isset($_SESSION['language'])) + { + $language = 'en'; + if(isset($_SESSION['language'])) + $language = $_SESSION['language']; + if(myisset('language')) + { + $language = $_REQUEST['language']; + $_SESSION['language'] = $language; /* overrule preferences */ + } + switch($language) + { + case 'de': + putenv("LC_ALL=de_DE"); + setlocale(LC_ALL, "de_DE"); + // Specify location of translation tables + bindtextdomain("edoko", "./locale"); + // Choose domain + textdomain("edoko"); + break; + default: + /* do nothing */ + } + } + +/* done major error checking, output header of HTML page */ output_header(); /* The rest of the file consists of handling user input. @@ -66,6 +120,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'; @@ -95,5 +152,3 @@ DB_close(); *End: */ ?> - -