]> _ Git - cubeextranet.git/commitdiff
wip #3378 @0:15
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jan 2020 15:18:20 +0000 (15:18 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 29 Jan 2020 15:18:20 +0000 (15:18 +0000)
inc/ws/Controlleur/class.ws.services.php

index 39433a23c58cf7b06c0e5235053302b524d56986..8f116fe8301be9c3ef47a9c0e44eb632e93c7f1f 100644 (file)
@@ -1337,11 +1337,24 @@ class wsServices extends cubeFlashGateway
     {
         $this->outputXML = false;
 
+        $limit = time() - (3600 * 24 * 2);
+        $cache = WS_CACHE . '/pinterest/' . sha1($this->args['url']);
         header('Content-type: application/rss+xml');
-        $url = 'https://www.pinterest.com/' . urlencode($this->args['url']);
+
         ob_end_clean();
+        if (file_exists($cache) && filemtime($cache) > $limit) {
+            echo file_get_contents($cache);
+            exit;
+        }
+
+        $url = 'https://www.pinterest.com/' . urlencode($this->args['url']);
         $c = file_get_contents($url);
-        echo $c;
+        if($c) {
+            file_put_contents($c, $cache);
+            echo $c;
+        }else{
+            echo file_get_contents($cache);
+        }
         exit;
     }