From: vincent@cubedesigners.com Date: Mon, 23 Jun 2014 10:17:34 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=360b1cc925d02aae68e71d5ecf79d681f3d5c2cf;p=cubeextranet.git --- diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index 853b3593d..0b80db141 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -407,6 +407,11 @@ class commonCore extends cubeCore { $db->books->index('index_books_demo_counter', 'BTREE', 'demo_counter'); $db->books->index('index_books_lang', 'BTREE', 'lang'); $db->books->index('index_books_cid', 'BTREE', 'cid'); + // Book referers + $db->books_referer->book_id('integer', 0, false); + $db->books_referer->referer('varchar', 256, false); + $db->books_referer->count('integer', 0, false); + $db->books_referer->primary('pk_books_referer', 'book_id', 'referer'); // . // Table pages des publications $db->book_pages->book_id('integer', 0, false); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index f599bfcad..dbb36658f 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -1157,8 +1157,10 @@ html{height:100%}' . "\n"; } } + self::logReferer($book_id); echo file_get_contents(WS_BOOKS . '/html5' . $dir . '/' . $book_id . '/index' . $version . '.html'); + exit; } @@ -1333,9 +1335,36 @@ html{height:100%}' . "\n"; $res .= ''; $res .= ''; + self::logReferer($book_id); + return $res; } + public static function logReferer($id) { + + if (!isset($_SERVER['HTTP_REFERER']) || !$_SERVER['HTTP_REFERER']) { + $r = ''; + } else { + $r = $_SERVER['HTTP_REFERER']; + } + + fb($r, $id); + + global $core; + $rr = $core->con->select('SELECT * FROM books_referer WHERE book_id=\'' . $core->con->escape($id) . '\' AND referer=\'' . $core->con->escape($r) . '\''); + $c = $core->con->openCursor('books_referer'); + if (!$rr->count()) { + $c->book_id = $id; + $c->referer = $r; + $c->count = 1; + $c->insert(); + } else { + $rr->fetch(); + $c->count = $rr->count + 1; + $c->update('WHERE book_id=\'' . $core->con->escape($id) . '\' AND referer=\'' . $core->con->escape($r) . '\''); + } + } + public static function statsxls($args) { $bid = (isset($args[1])) ? $args[1] : null; $annee = (isset($args[2])) ? $args[2] : null;