1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* NewBB 5.0x, the forum module for XOOPS project |
4
|
|
|
* |
5
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
6
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
7
|
|
|
* @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
8
|
|
|
* @since 4.00 |
9
|
|
|
* @package module::newbb |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.ini.php'); |
14
|
|
|
require_once __DIR__ . '/functions.session.php'; |
15
|
|
|
|
16
|
|
|
// NewBB cookie structure |
17
|
|
|
/* NewBB cookie storage |
18
|
|
|
Long term cookie: (configurable, generally one month) |
19
|
|
|
LV - Last Visit |
20
|
|
|
M - Menu mode |
21
|
|
|
V - View mode |
22
|
|
|
G - Toggle |
23
|
|
|
Short term cookie: (same as session life time) |
24
|
|
|
ST - Stored Topic IDs for mark |
25
|
|
|
LP - Last Post |
26
|
|
|
LF - Forum Last view |
27
|
|
|
LT - Topic Last read |
28
|
|
|
LVT - Last Visit Temp |
29
|
|
|
*/ |
30
|
|
|
|
31
|
|
|
/* -- Cookie settings -- */ |
32
|
|
|
$forumCookie['domain'] = ''; |
33
|
|
|
$forumCookie['path'] = '/'; |
34
|
|
|
$forumCookie['secure'] = false; |
35
|
|
|
$forumCookie['expire'] = time() + 3600 * 24 * 30; // one month |
36
|
|
|
$forumCookie['prefix'] = 'newbb_' . (is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : '0IP' . \Xmf\IPAddress::fromRequest()->asReadable()); // irmtfan IP for anons - use $GLOBALS["xoopsUser"] |
37
|
|
|
|
38
|
|
|
// set LastVisitTemp cookie, which only gets the time from the LastVisit cookie if it does not exist yet |
39
|
|
|
// otherwise, it gets the time from the LastVisitTemp cookie |
40
|
|
|
$last_visit = newbbGetSession('LV'); |
41
|
|
|
$last_visit = $last_visit ?: newbbGetCookie('LV'); |
42
|
|
|
$last_visit = $last_visit ?: time(); |
43
|
|
|
|
44
|
|
|
// update LastVisit cookie. |
45
|
|
|
newbbSetCookie('LV', time(), $forumCookie['expire']); // set cookie life time to one month |
46
|
|
|
newbbSetSession('LV', $last_visit); |
|
|
|
|
47
|
|
|
|
48
|
|
|
// include customized variables |
49
|
|
|
if (is_object($GLOBALS['xoopsModule']) && 'newbb' === $GLOBALS['xoopsModule']->getVar('dirname', 'n')) { |
50
|
|
|
$GLOBALS['xoopsModuleConfig'] = newbbLoadConfig(); |
51
|
|
|
} |
52
|
|
|
|