@@ -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;"); |
@@ -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) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $this->all_policy_agreements = $policy_data['agreements'] ?? []; |
| 65 | 65 | |
| 66 | - if ( $policy_id ) { |
|
| 66 | + if ($policy_id) { |
|
| 67 | 67 | $this->policy_id = $policy_id; |
| 68 | 68 | $this->policies = array( |
| 69 | 69 | $policy_id => $this->policies[$policy_id] |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | // want to complain here if we're looking for that policy and |
| 146 | 146 | // it does not exist. Otherwise, if the single policy isn't in |
| 147 | 147 | // the set we want to return an empty set |
| 148 | - if ( !isset($this->policy_id) || $set_policy == $this->policy_id ) { |
|
| 148 | + if (!isset($this->policy_id) || $set_policy == $this->policy_id) { |
|
| 149 | 149 | throw new \Exception ('Policy ' . $set_policy . ' in set "' . $set . '" does not exist.'); |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | $image = $q['image']; |
| 200 | 200 | |
| 201 | - if ( $image && file_exists(BASEDIR . '/' . $image)) { |
|
| 201 | + if ($image && file_exists(BASEDIR . '/' . $image)) { |
|
| 202 | 202 | $props['image'] = $image; |
| 203 | 203 | $props['image_license'] = $q['image_license']; |
| 204 | 204 | $props['image_attribution'] = $q['image_attrib']; |
@@ -91,6 +91,6 @@ |
||
| 91 | 91 | <span class="formw"><input type="submit" name="submit" value="Update"></span> |
| 92 | 92 | </div> |
| 93 | 93 | </form> |
| 94 | -EOF; |
|
| 94 | +eof; |
|
| 95 | 95 | return $out; |
| 96 | 96 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | if ($row['constituency']) { |
| 48 | 48 | $desc .= ', ' . $row['constituency']; |
| 49 | 49 | } |
| 50 | - $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n"; |
|
| 50 | + $out .= '<option value="' . $p_id . '">' . $desc . '</option>' . "\n"; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $out .= ' </select></span> </div> '; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public function getDataSet() |
| 13 | 13 | { |
| 14 | - return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/alerts.xml'); |
|
| 14 | + return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/alerts.xml'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $ALERT = new ALERT(); |
| 33 | 33 | |
| 34 | - $response = $ALERT->fetch(0,0); |
|
| 34 | + $response = $ALERT->fetch(0, 0); |
|
| 35 | 35 | |
| 36 | 36 | // Make sure we only get one response |
| 37 | 37 | $this->assertEquals(1, count($response['data'])); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $ALERT = new ALERT(); |
| 50 | 50 | |
| 51 | - $response = $ALERT->fetch(1,0); |
|
| 51 | + $response = $ALERT->fetch(1, 0); |
|
| 52 | 52 | |
| 53 | 53 | // Make sure we only get two responses |
| 54 | 54 | $this->assertEquals(2, count($response['data'])); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $ALERT = new ALERT(); |
| 67 | 67 | |
| 68 | - $response = $ALERT->fetch_between(1,0, '2014-02-03', '2014-02-04'); |
|
| 68 | + $response = $ALERT->fetch_between(1, 0, '2014-02-03', '2014-02-04'); |
|
| 69 | 69 | |
| 70 | 70 | // Make sure we only get one response |
| 71 | 71 | $this->assertEquals(1, count($response['alerts'])); |