]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Dec 2010 14:52:26 +0000 (14:52 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Dec 2010 14:52:26 +0000 (14:52 +0000)
inc/extranet/Controlleur/class.extranet.core.php
inc/prepend.php
inc/ws/Controlleur/_common.php
inc/ws/Controlleur/class.ws.services.php [new file with mode: 0644]

index 769f20780a954bb711b630a135f70020c1b30632..e43a1764a9c1542306eeaf37107eeb38e5cdc567 100644 (file)
@@ -367,6 +367,13 @@ class extranetCore extends cubeCore {
                $db->book_pages->reference('fk_book_pages_book_id', 'book_id', 'books', 'book_id');\r
                $db->book_pages->reference('fk_book_pages_document_id', 'document_id', 'documents', 'document_id');\r
                // .\r
+               // Table de cache des urls courtes\r
+               $db->book_short_url->long_url('varchar', 255, false);\r
+               $db->book_short_url->short_url('varchar', 64, false);\r
+               $db->book_short_url->book_id('integer', 0, false);\r
+               // Clés\r
+               $db->book_short_url->index('index_book_short_url_long_url', 'BTREE', 'long_url');\r
+               $db->book_short_url->index('index_book_short_url_book_id', 'BTREE', 'book_id');\r
                try {\r
                        $dbi = new CubeDbStruct($this->con);\r
                        $dbi->synchronize($db);\r
index 006e28b2b81b5dc0e40fcb408cfde61b15d7033d..6894bfc2d5343c98388b6ac91205985075e68a30 100644 (file)
@@ -21,6 +21,7 @@ $core->url->register('ajax', 'ajax', '^ajax(.*)$', array('cubeAjax', 'ajax'));
 $core->url->register('cleanDownload', 'cleanDownload', '^cleanDownload$', array('extranetUrl', 'cleanDownload'));\r
 // Fluidbook Workshop\r
 $core->url->register('flash', 'flash', '^flash(.*)$', array('wsFlash', 'in'));\r
+$core->url->register('services', 'services', '^services(.*)$', array('wsServices', 'in'));\r
 $core->url->register('editor', 'editor', '^editor/(.*)$', array('wsUrl', 'editor'));\r
 $core->url->register('viewer', 'viewer', '^viewer/(.*)$', array('wsUrl', 'viewer'));\r
 \r
index 69818bdf8a958eaf832f42a40e8cdc6ff70292b5..f77f4f978e3d69325bd1581eb82d524cdf8c1da9 100644 (file)
@@ -6,4 +6,5 @@ $__autoload['wsUrl'] = dirname(__FILE__) . '/class.ws.url.php';
 $__autoload['wsDroits'] = dirname(__FILE__) . '/class.ws.droits.php';\r
 $__autoload['wsConversionSession'] = dirname(__FILE__) . '/class.ws.conversion.session.php';\r
 $__autoload['wsStats']=dirname(__FILE__).'/class.ws.stats.php';\r
+$__autoload['wsServices']=dirname(__FILE__).'/class.ws.services.php';\r
 ?>
\ No newline at end of file
diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php
new file mode 100644 (file)
index 0000000..d4d177d
--- /dev/null
@@ -0,0 +1,47 @@
+<?php\r
+class wsServices extends cubeFlashGateway {\r
+       const CNAME = __CLASS__;\r
+       public static function in($args)\r
+       {\r
+               global $core;\r
+               $args = cubePage::getArgs($args);\r
+               $n = self::CNAME;\r
+               $gateway = new $n($core->con, $args);\r
+       }\r
+\r
+       public function sendEmail()\r
+       {\r
+       }\r
+\r
+       public function shortenURL()\r
+       {\r
+               $bitLyUser = 'fluidbook';\r
+               $bitLyKey = 'R_3858dd1c9884d5c6a5fe386d7e95cf1d';\r
+               // Recherche dans le cache\r
+               $r = $this->con->select('SELECT * FROM book_short_url WHERE long_url=\'' . $this->con->escape($this->args['url']) . '\' LIMIT 1');\r
+               if ($r->count() > 0) {\r
+                       $this->xml->addChild('shortURL', $r->short_url);\r
+                       return;\r
+               }\r
+               // Si pas dans le cache, on le recherche\r
+               $short_url = cubeURLShortener::bitLy($this->args['url'], $bitLyUser, $bitLyKey);\r
+               if (is_null($short_url) || empty($short_url) || !$short_url) {\r
+                       $short_url = cubeURLShortener::tinyURL($this->args['url']);\r
+               }\r
+               $short_url = trim($short_url);\r
+\r
+               $c = $this->con->openCursor('book_short_url');\r
+               $c->long_url = $this->args['url'];\r
+               $c->book_id = $this->args['id'];\r
+               $c->short_url = $short_url;\r
+               $c->insert();\r
+\r
+               $this->xml->addChild('shortURL', $short_url);\r
+       }\r
+\r
+       public function getPDF()\r
+       {\r
+       }\r
+}\r
+\r
+?>
\ No newline at end of file