@@ -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) { |
@@ -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'); |
@@ -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 |
@@ -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)) { |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $PAGE->page_start(); |
9 | 9 | $PAGE->stripe_start(); |
10 | -$PAGE->block_start(array ('id'=>'alerts', 'title'=>'Alert Statistics')); |
|
10 | +$PAGE->block_start(array('id'=>'alerts', 'title'=>'Alert Statistics')); |
|
11 | 11 | $db = new ParlDB; |
12 | 12 | |
13 | 13 | $q_confirmed = $db->query('select count(*) as c from alerts where confirmed and not deleted'); |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | print '<h3>Headline stats</h3> <table>'; |
20 | 20 | $data = array( |
21 | - 'header' => array( 'Alert Type', 'Count' ), |
|
21 | + 'header' => array('Alert Type', 'Count'), |
|
22 | 22 | 'rows' => array( |
23 | - array( 'Confirmed', $q_confirmed->field('0', 'c') ), |
|
24 | - array( 'Not Confirmed', $q_not_confirmed->field('0', 'c') ), |
|
25 | - array( 'Deleted', $q_deleted->field('0', 'c') ), |
|
26 | - array( 'For a Speaker<sup>*</sup>', $q_speaker->field('0', 'c') ), |
|
27 | - array( 'For a Keyword', $q_keyword->field('0', 'c') ), |
|
23 | + array('Confirmed', $q_confirmed->field('0', 'c')), |
|
24 | + array('Not Confirmed', $q_not_confirmed->field('0', 'c')), |
|
25 | + array('Deleted', $q_deleted->field('0', 'c')), |
|
26 | + array('For a Speaker<sup>*</sup>', $q_speaker->field('0', 'c')), |
|
27 | + array('For a Keyword', $q_keyword->field('0', 'c')), |
|
28 | 28 | ) |
29 | 29 | ); |
30 | 30 | |
@@ -35,17 +35,17 @@ discard block |
||
35 | 35 | $q = $db->query('select alert_id, criteria from alerts where criteria not like "%speaker:%" and criteria like "%,%" and confirmed and not deleted'); |
36 | 36 | print '<h3>People who probably wanted separate signups</h3>'; |
37 | 37 | $rows = array(); |
38 | -for ($i=0; $i<$q->rows(); $i++) { |
|
38 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
39 | 39 | $id = $q->field($i, 'alert_id'); |
40 | 40 | $criteria = $q->field($i, 'criteria'); |
41 | 41 | $rows[] = array($id, $critera); |
42 | 42 | } |
43 | -$data = array( 'rows' => $rows ); |
|
43 | +$data = array('rows' => $rows); |
|
44 | 44 | $PAGE->display_table($data); |
45 | 45 | |
46 | 46 | $q = $db->query('select count(*) as c, criteria from alerts where criteria like "speaker:%" and confirmed and not deleted group by criteria order by c desc'); |
47 | 47 | $tots = array(); $name = array(); |
48 | -for ($i=0; $i<$q->rows(); $i++) { |
|
48 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
49 | 49 | $c = $q->field($i, 'c'); |
50 | 50 | $criteria = $q->field($i, 'criteria'); |
51 | 51 | if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | $q = $db->query('select count(*) as c, criteria from alerts where criteria like "speaker:%" and not confirmed group by criteria order by c desc'); |
61 | 61 | $unconfirmed = array(); |
62 | -for ($i=0; $i<$q->rows(); $i++) { |
|
62 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
63 | 63 | $c = $q->field($i, 'c'); |
64 | 64 | $criteria = $q->field($i, 'criteria'); |
65 | 65 | if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue; |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | -$people_header = array( 'Name', 'Confirmed', 'Unconfirmed'); |
|
73 | +$people_header = array('Name', 'Confirmed', 'Unconfirmed'); |
|
74 | 74 | print '<h3>Alert signups by MP/Peer</h3>'; |
75 | 75 | $rows = array(); |
76 | 76 | foreach ($tots as $person_id => $c) { |
77 | 77 | $u = isset($unconfirmed[$person_id]) ? $unconfirmed[$person_id] : 0; |
78 | - $rows[] = array( $name[$person_id], $c, $u ); |
|
78 | + $rows[] = array($name[$person_id], $c, $u); |
|
79 | 79 | } |
80 | 80 | $data = array( |
81 | - 'header' => array( 'Name', 'Confirmed', 'Unconfirmed'), |
|
81 | + 'header' => array('Name', 'Confirmed', 'Unconfirmed'), |
|
82 | 82 | 'rows' => $rows |
83 | 83 | ); |
84 | 84 | $PAGE->display_table($data); |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $confirmed = array(); |
88 | 88 | $total = array(); |
89 | 89 | $q = $db->query("select count(*) as c, criteria from alerts where criteria not like '%speaker:%' and confirmed and not deleted group by criteria having c>1 order by c desc"); |
90 | -for ($i=0; $i<$q->rows(); $i++) { |
|
90 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
91 | 91 | $c = $q->field($i, 'c'); |
92 | 92 | $criteria = $q->field($i, 'criteria'); |
93 | 93 | $confirmed[$criteria] = $c; |
94 | 94 | $total[$criteria] = 1; |
95 | 95 | } |
96 | 96 | $q = $db->query("select count(*) as c, criteria from alerts where criteria not like '%speaker:%' and not confirmed group by criteria having c>1 order by c desc"); |
97 | -for ($i=0; $i<$q->rows(); $i++) { |
|
97 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
98 | 98 | $c = $q->field($i, 'c'); |
99 | 99 | $criteria = $q->field($i, 'criteria'); |
100 | 100 | $unconfirmed[$criteria] = $c; |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | foreach ($total as $criteria => $tot) { |
106 | 106 | $c = isset($confirmed[$criteria]) ? $confirmed[$criteria] : 0; |
107 | 107 | $u = isset($unconfirmed[$criteria]) ? $unconfirmed[$criteria] : 0; |
108 | - $rows[] = array( $criteria, $c, $u ); |
|
108 | + $rows[] = array($criteria, $c, $u); |
|
109 | 109 | } |
110 | 110 | $data = array( |
111 | - 'header' => array( 'Criteria', 'Confirmed', 'Unconfirmed'), |
|
111 | + 'header' => array('Criteria', 'Confirmed', 'Unconfirmed'), |
|
112 | 112 | 'rows' => $rows |
113 | 113 | ); |
114 | 114 | $PAGE->display_table($data); |
@@ -48,11 +48,15 @@ discard block |
||
48 | 48 | for ($i=0; $i<$q->rows(); $i++) { |
49 | 49 | $c = $q->field($i, 'c'); |
50 | 50 | $criteria = $q->field($i, 'criteria'); |
51 | - if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue; |
|
51 | + if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) { |
|
52 | + continue; |
|
53 | + } |
|
52 | 54 | $person_id = $m[1]; |
53 | 55 | $MEMBER = new MEMBER(array('person_id'=>$person_id)); |
54 | 56 | if ($MEMBER->valid) { |
55 | - if (!array_key_exists($person_id, $tots)) $tots[$person_id] = 0; |
|
57 | + if (!array_key_exists($person_id, $tots)) { |
|
58 | + $tots[$person_id] = 0; |
|
59 | + } |
|
56 | 60 | $tots[$person_id] += $c; |
57 | 61 | $name[$person_id] = $MEMBER->full_name(); |
58 | 62 | } |
@@ -62,10 +66,14 @@ discard block |
||
62 | 66 | for ($i=0; $i<$q->rows(); $i++) { |
63 | 67 | $c = $q->field($i, 'c'); |
64 | 68 | $criteria = $q->field($i, 'criteria'); |
65 | - if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) continue; |
|
69 | + if (!preg_match('#^speaker:(\d+)#', $criteria, $m)) { |
|
70 | + continue; |
|
71 | + } |
|
66 | 72 | $person_id = $m[1]; |
67 | 73 | if (isset($name[$person_id])) { |
68 | - if (!array_key_exists($person_id, $unconfirmed)) $unconfirmed[$person_id] = 0; |
|
74 | + if (!array_key_exists($person_id, $unconfirmed)) { |
|
75 | + $unconfirmed[$person_id] = 0; |
|
76 | + } |
|
69 | 77 | $unconfirmed[$person_id] += $c; |
70 | 78 | } |
71 | 79 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $PAGE->page_start(); |
9 | 9 | $PAGE->stripe_start(); |
10 | -$PAGE->block_start(array ('id'=>'alerts', 'title'=>'Reporting Statistics')); |
|
10 | +$PAGE->block_start(array('id'=>'alerts', 'title'=>'Reporting Statistics')); |
|
11 | 11 | $db = new ParlDB; |
12 | 12 | $q = $db->query('select year(created) as the_year, month(created) as the_month, count(*) as c from alerts where confirmed and not deleted group by year(created) desc, month(created) desc'); |
13 | 13 | print '<h3>Alert signups per month</h3> <table>'; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | print '<thead><tr><th>Year</th><th style="padding-right: 15px;">Month</th><th>Sign Ups</th><tr></thead>'; |
17 | 17 | |
18 | 18 | $row_count = $q->rows(); |
19 | -for ($i=0; $i<$row_count; $i++) { |
|
19 | +for ($i = 0; $i < $row_count; $i++) { |
|
20 | 20 | $year = $q->field($i, 'the_year'); |
21 | 21 | $month = $q->field($i, 'the_month'); |
22 | 22 | $count = $q->field($i, 'c'); |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | 'epobject_type' => 2 |
31 | 31 | ); |
32 | 32 | $EDITQUEUE->approve($data); |
33 | -} |
|
34 | -elseif (get_http_var('decline')) { |
|
33 | +} elseif (get_http_var('decline')) { |
|
35 | 34 | $decline = array (get_http_var('decline')); |
36 | 35 | // Dump all declined items |
37 | 36 | $data = array ( |
@@ -39,8 +38,7 @@ discard block |
||
39 | 38 | 'epobject_type' => 2 |
40 | 39 | ); |
41 | 40 | $EDITQUEUE->decline($data); |
42 | -} |
|
43 | -elseif (get_http_var('delete_confirm')) { |
|
41 | +} elseif (get_http_var('delete_confirm')) { |
|
44 | 42 | $delete_id = get_http_var('delete_confirm'); |
45 | 43 | // Delete the existing glossary entry |
46 | 44 | $GLOSSARY->delete($delete_id); |
@@ -2,14 +2,14 @@ discard block |
||
2 | 2 | // Some sketchy crap for displaying pending glossary additions |
3 | 3 | |
4 | 4 | include_once '../../includes/easyparliament/init.php'; |
5 | -include_once (INCLUDESPATH."easyparliament/editqueue.php"); |
|
6 | -include_once (INCLUDESPATH."easyparliament/glossary.php"); |
|
5 | +include_once (INCLUDESPATH . "easyparliament/editqueue.php"); |
|
6 | +include_once (INCLUDESPATH . "easyparliament/glossary.php"); |
|
7 | 7 | |
8 | 8 | $this_page = "admin_glossary"; |
9 | 9 | |
10 | 10 | $EDITQUEUE = new GLOSSEDITQUEUE(); |
11 | 11 | |
12 | -$args = array ( |
|
12 | +$args = array( |
|
13 | 13 | 'sort' => "regexp_replace" |
14 | 14 | ); |
15 | 15 | |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | if (get_http_var('approve')) { |
23 | 23 | $approve = get_http_var('approve'); |
24 | 24 | if (!is_array($approve)) { |
25 | - $approve = array ( $approve ); |
|
25 | + $approve = array($approve); |
|
26 | 26 | } |
27 | 27 | // Add all approved items |
28 | - $data = array ( |
|
28 | + $data = array( |
|
29 | 29 | 'approvals' => $approve, |
30 | 30 | 'epobject_type' => 2 |
31 | 31 | ); |
32 | 32 | $EDITQUEUE->approve($data); |
33 | 33 | } |
34 | 34 | elseif (get_http_var('decline')) { |
35 | - $decline = array (get_http_var('decline')); |
|
35 | + $decline = array(get_http_var('decline')); |
|
36 | 36 | // Dump all declined items |
37 | - $data = array ( |
|
37 | + $data = array( |
|
38 | 38 | 'declines' => $decline, |
39 | 39 | 'epobject_type' => 2 |
40 | 40 | ); |
@@ -36,28 +36,33 @@ discard block |
||
36 | 36 | $pid = intval(get_http_var('pid')); |
37 | 37 | $errors = array(); |
38 | 38 | |
39 | - if (!array_key_exists('photo', $_FILES)) |
|
40 | - array_push($errors, 'Not got the photo.'); |
|
41 | - elseif ($_FILES['photo']['error'] > 0) |
|
42 | - array_push($errors, 'There was an error uploading the photo.'); |
|
43 | - elseif (!is_uploaded_file($_FILES['photo']['tmp_name'])) |
|
44 | - array_push($errors, 'Did not get an uploaded file.'); |
|
45 | - else { |
|
39 | + if (!array_key_exists('photo', $_FILES)) { |
|
40 | + array_push($errors, 'Not got the photo.'); |
|
41 | + } elseif ($_FILES['photo']['error'] > 0) { |
|
42 | + array_push($errors, 'There was an error uploading the photo.'); |
|
43 | + } elseif (!is_uploaded_file($_FILES['photo']['tmp_name'])) { |
|
44 | + array_push($errors, 'Did not get an uploaded file.'); |
|
45 | + } else { |
|
46 | 46 | $tmp_name = $_FILES['photo']['tmp_name']; |
47 | 47 | |
48 | 48 | $image = new Imagick(); |
49 | 49 | $image->readImage($tmp_name); |
50 | - if (!$image) |
|
51 | - array_push($errors, 'Failed to read image from uploaded file'); |
|
50 | + if (!$image) { |
|
51 | + array_push($errors, 'Failed to read image from uploaded file'); |
|
52 | + } |
|
52 | 53 | $imageS = clone $image; |
53 | - if (!$image->scaleImage(0, 118)) |
|
54 | - array_push($errors, 'Scaling large failed'); |
|
55 | - if (!$imageS->scaleImage(0, 59)) |
|
56 | - array_push($errors, 'Scaling small failed'); |
|
57 | - if (!$image->writeImage("$dir/mpsL/$pid.jpeg")) |
|
58 | - array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed"); |
|
59 | - if (!$imageS->writeImage("$dir/mps/$pid.jpeg")) |
|
60 | - array_push($errors, "Saving to $dir/mps/$pid.jpeg failed"); |
|
54 | + if (!$image->scaleImage(0, 118)) { |
|
55 | + array_push($errors, 'Scaling large failed'); |
|
56 | + } |
|
57 | + if (!$imageS->scaleImage(0, 59)) { |
|
58 | + array_push($errors, 'Scaling small failed'); |
|
59 | + } |
|
60 | + if (!$image->writeImage("$dir/mpsL/$pid.jpeg")) { |
|
61 | + array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed"); |
|
62 | + } |
|
63 | + if (!$imageS->writeImage("$dir/mps/$pid.jpeg")) { |
|
64 | + array_push($errors, "Saving to $dir/mps/$pid.jpeg failed"); |
|
65 | + } |
|
61 | 66 | if (!$errors) { |
62 | 67 | print "<pre>"; |
63 | 68 | chdir($dir); |
@@ -70,8 +75,9 @@ discard block |
||
70 | 75 | } |
71 | 76 | } |
72 | 77 | |
73 | - if ($errors) |
|
74 | - return display_photo_form($errors); |
|
78 | + if ($errors) { |
|
79 | + return display_photo_form($errors); |
|
80 | + } |
|
75 | 81 | return "<p><em>Photo uploaded and resized for pid $pid</em> — check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>" . display_photo_form(); |
76 | 82 | } |
77 | 83 | |
@@ -99,7 +105,9 @@ discard block |
||
99 | 105 | $house = $q->field($i, 'house'); |
100 | 106 | $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) . |
101 | 107 | " " . $houses[$house]; |
102 | - if ($q->field($i, 'party')) $desc .= ' (' . $q->field($i, 'party') . ')'; |
|
108 | + if ($q->field($i, 'party')) { |
|
109 | + $desc .= ' (' . $q->field($i, 'party') . ')'; |
|
110 | + } |
|
103 | 111 | if ($q->field($i, 'constituency')) { |
104 | 112 | $desc .= ', ' . $q->field($i, 'constituency'); |
105 | 113 | } |
@@ -150,13 +158,15 @@ discard block |
||
150 | 158 | $attr_link = get_http_var('attr_link'); |
151 | 159 | $errors = array(); |
152 | 160 | |
153 | - if (!$pid || !$attr_text) |
|
154 | - array_push($errors, 'Missing information'); |
|
155 | - elseif ($attr_link && substr($attr_link, 0, 4) != 'http') |
|
156 | - array_push($errors, 'Bad link'); |
|
161 | + if (!$pid || !$attr_text) { |
|
162 | + array_push($errors, 'Missing information'); |
|
163 | + } elseif ($attr_link && substr($attr_link, 0, 4) != 'http') { |
|
164 | + array_push($errors, 'Bad link'); |
|
165 | + } |
|
157 | 166 | |
158 | - if ($errors) |
|
159 | - return display_attribution_form($errors); |
|
167 | + if ($errors) { |
|
168 | + return display_attribution_form($errors); |
|
169 | + } |
|
160 | 170 | |
161 | 171 | # UPDATE |
162 | 172 | global $db; |
@@ -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 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $houses = array(1 => 'MP', 'Lord', 'MLA', 'MSP'); |
96 | 96 | |
97 | - for ($i=0; $i<$q->rows(); $i++) { |
|
97 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
98 | 98 | $p_id = $q->field($i, 'person_id'); |
99 | 99 | $house = $q->field($i, 'house'); |
100 | 100 | $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) . |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } else { |
113 | 113 | $desc .= ' [no photo]'; |
114 | 114 | } |
115 | - $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n"; |
|
115 | + $out .= '<option value="' . $p_id . '">' . $desc . '</option>' . "\n"; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $out .= ' </select></span> </div> '; |