Failed Conditions
Pull Request — master (#1328)
by Nick
33:04 queued 18:05
created
www/docs/news/rdf.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 <?php
26 26
     $c = 0;
27 27
     foreach ($all_news as $id => $news_row) {
28
-        if ($c++ == 10) break;
28
+        if ($c++ == 10) {
29
+            break;
30
+        }
29 31
         list($title, $content, $date) = $news_row;
30 32
         $url = "https://www.theyworkforyou.com".news_individual_link($date, $title);
31 33
         print "<rdf:li rdf:resource=\"$url\" />\n";
@@ -39,7 +41,9 @@  discard block
 block discarded – undo
39 41
 <?php
40 42
     $c = 0;
41 43
     foreach ($all_news as $id => $news_row) {
42
-        if ($c++ == 10) break;
44
+        if ($c++ == 10) {
45
+            break;
46
+        }
43 47
         list($title, $content, $date) = $news_row;
44 48
         $url = "https://www.theyworkforyou.com".news_individual_link($date, $title);
45 49
         $excerpt = trim_characters(news_format_body($content), 0, 250);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     foreach ($all_news as $id => $news_row) {
28 28
         if ($c++ == 10) break;
29 29
         list($title, $content, $date) = $news_row;
30
-        $url = "https://www.theyworkforyou.com".news_individual_link($date, $title);
30
+        $url = "https://www.theyworkforyou.com" . news_individual_link($date, $title);
31 31
         print "<rdf:li rdf:resource=\"$url\" />\n";
32 32
     }
33 33
 ?>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     foreach ($all_news as $id => $news_row) {
42 42
         if ($c++ == 10) break;
43 43
         list($title, $content, $date) = $news_row;
44
-        $url = "https://www.theyworkforyou.com".news_individual_link($date, $title);
44
+        $url = "https://www.theyworkforyou.com" . news_individual_link($date, $title);
45 45
         $excerpt = trim_characters(news_format_body($content), 0, 250);
46 46
         $date = str_replace(" ", "T", $date) . "+00:00";
47 47
 ?>
Please login to merge, or discard this patch.
www/docs/news/index.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,10 +9,14 @@  discard block
 block discarded – undo
9 9
 if (preg_match("#/(\d\d\d\d)/(\d\d)/(\d\d)/([a-z0-9_]+)(\.php)?$#", $uri, $matches)) {
10 10
     // Individual item
11 11
     list($all, $year, $month, $day, $ref) = $matches;
12
-    if ($ref == "please_build_on_") $ref = "new_full_source_";
12
+    if ($ref == "please_build_on_") {
13
+        $ref = "new_full_source_";
14
+    }
13 15
     foreach ($all_news as $id => $news_row) {
14 16
         list($title, $content, $date) = $news_row;
15
-        if (news_format_ref($title) != $ref) continue;
17
+        if (news_format_ref($title) != $ref) {
18
+            continue;
19
+        }
16 20
 
17 21
         $this_page = 'sitenews_individual';
18 22
         $DATA->set_page_metadata($this_page, 'title', $title);
@@ -20,7 +24,9 @@  discard block
 block discarded – undo
20 24
         $PAGE->stripe_start();
21 25
         print news_format_body($content);
22 26
         print "<p>Posted on " . format_date(substr($date, 0, 10), LONGDATEFORMAT) . " at " . substr($date, 11);
23
-        if (isset($news_row[3])) print " by $news_row[3]";
27
+        if (isset($news_row[3])) {
28
+            print " by $news_row[3]";
29
+        }
24 30
         print " | <a href=\"" . news_individual_link($date, $title) . "\">Link to this</a>";
25 31
         break;
26 32
     }
@@ -37,12 +43,16 @@  discard block
 block discarded – undo
37 43
     $PAGE->stripe_start();
38 44
     foreach (array_reverse($all_news) as $id => $news_row) {
39 45
         list($title, $content, $date) = $news_row;
40
-        if (substr($date, 0, 7) != "$year-$month") continue;
46
+        if (substr($date, 0, 7) != "$year-$month") {
47
+            continue;
48
+        }
41 49
         print "<h3>" . format_date(substr($date, 0, 10), LONGDATEFORMAT) . "</h3>";
42 50
         print "<h4>" . $title . "</h4>";
43 51
         print news_format_body($content);
44 52
         print "<p>Posted at " . substr($date, 11);
45
-        if (isset($news_row[3])) print " by $news_row[3]";
53
+        if (isset($news_row[3])) {
54
+            print " by $news_row[3]";
55
+        }
46 56
         print " | <a href=\"" . news_individual_link($date, $title) . "\">Link to this</a>";
47 57
     }
48 58
 } else {
@@ -52,13 +62,17 @@  discard block
 block discarded – undo
52 62
     $PAGE->stripe_start();
53 63
     $c = 0;
54 64
     foreach ($all_news as $id => $news_row) {
55
-        if ($c++ == 10) break;
65
+        if ($c++ == 10) {
66
+            break;
67
+        }
56 68
         list($title, $content, $date) = $news_row;
57 69
         print "<h3>" . format_date(substr($date, 0, 10), LONGDATEFORMAT) . "</h3>";
58 70
         print "<h4>" . $title . "</h4>";
59 71
         print news_format_body($content);
60 72
         print "<p>Posted at " . substr($date, 11);
61
-        if (isset($news_row[3])) print " by $news_row[3]";
73
+        if (isset($news_row[3])) {
74
+            print " by $news_row[3]";
75
+        }
62 76
         print " | <a href=\"" . news_individual_link($date, $title) . "\">Link to this</a>";
63 77
     }
64 78
 }
Please login to merge, or discard this patch.
www/docs/api/api_getAlerts.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function api_getAlerts_start_date($start_date) {
4
-  $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
5
-  $alert = new ALERT();
6
-  $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']);
7
-  api_output($data);
4
+    $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
5
+    $alert = new ALERT();
6
+    $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']);
7
+    api_output($data);
8 8
 }
9 9
 
10 10
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function api_getAlerts_start_date($start_date) {
4
-  $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
4
+  $args = array('start_date' => $start_date, 'end_date' => get_http_var('end_date'));
5 5
   $alert = new ALERT();
6
-  $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']);
6
+  $data = $alert->fetch_between($confirmed = 1, $deleted = 0, $args['start_date'], $args['end_date']);
7 7
   api_output($data);
8 8
 }
9 9
 
Please login to merge, or discard this patch.
www/docs/api/api_getGeometry.php 2 patches
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,13 +38,17 @@  discard block
 block discarded – undo
38 38
 
39 39
 function api_getGeometry_name($name) {
40 40
     $out = _api_getGeometry_name($name);
41
-    if ($out) api_output($out);
42
-    else api_error('Name not recognised');
43
-}
41
+    if ($out) {
42
+        api_output($out);
43
+    } else {
44
+        api_error('Name not recognised');
45
+    }
46
+    }
44 47
 
45 48
 function _api_getGeometry_name($name) {
46
-    if (!defined('OPTION_MAPIT_URL') || !OPTION_MAPIT_URL)
47
-        return null;
49
+    if (!defined('OPTION_MAPIT_URL') || !OPTION_MAPIT_URL) {
50
+            return null;
51
+    }
48 52
 
49 53
     $name = MySociety\TheyWorkForYou\Utility\Constituencies::normaliseConstituencyName($name);
50 54
 
@@ -68,8 +72,9 @@  discard block
 block discarded – undo
68 72
 
69 73
 function _api_cacheCheck($fn, $arg='') {
70 74
     $cache = INCLUDESPATH . '../docs/api/cache/' . $fn;
71
-    if (is_file($cache))
72
-        return unserialize(file_get_contents($cache));
75
+    if (is_file($cache)) {
76
+            return unserialize(file_get_contents($cache));
77
+    }
73 78
     $out = mapit_call($fn, $arg);
74 79
     $fp = fopen($cache, 'w');
75 80
     if ($fp) {
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     return null;
67 67
 }
68 68
 
69
-function _api_cacheCheck($fn, $arg='') {
69
+function _api_cacheCheck($fn, $arg = '') {
70 70
     $cache = INCLUDESPATH . '../docs/api/cache/' . $fn;
71 71
     if (is_file($cache))
72 72
         return unserialize(file_get_contents($cache));
@@ -83,58 +83,58 @@  discard block
 block discarded – undo
83 83
 function _api_ni_centroids() {
84 84
     return array(
85 85
         # East Londonderry
86
-        66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ),
87
-        14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907 ),
86
+        66129 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907),
87
+        14276 => array('centre_lat' => 54.980766, 'centre_lon' => -6.904907),
88 88
         # Foyle
89
-        66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ),
90
-        14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456 ),
89
+        66131 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456),
90
+        14273 => array('centre_lat' => 54.933453, 'centre_lon' => -7.267456),
91 91
         # West Tyrone
92
-        66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ),
93
-        14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278 ),
92
+        66141 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278),
93
+        14292 => array('centre_lat' => 54.619797, 'centre_lon' => -7.410278),
94 94
         # Fermanagh &amp; South Tyrone
