]> _ Git - cubeextranet.git/commitdiff
wait #3872 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 8 Sep 2020 15:37:57 +0000 (15:37 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 8 Sep 2020 15:37:57 +0000 (15:37 +0000)
composer.json
inc/prepend.php
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/Metier/class.ws.document.php
vendor/composer/ClassLoader.php
vendor/composer/autoload_psr4.php
vendor/composer/autoload_static.php
vendor/composer/installed.json

index 6abd43841c26b30599fa1368e8a124f90be89f71..befbdbe91fa68240231c25b2461f5981a73f8d1d 100644 (file)
@@ -1,6 +1,7 @@
 {\r
   "require": {\r
     "php": ">=7.2",\r
-    "php-mime-mail-parser/php-mime-mail-parser": "2.11.1"\r
+    "php-mime-mail-parser/php-mime-mail-parser": "2.11.1",\r
+    "jaybizzle/crawler-detect": "^1.2"\r
   }\r
 }\r
index 3219410837cee322104e05e275a364ec48580c94..33215784b26a882342cc934e88605d3aae6bdaaf 100644 (file)
@@ -6,6 +6,7 @@ if (!isset($_SERVER['SERVER_ADDR'])) {
        }\r
 }\r
 \r
+\r
 // Inclusion du fichier de configuration\r
 require_once(dirname(__FILE__) . '/config.inc.php');\r
 // Chargement de la classe cube\r
@@ -25,6 +26,9 @@ require_once 'Zend/Loader/Autoloader.php';
 $loader = Zend_Loader_Autoloader::getInstance();\r
 $loader->registerNamespace('CubeIT_');\r
 \r
+\r
+require_once __DIR__.'/../vendor/autoload.php';\r
+\r
 if ($ws) {\r
        define('GA', 'UA-4339912-7');\r
        define('MAIL_BCC', 'tech@fluidbook.com');\r
index 0859469190ac09f701d5b27f50345fe2f078a014..ed463dcd4e85af91adc4c728b957bad3db466c39 100644 (file)
@@ -1316,6 +1316,22 @@ class wsMaintenance
         unlink($tmp);
         exit;
     }
+
+    public static function prepareSocialImages()
+    {
+        global $core;
+
+        CubeIT_Util_PHP::neverStop();
+        $dao = new wsDAOBook($core->con);
+        $books = $dao->selectAll();
+        foreach ($books as $book) {
+            file_get_contents('https://workshop.fluidbook.com/services/facebook_thumbnail?cid=' . $book->cid . '&j=' . TIME);
+        }
+    }
+
+    public static function _socialImage($cid){
+        file_get_contents('https://workshop.fluidbook.com/services/facebook_thumbnail?cid=' . $cid . '&j=' . TIME);
+    }
 }
 
 
index ed7545e3f5628ddebae108ea071ff3a2a5370127..30ef8aa9bc088233fee92cbb2d7a2ebc2f1fc0ed 100644 (file)
@@ -192,14 +192,18 @@ class wsServices extends cubeFlashGateway
                 if (file_exists($c)) {
                     $cover = $c;
                 }
-            } else {
+            }
+
+            if (!isset($cover)) {
                 $cover = WS_FILES . '/social_image/' . $id . '.jpg';
-                $limit = TIME - (3600 * 24 * 3);
+                $limit = TIME - (3600 * 24 * 5);
+
                 if (isset($_GET['force']) || !file_exists($cover) || filemtime($cover) < $limit) {
                     $w = 1200;
                     $h = 628;
                     $tmp = CubeIT_Files::tempnam() . '.svg';
                     $cl = new CubeIT_CommandLine('xvfb-run');
+                    $cl->setArg('a');
                     $cl->setArg('server-args', '-screen 0, ' . $w . 'x' . $h . 'x24');
                     $cl->setArg(null, '/usr/bin/cutycapt');
                     $cl->setArg('min-width', $w);
@@ -211,14 +215,13 @@ class wsServices extends cubeFlashGateway
                     $cl->execute();
                     $cl->debug();
 
-                    $geo=$w.'x'.$h;
+                    $geo = $w . 'x' . $h;
                     `convert $tmp -crop $geo+0+0 +repage -resize $geo -flatten  $cover`;
                     unlink($tmp);
                 }
             }
         }
 
-
         cubeHTTP::relayFile($cover);
         exit;
     }
index b96d77c7cc7ee30f88901fa09158d9a51f6fdd3d..d36fa289986b7b53ba81d41551ed89ab4f952360 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+
 class wsUrl
 {
 
@@ -1140,10 +1141,11 @@ html.tall{height:150%}' . "\n";
             http::redirect(SITE_PATH . 'viewerh/' . implode('_', $e) . '/' . $q);
             exit;
         }
