Passed
Push — master ( 2073b4...fffc45 )
by Struan
06:46
created
www/docs/admin/reports.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include_once '../../includes/easyparliament/init.php';
4
-include_once (INCLUDESPATH."easyparliament/commentreportlist.php");
4
+include_once (INCLUDESPATH . "easyparliament/commentreportlist.php");
5 5
 
6 6
 $this_page = "admin_commentreports";
7 7
 
Please login to merge, or discard this patch.
www/docs/admin/comments.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include_once '../../includes/easyparliament/init.php';
4
-include_once (INCLUDESPATH."easyparliament/commentreportlist.php");
4
+include_once (INCLUDESPATH . "easyparliament/commentreportlist.php");
5 5
 
6 6
 $this_page = "admin_comments";
7 7
 
Please login to merge, or discard this patch.
www/docs/admin/report.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 // where rid is a report_id and cid is a comment_id.
7 7
 
8 8
 include_once '../../includes/easyparliament/init.php';
9
-include_once (INCLUDESPATH."easyparliament/commentreport.php");
9
+include_once (INCLUDESPATH . "easyparliament/commentreport.php");
10 10
 
11 11
 $this_page = "admin_commentreport";
12 12
 
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
     global $this_page;
178 178
 
179 179
 #	$commentermail = preg_replace("/\n/", "<br>\n", get_template_contents('comment_deleted') );
180
-    $commentermail = preg_replace('/^Subject:.*\n/', '', get_template_contents('comment_deleted') );
181
-    $reportermail = preg_replace("/\n/", "<br>\n", get_template_contents('report_upheld') );
180
+    $commentermail = preg_replace('/^Subject:.*\n/', '', get_template_contents('comment_deleted'));
181
+    $reportermail = preg_replace("/\n/", "<br>\n", get_template_contents('report_upheld'));
182 182
 
183 183
     ?>
184 184
         <p><strong>You've chosen to delete this comment.</strong> You can now send an email to both the person who posted the comment, and the person who made the report. Uncheck a box to prevent an email from being sent. The comment will not be deleted until you click the button below.</p>
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 
212 212
     global $this_page;
213 213
 
214
-    $reportermail = preg_replace("/\n/", "<br>\n", get_template_contents('report_declined') );
214
+    $reportermail = preg_replace("/\n/", "<br>\n", get_template_contents('report_declined'));
215 215
 
216 216
     ?>
217 217
         <p><strong>You have chosen not to delete this comment.</strong> You can now send an email to the person who made the report (uncheck the box to send no email). The report will not be resolved until you click the button below.</p>
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $upheld = false;
244 244
     }
245 245
 
246
-    $success = $REPORT->resolve ($upheld, $COMMENT);
246
+    $success = $REPORT->resolve($upheld, $COMMENT);
247 247
 
248 248
     if ($success) {
249 249
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 // The reporting user was logged in at the time,
262 262
                 // so get their email address.
263 263
                 $USER = new USER;
264
-                $USER->init( $REPORT->user_id() );
264
+                $USER->init($REPORT->user_id());
265 265
                 $email = $USER->email();
266 266
             } else {
267 267
                 // Non-logged-in user; they should have left their address.
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
             }
270 270
 
271 271
             // Prepare the data needed for either email.
