Completed
Pull Request — master (#965)
by Nick
05:26
created
www/docs/api/api_getDebates.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once dirname(__FILE__) . '/api_getHansard.php';
3
+include_once dirname(__FILE__).'/api_getHansard.php';
4 4
 
5 5
 function api_getDebates_front() {
6 6
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getMSP.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 2
 
3
-include_once INCLUDESPATH . 'easyparliament/member.php';
4
-include_once dirname(__FILE__) . '/api_getPerson.php';
3
+include_once INCLUDESPATH.'easyparliament/member.php';
4
+include_once dirname(__FILE__).'/api_getPerson.php';
5 5
 
6 6
 function api_getMSP_front() {
7 7
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getMP.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 2
 
3
-include_once INCLUDESPATH . 'easyparliament/member.php';
4
-include_once dirname(__FILE__) . '/api_getPerson.php';
3
+include_once INCLUDESPATH.'easyparliament/member.php';
4
+include_once dirname(__FILE__).'/api_getPerson.php';
5 5
 
6 6
 function api_getMP_front() {
7 7
 ?>
Please login to merge, or discard this patch.
www/docs/api/api_getGeometry.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once INCLUDESPATH . '../../commonlib/phplib/mapit.php';
3
+include_once INCLUDESPATH.'../../commonlib/phplib/mapit.php';
4 4
 
5 5
 function api_getGeometry_front() {
6 6
 ?>
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
     return null;
67 67
 }
68 68
 
69
-function _api_cacheCheck($fn, $arg='') {
70
-    $cache = INCLUDESPATH . '../docs/api/cache/' . $fn;
69
+function _api_cacheCheck($fn, $arg = '') {
70
+    $cache = INCLUDESPATH.'../docs/api/cache/'.$fn;
71 71
     if (is_file($cache))
72 72
         return unserialize(file_get_contents($cache));
73 73
     $out = mapit_call($fn, $arg);
@@ -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.
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.
www/docs/api/api_getBoundary.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 2
 
3
-include_once INCLUDESPATH . '../../commonlib/phplib/mapit.php';
4
-include_once dirname(__FILE__) . '/api_getGeometry.php';
3
+include_once INCLUDESPATH.'../../commonlib/phplib/mapit.php';
4
+include_once dirname(__FILE__).'/api_getGeometry.php';
5 5
 
6 6
 function api_getBoundary_front() {
7 7
 ?>
Please login to merge, or discard this patch.
www/docs/api/key.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 include_once '../../includes/easyparliament/init.php';
4 4
 include_once './api_functions.php';
5
-include_once INCLUDESPATH . '../../commonlib/phplib/auth.php';
5
+include_once INCLUDESPATH.'../../commonlib/phplib/auth.php';
6 6
 
7 7
 $a = auth_ab64_encode(urandom_bytes(32));
8 8
 
@@ -21,15 +21,15 @@  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
         }
28 28
     }
29 29
     $db = new ParlDB;
30
-    $q = $db->query('SELECT api_key, commercial, created, reason, estimated_usage FROM api_key WHERE user_id=' . $THEUSER->user_id());
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) {
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
     }
38 38
     foreach ($keys as $keyarr) {
39 39
         list($key, $commercial, $created, $reason, $estimated_usage) = $keyarr;
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';
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 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>: ';
46
-        $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="' . $key . '" AND query_time > NOW() - interval 1 day');
46
+        $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="'.$key.'" AND query_time > NOW() - interval 1 day');
47 47
         $c = $q->field(0, 'count');
48 48
         echo "last 24 hours: $c, ";
49
-        $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="' . $key . '" AND query_time > NOW() - interval 1 week');
49
+        $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="'.$key.'" AND query_time > NOW() - interval 1 week');
50 50
         $c = $q->field(0, 'count');
51 51
         echo "last week: $c, ";
52
-        $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="' . $key . '" AND query_time > NOW() - interval 1 month');
52
+        $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="'.$key.'" AND query_time > NOW() - interval 1 month');
53 53
         $c = $q->field(0, 'count');
54 54
         echo "last month: $c";
55 55
         echo '</p>';
@@ -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.
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.
www/docs/api/api_getCommittee.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,16 +57,16 @@  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'] . '"';
60
+    if ($date) $date = '"'.$date['iso'].'"';
61 61
     else $date = 'date(now())';
62 62
     $q = $db->query("select distinct(dept) from moffice
63 63
         where dept like :department
64 64
         and from_date <= $date and $date <= to_date", array(
65
-            ':department' => '%' . $name . '%Committee',
65
+            ':department' => '%'.$name.'%Committee',
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
             );
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
             and dept like :department
81 81
             and from_date <= $date and $date <= to_date
82 82
             and entered_house <= $date and $date <= left_house", array(
83
-                ':department' => '%' . $name . '%Committee',
83
+                ':department' => '%'.$name.'%Committee',
84 84
             ));
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
-                    'name' => $q->field($i, 'given_name') . ' ' . $q->field($i, 'family_name'),
91
+                    'name' => $q->field($i, 'given_name').' '.$q->field($i, 'family_name'),
92 92
                 );
93 93
                 if ($q->field($i, 'position') == 'Chairman') {
94 94
                     $member['position'] = $q->field($i, 'position');
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
     $db = new ParlDB;
109 109
 
110 110
     $date = parse_date($date);
111
-    if ($date) $date = '"' . $date['iso'] . '"';
111
+    if ($date) $date = '"'.$date['iso'].'"';
112 112
     else $date = 'date(now())';
113 113
     $q = $db->query("select distinct(dept) from moffice
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.
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.
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   +8 added lines, -8 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,14 +50,14 @@  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 ) );
57
-            $fragment = '#g' . gid_to_anchor($id_data['gid']);
56
+            $LISTURL->insert(array('id' => $parent_gid));
57
+            $fragment = '#g'.gid_to_anchor($id_data['gid']);
58 58
         }
59 59
     }
60
-    return $LISTURL->generate('none') . $fragment;
60
+    return $LISTURL->generate('none').$fragment;
61 61
 }
62 62
 
63 63
 function api_converturl_url_output($q) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $url = get_listurl($q);
66 66
     $output = array(
67 67
         'gid' => $gid,
68
-        'url' => 'https://www.theyworkforyou.com' . $url
68
+        'url' => 'https://www.theyworkforyou.com'.$url
69 69
     );
70 70
     api_output($output);
71 71
 }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         return api_converturl_url_output($q);
80 80
 
81 81
     $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url like :url order by gid limit 1', array(
82
-        ':url' => $url_nohash . '%'
82
+        ':url' => $url_nohash.'%'
83 83
         ));
84 84
     if ($q->rows())
85 85
         return api_converturl_url_output($q);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     $url_bound = str_replace('cmhansrd/cm', 'cmhansrd/vo', $url_nohash);
88 88
     if ($url_bound != $url_nohash) {
89 89
         $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url like :url order by gid limit 1', array(
90
-            ':url' => $url_bound . '%'
90
+            ':url' => $url_bound.'%'
91 91
             ));
92 92
         if ($q->rows())
93 93
             return api_converturl_url_output($q);
Please login to merge, or discard this patch.
www/docs/api/api_getLords.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once dirname(__FILE__) . '/api_getMembers.php';
3
+include_once dirname(__FILE__).'/api_getMembers.php';
4 4
 
5 5
 function api_getLords_front() {
6 6
 ?>
Please login to merge, or discard this patch.