From 366915f03a48ec7dc70edd84a4a7bf6b813d3d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 23 Jan 2013 13:55:47 +0000 Subject: [PATCH] =?UTF-8?q?=C3=9Cberpr=C3=BCfung=20beim=20Sprachwechsel=20?= =?UTF-8?q?hinzugef=C3=BCgt.=20Bei=20Fehlerhafter=20Sprach=C3=BCbergabe=20?= =?UTF-8?q?wird=20die=20Defaultsprache=20verwendet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/index.php | 4 +++- include/sprache.class.php | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/cis/index.php b/cis/index.php index ee2a23ea5..7c430953e 100644 --- a/cis/index.php +++ b/cis/index.php @@ -59,9 +59,11 @@ if(isset($_GET['sprache'])) { $sprache = new sprache(); if($sprache->load($_GET['sprache'])) + { setSprache($_GET['sprache']); + } else - die('Sprache invalid'); + setSprache(DEFAULT_LANGUAGE); } if(isset($_GET['content_id'])) { diff --git a/include/sprache.class.php b/include/sprache.class.php index 625809c2e..72d3a5ebd 100644 --- a/include/sprache.class.php +++ b/include/sprache.class.php @@ -58,19 +58,27 @@ class sprache extends basis_db { $qry = "SELECT * FROM public.tbl_sprache WHERE sprache=".$this->db_add_param($sprache, FHC_STRING, false).";"; - if(!$this->db_query($qry)) + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->sprache = $row->sprache; + $this->locale = $row->locale; + $this->index = $row->index; + $this->content = $this->db_parse_bool($row->content); + return true; + } + else + { + $this->errormsg = 'Sprache nicht gefunden'; + return false; + } + } + else { $this->errormsg = "Fehler bei der Abfrage."; - return false; + return false; } - if($row = $this->db_fetch_object()) - { - $this->sprache = $row->sprache; - $this->locale = $row->locale; - $this->index = $row->index; - $this->content = $this->db_parse_bool($row->content); - } - return true; } /**