$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
$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
$__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
--- /dev/null
+<?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