@@ -9,7 +9,7 @@ |
||
9 | 9 | 'body'=>'')); |
10 | 10 | ?> |
11 | 11 | <p> |
12 | - Vacher Dods charge <a href="http://www.dodonline.co.uk/engine.asp?showPage=article&id=2564"> 95 pounds </a> for this list of MPs names. We think democracy should be free. Click <?php echo '<a href="'.$csvurl.'">here</a>'; ?> to download a CSV (Comma Separated Values) file that you can load into Excel. |
|
12 | + Vacher Dods charge <a href="http://www.dodonline.co.uk/engine.asp?showPage=article&id=2564"> 95 pounds </a> for this list of MPs names. We think democracy should be free. Click <?php echo '<a href="' . $csvurl . '">here</a>'; ?> to download a CSV (Comma Separated Values) file that you can load into Excel. |
|
13 | 13 | </p> |
14 | 14 | <?php |
15 | 15 | $this->block_end(); |
@@ -36,7 +36,8 @@ |
||
36 | 36 | public function add($searchlogdata) { |
37 | 37 | |
38 | 38 | $ip = getenv('REMOTE_ADDR'); |
39 | - if (preg_match('#66\.249\.(6[4-9]|[78]\d|9[0-5])\.#', $ip)) { # Googlebot |
|
39 | + if (preg_match('#66\.249\.(6[4-9]|[78]\d|9[0-5])\.#', $ip)) { |
|
40 | +# Googlebot |
|
40 | 41 | return; |
41 | 42 | } |
42 | 43 | if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('#simplepie|bot#i', $_SERVER['HTTP_USER_AGENT'])) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // Select popular queries |
72 | 72 | public function popular_recent($count, $max_chars = null) { |
73 | 73 | |
74 | - $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
74 | + $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
75 | 75 | WHERE count_hits != 0 AND query_string != 'twat' |
76 | 76 | AND query_string != 'suffragettes' AND page_number=1 |
77 | 77 | AND query_time > date_sub(NOW(), INTERVAL 1 DAY) |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $rowarray['query'] = $query; |
125 | 125 | $rowarray['visible_name'] = $visible_name; |
126 | 126 | $rowarray['url'] = $url; |
127 | - $rowarray['display'] = '<a href="' . $url . '">' . ($htmlescape ? _htmlentities($visible_name) : $visible_name). '</a>'; |
|
127 | + $rowarray['display'] = '<a href="' . $url . '">' . ($htmlescape ? _htmlentities($visible_name) : $visible_name) . '</a>'; |
|
128 | 128 | |
129 | 129 | return $rowarray; |
130 | 130 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | public function admin_popular_searches($count) { |
145 | 145 | |
146 | - $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
146 | + $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
147 | 147 | WHERE count_hits != 0 AND query_string NOT LIKE '%speaker:%' |
148 | 148 | AND query_time > date_sub(NOW(), INTERVAL 30 DAY) |
149 | 149 | GROUP BY query_string ORDER BY c desc LIMIT $count;"); |
@@ -9,8 +9,8 @@ |
||
9 | 9 | <div class="search-page__section search-page__section--results"> |
10 | 10 | <div class="search-page__section__primary"> |
11 | 11 | <?php |
12 | - # XXX Hack |
|
13 | - if (preg_match('#budget#', $searchstring)) { ?> |
|
12 | + # XXX Hack |
|
13 | + if (preg_match('#budget#', $searchstring)) { ?> |
|
14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
15 | 15 | <?php } ?> |
16 | 16 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <div class="full-page"> |
2 | - <div class="full-page__row search-page <?php if ( !$searchstring ) { ?>search-page--blank<?php } ?>"> |
|
2 | + <div class="full-page__row search-page <?php if (!$searchstring) { ?>search-page--blank<?php } ?>"> |
|
3 | 3 | |
4 | 4 | <form class="js-search-form-without-options"> |
5 | 5 | <?php include 'form_main.php'; ?> |
6 | 6 | </form> |
7 | 7 | |
8 | - <?php if ( $searchstring && !isset($warnings) ) { ?> |
|
8 | + <?php if ($searchstring && !isset($warnings)) { ?> |
|
9 | 9 | <div class="search-page__section search-page__section--results"> |
10 | 10 | <div class="search-page__section__primary"> |
11 | 11 | <?php |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
15 | 15 | <?php } ?> |
16 | 16 | |
17 | - <?php if ( $cons ) { ?> |
|
18 | - <?php if ( count($cons) > 1 ) { |
|
17 | + <?php if ($cons) { ?> |
|
18 | + <?php if (count($cons) > 1) { |
|
19 | 19 | $types = array(); |
20 | - if ( $mp_types['mp'] > 0 ) { |
|
20 | + if ($mp_types['mp'] > 0) { |
|
21 | 21 | $types[] = 'MPs'; |
22 | 22 | } |
23 | - if ( $mp_types['former'] > 0 ) { |
|
23 | + if ($mp_types['former'] > 0) { |
|
24 | 24 | $types[] = 'former MPs'; |
25 | 25 | } |
26 | 26 | $desc = ucfirst(implode(' and ', $types)); |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | <?php } else { // count($cons) <= 1 ?> |
30 | 30 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
31 | 31 | <?php } ?> |
32 | - <?php foreach ( $cons as $member ) { ?> |
|
32 | + <?php foreach ($cons as $member) { ?> |
|
33 | 33 | <?php include('person.php'); ?> |
34 | 34 | <?php } ?> |
35 | 35 | <?php } ?> |
36 | 36 | |
37 | - <?php if ( $members ) { ?> |
|
37 | + <?php if ($members) { ?> |
|
38 | 38 | <h2>People matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
39 | - <?php foreach ( $members as $member ) { ?> |
|
39 | + <?php foreach ($members as $member) { ?> |
|
40 | 40 | <?php include('person.php'); ?> |
41 | 41 | <?php } ?> |
42 | 42 | <hr> |
@@ -44,25 +44,25 @@ discard block |
||
44 | 44 | |
45 | 45 | <?php if ($glossary) { ?> |
46 | 46 | <h2>Glossary items matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
47 | - <?php foreach ( $glossary as $item ) { ?> |
|
47 | + <?php foreach ($glossary as $item) { ?> |
|
48 | 48 | <?php include('glossary.php'); ?> |
49 | 49 | <?php } ?> |
50 | 50 | <hr> |
51 | 51 | <?php } ?> |
52 | 52 | |
53 | - <?php if ( isset($pid) && $wtt == 2 ) { ?> |
|
53 | + <?php if (isset($pid) && $wtt == 2) { ?> |
|
54 | 54 | <p>I want to <a href="https://www.writetothem.com/lords/?pid=<?= $pid ?>">write to <?= $wtt_lord_name ?></a></p> |
55 | 55 | <?php } ?> |
56 | 56 | |
57 | - <?php if ( isset($error) ) { ?> |
|
57 | + <?php if (isset($error)) { ?> |
|
58 | 58 | There was an error – <?= $error ?> – searching for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em>. |
59 | 59 | <?php } else { ?> |
60 | 60 | <h2> |
61 | - <?php if ( $pagination_links ) { ?> |
|
61 | + <?php if ($pagination_links) { ?> |
|
62 | 62 | Results <?= $pagination_links['first_result'] ?>–<?= $pagination_links['last_result'] ?> of <?= $info['total_results'] ?> |
63 | - <?php } else if ( $info['total_results'] == 1 ) { ?> |
|
63 | + <?php } else if ($info['total_results'] == 1) { ?> |
|
64 | 64 | The only result |
65 | - <?php } else if ( $info['total_results'] == 0 ) { ?> |
|
65 | + <?php } else if ($info['total_results'] == 0) { ?> |
|
66 | 66 | There were no results |
67 | 67 | <?php } else { ?> |
68 | 68 | All <?= $info['total_results'] ?> results |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | for <em class="current-search-term"><?= _htmlentities($searchdescription) ?></em> |
71 | 71 | </h2> |
72 | 72 | |
73 | - <?php if ( $info['spelling_correction'] ) { ?> |
|
74 | - <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities( $info['spelling_correction_display'] ) ?></a>?</p> |
|
73 | + <?php if ($info['spelling_correction']) { ?> |
|
74 | + <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities($info['spelling_correction_display']) ?></a>?</p> |
|
75 | 75 | <?php } ?> |
76 | 76 | |
77 | - <?php if ( $info['total_results'] ) { ?> |
|
77 | + <?php if ($info['total_results']) { ?> |
|
78 | 78 | <ul class="search-result-display-options"> |
79 | - <?php if ( $sort_order == 'relevance' ) { ?> |
|
79 | + <?php if ($sort_order == 'relevance') { ?> |
|
80 | 80 | <li>Sorted by relevance</li> |
81 | 81 | <li>Sort by date: <a href="<?= $urls['newest'] ?>">newest</a> / <a href="<?= $urls['oldest'] ?>">oldest</a></li> |
82 | - <?php } else if ( $sort_order == 'oldest' ) { ?> |
|
82 | + <?php } else if ($sort_order == 'oldest') { ?> |
|
83 | 83 | <li>Sort by <a href="<?= $urls['relevance'] ?>">relevance</a></li> |
84 | 84 | <li>Sorted by date: <a href="<?= $urls['newest'] ?>">newest</a> / oldest</li> |
85 | 85 | <?php } else { ?> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | </ul> |
91 | 91 | <?php } ?> |
92 | 92 | |
93 | - <?php foreach ( $rows as $result ) { ?> |
|
93 | + <?php foreach ($rows as $result) { ?> |
|
94 | 94 | <div class="search-result search-result--generic"> |
95 | 95 | <h3 class="search-result__title"><a href="<?= $result['listurl'] ?>"><?= $result['parent']['body'] ?></a> (<?= format_date($result['hdate'], SHORTDATEFORMAT) ?>)</h3> |
96 | 96 | <p class="search-result__description"><?= isset($result['speaker']) ? $result['speaker']['name'] . ': ' : '' ?><?= $result['extract'] ?></p> |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | |
100 | 100 | <hr> |
101 | 101 | |
102 | - <?php if ( $pagination_links ) { ?> |
|
102 | + <?php if ($pagination_links) { ?> |
|
103 | 103 | <div class="search-result-pagination"> |
104 | - <?php if ( isset($pagination_links['prev']) ) { ?> |
|
104 | + <?php if (isset($pagination_links['prev'])) { ?> |
|
105 | 105 | <a href="<?= $pagination_links['firstpage']['url'] ?>" title="First page"><<</a> |
106 | 106 | <a href="<?= $pagination_links['prev']['url'] ?>" title="Previous page"><</a> |
107 | 107 | <?php } ?> |
108 | - <?php foreach ( $pagination_links['nums'] as $link ) { ?> |
|
108 | + <?php foreach ($pagination_links['nums'] as $link) { ?> |
|
109 | 109 | <a href="<?= $link['url'] ?>"<?= $link['current'] ? ' class="search-result-pagination__current-page"' : '' ?>><?= $link['page'] ?></a> |
110 | 110 | <?php } ?> |
111 | - <?php if ( isset($pagination_links['next']) ) { ?> |
|
111 | + <?php if (isset($pagination_links['next'])) { ?> |
|
112 | 112 | <a href="<?= $pagination_links['next']['url'] ?>" title="Next page">></a> |
113 | 113 | <a href="<?= $pagination_links['lastpage']['url'] ?>" title="Final page">>></a> |
114 | 114 | <?php } ?> |
@@ -26,7 +26,8 @@ |
||
26 | 26 | $desc = ucfirst(implode(' and ', $types)); |
27 | 27 | ?> |
28 | 28 | <h2><?= $desc ?> in constituencies matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
29 | - <?php } else { // count($cons) <= 1 ?> |
|
29 | + <?php } else { |
|
30 | +// count($cons) <= 1 ?> |
|
30 | 31 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
31 | 32 | <?php } ?> |
32 | 33 | <?php foreach ( $cons as $member ) { ?> |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $anchor = '#addcomment'; |
21 | 21 | |
22 | 22 | $URL = new \MySociety\TheyWorkForYou\Url('userjoin'); |
23 | -$URL->insert(array('ret'=>$returl.$anchor)); |
|
23 | +$URL->insert(array('ret'=>$returl . $anchor)); |
|
24 | 24 | $joinurl = $URL->generate(); |
25 | 25 | |
26 | 26 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $HANSARDURL = new \MySociety\TheyWorkForYou\Url('hansard'); |
73 | 73 | $MPURL = new \MySociety\TheyWorkForYou\Url('yourmp'); |
74 | 74 | |
75 | -$PAGE->block_start(array ('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:')); |
|
75 | +$PAGE->block_start(array('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:')); |
|
76 | 76 | ?> |
77 | 77 | <ol> |
78 | 78 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } else { |
90 | 90 | $CHANGEURL = new \MySociety\TheyWorkForYou\Url('userchangepc'); |
91 | 91 | } |
92 | - $MEMBER = new MEMBER(array ('postcode'=>$THEUSER->postcode(), 'house'=>1)); |
|
92 | + $MEMBER = new MEMBER(array('postcode'=>$THEUSER->postcode(), 'house'=>1)); |
|
93 | 93 | $mpname = $MEMBER->full_name(); |
94 | 94 | ?> |
95 | 95 | <p><a href="<?php echo $MPURL->generate(); ?>"><strong>Find out more about how <?php echo $mpname; ?>, your ex-MP, represented you over the last parliament</strong></a><br> |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | //$PAGE->block_end(); |
186 | 186 | |
187 | 187 | $PAGE->stripe_end(array( |
188 | - array ( |
|
188 | + array( |
|
189 | 189 | 'type' => 'include', |
190 | 190 | 'content' => 'whatisthissite' |
191 | 191 | ), |
192 | - array ( |
|
192 | + array( |
|
193 | 193 | 'type' => 'include', |
194 | 194 | 'content' => 'sitenews_recent' |
195 | 195 | ) |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $user = new Renderer\User(); |
44 | 44 | $data = array_merge($user->data, $data); |
45 | 45 | |
46 | - if ( isset($page_errors) ) { |
|
46 | + if (isset($page_errors)) { |
|
47 | 47 | $data['page_errors'] = $page_errors; |
48 | 48 | } |
49 | 49 | |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | |
96 | 96 | private static function addCommonURLs($data) { |
97 | 97 | $urls = array(); |
98 | - if ( isset($data['urls']) ) { |
|
98 | + if (isset($data['urls'])) { |
|
99 | 99 | $urls = $data['urls']; |
100 | 100 | } |
101 | 101 | |
102 | 102 | $common_urls = array('search', 'alert'); |
103 | 103 | |
104 | - foreach ( $common_urls as $path ) { |
|
105 | - if (!isset($urls[$path]) ) { |
|
104 | + foreach ($common_urls as $path) { |
|
105 | + if (!isset($urls[$path])) { |
|
106 | 106 | $url = new Url($path); |
107 | 107 | $urls[$path] = $url->generate(); |
108 | 108 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | // These stores an associative array of key/value pairs that |
44 | 44 | // we'll want passed on to other pages. |
45 | - $this->session_vars = array (); |
|
45 | + $this->session_vars = array(); |
|
46 | 46 | |
47 | 47 | // Prevent things using $DATA running if it hasn't been set, ie in testing |
48 | 48 | if (isset($DATA)) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function reset() { |
95 | 95 | // Call this to remove all the session_vars. |
96 | - $this->session_vars = array (); |
|
96 | + $this->session_vars = array(); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * override just one or two of them. |
163 | 163 | */ |
164 | 164 | |
165 | - public function generate($encode = "html", $overrideVars=array()) { |
|
165 | + public function generate($encode = "html", $overrideVars = array()) { |
|
166 | 166 | |
167 | 167 | global $DATA; |
168 | 168 | |
169 | - $url_args = array (); |
|
169 | + $url_args = array(); |
|
170 | 170 | |
171 | 171 | foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) { |
172 | 172 | if (is_array($var)) { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | // the new epobject id and approval details. |
62 | 62 | $q = $this->db->query("UPDATE editqueue |
63 | 63 | SET |
64 | - glossary_id='" . $this->current_epobject_id. "', |
|
64 | + glossary_id='" . $this->current_epobject_id . "', |
|
65 | 65 | editor_id='" . addslashes($THEUSER->user_id()) . "', |
66 | 66 | approved='1', |
67 | 67 | decided='" . $timestamp . "' |
@@ -366,14 +366,12 @@ |
||
366 | 366 | public function limitToSet($set) { |
367 | 367 | |
368 | 368 | // Sanity check the set exists |
369 | - if (isset($this->sets[$set])) |
|
370 | - { |
|
369 | + if (isset($this->sets[$set])) { |
|
371 | 370 | $out = array(); |
372 | 371 | // Reassemble the new policies list based on the set. |
373 | 372 | foreach ($this->sets[$set] as $set_policy) |
374 | 373 | { |
375 | - if (isset($this->policies[$set_policy])) |
|
376 | - { |
|
374 | + if (isset($this->policies[$set_policy])) { |
|
377 | 375 | $out[$set_policy] = $this->policies[$set_policy]; |
378 | 376 | } else { |
379 | 377 | // if we've limited the policies to a single one then we only |
@@ -397,18 +397,18 @@ |
||
397 | 397 | } |
398 | 398 | |
399 | 399 | public function limitToArray($policies) { |
400 | - $out = array(); |
|
401 | - // Reassemble the new policies list based on the set. |
|
402 | - foreach ($policies as $policy) { |
|
403 | - if (isset($this->policies[$policy])) { |
|
404 | - $out[$policy] = $this->policies[$policy]; |
|
405 | - } |
|
406 | - } |
|
407 | - |
|
408 | - $new_policies = new self(); |
|
409 | - $new_policies->policies = $out; |
|
410 | - |
|
411 | - return $new_policies; |
|
400 | + $out = array(); |
|
401 | + // Reassemble the new policies list based on the set. |
|
402 | + foreach ($policies as $policy) { |
|
403 | + if (isset($this->policies[$policy])) { |
|
404 | + $out[$policy] = $this->policies[$policy]; |
|
405 | + } |
|
406 | + } |
|
407 | + |
|
408 | + $new_policies = new self(); |
|
409 | + $new_policies->policies = $out; |
|
410 | + |
|
411 | + return $new_policies; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | public function getPolicyDetails($policyID) { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | public function __construct($policy_id = null) { |
303 | 303 | $this->db = new \ParlDB; |
304 | 304 | |
305 | - if ( $policy_id ) { |
|
305 | + if ($policy_id) { |
|
306 | 306 | $this->policy_id = $policy_id; |
307 | 307 | $this->policies = array( |
308 | 308 | $policy_id => $this->policies[$policy_id] |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | // want to complain here if we're looking for that policy and |
381 | 381 | // it does not exist. Otherwise, if the single policy isn't in |
382 | 382 | // the set we want to return an empty set |
383 | - if ( !isset($this->policy_id) || $set_policy == $this->policy_id ) { |
|
383 | + if (!isset($this->policy_id) || $set_policy == $this->policy_id) { |
|
384 | 384 | throw new \Exception ('Policy ' . $set_policy . ' in set "' . $set . '" does not exist.'); |
385 | 385 | } |
386 | 386 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | $image = $q['image']; |
435 | 435 | |
436 | - if ( $image && file_exists(BASEDIR . '/' . $image)) { |
|
436 | + if ($image && file_exists(BASEDIR . '/' . $image)) { |
|
437 | 437 | $props['image'] = $image; |
438 | 438 | $props['image_license'] = $q['image_license']; |
439 | 439 | $props['image_attribution'] = $q['image_attrib']; |