Passed
Push — master ( ce0915...fcbf06 )
by Matthew
06:41 queued 02:22
created
www/includes/easyparliament/commentreport.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
     public $firstname = '';
27 27
     public $lastname = '';
28 28
     public $body = '';
29
-    public $reported = null;	// datetime
30
-    public $resolved = null; 	// datetime
31
-    public $resolvedby = ''; 	// user_id
32
-    public $locked = null; 	// datetime
33
-    public $lockedby = '';		// user_id
34
-    public $upheld = ''; 		// boolean
29
+    public $reported = null; // datetime
30
+    public $resolved = null; // datetime
31
+    public $resolvedby = ''; // user_id
32
+    public $locked = null; // datetime
33
+    public $lockedby = ''; // user_id
34
+    public $upheld = ''; // boolean
35 35
 
36 36
     // If the user was logged in, this will be set:
37 37
     public $user_id = '';
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
 
257 257
         if ($q->success()) {
258 258
             // Inserted OK, so set up this object's variables.
259
-            $this->report_id 	= $q->insert_id();
260
-            $this->comment_id 	= $COMMENT->comment_id();
261
-            $this->body			= $body;
262
-            $this->reported		= $time;
259
+            $this->report_id = $q->insert_id();
260
+            $this->comment_id = $COMMENT->comment_id();
261
+            $this->body = $body;
262
+            $this->reported = $time;
263 263
 
264 264
             if ($THEUSER->isloggedin()) {
265
-                $this->user_id		= $THEUSER->user_id();
265
+                $this->user_id = $THEUSER->user_id();
266 266
                 $this->firstname	= $THEUSER->firstname();
267 267
                 $this->lastname		= $THEUSER->lastname();
268 268
             } else {
269
-                $this->email		= $reportdata['email'];
270
-                $this->firstname 	= $reportdata['firstname'];
271
-                $this->lastname		= $reportdata['lastname'];
269
+                $this->email = $reportdata['email'];
270
+                $this->firstname = $reportdata['firstname'];
271
+                $this->lastname = $reportdata['lastname'];
272 272
             }
273 273
 
274 274
 
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
                 $email = $this->email();
301 301
             }
302 302
 
