]> _ Git - cubeextranet.git/commitdiff
wait #5307
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Jun 2022 16:37:21 +0000 (16:37 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Jun 2022 16:37:21 +0000 (16:37 +0000)
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Controlleur/class.ws.url.php

index e30cdf6bbb31f089b9828fd5093678fa423745b6..1eca5f90f5cb9368c3cb8114747a35abe2da872c 100644 (file)
@@ -1409,7 +1409,12 @@ class wsMaintenance
 
     public static function _socialImage($cid)
     {
-        file_get_contents('https://workshop.fluidbook.com/services/facebook_thumbnail?cid=' . $cid . '&j=' . TIME);
+        $ctx = stream_context_create(array('http' =>
+            array(
+                'timeout' => 1,  //1200 Seconds is 20 Minutes
+            )
+        ));
+        file_get_contents('https://workshop.fluidbook.com/services/facebook_thumbnail?cid=' . $cid . '&j=' . TIME, $ctx);
     }
 
     public static function mergeLangs()
@@ -1507,7 +1512,7 @@ class wsMaintenance
     public static function bookParams()
     {
         $parent = new wsBook();
-        $t = new wsBookParametres($parent,'export');
+        $t = new wsBookParametres($parent, 'export');
         $t->generateV3Form(false);
     }
 
@@ -1582,7 +1587,7 @@ class wsMaintenance
 
         shuffle($pages);
 
-        echo wsDocument::isFarmUser()?'farm':'not farm'."\n";
+        echo wsDocument::isFarmUser() ? 'farm' : 'not farm' . "\n";
 
         foreach ($pages as $page) {
             foreach ($files as $file) {
@@ -1607,7 +1612,7 @@ class wsMaintenance
         $count = $book->parametres->pages;
         $allPages = range(1, $count);
 
-        $coef=wsDocument::isFarmUser()?2:0.25;
+        $coef = wsDocument::isFarmUser() ? 2 : 0.25;
         $it = round($coef * max(4, min(12, ceil($count / 20))));
 
         shuffle($allPages);
@@ -1615,7 +1620,7 @@ class wsMaintenance
         $portions = array_chunk($allPages, ceil($count / $it));
 
         foreach ($portions as $p) {
-            $url = 'https://workshop.fluidbook.com/maintenance/processPage/' . $book_id . '/' . implode(',', $p) . '/' . ($force ? '1' : '0').'?PHPSESSID=' . session_id();
+            $url = 'https://workshop.fluidbook.com/maintenance/processPage/' . $book_id . '/' . implode(',', $p) . '/' . ($force ? '1' : '0') . '?PHPSESSID=' . session_id();
             echo $url . "\n";
             self::timeoutRequest($url, 1);
         }
index 664409162e6df85ca8fe06ca2d2673db80b2fe18..ea6242825d6e81513601f15d89a1c869bf4c732a 100644 (file)
@@ -173,6 +173,7 @@ class wsServices extends cubeFlashGateway
      */
     public function facebook_thumbnail()
     {
+        CubeIT_Util_PHP::neverStop(true);
         $this->outputXML = false;
         $dao = new wsDAOBook($this->con);
         $daoTheme = new wsDAOTheme($this->con);
@@ -1414,7 +1415,8 @@ class wsServices extends cubeFlashGateway
     }
 
     // Endpoint for the CFOC Fluidbooks (custom cart)
-    public function CFOC() {
+    public function CFOC()
+    {
         $this->outputXML = false;
 
         if (empty($_POST['cart_items'])) {
@@ -1452,7 +1454,7 @@ class wsServices extends cubeFlashGateway
             $current_row++;
 
             // Look up the value by the column keys to ensure the correct order of values
-            foreach(array_keys($column_headings) as $column_index => $column_key) {
+            foreach (array_keys($column_headings) as $column_index => $column_key) {
                 $sheet->setCellValueByColumnAndRow($column_index, $current_row, $cart_item[$column_key]);
 
                 $current_cell_style = $sheet->getStyleByColumnAndRow($column_index, $current_row);
index f25addac917f3ef373b3397cfd8743d0d64384cc..be00ab01f8d9a9e2285a5c49f01868b6f550d660 100644 (file)
@@ -610,7 +610,7 @@ class wsUrl
                     continue;
                 }
                 $tk = 'download_' . $k;
-                if (!$book->parametres->{$tk} && $k !== 'scorm') {
+                if ($k !== 'online' && !$book->parametres->{$tk} && $k !== 'scorm') {
                     if ($core->user->rs == 'Kadreo' || $core->user->rs == 'STUDIOFRANCE') {
                         $disabled = ' class="disabled"';
                     } else {
@@ -1006,6 +1006,7 @@ html.tall{height:150%}' . "\n";
         session_write_close();
 
         $nointerface = isset($_GET['nointerface']);
+        $shortLoading = isset($_GET['shortLoading']);
 
         $args = cubePage::getArgs($args);
 
@@ -1054,7 +1055,7 @@ html.tall{height:150%}' . "\n";
             $q = '?' . $q;
         }
         $limit = time() - 60;
-        if (count($e) <= 2 || ($e[2] < $limit && !$nointerface)) {
+        if (count($e) <= 2 || ($e[2] < $limit && !$nointerface && !$shortLoading)) {
             $e[2] = $time;
             $daoTheme = new wsDAOTheme($core->con);
             if (is_array($forceTheme)) {
@@ -1075,12 +1076,11 @@ html.tall{height:150%}' . "\n";
         }
 
         $CrawlerDetect = new Jaybizzle\CrawlerDetect\CrawlerDetect();
-        if (!isset($_GET['force']) && !$nointerface && !$CrawlerDetect->isCrawler()) {
-            if ($fbv !== 'scorm') {
-                $book->parametres->scorm_enable = false;
-            }
-
-            $dao->compile($book_id, $fbv, false, false, false, $book, false, $forceTheme);
+        if ($fbv !== 'scorm') {
+            $book->parametres->scorm_enable = false;
+        }
+        $dao->compile($book_id, $fbv, false, false, false, $book, false, $forceTheme);
+        if (!isset($_GET['force']) && !$nointerface && !$shortLoading && !$CrawlerDetect->isCrawler()) {
             wsMaintenance::_socialImage($book->cid);
         }
 
@@ -1103,8 +1103,15 @@ html.tall{height:150%}' . "\n";
 
         $res = '<!DOCTYPE html><html>';
         $res .= '<head>';
-        $res .= '<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">';
-        $res .= '<style>
+        $res .= '<script type="text/javascript">function load(){
+    var url=\'' . $url . '\'+window.location.hash;
+    window.location=url;
+};
+</script>';
+        if (!isset($_GET['shortLoading']) || !$_GET['shortLoading']) {
+            $res .= '<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">';
+
+            $res .= '<style>
 @keyframes loader-spin {
   0% {
     transform: rotate(0deg);
@@ -1115,31 +1122,34 @@ html.tall{height:150%}' . "\n";
 }
 *{margin:0;padding:0;}
 html,body{height:100%;cursor: wait;font-family: "Open Sans", Arial;background-color:' . $bgcolor . ';}';
-        $res .= 'h2,h3{text-align:center;color:' . $tcolor . ';font-weight:400;position:relative;top:55%;}';
-        $res .= 'h2{font-size:16px;}';
-        $res .= 'h3{font-size:10px;}';
-        $res .= 'svg{position:absolute;top:calc(50% - 24px);left:calc(50% - 24px);
+            $res .= 'h2,h3{text-align:center;color:' . $tcolor . ';font-weight:400;position:relative;top:55%;}';
+            $res .= 'h2{font-size:16px;}';
+            $res .= 'h3{font-size:10px;}';
+            $res .= 'svg{position:absolute;top:calc(50% - 24px);left:calc(50% - 24px);
         animation-name: loader-spin;
         animation-duration: 1s;
         animation-iteration-count: infinite;
         animation-timing-function: linear;}';
-        $res .= '</style>';
-        $res .= '<script type="text/javascript">function load(){
-    var url=\'' . $url . '\'+window.location.hash;
-    window.location=url;
-}</script>';
-        $res .= '<title>' . $book->parametres->title . '</title>';
-        $res .= '</head>';
-        $res .= '<body onload="load();">';
-        $res .= '<svg width="48" height="48" id="interface-loader" viewBox="0 0 48 48">
+            $res .= '</style>';
+            $res .= '<title>' . $book->parametres->title . '</title>';
+            $res .= '</head>';
+            $res .= '<body onload="load();">';
+            $res .= '<svg width="48" height="48" id="interface-loader" viewBox="0 0 48 48">
         <circle cx="24" cy="24" r="23" fill="' . $lcolor . '"></circle>
         <circle class="animate" cx="24" cy="24" fill="none" stroke="' . $scolor . '" stroke-width="3" r="16"
                 stroke-dasharray="80 80"
                 transform="rotate(0 24 24)">
         </circle>
     </svg>';
-        $res .= '<h2>' . __('Compilation du fluidbook en cours') . '...</h2>';
-        $res .= '<h3>' . __('Cette étape ne sera pas nécessaire lorsque le fluidbook sera installé sur son emplacement définitif') . '</h3>';
+
+            $res .= '<h2>' . __('Compilation du fluidbook en cours') . '...</h2>';
+            $res .= '<h3>' . __('Cette étape ne sera pas nécessaire lorsque le fluidbook sera installé sur son emplacement définitif') . '</h3>';
+        } else {
+            $res .= '<script>load();</script>';
+            $res .= '</head>';
+            $res .= '<body>';
+        }
+
         $res .= '</body>';
         $res .= '</html>';
         echo $res;