@@ -24,12 +24,12 @@ |
||
24 | 24 | */ |
25 | 25 | class Constants |
26 | 26 | { |
27 | - /**#@+ |
|
27 | + /**#@+ |
|
28 | 28 | * Constant definition |
29 | 29 | */ |
30 | 30 | |
31 | - const DISALLOW = 0; |
|
31 | + const DISALLOW = 0; |
|
32 | 32 | |
33 | - /**#@-*/ |
|
33 | + /**#@-*/ |
|
34 | 34 | } |
35 | 35 |
@@ -44,17 +44,17 @@ |
||
44 | 44 | */ |
45 | 45 | class Read extends \XoopsObject |
46 | 46 | { |
47 | - /** |
|
48 | - * @internal param $type |
|
49 | - */ |
|
50 | - public function __construct() |
|
51 | - { |
|
52 | - // parent::__construct("newbb_reads_" . $type); |
|
53 | - parent::__construct(); |
|
54 | - $this->initVar('read_id', XOBJ_DTYPE_INT); |
|
55 | - $this->initVar('uid', XOBJ_DTYPE_INT); |
|
56 | - $this->initVar('read_item', XOBJ_DTYPE_INT); |
|
57 | - $this->initVar('post_id', XOBJ_DTYPE_INT); |
|
58 | - $this->initVar('read_time', XOBJ_DTYPE_INT); |
|
59 | - } |
|
47 | + /** |
|
48 | + * @internal param $type |
|
49 | + */ |
|
50 | + public function __construct() |
|
51 | + { |
|
52 | + // parent::__construct("newbb_reads_" . $type); |
|
53 | + parent::__construct(); |
|
54 | + $this->initVar('read_id', XOBJ_DTYPE_INT); |
|
55 | + $this->initVar('uid', XOBJ_DTYPE_INT); |
|
56 | + $this->initVar('read_item', XOBJ_DTYPE_INT); |
|
57 | + $this->initVar('post_id', XOBJ_DTYPE_INT); |
|
58 | + $this->initVar('read_time', XOBJ_DTYPE_INT); |
|
59 | + } |
|
60 | 60 | } |
@@ -13,17 +13,17 @@ |
||
13 | 13 | |
14 | 14 | class Category extends \XoopsObject |
15 | 15 | { |
16 | - /** |
|
17 | - * |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - parent::__construct(); |
|
22 | - $this->initVar('cat_id', XOBJ_DTYPE_INT); |
|
23 | - $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX); |
|
24 | - $this->initVar('cat_image', XOBJ_DTYPE_SOURCE, 'blank.gif'); |
|
25 | - $this->initVar('cat_description', XOBJ_DTYPE_TXTAREA); |
|
26 | - $this->initVar('cat_order', XOBJ_DTYPE_INT, 99); |
|
27 | - $this->initVar('cat_url', XOBJ_DTYPE_URL); |
|
28 | - } |
|
16 | + /** |
|
17 | + * |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + parent::__construct(); |
|
22 | + $this->initVar('cat_id', XOBJ_DTYPE_INT); |
|
23 | + $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX); |
|
24 | + $this->initVar('cat_image', XOBJ_DTYPE_SOURCE, 'blank.gif'); |
|
25 | + $this->initVar('cat_description', XOBJ_DTYPE_TXTAREA); |
|
26 | + $this->initVar('cat_order', XOBJ_DTYPE_INT, 99); |
|
27 | + $this->initVar('cat_url', XOBJ_DTYPE_URL); |
|
28 | + } |
|
29 | 29 | } |
@@ -19,80 +19,80 @@ |
||
19 | 19 | */ |
20 | 20 | class Uploader extends \XoopsMediaUploader |
21 | 21 | { |
22 | - /** |
|
23 | - * No admin check for uploads |
|
24 | - */ |
|
25 | - /** |
|
26 | - * Constructor |
|
27 | - * |
|
28 | - * @param string $uploadDir |
|
29 | - * @param array|int|string $allowedMimeTypes |
|
30 | - * @param int $maxFileSize |
|
31 | - * @param int $maxWidth |
|
32 | - * @param int $maxHeight |
|
33 | - */ |
|
34 | - public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize = 0, $maxWidth = 0, $maxHeight = 0) |
|
35 | - { |
|
36 | - // $this->XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
22 | + /** |
|
23 | + * No admin check for uploads |
|
24 | + */ |
|
25 | + /** |
|
26 | + * Constructor |
|
27 | + * |
|
28 | + * @param string $uploadDir |
|
29 | + * @param array|int|string $allowedMimeTypes |
|
30 | + * @param int $maxFileSize |
|
31 | + * @param int $maxWidth |
|
32 | + * @param int $maxHeight |
|
33 | + */ |
|
34 | + public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize = 0, $maxWidth = 0, $maxHeight = 0) |
|
35 | + { |
|
36 | + // $this->XoopsMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
37 | 37 | |
38 | - if (!is_array($allowedMimeTypes)) { |
|
39 | - if (empty($allowedMimeTypes) || '*' === $allowedMimeTypes) { |
|
40 | - $allowedMimeTypes = []; |
|
41 | - } else { |
|
42 | - $allowedMimeTypes = array_filter(array_map('trim', explode('|', strtolower($allowedMimeTypes)))); |
|
43 | - } |
|
44 | - } |
|
45 | - $_allowedMimeTypes = []; |
|
46 | - $extensionToMime = require_once $GLOBALS['xoops']->path('include/mimetypes.inc.php'); |
|
47 | - foreach ($allowedMimeTypes as $type) { |
|
48 | - if (isset($extensionToMime[$type])) { |
|
49 | - $_allowedMimeTypes[] = $extensionToMime[$type]; |
|
50 | - } else { |
|
51 | - $_allowedMimeTypes[] = $type; |
|
52 | - } |
|
53 | - } |
|
54 | - parent::__construct($uploadDir, $_allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
55 | - } |
|
38 | + if (!is_array($allowedMimeTypes)) { |
|
39 | + if (empty($allowedMimeTypes) || '*' === $allowedMimeTypes) { |
|
40 | + $allowedMimeTypes = []; |
|
41 | + } else { |
|
42 | + $allowedMimeTypes = array_filter(array_map('trim', explode('|', strtolower($allowedMimeTypes)))); |
|
43 | + } |
|
44 | + } |
|
45 | + $_allowedMimeTypes = []; |
|
46 | + $extensionToMime = require_once $GLOBALS['xoops']->path('include/mimetypes.inc.php'); |
|
47 | + foreach ($allowedMimeTypes as $type) { |
|
48 | + if (isset($extensionToMime[$type])) { |
|
49 | + $_allowedMimeTypes[] = $extensionToMime[$type]; |
|
50 | + } else { |
|
51 | + $_allowedMimeTypes[] = $type; |
|
52 | + } |
|
53 | + } |
|
54 | + parent::__construct($uploadDir, $_allowedMimeTypes, $maxFileSize, $maxWidth, $maxHeight); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Set the CheckMediaTypeByExt |
|
59 | - * Deprecated |
|
60 | - * |
|
61 | - * @param bool|string $value |
|
62 | - */ |
|
63 | - public function setCheckMediaTypeByExt($value = true) |
|
64 | - { |
|
65 | - } |
|
57 | + /** |
|
58 | + * Set the CheckMediaTypeByExt |
|
59 | + * Deprecated |
|
60 | + * |
|
61 | + * @param bool|string $value |
|
62 | + */ |
|
63 | + public function setCheckMediaTypeByExt($value = true) |
|
64 | + { |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Set the imageSizeCheck |
|
69 | - * Deprecated |
|
70 | - * |
|
71 | - * @param string $value |
|
72 | - */ |
|
73 | - public function setImageSizeCheck($value) |
|
74 | - { |
|
75 | - } |
|
67 | + /** |
|
68 | + * Set the imageSizeCheck |
|
69 | + * Deprecated |
|
70 | + * |
|
71 | + * @param string $value |
|
72 | + */ |
|
73 | + public function setImageSizeCheck($value) |
|
74 | + { |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Set the fileSizeCheck |
|
79 | - * Deprecated |
|
80 | - * |
|
81 | - * @param string $value |
|
82 | - */ |
|
83 | - public function setFileSizeCheck($value) |
|
84 | - { |
|
85 | - } |
|
77 | + /** |
|
78 | + * Set the fileSizeCheck |
|
79 | + * Deprecated |
|
80 | + * |
|
81 | + * @param string $value |
|
82 | + */ |
|
83 | + public function setFileSizeCheck($value) |
|
84 | + { |
|
85 | + } |
|
86 | 86 | |
87 | - /** |
|
88 | - * Get the file extension |
|
89 | - * |
|
90 | - * @return string |
|
91 | - */ |
|
92 | - public function getExt() |
|
93 | - { |
|
94 | - $this->ext = strtolower(ltrim(strrchr($this->getMediaName(), '.'), '.')); |
|
87 | + /** |
|
88 | + * Get the file extension |
|
89 | + * |
|
90 | + * @return string |
|
91 | + */ |
|
92 | + public function getExt() |
|
93 | + { |
|
94 | + $this->ext = strtolower(ltrim(strrchr($this->getMediaName(), '.'), '.')); |
|
95 | 95 | |
96 | - return $this->ext; |
|
97 | - } |
|
96 | + return $this->ext; |
|
97 | + } |
|
98 | 98 | } |
@@ -24,18 +24,18 @@ |
||
24 | 24 | */ |
25 | 25 | class Moderate extends \XoopsObject |
26 | 26 | { |
27 | - /** |
|
28 | - * |
|
29 | - */ |
|
30 | - public function __construct() |
|
31 | - { |
|
32 | - parent::__construct(); |
|
33 | - $this->initVar('mod_id', XOBJ_DTYPE_INT); |
|
34 | - $this->initVar('mod_start', XOBJ_DTYPE_INT); |
|
35 | - $this->initVar('mod_end', XOBJ_DTYPE_INT); |
|
36 | - $this->initVar('mod_desc', XOBJ_DTYPE_TXTBOX); |
|
37 | - $this->initVar('uid', XOBJ_DTYPE_INT); |
|
38 | - $this->initVar('ip', XOBJ_DTYPE_TXTBOX); |
|
39 | - $this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
40 | - } |
|
27 | + /** |
|
28 | + * |
|
29 | + */ |
|
30 | + public function __construct() |
|
31 | + { |
|
32 | + parent::__construct(); |
|
33 | + $this->initVar('mod_id', XOBJ_DTYPE_INT); |
|
34 | + $this->initVar('mod_start', XOBJ_DTYPE_INT); |
|
35 | + $this->initVar('mod_end', XOBJ_DTYPE_INT); |
|
36 | + $this->initVar('mod_desc', XOBJ_DTYPE_TXTBOX); |
|
37 | + $this->initVar('uid', XOBJ_DTYPE_INT); |
|
38 | + $this->initVar('ip', XOBJ_DTYPE_TXTBOX); |
|
39 | + $this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
40 | + } |
|
41 | 41 | } |
@@ -39,17 +39,17 @@ |
||
39 | 39 | */ |
40 | 40 | class Rate extends \XoopsObject |
41 | 41 | { |
42 | - /** |
|
43 | - * |
|
44 | - */ |
|
45 | - public function __construct() |
|
46 | - { |
|
47 | - parent::__construct(); |
|
48 | - $this->initVar('ratingid', XOBJ_DTYPE_INT); |
|
49 | - $this->initVar('topic_id', XOBJ_DTYPE_INT); |
|
50 | - $this->initVar('ratinguser', XOBJ_DTYPE_INT); |
|
51 | - $this->initVar('rating', XOBJ_DTYPE_INT); |
|
52 | - $this->initVar('ratingtimestamp', XOBJ_DTYPE_INT); |
|
53 | - $this->initVar('ratinghostname', XOBJ_DTYPE_TXTBOX); |
|
54 | - } |
|
42 | + /** |
|
43 | + * |
|
44 | + */ |
|
45 | + public function __construct() |
|
46 | + { |
|
47 | + parent::__construct(); |
|
48 | + $this->initVar('ratingid', XOBJ_DTYPE_INT); |
|
49 | + $this->initVar('topic_id', XOBJ_DTYPE_INT); |
|
50 | + $this->initVar('ratinguser', XOBJ_DTYPE_INT); |
|
51 | + $this->initVar('rating', XOBJ_DTYPE_INT); |
|
52 | + $this->initVar('ratingtimestamp', XOBJ_DTYPE_INT); |
|
53 | + $this->initVar('ratinghostname', XOBJ_DTYPE_TXTBOX); |
|
54 | + } |
|
55 | 55 | } |
@@ -21,98 +21,98 @@ |
||
21 | 21 | */ |
22 | 22 | class UserHandler |
23 | 23 | { |
24 | - /** @var array */ |
|
25 | - public $users = []; |
|
26 | - |
|
27 | - /** @var bool */ |
|
28 | - private $enableGroup; |
|
29 | - |
|
30 | - /** @var bool */ |
|
31 | - private $enableOnline; |
|
32 | - |
|
33 | - /** @var array */ |
|
34 | - private $userlist = []; |
|
35 | - |
|
36 | - /** |
|
37 | - * @param bool $enableGroup |
|
38 | - * @param bool $enableOnline |
|
39 | - */ |
|
40 | - public function __construct($enableGroup = true, $enableOnline = true) |
|
41 | - { |
|
42 | - $this->enableGroup = $enableGroup; |
|
43 | - $this->enableOnline = $enableOnline; |
|
44 | - } |
|
45 | - |
|
46 | - public function loadUserInfo() |
|
47 | - { |
|
48 | - /** @var Newbb\Helper $helper */ |
|
49 | - $helper = Newbb\Helper::getInstance(); |
|
50 | - $helper->loadLanguage('user'); |
|
24 | + /** @var array */ |
|
25 | + public $users = []; |
|
26 | + |
|
27 | + /** @var bool */ |
|
28 | + private $enableGroup; |
|
29 | + |
|
30 | + /** @var bool */ |
|
31 | + private $enableOnline; |
|
32 | + |
|
33 | + /** @var array */ |
|
34 | + private $userlist = []; |
|
35 | + |
|
36 | + /** |
|
37 | + * @param bool $enableGroup |
|
38 | + * @param bool $enableOnline |
|
39 | + */ |
|
40 | + public function __construct($enableGroup = true, $enableOnline = true) |
|
41 | + { |
|
42 | + $this->enableGroup = $enableGroup; |
|
43 | + $this->enableOnline = $enableOnline; |
|
44 | + } |
|
45 | + |
|
46 | + public function loadUserInfo() |
|
47 | + { |
|
48 | + /** @var Newbb\Helper $helper */ |
|
49 | + $helper = Newbb\Helper::getInstance(); |
|
50 | + $helper->loadLanguage('user'); |
|
51 | 51 | // @require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/user.php'); |
52 | - if (class_exists('UserLanguage')) { |
|
53 | - $handler = new Newbb\UserLanguage(); |
|
54 | - } else { |
|
55 | - $handler = new User(); |
|
56 | - } |
|
57 | - foreach (array_keys($this->users) as $uid) { |
|
58 | - $this->userlist[$uid] = $handler->getInfo($this->users[$uid]); |
|
59 | - } |
|
60 | - } |
|
61 | - |
|
62 | - public function loadUserOnline() |
|
63 | - { |
|
64 | - if (empty($this->users) || !$this->enableOnline) { |
|
65 | - return; |
|
66 | - } |
|
67 | - require_once dirname(__DIR__) . '/include/functions.render.php'; |
|
68 | - $image_online = newbbDisplayImage('online', _MD_NEWBB_ONLINE); |
|
69 | - $image_offline = newbbDisplayImage('offline', _MD_NEWBB_OFFLINE); |
|
70 | - |
|
71 | - /** @var Newbb\OnlineHandler $onlineHandler */ |
|
72 | - $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
73 | - $onlines = $onlineHandler->checkStatus(array_keys($this->users)); |
|
74 | - |
|
75 | - foreach (array_keys($this->users) as $uid) { |
|
76 | - $this->userlist[$uid]['status'] = empty($onlines[$uid]) ? $image_offline : $image_online; |
|
77 | - } |
|
78 | - } |
|
79 | - // START irmtfan remove function - no deprecated is needed because just use in this file |
|
80 | - // function loadUserGroups() |
|
81 | - // { |
|
82 | - // return true; |
|
83 | - // } |
|
84 | - // END irmtfan remove function - no deprecated is needed because just use in this file |
|
85 | - |
|
86 | - public function loadUserDigest() |
|
87 | - { |
|
88 | - if (empty($this->users)) { |
|
89 | - return; |
|
90 | - } |
|
91 | - |
|
92 | - $sql = 'SELECT user_digests, uid FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . ' WHERE uid IN( ' . implode(', ', array_keys($this->users)) . ')'; |
|
93 | - $result = $GLOBALS['xoopsDB']->query($sql); |
|
94 | - while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
95 | - $this->userlist[$myrow['uid']]['digests'] = (int)$myrow['user_digests']; |
|
96 | - } |
|
97 | - } |
|
98 | - // START irmtfan remove function |
|
99 | - // function loadUserRank() |
|
100 | - // { |
|
101 | - // return true; |
|
102 | - // } |
|
103 | - // END irmtfan remove function |
|
104 | - |
|
105 | - /** |
|
106 | - * @return array |
|
107 | - */ |
|
108 | - public function getUsers() |
|
109 | - { |
|
110 | - $this->loadUserInfo(); |
|
111 | - $this->loadUserOnline(); |
|
112 | - // irmtfan removed $this->loadUserGroups(); |
|
113 | - // irmtfan removed $this->loadUserRank(); |
|
114 | - $this->loadUserDigest(); |
|
115 | - |
|
116 | - return $this->userlist; |
|
117 | - } |
|
52 | + if (class_exists('UserLanguage')) { |
|
53 | + $handler = new Newbb\UserLanguage(); |
|
54 | + } else { |
|
55 | + $handler = new User(); |
|
56 | + } |
|
57 | + foreach (array_keys($this->users) as $uid) { |
|
58 | + $this->userlist[$uid] = $handler->getInfo($this->users[$uid]); |
|
59 | + } |
|
60 | + } |
|
61 | + |
|
62 | + public function loadUserOnline() |
|
63 | + { |
|
64 | + if (empty($this->users) || !$this->enableOnline) { |
|
65 | + return; |
|
66 | + } |
|
67 | + require_once dirname(__DIR__) . '/include/functions.render.php'; |
|
68 | + $image_online = newbbDisplayImage('online', _MD_NEWBB_ONLINE); |
|
69 | + $image_offline = newbbDisplayImage('offline', _MD_NEWBB_OFFLINE); |
|
70 | + |
|
71 | + /** @var Newbb\OnlineHandler $onlineHandler */ |
|
72 | + $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
73 | + $onlines = $onlineHandler->checkStatus(array_keys($this->users)); |
|
74 | + |
|
75 | + foreach (array_keys($this->users) as $uid) { |
|
76 | + $this->userlist[$uid]['status'] = empty($onlines[$uid]) ? $image_offline : $image_online; |
|
77 | + } |
|
78 | + } |
|
79 | + // START irmtfan remove function - no deprecated is needed because just use in this file |
|
80 | + // function loadUserGroups() |
|
81 | + // { |
|
82 | + // return true; |
|
83 | + // } |
|
84 | + // END irmtfan remove function - no deprecated is needed because just use in this file |
|
85 | + |
|
86 | + public function loadUserDigest() |
|
87 | + { |
|
88 | + if (empty($this->users)) { |
|
89 | + return; |
|
90 | + } |
|
91 | + |
|
92 | + $sql = 'SELECT user_digests, uid FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . ' WHERE uid IN( ' . implode(', ', array_keys($this->users)) . ')'; |
|
93 | + $result = $GLOBALS['xoopsDB']->query($sql); |
|
94 | + while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
95 | + $this->userlist[$myrow['uid']]['digests'] = (int)$myrow['user_digests']; |
|
96 | + } |
|
97 | + } |
|
98 | + // START irmtfan remove function |
|
99 | + // function loadUserRank() |
|
100 | + // { |
|
101 | + // return true; |
|
102 | + // } |
|
103 | + // END irmtfan remove function |
|
104 | + |
|
105 | + /** |
|
106 | + * @return array |
|
107 | + */ |
|
108 | + public function getUsers() |
|
109 | + { |
|
110 | + $this->loadUserInfo(); |
|
111 | + $this->loadUserOnline(); |
|
112 | + // irmtfan removed $this->loadUserGroups(); |
|
113 | + // irmtfan removed $this->loadUserRank(); |
|
114 | + $this->loadUserDigest(); |
|
115 | + |
|
116 | + return $this->userlist; |
|
117 | + } |
|
118 | 118 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | if (empty($this->users) || !$this->enableOnline) { |
65 | 65 | return; |
66 | 66 | } |
67 | - require_once dirname(__DIR__) . '/include/functions.render.php'; |
|
67 | + require_once dirname(__DIR__).'/include/functions.render.php'; |
|
68 | 68 | $image_online = newbbDisplayImage('online', _MD_NEWBB_ONLINE); |
69 | 69 | $image_offline = newbbDisplayImage('offline', _MD_NEWBB_OFFLINE); |
70 | 70 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | return; |
90 | 90 | } |
91 | 91 | |
92 | - $sql = 'SELECT user_digests, uid FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . ' WHERE uid IN( ' . implode(', ', array_keys($this->users)) . ')'; |
|
92 | + $sql = 'SELECT user_digests, uid FROM '.$GLOBALS['xoopsDB']->prefix('newbb_user_stats').' WHERE uid IN( '.implode(', ', array_keys($this->users)).')'; |
|
93 | 93 | $result = $GLOBALS['xoopsDB']->query($sql); |
94 | 94 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
95 | - $this->userlist[$myrow['uid']]['digests'] = (int)$myrow['user_digests']; |
|
95 | + $this->userlist[$myrow['uid']]['digests'] = (int) $myrow['user_digests']; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | // START irmtfan remove function |
@@ -21,41 +21,41 @@ |
||
21 | 21 | |
22 | 22 | class Forum extends \XoopsObject |
23 | 23 | { |
24 | - /** |
|
25 | - * |
|
26 | - */ |
|
27 | - public function __construct() |
|
28 | - { |
|
29 | - parent::__construct(); |
|
30 | - $this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
31 | - $this->initVar('forum_name', XOBJ_DTYPE_TXTBOX); |
|
32 | - $this->initVar('forum_desc', XOBJ_DTYPE_TXTAREA); |
|
33 | - $this->initVar('forum_moderator', XOBJ_DTYPE_ARRAY, serialize([])); |
|
34 | - $this->initVar('forum_topics', XOBJ_DTYPE_INT); |
|
35 | - $this->initVar('forum_posts', XOBJ_DTYPE_INT); |
|
36 | - $this->initVar('forum_last_post_id', XOBJ_DTYPE_INT); |
|
37 | - $this->initVar('cat_id', XOBJ_DTYPE_INT); |
|
38 | - $this->initVar('parent_forum', XOBJ_DTYPE_INT); |
|
39 | - $this->initVar('hot_threshold', XOBJ_DTYPE_INT, 20); |
|
40 | - $this->initVar('attach_maxkb', XOBJ_DTYPE_INT, 500); |
|
41 | - $this->initVar('attach_ext', XOBJ_DTYPE_SOURCE, 'zip|jpg|gif|png'); |
|
42 | - $this->initVar('forum_order', XOBJ_DTYPE_INT, 99); |
|
43 | - $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
44 | - } |
|
24 | + /** |
|
25 | + * |
|
26 | + */ |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | + parent::__construct(); |
|
30 | + $this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
31 | + $this->initVar('forum_name', XOBJ_DTYPE_TXTBOX); |
|
32 | + $this->initVar('forum_desc', XOBJ_DTYPE_TXTAREA); |
|
33 | + $this->initVar('forum_moderator', XOBJ_DTYPE_ARRAY, serialize([])); |
|
34 | + $this->initVar('forum_topics', XOBJ_DTYPE_INT); |
|
35 | + $this->initVar('forum_posts', XOBJ_DTYPE_INT); |
|
36 | + $this->initVar('forum_last_post_id', XOBJ_DTYPE_INT); |
|
37 | + $this->initVar('cat_id', XOBJ_DTYPE_INT); |
|
38 | + $this->initVar('parent_forum', XOBJ_DTYPE_INT); |
|
39 | + $this->initVar('hot_threshold', XOBJ_DTYPE_INT, 20); |
|
40 | + $this->initVar('attach_maxkb', XOBJ_DTYPE_INT, 500); |
|
41 | + $this->initVar('attach_ext', XOBJ_DTYPE_SOURCE, 'zip|jpg|gif|png'); |
|
42 | + $this->initVar('forum_order', XOBJ_DTYPE_INT, 99); |
|
43 | + $this->initVar('dohtml', XOBJ_DTYPE_INT, 1); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @return string |
|
48 | - */ |
|
49 | - public function dispForumModerators() |
|
50 | - { |
|
51 | - $ret = ''; |
|
52 | - if (!$valid_moderators = $this->getVar('forum_moderator')) { |
|
53 | - return $ret; |
|
54 | - } |
|
55 | - require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.user.php'); |
|
56 | - $moderators = newbbGetUnameFromIds($valid_moderators, !empty($GLOBALS['xoopsModuleConfig']['show_realname']), true); |
|
57 | - $ret = implode(', ', $moderators); |
|
46 | + /** |
|
47 | + * @return string |
|
48 | + */ |
|
49 | + public function dispForumModerators() |
|
50 | + { |
|
51 | + $ret = ''; |
|
52 | + if (!$valid_moderators = $this->getVar('forum_moderator')) { |
|
53 | + return $ret; |
|
54 | + } |
|
55 | + require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.user.php'); |
|
56 | + $moderators = newbbGetUnameFromIds($valid_moderators, !empty($GLOBALS['xoopsModuleConfig']['show_realname']), true); |
|
57 | + $ret = implode(', ', $moderators); |
|
58 | 58 | |
59 | - return $ret; |
|
60 | - } |
|
59 | + return $ret; |
|
60 | + } |
|
61 | 61 | } |
@@ -32,43 +32,43 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function newbb_tag_iteminfo(&$items) |
34 | 34 | { |
35 | - if (0 === count($items) || !is_array($items)) { |
|
36 | - return false; |
|
37 | - } |
|
35 | + if (0 === count($items) || !is_array($items)) { |
|
36 | + return false; |
|
37 | + } |
|
38 | 38 | |
39 | - $items_id = []; |
|
40 | - foreach (array_keys($items) as $cat_id) { |
|
41 | - // Some handling here to build the link upon catid |
|
42 | - // catid is not used in newbb, so just skip it |
|
43 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
44 | - // In newbb, the item_id is "topic_id" |
|
45 | - $items_id[] = (int)$item_id; |
|
46 | - } |
|
47 | - } |
|
48 | - /** @var TopicHandler $itemHandler */ |
|
49 | - $itemHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
50 | - /** @var \XoopsObject $itemsObject */ |
|
51 | - $itemsObject = $itemHandler->getObjects(new \Criteria('topic_id', '(' . implode(', ', $items_id) . ')', 'IN'), true); |
|
39 | + $items_id = []; |
|
40 | + foreach (array_keys($items) as $cat_id) { |
|
41 | + // Some handling here to build the link upon catid |
|
42 | + // catid is not used in newbb, so just skip it |
|
43 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
44 | + // In newbb, the item_id is "topic_id" |
|
45 | + $items_id[] = (int)$item_id; |
|
46 | + } |
|
47 | + } |
|
48 | + /** @var TopicHandler $itemHandler */ |
|
49 | + $itemHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
50 | + /** @var \XoopsObject $itemsObject */ |
|
51 | + $itemsObject = $itemHandler->getObjects(new \Criteria('topic_id', '(' . implode(', ', $items_id) . ')', 'IN'), true); |
|
52 | 52 | |
53 | - foreach (array_keys($items) as $cat_id) { |
|
54 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
55 | - /** @var \XoopsObject $itemObject */ |
|
56 | - if (!$itemObject = $itemsObject[$item_id]) { |
|
57 | - continue; |
|
58 | - } |
|
59 | - $items[$cat_id][$item_id] = [ |
|
60 | - 'title' => $itemObject->getVar('topic_title'), |
|
61 | - 'uid' => $itemObject->getVar('topic_poster'), |
|
62 | - 'link' => "viewtopic.php?topic_id={$item_id}", |
|
63 | - 'time' => $itemObject->getVar('topic_time'), |
|
64 | - 'tags' => tag_parse_tag($itemObject->getVar('topic_tags', 'n')), |
|
65 | - 'content' => '' |
|
66 | - ]; |
|
67 | - } |
|
68 | - } |
|
69 | - unset($itemsObject); |
|
53 | + foreach (array_keys($items) as $cat_id) { |
|
54 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
55 | + /** @var \XoopsObject $itemObject */ |
|
56 | + if (!$itemObject = $itemsObject[$item_id]) { |
|
57 | + continue; |
|
58 | + } |
|
59 | + $items[$cat_id][$item_id] = [ |
|
60 | + 'title' => $itemObject->getVar('topic_title'), |
|
61 | + 'uid' => $itemObject->getVar('topic_poster'), |
|
62 | + 'link' => "viewtopic.php?topic_id={$item_id}", |
|
63 | + 'time' => $itemObject->getVar('topic_time'), |
|
64 | + 'tags' => tag_parse_tag($itemObject->getVar('topic_tags', 'n')), |
|
65 | + 'content' => '' |
|
66 | + ]; |
|
67 | + } |
|
68 | + } |
|
69 | + unset($itemsObject); |
|
70 | 70 | |
71 | - return true; |
|
71 | + return true; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -78,21 +78,21 @@ discard block |
||
78 | 78 | */ |
79 | 79 | function newbb_tag_synchronization($mid) |
80 | 80 | { |
81 | - /** @var TopicHandler $itemHandler */ |
|
82 | - $itemHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
83 | - /** @var \XoopsPersistableObjectHandler $linkHandler */ |
|
84 | - $linkHandler = Tag\Helper::getInstance()->getHandler('Link'); |
|
81 | + /** @var TopicHandler $itemHandler */ |
|
82 | + $itemHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
83 | + /** @var \XoopsPersistableObjectHandler $linkHandler */ |
|
84 | + $linkHandler = Tag\Helper::getInstance()->getHandler('Link'); |
|
85 | 85 | |
86 | - /* clear tag-item links */ |
|
87 | - $sql = " DELETE FROM {$linkHandler->table}" |
|
88 | - . ' WHERE ' |
|
89 | - . " tag_modid = {$mid}" |
|
90 | - . ' AND ' |
|
91 | - . ' ( tag_itemid NOT IN ' |
|
92 | - . " ( SELECT DISTINCT {$itemHandler->keyName} " |
|
93 | - . " FROM {$itemHandler->table} " |
|
94 | - . " WHERE {$itemHandler->table}.approved > 0" |
|
95 | - . ' ) ' |
|
96 | - . ' )'; |
|
97 | - $linkHandler->db->queryF($sql); |
|
86 | + /* clear tag-item links */ |
|
87 | + $sql = " DELETE FROM {$linkHandler->table}" |
|
88 | + . ' WHERE ' |
|
89 | + . " tag_modid = {$mid}" |
|
90 | + . ' AND ' |
|
91 | + . ' ( tag_itemid NOT IN ' |
|
92 | + . " ( SELECT DISTINCT {$itemHandler->keyName} " |
|
93 | + . " FROM {$itemHandler->table} " |
|
94 | + . " WHERE {$itemHandler->table}.approved > 0" |
|
95 | + . ' ) ' |
|
96 | + . ' )'; |
|
97 | + $linkHandler->db->queryF($sql); |
|
98 | 98 | } |
@@ -42,13 +42,13 @@ |
||
42 | 42 | // catid is not used in newbb, so just skip it |
43 | 43 | foreach (array_keys($items[$cat_id]) as $item_id) { |
44 | 44 | // In newbb, the item_id is "topic_id" |
45 | - $items_id[] = (int)$item_id; |
|
45 | + $items_id[] = (int) $item_id; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | /** @var TopicHandler $itemHandler */ |
49 | 49 | $itemHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
50 | 50 | /** @var \XoopsObject $itemsObject */ |
51 | - $itemsObject = $itemHandler->getObjects(new \Criteria('topic_id', '(' . implode(', ', $items_id) . ')', 'IN'), true); |
|
51 | + $itemsObject = $itemHandler->getObjects(new \Criteria('topic_id', '('.implode(', ', $items_id).')', 'IN'), true); |
|
52 | 52 | |
53 | 53 | foreach (array_keys($items) as $cat_id) { |
54 | 54 | foreach (array_keys($items[$cat_id]) as $item_id) { |