@@ -354,8 +354,8 @@ |
||
| 354 | 354 | $out = "null"; |
| 355 | 355 | } elseif (is_string($v)) { |
| 356 | 356 | $out = '"' . str_replace( |
| 357 | - ["\\",'"',"\n","\t","\r", "‶", "″", "“", "”"], |
|
| 358 | - ["\\\\",'\"','\n','\t','\r', '\"', '\"', '\"', '\"'], |
|
| 357 | + ["\\", '"', "\n", "\t", "\r", "‶", "″", "“", "”"], |
|
| 358 | + ["\\\\", '\"', '\n', '\t', '\r', '\"', '\"', '\"', '\"'], |
|
| 359 | 359 | $v |
| 360 | 360 | ) . '"'; |
| 361 | 361 | } elseif (is_bool($v)) { |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | function api_getAlerts_start_date($start_date) { |
| 4 | - $args = ['start_date' => $start_date, 'end_date' => get_http_var('end_date')]; |
|
| 4 | + $args = ['start_date' => $start_date, 'end_date' => get_http_var('end_date')]; |
|
| 5 | 5 | $alert = new ALERT(); |
| 6 | 6 | $data = $alert->fetch_between($confirmed = 1, $deleted = 0, $args['start_date'], $args['end_date']); |
| 7 | 7 | api_output($data); |
@@ -88,58 +88,58 @@ |
||
| 88 | 88 | function _api_ni_centroids() { |
| 89 | 89 | return [ |
| 90 | 90 | # East Londonderry |
| 91 | - 66129 => ['centre_lat' => 54.980766, 'centre_lon' => -6.904907 ], |
|
| 92 | - 14276 => ['centre_lat' => 54.980766, 'centre_lon' => -6.904907 ], |
|
| 91 | + 66129 => ['centre_lat' => 54.980766, 'centre_lon' => -6.904907], |
|
| 92 | + 14276 => ['centre_lat' => 54.980766, 'centre_lon' => -6.904907], |
|
| 93 | 93 | # Foyle |
| 94 | - 66131 => ['centre_lat' => 54.933453, 'centre_lon' => -7.267456 ], |
|
| 95 | - 14273 => ['centre_lat' => 54.933453, 'centre_lon' => -7.267456 ], |
|
| 94 | + 66131 => ['centre_lat' => 54.933453, 'centre_lon' => -7.267456], |
|
| 95 | + 14273 => ['centre_lat' => 54.933453, 'centre_lon' => -7.267456], |
|
| 96 | 96 | # West Tyrone |
| 97 | - 66141 => ['centre_lat' => 54.619797, 'centre_lon' => -7.410278 ], |
|
| 98 | - 14292 => ['centre_lat' => 54.619797, 'centre_lon' => -7.410278 ], |
|
| 97 | + 66141 => ['centre_lat' => 54.619797, 'centre_lon' => -7.410278], |
|
| 98 | + 14292 => ['centre_lat' => 54.619797, 'centre_lon' => -7.410278], |
|
| 99 | 99 | # Fermanagh & South Tyrone |
| 100 | - 14296 => ['centre_lat' => 54.354958, 'centre_lon' => -7.443237 ], |
|
| 101 | - 66130 => ['centre_lat' => 54.354958, 'centre_lon' => -7.443237 ], |
|
| 100 | + 14296 => ['centre_lat' => 54.354958, 'centre_lon' => -7.443237], |
|
| 101 | + 66130 => ['centre_lat' => 54.354958, 'centre_lon' => -7.443237], |
|
| 102 | 102 | # Newry & Armagh |
| 103 | - 14303 => ['centre_lat' => 54.297295, 'centre_lon' => -6.613770 ], |
|
| 104 | - 66134 => ['centre_lat' => 54.297295, 'centre_lon' => -6.613770 ], |
|
| 103 | + 14303 => ['centre_lat' => 54.297295, 'centre_lon' => -6.613770], |
|
| 104 | + 66134 => ['centre_lat' => 54.297295, 'centre_lon' => -6.613770], |
|
| 105 | 105 | # Upper Bann |
| 106 | - 14300 => ['centre_lat' => 54.399750, 'centre_lon' => -6.350098 ], |
|
| 107 | - 66140 => ['centre_lat' => 54.399750, 'centre_lon' => -6.350098 ], |
|
| 106 | + 14300 => ['centre_lat' => 54.399750, 'centre_lon' => -6.350098], |
|
| 107 | + 66140 => ['centre_lat' => 54.399750, 'centre_lon' => -6.350098], |
|
| 108 | 108 | # South Down |
| 109 | - 14306 => ['centre_lat' => 54.213860, 'centre_lon' => -6.152344 ], |
|
| 110 | - 66138 => ['centre_lat' => 54.213860, 'centre_lon' => -6.152344 ], |
|
| 109 | + 14306 => ['centre_lat' => 54.213860, 'centre_lon' => -6.152344], |
|
| 110 | + 66138 => ['centre_lat' => 54.213860, 'centre_lon' => -6.152344], |
|
| 111 | 111 | # Lagan Valley |
| 112 | - 14309 => ['centre_lat' => 54.441296, 'centre_lon' => -6.108398 ], |
|
| 113 | - 66132 => ['centre_lat' => 54.441296, 'centre_lon' => -6.108398 ], |
|
| 112 | + 14309 => ['centre_lat' => 54.441296, 'centre_lon' => -6.108398], |
|
| 113 | + 66132 => ['centre_lat' => 54.441296, 'centre_lon' => -6.108398], |
|
| 114 | 114 | # Strangford |
| 115 | - 14312 => ['centre_lat' => 54.514706, 'centre_lon' => -5.751343 ], |
|
| 116 | - 66139 => ['centre_lat' => 54.514706, 'centre_lon' => -5.751343 ], |
|
| 115 | + 14312 => ['centre_lat' => 54.514706, 'centre_lon' => -5.751343], |
|
| 116 | + 66139 => ['centre_lat' => 54.514706, 'centre_lon' => -5.751343], |
|
| 117 | 117 | # North Down |
| 118 | - 14325 => ['centre_lat' => 54.651592, 'centre_lon' => -5.718384 ], |
|
| 119 | - 66136 => ['centre_lat' => 54.651592, 'centre_lon' => -5.718384 ], |
|
| 118 | + 14325 => ['centre_lat' => 54.651592, 'centre_lon' => -5.718384], |
|
| 119 | + 66136 => ['centre_lat' => 54.651592, 'centre_lon' => -5.718384], |
|
| 120 | 120 | # South Antrim |
| 121 | - 14318 => ['centre_lat' => 54.699234, 'centre_lon' => -6.102905 ], |
|
| 122 | - 66137 => ['centre_lat' => 54.699234, 'centre_lon' => -6.102905 ], |
|
| 121 | + 14318 => ['centre_lat' => 54.699234, 'centre_lon' => -6.102905], |
|
| 122 | + 66137 => ['centre_lat' => 54.699234, 'centre_lon' => -6.102905], |
|
| 123 | 123 | # East Antrim |
| 124 | - 66128 => ['centre_lat' => 54.832336, 'centre_lon' => -5.883179 ], |
|
| 125 | - 14284 => ['centre_lat' => 54.832336, 'centre_lon' => -5.883179 ], |
|
| 124 | + 66128 => ['centre_lat' => 54.832336, 'centre_lon' => -5.883179], |
|
| 125 | + 14284 => ['centre_lat' => 54.832336, 'centre_lon' => -5.883179], |
|
| 126 | 126 | # North Antrim |
| 127 | - 66135 => ['centre_lat' => 54.993374, 'centre_lon' => -6.328125 ], |
|
| 128 | - 14280 => ['centre_lat' => 54.993374, 'centre_lon' => -6.328125 ], |
|
| 127 | + 66135 => ['centre_lat' => 54.993374, 'centre_lon' => -6.328125], |
|
| 128 | + 14280 => ['centre_lat' => 54.993374, 'centre_lon' => -6.328125], |
|
| 129 | 129 | # Mid Ulster |
| 130 | - 66133 => ['centre_lat' => 54.721447, 'centre_lon' => -6.795044 ], |
|
| 131 | - 14288 => ['centre_lat' => 54.721447, 'centre_lon' => -6.795044 ], |
|
| 130 | + 66133 => ['centre_lat' => 54.721447, 'centre_lon' => -6.795044], |
|
| 131 | + 14288 => ['centre_lat' => 54.721447, 'centre_lon' => -6.795044], |
|
| 132 | 132 | # Belfast North |
| 133 | - 14321 => ['centre_lat' => 54.618607, 'centre_lon' => -5.917511 ], |
|
| 134 | - 66125 => ['centre_lat' => 54.618607, 'centre_lon' => -5.917511 ], |
|
| 133 | + 14321 => ['centre_lat' => 54.618607, 'centre_lon' => -5.917511], |
|
| 134 | + 66125 => ['centre_lat' => 54.618607, 'centre_lon' => -5.917511], |
|
| 135 | 135 | # Belfast East |
| 136 | - 14329 => ['centre_lat' => 54.598324, 'centre_lon' => -5.892792 ], |
|
| 137 | - 66124 => ['centre_lat' => 54.598324, 'centre_lon' => -5.892792 ], |
|
| 136 | + 14329 => ['centre_lat' => 54.598324, 'centre_lon' => -5.892792], |
|
| 137 | + 66124 => ['centre_lat' => 54.598324, 'centre_lon' => -5.892792], |
|
| 138 | 138 | # Belfast South |
| 139 | - 14331 => ['centre_lat' => 54.582409, 'centre_lon' => -5.925064 ], |
|
| 140 | - 66126 => ['centre_lat' => 54.582409, 'centre_lon' => -5.925064 ], |
|
| 139 | + 14331 => ['centre_lat' => 54.582409, 'centre_lon' => -5.925064], |
|
| 140 | + 66126 => ['centre_lat' => 54.582409, 'centre_lon' => -5.925064], |
|
| 141 | 141 | # Belfast West |
| 142 | - 14315 => ['centre_lat' => 54.606277, 'centre_lon' => -5.956650 ], |
|
| 143 | - 66127 => ['centre_lat' => 54.606277, 'centre_lon' => -5.956650 ], |
|
| 142 | + 14315 => ['centre_lat' => 54.606277, 'centre_lon' => -5.956650], |
|
| 143 | + 66127 => ['centre_lat' => 54.606277, 'centre_lon' => -5.956650], |
|
| 144 | 144 | ]; |
| 145 | 145 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | function _api_getHansard_date($type, $d) { |
| 44 | - $args = ['date' => $d]; |
|
| 44 | + $args = ['date' => $d]; |
|
| 45 | 45 | $LIST = _api_getListObject($type); |
| 46 | 46 | $LIST->display('date', $args, 'api'); |
| 47 | 47 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | # $query_desc_short = $SEARCHENGINE->query_description_short(); |
| 95 | 95 | $pagenum = get_http_var('page'); |
| 96 | - $args = [ |
|
| 96 | + $args = [ |
|
| 97 | 97 | 's' => $search, |
| 98 | 98 | 'p' => $pagenum, |
| 99 | 99 | 'num' => get_http_var('num'), |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | $DATA->set_page_metadata($this_page, 'title', $pagetitle); |
| 53 | 53 | |
| 54 | - $args = [ |
|
| 54 | + $args = [ |
|
| 55 | 55 | 's' => $searchstring, |
| 56 | 56 | 'p' => $pagenum, |
| 57 | 57 | 'pop' => 1, |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | class UtilityTest extends UnitTestCase { |
| 14 | 14 | public function testVerpEnvelopeSenderCanCreateStandardSender() { |
| 15 | 15 | $sender = twfy_verp_envelope_sender('[email protected]'); |
| 16 | - $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; |
|
| 16 | + $expected_sender = 'twfy+aperson=a.nother.dom@' +EMAILDOMAIN; |
|
| 17 | 17 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | public $firstname = ''; |
| 27 | 27 | public $lastname = ''; |
| 28 | 28 | public $body = ''; |
| 29 | - public $reported = null; // datetime |
|
| 30 | - public $resolved = null; // datetime |
|
| 31 | - public $resolvedby = ''; // user_id |
|
| 32 | - public $locked = null; // datetime |
|
| 33 | - public $lockedby = ''; // user_id |
|
| 34 | - public $upheld = ''; // boolean |
|
| 29 | + public $reported = null; // datetime |
|
| 30 | + public $resolved = null; // datetime |
|
| 31 | + public $resolvedby = ''; // user_id |
|
| 32 | + public $locked = null; // datetime |
|
| 33 | + public $lockedby = ''; // user_id |
|
| 34 | + public $upheld = ''; // boolean |
|
| 35 | 35 | |
| 36 | 36 | // If the user was logged in, this will be set: |
| 37 | 37 | public $user_id = ''; |
@@ -256,19 +256,19 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | if ($q->success()) { |
| 258 | 258 | // Inserted OK, so set up this object's variables. |
| 259 | - $this->report_id = $q->insert_id(); |
|
| 260 | - $this->comment_id = $COMMENT->comment_id(); |
|
| 261 | - $this->body = $body; |
|
| 262 | - $this->reported = $time; |
|
| 259 | + $this->report_id = $q->insert_id(); |
|
| 260 | + $this->comment_id = $COMMENT->comment_id(); |
|
| 261 | + $this->body = $body; |
|
| 262 | + $this->reported = $time; |
|
| 263 | 263 | |
| 264 | 264 | if ($THEUSER->isloggedin()) { |
| 265 | - $this->user_id = $THEUSER->user_id(); |
|
| 265 | + $this->user_id = $THEUSER->user_id(); |
|
| 266 | 266 | $this->firstname = $THEUSER->firstname(); |
| 267 | 267 | $this->lastname = $THEUSER->lastname(); |
| 268 | 268 | } else { |
| 269 | - $this->email = $reportdata['email']; |
|
| 270 | - $this->firstname = $reportdata['firstname']; |
|
| 271 | - $this->lastname = $reportdata['lastname']; |
|
| 269 | + $this->email = $reportdata['email']; |
|
| 270 | + $this->firstname = $reportdata['firstname']; |
|
| 271 | + $this->lastname = $reportdata['lastname']; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | |
@@ -300,11 +300,11 @@ discard block |
||
| 300 | 300 | $email = $this->email(); |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - $data = [ |
|
| 303 | + $data = [ |
|
| 304 | 304 | 'to' => $email, |
| 305 | 305 | 'template' => 'report_acknowledge', |
| 306 | 306 | ]; |
| 307 | - $merge = [ |
|
| 307 | + $merge = [ |
|
| 308 | 308 | 'COMMENTURL' => "https://" . DOMAIN . $COMMENT->url(), |
| 309 | 309 | 'REPORTBODY' => strip_tags($this->body()), |
| 310 | 310 | ]; |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $data = []; |
| 327 | 327 | |
| 328 | 328 | if (is_numeric($this->report_id)) { |
| 329 | - $data = [ |
|
| 329 | + $data = [ |
|
| 330 | 330 | 'report_id' => $this->report_id(), |
| 331 | 331 | 'comment_id' => $this->comment_id(), |
| 332 | 332 | 'user_id' => $this->user_id(), |
@@ -1430,7 +1430,8 @@ discard block |
||
| 1430 | 1430 | // not-logged-in users. |
| 1431 | 1431 | |
| 1432 | 1432 | $this->postcode = $pc; |
| 1433 | - if (!headers_sent()) { // if in debug mode |
|
| 1433 | + if (!headers_sent()) { |
|
| 1434 | +// if in debug mode |
|
| 1434 | 1435 | setcookie(POSTCODE_COOKIE, $pc, time() + 7 * 86400, "/", COOKIEDOMAIN); |
| 1435 | 1436 | } |
| 1436 | 1437 | |
@@ -1438,7 +1439,8 @@ discard block |
||
| 1438 | 1439 | } |
| 1439 | 1440 | |
| 1440 | 1441 | public function unset_postcode_cookie() { |
| 1441 | - if (!headers_sent()) { // if in debug mode |
|
| 1442 | + if (!headers_sent()) { |
|
| 1443 | +// if in debug mode |
|
| 1442 | 1444 | setcookie(POSTCODE_COOKIE, '', time() - 3600, '/', COOKIEDOMAIN); |
| 1443 | 1445 | } |
| 1444 | 1446 | } |
@@ -55,23 +55,23 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | |
| 57 | 57 | class USER { |
| 58 | - public $user_id = "0"; // So we have an ID for non-logged in users reporting comments etc. |
|
| 59 | - public $firstname = "Guest"; // So we have something to print for non-logged in users. |
|
| 58 | + public $user_id = "0"; // So we have an ID for non-logged in users reporting comments etc. |
|
| 59 | + public $firstname = "Guest"; // So we have something to print for non-logged in users. |
|
| 60 | 60 | public $lastname = ""; |
| 61 | - public $password = ""; // This will be a hashed version of a plaintext pw. |
|
| 61 | + public $password = ""; // This will be a hashed version of a plaintext pw. |
|
| 62 | 62 | public $email = ""; |
| 63 | 63 | public $postcode = ""; |
| 64 | 64 | public $url = ""; |
| 65 | - public $lastvisit = ""; // Last time the logged-in user loaded a page (GMT). |
|
| 65 | + public $lastvisit = ""; // Last time the logged-in user loaded a page (GMT). |
|
| 66 | 66 | public $registrationtime = ""; // When they registered (GMT). |
| 67 | - public $registrationip = ""; // Where they registered from. |
|
| 68 | - public $optin = ""; // Int containing multiple binary opt-ins. (See top of User.php) |
|
| 69 | - public $deleted = ""; // User can't log in or have their info displayed. |
|
| 70 | - public $confirmed = ''; // boolean - Has the user confirmed via email? |
|
| 71 | - public $facebook_id = ''; // Facebook ID for users who login with FB |
|
| 72 | - public $facebook_token = ''; // Facebook token for users who login with FB |
|
| 73 | - public $can_annotate = false; // Can the user add annotations |
|
| 74 | - public $organisation = ''; // The organisation the user belongs to |
|
| 67 | + public $registrationip = ""; // Where they registered from. |
|
| 68 | + public $optin = ""; // Int containing multiple binary opt-ins. (See top of User.php) |
|
| 69 | + public $deleted = ""; // User can't log in or have their info displayed. |
|
| 70 | + public $confirmed = ''; // boolean - Has the user confirmed via email? |
|
| 71 | + public $facebook_id = ''; // Facebook ID for users who login with FB |
|
| 72 | + public $facebook_token = ''; // Facebook token for users who login with FB |
|
| 73 | + public $can_annotate = false; // Can the user add annotations |
|
| 74 | + public $organisation = ''; // The organisation the user belongs to |
|
| 75 | 75 | // Don't use the status to check access privileges - use the is_able_to() function. |
| 76 | 76 | public $status = "Viewer"; |
| 77 | 77 | |
@@ -324,12 +324,12 @@ discard block |
||
| 324 | 324 | $confirmurl = 'https://' . DOMAIN . '/E/' . $urltoken; |
| 325 | 325 | |
| 326 | 326 | // Arrays we need to send a templated email. |
| 327 | - $data = [ |
|
| 327 | + $data = [ |
|
| 328 | 328 | 'to' => $details['email'], |
| 329 | 329 | 'template' => 'email_confirmation', |
| 330 | 330 | ]; |
| 331 | 331 | |
| 332 | - $merge = [ |
|
| 332 | + $merge = [ |
|
| 333 | 333 | 'CONFIRMURL' => $confirmurl, |
| 334 | 334 | ]; |
| 335 | 335 | |
@@ -367,12 +367,12 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | // Arrays we need to send a templated email. |
| 370 | - $data = [ |
|
| 370 | + $data = [ |
|
| 371 | 371 | 'to' => $details['email'], |
| 372 | 372 | 'template' => 'join_confirmation', |
| 373 | 373 | ]; |
| 374 | 374 | |
| 375 | - $merge = [ |
|
| 375 | + $merge = [ |
|
| 376 | 376 | 'CONFIRMURL' => $confirmurl, |
| 377 | 377 | ]; |
| 378 | 378 | |
@@ -504,14 +504,14 @@ discard block |
||
| 504 | 504 | return false; |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - $data = [ |
|
| 507 | + $data = [ |
|
| 508 | 508 | 'to' => $this->email(), |
| 509 | 509 | 'template' => 'new_password', |
| 510 | 510 | ]; |
| 511 | 511 | |
| 512 | 512 | $URL = new \MySociety\TheyWorkForYou\Url("userlogin"); |
| 513 | 513 | |
| 514 | - $merge = [ |
|
| 514 | + $merge = [ |
|
| 515 | 515 | 'EMAIL' => $this->email(), |
| 516 | 516 | 'LOGINURL' => "https://" . DOMAIN . $URL->generate(), |
| 517 | 517 | 'PASSWORD' => $this->password(), |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | // Maybe there's a way of fetching these from the DB, |
| 684 | 684 | // so we don't duplicate them here...? |
| 685 | 685 | |
| 686 | - $statuses = ["Viewer", "User", "Moderator", "Administrator", "Superuser"]; |
|
| 686 | + $statuses = ["Viewer", "User", "Moderator", "Administrator", "Superuser"]; |
|
| 687 | 687 | |
| 688 | 688 | return $statuses; |
| 689 | 689 | |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | $date_now = gmdate("Y-m-d H:i:s"); |
| 1028 | 1028 | $this->db->query( |
| 1029 | 1029 | "UPDATE users SET lastvisit = :lastvisit WHERE user_id = :user_id", |
| 1030 | - [ ':lastvisit' => $date_now, ':user_id' => $this->user_id() ] |
|
| 1030 | + [':lastvisit' => $date_now, ':user_id' => $this->user_id()] |
|
| 1031 | 1031 | ); |
| 1032 | 1032 | |
| 1033 | 1033 | $this->lastvisit = $date_now; |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | |
| 1424 | 1424 | twfy_debug("THEUSER", "User with ID found to confirm: " . $this->user_id()); |
| 1425 | 1425 | // We'll need these to be set before logging the user in. |
| 1426 | - $this->email = $q['email']; |
|
| 1426 | + $this->email = $q['email']; |
|
| 1427 | 1427 | |
| 1428 | 1428 | // Set that they're confirmed in the DB. |
| 1429 | 1429 | $r = $this->db->query("UPDATE users |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | */ |
| 68 | 68 | |
| 69 | -$page = [ |
|
| 69 | +$page = [ |
|
| 70 | 70 | |
| 71 | 71 | // Things used on EVERY page, unless overridden for a page: |
| 72 | 72 | 'default' => [ |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | // The text displayed on the page itself will also be this, |
| 1296 | 1296 | // UNLESS the section has a 'heading', in which case that's used instead. |
| 1297 | 1297 | |
| 1298 | -$section = [ |
|
| 1298 | +$section = [ |
|
| 1299 | 1299 | |
| 1300 | 1300 | |
| 1301 | 1301 | 'about' => [ |