272
-            $data = array (
272
+            $data = array(
273 273
                 'to' 			=> $email
274 274
             );
275
-            $merge = array (
275
+            $merge = array(
276 276
                 'FIRSTNAME' 	=> $REPORT->firstname(),
277 277
                 'LASTNAME' 		=> $REPORT->lastname(),
278 278
                 'REPORTBODY' 	=> strip_tags($REPORT->body())
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
             // Remove the anchor for their now deleted comment.
309 309
             $addcommentsurl = 'https://' . DOMAIN . preg_replace("/#.*$/", '#addcomment', $COMMENT->url());
310 310
 
311
-            $data = array (
311
+            $data = array(
312 312
                 'to' => $USER->email(),
313 313
                 'template' => 'comment_deleted_blank',
314 314
                 'subject' => 'One of your comments has been deleted',
315 315
             );
316
-            $merge = array (
316
+            $merge = array(
317 317
                 'REPLYBODY' => get_http_var('commentermail'),
318 318
                 'FIRSTNAME' 	=> $USER->firstname(),
319 319
                 'LASTNAME' 	=> $USER->lastname(),
Please login to merge, or discard this patch.
www/docs/admin/banner.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
     global $banner;
62 62
     $banner_text = get_http_var('banner');
63 63
 
64
-    if ( $banner->set_text($banner_text) ) {
64
+    if ($banner->set_text($banner_text)) {
65 65
         $out = "<h4>update successful</h4>";
66 66
         $out .= "<p>Banner text is now:</p><p>$banner_text</p>";
67 67
     } else {
Please login to merge, or discard this patch.
www/docs/admin/policies.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         )
111 111
     );
112 112
 
113
-    if ( $q->success() ) {
113
+    if ($q->success()) {
114 114
         $out = "<h4>update successful</h4>";
115 115
     }
116 116
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 
126 126
     $rettext .= '<div id="subnav_websites">';
127 127
     foreach ($subnav as $label => $path) {
128
-        $rettext .=  '<a href="'. $path . '">'. $label .'</a>';
128
+        $rettext .= '<a href="' . $path . '">' . $label . '</a>';
129 129
     }
130
-    $rettext .=  '</div>';
130
+    $rettext .= '</div>';
131 131
 
132 132
     return $rettext;
133 133
 }
Please login to merge, or discard this patch.
www/docs/api/api_getWMS.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,11 +100,11 @@
 block discarded – undo
100 100
     _api_getHansard_year('WMS', $y);
101 101
 }
102 102
 function api_getWMS_search($s) {
103
-    _api_getHansard_search( array(
103
+    _api_getHansard_search(array(
104 104
         's' => $s,
105 105
         'pid' => get_http_var('person'),
106 106
         'type' => 'wms',
107
-    ) );
107
+    ));
108 108
 }
109 109
 function api_getWMS_person($pid) {
110 110
     _api_getHansard_search(array(
Please login to merge, or discard this patch.
www/docs/api/api_getWrans.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,11 +57,11 @@
 block discarded – undo
57 57
     _api_getHansard_year('WRANS', $y);
58 58
 }
59 59
 function api_getWrans_search($s) {
60
-    _api_getHansard_search( array(
60
+    _api_getHansard_search(array(
61 61
         's' => $s,
62 62
         'pid' => get_http_var('person'),
63 63
         'type' => 'wrans',
64
-    ) );
64
+    ));
65 65
 }
66 66
 function api_getWrans_person($pid) {
67 67
     _api_getHansard_search(array(
Please login to merge, or discard this patch.
www/docs/api/api_getConstituencies.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
         and c_main.main_name and constituency.name like :constituency_name and constituency.from_date <= date(now())
42 42
         and date(now()) <= constituency.to_date
43 43
         order by name', array(
44
-        ':constituency_name' => '%' . $s .'%'
44
+        ':constituency_name' => '%' . $s . '%'
45 45
         ));
46 46
     $output = array();
47 47
     $done = array();
48
-    for ($i=0; $i<$q->rows(); $i++) {
48
+    for ($i = 0; $i < $q->rows(); $i++) {
49 49
         $name = $q->field($i, 'name');
50 50
         if (!in_array($name, $done)) {
51 51
             $output[] = array(
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 function api_getConstituencies($date = 'now()') {
71 71
     $db = new ParlDB;
72 72
     $q = $db->query('select cons_id, name from constituency
73
-        where main_name and from_date <= date('.$date.') and date('.$date.') <= to_date
73
+        where main_name and from_date <= date('.$date . ') and date(' . $date . ') <= to_date
74 74
         order by name');
75 75
     $output = array();
76
-    for ($i=0; $i<$q->rows(); $i++) {
76
+    for ($i = 0; $i < $q->rows(); $i++) {
77 77
         $output[] = array(
78 78
             # 'id' => $q->field($i, 'cons_id'),
79 79
             'name' => $q->field($i, 'name')
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  * smallest angle between them.
145 145
  */
146 146
 function _api_angle_between($a1, $a2) {
147
-    if (abs($a1 - $a2) > M_PI) return 2*M_PI - abs($a1 - $a2);
147
+    if (abs($a1 - $a2) > M_PI) return 2 * M_PI - abs($a1 - $a2);
148 148
     return abs($a1 - $a2);
149 149
 }
150 150
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,7 +108,9 @@  discard block
 block discarded – undo
108 108
     $geometry = _api_getGeometry();
109 109
     $out = array();
110 110
     foreach ($geometry['data'] as $name => $data) {
111
-        if (!isset($data['centre_lat']) || !isset($data['centre_lon'])) continue;
111
+        if (!isset($data['centre_lat']) || !isset($data['centre_lon'])) {
112
+            continue;
113
+        }
112 114
         $distance = R_e * acos(
113 115
             sin(deg2rad($lat)) * sin(deg2rad($data['centre_lat']))
114 116
             + cos(deg2rad($lat)) * cos(deg2rad($data['centre_lat']))
@@ -125,8 +127,12 @@  discard block
 block discarded – undo
125 127
         }
126 128
     }
127 129
     usort($out, function($a, $b) {
128
-        if ($a['distance'] > $b['distance']) return 1;
129
-        if ($a['distance'] < $b['distance']) return -1;
130
+        if ($a['distance'] > $b['distance']) {
131
+            return 1;
132
+        }
133
+        if ($a['distance'] < $b['distance']) {
134
+            return -1;
135
+        }
130 136
         return 0;
131 137
     });
132 138
     return $out;
@@ -145,7 +151,9 @@  discard block
 block discarded – undo
145 151
  * smallest angle between them.
146 152
  */
147 153
 function _api_angle_between($a1, $a2) {
148
-    if (abs($a1 - $a2) > M_PI) return 2*M_PI - abs($a1 - $a2);
154
+    if (abs($a1 - $a2) > M_PI) {
155
+        return 2*M_PI - abs($a1 - $a2);
156
+    }
149 157
     return abs($a1 - $a2);
150 158
 }
151 159
 
Please login to merge, or discard this patch.
www/docs/api/api_getConstituency.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     $q = $db->query("select constituency, data_key, data_value from consinfo
61 61
                      where constituency = :constituency", array(':constituency' => $constituency));
62 62
     if ($q->rows()) {
63
-        for ($i=0; $i<$q->rows(); $i++) {
63
+        for ($i = 0; $i < $q->rows(); $i++) {
64 64
             $data_key = $q->field($i, 'data_key');
65 65
             $output[$data_key] = $q->field($i, 'data_value');
66 66
         }
Please login to merge, or discard this patch.