Passed
Push — master ( 4990f6...882d2a )
by Michael
03:01
created
class/User.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
class/Common/ServerStats.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
         //        $sql   .= " WHERE metakey='version' LIMIT 1";
35 35
         //        $query = $GLOBALS['xoopsDB']->query($sql);
36 36
         //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
-        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
37
+        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>".constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO')."</legend>\n";
38 38
         $html .= "<div style='padding: 8px;'>\n";
39 39
         //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40 40
         //        $html .= "<br>\n";
41 41
         //        $html .= "<br>\n";
42
-        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
42
+        $html .= '<div>'.constant('CO_'.$moduleDirNameUpper.'_SPHPINI')."</div>\n";
43 43
         $html .= "<ul>\n";
44 44
         //
45
-        $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
-        $html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
45
+        $gdlib = function_exists('gd_info') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>';
46
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib;
47 47
         if (function_exists('gd_info')) {
48 48
             if (true === ($gdlib = gd_info())) {
49
-                $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
49
+                $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>';
50 50
             }
51 51
         }
52 52
         //
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
         //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57 57
         //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58 58
         //
59
-        $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
-        $html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
59
+        $downloads = ini_get('file_uploads') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>';
60
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads;
61 61
         //
62
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
62
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: blue;">'.ini_get('upload_max_filesize')."</span></b>\n";
63
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: blue;">'.ini_get('post_max_size')."</span></b>\n";
64
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: blue;">'.ini_get('memory_limit')."</span></b>\n";
65 65
         $html .= "</ul>\n";
66 66
         $html .= "<ul>\n";
67
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
67
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH."</b>\n";
68 68
         $html .= "</ul>\n";
69 69
         $html .= "<br>\n";
70
-        $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
70
+        $html .= constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC')."\n";
71 71
         $html .= '</div>';
72 72
         $html .= '</fieldset><br>';
73 73
 
Please login to merge, or discard this patch.
class/Common/Configurator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  */
22 22
 
23
-require_once __DIR__ . '/../../include/common.php';
23
+require_once __DIR__.'/../../include/common.php';
24 24
 
25 25
 /**
26 26
  * Class Configurator
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $moduleDirName = basename(dirname(__DIR__));
46 46
         $capsDirName   = strtoupper($moduleDirName);
47 47
 
48
-        require_once __DIR__ . '/../../include/config.php';
48
+        require_once __DIR__.'/../../include/config.php';
49 49
         $config = getConfig();
50 50
 
51 51
         $this->name            = $config->name;
Please login to merge, or discard this patch.
class/StatsHandler.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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}"
Please login to merge, or discard this patch.
class/ForumHandler.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
332 332
             $totalpages           = ceil(($myrow['topic_replies'] + 1) / $GLOBALS['xoopsModuleConfig']['posts_per_page']);
333 333
             if ($totalpages > 1) {
334 334
                 $topic_page_jump .= '&nbsp;&nbsp;';
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'] . '&amp;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'].'&amp;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'] . "&amp;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 (false !== (list($topic_id) = $this->db->fetchRow($result))) {
462
-                    $topics[$topic_id]['attachment'] = '&nbsp;' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT);
462
+                    $topics[$topic_id]['attachment'] = '&nbsp;'.newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT);
463 463
                 }
464 464
             }
465 465
         }
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
572 572
             return true;
573 573
         }
574 574
 
575
-        require_once __DIR__ . '/../include/functions.user.php';
575
+        require_once __DIR__.'/../include/functions.user.php';
576 576
         if (newbbIsAdmin($forum)) {
577 577
             return true;
578 578
         }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
class/Topic.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
74 74
             return $topic_title;
75 75
         }
76 76
 
77
-        require_once __DIR__ . '/../include/functions.topic.php';
77
+        require_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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
class/OnlineHandler.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -252,18 +252,18 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
17 17
 
18
-require_once __DIR__ . '/../include/functions.config.php';
18
+require_once __DIR__.'/../include/functions.config.php';
19 19
 
20 20
 /**
21 21
  * Class OnlineHandler
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function render(\Smarty $xoopsTpl)
98 98
     {
99
-        require_once __DIR__ . '/../include/functions.render.php';
100
-        require_once __DIR__ . '/../include/functions.user.php';
99
+        require_once __DIR__.'/../include/functions.render.php';
100
+        require_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
 block discarded – undo
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
 block discarded – undo
155 155
      */
156 156
     public function showOnline()
157 157
     {
158
-        require_once __DIR__ . '/../include/functions.render.php';
159
-        require_once __DIR__ . '/../include/functions.user.php';
158
+        require_once __DIR__.'/../include/functions.render.php';
159
+        require_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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
class/DigestHandler.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -214,18 +214,18 @@
 block discarded – undo
214 214
         $reply_criteria = $GLOBALS['xoopsModuleConfig']['allow_require_reply'] ? ' AND p.require_reply=0' : '';
215 215
 
216 216
         $query = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_time, t.digest_time, p.uid, p.poster_name, pt.post_text FROM '
217
-                 . $this->db->prefix('newbb_topics')
218
-                 . ' t, '
219
-                 . $this->db->prefix('newbb_posts_text')
220
-                 . ' pt, '
221
-                 . $this->db->prefix('newbb_posts')
222
-                 . ' p WHERE t.topic_digest = 1 AND p.topic_id=t.topic_id AND p.pid=0 '
223
-                 . $forumCriteria
224
-                 . $approveCriteria
225
-                 . $time_criteria
226
-                 . $karma_criteria
227
-                 . $reply_criteria
228
-                 . ' AND pt.post_id=p.post_id ORDER BY t.digest_time DESC';
217
+                    . $this->db->prefix('newbb_topics')
218
+                    . ' t, '
219
+                    . $this->db->prefix('newbb_posts_text')
220
+                    . ' pt, '
221
+                    . $this->db->prefix('newbb_posts')
222
+                    . ' p WHERE t.topic_digest = 1 AND p.topic_id=t.topic_id AND p.pid=0 '
223
+                    . $forumCriteria
224
+                    . $approveCriteria
225
+                    . $time_criteria
226
+                    . $karma_criteria
227
+                    . $reply_criteria
228
+                    . ' AND pt.post_id=p.post_id ORDER BY t.digest_time DESC';
229 229
         if (!$result = $this->db->query($query)) {
230 230
             //echo "<br>No result:<br>$query";
231 231
             return false;
Please login to merge, or discard this patch.
class/ReadForumHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
 use XoopsModules\Newbb;
34 34
 
35
-require_once __DIR__ . '/read.php';
35
+require_once __DIR__.'/read.php';
36 36
 
37 37
 /**
38 38
  * A handler for read/unread handling
Please login to merge, or discard this patch.