@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | global $myts; |
68 | 68 | |
69 | 69 | $clean = stripslashes($text); |
70 | - $clean =& $myts->displayTarea($clean, 1, 0, 1); |
|
70 | + $clean = & $myts->displayTarea($clean, 1, 0, 1); |
|
71 | 71 | $clean = strip_tags($clean); |
72 | 72 | $clean = htmlspecialchars($clean, ENT_QUOTES); |
73 | 73 | |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | $linebreak = $isHtml ? '<br>' : "\n"; |
88 | 88 | for ($i = 0; $i < $digest_count; ++$i) { |
89 | 89 | if ($isHtml) { |
90 | - $content .= ($i + 1) . '. <a href=' . $this->items[$i]['link'] . '>' . $this->items[$i]['title'] . '</a>'; |
|
90 | + $content .= ($i + 1).'. <a href='.$this->items[$i]['link'].'>'.$this->items[$i]['title'].'</a>'; |
|
91 | 91 | } else { |
92 | - $content .= ($i + 1) . '. ' . $this->items[$i]['title'] . $linebreak . $this->items[$i]['link']; |
|
92 | + $content .= ($i + 1).'. '.$this->items[$i]['title'].$linebreak.$this->items[$i]['link']; |
|
93 | 93 | } |
94 | 94 | |
95 | - $content .= $linebreak . $this->items[$i]['author']; |
|
95 | + $content .= $linebreak.$this->items[$i]['author']; |
|
96 | 96 | if ($isSummary) { |
97 | - $content .= $linebreak . $this->items[$i]['summary']; |
|
97 | + $content .= $linebreak.$this->items[$i]['summary']; |
|
98 | 98 | } |
99 | - $content .= $linebreak . $linebreak; |
|
99 | + $content .= $linebreak.$linebreak; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | $this->setVar('digest_content', $content); |
@@ -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 |
@@ -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') || 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); |
@@ -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 (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}" |
@@ -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 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
257 | + require_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, |
@@ -93,7 +93,7 @@ |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | $newPostArray = []; |
96 | - $prefix .= $this->increment; |
|
96 | + $prefix .= $this->increment; |
|
97 | 97 | foreach ($this->postArray as $post) { |
98 | 98 | if ($post->getVar('pid') == $pid) { |
99 | 99 | $postTree_array[] = [ |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | { |
113 | 113 | $ips = []; |
114 | 114 | if ($isUid) { |
115 | - $criteria = 'uid =' . (int)$item; |
|
115 | + $criteria = 'uid ='.(int)$item; |
|
116 | 116 | } else { |
117 | 117 | $ip_segs = explode('.', $item); |
118 | 118 | $segs = min(count($ip_segs), 4); |
119 | 119 | for ($i = 1; $i <= $segs; ++$i) { |
120 | 120 | $ips[] = $this->db->quoteString(implode('.', array_slice($ip_segs, 0, $i))); |
121 | 121 | } |
122 | - $criteria = 'ip IN(' . implode(',', $ips) . ')'; |
|
122 | + $criteria = 'ip IN('.implode(',', $ips).')'; |
|
123 | 123 | } |
124 | - $sql = 'SELECT MAX(mod_end) AS expire FROM ' . $this->db->prefix('newbb_moderates') . ' WHERE ' . $criteria; |
|
124 | + $sql = 'SELECT MAX(mod_end) AS expire FROM '.$this->db->prefix('newbb_moderates').' WHERE '.$criteria; |
|
125 | 125 | if (!$result = $this->db->query($sql)) { |
126 | 126 | return -1; |
127 | 127 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function cleanOrphan($table_link = '', $field_link = '', $field_object = '') //cleanOrphan() |
142 | 142 | { |
143 | - $sql = 'DELETE FROM ' . $this->table . ' WHERE (forum_id >0 AND forum_id NOT IN ( SELECT DISTINCT forum_id FROM ' . $this->db->prefix('newbb_forums') . ') )'; |
|
143 | + $sql = 'DELETE FROM '.$this->table.' WHERE (forum_id >0 AND forum_id NOT IN ( SELECT DISTINCT forum_id FROM '.$this->db->prefix('newbb_forums').') )'; |
|
144 | 144 | if (!$result = $this->db->queryF($sql)) { |
145 | 145 | //xoops_error($this->db->error()); |
146 | 146 | return false; |
@@ -488,22 +488,22 @@ discard block |
||
488 | 488 | 'sort' => 't.topic_views' |
489 | 489 | ], |
490 | 490 | 'lastpost' => [ // irmtfan show topic_page_jump_icon smarty |
491 | - 'title' => _MD_NEWBB_LASTPOST, |
|
492 | - /*irmtfan _MD_NEWBB_DATE to _MD_NEWBB_LASTPOSTTIME again change to _MD_LASTPOST*/ |
|
493 | - 'sort' => 't.topic_last_post_id' |
|
491 | + 'title' => _MD_NEWBB_LASTPOST, |
|
492 | + /*irmtfan _MD_NEWBB_DATE to _MD_NEWBB_LASTPOSTTIME again change to _MD_LASTPOST*/ |
|
493 | + 'sort' => 't.topic_last_post_id' |
|
494 | 494 | ], |
495 | 495 | // START irmtfan add more sorts |
496 | 496 | 'lastposttime' => [ // irmtfan same as lastpost |
497 | - 'title' => _MD_NEWBB_LASTPOSTTIME, |
|
498 | - 'sort' => 't.topic_last_post_id' |
|
497 | + 'title' => _MD_NEWBB_LASTPOSTTIME, |
|
498 | + 'sort' => 't.topic_last_post_id' |
|
499 | 499 | ], |
500 | 500 | 'lastposter' => [ // irmtfan |
501 | - 'title' => _MD_NEWBB_POSTER, |
|
502 | - 'sort' => 'p.uid',// poster uid |
|
501 | + 'title' => _MD_NEWBB_POSTER, |
|
502 | + 'sort' => 'p.uid',// poster uid |
|
503 | 503 | ], |
504 | 504 | 'lastpostmsgicon' => [ // irmtfan |
505 | - 'title' => _MD_NEWBB_MESSAGEICON, |
|
506 | - 'sort' => 'p.icon',// post message icon |
|
505 | + 'title' => _MD_NEWBB_MESSAGEICON, |
|
506 | + 'sort' => 'p.icon',// post message icon |
|
507 | 507 | ], |
508 | 508 | 'ratings' => [ |
509 | 509 | 'title' => _MD_NEWBB_RATINGS, |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $wheres[] = '1 = 1'; |
856 | 856 | |
857 | 857 | $sql = ' SELECT ' . implode(', ', $selects) . ' FROM ' . implode(', ', $froms) . ' ' . implode(' ', $joins) . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') . // irmtfan bug fix: Undefined index: join when post_excerpt = 0 |
858 | - ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']); |
|
858 | + ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']); |
|
859 | 859 | |
860 | 860 | if (!$result = $this->handler->db->query($sql)) { |
861 | 861 | return 0; |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | //if (empty($this->query["sort"])) $this->query["sort"][] = 't.topic_last_post_id DESC'; // irmtfan commented no need |
908 | 908 | |
909 | 909 | $sql = ' SELECT ' . implode(', ', $selects) . ' FROM ' . implode(', ', $froms) . ' ' . implode(' ', $joins) . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') . // irmtfan bug fix: Undefined index join when post_excerpt = 0 |
910 | - ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']) . ' ORDER BY ' . implode(', ', $this->query['sort']); |
|
910 | + ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']) . ' ORDER BY ' . implode(', ', $this->query['sort']); |
|
911 | 911 | |
912 | 912 | if (!$result = $this->handler->db->query($sql, $this->config['topics_per_page'], @$this->vars['start'])) { |
913 | 913 | if (is_object($xoopsTpl)) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | // START irmtfan use read_uid to find the unread posts when the user is logged in |
235 | 235 | $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
236 | 236 | if (!empty($read_uid)) { |
237 | - $this->query['join'][] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_reads_topic') . ' AS r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; |
|
237 | + $this->query['join'][] = 'LEFT JOIN '.$this->handler->db->prefix('newbb_reads_topic').' AS r ON r.read_item = t.topic_id AND r.uid = '.$read_uid.' '; |
|
238 | 238 | $this->query['where'][] = 'r.post_id = t.topic_last_post_id'; |
239 | 239 | } else { |
240 | 240 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | if ($lastvisit = max($GLOBALS['last_visit'], $startdate)) { |
247 | 247 | $readmode1query = ''; |
248 | 248 | if ($lastvisit > $startdate) { |
249 | - $readmode1query = 'p.post_time < ' . $lastvisit; |
|
249 | + $readmode1query = 'p.post_time < '.$lastvisit; |
|
250 | 250 | } |
251 | 251 | $topics = []; |
252 | 252 | $topic_lastread = newbbGetCookie('LT', true); |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | } |
259 | 259 | } |
260 | 260 | if (count($topics) > 0) { |
261 | - $topicquery = ' t.topic_id IN (' . implode(',', $topics) . ')'; |
|
261 | + $topicquery = ' t.topic_id IN ('.implode(',', $topics).')'; |
|
262 | 262 | // because it should be OR |
263 | - $readmode1query = !empty($readmode1query) ? '(' . $readmode1query . ' OR ' . $topicquery . ')' : $topicquery; |
|
263 | + $readmode1query = !empty($readmode1query) ? '('.$readmode1query.' OR '.$topicquery.')' : $topicquery; |
|
264 | 264 | } |
265 | 265 | $this->query['where'][] = $readmode1query; |
266 | 266 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | // START irmtfan use read_uid to find the unread posts when the user is logged in |
277 | 277 | $read_uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
278 | 278 | if (!empty($read_uid)) { |
279 | - $this->query['join'][] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_reads_topic') . ' AS r ON r.read_item = t.topic_id AND r.uid = ' . $read_uid . ' '; |
|
279 | + $this->query['join'][] = 'LEFT JOIN '.$this->handler->db->prefix('newbb_reads_topic').' AS r ON r.read_item = t.topic_id AND r.uid = '.$read_uid.' '; |
|
280 | 280 | $this->query['where'][] = '(r.read_id IS NULL OR r.post_id < t.topic_last_post_id)'; |
281 | 281 | } else { |
282 | 282 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $startdate = !empty($this->vars['since']) ? (time() - newbbGetSinceTime($this->vars['since'])) : 0; |
288 | 288 | if ($lastvisit = max($GLOBALS['last_visit'], $startdate)) { |
289 | 289 | if ($lastvisit > $startdate) { |
290 | - $this->query['where'][] = 'p.post_time > ' . $lastvisit; |
|
290 | + $this->query['where'][] = 'p.post_time > '.$lastvisit; |
|
291 | 291 | } |
292 | 292 | $topics = []; |
293 | 293 | $topic_lastread = newbbGetCookie('LT', true); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | } |
301 | 301 | if (count($topics) > 0) { |
302 | - $this->query['where'][] = ' t.topic_id NOT IN (' . implode(',', $topics) . ')'; |
|
302 | + $this->query['where'][] = ' t.topic_id NOT IN ('.implode(',', $topics).')'; |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | // END irmtfan fix read_mode = 1 bugs - for all users (member and anon) |
@@ -358,20 +358,20 @@ discard block |
||
358 | 358 | //} elseif (count($accessForums) === 1) { |
359 | 359 | //$this->query["where"][] = "t.forum_id = " . $accessForums[0]; |
360 | 360 | } else { |
361 | - $this->query['where'][] = 't.forum_id IN ( ' . implode(', ', $accessForums) . ' )'; |
|
361 | + $this->query['where'][] = 't.forum_id IN ( '.implode(', ', $accessForums).' )'; |
|
362 | 362 | } |
363 | 363 | break; |
364 | 364 | |
365 | 365 | case 'uid': // irmtfan add multi topic poster |
366 | 366 | if (-1 !== $val) { |
367 | 367 | $val = implode(',', array_map('intval', explode(',', $val))); |
368 | - $this->query['where'][] = 't.topic_poster IN ( ' . $val . ' )'; |
|
368 | + $this->query['where'][] = 't.topic_poster IN ( '.$val.' )'; |
|
369 | 369 | } |
370 | 370 | break; |
371 | 371 | case 'lastposter': // irmtfan add multi lastposter |
372 | 372 | if (-1 !== $val) { |
373 | 373 | $val = implode(',', array_map('intval', explode(',', $val))); |
374 | - $this->query['where'][] = 'p.uid IN ( ' . $val . ' )'; |
|
374 | + $this->query['where'][] = 'p.uid IN ( '.$val.' )'; |
|
375 | 375 | } |
376 | 376 | break; |
377 | 377 | |
@@ -385,17 +385,17 @@ discard block |
||
385 | 385 | } |
386 | 386 | // irmtfan digest_time | to accept multiple status |
387 | 387 | if (in_array('digest', explode(',', $this->vars['status'], true))) { |
388 | - $this->query['where'][] = 't.digest_time > ' . $startdate; |
|
388 | + $this->query['where'][] = 't.digest_time > '.$startdate; |
|
389 | 389 | } |
390 | 390 | // irmtfan - should be >= instead of = |
391 | - $this->query['where'][] = 'p.post_time >= ' . $startdate; |
|
391 | + $this->query['where'][] = 'p.post_time >= '.$startdate; |
|
392 | 392 | // END irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query |
393 | 393 | } |
394 | 394 | break; |
395 | 395 | |
396 | 396 | case 'type': |
397 | 397 | if (!empty($val)) { |
398 | - $this->query['where'][] = 't.type_id = ' . $val; |
|
398 | + $this->query['where'][] = 't.type_id = '.$val; |
|
399 | 399 | } |
400 | 400 | break; |
401 | 401 | |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | |
415 | 415 | case 'sort': |
416 | 416 | if ($sort = $this->getSort($val, 'sort')) { |
417 | - $this->query['sort'][] = $sort . (empty($this->vars['order']) ? ' DESC' : ' ASC'); |
|
417 | + $this->query['sort'][] = $sort.(empty($this->vars['order']) ? ' DESC' : ' ASC'); |
|
418 | 418 | } else { // irmtfan if sort is not in the list |
419 | - $this->query['sort'][] = 't.topic_last_post_id' . (empty($this->vars['order']) ? ' DESC' : ' ASC'); |
|
419 | + $this->query['sort'][] = 't.topic_last_post_id'.(empty($this->vars['order']) ? ' DESC' : ' ASC'); |
|
420 | 420 | } |
421 | 421 | break; |
422 | 422 | |
@@ -487,23 +487,23 @@ discard block |
||
487 | 487 | 'title' => _MD_NEWBB_VIEWS, |
488 | 488 | 'sort' => 't.topic_views' |
489 | 489 | ], |
490 | - 'lastpost' => [ // irmtfan show topic_page_jump_icon smarty |
|
490 | + 'lastpost' => [// irmtfan show topic_page_jump_icon smarty |
|
491 | 491 | 'title' => _MD_NEWBB_LASTPOST, |
492 | 492 | /*irmtfan _MD_NEWBB_DATE to _MD_NEWBB_LASTPOSTTIME again change to _MD_LASTPOST*/ |
493 | 493 | 'sort' => 't.topic_last_post_id' |
494 | 494 | ], |
495 | 495 | // START irmtfan add more sorts |
496 | - 'lastposttime' => [ // irmtfan same as lastpost |
|
496 | + 'lastposttime' => [// irmtfan same as lastpost |
|
497 | 497 | 'title' => _MD_NEWBB_LASTPOSTTIME, |
498 | 498 | 'sort' => 't.topic_last_post_id' |
499 | 499 | ], |
500 | - 'lastposter' => [ // irmtfan |
|
500 | + 'lastposter' => [// irmtfan |
|
501 | 501 | 'title' => _MD_NEWBB_POSTER, |
502 | - 'sort' => 'p.uid',// poster uid |
|
502 | + 'sort' => 'p.uid', // poster uid |
|
503 | 503 | ], |
504 | - 'lastpostmsgicon' => [ // irmtfan |
|
504 | + 'lastpostmsgicon' => [// irmtfan |
|
505 | 505 | 'title' => _MD_NEWBB_MESSAGEICON, |
506 | - 'sort' => 'p.icon',// post message icon |
|
506 | + 'sort' => 'p.icon', // post message icon |
|
507 | 507 | ], |
508 | 508 | 'ratings' => [ |
509 | 509 | 'title' => _MD_NEWBB_RATINGS, |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | 'sort' => 't.poll_id' |
535 | 535 | ] |
536 | 536 | ]; |
537 | - $types = $this->getTypes(); |
|
537 | + $types = $this->getTypes(); |
|
538 | 538 | if (!empty($types)) { |
539 | 539 | $headers['type'] = [ |
540 | 540 | 'title' => _MD_NEWBB_TYPE, |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | // additional headers - important: those cannot be in sort anyway |
578 | 578 | $headers = array_merge($headersSort, [ |
579 | 579 | 'attachment' => _MD_NEWBB_TOPICSHASATT, // show attachment smarty |
580 | - 'read' => _MD_NEWBB_MARK_UNREAD . '|' . _MD_NEWBB_MARK_READ, // read/unread show topic_folder smarty |
|
580 | + 'read' => _MD_NEWBB_MARK_UNREAD.'|'._MD_NEWBB_MARK_READ, // read/unread show topic_folder smarty |
|
581 | 581 | 'pagenav' => _MD_NEWBB_PAGENAV_DISPLAY, // show topic_page_jump smarty - sort by topic_replies? |
582 | 582 | ]); |
583 | 583 | |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function getStatus($type = null, $status = null) |
595 | 595 | { |
596 | - $links = [ |
|
596 | + $links = [ |
|
597 | 597 | //"" => "", /* irmtfan remove empty array */ |
598 | 598 | 'all' => _ALL, |
599 | 599 | 'digest' => _MD_NEWBB_DIGEST, |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | |
622 | 622 | // all status, for admin |
623 | 623 | if ($type > 1) { |
624 | - $links = array_merge($links, $links_admin);// irmtfan to accept multiple status |
|
624 | + $links = array_merge($links, $links_admin); // irmtfan to accept multiple status |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | return $this->getFromKeys($links, $status); // irmtfan to accept multiple status |
@@ -635,10 +635,10 @@ discard block |
||
635 | 635 | { |
636 | 636 | $selection = ['action' => $this->page]; |
637 | 637 | $selection['vars'] = $this->vars; |
638 | - require_once __DIR__ . '/../include/functions.forum.php'; |
|
638 | + require_once __DIR__.'/../include/functions.forum.php'; |
|
639 | 639 | $forum_selected = empty($this->vars['forum']) ? null : explode('|', @$this->vars['forum']); |
640 | 640 | $selection['forum'] = '<select name="forum[]" multiple="multiple">'; |
641 | - $selection['forum'] .= '<option value="0">' . _MD_NEWBB_ALL . '</option>'; |
|
641 | + $selection['forum'] .= '<option value="0">'._MD_NEWBB_ALL.'</option>'; |
|
642 | 642 | $selection['forum'] .= newbbForumSelectBox($forum_selected); |
643 | 643 | $selection['forum'] .= '</select>'; |
644 | 644 | |
@@ -649,13 +649,13 @@ discard block |
||
649 | 649 | throw new \RuntimeException('$sorts must be an array.'); |
650 | 650 | } |
651 | 651 | foreach ($sorts as $sort => $title) { |
652 | - $selection['sort'] .= "<option value='" . $sort . "' " . (($sort == $sort_selected) ? " selected='selected'" : '') . '>' . $title . '</option>'; |
|
652 | + $selection['sort'] .= "<option value='".$sort."' ".(($sort == $sort_selected) ? " selected='selected'" : '').'>'.$title.'</option>'; |
|
653 | 653 | } |
654 | 654 | $selection['sort'] .= '</select>'; |
655 | 655 | |
656 | 656 | $selection['order'] = "<select name='order'>"; |
657 | - $selection['order'] .= "<option value='0' " . (empty($this->vars['order']) ? " selected='selected'" : '') . '>' . _DESCENDING . '</option>'; |
|
658 | - $selection['order'] .= "<option value='1' " . (!empty($this->vars['order']) ? " selected='selected'" : '') . '>' . _ASCENDING . '</option>'; |
|
657 | + $selection['order'] .= "<option value='0' ".(empty($this->vars['order']) ? " selected='selected'" : '').'>'._DESCENDING.'</option>'; |
|
658 | + $selection['order'] .= "<option value='1' ".(!empty($this->vars['order']) ? " selected='selected'" : '').'>'._ASCENDING.'</option>'; |
|
659 | 659 | $selection['order'] .= '</select>'; |
660 | 660 | |
661 | 661 | $since = isset($this->vars['since']) ? $this->vars['since'] : $this->config['since_default']; |
@@ -698,10 +698,10 @@ discard block |
||
698 | 698 | foreach ($headers as $header => $title) { |
699 | 699 | $_args = ["sort={$header}"]; |
700 | 700 | if (@$this->vars['sort'] == $header) { |
701 | - $_args[] = 'order=' . ((@$this->vars['order'] + 1) % 2); |
|
701 | + $_args[] = 'order='.((@$this->vars['order'] + 1) % 2); |
|
702 | 702 | } |
703 | 703 | $headers_data[$header]['title'] = $title; |
704 | - $headers_data[$header]['link'] = $this->page . '?' . implode('&', array_merge($args, $_args)); |
|
704 | + $headers_data[$header]['link'] = $this->page.'?'.implode('&', array_merge($args, $_args)); |
|
705 | 705 | } |
706 | 706 | $xoopsTpl->assign_by_ref('headers', $headers_data); |
707 | 707 | } |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | foreach ($links as $link => $title) { |
726 | 726 | $_args = ["status={$link}"]; |
727 | 727 | $status[$link]['title'] = $title; |
728 | - $status[$link]['link'] = $this->page . '?' . implode('&', array_merge($args, $_args)); |
|
728 | + $status[$link]['link'] = $this->page.'?'.implode('&', array_merge($args, $_args)); |
|
729 | 729 | } |
730 | 730 | $xoopsTpl->assign_by_ref('filters', $status); |
731 | 731 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | foreach ($types as $id => $type) { |
774 | 774 | $_args = ["type={$id}"]; |
775 | 775 | $status[$id]['title'] = $type['type_name']; |
776 | - $status[$id]['link'] = $this->page . '?' . implode('&', array_merge($args, $_args)); |
|
776 | + $status[$id]['link'] = $this->page.'?'.implode('&', array_merge($args, $_args)); |
|
777 | 777 | } |
778 | 778 | $xoopsTpl->assign_by_ref('types', $status); |
779 | 779 | } |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | $status = []; |
797 | 797 | $status['title'] = implode(',', $this->getStatus($this->userlevel, $this->vars['status'])); // irmtfan to accept multiple status |
798 | 798 | //$status['link'] = $this->page.(empty($this->vars['status']) ? '' : '?status='.$this->vars['status']); |
799 | - $status['link'] = $this->page . (empty($args) ? '' : '?' . implode('&', $args)); |
|
799 | + $status['link'] = $this->page.(empty($args) ? '' : '?'.implode('&', $args)); |
|
800 | 800 | |
801 | 801 | $xoopsTpl->assign_by_ref('current', $status); |
802 | 802 | } |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
819 | 819 | $nav = new \XoopsPageNav($count_topic, $this->config['topics_per_page'], @$this->vars['start'], 'start', implode('&', $args)); |
820 | 820 | if (isset($GLOBALS['xoopsModuleConfig']['do_rewrite'])) { |
821 | - $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')) . ' /' . $nav->url; |
|
821 | + $nav->url = formatURL(Request::getString('SERVER_NAME', '', 'SERVER')).' /'.$nav->url; |
|
822 | 822 | } |
823 | 823 | if ('select' === $this->config['pagenav_display']) { |
824 | 824 | $navi = $nav->renderSelect(); |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | // topic fields |
851 | 851 | $selects[] = 'COUNT(*)'; |
852 | 852 | |
853 | - $froms[] = $this->handler->db->prefix('newbb_topics') . ' AS t '; |
|
854 | - $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; |
|
853 | + $froms[] = $this->handler->db->prefix('newbb_topics').' AS t '; |
|
854 | + $joins[] = 'LEFT JOIN '.$this->handler->db->prefix('newbb_posts').' AS p ON p.post_id = t.topic_last_post_id'; |
|
855 | 855 | $wheres[] = '1 = 1'; |
856 | 856 | |
857 | - $sql = ' SELECT ' . implode(', ', $selects) . ' FROM ' . implode(', ', $froms) . ' ' . implode(' ', $joins) . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') . // irmtfan bug fix: Undefined index: join when post_excerpt = 0 |
|
858 | - ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']); |
|
857 | + $sql = ' SELECT '.implode(', ', $selects).' FROM '.implode(', ', $froms).' '.implode(' ', $joins).(!empty($this->query['join']) ? ' '.implode(' ', $this->query['join']) : '').// irmtfan bug fix: Undefined index: join when post_excerpt = 0 |
|
858 | + ' WHERE '.implode(' AND ', $wheres).' AND '.@implode(' AND ', @$this->query['where']); |
|
859 | 859 | |
860 | 860 | if (!$result = $this->handler->db->query($sql)) { |
861 | 861 | return 0; |
@@ -896,18 +896,18 @@ discard block |
||
896 | 896 | // post fields |
897 | 897 | $selects[] = 'p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; |
898 | 898 | |
899 | - $froms[] = $this->handler->db->prefix('newbb_topics') . ' AS t '; |
|
900 | - $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; |
|
899 | + $froms[] = $this->handler->db->prefix('newbb_topics').' AS t '; |
|
900 | + $joins[] = 'LEFT JOIN '.$this->handler->db->prefix('newbb_posts').' AS p ON p.post_id = t.topic_last_post_id'; |
|
901 | 901 | $wheres[] = '1 = 1'; |
902 | 902 | |
903 | 903 | if (!empty($this->config['post_excerpt'])) { |
904 | 904 | $selects[] = 'p.post_karma, p.require_reply, pt.post_text'; |
905 | - $this->query['join'][] = 'LEFT JOIN ' . $this->handler->db->prefix('newbb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id'; |
|
905 | + $this->query['join'][] = 'LEFT JOIN '.$this->handler->db->prefix('newbb_posts_text').' AS pt ON pt.post_id = t.topic_last_post_id'; |
|
906 | 906 | } |
907 | 907 | //if (empty($this->query["sort"])) $this->query["sort"][] = 't.topic_last_post_id DESC'; // irmtfan commented no need |
908 | 908 | |
909 | - $sql = ' SELECT ' . implode(', ', $selects) . ' FROM ' . implode(', ', $froms) . ' ' . implode(' ', $joins) . (!empty($this->query['join']) ? ' ' . implode(' ', $this->query['join']) : '') . // irmtfan bug fix: Undefined index join when post_excerpt = 0 |
|
910 | - ' WHERE ' . implode(' AND ', $wheres) . ' AND ' . @implode(' AND ', @$this->query['where']) . ' ORDER BY ' . implode(', ', $this->query['sort']); |
|
909 | + $sql = ' SELECT '.implode(', ', $selects).' FROM '.implode(', ', $froms).' '.implode(' ', $joins).(!empty($this->query['join']) ? ' '.implode(' ', $this->query['join']) : '').// irmtfan bug fix: Undefined index join when post_excerpt = 0 |
|
910 | + ' WHERE '.implode(' AND ', $wheres).' AND '.@implode(' AND ', @$this->query['where']).' ORDER BY '.implode(', ', $this->query['sort']); |
|
911 | 911 | |
912 | 912 | if (!$result = $this->handler->db->query($sql, $this->config['topics_per_page'], @$this->vars['start'])) { |
913 | 913 | if (is_object($xoopsTpl)) { |
@@ -919,11 +919,11 @@ discard block |
||
919 | 919 | return $ret; |
920 | 920 | } |
921 | 921 | |
922 | - require_once __DIR__ . '/../include/functions.render.php'; |
|
923 | - require_once __DIR__ . '/../include/functions.session.php'; |
|
924 | - require_once __DIR__ . '/../include/functions.time.php'; |
|
925 | - require_once __DIR__ . '/../include/functions.read.php'; |
|
926 | - require_once __DIR__ . '/../include/functions.topic.php'; |
|
922 | + require_once __DIR__.'/../include/functions.render.php'; |
|
923 | + require_once __DIR__.'/../include/functions.session.php'; |
|
924 | + require_once __DIR__.'/../include/functions.time.php'; |
|
925 | + require_once __DIR__.'/../include/functions.read.php'; |
|
926 | + require_once __DIR__.'/../include/functions.topic.php'; |
|
927 | 927 | |
928 | 928 | $sticky = 0; |
929 | 929 | $topics = []; |
@@ -942,9 +942,9 @@ discard block |
||
942 | 942 | // START irmtfan remove topic_icon hardcode smarty |
943 | 943 | // topic_icon: just regular topic_icon |
944 | 944 | if (!empty($myrow['icon'])) { |
945 | - $topic_icon = '<img align="middle" src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon'], ENT_QUOTES | ENT_HTML5) . '" alt="" />'; |
|
945 | + $topic_icon = '<img align="middle" src="'.XOOPS_URL.'/images/subject/'.htmlspecialchars($myrow['icon'], ENT_QUOTES | ENT_HTML5).'" alt="" />'; |
|
946 | 946 | } else { |
947 | - $topic_icon = '<img align="middle" src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; |
|
947 | + $topic_icon = '<img align="middle" src="'.XOOPS_URL.'/images/icons/no_posticon.gif" alt="" />'; |
|
948 | 948 | } |
949 | 949 | // END irmtfan remove topic_icon hardcode smarty |
950 | 950 | |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | if ($rating < 1) { |
956 | 956 | $rating_img = newbbDisplayImage('blank'); |
957 | 957 | } else { |
958 | - $rating_img = newbbDisplayImage('rate' . $rating, constant('_MD_NEWBB_RATE' . $rating)); |
|
958 | + $rating_img = newbbDisplayImage('rate'.$rating, constant('_MD_NEWBB_RATE'.$rating)); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | // ------------------------------------------------------ |
@@ -965,22 +965,22 @@ discard block |
||
965 | 965 | $totalpages = ceil(($myrow['topic_replies'] + 1) / $this->config['posts_per_page']); |
966 | 966 | if ($totalpages > 1) { |
967 | 967 | $topic_page_jump .= ' '; |
968 | - $append = false; |
|
968 | + $append = false; |
|
969 | 969 | for ($i = 1; $i <= $totalpages; ++$i) { |
970 | 970 | if ($i > 3 && $i < $totalpages) { |
971 | 971 | if (!$append) { |
972 | 972 | $topic_page_jump .= '...'; |
973 | - $append = true; |
|
973 | + $append = true; |
|
974 | 974 | } |
975 | 975 | } else { |
976 | - $topic_page_jump .= '[<a href="' . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . (($i - 1) * $this->config['posts_per_page']) . '">' . $i . '</a>]'; |
|
976 | + $topic_page_jump .= '[<a href="'.XOOPS_URL.'/modules/newbb/viewtopic.php?topic_id='.$myrow['topic_id'].'&start='.(($i - 1) * $this->config['posts_per_page']).'">'.$i.'</a>]'; |
|
977 | 977 | // irmtfan remove here and move |
978 | 978 | //$topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "&start=" . (($i - 1) * $this->config['posts_per_page']) . "" . "'>" . newbbDisplayImage('document',_MD_NEWBB_GOTOLASTPOST) . '</a>'; |
979 | 979 | } |
980 | 980 | } |
981 | 981 | } |
982 | 982 | // irmtfan - move here for both topics with and without pages - change topic_id to post_id |
983 | - $topic_page_jump_icon = "<a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?post_id=' . $myrow['topic_last_post_id'] . '' . "'>" . newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST) . '</a>'; |
|
983 | + $topic_page_jump_icon = "<a href='".XOOPS_URL.'/modules/newbb/viewtopic.php?post_id='.$myrow['topic_last_post_id'].''."'>".newbbDisplayImage('lastposticon', _MD_NEWBB_GOTOLASTPOST).'</a>'; |
|
984 | 984 | |
985 | 985 | // ------------------------------------------------------ |
986 | 986 | // => topic array |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | 'topic_title_excerpt' => $topic_title_excerpt, |
1013 | 1013 | //irmtfan use topic_title_excerpt |
1014 | 1014 | //'topic_link' => XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $myrow['topic_id'], // . '&forum=' . $myrow['forum_id'], // irmtfan comment |
1015 | - 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'], |
|
1015 | + 'topic_link' => 'viewtopic.php?topic_id='.$myrow['topic_id'], |
|
1016 | 1016 | // irmtfan remove hardcode link |
1017 | 1017 | 'rating_img' => $rating_img, |
1018 | 1018 | 'votes' => $myrow['votes'], |
@@ -1071,14 +1071,14 @@ discard block |
||
1071 | 1071 | $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
1072 | 1072 | |
1073 | 1073 | if (count($forums) > 0) { |
1074 | - $forum_list = $forumHandler->getAll(new \Criteria('forum_id', '(' . implode(', ', array_keys($forums)) . ')', 'IN'), ['forum_name', 'hot_threshold'], false); |
|
1074 | + $forum_list = $forumHandler->getAll(new \Criteria('forum_id', '('.implode(', ', array_keys($forums)).')', 'IN'), ['forum_name', 'hot_threshold'], false); |
|
1075 | 1075 | } else { |
1076 | 1076 | $forum_list = $forumHandler->getAll(); |
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | foreach (array_keys($topics) as $id) { |
1080 | 1080 | $topics[$id]['topic_read'] = empty($topic_isRead[$id]) ? 0 : 1; // add topic-read/topic-new smarty variable |
1081 | - $topics[$id]['topic_forum_link'] = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $topics[$id]['topic_forum'] . '">' . $forum_list[$topics[$id]['topic_forum']]['forum_name'] . '</a>'; |
|
1081 | + $topics[$id]['topic_forum_link'] = '<a href="'.XOOPS_URL.'/modules/newbb/viewforum.php?forum='.$topics[$id]['topic_forum'].'">'.$forum_list[$topics[$id]['topic_forum']]['forum_name'].'</a>'; |
|
1082 | 1082 | |
1083 | 1083 | //irmtfan use topic_title_excerpt -- add else |
1084 | 1084 | if (!empty($topics[$id]['type_id']) && isset($type_list[$topics[$id]['type_id']])) { |
@@ -1112,14 +1112,14 @@ discard block |
||
1112 | 1112 | $topics[$id]['topic_folder'] = newbbDisplayImage($topic_folder, $topic_folder_text); |
1113 | 1113 | // END irmtfan - add topic_folder_text for alt |
1114 | 1114 | |
1115 | - unset($topics[$id]['topic_poster_name'], $topics[$id]['topic_last_poster_name']);// irmtfan remove $topics[$id]["stats"] because it is not exist now |
|
1115 | + unset($topics[$id]['topic_poster_name'], $topics[$id]['topic_last_poster_name']); // irmtfan remove $topics[$id]["stats"] because it is not exist now |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | 1118 | if (count($topics) > 0) { |
1119 | - $sql = ' SELECT DISTINCT topic_id FROM ' . $this->handler->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')'; |
|
1119 | + $sql = ' SELECT DISTINCT topic_id FROM '.$this->handler->db->prefix('newbb_posts')." WHERE attachment != ''".' AND topic_id IN ('.implode(',', array_keys($topics)).')'; |
|
1120 | 1120 | if ($result = $this->handler->db->query($sql)) { |
1121 | 1121 | while (false !== (list($topic_id) = $this->handler->db->fetchRow($result))) { |
1122 | - $topics[$topic_id]['attachment'] = ' ' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT); |
|
1122 | + $topics[$topic_id]['attachment'] = ' '.newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT); |
|
1123 | 1123 | } |
1124 | 1124 | } |
1125 | 1125 | } |