@@ -31,7 +31,7 @@ |
||
31 | 31 | </li> |
32 | 32 | |
33 | 33 | <?php |
34 | -$user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; |
|
34 | +$user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; |
|
35 | 35 | if (stristr($user_agent, 'Firefox/')) { |
36 | 36 | ?> |
37 | 37 | <li>You can also add TheyWorkForYou to <a href="http://mycroft.mozdev.org/download.html?name=theyworkforyou">Firefox's search box</a>.</li> |
@@ -542,11 +542,11 @@ |
||
542 | 542 | } |
543 | 543 | if ($limit != '') { |
544 | 544 | # Can't use parameter as >1 argument |
545 | - $limit = "LIMIT $limit"; |
|
545 | + $limit = "limit $limit"; |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | // Finally, do the query! |
549 | - $q = $this->db->query ("SELECT $fields |
|
549 | + $q = $this->db->query ("select $fields |
|
550 | 550 | FROM comments |
551 | 551 | $join |
552 | 552 | WHERE $where |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | - public function display ($view, $args=array(), $format='html') { |
|
45 | + public function display($view, $args = array(), $format = 'html') { |
|
46 | 46 | // $view is what we're viewing by: |
47 | 47 | // 'ep' is all the comments attached to an epobject. |
48 | 48 | // 'user' is all the comments written by a user. |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | |
61 | 61 | if ($view == 'ep' || $view == 'user' || $view == 'recent' || $view == 'search' || $view == 'dates') { |
62 | 62 | // What function do we call for this view? |
63 | - $function = '_get_data_by_'.$view; |
|
63 | + $function = '_get_data_by_' . $view; |
|
64 | 64 | // Get all the dta that's to be rendered. |
65 | 65 | $data = $this->$function($args); |
66 | 66 | |
67 | 67 | } else { |
68 | 68 | // Don't have a valid $view; |
69 | - $PAGE->error_message ("You haven't specified a view type."); |
|
69 | + $PAGE->error_message("You haven't specified a view type."); |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
@@ -85,29 +85,29 @@ discard block |
||
85 | 85 | return true; |
86 | 86 | } |
87 | 87 | |
88 | - public function render($data, $format='html', $template='comments') { |
|
89 | - include (INCLUDESPATH."easyparliament/templates/$format/$template.php"); |
|
88 | + public function render($data, $format = 'html', $template = 'comments') { |
|
89 | + include (INCLUDESPATH . "easyparliament/templates/$format/$template.php"); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | public function _get_data_by_ep($args) { |
93 | 93 | // Get all the data attached to an epobject. |
94 | 94 | global $PAGE; |
95 | 95 | |
96 | - twfy_debug (get_class($this), "getting data by epobject"); |
|
96 | + twfy_debug(get_class($this), "getting data by epobject"); |
|
97 | 97 | |
98 | 98 | // What we return. |
99 | 99 | $data = array(); |
100 | 100 | if (!is_numeric($args['epobject_id'])) { |
101 | - $PAGE->error_message ("Sorry, we don't have a valid epobject id"); |
|
101 | + $PAGE->error_message("Sorry, we don't have a valid epobject id"); |
|
102 | 102 | return $data; |
103 | 103 | } |
104 | 104 | |
105 | 105 | // For getting the data. |
106 | - $input = array ( |
|
107 | - 'amount' => array ( |
|
106 | + $input = array( |
|
107 | + 'amount' => array( |
|
108 | 108 | 'user' => true |
109 | 109 | ), |
110 | - 'where' => array ( |
|
110 | + 'where' => array( |
|
111 | 111 | 'comments.epobject_id=' => $args['epobject_id'], |
112 | 112 | #'visible=' => '1' |
113 | 113 | ), |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | // comments by things in $args? |
136 | 136 | global $PAGE; |
137 | 137 | |
138 | - twfy_debug (get_class($this), "getting data by user"); |
|
138 | + twfy_debug(get_class($this), "getting data by user"); |
|
139 | 139 | |
140 | 140 | // What we return. |
141 | 141 | $data = array(); |
142 | 142 | |
143 | 143 | if (!is_numeric($args['user_id'])) { |
144 | - $PAGE->error_message ("Sorry, we don't have a valid user id"); |
|
144 | + $PAGE->error_message("Sorry, we don't have a valid user id"); |
|
145 | 145 | return $data; |
146 | 146 | } |
147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | $num = 10; |
152 | 152 | } |
153 | 153 | |
154 | - if (isset($args['page']) && is_numeric($args['page']) && $args['page']>1) { |
|
154 | + if (isset($args['page']) && is_numeric($args['page']) && $args['page'] > 1) { |
|
155 | 155 | $page = $args['page']; |
156 | 156 | } else { |
157 | 157 | $page = 1; |
158 | 158 | } |
159 | 159 | |
160 | - $limit = $num*($page-1) . ',' . $num; |
|
160 | + $limit = $num * ($page - 1) . ',' . $num; |
|
161 | 161 | |
162 | 162 | // We're getting the most recent comments posted to epobjects. |
163 | 163 | // We're grouping them by epobject so we can just link to each hansard thing once. |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | // This does rely on both this and the previous query returning |
239 | 239 | // stuff in the same order... |
240 | 240 | foreach ($comments as $n => $commentdata) { |
241 | - $comments[$n]['body'] = $commentbodies[ $comments[$n]['comment_id'] ]; |
|
241 | + $comments[$n]['body'] = $commentbodies[$comments[$n]['comment_id']]; |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | // $args should contain 'num', indicating how many to get. |
259 | 259 | // and perhaps pid too, for a particular person |
260 | 260 | |
261 | - twfy_debug (get_class($this), "getting data by recent"); |
|
261 | + twfy_debug(get_class($this), "getting data by recent"); |
|
262 | 262 | |
263 | 263 | // What we return. |
264 | 264 | $data = array(); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $page = 1; |
276 | 276 | } |
277 | 277 | |
278 | - $limit = $num*($page-1) . ',' . $num; |
|
278 | + $limit = $num * ($page - 1) . ',' . $num; |
|
279 | 279 | |
280 | 280 | $where = array( |
281 | 281 | 'visible=' => '1' |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | if (isset($args['pid']) && is_numeric($args['pid'])) { |
284 | 284 | $where['person_id='] = $args['pid']; |
285 | 285 | } |
286 | - $input = array ( |
|
287 | - 'amount' => array ( |
|
286 | + $input = array( |
|
287 | + 'amount' => array( |
|
288 | 288 | 'user' => true |
289 | 289 | ), |
290 | 290 | 'where' => $where, |
@@ -316,15 +316,15 @@ discard block |
||
316 | 316 | public function _get_data_by_dates($args) { |
317 | 317 | // $args should contain start_date and end_date |
318 | 318 | |
319 | - twfy_debug (get_class($this), "getting data by recent"); |
|
319 | + twfy_debug(get_class($this), "getting data by recent"); |
|
320 | 320 | $data = array(); |
321 | 321 | $where = array( |
322 | 322 | 'visible=' => '1', |
323 | 323 | 'date(posted)>=' => $args['start_date'], |
324 | 324 | 'date(posted)<=' => $args['end_date'] |
325 | 325 | ); |
326 | - $input = array ( |
|
327 | - 'amount' => array ( |
|
326 | + $input = array( |
|
327 | + 'amount' => array( |
|
328 | 328 | 'user' => true |
329 | 329 | ), |
330 | 330 | 'where' => $where, |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public function _get_data_by_search($args) { |
339 | 339 | // $args should contain 'num', indicating how many to get. |
340 | 340 | |
341 | - twfy_debug (get_class($this), "getting data by search"); |
|
341 | + twfy_debug(get_class($this), "getting data by search"); |
|
342 | 342 | |
343 | 343 | // What we return. |
344 | 344 | $data = array(); |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | $page = 1; |
356 | 356 | } |
357 | 357 | |
358 | - $limit = $num*($page-1) . ',' . $num; |
|
358 | + $limit = $num * ($page - 1) . ',' . $num; |
|
359 | 359 | |
360 | - $input = array ( |
|
361 | - 'amount' => array ( |
|
360 | + $input = array( |
|
361 | + 'amount' => array( |
|
362 | 362 | 'user'=> true |
363 | 363 | ), |
364 | - 'where' => array ( |
|
364 | + 'where' => array( |
|
365 | 365 | 'comments.body LIKE' => "%$args[s]%" |
366 | 366 | ), |
367 | 367 | 'order' => 'posted DESC', |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | // It returns the URL for the comment. |
389 | 389 | |
390 | 390 | $major = $urldata['major']; |
391 | - $gid = $urldata['gid']; |
|
391 | + $gid = $urldata['gid']; |
|
392 | 392 | $comment_id = $urldata['comment_id']; |
393 | 393 | $user_id = isset($urldata['user_id']) ? $urldata['user_id'] : false; |
394 | 394 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $URL = new \MySociety\TheyWorkForYou\Url($page); |
403 | 403 | |
404 | 404 | $gid = fix_gid_from_db($gid); // In includes/utility.php |
405 | - $URL->insert(array('id' => $gid )); |
|
405 | + $URL->insert(array('id' => $gid)); |
|
406 | 406 | if ($user_id) { |
407 | 407 | $URL->insert(array('u' => $user_id)); |
408 | 408 | } |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | $limit = isset($input['limit']) ? $input['limit'] : ''; |
481 | 481 | |
482 | 482 | // The fields to fetch from db. 'table' => array ('field1', 'field2'). |
483 | - $fieldsarr = array ( |
|
484 | - 'comments' => array ('comment_id', 'user_id', 'epobject_id', 'body', 'posted', 'modflagged', 'visible'), |
|
485 | - 'hansard' => array ('major', 'gid') |
|
483 | + $fieldsarr = array( |
|
484 | + 'comments' => array('comment_id', 'user_id', 'epobject_id', 'body', 'posted', 'modflagged', 'visible'), |
|
485 | + 'hansard' => array('major', 'gid') |
|
486 | 486 | ); |
487 | 487 | |
488 | 488 | // Yes, we need the gid of a comment's associated hansard object |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | // Add on the stuff for getting a user's details. |
495 | 495 | if (isset($amount['user']) && $amount['user'] == true) { |
496 | - $fieldsarr['users'] = array ('firstname', 'lastname', 'user_id'); |
|
496 | + $fieldsarr['users'] = array('firstname', 'lastname', 'user_id'); |
|
497 | 497 | // Like doing "FROM comments, users" but it's easier to add |
498 | 498 | // an "INNER JOIN..." automatically to the query. |
499 | 499 | $join .= ' INNER JOIN users ON comments.user_id = users.user_id '; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $fieldsarr['epobject'] = array('body'); |
505 | 505 | } |
506 | 506 | |
507 | - $fieldsarr2 = array (); |
|
507 | + $fieldsarr2 = array(); |
|
508 | 508 | // Construct the $fields clause. |
509 | 509 | foreach ($fieldsarr as $table => $tablesfields) { |
510 | 510 | foreach ($tablesfields as $n => $field) { |
@@ -515,13 +515,13 @@ discard block |
||
515 | 515 | if ($table == 'epobject' && $field == 'body') { |
516 | 516 | $field .= ' AS hbody'; |
517 | 517 | } |
518 | - $fieldsarr2[] = $table.'.'.$field; |
|
518 | + $fieldsarr2[] = $table . '.' . $field; |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | $fields = implode(', ', $fieldsarr2); |
522 | 522 | |
523 | 523 | |
524 | - $wherearr2 = array (); |
|
524 | + $wherearr2 = array(); |
|
525 | 525 | $params = array(); |
526 | 526 | $i = 0; |
527 | 527 | // Construct the $where clause. |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $params[":where$i"] = $val; |
531 | 531 | $i++; |
532 | 532 | } |
533 | - $where = implode (" AND ", $wherearr2); |
|
533 | + $where = implode(" AND ", $wherearr2); |
|
534 | 534 | |
535 | 535 | if ($order != '') { |
536 | 536 | $order = "ORDER BY $order"; |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } |
542 | 542 | |
543 | 543 | // Finally, do the query! |
544 | - $q = $this->db->query ("SELECT $fields |
|
544 | + $q = $this->db->query("SELECT $fields |
|
545 | 545 | FROM comments |
546 | 546 | $join |
547 | 547 | WHERE $where |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | ", $params); |
551 | 551 | |
552 | 552 | // Format the data into an array for returning. |
553 | - $data = array (); |
|
553 | + $data = array(); |
|
554 | 554 | |
555 | 555 | // If you change stuff here, you might have to change it in |
556 | 556 | // $COMMENT->_set_url() too... |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | Read <a href="http://www.mysociety.org/2009/01/21/blimey-it-looks-like-the-internets-won/">our victory mySociety blog post</a>, |
22 | 22 | and do join our mailing list. :-) |
23 | -EOT |
|
23 | +eot |
|
24 | 24 | , '2009-01-21 15:30:00', 'Matthew'), |
25 | 25 | |
26 | 26 | 48 => array('API keys, and improved internal links', <<<EOT |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | crowd-sourcing game to match the reference to the exact speech, much like our |
46 | 46 | <a href="https://www.theyworkforyou.com/video/">video matching</a> (nearly 80% |
47 | 47 | of our archive done!). :) |
48 | -EOT |
|
48 | +eot |
|
49 | 49 | , '2008-07-18 14:01:00', 'Matthew'), |
50 | 50 | |
51 | 51 | 47 => array('Video on TheyWorkForYou', <<<EOT |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | <a href="http://www.mysociety.org/2008/06/01/video-recordings-of-the-house-of-commons-on-theyworkforyoucom/">Etienne's post on the mySociety blog</a> |
59 | 59 | has some background information on the project. |
60 | -EOT |
|
60 | +eot |
|
61 | 61 | , '2008-06-02 18:56:00', 'Matthew'), |
62 | 62 | |
63 | 63 | 46 => array('The Scottish Parliament', <<<EOT |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | launching this now to mark the success in getting endorsements for our <a |
90 | 90 | href="/freeourbills/">Free Our Bills campaign</a>, and we'll be rolling out |
91 | 91 | more goodies as the campaign goes along. |
92 | -EOT |
|
92 | +eot |
|
93 | 93 | , '2008-05-06 13:35:28', 'Matthew'), |
94 | 94 | |
95 | 95 | 45 => array('Shadow ministers and spokespersons', <<<EOT |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | This information is given both on a person's page and within any debates they |
99 | 99 | speak in, which could help explain why your local MP is speaking on transport |
100 | 100 | or foreign affairs a lot. :) |
101 | -EOT |
|
101 | +eot |
|
102 | 102 | , '2008-04-30 08:25:00', 'Matthew'), |
103 | 103 | |
104 | 104 | 44 => array('Please donate to help us expand TheyWorkForYou', <<<EOT |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | Unfortunately, the server that TheyWorkForYou sits on is almost full, so we can’t launch their hard work. Boo! |
108 | 108 | |
109 | 109 | TheyWorkForYou isn’t an externally funded project, and we need funding from other sources to keep it growing and improving. So if the season has filled you with generosity of spirit, why not <a href="https://secure.mysociety.org/donate/">drop us a few pennies</a> to pay for some upgrades? Any extra beyond what we need will go into the general pot to keep <a href="http://www.mysociety.org/">mySociety</a> running and the developers from starving. |
110 | -EOT |
|
110 | +eot |
|
111 | 111 | , '2007-12-21 10:07:35', 'Tom'), |
112 | 112 | |
113 | 113 | 43 => array('The Queen in Parliament', <<<EOT |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | or just look at past |
122 | 122 | <a href="https://www.theyworkforyou.com/search/?pid=13935&pop=1">prorogation and Queen's speeches</a> |
123 | 123 | more easily than anywhere else I've found. |
124 | -EOT |
|
124 | +eot |
|
125 | 125 | , '2007-09-11 15:34:47', 'Matthew'), |
126 | 126 | |
127 | 127 | 42 => array('Missing confirmation emails', <<<EOT |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | few days have now been sent out, and I've got in touch |
133 | 133 | with anyone who signed up in the days prior to |
134 | 134 | that to let them know what happened. |
135 | -EOT |
|
135 | +eot |
|
136 | 136 | , "2007-09-03 17:12:47", 'Matthew'), |
137 | 137 | |
138 | 138 | 41 => array('The Northern Ireland Assembly', <<<EOT |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | ATB,<br> |
174 | 174 | <a href="http://www.dracos.co.uk/">Matthew Somerville</a> |
175 | -EOT |
|
175 | +eot |
|
176 | 176 | , "2006-12-11 00:00:00", 'Matthew'), |
177 | 177 | |
178 | 178 | 40 => array('TheyWorkForYou API', <<<EOT |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | Here's my <a href="http://www.mysociety.org/2006/barcamp-london/">BarCamp |
192 | 192 | Presentation</a> launching the API, and a <a href="http://www.dracos.co.uk/work/theyworkforyou/api/fabfarts/">couple</a> |
193 | 193 | of <a href="http://www.mysociety.org/2006/09/02/battle-your-way-to-sedgefield/">applications</a> using it. |
194 | -EOT |
|
194 | +eot |
|
195 | 195 | , "2006-09-02 17:10:00"), |
196 | 196 | |
197 | 197 | 39 => array('New features over the last couple of months', <<<EOT |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | and when searching a particular person's speeches, we no longer group the results by debate, which |
220 | 220 | was confusing, as you obviously expected to see all the speeches for that person that matched your |
221 | 221 | search terms. |
222 | -EOT |
|
222 | +eot |
|
223 | 223 | , "2006-08-18 09:46:36"), |
224 | 224 | |
225 | 225 | 38 => array("Got an idea for a useful website?", <<<EOT |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | come up with an idea for a useful site like this one, and it beats all |
228 | 228 | the other ideas, we'll build it for free. <a href="http://www.mysociety.org/proposals2006/submit">Submit an idea</a> |
229 | 229 | or <a href="http://www.mysociety.org/proposals2006/view">read and comment on what other people have submitted</a>. |
230 | -EOT |
|
230 | +eot |
|
231 | 231 | , "2006-06-06 06:06:06"), |
232 | 232 | |
233 | 233 | 37 => array("We've added the Lords, and more", <<<EOT |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | also added a feature to the search to help you identify which MPs or |
238 | 238 | Lords are interested in a certain word or phrases. Just search as |
239 | 239 | usual and then click 'Show use by person'. |
240 | -EOT |
|
240 | +eot |
|
241 | 241 | , "2006-06-01 12:34:56"), |
242 | 242 | |
243 | 243 | 36 => array("Changes to the Register of Members' Interests", <<<EOT |
244 | 244 | One of the many things our site does, probably without you realising, is to track the Register of Members' Interests, in which MPs are "to provide information of any pecuniary interest or other material benefit which a Member receives which might reasonably be thought by others to influence his or her actions, speeches or votes in Parliament, or actions taken in the capacity of a Member of Parliament". The latest entry published on the official site has always been shown on MP pages (<a href="https://www.theyworkforyou.com/mp/tony_blair/sedgefield#register">here's Tony Blair's</a>), however we kept all previous editions of the Register safe and sound. And now, after a bit of coding, you can view a history of the Register, either <a href="https://www.theyworkforyou.com/regmem/?f=2005-12-14">comparing particular editions</a>, or for particular MPs (<a href="https://www.theyworkforyou.com/regmem/?p=10001">Diane Abbott</a>, for example). Entries only have to stay on the Register for a year, so this can make for some interesting reading. |
245 | 245 | |
246 | 246 | Happy New Year! :) <a href="https://www.theyworkforyou.com/regmem/">Changes to the Register of Members' Interests</a> |
247 | -EOT |
|
247 | +eot |
|
248 | 248 | , "2006-01-01 12:36:00"), |
249 | 249 | |
250 | 250 | 35 => array("TheyWorkForYou.com Wins Award", <<<EOT |
@@ -253,14 +253,14 @@ discard block |
||
253 | 253 | Thanks to the kind souls who nominated us. We enjoyed ourselves. |
254 | 254 | |
255 | 255 | |
256 | -EOT |
|
256 | +eot |
|
257 | 257 | , "2005-07-05 23:54:13"), |
258 | 258 | |
259 | 259 | 34 => array("NEW! Email this page to a friend", <<<EOT |
260 | 260 | At the top right hand side of every (ex)MP's page, we've added a simple new feature: email the page to a friend. |
261 | 261 | |
262 | 262 | <a href="/mp/">Have a go</a>, and let all your friends know how easy it is to keep tabs on what your former MP did and said in your name during the last Parliament. |
263 | -EOT |
|
263 | +eot |
|
264 | 264 | , "2005-04-14 23:43:50"), |
265 | 265 | |
266 | 266 | 33 => array("Play with Pledgebank, Pound the Streets", <<<EOT |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | </blockquote> |
274 | 274 | |
275 | 275 | If you're up for it, why not <a href="http://www.pledgebank.com/theywork">sign up now?</a> |
276 | -EOT |
|
276 | +eot |
|
277 | 277 | , "2005-04-13 22:41:23"), |
278 | 278 | |
279 | 279 | 32 => array("NEW! How MPs voted on Key Issues", <<<EOT |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | This information is the result sophisticated mining of PublicWhip's detailed vote data covering hundreds of Parliamentary divisions. |
287 | 287 | |
288 | 288 | We hope it'll make it easier for you to keep track of where your MP really stands on key issues - after all, They Work For You. |
289 | -EOT |
|
289 | +eot |
|
290 | 290 | , "2005-04-05 22:59:57"), |
291 | 291 | |
292 | 292 | 31 => array("Channel 4 linking to TheyWorkForYou.com", <<<EOT |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | We've done a special paint job for users coming from the Channel 4 site, just to make them feel welcome. You can see an example <a href="https://www.theyworkforyou.com/mp/c4/paul_keetch/hereford">here</a>. |
296 | 296 | |
297 | 297 | We'd love to know what you think of this paint job, as we're planning a redesign. As ever, <a href="/contact/">get in touch</a>. |
298 | -EOT |
|
298 | +eot |
|
299 | 299 | , "2005-04-05 22:53:32"), |
300 | 300 | |
301 | 301 | 30 => array("NEW! Email Alerts & Other Features", <<<EOT |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | - Tom, on behalf of the TheyWorkForYou.com volunteers |
358 | 358 | |
359 | 359 | <a href="https://www.theyworkforyou.com/about/">https://www.theyworkforyou.com/about/</a> - New volunteers welcome! |
360 | -EOT |
|
360 | +eot |
|
361 | 361 | , "2005-02-24 22:02:44"), |
362 | 362 | |
363 | 363 | 26 => array("New Release of TheyWorkForYou.com Source Code", <<<EOT |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | Feel free to download it and have a play. |
375 | 375 | |
376 | 376 | Whilst you're at it, don't forget we also publish a full <a href="https://www.theyworkforyou.com/raw/">XML version of the Hansard data</a>. |
377 | -EOT |
|
377 | +eot |
|
378 | 378 | , "2005-01-25 00:15:19"), |
379 | 379 | |
380 | 380 | 25 => array("Search by Date", <<<EOT |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | Next step on search is probably an RSS version of keyword searches. We're still very keen to improve overall relevancy of results - anyone out there fancy lending us a Google Appliance to play with? |
387 | 387 | |
388 | 388 | As ever, <a href="/contact/">contact us</a> if you've got any suggestions how we might improve the site, or if you fancy volunteering. |
389 | -EOT |
|
389 | +eot |
|
390 | 390 | , "2005-01-25 00:16:09"), |
391 | 391 | |
392 | 392 | 20 => array("New! Ministerial Statements now included", <<<EOT |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | Next up: Select Committees, which promise to be an order of magnitude more challenging. We'll keep you posted. |
405 | 405 | |
406 | 406 | PS We're always on the lookout for new volunteers - <a href="/contact/">contact us</a> if you are keen to help in almost any capacity. |
407 | -EOT |
|
407 | +eot |
|
408 | 408 | , "2005-01-17 17:44:47"), |
409 | 409 | |
410 | 410 | 19 => array("NEW! Westminster Hall debates now available.", <<<EOT |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | |
423 | 423 | |
424 | 424 | |
425 | -EOT |
|
425 | +eot |
|
426 | 426 | , "2004-12-22 23:47:19"), |
427 | 427 | |
428 | 428 | 18 => array("RSS feed of your MP's recent appearances", <<<EOT |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | RSS is a simple way to publish & distribute content which is frequently updated (<a href="http://news.bbc.co.uk/1/hi/help/3223484.stm">learn more here</a>.) |
437 | 437 | |
438 | 438 | Some enlightened MPs are now incorporating this useful feed of their Parliamentary activity into their websites. See <a href="http://www.richardallan.org.uk/">Richard Allen's</a> website for a good example. |
439 | -EOT |
|
439 | +eot |
|
440 | 440 | , "2004-11-27 16:38:41"), |
441 | 441 | |
442 | 442 | 16 => array("NEW! MPs' Expenses", <<<EOT |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | For example, it is good to note that <a href="https://www.theyworkforyou.com/mp/?pid=10508#expenses">Barbara Roche</a>, a North London MP, does not claim excessive travel expenses. |
446 | 446 | |
447 | 447 | Bear in mind that proper democracy does cost money, so please think twice before using these data as a stick with which to beat your MP. An "expensive" MP might be providing excellent value for money. And vice versa. |
448 | -EOT |
|
448 | +eot |
|
449 | 449 | , "2004-11-08 10:11:14"), |
450 | 450 | |
451 | 451 | 11 => array("TheyWorkForYou.com Development Wiki now public", <<<EOT |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | (dissemination is fine, but please don't post the link with the login details embedded in the url) |
462 | 462 | |
463 | 463 | In case you're wondering what we're up to, well, we're just rousing ourselves for another tilt at completing our vision before the next election is called, so if anyone python or php skills and fancies lending a hand, do <a href="/contact/">contact us</a>. |
464 | -EOT |
|
464 | +eot |
|
465 | 465 | , "2004-10-01 23:14:13"), |
466 | 466 | |
467 | 467 | 8 => array("New! Full Source Code Published", <<<EOT |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | |
482 | 482 | <a href="https://www.theyworkforyou.com/rss/mp/10508.rdf">https://www.theyworkforyou.com/rss/mp/10508.rdf</a> |
483 | 483 | - Typical MP 'recent appearances' RSS feed, uses person id. |
484 | -EOT |
|
484 | +eot |
|
485 | 485 | , "2004-07-18 22:58:23"), |
486 | 486 | |
487 | 487 | 7 => array("Public Beta Now Live", <<<EOT |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | More than the usuals, |
503 | 503 | |
504 | 504 | - <i><a href="https://www.theyworkforyou.com/about/" title="link to About Us page">The TheyWorkForYou.com Volunteers</a></i> |
505 | -EOT |
|
505 | +eot |
|
506 | 506 | , "2004-06-06 03:02:53"), |
507 | 507 | |
508 | 508 | 6 => array("Want to help make us complete?", <<<EOT |
@@ -514,14 +514,14 @@ discard block |
||
514 | 514 | |
515 | 515 | Just <a href="/contact/">contact us</a>. |
516 | 516 | |
517 | -EOT |
|
517 | +eot |
|
518 | 518 | , "2004-05-21 22:15:22"), |
519 | 519 | |
520 | 520 | 5 => array("Know someone who'd like this website?", <<<EOT |
521 | 521 | If you know someone who would appreciate being a beta tester, please <a href="/contact/">contact us</a> with their details. |
522 | 522 | |
523 | 523 | Many thanks. |
524 | -EOT |
|
524 | +eot |
|
525 | 525 | , "2004-05-21 22:55:24"), |
526 | 526 | |
527 | 527 | 4 => array("Welcome to our private beta test", <<<EOT |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | In the meantime, please enjoy being the first people to scribble in the margins of Hansard. May you be first of many. |
539 | 539 | |
540 | 540 | - <em>The TheyWorkForYou.com volunteers</em> |
541 | -EOT |
|
541 | +eot |
|
542 | 542 | , "2004-05-21 22:55:24") |
543 | 543 | ); |
544 | 544 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | $topic = $topics->getTopic($slug); |
9 | 9 | } |
10 | 10 | |
11 | -if (!$slug || !isset($topic) || $topic === NULL) { |
|
11 | +if (!$slug || !isset($topic) || $topic === null) { |
|
12 | 12 | header('HTTP/1.0 404 Not Found'); |
13 | 13 | exit(); |
14 | 14 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | </form> |
140 | 140 | |
141 | 141 | <p style="clear:both; margin-top: 3em"><a href="/images/mps/photo-status.php">List MPs without photos</a></p> |
142 | -EOF; |
|
142 | +eof; |
|
143 | 143 | |
144 | 144 | return $out; |
145 | 145 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | <span class="formw"><input type="submit" name="submit" value="Update attribution"></span> |
194 | 194 | </div> |
195 | 195 | </form> |
196 | -EOF; |
|
196 | +eof; |
|
197 | 197 | |
198 | 198 | return $out; |
199 | 199 | } |
@@ -111,7 +111,7 @@ |
||
111 | 111 | } else { |
112 | 112 | $desc .= ' [no photo]'; |
113 | 113 | } |
114 | - $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n"; |
|
114 | + $out .= '<option value="' . $p_id . '">' . $desc . '</option>' . "\n"; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $out .= ' </select></span> </div> '; |
@@ -139,7 +139,7 @@ |
||
139 | 139 | global $globalsuccess, $sentemails, $nomail, $start_time; |
140 | 140 | |
141 | 141 | $sentemails++; |
142 | - mlog("SEND $sentemails : Sending email to $current[email] ... "); |
|
142 | + mlog("send $sentemails : Sending email to $current[email] ... "); |
|
143 | 143 | $d = array('to' => $current['email'], 'template' => $template); |
144 | 144 | $m = array( |
145 | 145 | 'DATA' => join("\n", $data), |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | $toemail = ''; |
24 | 24 | $template = 'alert_gone'; |
25 | 25 | for ($k=1; $k<$argc; $k++) { |
26 | - if ($argv[$k] == '--nomail') { |
|
27 | - $nomail = true; |
|
28 | - } |
|
29 | - if (preg_match('#^--only=(.*)$#', $argv[$k], $m)) { |
|
30 | - $onlyemail = $m[1]; |
|
31 | - } |
|
32 | - if (preg_match('#^--from=(.*)$#', $argv[$k], $m)) { |
|
33 | - $fromemail = $m[1]; |
|
34 | - } |
|
35 | - if (preg_match('#^--to=(.*)$#', $argv[$k], $m)) { |
|
36 | - $toemail = $m[1]; |
|
37 | - } |
|
38 | - if (preg_match('#^--template=(.*)$#', $argv[$k], $m)) { |
|
39 | - $template = $m[1]; |
|
40 | - # Tee hee |
|
41 | - $template = "../../../../../../../../../../home/twfy-live/email-alert-templates/alert_mailout_$template"; |
|
42 | - } |
|
26 | + if ($argv[$k] == '--nomail') { |
|
27 | + $nomail = true; |
|
28 | + } |
|
29 | + if (preg_match('#^--only=(.*)$#', $argv[$k], $m)) { |
|
30 | + $onlyemail = $m[1]; |
|
31 | + } |
|
32 | + if (preg_match('#^--from=(.*)$#', $argv[$k], $m)) { |
|
33 | + $fromemail = $m[1]; |
|
34 | + } |
|
35 | + if (preg_match('#^--to=(.*)$#', $argv[$k], $m)) { |
|
36 | + $toemail = $m[1]; |
|
37 | + } |
|
38 | + if (preg_match('#^--template=(.*)$#', $argv[$k], $m)) { |
|
39 | + $template = $m[1]; |
|
40 | + # Tee hee |
|
41 | + $template = "../../../../../../../../../../home/twfy-live/email-alert-templates/alert_mailout_$template"; |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | #if (DEVSITE) |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | mlog("NOT SENDING EMAIL\n"); |
50 | 50 | } |
51 | 51 | if (($fromemail && $onlyemail) || ($toemail && $onlyemail)) { |
52 | - mlog("Can't have both from/to and only!\n"); |
|
53 | - exit; |
|
52 | + mlog("Can't have both from/to and only!\n"); |
|
53 | + exit; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $active = 0; |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | $members = array(); |
75 | 75 | $start_time = time(); |
76 | 76 | foreach ($alertdata as $alertitem) { |
77 | - $active++; |
|
78 | - $email = $alertitem['email']; |
|
77 | + $active++; |
|
78 | + $email = $alertitem['email']; |
|
79 | 79 | if ($onlyemail && $email != $onlyemail) { |
80 | 80 | continue; |
81 | 81 | } |
@@ -90,39 +90,39 @@ discard block |
||
90 | 90 | } |
91 | 91 | $criteria_raw = $alertitem['criteria']; |
92 | 92 | |
93 | - if (!strstr($criteria_raw, 'speaker:')) { |
|
94 | - continue; |
|
95 | - } |
|
93 | + if (!strstr($criteria_raw, 'speaker:')) { |
|
94 | + continue; |
|
95 | + } |
|
96 | 96 | |
97 | - preg_match('#speaker:(\d+)#', $criteria_raw, $m); |
|
98 | - $person_id = $m[1]; |
|
99 | - if (!isset($members[$person_id])) { |
|
97 | + preg_match('#speaker:(\d+)#', $criteria_raw, $m); |
|
98 | + $person_id = $m[1]; |
|
99 | + if (!isset($members[$person_id])) { |
|
100 | 100 | $queries++; |
101 | 101 | $members[$person_id] = new MEMBER(array('person_id' => $person_id)); |
102 | - } |
|
102 | + } |
|
103 | 103 | $member = $members[$person_id]; |
104 | 104 | if ($member->current_member_anywhere()) { |
105 | 105 | continue; |
106 | 106 | } |
107 | 107 | |
108 | - if ($email != $current['email']) { |
|
109 | - if ($email_text) { |
|
110 | - write_and_send_email($current, $email_text, $template); |
|
111 | - } |
|
112 | - $current['email'] = $email; |
|
113 | - $current['token'] = $alertitem['alert_id'] . '-' . $alertitem['registrationtoken']; |
|
114 | - $email_text = array(); |
|
115 | - $q = $db->query('SELECT user_id FROM users WHERE email = :email', array( |
|
108 | + if ($email != $current['email']) { |
|
109 | + if ($email_text) { |
|
110 | + write_and_send_email($current, $email_text, $template); |
|
111 | + } |
|
112 | + $current['email'] = $email; |
|
113 | + $current['token'] = $alertitem['alert_id'] . '-' . $alertitem['registrationtoken']; |
|
114 | + $email_text = array(); |
|
115 | + $q = $db->query('SELECT user_id FROM users WHERE email = :email', array( |
|
116 | 116 | ':email' => $email))->first(); |
117 | 117 | if ($q) { |
118 | 118 | $user_id = $q['user_id']; |
119 | 119 | $registered++; |
120 | - } else { |
|
121 | - $user_id = 0; |
|
122 | - $unregistered++; |
|
123 | - } |
|
124 | - mlog("\nEMAIL: $email, uid $user_id; memory usage : ".memory_get_usage()."\n"); |
|
125 | - } |
|
120 | + } else { |
|
121 | + $user_id = 0; |
|
122 | + $unregistered++; |
|
123 | + } |
|
124 | + mlog("\nEMAIL: $email, uid $user_id; memory usage : ".memory_get_usage()."\n"); |
|
125 | + } |
|
126 | 126 | |
127 | 127 | $lh = $member->left_house(); |
128 | 128 | $lh = array_shift($lh); |
@@ -148,32 +148,32 @@ discard block |
||
148 | 148 | mlog(date('r') . "\n"); |
149 | 149 | |
150 | 150 | function write_and_send_email($current, $data, $template) { |
151 | - global $globalsuccess, $sentemails, $nomail, $start_time; |
|
152 | - |
|
153 | - $sentemails++; |
|
154 | - mlog("SEND $sentemails : Sending email to $current[email] ... "); |
|
155 | - $d = array('to' => $current['email'], 'template' => $template); |
|
156 | - $m = array( |
|
157 | - 'DATA' => join("\n", $data), |
|
158 | - 'MANAGE' => 'https://www.theyworkforyou.com/D/' . $current['token'], |
|
151 | + global $globalsuccess, $sentemails, $nomail, $start_time; |
|
152 | + |
|
153 | + $sentemails++; |
|
154 | + mlog("SEND $sentemails : Sending email to $current[email] ... "); |
|
155 | + $d = array('to' => $current['email'], 'template' => $template); |
|
156 | + $m = array( |
|
157 | + 'DATA' => join("\n", $data), |
|
158 | + 'MANAGE' => 'https://www.theyworkforyou.com/D/' . $current['token'], |
|
159 | 159 | 'ALERT_IS' => count($data)==1 ? 'alert is' : 'alerts are', |
160 | 160 | 'ALERTS' => count($data)==1 ? 'an alert' : 'some alerts', |
161 | - ); |
|
162 | - if (!$nomail) { |
|
163 | - $success = send_template_email($d, $m, true); |
|
164 | - mlog("sent ... "); |
|
165 | - # sleep if time between sending mails is less than a certain number of seconds on average |
|
166 | - if (((time() - $start_time) / $sentemails) < 0.5 ) { # number of seconds per mail not to be quicker than |
|
167 | - mlog("pausing ... "); |
|
168 | - sleep(1); |
|
169 | - } |
|
170 | - } else { |
|
171 | - mlog(join('', $data)); |
|
172 | - $success = 1; |
|
173 | - } |
|
174 | - mlog("done\n"); |
|
175 | - if (!$success) { |
|
176 | - $globalsuccess = 0; |
|
177 | - } |
|
161 | + ); |
|
162 | + if (!$nomail) { |
|
163 | + $success = send_template_email($d, $m, true); |
|
164 | + mlog("sent ... "); |
|
165 | + # sleep if time between sending mails is less than a certain number of seconds on average |
|
166 | + if (((time() - $start_time) / $sentemails) < 0.5 ) { # number of seconds per mail not to be quicker than |
|
167 | + mlog("pausing ... "); |
|
168 | + sleep(1); |
|
169 | + } |
|
170 | + } else { |
|
171 | + mlog(join('', $data)); |
|
172 | + $success = 1; |
|
173 | + } |
|
174 | + mlog("done\n"); |
|
175 | + if (!$success) { |
|
176 | + $globalsuccess = 0; |
|
177 | + } |
|
178 | 178 | } |
179 | 179 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $fromflag = false; |
23 | 23 | $toemail = ''; |
24 | 24 | $template = 'alert_gone'; |
25 | -for ($k=1; $k<$argc; $k++) { |
|
25 | +for ($k = 1; $k < $argc; $k++) { |
|
26 | 26 | if ($argv[$k] == '--nomail') { |
27 | 27 | $nomail = true; |
28 | 28 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $user_id = 0; |
122 | 122 | $unregistered++; |
123 | 123 | } |
124 | - mlog("\nEMAIL: $email, uid $user_id; memory usage : ".memory_get_usage()."\n"); |
|
124 | + mlog("\nEMAIL: $email, uid $user_id; memory usage : " . memory_get_usage() . "\n"); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $lh = $member->left_house(); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } else { |
144 | 144 | $sss .= 'Something went wrong! Total time: '; |
145 | 145 | } |
146 | -$sss .= (getmicrotime()-$global_start)."\n\n"; |
|
146 | +$sss .= (getmicrotime() - $global_start) . "\n\n"; |
|
147 | 147 | mlog($sss); |
148 | 148 | mlog(date('r') . "\n"); |
149 | 149 | |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | $m = array( |
157 | 157 | 'DATA' => join("\n", $data), |
158 | 158 | 'MANAGE' => 'https://www.theyworkforyou.com/D/' . $current['token'], |
159 | - 'ALERT_IS' => count($data)==1 ? 'alert is' : 'alerts are', |
|
160 | - 'ALERTS' => count($data)==1 ? 'an alert' : 'some alerts', |
|
159 | + 'ALERT_IS' => count($data) == 1 ? 'alert is' : 'alerts are', |
|
160 | + 'ALERTS' => count($data) == 1 ? 'an alert' : 'some alerts', |
|
161 | 161 | ); |
162 | 162 | if (!$nomail) { |
163 | 163 | $success = send_template_email($d, $m, true); |
164 | 164 | mlog("sent ... "); |
165 | 165 | # sleep if time between sending mails is less than a certain number of seconds on average |
166 | - if (((time() - $start_time) / $sentemails) < 0.5 ) { # number of seconds per mail not to be quicker than |
|
166 | + if (((time() - $start_time) / $sentemails) < 0.5) { # number of seconds per mail not to be quicker than |
|
167 | 167 | mlog("pausing ... "); |
168 | 168 | sleep(1); |
169 | 169 | } |
@@ -163,7 +163,8 @@ |
||
163 | 163 | $success = send_template_email($d, $m, true); |
164 | 164 | mlog("sent ... "); |
165 | 165 | # sleep if time between sending mails is less than a certain number of seconds on average |
166 | - if (((time() - $start_time) / $sentemails) < 0.5 ) { # number of seconds per mail not to be quicker than |
|
166 | + if (((time() - $start_time) / $sentemails) < 0.5 ) { |
|
167 | +# number of seconds per mail not to be quicker than |
|
167 | 168 | mlog("pausing ... "); |
168 | 169 | sleep(1); |
169 | 170 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | global $globalsuccess, $sentemails, $nomail, $start_time; |
156 | 156 | |
157 | 157 | $sentemails++; |
158 | - mlog("SEND $sentemails : Sending email to $current[email] ... "); |
|
158 | + mlog("send $sentemails : Sending email to $current[email] ... "); |
|
159 | 159 | $d = array('to' => $current['email'], 'template' => $template); |
160 | 160 | $m = array( |
161 | 161 | 'DATA' => join("\n", $data), |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | $toemail = ''; |
23 | 23 | $template = 'alert_new_mp'; |
24 | 24 | for ($k=1; $k<$argc; $k++) { |
25 | - if ($argv[$k] == '--nomail') { |
|
26 | - $nomail = true; |
|
27 | - } |
|
28 | - if (preg_match('#^--only=(.*)$#', $argv[$k], $m)) { |
|
29 | - $onlyemail = $m[1]; |
|
30 | - } |
|
31 | - if (preg_match('#^--from=(.*)$#', $argv[$k], $m)) { |
|
32 | - $fromemail = $m[1]; |
|
33 | - } |
|
34 | - if (preg_match('#^--to=(.*)$#', $argv[$k], $m)) { |
|
35 | - $toemail = $m[1]; |
|
36 | - } |
|
25 | + if ($argv[$k] == '--nomail') { |
|
26 | + $nomail = true; |
|
27 | + } |
|
28 | + if (preg_match('#^--only=(.*)$#', $argv[$k], $m)) { |
|
29 | + $onlyemail = $m[1]; |
|
30 | + } |
|
31 | + if (preg_match('#^--from=(.*)$#', $argv[$k], $m)) { |
|
32 | + $fromemail = $m[1]; |
|
33 | + } |
|
34 | + if (preg_match('#^--to=(.*)$#', $argv[$k], $m)) { |
|
35 | + $toemail = $m[1]; |
|
36 | + } |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if (DEVSITE) { |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | mlog("NOT SENDING EMAIL\n"); |
48 | 48 | } |
49 | 49 | if (($fromemail && $onlyemail) || ($toemail && $onlyemail)) { |
50 | - mlog("Can't have both from/to and only!\n"); |
|
51 | - exit; |
|
50 | + mlog("Can't have both from/to and only!\n"); |
|
51 | + exit; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $active = 0; |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | $members = array(); |
74 | 74 | $start_time = time(); |
75 | 75 | foreach ($alertdata as $alertitem) { |
76 | - $active++; |
|
77 | - $email = $alertitem['email']; |
|
76 | + $active++; |
|
77 | + $email = $alertitem['email']; |
|
78 | 78 | if ($onlyemail && $email != $onlyemail) { |
79 | 79 | continue; |
80 | 80 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | |
169 | 169 | $sss = "Active alerts: $active\nEmail lookups: $registered registered, $unregistered unregistered\nQuery lookups: $queries\nSent emails: $sentemails\n"; |
170 | 170 | if ($globalsuccess) { |
171 | - $sss .= 'Everything went swimmingly, in '; |
|
171 | + $sss .= 'Everything went swimmingly, in '; |
|
172 | 172 | } else { |
173 | - $sss .= 'Something went wrong! Total time: '; |
|
173 | + $sss .= 'Something went wrong! Total time: '; |
|
174 | 174 | } |
175 | 175 | $sss .= (getmicrotime()-$global_start)."\n\n"; |
176 | 176 | mlog($sss); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $fromflag = false; |
22 | 22 | $toemail = ''; |
23 | 23 | $template = 'alert_new_mp'; |
24 | -for ($k=1; $k<$argc; $k++) { |
|
24 | +for ($k = 1; $k < $argc; $k++) { |
|
25 | 25 | if ($argv[$k] == '--nomail') { |
26 | 26 | $nomail = true; |
27 | 27 | } |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | continue; |
113 | 113 | } |
114 | 114 | |
115 | - if ( !isset($cons[$member->constituency]) ) { |
|
115 | + if (!isset($cons[$member->constituency])) { |
|
116 | 116 | $cons_member = new MEMBER(array('constituency' => $member->constituency, 'house' => 1)); |
117 | - if ( !$cons_member ) { |
|
117 | + if (!$cons_member) { |
|
118 | 118 | continue; |
119 | 119 | } |
120 | 120 | $cons[$member->constituency] = $cons_member; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | // these should never happen but let's just be sure |
126 | - if ( $cons_member->person_id == $member->person_id ) { |
|
126 | + if ($cons_member->person_id == $member->person_id) { |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | if (!$cons_member->current_member_anywhere()) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $user_id = 0; |
148 | 148 | $unregistered++; |
149 | 149 | } |
150 | - mlog("\nEMAIL: $email, uid $user_id; memory usage : ".memory_get_usage()."\n"); |
|
150 | + mlog("\nEMAIL: $email, uid $user_id; memory usage : " . memory_get_usage() . "\n"); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | $lh = $member->left_house(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } else { |
173 | 173 | $sss .= 'Something went wrong! Total time: '; |
174 | 174 | } |
175 | -$sss .= (getmicrotime()-$global_start)."\n\n"; |
|
175 | +$sss .= (getmicrotime() - $global_start) . "\n\n"; |
|
176 | 176 | mlog($sss); |
177 | 177 | mlog(date('r') . "\n"); |
178 | 178 | |
@@ -185,18 +185,18 @@ discard block |
||
185 | 185 | $m = array( |
186 | 186 | 'DATA' => join("\n", $data), |
187 | 187 | 'CHANGE' => join("\n", $change), |
188 | - 'ALERT_IS' => count($data)==1 ? 'alert is' : 'alerts are', |
|
189 | - 'MPS' => count($data)==1 ? 'This MP' : 'These MPs', |
|
190 | - 'MPS2' => count($data)==1 ? 'MP' : 'MPs', |
|
191 | - 'ALERTS' => count($data)==1 ? 'an alert' : 'some alerts', |
|
192 | - 'ALERTS2' => count($data)==1 ? 'alert' : 'alerts', |
|
193 | - 'LINKS' => count($data)==1 ? 'link' : 'links', |
|
188 | + 'ALERT_IS' => count($data) == 1 ? 'alert is' : 'alerts are', |
|
189 | + 'MPS' => count($data) == 1 ? 'This MP' : 'These MPs', |
|
190 | + 'MPS2' => count($data) == 1 ? 'MP' : 'MPs', |
|
191 | + 'ALERTS' => count($data) == 1 ? 'an alert' : 'some alerts', |
|
192 | + 'ALERTS2' => count($data) == 1 ? 'alert' : 'alerts', |
|
193 | + 'LINKS' => count($data) == 1 ? 'link' : 'links', |
|
194 | 194 | ); |
195 | 195 | if (!$nomail) { |
196 | 196 | $success = send_template_email($d, $m, true); |
197 | 197 | mlog("sent ... "); |
198 | 198 | # sleep if time between sending mails is less than a certain number of seconds on average |
199 | - if (((time() - $start_time) / $sentemails) < 0.5 ) { |
|
199 | + if (((time() - $start_time) / $sentemails) < 0.5) { |
|
200 | 200 | # number of seconds per mail not to be quicker than |
201 | 201 | mlog("pausing ... "); |
202 | 202 | sleep(1); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | $count = 0; |
49 | -while ( ( $policy = fgetcsv($file) ) !== FALSE ) { |
|
49 | +while ( ( $policy = fgetcsv($file) ) !== false ) { |
|
50 | 50 | if ( intval($policy[0]) ) { |
51 | 51 | $policy_id = $policy[0]; |
52 | 52 | $img_id = $policy[1] ? $policy[1] : $policy_id; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | exit(1); |
34 | 34 | } |
35 | 35 | |
36 | -if ( !file_exists($csvfile) ) { |
|
36 | +if (!file_exists($csvfile)) { |
|
37 | 37 | print "$csvfile cannot be found\n"; |
38 | 38 | exit(1); |
39 | 39 | } |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | $count = 0; |
49 | -while ( ( $policy = fgetcsv($file) ) !== FALSE ) { |
|
50 | - if ( intval($policy[0]) ) { |
|
49 | +while (($policy = fgetcsv($file)) !== FALSE) { |
|
50 | + if (intval($policy[0])) { |
|
51 | 51 | $policy_id = $policy[0]; |
52 | 52 | $img_id = $policy[1] ? $policy[1] : $policy_id; |
53 | 53 | $title = $policy[2]; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ':image_attribution' => $attribution, |
70 | 70 | ':license_url' => $licence_url) |
71 | 71 | ); |
72 | - if ( $q->success() ) { |
|
72 | + if ($q->success()) { |
|
73 | 73 | $count += $q->affected_rows(); |
74 | 74 | } else { |
75 | 75 | print "failed to update data for $policy_id\n"; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -$new_style_template = TRUE; |
|
3 | +$new_style_template = true; |
|
4 | 4 | |
5 | 5 | include_once '../../../includes/easyparliament/init.php'; |
6 | 6 | include_once INCLUDESPATH . 'easyparliament/member.php'; |