@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | $level = []; |
82 | 82 | $level['level'] = $showlevel; |
83 | 83 | $level['exp'] = $ep; |
84 | - $level['exp_width'] = $ep . '%'; |
|
84 | + $level['exp_width'] = $ep.'%'; |
|
85 | 85 | $level['hp'] = $hp; |
86 | 86 | $level['hp_max'] = $maxhp; |
87 | - $level['hp_width'] = $hpf . '%'; |
|
87 | + $level['hp_width'] = $hpf.'%'; |
|
88 | 88 | $level['mp'] = $mp; |
89 | 89 | $level['mp_max'] = $maxmp; |
90 | - $level['mp_width'] = $mpf . '%'; |
|
90 | + $level['mp_width'] = $mpf.'%'; |
|
91 | 91 | |
92 | 92 | return $level; |
93 | 93 | } |
@@ -117,49 +117,49 @@ discard block |
||
117 | 117 | |
118 | 118 | $user = $this->user; |
119 | 119 | $userbar['profile'] = [ |
120 | - 'link' => XOOPS_URL . '/userinfo.php?uid=' . $user->getVar('uid'), |
|
120 | + 'link' => XOOPS_URL.'/userinfo.php?uid='.$user->getVar('uid'), |
|
121 | 121 | 'name' => _PROFILE |
122 | 122 | ]; |
123 | 123 | |
124 | 124 | if (is_object($GLOBALS['xoopsUser'])) { |
125 | 125 | $userbar['pm'] = [ |
126 | - 'link' => "javascript:void openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $user->getVar('uid') . "', 'pmlite', 450, 380);", |
|
126 | + 'link' => "javascript:void openWithSelfMain('".XOOPS_URL.'/pmlite.php?send2=1&to_userid='.$user->getVar('uid')."', 'pmlite', 450, 380);", |
|
127 | 127 | 'name' => _MD_NEWBB_PM |
128 | 128 | ]; |
129 | 129 | } |
130 | 130 | if ($user->getVar('user_viewemail') || $isAdmin) { |
131 | 131 | $userbar['email'] = [ |
132 | - 'link' => "javascript:void window.open('mailto:" . $user->getVar('email') . "', 'new');", |
|
132 | + 'link' => "javascript:void window.open('mailto:".$user->getVar('email')."', 'new');", |
|
133 | 133 | 'name' => _MD_NEWBB_EMAIL |
134 | 134 | ]; |
135 | 135 | } |
136 | 136 | if ($url = $user->getVar('url')) { |
137 | 137 | $userbar['url'] = [ |
138 | - 'link' => "javascript:void window.open('" . $url . "', 'new');", |
|
138 | + 'link' => "javascript:void window.open('".$url."', 'new');", |
|
139 | 139 | 'name' => _MD_NEWBB_WWW |
140 | 140 | ]; |
141 | 141 | } |
142 | 142 | if ($icq = $user->getVar('user_icq')) { |
143 | 143 | $userbar['icq'] = [ |
144 | - 'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=" . $icq . "', 'new');", |
|
144 | + 'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=".$icq."', 'new');", |
|
145 | 145 | 'name' => _MD_NEWBB_ICQ |
146 | 146 | ]; |
147 | 147 | } |
148 | 148 | if ($aim = $user->getVar('user_aim')) { |
149 | 149 | $userbar['aim'] = [ |
150 | - 'link' => "javascript:void window.open('aim:goim?screenname=" . $aim . '&message=Hi+' . $aim . '+Are+you+there?' . "', 'new');", |
|
150 | + 'link' => "javascript:void window.open('aim:goim?screenname=".$aim.'&message=Hi+'.$aim.'+Are+you+there?'."', 'new');", |
|
151 | 151 | 'name' => _MD_NEWBB_AIM |
152 | 152 | ]; |
153 | 153 | } |
154 | 154 | if ($yim = $user->getVar('user_yim')) { |
155 | 155 | $userbar['yim'] = [ |
156 | - 'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=" . $yim . '&.src=pg' . "', 'new');", |
|
156 | + 'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=".$yim.'&.src=pg'."', 'new');", |
|
157 | 157 | 'name' => _MD_NEWBB_YIM |
158 | 158 | ]; |
159 | 159 | } |
160 | 160 | if ($msn = $user->getVar('user_msnm')) { |
161 | 161 | $userbar['msnm'] = [ |
162 | - 'link' => "javascript:void window.open('http://members.msn.com?mem=" . $msn . "', 'new');", |
|
162 | + 'link' => "javascript:void window.open('http://members.msn.com?mem=".$msn."', 'new');", |
|
163 | 163 | 'name' => _MD_NEWBB_MSNM |
164 | 164 | ]; |
165 | 165 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $rpg_path = $iconHandler->getPath('rpg'); |
184 | 184 | foreach (['img_left', 'img_backing', 'img_right', 'blue', 'green', 'orange'] as $img) { |
185 | 185 | // irmtfan fix: double "/" removed |
186 | - $rpg_images[$img] = XOOPS_URL . $rpg_path . '/' . $img . '.gif'; |
|
186 | + $rpg_images[$img] = XOOPS_URL.$rpg_path.'/'.$img.'.gif'; |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | // irmtfan hardcore removed align="left" |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | . $rpg_images['img_right'] |
196 | 196 | . "' alt='' /></td></tr></table>"; |
197 | 197 | |
198 | - $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '<br><span title="' . _MD_NEWBB_HP_DESC . '">' . _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '</span><br>' . sprintf($table, $rpg_images['orange'], $level['hp_width']); |
|
199 | - $info .= '<span title="' . _MD_NEWBB_MP_DESC . '">' . _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '</span><br>' . sprintf($table, $rpg_images['green'], $level['mp_width']); |
|
200 | - $info .= '<span title="' . _MD_NEWBB_EXP_DESC . '">' . _MD_NEWBB_EXP . ' ' . $level['exp'] . '</span><br>' . sprintf($table, $rpg_images['blue'], $level['exp_width']); |
|
198 | + $info = _MD_NEWBB_LEVEL.' '.$level['level'].'<br><span title="'._MD_NEWBB_HP_DESC.'">'._MD_NEWBB_HP.' '.$level['hp'].' / '.$level['hp_max'].'</span><br>'.sprintf($table, $rpg_images['orange'], $level['hp_width']); |
|
199 | + $info .= '<span title="'._MD_NEWBB_MP_DESC.'">'._MD_NEWBB_MP.' '.$level['mp'].' / '.$level['mp_max'].'</span><br>'.sprintf($table, $rpg_images['green'], $level['mp_width']); |
|
200 | + $info .= '<span title="'._MD_NEWBB_EXP_DESC.'">'._MD_NEWBB_EXP.' '.$level['exp'].'</span><br>'.sprintf($table, $rpg_images['blue'], $level['exp_width']); |
|
201 | 201 | } else { |
202 | - $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '; <span title="' . _MD_NEWBB_EXP_DESC . '">' . _MD_NEWBB_EXP . ' ' . $level['exp'] . '</span><br>'; |
|
203 | - $info .= '<span title="' . _MD_NEWBB_HP_DESC . '">' . _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '</span><br>'; |
|
204 | - $info .= '<span title="' . _MD_NEWBB_MP_DESC . '">' . _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '</span>'; |
|
202 | + $info = _MD_NEWBB_LEVEL.' '.$level['level'].'; <span title="'._MD_NEWBB_EXP_DESC.'">'._MD_NEWBB_EXP.' '.$level['exp'].'</span><br>'; |
|
203 | + $info .= '<span title="'._MD_NEWBB_HP_DESC.'">'._MD_NEWBB_HP.' '.$level['hp'].' / '.$level['hp_max'].'</span><br>'; |
|
204 | + $info .= '<span title="'._MD_NEWBB_MP_DESC.'">'._MD_NEWBB_MP.' '.$level['mp'].' / '.$level['mp_max'].'</span>'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $info; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $name = empty($GLOBALS['xoopsModuleConfig']['show_realname']) ? $user->getVar('uname') : $user->getVar('name'); |
232 | 232 | $userinfo['name'] = $name ?: $user->getVar('uname'); |
233 | 233 | |
234 | - $userinfo['link'] = '<a href=\'' . XOOPS_URL . '/userinfo.php?uid=' . $user->getVar('uid') . '\'>' . $userinfo['name'] . '</a>'; |
|
234 | + $userinfo['link'] = '<a href=\''.XOOPS_URL.'/userinfo.php?uid='.$user->getVar('uid').'\'>'.$userinfo['name'].'</a>'; |
|
235 | 235 | |
236 | 236 | $userinfo['avatar'] = $user->getVar('user_avatar'); |
237 | 237 | // START hacked by irmtfan - easier rank getting - consistency with previous version back rank.title and rank.image |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | // END hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? |
255 | 255 | $userinfo['from'] = $user->getVar('user_from'); |
256 | 256 | |
257 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
257 | + require_once dirname(__DIR__).'/include/functions.time.php'; |
|
258 | 258 | $userinfo['regdate'] = newbbFormatTimestamp($user->getVar('user_regdate'), 'reg'); |
259 | 259 | $userinfo['last_login'] = newbbFormatTimestamp($user->getVar('last_login')); // irmtfan add last_login |
260 | 260 |
@@ -22,74 +22,74 @@ discard block |
||
22 | 22 | function newbb_calculateLevel($RPG, $RPGDIFF) |
23 | 23 | { |
24 | 24 | |
25 | - //$RPG = $user->getVar('posts'); |
|
26 | - //$RPGDIFF = $user->getVar('user_regdate'); |
|
27 | - |
|
28 | - $today = time(); |
|
29 | - $diff = $today - $RPGDIFF; |
|
30 | - $exp = round($diff / 86400, 0); |
|
31 | - if ($exp <= 0) { |
|
32 | - $exp = 1; |
|
33 | - } |
|
34 | - $ppd = round($RPG / $exp, 0); |
|
35 | - $level = log10($RPG) ** 3; |
|
36 | - $ep = floor(100 * ($level - floor($level))); |
|
37 | - $showlevel = floor($level + 1); |
|
38 | - $hpmulti = round($ppd / 6, 1); |
|
39 | - if ($hpmulti > 1.5) { |
|
40 | - $hpmulti = 1.5; |
|
41 | - } |
|
42 | - if ($hpmulti < 1) { |
|
43 | - $hpmulti = 1; |
|
44 | - } |
|
45 | - $maxhp = $level * 25 * $hpmulti; |
|
46 | - $hp = $ppd / 5; |
|
47 | - if ($hp >= 1) { |
|
48 | - $hp = $maxhp; |
|
49 | - } else { |
|
50 | - $hp = floor($hp * $maxhp); |
|
51 | - } |
|
52 | - $hp = floor($hp); |
|
53 | - $maxhp = floor($maxhp); |
|
54 | - $zhp = $maxhp; |
|
55 | - if ($maxhp <= 0) { |
|
56 | - $zhp = 1; |
|
57 | - } |
|
58 | - $hpf = floor(100 * ($hp / $zhp)) - 1; |
|
59 | - $maxmp = ($exp * $level) / 5; |
|
60 | - $mp = $RPG / 3; |
|
61 | - if ($mp >= $maxmp) { |
|
62 | - $mp = $maxmp; |
|
63 | - } |
|
64 | - $maxmp = floor($maxmp); |
|
65 | - $mp = floor($mp); |
|
66 | - $zmp = $maxmp; |
|
67 | - if ($maxmp <= 0) { |
|
68 | - $zmp = 1; |
|
69 | - } |
|
70 | - $mpf = floor(100 * ($mp / $zmp)) - 1; |
|
71 | - if ($hpf >= 98) { |
|
72 | - $hpf -= 2; |
|
73 | - } |
|
74 | - if ($ep >= 98) { |
|
75 | - $ep -= 2; |
|
76 | - } |
|
77 | - if ($mpf >= 98) { |
|
78 | - $mpf -= 2; |
|
79 | - } |
|
80 | - |
|
81 | - $level = []; |
|
82 | - $level['level'] = $showlevel; |
|
83 | - $level['exp'] = $ep; |
|
84 | - $level['exp_width'] = $ep . '%'; |
|
85 | - $level['hp'] = $hp; |
|
86 | - $level['hp_max'] = $maxhp; |
|
87 | - $level['hp_width'] = $hpf . '%'; |
|
88 | - $level['mp'] = $mp; |
|
89 | - $level['mp_max'] = $maxmp; |
|
90 | - $level['mp_width'] = $mpf . '%'; |
|
91 | - |
|
92 | - return $level; |
|
25 | + //$RPG = $user->getVar('posts'); |
|
26 | + //$RPGDIFF = $user->getVar('user_regdate'); |
|
27 | + |
|
28 | + $today = time(); |
|
29 | + $diff = $today - $RPGDIFF; |
|
30 | + $exp = round($diff / 86400, 0); |
|
31 | + if ($exp <= 0) { |
|
32 | + $exp = 1; |
|
33 | + } |
|
34 | + $ppd = round($RPG / $exp, 0); |
|
35 | + $level = log10($RPG) ** 3; |
|
36 | + $ep = floor(100 * ($level - floor($level))); |
|
37 | + $showlevel = floor($level + 1); |
|
38 | + $hpmulti = round($ppd / 6, 1); |
|
39 | + if ($hpmulti > 1.5) { |
|
40 | + $hpmulti = 1.5; |
|
41 | + } |
|
42 | + if ($hpmulti < 1) { |
|
43 | + $hpmulti = 1; |
|
44 | + } |
|
45 | + $maxhp = $level * 25 * $hpmulti; |
|
46 | + $hp = $ppd / 5; |
|
47 | + if ($hp >= 1) { |
|
48 | + $hp = $maxhp; |
|
49 | + } else { |
|
50 | + $hp = floor($hp * $maxhp); |
|
51 | + } |
|
52 | + $hp = floor($hp); |
|
53 | + $maxhp = floor($maxhp); |
|
54 | + $zhp = $maxhp; |
|
55 | + if ($maxhp <= 0) { |
|
56 | + $zhp = 1; |
|
57 | + } |
|
58 | + $hpf = floor(100 * ($hp / $zhp)) - 1; |
|
59 | + $maxmp = ($exp * $level) / 5; |
|
60 | + $mp = $RPG / 3; |
|
61 | + if ($mp >= $maxmp) { |
|
62 | + $mp = $maxmp; |
|
63 | + } |
|
64 | + $maxmp = floor($maxmp); |
|
65 | + $mp = floor($mp); |
|
66 | + $zmp = $maxmp; |
|
67 | + if ($maxmp <= 0) { |
|
68 | + $zmp = 1; |
|
69 | + } |
|
70 | + $mpf = floor(100 * ($mp / $zmp)) - 1; |
|
71 | + if ($hpf >= 98) { |
|
72 | + $hpf -= 2; |
|
73 | + } |
|
74 | + if ($ep >= 98) { |
|
75 | + $ep -= 2; |
|
76 | + } |
|
77 | + if ($mpf >= 98) { |
|
78 | + $mpf -= 2; |
|
79 | + } |
|
80 | + |
|
81 | + $level = []; |
|
82 | + $level['level'] = $showlevel; |
|
83 | + $level['exp'] = $ep; |
|
84 | + $level['exp_width'] = $ep . '%'; |
|
85 | + $level['hp'] = $hp; |
|
86 | + $level['hp_max'] = $maxhp; |
|
87 | + $level['hp_width'] = $hpf . '%'; |
|
88 | + $level['mp'] = $mp; |
|
89 | + $level['mp_max'] = $maxmp; |
|
90 | + $level['mp_width'] = $mpf . '%'; |
|
91 | + |
|
92 | + return $level; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -97,179 +97,179 @@ discard block |
||
97 | 97 | */ |
98 | 98 | class User |
99 | 99 | { |
100 | - public $user; |
|
101 | - |
|
102 | - public function __construct() |
|
103 | - { |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @return array |
|
108 | - */ |
|
109 | - public function getUserbar() |
|
110 | - { |
|
111 | - global $isAdmin; |
|
112 | - |
|
113 | - $userbar = []; |
|
114 | - if (empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) { |
|
115 | - return $userbar; |
|
116 | - } |
|
117 | - |
|
118 | - $user = $this->user; |
|
119 | - $userbar['profile'] = [ |
|
120 | - 'link' => XOOPS_URL . '/userinfo.php?uid=' . $user->getVar('uid'), |
|
121 | - 'name' => _PROFILE |
|
122 | - ]; |
|
123 | - |
|
124 | - if (is_object($GLOBALS['xoopsUser'])) { |
|
125 | - $userbar['pm'] = [ |
|
126 | - 'link' => "javascript:void openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $user->getVar('uid') . "', 'pmlite', 450, 380);", |
|
127 | - 'name' => _MD_NEWBB_PM |
|
128 | - ]; |
|
129 | - } |
|
130 | - if ($user->getVar('user_viewemail') || $isAdmin) { |
|
131 | - $userbar['email'] = [ |
|
132 | - 'link' => "javascript:void window.open('mailto:" . $user->getVar('email') . "', 'new');", |
|
133 | - 'name' => _MD_NEWBB_EMAIL |
|
134 | - ]; |
|
135 | - } |
|
136 | - if ($url = $user->getVar('url')) { |
|
137 | - $userbar['url'] = [ |
|
138 | - 'link' => "javascript:void window.open('" . $url . "', 'new');", |
|
139 | - 'name' => _MD_NEWBB_WWW |
|
140 | - ]; |
|
141 | - } |
|
142 | - if ($icq = $user->getVar('user_icq')) { |
|
143 | - $userbar['icq'] = [ |
|
144 | - 'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=" . $icq . "', 'new');", |
|
145 | - 'name' => _MD_NEWBB_ICQ |
|
146 | - ]; |
|
147 | - } |
|
148 | - if ($aim = $user->getVar('user_aim')) { |
|
149 | - $userbar['aim'] = [ |
|
150 | - 'link' => "javascript:void window.open('aim:goim?screenname=" . $aim . '&message=Hi+' . $aim . '+Are+you+there?' . "', 'new');", |
|
151 | - 'name' => _MD_NEWBB_AIM |
|
152 | - ]; |
|
153 | - } |
|
154 | - if ($yim = $user->getVar('user_yim')) { |
|
155 | - $userbar['yim'] = [ |
|
156 | - 'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=" . $yim . '&.src=pg' . "', 'new');", |
|
157 | - 'name' => _MD_NEWBB_YIM |
|
158 | - ]; |
|
159 | - } |
|
160 | - if ($msn = $user->getVar('user_msnm')) { |
|
161 | - $userbar['msnm'] = [ |
|
162 | - 'link' => "javascript:void window.open('http://members.msn.com?mem=" . $msn . "', 'new');", |
|
163 | - 'name' => _MD_NEWBB_MSNM |
|
164 | - ]; |
|
165 | - } |
|
166 | - |
|
167 | - return $userbar; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public function getLevel() |
|
174 | - { |
|
175 | - global $forumUrl; |
|
176 | - |
|
177 | - $level = newbb_calculateLevel($this->user->getVar('posts'), $this->user->getVar('user_regdate')); |
|
178 | - $info = ''; |
|
179 | - if (2 == $GLOBALS['xoopsModuleConfig']['user_level']) { |
|
180 | - static $rpg_images; |
|
181 | - if (null === $rpg_images) { |
|
182 | - $iconHandler = newbbGetIconHandler(); |
|
183 | - $rpg_path = $iconHandler->getPath('rpg'); |
|
184 | - foreach (['img_left', 'img_backing', 'img_right', 'blue', 'green', 'orange'] as $img) { |
|
185 | - // irmtfan fix: double "/" removed |
|
186 | - $rpg_images[$img] = XOOPS_URL . $rpg_path . '/' . $img . '.gif'; |
|
187 | - } |
|
188 | - } |
|
189 | - // irmtfan hardcore removed align="left" |
|
190 | - $table = "<table class='userlevel'><tr><td class='end'><img src='" |
|
191 | - . $rpg_images['img_left'] |
|
192 | - . "' alt='' /></td><td class='center' background='" |
|
193 | - . $rpg_images['img_backing'] |
|
194 | - . "'><img src='%s' width='%d' alt='' class='icon_left' /></td><td><img src='" |
|
195 | - . $rpg_images['img_right'] |
|
196 | - . "' alt='' /></td></tr></table>"; |
|
197 | - |
|
198 | - $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '<br><span title="' . _MD_NEWBB_HP_DESC . '">' . _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '</span><br>' . sprintf($table, $rpg_images['orange'], $level['hp_width']); |
|
199 | - $info .= '<span title="' . _MD_NEWBB_MP_DESC . '">' . _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '</span><br>' . sprintf($table, $rpg_images['green'], $level['mp_width']); |
|
200 | - $info .= '<span title="' . _MD_NEWBB_EXP_DESC . '">' . _MD_NEWBB_EXP . ' ' . $level['exp'] . '</span><br>' . sprintf($table, $rpg_images['blue'], $level['exp_width']); |
|
201 | - } else { |
|
202 | - $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '; <span title="' . _MD_NEWBB_EXP_DESC . '">' . _MD_NEWBB_EXP . ' ' . $level['exp'] . '</span><br>'; |
|
203 | - $info .= '<span title="' . _MD_NEWBB_HP_DESC . '">' . _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '</span><br>'; |
|
204 | - $info .= '<span title="' . _MD_NEWBB_MP_DESC . '">' . _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '</span>'; |
|
205 | - } |
|
206 | - |
|
207 | - return $info; |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * @param \XoopsUser $user |
|
212 | - * @return mixed |
|
213 | - */ |
|
214 | - public function getInfo(&$user) |
|
215 | - { |
|
216 | - global $myts; |
|
217 | - static $name_anonymous; |
|
218 | - |
|
219 | - if (!is_object($user) || !$user->isActive()) { |
|
220 | - if (null === $name_anonymous) { |
|
221 | - $name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
|
222 | - } |
|
223 | - |
|
224 | - return ['name' => $name_anonymous, 'link' => $name_anonymous]; |
|
225 | - } |
|
226 | - |
|
227 | - $this->user = $user; |
|
228 | - |
|
229 | - $userinfo['uid'] = $user->getVar('uid'); |
|
230 | - |
|
231 | - $name = empty($GLOBALS['xoopsModuleConfig']['show_realname']) ? $user->getVar('uname') : $user->getVar('name'); |
|
232 | - $userinfo['name'] = $name ?: $user->getVar('uname'); |
|
233 | - |
|
234 | - $userinfo['link'] = '<a href=\'' . XOOPS_URL . '/userinfo.php?uid=' . $user->getVar('uid') . '\'>' . $userinfo['name'] . '</a>'; |
|
235 | - |
|
236 | - $userinfo['avatar'] = $user->getVar('user_avatar'); |
|
237 | - // START hacked by irmtfan - easier rank getting - consistency with previous version back rank.title and rank.image |
|
238 | - $userrank = $user->rank(); |
|
239 | - $userinfo['rank'] = []; |
|
240 | - if (isset($userrank['image']) && $userrank['image']) { |
|
241 | - $userinfo['rank']['image'] = $userrank['image']; |
|
242 | - $userinfo['rank']['title'] = $userrank['title']; |
|
243 | - } |
|
244 | - // END hacked by irmtfan - easier rank getting - a little correctness dot removed |
|
245 | - // START hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? |
|
246 | - //checks for user's groups |
|
247 | - $userinfo['groups'] = []; |
|
248 | - /** @var \XoopsMemberHandler $memberHandler */ |
|
249 | - $memberHandler = xoops_getHandler('member'); |
|
250 | - $usergroups = $memberHandler->getGroupsByUser($userinfo['uid'], true); |
|
251 | - foreach ($usergroups as $group) { |
|
252 | - $userinfo['groups'][] = $group->getVar('name'); |
|
253 | - } |
|
254 | - // END hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? |
|
255 | - $userinfo['from'] = $user->getVar('user_from'); |
|
256 | - |
|
257 | - require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
258 | - $userinfo['regdate'] = newbbFormatTimestamp($user->getVar('user_regdate'), 'reg'); |
|
259 | - $userinfo['last_login'] = newbbFormatTimestamp($user->getVar('last_login')); // irmtfan add last_login |
|
260 | - |
|
261 | - $userinfo['posts'] = $user->getVar('posts'); |
|
262 | - |
|
263 | - if (!empty($GLOBALS['xoopsModuleConfig']['user_level'])) { |
|
264 | - $userinfo['level'] = $this->getLevel(); |
|
265 | - } |
|
266 | - |
|
267 | - if (!empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) { |
|
268 | - $userinfo['userbar'] = $this->getUserbar(); |
|
269 | - } |
|
270 | - |
|
271 | - $userinfo['signature'] = $user->getVar('user_sig'); |
|
272 | - |
|
273 | - return $userinfo; |
|
274 | - } |
|
100 | + public $user; |
|
101 | + |
|
102 | + public function __construct() |
|
103 | + { |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @return array |
|
108 | + */ |
|
109 | + public function getUserbar() |
|
110 | + { |
|
111 | + global $isAdmin; |
|
112 | + |
|
113 | + $userbar = []; |
|
114 | + if (empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) { |
|
115 | + return $userbar; |
|
116 | + } |
|
117 | + |
|
118 | + $user = $this->user; |
|
119 | + $userbar['profile'] = [ |
|
120 | + 'link' => XOOPS_URL . '/userinfo.php?uid=' . $user->getVar('uid'), |
|
121 | + 'name' => _PROFILE |
|
122 | + ]; |
|
123 | + |
|
124 | + if (is_object($GLOBALS['xoopsUser'])) { |
|
125 | + $userbar['pm'] = [ |
|
126 | + 'link' => "javascript:void openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $user->getVar('uid') . "', 'pmlite', 450, 380);", |
|
127 | + 'name' => _MD_NEWBB_PM |
|
128 | + ]; |
|
129 | + } |
|
130 | + if ($user->getVar('user_viewemail') || $isAdmin) { |
|
131 | + $userbar['email'] = [ |
|
132 | + 'link' => "javascript:void window.open('mailto:" . $user->getVar('email') . "', 'new');", |
|
133 | + 'name' => _MD_NEWBB_EMAIL |
|
134 | + ]; |
|
135 | + } |
|
136 | + if ($url = $user->getVar('url')) { |
|
137 | + $userbar['url'] = [ |
|
138 | + 'link' => "javascript:void window.open('" . $url . "', 'new');", |
|
139 | + 'name' => _MD_NEWBB_WWW |
|
140 | + ]; |
|
141 | + } |
|
142 | + if ($icq = $user->getVar('user_icq')) { |
|
143 | + $userbar['icq'] = [ |
|
144 | + 'link' => "javascript:void window.open('http://wwp.icq.com/scripts/search.dll?to=" . $icq . "', 'new');", |
|
145 | + 'name' => _MD_NEWBB_ICQ |
|
146 | + ]; |
|
147 | + } |
|
148 | + if ($aim = $user->getVar('user_aim')) { |
|
149 | + $userbar['aim'] = [ |
|
150 | + 'link' => "javascript:void window.open('aim:goim?screenname=" . $aim . '&message=Hi+' . $aim . '+Are+you+there?' . "', 'new');", |
|
151 | + 'name' => _MD_NEWBB_AIM |
|
152 | + ]; |
|
153 | + } |
|
154 | + if ($yim = $user->getVar('user_yim')) { |
|
155 | + $userbar['yim'] = [ |
|
156 | + 'link' => "javascript:void window.open('http://edit.yahoo.com/config/send_webmesg?.target=" . $yim . '&.src=pg' . "', 'new');", |
|
157 | + 'name' => _MD_NEWBB_YIM |
|
158 | + ]; |
|
159 | + } |
|
160 | + if ($msn = $user->getVar('user_msnm')) { |
|
161 | + $userbar['msnm'] = [ |
|
162 | + 'link' => "javascript:void window.open('http://members.msn.com?mem=" . $msn . "', 'new');", |
|
163 | + 'name' => _MD_NEWBB_MSNM |
|
164 | + ]; |
|
165 | + } |
|
166 | + |
|
167 | + return $userbar; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public function getLevel() |
|
174 | + { |
|
175 | + global $forumUrl; |
|
176 | + |
|
177 | + $level = newbb_calculateLevel($this->user->getVar('posts'), $this->user->getVar('user_regdate')); |
|
178 | + $info = ''; |
|
179 | + if (2 == $GLOBALS['xoopsModuleConfig']['user_level']) { |
|
180 | + static $rpg_images; |
|
181 | + if (null === $rpg_images) { |
|
182 | + $iconHandler = newbbGetIconHandler(); |
|
183 | + $rpg_path = $iconHandler->getPath('rpg'); |
|
184 | + foreach (['img_left', 'img_backing', 'img_right', 'blue', 'green', 'orange'] as $img) { |
|
185 | + // irmtfan fix: double "/" removed |
|
186 | + $rpg_images[$img] = XOOPS_URL . $rpg_path . '/' . $img . '.gif'; |
|
187 | + } |
|
188 | + } |
|
189 | + // irmtfan hardcore removed align="left" |
|
190 | + $table = "<table class='userlevel'><tr><td class='end'><img src='" |
|
191 | + . $rpg_images['img_left'] |
|
192 | + . "' alt='' /></td><td class='center' background='" |
|
193 | + . $rpg_images['img_backing'] |
|
194 | + . "'><img src='%s' width='%d' alt='' class='icon_left' /></td><td><img src='" |
|
195 | + . $rpg_images['img_right'] |
|
196 | + . "' alt='' /></td></tr></table>"; |
|
197 | + |
|
198 | + $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '<br><span title="' . _MD_NEWBB_HP_DESC . '">' . _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '</span><br>' . sprintf($table, $rpg_images['orange'], $level['hp_width']); |
|
199 | + $info .= '<span title="' . _MD_NEWBB_MP_DESC . '">' . _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '</span><br>' . sprintf($table, $rpg_images['green'], $level['mp_width']); |
|
200 | + $info .= '<span title="' . _MD_NEWBB_EXP_DESC . '">' . _MD_NEWBB_EXP . ' ' . $level['exp'] . '</span><br>' . sprintf($table, $rpg_images['blue'], $level['exp_width']); |
|
201 | + } else { |
|
202 | + $info = _MD_NEWBB_LEVEL . ' ' . $level['level'] . '; <span title="' . _MD_NEWBB_EXP_DESC . '">' . _MD_NEWBB_EXP . ' ' . $level['exp'] . '</span><br>'; |
|
203 | + $info .= '<span title="' . _MD_NEWBB_HP_DESC . '">' . _MD_NEWBB_HP . ' ' . $level['hp'] . ' / ' . $level['hp_max'] . '</span><br>'; |
|
204 | + $info .= '<span title="' . _MD_NEWBB_MP_DESC . '">' . _MD_NEWBB_MP . ' ' . $level['mp'] . ' / ' . $level['mp_max'] . '</span>'; |
|
205 | + } |
|
206 | + |
|
207 | + return $info; |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * @param \XoopsUser $user |
|
212 | + * @return mixed |
|
213 | + */ |
|
214 | + public function getInfo(&$user) |
|
215 | + { |
|
216 | + global $myts; |
|
217 | + static $name_anonymous; |
|
218 | + |
|
219 | + if (!is_object($user) || !$user->isActive()) { |
|
220 | + if (null === $name_anonymous) { |
|
221 | + $name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
|
222 | + } |
|
223 | + |
|
224 | + return ['name' => $name_anonymous, 'link' => $name_anonymous]; |
|
225 | + } |
|
226 | + |
|
227 | + $this->user = $user; |
|
228 | + |
|
229 | + $userinfo['uid'] = $user->getVar('uid'); |
|
230 | + |
|
231 | + $name = empty($GLOBALS['xoopsModuleConfig']['show_realname']) ? $user->getVar('uname') : $user->getVar('name'); |
|
232 | + $userinfo['name'] = $name ?: $user->getVar('uname'); |
|
233 | + |
|
234 | + $userinfo['link'] = '<a href=\'' . XOOPS_URL . '/userinfo.php?uid=' . $user->getVar('uid') . '\'>' . $userinfo['name'] . '</a>'; |
|
235 | + |
|
236 | + $userinfo['avatar'] = $user->getVar('user_avatar'); |
|
237 | + // START hacked by irmtfan - easier rank getting - consistency with previous version back rank.title and rank.image |
|
238 | + $userrank = $user->rank(); |
|
239 | + $userinfo['rank'] = []; |
|
240 | + if (isset($userrank['image']) && $userrank['image']) { |
|
241 | + $userinfo['rank']['image'] = $userrank['image']; |
|
242 | + $userinfo['rank']['title'] = $userrank['title']; |
|
243 | + } |
|
244 | + // END hacked by irmtfan - easier rank getting - a little correctness dot removed |
|
245 | + // START hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? |
|
246 | + //checks for user's groups |
|
247 | + $userinfo['groups'] = []; |
|
248 | + /** @var \XoopsMemberHandler $memberHandler */ |
|
249 | + $memberHandler = xoops_getHandler('member'); |
|
250 | + $usergroups = $memberHandler->getGroupsByUser($userinfo['uid'], true); |
|
251 | + foreach ($usergroups as $group) { |
|
252 | + $userinfo['groups'][] = $group->getVar('name'); |
|
253 | + } |
|
254 | + // END hacked by irmtfan - easier groups getting - can we use $_SESSION['xoopsUserGroups']??? |
|
255 | + $userinfo['from'] = $user->getVar('user_from'); |
|
256 | + |
|
257 | + require_once dirname(__DIR__) . '/include/functions.time.php'; |
|
258 | + $userinfo['regdate'] = newbbFormatTimestamp($user->getVar('user_regdate'), 'reg'); |
|
259 | + $userinfo['last_login'] = newbbFormatTimestamp($user->getVar('last_login')); // irmtfan add last_login |
|
260 | + |
|
261 | + $userinfo['posts'] = $user->getVar('posts'); |
|
262 | + |
|
263 | + if (!empty($GLOBALS['xoopsModuleConfig']['user_level'])) { |
|
264 | + $userinfo['level'] = $this->getLevel(); |
|
265 | + } |
|
266 | + |
|
267 | + if (!empty($GLOBALS['xoopsModuleConfig']['userbar_enabled'])) { |
|
268 | + $userinfo['userbar'] = $this->getUserbar(); |
|
269 | + } |
|
270 | + |
|
271 | + $userinfo['signature'] = $user->getVar('user_sig'); |
|
272 | + |
|
273 | + return $userinfo; |
|
274 | + } |
|
275 | 275 | } |
@@ -19,14 +19,14 @@ |
||
19 | 19 | */ |
20 | 20 | class Text extends \XoopsObject |
21 | 21 | { |
22 | - /** |
|
23 | - * |
|
24 | - */ |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - parent::__construct(); |
|
28 | - $this->initVar('post_id', XOBJ_DTYPE_INT); |
|
29 | - $this->initVar('post_text', XOBJ_DTYPE_TXTAREA); |
|
30 | - $this->initVar('post_edit', XOBJ_DTYPE_SOURCE); |
|
31 | - } |
|
22 | + /** |
|
23 | + * |
|
24 | + */ |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + parent::__construct(); |
|
28 | + $this->initVar('post_id', XOBJ_DTYPE_INT); |
|
29 | + $this->initVar('post_text', XOBJ_DTYPE_TXTAREA); |
|
30 | + $this->initVar('post_edit', XOBJ_DTYPE_SOURCE); |
|
31 | + } |
|
32 | 32 | } |
@@ -30,238 +30,238 @@ |
||
30 | 30 | */ |
31 | 31 | class StatsHandler |
32 | 32 | { |
33 | - public $db; |
|
34 | - public $table; |
|
35 | - public $param = [ |
|
36 | - 'type' => ['topic', 'post', 'digest', 'view'], |
|
37 | - 'period' => ['total', 'day', 'week', 'month'] |
|
38 | - ]; |
|
33 | + public $db; |
|
34 | + public $table; |
|
35 | + public $param = [ |
|
36 | + 'type' => ['topic', 'post', 'digest', 'view'], |
|
37 | + 'period' => ['total', 'day', 'week', 'month'] |
|
38 | + ]; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @param null|\XoopsDatabase $db |
|
42 | - */ |
|
43 | - public function __construct(\XoopsDatabase $db = null) |
|
44 | - { |
|
45 | - //$this->db = $db; |
|
46 | - //if (!$db || !($db instanceof XoopsDatabase)) { |
|
47 | - $this->db = $GLOBALS['xoopsDB']; |
|
48 | - //} |
|
49 | - $this->table = $this->db->prefix('newbb_stats'); |
|
50 | - } |
|
40 | + /** |
|
41 | + * @param null|\XoopsDatabase $db |
|
42 | + */ |
|
43 | + public function __construct(\XoopsDatabase $db = null) |
|
44 | + { |
|
45 | + //$this->db = $db; |
|
46 | + //if (!$db || !($db instanceof XoopsDatabase)) { |
|
47 | + $this->db = $GLOBALS['xoopsDB']; |
|
48 | + //} |
|
49 | + $this->table = $this->db->prefix('newbb_stats'); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param null|\XoopsDatabase $db |
|
54 | - * @return StatsHandler |
|
55 | - */ |
|
56 | - public static function getInstance(\XoopsDatabase $db = null) |
|
57 | - { |
|
58 | - static $instance; |
|
59 | - if (null === $instance) { |
|
60 | - $instance = new static($db); |
|
61 | - } |
|
52 | + /** |
|
53 | + * @param null|\XoopsDatabase $db |
|
54 | + * @return StatsHandler |
|
55 | + */ |
|
56 | + public static function getInstance(\XoopsDatabase $db = null) |
|
57 | + { |
|
58 | + static $instance; |
|
59 | + if (null === $instance) { |
|
60 | + $instance = new static($db); |
|
61 | + } |
|
62 | 62 | |
63 | - return $instance; |
|
64 | - } |
|
63 | + return $instance; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @param $id |
|
68 | - * @param $type |
|
69 | - * @param int $increment |
|
70 | - * @return bool |
|
71 | - */ |
|
72 | - public function update($id, $type, $increment = 1) |
|
73 | - { |
|
74 | - $id = (int)$id; |
|
75 | - $increment = (int)$increment; |
|
66 | + /** |
|
67 | + * @param $id |
|
68 | + * @param $type |
|
69 | + * @param int $increment |
|
70 | + * @return bool |
|
71 | + */ |
|
72 | + public function update($id, $type, $increment = 1) |
|
73 | + { |
|
74 | + $id = (int)$id; |
|
75 | + $increment = (int)$increment; |
|
76 | 76 | |
77 | - if (empty($increment) || false === ($type = array_search($type, $this->param['type']))) { |
|
78 | - return false; |
|
79 | - } |
|
77 | + if (empty($increment) || false === ($type = array_search($type, $this->param['type']))) { |
|
78 | + return false; |
|
79 | + } |
|
80 | 80 | |
81 | - $sql = " UPDATE {$this->table}" |
|
82 | - . ' SET stats_value = CASE ' |
|
83 | - . " WHEN time_format = '' OR DATE_FORMAT(time_update, time_format) = DATE_FORMAT(NOW(), time_format) THEN stats_value + '{$increment}' " |
|
84 | - . " ELSE '{$increment}' " |
|
85 | - . ' END, ' |
|
86 | - . ' time_update = NOW()' |
|
87 | - . ' WHERE ' |
|
88 | - . " (stats_id = '0' OR stats_id = '{$id}') " |
|
89 | - . " AND stats_type='{$type}' "; |
|
90 | - $result = $this->db->queryF($sql); |
|
91 | - $rows = $this->db->getAffectedRows(); |
|
92 | - if (0 == $rows) { |
|
93 | - $sql = " INSERT INTO {$this->table}" |
|
94 | - . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
95 | - . ' VALUES ' |
|
96 | - . " ('0', '{$increment}', '{$type}', '" |
|
97 | - . array_search('total', $this->param['period'], true) |
|
98 | - . "', NOW(), ''), " |
|
99 | - . " ('0', '{$increment}', '{$type}', '" |
|
100 | - . array_search('day', $this->param['period'], true) |
|
101 | - . "', NOW(), '%Y%j'), " |
|
102 | - . " ('0', '{$increment}', '{$type}', '" |
|
103 | - . array_search('week', $this->param['period'], true) |
|
104 | - . "', NOW(), '%Y%u'), " |
|
105 | - . " ('0', '{$increment}', '{$type}', '" |
|
106 | - . array_search('month', $this->param['period'], true) |
|
107 | - . "', NOW(), '%Y%m')"; |
|
108 | - $result = $this->db->queryF($sql); |
|
109 | - } |
|
110 | - if ($rows < 2 * count($this->param['period']) && !empty($id)) { |
|
111 | - $sql = " INSERT INTO {$this->table}" |
|
112 | - . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
113 | - . ' VALUES ' |
|
114 | - . " ('{$id}', '{$increment}', '{$type}', '" |
|
115 | - . array_search('total', $this->param['period'], true) |
|
116 | - . "', NOW(), ''), " |
|
117 | - . " ('{$id}', '{$increment}', '{$type}', '" |
|
118 | - . array_search('day', $this->param['period'], true) |
|
119 | - . "', NOW(), '%Y%j'), " |
|
120 | - . " ('{$id}', '{$increment}', '{$type}', '" |
|
121 | - . array_search('week', $this->param['period'], true) |
|
122 | - . "', NOW(), '%Y%u'), " |
|
123 | - . " ('{$id}', '{$increment}', '{$type}', '" |
|
124 | - . array_search('month', $this->param['period'], true) |
|
125 | - . "', NOW(), '%Y%m')"; |
|
126 | - $result = $this->db->queryF($sql); |
|
127 | - } |
|
128 | - } |
|
81 | + $sql = " UPDATE {$this->table}" |
|
82 | + . ' SET stats_value = CASE ' |
|
83 | + . " WHEN time_format = '' OR DATE_FORMAT(time_update, time_format) = DATE_FORMAT(NOW(), time_format) THEN stats_value + '{$increment}' " |
|
84 | + . " ELSE '{$increment}' " |
|
85 | + . ' END, ' |
|
86 | + . ' time_update = NOW()' |
|
87 | + . ' WHERE ' |
|
88 | + . " (stats_id = '0' OR stats_id = '{$id}') " |
|
89 | + . " AND stats_type='{$type}' "; |
|
90 | + $result = $this->db->queryF($sql); |
|
91 | + $rows = $this->db->getAffectedRows(); |
|
92 | + if (0 == $rows) { |
|
93 | + $sql = " INSERT INTO {$this->table}" |
|
94 | + . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
95 | + . ' VALUES ' |
|
96 | + . " ('0', '{$increment}', '{$type}', '" |
|
97 | + . array_search('total', $this->param['period'], true) |
|
98 | + . "', NOW(), ''), " |
|
99 | + . " ('0', '{$increment}', '{$type}', '" |
|
100 | + . array_search('day', $this->param['period'], true) |
|
101 | + . "', NOW(), '%Y%j'), " |
|
102 | + . " ('0', '{$increment}', '{$type}', '" |
|
103 | + . array_search('week', $this->param['period'], true) |
|
104 | + . "', NOW(), '%Y%u'), " |
|
105 | + . " ('0', '{$increment}', '{$type}', '" |
|
106 | + . array_search('month', $this->param['period'], true) |
|
107 | + . "', NOW(), '%Y%m')"; |
|
108 | + $result = $this->db->queryF($sql); |
|
109 | + } |
|
110 | + if ($rows < 2 * count($this->param['period']) && !empty($id)) { |
|
111 | + $sql = " INSERT INTO {$this->table}" |
|
112 | + . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
113 | + . ' VALUES ' |
|
114 | + . " ('{$id}', '{$increment}', '{$type}', '" |
|
115 | + . array_search('total', $this->param['period'], true) |
|
116 | + . "', NOW(), ''), " |
|
117 | + . " ('{$id}', '{$increment}', '{$type}', '" |
|
118 | + . array_search('day', $this->param['period'], true) |
|
119 | + . "', NOW(), '%Y%j'), " |
|
120 | + . " ('{$id}', '{$increment}', '{$type}', '" |
|
121 | + . array_search('week', $this->param['period'], true) |
|
122 | + . "', NOW(), '%Y%u'), " |
|
123 | + . " ('{$id}', '{$increment}', '{$type}', '" |
|
124 | + . array_search('month', $this->param['period'], true) |
|
125 | + . "', NOW(), '%Y%m')"; |
|
126 | + $result = $this->db->queryF($sql); |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Get stats of "Today" |
|
132 | - * |
|
133 | - * @param array $ids ID of forum: > 0, forum; 0 - global; empty - all |
|
134 | - * @param array $types type of stats items: 1 - topic; 2 - post; 3 - digest; 4 - click; empty - all |
|
135 | - * @param array $periods time period: 1 - all time; 2 - today; 3 - this week; 4 - this month; empty - all |
|
136 | - * @return array |
|
137 | - */ |
|
138 | - public function getStats(array $ids, array $types = [], array $periods = []) |
|
139 | - { |
|
140 | - $ret = []; |
|
130 | + /** |
|
131 | + * Get stats of "Today" |
|
132 | + * |
|
133 | + * @param array $ids ID of forum: > 0, forum; 0 - global; empty - all |
|
134 | + * @param array $types type of stats items: 1 - topic; 2 - post; 3 - digest; 4 - click; empty - all |
|
135 | + * @param array $periods time period: 1 - all time; 2 - today; 3 - this week; 4 - this month; empty - all |
|
136 | + * @return array |
|
137 | + */ |
|
138 | + public function getStats(array $ids, array $types = [], array $periods = []) |
|
139 | + { |
|
140 | + $ret = []; |
|
141 | 141 | |
142 | - $_types = []; |
|
143 | - foreach ($types as $type) { |
|
144 | - $_types[] = array_search($type, $this->param['type']); |
|
145 | - } |
|
146 | - $_periods = []; |
|
147 | - foreach ($periods as $period) { |
|
148 | - $_periods[] = array_search($period, $this->param['period']); |
|
149 | - } |
|
150 | - $sql = ' SELECT stats_id, stats_value, stats_type, stats_period ' |
|
151 | - . " FROM {$this->table} " |
|
152 | - . ' WHERE ' |
|
153 | - . " ( time_format = '' OR DATE_FORMAT(time_update, time_format) = DATE_FORMAT(NOW(), time_format) ) " |
|
154 | - . ' ' |
|
155 | - . (empty($ids) ? '' : 'AND stats_id IN (' |
|
156 | - . implode(', ', array_map('intval', $ids)) |
|
157 | - . ')') |
|
158 | - . ' ' |
|
159 | - . (empty($_types) ? '' : 'AND stats_type IN (' . implode(', ', $_types) . ')') |
|
160 | - . ' ' |
|
161 | - . (empty($_periods) ? '' : 'AND stats_period IN (' . implode(', ', $_periods) . ')'); |
|
162 | - $result = $this->db->query($sql); |
|
142 | + $_types = []; |
|
143 | + foreach ($types as $type) { |
|
144 | + $_types[] = array_search($type, $this->param['type']); |
|
145 | + } |
|
146 | + $_periods = []; |
|
147 | + foreach ($periods as $period) { |
|
148 | + $_periods[] = array_search($period, $this->param['period']); |
|
149 | + } |
|
150 | + $sql = ' SELECT stats_id, stats_value, stats_type, stats_period ' |
|
151 | + . " FROM {$this->table} " |
|
152 | + . ' WHERE ' |
|
153 | + . " ( time_format = '' OR DATE_FORMAT(time_update, time_format) = DATE_FORMAT(NOW(), time_format) ) " |
|
154 | + . ' ' |
|
155 | + . (empty($ids) ? '' : 'AND stats_id IN (' |
|
156 | + . implode(', ', array_map('intval', $ids)) |
|
157 | + . ')') |
|
158 | + . ' ' |
|
159 | + . (empty($_types) ? '' : 'AND stats_type IN (' . implode(', ', $_types) . ')') |
|
160 | + . ' ' |
|
161 | + . (empty($_periods) ? '' : 'AND stats_period IN (' . implode(', ', $_periods) . ')'); |
|
162 | + $result = $this->db->query($sql); |
|
163 | 163 | |
164 | - while (false !== ($row = $this->db->fetchArray($result))) { |
|
165 | - $ret[(string)$row['stats_id']][$this->param['type'][$row['stats_type']]][$this->param['period'][$row['stats_period']]] = $row['stats_value']; |
|
166 | - } |
|
164 | + while (false !== ($row = $this->db->fetchArray($result))) { |
|
165 | + $ret[(string)$row['stats_id']][$this->param['type'][$row['stats_type']]][$this->param['period'][$row['stats_period']]] = $row['stats_value']; |
|
166 | + } |
|
167 | 167 | |
168 | - return $ret; |
|
169 | - } |
|
168 | + return $ret; |
|
169 | + } |
|
170 | 170 | |
171 | - public function reset() |
|
172 | - { |
|
173 | - $this->db->queryF('TRUNCATE TABLE ' . $this->table); |
|
174 | - $now = time(); |
|
175 | - $time_start = [ |
|
176 | - 'day' => '%Y%j', |
|
177 | - 'week' => '%Y%u', |
|
178 | - 'month' => '%Y%m' |
|
179 | - ]; |
|
180 | - $counts = []; |
|
171 | + public function reset() |
|
172 | + { |
|
173 | + $this->db->queryF('TRUNCATE TABLE ' . $this->table); |
|
174 | + $now = time(); |
|
175 | + $time_start = [ |
|
176 | + 'day' => '%Y%j', |
|
177 | + 'week' => '%Y%u', |
|
178 | + 'month' => '%Y%m' |
|
179 | + ]; |
|
180 | + $counts = []; |
|
181 | 181 | |
182 | - $sql = ' SELECT forum_id' . ' FROM ' . $this->db->prefix('newbb_forums'); |
|
183 | - $ret = $this->db->query($sql); |
|
184 | - while (false !== (list($forum_id) = $this->db->fetchRow($ret))) { |
|
185 | - $sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}"; |
|
186 | - $result = $this->db->query($sql); |
|
187 | - list($topics, $views) = $this->db->fetchRow($result); |
|
188 | - $this->update($forum_id, 'topic', $topics); |
|
189 | - $this->update($forum_id, 'view', $views); |
|
182 | + $sql = ' SELECT forum_id' . ' FROM ' . $this->db->prefix('newbb_forums'); |
|
183 | + $ret = $this->db->query($sql); |
|
184 | + while (false !== (list($forum_id) = $this->db->fetchRow($ret))) { |
|
185 | + $sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}"; |
|
186 | + $result = $this->db->query($sql); |
|
187 | + list($topics, $views) = $this->db->fetchRow($result); |
|
188 | + $this->update($forum_id, 'topic', $topics); |
|
189 | + $this->update($forum_id, 'view', $views); |
|
190 | 190 | |
191 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}"; |
|
192 | - $result = $this->db->query($sql); |
|
193 | - list($digests) = $this->db->fetchRow($result); |
|
194 | - $this->update($forum_id, 'digest', $digests); |
|
191 | + $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}"; |
|
192 | + $result = $this->db->query($sql); |
|
193 | + list($digests) = $this->db->fetchRow($result); |
|
194 | + $this->update($forum_id, 'digest', $digests); |
|
195 | 195 | |
196 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_posts') . " WHERE approved=1 AND forum_id = {$forum_id}"; |
|
197 | - $result = $this->db->query($sql); |
|
198 | - list($posts) = $this->db->fetchRow($result); |
|
199 | - $this->update($forum_id, 'post', $posts); |
|
196 | + $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_posts') . " WHERE approved=1 AND forum_id = {$forum_id}"; |
|
197 | + $result = $this->db->query($sql); |
|
198 | + list($posts) = $this->db->fetchRow($result); |
|
199 | + $this->update($forum_id, 'post', $posts); |
|
200 | 200 | |
201 | - foreach ($time_start as $period => $format) { |
|
202 | - $sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(topic_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
203 | - $result = $this->db->query($sql); |
|
204 | - list($topics, $views) = $this->db->fetchRow($result); |
|
205 | - $views = empty($views) ? 0 : $views; // null check |
|
206 | - $this->db->queryF(" INSERT INTO {$this->table}" |
|
207 | - . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
208 | - . ' VALUES ' |
|
209 | - . " ('{$forum_id}', '{$topics}', '" |
|
210 | - . array_search('topic', $this->param['type'], true) |
|
211 | - . "', '" |
|
212 | - . array_search($period, $this->param['period']) |
|
213 | - . "', NOW(), '{$format}')"); |
|
214 | - $this->db->queryF(" INSERT INTO {$this->table}" |
|
215 | - . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
216 | - . ' VALUES ' |
|
217 | - . " ('{$forum_id}', '{$views}', '" |
|
218 | - . array_search('view', $this->param['type'], true) |
|
219 | - . "', '" |
|
220 | - . array_search($period, $this->param['period']) |
|
221 | - . "', NOW(), '{$format}')"); |
|
222 | - @$counts['topic'][$period] += $topics; |
|
223 | - @$counts['view'][$period] += $views; |
|
201 | + foreach ($time_start as $period => $format) { |
|
202 | + $sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(topic_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
203 | + $result = $this->db->query($sql); |
|
204 | + list($topics, $views) = $this->db->fetchRow($result); |
|
205 | + $views = empty($views) ? 0 : $views; // null check |
|
206 | + $this->db->queryF(" INSERT INTO {$this->table}" |
|
207 | + . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
208 | + . ' VALUES ' |
|
209 | + . " ('{$forum_id}', '{$topics}', '" |
|
210 | + . array_search('topic', $this->param['type'], true) |
|
211 | + . "', '" |
|
212 | + . array_search($period, $this->param['period']) |
|
213 | + . "', NOW(), '{$format}')"); |
|
214 | + $this->db->queryF(" INSERT INTO {$this->table}" |
|
215 | + . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
216 | + . ' VALUES ' |
|
217 | + . " ('{$forum_id}', '{$views}', '" |
|
218 | + . array_search('view', $this->param['type'], true) |
|
219 | + . "', '" |
|
220 | + . array_search($period, $this->param['period']) |
|
221 | + . "', NOW(), '{$format}')"); |
|
222 | + @$counts['topic'][$period] += $topics; |
|
223 | + @$counts['view'][$period] += $views; |
|
224 | 224 | |
225 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(digest_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
226 | - $result = $this->db->query($sql); |
|
227 | - list($digests) = $this->db->fetchRow($result); |
|
228 | - $this->db->queryF(" INSERT INTO {$this->table}" |
|
229 | - . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
230 | - . ' VALUES ' |
|
231 | - . " ('{$forum_id}', '{$digests}', '" |
|
232 | - . array_search('digest', $this->param['type'], true) |
|
233 | - . "', '" |
|
234 | - . array_search($period, $this->param['period']) |
|
235 | - . "', NOW(), '{$format}')"); |
|
236 | - @$counts['digest'][$period] += $digests; |
|
225 | + $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(digest_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
226 | + $result = $this->db->query($sql); |
|
227 | + list($digests) = $this->db->fetchRow($result); |
|
228 | + $this->db->queryF(" INSERT INTO {$this->table}" |
|
229 | + . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
230 | + . ' VALUES ' |
|
231 | + . " ('{$forum_id}', '{$digests}', '" |
|
232 | + . array_search('digest', $this->param['type'], true) |
|
233 | + . "', '" |
|
234 | + . array_search($period, $this->param['period']) |
|
235 | + . "', NOW(), '{$format}')"); |
|
236 | + @$counts['digest'][$period] += $digests; |
|
237 | 237 | |
238 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_posts') . " WHERE approved=1 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(post_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
239 | - $result = $this->db->query($sql); |
|
240 | - list($posts) = $this->db->fetchRow($result); |
|
241 | - $this->db->queryF(" INSERT INTO {$this->table}" |
|
242 | - . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
243 | - . ' VALUES ' |
|
244 | - . " ('{$forum_id}', '{$posts}', '" |
|
245 | - . array_search('post', $this->param['type']) |
|
246 | - . "', '" |
|
247 | - . array_search($period, $this->param['period'], true) |
|
248 | - . "', NOW(), '{$format}')"); |
|
249 | - @$counts['post'][$period] += $posts; |
|
250 | - } |
|
251 | - } |
|
238 | + $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_posts') . " WHERE approved=1 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(post_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
239 | + $result = $this->db->query($sql); |
|
240 | + list($posts) = $this->db->fetchRow($result); |
|
241 | + $this->db->queryF(" INSERT INTO {$this->table}" |
|
242 | + . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
243 | + . ' VALUES ' |
|
244 | + . " ('{$forum_id}', '{$posts}', '" |
|
245 | + . array_search('post', $this->param['type']) |
|
246 | + . "', '" |
|
247 | + . array_search($period, $this->param['period'], true) |
|
248 | + . "', NOW(), '{$format}')"); |
|
249 | + @$counts['post'][$period] += $posts; |
|
250 | + } |
|
251 | + } |
|
252 | 252 | |
253 | - $this->db->queryF(" DELETE FROM {$this->table}" . " WHERE stats_id = '0' AND stats_period <> " . array_search('total', $this->param['period'], true)); |
|
254 | - foreach ($time_start as $period => $format) { |
|
255 | - foreach (array_keys($counts) as $type) { |
|
256 | - $this->db->queryF(" INSERT INTO {$this->table}" |
|
257 | - . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
258 | - . ' VALUES ' |
|
259 | - . " ('0', '{$counts[$type][$period]}', '" |
|
260 | - . array_search($type, $this->param['type'], true) |
|
261 | - . "', '" |
|
262 | - . array_search($period, $this->param['period'], true) |
|
263 | - . "', NOW(), '{$format}')"); |
|
264 | - } |
|
265 | - } |
|
266 | - } |
|
253 | + $this->db->queryF(" DELETE FROM {$this->table}" . " WHERE stats_id = '0' AND stats_period <> " . array_search('total', $this->param['period'], true)); |
|
254 | + foreach ($time_start as $period => $format) { |
|
255 | + foreach (array_keys($counts) as $type) { |
|
256 | + $this->db->queryF(" INSERT INTO {$this->table}" |
|
257 | + . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
|
258 | + . ' VALUES ' |
|
259 | + . " ('0', '{$counts[$type][$period]}', '" |
|
260 | + . array_search($type, $this->param['type'], true) |
|
261 | + . "', '" |
|
262 | + . array_search($period, $this->param['period'], true) |
|
263 | + . "', NOW(), '{$format}')"); |
|
264 | + } |
|
265 | + } |
|
266 | + } |
|
267 | 267 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
14 | 14 | |
15 | -defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__ . '/functions.ini.php'; |
|
15 | +defined('NEWBB_FUNCTIONS_INI') || require_once __DIR__.'/functions.ini.php'; |
|
16 | 16 | |
17 | 17 | define('NEWBB_STATS_TYPE_TOPIC', 1); |
18 | 18 | define('NEWBB_STATS_TYPE_POST', 2); |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function update($id, $type, $increment = 1) |
73 | 73 | { |
74 | - $id = (int)$id; |
|
75 | - $increment = (int)$increment; |
|
74 | + $id = (int) $id; |
|
75 | + $increment = (int) $increment; |
|
76 | 76 | |
77 | 77 | if (empty($increment) || false === ($type = array_search($type, $this->param['type']))) { |
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
81 | - $sql = " UPDATE {$this->table}" |
|
81 | + $sql = " UPDATE {$this->table}" |
|
82 | 82 | . ' SET stats_value = CASE ' |
83 | 83 | . " WHEN time_format = '' OR DATE_FORMAT(time_update, time_format) = DATE_FORMAT(NOW(), time_format) THEN stats_value + '{$increment}' " |
84 | 84 | . " ELSE '{$increment}' " |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $result = $this->db->queryF($sql); |
91 | 91 | $rows = $this->db->getAffectedRows(); |
92 | 92 | if (0 == $rows) { |
93 | - $sql = " INSERT INTO {$this->table}" |
|
93 | + $sql = " INSERT INTO {$this->table}" |
|
94 | 94 | . ' (`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) ' |
95 | 95 | . ' VALUES ' |
96 | 96 | . " ('0', '{$increment}', '{$type}', '" |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | foreach ($periods as $period) { |
148 | 148 | $_periods[] = array_search($period, $this->param['period']); |
149 | 149 | } |
150 | - $sql = ' SELECT stats_id, stats_value, stats_type, stats_period ' |
|
150 | + $sql = ' SELECT stats_id, stats_value, stats_type, stats_period ' |
|
151 | 151 | . " FROM {$this->table} " |
152 | 152 | . ' WHERE ' |
153 | 153 | . " ( time_format = '' OR DATE_FORMAT(time_update, time_format) = DATE_FORMAT(NOW(), time_format) ) " |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | . implode(', ', array_map('intval', $ids)) |
157 | 157 | . ')') |
158 | 158 | . ' ' |
159 | - . (empty($_types) ? '' : 'AND stats_type IN (' . implode(', ', $_types) . ')') |
|
159 | + . (empty($_types) ? '' : 'AND stats_type IN ('.implode(', ', $_types).')') |
|
160 | 160 | . ' ' |
161 | - . (empty($_periods) ? '' : 'AND stats_period IN (' . implode(', ', $_periods) . ')'); |
|
161 | + . (empty($_periods) ? '' : 'AND stats_period IN ('.implode(', ', $_periods).')'); |
|
162 | 162 | $result = $this->db->query($sql); |
163 | 163 | |
164 | 164 | while (false !== ($row = $this->db->fetchArray($result))) { |
165 | - $ret[(string)$row['stats_id']][$this->param['type'][$row['stats_type']]][$this->param['period'][$row['stats_period']]] = $row['stats_value']; |
|
165 | + $ret[(string) $row['stats_id']][$this->param['type'][$row['stats_type']]][$this->param['period'][$row['stats_period']]] = $row['stats_value']; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | return $ret; |
@@ -170,36 +170,36 @@ discard block |
||
170 | 170 | |
171 | 171 | public function reset() |
172 | 172 | { |
173 | - $this->db->queryF('TRUNCATE TABLE ' . $this->table); |
|
173 | + $this->db->queryF('TRUNCATE TABLE '.$this->table); |
|
174 | 174 | $now = time(); |
175 | 175 | $time_start = [ |
176 | 176 | 'day' => '%Y%j', |
177 | 177 | 'week' => '%Y%u', |
178 | 178 | 'month' => '%Y%m' |
179 | 179 | ]; |
180 | - $counts = []; |
|
180 | + $counts = []; |
|
181 | 181 | |
182 | - $sql = ' SELECT forum_id' . ' FROM ' . $this->db->prefix('newbb_forums'); |
|
182 | + $sql = ' SELECT forum_id'.' FROM '.$this->db->prefix('newbb_forums'); |
|
183 | 183 | $ret = $this->db->query($sql); |
184 | 184 | while (false !== (list($forum_id) = $this->db->fetchRow($ret))) { |
185 | - $sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}"; |
|
185 | + $sql = ' SELECT COUNT(*), SUM(topic_views)'.' FROM '.$this->db->prefix('newbb_topics')." WHERE approved=1 AND forum_id = {$forum_id}"; |
|
186 | 186 | $result = $this->db->query($sql); |
187 | 187 | list($topics, $views) = $this->db->fetchRow($result); |
188 | 188 | $this->update($forum_id, 'topic', $topics); |
189 | 189 | $this->update($forum_id, 'view', $views); |
190 | 190 | |
191 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}"; |
|
191 | + $sql = ' SELECT COUNT(*)'.' FROM '.$this->db->prefix('newbb_topics')." WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}"; |
|
192 | 192 | $result = $this->db->query($sql); |
193 | 193 | list($digests) = $this->db->fetchRow($result); |
194 | 194 | $this->update($forum_id, 'digest', $digests); |
195 | 195 | |
196 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_posts') . " WHERE approved=1 AND forum_id = {$forum_id}"; |
|
196 | + $sql = ' SELECT COUNT(*)'.' FROM '.$this->db->prefix('newbb_posts')." WHERE approved=1 AND forum_id = {$forum_id}"; |
|
197 | 197 | $result = $this->db->query($sql); |
198 | 198 | list($posts) = $this->db->fetchRow($result); |
199 | 199 | $this->update($forum_id, 'post', $posts); |
200 | 200 | |
201 | 201 | foreach ($time_start as $period => $format) { |
202 | - $sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(topic_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
202 | + $sql = ' SELECT COUNT(*), SUM(topic_views)'.' FROM '.$this->db->prefix('newbb_topics')." WHERE approved=1 AND forum_id = {$forum_id}"." AND FROM_UNIXTIME(topic_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
203 | 203 | $result = $this->db->query($sql); |
204 | 204 | list($topics, $views) = $this->db->fetchRow($result); |
205 | 205 | $views = empty($views) ? 0 : $views; // null check |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | @$counts['topic'][$period] += $topics; |
223 | 223 | @$counts['view'][$period] += $views; |
224 | 224 | |
225 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(digest_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
225 | + $sql = ' SELECT COUNT(*)'.' FROM '.$this->db->prefix('newbb_topics')." WHERE approved=1 AND topic_digest >0 AND forum_id = {$forum_id}"." AND FROM_UNIXTIME(digest_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
226 | 226 | $result = $this->db->query($sql); |
227 | 227 | list($digests) = $this->db->fetchRow($result); |
228 | 228 | $this->db->queryF(" INSERT INTO {$this->table}" |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | . "', NOW(), '{$format}')"); |
236 | 236 | @$counts['digest'][$period] += $digests; |
237 | 237 | |
238 | - $sql = ' SELECT COUNT(*)' . ' FROM ' . $this->db->prefix('newbb_posts') . " WHERE approved=1 AND forum_id = {$forum_id}" . " AND FROM_UNIXTIME(post_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
238 | + $sql = ' SELECT COUNT(*)'.' FROM '.$this->db->prefix('newbb_posts')." WHERE approved=1 AND forum_id = {$forum_id}"." AND FROM_UNIXTIME(post_time, '{$format}') >= FROM_UNIXTIME({$now}, '{$format}')"; |
|
239 | 239 | $result = $this->db->query($sql); |
240 | 240 | list($posts) = $this->db->fetchRow($result); |
241 | 241 | $this->db->queryF(" INSERT INTO {$this->table}" |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | - $this->db->queryF(" DELETE FROM {$this->table}" . " WHERE stats_id = '0' AND stats_period <> " . array_search('total', $this->param['period'], true)); |
|
253 | + $this->db->queryF(" DELETE FROM {$this->table}"." WHERE stats_id = '0' AND stats_period <> ".array_search('total', $this->param['period'], true)); |
|
254 | 254 | foreach ($time_start as $period => $format) { |
255 | 255 | foreach (array_keys($counts) as $type) { |
256 | 256 | $this->db->queryF(" INSERT INTO {$this->table}" |
@@ -44,12 +44,12 @@ |
||
44 | 44 | */ |
45 | 45 | class Readtopic extends Newbb\Read |
46 | 46 | { |
47 | - /** |
|
48 | - * |
|
49 | - */ |
|
50 | - public function __construct() |
|
51 | - { |
|
52 | - parent::__construct(); |
|
53 | - //$this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
54 | - } |
|
47 | + /** |
|
48 | + * |
|
49 | + */ |
|
50 | + public function __construct() |
|
51 | + { |
|
52 | + parent::__construct(); |
|
53 | + //$this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
54 | + } |
|
55 | 55 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | use XoopsModules\Newbb; |
34 | 34 | |
35 | -require_once __DIR__ . '/Read.php'; |
|
35 | +require_once __DIR__.'/Read.php'; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * A handler for read/unread handling |
@@ -22,186 +22,186 @@ |
||
22 | 22 | */ |
23 | 23 | class Topic extends \XoopsObject |
24 | 24 | { |
25 | - /** |
|
26 | - * |
|
27 | - */ |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - parent::__construct(); |
|
31 | - $this->initVar('topic_id', XOBJ_DTYPE_INT); |
|
32 | - $this->initVar('topic_title', XOBJ_DTYPE_TXTBOX); |
|
33 | - $this->initVar('topic_poster', XOBJ_DTYPE_INT); |
|
34 | - $this->initVar('topic_time', XOBJ_DTYPE_INT); |
|
35 | - $this->initVar('topic_views', XOBJ_DTYPE_INT); |
|
36 | - $this->initVar('topic_replies', XOBJ_DTYPE_INT); |
|
37 | - $this->initVar('topic_last_post_id', XOBJ_DTYPE_INT); |
|
38 | - $this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
39 | - $this->initVar('topic_status', XOBJ_DTYPE_INT); |
|
40 | - $this->initVar('type_id', XOBJ_DTYPE_INT); |
|
41 | - $this->initVar('topic_sticky', XOBJ_DTYPE_INT); |
|
42 | - $this->initVar('topic_digest', XOBJ_DTYPE_INT); |
|
43 | - $this->initVar('digest_time', XOBJ_DTYPE_INT); |
|
44 | - $this->initVar('approved', XOBJ_DTYPE_INT); |
|
45 | - $this->initVar('poster_name', XOBJ_DTYPE_TXTBOX); |
|
46 | - $this->initVar('rating', XOBJ_DTYPE_OTHER); |
|
47 | - $this->initVar('votes', XOBJ_DTYPE_INT); |
|
48 | - $this->initVar('topic_haspoll', XOBJ_DTYPE_INT); |
|
49 | - $this->initVar('poll_id', XOBJ_DTYPE_INT); |
|
50 | - $this->initVar('topic_tags', XOBJ_DTYPE_SOURCE); |
|
51 | - } |
|
52 | - |
|
53 | - // irmtfan add LAST_INSERT_ID to enhance the mysql performances |
|
54 | - public function incrementCounter() |
|
55 | - { |
|
56 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id =' . $this->getVar('topic_id'); |
|
57 | - $GLOBALS['xoopsDB']->queryF($sql); |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Create full title of the topic |
|
62 | - * |
|
63 | - * the title is composed of [type_name] if type_id is greater than 0 plus topic_title |
|
64 | - * |
|
65 | - */ |
|
66 | - public function getFullTitle() |
|
67 | - { |
|
68 | - $topic_title = $this->getVar('topic_title'); |
|
69 | - if (!$this->getVar('type_id')) { |
|
70 | - return $topic_title; |
|
71 | - } |
|
72 | - $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
73 | - if (!$typeObject = $typeHandler->get($this->getVar('type_id'))) { |
|
74 | - return $topic_title; |
|
75 | - } |
|
76 | - |
|
77 | - require_once dirname(__DIR__) . '/include/functions.topic.php'; |
|
78 | - |
|
79 | - return getTopicTitle($topic_title, $typeObject->getVar('type_name'), $typeObject->getVar('type_color')); |
|
80 | - } |
|
81 | - // START irmtfan loadOldPoll function |
|
82 | - |
|
83 | - /** |
|
84 | - * Load functions needed for old xoopspoll (older than version 1.4 by zyspec) and umfrage modules |
|
85 | - * |
|
86 | - * @access public |
|
87 | - * @param string $pollModule dirname of the poll module |
|
88 | - * @return string|false $classPoll = the name of the old poll class eg: "XoopsPoll" | "Umfrage" |
|
89 | - */ |
|
90 | - |
|
91 | - public function loadOldPoll($pollModule = null) |
|
92 | - { |
|
93 | - static $classPoll = false; |
|
94 | - if ($classPoll && empty($pollModule)) { |
|
95 | - return $classPoll; |
|
96 | - } |
|
97 | - $newbbConfig = newbbLoadConfig(); |
|
98 | - if (!empty($pollModule)) { |
|
99 | - $newbbConfig['poll_module'] = $pollModule; |
|
100 | - } |
|
25 | + /** |
|
26 | + * |
|
27 | + */ |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + parent::__construct(); |
|
31 | + $this->initVar('topic_id', XOBJ_DTYPE_INT); |
|
32 | + $this->initVar('topic_title', XOBJ_DTYPE_TXTBOX); |
|
33 | + $this->initVar('topic_poster', XOBJ_DTYPE_INT); |
|
34 | + $this->initVar('topic_time', XOBJ_DTYPE_INT); |
|
35 | + $this->initVar('topic_views', XOBJ_DTYPE_INT); |
|
36 | + $this->initVar('topic_replies', XOBJ_DTYPE_INT); |
|
37 | + $this->initVar('topic_last_post_id', XOBJ_DTYPE_INT); |
|
38 | + $this->initVar('forum_id', XOBJ_DTYPE_INT); |
|
39 | + $this->initVar('topic_status', XOBJ_DTYPE_INT); |
|
40 | + $this->initVar('type_id', XOBJ_DTYPE_INT); |
|
41 | + $this->initVar('topic_sticky', XOBJ_DTYPE_INT); |
|
42 | + $this->initVar('topic_digest', XOBJ_DTYPE_INT); |
|
43 | + $this->initVar('digest_time', XOBJ_DTYPE_INT); |
|
44 | + $this->initVar('approved', XOBJ_DTYPE_INT); |
|
45 | + $this->initVar('poster_name', XOBJ_DTYPE_TXTBOX); |
|
46 | + $this->initVar('rating', XOBJ_DTYPE_OTHER); |
|
47 | + $this->initVar('votes', XOBJ_DTYPE_INT); |
|
48 | + $this->initVar('topic_haspoll', XOBJ_DTYPE_INT); |
|
49 | + $this->initVar('poll_id', XOBJ_DTYPE_INT); |
|
50 | + $this->initVar('topic_tags', XOBJ_DTYPE_SOURCE); |
|
51 | + } |
|
52 | + |
|
53 | + // irmtfan add LAST_INSERT_ID to enhance the mysql performances |
|
54 | + public function incrementCounter() |
|
55 | + { |
|
56 | + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id =' . $this->getVar('topic_id'); |
|
57 | + $GLOBALS['xoopsDB']->queryF($sql); |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Create full title of the topic |
|
62 | + * |
|
63 | + * the title is composed of [type_name] if type_id is greater than 0 plus topic_title |
|
64 | + * |
|
65 | + */ |
|
66 | + public function getFullTitle() |
|
67 | + { |
|
68 | + $topic_title = $this->getVar('topic_title'); |
|
69 | + if (!$this->getVar('type_id')) { |
|
70 | + return $topic_title; |
|
71 | + } |
|
72 | + $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
|
73 | + if (!$typeObject = $typeHandler->get($this->getVar('type_id'))) { |
|
74 | + return $topic_title; |
|
75 | + } |
|
76 | + |
|
77 | + require_once dirname(__DIR__) . '/include/functions.topic.php'; |
|
78 | + |
|
79 | + return getTopicTitle($topic_title, $typeObject->getVar('type_name'), $typeObject->getVar('type_color')); |
|
80 | + } |
|
81 | + // START irmtfan loadOldPoll function |
|
82 | + |
|
83 | + /** |
|
84 | + * Load functions needed for old xoopspoll (older than version 1.4 by zyspec) and umfrage modules |
|
85 | + * |
|
86 | + * @access public |
|
87 | + * @param string $pollModule dirname of the poll module |
|
88 | + * @return string|false $classPoll = the name of the old poll class eg: "XoopsPoll" | "Umfrage" |
|
89 | + */ |
|
90 | + |
|
91 | + public function loadOldPoll($pollModule = null) |
|
92 | + { |
|
93 | + static $classPoll = false; |
|
94 | + if ($classPoll && empty($pollModule)) { |
|
95 | + return $classPoll; |
|
96 | + } |
|
97 | + $newbbConfig = newbbLoadConfig(); |
|
98 | + if (!empty($pollModule)) { |
|
99 | + $newbbConfig['poll_module'] = $pollModule; |
|
100 | + } |
|
101 | 101 | // $relPath = $GLOBALS['xoops']->path('modules/' . $newbbConfig['poll_module'] . '/class/' . $newbbConfig['poll_module']); |
102 | 102 | // require_once $relPath . '.php'; |
103 | 103 | // require_once $relPath . 'option.php'; |
104 | 104 | // require_once $relPath . 'log.php'; |
105 | 105 | // require_once $relPath . 'renderer.php'; |
106 | - $classes = get_declared_classes(); |
|
107 | - foreach (array_reverse($classes) as $class) { |
|
108 | - if (strtolower($class) == $newbbConfig['poll_module']) { |
|
109 | - $classPoll = $class; |
|
110 | - |
|
111 | - return $classPoll; |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - return false; |
|
116 | - } |
|
117 | - // END irmtfan loadOldPoll function |
|
118 | - // START irmtfan add deletePoll function |
|
119 | - /** |
|
120 | - * delete a poll in database |
|
121 | - * |
|
122 | - * @access public |
|
123 | - * @param int $poll_id |
|
124 | - * @return bool |
|
125 | - */ |
|
126 | - public function deletePoll($poll_id) |
|
127 | - { |
|
128 | - if (empty($poll_id)) { |
|
129 | - return false; |
|
130 | - } |
|
131 | - /** @var \XoopsModuleHandler $moduleHandler */ |
|
132 | - $moduleHandler = xoops_getHandler('module'); |
|
133 | - $newbbConfig = newbbLoadConfig(); |
|
134 | - $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); |
|
135 | - if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { |
|
136 | - return false; |
|
137 | - } |
|
138 | - // new xoopspoll module |
|
139 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
140 | - /** @var \XoopsPollHandler $pollHandler */ |
|
141 | - $pollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
|
142 | - if (false !== $pollHandler->deleteAll(new \Criteria('poll_id', $poll_id, '='))) { |
|
143 | - /** @var XoopsPoll\OptionHandler $optionHandler */ |
|
144 | - $optionHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
145 | - $optionHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); |
|
146 | - /** @var XoopsPoll\LogHandler $logHandler */ |
|
147 | - $logHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
148 | - $logHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); |
|
149 | - xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll_id); |
|
150 | - } |
|
151 | - // old Xoopspoll or Umfrage or any clone from them |
|
152 | - } else { |
|
153 | - $classPoll = $this->loadOldPoll(); |
|
154 | - /** @var \XoopsPoll $poll */ |
|
155 | - $poll = new $classPoll($poll_id); |
|
156 | - if (false !== $poll->delete()) { |
|
157 | - $classOption = $classPoll . 'Option'; |
|
158 | - $classOption::deleteByPollId($poll->getVar('poll_id')); |
|
159 | - $classLog = $classPoll . 'Log'; |
|
160 | - $classLog::deleteByPollId($poll->getVar('poll_id')); |
|
161 | - xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll->getVar('poll_id')); |
|
162 | - } |
|
163 | - } // end poll_module new or old |
|
164 | - |
|
165 | - return true; |
|
166 | - } |
|
167 | - // END irmtfan add deletePoll function |
|
168 | - |
|
169 | - // START irmtfan add getPoll function |
|
170 | - /** |
|
171 | - * get a poll object from a poll module. |
|
172 | - * note: can be used to find if a poll exist in a module |
|
173 | - * @access public |
|
174 | - * @param int $poll_id |
|
175 | - * @param string $pollModule dirname of the poll module |
|
176 | - * @return bool|\XoopsObject poll |
|
177 | - */ |
|
178 | - public function getPoll($poll_id, $pollModule = null) |
|
179 | - { |
|
180 | - if (empty($poll_id)) { |
|
181 | - return false; |
|
182 | - } |
|
183 | - /** @var \XoopsModuleHandler $moduleHandler */ |
|
184 | - $moduleHandler = xoops_getHandler('module'); |
|
185 | - $newbbConfig = newbbLoadConfig(); |
|
186 | - if (!empty($pollModule)) { |
|
187 | - $newbbConfig['poll_module'] = $pollModule; |
|
188 | - } |
|
189 | - |
|
190 | - $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); |
|
191 | - if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { |
|
192 | - return false; |
|
193 | - } |
|
194 | - // new xoopspoll module |
|
195 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
196 | - $pollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
|
197 | - $pollObject = $pollHandler->get($poll_id); |
|
198 | - // old xoopspoll or umfrage or any clone from them |
|
199 | - } else { |
|
200 | - $classPoll = $this->loadOldPoll($newbbConfig['poll_module']); |
|
201 | - $pollObject = new $classPoll($poll_id); |
|
202 | - } // end poll_module new or old |
|
203 | - |
|
204 | - return $pollObject; |
|
205 | - } |
|
206 | - // END irmtfan add getPoll function |
|
106 | + $classes = get_declared_classes(); |
|
107 | + foreach (array_reverse($classes) as $class) { |
|
108 | + if (strtolower($class) == $newbbConfig['poll_module']) { |
|
109 | + $classPoll = $class; |
|
110 | + |
|
111 | + return $classPoll; |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + return false; |
|
116 | + } |
|
117 | + // END irmtfan loadOldPoll function |
|
118 | + // START irmtfan add deletePoll function |
|
119 | + /** |
|
120 | + * delete a poll in database |
|
121 | + * |
|
122 | + * @access public |
|
123 | + * @param int $poll_id |
|
124 | + * @return bool |
|
125 | + */ |
|
126 | + public function deletePoll($poll_id) |
|
127 | + { |
|
128 | + if (empty($poll_id)) { |
|
129 | + return false; |
|
130 | + } |
|
131 | + /** @var \XoopsModuleHandler $moduleHandler */ |
|
132 | + $moduleHandler = xoops_getHandler('module'); |
|
133 | + $newbbConfig = newbbLoadConfig(); |
|
134 | + $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); |
|
135 | + if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { |
|
136 | + return false; |
|
137 | + } |
|
138 | + // new xoopspoll module |
|
139 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
140 | + /** @var \XoopsPollHandler $pollHandler */ |
|
141 | + $pollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
|
142 | + if (false !== $pollHandler->deleteAll(new \Criteria('poll_id', $poll_id, '='))) { |
|
143 | + /** @var XoopsPoll\OptionHandler $optionHandler */ |
|
144 | + $optionHandler = Xoopspoll\Helper::getInstance()->getHandler('Option'); |
|
145 | + $optionHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); |
|
146 | + /** @var XoopsPoll\LogHandler $logHandler */ |
|
147 | + $logHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
148 | + $logHandler->deleteAll(new \Criteria('poll_id', $poll_id, '=')); |
|
149 | + xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll_id); |
|
150 | + } |
|
151 | + // old Xoopspoll or Umfrage or any clone from them |
|
152 | + } else { |
|
153 | + $classPoll = $this->loadOldPoll(); |
|
154 | + /** @var \XoopsPoll $poll */ |
|
155 | + $poll = new $classPoll($poll_id); |
|
156 | + if (false !== $poll->delete()) { |
|
157 | + $classOption = $classPoll . 'Option'; |
|
158 | + $classOption::deleteByPollId($poll->getVar('poll_id')); |
|
159 | + $classLog = $classPoll . 'Log'; |
|
160 | + $classLog::deleteByPollId($poll->getVar('poll_id')); |
|
161 | + xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll->getVar('poll_id')); |
|
162 | + } |
|
163 | + } // end poll_module new or old |
|
164 | + |
|
165 | + return true; |
|
166 | + } |
|
167 | + // END irmtfan add deletePoll function |
|
168 | + |
|
169 | + // START irmtfan add getPoll function |
|
170 | + /** |
|
171 | + * get a poll object from a poll module. |
|
172 | + * note: can be used to find if a poll exist in a module |
|
173 | + * @access public |
|
174 | + * @param int $poll_id |
|
175 | + * @param string $pollModule dirname of the poll module |
|
176 | + * @return bool|\XoopsObject poll |
|
177 | + */ |
|
178 | + public function getPoll($poll_id, $pollModule = null) |
|
179 | + { |
|
180 | + if (empty($poll_id)) { |
|
181 | + return false; |
|
182 | + } |
|
183 | + /** @var \XoopsModuleHandler $moduleHandler */ |
|
184 | + $moduleHandler = xoops_getHandler('module'); |
|
185 | + $newbbConfig = newbbLoadConfig(); |
|
186 | + if (!empty($pollModule)) { |
|
187 | + $newbbConfig['poll_module'] = $pollModule; |
|
188 | + } |
|
189 | + |
|
190 | + $pollModuleHandler = $moduleHandler->getByDirname($newbbConfig['poll_module']); |
|
191 | + if (!is_object($pollModuleHandler) || !$pollModuleHandler->getVar('isactive')) { |
|
192 | + return false; |
|
193 | + } |
|
194 | + // new xoopspoll module |
|
195 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
196 | + $pollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
|
197 | + $pollObject = $pollHandler->get($poll_id); |
|
198 | + // old xoopspoll or umfrage or any clone from them |
|
199 | + } else { |
|
200 | + $classPoll = $this->loadOldPoll($newbbConfig['poll_module']); |
|
201 | + $pollObject = new $classPoll($poll_id); |
|
202 | + } // end poll_module new or old |
|
203 | + |
|
204 | + return $pollObject; |
|
205 | + } |
|
206 | + // END irmtfan add getPoll function |
|
207 | 207 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // irmtfan add LAST_INSERT_ID to enhance the mysql performances |
54 | 54 | public function incrementCounter() |
55 | 55 | { |
56 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id =' . $this->getVar('topic_id'); |
|
56 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_topics').' SET topic_views = LAST_INSERT_ID(topic_views + 1) WHERE topic_id ='.$this->getVar('topic_id'); |
|
57 | 57 | $GLOBALS['xoopsDB']->queryF($sql); |
58 | 58 | } |
59 | 59 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return $topic_title; |
75 | 75 | } |
76 | 76 | |
77 | - require_once dirname(__DIR__) . '/include/functions.topic.php'; |
|
77 | + require_once dirname(__DIR__).'/include/functions.topic.php'; |
|
78 | 78 | |
79 | 79 | return getTopicTitle($topic_title, $typeObject->getVar('type_name'), $typeObject->getVar('type_color')); |
80 | 80 | } |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | /** @var \XoopsPoll $poll */ |
155 | 155 | $poll = new $classPoll($poll_id); |
156 | 156 | if (false !== $poll->delete()) { |
157 | - $classOption = $classPoll . 'Option'; |
|
157 | + $classOption = $classPoll.'Option'; |
|
158 | 158 | $classOption::deleteByPollId($poll->getVar('poll_id')); |
159 | - $classLog = $classPoll . 'Log'; |
|
159 | + $classLog = $classPoll.'Log'; |
|
160 | 160 | $classLog::deleteByPollId($poll->getVar('poll_id')); |
161 | 161 | xoops_comment_delete($GLOBALS['xoopsModule']->getVar('mid'), $poll->getVar('poll_id')); |
162 | 162 | } |
@@ -36,184 +36,184 @@ |
||
36 | 36 | */ |
37 | 37 | class IconHandler |
38 | 38 | { |
39 | - /** |
|
40 | - * reference to XOOPS template |
|
41 | - */ |
|
42 | - public $template; |
|
43 | - |
|
44 | - /** |
|
45 | - * image set |
|
46 | - */ |
|
47 | - private $forumImage = []; |
|
48 | - |
|
49 | - /** |
|
50 | - * prefix |
|
51 | - */ |
|
52 | - private $prefix = ''; |
|
53 | - |
|
54 | - /** |
|
55 | - * postfix, including extension |
|
56 | - */ |
|
57 | - private $postfix = '.png'; |
|
58 | - |
|
59 | - /** |
|
60 | - * images to be assigned to template |
|
61 | - */ |
|
62 | - private $images = []; |
|
63 | - |
|
64 | - /** |
|
65 | - * Constructor |
|
66 | - */ |
|
67 | - public function __construct() |
|
68 | - { |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Access the only instance of this class |
|
73 | - * @return IconHandler |
|
74 | - */ |
|
75 | - public static function getInstance() |
|
76 | - { |
|
77 | - static $instance; |
|
78 | - if (null === $instance) { |
|
79 | - $instance = new static(); |
|
80 | - } |
|
81 | - |
|
82 | - return $instance; |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * TODO: get compatible with new theme engine |
|
87 | - * @param $type |
|
88 | - * @param string $dirname |
|
89 | - * @param string $default |
|
90 | - * @param string $endDir |
|
91 | - * @return mixed |
|
92 | - */ |
|
93 | - // START irmtfan - improve to get other "end dirnames" like "css" and "js" - change images with $endDir |
|
94 | - public function getPath($type, $dirname = 'newbb', $default = '', $endDir = 'images') |
|
95 | - { |
|
96 | - static $paths; |
|
97 | - if (isset($paths[$endDir . '/' . $type])) { |
|
98 | - return $paths[$endDir . '/' . $type]; |
|
99 | - } |
|
100 | - |
|
101 | - $theme_path = $this->template->currentTheme->path; |
|
102 | - $rel_dir = "modules/{$dirname}/{$endDir}"; |
|
103 | - // START irmtfan add default for all pathes |
|
104 | - if (empty($default)) { |
|
105 | - $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" |
|
106 | - : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}" |
|
107 | - : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}")); |
|
108 | - } else { |
|
109 | - $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : ( |
|
110 | - is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : ( |
|
111 | - is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH |
|
112 | - . "/default/{$rel_dir}/{$type}" : ( |
|
113 | - is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" |
|
114 | - : (is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") |
|
115 | - : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$default}")) // XOOPS_ROOT_PATH |
|
116 | - ) // XOOPS_THEME_PATH {$default} |
|
117 | - ) // XOOPS_THEME_PATH |
|
118 | - ); // $theme_path {$default} |
|
119 | - } |
|
120 | - // END irmtfan add default for all pathes |
|
121 | - $paths[$endDir . '/' . $type] = str_replace(XOOPS_ROOT_PATH, '', str_replace('\\', '/', $path)); |
|
122 | - |
|
123 | - return $paths[$endDir . '/' . $type]; |
|
124 | - } |
|
125 | - |
|
126 | - // END irmtfan - improve to get other "end dirnames" like "css" and "js" - change images with $endDir |
|
127 | - |
|
128 | - /** |
|
129 | - * @param string $language |
|
130 | - * @param string $dirname |
|
131 | - */ |
|
132 | - public function init(/*$set = "default", */ |
|
133 | - $language = 'english', |
|
134 | - $dirname = 'newbb' |
|
135 | - ) { |
|
136 | - $this->forumImage = require_once $GLOBALS['xoops']->path("modules/{$dirname}/include/images.php"); |
|
137 | - |
|
138 | - $this->forumImage['icon'] = XOOPS_URL . $this->getPath('icon', $dirname) . '/'; |
|
139 | - $this->forumImage['language'] = XOOPS_URL . $this->getPath("language/{$language}", $dirname, 'language/english') . '/'; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * @param $image |
|
144 | - * @param string $alt |
|
145 | - * @param string $extra |
|
146 | - */ |
|
147 | - public function setImage($image, $alt = '', $extra = '') |
|
148 | - { |
|
149 | - if (!isset($this->images[$image])) { |
|
150 | - $imageSource = $this->getImageSource($image); |
|
151 | - // irmtfan add id={$image} |
|
152 | - $this->images[$image] = "<img src=\"{$imageSource}\" alt=\"{$alt}\" title=\"{$alt}\" align=\"middle\" {$extra} id={$image} />"; |
|
153 | - } |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * TODO: How about image not exist? |
|
158 | - * @param $image |
|
159 | - * @return string |
|
160 | - */ |
|
161 | - public function getImageSource($image) |
|
162 | - { |
|
163 | - return $this->forumImage[$this->forumImage[$image]] . $this->prefix . $image . $this->postfix; |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * @param $image |
|
168 | - * @param string $alt |
|
169 | - * @param string $extra |
|
170 | - * @return mixed |
|
171 | - */ |
|
172 | - public function getImage($image, $alt = '', $extra = '') |
|
173 | - { |
|
174 | - $this->setImage($image, $alt, $extra); |
|
175 | - |
|
176 | - return $this->images[$image]; |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * @param $image |
|
181 | - * @param string $alt |
|
182 | - * @param string $extra |
|
183 | - * @return string |
|
184 | - */ |
|
185 | - public function assignImage($image, $alt = '', $extra = '') |
|
186 | - { |
|
187 | - $this->setImage($image, $alt, $extra); |
|
188 | - // START hacked by irmtfan - improve function to CSS3 buttons - add alt and title attributes - use span instead of button to support IE7&8 |
|
189 | - $tag = 'span'; |
|
190 | - if ("class='forum_icon'" === $extra && in_array(substr($image, 0, 2), ['t_', 'p_', 'up'])) { |
|
191 | - $extra = "class='forum_icon forum_button'"; |
|
192 | - } |
|
193 | - |
|
194 | - return "<{$tag} alt=\"{$alt}\" title=\"{$alt}\" align=\"middle\" {$extra} id={$image}>$alt</{$tag}>"; |
|
195 | - // END hacked by irmtfan - improve function to CSS3 buttons |
|
196 | - } |
|
197 | - |
|
198 | - /** |
|
199 | - * @param $images |
|
200 | - */ |
|
201 | - public function assignImages($images) |
|
202 | - { |
|
203 | - foreach ($images as $myImage) { |
|
204 | - list($image, $alt, $extra) = $myImage; |
|
205 | - $this->assignImage($image, $alt, $extra); |
|
206 | - } |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * @return int|void |
|
211 | - */ |
|
212 | - public function render() |
|
213 | - { |
|
214 | - //$this->template->assign_by_ref("image", $this->images); |
|
215 | - $this->template->assign($this->images); |
|
216 | - |
|
217 | - return count($this->images); |
|
218 | - } |
|
39 | + /** |
|
40 | + * reference to XOOPS template |
|
41 | + */ |
|
42 | + public $template; |
|
43 | + |
|
44 | + /** |
|
45 | + * image set |
|
46 | + */ |
|
47 | + private $forumImage = []; |
|
48 | + |
|
49 | + /** |
|
50 | + * prefix |
|
51 | + */ |
|
52 | + private $prefix = ''; |
|
53 | + |
|
54 | + /** |
|
55 | + * postfix, including extension |
|
56 | + */ |
|
57 | + private $postfix = '.png'; |
|
58 | + |
|
59 | + /** |
|
60 | + * images to be assigned to template |
|
61 | + */ |
|
62 | + private $images = []; |
|
63 | + |
|
64 | + /** |
|
65 | + * Constructor |
|
66 | + */ |
|
67 | + public function __construct() |
|
68 | + { |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Access the only instance of this class |
|
73 | + * @return IconHandler |
|
74 | + */ |
|
75 | + public static function getInstance() |
|
76 | + { |
|
77 | + static $instance; |
|
78 | + if (null === $instance) { |
|
79 | + $instance = new static(); |
|
80 | + } |
|
81 | + |
|
82 | + return $instance; |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * TODO: get compatible with new theme engine |
|
87 | + * @param $type |
|
88 | + * @param string $dirname |
|
89 | + * @param string $default |
|
90 | + * @param string $endDir |
|
91 | + * @return mixed |
|
92 | + */ |
|
93 | + // START irmtfan - improve to get other "end dirnames" like "css" and "js" - change images with $endDir |
|
94 | + public function getPath($type, $dirname = 'newbb', $default = '', $endDir = 'images') |
|
95 | + { |
|
96 | + static $paths; |
|
97 | + if (isset($paths[$endDir . '/' . $type])) { |
|
98 | + return $paths[$endDir . '/' . $type]; |
|
99 | + } |
|
100 | + |
|
101 | + $theme_path = $this->template->currentTheme->path; |
|
102 | + $rel_dir = "modules/{$dirname}/{$endDir}"; |
|
103 | + // START irmtfan add default for all pathes |
|
104 | + if (empty($default)) { |
|
105 | + $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" |
|
106 | + : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}" |
|
107 | + : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}")); |
|
108 | + } else { |
|
109 | + $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : ( |
|
110 | + is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : ( |
|
111 | + is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH |
|
112 | + . "/default/{$rel_dir}/{$type}" : ( |
|
113 | + is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" |
|
114 | + : (is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") |
|
115 | + : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$default}")) // XOOPS_ROOT_PATH |
|
116 | + ) // XOOPS_THEME_PATH {$default} |
|
117 | + ) // XOOPS_THEME_PATH |
|
118 | + ); // $theme_path {$default} |
|
119 | + } |
|
120 | + // END irmtfan add default for all pathes |
|
121 | + $paths[$endDir . '/' . $type] = str_replace(XOOPS_ROOT_PATH, '', str_replace('\\', '/', $path)); |
|
122 | + |
|
123 | + return $paths[$endDir . '/' . $type]; |
|
124 | + } |
|
125 | + |
|
126 | + // END irmtfan - improve to get other "end dirnames" like "css" and "js" - change images with $endDir |
|
127 | + |
|
128 | + /** |
|
129 | + * @param string $language |
|
130 | + * @param string $dirname |
|
131 | + */ |
|
132 | + public function init(/*$set = "default", */ |
|
133 | + $language = 'english', |
|
134 | + $dirname = 'newbb' |
|
135 | + ) { |
|
136 | + $this->forumImage = require_once $GLOBALS['xoops']->path("modules/{$dirname}/include/images.php"); |
|
137 | + |
|
138 | + $this->forumImage['icon'] = XOOPS_URL . $this->getPath('icon', $dirname) . '/'; |
|
139 | + $this->forumImage['language'] = XOOPS_URL . $this->getPath("language/{$language}", $dirname, 'language/english') . '/'; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * @param $image |
|
144 | + * @param string $alt |
|
145 | + * @param string $extra |
|
146 | + */ |
|
147 | + public function setImage($image, $alt = '', $extra = '') |
|
148 | + { |
|
149 | + if (!isset($this->images[$image])) { |
|
150 | + $imageSource = $this->getImageSource($image); |
|
151 | + // irmtfan add id={$image} |
|
152 | + $this->images[$image] = "<img src=\"{$imageSource}\" alt=\"{$alt}\" title=\"{$alt}\" align=\"middle\" {$extra} id={$image} />"; |
|
153 | + } |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * TODO: How about image not exist? |
|
158 | + * @param $image |
|
159 | + * @return string |
|
160 | + */ |
|
161 | + public function getImageSource($image) |
|
162 | + { |
|
163 | + return $this->forumImage[$this->forumImage[$image]] . $this->prefix . $image . $this->postfix; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * @param $image |
|
168 | + * @param string $alt |
|
169 | + * @param string $extra |
|
170 | + * @return mixed |
|
171 | + */ |
|
172 | + public function getImage($image, $alt = '', $extra = '') |
|
173 | + { |
|
174 | + $this->setImage($image, $alt, $extra); |
|
175 | + |
|
176 | + return $this->images[$image]; |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * @param $image |
|
181 | + * @param string $alt |
|
182 | + * @param string $extra |
|
183 | + * @return string |
|
184 | + */ |
|
185 | + public function assignImage($image, $alt = '', $extra = '') |
|
186 | + { |
|
187 | + $this->setImage($image, $alt, $extra); |
|
188 | + // START hacked by irmtfan - improve function to CSS3 buttons - add alt and title attributes - use span instead of button to support IE7&8 |
|
189 | + $tag = 'span'; |
|
190 | + if ("class='forum_icon'" === $extra && in_array(substr($image, 0, 2), ['t_', 'p_', 'up'])) { |
|
191 | + $extra = "class='forum_icon forum_button'"; |
|
192 | + } |
|
193 | + |
|
194 | + return "<{$tag} alt=\"{$alt}\" title=\"{$alt}\" align=\"middle\" {$extra} id={$image}>$alt</{$tag}>"; |
|
195 | + // END hacked by irmtfan - improve function to CSS3 buttons |
|
196 | + } |
|
197 | + |
|
198 | + /** |
|
199 | + * @param $images |
|
200 | + */ |
|
201 | + public function assignImages($images) |
|
202 | + { |
|
203 | + foreach ($images as $myImage) { |
|
204 | + list($image, $alt, $extra) = $myImage; |
|
205 | + $this->assignImage($image, $alt, $extra); |
|
206 | + } |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * @return int|void |
|
211 | + */ |
|
212 | + public function render() |
|
213 | + { |
|
214 | + //$this->template->assign_by_ref("image", $this->images); |
|
215 | + $this->template->assign($this->images); |
|
216 | + |
|
217 | + return count($this->images); |
|
218 | + } |
|
219 | 219 | } |
@@ -94,23 +94,23 @@ discard block |
||
94 | 94 | public function getPath($type, $dirname = 'newbb', $default = '', $endDir = 'images') |
95 | 95 | { |
96 | 96 | static $paths; |
97 | - if (isset($paths[$endDir . '/' . $type])) { |
|
98 | - return $paths[$endDir . '/' . $type]; |
|
97 | + if (isset($paths[$endDir.'/'.$type])) { |
|
98 | + return $paths[$endDir.'/'.$type]; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $theme_path = $this->template->currentTheme->path; |
102 | 102 | $rel_dir = "modules/{$dirname}/{$endDir}"; |
103 | 103 | // START irmtfan add default for all pathes |
104 | 104 | if (empty($default)) { |
105 | - $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" |
|
106 | - : (is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}" |
|
105 | + $path = is_dir($theme_path."/{$rel_dir}/{$type}/") ? $theme_path."/{$rel_dir}/{$type}" |
|
106 | + : (is_dir(XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}" |
|
107 | 107 | : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}")); |
108 | 108 | } else { |
109 | - $path = is_dir($theme_path . "/{$rel_dir}/{$type}/") ? $theme_path . "/{$rel_dir}/{$type}" : ( |
|
110 | - is_dir($theme_path . "/{$rel_dir}/{$default}/") ? $theme_path . "/{$rel_dir}/{$default}" : ( |
|
111 | - is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH |
|
109 | + $path = is_dir($theme_path."/{$rel_dir}/{$type}/") ? $theme_path."/{$rel_dir}/{$type}" : ( |
|
110 | + is_dir($theme_path."/{$rel_dir}/{$default}/") ? $theme_path."/{$rel_dir}/{$default}" : ( |
|
111 | + is_dir(XOOPS_THEME_PATH."/default/{$rel_dir}/{$type}/") ? XOOPS_THEME_PATH |
|
112 | 112 | . "/default/{$rel_dir}/{$type}" : ( |
113 | - is_dir(XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" |
|
113 | + is_dir(XOOPS_THEME_PATH."/default/{$rel_dir}/{$default}/") ? XOOPS_THEME_PATH . "/default/{$rel_dir}/{$default}" |
|
114 | 114 | : (is_dir($GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}/")) ? $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$type}") |
115 | 115 | : $GLOBALS['xoops']->path("modules/{$dirname}/templates/{$endDir}/{$default}")) // XOOPS_ROOT_PATH |
116 | 116 | ) // XOOPS_THEME_PATH {$default} |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | ); // $theme_path {$default} |
119 | 119 | } |
120 | 120 | // END irmtfan add default for all pathes |
121 | - $paths[$endDir . '/' . $type] = str_replace(XOOPS_ROOT_PATH, '', str_replace('\\', '/', $path)); |
|
121 | + $paths[$endDir.'/'.$type] = str_replace(XOOPS_ROOT_PATH, '', str_replace('\\', '/', $path)); |
|
122 | 122 | |
123 | - return $paths[$endDir . '/' . $type]; |
|
123 | + return $paths[$endDir.'/'.$type]; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // END irmtfan - improve to get other "end dirnames" like "css" and "js" - change images with $endDir |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | ) { |
136 | 136 | $this->forumImage = require_once $GLOBALS['xoops']->path("modules/{$dirname}/include/images.php"); |
137 | 137 | |
138 | - $this->forumImage['icon'] = XOOPS_URL . $this->getPath('icon', $dirname) . '/'; |
|
139 | - $this->forumImage['language'] = XOOPS_URL . $this->getPath("language/{$language}", $dirname, 'language/english') . '/'; |
|
138 | + $this->forumImage['icon'] = XOOPS_URL.$this->getPath('icon', $dirname).'/'; |
|
139 | + $this->forumImage['language'] = XOOPS_URL.$this->getPath("language/{$language}", $dirname, 'language/english').'/'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function getImageSource($image) |
162 | 162 | { |
163 | - return $this->forumImage[$this->forumImage[$image]] . $this->prefix . $image . $this->postfix; |
|
163 | + return $this->forumImage[$this->forumImage[$image]].$this->prefix.$image.$this->postfix; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -19,19 +19,19 @@ |
||
19 | 19 | */ |
20 | 20 | class Report extends \XoopsObject |
21 | 21 | { |
22 | - /** |
|
23 | - * |
|
24 | - */ |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - parent::__construct(); |
|
28 | - $this->initVar('report_id', XOBJ_DTYPE_INT); |
|
29 | - $this->initVar('post_id', XOBJ_DTYPE_INT); |
|
30 | - $this->initVar('reporter_uid', XOBJ_DTYPE_INT); |
|
31 | - $this->initVar('reporter_ip', XOBJ_DTYPE_TXTBOX); |
|
32 | - $this->initVar('report_time', XOBJ_DTYPE_INT); |
|
33 | - $this->initVar('report_text', XOBJ_DTYPE_TXTBOX); |
|
34 | - $this->initVar('report_result', XOBJ_DTYPE_INT); |
|
35 | - $this->initVar('report_memo', XOBJ_DTYPE_TXTBOX); |
|
36 | - } |
|
22 | + /** |
|
23 | + * |
|
24 | + */ |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + parent::__construct(); |
|
28 | + $this->initVar('report_id', XOBJ_DTYPE_INT); |
|
29 | + $this->initVar('post_id', XOBJ_DTYPE_INT); |
|
30 | + $this->initVar('reporter_uid', XOBJ_DTYPE_INT); |
|
31 | + $this->initVar('reporter_ip', XOBJ_DTYPE_TXTBOX); |
|
32 | + $this->initVar('report_time', XOBJ_DTYPE_INT); |
|
33 | + $this->initVar('report_text', XOBJ_DTYPE_TXTBOX); |
|
34 | + $this->initVar('report_result', XOBJ_DTYPE_INT); |
|
35 | + $this->initVar('report_memo', XOBJ_DTYPE_TXTBOX); |
|
36 | + } |
|
37 | 37 | } |
@@ -37,119 +37,119 @@ |
||
37 | 37 | //$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
38 | 38 | $topicObject = $topicHandler->get($topic_id); |
39 | 39 | if (!$topicHandler->getPermission($topicObject->getVar('forum_id'), $topicObject->getVar('topic_status'), 'vote')) { |
40 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _NOPERM); |
|
40 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _NOPERM); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!Request::getInt('option_id', 0, 'POST')) { |
44 | - // irmtfan - add error message - simple url |
|
45 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_NOOPTION); |
|
44 | + // irmtfan - add error message - simple url |
|
45 | + redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_NOOPTION); |
|
46 | 46 | } |
47 | 47 | // poll module |
48 | 48 | $pollModuleHandler = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']); |
49 | 49 | if (is_object($pollModuleHandler) && $pollModuleHandler->getVar('isactive')) { |
50 | - // new xoopspoll module |
|
51 | - if ($pollModuleHandler->getVar('version') >= 140) { |
|
52 | - xoops_load('constants', $GLOBALS['xoopsModuleConfig']['poll_module']); |
|
53 | - xoops_loadLanguage('main', $GLOBALS['xoopsModuleConfig']['poll_module']); |
|
50 | + // new xoopspoll module |
|
51 | + if ($pollModuleHandler->getVar('version') >= 140) { |
|
52 | + xoops_load('constants', $GLOBALS['xoopsModuleConfig']['poll_module']); |
|
53 | + xoops_loadLanguage('main', $GLOBALS['xoopsModuleConfig']['poll_module']); |
|
54 | 54 | |
55 | - /** @var Xoopspoll\PollHandler $xpPollHandler */ |
|
56 | - $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
|
57 | - /** @var Xoopspoll\LogHandler $xpLogHandler */ |
|
58 | - $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
59 | - /** @var Xoopspoll\Poll $pollObject */ |
|
60 | - $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist |
|
61 | - // old xoopspoll or umfrage or any clone from them |
|
62 | - } else { |
|
63 | - require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); |
|
64 | - $classPoll = $topicObject->loadOldPoll(); |
|
65 | - $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist |
|
66 | - } |
|
55 | + /** @var Xoopspoll\PollHandler $xpPollHandler */ |
|
56 | + $xpPollHandler = Xoopspoll\Helper::getInstance()->getHandler('Poll'); |
|
57 | + /** @var Xoopspoll\LogHandler $xpLogHandler */ |
|
58 | + $xpLogHandler = Xoopspoll\Helper::getInstance()->getHandler('Log'); |
|
59 | + /** @var Xoopspoll\Poll $pollObject */ |
|
60 | + $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist |
|
61 | + // old xoopspoll or umfrage or any clone from them |
|
62 | + } else { |
|
63 | + require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); |
|
64 | + $classPoll = $topicObject->loadOldPoll(); |
|
65 | + $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist |
|
66 | + } |
|
67 | 67 | } else { |
68 | - redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_POLLMODULE_ERROR); |
|
68 | + redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 2, _MD_NEWBB_POLLMODULE_ERROR); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $mail_author = false; |
72 | 72 | // new xoopspoll module |
73 | 73 | if ($pollModuleHandler->getVar('version') >= 140) { |
74 | - $classConstants = Xoopspoll\Constants(); |
|
75 | - if (is_object($pollObject)) { |
|
76 | - if ($pollObject->getVar('multiple')) { |
|
77 | - $optionId = Request::getInt('option_id', 0, 'POST'); |
|
78 | - $optionId = (array)$optionId; // type cast to make sure it's an array |
|
79 | - $optionId = array_map('intval', $optionId); // make sure values are integers |
|
80 | - } else { |
|
81 | - $optionId = Request::getInt('option_id', 0, 'POST'); |
|
82 | - } |
|
83 | - if (!$pollObject->hasExpired()) { |
|
84 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_MUSTLOGIN'); |
|
85 | - //@todo:: add $url to all redirects |
|
86 | - // $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id)); |
|
87 | - if ($pollObject->isAllowedToVote()) { |
|
88 | - $thisVoter = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : null; |
|
89 | - $votedThisPoll = $xpLogHandler->hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $thisVoter); |
|
90 | - if (!$votedThisPoll) { |
|
91 | - /* user that hasn't voted before in this poll or module preferences allow it */ |
|
92 | - $voteTime = time(); |
|
93 | - if ($pollObject->vote($optionId, xoops_getenv('REMOTE_ADDR'), $voteTime)) { |
|
94 | - if (!$xpPollHandler->updateCount($pollObject)) { // update the count and save in db |
|
95 | - echo $pollObject->getHtmlErrors(); |
|
96 | - exit(); |
|
97 | - } |
|
98 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_THANKSFORVOTE'); |
|
99 | - } else { |
|
100 | - /* there was a problem registering the vote */ |
|
101 | - redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), $classConstants::REDIRECT_DELAY_MEDIUM, constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE_ERROR')); |
|
102 | - } |
|
103 | - } else { |
|
104 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ALREADYVOTED'); |
|
105 | - } |
|
106 | - /* set anon user vote (and the time they voted) */ |
|
107 | - if (!is_object($GLOBALS['xoopsUser'])) { |
|
108 | - xoops_load('pollUtility', $GLOBALS['xoopsModuleConfig']['poll_module']); |
|
109 | - /** @var Xoopspoll\Utility $classPollUtility */ |
|
110 | - $classPollUtility = new Xoopspoll\Utility(); |
|
111 | - $classPollUtility::setVoteCookie($poll_id, $voteTime, 0); |
|
112 | - } |
|
113 | - } else { |
|
114 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_CANNOTVOTE'); |
|
115 | - } |
|
116 | - } else { |
|
117 | - /* poll has expired so just show the results */ |
|
118 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . 'SORRYEXPIRED'); |
|
119 | - } |
|
120 | - } else { |
|
121 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ERROR_INVALID_POLLID'); |
|
122 | - } |
|
123 | - if (null !== $url) { |
|
124 | - redirect_header($url, $classConstants::REDIRECT_DELAY_MEDIUM, $msg); |
|
125 | - } else { |
|
126 | - redirect_header($GLOBALS['xoops']->buildUrl('viewtopic.php', ['topic_id' => $topic_id]), $classConstants::REDIRECT_DELAY_MEDIUM, $msg); |
|
127 | - } |
|
128 | - // old xoopspoll or umfrage or any clone from them |
|
74 | + $classConstants = Xoopspoll\Constants(); |
|
75 | + if (is_object($pollObject)) { |
|
76 | + if ($pollObject->getVar('multiple')) { |
|
77 | + $optionId = Request::getInt('option_id', 0, 'POST'); |
|
78 | + $optionId = (array)$optionId; // type cast to make sure it's an array |
|
79 | + $optionId = array_map('intval', $optionId); // make sure values are integers |
|
80 | + } else { |
|
81 | + $optionId = Request::getInt('option_id', 0, 'POST'); |
|
82 | + } |
|
83 | + if (!$pollObject->hasExpired()) { |
|
84 | + $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_MUSTLOGIN'); |
|
85 | + //@todo:: add $url to all redirects |
|
86 | + // $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id)); |
|
87 | + if ($pollObject->isAllowedToVote()) { |
|
88 | + $thisVoter = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : null; |
|
89 | + $votedThisPoll = $xpLogHandler->hasVoted($poll_id, xoops_getenv('REMOTE_ADDR'), $thisVoter); |
|
90 | + if (!$votedThisPoll) { |
|
91 | + /* user that hasn't voted before in this poll or module preferences allow it */ |
|
92 | + $voteTime = time(); |
|
93 | + if ($pollObject->vote($optionId, xoops_getenv('REMOTE_ADDR'), $voteTime)) { |
|
94 | + if (!$xpPollHandler->updateCount($pollObject)) { // update the count and save in db |
|
95 | + echo $pollObject->getHtmlErrors(); |
|
96 | + exit(); |
|
97 | + } |
|
98 | + $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_THANKSFORVOTE'); |
|
99 | + } else { |
|
100 | + /* there was a problem registering the vote */ |
|
101 | + redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), $classConstants::REDIRECT_DELAY_MEDIUM, constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE_ERROR')); |
|
102 | + } |
|
103 | + } else { |
|
104 | + $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ALREADYVOTED'); |
|
105 | + } |
|
106 | + /* set anon user vote (and the time they voted) */ |
|
107 | + if (!is_object($GLOBALS['xoopsUser'])) { |
|
108 | + xoops_load('pollUtility', $GLOBALS['xoopsModuleConfig']['poll_module']); |
|
109 | + /** @var Xoopspoll\Utility $classPollUtility */ |
|
110 | + $classPollUtility = new Xoopspoll\Utility(); |
|
111 | + $classPollUtility::setVoteCookie($poll_id, $voteTime, 0); |
|
112 | + } |
|
113 | + } else { |
|
114 | + $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_CANNOTVOTE'); |
|
115 | + } |
|
116 | + } else { |
|
117 | + /* poll has expired so just show the results */ |
|
118 | + $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . 'SORRYEXPIRED'); |
|
119 | + } |
|
120 | + } else { |
|
121 | + $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ERROR_INVALID_POLLID'); |
|
122 | + } |
|
123 | + if (null !== $url) { |
|
124 | + redirect_header($url, $classConstants::REDIRECT_DELAY_MEDIUM, $msg); |
|
125 | + } else { |
|
126 | + redirect_header($GLOBALS['xoops']->buildUrl('viewtopic.php', ['topic_id' => $topic_id]), $classConstants::REDIRECT_DELAY_MEDIUM, $msg); |
|
127 | + } |
|
128 | + // old xoopspoll or umfrage or any clone from them |
|
129 | 129 | } else { |
130 | - $classLog = $classPoll . 'Log'; |
|
131 | - if (is_object($GLOBALS['xoopsUser'])) { |
|
132 | - if ($classLog::hasVoted($poll_id, Request::getString('REMOTE_ADDR', '', 'SERVER'), $GLOBALS['xoopsUser']->getVar('uid'))) { |
|
133 | - $msg = _PL_ALREADYVOTED; |
|
134 | - setcookie("newbb_polls[{$poll_id}]", 1); |
|
135 | - } else { |
|
136 | - // irmtfan save ip to db |
|
137 | - $pollObject->vote(Request::getInt('option_id', 0, 'POST'), Request::getString('REMOTE_ADDR', '', 'SERVER'), $GLOBALS['xoopsUser']->getVar('uid')); |
|
138 | - $pollObject->updateCount(); |
|
139 | - $msg = _PL_THANKSFORVOTE; |
|
140 | - setcookie("newbb_polls[{$poll_id}]", 1); |
|
141 | - } |
|
142 | - } else { |
|
143 | - if ($classLog::hasVoted($poll_id, Request::getString('REMOTE_ADDR', '', 'SERVER'))) { |
|
144 | - $msg = _PL_ALREADYVOTED; |
|
145 | - setcookie("newbb_polls[{$poll_id}]", 1); |
|
146 | - } else { |
|
147 | - $pollObject->vote(Request::getInt('option_id', 0, 'POST'), Request::getString('REMOTE_ADDR', '', 'SERVER')); |
|
148 | - $pollObject->updateCount(); |
|
149 | - $msg = _PL_THANKSFORVOTE; |
|
150 | - setcookie("newbb_polls[{$poll_id}]", 1); |
|
151 | - } |
|
152 | - } |
|
130 | + $classLog = $classPoll . 'Log'; |
|
131 | + if (is_object($GLOBALS['xoopsUser'])) { |
|
132 | + if ($classLog::hasVoted($poll_id, Request::getString('REMOTE_ADDR', '', 'SERVER'), $GLOBALS['xoopsUser']->getVar('uid'))) { |
|
133 | + $msg = _PL_ALREADYVOTED; |
|
134 | + setcookie("newbb_polls[{$poll_id}]", 1); |
|
135 | + } else { |
|
136 | + // irmtfan save ip to db |
|
137 | + $pollObject->vote(Request::getInt('option_id', 0, 'POST'), Request::getString('REMOTE_ADDR', '', 'SERVER'), $GLOBALS['xoopsUser']->getVar('uid')); |
|
138 | + $pollObject->updateCount(); |
|
139 | + $msg = _PL_THANKSFORVOTE; |
|
140 | + setcookie("newbb_polls[{$poll_id}]", 1); |
|
141 | + } |
|
142 | + } else { |
|
143 | + if ($classLog::hasVoted($poll_id, Request::getString('REMOTE_ADDR', '', 'SERVER'))) { |
|
144 | + $msg = _PL_ALREADYVOTED; |
|
145 | + setcookie("newbb_polls[{$poll_id}]", 1); |
|
146 | + } else { |
|
147 | + $pollObject->vote(Request::getInt('option_id', 0, 'POST'), Request::getString('REMOTE_ADDR', '', 'SERVER')); |
|
148 | + $pollObject->updateCount(); |
|
149 | + $msg = _PL_THANKSFORVOTE; |
|
150 | + setcookie("newbb_polls[{$poll_id}]", 1); |
|
151 | + } |
|
152 | + } |
|
153 | 153 | } |
154 | 154 | // irmtfan - simple url |
155 | 155 | redirect_header("viewtopic.php?topic_id={$topic_id}", 1, $msg); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | use Xmf\Request; |
29 | 29 | use XoopsModules\Xoopspoll; |
30 | 30 | |
31 | -require_once __DIR__ . '/header.php'; |
|
31 | +require_once __DIR__.'/header.php'; |
|
32 | 32 | $poll_id = Request::getInt('poll_id', Request::getInt('poll_id', 0, 'POST'), 'GET'); |
33 | 33 | $topic_id = Request::getInt('topic_id', Request::getInt('topic_id', 0, 'POST'), 'GET'); |
34 | 34 | $forum = Request::getInt('forum', Request::getInt('forum', 0, 'POST'), 'GET'); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | if (!Request::getInt('option_id', 0, 'POST')) { |
44 | 44 | // irmtfan - add error message - simple url |
45 | - redirect_header(XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_NOOPTION); |
|
45 | + redirect_header(XOOPS_URL."/modules/newbb/viewtopic.php?topic_id={$topic_id}", 1, _MD_NEWBB_POLL_NOOPTION); |
|
46 | 46 | } |
47 | 47 | // poll module |
48 | 48 | $pollModuleHandler = $moduleHandler->getByDirname($GLOBALS['xoopsModuleConfig']['poll_module']); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $pollObject = $xpPollHandler->get($poll_id); // will create poll if poll_id = 0 exist |
61 | 61 | // old xoopspoll or umfrage or any clone from them |
62 | 62 | } else { |
63 | - require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModuleConfig']['poll_module'] . '/include/constants.php'); |
|
63 | + require_once $GLOBALS['xoops']->path('modules/'.$GLOBALS['xoopsModuleConfig']['poll_module'].'/include/constants.php'); |
|
64 | 64 | $classPoll = $topicObject->loadOldPoll(); |
65 | 65 | $pollObject = new $classPoll($poll_id); // will create poll if poll_id = 0 exist |
66 | 66 | } |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | if (is_object($pollObject)) { |
76 | 76 | if ($pollObject->getVar('multiple')) { |
77 | 77 | $optionId = Request::getInt('option_id', 0, 'POST'); |
78 | - $optionId = (array)$optionId; // type cast to make sure it's an array |
|
78 | + $optionId = (array) $optionId; // type cast to make sure it's an array |
|
79 | 79 | $optionId = array_map('intval', $optionId); // make sure values are integers |
80 | 80 | } else { |
81 | 81 | $optionId = Request::getInt('option_id', 0, 'POST'); |
82 | 82 | } |
83 | 83 | if (!$pollObject->hasExpired()) { |
84 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_MUSTLOGIN'); |
|
84 | + $msg = constant('_MD_'.strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']).'_MUSTLOGIN'); |
|
85 | 85 | //@todo:: add $url to all redirects |
86 | 86 | // $url = $GLOBALS['xoops']->buildUrl("index.php", array('poll_id' => $poll_id)); |
87 | 87 | if ($pollObject->isAllowedToVote()) { |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | echo $pollObject->getHtmlErrors(); |
96 | 96 | exit(); |
97 | 97 | } |
98 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_THANKSFORVOTE'); |
|
98 | + $msg = constant('_MD_'.strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']).'_THANKSFORVOTE'); |
|
99 | 99 | } else { |
100 | 100 | /* there was a problem registering the vote */ |
101 | - redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), $classConstants::REDIRECT_DELAY_MEDIUM, constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_VOTE_ERROR')); |
|
101 | + redirect_header($GLOBALS['xoops']->buildUrl('index.php', ['poll_id' => $poll_id]), $classConstants::REDIRECT_DELAY_MEDIUM, constant('_MD_'.strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']).'_VOTE_ERROR')); |
|
102 | 102 | } |
103 | 103 | } else { |
104 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ALREADYVOTED'); |
|
104 | + $msg = constant('_MD_'.strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']).'_ALREADYVOTED'); |
|
105 | 105 | } |
106 | 106 | /* set anon user vote (and the time they voted) */ |
107 | 107 | if (!is_object($GLOBALS['xoopsUser'])) { |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | $classPollUtility::setVoteCookie($poll_id, $voteTime, 0); |
112 | 112 | } |
113 | 113 | } else { |
114 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_CANNOTVOTE'); |
|
114 | + $msg = constant('_MD_'.strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']).'_CANNOTVOTE'); |
|
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | /* poll has expired so just show the results */ |
118 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . 'SORRYEXPIRED'); |
|
118 | + $msg = constant('_MD_'.strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']).'SORRYEXPIRED'); |
|
119 | 119 | } |
120 | 120 | } else { |
121 | - $msg = constant('_MD_' . strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']) . '_ERROR_INVALID_POLLID'); |
|
121 | + $msg = constant('_MD_'.strtoupper($GLOBALS['xoopsModuleConfig']['poll_module']).'_ERROR_INVALID_POLLID'); |
|
122 | 122 | } |
123 | 123 | if (null !== $url) { |
124 | 124 | redirect_header($url, $classConstants::REDIRECT_DELAY_MEDIUM, $msg); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | // old xoopspoll or umfrage or any clone from them |
129 | 129 | } else { |
130 | - $classLog = $classPoll . 'Log'; |
|
130 | + $classLog = $classPoll.'Log'; |
|
131 | 131 | if (is_object($GLOBALS['xoopsUser'])) { |
132 | 132 | if ($classLog::hasVoted($poll_id, Request::getString('REMOTE_ADDR', '', 'SERVER'), $GLOBALS['xoopsUser']->getVar('uid'))) { |
133 | 133 | $msg = _PL_ALREADYVOTED; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | require_once __DIR__ . '/header.php'; |
15 | 15 | |
16 | 16 | if (!Request::getInt('forum', 0, 'GET')) { |
17 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
17 | + redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
18 | 18 | } |
19 | 19 | require_once __DIR__ . '/include/functions.read.php'; |
20 | 20 | |
@@ -24,54 +24,54 @@ discard block |
||
24 | 24 | $query_vars = ['forum', 'type', 'status', 'sort', 'order', 'start', 'since']; |
25 | 25 | $query_array = []; |
26 | 26 | foreach ($query_vars as $var) { |
27 | - if (Request::getString($var, '', 'GET')) { |
|
28 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
29 | - } |
|
27 | + if (Request::getString($var, '', 'GET')) { |
|
28 | + $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | $page_query = implode('&', array_values($query_array)); |
32 | 32 | |
33 | 33 | if (Request::getInt('mark', 0, 'GET')) { |
34 | - if (1 === Request::getInt('mark', 0, 'GET')) { // marked as read |
|
35 | - $markvalue = 1; |
|
36 | - $markresult = _MD_NEWBB_MARK_READ; |
|
37 | - } else { // marked as unread |
|
38 | - $markvalue = 0; |
|
39 | - $markresult = _MD_NEWBB_MARK_UNREAD; |
|
40 | - } |
|
41 | - newbbSetReadTopic($markvalue, Request::getInt('forum', 0, 'GET')); |
|
42 | - $url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?' . $page_query; |
|
43 | - redirect_header($url, 2, _MD_NEWBB_ALL_TOPIC_MARKED . ' ' . $markresult); |
|
34 | + if (1 === Request::getInt('mark', 0, 'GET')) { // marked as read |
|
35 | + $markvalue = 1; |
|
36 | + $markresult = _MD_NEWBB_MARK_READ; |
|
37 | + } else { // marked as unread |
|
38 | + $markvalue = 0; |
|
39 | + $markresult = _MD_NEWBB_MARK_UNREAD; |
|
40 | + } |
|
41 | + newbbSetReadTopic($markvalue, Request::getInt('forum', 0, 'GET')); |
|
42 | + $url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?' . $page_query; |
|
43 | + redirect_header($url, 2, _MD_NEWBB_ALL_TOPIC_MARKED . ' ' . $markresult); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $forum_id = Request::getInt('forum', 0, 'GET'); |
47 | 47 | $type = Request::getInt('type', 0, 'GET'); |
48 | 48 | $status = (Request::getString('status', '', 'GET') |
49 | - && in_array(Request::getString('status', '', 'GET'), [ |
|
50 | - 'active', |
|
51 | - 'pending', |
|
52 | - 'deleted', |
|
53 | - 'digest', |
|
54 | - 'unreplied', |
|
55 | - 'unread' |
|
56 | - ], true)) ? Request::getString('status', '', 'GET') : ''; |
|
49 | + && in_array(Request::getString('status', '', 'GET'), [ |
|
50 | + 'active', |
|
51 | + 'pending', |
|
52 | + 'deleted', |
|
53 | + 'digest', |
|
54 | + 'unreplied', |
|
55 | + 'unread' |
|
56 | + ], true)) ? Request::getString('status', '', 'GET') : ''; |
|
57 | 57 | |
58 | 58 | $mode = (Request::getString('status', '', 'GET') |
59 | - && in_array(Request::getString('status', '', 'GET'), [ |
|
60 | - 'active', |
|
61 | - 'pending', |
|
62 | - 'deleted' |
|
63 | - ], true)) ? 2 : Request::getInt('mode', 0, 'GET'); |
|
59 | + && in_array(Request::getString('status', '', 'GET'), [ |
|
60 | + 'active', |
|
61 | + 'pending', |
|
62 | + 'deleted' |
|
63 | + ], true)) ? 2 : Request::getInt('mode', 0, 'GET'); |
|
64 | 64 | |
65 | 65 | ///** @var Newbb\ForumHandler $forumHandler */ |
66 | 66 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
67 | 67 | $forumObject = $forumHandler->get($forum_id); |
68 | 68 | |
69 | 69 | if (!$forumObject) { |
70 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
70 | + redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if (!$forumHandler->getPermission($forumObject)) { |
74 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _NOPERM); |
|
74 | + redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _NOPERM); |
|
75 | 75 | } |
76 | 76 | newbbSetRead('forum', $forum_id, $forumObject->getVar('forum_last_post_id')); |
77 | 77 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | require_once __DIR__ . '/include/functions.render.php'; |
85 | 85 | |
86 | 86 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
87 | - $xoopsTpl->assign('xoops_module_header', ' |
|
87 | + $xoopsTpl->assign('xoops_module_header', ' |
|
88 | 88 | <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '-' . $forumObject->getVar('forum_name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php?f=' . $forum_id . '" /> |
89 | 89 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
90 | 90 | } |
@@ -99,41 +99,41 @@ discard block |
||
99 | 99 | $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 0); |
100 | 100 | /* Only admin has access to admin mode */ |
101 | 101 | if (!$isAdmin) { |
102 | - $status = (!empty($status) && in_array($status, ['active', 'pending', 'deleted'], true)) ? '' : $status; |
|
103 | - // irmtfan add mode |
|
104 | - $mode = 0; |
|
102 | + $status = (!empty($status) && in_array($status, ['active', 'pending', 'deleted'], true)) ? '' : $status; |
|
103 | + // irmtfan add mode |
|
104 | + $mode = 0; |
|
105 | 105 | } |
106 | 106 | // irmtfan add mode |
107 | 107 | $xoopsTpl->assign('mode', $mode); |
108 | 108 | $xoopsTpl->assign('status', $status); |
109 | 109 | if ($isAdmin) { |
110 | - $xoopsTpl->assign('forum_index_cpanel', ['link' => 'admin/index.php', 'name' => _MD_NEWBB_ADMINCP]); |
|
110 | + $xoopsTpl->assign('forum_index_cpanel', ['link' => 'admin/index.php', 'name' => _MD_NEWBB_ADMINCP]); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if ($GLOBALS['xoopsModuleConfig']['wol_enabled']) { |
114 | - // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
115 | - // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
116 | - $onlineHandler->init($forumObject); |
|
117 | - $xoopsTpl->assign('online', $onlineHandler->showOnline()); |
|
114 | + // /** @var Newbb\OnlineHandler $onlineHandler */ |
|
115 | + // $onlineHandler = Newbb\Helper::getInstance()->getHandler('Online'); |
|
116 | + $onlineHandler->init($forumObject); |
|
117 | + $xoopsTpl->assign('online', $onlineHandler->showOnline()); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | if ($forumHandler->getPermission($forumObject, 'post')) { |
121 | - $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 1); |
|
122 | - $xoopsTpl->assign('forum_post_or_register', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/newtopic.php?forum={$forum_id}\">" . newbbDisplayImage('t_new', _MD_NEWBB_POSTNEW) . '</a>'); |
|
123 | - if ($pollmodules && $forumHandler->getPermission($forumObject, 'addpoll')) { |
|
124 | - $t_poll = newbbDisplayImage('t_poll', _MD_NEWBB_ADDPOLL); |
|
125 | - $xoopsTpl->assign('forum_addpoll', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=add&forum={$forum_id}\">{$t_poll}</a>"); |
|
126 | - } |
|
121 | + $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 1); |
|
122 | + $xoopsTpl->assign('forum_post_or_register', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/newtopic.php?forum={$forum_id}\">" . newbbDisplayImage('t_new', _MD_NEWBB_POSTNEW) . '</a>'); |
|
123 | + if ($pollmodules && $forumHandler->getPermission($forumObject, 'addpoll')) { |
|
124 | + $t_poll = newbbDisplayImage('t_poll', _MD_NEWBB_ADDPOLL); |
|
125 | + $xoopsTpl->assign('forum_addpoll', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=add&forum={$forum_id}\">{$t_poll}</a>"); |
|
126 | + } |
|
127 | 127 | } else { |
128 | - $xoopsTpl->assign('viewer_level', 0); |
|
129 | - if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { |
|
130 | - $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=" . $forum_id, htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5)); |
|
131 | - $xoopsTpl->assign('forum_post_or_register', "<a href='" . XOOPS_URL . "/user.php?xoops_redirect={$redirect}'>" . _MD_NEWBB_REGTOPOST . '</a>'); |
|
132 | - $xoopsTpl->assign('forum_addpoll', ''); |
|
133 | - } else { |
|
134 | - $xoopsTpl->assign('forum_post_or_register', ''); |
|
135 | - $xoopsTpl->assign('forum_addpoll', ''); |
|
136 | - } |
|
128 | + $xoopsTpl->assign('viewer_level', 0); |
|
129 | + if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { |
|
130 | + $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=" . $forum_id, htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5)); |
|
131 | + $xoopsTpl->assign('forum_post_or_register', "<a href='" . XOOPS_URL . "/user.php?xoops_redirect={$redirect}'>" . _MD_NEWBB_REGTOPOST . '</a>'); |
|
132 | + $xoopsTpl->assign('forum_addpoll', ''); |
|
133 | + } else { |
|
134 | + $xoopsTpl->assign('forum_post_or_register', ''); |
|
135 | + $xoopsTpl->assign('forum_addpoll', ''); |
|
136 | + } |
|
137 | 137 | } |
138 | 138 | $parentforum = $forumHandler->getParents($forumObject); |
139 | 139 | $xoopsTpl->assign_by_ref('parentforum', $parentforum); |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | $criteria->setSort('forum_order'); |
144 | 144 | |
145 | 145 | if ($forums = $forumHandler->getAll($criteria, null, false)) { |
146 | - $subforum_array = $forumHandler->display($forums, $GLOBALS['xoopsModuleConfig']['length_title_index'], $GLOBALS['xoopsModuleConfig']['count_subforum']); |
|
147 | - $subforum = array_values($subforum_array[$forum_id]); |
|
148 | - unset($subforum_array); |
|
149 | - $xoopsTpl->assign_by_ref('subforum', $subforum); |
|
146 | + $subforum_array = $forumHandler->display($forums, $GLOBALS['xoopsModuleConfig']['length_title_index'], $GLOBALS['xoopsModuleConfig']['count_subforum']); |
|
147 | + $subforum = array_values($subforum_array[$forum_id]); |
|
148 | + unset($subforum_array); |
|
149 | + $xoopsTpl->assign_by_ref('subforum', $subforum); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | //$categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
@@ -159,30 +159,30 @@ discard block |
||
159 | 159 | |
160 | 160 | // irmtfan - add and edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | "t.rating"=>_MD_NEWBB_RATINGS, | p.post_time => t.topic_last_post_id |
161 | 161 | $sel_sort_array = [ |
162 | - 't.topic_title' => _MD_NEWBB_TOPICTITLE, |
|
163 | - 't.topic_poster' => _MD_NEWBB_TOPICPOSTER, |
|
164 | - 't.topic_id' => _MD_NEWBB_TOPICTIME, |
|
165 | - 't.topic_replies' => _MD_NEWBB_NUMBERREPLIES, |
|
166 | - 't.topic_views' => _MD_NEWBB_VIEWS, |
|
167 | - 't.rating' => _MD_NEWBB_RATINGS, |
|
168 | - 't.topic_last_post_id' => _MD_NEWBB_LASTPOSTTIME |
|
162 | + 't.topic_title' => _MD_NEWBB_TOPICTITLE, |
|
163 | + 't.topic_poster' => _MD_NEWBB_TOPICPOSTER, |
|
164 | + 't.topic_id' => _MD_NEWBB_TOPICTIME, |
|
165 | + 't.topic_replies' => _MD_NEWBB_NUMBERREPLIES, |
|
166 | + 't.topic_views' => _MD_NEWBB_VIEWS, |
|
167 | + 't.rating' => _MD_NEWBB_RATINGS, |
|
168 | + 't.topic_last_post_id' => _MD_NEWBB_LASTPOSTTIME |
|
169 | 169 | ]; |
170 | 170 | if (!Request::getString('sort', '', 'GET') || !array_key_exists(Request::getString('sort', '', 'GET'), $sel_sort_array)) { |
171 | - $sort = 't.topic_last_post_id'; |
|
171 | + $sort = 't.topic_last_post_id'; |
|
172 | 172 | } else { |
173 | - $sort = Request::getString('sort', '', 'GET'); |
|
173 | + $sort = Request::getString('sort', '', 'GET'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | $forum_selection_sort = '<select name="sort">'; |
177 | 177 | foreach ($sel_sort_array as $sort_k => $sort_v) { |
178 | - $forum_selection_sort .= '<option value="' . $sort_k . '"' . (($sort == $sort_k) ? ' selected="selected"' : '') . '>' . $sort_v . '</option>'; |
|
178 | + $forum_selection_sort .= '<option value="' . $sort_k . '"' . (($sort == $sort_k) ? ' selected="selected"' : '') . '>' . $sort_v . '</option>'; |
|
179 | 179 | } |
180 | 180 | $forum_selection_sort .= '</select>'; |
181 | 181 | |
182 | 182 | $xoopsTpl->assign_by_ref('forum_selection_sort', $forum_selection_sort); |
183 | 183 | |
184 | 184 | $order = (!Request::getString('order', '', 'GET') |
185 | - || 'ASC' !== Request::getString('order', '', 'GET')) ? 'DESC' : 'ASC'; |
|
185 | + || 'ASC' !== Request::getString('order', '', 'GET')) ? 'DESC' : 'ASC'; |
|
186 | 186 | $forum_selection_order = '<select name="order">'; |
187 | 187 | $forum_selection_order .= '<option value="ASC"' . (('ASC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_ASCENDING . '</option>'; |
188 | 188 | $forum_selection_order .= '<option value="DESC"' . (('DESC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_DESCENDING . '</option>'; |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | $xoopsTpl->assign('h_poster_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=" . (('t.topic_poster' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
206 | 206 | $xoopsTpl->assign('h_views_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=" . (('t.topic_views' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
207 | 207 | $xoopsTpl->assign('h_rating_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=" . (('t.rating' === $sort |
208 | - && 'DESC' === $order) ? 'ASC' : 'DESC')); // irmtfan t.topic_ratings to t.rating |
|
208 | + && 'DESC' === $order) ? 'ASC' : 'DESC')); // irmtfan t.topic_ratings to t.rating |
|
209 | 209 | $xoopsTpl->assign('h_date_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=" . (('t.topic_last_post_id' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
210 | 210 | $xoopsTpl->assign('h_publish_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=" . (('t.topic_id' === $sort |
211 | - && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
211 | + && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
212 | 212 | $xoopsTpl->assign('forum_since', $since); // For $since in search.php |
213 | 213 | |
214 | 214 | // irmtfan - if no since it should be 0 |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | $criteria_vars = ['startdate', 'start', 'sort', 'order', 'type', 'status', 'excerpt']; |
220 | 220 | foreach ($criteria_vars as $var) { |
221 | - $criteria_topic[$var] = @${$var}; |
|
221 | + $criteria_topic[$var] = @${$var}; |
|
222 | 222 | } |
223 | 223 | $criteria_topic['excerpt'] = $GLOBALS['xoopsModuleConfig']['post_excerpt']; |
224 | 224 | |
@@ -252,17 +252,17 @@ discard block |
||
252 | 252 | $typeOptions = null; |
253 | 253 | $types = []; |
254 | 254 | if ($types = $typeHandler->getByForum($forum_id)) { |
255 | - $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}"]; |
|
256 | - foreach ($types as $key => $item) { |
|
257 | - $typeOptions[] = [ |
|
258 | - 'title' => $item['type_name'], |
|
259 | - 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" |
|
260 | - ]; |
|
261 | - } |
|
255 | + $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}"]; |
|
256 | + foreach ($types as $key => $item) { |
|
257 | + $typeOptions[] = [ |
|
258 | + 'title' => $item['type_name'], |
|
259 | + 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" |
|
260 | + ]; |
|
261 | + } |
|
262 | 262 | } |
263 | 263 | if ($type > 0) { |
264 | - require_once __DIR__ . '/include/functions.topic.php'; |
|
265 | - $xoopsTpl->assign('forum_topictype', getTopicTitle('', $types[$type]['type_name'], $types[$type]['type_color'])); |
|
264 | + require_once __DIR__ . '/include/functions.topic.php'; |
|
265 | + $xoopsTpl->assign('forum_topictype', getTopicTitle('', $types[$type]['type_name'], $types[$type]['type_color'])); |
|
266 | 266 | } |
267 | 267 | $xoopsTpl->assign_by_ref('typeOptions', $typeOptions); |
268 | 268 | |
@@ -276,66 +276,66 @@ discard block |
||
276 | 276 | $xoopsTpl->assign('unreplied_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unreplied"); |
277 | 277 | $xoopsTpl->assign('unread_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unread"); |
278 | 278 | switch ($status) { |
279 | - case 'digest': |
|
280 | - $current_status = _MD_NEWBB_DIGEST; |
|
281 | - break; |
|
282 | - case 'unreplied': |
|
283 | - $current_status = _MD_NEWBB_UNREPLIED; |
|
284 | - break; |
|
285 | - case 'unread': |
|
286 | - $current_status = _MD_NEWBB_UNREAD; |
|
287 | - break; |
|
288 | - case 'active': |
|
289 | - $current_status = _MD_NEWBB_TYPE_ADMIN; |
|
290 | - break; |
|
291 | - case 'pending': |
|
292 | - $current_status = _MD_NEWBB_TYPE_PENDING; |
|
293 | - break; |
|
294 | - case 'deleted': |
|
295 | - $current_status = _MD_NEWBB_TYPE_DELETED; |
|
296 | - break; |
|
297 | - default: |
|
298 | - $current_status = ''; |
|
299 | - break; |
|
279 | + case 'digest': |
|
280 | + $current_status = _MD_NEWBB_DIGEST; |
|
281 | + break; |
|
282 | + case 'unreplied': |
|
283 | + $current_status = _MD_NEWBB_UNREPLIED; |
|
284 | + break; |
|
285 | + case 'unread': |
|
286 | + $current_status = _MD_NEWBB_UNREAD; |
|
287 | + break; |
|
288 | + case 'active': |
|
289 | + $current_status = _MD_NEWBB_TYPE_ADMIN; |
|
290 | + break; |
|
291 | + case 'pending': |
|
292 | + $current_status = _MD_NEWBB_TYPE_PENDING; |
|
293 | + break; |
|
294 | + case 'deleted': |
|
295 | + $current_status = _MD_NEWBB_TYPE_DELETED; |
|
296 | + break; |
|
297 | + default: |
|
298 | + $current_status = ''; |
|
299 | + break; |
|
300 | 300 | } |
301 | 301 | $xoopsTpl->assign('forum_topicstatus', $current_status); |
302 | 302 | |
303 | 303 | $all_topics = $forumHandler->getTopicCount($forumObject, $startdate, $status); |
304 | 304 | if ($all_topics > $GLOBALS['xoopsModuleConfig']['topics_per_page']) { |
305 | - require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
306 | - $query_nav = $query_array; |
|
307 | - unset($query_nav['start']); |
|
308 | - $page_query_nav = implode('&', array_values($query_nav)); |
|
309 | - unset($query_nav); |
|
310 | - $nav = new \XoopsPageNav($all_topics, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start, 'start', $page_query_nav); |
|
311 | - if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
312 | - $navi = $nav->renderSelect(); |
|
313 | - } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
314 | - $navi = $nav->renderImageNav(4); |
|
315 | - } else { |
|
316 | - $navi = $nav->renderNav(4); |
|
317 | - } |
|
318 | - |
|
319 | - $xoopsTpl->assign('forum_pagenav', $navi); |
|
305 | + require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
|
306 | + $query_nav = $query_array; |
|
307 | + unset($query_nav['start']); |
|
308 | + $page_query_nav = implode('&', array_values($query_nav)); |
|
309 | + unset($query_nav); |
|
310 | + $nav = new \XoopsPageNav($all_topics, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start, 'start', $page_query_nav); |
|
311 | + if ('select' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
312 | + $navi = $nav->renderSelect(); |
|
313 | + } elseif ('image' === $GLOBALS['xoopsModuleConfig']['pagenav_display']) { |
|
314 | + $navi = $nav->renderImageNav(4); |
|
315 | + } else { |
|
316 | + $navi = $nav->renderNav(4); |
|
317 | + } |
|
318 | + |
|
319 | + $xoopsTpl->assign('forum_pagenav', $navi); |
|
320 | 320 | } else { |
321 | - $xoopsTpl->assign('forum_pagenav', ''); |
|
321 | + $xoopsTpl->assign('forum_pagenav', ''); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
325 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
326 | - $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
|
325 | + require_once __DIR__ . '/include/functions.forum.php'; |
|
326 | + $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | if ($GLOBALS['xoopsModuleConfig']['show_permissiontable']) { |
330 | - // /** var Newbb\PermissionHandler $permHandler */ |
|
331 | - // $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
332 | - $permission_table = $permHandler->getPermissionTable($forum_id, false, $isAdmin); |
|
333 | - $xoopsTpl->assign_by_ref('permission_table', $permission_table); |
|
334 | - unset($permission_table); |
|
330 | + // /** var Newbb\PermissionHandler $permHandler */ |
|
331 | + // $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
332 | + $permission_table = $permHandler->getPermissionTable($forum_id, false, $isAdmin); |
|
333 | + $xoopsTpl->assign_by_ref('permission_table', $permission_table); |
|
334 | + unset($permission_table); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | if (1 == $GLOBALS['xoopsModuleConfig']['rss_enable']) { |
338 | - $xoopsTpl->assign('rss_button', "<div align='right'><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/rss.php?f=' . $forum_id . "' title='RSS feed' target='_blank'>" . newbbDisplayImage('rss', 'RSS feed') . '</a></div>'); |
|
338 | + $xoopsTpl->assign('rss_button', "<div align='right'><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/rss.php?f=' . $forum_id . "' title='RSS feed' target='_blank'>" . newbbDisplayImage('rss', 'RSS feed') . '</a></div>'); |
|
339 | 339 | } |
340 | 340 | // irmtfan move to footer.php |
341 | 341 | require_once __DIR__ . '/footer.php'; |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | |
12 | 12 | use Xmf\Request; |
13 | 13 | |
14 | -require_once __DIR__ . '/header.php'; |
|
14 | +require_once __DIR__.'/header.php'; |
|
15 | 15 | |
16 | 16 | if (!Request::getInt('forum', 0, 'GET')) { |
17 | - redirect_header(XOOPS_URL . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
17 | + redirect_header(XOOPS_URL.'/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
18 | 18 | } |
19 | -require_once __DIR__ . '/include/functions.read.php'; |
|
19 | +require_once __DIR__.'/include/functions.read.php'; |
|
20 | 20 | |
21 | 21 | /* |
22 | 22 | * Build the page query |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $query_array = []; |
26 | 26 | foreach ($query_vars as $var) { |
27 | 27 | if (Request::getString($var, '', 'GET')) { |
28 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
28 | + $query_array[$var] = "{$var}=".Request::getString($var, '', 'GET'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | $page_query = implode('&', array_values($query_array)); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | $markresult = _MD_NEWBB_MARK_UNREAD; |
40 | 40 | } |
41 | 41 | newbbSetReadTopic($markvalue, Request::getInt('forum', 0, 'GET')); |
42 | - $url = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewforum.php?' . $page_query; |
|
43 | - redirect_header($url, 2, _MD_NEWBB_ALL_TOPIC_MARKED . ' ' . $markresult); |
|
42 | + $url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewforum.php?'.$page_query; |
|
43 | + redirect_header($url, 2, _MD_NEWBB_ALL_TOPIC_MARKED.' '.$markresult); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $forum_id = Request::getInt('forum', 0, 'GET'); |
@@ -67,25 +67,25 @@ discard block |
||
67 | 67 | $forumObject = $forumHandler->get($forum_id); |
68 | 68 | |
69 | 69 | if (!$forumObject) { |
70 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
70 | + redirect_header(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/index.php', 2, _MD_NEWBB_ERRORFORUM); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if (!$forumHandler->getPermission($forumObject)) { |
74 | - redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 2, _NOPERM); |
|
74 | + redirect_header(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/index.php', 2, _NOPERM); |
|
75 | 75 | } |
76 | 76 | newbbSetRead('forum', $forum_id, $forumObject->getVar('forum_last_post_id')); |
77 | 77 | |
78 | -$xoops_pagetitle = $forumObject->getVar('forum_name') . ' [' . $xoopsModule->getVar('name') . ']'; |
|
78 | +$xoops_pagetitle = $forumObject->getVar('forum_name').' ['.$xoopsModule->getVar('name').']'; |
|
79 | 79 | |
80 | 80 | $xoopsOption['template_main'] = 'newbb_viewforum.tpl'; |
81 | 81 | $xoopsOption['xoops_pagetitle'] = $xoops_pagetitle; |
82 | 82 | |
83 | 83 | require_once $GLOBALS['xoops']->path('header.php'); |
84 | -require_once __DIR__ . '/include/functions.render.php'; |
|
84 | +require_once __DIR__.'/include/functions.render.php'; |
|
85 | 85 | |
86 | 86 | if (!empty($GLOBALS['xoopsModuleConfig']['rss_enable'])) { |
87 | 87 | $xoopsTpl->assign('xoops_module_header', ' |
88 | - <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '-' . $forumObject->getVar('forum_name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php?f=' . $forum_id . '" /> |
|
88 | + <link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name').'-'.$forumObject->getVar('forum_name').'" href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/rss.php?f='.$forum_id.'" /> |
|
89 | 89 | ' . @$xoopsTpl->get_template_vars('xoops_module_header')); |
90 | 90 | } |
91 | 91 | $forumDescription = $forumObject->getVar('forum_desc'); |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | |
120 | 120 | if ($forumHandler->getPermission($forumObject, 'post')) { |
121 | 121 | $xoopsTpl->assign('viewer_level', $isAdmin ? 2 : 1); |
122 | - $xoopsTpl->assign('forum_post_or_register', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/newtopic.php?forum={$forum_id}\">" . newbbDisplayImage('t_new', _MD_NEWBB_POSTNEW) . '</a>'); |
|
122 | + $xoopsTpl->assign('forum_post_or_register', '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/newtopic.php?forum={$forum_id}\">".newbbDisplayImage('t_new', _MD_NEWBB_POSTNEW).'</a>'); |
|
123 | 123 | if ($pollmodules && $forumHandler->getPermission($forumObject, 'addpoll')) { |
124 | 124 | $t_poll = newbbDisplayImage('t_poll', _MD_NEWBB_ADDPOLL); |
125 | - $xoopsTpl->assign('forum_addpoll', '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/polls.php?op=add&forum={$forum_id}\">{$t_poll}</a>"); |
|
125 | + $xoopsTpl->assign('forum_addpoll', '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/polls.php?op=add&forum={$forum_id}\">{$t_poll}</a>"); |
|
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | $xoopsTpl->assign('viewer_level', 0); |
129 | 129 | if (!is_object($GLOBALS['xoopsUser']) && !empty($GLOBALS['xoopsModuleConfig']['show_reg'])) { |
130 | - $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=" . $forum_id, htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5)); |
|
131 | - $xoopsTpl->assign('forum_post_or_register', "<a href='" . XOOPS_URL . "/user.php?xoops_redirect={$redirect}'>" . _MD_NEWBB_REGTOPOST . '</a>'); |
|
130 | + $redirect = preg_replace("|(.*)\/modules\/Newbb\/(.*)|", "\\1/modules/newbb/newtopic.php?forum=".$forum_id, htmlspecialchars($xoopsRequestUri, ENT_QUOTES | ENT_HTML5)); |
|
131 | + $xoopsTpl->assign('forum_post_or_register', "<a href='".XOOPS_URL."/user.php?xoops_redirect={$redirect}'>"._MD_NEWBB_REGTOPOST.'</a>'); |
|
132 | 132 | $xoopsTpl->assign('forum_addpoll', ''); |
133 | 133 | } else { |
134 | 134 | $xoopsTpl->assign('forum_post_or_register', ''); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $xoopsTpl->assign_by_ref('parentforum', $parentforum); |
140 | 140 | |
141 | 141 | $criteria = new \CriteriaCompo(new \Criteria('parent_forum', $forum_id)); |
142 | -$criteria->add(new \Criteria('forum_id', '(' . implode(', ', $forumHandler->getIdsByPermission('access')) . ')', 'IN')); |
|
142 | +$criteria->add(new \Criteria('forum_id', '('.implode(', ', $forumHandler->getIdsByPermission('access')).')', 'IN')); |
|
143 | 143 | $criteria->setSort('forum_order'); |
144 | 144 | |
145 | 145 | if ($forums = $forumHandler->getAll($criteria, null, false)) { |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $forum_selection_sort = '<select name="sort">'; |
177 | 177 | foreach ($sel_sort_array as $sort_k => $sort_v) { |
178 | - $forum_selection_sort .= '<option value="' . $sort_k . '"' . (($sort == $sort_k) ? ' selected="selected"' : '') . '>' . $sort_v . '</option>'; |
|
178 | + $forum_selection_sort .= '<option value="'.$sort_k.'"'.(($sort == $sort_k) ? ' selected="selected"' : '').'>'.$sort_v.'</option>'; |
|
179 | 179 | } |
180 | 180 | $forum_selection_sort .= '</select>'; |
181 | 181 | |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | $order = (!Request::getString('order', '', 'GET') |
185 | 185 | || 'ASC' !== Request::getString('order', '', 'GET')) ? 'DESC' : 'ASC'; |
186 | 186 | $forum_selection_order = '<select name="order">'; |
187 | -$forum_selection_order .= '<option value="ASC"' . (('ASC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_ASCENDING . '</option>'; |
|
188 | -$forum_selection_order .= '<option value="DESC"' . (('DESC' === $order) ? ' selected' : '') . '>' . _MD_NEWBB_DESCENDING . '</option>'; |
|
187 | +$forum_selection_order .= '<option value="ASC"'.(('ASC' === $order) ? ' selected' : '').'>'._MD_NEWBB_ASCENDING.'</option>'; |
|
188 | +$forum_selection_order .= '<option value="DESC"'.(('DESC' === $order) ? ' selected' : '').'>'._MD_NEWBB_DESCENDING.'</option>'; |
|
189 | 189 | $forum_selection_order .= '</select>'; |
190 | 190 | |
191 | 191 | $xoopsTpl->assign_by_ref('forum_selection_order', $forum_selection_order); |
192 | 192 | |
193 | 193 | $since = Request::getInt('since', $GLOBALS['xoopsModuleConfig']['since_default'], 'GET'); |
194 | -require_once __DIR__ . '/include/functions.time.php'; |
|
194 | +require_once __DIR__.'/include/functions.time.php'; |
|
195 | 195 | $forum_selection_since = newbbSinceSelectBox($since); |
196 | 196 | $xoopsTpl->assign_by_ref('forum_selection_since', $forum_selection_since); |
197 | 197 | |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | $page_query_sort = implode('&', array_values($query_sort)); |
201 | 201 | unset($query_sort); |
202 | 202 | // irmtfan - edit: u.uname => t.topic_poster | t.topic_time => t.topic_id | p.post_time => t.topic_last_post_id |
203 | -$xoopsTpl->assign('h_topic_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=" . (('t.topic_title' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
204 | -$xoopsTpl->assign('h_reply_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=" . (('t.topic_replies' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
205 | -$xoopsTpl->assign('h_poster_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=" . (('t.topic_poster' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
206 | -$xoopsTpl->assign('h_views_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=" . (('t.topic_views' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
207 | -$xoopsTpl->assign('h_rating_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=" . (('t.rating' === $sort |
|
203 | +$xoopsTpl->assign('h_topic_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_title&order=".(('t.topic_title' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
204 | +$xoopsTpl->assign('h_reply_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_replies&order=".(('t.topic_replies' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
205 | +$xoopsTpl->assign('h_poster_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_poster&order=".(('t.topic_poster' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
206 | +$xoopsTpl->assign('h_views_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_views&order=".(('t.topic_views' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
207 | +$xoopsTpl->assign('h_rating_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.rating&order=".(('t.rating' === $sort |
|
208 | 208 | && 'DESC' === $order) ? 'ASC' : 'DESC')); // irmtfan t.topic_ratings to t.rating |
209 | -$xoopsTpl->assign('h_date_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=" . (('t.topic_last_post_id' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
210 | -$xoopsTpl->assign('h_publish_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=" . (('t.topic_id' === $sort |
|
209 | +$xoopsTpl->assign('h_date_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_last_post_id&order=".(('t.topic_last_post_id' === $sort && 'DESC' === $order) ? 'ASC' : 'DESC')); |
|
210 | +$xoopsTpl->assign('h_publish_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_sort}&sort=t.topic_id&order=".(('t.topic_id' === $sort |
|
211 | 211 | && 'DESC' === $order) ? 'ASC' : 'DESC')); |
212 | 212 | $xoopsTpl->assign('forum_since', $since); // For $since in search.php |
213 | 213 | |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | $xoopsTpl->assign('img_digest', newbbDisplayImage('topic_digest', _MD_NEWBB_TOPICDIGEST)); |
238 | 238 | $xoopsTpl->assign('img_poll', newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL)); |
239 | 239 | |
240 | -$xoopsTpl->assign('mark_read', XOOPS_URL . "/modules/newbb/viewforum.php?mark=1&{$page_query}"); |
|
241 | -$xoopsTpl->assign('mark_unread', XOOPS_URL . "/modules/newbb/viewforum.php?mark=2&{$page_query}"); |
|
240 | +$xoopsTpl->assign('mark_read', XOOPS_URL."/modules/newbb/viewforum.php?mark=1&{$page_query}"); |
|
241 | +$xoopsTpl->assign('mark_unread', XOOPS_URL."/modules/newbb/viewforum.php?mark=2&{$page_query}"); |
|
242 | 242 | |
243 | -$xoopsTpl->assign('post_link', XOOPS_URL . '/modules/newbb/viewpost.php?forum=' . $forum_id); |
|
244 | -$xoopsTpl->assign('newpost_link', XOOPS_URL . '/modules/newbb/viewpost.php?status=new&forum=' . $forum_id); |
|
243 | +$xoopsTpl->assign('post_link', XOOPS_URL.'/modules/newbb/viewpost.php?forum='.$forum_id); |
|
244 | +$xoopsTpl->assign('newpost_link', XOOPS_URL.'/modules/newbb/viewpost.php?status=new&forum='.$forum_id); |
|
245 | 245 | |
246 | 246 | $query_type = $query_array; |
247 | 247 | unset($query_type['type']); |
@@ -252,16 +252,16 @@ discard block |
||
252 | 252 | $typeOptions = null; |
253 | 253 | $types = []; |
254 | 254 | if ($types = $typeHandler->getByForum($forum_id)) { |
255 | - $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}"]; |
|
255 | + $typeOptions[] = ['title' => _ALL, 'link' => XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_type}"]; |
|
256 | 256 | foreach ($types as $key => $item) { |
257 | 257 | $typeOptions[] = [ |
258 | 258 | 'title' => $item['type_name'], |
259 | - 'link' => XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" |
|
259 | + 'link' => XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_type}&type={$key}" |
|
260 | 260 | ]; |
261 | 261 | } |
262 | 262 | } |
263 | 263 | if ($type > 0) { |
264 | - require_once __DIR__ . '/include/functions.topic.php'; |
|
264 | + require_once __DIR__.'/include/functions.topic.php'; |
|
265 | 265 | $xoopsTpl->assign('forum_topictype', getTopicTitle('', $types[$type]['type_name'], $types[$type]['type_color'])); |
266 | 266 | } |
267 | 267 | $xoopsTpl->assign_by_ref('typeOptions', $typeOptions); |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | unset($query_status['status']); |
271 | 271 | $page_query_status = implode('&', array_values($query_status)); |
272 | 272 | unset($query_status); |
273 | -$xoopsTpl->assign('newpost_link', XOOPS_URL . '/modules/newbb/viewpost.php?status=new&forum=' . $forumObject->getVar('forum_id')); |
|
274 | -$xoopsTpl->assign('all_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}"); |
|
275 | -$xoopsTpl->assign('digest_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=digest"); |
|
276 | -$xoopsTpl->assign('unreplied_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unreplied"); |
|
277 | -$xoopsTpl->assign('unread_link', XOOPS_URL . "/modules/newbb/viewforum.php?{$page_query_status}&status=unread"); |
|
273 | +$xoopsTpl->assign('newpost_link', XOOPS_URL.'/modules/newbb/viewpost.php?status=new&forum='.$forumObject->getVar('forum_id')); |
|
274 | +$xoopsTpl->assign('all_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}"); |
|
275 | +$xoopsTpl->assign('digest_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}&status=digest"); |
|
276 | +$xoopsTpl->assign('unreplied_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}&status=unreplied"); |
|
277 | +$xoopsTpl->assign('unread_link', XOOPS_URL."/modules/newbb/viewforum.php?{$page_query_status}&status=unread"); |
|
278 | 278 | switch ($status) { |
279 | 279 | case 'digest': |
280 | 280 | $current_status = _MD_NEWBB_DIGEST; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | } |
323 | 323 | |
324 | 324 | if (!empty($GLOBALS['xoopsModuleConfig']['show_jump'])) { |
325 | - require_once __DIR__ . '/include/functions.forum.php'; |
|
325 | + require_once __DIR__.'/include/functions.forum.php'; |
|
326 | 326 | $xoopsTpl->assign('forum_jumpbox', newbbMakeJumpbox($forum_id)); |
327 | 327 | } |
328 | 328 | |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | if (1 == $GLOBALS['xoopsModuleConfig']['rss_enable']) { |
338 | - $xoopsTpl->assign('rss_button', "<div align='right'><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/rss.php?f=' . $forum_id . "' title='RSS feed' target='_blank'>" . newbbDisplayImage('rss', 'RSS feed') . '</a></div>'); |
|
338 | + $xoopsTpl->assign('rss_button', "<div align='right'><a href='".XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/rss.php?f='.$forum_id."' title='RSS feed' target='_blank'>".newbbDisplayImage('rss', 'RSS feed').'</a></div>'); |
|
339 | 339 | } |
340 | 340 | // irmtfan move to footer.php |
341 | -require_once __DIR__ . '/footer.php'; |
|
341 | +require_once __DIR__.'/footer.php'; |
|
342 | 342 | require_once $GLOBALS['xoops']->path('footer.php'); |