Passed
Branch master (dd6e46)
by Michael
03:32
created
class/CategoryHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         if (!$valid_ids = $this->getIdsByPermission($permission)) {
51 51
             return $categories;
52 52
         }
53
-        $criteria = new \Criteria('cat_id', '(' . implode(', ', $valid_ids) . ')', 'IN');
53
+        $criteria = new \Criteria('cat_id', '('.implode(', ', $valid_ids).')', 'IN');
54 54
         $criteria->setSort('cat_order');
55 55
         $categories = $this->getAll($criteria, $tags, $asObject);
56 56
 
Please login to merge, or discard this patch.
class/PermissionHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         if (!isset($this->_handler[$name])) {
52 52
 //            require_once __DIR__ . "/permission.{$name}.php";
53
-            $className             = '\\XoopsModules\\Newbb\\Permission' . ucfirst($name) . 'Handler';
53
+            $className             = '\\XoopsModules\\Newbb\\Permission'.ucfirst($name).'Handler';
54 54
             $this->_handler[$name] = new $className($this->db);
55 55
         }
56 56
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             $criteria->add(new \Criteria('gperm_groupid', $groupid));
378 378
             $criteria->add(new \Criteria('gperm_itemid', $itemid));
379 379
             $criteria->add(new \Criteria('gperm_modid', $mid));
380
-            $permsObject =& $this->getObjects($criteria);
380
+            $permsObject = & $this->getObjects($criteria);
381 381
             if (!empty($permsObject)) {
382 382
                 foreach ($permsObject as $permObject) {
383 383
                     $this->delete($permObject);
Please login to merge, or discard this patch.
class/UserstatsHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
         if (empty($id)) {
83 83
             return null;
84 84
         }
85
-        $sql = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->keyName . ' = ' . (int)$id;
85
+        $sql = 'SELECT * FROM '.$this->table.' WHERE '.$this->keyName.' = '.(int)$id;
86 86
         if (!$result = $this->db->query($sql)) {
87 87
             return null;
88 88
         }
Please login to merge, or discard this patch.
class/ReportHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         if (!is_array($posts)) {
41 41
             $posts = [$posts];
42 42
         }
43
-        $post_criteria = new \Criteria('post_id', '(' . implode(', ', $posts) . ')', 'IN');
43
+        $post_criteria = new \Criteria('post_id', '('.implode(', ', $posts).')', 'IN');
44 44
         $ret           = $this->getAll($post_criteria);
45 45
 
46 46
         return $ret;
@@ -79,18 +79,18 @@  discard block
 block discarded – undo
79 79
         if (empty($start)) {
80 80
             $start = 0;
81 81
         }
82
-        $result_criteria = ' AND r.report_result = ' . $report_result;
82
+        $result_criteria = ' AND r.report_result = '.$report_result;
83 83
 
84 84
         if ($forums) {
85 85
             $forumCriteria = '';
86 86
         } elseif (!is_array($forums)) {
87 87
             $forums        = [$forums];
88
-            $forumCriteria = ' AND p.forum_id IN (' . implode(',', $forums) . ')';
88
+            $forumCriteria = ' AND p.forum_id IN ('.implode(',', $forums).')';
89 89
         }
90
-        $tables_criteria = ' FROM ' . $this->db->prefix('newbb_report') . ' r, ' . $this->db->prefix('newbb_posts') . ' p WHERE r.post_id= p.post_id';
90
+        $tables_criteria = ' FROM '.$this->db->prefix('newbb_report').' r, '.$this->db->prefix('newbb_posts').' p WHERE r.post_id= p.post_id';
91 91
 
92 92
         if ($report_id) {
93
-            $result = $this->db->query('SELECT COUNT(*) as report_count' . $tables_criteria . $forumCriteria . $result_criteria . " AND report_id $operator_for_position $report_id" . $order_criteria);
93
+            $result = $this->db->query('SELECT COUNT(*) as report_count'.$tables_criteria.$forumCriteria.$result_criteria." AND report_id $operator_for_position $report_id".$order_criteria);
94 94
             if ($result) {
95 95
                 $row = $this->db->fetchArray($result);
96 96
             }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             $start    = (int)($position / $perpage) * $perpage;
99 99
         }
100 100
 
101
-        $sql    = 'SELECT r.*, p.subject, p.topic_id, p.forum_id' . $tables_criteria . $forumCriteria . $result_criteria . $order_criteria;
101
+        $sql    = 'SELECT r.*, p.subject, p.topic_id, p.forum_id'.$tables_criteria.$forumCriteria.$result_criteria.$order_criteria;
102 102
         $result = $this->db->query($sql, $perpage, $start);
103 103
         $ret    = [];
104 104
         //$reportHandler =  Newbb\Helper::getInstance()->getHandler('Report');
Please login to merge, or discard this patch.
class/Common/VersionChecks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
         //check for minimum XOOPS version
38 38
         $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
39 39
         if (null === $requiredVer) {
40
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
40
+            $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string
41 41
         }
42 42
         $success = true;
43 43
 
44 44
         if (version_compare($currentVer, $requiredVer, '<')) {
45 45
             $success = false;
46
-            $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
46
+            $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
47 47
         }
48 48
 
49 49
         return $success;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $reqVer  = $module->getInfo('min_php');
67 67
         if (false !== $reqVer && '' !== $reqVer) {
68 68
             if (version_compare($verNum, $reqVer, '<')) {
69
-                $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
69
+                $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum));
70 70
                 $success = false;
71 71
             }
72 72
         }
