From 2547236c1c5e9f0478560135139ef9d27b091756 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 17 Dec 2012 16:39:24 +0000 Subject: [PATCH] --- inc/commons/class.common.url.php | 2 +- inc/ws/Controlleur/class.ws.url.php | 2 +- inc/ws/DAO/class.ws.dao.lang.php | 25 ++++++++++++++++--------- inc/ws/Metier/class.ws.document.php | 10 ++++++---- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/inc/commons/class.common.url.php b/inc/commons/class.common.url.php index 518b400cd..71e96f112 100644 --- a/inc/commons/class.common.url.php +++ b/inc/commons/class.common.url.php @@ -7,7 +7,7 @@ class commonUrl { $args = cubePage::getArgs($args); // Si l'utilisateur n'est pas connecté, on affiche le formulaire // de login - if ($args[0] != 'stats' && (is_null($core->user) || !$core->user)) { + if ((!isset($args[0]) || $args[0] != 'stats') && (is_null($core->user) || !$core->user)) { $args = array('login'); } else { if (isset($args[0]) && $args[0] == 'login') { diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 4a2ac00dd..02a5642a4 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -826,7 +826,7 @@ html{height:100%}' . "\n"; $book_id = $e[0]; - $wmode = $wmode != '' ? $wmode : 'default'; + $wmode = (isset($wmode) && $wmode != '') ? $wmode : 'default'; self::checkDocumentVersionOfBook($book_id); wsSecureSWF::checkProtectedSWF(); diff --git a/inc/ws/DAO/class.ws.dao.lang.php b/inc/ws/DAO/class.ws.dao.lang.php index f63ca2302..16411b239 100644 --- a/inc/ws/DAO/class.ws.dao.lang.php +++ b/inc/ws/DAO/class.ws.dao.lang.php @@ -1,7 +1,8 @@ lang_id = mb_strtolower($r->lang_id); $lang->font = $r->font; @@ -22,26 +23,31 @@ class wsDAOLang extends commonDAO { return $lang; } - public function selectById($lang_id) - { + public function selectById($lang_id) { $r = $this->con->select('SELECT * FROM langues WHERE lang_id=\'' . $this->con->escape($lang_id) . '\''); return $this->singleton($r); } - public function selectAll() - { + public function selectAll() { $r = $this->con->select('SELECT * FROM langues'); return $this->factory($r); } - public function sauve($data) - { + public function sauve($data) { $c = $this->con->openCursor('langues'); $c->lang_id = $data['lang_id']; $c->font = $data['font']; $c->charset = $data['charset']; $c->nsis = $data['nsis']; - $c->traductions = json_encode($data['traductions']); + $traductions = array(); + foreach ($data['traductions'] as $msgid => $text) { + if (substr($msgid, 0, 4) == 'B64_') { + $msgid = base64_decode(substr($msgid, 4)); + } + $traductions[$msgid] = $text; + } + + $c->traductions = json_encode($traductions); $r = $this->con->select('SELECT * FROM langues WHERE lang_id=\'' . $this->con->escape($c->lang_id) . '\''); if (!$r->count()) { $c->insert(); @@ -51,6 +57,7 @@ class wsDAOLang extends commonDAO { return $this->selectById($c->lang_id); } + } ?> \ No newline at end of file diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 0daec3afd..388b515c1 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -618,11 +618,13 @@ class wsDocument extends cubeMetier { $svglog[] = "Evaluate xpath query " . $q; $svglog[] = 'Give ' . $list->length . ' results'; $svglog[] = 'Deleting Nodes in ' . print_r($list, true); - foreach ($list as $node) { + if (count($list)) { + foreach ($list as $node) { - /* @var $node DOMNode */ - $parent = $node->parentNode; - $parent->removeChild($node); + /* @var $node DOMNode */ + $parent = $node->parentNode; + $parent->removeChild($node); + } } } -- 2.39.5