@@ -44,8 +44,9 @@ |
||
| 44 | 44 | $pagetitle .= " page $pagenum"; |
| 45 | 45 | } |
| 46 | 46 | $num = get_http_var('n'); |
| 47 | - if (!is_numeric($num) || $num <= 0) |
|
| 48 | - $num = 20; |
|
| 47 | + if (!is_numeric($num) || $num <= 0) { |
|
| 48 | + $num = 20; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | $DATA->set_page_metadata($this_page, 'title', $pagetitle); |
| 51 | 52 | |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | # vim:sw=4:ts=4:et:nowrap |
| 3 | 3 | |
| 4 | 4 | include_once '../../../includes/easyparliament/init.php'; |
| 5 | -include_once INCLUDESPATH."easyparliament/member.php"; |
|
| 6 | -include_once INCLUDESPATH."easyparliament/glossary.php"; |
|
| 5 | +include_once INCLUDESPATH . "easyparliament/member.php"; |
|
| 6 | +include_once INCLUDESPATH . "easyparliament/glossary.php"; |
|
| 7 | 7 | |
| 8 | 8 | if (!DEVSITE) { |
| 9 | 9 | header('Cache-Control: max-age=86400'); # Once a day |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $DATA->set_page_metadata($this_page, 'title', $pagetitle); |
| 51 | 51 | |
| 52 | - $args = array ( |
|
| 52 | + $args = array( |
|
| 53 | 53 | 's' => $searchstring, |
| 54 | 54 | 'p' => $pagenum, |
| 55 | 55 | 'pop' => 1, |
@@ -2,12 +2,12 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | $this_page = 'hansard_bugs'; |
| 4 | 4 | include_once '../../includes/easyparliament/init.php'; |
| 5 | -$DATA->set_page_metadata($this_page, 'heading','Official Hansard problems'); |
|
| 5 | +$DATA->set_page_metadata($this_page, 'heading', 'Official Hansard problems'); |
|
| 6 | 6 | |
| 7 | 7 | $PAGE->page_start(); |
| 8 | 8 | $PAGE->stripe_start(); |
| 9 | 9 | |
| 10 | -$PAGE->block_start(array ('title'=>'Things currently noticeable to the user')); |
|
| 10 | +$PAGE->block_start(array('title'=>'Things currently noticeable to the user')); |
|
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | <style type="text/css"> |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | <?php |
| 112 | 112 | $PAGE->block_end(); |
| 113 | -$PAGE->block_start(array ('title'=>'Things not noticeable to the user')); |
|
| 113 | +$PAGE->block_start(array('title'=>'Things not noticeable to the user')); |
|
| 114 | 114 | ?> |
| 115 | 115 | |
| 116 | 116 | <ul> |
@@ -33,8 +33,9 @@ |
||
| 33 | 33 | if (isset($arr[3])) { |
| 34 | 34 | print '<a href="'.$link.'/questions">Written Questions</a>'; |
| 35 | 35 | } |
| 36 | - if (count($arr)==2) |
|
| 37 | - print ' | '; |
|
| 36 | + if (count($arr)==2) { |
|
| 37 | + print ' | '; |
|
| 38 | + } |
|
| 38 | 39 | if (isset($arr[4])) { |
| 39 | 40 | print '<a href="'.$link.'/statements">Written Ministerial Statements</a>'; |
| 40 | 41 | } |
@@ -26,17 +26,17 @@ |
||
| 26 | 26 | |
| 27 | 27 | print '<ul>'; |
| 28 | 28 | foreach ($data as $body => $arr) { |
| 29 | - $link = strtolower(str_replace(' ','_',$body)); |
|
| 29 | + $link = strtolower(str_replace(' ', '_', $body)); |
|
| 30 | 30 | print '<li>'; |
| 31 | 31 | print $body; |
| 32 | 32 | print ' — '; |
| 33 | 33 | if (isset($arr[3])) { |
| 34 | - print '<a href="'.$link.'/questions">Written Questions</a>'; |
|
| 34 | + print '<a href="' . $link . '/questions">Written Questions</a>'; |
|
| 35 | 35 | } |
| 36 | - if (count($arr)==2) |
|
| 36 | + if (count($arr) == 2) |
|
| 37 | 37 | print ' | '; |
| 38 | 38 | if (isset($arr[4])) { |
| 39 | - print '<a href="'.$link.'/statements">Written Ministerial Statements</a>'; |
|
| 39 | + print '<a href="' . $link . '/statements">Written Ministerial Statements</a>'; |
|
| 40 | 40 | } |
| 41 | 41 | print '</li>'; |
| 42 | 42 | } |
@@ -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>"; |
@@ -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 IN (12,13,14) " |
| 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")->first(); |
| 32 | 32 | if (!$q) { |
| 33 | 33 | $PAGE->page_start(); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } else { |
| 42 | 42 | $new_gid = $q['gid']; |
| 43 | 43 | $new_hpos = $q['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)) { |
@@ -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,13 +2,13 @@ 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/glossary.php"); |
|
| 5 | +include_once (INCLUDESPATH . "easyparliament/glossary.php"); |
|
| 6 | 6 | |
| 7 | 7 | $this_page = "admin_glossary"; |
| 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 | ); |
@@ -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 | } |
@@ -2,13 +2,13 @@ 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/glossary.php"); |
|
| 5 | +include_once (INCLUDESPATH . "easyparliament/glossary.php"); |
|
| 6 | 6 | |
| 7 | 7 | $this_page = "admin_glossary_pending"; |
| 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']; |
@@ -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') |