Please login to merge, or discard this patch.
class/Common/FilesManagement.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
                     throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
33 33
                 }
34 34
 
35
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
35
+                file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
36 36
             }
37 37
         } catch (\Exception $e) {
38 38
             echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
         if (!mkdir($dst) && !is_dir($dst)) {
61 61
             while (false !== ($file = readdir($dir))) {
62 62
                 if (('.' !== $file) && ('..' !== $file)) {
63
-                    if (is_dir($src . '/' . $file)) {
64
-                        self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
63
+                    if (is_dir($src.'/'.$file)) {
64
+                        self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
65 65
                     } else {
66
-                        copy($src . '/' . $file, $dst . '/' . $file);
66
+                        copy($src.'/'.$file, $dst.'/'.$file);
67 67
                     }
68 68
                 }
69 69
             }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 self::rrmdir($fObj->getPathname());
159 159
             }
160 160
         }
161
-        $iterator = null;   // clear iterator Obj to close file/directory
161
+        $iterator = null; // clear iterator Obj to close file/directory
162 162
         return rmdir($src); // remove the directory & return results
163 163
     }
164 164
 
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
         $iterator = new \DirectoryIterator($src);
192 192
         foreach ($iterator as $fObj) {
193 193
             if ($fObj->isFile()) {
194
-                rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
194
+                rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
195 195
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
196 196
                 // Try recursively on directory
197
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
197
+                self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
198 198
                 //                rmdir($fObj->getPath()); // now delete the directory
199 199
             }
200 200
         }
201
-        $iterator = null;   // clear iterator Obj to close file/directory
201
+        $iterator = null; // clear iterator Obj to close file/directory
202 202
         return rmdir($src); // remove the directory & return results
203 203
     }
204 204
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
         $iterator = new \DirectoryIterator($src);
235 235
         foreach ($iterator as $fObj) {
236 236
             if ($fObj->isFile()) {
237
-                copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
237
+                copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
238 238
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
239
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
239
+                self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
240 240
             }
241 241
         }
242 242
         return true;
Please login to merge, or discard this patch.
class/Common/Breadcrumb.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         require_once $GLOBALS['xoops']->path('class/template.php');
71 71
         $breadcrumbTpl = new \XoopsTpl();
72 72
         $breadcrumbTpl->assign('breadcrumb', $this->bread);
73
-        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
73
+        $html = $breadcrumbTpl->fetch('db:'.$this->dirname.'_common_breadcrumb.tpl');
74 74
         unset($breadcrumbTpl);
