@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | <div class="panel panel--flushtop clearfix"> |
46 | 46 | <div class="row nested-row"> |
47 | 47 | <div class="homepage-in-the-news homepage-content-section"> |
48 | - <?php if ( count($featured) > 0 ) { |
|
48 | + <?php if (count($featured) > 0) { |
|
49 | 49 | include 'homepage/featured.php'; |
50 | 50 | } else { ?> |
51 | 51 | No debates found. |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | <div class="homepage-recently homepage-content-section"> |
101 | 101 | <h2>Recently in Parliament</h2> |
102 | 102 | <ul class="recently__list"><?php |
103 | - foreach ( $debates['recent'] as $recent ) { |
|
103 | + foreach ($debates['recent'] as $recent) { |
|
104 | 104 | include 'homepage/recent-debates.php'; |
105 | 105 | } |
106 | 106 | ?></ul> |
107 | 107 | </div> |
108 | 108 | <div class="homepage-upcoming homepage-content-section"> |
109 | 109 | <h2>Upcoming</h2> |
110 | - <?php if ( count($calendar) ) { ?> |
|
110 | + <?php if (count($calendar)) { ?> |
|
111 | 111 | <div class="upcoming__controls"> |
112 | 112 | <!-- |
113 | 113 | These controls should make the upcoming section slide to the next day. |
@@ -126,25 +126,25 @@ discard block |
||
126 | 126 | </div> |
127 | 127 | </div> |
128 | 128 | <?php $first = true; $count = 0; |
129 | - foreach ( $calendar as $date => $places ) { |
|
129 | + foreach ($calendar as $date => $places) { |
|
130 | 130 | $count++; ?> |
131 | 131 | <div class="cal-wrapper <?= $first ? 'visible' : 'hidden' ?>" id="day-<?= $count ?>" data-count="<?= $count ?>" data-date="<?= format_date($date, SHORTDATEFORMAT); ?>"> |
132 | 132 | <?php foreach ($places as $place => $events) { ?> |
133 | 133 | <?php $first = false; ?> |
134 | 134 | <h3><?= $place ?></h3> |
135 | 135 | <ul class="upcoming__list"> |
136 | - <?php for ( $i = 0; $i < 3; $i++ ) { |
|
137 | - if ( isset( $events[$i] ) ) { ?> |
|
136 | + <?php for ($i = 0; $i < 3; $i++) { |
|
137 | + if (isset($events[$i])) { ?> |
|
138 | 138 | <li> |
139 | 139 | <h4 class="upcoming__title"><a href="<?= $events[$i]['link_external'] ?>"><?= $events[$i]['title'] ?></a></h4> |
140 | 140 | <p class="meta"><?php |
141 | 141 | $meta_items = array(); |
142 | 142 | $meta_items[] = $events[$i]['debate_type']; |
143 | - if( isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00' ){ |
|
143 | + if (isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00') { |
|
144 | 144 | $times = format_time($events[$i]['time_start'], 'g:i a'); |
145 | 145 | |
146 | - if( isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00' ){ |
|
147 | - $times = $times . ' - ' . format_time($events[$i]['time_end'], 'g:i a'); |
|
146 | + if (isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00') { |
|
147 | + $times = $times.' - '.format_time($events[$i]['time_end'], 'g:i a'); |
|
148 | 148 | } |
149 | 149 | $meta_items[] = $times; |
150 | 150 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | <?php } ?> |
156 | 156 | <?php } ?> |
157 | 157 | </ul> |
158 | - <?php if ( count($events) - 3 > 0 ) { ?> |
|
158 | + <?php if (count($events) - 3 > 0) { ?> |
|
159 | 159 | <a href="/calendar/?d=<?= format_date($date, 'Y-m-d') ?>" class="upcoming__more">And <?= count($events) - 3 ?> more</a><!-- (just links to relevant upcoming page) --> |
160 | 160 | <?php } ?> |
161 | 161 | <?php } ?> |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <?php } ?> |
164 | 164 | <?php } else { |
165 | 165 | list($recess, $from, $to) = recess_prettify(date('j'), date('n'), date('Y'), 1); |
166 | - if ( $recess ) { ?> |
|
166 | + if ($recess) { ?> |
|
167 | 167 | <p> |
168 | 168 | Parliament is on holiday until <?= format_date($to, LONGERDATEFORMAT) ?>. |
169 | 169 | Follow us on <a href="https://twitter.com/theyworkforyou">Twitter</a> and you'll |
@@ -84,13 +84,13 @@ |
||
84 | 84 | $db->display_total_duration(); |
85 | 85 | |
86 | 86 | $duration = getmicrotime() - STARTTIME; |
87 | - twfy_debug ("TIME", "Total time for page: $duration seconds."); |
|
87 | + twfy_debug("TIME", "Total time for page: $duration seconds."); |
|
88 | 88 | if (!isset($_SERVER['WINDIR'])) { |
89 | 89 | $rusage = getrusage(); |
90 | - $duration = $rusage['ru_utime.tv_sec']*1000000 + $rusage['ru_utime.tv_usec'] - STARTTIMEU; |
|
91 | - twfy_debug ('TIME', "Total user time: $duration microseconds."); |
|
92 | - $duration = $rusage['ru_stime.tv_sec']*1000000 + $rusage['ru_stime.tv_usec'] - STARTTIMES; |
|
93 | - twfy_debug ('TIME', "Total system time: $duration microseconds."); |
|
90 | + $duration = $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec'] - STARTTIMEU; |
|
91 | + twfy_debug('TIME', "Total user time: $duration microseconds."); |
|
92 | + $duration = $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec'] - STARTTIMES; |
|
93 | + twfy_debug('TIME', "Total system time: $duration microseconds."); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | ?> |
@@ -31,7 +31,7 @@ |
||
31 | 31 | </li> |
32 | 32 | |
33 | 33 | <?php |
34 | -$user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; |
|
34 | +$user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; |
|
35 | 35 | if (stristr($user_agent, 'Firefox/')) { |
36 | 36 | ?> |
37 | 37 | <li>You can also add TheyWorkForYou to <a href="http://mycroft.mozdev.org/download.html?name=theyworkforyou">Firefox's search box</a>.</li> |
@@ -67,4 +67,4 @@ |
||
67 | 67 | api_output($out); |
68 | 68 | } else { |
69 | 69 | api_error('Nothing'); |
70 | - } |
|
70 | + } |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | |
13 | 13 | $out = array(); |
14 | 14 | if (isset ($data['rows'])) { |
15 | - for ($i=0; $i<count($data['rows']); $i++) { |
|
15 | + for ($i = 0; $i < count($data['rows']); $i++) { |
|
16 | 16 | $row = $data['rows'][$i]; |
17 | 17 | if (count($row) == 0) continue; |
18 | 18 | if ($row['htype'] == '12') { |
19 | 19 | if (isset($row['speaker']) && count($row['speaker']) > 0) { |
20 | 20 | $speaker = $row['speaker']; |
21 | - if (is_file(BASEDIR . IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpeg')) { |
|
22 | - $row['speaker']['image'] = IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpeg'; |
|
23 | - } elseif (is_file(BASEDIR . IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpg')) { |
|
24 | - $row['speaker']['image'] = IMAGEPATH . 'mps/' . $speaker['person_id'] . '.jpg'; |
|
21 | + if (is_file(BASEDIR.IMAGEPATH.'mps/'.$speaker['person_id'].'.jpeg')) { |
|
22 | + $row['speaker']['image'] = IMAGEPATH.'mps/'.$speaker['person_id'].'.jpeg'; |
|
23 | + } elseif (is_file(BASEDIR.IMAGEPATH.'mps/'.$speaker['person_id'].'.jpg')) { |
|
24 | + $row['speaker']['image'] = IMAGEPATH.'mps/'.$speaker['person_id'].'.jpg'; |
|
25 | 25 | } |
26 | 26 | $desc = ''; |
27 | 27 | if (isset($speaker['office'])) { |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | foreach ($speaker['office'] as $off) { |
30 | 30 | $desc[] = $off['pretty']; |
31 | 31 | } |
32 | - $desc = join(', ', $desc) . '; '; |
|
32 | + $desc = join(', ', $desc).'; '; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($speaker['house'] == 1 && $speaker['party'] != 'Speaker' && $speaker['party'] != 'Deputy Speaker' && $speaker['constituency']) { |
36 | - $desc .= $speaker['constituency'] . ', '; |
|
36 | + $desc .= $speaker['constituency'].', '; |
|
37 | 37 | } |
38 | 38 | $desc .= _htmlentities($speaker['party']); |
39 | 39 | if ($desc) $row['speaker']['desc'] = $desc; |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | if (isset ($data['rows'])) { |
15 | 15 | for ($i=0; $i<count($data['rows']); $i++) { |
16 | 16 | $row = $data['rows'][$i]; |
17 | - if (count($row) == 0) continue; |
|
17 | + if (count($row) == 0) { |
|
18 | + continue; |
|
19 | + } |
|
18 | 20 | if ($row['htype'] == '12') { |
19 | 21 | if (isset($row['speaker']) && count($row['speaker']) > 0) { |
20 | 22 | $speaker = $row['speaker']; |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | $desc .= $speaker['constituency'] . ', '; |
37 | 39 | } |
38 | 40 | $desc .= _htmlentities($speaker['party']); |
39 | - if ($desc) $row['speaker']['desc'] = $desc; |
|
41 | + if ($desc) { |
|
42 | + $row['speaker']['desc'] = $desc; |
|
43 | + } |
|
40 | 44 | } |
41 | 45 | } |
42 | 46 | $out[] = $row; |
@@ -52,8 +56,9 @@ discard block |
||
52 | 56 | $has_content = false; |
53 | 57 | } |
54 | 58 | $entry = $row; |
55 | - if (isset($row['excerpt'])) |
|
56 | - $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
59 | + if (isset($row['excerpt'])) { |
|
60 | + $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
61 | + } |
|
57 | 62 | if ($has_content) { |
58 | 63 | } else { |
59 | 64 | unset($entry['listurl']); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | if (isset($comment['comment_id'])) { |
72 | - $id = 'c' . $comment['comment_id']; |
|
72 | + $id = 'c'.$comment['comment_id']; |
|
73 | 73 | } else { |
74 | 74 | $id = ''; |
75 | 75 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // COMMENT REPORTING LINK. |
83 | 83 | |
84 | 84 | if (($this_page != 'commentreport' && |
85 | - $this_page != 'addcomment' && |
|
85 | + $this_page != 'addcomment' && |
|
86 | 86 | $this_page != 'admin_commentreport') |
87 | 87 | && $THEUSER->is_able_to('reportcomment') |
88 | 88 | && $THEUSER->user_id() != $comment['user_id'] |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'ret' => $comment['url'] |
99 | 99 | )); |
100 | 100 | |
101 | - $reporthtml = '(<a href="' . $URL->generate() . '" title="Notify moderators that this comment should be deleted">Report this comment</a>)'; |
|
101 | + $reporthtml = '(<a href="'.$URL->generate().'" title="Notify moderators that this comment should be deleted">Report this comment</a>)'; |
|
102 | 102 | |
103 | 103 | } elseif ($comment['modflagged']) { |
104 | 104 | $reporthtml = '(This comment has been reported to moderators)'; |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | $date = format_date($date, SHORTDATEFORMAT); |
118 | 118 | $time = format_time($time, TIMEFORMAT); |
119 | 119 | ?> |
120 | - <p class="credit"><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) .' '. _htmlentities($comment['lastname']); ?></strong></a><br> |
|
120 | + <p class="credit"><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']).' '._htmlentities($comment['lastname']); ?></strong></a><br> |
|
121 | 121 | <small>Posted on <?php echo $date; |
122 | 122 | |
123 | 123 | if (isset($comment['url'])) { |
124 | - print ' <a href="' . $comment['url'] . '" title="Link to this comment">' . $time . '</a>'; |
|
124 | + print ' <a href="'.$comment['url'].'" title="Link to this comment">'.$time.'</a>'; |
|
125 | 125 | |
126 | 126 | } else { |
127 | 127 | // There won't be a URL when we're just previewing a comment. |
@@ -39,20 +39,20 @@ |
||
39 | 39 | |
40 | 40 | // Get the name of the member whose epobject was commented upon (if any). |
41 | 41 | if (isset($comment['speaker']) && $comment['speaker']['name'] != '') { |
42 | - $member_name = $comment['speaker']['name'] . ': '; |
|
42 | + $member_name = $comment['speaker']['name'].': '; |
|
43 | 43 | } else { |
44 | 44 | $member_name = ''; |
45 | 45 | } |
46 | 46 | |
47 | - $user_name = _htmlentities($comment['firstname'] . ' ' . $comment['lastname']); |
|
47 | + $user_name = _htmlentities($comment['firstname'].' '.$comment['lastname']); |
|
48 | 48 | |
49 | 49 | // We're grouping things by epobject_id, so we're going to display the number |
50 | 50 | // of comments on this epobject. |
51 | 51 | $plural = $comment['total_comments'] == 1 ? ' comment' : ' comments'; |
52 | 52 | |
53 | - echo "\t\t\t\t<p><a href=\"$comment[url]\">$comment[total_comments]$plural</a> to <strong>" . $member_name . $hansardtext . "</strong><br>\n"; |
|
53 | + echo "\t\t\t\t<p><a href=\"$comment[url]\">$comment[total_comments]$plural</a> to <strong>".$member_name.$hansardtext."</strong><br>\n"; |
|
54 | 54 | echo "\t\t\t\t<small>(posted on $date)</small><br>\n"; |
55 | - echo "\t\t\t\t" . prepare_comment_for_display($comment['body']) . "</p>"; ?> |
|
55 | + echo "\t\t\t\t".prepare_comment_for_display($comment['body'])."</p>"; ?> |
|
56 | 56 | |
57 | 57 | <?php |
58 | 58 | $PAGE->stripe_end(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (isset ($data['rows'])) { |
13 | 13 | $out = array(); |
14 | - for ($i=0; $i<count($data['rows']); $i++) { |
|
14 | + for ($i = 0; $i < count($data['rows']); $i++) { |
|
15 | 15 | $row = $data['rows'][$i]; |
16 | 16 | |
17 | 17 | if ($row['htype'] == '10' && isset($row['excerpt']) && strstr($row['excerpt'], "was asked—")) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if ($row['htype'] == '10') { |
41 | 41 | $out[] = array('entry' => $entry, 'subs' => array()); |
42 | 42 | } else { |
43 | - $out[sizeof($out)-1]['subs'][] = $entry; |
|
43 | + $out[sizeof($out) - 1]['subs'][] = $entry; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
@@ -27,8 +27,9 @@ |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | $entry = $row; |
30 | - if (isset($row['excerpt'])) |
|
31 | - $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
30 | + if (isset($row['excerpt'])) { |
|
31 | + $entry['excerpt'] = trim_characters($entry['excerpt'], 0, 200); |
|
32 | + } |
|
32 | 33 | if ($has_content) { |
33 | 34 | } else { |
34 | 35 | unset($entry['listurl']); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | public $firstname = ''; |
28 | 28 | public $lastname = ''; |
29 | 29 | public $body = ''; |
30 | - public $reported = NULL; // datetime |
|
31 | - public $resolved = NULL; // datetime |
|
32 | - public $resolvedby = ''; // user_id |
|
33 | - public $locked = NULL; // datetime |
|
34 | - public $lockedby = ''; // user_id |
|
35 | - public $upheld = ''; // boolean |
|
30 | + public $reported = NULL; // datetime |
|
31 | + public $resolved = NULL; // datetime |
|
32 | + public $resolvedby = ''; // user_id |
|
33 | + public $locked = NULL; // datetime |
|
34 | + public $lockedby = ''; // user_id |
|
35 | + public $upheld = ''; // boolean |
|
36 | 36 | |
37 | 37 | // If the user was logged in, this will be set: |
38 | 38 | public $user_id = ''; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public $email = ''; |
41 | 41 | |
42 | 42 | |
43 | - public function __construct($report_id='') { |
|
43 | + public function __construct($report_id = '') { |
|
44 | 44 | // Pass it a report id and it gets and sets this report's data. |
45 | 45 | |
46 | 46 | $this->db = new ParlDB; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | $q = $this->db->query("SELECT commentreports.comment_id, |
51 | 51 | commentreports.user_id, |
52 | 52 | commentreports.body, |
53 | - DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS reported, |
|
54 | - DATE_FORMAT(commentreports.resolved, '" . SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS resolved, |
|
53 | + DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS reported, |
|
54 | + DATE_FORMAT(commentreports.resolved, '" . SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS resolved, |
|
55 | 55 | commentreports.resolvedby, |
56 | 56 | commentreports.locked, |
57 | 57 | commentreports.lockedby, |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | |
72 | 72 | if ($q->rows() > 0) { |
73 | 73 | $this->report_id = $report_id; |
74 | - $this->comment_id = $q->field(0, 'comment_id'); |
|
75 | - $this->body = $q->field(0, 'body'); |
|
74 | + $this->comment_id = $q->field(0, 'comment_id'); |
|
75 | + $this->body = $q->field(0, 'body'); |
|
76 | 76 | $this->reported = $q->field(0, 'reported'); |
77 | 77 | $this->resolved = $q->field(0, 'resolved'); |
78 | - $this->resolvedby = $q->field(0, 'resolvedby'); |
|
78 | + $this->resolvedby = $q->field(0, 'resolvedby'); |
|
79 | 79 | $this->locked = $q->field(0, 'locked'); |
80 | 80 | $this->lockedby = $q->field(0, 'lockedby'); |
81 | 81 | $this->upheld = $q->field(0, 'upheld'); |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | $q = $this->db->query("SELECT commentreports.comment_id, |
96 | 96 | commentreports.user_id, |
97 | 97 | commentreports.body, |
98 | - DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS reported, |
|
99 | - DATE_FORMAT(commentreports.resolved, '" . SHORTDATEFORMAT_SQL . ' ' . TIMEFORMAT_SQL . "') AS resolved, |
|
98 | + DATE_FORMAT(commentreports.reported, '" . SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS reported, |
|
99 | + DATE_FORMAT(commentreports.resolved, '" . SHORTDATEFORMAT_SQL.' '.TIMEFORMAT_SQL."') AS resolved, |
|
100 | 100 | commentreports.resolvedby, |
101 | 101 | commentreports.locked, |
102 | 102 | commentreports.lockedby, |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | |
112 | 112 | if ($q->rows() > 0) { |
113 | 113 | $this->report_id = $report_id; |
114 | - $this->comment_id = $q->field(0, 'comment_id'); |
|
115 | - $this->body = $q->field(0, 'body'); |
|
114 | + $this->comment_id = $q->field(0, 'comment_id'); |
|
115 | + $this->body = $q->field(0, 'body'); |
|
116 | 116 | $this->reported = $q->field(0, 'reported'); |
117 | 117 | $this->resolved = $q->field(0, 'resolved'); |
118 | - $this->resolvedby = $q->field(0, 'resolvedby'); |
|
118 | + $this->resolvedby = $q->field(0, 'resolvedby'); |
|
119 | 119 | $this->locked = $q->field(0, 'locked'); |
120 | 120 | $this->lockedby = $q->field(0, 'lockedby'); |
121 | 121 | $this->upheld = $q->field(0, 'upheld'); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function report_id() { return $this->report_id; } |
132 | 132 | public function comment_id() { return $this->comment_id; } |
133 | 133 | public function user_id() { return $this->user_id; } |
134 | - public function user_name() { return $this->firstname . ' ' . $this->lastname; } |
|
134 | + public function user_name() { return $this->firstname.' '.$this->lastname; } |
|
135 | 135 | public function firstname() { return $this->firstname; } |
136 | 136 | public function lastname() { return $this->lastname; } |
137 | 137 | public function email() { return $this->email; } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | global $THEUSER, $PAGE; |
163 | 163 | |
164 | 164 | if (!$THEUSER->is_able_to('reportcomment')) { |
165 | - $PAGE->error_message ("Sorry, you are not allowed to post reports."); |
|
165 | + $PAGE->error_message("Sorry, you are not allowed to post reports."); |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | $q = $this->db->query("SELECT report_id |
177 | 177 | FROM commentreports |
178 | - WHERE user_id = '" . $THEUSER->user_id() . "' |
|
178 | + WHERE user_id = '" . $THEUSER->user_id()."' |
|
179 | 179 | AND reported + 0 > NOW() - $flood_time_limit"); |
180 | 180 | |
181 | 181 | if ($q->rows() > 0) { |
@@ -230,19 +230,19 @@ discard block |
||
230 | 230 | |
231 | 231 | if ($q->success()) { |
232 | 232 | // Inserted OK, so set up this object's variables. |
233 | - $this->report_id = $q->insert_id(); |
|
234 | - $this->comment_id = $COMMENT->comment_id(); |
|
235 | - $this->body = $body; |
|
236 | - $this->reported = $time; |
|
233 | + $this->report_id = $q->insert_id(); |
|
234 | + $this->comment_id = $COMMENT->comment_id(); |
|
235 | + $this->body = $body; |
|
236 | + $this->reported = $time; |
|
237 | 237 | |
238 | 238 | if ($THEUSER->isloggedin()) { |
239 | - $this->user_id = $THEUSER->user_id(); |
|
239 | + $this->user_id = $THEUSER->user_id(); |
|
240 | 240 | $this->firstname = $THEUSER->firstname(); |
241 | 241 | $this->lastname = $THEUSER->lastname(); |
242 | 242 | } else { |
243 | - $this->email = $reportdata['email']; |
|
244 | - $this->firstname = $reportdata['firstname']; |
|
245 | - $this->lastname = $reportdata['lastname']; |
|
243 | + $this->email = $reportdata['email']; |
|
244 | + $this->firstname = $reportdata['firstname']; |
|
245 | + $this->lastname = $reportdata['lastname']; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | 'cid'=>$this->comment_id |
259 | 259 | )); |
260 | 260 | |
261 | - $emailbody = "A new comment report has been filed by " . $this->user_name() . ".\n\n"; |
|
262 | - $emailbody .= "COMMENT:\n" . $COMMENT->body() . "\n\n"; |
|
263 | - $emailbody .= "REPORT:\n" . $this->body . "\n\n"; |
|
264 | - $emailbody .= "To manage this report follow this link: https://" . DOMAIN . $URL->generate('none') . "\n"; |
|
261 | + $emailbody = "A new comment report has been filed by ".$this->user_name().".\n\n"; |
|
262 | + $emailbody .= "COMMENT:\n".$COMMENT->body()."\n\n"; |
|
263 | + $emailbody .= "REPORT:\n".$this->body."\n\n"; |
|
264 | + $emailbody .= "To manage this report follow this link: https://".DOMAIN.$URL->generate('none')."\n"; |
|
265 | 265 | |
266 | 266 | send_email(REPORTLIST, 'New comment report', $emailbody); |
267 | 267 | |
@@ -274,14 +274,14 @@ discard block |
||
274 | 274 | $email = $this->email(); |
275 | 275 | } |
276 | 276 | |
277 | - $data = array ( |
|
277 | + $data = array( |
|
278 | 278 | 'to' => $email, |
279 | 279 | 'template' => 'report_acknowledge' |
280 | 280 | ); |
281 | - $merge = array ( |
|
281 | + $merge = array( |
|
282 | 282 | 'FIRSTNAME' => $this->firstname(), |
283 | 283 | 'LASTNAME' => $this->lastname(), |
284 | - 'COMMENTURL' => "https://" . DOMAIN . $COMMENT->url(), |
|
284 | + 'COMMENTURL' => "https://".DOMAIN.$COMMENT->url(), |
|
285 | 285 | 'REPORTBODY' => strip_tags($this->body()) |
286 | 286 | ); |
287 | 287 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $data = array(); |
303 | 303 | |
304 | 304 | if (is_numeric($this->report_id)) { |
305 | - $data = array ( |
|
305 | + $data = array( |
|
306 | 306 | 'report_id' => $this->report_id(), |
307 | 307 | 'comment_id' => $this->comment_id(), |
308 | 308 | 'user_id' => $this->user_id(), |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | if ($THEUSER->is_able_to('deletecomment')) { |
340 | 340 | $time = gmdate("Y-m-d H:i:s"); |
341 | 341 | |
342 | - $q = $this->db->query ("UPDATE commentreports |
|
342 | + $q = $this->db->query("UPDATE commentreports |
|
343 | 343 | SET locked = '$time', |
344 | - lockedby = '" . $THEUSER->user_id() . "' |
|
345 | - WHERE report_id = '" . $this->report_id . "' |
|
344 | + lockedby = '".$THEUSER->user_id()."' |
|
345 | + WHERE report_id = '" . $this->report_id."' |
|
346 | 346 | "); |
347 | 347 | |
348 | 348 | if ($q->success()) { |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | $this->lockedby = $THEUSER->user_id(); |
351 | 351 | return true; |
352 | 352 | } else { |
353 | - $PAGE->error_message ("Sorry, we were unable to lock this report."); |
|
353 | + $PAGE->error_message("Sorry, we were unable to lock this report."); |
|
354 | 354 | return false; |
355 | 355 | } |
356 | 356 | } else { |
357 | - $PAGE->error_message ("You are not authorised to delete annotations."); |
|
357 | + $PAGE->error_message("You are not authorised to delete annotations."); |
|
358 | 358 | return false; |
359 | 359 | } |
360 | 360 | } |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | public function unlock() { |
364 | 364 | // Unlock a comment so it can be examined by someone else. |
365 | 365 | |
366 | - $q = $this->db->query ("UPDATE commentreports |
|
366 | + $q = $this->db->query("UPDATE commentreports |
|
367 | 367 | SET locked = NULL, |
368 | 368 | lockedby = NULL |
369 | - WHERE report_id = '" . $this->report_id . "' |
|
369 | + WHERE report_id = '" . $this->report_id."' |
|
370 | 370 | "); |
371 | 371 | |
372 | 372 | if ($q->success()) { |
@@ -437,16 +437,16 @@ discard block |
||
437 | 437 | |
438 | 438 | return true; |
439 | 439 | } else { |
440 | - $PAGE->error_message ("Sorry, we couldn't resolve this report."); |
|
440 | + $PAGE->error_message("Sorry, we couldn't resolve this report."); |
|
441 | 441 | return false; |
442 | 442 | } |
443 | 443 | } else { |
444 | - $PAGE->error_message ("This report has already been resolved (on " . $this->resolved . ")"); |
|
444 | + $PAGE->error_message("This report has already been resolved (on ".$this->resolved.")"); |
|
445 | 445 | return false; |
446 | 446 | } |
447 | 447 | |
448 | 448 | } else { |
449 | - $PAGE->error_message ("You are not authorised to resolve reports."); |
|
449 | + $PAGE->error_message("You are not authorised to resolve reports."); |
|
450 | 450 | return false; |
451 | 451 | } |
452 | 452 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | public $firstname = ''; |
28 | 28 | public $lastname = ''; |
29 | 29 | public $body = ''; |
30 | - public $reported = NULL; // datetime |
|
31 | - public $resolved = NULL; // datetime |
|
30 | + public $reported = null; // datetime |
|
31 | + public $resolved = null; // datetime |
|
32 | 32 | public $resolvedby = ''; // user_id |
33 | - public $locked = NULL; // datetime |
|
33 | + public $locked = null; // datetime |
|
34 | 34 | public $lockedby = ''; // user_id |
35 | 35 | public $upheld = ''; // boolean |
36 | 36 | |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | "); |
371 | 371 | |
372 | 372 | if ($q->success()) { |
373 | - $this->locked = NULL; |
|
374 | - $this->lockedby = NULL; |
|
373 | + $this->locked = null; |
|
374 | + $this->lockedby = null; |
|
375 | 375 | return true; |
376 | 376 | } else { |
377 | 377 | return false; |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | |
432 | 432 | $this->resolved = $time; |
433 | 433 | $this->resolvedby = $THEUSER->user_id(); |
434 | - $this->locked = NULL; |
|
435 | - $this->lockedby = NULL; |
|
434 | + $this->locked = null; |
|
435 | + $this->lockedby = null; |
|
436 | 436 | $this->upheld = $upheld; |
437 | 437 | |
438 | 438 | return true; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <select id="section" name="section"> |
67 | 67 | <option value="">Any |
68 | 68 | <?php |
69 | - optgroups(array( |
|
69 | + optgroups(array( |
|
70 | 70 | 'UK Parliament' => array( |
71 | 71 | 'uk' => 'All UK', |
72 | 72 | 'debates' => 'House of Commons debates', |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | 'sp' => 'Debates', |
86 | 86 | 'spwrans' => 'Written answers', |
87 | 87 | ), |
88 | - ), $section); |
|
89 | - ?> |
|
88 | + ), $section); |
|
89 | + ?> |
|
90 | 90 | </select> |
91 | 91 | <div class="help"> |
92 | 92 | Restrict results to a particular parliament or assembly that we cover (e.g. the |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | if (preg_match('#\s*([0-9/.-]*)\.\.([0-9/.-]*)#', $filter_ss, $m)) { |
24 | 24 | $from = $m[1]; |
25 | 25 | $to = $m[2]; |
26 | - $filter_ss = preg_replace('#\s*([0-9/.-]*)\.\.([0-9/.-]*)#', '', $filter_ss); |
|
26 | + $filter_ss = preg_replace('#\s*([0-9/.-]*)\.\.([0-9/.-]*)#', '', $filter_ss); |
|
27 | 27 | } |
28 | 28 | $section = get_http_var('section'); |
29 | 29 | if (preg_match('#\s*section:([a-z]*)#', $filter_ss, $m)) { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $filter_ss = preg_replace('#\s*speaker:[0-9]*#', '', $filter_ss); |
37 | 37 | } |
38 | 38 | |
39 | -$this->block_start(array( 'title' => "Filtering your results")); |
|
39 | +$this->block_start(array('title' => "Filtering your results")); |
|
40 | 40 | |
41 | 41 | ?> |
42 | 42 | <form method="get" action="/search/"> |
@@ -5,7 +5,9 @@ |
||
5 | 5 | echo '<optgroup label="', $key, '">'; |
6 | 6 | foreach ($values as $k => $v) { |
7 | 7 | echo '<option'; |
8 | - if ($current == $k) echo ' selected'; |
|
8 | + if ($current == $k) { |
|
9 | + echo ' selected'; |
|
10 | + } |
|
9 | 11 | echo ' value="', $k, '">', $v; |
10 | 12 | } |
11 | 13 | echo "</optgroup>\n"; |