Passed
Pull Request — master (#1917)
by Struan
34:42
created
www/docs/addcomment/index.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 if (get_http_var("submitcomment") != '') {
11 11
     // We're submitting a comment.
12 12
 
13
-    $data = array (
13
+    $data = array(
14 14
         'epobject_id' => get_http_var('epobject_id'),
15 15
         'body'	=> get_http_var('body')
16 16
     );
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
         // Preview the comment.
60 60
         // Mock up a data array for the comment listing template.
61
-        $data['comments'][0] = array (
61
+        $data['comments'][0] = array(
62 62
             'body' => $body,
63 63
             'firstname' => $THEUSER->firstname(),
64 64
             'lastname' => $THEUSER->lastname(),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
         // Show the populated comment form.
78
-        $commendata = array (
78
+        $commendata = array(
79 79
             'epobject_id' => get_http_var('epobject_id'),
80 80
             'gid' => get_http_var('gid'),
81 81
             'body'	=> get_http_var('body'),
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 
87 87
         // Show all comments for this epobject.
88
-        $args = array (
88
+        $args = array(
89 89
             'epobject_id' => get_http_var('epobject_id')
90 90
         );
91 91
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
             'lastname' => $THEUSER->lastname(),
65 65
             'user_id' => $THEUSER->user_id(),
66 66
             'posted' => date('Y-m-d H:i:s', time()),
67
-            'modflagged' => NULL,
67
+            'modflagged' => null,
68 68
             'visible' => 1,
69 69
             'preview' => true	// Extra tag so we know this is just a preview.
70 70
         );
Please login to merge, or discard this patch.
www/includes/easyparliament/comment.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
     public $body = '';
31 31
     public $posted = '';
32 32
     public $visible = false;
33
-    public $modflagged = null;	// Is a datetime when set.
34
-    public $firstname = '';	// Of the person who posted it.
33
+    public $modflagged = null; // Is a datetime when set.
34
+    public $firstname = ''; // Of the person who posted it.
35 35
     public $lastname = '';
36 36
     public $url = '';
37 37
 
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
             if ($q) {
71 71
 
72 72
                 $this->comment_id 	= $comment_id;
73
-                $this->user_id		= $q['user_id'];
73
+                $this->user_id = $q['user_id'];
74 74
                 $this->epobject_id	= $q['epobject_id'];
75
-                $this->body			= $q['body'];
76
-                $this->posted		= $q['posted'];
77
-                $this->visible		= $q['visible'];
78
-                $this->modflagged	= $q['modflagged'];
75
+                $this->body = $q['body'];
76
+                $this->posted = $q['posted'];
77
+                $this->visible = $q['visible'];
78
+                $this->modflagged = $q['modflagged'];
79 79
 
80 80
                 // Sets the URL and username for this comment. Duh.
81 81
                 $this->_set_url();
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         }
143 143
 
144 144
         if (!$THEUSER->is_able_to('addcomment')) {
145
-            $message = 	array (
145
+            $message = array(
146 146
                 'title' => 'Sorry',
147 147
                 'text' => 'You are not allowed to post annotations.'
148 148
             );
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
             return false;
151 151
         }
152 152
 
153
-        if (!is_numeric ($data['epobject_id'])) {
154
-            $message = array (
153
+        if (!is_numeric($data['epobject_id'])) {
154
+            $message = array(
155 155
                 'title' => 'Sorry',
156 156
                 'text' => "We don't have an epobject id."
157 157
             );
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         }
161 161
 
162 162
         if ($data['body'] == '') {
163
-            $message = array (
163
+            $message = array(
164 164
                 'title' => 'Whoops!',
165 165
                 'text' => "You haven't entered an annotation!"
166 166
             );
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
 
224 224
         if ($q->success()) {
225 225
             // Set the object varibales up.
226
-            $this->comment_id 	= $q->insert_id();
227
-            $this->user_id	  	= $THEUSER->user_id();
228
-            $this->epobject_id 	= $data['epobject_id'];
229
-            $this->body			= $data['body'];
230
-            $this->posted		= $posted;
231
-            $this->visible		= 1;
226
+            $this->comment_id = $q->insert_id();
227
+            $this->user_id = $THEUSER->user_id();
228
+            $this->epobject_id = $data['epobject_id'];
229
+            $this->body = $data['body'];
230
+            $this->posted = $posted;
231
+            $this->visible = 1;
232 232
 
233 233
             return $this->comment_id();
234 234
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
     }
239 239
 
240 240
 
241
-    public function display($format='html', $template='comments') {
242
-        $data['comments'][0] =  [
241
+    public function display($format = 'html', $template = 'comments') {
242
+        $data['comments'][0] = [
243 243
             'comment_id'	=> $this->comment_id,
244 244
             'user_id'		=> $this->user_id,
245 245
             'epobject_id'	=> $this->epobject_id,
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             $this->modflagged = $date;
288 288
             return true;
289 289
         } else {
290
-            $message =  [
290
+            $message = [
291 291
                 'title' => 'Sorry',
292 292
                 'text' => "We couldn't update the annotation's modflag.",
293 293
             ];
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             if ($q->success()) {
310 310
                 return true;
311 311
             } else {
312
-                $message =  [
312
+                $message = [
313 313
                     'title' => 'Sorry',
314 314
                     'text' => "We were unable to delete the annotation.",
315 315
                 ];
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             }
319 319
 
320 320
         } else {
321
-            $message =  [
321
+            $message = [
322 322
                 'title' => 'Sorry',
323 323
                 'text' => "You are not authorised to delete annotations.",
324 324
             ];
Please login to merge, or discard this patch.
www/includes/easyparliament/user.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  discard block
 block discarded – undo
55 55
 */
56 56
 
57 57
 class USER {
58
-    public $user_id = "0";         // So we have an ID for non-logged in users reporting comments etc.
59
-    public $firstname = "Guest";   // So we have something to print for non-logged in users.
58
+    public $user_id = "0"; // So we have an ID for non-logged in users reporting comments etc.
59
+    public $firstname = "Guest"; // So we have something to print for non-logged in users.
60 60
     public $lastname = "";
61
-    public $password = "";         // This will be a hashed version of a plaintext pw.
61
+    public $password = ""; // This will be a hashed version of a plaintext pw.
62 62
     public $email = "";
63 63
     public $postcode = "";
64 64
     public $url = "";
65
-    public $lastvisit = "";        // Last time the logged-in user loaded a page (GMT).
65
+    public $lastvisit = ""; // Last time the logged-in user loaded a page (GMT).
66 66
     public $registrationtime = ""; // When they registered (GMT).
67
-    public $registrationip = "";   // Where they registered from.
68
-    public $optin = "";            // Int containing multiple binary opt-ins. (See top of User.php)
69
-    public $deleted = "";          // User can't log in or have their info displayed.
70
-    public $confirmed = '';        // boolean - Has the user confirmed via email?
71
-    public $facebook_id = '';      // Facebook ID for users who login with FB
72
-    public $facebook_token = '';   // Facebook token for users who login with FB
73
-    public $can_annotate = false;  // Can the user add annotations
74
-    public $organisation = '';     // The organisation the user belongs to
67
+    public $registrationip = ""; // Where they registered from.
68
+    public $optin = ""; // Int containing multiple binary opt-ins. (See top of User.php)
69
+    public $deleted = ""; // User can't log in or have their info displayed.
70
+    public $confirmed = ''; // boolean - Has the user confirmed via email?
71
+    public $facebook_id = ''; // Facebook ID for users who login with FB
72
+    public $facebook_token = ''; // Facebook token for users who login with FB
73
+    public $can_annotate = false; // Can the user add annotations
74
+    public $organisation = ''; // The organisation the user belongs to
75 75
     // Don't use the status to check access privileges - use the is_able_to() function.
76 76
     public $status = "Viewer";
77 77
 
@@ -324,12 +324,12 @@  discard block
 block discarded – undo
324 324
         $confirmurl = 'https://' . DOMAIN . '/E/' . $urltoken;
325 325
 
326 326
         // Arrays we need to send a templated email.
327
-        $data =  [
327
+        $data = [
328 328
             'to'        => $details['email'],
329 329
             'template'  => 'email_confirmation',
330 330
         ];
331 331
 
332
-        $merge =  [
332
+        $merge = [
333 333
             'CONFIRMURL'    => $confirmurl,
334 334
         ];
335 335
 
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
         }
368 368
 
369 369
         // Arrays we need to send a templated email.
370
-        $data =  [
370
+        $data = [
371 371
             'to'        => $details['email'],
372 372
             'template'  => 'join_confirmation',
373 373
         ];
374 374
 
375
-        $merge =  [
375
+        $merge = [
376 376
             'CONFIRMURL'    => $confirmurl,
377 377
         ];
378 378
 
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
                 // Generates the password ....
439 439
                 for ($x = 0; $x < 6;) {
440 440
                     $y = rand(1, 1000);
441
-                    if($y > 350 && $y < 601) {
441
+                    if ($y > 350 && $y < 601) {
442 442
                         $d = chr(rand(48, 57));
443 443
                     }
444
-                    if($y < 351) {
444
+                    if ($y < 351) {
445 445
                         $d = chr(rand(65, 90));
446 446
                     }
447
-                    if($y > 600) {
447
+                    if ($y > 600) {
448 448
                         $d = chr(rand(97, 122));
449 449
                     }
450 450
                     if ($d != $o && !preg_match('#[O01lI]#', $d)) {
@@ -504,14 +504,14 @@  discard block
 block discarded – undo
504 504
             return false;
505 505
         }
506 506
 
507
-        $data =  [
507
+        $data = [
508 508
             'to'            => $this->email(),
509 509
             'template'      => 'new_password',
510 510
         ];
511 511
 
512 512
         $URL = new \MySociety\TheyWorkForYou\Url("userlogin");
513 513
 
514
-        $merge =  [
514
+        $merge = [
515 515
             'EMAIL'         => $this->email(),
516 516
             'LOGINURL'      => "https://" . DOMAIN . $URL->generate(),
517 517
             'PASSWORD'      => $this->password(),
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
         // Maybe there's a way of fetching these from the DB,
688 688
         // so we don't duplicate them here...?
689 689
 
690
-        $statuses =  ["Viewer", "User", "Moderator", "Administrator", "Superuser"];
690
+        $statuses = ["Viewer", "User", "Moderator", "Administrator", "Superuser"];
691 691
 
692 692
         return $statuses;
693 693
 
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
             $date_now = gmdate("Y-m-d H:i:s");
1032 1032
             $this->db->query(
1033 1033
                 "UPDATE users SET lastvisit = :lastvisit WHERE user_id = :user_id",
1034
-                [ ':lastvisit' => $date_now, ':user_id' => $this->user_id() ]
1034
+                [':lastvisit' => $date_now, ':user_id' => $this->user_id()]
1035 1035
             );
1036 1036
 
1037 1037
             $this->lastvisit = $date_now;
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
 
1428 1428
             twfy_debug("THEUSER", "User with ID found to confirm: " . $this->user_id());
1429 1429
             // We'll need these to be set before logging the user in.
1430
-            $this->email    = $q['email'];
1430
+            $this->email = $q['email'];
1431 1431
 
1432 1432
             // Set that they're confirmed in the DB.
1433 1433
             $r = $this->db->query("UPDATE users
Please login to merge, or discard this patch.
www/includes/easyparliament/page.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                 $THISPAGE = new \MySociety\TheyWorkForYou\Url($this_page);
52 52
 
53 53
                 $LOGINURL = new \MySociety\TheyWorkForYou\Url('userlogin');
54
-                $LOGINURL->insert(['ret' => $THISPAGE->generate('none') ]);
54
+                $LOGINURL->insert(['ret' => $THISPAGE->generate('none')]);
55 55
 
56 56
                 $text = "<a href=\"" . $LOGINURL->generate() . '">' . gettext('You’d better sign in!') . '</a>';
57 57
             } else {
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         if (is_string($message)) {
392 392
             // Sometimes we're just sending a single line to this function
393 393
             // rather like the bigger array...
394
-            $message =  [
394
+            $message = [
395 395
                 'text' => $message,
396 396
             ];
397 397
         }
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
             if (!isset($page_errors)) {
406 406
                 $page_errors = [];
407 407
             }
408
-            $page_errors[]  = $message;
408
+            $page_errors[] = $message;
409 409
         }
410 410
 
411 411
         if ($fatal) {
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
     public function glossary_atoz(&$GLOSSARY) {
812 812
         // Print out a nice list of lettered links to glossary pages
813 813
 
814
-        $letters =  [];
814
+        $letters = [];
815 815
 
816 816
         foreach ($GLOSSARY->alphabet as $letter => $eps) {
817 817
             // if we're writing out the current letter (list or item)
@@ -1065,9 +1065,9 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
             // The URLs to login / join pages.
1067 1067
             $LOGINURL = new \MySociety\TheyWorkForYou\Url('userlogin');
1068
-            $LOGINURL->insert(array('ret'=>$THISPAGEURL->generate().'#addcomment'));
1068
+            $LOGINURL->insert(array('ret'=>$THISPAGEURL->generate() . '#addcomment'));
1069 1069
             $JOINURL = new \MySociety\TheyWorkForYou\Url('userjoin');
1070
-            $JOINURL->insert(array('ret'=>$THISPAGEURL->generate().'#addcomment'));
1070
+            $JOINURL->insert(array('ret'=>$THISPAGEURL->generate() . '#addcomment'));
1071 1071
 
1072 1072
             ?>
1073 1073
                 <p><a href="<?php echo $LOGINURL->generate(); ?>">Sign in</a> or <a href="<?php echo $JOINURL->generate(); ?>">join</a> to post a public annotation.</p>
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
                 $body = trim_characters($report['body'], 0, 40);
1194 1194
 
1195
-                $tabledata['rows'][] =  [
1195
+                $tabledata['rows'][] = [
1196 1196
                     _htmlentities($report['firstname'] . ' ' . $report['lastname']),
1197 1197
                     _htmlentities($body),
1198 1198
                     $report['reported'],
@@ -1274,11 +1274,11 @@  discard block
 block discarded – undo
1274 1274
         // Returns HTML suitable for putting in the sidebar on Admin pages.
1275 1275
         global $this_page, $DATA;
1276 1276
 
1277
-        $pages =  ['admin_home',
1277
+        $pages = ['admin_home',
1278 1278
             'admin_comments', 'admin_searchlogs', 'admin_popularsearches', 'admin_failedsearches',
1279 1279
             'alert_stats', 'admin_statistics', 'admin_reportstats',
1280 1280
             'admin_commentreports', 'admin_glossary', 'admin_glossary_pending', 'admin_badusers',
1281
-            'admin_profile_message', 'admin_photos', 'admin_mpurls', 'admin_policies', 'admin_banner', 'admin_announcement','admin_featured', 'admin_topics',
1281
+            'admin_profile_message', 'admin_photos', 'admin_mpurls', 'admin_policies', 'admin_banner', 'admin_announcement', 'admin_featured', 'admin_topics',
1282 1282
             'admin_wikipedia',
1283 1283
         ];
1284 1284
 
Please login to merge, or discard this patch.
tests/CommentTest.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     /**
53 53
      * Tests adding a new comment, testing HTML cleaning.
54 54
      */
55
-	public function testHTMLCleaningAddComment()
55
+    public function testHTMLCleaningAddComment()
56 56
     {
57 57
 
58 58
         global $THEUSER;
Please login to merge, or discard this patch.