75 75
 
76 76
         return $html;
Please login to merge, or discard this patch.
class/Migrate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
                 $this->synchronizeTable($tableName);
103 103
                 $updateTable = $GLOBALS['xoopsDB']->prefix($tableName);
104 104
                 $joinTable   = $GLOBALS['xoopsDB']->prefix($srcTableName);
105
-                $sql         = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . '  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
105
+                $sql         = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n"."SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n".'  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
106 106
                 $this->tableHandler->addToQueue($sql);
107 107
             }
108 108
         }
Please login to merge, or discard this patch.
class/PostHandler.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $id   = (int)$id;
60 60
         $post = null;
61
-        $sql  = 'SELECT p.*, t.* FROM ' . $this->db->prefix('newbb_posts') . ' p LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' t ON p.post_id=t.post_id WHERE p.post_id=' . $id;
61
+        $sql  = 'SELECT p.*, t.* FROM '.$this->db->prefix('newbb_posts').' p LEFT JOIN '.$this->db->prefix('newbb_posts_text').' t ON p.post_id=t.post_id WHERE p.post_id='.$id;
62 62
         if ($array = $this->db->fetchArray($this->db->query($sql))) {
63 63
             $post = $this->create(false);
64 64
             $post->assignVars($array);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $topic_id = 0,
88 88
         $approved = 1
89 89
     ) {
90
-        $sql    = 'SELECT p.*, t.*, tp.topic_status FROM '
90
+        $sql = 'SELECT p.*, t.*, tp.topic_status FROM '
91 91
                   . $this->db->prefix('newbb_posts')
92 92
                   . ' p LEFT JOIN '
93 93
                   . $this->db->prefix('newbb_posts_text')
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
 
381 381
         /* Set active post as deleted */
382 382
         if ($post->getVar('approved') > 0 && empty($force)) {
383
-            $sql = 'UPDATE ' . $this->db->prefix('newbb_posts') . ' SET approved = -1 WHERE post_id = ' . $post->getVar('post_id');
383
+            $sql = 'UPDATE '.$this->db->prefix('newbb_posts').' SET approved = -1 WHERE post_id = '.$post->getVar('post_id');
384 384
             if (!$result = $this->db->queryF($sql)) {
385 385
             }
386 386
             /* delete pending post directly */
387 387
         } else {
388 388
             $sql = sprintf('DELETE FROM `%s` WHERE post_id = %u', $this->db->prefix('newbb_posts'), $post->getVar('post_id'));
389 389
             if (!$result = $this->db->queryF($sql)) {
390
-                $post->setErrors('delete post error: ' . $sql);
390
+                $post->setErrors('delete post error: '.$sql);
391 391
 
392 392
                 return false;
393 393
             }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
             $sql = sprintf('DELETE FROM %s WHERE post_id = %u', $this->db->prefix('newbb_posts_text'), $post->getVar('post_id'));
397 397
             if (!$result = $this->db->queryF($sql)) {
398
-                $post->setErrors('Could not remove post text: ' . $sql);
398
+                $post->setErrors('Could not remove post text: '.$sql);
399 399
 
400 400
                 return false;
401 401
             }
@@ -432,11 +432,11 @@  discard block
 block discarded – undo
432 432
                 }
433 433
             }
434 434
         } else {
435
-            $sql = 'UPDATE ' . $this->db->prefix('newbb_topics') . ' t
436
-                            LEFT JOIN ' . $this->db->prefix('newbb_posts') . ' p ON p.topic_id = t.topic_id
435
+            $sql = 'UPDATE '.$this->db->prefix('newbb_topics').' t
436
+                            LEFT JOIN ' . $this->db->prefix('newbb_posts').' p ON p.topic_id = t.topic_id
437 437
                             SET t.topic_last_post_id = p.post_id
438
-                            WHERE t.topic_last_post_id = ' . $post->getVar('post_id') . '
439
-                                    AND p.post_id = (SELECT MAX(post_id) FROM ' . $this->db->prefix('newbb_posts') . ' WHERE topic_id=t.topic_id)';
438
+                            WHERE t.topic_last_post_id = ' . $post->getVar('post_id').'
439
+                                    AND p.post_id = (SELECT MAX(post_id) FROM ' . $this->db->prefix('newbb_posts').' WHERE topic_id=t.topic_id)';
440 440
             if (!$result = $this->db->queryF($sql)) {
441 441
             }
442 442
         }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
             }
