From: Zheng Zhu Date: Fri, 24 Sep 2004 19:02:39 +0000 (+0000) Subject: Added a simple syntax check in the conversion code X-Git-Tag: 1.5.0alpha1~1814 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=d07ce937ee4ec80f87c773ba69e60b8e5bbd12b2;p=lhc%2Fweb%2Fwiklou.git Added a simple syntax check in the conversion code --- diff --git a/languages/Language.php b/languages/Language.php index f736314590..ee7ea8e351 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1996,21 +1996,28 @@ class Language { $marked = explode("}-", $txt); $choice = explode(";", $marked{0}); - if($choice{1}==NULL) { + if(!array_key_exists(1, $choice)) { + /* a single choice */ $text .= $choice{0}; } else { foreach($choice as $c) { - list($code, $content) = split(":", $c); - $code = trim($code); - $content = trim($content); + $v = explode(":", $c); + if(!array_key_exists(1, $v)) { + //syntax error in the markup, give up + $text .= $marked{0}; + break; + } + $code = trim($v{0}); + $content = trim($v{1}); if($code == $plang) { $text .= $content; break; } } } - $text .= $this->autoConvert($marked{1}); + if(array_key_exists(1, $marked)) + $text .= $this->autoConvert($marked{1}); } return $text;