@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | $gid = get_http_var('gid'); |
6 | 6 | $oops = get_http_var('oops'); |
7 | 7 | |
8 | -if (!$oops || !$gid) exit; |
|
8 | +if (!$oops || !$gid) { |
|
9 | + exit; |
|
10 | +} |
|
9 | 11 | |
10 | 12 | $gid = "uk.org.publicwhip/$gid"; |
11 | 13 | |
@@ -16,7 +18,8 @@ discard block |
||
16 | 18 | |
17 | 19 | $db = new ParlDB; |
18 | 20 | $q = $db->query("update video_timestamps set deleted=1 where id = :oops and gid = :gid and current_timestamp<whenstamped+interval 30 second", $params); |
19 | -if ($q->affected_rows()) |
|
21 | +if ($q->affected_rows()) { |
|
20 | 22 | $db->query("update hansard set video_status = video_status & 11 where gid = :gid", $params); |
23 | +} |
|
21 | 24 | |
22 | 25 | print "<status>OK</status>"; |
@@ -18,11 +18,16 @@ |
||
18 | 18 | $htime = $q->field(0, 'htime'); |
19 | 19 | $atime = $q->field(0, 'atime'); |
20 | 20 | $adate = $q->field(0, 'adate'); |
21 | -if ($atime) $htime = $atime; |
|
22 | -if ($adate) $hdate = $adate; |
|
21 | +if ($atime) { |
|
22 | + $htime = $atime; |
|
23 | +} |
|
24 | +if ($adate) { |
|
25 | + $hdate = $adate; |
|
26 | +} |
|
23 | 27 | |
24 | -if (!$hdate || !$htime || !$time) |
|
28 | +if (!$hdate || !$htime || !$time) { |
|
25 | 29 | exit; |
30 | +} |
|
26 | 31 | |
27 | 32 | $videodb = \MySociety\TheyWorkForYou\Utility\Video::dbConnect(); |
28 | 33 | if (!$file) { |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $major = intval(get_http_var('major')); |
8 | 8 | if (!$major) $major = 1; |
9 | 9 | |
10 | -if ($action == 'next' || $action=='nextneeded') { |
|
10 | +if ($action == 'next' || $action == 'nextneeded') { |
|
11 | 11 | $gid = get_http_var('gid'); |
12 | 12 | $file = intval(get_http_var('file')); |
13 | 13 | $time = intval(get_http_var('time')); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $q = $db->query("select gid, hpos from hansard |
28 | 28 | where hpos>$hpos and hdate='$hdate' and major=$major |
29 | 29 | and (htype=12 or htype=13) " |
30 | - . ($action=='nextneeded'?'and video_status in (1,3)':'') . " |
|
30 | + . ($action == 'nextneeded' ? 'and video_status in (1,3)' : '')." |
|
31 | 31 | ORDER BY hpos LIMIT 1"); |
32 | 32 | if (!$q->rows()) { |
33 | 33 | $PAGE->page_start(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } else { |
42 | 42 | $new_gid = $q->field(0, 'gid'); |
43 | 43 | $new_hpos = $q->field(0, 'hpos'); |
44 | - if ($action=='nextneeded') { |
|
44 | + if ($action == 'nextneeded') { |
|
45 | 45 | $q = $db->query("select adate, atime from hansard, video_timestamps |
46 | 46 | where hansard.gid = video_timestamps.gid and deleted=0 |
47 | 47 | and hpos<$new_hpos and hdate='$hdate' and major=$major |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | $new_gid = fix_gid_but_leave_section($new_gid); |
60 | - header('Location: /video/?from=next&file=' . $file . '&gid=' . $new_gid . '&start=' . $time); |
|
60 | + header('Location: /video/?from=next&file='.$file.'&gid='.$new_gid.'&start='.$time); |
|
61 | 61 | } |
62 | 62 | } elseif ($action == 'random' && $pid) { |
63 | 63 | $db = new ParlDB; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | and hansard.person_id=:pid |
68 | 68 | ORDER BY RAND() LIMIT 1", array(':major' => $major, ':pid' => $pid)); |
69 | 69 | $new_gid = fix_gid_but_leave_section($q->field(0, 'gid')); |
70 | - header('Location: /video/?from=random&pid=' . $pid . '&gid=' . $new_gid); |
|
70 | + header('Location: /video/?from=random&pid='.$pid.'&gid='.$new_gid); |
|
71 | 71 | } elseif ($action == 'random') { |
72 | 72 | $db = new ParlDB; |
73 | 73 | $q = $db->query("select gid, hpos, hdate from hansard |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | */ |
97 | 97 | $gid = fix_gid_but_leave_section($gid); |
98 | - header('Location: /video/?from=random&gid=' . $gid); |
|
98 | + header('Location: /video/?from=random&gid='.$gid); |
|
99 | 99 | } else { |
100 | 100 | # Illegal action |
101 | 101 | } |
@@ -5,7 +5,9 @@ |
||
5 | 5 | $action = get_http_var('action'); |
6 | 6 | $pid = intval(get_http_var('pid')); |
7 | 7 | $major = intval(get_http_var('major')); |
8 | -if (!$major) $major = 1; |
|
8 | +if (!$major) { |
|
9 | + $major = 1; |
|
10 | +} |
|
9 | 11 | |
10 | 12 | if ($action == 'next' || $action=='nextneeded') { |
11 | 13 | $gid = get_http_var('gid'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | // We then print a nice welcome message. |
12 | 12 | |
13 | 13 | include_once '../../../includes/easyparliament/init.php'; |
14 | -include_once INCLUDESPATH . "easyparliament/member.php"; |
|
14 | +include_once INCLUDESPATH."easyparliament/member.php"; |
|
15 | 15 | |
16 | 16 | if (get_http_var('welcome') == 't') { |
17 | 17 | // The user has successfully clicked the link, been logged in, and |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $PAGE->stripe_end(array( |
71 | - array ( |
|
71 | + array( |
|
72 | 72 | 'type' => 'include', |
73 | 73 | 'content' => 'userconfirmed' |
74 | 74 | ) |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | // The user's first visit to this page, and they have a registration token. |
81 | 81 | // So let's confirm them and hope they get logged in... |
82 | 82 | |
83 | - if (get_http_var('c') == 'email' ) { |
|
84 | - $success = $THEUSER->confirm_email( get_http_var('t') ); |
|
83 | + if (get_http_var('c') == 'email') { |
|
84 | + $success = $THEUSER->confirm_email(get_http_var('t')); |
|
85 | 85 | } else { |
86 | - $success = $THEUSER->confirm( get_http_var('t') ); |
|
86 | + $success = $THEUSER->confirm(get_http_var('t')); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | if (!$success) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | $this_page = 'userconfirmfailed'; |
104 | 104 | |
105 | - if ( !$PAGE->page_started() ) { |
|
105 | + if (!$PAGE->page_started()) { |
|
106 | 106 | $PAGE->page_start(); |
107 | 107 | |
108 | 108 | $PAGE->stripe_start(); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | if ($success) { |
63 | 63 | |
64 | - print "<p>A new password has been sent to " . _htmlentities($email) . "</p>\n"; |
|
64 | + print "<p>A new password has been sent to "._htmlentities($email)."</p>\n"; |
|
65 | 65 | |
66 | 66 | } else { |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } else { |
75 | 75 | // This email address isn't in the DB. |
76 | 76 | |
77 | - $errors["passwordchange"] = "Sorry, there was a problem and we couldn't set a new password for " . _htmlentities($email); |
|
77 | + $errors["passwordchange"] = "Sorry, there was a problem and we couldn't set a new password for "._htmlentities($email); |
|
78 | 78 | |
79 | 79 | |
80 | 80 | display_page($errors); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | |
93 | -function display_page ($errors=array()) { |
|
93 | +function display_page($errors = array()) { |
|
94 | 94 | global $this_page, $PAGE; |
95 | 95 | |
96 | 96 | if (isset($errors["sending"])) { |
@@ -14,7 +14,7 @@ |
||
14 | 14 | // So we can send the user back to where they came from. |
15 | 15 | $URL->insert(array("ret"=>get_http_var("ret"))); |
16 | 16 | } |
17 | -$THEUSER->logout( $URL->generate() ); |
|
17 | +$THEUSER->logout($URL->generate()); |
|
18 | 18 | |
19 | 19 | $message['title'] = 'You are now logged out'; |
20 | 20 |
@@ -11,34 +11,34 @@ discard block |
||
11 | 11 | |
12 | 12 | $slug = get_http_var('id'); |
13 | 13 | if ($slug) { |
14 | - $topic = $topics->getTopic($slug); |
|
14 | + $topic = $topics->getTopic($slug); |
|
15 | 15 | } else { |
16 | - $topic = new \MySociety\TheyWorkForYou\Topic(); |
|
16 | + $topic = new \MySociety\TheyWorkForYou\Topic(); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | $action = get_http_var('action'); |
20 | 20 | switch ($action) { |
21 | 21 | case 'add': |
22 | 22 | $success = add_topic($topic); |
23 | - break; |
|
23 | + break; |
|
24 | 24 | case 'update': |
25 | 25 | $success = update_topic($topic); |
26 | - break; |
|
26 | + break; |
|
27 | 27 | case 'setimage': |
28 | 28 | $success = add_image($topic); |
29 | - break; |
|
29 | + break; |
|
30 | 30 | case 'addcontent': |
31 | 31 | $success = add_content($topic); |
32 | - break; |
|
32 | + break; |
|
33 | 33 | case 'deletecontent': |
34 | 34 | $success = delete_content($topic); |
35 | - break; |
|
35 | + break; |
|
36 | 36 | case 'addpolicysets': |
37 | 37 | $success = add_policy_sets($topic); |
38 | - break; |
|
38 | + break; |
|
39 | 39 | case 'addpolicies': |
40 | 40 | $success = add_policies($topic); |
41 | - break; |
|
41 | + break; |
|
42 | 42 | default: |
43 | 43 | $success = NULL; |
44 | 44 | } |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | <select name="sets[]" multiple> |
126 | 126 | <option value="">None</option> |
127 | 127 | <?php |
128 | - $policies = new \MySociety\TheyWorkForYou\Policies; |
|
129 | - $set_descriptions = $policies->getSetDescriptions(); |
|
130 | - $related_sets = $topic->getPolicySets(); |
|
131 | - foreach ($set_descriptions as $set => $description) { ?> |
|
128 | + $policies = new \MySociety\TheyWorkForYou\Policies; |
|
129 | + $set_descriptions = $policies->getSetDescriptions(); |
|
130 | + $related_sets = $topic->getPolicySets(); |
|
131 | + foreach ($set_descriptions as $set => $description) { ?> |
|
132 | 132 | <option value="<?= $set ?>" <?= in_array($set, $related_sets) ? 'selected' : '' ?>><?= $description ?></option> |
133 | 133 | <?php } ?> |
134 | 134 | <input type="submit" value="Update"> |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | <select name="policies[]" multiple> |
144 | 144 | <option value="">None</option> |
145 | 145 | <?php |
146 | - $policies = new \MySociety\TheyWorkForYou\Policies; |
|
147 | - $all_policies = $policies->getPolicies(); |
|
148 | - $related_policies = $topic->getPolicies(); |
|
149 | - foreach ($all_policies as $number => $description) { ?> |
|
146 | + $policies = new \MySociety\TheyWorkForYou\Policies; |
|
147 | + $all_policies = $policies->getPolicies(); |
|
148 | + $related_policies = $topic->getPolicies(); |
|
149 | + foreach ($all_policies as $number => $description) { ?> |
|
150 | 150 | <option value="<?= $number ?>" <?= in_array($number, $related_policies) ? 'selected' : '' ?>><?= $description ?></option> |
151 | 151 | <?php } ?> |
152 | 152 | |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | $file_info['tmp_name'], |
215 | 215 | $topic->image_path() |
216 | 216 | ); |
217 | - } catch (ErrorException $e) { |
|
217 | + } catch (ErrorException $e) { |
|
218 | 218 | return false; |
219 | - } |
|
219 | + } |
|
220 | 220 | |
221 | 221 | if ($image_saved) { |
222 | 222 | return $topic->save(); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $success = add_policies($topic); |
41 | 41 | break; |
42 | 42 | default: |
43 | - $success = NULL; |
|
43 | + $success = null; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if (!is_null($success)) { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $max_time = relative_time($row['max_time']); |
21 | 21 | $min_time = str_replace(" ago", "", $min_time); |
22 | 22 | $max_time = str_replace(" ago", "", $max_time); |
23 | - $rows[] = array ( |
|
23 | + $rows[] = array( |
|
24 | 24 | $row['count_ips'], |
25 | 25 | $row['group_count'], |
26 | 26 | '<a href="'.$row['url'].'">'._htmlentities($row['query']).'</a>', |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | ); |
30 | 30 | } |
31 | 31 | |
32 | -$tabledata = array ( |
|
33 | - 'header' => array ( |
|
32 | +$tabledata = array( |
|
33 | + 'header' => array( |
|
34 | 34 | 'Distinct IPs', |
35 | 35 | 'Number of times', |
36 | 36 | 'Query', |
@@ -14,14 +14,14 @@ |
||
14 | 14 | |
15 | 15 | $rows = array(); |
16 | 16 | foreach ($search_popular as $row) { |
17 | - $rows[] = array ( |
|
18 | - '<a href="'.$row['url'].'">' . _htmlentities($row['query']) . '</a>', |
|
17 | + $rows[] = array( |
|
18 | + '<a href="'.$row['url'].'">'._htmlentities($row['query']).'</a>', |
|
19 | 19 | $row['c'], |
20 | 20 | ); |
21 | 21 | } |
22 | 22 | |
23 | -$tabledata = array ( |
|
24 | - 'header' => array ( |
|
23 | +$tabledata = array( |
|
24 | + 'header' => array( |
|
25 | 25 | 'Query', |
26 | 26 | 'Count' |
27 | 27 | ), |