-
-        if (!$nointerface) {
+        $CrawlerDetect = new Jaybizzle\CrawlerDetect\CrawlerDetect();
+        if (!$nointerface && !$CrawlerDetect->isCrawler()) {
             $book->parametres->scorm_enable = false;
             $dao->compile($book_id, 'html5', false, false, false, $book, false);
+            wsMaintenance::_socialImage($book->cid);
         }
 
         $book_id = $e[0];
index e30cd1b71ac68f4b930def9da9353f2590522778..1db28b0b51a37a432ac3bace35ed31d32f7412de 100644 (file)
@@ -110,7 +110,7 @@ class wsDocument extends cubeMetier
     public function copyOriginalFromOlderVersion()
     {
         if (!file_exists($this->in)) {
-            copy('https://ws.fluidbook.com/docs/' . $this->document_id . '/original.pdf', $this->in);
+          //  copy('https://ws.fluidbook.com/docs/' . $this->document_id . '/original.pdf', $this->in);
         }
     }
 
index 95f7e0978bad11efb1f75f5049b0c2ac7ae1939b..fce8549f0781bafdc7da2301b84d048286757445 100644 (file)
@@ -279,7 +279,7 @@ class ClassLoader
      */
     public function setApcuPrefix($apcuPrefix)
     {
-        $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
+        $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
     }
 
     /**
index 9ea3b77767aa9e4d7ee81c3a02e8e88fd44f8bee..6ae49c2b62ae0f27787e93a4d5c98bc735a0df63 100644 (file)
@@ -7,4 +7,5 @@ $baseDir = dirname($vendorDir);
 
 return array(
     'PhpMimeMailParser\\' => array($vendorDir . '/php-mime-mail-parser/php-mime-mail-parser/src'),
+    'Jaybizzle\\CrawlerDetect\\' => array($vendorDir . '/jaybizzle/crawler-detect/src'),
 );
index 62403a9eb5f0ca0e49cadd9a9007e186f9749270..7bb508acf957a96bee090b2f14b0783e6023d9e4 100644 (file)
@@ -11,6 +11,10 @@ class ComposerStaticInit920111649f7e87249f1f2fbc0fd23976
         array (
             'PhpMimeMailParser\\' => 18,
         ),
+        'J' => 
+        array (
+            'Jaybizzle\\CrawlerDetect\\' => 24,
+        ),
     );
 
     public static $prefixDirsPsr4 = array (
@@ -18,6 +22,10 @@ class ComposerStaticInit920111649f7e87249f1f2fbc0fd23976
         array (
             0 => __DIR__ . '/..' . '/php-mime-mail-parser/php-mime-mail-parser/src',
         ),
+        'Jaybizzle\\CrawlerDetect\\' => 
+        array (
+            0 => __DIR__ . '/..' . '/jaybizzle/crawler-detect/src',
+        ),
     );
 
     public static function getInitializer(ClassLoader $loader)
index 037daaa55b5a35512f85f37525a0e98a86dfad30..bc1984c698ed9fed8b5bdd5d4e05e8af8ca7092f 100644 (file)
@@ -1,4 +1,55 @@
 [
+    {
+        "name": "jaybizzle/crawler-detect",
+        "version": "v1.2.99",
+        "version_normalized": "1.2.99.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/JayBizzle/Crawler-Detect.git",
+            "reference": "0ffea34489b258a2709bfe93a9553e1efa5d1904"
+        },
+        "dist": {
+            "type": "zip",
+            "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/0ffea34489b258a2709bfe93a9553e1efa5d1904",
+            "reference": "0ffea34489b258a2709bfe93a9553e1efa5d1904",
+            "shasum": ""
+        },
+        "require": {
+            "php": ">=5.3.0"
+        },
+        "require-dev": {
+            "phpunit/phpunit": "^4.8|^5.5|^6.5",
+            "satooshi/php-coveralls": "1.*"
+        },
+        "time": "2020-08-25T21:35:55+00:00",
+        "type": "library",
+        "installation-source": "dist",
+        "autoload": {
+            "psr-4": {
+                "Jaybizzle\\CrawlerDetect\\": "src/"
+            }
+        },
+        "notification-url": "https://packagist.org/downloads/",
+        "license": [
+            "MIT"
+        ],
+        "authors": [
+            {
+                "name": "Mark Beech",
+                "email": "m@rkbee.ch",
+                "role": "Developer"
+            }
+        ],
+        "description": "CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent",
+        "homepage": "https://github.com/JayBizzle/Crawler-Detect/",
+        "keywords": [
+            "crawler",
+            "crawler detect",
+            "crawler detector",
+            "crawlerdetect",
+            "php crawler detect"
+        ]
+    },
     {
         "name": "php-mime-mail-parser/php-mime-mail-parser",
         "version": "2.11.1",