303
-            $data =  [
303
+            $data = [
304 304
                 'to' 			=> $email,
305 305
                 'template' 		=> 'report_acknowledge',
306 306
             ];
307
-            $merge =  [
307
+            $merge = [
308 308
                 'COMMENTURL' 	=> "https://" . DOMAIN . $COMMENT->url(),
309 309
                 'REPORTBODY' 	=> strip_tags($this->body()),
310 310
             ];
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $data = [];
327 327
 
328 328
         if (is_numeric($this->report_id)) {
329
-            $data =  [
329
+            $data = [
330 330
                 'report_id' 	=> $this->report_id(),
331 331
                 'comment_id' 	=> $this->comment_id(),
332 332
                 'user_id' 		=> $this->user_id(),
Please login to merge, or discard this patch.
www/includes/easyparliament/user.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -55,21 +55,21 @@  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
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 73
     // Don't use the status to check access privileges - use the is_able_to() function.
74 74
     public $status = "Viewer";
75 75
 
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
         $confirmurl = 'https://' . DOMAIN . '/E/' . $urltoken;
319 319
 
320 320
         // Arrays we need to send a templated email.
321
-        $data =  [
321
+        $data = [
322 322
             'to'        => $details['email'],
323 323
             'template'  => 'email_confirmation',
324 324
         ];
325 325
 
326
-        $merge =  [
326
+        $merge = [
327 327
             'CONFIRMURL'    => $confirmurl,
328 328
         ];
329 329
 
@@ -361,12 +361,12 @@  discard block
 block discarded – undo
361 361
         }
362 362
 
363 363
         // Arrays we need to send a templated email.
364
-        $data =  [
364
+        $data = [
365 365
             'to'        => $details['email'],
366 366
             'template'  => 'join_confirmation',
367 367
         ];
368 368
 
369
-        $merge =  [
369
+        $merge = [
370 370
             'CONFIRMURL'    => $confirmurl,
371 371
         ];
372 372
 
@@ -432,13 +432,13 @@  discard block
 block discarded – undo
432 432
                 // Generates the password ....
433 433
                 for ($x = 0; $x < 6;) {
434 434
                     $y = rand(1, 1000);
435
-                    if($y > 350 && $y < 601) {
435
+                    if ($y > 350 && $y < 601) {
436 436
                         $d = chr(rand(48, 57));
437 437
                     }
438
-                    if($y < 351) {
438
+                    if ($y < 351) {
439 439
                         $d = chr(rand(65, 90));
440 440
                     }
441
-                    if($y > 600) {
441
+                    if ($y > 600) {
442 442
                         $d = chr(rand(97, 122));
443 443
                     }
444 444
                     if ($d != $o && !preg_match('#[O01lI]#', $d)) {
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
             return false;
499 499
         }
500 500
 
501
-        $data =  [
501
+        $data = [
502 502
             'to'            => $this->email(),
503 503
             'template'      => 'new_password',
504 504
         ];
505 505
 
506 506
         $URL = new \MySociety\TheyWorkForYou\Url("userlogin");
507 507
 
508
-        $merge =  [
508
+        $merge = [
509 509
             'EMAIL'         => $this->email(),
510 510
             'LOGINURL'      => "https://" . DOMAIN . $URL->generate(),
511 511
             'PASSWORD'      => $this->password(),
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
         // Maybe there's a way of fetching these from the DB,
660 660
         // so we don't duplicate them here...?
661 661
 
662
-        $statuses =  ["Viewer", "User", "Moderator", "Administrator", "Superuser"];
662
+        $statuses = ["Viewer", "User", "Moderator", "Administrator", "Superuser"];
663 663
 
664 664
         return $statuses;
665 665
 
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
             $date_now = gmdate("Y-m-d H:i:s");
989 989
             $this->db->query(
990 990
                 "UPDATE users SET lastvisit = :lastvisit WHERE user_id = :user_id",
991
-                [ ':lastvisit' => $date_now, ':user_id' => $this->user_id() ]
991
+                [':lastvisit' => $date_now, ':user_id' => $this->user_id()]
992 992
             );
993 993
 
994 994
             $this->lastvisit = $date_now;
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
 
1385 1385
             twfy_debug("THEUSER", "User with ID found to confirm: " . $this->user_id());
1386 1386
             // We'll need these to be set before logging the user in.
1387
-            $this->email    = $q['email'];
1387
+            $this->email = $q['email'];
1388 1388
 
1389 1389
             // Set that they're confirmed in the DB.
1390 1390
             $r = $this->db->query("UPDATE users
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1430,7 +1430,8 @@  discard block
 block discarded – undo
1430 1430
         // not-logged-in users.
1431 1431
 
1432 1432
         $this->postcode = $pc;
1433
-        if (!headers_sent()) { // if in debug mode
1433
+        if (!headers_sent()) {
1434
+// if in debug mode
1434 1435
             setcookie(POSTCODE_COOKIE, $pc, time() + 7 * 86400, "/", COOKIEDOMAIN);
1435 1436
         }
1436 1437
 
@@ -1438,7 +1439,8 @@  discard block
 block discarded – undo
1438 1439
     }
1439 1440
 
1440 1441
     public function unset_postcode_cookie() {
1441
-        if (!headers_sent()) { // if in debug mode
1442
+        if (!headers_sent()) {
1443
+// if in debug mode
1442 1444
             setcookie(POSTCODE_COOKIE, '', time() - 3600, '/', COOKIEDOMAIN);
1443 1445
         }
1444 1446
     }
Please login to merge, or discard this patch.
www/includes/easyparliament/comment.php 1 patch
Spacing   +11 added lines, -11 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();
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     public function display($format = 'html', $template = 'comments') {
133 133
 
134
-        $data['comments'][0] =  [
134
+        $data['comments'][0] = [
135 135
             'comment_id'	=> $this->comment_id,
136 136
             'user_id'		=> $this->user_id,
137 137
             'epobject_id'	=> $this->epobject_id,
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             $this->modflagged = $date;
180 180
             return true;
181 181
         } else {
182
-            $message =  [
182
+            $message = [
183 183
                 'title' => 'Sorry',
184 184
                 'text' => "We couldn't update the annotation's modflag.",
185 185
             ];
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             if ($q->success()) {
202 202
                 return true;
203 203
             } else {
204
-                $message =  [
204
+                $message = [
205 205
                     'title' => 'Sorry',
206 206
                     'text' => "We were unable to delete the annotation.",
207 207
                 ];
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             }
211 211
 
212 212
         } else {
213
-            $message =  [
213
+            $message = [
214 214
                 'title' => 'Sorry',
215 215
                 'text' => "You are not authorised to delete annotations.",
216 216
             ];
Please login to merge, or discard this patch.
www/includes/easyparliament/metadata.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 */
68 68
 
69
-$page =  [
69
+$page = [
70 70
 
71 71
     // Things used on EVERY page, unless overridden for a page:
72 72
     'default' =>  [
@@ -1295,7 +1295,7 @@  discard block
 block discarded – undo
1295 1295
 // The text displayed on the page itself will also be this,
1296 1296
 // UNLESS the section has a 'heading', in which case that's used instead.
1297 1297
 
1298
-$section =  [
1298
+$section = [
1299 1299
 
1300 1300
 
1301 1301
     'about' =>  [
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/header.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -20,39 +20,39 @@  discard block
 block discarded – undo
20 20
                 <p class="person-header__about__position">
21 21
                 <?php
22 22
                     $lat = $latest_membership['party'] == 'Bishop' ? '' : $latest_membership['party'];
23
-                  if ($latest_membership['current']) {
24
-                      if ($latest_membership['constituency']) {
25
-                          # First %s is party, second is type of rep (e.g. MS), third is constituency name
26
-                          printf(
27
-                              gettext('<span class="person-header__about__position__role">%s %s</span> for <span class="person-header__about__position__constituency">%s</span>'),
28
-                              $lat,
29
-                              $latest_membership['rep_name'],
30
-                              $latest_membership['constituency']
31
-                          );
32
-                      } else {
33
-                          printf(
34
-                              gettext('<span class="person-header__about__position__role">%s %s</span>'),
35
-                              $lat,
36
-                              $latest_membership['rep_name']
37
-                          );
38
-                      }
39
-                  } else {
40
-                      if ($latest_membership['constituency']) {
41
-                          printf(
42
-                              gettext('<span class="person-header__about__position__role">Former %s %s</span> for <span class="person-header__about__position__constituency">%s</span>'),
43
-                              $lat,
44
-                              $latest_membership['rep_name'],
45
-                              $latest_membership['constituency']
46
-                          );
47
-                      } else {
48
-                          printf(
49
-                              gettext('<span class="person-header__about__position__role">Former %s %s</span>'),
50
-                              $lat,
51
-                              $latest_membership['rep_name']
52
-                          );
53
-                      }
54
-                  }
55
-                  ?>
23
+                    if ($latest_membership['current']) {
24
+                        if ($latest_membership['constituency']) {
25
+                            # First %s is party, second is type of rep (e.g. MS), third is constituency name
26
+                            printf(
27
+                                gettext('<span class="person-header__about__position__role">%s %s</span> for <span class="person-header__about__position__constituency">%s</span>'),
28
+                                $lat,
29
+                                $latest_membership['rep_name'],
30
+                                $latest_membership['constituency']
31
+                            );
32
+                        } else {
33
+                            printf(
34
+                                gettext('<span class="person-header__about__position__role">%s %s</span>'),
35
+                                $lat,
36
+                                $latest_membership['rep_name']
37
+                            );
38
+                        }
39
+                    } else {
40
+                        if ($latest_membership['constituency']) {
41
+                            printf(
42
+                                gettext('<span class="person-header__about__position__role">Former %s %s</span> for <span class="person-header__about__position__constituency">%s</span>'),
43
+                                $lat,
44
+                                $latest_membership['rep_name'],
45
+                                $latest_membership['constituency']
46
+                            );
47
+                        } else {
48
+                            printf(
49
+                                gettext('<span class="person-header__about__position__role">Former %s %s</span>'),
50
+                                $lat,
51
+                                $latest_membership['rep_name']
52
+                            );
53
+                        }
54
+                    }
55
+                    ?>
56 56
                 </p>
57 57
               <?php } ?>
58 58
               <?php if (count($social_links) > 0) { ?>
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
           <?php if ($current_member_anywhere) { ?>
78 78
             <div class="person-header__actions">
79 79
               <?php if ($this_page != 'royal') {
80
-                  $wtt_url = 'https://www.writetothem.com/';
81
-                  if ($current_member[HOUSE_TYPE_LORDS]) {
82
-                      $wtt_url = $wtt_url . "?person=uk.org.publicwhip/person/$person_id";
83
-                  } elseif ($the_users_mp) {
84
-                      $wtt_url = $wtt_url . "?a=WMC&amp;pc=" . _htmlentities(urlencode($user_postcode));
85
-                  }
86
-                  ?>
80
+                    $wtt_url = 'https://www.writetothem.com/';
81
+                    if ($current_member[HOUSE_TYPE_LORDS]) {
82
+                        $wtt_url = $wtt_url . "?person=uk.org.publicwhip/person/$person_id";
83
+                    } elseif ($the_users_mp) {
84
+                        $wtt_url = $wtt_url . "?a=WMC&amp;pc=" . _htmlentities(urlencode($user_postcode));
85
+                    }
86
+                    ?>
87 87
                 <a href="<?= $wtt_url ?>" class="button" onclick="trackLinkClick(this, 'link_click', 'WriteToThem', 'Person'); return false;"><?= gettext('Send a message') ?></a>
88 88
               <?php } ?>
89 89
               <?php if ($has_email_alerts) { ?>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/votes_svg.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,15 +44,15 @@
 block discarded – undo
44 44
     <text font-size="24" font-weight="normal" fill="#000000">
45 45
         <?php foreach ($lines as $j => $line) { ?>
46 46
             <tspan x="40" y="<?= $stance_y + $stance_padding_top + $stance_baseline_offset + ($stance_lineheight * $j) ?>"><?php
47
-               if (strpos($line, '*') !== false) {
48
-                   echo preg_replace(
49
-                       '#(?:^|[*])([^\r\n *][^*\n]*[^\r\n *])(?:$|[*])#i',
50
-                       '$1',
51
-                       $line
52
-                   );
53
-               } else {
54
-                   echo $line;
55
-               }
47
+                if (strpos($line, '*') !== false) {
48
+                    echo preg_replace(
49
+                        '#(?:^|[*])([^\r\n *][^*\n]*[^\r\n *])(?:$|[*])#i',
50
+                        '$1',
51
+                        $line
52
+                    );
53
+                } else {
54
+                    echo $line;
55
+                }
56 56
             ?></tspan>
57 57
         <?php } ?>
58 58
     </text>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/homepage/devolved-list.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-$nav_items =  [
2
+$nav_items = [
3 3
     ['hansard', 'alldebatesfront', 'mps', 'peers', 'wranswmsfront', 'divisions_recent_commons', 'divisions_recent_lords'],
4
-    ['sp_home', 'sp_home', 'spdebatesfront', 'msps',  'spwransfront', 'divisions_recent_sp'],
4
+    ['sp_home', 'sp_home', 'spdebatesfront', 'msps', 'spwransfront', 'divisions_recent_sp'],
5 5
     ['wales_home', 'wales_home', 'wales_debates', 'mss', 'welshlanguage', 'divisions_recent_wales'],
6 6
     ['ni_home', 'ni_home', 'nioverview', 'mlas'],
7 7
 ];
Please login to merge, or discard this patch.
www/includes/easyparliament/commentreportlist.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         $data = [];
98 98
         foreach ($q as $row) {
99
-            $data[] =  [
99
+            $data[] = [
100 100
                 'report_id'		=> $row['report_id'],
101 101
                 'comment_id' 	=> $row['comment_id'],
102 102
                 'firstname'		=> $row['firstname'],
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             ];
108 108
         }
109 109
         foreach ($r as $row) {
110
-            $data[] =  [
110
+            $data[] = [
111 111
                 'report_id'		=> $row['report_id'],
112 112
                 'comment_id' 	=> $row['comment_id'],
113 113
                 'firstname'		=> $row['firstname'],
Please login to merge, or discard this patch.
www/includes/easyparliament/alert.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public $token_checked = null;
41 41
     private $alert_id = "";
42 42
     public $email = "";
43
-    public $criteria = "";		// Sets the terms that are used to produce the search results.
43
+    public $criteria = ""; // Sets the terms that are used to produce the search results.
44 44
 
45 45
     private $db;
46 46
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $contents = ['criteria' => $row['criteria'], 'count' => $row['cnt']];
72 72
             $data[] = $contents;
73 73
         }
74
-        $data =  ['alerts' => $data];
74
+        $data = ['alerts' => $data];
75 75
         return $data;
76 76
     }
77 77
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
         $data = $q->fetchAll();
101 101
         $info = "Alert";
102
-        $data =  ['info' => $info, 'data' => $data];
102
+        $data = ['info' => $info, 'data' => $data];
103 103
 
104 104
         return $data;
105 105
     }
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
         }
255 255
 
256 256
         // Arrays we need to send a templated email.
257
-        $data =  [
257
+        $data = [
258 258
             'to' 		=> $details['email'],
259 259
             'template' 	=> 'alert_confirmation',
260 260
         ];
261 261
 
262
-        $merge =  [
262
+        $merge = [
263 263
             'CONFIRMURL'	=> $confirmurl,
264 264
             'CRITERIA'	=> $this->criteria_pretty(),
265 265
         ];
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     }
274 274
 
275 275
     public function send_already_signedup_email($details) {
276
-        $data =  [
276
+        $data = [
277 277
             'to' 		=> $details['email'],
278 278
             'template' 	=> 'alert_already_signedup',
279 279
         ];
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         $criteria = \MySociety\TheyWorkForYou\Utility\Alert::detailsToCriteria($details);
282 282
         $this->criteria = $criteria;
283 283
 
284
-        $merge =  [
284
+        $merge = [
285 285
             'CRITERIA'	=> $this->criteria_pretty(),
286 286
         ];
287 287
 
Please login to merge, or discard this patch.