@@ -20,7 +20,7 @@ |
||
20 | 20 | <input type="hidden" name="scrub" value="$email"> |
21 | 21 | <input type="submit" value="Delete user"> |
22 | 22 | </form> |
23 | -EOF; |
|
23 | +eof; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $user_data = array( |
@@ -2,12 +2,12 @@ |
||
2 | 2 | <img src="<?= $member->image()['url'] ?>" alt=""> |
3 | 3 | <h3 class="search-result__title"><a href="<?= $member->url() ?>"><?= $member->full_name() ?></a></h3> |
4 | 4 | <?php $latest_membership = $member->getMostRecentMembership(); ?> |
5 | - <?php if ( $latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL ) { ?> |
|
5 | + <?php if ($latest_membership && $latest_membership['house'] != HOUSE_TYPE_ROYAL) { ?> |
|
6 | 6 | <p class="search-result__description"> |
7 | 7 | <?= $latest_membership['current'] ? '' : 'Former' ?> |
8 | 8 | <?= $latest_membership['party'] == 'Bishop' ? '' : $latest_membership['party'] ?> |
9 | 9 | <?= $latest_membership['rep_name'] ?> |
10 | - <?php if ( $latest_membership['constituency'] ) { ?> |
|
10 | + <?php if ($latest_membership['constituency']) { ?> |
|
11 | 11 | for <?= $latest_membership['constituency'] ?> |
12 | 12 | <?php } ?> |
13 | 13 | (<?= format_date($latest_membership['start_date'], SHORTDATEFORMAT) ?> – <?= $latest_membership['current'] ? 'current' : format_date($latest_membership['end_date'], SHORTDATEFORMAT); ?>) |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function sctitle() { |
55 | 55 | $title = $this->title; |
56 | - if (strpos($title, 'The ') === 0 ) { |
|
56 | + if (strpos($title, 'The ') === 0) { |
|
57 | 57 | $title = lcfirst($title); |
58 | 58 | } |
59 | 59 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ); |
243 | 243 | } else { |
244 | 244 | foreach ($sets as $set) { |
245 | - if ($set == '' ) { |
|
245 | + if ($set == '') { |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | $q = $this->db->query( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ); |
286 | 286 | } else { |
287 | 287 | foreach ($policies as $policy) { |
288 | - if ($policy == '' ) { |
|
288 | + if ($policy == '') { |
|
289 | 289 | continue; |
290 | 290 | } |
291 | 291 | $q = $this->db->query( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->db = new \ParlDB; |
34 | 34 | |
35 | 35 | if (is_null($data)) { |
36 | - return; |
|
36 | + return; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $this->id = $data['id']; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | private function _getContentIDs() { |
126 | 126 | $q = $this->db->query( |
127 | - "SELECT body, gid, ep.epobject_id FROM epobject ep |
|
127 | + "SELECT body, gid, ep.epobject_id FROM epobject ep |
|
128 | 128 | JOIN hansard h on ep.epobject_id = h.epobject_id |
129 | 129 | JOIN topic_epobjects te on te.epobject_id = ep.epobject_id |
130 | 130 | WHERE topic_key = :topic_key", |
@@ -178,24 +178,24 @@ discard block |
||
178 | 178 | |
179 | 179 | public function addContent($gid) { |
180 | 180 | $q = $this->db->query( |
181 | - "SELECT epobject_id FROM hansard WHERE gid = :gid", |
|
182 | - array( |
|
181 | + "SELECT epobject_id FROM hansard WHERE gid = :gid", |
|
182 | + array( |
|
183 | 183 | ":gid" => $gid |
184 | - ) |
|
184 | + ) |
|
185 | 185 | )->first(); |
186 | 186 | |
187 | 187 | if (!$q) { |
188 | - return false; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $epobject_id = $q['epobject_id']; |
192 | 192 | |
193 | 193 | $q = $this->db->query( |
194 | - "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)", |
|
195 | - array( |
|
194 | + "INSERT INTO topic_epobjects (topic_key, epobject_id) VALUES (:topic, :ep_id)", |
|
195 | + array( |
|
196 | 196 | ":topic" => $this->id, |
197 | 197 | ":ep_id" => $epobject_id |
198 | - ) |
|
198 | + ) |
|
199 | 199 | ); |
200 | 200 | |
201 | 201 | return $q->success(); |
@@ -203,23 +203,23 @@ discard block |
||
203 | 203 | |
204 | 204 | public function deleteContent($id) { |
205 | 205 | $q = $this->db->query( |
206 | - "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id", |
|
207 | - array( |
|
206 | + "DELETE FROM topic_epobjects WHERE topic_key = :topic AND epobject_id = :ep_id", |
|
207 | + array( |
|
208 | 208 | ":topic" => $this->id, |
209 | 209 | ":ep_id" => $id |
210 | - ) |
|
210 | + ) |
|
211 | 211 | ); |
212 | 212 | |
213 | 213 | return $q->success(); |
214 | 214 | } |
215 | 215 | |
216 | 216 | public function getPolicySets() { |
217 | - $q = $this->db->query( |
|
217 | + $q = $this->db->query( |
|
218 | 218 | "SELECT policyset FROM topic_policysets WHERE topic_key = :key", |
219 | 219 | array( |
220 | - ':key' => $this->id |
|
220 | + ':key' => $this->id |
|
221 | 221 | ) |
222 | - ); |
|
222 | + ); |
|
223 | 223 | |
224 | 224 | $sets = array(); |
225 | 225 | foreach ($q as $row) { |
@@ -256,12 +256,12 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | public function getPolicies() { |
259 | - $q = $this->db->query( |
|
259 | + $q = $this->db->query( |
|
260 | 260 | 'SELECT policy_id FROM topic_policies WHERE topic_key = :key', |
261 | 261 | array( |
262 | - ':key' => $this->id |
|
262 | + ':key' => $this->id |
|
263 | 263 | ) |
264 | - ); |
|
264 | + ); |
|
265 | 265 | |
266 | 266 | $policies = array(); |
267 | 267 | foreach ($q as $row) { |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | public function save() { |
314 | 314 | $q = $this->db->query( |
315 | - "REPLACE INTO topics |
|
315 | + "REPLACE INTO topics |
|
316 | 316 | (id, title, slug, description, search_string, front_page, image) |
317 | 317 | VALUES |
318 | 318 | (:id, :title, :slug, :description, :search_string, :front_page, :image)", |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once INCLUDESPATH."easyparliament/member.php"; |
|
3 | +include_once INCLUDESPATH . "easyparliament/member.php"; |
|
4 | 4 | |
5 | 5 | function api_getHansard_front() { |
6 | 6 | ?> |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | function api_getHansard_search($s) { |
32 | - _api_getHansard_search( array( |
|
32 | + _api_getHansard_search(array( |
|
33 | 33 | 's' => $s, |
34 | 34 | 'pid' => get_http_var('person') |
35 | - ) ); |
|
35 | + )); |
|
36 | 36 | } |
37 | 37 | function api_getHansard_person($pid) { |
38 | 38 | _api_getHansard_search(array( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | function _api_getHansard_date($type, $d) { |
44 | - $args = array ('date' => $d); |
|
44 | + $args = array('date' => $d); |
|
45 | 45 | $LIST = _api_getListObject($type); |
46 | 46 | $LIST->display('date', $args, 'api'); |
47 | 47 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $type = isset($array['type']) ? $array['type'] : ''; |
57 | 57 | $search = filter_user_input($search, 'strict'); |
58 | 58 | if ($pid) { |
59 | - $search .= ($search?' ':'') . 'speaker:' . $pid; |
|
59 | + $search .= ($search ? ' ' : '') . 'speaker:' . $pid; |
|
60 | 60 | } |
61 | 61 | if ($type) { |
62 | 62 | $search .= " section:" . $type; |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | } |
92 | 92 | # $query_desc_short = $SEARCHENGINE->query_description_short(); |
93 | 93 | $pagenum = get_http_var('page'); |
94 | - $args = array ( |
|
94 | + $args = array( |
|
95 | 95 | 's' => $search, |
96 | 96 | 'p' => $pagenum, |
97 | 97 | 'num' => get_http_var('num'), |
98 | 98 | 'pop' => 1, |
99 | - 'o' => ($o=='d' || $o=='r') ? $o : 'd', |
|
99 | + 'o' => ($o == 'd' || $o == 'r') ? $o : 'd', |
|
100 | 100 | ); |
101 | 101 | $LIST = new HANSARDLIST(); |
102 | 102 | $data = $LIST->display('search', $args, 'none'); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <p> |
2 | 2 | <a href="#for"><?= $division['for'] ?> for</a>, |
3 | 3 | <a href="#against"><?= $division['against'] ?> against</a><?php |
4 | - if ($division['both'] > 0) { ?>, |
|
4 | + if ($division['both'] > 0) { ?>, |
|
5 | 5 | <a href="#both"><?= $division['both'] ?> abstained</a><?php |
6 | - } |
|
7 | - if ($division['absent'] > 0) { ?>, |
|
6 | + } |
|
7 | + if ($division['absent'] > 0) { ?>, |
|
8 | 8 | <a href="#absent"><?= $division['absent'] ?> absent</a><?php |
9 | - } ?>. |
|
9 | + } ?>. |
|
10 | 10 | </p> |
@@ -1,5 +1,6 @@ |
||
1 | 1 | <div class="debate-speech__division__your-mp"> |
2 | - <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
2 | + <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { |
|
3 | +/* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
3 | 4 | <div class="your-mp__header"> |
4 | 5 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
5 | 6 | <p> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <div class="debate-speech__division__your-mp"> |
2 | - <?php if ( !isset($main_vote_mp) || ! $main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
2 | + <?php if (!isset($main_vote_mp) || !$main_vote_mp) { /* $main_vote_mp is true if an MP has been requested via the URL */ ?> |
|
3 | 3 | <div class="your-mp__header"> |
4 | 4 | <h3>How your <?= $division['members']['singular'] ?> voted</h3> |
5 | 5 | <p> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | </div> |
10 | 10 | <?php } ?> |
11 | 11 | <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content"> |
12 | - <?php if ( isset($mp_vote) ) { ?> |
|
12 | + <?php if (isset($mp_vote)) { ?> |
|
13 | 13 | <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php |
14 | 14 | switch ($mp_vote['vote']) { |
15 | 15 | case 'aye': |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | echo 'N/A'; |
34 | 34 | } |
35 | 35 | ?></span> |
36 | - <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?> |
|
36 | + <?php } else if (isset($before_mp) || isset($after_mp)) { ?> |
|
37 | 37 | <span class="your-mp__vote">N/A</span> |
38 | 38 | <?php } ?> |
39 | 39 | <img class="your-mp__image" src="<?= $data['mp_data']['image'] ?>"> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | <h2 class="people-list__person__name"><?= $data['mp_data']['name'] ?></h2> |
42 | 42 | <p class="people-list__person__memberships"> |
43 | 43 | <span class="people-list__person__constituency"><?= $data['mp_data']['constituency'] ?></span> |
44 | - <span class="people-list__person__party <?= slugify( $data['mp_data']['party'] ) ?>"><?= $data['mp_data']['party'] ?></span> |
|
44 | + <span class="people-list__person__party <?= slugify($data['mp_data']['party']) ?>"><?= $data['mp_data']['party'] ?></span> |
|
45 | 45 | </p> |
46 | 46 | </div> |
47 | 47 | </a> |
@@ -11,28 +11,28 @@ |
||
11 | 11 | <a href="<?= $data['mp_data']['mp_url'] ?>" class="your-mp__content"> |
12 | 12 | <?php if ( isset($mp_vote) ) { ?> |
13 | 13 | <span class="your-mp__vote your-mp__vote--<?= $mp_vote['vote'] ?>"><?php |
14 | - switch ($mp_vote['vote']) { |
|
15 | - case 'aye': |
|
14 | + switch ($mp_vote['vote']) { |
|
15 | + case 'aye': |
|
16 | 16 | echo 'Aye'; |
17 | - break; |
|
18 | - case 'no': |
|
17 | + break; |
|
18 | + case 'no': |
|
19 | 19 | echo 'No'; |
20 | - break; |
|
21 | - case 'absent': |
|
20 | + break; |
|
21 | + case 'absent': |
|
22 | 22 | echo 'Absent'; |
23 | - break; |
|
24 | - case 'both': |
|
23 | + break; |
|
24 | + case 'both': |
|
25 | 25 | echo 'Abstain'; |
26 | - break; |
|
27 | - case 'tellaye': |
|
26 | + break; |
|
27 | + case 'tellaye': |
|
28 | 28 | echo 'Aye (Teller)'; |
29 | - break; |
|
30 | - case 'tellno': |
|
29 | + break; |
|
30 | + case 'tellno': |
|
31 | 31 | echo 'No (Teller)'; |
32 | - break; |
|
33 | - default: |
|
32 | + break; |
|
33 | + default: |
|
34 | 34 | echo 'N/A'; |
35 | - } |
|
35 | + } |
|
36 | 36 | ?></span> |
37 | 37 | <?php } else if ( isset($before_mp) || isset($after_mp) ) { ?> |
38 | 38 | <span class="your-mp__vote">N/A</span> |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <h3>Your current email alerts</h3> |
2 | 2 | |
3 | 3 | <ul class="alerts-manage__list"> |
4 | - <?php foreach ( $alerts as $alert ) { ?> |
|
4 | + <?php foreach ($alerts as $alert) { ?> |
|
5 | 5 | <li> |
6 | 6 | When <?= _htmlspecialchars($alert['criteria']) ?>. |
7 | 7 | <form action="<?= $actionurl ?>" method="POST"> |
8 | 8 | <input type="hidden" name="t" value="<?= _htmlspecialchars($alert['token']) ?>"> |
9 | - <?php if ( $alert['status'] == 'unconfirmed' ) { ?> |
|
9 | + <?php if ($alert['status'] == 'unconfirmed') { ?> |
|
10 | 10 | <input type="submit" class="button small" name="action" value="Confirm"> |
11 | - <?php } elseif ( $alert['status'] == 'suspended' ) { ?> |
|
11 | + <?php } elseif ($alert['status'] == 'suspended') { ?> |
|
12 | 12 | <input type="submit" class="button small" name="action" value="Resume"> |
13 | 13 | <?php } else { ?> |
14 | 14 | <input type="submit" class="button button--secondary small" name="action" value="Suspend"> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!empty($details['pid'])) { |
22 | - $criteria[] = 'speaker:'.$details['pid']; |
|
22 | + $criteria[] = 'speaker:' . $details['pid']; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $criteria = join(' ', $criteria); |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $token = $row['alert_id'] . '-' . $row['registrationtoken']; |
42 | 42 | |
43 | 43 | $status = 'confirmed'; |
44 | - if ( !$row['confirmed'] ) { |
|
44 | + if (!$row['confirmed']) { |
|
45 | 45 | $status = 'unconfirmed'; |
46 | - } elseif ( $row['deleted'] == 2 ) { |
|
46 | + } elseif ($row['deleted'] == 2) { |
|
47 | 47 | $status = 'suspended'; |
48 | 48 | } |
49 | 49 | |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | |
61 | 61 | public static function prettifyCriteria($alert_criteria) { |
62 | 62 | $text = ''; |
63 | - if ( $alert_criteria ) { |
|
63 | + if ($alert_criteria) { |
|
64 | 64 | $criteria = explode(' ', $alert_criteria); |
65 | 65 | $words = array(); |
66 | 66 | $spokenby = array_values(\MySociety\TheyWorkForYou\Utility\Search::speakerNamesForIDs($alert_criteria)); |
67 | 67 | |
68 | 68 | foreach ($criteria as $c) { |
69 | - if (!preg_match('#^speaker:(\d+)#',$c,$m)) { |
|
69 | + if (!preg_match('#^speaker:(\d+)#', $c, $m)) { |
|
70 | 70 | $words[] = $c; |
71 | 71 | } |
72 | 72 | } |
73 | - if ( $spokenby && count($words) ) { |
|
73 | + if ($spokenby && count($words)) { |
|
74 | 74 | $text = implode(' or ', $spokenby) . ' mentions [' . implode(' ', $words) . ']'; |
75 | - } else if ( count( $words ) ) { |
|
75 | + } else if (count($words)) { |
|
76 | 76 | $text = '[' . implode(' ', $words) . ']' . ' is mentioned'; |
77 | - } else if ( $spokenby ) { |
|
77 | + } else if ($spokenby) { |
|
78 | 78 | $text = implode(' or ', $spokenby) . " speaks"; |
79 | 79 | } |
80 | 80 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | try { |
178 | 178 | $MEMBER = new \MEMBER(array('constituency'=>$constituency, 'house' => 1)); |
179 | 179 | $cons[$constituency] = $MEMBER; |
180 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
180 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
181 | 181 | // do nothing |
182 | 182 | } |
183 | 183 | } |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | |
198 | 198 | // If this goes well, the alert will be added to the database and a confirmation email |
199 | 199 | // will be sent to them. |
200 | - $success = $this->alert->add( $this->data, $confirm ); |
|
200 | + $success = $this->alert->add($this->data, $confirm); |
|
201 | 201 | |
202 | - if ($success>0 && !$confirm) { |
|
202 | + if ($success > 0 && !$confirm) { |
|
203 | 203 | $result = 'alert-added'; |
204 | - } elseif ($success>0) { |
|
204 | + } elseif ($success > 0) { |
|
205 | 205 | $result = 'alert-confirmation'; |
206 | 206 | } elseif ($success == -2) { |
207 | 207 | // we need to make sure we know that the person attempting to sign up |
208 | 208 | // for the alert has that email address to stop people trying to work |
209 | 209 | // out what alerts they are signed up to |
210 | - if ( $this->data['email_verified'] || ( $this->user->loggedin && $this->user->email() == $this->data['email'] ) ) { |
|
210 | + if ($this->data['email_verified'] || ($this->user->loggedin && $this->user->email() == $this->data['email'])) { |
|
211 | 211 | $result = 'alert-exists'; |
212 | 212 | } else { |
213 | 213 | // don't throw an error message as that implies that they have already signed |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | |
234 | 234 | private function formatSearchTerms() { |
235 | - if ( $this->data['alertsearch'] ) { |
|
235 | + if ($this->data['alertsearch']) { |
|
236 | 236 | $this->data['alertsearch_pretty'] = \MySociety\TheyWorkForYou\Utility\Alert::prettifyCriteria($this->data['alertsearch']); |
237 | 237 | $this->data['search_text'] = $this->data['alertsearch']; |
238 | 238 | } else { |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | private function formatSearchMemberData() { |
268 | - if ( isset($this->data['postcode']) ) { |
|
268 | + if (isset($this->data['postcode'])) { |
|
269 | 269 | try { |
270 | 270 | $postcode = $this->data['postcode']; |
271 | 271 | |
272 | - $MEMBER = new \MEMBER( array('postcode' => $postcode) ); |
|
272 | + $MEMBER = new \MEMBER(array('postcode' => $postcode)); |
|
273 | 273 | // move the postcode to the front just to be tidy |
274 | 274 | $tidy_alertsearch = $postcode . " " . trim(str_replace("$postcode", "", $this->data['alertsearch'])); |
275 | 275 | $alertsearch_display = str_replace("$postcode ", "", $tidy_alertsearch); |
@@ -278,25 +278,25 @@ discard block |
||
278 | 278 | $this->data['member_displaysearch'] = $alertsearch_display; |
279 | 279 | $this->data['member'] = $MEMBER; |
280 | 280 | |
281 | - if ( $this->data['scottish_text'] ) { |
|
281 | + if ($this->data['scottish_text']) { |
|
282 | 282 | $constituencies = \MySociety\TheyWorkForYou\Utility\Postcode::postcodeToConstituencies($postcode); |
283 | - if ( isset($constituencies['SPC']) ) { |
|
283 | + if (isset($constituencies['SPC'])) { |
|
284 | 284 | $MEMBER = new \MEMBER(array('constituency' => $constituencies['SPC'], 'house' => 4)); |
285 | 285 | $this->data['scottish_alertsearch'] = str_replace("$postcode", "speaker:" . $MEMBER->person_id, $tidy_alertsearch); |
286 | 286 | $this->data['scottish_member'] = $MEMBER; |
287 | 287 | } |
288 | 288 | } |
289 | - } catch ( \MySociety\TheyWorkForYou\MemberException $e ) { |
|
289 | + } catch (\MySociety\TheyWorkForYou\MemberException $e) { |
|
290 | 290 | $this->data['member_error'] = 1; |
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | - if ( $this->data['pid'] ) { |
|
295 | - $MEMBER = new \MEMBER( array('person_id' => $this->data['pid']) ); |
|
294 | + if ($this->data['pid']) { |
|
295 | + $MEMBER = new \MEMBER(array('person_id' => $this->data['pid'])); |
|
296 | 296 | $this->data['pid_member'] = $MEMBER; |
297 | 297 | } |
298 | 298 | |
299 | - if ( $this->data['keyword'] ) { |
|
299 | + if ($this->data['keyword']) { |
|
300 | 300 | $this->data['display_keyword'] = \MySociety\TheyWorkForYou\Utility\Alert::prettifyCriteria($this->data['keyword']); |
301 | 301 | } |
302 | 302 | } |