@@ -252,18 +252,18 @@ discard block |
||
252 | 252 | $xoopsOnlineTable = $xoops_onlineHandler->table; |
253 | 253 | |
254 | 254 | $sql = 'DELETE FROM ' |
255 | - . $this->db->prefix('newbb_online') |
|
256 | - . ' WHERE' |
|
257 | - . ' ( online_uid > 0 AND online_uid NOT IN ( SELECT online_uid FROM ' |
|
258 | - . $xoopsOnlineTable |
|
259 | - . ' WHERE online_module =' |
|
260 | - . $xoopsModule->getVar('mid') |
|
261 | - . ' ) )' |
|
262 | - . ' OR ( online_uid = 0 AND online_ip NOT IN ( SELECT online_ip FROM ' |
|
263 | - . $xoopsOnlineTable |
|
264 | - . ' WHERE online_module =' |
|
265 | - . $xoopsModule->getVar('mid') |
|
266 | - . ' AND online_uid = 0 ) )'; |
|
255 | + . $this->db->prefix('newbb_online') |
|
256 | + . ' WHERE' |
|
257 | + . ' ( online_uid > 0 AND online_uid NOT IN ( SELECT online_uid FROM ' |
|
258 | + . $xoopsOnlineTable |
|
259 | + . ' WHERE online_module =' |
|
260 | + . $xoopsModule->getVar('mid') |
|
261 | + . ' ) )' |
|
262 | + . ' OR ( online_uid = 0 AND online_ip NOT IN ( SELECT online_ip FROM ' |
|
263 | + . $xoopsOnlineTable |
|
264 | + . ' WHERE online_module =' |
|
265 | + . $xoopsModule->getVar('mid') |
|
266 | + . ' AND online_uid = 0 ) )'; |
|
267 | 267 | |
268 | 268 | if ($result = $this->db->queryF($sql)) { |
269 | 269 | return true; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if (!$result) { |
311 | 311 | return $ret; |
312 | 312 | } |
313 | - while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
313 | + while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
314 | 314 | $ret[] = $myrow; |
315 | 315 | if ($myrow['online_uid'] > 0) { |
316 | 316 | $this->user_ids[] = $myrow['online_uid']; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
17 | 17 | |
18 | -include_once __DIR__ . '/../include/functions.config.php'; |
|
18 | +include_once __DIR__.'/../include/functions.config.php'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Class OnlineHandler |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function render(\Smarty $xoopsTpl) |
98 | 98 | { |
99 | - include_once __DIR__ . '/../include/functions.render.php'; |
|
100 | - include_once __DIR__ . '/../include/functions.user.php'; |
|
99 | + include_once __DIR__.'/../include/functions.render.php'; |
|
100 | + include_once __DIR__.'/../include/functions.user.php'; |
|
101 | 101 | $criteria = null; |
102 | 102 | if ($this->topic_id) { |
103 | 103 | $criteria = new \Criteria('online_topic', $this->topic_id); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | $users_id[] = $users[$i]['online_uid']; |
118 | 118 | $users_online[$users[$i]['online_uid']] = [ |
119 | - 'link' => XOOPS_URL . '/userinfo.php?uid=' . $users[$i]['online_uid'], |
|
119 | + 'link' => XOOPS_URL.'/userinfo.php?uid='.$users[$i]['online_uid'], |
|
120 | 120 | 'uname' => $users[$i]['online_uname'] |
121 | 121 | ]; |
122 | 122 | ++$num_user; |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function showOnline() |
157 | 157 | { |
158 | - include_once __DIR__ . '/../include/functions.render.php'; |
|
159 | - include_once __DIR__ . '/../include/functions.user.php'; |
|
158 | + include_once __DIR__.'/../include/functions.render.php'; |
|
159 | + include_once __DIR__.'/../include/functions.user.php'; |
|
160 | 160 | $criteria = null; |
161 | 161 | if ($this->topic_id) { |
162 | 162 | $criteria = new \Criteria('online_topic', $this->topic_id); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | $users_id[] = $users[$i]['online_uid']; |
177 | 177 | $users_online[$users[$i]['online_uid']] = [ |
178 | - 'link' => XOOPS_URL . '/userinfo.php?uid=' . $users[$i]['online_uid'], |
|
178 | + 'link' => XOOPS_URL.'/userinfo.php?uid='.$users[$i]['online_uid'], |
|
179 | 179 | 'uname' => $users[$i]['online_uname'] |
180 | 180 | ]; |
181 | 181 | ++$num_user; |
@@ -229,15 +229,15 @@ discard block |
||
229 | 229 | |
230 | 230 | $uid = (int)$uid; |
231 | 231 | if ($uid > 0) { |
232 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online') . ' WHERE online_uid=' . $uid; |
|
232 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('newbb_online').' WHERE online_uid='.$uid; |
|
233 | 233 | } else { |
234 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online') . ' WHERE online_uid=' . $uid . " AND online_ip='" . $ip . "'"; |
|
234 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('newbb_online').' WHERE online_uid='.$uid." AND online_ip='".$ip."'"; |
|
235 | 235 | } |
236 | 236 | list($count) = $this->db->fetchRow($this->db->queryF($sql)); |
237 | 237 | if ($count > 0) { |
238 | - $sql = 'UPDATE ' . $this->db->prefix('newbb_online') . " SET online_updated= '" . $time . "', online_forum = '" . $forum_id . "', online_topic = '" . $topic_id . "' WHERE online_uid = " . $uid; |
|
238 | + $sql = 'UPDATE '.$this->db->prefix('newbb_online')." SET online_updated= '".$time."', online_forum = '".$forum_id."', online_topic = '".$topic_id."' WHERE online_uid = ".$uid; |
|
239 | 239 | if (0 == $uid) { |
240 | - $sql .= " AND online_ip='" . $ip . "'"; |
|
240 | + $sql .= " AND online_ip='".$ip."'"; |
|
241 | 241 | } |
242 | 242 | } else { |
243 | 243 | $sql = sprintf('INSERT INTO `%s` (online_uid, online_uname, online_updated, online_ip, online_forum, online_topic) VALUES (%u, %s, %u, %s, %u, %u)', $this->db->prefix('newbb_online'), $uid, $this->db->quote($uname), $time, $this->db->quote($ip), $forum_id, $topic_id); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | public function gc($expire) |
284 | 284 | { |
285 | 285 | global $xoopsModule; |
286 | - $sql = 'DELETE FROM ' . $this->db->prefix('newbb_online') . ' WHERE online_updated < ' . (time() - (int)$expire); |
|
286 | + $sql = 'DELETE FROM '.$this->db->prefix('newbb_online').' WHERE online_updated < '.(time() - (int)$expire); |
|
287 | 287 | $this->db->queryF($sql); |
288 | 288 | |
289 | 289 | $xoops_onlineHandler = xoops_getHandler('online'); |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | { |
301 | 301 | $ret = []; |
302 | 302 | $limit = $start = 0; |
303 | - $sql = 'SELECT * FROM ' . $this->db->prefix('newbb_online'); |
|
303 | + $sql = 'SELECT * FROM '.$this->db->prefix('newbb_online'); |
|
304 | 304 | if (is_object($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
305 | - $sql .= ' ' . $criteria->renderWhere(); |
|
305 | + $sql .= ' '.$criteria->renderWhere(); |
|
306 | 306 | $limit = $criteria->getLimit(); |
307 | 307 | $start = $criteria->getStart(); |
308 | 308 | } |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | if (!empty($this->user_ids)) { |
334 | 334 | $online_users = $this->user_ids; |
335 | 335 | } else { |
336 | - $sql = 'SELECT online_uid FROM ' . $this->db->prefix('newbb_online'); |
|
336 | + $sql = 'SELECT online_uid FROM '.$this->db->prefix('newbb_online'); |
|
337 | 337 | if (!empty($uids)) { |
338 | - $sql .= ' WHERE online_uid IN (' . implode(', ', array_map('intval', $uids)) . ')'; |
|
338 | + $sql .= ' WHERE online_uid IN ('.implode(', ', array_map('intval', $uids)).')'; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | $result = $this->db->query($sql); |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | */ |
364 | 364 | public function getCount(\CriteriaElement $criteria = null) |
365 | 365 | { |
366 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online'); |
|
366 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('newbb_online'); |
|
367 | 367 | if (is_object($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { |
368 | - $sql .= ' ' . $criteria->renderWhere(); |
|
368 | + $sql .= ' '.$criteria->renderWhere(); |
|
369 | 369 | } |
370 | 370 | if (!$result = $this->db->query($sql)) { |
371 | 371 | return false; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function addField($field, $table) |
66 | 66 | { |
67 | 67 | global $xoopsDB; |
68 | - $result = $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field"); |
|
68 | + $result = $xoopsDB->queryF('ALTER TABLE '.$table." ADD $field"); |
|
69 | 69 | |
70 | 70 | return $result; |
71 | 71 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if (!@mkdir($folder) && !is_dir($folder)) { |
84 | 84 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
85 | 85 | } else { |
86 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
86 | + file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>'); |
|
87 | 87 | } |
88 | 88 | } catch (\Exception $e) { |
89 | 89 | echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return; |
99 | 99 | } |
100 | 100 | // for 2.5 systems, clear everything |
101 | - require_once XOOPS_ROOT_PATH . '/modules/system/class/maintenance.php'; |
|
101 | + require_once XOOPS_ROOT_PATH.'/modules/system/class/maintenance.php'; |
|
102 | 102 | $maintenance = new \SystemMaintenance(); |
103 | 103 | $cacheList = [ |
104 | 104 | 3, // xoops_cache |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $attachmentSave = base64_encode(serialize($this->attachmentArray)); |
123 | 123 | } |
124 | 124 | $this->setVar('attachment', $attachmentSave); |
125 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachmentSave) . ' WHERE post_id = ' . $this->getVar('post_id'); |
|
125 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachmentSave).' WHERE post_id = '.$this->getVar('post_id'); |
|
126 | 126 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
127 | 127 | //xoops_error($GLOBALS['xoopsDB']->error()); |
128 | 128 | return false; |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | |
153 | 153 | foreach ($attachOld as $key => $attach) { |
154 | 154 | if (in_array($key, $attachArray)) { |
155 | - @unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved'])); |
|
156 | - @unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/thumbs/' . $attach['name_saved'])); // delete thumbnails |
|
155 | + @unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$attach['name_saved'])); |
|
156 | + @unlink($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/thumbs/'.$attach['name_saved'])); // delete thumbnails |
|
157 | 157 | continue; |
158 | 158 | } |
159 | 159 | $this->attachmentArray[$key] = $attach; |
@@ -210,25 +210,25 @@ discard block |
||
210 | 210 | if (is_array($attachments) && count($attachments) > 0) { |
211 | 211 | $iconHandler = newbbGetIconHandler(); |
212 | 212 | $mime_path = $iconHandler->getPath('mime'); |
213 | - include_once dirname(__DIR__) . '/include/functions.image.php'; |
|
213 | + include_once dirname(__DIR__).'/include/functions.image.php'; |
|
214 | 214 | $image_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']; // need improve !!! |
215 | - $post_attachment .= '<br><strong>' . _MD_NEWBB_ATTACHMENT . '</strong>:'; |
|
215 | + $post_attachment .= '<br><strong>'._MD_NEWBB_ATTACHMENT.'</strong>:'; |
|
216 | 216 | $post_attachment .= '<br><hr size="1" noshade="noshade" /><br>'; |
217 | 217 | foreach ($attachments as $key => $att) { |
218 | 218 | $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.'); |
219 | 219 | $filetype = $file_extension; |
220 | - if (file_exists($GLOBALS['xoops']->path($mime_path . '/' . $filetype . '.gif'))) { |
|
221 | - $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif'; |
|
220 | + if (file_exists($GLOBALS['xoops']->path($mime_path.'/'.$filetype.'.gif'))) { |
|
221 | + $icon_filetype = XOOPS_URL.'/'.$mime_path.'/'.$filetype.'.gif'; |
|
222 | 222 | } else { |
223 | - $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif'; |
|
223 | + $icon_filetype = XOOPS_URL.'/'.$mime_path.'/unknown.gif'; |
|
224 | 224 | } |
225 | - $file_size = @filesize($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $att['name_saved'])); |
|
226 | - $file_size = number_format($file_size / 1024, 2) . ' KB'; |
|
225 | + $file_size = @filesize($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'].'/'.$att['name_saved'])); |
|
226 | + $file_size = number_format($file_size / 1024, 2).' KB'; |
|
227 | 227 | if (in_array(strtolower($file_extension), $image_extensions) |
228 | 228 | && $GLOBALS['xoopsModuleConfig']['media_allowed']) { |
229 | - $post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '" /><strong> ' . $att['nameDisplay'] . '</strong> <small>(' . $file_size . ')</small>'; |
|
230 | - $post_attachment .= '<br>' . newbbAttachmentImage($att['name_saved']); |
|
231 | - $isDisplayed = true; |
|
229 | + $post_attachment .= '<br><img src="'.$icon_filetype.'" alt="'.$filetype.'" /><strong> '.$att['nameDisplay'].'</strong> <small>('.$file_size.')</small>'; |
|
230 | + $post_attachment .= '<br>'.newbbAttachmentImage($att['name_saved']); |
|
231 | + $isDisplayed = true; |
|
232 | 232 | } else { |
233 | 233 | if (empty($GLOBALS['xoopsModuleConfig']['show_userattach'])) { |
234 | 234 | $post_attachment .= '<a href="' |
@@ -362,10 +362,10 @@ discard block |
||
362 | 362 | // End irmtfan add option to do only the latest edit when do_latestedit=0 (Alfred) |
363 | 363 | // START hacked by irmtfan |
364 | 364 | // display/save all edit records. |
365 | - $post_edit .= _MD_NEWBB_EDITEDBY . ' ' . $edit_user . ' ' . _MD_NEWBB_ON . ' ' . formatTimestamp($edit_time) . '<br>'; |
|
365 | + $post_edit .= _MD_NEWBB_EDITEDBY.' '.$edit_user.' '._MD_NEWBB_ON.' '.formatTimestamp($edit_time).'<br>'; |
|
366 | 366 | // if reason is not empty |
367 | 367 | if ('' !== $edit_msg) { |
368 | - $post_edit .= _MD_NEWBB_EDITEDMSG . ' ' . $edit_msg . '<br>'; |
|
368 | + $post_edit .= _MD_NEWBB_EDITEDMSG.' '.$edit_msg.'<br>'; |
|
369 | 369 | } |
370 | 370 | // START hacked by irmtfan |
371 | 371 | } |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | { |
382 | 382 | global $viewtopic_users; |
383 | 383 | $newbbConfig = newbbLoadConfig(); |
384 | - include_once __DIR__ . '/../include/functions.user.php'; |
|
385 | - include_once __DIR__ . '/../include/functions.render.php'; |
|
384 | + include_once __DIR__.'/../include/functions.user.php'; |
|
385 | + include_once __DIR__.'/../include/functions.render.php'; |
|
386 | 386 | |
387 | 387 | $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
388 | 388 | /** @var KarmaHandler $karmaHandler */ |
@@ -393,14 +393,14 @@ discard block |
||
393 | 393 | $post['attachment'] = false; |
394 | 394 | $post_text = newbbDisplayTarea($this->vars['post_text']['value'], $this->getVar('dohtml'), $this->getVar('dosmiley'), $this->getVar('doxcode'), $this->getVar('doimage'), $this->getVar('dobr')); |
395 | 395 | if (newbbIsAdmin($this->getVar('forum_id')) || $this->checkIdentity()) { |
396 | - $post['text'] = $post_text . '<br>' . $this->displayAttachment(); |
|
396 | + $post['text'] = $post_text.'<br>'.$this->displayAttachment(); |
|
397 | 397 | } elseif ($newbbConfig['enable_karma'] && $this->getVar('post_karma') > $user_karma) { |
398 | 398 | $post['text'] = sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')); |
399 | 399 | } elseif ($newbbConfig['allow_require_reply'] && $this->getVar('require_reply') |
400 | 400 | && (!$uid || !isset($viewtopic_users[$uid]))) { |
401 | 401 | $post['text'] = _MD_NEWBB_REPLY_REQUIREMENT; |
402 | 402 | } else { |
403 | - $post['text'] = $post_text . '<br>' . $this->displayAttachment(); |
|
403 | + $post['text'] = $post_text.'<br>'.$this->displayAttachment(); |
|
404 | 404 | } |
405 | 405 | /** @var \XoopsMemberHandler $memberHandler */ |
406 | 406 | $memberHandler = xoops_getHandler('member'); |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | $name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
486 | 486 | } |
487 | 487 | |
488 | - include_once __DIR__ . '/../include/functions.time.php'; |
|
489 | - include_once __DIR__ . '/../include/functions.render.php'; |
|
488 | + include_once __DIR__.'/../include/functions.time.php'; |
|
489 | + include_once __DIR__.'/../include/functions.render.php'; |
|
490 | 490 | |
491 | 491 | $post_id = $this->getVar('post_id'); |
492 | 492 | $topic_id = $this->getVar('topic_id'); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $query_array['topic_id'] = "topic_id={$topic_id}"; |
498 | 498 | foreach ($query_vars as $var) { |
499 | 499 | if (Request::getString($var, '', 'GET')) { |
500 | - $query_array[$var] = "{$var}=" . Request::getString($var, '', 'GET'); |
|
500 | + $query_array[$var] = "{$var}=".Request::getString($var, '', 'GET'); |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | $page_query = htmlspecialchars(implode('&', array_values($query_array))); |
@@ -515,11 +515,11 @@ discard block |
||
515 | 515 | $post_text = $this->getVar('post_text'); |
516 | 516 | $post_attachment = $this->displayAttachment(); |
517 | 517 | } elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $this->getVar('post_karma') > $user_karma) { |
518 | - $post_text = "<div class='karma'>" . sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . '</div>'; |
|
518 | + $post_text = "<div class='karma'>".sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')).'</div>'; |
|
519 | 519 | $post_attachment = ''; |
520 | 520 | } elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $this->getVar('require_reply') |
521 | 521 | && (!$uid || !in_array($uid, $viewtopic_posters))) { |
522 | - $post_text = "<div class='karma'>" . _MD_NEWBB_REPLY_REQUIREMENT . '</div>'; |
|
522 | + $post_text = "<div class='karma'>"._MD_NEWBB_REPLY_REQUIREMENT.'</div>'; |
|
523 | 523 | $post_attachment = ''; |
524 | 524 | } else { |
525 | 525 | $post_text = $this->getVar('post_text'); |
@@ -546,9 +546,9 @@ discard block |
||
546 | 546 | } |
547 | 547 | |
548 | 548 | if ($posticon = $this->getVar('icon')) { |
549 | - $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/subject/' . $posticon . '" alt="" /></a>'; |
|
549 | + $post_image = '<a name="'.$post_id.'"><img src="'.XOOPS_URL.'/images/subject/'.$posticon.'" alt="" /></a>'; |
|
550 | 550 | } else { |
551 | - $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /></a>'; |
|
551 | + $post_image = '<a name="'.$post_id.'"><img src="'.XOOPS_URL.'/images/icons/posticon.gif" alt="" /></a>'; |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | $thread_buttons = []; |
@@ -557,10 +557,10 @@ discard block |
||
557 | 557 | if ($isAdmin && ($GLOBALS['xoopsUser'] && $GLOBALS['xoopsUser']->getVar('uid') !== $this->getVar('uid')) |
558 | 558 | && $this->getVar('uid') > 0) { |
559 | 559 | $mod_buttons['bann']['image'] = newbbDisplayImage('p_bann', _MD_NEWBB_SUSPEND_MANAGEMENT); |
560 | - $mod_buttons['bann']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/moderate.php?forum=' . $forum_id . '&uid=' . $this->getVar('uid'); |
|
560 | + $mod_buttons['bann']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/moderate.php?forum='.$forum_id.'&uid='.$this->getVar('uid'); |
|
561 | 561 | $mod_buttons['bann']['name'] = _MD_NEWBB_SUSPEND_MANAGEMENT; |
562 | 562 | $thread_buttons['bann']['image'] = newbbDisplayImage('p_bann', _MD_NEWBB_SUSPEND_MANAGEMENT); |
563 | - $thread_buttons['bann']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/moderate.php?forum=' . $forum_id . '&uid=' . $this->getVar('uid'); |
|
563 | + $thread_buttons['bann']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/moderate.php?forum='.$forum_id.'&uid='.$this->getVar('uid'); |
|
564 | 564 | $thread_buttons['bann']['name'] = _MD_NEWBB_SUSPEND_MANAGEMENT; |
565 | 565 | } |
566 | 566 | |
@@ -573,10 +573,10 @@ discard block |
||
573 | 573 | |
574 | 574 | if ($edit_ok) { |
575 | 575 | $thread_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
576 | - $thread_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/edit.php?{$page_query}"; |
|
576 | + $thread_buttons['edit']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/edit.php?{$page_query}"; |
|
577 | 577 | $thread_buttons['edit']['name'] = _EDIT; |
578 | 578 | $mod_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
579 | - $mod_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/edit.php?{$page_query}"; |
|
579 | + $mod_buttons['edit']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/edit.php?{$page_query}"; |
|
580 | 580 | $mod_buttons['edit']['name'] = _EDIT; |
581 | 581 | } |
582 | 582 | } |
@@ -586,55 +586,55 @@ discard block |
||
586 | 586 | |
587 | 587 | if ($delete_ok) { |
588 | 588 | $thread_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
589 | - $thread_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/delete.php?{$page_query}"; |
|
589 | + $thread_buttons['delete']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/delete.php?{$page_query}"; |
|
590 | 590 | $thread_buttons['delete']['name'] = _DELETE; |
591 | 591 | $mod_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
592 | - $mod_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/delete.php?{$page_query}"; |
|
592 | + $mod_buttons['delete']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/delete.php?{$page_query}"; |
|
593 | 593 | $mod_buttons['delete']['name'] = _DELETE; |
594 | 594 | } |
595 | 595 | } |
596 | 596 | if ($topicHandler->getPermission($forum_id, $topic_status, 'reply')) { |
597 | 597 | $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
598 | - $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/reply.php?{$page_query}"; |
|
598 | + $thread_buttons['reply']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/reply.php?{$page_query}"; |
|
599 | 599 | $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
600 | 600 | |
601 | 601 | $thread_buttons['quote']['image'] = newbbDisplayImage('p_quote', _MD_NEWBB_QUOTE); |
602 | - $thread_buttons['quote']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/reply.php?{$page_query}&quotedac=1"; |
|
602 | + $thread_buttons['quote']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/reply.php?{$page_query}&quotedac=1"; |
|
603 | 603 | $thread_buttons['quote']['name'] = _MD_NEWBB_QUOTE; |
604 | 604 | } |
605 | 605 | } else { |
606 | 606 | $mod_buttons['edit']['image'] = newbbDisplayImage('p_edit', _EDIT); |
607 | - $mod_buttons['edit']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/edit.php?{$page_query}"; |
|
607 | + $mod_buttons['edit']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/edit.php?{$page_query}"; |
|
608 | 608 | $mod_buttons['edit']['name'] = _EDIT; |
609 | 609 | |
610 | 610 | $mod_buttons['delete']['image'] = newbbDisplayImage('p_delete', _DELETE); |
611 | - $mod_buttons['delete']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/delete.php?{$page_query}"; |
|
611 | + $mod_buttons['delete']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/delete.php?{$page_query}"; |
|
612 | 612 | $mod_buttons['delete']['name'] = _DELETE; |
613 | 613 | |
614 | 614 | $thread_buttons['reply']['image'] = newbbDisplayImage('p_reply', _MD_NEWBB_REPLY); |
615 | - $thread_buttons['reply']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/reply.php?{$page_query}"; |
|
615 | + $thread_buttons['reply']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/reply.php?{$page_query}"; |
|
616 | 616 | $thread_buttons['reply']['name'] = _MD_NEWBB_REPLY; |
617 | 617 | } |
618 | 618 | |
619 | 619 | if (!$isAdmin && $GLOBALS['xoopsModuleConfig']['reportmod_enabled']) { |
620 | 620 | $thread_buttons['report']['image'] = newbbDisplayImage('p_report', _MD_NEWBB_REPORT); |
621 | - $thread_buttons['report']['link'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/report.php?{$page_query}"; |
|
621 | + $thread_buttons['report']['link'] = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/report.php?{$page_query}"; |
|
622 | 622 | $thread_buttons['report']['name'] = _MD_NEWBB_REPORT; |
623 | 623 | } |
624 | 624 | |
625 | 625 | $thread_action = []; |
626 | 626 | // irmtfan add pdf permission |
627 | - if (file_exists(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php') |
|
627 | + if (file_exists(XOOPS_ROOT_PATH.'/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php') |
|
628 | 628 | && $topicHandler->getPermission($forum_id, $topic_status, 'pdf')) { |
629 | 629 | $thread_action['pdf']['image'] = newbbDisplayImage('pdf', _MD_NEWBB_PDF); |
630 | - $thread_action['pdf']['link'] = XOOPS_URL . '/modules/newbb/makepdf.php?type=post&pageid=0'; |
|
630 | + $thread_action['pdf']['link'] = XOOPS_URL.'/modules/newbb/makepdf.php?type=post&pageid=0'; |
|
631 | 631 | $thread_action['pdf']['name'] = _MD_NEWBB_PDF; |
632 | 632 | $thread_action['pdf']['target'] = '_blank'; |
633 | 633 | } |
634 | 634 | // irmtfan add print permission |
635 | 635 | if ($topicHandler->getPermission($forum_id, $topic_status, 'print')) { |
636 | 636 | $thread_action['print']['image'] = newbbDisplayImage('printer', _MD_NEWBB_PRINT); |
637 | - $thread_action['print']['link'] = XOOPS_URL . '/modules/newbb/print.php?form=2&forum=' . $forum_id . '&topic_id=' . $topic_id; |
|
637 | + $thread_action['print']['link'] = XOOPS_URL.'/modules/newbb/print.php?form=2&forum='.$forum_id.'&topic_id='.$topic_id; |
|
638 | 638 | $thread_action['print']['name'] = _MD_NEWBB_PRINT; |
639 | 639 | $thread_action['print']['target'] = '_blank'; |
640 | 640 | } |
@@ -642,45 +642,45 @@ discard block |
||
642 | 642 | if ($GLOBALS['xoopsModuleConfig']['show_sociallinks']) { |
643 | 643 | $full_title = $this->getVar('subject'); |
644 | 644 | $clean_title = preg_replace('/[^A-Za-z0-9-]+/', '+', $this->getVar('subject')); |
645 | - $full_link = XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $post_id; |
|
645 | + $full_link = XOOPS_URL.'/modules/newbb/viewtopic.php?post_id='.$post_id; |
|
646 | 646 | |
647 | 647 | $thread_action['social_twitter']['image'] = newbbDisplayImage('twitter', _MD_NEWBB_SHARE_TWITTER); |
648 | - $thread_action['social_twitter']['link'] = 'http://twitter.com/share?text=' . $clean_title . '&url=' . $full_link; |
|
648 | + $thread_action['social_twitter']['link'] = 'http://twitter.com/share?text='.$clean_title.'&url='.$full_link; |
|
649 | 649 | $thread_action['social_twitter']['name'] = _MD_NEWBB_SHARE_TWITTER; |
650 | 650 | $thread_action['social_twitter']['target'] = '_blank'; |
651 | 651 | |
652 | 652 | $thread_action['social_facebook']['image'] = newbbDisplayImage('facebook', _MD_NEWBB_SHARE_FACEBOOK); |
653 | - $thread_action['social_facebook']['link'] = 'http://www.facebook.com/sharer.php?u=' . $full_link; |
|
653 | + $thread_action['social_facebook']['link'] = 'http://www.facebook.com/sharer.php?u='.$full_link; |
|
654 | 654 | $thread_action['social_facebook']['name'] = _MD_NEWBB_SHARE_FACEBOOK; |
655 | 655 | $thread_action['social_facebook']['target'] = '_blank'; |
656 | 656 | |
657 | 657 | $thread_action['social_gplus']['image'] = newbbDisplayImage('googleplus', _MD_NEWBB_SHARE_GOOGLEPLUS); |
658 | - $thread_action['social_gplus']['link'] = 'https://plusone.google.com/_/+1/confirm?hl=en&url=' . $full_link; |
|
658 | + $thread_action['social_gplus']['link'] = 'https://plusone.google.com/_/+1/confirm?hl=en&url='.$full_link; |
|
659 | 659 | $thread_action['social_gplus']['name'] = _MD_NEWBB_SHARE_GOOGLEPLUS; |
660 | 660 | $thread_action['social_gplus']['target'] = '_blank'; |
661 | 661 | |
662 | 662 | $thread_action['social_linkedin']['image'] = newbbDisplayImage('linkedin', _MD_NEWBB_SHARE_LINKEDIN); |
663 | - $thread_action['social_linkedin']['link'] = 'http://www.linkedin.com/shareArticle?mini=true&title=' . $full_title . '&url=' . $full_link; |
|
663 | + $thread_action['social_linkedin']['link'] = 'http://www.linkedin.com/shareArticle?mini=true&title='.$full_title.'&url='.$full_link; |
|
664 | 664 | $thread_action['social_linkedin']['name'] = _MD_NEWBB_SHARE_LINKEDIN; |
665 | 665 | $thread_action['social_linkedin']['target'] = '_blank'; |
666 | 666 | |
667 | 667 | $thread_action['social_delicious']['image'] = newbbDisplayImage('delicious', _MD_NEWBB_SHARE_DELICIOUS); |
668 | - $thread_action['social_delicious']['link'] = 'http://del.icio.us/post?title=' . $full_title . '&url=' . $full_link; |
|
668 | + $thread_action['social_delicious']['link'] = 'http://del.icio.us/post?title='.$full_title.'&url='.$full_link; |
|
669 | 669 | $thread_action['social_delicious']['name'] = _MD_NEWBB_SHARE_DELICIOUS; |
670 | 670 | $thread_action['social_delicious']['target'] = '_blank'; |
671 | 671 | |
672 | 672 | $thread_action['social_digg']['image'] = newbbDisplayImage('digg', _MD_NEWBB_SHARE_DIGG); |
673 | - $thread_action['social_digg']['link'] = 'http://digg.com/submit?phase=2&title=' . $full_title . '&url=' . $full_link; |
|
673 | + $thread_action['social_digg']['link'] = 'http://digg.com/submit?phase=2&title='.$full_title.'&url='.$full_link; |
|
674 | 674 | $thread_action['social_digg']['name'] = _MD_NEWBB_SHARE_DIGG; |
675 | 675 | $thread_action['social_digg']['target'] = '_blank'; |
676 | 676 | |
677 | 677 | $thread_action['social_reddit']['image'] = newbbDisplayImage('reddit', _MD_NEWBB_SHARE_REDDIT); |
678 | - $thread_action['social_reddit']['link'] = 'http://reddit.com/submit?title=' . $full_title . '&url=' . $full_link; |
|
678 | + $thread_action['social_reddit']['link'] = 'http://reddit.com/submit?title='.$full_title.'&url='.$full_link; |
|
679 | 679 | $thread_action['social_reddit']['name'] = _MD_NEWBB_SHARE_REDDIT; |
680 | 680 | $thread_action['social_reddit']['target'] = '_blank'; |
681 | 681 | |
682 | 682 | $thread_action['social_wong']['image'] = newbbDisplayImage('wong', _MD_NEWBB_SHARE_MRWONG); |
683 | - $thread_action['social_wong']['link'] = 'http://www.mister-wong.de/index.php?action=addurl&bm_url=' . $full_link; |
|
683 | + $thread_action['social_wong']['link'] = 'http://www.mister-wong.de/index.php?action=addurl&bm_url='.$full_link; |
|
684 | 684 | $thread_action['social_wong']['name'] = _MD_NEWBB_SHARE_MRWONG; |
685 | 685 | $thread_action['social_wong']['target'] = '_blank'; |
686 | 686 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | 'thread_buttons' => $thread_buttons, |
705 | 705 | 'mod_buttons' => $mod_buttons, |
706 | 706 | 'poster' => $poster, |
707 | - 'post_permalink' => '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?post_id=' . $post_id . '"></a>' |
|
707 | + 'post_permalink' => '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/viewtopic.php?post_id='.$post_id.'"></a>' |
|
708 | 708 | ]; |
709 | 709 | |
710 | 710 | unset($thread_buttons, $mod_buttons, $eachposter); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function __construct(\XoopsDatabase $db, $type) |
93 | 93 | { |
94 | 94 | $type = ('forum' === $type) ? 'forum' : 'topic'; |
95 | - parent::__construct($db, 'newbb_reads_' . $type, Read::class . $type, 'read_id', 'post_id'); |
|
95 | + parent::__construct($db, 'newbb_reads_'.$type, Read::class.$type, 'read_id', 'post_id'); |
|
96 | 96 | $this->type = $type; |
97 | 97 | $newbbConfig = newbbLoadConfig(); |
98 | 98 | // irmtfan if read_expire = 0 dont clean |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | |
116 | - $sql = 'DELETE bb FROM ' . $this->table . ' AS bb' . ' LEFT JOIN ' . $this->table . ' AS aa ON bb.read_item = aa.read_item ' . ' WHERE aa.post_id > bb.post_id'; |
|
116 | + $sql = 'DELETE bb FROM '.$this->table.' AS bb'.' LEFT JOIN '.$this->table.' AS aa ON bb.read_item = aa.read_item '.' WHERE aa.post_id > bb.post_id'; |
|
117 | 117 | if (!$result = $this->db->queryF($sql)) { |
118 | 118 | //xoops_error($this->db->error()); |
119 | 119 | return false; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | // irmtfan move here and rephrase |
126 | 126 | $expire = time() - (int)$this->lifetime; |
127 | - $sql = 'DELETE FROM ' . $this->table . ' WHERE read_time < ' . $expire; |
|
127 | + $sql = 'DELETE FROM '.$this->table.' WHERE read_time < '.$expire; |
|
128 | 128 | if (!$result = $this->db->queryF($sql)) { |
129 | 129 | //xoops_error($this->db->error()); |
130 | 130 | return false; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | return false; |
181 | 181 | } |
182 | 182 | } |
183 | - $sql = 'SELECT post_id ' . ' FROM ' . $this->table . ' WHERE read_item = ' . (int)$read_item . ' AND uid = ' . (int)$uid; |
|
183 | + $sql = 'SELECT post_id '.' FROM '.$this->table.' WHERE read_item = '.(int)$read_item.' AND uid = '.(int)$uid; |
|
184 | 184 | if (!$result = $this->db->queryF($sql, 1)) { |
185 | 185 | return null; |
186 | 186 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
238 | - $sql = 'UPDATE ' . $this->table . ' SET post_id = ' . (int)$post_id . ',' . ' read_time =' . time() . ' WHERE read_item = ' . (int)$read_item . ' AND uid = ' . (int)$uid; |
|
238 | + $sql = 'UPDATE '.$this->table.' SET post_id = '.(int)$post_id.','.' read_time ='.time().' WHERE read_item = '.(int)$read_item.' AND uid = '.(int)$uid; |
|
239 | 239 | if ($this->db->queryF($sql) && $this->db->getAffectedRows()) { |
240 | 240 | return true; |
241 | 241 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | $criteria = new \CriteriaCompo(new \Criteria('uid', $uid)); |
310 | - $criteria->add(new \Criteria('read_item', '(' . implode(', ', array_map('intval', array_keys($items))) . ')', 'IN')); |
|
310 | + $criteria->add(new \Criteria('read_item', '('.implode(', ', array_map('intval', array_keys($items))).')', 'IN')); |
|
311 | 311 | $itemsObject = $this->getAll($criteria, ['read_item', 'post_id']); |
312 | 312 | |
313 | 313 | $items_list = []; |
@@ -339,43 +339,43 @@ discard block |
||
339 | 339 | $sql = "SET sql_mode=(SELECT REPLACE(@@sql_mode, 'ONLY_FULL_GROUP_BY', ''))"; |
340 | 340 | $this->db->queryF($sql); |
341 | 341 | |
342 | - $sql = 'CREATE TABLE ' . $this->table . '_duplicate LIKE ' . $this->table . '; '; |
|
342 | + $sql = 'CREATE TABLE '.$this->table.'_duplicate LIKE '.$this->table.'; '; |
|
343 | 343 | if (!$result = $this->db->queryF($sql)) { |
344 | - xoops_error($this->db->error() . '<br>' . $sql); |
|
344 | + xoops_error($this->db->error().'<br>'.$sql); |
|
345 | 345 | |
346 | 346 | return false; |
347 | 347 | } |
348 | - $sql = 'INSERT ' . $this->table . '_duplicate SELECT * FROM ' . $this->table . ' GROUP BY read_item, uid; '; |
|
348 | + $sql = 'INSERT '.$this->table.'_duplicate SELECT * FROM '.$this->table.' GROUP BY read_item, uid; '; |
|
349 | 349 | if (!$result = $this->db->queryF($sql)) { |
350 | - xoops_error($this->db->error() . '<br>' . $sql); |
|
350 | + xoops_error($this->db->error().'<br>'.$sql); |
|
351 | 351 | |
352 | 352 | return false; |
353 | 353 | } |
354 | - $sql = 'RENAME TABLE ' . $this->table . ' TO ' . $this->table . '_with_duplicate; '; |
|
354 | + $sql = 'RENAME TABLE '.$this->table.' TO '.$this->table.'_with_duplicate; '; |
|
355 | 355 | if (!$result = $this->db->queryF($sql)) { |
356 | - xoops_error($this->db->error() . '<br>' . $sql); |
|
356 | + xoops_error($this->db->error().'<br>'.$sql); |
|
357 | 357 | |
358 | 358 | return false; |
359 | 359 | } |
360 | - $sql = 'RENAME TABLE ' . $this->table . '_duplicate TO ' . $this->table . '; '; |
|
360 | + $sql = 'RENAME TABLE '.$this->table.'_duplicate TO '.$this->table.'; '; |
|
361 | 361 | if (!$result = $this->db->queryF($sql)) { |
362 | - xoops_error($this->db->error() . '<br>' . $sql); |
|
362 | + xoops_error($this->db->error().'<br>'.$sql); |
|
363 | 363 | |
364 | 364 | return false; |
365 | 365 | } |
366 | - $sql = 'SHOW INDEX FROM ' . $this->table . " WHERE KEY_NAME = 'read_item_uid'"; |
|
366 | + $sql = 'SHOW INDEX FROM '.$this->table." WHERE KEY_NAME = 'read_item_uid'"; |
|
367 | 367 | $result = $this->db->queryF($sql); |
368 | 368 | if (empty($result)) { |
369 | - $sql .= 'ALTER TABLE ' . $this->table . ' ADD INDEX read_item_uid ( read_item, uid ); '; |
|
369 | + $sql .= 'ALTER TABLE '.$this->table.' ADD INDEX read_item_uid ( read_item, uid ); '; |
|
370 | 370 | if (!$result = $this->db->queryF($sql)) { |
371 | - xoops_error($this->db->error() . '<br>' . $sql); |
|
371 | + xoops_error($this->db->error().'<br>'.$sql); |
|
372 | 372 | |
373 | 373 | return false; |
374 | 374 | } |
375 | 375 | } |
376 | - $sql = 'DROP TABLE ' . $this->table . '_with_duplicate; '; |
|
376 | + $sql = 'DROP TABLE '.$this->table.'_with_duplicate; '; |
|
377 | 377 | if (!$result = $this->db->queryF($sql)) { |
378 | - xoops_error($this->db->error() . '<br>' . $sql); |
|
378 | + xoops_error($this->db->error().'<br>'.$sql); |
|
379 | 379 | |
380 | 380 | return false; |
381 | 381 | } |
@@ -79,50 +79,50 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 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}' "; |
|
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 | 90 | $result = $this->db->queryF($sql); |
91 | 91 | $rows = $this->db->getAffectedRows(); |
92 | 92 | if (0 == $rows) { |
93 | 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')"; |
|
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 | 108 | $result = $this->db->queryF($sql); |
109 | 109 | } |
110 | 110 | if ($rows < 2 * count($this->param['period']) && !empty($id)) { |
111 | 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')"; |
|
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 | 126 | $result = $this->db->queryF($sql); |
127 | 127 | } |
128 | 128 | } |
@@ -148,17 +148,17 @@ discard block |
||
148 | 148 | $_periods[] = array_search($period, $this->param['period']); |
149 | 149 | } |
150 | 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 (' |
|
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 | 156 | . implode(', ', array_map('intval', $ids)) |
157 | 157 | . ')') |
158 | - . ' ' |
|
159 | - . (empty($_types) ? '' : 'AND stats_type IN (' . implode(', ', $_types) . ')') |
|
160 | - . ' ' |
|
161 | - . (empty($_periods) ? '' : 'AND stats_period IN (' . implode(', ', $_periods) . ')'); |
|
158 | + . ' ' |
|
159 | + . (empty($_types) ? '' : 'AND stats_type IN (' . implode(', ', $_types) . ')') |
|
160 | + . ' ' |
|
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))) { |
@@ -204,21 +204,21 @@ discard block |
||
204 | 204 | list($topics, $views) = $this->db->fetchRow($result); |
205 | 205 | $views = empty($views) ? 0 : $views; // null check |
206 | 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}')"); |
|
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 | 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}')"); |
|
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 | 222 | @$counts['topic'][$period] += $topics; |
223 | 223 | @$counts['view'][$period] += $views; |
224 | 224 | |
@@ -226,26 +226,26 @@ discard block |
||
226 | 226 | $result = $this->db->query($sql); |
227 | 227 | list($digests) = $this->db->fetchRow($result); |
228 | 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}')"); |
|
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 | 236 | @$counts['digest'][$period] += $digests; |
237 | 237 | |
238 | 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}" |
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}')"); |
|
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 | 249 | @$counts['post'][$period] += $posts; |
250 | 250 | } |
251 | 251 | } |
@@ -254,13 +254,13 @@ discard block |
||
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}" |
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}')"); |
|
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 | 264 | } |
265 | 265 | } |
266 | 266 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
14 | 14 | |
15 | -defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__ . '/functions.ini.php'; |
|
15 | +defined('NEWBB_FUNCTIONS_INI') || include_once __DIR__.'/functions.ini.php'; |
|
16 | 16 | |
17 | 17 | define('NEWBB_STATS_TYPE_TOPIC', 1); |
18 | 18 | define('NEWBB_STATS_TYPE_POST', 2); |
@@ -78,7 +78,7 @@ discard block |
||
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,9 +156,9 @@ 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))) { |
@@ -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 (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}" |
@@ -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 | - include_once __DIR__ . '/../include/functions.topic.php'; |
|
77 | + include_once __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 | } |
@@ -188,12 +188,12 @@ |
||
188 | 188 | } |
189 | 189 | // irmtfan hardcore removed align="left" |
190 | 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>"; |
|
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 | 197 | |
198 | 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 | 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']); |
@@ -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 | - include_once __DIR__ . '/../include/functions.time.php'; |
|
257 | + include_once __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 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | if (count($this->items) < $this->max_items) { |
87 | 87 | if (!empty($label)) { |
88 | - $label = '[' . $this->cleanup($label) . ']'; |
|
88 | + $label = '['.$this->cleanup($label).']'; |
|
89 | 89 | } |
90 | 90 | if (!empty($description)) { |
91 | 91 | $description = $this->cleanup($description, $this->max_item_description); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | //$description = $label; |
95 | 95 | } |
96 | 96 | |
97 | - $title = $this->cleanup($title) . ' ' . $label; |
|
97 | + $title = $this->cleanup($title).' '.$label; |
|
98 | 98 | $pubdate = $this->cleanup($pubdate); |
99 | 99 | $this->items[] = [ |
100 | 100 | 'title' => $title, |
@@ -294,7 +294,7 @@ |
||
294 | 294 | /** @var Newbb\TypeHandler $typeHandler */ |
295 | 295 | $typeHandler = Newbb\Helper::getInstance()->getHandler('Type'); |
296 | 296 | $typen = $typeHandler->getByForum($forum->getVar('forum_id')); |
297 | - while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
297 | + while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
298 | 298 | if ($myrow['topic_sticky']) { |
299 | 299 | ++$sticky; |
300 | 300 | } |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | return $_cachedForums; |
101 | 101 | } |
102 | 102 | |
103 | - $criteria = new \CriteriaCompo(new \Criteria('forum_id', '(' . implode(', ', $valid_ids) . ')', 'IN')); |
|
103 | + $criteria = new \CriteriaCompo(new \Criteria('forum_id', '('.implode(', ', $valid_ids).')', 'IN')); |
|
104 | 104 | if (is_numeric($cat) && $cat > 0) { |
105 | 105 | $criteria->add(new \Criteria('cat_id', (int)$cat)); |
106 | 106 | } elseif (is_array($cat) && count($cat) > 0) { |
107 | - $criteria->add(new \Criteria('cat_id', '(' . implode(', ', $cat) . ')', 'IN')); |
|
107 | + $criteria->add(new \Criteria('cat_id', '('.implode(', ', $cat).')', 'IN')); |
|
108 | 108 | } |
109 | 109 | $criteria->setSort('forum_order'); |
110 | 110 | $criteria->setOrder('ASC'); |
@@ -181,23 +181,23 @@ discard block |
||
181 | 181 | $topic_lastread = newbbGetCookie('LT', true); |
182 | 182 | $criteria_forum = ''; |
183 | 183 | if (is_object($forum)) { |
184 | - $criteria_forum = ' AND t.forum_id = ' . $forum->getVar('forum_id'); |
|
184 | + $criteria_forum = ' AND t.forum_id = '.$forum->getVar('forum_id'); |
|
185 | 185 | $hot_threshold = $forum->getVar('hot_threshold'); |
186 | 186 | } else { |
187 | 187 | $hot_threshold = 10; |
188 | 188 | if (is_array($forum) && count($forum) > 0) { |
189 | - $criteria_forum = ' AND t.forum_id IN (' . implode(',', array_keys($forum)) . ')'; |
|
189 | + $criteria_forum = ' AND t.forum_id IN ('.implode(',', array_keys($forum)).')'; |
|
190 | 190 | } elseif (!empty($forum)) { |
191 | - $criteria_forum = ' AND t.forum_id =' . (int)$forum; |
|
191 | + $criteria_forum = ' AND t.forum_id ='.(int)$forum; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - $criteria_post = $startdate ? ' p.post_time > ' . $startdate : ' 1 = 1 '; |
|
195 | + $criteria_post = $startdate ? ' p.post_time > '.$startdate : ' 1 = 1 '; |
|
196 | 196 | $criteria_topic = empty($type) ? '' : " AND t.type_id={$type}"; |
197 | 197 | $criteria_extra = ''; |
198 | 198 | $criteria_approve = ' AND t.approved = 1'; |
199 | 199 | $post_on = ' p.post_id = t.topic_last_post_id'; |
200 | - $leftjoin = ' LEFT JOIN ' . $this->db->prefix('newbb_posts') . ' p ON p.post_id = t.topic_last_post_id'; |
|
200 | + $leftjoin = ' LEFT JOIN '.$this->db->prefix('newbb_posts').' p ON p.post_id = t.topic_last_post_id'; |
|
201 | 201 | $sort_array = []; |
202 | 202 | switch ($status) { |
203 | 203 | case 'digest': |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | // START irmtfan use read_uid to find the unread posts when the user is logged in |
215 | 215 | $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
216 | 216 | if (!empty($read_uid)) { |
217 | - $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('newbb_reads_topic') . ' r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; |
|
217 | + $leftjoin .= ' LEFT JOIN '.$this->db->prefix('newbb_reads_topic').' r ON r.read_item = t.topic_id AND r.uid = '.$read_uid.' '; |
|
218 | 218 | $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; |
219 | 219 | } else { |
220 | 220 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
223 | 223 | // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
224 | 224 | if ($time_criterion = max($GLOBALS['last_visit'], $startdate)) { |
225 | - $criteria_post = ' p.post_time > ' . $time_criterion; // for all users |
|
225 | + $criteria_post = ' p.post_time > '.$time_criterion; // for all users |
|
226 | 226 | $topics = []; |
227 | 227 | $topic_lastread = newbbGetCookie('LT', true); |
228 | 228 | if (count($topic_lastread) > 0) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | if (count($topics) > 0) { |
236 | - $criteria_extra = ' AND t.topic_id NOT IN (' . implode(',', $topics) . ')'; |
|
236 | + $criteria_extra = ' AND t.topic_id NOT IN ('.implode(',', $topics).')'; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | break; |
242 | 242 | case 'pending': |
243 | 243 | $post_on = ' p.topic_id = t.topic_id'; |
244 | - $criteria_post .= ' AND p.pid = 0'; |
|
244 | + $criteria_post .= ' AND p.pid = 0'; |
|
245 | 245 | $criteria_approve = ' AND t.approved = 0'; |
246 | 246 | break; |
247 | 247 | |
@@ -255,31 +255,31 @@ discard block |
||
255 | 255 | |
256 | 256 | default: |
257 | 257 | if ($startdate > 0) { |
258 | - $criteria_post = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)'; |
|
258 | + $criteria_post = ' (p.post_time > '.$startdate.' OR t.topic_sticky=1)'; |
|
259 | 259 | } |
260 | 260 | $sort_array[] = 't.topic_sticky DESC'; |
261 | 261 | break; |
262 | 262 | } |
263 | 263 | |
264 | - $select = 't.*, ' . ' p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; |
|
265 | - $from = $this->db->prefix('newbb_topics') . ' t ' . $leftjoin; |
|
266 | - $where = $criteria_post . $criteria_topic . $criteria_forum . $criteria_extra . $criteria_approve; |
|
264 | + $select = 't.*, '.' p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; |
|
265 | + $from = $this->db->prefix('newbb_topics').' t '.$leftjoin; |
|
266 | + $where = $criteria_post.$criteria_topic.$criteria_forum.$criteria_extra.$criteria_approve; |
|
267 | 267 | |
268 | 268 | if ($excerpt) { |
269 | 269 | $select .= ', p.post_karma, p.require_reply, pt.post_text'; |
270 | - $from .= ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' pt ON pt.post_id = t.topic_last_post_id'; |
|
270 | + $from .= ' LEFT JOIN '.$this->db->prefix('newbb_posts_text').' pt ON pt.post_id = t.topic_last_post_id'; |
|
271 | 271 | } |
272 | 272 | if ('u.uname' === $sort) { |
273 | 273 | $sort = 't.topic_poster'; |
274 | 274 | } |
275 | 275 | |
276 | - $sort_array[] = trim($sort . ' ' . $order); |
|
276 | + $sort_array[] = trim($sort.' '.$order); |
|
277 | 277 | $sortby = implode(', ', array_filter($sort_array)); |
278 | 278 | if (empty($sortby)) { |
279 | 279 | $sortby = 't.topic_last_post_id DESC'; |
280 | 280 | } |
281 | 281 | |
282 | - $sql = 'SELECT ' . $select . ' FROM ' . $from . ' WHERE ' . $where . ' ORDER BY ' . $sortby; |
|
282 | + $sql = 'SELECT '.$select.' FROM '.$from.' WHERE '.$where.' ORDER BY '.$sortby; |
|
283 | 283 | |
284 | 284 | if (!$result = $this->db->query($sql, $GLOBALS['xoopsModuleConfig']['topics_per_page'], $start)) { |
285 | 285 | redirect_header('index.php', 2, _MD_NEWBB_ERROROCCURED); |
@@ -304,16 +304,16 @@ discard block |
||
304 | 304 | |
305 | 305 | if ($myrow['topic_haspoll']) { |
306 | 306 | if ($myrow['topic_sticky']) { |
307 | - $topic_icon = newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY) . '<br>' . newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL); |
|
307 | + $topic_icon = newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY).'<br>'.newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL); |
|
308 | 308 | } else { |
309 | 309 | $topic_icon = newbbDisplayImage('poll', _MD_NEWBB_TOPICHASPOLL); |
310 | 310 | } |
311 | 311 | } elseif ($myrow['topic_sticky']) { |
312 | 312 | $topic_icon = newbbDisplayImage('topic_sticky', _MD_NEWBB_TOPICSTICKY); |
313 | 313 | } elseif (!empty($myrow['icon'])) { |
314 | - $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; |
|
314 | + $topic_icon = '<img src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($myrow['icon']).'" alt="" />'; |
|
315 | 315 | } else { |
316 | - $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; |
|
316 | + $topic_icon = '<img src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" />'; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // ------------------------------------------------------ |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if ($rating < 1) { |
324 | 324 | $rating_img = newbbDisplayImage('blank'); |
325 | 325 | } else { |
326 | - $rating_img = newbbDisplayImage('rate' . $rating, constant('_MD_NEWBB_RATE' . $rating)); |
|
326 | + $rating_img = newbbDisplayImage('rate'.$rating, constant('_MD_NEWBB_RATE'.$rating)); |
|
327 | 327 | } |
328 | 328 | // ------------------------------------------------------ |
329 | 329 | // topic_page_jump |
@@ -332,28 +332,28 @@ discard block |
||
332 | 332 | $totalpages = ceil(($myrow['topic_replies'] + 1) / $GLOBALS['xoopsModuleConfig']['posts_per_page']); |
333 | 333 | if ($totalpages > 1) { |
334 | 334 | $topic_page_jump .= ' '; |
335 | - $append = false; |
|
335 | + $append = false; |
|
336 | 336 | for ($i = 1; $i <= $totalpages; ++$i) { |
337 | 337 | if ($i > 3 && $i < $totalpages) { |
338 | 338 | if (!$append) { |
339 | 339 | $topic_page_jump .= '...'; |
340 | - $append = true; |
|
340 | + $append = true; |
|
341 | 341 | } |
342 | 342 | } else { |
343 | - $topic_page_jump .= '[<a href="' . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . (($i - 1) * $GLOBALS['xoopsModuleConfig']['posts_per_page']) . '">' . $i . '</a>]'; |
|
343 | + $topic_page_jump .= '[<a href="'.XOOPS_URL.'/modules/newbb/viewtopic.php?topic_id='.$myrow['topic_id'].'&start='.(($i - 1) * $GLOBALS['xoopsModuleConfig']['posts_per_page']).'">'.$i.'</a>]'; |
|
344 | 344 | // irmtfan remove here and move |
345 | 345 | //$topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?post_id=" . $myrow['post_id'] . "&start=" . (($i - 1) * $GLOBALS['xoopsModuleConfig']['posts_per_page']) . "'>" . newbbDisplayImage('lastposticon',_MD_NEWBB_GOTOLASTPOST) . '</a>'; |
346 | 346 | } |
347 | 347 | } |
348 | 348 | } |
349 | 349 | // irmtfan - move here for both topics with and without pages |
350 | - $topic_page_jump_icon = "<a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $myrow['post_id'] . "'>" . newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST) . '</a>'; |
|
350 | + $topic_page_jump_icon = "<a href='".XOOPS_URL.'/modules/newbb/viewtopic.php?post_id='.$myrow['post_id']."'>".newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST).'</a>'; |
|
351 | 351 | |
352 | 352 | // ------------------------------------------------------ |
353 | 353 | // => topic array |
354 | 354 | $forum_link = ''; |
355 | 355 | if (!empty($viewAllForums[$myrow['forum_id']])) { |
356 | - $forum_link = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $myrow['forum_id'] . '">' . $viewAllForums[$myrow['forum_id']]['forum_name'] . '</a>'; |
|
356 | + $forum_link = '<a href="'.XOOPS_URL.'/modules/newbb/viewforum.php?forum='.$myrow['forum_id'].'">'.$viewAllForums[$myrow['forum_id']]['forum_name'].'</a>'; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | $topic_title = $myts->htmlSpecialChars($myrow['topic_title']); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | //$topic_title = '<span style="color:'.$typen[$myrow["type_id"]]["type_color"].'">['.$typen[$myrow["type_id"]]["type_name"].']</span> '.$topic_title.''; |
363 | 363 | //} |
364 | 364 | if ($myrow['topic_digest']) { |
365 | - $topic_title = "<span class='digest'>" . $topic_title . '</span>'; |
|
365 | + $topic_title = "<span class='digest'>".$topic_title.'</span>'; |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | if (0 == $excerpt) { |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | //'type_text' => $topic_prefix,/*irmtfan remove here and move to for loop*/ |
382 | 382 | 'topic_title' => $topic_title, |
383 | 383 | //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], |
384 | - 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], |
|
384 | + 'topic_link' => 'viewtopic.php?topic_id='.$myrow['topic_id'], |
|
385 | 385 | 'rating_img' => $rating_img, |
386 | 386 | 'topic_page_jump' => $topic_page_jump, |
387 | 387 | 'topic_page_jump_icon' => $topic_page_jump_icon, |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | } // irmtfan end for loop |
457 | 457 | // END irmtfan move to a for loop |
458 | 458 | if (count($topics) > 0) { |
459 | - $sql = ' SELECT DISTINCT topic_id FROM ' . $this->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')'; |
|
459 | + $sql = ' SELECT DISTINCT topic_id FROM '.$this->db->prefix('newbb_posts')." WHERE attachment != ''".' AND topic_id IN ('.implode(',', array_keys($topics)).')'; |
|
460 | 460 | if ($result = $this->db->query($sql)) { |
461 | 461 | while (list($topic_id) = $this->db->fetchRow($result)) { |
462 | - $topics[$topic_id]['attachment'] = ' ' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT); |
|
462 | + $topics[$topic_id]['attachment'] = ' '.newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | |
480 | 480 | $criteria_extra = ''; |
481 | 481 | $criteria_approve = ' AND t.approved = 1'; // any others? |
482 | - $leftjoin = ' LEFT JOIN ' . $this->db->prefix('newbb_posts') . ' p ON p.post_id = t.topic_last_post_id'; |
|
483 | - $criteria_post = ' p.post_time > ' . $startdate; |
|
482 | + $leftjoin = ' LEFT JOIN '.$this->db->prefix('newbb_posts').' p ON p.post_id = t.topic_last_post_id'; |
|
483 | + $criteria_post = ' p.post_time > '.$startdate; |
|
484 | 484 | switch ($type) { |
485 | 485 | case 'digest': |
486 | 486 | $criteria_extra = ' AND topic_digest = 1'; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | |
496 | 496 | $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
497 | 497 | if (!empty($read_uid)) { |
498 | - $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('newbb_reads_topic') . ' r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; |
|
498 | + $leftjoin .= ' LEFT JOIN '.$this->db->prefix('newbb_reads_topic').' r ON r.read_item = t.topic_id AND r.uid = '.$read_uid.' '; |
|
499 | 499 | $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; |
500 | 500 | } else { |
501 | 501 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | } elseif (1 == $GLOBALS['xoopsModuleConfig']['read_mode']) { |
504 | 504 | // START irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
505 | 505 | if ($time_criterion = max($GLOBALS['last_visit'], $startdate)) { |
506 | - $criteria_post = ' p.post_time > ' . $time_criterion; // for all users |
|
506 | + $criteria_post = ' p.post_time > '.$time_criterion; // for all users |
|
507 | 507 | $topics = []; |
508 | 508 | $topic_lastread = newbbGetCookie('LT', true); |
509 | 509 | if (count($topic_lastread) > 0) { |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | } |
515 | 515 | } |
516 | 516 | if (count($topics) > 0) { |
517 | - $criteria_extra = ' AND t.topic_id NOT IN (' . implode(',', $topics) . ')'; |
|
517 | + $criteria_extra = ' AND t.topic_id NOT IN ('.implode(',', $topics).')'; |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
@@ -529,22 +529,22 @@ discard block |
||
529 | 529 | case 'all': |
530 | 530 | break; |
531 | 531 | default: |
532 | - $criteria_post = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)'; |
|
532 | + $criteria_post = ' (p.post_time > '.$startdate.' OR t.topic_sticky=1)'; |
|
533 | 533 | break; |
534 | 534 | } |
535 | 535 | $criteria_forum = ''; |
536 | 536 | if (is_object($forum)) { |
537 | - $criteria_forum = ' AND t.forum_id = ' . $forum->getVar('forum_id'); |
|
537 | + $criteria_forum = ' AND t.forum_id = '.$forum->getVar('forum_id'); |
|
538 | 538 | } else { |
539 | 539 | if (is_array($forum) && count($forum) > 0) { |
540 | - $criteria_forum = ' AND t.forum_id IN (' . implode(',', array_keys($forum)) . ')'; |
|
540 | + $criteria_forum = ' AND t.forum_id IN ('.implode(',', array_keys($forum)).')'; |
|
541 | 541 | } elseif (!empty($forum)) { |
542 | - $criteria_forum = ' AND t.forum_id =' . (int)$forum; |
|
542 | + $criteria_forum = ' AND t.forum_id ='.(int)$forum; |
|
543 | 543 | } |
544 | 544 | } |
545 | 545 | |
546 | - $sql = 'SELECT COUNT(*) AS count FROM ' . $this->db->prefix('newbb_topics') . ' t ' . $leftjoin; |
|
547 | - $sql .= ' WHERE ' . $criteria_post . $criteria_forum . $criteria_extra . $criteria_approve; |
|
546 | + $sql = 'SELECT COUNT(*) AS count FROM '.$this->db->prefix('newbb_topics').' t '.$leftjoin; |
|
547 | + $sql .= ' WHERE '.$criteria_post.$criteria_forum.$criteria_extra.$criteria_approve; |
|
548 | 548 | if (!$result = $this->db->query($sql)) { |
549 | 549 | //xoops_error($this->db->error().'<br>'.$sql); |
550 | 550 | return null; |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | return true; |
573 | 573 | } |
574 | 574 | |
575 | - include_once __DIR__ . '/../include/functions.user.php'; |
|
575 | + include_once __DIR__.'/../include/functions.user.php'; |
|
576 | 576 | if (newbbIsAdmin($forum)) { |
577 | 577 | return true; |
578 | 578 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | " OR parent_forum = forum_id"; |
674 | 674 | */ |
675 | 675 | $criteria = new \CriteriaCompo(); |
676 | - $criteria->add(new \Criteria('parent_forum', '(' . implode(', ', $forum_ids) . ')', 'NOT IN'), 'AND'); |
|
676 | + $criteria->add(new \Criteria('parent_forum', '('.implode(', ', $forum_ids).')', 'NOT IN'), 'AND'); |
|
677 | 677 | $criteria->add(new \Criteria('parent_forum', '`forum_id`', '='), 'OR'); |
678 | 678 | $b1 = $this->updateAll('parent_forum', 0, $criteria, true); |
679 | 679 | // check cat_id orphan forums |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | return false; |
684 | 684 | } |
685 | 685 | $criteria = new \CriteriaCompo(); |
686 | - $criteria->add(new \Criteria('cat_id', '(' . implode(', ', $cat_ids) . ')', 'NOT IN'), 'AND'); |
|
686 | + $criteria->add(new \Criteria('cat_id', '('.implode(', ', $cat_ids).')', 'NOT IN'), 'AND'); |
|
687 | 687 | $b2 = $this->updateAll('cat_id', $cat_ids[0], $criteria, true); |
688 | 688 | |
689 | 689 | return ($b1 && $b2); |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | if (!$object->getVar('forum_id')) { |
718 | 718 | return false; |
719 | 719 | } |
720 | - $sql = 'SELECT MAX(post_id) AS last_post, COUNT(*) AS total FROM ' . $this->db->prefix('newbb_posts') . ' AS p LEFT JOIN ' . $this->db->prefix('newbb_topics') . ' AS t ON p.topic_id=t.topic_id WHERE p.approved=1 AND t.approved=1 AND p.forum_id = ' . $object->getVar('forum_id'); |
|
720 | + $sql = 'SELECT MAX(post_id) AS last_post, COUNT(*) AS total FROM '.$this->db->prefix('newbb_posts').' AS p LEFT JOIN '.$this->db->prefix('newbb_topics').' AS t ON p.topic_id=t.topic_id WHERE p.approved=1 AND t.approved=1 AND p.forum_id = '.$object->getVar('forum_id'); |
|
721 | 721 | |
722 | 722 | if ($result = $this->db->query($sql)) { |
723 | 723 | $last_post = 0; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | - $sql = 'SELECT COUNT(*) AS total FROM ' . $this->db->prefix('newbb_topics') . ' WHERE approved=1 AND forum_id = ' . $object->getVar('forum_id'); |
|
737 | + $sql = 'SELECT COUNT(*) AS total FROM '.$this->db->prefix('newbb_topics').' WHERE approved=1 AND forum_id = '.$object->getVar('forum_id'); |
|
738 | 738 | if ($result = $this->db->query($sql)) { |
739 | 739 | if ($row = $this->db->fetchArray($result)) { |
740 | 740 | if ($object->getVar('forum_topics') !== $row['total']) { |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | if (!$forums_id) { |
777 | 777 | return $stats; |
778 | 778 | } |
779 | - $sql = ' SELECT forum_posts AS posts, forum_topics AS topics, forum_id AS id' . ' FROM ' . $this->table . ' WHERE forum_id IN (' . implode(', ', $forums_id) . ')'; |
|
779 | + $sql = ' SELECT forum_posts AS posts, forum_topics AS topics, forum_id AS id'.' FROM '.$this->table.' WHERE forum_id IN ('.implode(', ', $forums_id).')'; |
|
780 | 780 | if (!$result = $this->db->query($sql)) { |
781 | 781 | return $stats; |
782 | 782 | } |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | if (!empty($length_title_index)) { |
822 | 822 | $tags_post[] = 'subject'; |
823 | 823 | } |
824 | - $posts = $postHandler->getAll(new \Criteria('post_id', '(' . implode(', ', $posts) . ')', 'IN'), $tags_post, false); |
|
824 | + $posts = $postHandler->getAll(new \Criteria('post_id', '('.implode(', ', $posts).')', 'IN'), $tags_post, false); |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | // Get topic/post stats per forum |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | $topics = []; |
837 | 837 | |
838 | 838 | foreach (array_keys($forums) as $id) { |
839 | - $forum =& $forums[$id]; |
|
839 | + $forum = & $forums[$id]; |
|
840 | 840 | |
841 | 841 | if (!$forum['forum_last_post_id']) { |
842 | 842 | continue; |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | $name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
869 | 869 | |
870 | 870 | foreach (array_keys($forums) as $id) { |
871 | - $forum =& $forums[$id]; |
|
871 | + $forum = & $forums[$id]; |
|
872 | 872 | |
873 | 873 | $_forum_data = []; |
874 | 874 | $_forum_data['forum_order'] = $forum['forum_order']; |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | |
892 | 892 | // irmtfan change if/endif to if{} method |
893 | 893 | if ($post_id = $forum['forum_last_post_id']) { |
894 | - $post =& $posts[$post_id]; |
|
894 | + $post = & $posts[$post_id]; |
|
895 | 895 | $_forum_data['forum_lastpost_id'] = $post_id; |
896 | 896 | $_forum_data['forum_lastpost_time'] = newbbFormatTimestamp($post['post_time']); |
897 | 897 | if (!empty($users_linked[$post['uid']])) { |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | } |
948 | 948 | $forumsObject = $this->getByPermission($cat_id, $perm_string, $tags); |
949 | 949 | |
950 | - require_once __DIR__ . '/tree.php'; |
|
950 | + require_once __DIR__.'/tree.php'; |
|
951 | 951 | $forums_structured = []; |
952 | 952 | foreach (array_keys($forumsObject) as $key) { |
953 | 953 | $forums_structured[$forumsObject[$key]->getVar('cat_id')][$key] = $forumsObject[$key]; |
@@ -983,10 +983,10 @@ discard block |
||
983 | 983 | } |
984 | 984 | $forumsObject = $this->getByPermission($cat_id, $perm_string, $tags); |
985 | 985 | |
986 | - require_once __DIR__ . '/tree.php'; |
|
986 | + require_once __DIR__.'/tree.php'; |
|
987 | 987 | $forums_structured = []; |
988 | 988 | foreach (array_keys($forumsObject) as $key) { |
989 | - $forumObject =& $forumsObject[$key]; |
|
989 | + $forumObject = & $forumsObject[$key]; |
|
990 | 990 | $forums_structured[$forumObject->getVar('cat_id')][$key] = $forumsObject[$key]; |
991 | 991 | } |
992 | 992 | foreach (array_keys($forums_structured) as $cid) { |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | if (!$parents = newbbGetParentForum($object->getVar('forum_id'))) { |
1014 | 1014 | return $ret; |
1015 | 1015 | } |
1016 | - $parents_list = $this->getList(new \Criteria('forum_id', '(' . implode(', ', $parents) . ')', 'IN')); |
|
1016 | + $parents_list = $this->getList(new \Criteria('forum_id', '('.implode(', ', $parents).')', 'IN')); |
|
1017 | 1017 | foreach ($parents as $key => $id) { |
1018 | 1018 | $ret[] = ['forum_id' => $id, 'forum_name' => $parents_list[$id]]; |
1019 | 1019 | } |