Completed
Pull Request — master (#965)
by Nick
05:26
created
www/includes/easyparliament/templates/html/people/index.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,31 +26,31 @@  discard block
 block discarded – undo
26 26
                           Based on postcode <strong><?= $mp_data['postcode'] ?></strong>
27 27
                           <a href="<?= $mp_data['change_url'] ?>">(Change postcode)</a>
28 28
                       </p>
29
-                    <?php if ( isset( $mp_data ) && $type != 'mlas' ) { ?>
30
-                      <h3>Your <?= $mp_data['former'] ? $mp_data['former'] . ' ' : '' ?><?= $rep_name ?> is</h3>
29
+                    <?php if (isset($mp_data) && $type != 'mlas') { ?>
30
+                      <h3>Your <?= $mp_data['former'] ? $mp_data['former'].' ' : '' ?><?= $rep_name ?> is</h3>
31 31
                     </div>
32 32
                     <a href="<?= $mp_data['mp_url'] ?>" class="people-list__person">
33 33
                     <img class="people-list__person__image" src="<?= $mp_data['image'] ?>">
34 34
                         <h2 class="people-list__person__name"><?= $mp_data['name'] ?></h2>
35 35
                         <p class="people-list__person__memberships">
36 36
                         <span class="people-list__person__constituency"><?= $mp_data['constituency'] ?></span>
37
-                        <span class="people-list__person__party <?= strtolower( $mp_data['party'] ) ?>"><?= $mp_data['party'] ?></span>
37
+                        <span class="people-list__person__party <?= strtolower($mp_data['party']) ?>"><?= $mp_data['party'] ?></span>
38 38
                         </p>
39 39
                     </a>
40 40
                     <?php }
41
-                    if ( isset($reps) ) {
42
-                        if ( isset($mp_data) && $type != 'mlas' ) { ?>
41
+                    if (isset($reps)) {
42
+                        if (isset($mp_data) && $type != 'mlas') { ?>
43 43
                     <div class="people-list__your-mp__replist-header">
44 44
                         <?php } ?>
45 45
                       <h3>Your <?=$former ?> <?= $rep_plural == 'MSPs' ? 'regional ' : '' ?><?= $rep_plural ?> are</h3>
46 46
                     </div>
47
-                        <?php foreach ( $reps as $rep ) { ?>
47
+                        <?php foreach ($reps as $rep) { ?>
48 48
                     <a href="<?= $rep['mp_url'] ?>" class="people-list__person">
49 49
                     <img class="people-list__person__image" src="<?= $rep['image'] ?>">
50 50
                         <h2 class="people-list__person__name"><?= $rep['name'] ?></h2>
51 51
                         <p class="people-list__person__memberships">
52 52
                         <span class="people-list__person__constituency"><?= $rep['constituency'] ?></span>
53
-                        <span class="people-list__person__party <?= strtolower( $rep['party'] ) ?>"><?= $rep['party'] ?></span>
53
+                        <span class="people-list__person__party <?= strtolower($rep['party']) ?>"><?= $rep['party'] ?></span>
54 54
                         </p>
55 55
                     </a>
56 56
                         <?php } ?>
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
             <div class="search-page__section search-page__section--search">
66 66
                 <div class="search-page__section__primary">
67 67
                     <p class="search-page-main-inputs">
68
-                    <?php if ( $type == 'peers' ) { ?>
68
+                    <?php if ($type == 'peers') { ?>
69 69
                         <label for="find-mp-by-name-or-postcode">Find <?= $rep_plural ?> by name:</label>
70
-                    <?php } elseif ( $type == 'mlas' || $type == 'msps' ) { ?>
70
+                    <?php } elseif ($type == 'mlas' || $type == 'msps') { ?>
71 71
                         <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by postcode:</label>
72 72
                     <?php } else { ?>
73 73
                         <label for="find-mp-by-name-or-postcode">Find your <?= $rep_name ?> by name or postcode:</label>
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
             <div class="search-page__section__primary">
109 109
             <h2>All <?= $rep_plural ?></h2>
110 110
 
111
-                <?php if ( $type != 'peers' ) { ?>
111
+                <?php if ($type != 'peers') { ?>
112 112
                 <ul class="search-result-display-options">
113
-                    <?php if ( $order == 'given_name' ) { ?>
113
+                    <?php if ($order == 'given_name') { ?>
114 114
                     <li><strong>Sorted by</strong> First name</li>
115 115
                     <li>Sort by <a href="<?= $urls['by_last'] ?>">Last name</a> / <a href="<?= $urls['by_party'] ?>">Party</a></li>
116
-                    <?php } else if ( $order == 'party' ) { ?>
116
+                    <?php } else if ($order == 'party') { ?>
117 117
                     <li><strong>Sorted by</strong> Party</li>
118 118
                     <li>Sort by <a href="<?= $urls['by_first'] ?>">First name</a> / <a href="<?= $urls['by_last'] ?>">Last name</a></li>
119 119
                     <?php } else { ?>
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 </ul>
124 124
                 <?php } else { ?>
125 125
                 <ul class="search-result-display-options">
126
-                    <?php if ( $order == 'party' ) { ?>
126
+                    <?php if ($order == 'party') { ?>
127 127
                     <li><strong>Sorted by</strong> Party</li>
128 128
                     <li>Sort by <a href="<?= $urls['by_name'] ?>">Name</a></li>
129 129
                     <?php } else { ?>
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
                     }
174 174
                 }
175 175
                 $initial_link = '';
176
-                foreach ( $data as $person ) {
176
+                foreach ($data as $person) {
177 177
                     if ($order != 'party') {
178
-                        $initial = substr( strtoupper($person[$a_to_z_key]), 0, 1);
179
-                        if ( $initial != $current_initial ) {
178
+                        $initial = substr(strtoupper($person[$a_to_z_key]), 0, 1);
179
+                        if ($initial != $current_initial) {
180 180
                             $current_initial = $initial;
181 181
                             $initial_link = "name=\"$initial\" ";
182 182
                         } else {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 <img class="people-list__person__image" src="<?= $person['image'] ?>">
189 189
                         <h2 class="people-list__person__name"><?= ucfirst($person['name']) ?></h2>
190 190
                         <p class="people-list__person__memberships">
191
-                        <?php if ( $person['constituency'] ) { ?>
191
+                        <?php if ($person['constituency']) { ?>
192 192
                         <span class="people-list__person__constituency"><?= $person['constituency'] ?></span>
193 193
                         <?php } ?>
194 194
                         <span class="people-list__person__party <?= strtolower($person['party']) ?>"><?= $person['party'] ?></span>
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 <a href="<?= $urls['by_csv'] ?>">Download this list as a CSV</a>
207 207
                     suitable for Excel
208 208
                 </p>
209
-                <?php if ( $type == 'mps' ) { ?>
209
+                <?php if ($type == 'mps') { ?>
210 210
                 <form method="get" action="<?= $urls['plain'] ?>" class="sidebar-item-with-icon sidebar-item-with-icon--date">
211 211
                     <p>
212 212
                         Or view a past list
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                   })
251 251
                 });
252 252
                 </script>
253
-                <?php } else if ( $type == 'msps' ) { ?>
253
+                <?php } else if ($type == 'msps') { ?>
254 254
                     <p class="past-list-dates" id="past-list-dates">
255 255
                         <a href="<?= $urls['plain'] ?>?date=2011-05-05">MSPs at 2011 election</a>
256 256
                         <a href="<?= $urls['plain'] ?>?date=2007-05-03">MSPs at 2007 election</a>
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                     </p>
265 265
                 <?php } ?>
266 266
 
267
-                <?php include( dirname(__FILE__) . '/../sidebar/looking_for.php' ) ?>
267
+                <?php include(dirname(__FILE__).'/../sidebar/looking_for.php') ?>
268 268
             </div>
269 269
         </div>
270 270
 
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/index.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/footer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,13 +84,13 @@
 block discarded – undo
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
 ?>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/static/search_help.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
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>
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/api/hansard_gid.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,4 +67,4 @@
 block discarded – undo
67 67
     api_output($out);
68 68
 } else {
69 69
     api_error('Nothing');
70
-   }
70
+    }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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']);
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/api/comments.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/api/comments_user.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,20 +39,20 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/api/hansard_date.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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&#8212;")) {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,9 @@
 block discarded – undo
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']);
Please login to merge, or discard this patch.
www/includes/easyparliament/commentreport.php 2 patches
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.