459 459
             // irmtfan - just update the pid for approved posts when the post is not topic (pid=0)
460 460
             if (!$post->isTopic()) {
461
-                $sql = 'UPDATE ' . $this->db->prefix('newbb_posts') . ' SET pid = ' . $post->getVar('pid') . ' WHERE approved=1 AND pid=' . $post->getVar('post_id');
461
+                $sql = 'UPDATE '.$this->db->prefix('newbb_posts').' SET pid = '.$post->getVar('pid').' WHERE approved=1 AND pid='.$post->getVar('post_id');
462 462
                 if (!$result = $this->db->queryF($sql)) {
463 463
                     //xoops_error($this->db->error());
464 464
                 }
@@ -482,12 +482,12 @@  discard block
 block discarded – undo
482 482
             return parent::getCount($criteria);
483 483
         }
484 484
 
485
-        $sql = 'SELECT COUNT(*) as count' . ' FROM ' . $this->db->prefix('newbb_posts') . ' AS p' . ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' AS t ON t.post_id = p.post_id';
485
+        $sql = 'SELECT COUNT(*) as count'.' FROM '.$this->db->prefix('newbb_posts').' AS p'.' LEFT JOIN '.$this->db->prefix('newbb_posts_text').' AS t ON t.post_id = p.post_id';
486 486
         // LEFT JOIN
487 487
         $sql .= $join;
488 488
         // WHERE
489 489
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
490
-            $sql .= ' ' . $criteria->renderWhere();
490
+            $sql .= ' '.$criteria->renderWhere();
491 491
         }
492 492
         if (!$result = $this->db->query($sql)) {
493 493
             //xoops_error($this->db->error().'<br>'.$sql);
@@ -512,14 +512,14 @@  discard block
 block discarded – undo
512 512
     public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join = null)
513 513
     {
514 514
         $ret = [];
515
-        $sql = 'SELECT p.*, t.* ' . ' FROM ' . $this->db->prefix('newbb_posts') . ' AS p' . ' LEFT JOIN ' . $this->db->prefix('newbb_posts_text') . ' AS t ON t.post_id = p.post_id';
515
+        $sql = 'SELECT p.*, t.* '.' FROM '.$this->db->prefix('newbb_posts').' AS p'.' LEFT JOIN '.$this->db->prefix('newbb_posts_text').' AS t ON t.post_id = p.post_id';
516 516
         if (!empty($join)) {
517 517
             $sql .= $join;
518 518
         }
519 519
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
520
-            $sql .= ' ' . $criteria->renderWhere();
520
+            $sql .= ' '.$criteria->renderWhere();
521 521
             if ('' !== $criteria->getSort()) {
522
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
522
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
523 523
             }
524 524
         }
525 525
         $result = $this->db->query($sql, (int)$limit, (int)$start);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
         parent::cleanOrphan($this->db->prefix('newbb_topics'), 'topic_id');
561 561
         parent::cleanOrphan($this->db->prefix('newbb_posts_text'), 'post_id');
562 562
 
563
-        $sql = 'DELETE FROM ' . $this->db->prefix('newbb_posts_text') . ' WHERE (post_id NOT IN ( SELECT DISTINCT post_id FROM ' . $this->table . ') )';
563
+        $sql = 'DELETE FROM '.$this->db->prefix('newbb_posts_text').' WHERE (post_id NOT IN ( SELECT DISTINCT post_id FROM '.$this->table.') )';
564 564
         if (!$result = $this->db->queryF($sql)) {
565 565
             //xoops_error($this->db->error());
566 566
             return false;
Please login to merge, or discard this patch.