95
-        14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ),
96
-        66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237 ),
95
+        14296 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237),
96
+        66130 => array('centre_lat' => 54.354958, 'centre_lon' => -7.443237),
97 97
         # Newry &amp; Armagh
98
-        14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ),
99
-        66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770 ),
98
+        14303 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770),
99
+        66134 => array('centre_lat' => 54.297295, 'centre_lon' => -6.613770),
100 100
         # Upper Bann
101
-        14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ),
102
-        66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098 ),
101
+        14300 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098),
102
+        66140 => array('centre_lat' => 54.399750, 'centre_lon' => -6.350098),
103 103
         # South Down
104
-        14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ),
105
-        66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344 ),
104
+        14306 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344),
105
+        66138 => array('centre_lat' => 54.213860, 'centre_lon' => -6.152344),
106 106
         # Lagan Valley
107
-        14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ),
108
-        66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398 ),
107
+        14309 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398),
108
+        66132 => array('centre_lat' => 54.441296, 'centre_lon' => -6.108398),
109 109
         # Strangford
110
-        14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ),
111
-        66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343 ),
110
+        14312 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343),
111
+        66139 => array('centre_lat' => 54.514706, 'centre_lon' => -5.751343),
112 112
         # North Down
113
-        14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ),
114
-        66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384 ),
113
+        14325 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384),
114
+        66136 => array('centre_lat' => 54.651592, 'centre_lon' => -5.718384),
115 115
         # South Antrim
