@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $out = '<form action="banner.php" method="post">'; |
51 | 51 | $out .= '<input name="action" type="hidden" value="Save">'; |
52 | 52 | $out .= '<p><label for="banner">Contents (HTML permitted)</label><br>'; |
53 | - $out .= '<textarea id="banner_text" name="banner" rows="5" cols="80">' . htmlentities($text) . "</textarea></p>\n"; |
|
53 | + $out .= '<textarea id="banner_text" name="banner" rows="5" cols="80">'.htmlentities($text)."</textarea></p>\n"; |
|
54 | 54 | $out .= '<span class="formw"><input type="button" id="preview" value="Preview"> <input name="btnaction" type="submit" value="Save"></span>'; |
55 | 55 | $out .= '</form>'; |
56 | 56 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | global $banner; |
62 | 62 | $banner_text = get_http_var('banner'); |
63 | 63 | |
64 | - if ( $banner->set_text($banner_text) ) { |
|
64 | + if ($banner->set_text($banner_text)) { |
|
65 | 65 | $out = "<h4>update successful</h4>"; |
66 | 66 | $out .= "<p>Banner text is now:</p><p>$banner_text</p>"; |
67 | 67 | } else { |
@@ -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'); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | include_once '../../includes/easyparliament/init.php'; |
4 | 4 | #include_once INCLUDESPATH . 'easyparliament/commentreportlist.php'; |
5 | 5 | #include_once INCLUDESPATH . 'easyparliament/searchengine.php'; |
6 | -include_once INCLUDESPATH . 'easyparliament/member.php'; |
|
6 | +include_once INCLUDESPATH.'easyparliament/member.php'; |
|
7 | 7 | #include_once INCLUDESPATH . 'easyparliament/people.php'; |
8 | 8 | |
9 | 9 | $this_page = 'admin_mpurls'; |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | |
55 | 55 | $out = "<h3>Edit person: $name</h3>\n"; |
56 | 56 | |
57 | - $out .= '<form action="websites.php?editperson=' . $q->field($row, 'person_id') . '" method="post">'; |
|
57 | + $out .= '<form action="websites.php?editperson='.$q->field($row, 'person_id').'" method="post">'; |
|
58 | 58 | $out .= '<input name="action" type="hidden" value="SaveURL">'; |
59 | 59 | $out .= '<label for="url">URL:</label>'; |
60 | - $out .= '<span class="formw"><input id="url" name="url" type="text" size="60" value="' . $q->field($row, 'mp_website') . '"></span>' . "\n"; |
|
60 | + $out .= '<span class="formw"><input id="url" name="url" type="text" size="60" value="'.$q->field($row, 'mp_website').'"></span>'."\n"; |
|
61 | 61 | $out .= '<span class="formw"><input name="btnaction" type="submit" value="Save URL"></span>'; |
62 | 62 | $out .= '</form>'; |
63 | 63 | } |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | $out .= '<li>'; |
84 | 84 | $name = member_full_name($q->field($row, 'house'), $q->field($row, 'title'), $q->field($row, 'given_name'), $q->field($row, 'family_name'), $q->field($row, 'lordofname')); |
85 | 85 | $mp_website = $q->field($row, 'data_value'); |
86 | - $out .= ' <small>[<a href="websites.php?editperson=' . $q->field($row, 'person_id') . '"'; |
|
86 | + $out .= ' <small>[<a href="websites.php?editperson='.$q->field($row, 'person_id').'"'; |
|
87 | 87 | if ($mp_website) { |
88 | - $out .= ' title="Change URL ' . $mp_website . '">Edit URL</a>]</small>'; |
|
88 | + $out .= ' title="Change URL '.$mp_website.'">Edit URL</a>]</small>'; |
|
89 | 89 | } else { |
90 | 90 | $out .= '>Add URL</a>]</small>'; |
91 | 91 | } |
92 | - $out .= ' ' . $name; |
|
92 | + $out .= ' '.$name; |
|
93 | 93 | if ($q->field($row, 'constituency')) { |
94 | - $out .= ' (' . $q->field($row, 'constituency') . ')'; |
|
94 | + $out .= ' ('.$q->field($row, 'constituency').')'; |
|
95 | 95 | } |
96 | 96 | $out .= "</li>\n"; |
97 | 97 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $sysretval = 0; |
108 | 108 | $personid = get_http_var('editperson'); |
109 | 109 | |
110 | - $q = $db->query("DELETE FROM personinfo WHERE data_key = 'mp_website' AND personinfo.person_id = :person_id", array( |
|
110 | + $q = $db->query("DELETE FROM personinfo WHERE data_key = 'mp_website' AND personinfo.person_id = :person_id", array( |
|
111 | 111 | ':person_id' => $personid |
112 | 112 | )); |
113 | 113 | |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | if ($q->success()) { |
122 | - exec($scriptpath . "/db2xml.pl --update_person --personid=" . escapeshellarg($personid) . " --debug", $exec_output); |
|
122 | + exec($scriptpath."/db2xml.pl --update_person --personid=".escapeshellarg($personid)." --debug", $exec_output); |
|
123 | 123 | $out = '<p id="warning">'; |
124 | - foreach ($exec_output as $message) {$out .= $message . "<br>";} |
|
124 | + foreach ($exec_output as $message) {$out .= $message."<br>"; } |
|
125 | 125 | $out .= '</p>'; |
126 | 126 | # ../../../scripts/db2xml.pl --update_person --personid=10001 |
127 | 127 | } |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | |
141 | 141 | $rettext .= '<div id="subnav_websites">'; |
142 | 142 | foreach ($subnav as $label => $path) { |
143 | - $rettext .= '<a href="'. $path . '">'. $label .'</a>'; |
|
143 | + $rettext .= '<a href="'.$path.'">'.$label.'</a>'; |
|
144 | 144 | } |
145 | - $rettext .= '</div>'; |
|
145 | + $rettext .= '</div>'; |
|
146 | 146 | |
147 | 147 | return $rettext; |
148 | 148 | } |
@@ -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); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $EDITQUEUE = new \MySociety\TheyWorkForYou\GlossaryEditQueue; |
10 | 10 | |
11 | -$args = array ( |
|
11 | +$args = array( |
|
12 | 12 | 'sort' => "regexp_replace" |
13 | 13 | ); |
14 | 14 | |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | if (get_http_var('approve')) { |
22 | 22 | $approve = get_http_var('approve'); |
23 | 23 | if (!is_array($approve)) { |
24 | - $approve = array ( $approve ); |
|
24 | + $approve = array($approve); |
|
25 | 25 | } |
26 | 26 | // Add all approved items |
27 | - $data = array ( |
|
27 | + $data = array( |
|
28 | 28 | 'approvals' => $approve, |
29 | 29 | 'epobject_type' => 2 |
30 | 30 | ); |
31 | 31 | $EDITQUEUE->approve($data); |
32 | 32 | } |
33 | 33 | elseif (get_http_var('decline')) { |
34 | - $decline = array (get_http_var('decline')); |
|
34 | + $decline = array(get_http_var('decline')); |
|
35 | 35 | // Dump all declined items |
36 | - $data = array ( |
|
36 | + $data = array( |
|
37 | 37 | 'declines' => $decline, |
38 | 38 | 'epobject_type' => 2 |
39 | 39 | ); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | include_once '../../includes/easyparliament/init.php'; |
4 | 4 | #include_once INCLUDESPATH . 'easyparliament/commentreportlist.php'; |
5 | 5 | #include_once INCLUDESPATH . 'easyparliament/searchengine.php'; |
6 | -include_once INCLUDESPATH . 'easyparliament/member.php'; |
|
6 | +include_once INCLUDESPATH.'easyparliament/member.php'; |
|
7 | 7 | #include_once INCLUDESPATH . 'easyparliament/people.php'; |
8 | 8 | |
9 | 9 | $this_page = 'admin_policies'; |
@@ -47,24 +47,24 @@ discard block |
||
47 | 47 | |
48 | 48 | for ($row = 0; $row < $q->rows(); $row++) { |
49 | 49 | |
50 | - $out = "<h3>Edit policy: " . $q->field($row, 'title') . "</h3>\n"; |
|
50 | + $out = "<h3>Edit policy: ".$q->field($row, 'title')."</h3>\n"; |
|
51 | 51 | |
52 | - $out .= '<form action="policies.php?editpolicy=' . $q->field($row, 'policy_id') . '" method="post">'; |
|
52 | + $out .= '<form action="policies.php?editpolicy='.$q->field($row, 'policy_id').'" method="post">'; |
|
53 | 53 | $out .= '<input name="action" type="hidden" value="Save">'; |
54 | 54 | $out .= '<p><label for="title">Title: </label>'; |
55 | - $out .= '<span class="formw"><input id="title-textbox" name="title" type="text" size="60" value="' . htmlentities($q->field($row, 'title')) . '"></span>' . "</p>\n"; |
|
55 | + $out .= '<span class="formw"><input id="title-textbox" name="title" type="text" size="60" value="'.htmlentities($q->field($row, 'title')).'"></span>'."</p>\n"; |
|
56 | 56 | $out .= '<p><label for="description">Description</label><br>'; |
57 | - $out .= '<span class="formw"><textarea id="description" name="description" rows="10" cols="100">' . htmlentities($q->field($row, 'description')) . '</textarea></span>' . "</p>\n"; |
|
57 | + $out .= '<span class="formw"><textarea id="description" name="description" rows="10" cols="100">'.htmlentities($q->field($row, 'description')).'</textarea></span>'."</p>\n"; |
|
58 | 58 | $out .= '<p><label for="image">Image URL: </label>'; |
59 | - $out .= '<span class="formw"><input id="image" name="image" type="text" size="60" value="' . htmlentities($q->field($row, 'image')) . '"></span>' . "</p>\n"; |
|
59 | + $out .= '<span class="formw"><input id="image" name="image" type="text" size="60" value="'.htmlentities($q->field($row, 'image')).'"></span>'."</p>\n"; |
|
60 | 60 | $out .= '<p><label for="image_attrib">Image attribution: </label>'; |
61 | - $out .= '<span class="formw"><input id="image_attrib" name="image_attrib" type="text" size="60" value="' . htmlentities($q->field($row, 'image_attrib')) . '"></span>' . "</p>\n"; |
|
61 | + $out .= '<span class="formw"><input id="image_attrib" name="image_attrib" type="text" size="60" value="'.htmlentities($q->field($row, 'image_attrib')).'"></span>'."</p>\n"; |
|
62 | 62 | $out .= '<p><label for="image_license">Image license: </label>'; |
63 | - $out .= '<span class="formw"><input id="image_license" name="image_license" type="text" size="60" value="' . htmlentities($q->field($row, 'image_license')) . '"></span>' . "</p>\n"; |
|
63 | + $out .= '<span class="formw"><input id="image_license" name="image_license" type="text" size="60" value="'.htmlentities($q->field($row, 'image_license')).'"></span>'."</p>\n"; |
|
64 | 64 | $out .= '<p><label for="image_license_url">Image license URL: </label>'; |
65 | - $out .= '<span class="formw"><input id="image_license_url" name="image_license_url" type="text" size="60" value="' . htmlentities($q->field($row, 'image_license_url')) . '"></span>' . "</p>\n"; |
|
65 | + $out .= '<span class="formw"><input id="image_license_url" name="image_license_url" type="text" size="60" value="'.htmlentities($q->field($row, 'image_license_url')).'"></span>'."</p>\n"; |
|
66 | 66 | $out .= '<p><label for="image_source">Image source: </label>'; |
67 | - $out .= '<span class="formw"><input id="image_source" name="image_source" type="text" size="60" value="' . htmlentities($q->field($row, 'image_source')) . '"></span>' . "</p>\n"; |
|
67 | + $out .= '<span class="formw"><input id="image_source" name="image_source" type="text" size="60" value="'.htmlentities($q->field($row, 'image_source')).'"></span>'."</p>\n"; |
|
68 | 68 | $out .= '<p><span class="formw"><input name="btnaction" type="submit" value="Save"></span>'; |
69 | 69 | $out .= '</form>'; |
70 | 70 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | for ($row = 0; $row < $q->rows(); $row++) { |
82 | 82 | $out .= '<li style="margin-bottom: 1em;">'; |
83 | 83 | $out .= sprintf('<strong>%d</strong>: %s - %s', $q->field($row, 'policy_id'), htmlentities($q->field($row, 'title')), htmlentities($q->field($row, 'description'))); |
84 | - $out .= ' <small>[<a href="policies.php?editpolicy=' . $q->field($row, 'policy_id') . '">Edit Policy</a>]</small>'; |
|
84 | + $out .= ' <small>[<a href="policies.php?editpolicy='.$q->field($row, 'policy_id').'">Edit Policy</a>]</small>'; |
|
85 | 85 | $out .= "</li>\n"; |
86 | 86 | } |
87 | 87 | $out .= '</ul>'; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ) |
111 | 111 | ); |
112 | 112 | |
113 | - if ( $q->success() ) { |
|
113 | + if ($q->success()) { |
|
114 | 114 | $out = "<h4>update successful</h4>"; |
115 | 115 | } |
116 | 116 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | |
126 | 126 | $rettext .= '<div id="subnav_websites">'; |
127 | 127 | foreach ($subnav as $label => $path) { |
128 | - $rettext .= '<a href="'. $path . '">'. $label .'</a>'; |
|
128 | + $rettext .= '<a href="'.$path.'">'.$label.'</a>'; |
|
129 | 129 | } |
130 | - $rettext .= '</div>'; |
|
130 | + $rettext .= '</div>'; |
|
131 | 131 | |
132 | 132 | return $rettext; |
133 | 133 | } |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | include_once '../../includes/easyparliament/init.php'; |
4 | -include_once INCLUDESPATH . 'easyparliament/commentreportlist.php'; |
|
5 | -include_once INCLUDESPATH . 'easyparliament/searchengine.php'; |
|
6 | -include_once INCLUDESPATH . 'easyparliament/member.php'; |
|
7 | -include_once INCLUDESPATH . 'easyparliament/people.php'; |
|
4 | +include_once INCLUDESPATH.'easyparliament/commentreportlist.php'; |
|
5 | +include_once INCLUDESPATH.'easyparliament/searchengine.php'; |
|
6 | +include_once INCLUDESPATH.'easyparliament/member.php'; |
|
7 | +include_once INCLUDESPATH.'easyparliament/people.php'; |
|
8 | 8 | |
9 | 9 | $this_page = 'admin_photos'; |
10 | 10 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | if ($errors) |
74 | 74 | return display_photo_form($errors); |
75 | - 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(); |
|
75 | + 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 | 76 | } |
77 | 77 | |
78 | 78 | function person_drop_down() { |
@@ -94,14 +94,14 @@ 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 | - $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) . |
|
101 | - " " . $houses[$house]; |
|
102 | - if ($q->field($i, 'party')) $desc .= ' (' . $q->field($i, 'party') . ')'; |
|
100 | + $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')). |
|
101 | + " ".$houses[$house]; |
|
102 | + if ($q->field($i, 'party')) $desc .= ' ('.$q->field($i, 'party').')'; |
|
103 | 103 | if ($q->field($i, 'constituency')) { |
104 | - $desc .= ', ' . $q->field($i, 'constituency'); |
|
104 | + $desc .= ', '.$q->field($i, 'constituency'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | list($dummy, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($p_id); |
@@ -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> '; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | function display_photo_form($errors = array()) { |
124 | 124 | $out = ''; |
125 | 125 | if ($errors) { |
126 | - $out .= '<ul class="error"><li>' . join('</li><li>', $errors) . '</li></ul>'; |
|
126 | + $out .= '<ul class="error"><li>'.join('</li><li>', $errors).'</li></ul>'; |
|
127 | 127 | } |
128 | 128 | $out .= '<form method="post" action="photos.php" enctype="multipart/form-data">'; |
129 | 129 | $out .= person_drop_down(); |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | ':attr_link' => $attr_link |
170 | 170 | )); |
171 | 171 | |
172 | - return "<p><em>Attribution text/link set for pid $pid</em> — check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>" . display_attribution_form(); |
|
172 | + return "<p><em>Attribution text/link set for pid $pid</em> — check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>".display_attribution_form(); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | function display_attribution_form($errors = array()) { |
176 | 176 | $out = ''; |
177 | 177 | if ($errors) { |
178 | - $out .= '<ul class="error"><li>' . join('</li><li>', $errors) . '</li></ul>'; |
|
178 | + $out .= '<ul class="error"><li>'.join('</li><li>', $errors).'</li></ul>'; |
|
179 | 179 | } |
180 | 180 | $out .= '<form method="post" action="photos.php">'; |
181 | 181 | $out .= person_drop_down(); |
@@ -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 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | $host = trim_characters($host, strlen($host) - 25, 100); |
19 | 19 | $time = relative_time($row['query_time']); |
20 | 20 | $time = str_replace(" ago", "", $time); |
21 | - $rows[] = array ( |
|
22 | - '<a href="'.$row['url'].'">' . _htmlentities($row['query']) . '</a>', |
|
21 | + $rows[] = array( |
|
22 | + '<a href="'.$row['url'].'">'._htmlentities($row['query']).'</a>', |
|
23 | 23 | $row['page_number'], |
24 | 24 | $row['count_hits'], |
25 | 25 | $host, |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | ); |
28 | 28 | } |
29 | 29 | |
30 | -$tabledata = array ( |
|
31 | - 'header' => array ( |
|
30 | +$tabledata = array( |
|
31 | + 'header' => array( |
|
32 | 32 | 'Query', |
33 | 33 | 'Page', |
34 | 34 | 'Hits', |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | 'epobject_type' => 2 |
33 | 33 | ); |
34 | 34 | $EDITQUEUE->approve($data); |
35 | -} |
|
36 | -elseif (get_http_var('decline')) { |
|
35 | +} elseif (get_http_var('decline')) { |
|
37 | 36 | $decline = array (get_http_var('decline')); |
38 | 37 | // Dump all declined items |
39 | 38 | $data = array ( |
@@ -57,15 +56,13 @@ discard block |
||
57 | 56 | if (get_http_var('previewterm')) { |
58 | 57 | $body = get_http_var('definition'); |
59 | 58 | $title = get_http_var('g'); |
60 | - } |
|
61 | - else { |
|
59 | + } else { |
|
62 | 60 | $body = $EDITQUEUE->pending[$glossary_id]['body']; |
63 | 61 | $title = $EDITQUEUE->pending[$glossary_id]['title']; |
64 | 62 | } |
65 | 63 | if (get_http_var('wikiguess')) { |
66 | 64 | $checked = " checked"; |
67 | - } |
|
68 | - else { |
|
65 | + } else { |
|
69 | 66 | $checked = ""; |
70 | 67 | } |
71 | 68 | |
@@ -111,8 +108,7 @@ discard block |
||
111 | 108 | |
112 | 109 | $PAGE->glossary_display_term($GLOSSARY); |
113 | 110 | |
114 | -} |
|
115 | -else { |
|
111 | +} else { |
|
116 | 112 | |
117 | 113 | // add a modification to the database |
118 | 114 | if (get_http_var('submitterm') && get_http_var('modify')) { |
@@ -128,8 +124,7 @@ discard block |
||
128 | 124 | if ($EDITQUEUE->pending_count) { |
129 | 125 | print "<h3>" . $EDITQUEUE->pending_count . " Pending Glossary terms</h3>"; |
130 | 126 | $EDITQUEUE->display("pending"); |
131 | - } |
|
132 | - else { |
|
127 | + } else { |
|
133 | 128 | print "<h3>Nothing pending, tap your fingers awhile.</h3>"; |
134 | 129 | } |
135 | 130 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $EDITQUEUE = new \MySociety\TheyWorkForYou\GlossaryEditQueue; |
10 | 10 | |
11 | -$args = array ( |
|
11 | +$args = array( |
|
12 | 12 | 'sort' => "regexp_replace" |
13 | 13 | ); |
14 | 14 | $GLOSSARY = new GLOSSARY($args); |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | if (get_http_var('approve')) { |
24 | 24 | $approve = get_http_var('approve'); |
25 | 25 | if (!is_array($approve)) { |
26 | - $approve = array ( $approve ); |
|
26 | + $approve = array($approve); |
|
27 | 27 | } |
28 | 28 | // Add all approved items |
29 | - $data = array ( |
|
29 | + $data = array( |
|
30 | 30 | 'approvals' => $approve, |
31 | 31 | 'epobject_type' => 2 |
32 | 32 | ); |
33 | 33 | $EDITQUEUE->approve($data); |
34 | 34 | } |
35 | 35 | elseif (get_http_var('decline')) { |
36 | - $decline = array (get_http_var('decline')); |
|
36 | + $decline = array(get_http_var('decline')); |
|
37 | 37 | // Dump all declined items |
38 | - $data = array ( |
|
38 | + $data = array( |
|
39 | 39 | 'declines' => $decline, |
40 | 40 | 'epobject_type' => 2 |
41 | 41 | ); |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | |
55 | 55 | // Mock up a "current term" to send to the display function |
56 | 56 | if (get_http_var('previewterm')) { |
57 | - $body = get_http_var('definition'); |
|
58 | - $title = get_http_var('g'); |
|
57 | + $body = get_http_var('definition'); |
|
58 | + $title = get_http_var('g'); |
|
59 | 59 | } |
60 | 60 | else { |
61 | 61 | $body = $EDITQUEUE->pending[$glossary_id]['body']; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | // Wiki woo! |
95 | 95 | // We need to work out how best to work this... |
96 | - $wiki_link = _htmlspecialchars("http://en.wikipedia.org/wiki/" . strtr($title, " ", "_")); |
|
96 | + $wiki_link = _htmlspecialchars("http://en.wikipedia.org/wiki/".strtr($title, " ", "_")); |
|
97 | 97 | ?> |
98 | 98 | <p>Guessing the wikipedia link - give it a go:<br> |
99 | 99 | <a href="<?php echo $wiki_link; ?>" target="_blank"><?php echo $wiki_link; ?></a></p> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | // add a modification to the database |
117 | 117 | if (get_http_var('submitterm') && get_http_var('modify')) { |
118 | - $data = array ( |
|
118 | + $data = array( |
|
119 | 119 | 'user_id' => get_http_var('userid'), |
120 | 120 | 'title' => get_http_var('g'), |
121 | 121 | 'body' => get_http_var('definition') |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | if ($EDITQUEUE->pending_count) { |
128 | - print "<h3>" . $EDITQUEUE->pending_count . " Pending Glossary terms</h3>"; |
|
128 | + print "<h3>".$EDITQUEUE->pending_count." Pending Glossary terms</h3>"; |
|
129 | 129 | $EDITQUEUE->display("pending"); |
130 | 130 | } |
131 | 131 | else { |
@@ -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 |