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
|
|
|
use XoopsModules\Newbb; |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
|
16
|
|
|
defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php'; |
17
|
|
|
define('NEWBB_FUNCTIONS_READ_LOADED', true); |
18
|
|
|
|
19
|
|
|
if (!defined('NEWBB_FUNCTIONS_READ')) { |
20
|
|
|
define('NEWBB_FUNCTIONS_READ', 1); |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param $type |
24
|
|
|
* @param $item_id |
25
|
|
|
* @param $post_id |
26
|
|
|
* @param null $uid |
|
|
|
|
27
|
|
|
* @return mixed |
28
|
|
|
*/ |
29
|
|
|
function newbbSetRead($type, $item_id, $post_id, $uid = null) |
30
|
|
|
{ |
31
|
|
|
/** @var Newbb\ReadHandler $readHandler */ |
32
|
|
|
$readHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Read' . $type); |
33
|
|
|
|
34
|
|
|
return $readHandler->setRead($item_id, $post_id, $uid); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param $type |
39
|
|
|
* @param $item_id |
40
|
|
|
* @param null $uid |
|
|
|
|
41
|
|
|
* @return mixed |
42
|
|
|
*/ |
43
|
|
|
function newbbGetRead($type, $item_id, $uid = null) |
44
|
|
|
{ |
45
|
|
|
/** @var Newbb\ReadHandler $readHandler */ |
46
|
|
|
$readHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Read' . $type); |
47
|
|
|
|
48
|
|
|
return $readHandler->getRead($item_id, $uid); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param int $status |
53
|
|
|
* @param null $uid |
|
|
|
|
54
|
|
|
* @return mixed |
55
|
|
|
*/ |
56
|
|
|
function newbbSetReadforum($status = 0, $uid = null) |
57
|
|
|
{ |
58
|
|
|
/** @var Newbb\ReadforumHandler $readHandler */ |
59
|
|
|
$ReadforumHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Readforum'); |
60
|
|
|
|
61
|
|
|
return $ReadforumHandler->setReadItems($status, $uid); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param int $status |
66
|
|
|
* @param int $forum_id |
67
|
|
|
* @param null $uid |
|
|
|
|
68
|
|
|
* @return mixed |
69
|
|
|
*/ |
70
|
|
|
function newbbSetReadTopic($status = 0, $forum_id = 0, $uid = null) |
71
|
|
|
{ |
72
|
|
|
/** @var Newbb\ReadtopicHandler $readHandler */ |
73
|
|
|
$readTopicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Readtopic'); |
74
|
|
|
|
75
|
|
|
return $readTopicHandler->setReadItems($status, $forum_id, $uid); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param $type |
80
|
|
|
* @param $items |
81
|
|
|
* @param null $uid |
|
|
|
|
82
|
|
|
* @return mixed |
83
|
|
|
*/ |
84
|
|
|
function newbbIsRead($type, $items, $uid = null) |
85
|
|
|
{ |
86
|
|
|
/** @var Newbb\ReadHandler $readHandler */ |
87
|
|
|
$readHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Read' . $type); |
88
|
|
|
|
89
|
|
|
return $readHandler->isReadItems($items, $uid); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|