116
-        14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ),
117
-        66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905 ),
116
+        14318 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905),
117
+        66137 => array('centre_lat' => 54.699234, 'centre_lon' => -6.102905),
118 118
         # East Antrim
119
-        66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ),
120
-        14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179 ),
119
+        66128 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179),
120
+        14284 => array('centre_lat' => 54.832336, 'centre_lon' => -5.883179),
121 121
         # North Antrim
122
-        66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ),
123
-        14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125 ),
122
+        66135 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125),
123
+        14280 => array('centre_lat' => 54.993374, 'centre_lon' => -6.328125),
124 124
         # Mid Ulster
125
-        66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ),
126
-        14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044 ),
125
+        66133 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044),
126
+        14288 => array('centre_lat' => 54.721447, 'centre_lon' => -6.795044),
127 127
         # Belfast North
128
-        14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ),
129
-        66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511 ),
128
+        14321 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511),
129
+        66125 => array('centre_lat' => 54.618607, 'centre_lon' => -5.917511),
130 130
         # Belfast East
131
-        14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ),
132
-        66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792 ),
131
+        14329 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792),
132
+        66124 => array('centre_lat' => 54.598324, 'centre_lon' => -5.892792),
133 133
         # Belfast South
134
-        14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ),
135
-        66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064 ),
134
+        14331 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064),
135
+        66126 => array('centre_lat' => 54.582409, 'centre_lon' => -5.925064),
136 136
         # Belfast West
137
-        14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ),
138
-        66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650 ),
137
+        14315 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650),
138
+        66127 => array('centre_lat' => 54.606277, 'centre_lon' => -5.956650),
139 139
     );
140 140
 }
Please login to merge, or discard this patch.
www/docs/api/key.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,9 +38,13 @@  discard block
 block discarded – undo
