From: vincent@cubedesigners.com Date: Tue, 2 Jan 2024 16:43:52 +0000 (+0000) Subject: wait #6575 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8864ea09f3db6f903282425c58e17b36bba9d7e9;p=fluidbook-v3.git wait #6575 @2 --- diff --git a/.htaccess b/.htaccess index ba6c79b..f05e199 100644 --- a/.htaccess +++ b/.htaccess @@ -29,9 +29,6 @@ RewriteRule ^google[a-f0-9]*.html$ index.php [L,END] RewriteRule ^BingSiteAuth.xml$ index.php [L,END] - RewriteCond %{HTTPS} off - RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] - # Redirection to www. subdomain RewriteCond %{HTTP_HOST} ^fluidbook.com$ RewriteRule ^(.*)$ https://www.fluidbook.com/$1 [R=301,L] diff --git a/framework/application/configs/application.ini b/framework/application/configs/application.ini index dbe95a5..44a1330 100644 --- a/framework/application/configs/application.ini +++ b/framework/application/configs/application.ini @@ -24,10 +24,10 @@ session.lifetime = 31536000 ;1 year session.adapter = cache database.adapter = pdo_mysql -database.params.host = localhost -database.params.username = fluidbookwebv3 -database.params.password = QsFe2wxVMW -database.params.dbname = fluidbookwebv3 +database.params.host = fluidbook-v3-mariadb +database.params.username = root +database.params.password = FB8qVD7R0jqsXYNR +database.params.dbname = fluidbook-v3 seo.universalAnalytics = UA-4339912-2 seo.google = google93c0129ef18a399d.html @@ -65,7 +65,7 @@ webhost = elearning.fluidbook.com locales.en = elearning.fluidbook.com locales.fr = fr.elearning.fluidbook.com -database.params.dbname = fluidbook_elearning +database.params.dbname = fluidbook-v3-elearning [testing : production] @@ -78,10 +78,8 @@ seo.universalAnalytics = UA-4339912-9 httpauth.username = fluidbook httpauth.password = fb2016 -httpauth.ip_whitelist[] = 82.66.245.49 -httpauth.ip_whitelist[] = 82.216.164.184 -httpauth.ip_whitelist[] = 82.66.120.161 -httpauth.ip_whitelist[] = 78.193.201.107 +httpauth.ip_whitelist[] = 130.180.213.67 +httpauth.ip_whitelist[] = 82.64.156.165 robots = false @@ -90,18 +88,8 @@ webhost = dev.fluidbook.com locales.fr = dev.fluidbook.com locales.en = en.dev.fluidbook.com -database.params.dbname = fluidbookwebv3_dev - -[local : production] - -dev = true -firephp = false - -webhost = fluidbook.test -locales.fr = fluidbook.test -locales.en = en.fluidbook.test - +database.params.host = fluidbook-v3-dev-mariadb database.params.username = root -database.params.password = -database.params.dbname = fluidbook-website +database.params.password = ryruth0YzzuUn7Eq +database.params.dbname = fluidbook-v3-dev diff --git a/framework/application/views/helpers/ExemplePublication.php b/framework/application/views/helpers/ExemplePublication.php index 8d2a17d..dba8a9a 100644 --- a/framework/application/views/helpers/ExemplePublication.php +++ b/framework/application/views/helpers/ExemplePublication.php @@ -1,87 +1,89 @@ array('prop' => 'background-image', 'format' => 'url("%s")'), - 'size' => array('prop' => 'background-size', 'format' => '%s'), - 'position' => array('prop' => 'background-position', 'format' => '%s'), - 'blendmode' => array('prop' => 'background-blend-mode', 'format' => '%s'), - ); + $cssprops = array('image' => array('prop' => 'background-image', 'format' => 'url("%s")'), + 'size' => array('prop' => 'background-size', 'format' => '%s'), + 'position' => array('prop' => 'background-position', 'format' => '%s'), + 'blendmode' => array('prop' => 'background-blend-mode', 'format' => '%s'), + ); - - $left = $this->_getPage($fluidbook_id, $page); - $right = $this->_getPage($fluidbook_id, $page + 1); + $left = $this->_getPage($fluidbook_id, $page); + $right = $this->_getPage($fluidbook_id, $page + 1); // Sometimes a page might not return a valid size (eg. Page 0 with no graphic) // If the left page doesn't work, use the right page $width = ($left['width'] == -1) ? $right['width'] : $left['width']; $height = ($left['height'] == -1) ? $right['height'] : $left['height']; - $ratio = $width / $height; + $ratio = $width / $height; - $backgrounds = array(); - // $backgrounds[] = array('image' => '/images/exemples/publications/shadow.png', 'size' => '100% 10%', 'position' => '0 95%', 'blendmode' => null); - $backgrounds[] = array('image' => $left['url'], 'size' => '50% 100%', 'position' => '1px 0', 'blendmode' => 'normal'); - $backgrounds[] = array('image' => $right['url'], 'size' => '50% 100%', 'position' => '100% 0', 'blendmode' => 'normal'); - $backgrounds[] = array('image' => '/images/exemples/publications/light.png', 'size' => '30% 100%', 'position' => '50% 0', 'blendmode' => 'soft-light'); - $backgrounds[] = array('image' => '/images/exemples/publications/dark.png', 'size' => '20% 100%', 'position' => '50% 0', 'blendmode' => 'multiply'); + $backgrounds = array(); + // $backgrounds[] = array('image' => '/images/exemples/publications/shadow.png', 'size' => '100% 10%', 'position' => '0 95%', 'blendmode' => null); + $backgrounds[] = array('image' => $left['url'], 'size' => '50% 100%', 'position' => '1px 0', 'blendmode' => 'normal'); + $backgrounds[] = array('image' => $right['url'], 'size' => '50% 100%', 'position' => '100% 0', 'blendmode' => 'normal'); + $backgrounds[] = array('image' => '/images/exemples/publications/light.png', 'size' => '30% 100%', 'position' => '50% 0', 'blendmode' => 'soft-light'); + $backgrounds[] = array('image' => '/images/exemples/publications/dark.png', 'size' => '20% 100%', 'position' => '50% 0', 'blendmode' => 'multiply'); - $backgrounds = array_reverse($backgrounds); + $backgrounds = array_reverse($backgrounds); - $res = ''; - $res .= $this->htmlElement($this->htmlElement('', 'div', array('class' => 'shadow')), 'div', array( - 'class' => 'exemple-fluidbook', + $res .= '}'; + $res .= ''; + $res .= $this->htmlElement($this->htmlElement('', 'div', array('class' => 'shadow')), 'div', array( + 'class' => 'exemple-fluidbook', 'id' => $cssid, 'data-width' => $width * 2, 'data-height' => $height)); - return $res; - } + return $res; + } - protected function _getPage($fluidbook_id, $page) { - $path = 'fluidbook/' . $fluidbook_id . '/'; - $dir = FILES_PATH . '/' . $path; - if (!file_exists($dir)) { - mkdir($dir, 0777, true); - } + protected function _getPage($fluidbook_id, $page) + { + $path = 'fluidbook/' . $fluidbook_id . '/'; + $dir = FILES_PATH . '/' . $path; + if (!file_exists($dir)) { + mkdir($dir, 0777, true); + } - $url = '/files/' . $path . $page . '.jpg'; - $file = $dir . $page . '.jpg'; - if (!file_exists($file) || !filesize($file)) { - $wsurl = 'https://workshop.fluidbook.com/services/getFluidbookPage/' . $fluidbook_id . '/' . $page; - file_put_contents($file, file_get_contents($wsurl)); - } - $size = CubeIT_Image::getDimensions($file, $width, $height); - return array('url' => $url, 'width' => $width, 'height' => $height); - } + $url = '/files/' . $path . $page . '.jpg'; + $file = $dir . $page . '.jpg'; + if (!file_exists($file) || !filesize($file)) { + $toolbox = 'https://toolbox.fluidbook.com/services/getFluidbookPageFromWebsiteV3/' . $fluidbook_id . '/' . $page; + file_put_contents($file, file_get_contents($toolbox)); + } + CubeIT_Image::getDimensions($file, $width, $height); + return array('url' => $url, 'width' => $width, 'height' => $height); + } } \ No newline at end of file diff --git a/framework/application/views/helpers/Exemples.php b/framework/application/views/helpers/Exemples.php index 5182449..b441c4b 100644 --- a/framework/application/views/helpers/Exemples.php +++ b/framework/application/views/helpers/Exemples.php @@ -1,166 +1,169 @@ headScript() - ->addMasonry() - ->addJQueryTransform() - ->addTinysort() - ->addDotDotDot() - ->addScriptAndStyle('220-exemples'); - - $exemples = Fluidbook_Model_Reference::factory()->order('date DESC')->find(); - $this->_categories = Fluidbook_Model_Reference_Category::factory()->find(); - - $perline = 5.0; - - $featured = array(); - $normal = array(); - $c = 0; - - $okexemples = array(); - - foreach ($exemples as $id => $exemple) { - if ($category > 0 && !in_array($category, $exemple->getCategories()) && !in_array($category, $exemple->getFeaturedCategories())) { - continue; - } - $okexemples[$id] = $exemple; - $c++; - } - - $c = CubeIT_Math::round($c, $perline, 'floor'); - $nb = min($c, CubeIT_Math::round($nb, $perline, 'floor')); - $max_featured = floor($nb / $perline); - $normal_per_featured = $perline - 1; - $max_normal = $max_featured * $normal_per_featured; - - foreach ($okexemples as $id => $exemple) { - if (in_array($category, $exemple->getFeaturedCategories())) { - $featured[] = $id; - } else { - $normal[] = $id; - } - } - - $nb_featured = count($featured); - if ($nb_featured < $max_featured) { - for ($i = $nb_featured; $i < $max_featured; $i++) { - $featured[] = array_shift($normal); - } - } - $nb_featured = count($featured); - - if ($nb_featured > $max_featured) { - for ($i = $max_featured; $i < $nb_featured; $i++) { - $normal[] = array_pop($featured); - } - } - $nb_featured = count($featured); - - $featured = array_slice($featured, 0, $max_featured); - $normal = array_slice($normal, 0, $max_normal); - - $res = $this->title($title, 'h2', array('class' => 'col-2')); - - $e = 0; - - $publications = ''; - for ($i = 0; $i < $max_featured; $i++) { - if ($i % 2 == 0) { - $publications .= $this->_publication($exemples[$featured[$i]], $category, 1 + $i * 7, true); - } - for ($j = 0; $j < $normal_per_featured; $j++) { - $k = ($i * $normal_per_featured) + $j; - if ($j == 2 && $i % 2 == 1) { - $publications .= $this->_publication($exemples[$featured[$i]], $category, 1 + $i * 7, true); - } - $publications .= $this->_publication($exemples[$normal[$k]], $category, ($i * 7) + $j + 2, false); - } - } - - $res .= $this->htmlElement($publications, 'div', array('class' => 'publications col-6')); - return $this->htmlElement($res, 'section', array('class' => "exemples content-wrapper grid wrap")); - } - - /** - * @param $f Fluidbook_Model_Reference - * @param bool $featured - */ - protected function _publication($f, $category, $i, $featured = false) { - if (null === $f) { - return; - } - - $fr = $f->unserialize('fr'); - $f = $f->unserialize(); - - $res = ''; - - $res .= $this->htmlElement($f->getTitle(), 'h3'); - if ($featured && !is_array($f->getText())) { - - $res .= $this->htmlElement($f->getText(), 'p', ['class' => 'feature-description']); - } - - $image = CubeIT_Util_Cms::extractFile($f->getImage()); - - - if (!$image && $f->getFluidbookId()) { - $res .= $this->exemplePublication($f->getFluidbookId(), $f->getFluidbookPage()); - } else { - $res .= $this->htmlElement('', 'div', - array('style' => 'background-image:url(' . $this->imageProcess()->imageProcessGetURL( - $image, - $f->getTitle() - , 1200, 1200, - array(), 'R') . ');', - 'class' => 'img full') - ); - } - $attrs = array('data-j' => ++$this->_j, 'data-i' => $i); - if ($featured) { - $attrs['class'] = 'featured'; - } else { - $attrs['class'] = 'no-featured'; - } - - $res .= $this->_rollover($f, $category, $f->getFinalUrl()); - return $this->htmlElement($res, 'article', $attrs); - } - - protected function _rollover($f, $category, $url) { - $res = ''; - - if ($url && $url != '-') { - $res = $this->linkTruePopupFullscreen(__('Voir le Fluidbook'), $url, array('class' => 'button', 'data-event' => array('category' => 'exemple', 'action' => 'see', 'label' => $f->getTitle()))); - } - if ($category == 3) { - $firstCat = 0; - foreach ($f->getCategories() as $c) { - if ($c == 3) { - continue; - } - $firstCat = $c; - break; - } - if ($firstCat != 0 && isset($this->_categories[$firstCat])) { - $cat = $this->_categories[$firstCat]->unserialize(); - $pages = CubeIT_Util_Cms::findPagesByContent('category', $cat->getId()); - shuffle($pages); - - if (count($pages) > 0) { - $res .= $this->link($cat->getLinklabel(), 'internal:' . $pages[0], array('class' => 'others')); - } - } - - } - return $this->htmlElement($res, 'div', array('class' => 'more')); - } +class Fluidbook_View_Helper_Exemples extends CubeIT_View_Helper_Abstract +{ + + protected $_categories; + protected $_j = 0; + + /** + * @return string + */ + public function exemples($category, $title, $nb) + { + $this->headScript() + ->addMasonry() + ->addJQueryTransform() + ->addTinysort() + ->addDotDotDot() + ->addScriptAndStyle('220-exemples'); + + $exemples = Fluidbook_Model_Reference::factory()->order('date DESC')->find(); + $this->_categories = Fluidbook_Model_Reference_Category::factory()->find(); + + $perline = 5.0; + + $featured = array(); + $normal = array(); + $c = 0; + + $okexemples = array(); + + foreach ($exemples as $id => $exemple) { + if ($category > 0 && !in_array($category, $exemple->getCategories()) && !in_array($category, $exemple->getFeaturedCategories())) { + continue; + } + $okexemples[$id] = $exemple; + $c++; + } + + $c = CubeIT_Math::round($c, $perline, 'floor'); + $nb = min($c, CubeIT_Math::round($nb, $perline, 'floor')); + $max_featured = floor($nb / $perline); + $normal_per_featured = $perline - 1; + $max_normal = $max_featured * $normal_per_featured; + + foreach ($okexemples as $id => $exemple) { + if (in_array($category, $exemple->getFeaturedCategories())) { + $featured[] = $id; + } else { + $normal[] = $id; + } + } + + $nb_featured = count($featured); + if ($nb_featured < $max_featured) { + for ($i = $nb_featured; $i < $max_featured; $i++) { + $featured[] = array_shift($normal); + } + } + $nb_featured = count($featured); + + if ($nb_featured > $max_featured) { + for ($i = $max_featured; $i < $nb_featured; $i++) { + $normal[] = array_pop($featured); + } + } + $nb_featured = count($featured); + + $featured = array_slice($featured, 0, $max_featured); + $normal = array_slice($normal, 0, $max_normal); + + $res = $this->title($title, 'h2', array('class' => 'col-2')); + + $e = 0; + + $publications = ''; + for ($i = 0; $i < $max_featured; $i++) { + if ($i % 2 == 0) { + $publications .= $this->_publication($exemples[$featured[$i]], $category, 1 + $i * 7, true); + } + for ($j = 0; $j < $normal_per_featured; $j++) { + $k = ($i * $normal_per_featured) + $j; + if ($j == 2 && $i % 2 == 1) { + $publications .= $this->_publication($exemples[$featured[$i]], $category, 1 + $i * 7, true); + } + $publications .= $this->_publication($exemples[$normal[$k]], $category, ($i * 7) + $j + 2, false); + } + } + + $res .= $this->htmlElement($publications, 'div', array('class' => 'publications col-6')); + return $this->htmlElement($res, 'section', array('class' => "exemples content-wrapper grid wrap")); + } + + /** + * @param $f Fluidbook_Model_Reference + * @param bool $featured + */ + protected function _publication($f, $category, $i, $featured = false) + { + if (null === $f) { + return; + } + + $fr = $f->unserialize('fr'); + $f = $f->unserialize(); + + $res = ''; + + $res .= $this->htmlElement($f->getTitle(), 'h3'); + if ($featured && !is_array($f->getText())) { + + $res .= $this->htmlElement($f->getText(), 'p', ['class' => 'feature-description']); + } + + $image = CubeIT_Util_Cms::extractFile($f->getImage()); + + if (!$image && $f->getFluidbookId()) { + $res .= $this->exemplePublication($f->getFluidbookId(), $f->getFluidbookPage()); + } else { + $res .= $this->htmlElement('', 'div', + array('style' => 'background-image:url(' . $this->imageProcess()->imageProcessGetURL( + $image, + $f->getTitle() + , 1200, 1200, + array(), 'R') . ');', + 'class' => 'img full') + ); + } + $attrs = array('data-j' => ++$this->_j, 'data-i' => $i); + if ($featured) { + $attrs['class'] = 'featured'; + } else { + $attrs['class'] = 'no-featured'; + } + + $res .= $this->_rollover($f, $category, $f->getFinalUrl()); + return $this->htmlElement($res, 'article', $attrs); + } + + protected function _rollover($f, $category, $url) + { + $res = ''; + + if ($url && $url != '-') { + $res = $this->linkTruePopupFullscreen(__('Voir le Fluidbook'), $url, array('class' => 'button', 'data-event' => array('category' => 'exemple', 'action' => 'see', 'label' => $f->getTitle()))); + } + if ($category == 3) { + $firstCat = 0; + foreach ($f->getCategories() as $c) { + if ($c == 3) { + continue; + } + $firstCat = $c; + break; + } + if ($firstCat != 0 && isset($this->_categories[$firstCat])) { + $cat = $this->_categories[$firstCat]->unserialize(); + $pages = CubeIT_Util_Cms::findPagesByContent('category', $cat->getId()); + shuffle($pages); + + if (count($pages) > 0) { + $res .= $this->link($cat->getLinklabel(), 'internal:' . $pages[0], array('class' => 'others')); + } + } + + } + return $this->htmlElement($res, 'div', array('class' => 'more')); + } } \ No newline at end of file