From: vincent@cubedesigners.com Date: Tue, 18 Dec 2012 09:11:30 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=934c29cd530f1710ff7c88373e5b4e44c39cacae;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index c3ddced63..5b7fba821 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -359,9 +359,9 @@ class wsFlash extends cubeFlashGateway { } else { $right = 'r'; } - - - + + + $t->addAttribute('right', $right); $t->addAttribute('proprietaire', $theme->proprietaire_nom); $t->addAttribute('books', max(($theme->nbBooks) - ($mine ? 1 : 0), 0)); @@ -635,6 +635,12 @@ class wsFlash extends cubeFlashGateway { } } + if (isset($bookLang)) { + if (wsLang::compare($bookLang, $book->lang)) { + unset($bookLang); + } + } + $dao = new wsDAOLang($core->con); $langs = $dao->selectAll(); foreach ($langs as $lang) { diff --git a/inc/ws/Metier/class.ws.lang.php b/inc/ws/Metier/class.ws.lang.php index 52c91b7ab..52a7377dd 100644 --- a/inc/ws/Metier/class.ws.lang.php +++ b/inc/ws/Metier/class.ws.lang.php @@ -97,6 +97,34 @@ class wsLang extends cubeMetier { return $res; } + public static function compare(&$traductions, $lang) { + global $core; + $daoLang = new wsDAOLang($core->con); + $lang = $daoLang->selectById($lang); + + foreach ($lang->traductions as $k => $v) { + if (!isset($traductions[$k]) || $traductions[$k] == '') { + $traductions[$k] = $v; + continue; + } + if (self::cleanstr($traductions[$k]) != self::cleanstr($v)) { + fb(self::cleanstr($traductions[$k])); + fb(self::cleanstr($v)); + return false; + } + } + + return true; + } + + protected static function cleanstr($str) { + $str = trim($str); + $str = str_replace("\r\n", "\n", $str); + $str = str_replace("\r", "\n", $str); + + return trim($str); + } + public static function checkTranslations($traductions) { foreach ($traductions as $k => $v) { if (is_int($k) || intval($k) > 0) { @@ -104,6 +132,9 @@ class wsLang extends cubeMetier { } break; } + if (isset($traductions->{"0"})) { + unset($traductions->{"0"}); + } return $traductions; }