@@ -38,10 +38,10 @@ |
||
38 | 38 | <p>There are <b><?=number_format($debate_speeches)?></b> debate speeches (<?=number_format($debate_items)?> items including headers). |
39 | 39 | <br>There are <b><?=number_format($wrans_questions)?></b> written questions (<?=number_format($wrans_items)?> items including headers and answers). |
40 | 40 | |
41 | -<!-- Debate items / in-session day: <?=round($debate_items/$uniquedates,0)?> |
|
42 | -Wrans items / in-session day: <?=round($wrans_items/$uniquedates,0)?> --> |
|
41 | +<!-- Debate items / in-session day: <?=round($debate_items / $uniquedates, 0)?> |
|
42 | +Wrans items / in-session day: <?=round($wrans_items / $uniquedates, 0)?> --> |
|
43 | 43 | |
44 | -<p>Per sitting day, MPs are producing <b><?=round($debate_speeches/$uniquedates,0)?></b> speeches, and <b><?=round($wrans_questions/$uniquedates,0)?></b> written answers. |
|
44 | +<p>Per sitting day, MPs are producing <b><?=round($debate_speeches / $uniquedates, 0)?></b> speeches, and <b><?=round($wrans_questions / $uniquedates, 0)?></b> written answers. |
|
45 | 45 | </p> |
46 | 46 | |
47 | 47 | <?php |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE confirmed = '0'"); |
23 | 23 | $unconfirmedusers = $q->field(0, 'count'); |
24 | 24 | |
25 | -$olddate = gmdate("Y-m-d H:i:s", time()-86400); |
|
25 | +$olddate = gmdate("Y-m-d H:i:s", time() - 86400); |
|
26 | 26 | $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'"); |
27 | 27 | $dayusers = $q->field(0, 'count'); |
28 | 28 | |
29 | -$olddate = gmdate("Y-m-d H:i:s", time()-86400*7); |
|
29 | +$olddate = gmdate("Y-m-d H:i:s", time() - 86400 * 7); |
|
30 | 30 | $q = $db->query("SELECT COUNT(*) AS count FROM users WHERE lastvisit > '$olddate'"); |
31 | 31 | $weekusers = $q->field(0, 'count'); |
32 | 32 | ?> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $rows = array(); |
62 | 62 | $USERURL = new URL('userview'); |
63 | 63 | |
64 | -for ($row=0; $row<$q->rows(); $row++) { |
|
64 | +for ($row = 0; $row < $q->rows(); $row++) { |
|
65 | 65 | |
66 | 66 | $user_id = $q->field($row, 'user_id'); |
67 | 67 | |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | |
70 | 70 | if ($q->field($row, 'confirmed') == 1) { |
71 | 71 | $confirmed = 'Yes'; |
72 | - $name = '<a href="' . $USERURL->generate() . '">' . _htmlspecialchars($q->field($row, 'firstname')) |
|
73 | - . ' ' . _htmlspecialchars($q->field($row, 'lastname')) . '</a>'; |
|
72 | + $name = '<a href="'.$USERURL->generate().'">'._htmlspecialchars($q->field($row, 'firstname')) |
|
73 | + . ' '._htmlspecialchars($q->field($row, 'lastname')).'</a>'; |
|
74 | 74 | } else { |
75 | 75 | $confirmed = 'No'; |
76 | - $name = _htmlspecialchars($q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname')); |
|
76 | + $name = _htmlspecialchars($q->field($row, 'firstname').' '.$q->field($row, 'lastname')); |
|
77 | 77 | } |
78 | 78 | |
79 | - $rows[] = array ( |
|
79 | + $rows[] = array( |
|
80 | 80 | $name, |
81 | - '<a href="mailto:' . $q->field($row, 'email') . '">' . $q->field($row, 'email') . '</a>', |
|
81 | + '<a href="mailto:'.$q->field($row, 'email').'">'.$q->field($row, 'email').'</a>', |
|
82 | 82 | $confirmed, |
83 | 83 | $q->field($row, 'registrationtime') |
84 | 84 | ); |
85 | 85 | } |
86 | 86 | |
87 | -$tabledata = array ( |
|
88 | - 'header' => array ( |
|
87 | +$tabledata = array( |
|
88 | + 'header' => array( |
|
89 | 89 | 'Name', |
90 | 90 | 'Email', |
91 | 91 | 'Confirmed?', |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $DATA->set_page_metadata($this_page, 'title', 'Hansard'); |
8 | 8 | $DATA->set_page_metadata($this_page, 'meta_description', |
9 | - 'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.'); |
|
9 | + 'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.'); |
|
10 | 10 | $DATA->set_page_metadata($this_page, 'meta_keywords', "hansard, search hansard, hansard transcriptions, hansard record, parliamentary transcripts, parliament transcripts, parliament records, uk hansard, hansard uk, house of commons transcript, house of commons debates, house of commons records"); |
11 | 11 | |
12 | 12 | $PAGE->supress_heading = true; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | if ($COMMENT->exists() == false || !$COMMENT->visible()) { |
22 | 22 | // This comment id didn't exist in the DB. |
23 | - trigger_error("There is no annotation with an ID of '" . _htmlentities($comment_id) . "'.", E_USER_NOTICE); |
|
23 | + trigger_error("There is no annotation with an ID of '"._htmlentities($comment_id)."'.", E_USER_NOTICE); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // OK, we've got a valid comment ID. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | $REPORT = new COMMENTREPORT; |
58 | 58 | |
59 | - $reportdata = array ( |
|
59 | + $reportdata = array( |
|
60 | 60 | 'body' => get_http_var('body'), |
61 | 61 | 'firstname' => get_http_var('firstname'), |
62 | 62 | 'lastname' => get_http_var('lastname'), |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | |
86 | 86 | } else { |
87 | - $PAGE->error_message ("Sorry, we were unable to add the report to the database."); |
|
87 | + $PAGE->error_message("Sorry, we were unable to add the report to the database."); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | |
101 | 101 | |
102 | -function display_form($COMMENT, $errors=array()) { |
|
102 | +function display_form($COMMENT, $errors = array()) { |
|
103 | 103 | global $this_page, $THEUSER, $PAGE; |
104 | 104 | |
105 | 105 | ?> |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <?php |
123 | 123 | if ($THEUSER->isloggedin()) { |
124 | 124 | ?> |
125 | - <p><br><strong>From:</strong> <?php echo _htmlentities($THEUSER->firstname() . ' ' . $THEUSER->lastname()); ?></p> |
|
125 | + <p><br><strong>From:</strong> <?php echo _htmlentities($THEUSER->firstname().' '.$THEUSER->lastname()); ?></p> |
|
126 | 126 | <?php |
127 | 127 | } else { |
128 | 128 | // Not-logged-in user, so we want their name and email address. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | voteerror("Your browser must be able to accept cookies before you can register a vote."); |
32 | 32 | } else { |
33 | 33 | // Delete the test cookie. |
34 | - setcookie ('testcookie', ''); |
|
34 | + setcookie('testcookie', ''); |
|
35 | 35 | } |
36 | 36 | // On with the voting...! |
37 | 37 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // We need to check the user can accept cookies, so... |
41 | 41 | |
42 | 42 | // Set a cookie |
43 | - setcookie ('testcookie', 'true'); |
|
43 | + setcookie('testcookie', 'true'); |
|
44 | 44 | |
45 | 45 | $ret = get_http_var('ret'); |
46 | 46 | $id = get_http_var('id'); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | )); |
57 | 57 | |
58 | 58 | // Redirect to this same URL with 'testing=true' on the end. |
59 | - header("Location: " . $URL->generate('none')); |
|
59 | + header("Location: ".$URL->generate('none')); |
|
60 | 60 | exit; |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | $PAGE->page_start(); |
69 | 69 | |
70 | - $message = array ( |
|
70 | + $message = array( |
|
71 | 71 | 'title' => 'Sorry', |
72 | 72 | 'text' => $text |
73 | 73 | ); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $prev_epvotes[] = $epobject_id; |
159 | 159 | $new_cookie = implode('+', $prev_epvotes); |
160 | 160 | |
161 | - setcookie ("epvotes", $new_cookie, time()+60*60*24*365, "/", COOKIEDOMAIN); |
|
161 | + setcookie("epvotes", $new_cookie, time() + 60 * 60 * 24 * 365, "/", COOKIEDOMAIN); |
|
162 | 162 | |
163 | 163 | |
164 | 164 | } else { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $PAGE->page_start(); |
191 | 191 | |
192 | -$message = array ( |
|
192 | +$message = array( |
|
193 | 193 | 'title' => "Thanks for your vote", |
194 | 194 | 'text' => "<strong>Would you like to ask a question like this yourself?</strong> Use our <a href=\"http://www.whatdotheyknow.com\">Freedom of Information site</a>." |
195 | 195 | ); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | $this_page = "emailfriend"; |
4 | 4 | |
5 | 5 | include_once '../../includes/easyparliament/init.php'; |
6 | -include_once INCLUDESPATH . 'easyparliament/member.php'; |
|
6 | +include_once INCLUDESPATH.'easyparliament/member.php'; |
|
7 | 7 | |
8 | 8 | $PAGE->page_start(); |
9 | 9 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | if (sizeof($errors)) { |
33 | 33 | print '<p>Please correct the following errors:</p>'; |
34 | - print '<ul><li>' . join('</li> <li>', $errors) . '</li></ul><br>'; |
|
34 | + print '<ul><li>'.join('</li> <li>', $errors).'</li></ul><br>'; |
|
35 | 35 | ?> |
36 | 36 | <form action="./" method="post"> |
37 | 37 | <p> |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | <?php |
46 | 46 | } else { |
47 | 47 | $rep_name = $MEMBER->full_name(); |
48 | - if ($MEMBER->house_disp==1) $rep_name .= ' MP'; |
|
49 | - elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA'; |
|
50 | - $data = array ( |
|
48 | + if ($MEMBER->house_disp == 1) $rep_name .= ' MP'; |
|
49 | + elseif ($MEMBER->house_disp == 3) $rep_name .= ' MLA'; |
|
50 | + $data = array( |
|
51 | 51 | 'template' => 'email_a_friend', |
52 | 52 | 'to' => $recipient_email, |
53 | - 'subject' => 'Find out all about ' . $rep_name |
|
53 | + 'subject' => 'Find out all about '.$rep_name |
|
54 | 54 | ); |
55 | 55 | $url = $MEMBER->url(true); |
56 | - $merge = array ( |
|
56 | + $merge = array( |
|
57 | 57 | 'NAME' => $sender_name, |
58 | 58 | 'EMAIL' => $sender_email, |
59 | 59 | 'REP_NAME' => $rep_name, |
@@ -14,20 +14,25 @@ discard block |
||
14 | 14 | $sender_email = get_http_var('sender_mail'); |
15 | 15 | $sender_name = get_http_var('sender_name'); |
16 | 16 | $pid = intval(get_http_var('pid')); |
17 | -if ($pid) |
|
17 | +if ($pid) { |
|
18 | 18 | $MEMBER = new MEMBER(array('person_id' => $pid)); |
19 | +} |
|
19 | 20 | |
20 | 21 | //validate them |
21 | 22 | $errors = array(); |
22 | 23 | |
23 | -if (!$pid) |
|
24 | +if (!$pid) { |
|
24 | 25 | $errors[] = 'You did not get to this page from an MP or Peer page. Please go back and try again.'; |
25 | -if (!preg_match('#^[^@]+@#', $recipient_email)) |
|
26 | +} |
|
27 | +if (!preg_match('#^[^@]+@#', $recipient_email)) { |
|
26 | 28 | $errors[] = "'$recipient_email' is not a valid recipient email address. Please have another go."; |
27 | -if (!validate_email($sender_email)) |
|
29 | +} |
|
30 | +if (!validate_email($sender_email)) { |
|
28 | 31 | $errors[] = "'$sender_email' is not a valid sender email address. Please have another go."; |
29 | -if (!$sender_name) |
|
32 | +} |
|
33 | +if (!$sender_name) { |
|
30 | 34 | $errors[] = "If you don't give us your name, we can't tell the recipient who sent them the link. We won't store it or use for any other purpose than sending this email."; |
35 | +} |
|
31 | 36 | |
32 | 37 | if (sizeof($errors)) { |
33 | 38 | print '<p>Please correct the following errors:</p>'; |
@@ -45,8 +50,11 @@ discard block |
||
45 | 50 | <?php |
46 | 51 | } else { |
47 | 52 | $rep_name = $MEMBER->full_name(); |
48 | - if ($MEMBER->house_disp==1) $rep_name .= ' MP'; |
|
49 | - elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA'; |
|
53 | + if ($MEMBER->house_disp==1) { |
|
54 | + $rep_name .= ' MP'; |
|
55 | + } elseif ($MEMBER->house_disp==3) { |
|
56 | + $rep_name .= ' MLA'; |
|
57 | + } |
|
50 | 58 | $data = array ( |
51 | 59 | 'template' => 'email_a_friend', |
52 | 60 | 'to' => $recipient_email, |
@@ -62,7 +62,7 @@ |
||
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - include_once INCLUDESPATH . 'easyparliament/templates/html/calendar_date.php'; |
|
65 | + include_once INCLUDESPATH.'easyparliament/templates/html/calendar_date.php'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | # --- |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $divisions = new Divisions(); |
43 | 43 | $data['recent_divisions'] = $divisions->getRecentDivisionsForPolicies($topic_policies, 10); |
44 | 44 | |
45 | - include_once INCLUDESPATH . 'easyparliament/member.php'; |
|
45 | + include_once INCLUDESPATH.'easyparliament/member.php'; |
|
46 | 46 | |
47 | 47 | // Check to see if there's a submitted postcode to try determine policy positions. |
48 | 48 | if (get_http_var('pc') != '') |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | $pc = get_http_var('pc'); |
55 | 55 | $pc = preg_replace('#[^a-z0-9]#i', '', $pc); |
56 | 56 | if (validate_postcode($pc)) { |
57 | - twfy_debug ('MP', "MP lookup by postcode"); |
|
57 | + twfy_debug('MP', "MP lookup by postcode"); |
|
58 | 58 | $constituency = strtolower(Utility\Postcode::postcodeToConstituency($pc)); |
59 | 59 | if ($constituency == "connection_timed_out") { |
60 | 60 | throw new Exception('Sorry, we couldn’t check your postcode right now, as our postcode lookup server is under quite a lot of load.'); |
61 | 61 | } elseif ($constituency == "") { |
62 | - twfy_debug ('MP', "Can't display an MP, as submitted postcode didn't match a constituency"); |
|
63 | - throw new Exception('Sorry, ' . _htmlentities($pc) . ' isn’t a known postcode'); |
|
62 | + twfy_debug('MP', "Can't display an MP, as submitted postcode didn't match a constituency"); |
|
63 | + throw new Exception('Sorry, '._htmlentities($pc).' isn’t a known postcode'); |
|
64 | 64 | } else { |
65 | 65 | // Generate the Member object |
66 | 66 | $member = new Member(array('constituency' => $constituency, 'house' => HOUSE_TYPE_COMMONS)); |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | } else { |
73 | - twfy_debug ('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
74 | - throw new Exception('Sorry, ' . _htmlentities($pc) . ' isn’t a valid postcode'); |
|
73 | + twfy_debug('MP', "Can't display an MP because the submitted postcode wasn't of a valid form."); |
|
74 | + throw new Exception('Sorry, '._htmlentities($pc).' isn’t a valid postcode'); |
|
75 | 75 | } |
76 | 76 | } catch (Exception $e) { |
77 | 77 | Renderer::output('topic/error', array('error' => $e->getMessage())); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | namespace MySociety\TheyWorkForYou; |
12 | 12 | |
13 | 13 | // Disable the old PAGE class. |
14 | -$new_style_template = TRUE; |
|
14 | +$new_style_template = true; |
|
15 | 15 | |
16 | 16 | // Include all the things this page needs. |
17 | 17 | include_once '../../includes/easyparliament/init.php'; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | include_once '../../includes/easyparliament/init.php'; |
4 | -include_once INCLUDESPATH . "easyparliament/member.php"; |
|
4 | +include_once INCLUDESPATH."easyparliament/member.php"; |
|
5 | 5 | |
6 | 6 | $db = new ParlDB(); |
7 | 7 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | from member as m1, member as m2 |
13 | 13 | where m1.person_id = m2.person_id and m1.house != m2.house and m1.house < m2.house |
14 | 14 | and m1.left_house='9999-12-31' and m2.left_house='9999-12-31'"); |
15 | -for ($i=0; $i<$q->rows(); $i++) { |
|
15 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
16 | 16 | $pid = $q->field($i, 'person_id'); |
17 | 17 | $member = new MEMBER(array('person_id' => $pid)); |
18 | 18 | $h1 = $q->field($i, 'house1'); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | if (!isset($out[$h1][$h2])) return; |
32 | 32 | print "<h3>$title</h3>\n<ul>\n"; |
33 | 33 | foreach ($out[$h1][$h2] as $m) { |
34 | - print '<li><a href="' . $m->url() . '">' . $m->full_name() . "</a></li>\n"; |
|
34 | + print '<li><a href="'.$m->url().'">'.$m->full_name()."</a></li>\n"; |
|
35 | 35 | } |
36 | 36 | print '</ul>'; |
37 | 37 | } |
@@ -28,7 +28,9 @@ |
||
28 | 28 | |
29 | 29 | function out($h1, $h2, $title) { |
30 | 30 | global $out; |
31 | - if (!isset($out[$h1][$h2])) return; |
|
31 | + if (!isset($out[$h1][$h2])) { |
|
32 | + return; |
|
33 | + } |
|
32 | 34 | print "<h3>$title</h3>\n<ul>\n"; |
33 | 35 | foreach ($out[$h1][$h2] as $m) { |
34 | 36 | print '<li><a href="' . $m->url() . '">' . $m->full_name() . "</a></li>\n"; |