38 38
     foreach ($keys as $keyarr) {
39 39
         list($key, $commercial, $created, $reason, $estimated_usage) = $keyarr;
40 40
         echo '<li><span style="font-size:200%">' . $key . '</span><br><span style="color: #666666;">';
41
-        if ($commercial==1) echo 'Commercial key,';
42
-        elseif ($commercial==-1) echo 'Key';
43
-        else echo 'Non-commercial key,';
41
+        if ($commercial==1) {
42
+            echo 'Commercial key,';
43
+        } elseif ($commercial==-1) {
44
+            echo 'Key';
45
+        } else {
46
+            echo 'Non-commercial key,';
47
+        }
44 48
         echo ' created ', $created, '; ', $reason, '; estimated usage ', $estimated_usage;
45 49
         echo '</span><br><em>Usage statistics</em>: ';
46 50
         $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="' . $key . '" AND query_time > NOW() - interval 1 day');
@@ -75,7 +79,9 @@  discard block
 block discarded – undo
75 79
     global $THEUSER;
76 80
     $key = auth_ab64_encode(urandom_bytes(16));
77 81
     $db = new ParlDB;
78
-    if ($commercial=='') $commercial = 0;
82
+    if ($commercial=='') {
83
+        $commercial = 0;
84
+    }
79 85
     $db->query('INSERT INTO api_key (user_id, api_key, commercial, created, reason, estimated_usage) VALUES
80 86
         (:user_id, :key, :commercial, NOW(), :reason, :estimated_usage)', array(
81 87
         ':user_id' => $THEUSER->user_id(),
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     if (get_http_var('create_key') && get_http_var('reason')) {
22 22
         $estimated_usage = (int) get_http_var('estimated_usage');
23 23
         $commercial = get_http_var('commercial');
24
-        create_key($commercial, get_http_var('reason'),  $estimated_usage);
24
+        create_key($commercial, get_http_var('reason'), $estimated_usage);
25 25
         if ($commercial == '1' || $estimated_usage > 50000) {
26 26
             echo '<p><strong>It looks like your usage may fall outside of our free-of-charge bracket: if that\'s the case, this key might get blocked, so we\'d advise you to email us at <a href="[email protected]">[email protected]</a> to discuss licensing options.</strong></p>';
27 27
         }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     $db = new ParlDB;
30 30
     $q = $db->query('SELECT api_key, commercial, created, reason, estimated_usage FROM api_key WHERE user_id=' . $THEUSER->user_id());
31 31
     $keys = array();
32
-    for ($i=0; $i<$q->rows(); $i++) {
32
+    for ($i = 0; $i < $q->rows(); $i++) {
33 33
         $keys[] = array($q->field($i, 'api_key'), $q->field($i, 'commercial'), $q->field($i, 'created'), $q->field($i, 'reason'), $q->field($i, 'estimated_usage'));
34 34
     }
35 35
     if ($keys) {
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
     foreach ($keys as $keyarr) {
39 39
         list($key, $commercial, $created, $reason, $estimated_usage) = $keyarr;
40 40
         echo '<li><span style="font-size:200%">' . $key . '</span><br><span style="color: #666666;">';
41
-        if ($commercial==1) echo 'Commercial key,';
42
-        elseif ($commercial==-1) echo 'Key';
41
+        if ($commercial == 1) echo 'Commercial key,';
42
+        elseif ($commercial == -1) echo 'Key';
43 43
         else echo 'Non-commercial key,';
44 44
         echo ' created ', $created, '; ', $reason, '; estimated usage ', $estimated_usage;
45 45
         echo '</span><br><em>Usage statistics</em>: ';
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     global $THEUSER;
76 76
     $key = auth_ab64_encode(urandom_bytes(16));
77 77
     $db = new ParlDB;
78
-    if ($commercial=='') $commercial = 0;
78
+    if ($commercial == '') $commercial = 0;
79 79
     $db->query('INSERT INTO api_key (user_id, api_key, commercial, created, reason, estimated_usage) VALUES
80 80
         (:user_id, :key, :commercial, NOW(), :reason, :estimated_usage)', array(
81 81
         ':user_id' => $THEUSER->user_id(),
Please login to merge, or discard this patch.
www/docs/api/api_getCommittee.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,11 @@  discard block
 block discarded – undo
57 57
     $name = preg_replace('#\s+Committee#', '', $name);
58 58
 
59 59
     $date = parse_date(get_http_var('date'));
60
-    if ($date) $date = '"' . $date['iso'] . '"';
61
-    else $date = 'date(now())';
60
+    if ($date) {
61
+        $date = '"' . $date['iso'] . '"';
62
+    } else {
63
+        $date = 'date(now())';
64
+    }
62 65
     $q = $db->query("select distinct(dept) from moffice
63 66
         where dept like :department
64 67
         and from_date <= $date and $date <= to_date", array(
@@ -108,8 +111,11 @@  discard block
 block discarded – undo
108 111
     $db = new ParlDB;
109 112
 
110 113
     $date = parse_date($date);
111
-    if ($date) $date = '"' . $date['iso'] . '"';
112
-    else $date = 'date(now())';
114
+    if ($date) {
115
+        $date = '"' . $date['iso'] . '"';
116
+    } else {
117
+        $date = 'date(now())';
118
+    }
113 119
     $q = $db->query("select distinct(dept) from moffice
114 120
         where source = 'chgpages/selctee'
115 121
         and from_date <= $date and $date <= to_date");
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             ));
67 67
     if ($q->rows() > 1) {
68 68
         # More than one committee matches
69
-        for ($i=0; $i<$q->rows(); $i++) {
69
+        for ($i = 0; $i < $q->rows(); $i++) {
70 70
             $output['committees'][] = array(
71 71
                 'name' => $q->field($i, 'dept')
72 72
             );
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         if ($q->rows()) {
86 86
             $output = array();
87 87
             $output['committee'] = $q->field(0, 'dept');
88
-            for ($i=0; $i<$q->rows(); $i++) {
88
+            for ($i = 0; $i < $q->rows(); $i++) {
89 89
                 $member = array(
90 90
                     'person_id' => $q->field($i, 'person'),
91 91
                     'name' => $q->field($i, 'given_name') . ' ' . $q->field($i, 'family_name'),
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         where source = 'chgpages/selctee'
115 115
         and from_date <= $date and $date <= to_date");
116 116
     if ($q->rows()) {
117
-        for ($i=0; $i<$q->rows(); $i++) {
117
+        for ($i = 0; $i < $q->rows(); $i++) {
118 118
             $output['committees'][] = array(
119 119
                 'name' => $q->field($i, 'dept')
120 120
             );
Please login to merge, or discard this patch.
www/docs/api/api_convertURL.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -75,22 +75,25 @@
 block discarded – undo
75 75
     $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url = :url order by gid limit 1', array(
76 76
         ':url' => $url
77 77
         ));
78
-    if ($q->rows())
79
-        return api_converturl_url_output($q);
78
+    if ($q->rows()) {
79
+            return api_converturl_url_output($q);
80
+    }
80 81
 
81 82
     $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url like :url order by gid limit 1', array(
82 83
         ':url' => $url_nohash . '%'
83 84
         ));
84
-    if ($q->rows())
85
-        return api_converturl_url_output($q);
85
+    if ($q->rows()) {
86
+            return api_converturl_url_output($q);
87
+    }
86 88
 
87 89
     $url_bound = str_replace('cmhansrd/cm', 'cmhansrd/vo', $url_nohash);
88 90
     if ($url_bound != $url_nohash) {
89 91
         $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url like :url order by gid limit 1', array(
90 92
             ':url' => $url_bound . '%'
91 93
             ));
92
-        if ($q->rows())
93
-            return api_converturl_url_output($q);
94
+        if ($q->rows()) {
95
+                    return api_converturl_url_output($q);
96
+        }
94 97
     }
95 98
     api_error('Sorry, URL could not be converted');
96 99
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']);
41 41
     $fragment = '';
42 42
     if ($id_data['htype'] == '11' || $id_data['htype'] == '10') {
43
-        $LISTURL->insert( array( 'id' => $id_data['gid'] ) );
43
+        $LISTURL->insert(array('id' => $id_data['gid']));
44 44
     } else {
45 45
         $parent_epobject_id = $id_data['subsection_id'];
46 46
         $parent_gid = '';
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
                     ':epobject_id' => $parent_epobject_id
51 51
                     ));
52 52
         if ($r->rows() > 0) {
53
-            $parent_gid = fix_gid_from_db( $r->field(0, 'gid') );
53
+            $parent_gid = fix_gid_from_db($r->field(0, 'gid'));
54 54
         }
55 55
         if ($parent_gid != '') {
56
-            $LISTURL->insert( array( 'id' => $parent_gid ) );
56
+            $LISTURL->insert(array('id' => $parent_gid));
57 57
             $fragment = '#g' . gid_to_anchor($id_data['gid']);
58 58
         }
59 59
     }
Please login to merge, or discard this patch.
www/docs/api/api_getComments.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 }
25 25
 
26 26
 function api_getComments_start_date($start_date) {
27
-        $args = array (
27
+        $args = array(
28 28
             'start_date' => $start_date,
29 29
             'end_date' => get_http_var('end_date')
30 30
         );
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 }
34 34
 
35 35
 function api_getComments_search($s) {
36
-        $args = array (
36
+        $args = array(
37 37
             's' => $s,
38 38
             'p' => get_http_var('page'),
39 39
             'num' => get_http_var('num'),
Please login to merge, or discard this patch.
www/docs/api/api_getMPsInfo.php 2 patches
Braces   +21 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
     $ids = preg_split('#\s*,\s*#', $ids, -1, PREG_SPLIT_NO_EMPTY);
21 21
     $safe_ids = array(0);
22 22
     foreach ($ids as $id) {
23
-        if (ctype_digit($id)) $safe_ids[] = $id;
23
+        if (ctype_digit($id)) {
24
+            $safe_ids[] = $id;
25
+        }
24 26
     }
25 27
     $ids = join(',', $safe_ids);
26 28
 
@@ -32,13 +34,15 @@  discard block
 block discarded – undo
32 34
         $output = array();
33 35
         for ($i=0; $i<$q->rows(); $i++) {
34 36
             $data_key = $q->field($i, 'data_key');
35
-            if (count($fields) && !in_array($data_key, $fields))
36
-                continue;
37
+            if (count($fields) && !in_array($data_key, $fields)) {
38
+                            continue;
39
+            }
37 40
             $pid = $q->field($i, 'person_id');
38 41
             $output[$pid][$data_key] = $q->field($i, 'data_value');
39 42
             $time = strtotime($q->field($i, 'lastupdate'));
40
-            if ($time > $last_mod)
41
-                $last_mod = $time;
43
+            if ($time > $last_mod) {
44
+                            $last_mod = $time;
45
+            }
42 46
         }
43 47
         $q = $db->query("select memberinfo.*, person_id from memberinfo, member
44 48
             where memberinfo.member_id=member.member_id and person_id in (" . $ids . ")
@@ -46,16 +50,22 @@  discard block
 block discarded – undo
46 50
         if ($q->rows()) {
47 51
             for ($i=0; $i<$q->rows(); $i++) {
48 52
                 $data_key = $q->field($i, 'data_key');
49
-                if (count($fields) && !in_array($data_key, $fields))
50
-                    continue;
53
+                if (count($fields) && !in_array($data_key, $fields)) {
54
+                                    continue;
55
+                }
51 56
                 $mid = $q->field($i, 'member_id');
52 57
                 $pid = $q->field($i, 'person_id');
53
-                if (!isset($output[$pid]['by_member_id'])) $output[$pid]['by_member_id'] = array();
54
-                if (!isset($output[$pid]['by_member_id'][$mid])) $output[$pid]['by_member_id'][$mid] = array();
58
+                if (!isset($output[$pid]['by_member_id'])) {
59
+                    $output[$pid]['by_member_id'] = array();
60
+                }
61
+                if (!isset($output[$pid]['by_member_id'][$mid])) {
62
+                    $output[$pid]['by_member_id'][$mid] = array();
63
+                }
55 64
                 $output[$pid]['by_member_id'][$mid][$data_key] = $q->field($i, 'data_value');
56 65
                 $time = strtotime($q->field($i, 'lastupdate'));
57
-                if ($time > $last_mod)
58
-                    $last_mod = $time;
66
+                if ($time > $last_mod) {
67
+                                    $last_mod = $time;
68
+                }
59 69
             }
60 70
         }
61 71
         ksort($output);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         where person_id in (" . $ids . ")");
31 31
     if ($q->rows()) {
32 32
         $output = array();
33
-        for ($i=0; $i<$q->rows(); $i++) {
33
+        for ($i = 0; $i < $q->rows(); $i++) {
34 34
             $data_key = $q->field($i, 'data_key');
35 35
             if (count($fields) && !in_array($data_key, $fields))
36 36
                 continue;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             where memberinfo.member_id=member.member_id and person_id in (" . $ids . ")
45 45
             order by person_id,member_id");
46 46
         if ($q->rows()) {
47
-            for ($i=0; $i<$q->rows(); $i++) {
47
+            for ($i = 0; $i < $q->rows(); $i++) {
48 48
                 $data_key = $q->field($i, 'data_key');
49 49
                 if (count($fields) && !in_array($data_key, $fields))
50 50
                     continue;
Please login to merge, or discard this patch.