@@ -61,7 +61,7 @@ |
||
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 { |
@@ -64,7 +64,8 @@ |
||
64 | 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 | - } else { |
|
67 | + } |
|
68 | + else { |
|
68 | 69 | $out = "<h4>Failed to update banner text</h4>"; |
69 | 70 | } |
70 | 71 |
@@ -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 | } |
@@ -22,7 +22,8 @@ |
||
22 | 22 | |
23 | 23 | if (get_http_var('editpolicy')) { |
24 | 24 | $out .= edit_policy_form(); |
25 | -} else { |
|
25 | +} |
|
26 | +else { |
|
26 | 27 | $out .= list_policies(); |
27 | 28 | } |
28 | 29 |
@@ -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 | ); |
@@ -100,11 +100,11 @@ |
||
100 | 100 | _api_getHansard_year('WMS', $y); |
101 | 101 | } |
102 | 102 | function api_getWMS_search($s) { |
103 | - _api_getHansard_search( array( |
|
103 | + _api_getHansard_search(array( |
|
104 | 104 | 's' => $s, |
105 | 105 | 'pid' => get_http_var('person'), |
106 | 106 | 'type' => 'wms', |
107 | - ) ); |
|
107 | + )); |
|
108 | 108 | } |
109 | 109 | function api_getWMS_person($pid) { |
110 | 110 | _api_getHansard_search(array( |
@@ -57,11 +57,11 @@ |
||
57 | 57 | _api_getHansard_year('WRANS', $y); |
58 | 58 | } |
59 | 59 | function api_getWrans_search($s) { |
60 | - _api_getHansard_search( array( |
|
60 | + _api_getHansard_search(array( |
|
61 | 61 | 's' => $s, |
62 | 62 | 'pid' => get_http_var('person'), |
63 | 63 | 'type' => 'wrans', |
64 | - ) ); |
|
64 | + )); |
|
65 | 65 | } |
66 | 66 | function api_getWrans_person($pid) { |
67 | 67 | _api_getHansard_search(array( |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if (get_http_var('create_key') && get_http_var('reason')) { |
22 | 22 | $estimated_usage = (int) get_http_var('estimated_usage'); |
23 | 23 | $commercial = get_http_var('commercial'); |
24 | - create_key($commercial, get_http_var('reason'), $estimated_usage); |
|
24 | + create_key($commercial, get_http_var('reason'), $estimated_usage); |
|
25 | 25 | if ($commercial == '1' || $estimated_usage > 50000) { |
26 | 26 | echo '<p><strong>It looks like your usage may fall outside of our free-of-charge bracket: if that\'s the case, this key might get blocked, so we\'d advise you to email us at <a href="[email protected]">[email protected]</a> to discuss licensing options.</strong></p>'; |
27 | 27 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $db = new ParlDB; |
30 | 30 | $q = $db->query('SELECT api_key, commercial, created, reason, estimated_usage FROM api_key WHERE user_id=' . $THEUSER->user_id()); |
31 | 31 | $keys = array(); |
32 | - for ($i=0; $i<$q->rows(); $i++) { |
|
32 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
33 | 33 | $keys[] = array($q->field($i, 'api_key'), $q->field($i, 'commercial'), $q->field($i, 'created'), $q->field($i, 'reason'), $q->field($i, 'estimated_usage')); |
34 | 34 | } |
35 | 35 | if ($keys) { |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | foreach ($keys as $keyarr) { |
39 | 39 | list($key, $commercial, $created, $reason, $estimated_usage) = $keyarr; |
40 | 40 | echo '<li><span style="font-size:200%">' . $key . '</span><br><span style="color: #666666;">'; |
41 | - if ($commercial==1) echo 'Commercial key,'; |
|
42 | - elseif ($commercial==-1) echo 'Key'; |
|
41 | + if ($commercial == 1) echo 'Commercial key,'; |
|
42 | + elseif ($commercial == -1) echo 'Key'; |
|
43 | 43 | else echo 'Non-commercial key,'; |
44 | 44 | echo ' created ', $created, '; ', $reason, '; estimated usage ', $estimated_usage; |
45 | 45 | echo '</span><br><em>Usage statistics</em>: '; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | global $THEUSER; |
76 | 76 | $key = auth_ab64_encode(urandom_bytes(16)); |
77 | 77 | $db = new ParlDB; |
78 | - if ($commercial=='') $commercial = 0; |
|
78 | + if ($commercial == '') $commercial = 0; |
|
79 | 79 | $db->query('INSERT INTO api_key (user_id, api_key, commercial, created, reason, estimated_usage) VALUES |
80 | 80 | (:user_id, :key, :commercial, NOW(), :reason, :estimated_usage)', array( |
81 | 81 | ':user_id' => $THEUSER->user_id(), |
@@ -38,9 +38,15 @@ discard block |
||
38 | 38 | foreach ($keys as $keyarr) { |
39 | 39 | list($key, $commercial, $created, $reason, $estimated_usage) = $keyarr; |
40 | 40 | echo '<li><span style="font-size:200%">' . $key . '</span><br><span style="color: #666666;">'; |
41 | - if ($commercial==1) echo 'Commercial key,'; |
|
42 | - elseif ($commercial==-1) echo 'Key'; |
|
43 | - else echo 'Non-commercial key,'; |
|
41 | + if ($commercial==1) { |
|
42 | + echo 'Commercial key,'; |
|
43 | + } |
|
44 | + elseif ($commercial==-1) { |
|
45 | + echo 'Key'; |
|
46 | + } |
|
47 | + else { |
|
48 | + echo 'Non-commercial key,'; |
|
49 | + } |
|
44 | 50 | echo ' created ', $created, '; ', $reason, '; estimated usage ', $estimated_usage; |
45 | 51 | echo '</span><br><em>Usage statistics</em>: '; |
46 | 52 | $q = $db->query('SELECT count(*) as count FROM api_stats WHERE api_key="' . $key . '" AND query_time > NOW() - interval 1 day'); |
@@ -58,7 +64,8 @@ discard block |
||
58 | 64 | echo '</ul>'; |
59 | 65 | } |
60 | 66 | api_key_form(); |
61 | -} else { |
|
67 | +} |
|
68 | +else { |
|
62 | 69 | echo ' The key is tied to your TheyWorkForYou account, |
63 | 70 | so if you don\'t yet have one, please <a href="/user/?pg=join">sign up</a>, then |
64 | 71 | return here to get a key.</p>'; |
@@ -75,7 +82,9 @@ discard block |
||
75 | 82 | global $THEUSER; |
76 | 83 | $key = auth_ab64_encode(urandom_bytes(16)); |
77 | 84 | $db = new ParlDB; |
78 | - if ($commercial=='') $commercial = 0; |
|
85 | + if ($commercial=='') { |
|
86 | + $commercial = 0; |
|
87 | + } |
|
79 | 88 | $db->query('INSERT INTO api_key (user_id, api_key, commercial, created, reason, estimated_usage) VALUES |
80 | 89 | (:user_id, :key, :commercial, NOW(), :reason, :estimated_usage)', array( |
81 | 90 | ':user_id' => $THEUSER->user_id(), |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | $fragment = ''; |
42 | 42 | if ($id_data['htype'] == '11' || $id_data['htype'] == '10') { |
43 | 43 | $LISTURL->insert( array( 'id' => $id_data['gid'] ) ); |
44 | - } else { |
|
44 | + } |
|
45 | + else { |
|
45 | 46 | $parent_epobject_id = $id_data['subsection_id']; |
46 | 47 | $parent_gid = ''; |
47 | 48 | $r = $db->query("SELECT gid |
@@ -75,22 +76,25 @@ discard block |
||
75 | 76 | $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url = :url order by gid limit 1', array( |
76 | 77 | ':url' => $url |
77 | 78 | )); |
78 | - if ($q->rows()) |
|
79 | - return api_converturl_url_output($q); |
|
79 | + if ($q->rows()) { |
|
80 | + return api_converturl_url_output($q); |
|
81 | + } |
|
80 | 82 | |
81 | 83 | $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url like :url order by gid limit 1', array( |
82 | 84 | ':url' => $url_nohash . '%' |
83 | 85 | )); |
84 | - if ($q->rows()) |
|
85 | - return api_converturl_url_output($q); |
|
86 | + if ($q->rows()) { |
|
87 | + return api_converturl_url_output($q); |
|
88 | + } |
|
86 | 89 | |
87 | 90 | $url_bound = str_replace('cmhansrd/cm', 'cmhansrd/vo', $url_nohash); |
88 | 91 | if ($url_bound != $url_nohash) { |
89 | 92 | $q = $db->query('select gid,major,htype,subsection_id from hansard where source_url like :url order by gid limit 1', array( |
90 | 93 | ':url' => $url_bound . '%' |
91 | 94 | )); |
92 | - if ($q->rows()) |
|
93 | - return api_converturl_url_output($q); |
|
95 | + if ($q->rows()) { |
|
96 | + return api_converturl_url_output($q); |
|
97 | + } |
|
94 | 98 | } |
95 | 99 | api_error('Sorry, URL could not be converted'); |
96 | 100 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $LISTURL = new \MySociety\TheyWorkForYou\Url($hansardmajors[$id_data['major']]['page_all']); |
41 | 41 | $fragment = ''; |
42 | 42 | if ($id_data['htype'] == '11' || $id_data['htype'] == '10') { |
43 | - $LISTURL->insert( array( 'id' => $id_data['gid'] ) ); |
|
43 | + $LISTURL->insert(array('id' => $id_data['gid'])); |
|
44 | 44 | } else { |
45 | 45 | $parent_epobject_id = $id_data['subsection_id']; |
46 | 46 | $parent_gid = ''; |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | ':epobject_id' => $parent_epobject_id |
51 | 51 | )); |
52 | 52 | if ($r->rows() > 0) { |
53 | - $parent_gid = fix_gid_from_db( $r->field(0, 'gid') ); |
|
53 | + $parent_gid = fix_gid_from_db($r->field(0, 'gid')); |
|
54 | 54 | } |
55 | 55 | if ($parent_gid != '') { |
56 | - $LISTURL->insert( array( 'id' => $parent_gid ) ); |
|
56 | + $LISTURL->insert(array('id' => $parent_gid)); |
|
57 | 57 | $fragment = '#g' . gid_to_anchor($id_data['gid']); |
58 | 58 | } |
59 | 59 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | $q = $db->query($sql, $params); |
9 | 9 | $output = array(); |
10 | 10 | $last_mod = 0; |
11 | - for ($i=0; $i<$q->rows(); $i++) { |
|
11 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
12 | 12 | $pid = $q->field($i, 'person_id'); |
13 | 13 | $row = array( |
14 | 14 | 'member_id' => $q->field($i, 'member_id'), |
15 | 15 | 'person_id' => $pid, |
16 | 16 | 'name' => html_entity_decode(member_full_name($q->field($i, 'house'), $q->field($i, 'title'), |
17 | 17 | $q->field($i, 'given_name'), $q->field($i, 'family_name'), |
18 | - $q->field($i, 'lordofname') )), |
|
18 | + $q->field($i, 'lordofname'))), |
|
19 | 19 | 'party' => isset($parties[$q->field($i, 'party')]) ? $parties[$q->field($i, 'party')] : $q->field($i, 'party'), |
20 | 20 | ); |
21 | 21 | if ($q->field($i, 'house') != 2) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if (count($pids)) { |
33 | 33 | $q = $db->query('SELECT person, dept, position, from_date, to_date FROM moffice |
34 | 34 | WHERE to_date="9999-12-31" AND person IN (' . join(',', $pids) . ')'); |
35 | - for ($i=0; $i<$q->rows(); $i++) { |
|
35 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
36 | 36 | $row = $q->row($i); |
37 | 37 | $pid = $row['person']; |
38 | 38 | unset($row['person']); |
@@ -81,7 +81,8 @@ |
||
81 | 81 | function api_getMembers_date($house, $date) { |
82 | 82 | if ($date = parse_date($date)) { |
83 | 83 | api_getMembers($house, '"' . $date['iso'] . '"'); |
84 | - } else { |
|
84 | + } |
|
85 | + else { |
|
85 | 86 | api_error('Invalid date format'); |
86 | 87 | } |
87 | 88 | } |
@@ -27,10 +27,12 @@ |
||
27 | 27 | if ($output) { |
28 | 28 | if ($output[0]) { |
29 | 29 | api_output($output[0][$id], $output[1]); |
30 | - } else { |
|
30 | + } |
|
31 | + else { |
|
31 | 32 | api_error('Unknown field'); |
32 | 33 | } |
33 | - } else { |
|
34 | + } |
|
35 | + else { |
|
34 | 36 | api_error('Unknown person ID'); |
35 | 37 | } |
36 | 38 | } |