Completed
Push — master ( 783e10...2dcfb9 )
by Dimas
08:03
created
etc/superuser/index-f.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 if (isset($_POST['config'])) {
8 8
   unset($_POST['config']);
9
-  array_walk_recursive($_POST, function (&$key, $value) {
9
+  array_walk_recursive($_POST, function(&$key, $value) {
10 10
     if (preg_match('/^(true|false)$/s', $key, $match)) {
11 11
       if ($match[0] == 'true') {
12 12
         $key = true;
Please login to merge, or discard this patch.
etc/superuser/npm/index-f.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php
2
-if (!user()->is_admin()){
2
+if (!user()->is_admin()) {
3 3
   safe_redirect('/');
4 4
 }
5 5
\ No newline at end of file
Please login to merge, or discard this patch.
etc/superuser/npm/registry.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 if (isset($package['devDependencies'])) {
23 23
   $packages = array_merge($package['devDependencies'], $packages);
24 24
 }
25
-$packages = array_map(function ($pkg) {
25
+$packages = array_map(function($pkg) {
26 26
   //var_dump($pkg);
27 27
   if (false === strpos($pkg, '@types/')) {
28 28
     return $pkg;
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
   }
32 32
 }, array_keys($packages));
33 33
 $packages = array_values(array_filter($packages));
34
-$packages = array_map(function ($pkg) {
34
+$packages = array_map(function($pkg) {
35 35
   return "@types/$pkg";
36 36
 }, $packages);
37 37
 
38 38
 if (isset($package['devDependencies'])) {
39
-  array_map(function ($types) {
39
+  array_map(function($types) {
40 40
     $package['devDependencies'][$types] = '*';
41 41
   }, $packages);
42 42
 }
43 43
 
44 44
 \Filemanager\file::file($location, $package, true);
45 45
 
46
-$cmd = function ($pkg) {
46
+$cmd = function($pkg) {
47 47
   return 'cd ' . ROOT . ' && echo "Installing ' . $pkg . ' On %cd%" && ';
48 48
 };
49 49
 
Please login to merge, or discard this patch.
etc/superuser/coupon/list.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 $data = $p->fetchAll();
36 36
 $result['recordsTotal'] = count($data);
37 37
 $result['recordsFiltered'] = (int) count($data);
38
-$data_filter = array_map(function ($map_data) {
38
+$data_filter = array_map(function($map_data) {
39 39
   $i = 0;
40 40
   foreach ($map_data as $key => $value) {
41 41
     if (is_numeric($value)) {
Please login to merge, or discard this patch.
src/DB/pdo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
    *
140 140
    * @return $this
141 141
    */
142
-  public function switch(string $dbname)
142
+  public function switch (string $dbname)
143 143
   {
144 144
     $this->query('USE ' . $dbname)->exec();
145 145
 
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
     $this->query = '';
725 725
     if ($filter) {
726 726
       if (!empty($exec) && is_array($exec)) {
727
-        $filtered = array_map(function ($data) use ($filter) {
727
+        $filtered = array_map(function($data) use ($filter) {
728 728
           if (isset($data[$filter])) {
729 729
             return $data[$filter];
730 730
           }
Please login to merge, or discard this patch.
etc/server/websocket/websockets.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
   protected function checkHost($hostName)
264 264
   {
265 265
     return true; // Override and return false if the host is not one that you would expect.
266
-     // Ex: You only want to accept hosts from the my-domain.com domain,
267
-     // but you receive a host from malicious-site.com instead.
266
+      // Ex: You only want to accept hosts from the my-domain.com domain,
267
+      // but you receive a host from malicious-site.com instead.
268 268
   }
269 269
 
270 270
   protected function checkOrigin($origin)
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
   protected function processProtocol($protocol)
286 286
   {
287 287
     return ''; // return either "Sec-WebSocket-Protocol: SelectedProtocolFromClientList\r\n" or return an empty string.
288
-     // The carriage return/newline combo must appear at the end of a non-empty string, and must not
289
-     // appear at the beginning of the string nor in an otherwise empty string, or it will be considered part of
290
-     // the response body, which will trigger an error in the client as it will not be formatted correctly.
288
+      // The carriage return/newline combo must appear at the end of a non-empty string, and must not
289
+      // appear at the beginning of the string nor in an otherwise empty string, or it will be considered part of
290
+      // the response body, which will trigger an error in the client as it will not be formatted correctly.
291 291
   }
292 292
 
293 293
   protected function processExtensions($extensions)
Please login to merge, or discard this patch.
etc/server/msisdn.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
   $pdo->where(['simcard' => strtolower($_REQUEST['simcard'])]);
6 6
 }
7 7
 $row = $pdo->row_array();
8
-$row = array_map(function ($db) {
8
+$row = array_map(function($db) {
9 9
   if (isset($db['msisdn'])) {
10 10
     if (strlen($db['msisdn']) <= 7) return;
11 11
     return $db['msisdn'];
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@
 block discarded – undo
7 7
 $row = $pdo->row_array();
8 8
 $row = array_map(function ($db) {
9 9
   if (isset($db['msisdn'])) {
10
-    if (strlen($db['msisdn']) <= 7) return;
10
+    if (strlen($db['msisdn']) <= 7) {
11
+      return;
12
+    }
11 13
     return $db['msisdn'];
12 14
   }
13 15
 }, $row);
Please login to merge, or discard this patch.
etc/server/comments/func.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@
 block discarded – undo
19 19
     $url .= "?s=$s&d=$d&r=$r";
20 20
     if ($img) {
21 21
         $url = '<img src="' . $url . '"';
22
-        foreach ($atts as $key => $val)
23
-            $url .= ' ' . $key . '="' . $val . '"';
22
+        foreach ($atts as $key => $val) {
23
+                    $url .= ' ' . $key . '="' . $val . '"';
24
+        }
24 25
         $url .= ' />';
25 26
     }
26 27
     return $url;
Please login to merge, or discard this patch.
etc/server/comments/class.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     return $html;
346 346
   }
347 347
 
348
-  function generateForm($location =  '', $type = 0, $comment = false)
348
+  function generateForm($location = '', $type = 0, $comment = false)
349 349
   {
350 350
     $this->setToken();
351 351
     if ($location == '')
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
     $sql = "SELECT `id` FROM `" . $this->settings['comments_table'] . "` WHERE `parent` = 0 ";
736 736
 
737 737
     if ($pageid)
738
-      $sql .=  " AND `pageid`='" . (int) $pageid . "'";
738
+      $sql .= " AND `pageid`='" . (int) $pageid . "'";
739 739
 
740 740
 
741 741
     $total = mysqli_num_rows(mysqli_query($this->link, $sql));
Please login to merge, or discard this patch.
Braces   +143 added lines, -97 removed lines patch added patch discarded remove patch
@@ -47,13 +47,16 @@  discard block
 block discarded – undo
47 47
    */
48 48
   function __construct($db_details, $settings = array())
49 49
   {
50
-    if (session_id() == '')
51
-      session_start();
50
+    if (session_id() == '') {
51
+          session_start();
52
+    }
52 53
 
53 54
     // we first manage the mysql connection
54 55
     $this->link = @mysqli_connect($db_details['db_host'], $db_details['db_user'], $db_details['db_pass']);
55 56
 
56
-    if (!$this->link) die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
57
+    if (!$this->link) {
58
+      die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
59
+    }
57 60
 
58 61
     mysqli_select_db($this->link, $db_details['db_name']) or die(mysqli_error($this->link));
59 62
 
@@ -63,8 +66,9 @@  discard block
 block discarded – undo
63 66
     $this->settings['comments_table'] = str_replace("`", "``", $this->settings['comments_table']);
64 67
 
65 68
     // auto install
66
-    if ($this->settings['auto_install'] && !@mysqli_num_rows(mysqli_query($this->link, "SELECT `id` FROM `" . $this->settings['comments_table'] . "`")))
67
-      $this->install();
69
+    if ($this->settings['auto_install'] && !@mysqli_num_rows(mysqli_query($this->link, "SELECT `id` FROM `" . $this->settings['comments_table'] . "`"))) {
70
+          $this->install();
71
+    }
68 72
 
69 73
 
70 74
     // edit comment
@@ -79,17 +83,21 @@  discard block
 block discarded – undo
79 83
 
80 84
 
81 85
     // delete comment
82
-    if (isset($_POST['comm_del']))
83
-      if ($this->delComm($_POST['comm_del']))
86
+    if (isset($_POST['comm_del'])) {
87
+          if ($this->delComm($_POST['comm_del']))
84 88
         $this->success = "Comment deleted !";
89
+    }
85 90
 
86 91
     // bann ip
87
-    if (isset($_GET['comm_ban']) && $this->banIP($_GET['comm_ban'])) // we banned the ip
92
+    if (isset($_GET['comm_ban']) && $this->banIP($_GET['comm_ban'])) {
93
+      // we banned the ip
88 94
       $this->success = "IP banned !";
95
+    }
89 96
 
90 97
     // UnBann ip
91
-    if (isset($_GET['comm_unban']) && $this->unBanIP($_GET['comm_unban']))
92
-      $this->success = "IP UnBanned !";
98
+    if (isset($_GET['comm_unban']) && $this->unBanIP($_GET['comm_unban'])) {
99
+          $this->success = "IP UnBanned !";
100
+    }
93 101
 
94 102
     return true;
95 103
   }
@@ -98,8 +106,9 @@  discard block
 block discarded – undo
98 106
 
99 107
   function grabComment($pageid, $update_id = false)
100 108
   {
101
-    if (session_id() == '')
102
-      session_start();
109
+    if (session_id() == '') {
110
+          session_start();
111
+    }
103 112
 
104 113
     $_SESSION['comm_pageid'] = $pageid;
105 114
 
@@ -144,20 +153,22 @@  discard block
 block discarded – undo
144 153
 
145 154
 
146 155
       // we check in case the email is not valid
147
-      if (!$this->settings['optional_email'])
148
-        if (!$this->isValidMail($email)) {
156
+      if (!$this->settings['optional_email']) {
157
+              if (!$this->isValidMail($email)) {
149 158
           $this->error = "Invalid email !";
159
+      }
150 160
           return false;
151 161
         }
152 162
 
153 163
 
154 164
       // we check if it's an update or a new message 
155 165
       if ($update_id) {
156
-        if ($this->settings['public'])
157
-          $upd_fields = ",`name` = '" . mysqli_real_escape_string($this->link, $name) . "',
166
+        if ($this->settings['public']) {
167
+                  $upd_fields = ",`name` = '" . mysqli_real_escape_string($this->link, $name) . "',
158 168
 									`email` = '" . mysqli_real_escape_string($this->link, $email) . "'";
159
-        else
160
-          $upd_fields = '';
169
+        } else {
170
+                  $upd_fields = '';
171
+        }
161 172
 
162 173
 
163 174
         if (mysqli_query($this->link, "UPDATE `" . $this->settings['comments_table'] . "` SET 
@@ -176,10 +187,11 @@  discard block
 block discarded – undo
176 187
         isset($_POST['comm_reply']) &&
177 188
         mysqli_num_rows(mysqli_query($this->link, "SELECT `id` FROM `" . $this->settings['comments_table'] . "` 
178 189
 					WHERE `id`= '" . (int) $_POST['comm_reply'] . "' AND `parent`  = '0'"))
179
-      )
180
-        $reply = ",`parent` = '" . (int) $_POST['comm_reply'] . "'";
181
-      else
182
-        $reply = '';
190
+      ) {
191
+              $reply = ",`parent` = '" . (int) $_POST['comm_reply'] . "'";
192
+      } else {
193
+              $reply = '';
194
+      }
183 195
 
184 196
 
185 197
 
@@ -216,8 +228,9 @@  discard block
 block discarded – undo
216 228
   function generateComments($pageid = 0, $perpage = 10)
217 229
   {
218 230
 
219
-    if (session_id() == '')
220
-      session_start();
231
+    if (session_id() == '') {
232
+          session_start();
233
+    }
221 234
 
222 235
     $_SESSION['comm_pageid'] = $pageid;
223 236
 
@@ -230,8 +243,9 @@  discard block
 block discarded – undo
230 243
     // we generate the output of the comments
231 244
     if ($comments) {
232 245
       foreach ($comments as $comment) {
233
-        if (!($name = $this->getUsername($comment->name)))
234
-          $name = $comment->name;
246
+        if (!($name = $this->getUsername($comment->name))) {
247
+                  $name = $comment->name;
248
+        }
235 249
 
236 250
         // show reply link or form
237 251
         if (isset($_GET['comm_reply']) && ($comment->id == $_GET['comm_reply'])) {
@@ -295,18 +309,20 @@  discard block
 block discarded – undo
295 309
     $html = "";
296 310
     $comments = $this->getReplies($comm_id, $limit);
297 311
     // we generate the output of the comments
298
-    if ($comments)
299
-      foreach ($comments as $comment) {
312
+    if ($comments) {
313
+          foreach ($comments as $comment) {
300 314
         if (!($name = $this->getUsername($comment->name)))
301 315
           $name = $comment->name;
316
+    }
302 317
 
303 318
         // show normal username or with adminStyles
304 319
         $style = "";
305 320
         if ($comment->isadmin) {
306 321
           $show_name = "<span style='" . $this->settings['adminStyle']['username'] . "'>" . $this->html($name) . "</span>";
307 322
           $style = $this->settings['adminStyle']['box'];
308
-        } else
309
-          $show_name = $this->html($name);
323
+        } else {
324
+                  $show_name = $this->html($name);
325
+        }
310 326
 
311 327
         // show extra info only to admin
312 328
         $show_extra = "";
@@ -325,19 +341,21 @@  discard block
 block discarded – undo
325 341
 				<div class='media-body'>";
326 342
 
327 343
 
328
-        if (isset($_GET['comm_edit']) && ($_GET['comm_edit'] === $comment->id) && $this->hasRights($comment))
329
-          // we generate the form in edit mode with precompleted data
344
+        if (isset($_GET['comm_edit']) && ($_GET['comm_edit'] === $comment->id) && $this->hasRights($comment)) {
345
+                  // we generate the form in edit mode with precompleted data
330 346
           $html .= $this->generateForm('', 2, $comment);
331
-        else
332
-          $html .= "<h4 class='media-heading'>
347
+        } else {
348
+                  $html .= "<h4 class='media-heading'>
333 349
 						$show_name $show_extra
334 350
 						<small class='muted'>" . $this->tsince($comment->time) . " replied </small>
335 351
 						" . $this->admin_options($comment) . "
336 352
 					</h4>
337 353
 					<p>" . nl2br($this->html($comment->message)) . "</p>";
354
+        }
338 355
 
339
-        if ($is_del)
340
-          $html .= $this->gennerateConfirm('', 'comm_del', $comment->id);
356
+        if ($is_del) {
357
+                  $html .= $this->gennerateConfirm('', 'comm_del', $comment->id);
358
+        }
341 359
 
342 360
         $html .= "</div></div>";
343 361
       }
@@ -348,19 +366,22 @@  discard block
 block discarded – undo
348 366
   function generateForm($location =  '', $type = 0, $comment = false)
349 367
   {
350 368
     $this->setToken();
351
-    if ($location == '')
352
-      $location = "?" . $this->queryString('', $this->ignore);
369
+    if ($location == '') {
370
+          $location = "?" . $this->queryString('', $this->ignore);
371
+    }
353 372
 
354 373
 
355
-    if (!$comment)
356
-      $comment = (object) array("name" => "", "email" => "", "message" => "");
374
+    if (!$comment) {
375
+          $comment = (object) array("name" => "", "email" => "", "message" => "");
376
+    }
357 377
 
358
-    if ($type == 1)
359
-      $title = "<input type='hidden' name='comm_reply' value='" . (int) $_GET['comm_reply'] . "'>Post a reply";
360
-    else if ($type == 2)
361
-      $title = "<input type='hidden' name='comm_edit' value='" . (int) $_GET['comm_edit'] . "'>Edit comment";
362
-    else
363
-      $title = "Post a comment";
378
+    if ($type == 1) {
379
+          $title = "<input type='hidden' name='comm_reply' value='" . (int) $_GET['comm_reply'] . "'>Post a reply";
380
+    } else if ($type == 2) {
381
+          $title = "<input type='hidden' name='comm_edit' value='" . (int) $_GET['comm_edit'] . "'>Edit comment";
382
+    } else {
383
+          $title = "Post a comment";
384
+    }
364 385
 
365 386
     $show_name_email = '';
366 387
 
@@ -440,8 +461,9 @@  discard block
 block discarded – undo
440 461
 		  UNIQUE KEY `ip` (`ip`)
441 462
 		);";
442 463
 
443
-    if (mysqli_query($this->link, $sql) && mysqli_query($this->link, $sql2))
444
-      return true;
464
+    if (mysqli_query($this->link, $sql) && mysqli_query($this->link, $sql2)) {
465
+          return true;
466
+    }
445 467
 
446 468
     return false;
447 469
   }
@@ -457,8 +479,9 @@  discard block
 block discarded – undo
457 479
 
458 480
     $sql = "SELECT * FROM `" . $this->settings['comments_table'] . "` WHERE `parent` = 0 ";
459 481
 
460
-    if ($pageid)
461
-      $sql .= "AND `pageid` = '" . mysqli_real_escape_string($this->link, $pageid) . "'";
482
+    if ($pageid) {
483
+          $sql .= "AND `pageid` = '" . mysqli_real_escape_string($this->link, $pageid) . "'";
484
+    }
462 485
 
463 486
     // some sorting options
464 487
     $sql .= " " . $this->settings['sort'] . " "; // this is pasted as is
@@ -469,18 +492,20 @@  discard block
 block discarded – undo
469 492
 
470 493
     $total_results = mysqli_num_rows(mysqli_query($this->link, $sql));
471 494
 
472
-    if ($page_number > ceil($total_results / $perpage))
473
-      $page_number = ceil($total_results / $perpage);
495
+    if ($page_number > ceil($total_results / $perpage)) {
496
+          $page_number = ceil($total_results / $perpage);
497
+    }
474 498
 
475 499
     $start = ($page_number - 1) * $perpage;
476 500
 
477 501
     $sql .= "LIMIT $start, $perpage";
478 502
 
479
-    if ($result = mysqli_query($this->link, $sql))
480
-      while ($row = mysqli_fetch_object($result))
503
+    if ($result = mysqli_query($this->link, $sql)) {
504
+          while ($row = mysqli_fetch_object($result))
481 505
         $comments[] = $row;
482
-    else
483
-      return false;
506
+    } else {
507
+          return false;
508
+    }
484 509
 
485 510
     return $comments;
486 511
   }
@@ -500,11 +525,12 @@  discard block
 block discarded – undo
500 525
     // limitation
501 526
     $sql .= "LIMIT 0, $limit";
502 527
 
503
-    if ($result = mysqli_query($this->link, $sql))
504
-      while ($row = mysqli_fetch_object($result))
528
+    if ($result = mysqli_query($this->link, $sql)) {
529
+          while ($row = mysqli_fetch_object($result))
505 530
         $comments[] = $row;
506
-    else
507
-      return false;
531
+    } else {
532
+          return false;
533
+    }
508 534
 
509 535
     return $comments;
510 536
   }
@@ -547,8 +573,9 @@  discard block
 block discarded – undo
547 573
 
548 574
     $time = abs(time() - $time); // to get the time since that moment
549 575
 
550
-    if ($time == 0)
551
-      return "Just now";
576
+    if ($time == 0) {
577
+          return "Just now";
578
+    }
552 579
 
553 580
     $tokens = array(
554 581
       31536000 => 'year',
@@ -561,7 +588,9 @@  discard block
 block discarded – undo
561 588
     );
562 589
 
563 590
     foreach ($tokens as $unit => $text) {
564
-      if ($time < $unit) continue;
591
+      if ($time < $unit) {
592
+        continue;
593
+      }
565 594
       $numberOfUnits = floor($time / $unit);
566 595
       return $numberOfUnits . ' ' . $text . (($numberOfUnits > 1) ? 's' : '') . ' ' . $end_msg;
567 596
     }
@@ -570,13 +599,15 @@  discard block
 block discarded – undo
570 599
   function isValidMail($mail)
571 600
   {
572 601
 
573
-    if (!filter_var($mail, FILTER_VALIDATE_EMAIL))
574
-      return FALSE;
602
+    if (!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
603
+          return FALSE;
604
+    }
575 605
 
576 606
 
577 607
     list($username, $maildomain) = explode("@", $mail);
578
-    if (checkdnsrr($maildomain, "MX"))
579
-      return TRUE;
608
+    if (checkdnsrr($maildomain, "MX")) {
609
+          return TRUE;
610
+    }
580 611
 
581 612
     return FALSE;
582 613
   }
@@ -633,8 +664,9 @@  discard block
 block discarded – undo
633 664
    */
634 665
   function setToken()
635 666
   {
636
-    if (session_id() == '')
637
-      session_start();
667
+    if (session_id() == '') {
668
+          session_start();
669
+    }
638 670
 
639 671
     $_SESSION['comm_token'] = md5(time() . rand());
640 672
   }
@@ -652,8 +684,9 @@  discard block
 block discarded – undo
652 684
     foreach ($_GET as $k => $v) {
653 685
       if ((is_array($ignore) && in_array($k, $ignore))
654 686
         || (is_string($ignore) && preg_match($ignore, $k))
655
-      )
656
-        continue;
687
+      ) {
688
+              continue;
689
+      }
657 690
 
658 691
       if ($type == 'hidden') {
659 692
         $result .= "<input type='hidden' name='" . urlencode($k) . "' value='" . urlencode($v) . "'>";
@@ -662,8 +695,9 @@  discard block
 block discarded – undo
662 695
       }
663 696
     }
664 697
 
665
-    if (is_array($result))
666
-      return implode("&", $result);
698
+    if (is_array($result)) {
699
+          return implode("&", $result);
700
+    }
667 701
 
668 702
     return $result;
669 703
   }
@@ -676,8 +710,9 @@  discard block
 block discarded – undo
676 710
   function gennerateConfirm($location = '', $info_name = 'comm_del', $info_value = 0, $submit = "I&#39;m sure, Delete")
677 711
   {
678 712
 
679
-    if ($location == '')
680
-      $location = "?" . $this->queryString('', $this->ignore);
713
+    if ($location == '') {
714
+          $location = "?" . $this->queryString('', $this->ignore);
715
+    }
681 716
 
682 717
     return "<form class='form-horizontal' action='$location' method='post'>
683 718
 		<div class='control-group'>
@@ -696,11 +731,13 @@  discard block
 block discarded – undo
696 731
    */
697 732
   function hasRights($comment)
698 733
   {
699
-    if (session_id() == '')
700
-      session_start();
734
+    if (session_id() == '') {
735
+          session_start();
736
+    }
701 737
 
702
-    if ($this->settings['isAdmin'] || (isset($_SESSION['comm_last_id']) && $_SESSION['comm_last_id'] == $comment->id))
703
-      return true;
738
+    if ($this->settings['isAdmin'] || (isset($_SESSION['comm_last_id']) && $_SESSION['comm_last_id'] == $comment->id)) {
739
+          return true;
740
+    }
704 741
     return false;
705 742
   }
706 743
   /**
@@ -711,13 +748,14 @@  discard block
 block discarded – undo
711 748
   function admin_options($comment)
712 749
   {
713 750
     // if is admin or the person who posted the message
714
-    if ($this->hasRights($comment))
715
-      return "<a href='?" . $this->queryString('', $this->ignore) . "&comm_edit=$comment->id#$comment->id'>Edit</a> 
751
+    if ($this->hasRights($comment)) {
752
+          return "<a href='?" . $this->queryString('', $this->ignore) . "&comm_edit=$comment->id#$comment->id'>Edit</a> 
716 753
 				| <a href='?" . $this->queryString('', $this->ignore) . "&comm_del=$comment->id#$comment->id'>Delete</a>" .
717 754
         ($this->settings['isAdmin'] ? //if is admin 
718 755
           " | <a href='?" . $this->queryString('', $this->ignore) . "&comm_" .
719 756
           ($this->isBanned($comment->ip) ? "un" : "") . "ban=" . urlencode($comment->ip) . "'>" .
720 757
           ($this->isBanned($comment->ip) ? "Un" : "") . "Ban</a>" : "");
758
+    }
721 759
   }
722 760
 
723 761
 
@@ -734,8 +772,9 @@  discard block
 block discarded – undo
734 772
 
735 773
     $sql = "SELECT `id` FROM `" . $this->settings['comments_table'] . "` WHERE `parent` = 0 ";
736 774
 
737
-    if ($pageid)
738
-      $sql .=  " AND `pageid`='" . (int) $pageid . "'";
775
+    if ($pageid) {
776
+          $sql .=  " AND `pageid`='" . (int) $pageid . "'";
777
+    }
739 778
 
740 779
 
741 780
     $total = mysqli_num_rows(mysqli_query($this->link, $sql));
@@ -748,20 +787,25 @@  discard block
 block discarded – undo
748 787
 
749 788
     $html = "<div class='pagination'><ul>";
750 789
 
751
-    if ($page > 4)
752
-      $html .= "<li><a href='?$query'>First</a></li>";
790
+    if ($page > 4) {
791
+          $html .= "<li><a href='?$query'>First</a></li>";
792
+    }
753 793
 
754
-    if ($page > 1)
755
-      $html .= "<li><a href='?comm_page=" . ($page - 1) . "$query'>Prev</a> </li>";
794
+    if ($page > 1) {
795
+          $html .= "<li><a href='?comm_page=" . ($page - 1) . "$query'>Prev</a> </li>";
796
+    }
756 797
 
757
-    for ($i = max(1, $page - 3); $i <= min($page + 3, $total_pages); $i++)
758
-      $html .= ($i == $page ? "<li class='active'><a>" . $i . "</a></li>" : " <li><a href='?comm_page=$i$query'>$i</a></li> ");
798
+    for ($i = max(1, $page - 3); $i <= min($page + 3, $total_pages); $i++) {
799
+          $html .= ($i == $page ? "<li class='active'><a>" . $i . "</a></li>" : " <li><a href='?comm_page=$i$query'>$i</a></li> ");
800
+    }
759 801
 
760
-    if ($page < $total_pages)
761
-      $html .= "<li><a href='?comm_page=" . ($page + 1) . "$query'>Next</a></li>";
802
+    if ($page < $total_pages) {
803
+          $html .= "<li><a href='?comm_page=" . ($page + 1) . "$query'>Next</a></li>";
804
+    }
762 805
 
763
-    if ($page < $total_pages - 3)
764
-      $html .= "<li><a href='?comm_page=$total_pages$query'> Last </a></li>";
806
+    if ($page < $total_pages - 3) {
807
+          $html .= "<li><a href='?comm_page=$total_pages$query'> Last </a></li>";
808
+    }
765 809
 
766 810
     $html .= "</ul></div>";
767 811
 
@@ -791,10 +835,11 @@  discard block
 block discarded – undo
791 835
    */
792 836
   function banIP($ip)
793 837
   {
794
-    if ($this->settings['isAdmin'])
795
-      if (mysqli_query($this->link, "INSERT INTO `" . $this->settings['banned_table'] . "` 
838
+    if ($this->settings['isAdmin']) {
839
+          if (mysqli_query($this->link, "INSERT INTO `" . $this->settings['banned_table'] . "` 
796 840
 				SET `ip` = '" . mysqli_real_escape_string($this->link, $ip) . "'"))
797 841
         return true;
842
+    }
798 843
     return false;
799 844
   }
800 845
 
@@ -820,8 +865,9 @@  discard block
 block discarded – undo
820 865
   function isBanned($ip)
821 866
   {
822 867
     // no need to check the same ip 2 times in a row
823
-    if (count($this->checked_ips) && in_array($ip, array_keys($this->checked_ips)))
824
-      return $this->checked_ips[$ip];
868
+    if (count($this->checked_ips) && in_array($ip, array_keys($this->checked_ips))) {
869
+          return $this->checked_ips[$ip];
870
+    }
825 871
 
826 872
     $this->checked_ips[$ip] = $ip;
827 873
 
Please login to merge, or discard this patch.