Failed Conditions
Pull Request — master (#1327)
by Nick
69:15 queued 59:17
created
www/docs/bills/2005-06/identity-cards/index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@  discard block
 block discarded – undo
2 2
 
3 3
 $this_page = 'bill_index';
4 4
 include_once '../../../../includes/easyparliament/init.php';
5
-$DATA->set_page_metadata($this_page, 'heading','Identity Cards Act 2006');
5
+$DATA->set_page_metadata($this_page, 'heading', 'Identity Cards Act 2006');
6 6
 
7 7
 $PAGE->page_start();
8 8
 $PAGE->stripe_start();
9 9
 
10
-$PAGE->block_start(array ('title'=>'House of Commons - Normal Run'));
10
+$PAGE->block_start(array('title'=>'House of Commons - Normal Run'));
11 11
 ?>
12 12
 <ul> <li>Back on 25th May 2005, a bill was introduced: the <a
13 13
 href="http://www.publications.parliament.uk/pa/cm200506/cmbills/009/2006009.htm">Identity
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 <?php
34 34
 $PAGE->block_end();
35
-$PAGE->block_start(array ('title'=>'House of Lords - Normal Run'));
35
+$PAGE->block_start(array('title'=>'House of Lords - Normal Run'));
36 36
 ?>
37 37
 
38 38
 <ul>
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 <?php
51 51
 $PAGE->block_end();
52
-$PAGE->block_start(array ('title'=>'Ping Pong'));
52
+$PAGE->block_start(array('title'=>'Ping Pong'));
53 53
 ?>
54 54
 
55 55
 <ul>
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 $PAGE->block_end();
95 95
 
96 96
     $includes = array(
97
-        array (
97
+        array(
98 98
             'type' => 'include',
99 99
             'content' => 'bills_intro'
100 100
         ),
Please login to merge, or discard this patch.
www/docs/divisions/division.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
             $data['mp_vote']['with_majority'] = true;
44 44
         }
45 45
     } else {
46
-      if ($data['division']['date'] < $MEMBER->entered_house(1)['date']) {
47
-          $data['before_mp'] = true;
48
-      } else if ($data['division']['date'] > $MEMBER->left_house(1)['date']) {
49
-          $data['after_mp'] = true;
50
-      }
46
+        if ($data['division']['date'] < $MEMBER->entered_house(1)['date']) {
47
+            $data['before_mp'] = true;
48
+        } else if ($data['division']['date'] > $MEMBER->left_house(1)['date']) {
49
+            $data['after_mp'] = true;
50
+        }
51 51
     }
52 52
 }
53 53
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     }
52 52
 }
53 53
 
54
-$data['debate_time_human'] = False;
54
+$data['debate_time_human'] = false;
55 55
 $data['debate_day_human'] = format_date($data['division']['date'], LONGDATEFORMAT);
56 56
 $data['col_country'] = 'UK';
57 57
 $data['location'] = 'in the House of Commons';
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
 if ($mp = get_http_var('p')) {
17 17
     $MEMBER = new MySociety\TheyWorkForYou\Member(array('person_id' => $mp, 'house' => HOUSE_TYPE_COMMONS));
18 18
     $main_vote_mp = true;
19
-} else if ($THEUSER->postcode_is_set()) {
19
+}
20
+else if ($THEUSER->postcode_is_set()) {
20 21
     $MEMBER = new MySociety\TheyWorkForYou\Member(array('postcode' => $THEUSER->postcode(), 'house' => HOUSE_TYPE_COMMONS));
21 22
 }
22 23
 
@@ -42,10 +43,12 @@  discard block
 block discarded – undo
42 43
         if ($data['mp_vote']['vote'] == $data['division']['vote']) {
43 44
             $data['mp_vote']['with_majority'] = true;
44 45
         }
45
-    } else {
46
+    }
47
+    else {
46 48
       if ($data['division']['date'] < $MEMBER->entered_house(1)['date']) {
47 49
           $data['before_mp'] = true;
48
-      } else if ($data['division']['date'] > $MEMBER->left_house(1)['date']) {
50
+      }
51
+      else if ($data['division']['date'] > $MEMBER->left_house(1)['date']) {
49 52
           $data['after_mp'] = true;
50 53
       }
51 54
     }
Please login to merge, or discard this patch.
www/docs/divisions/index.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 }
11 11
 
12 12
 if (isset($MEMBER)) {
13
-  $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
14
-  $data = array('divisions' => $divisions->getRecentMemberDivisions(30, 'Parliament'));
15
-  $data['mp_name'] = ucfirst($MEMBER->full_name());
13
+    $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
14
+    $data = array('divisions' => $divisions->getRecentMemberDivisions(30, 'Parliament'));
15
+    $data['mp_name'] = ucfirst($MEMBER->full_name());
16 16
 } else {
17
-  $divisions = new MySociety\TheyWorkForYou\Divisions();
18
-  $data = $divisions->getRecentDivisions(30);
17
+    $divisions = new MySociety\TheyWorkForYou\Divisions();
18
+    $data = $divisions->getRecentDivisions(30);
19 19
 }
20 20
 
21 21
 $data['last_updated'] = MySociety\TheyWorkForYou\Divisions::getMostRecentDivisionDate()['latest'];
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@
 block discarded – undo
13 13
   $divisions = new MySociety\TheyWorkForYou\Divisions($MEMBER);
14 14
   $data = array('divisions' => $divisions->getRecentMemberDivisions(30, 'Parliament'));
15 15
   $data['mp_name'] = ucfirst($MEMBER->full_name());
16
-} else {
16
+}
17
+else {
17 18
   $divisions = new MySociety\TheyWorkForYou\Divisions();
18 19
   $data = $divisions->getRecentDivisions(30);
19 20
 }
Please login to merge, or discard this patch.
scripts/wikipedia-cron.php 3 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,39 +16,39 @@  discard block
 block discarded – undo
16 16
 contributions('212.35.252.2'); # LibDem
17 17
 
18 18
 function contributions($ip) {
19
-	global $dir;
19
+    global $dir;
20 20
 
21
-	$file = fetch("/w/index.php?title=Special:Contributions&limit=100&target=$ip");
22
-	if (!$file) return;
23
-	$fp = fopen($dir . $ip, 'w');
24
-	fwrite($fp, $file['body']);
25
-	fclose($fp);
26
-	preg_match_all('#<li>(.*?) \(<a[^>]*>hist</a>\) \(<a href="(.*?title=(.*?)&.*?oldid=(.*?))"[^>]*>diff</a>\)  <a[^>]*>(.*?)</a> .*?</li>#', $file['body'], $m, PREG_SET_ORDER);
27
-	foreach ($m as $row) {
28
-		# print "$row[3] / $row[4]";
29
-		$filename = html_entity_decode("$row[3].$row[4]");
30
-		$path = $dir;
31
-		if (strstr($filename, '/')) {
32
-			$bits = explode('/', $filename);
33
-			array_pop($bits);
34
-			foreach ($bits as $bit) {
35
-				@mkdir($path . $bit);
36
-				$path .= "$bit/";
37
-			}
38
-		}
39
-		$cache = $dir . $filename;
40
-		if (!is_file($cache)) {
41
-			# print " - fetching";
42
-			$file = fetch(html_entity_decode($row[2]));
43
-			if (!$file) continue;
44
-			$fp = fopen($cache, 'w');
45
-			if ($fp) {
46
-				fwrite($fp, $file['body']);
47
-				fclose($fp);
48
-			}
49
-		}
50
-		# print "\n";
51
-	}
21
+    $file = fetch("/w/index.php?title=Special:Contributions&limit=100&target=$ip");
22
+    if (!$file) return;
23
+    $fp = fopen($dir . $ip, 'w');
24
+    fwrite($fp, $file['body']);
25
+    fclose($fp);
26
+    preg_match_all('#<li>(.*?) \(<a[^>]*>hist</a>\) \(<a href="(.*?title=(.*?)&.*?oldid=(.*?))"[^>]*>diff</a>\)  <a[^>]*>(.*?)</a> .*?</li>#', $file['body'], $m, PREG_SET_ORDER);
27
+    foreach ($m as $row) {
28
+        # print "$row[3] / $row[4]";
29
+        $filename = html_entity_decode("$row[3].$row[4]");
30
+        $path = $dir;
31
+        if (strstr($filename, '/')) {
32
+            $bits = explode('/', $filename);
33
+            array_pop($bits);
34
+            foreach ($bits as $bit) {
35
+                @mkdir($path . $bit);
36
+                $path .= "$bit/";
37
+            }
38
+        }
39
+        $cache = $dir . $filename;
40
+        if (!is_file($cache)) {
41
+            # print " - fetching";
42
+            $file = fetch(html_entity_decode($row[2]));
43
+            if (!$file) continue;
44
+            $fp = fopen($cache, 'w');
45
+            if ($fp) {
46
+                fwrite($fp, $file['body']);
47
+                fclose($fp);
48
+            }
49
+        }
50
+        # print "\n";
51
+    }
52 52
 }
53 53
 
54 54
 function fetch($url) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     $host = 'en.wikipedia.org';
57 57
     $fp = @fsockopen($host, 80, $errno, $errstr, 10);
58 58
     if (!$fp) {
59
-	    #print "$errstr ($errno)\n";
59
+        #print "$errstr ($errno)\n";
60 60
             return '';
61 61
         }
62 62
     $out = "GET $url HTTP/1.1\r\n";
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@  discard block
 block discarded – undo
19 19
 	global $dir;
20 20
 
21 21
 	$file = fetch("/w/index.php?title=Special:Contributions&limit=100&target=$ip");
22
-	if (!$file) return;
22
+	if (!$file) {
23
+	    return;
24
+	}
23 25
 	$fp = fopen($dir . $ip, 'w');
24 26
 	fwrite($fp, $file['body']);
25 27
 	fclose($fp);
@@ -40,7 +42,9 @@  discard block
 block discarded – undo
40 42
 		if (!is_file($cache)) {
41 43
 			# print " - fetching";
42 44
 			$file = fetch(html_entity_decode($row[2]));
43
-			if (!$file) continue;
45
+			if (!$file) {
46
+			    continue;
47
+			}
44 48
 			$fp = fopen($cache, 'w');
45 49
 			if ($fp) {
46 50
 				fwrite($fp, $file['body']);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	    #print "$errstr ($errno)\n";
60 60
             return '';
61 61
         }
62
-    $out = "GET $url HTTP/1.1\r\n";
62
+    $out = "get $url HTTP/1.1\r\n";
63 63
     $out .= "Host: $host\r\n";
64 64
     $out .= "User-Agent: $ua\r\n";
65 65
     $out .= "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9;text/plain;q=0.8,image/png,*/*;q=0.5\r\n";
Please login to merge, or discard this patch.
scripts/alertmpchanged.php 4 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,26 +22,26 @@  discard block
 block discarded – undo
22 22
 $toemail = '';
23 23
 $template = 'alert_new_mp';
24 24
 for ($k=1; $k<$argc; $k++) {
25
-	if ($argv[$k] == '--nomail')
26
-		$nomail = true;
27
-	if (preg_match('#^--only=(.*)$#', $argv[$k], $m))
28
-		$onlyemail = $m[1];
29
-	if (preg_match('#^--from=(.*)$#', $argv[$k], $m))
30
-		$fromemail = $m[1];
31
-	if (preg_match('#^--to=(.*)$#', $argv[$k], $m))
32
-		$toemail = $m[1];
25
+    if ($argv[$k] == '--nomail')
26
+        $nomail = true;
27
+    if (preg_match('#^--only=(.*)$#', $argv[$k], $m))
28
+        $onlyemail = $m[1];
29
+    if (preg_match('#^--from=(.*)$#', $argv[$k], $m))
30
+        $fromemail = $m[1];
31
+    if (preg_match('#^--to=(.*)$#', $argv[$k], $m))
32
+        $toemail = $m[1];
33 33
 }
34 34
 
35 35
 if (DEVSITE)
36
-  $nomail = true;
36
+    $nomail = true;
37 37
 
38 38
 # Change this to the end date
39 39
 $END_DATE = '2017-05-03';
40 40
 
41 41
 if ($nomail) mlog("NOT SENDING EMAIL\n");
42 42
 if (($fromemail && $onlyemail) || ($toemail && $onlyemail)) {
43
-	mlog("Can't have both from/to and only!\n");
44
-	exit;
43
+    mlog("Can't have both from/to and only!\n");
44
+    exit;
45 45
 }
46 46
 
47 47
 $active = 0;
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 $members = array();
67 67
 $start_time = time();
68 68
 foreach ($alertdata as $alertitem) {
69
-	$active++;
70
-	$email = $alertitem['email'];
69
+    $active++;
70
+    $email = $alertitem['email'];
71 71
     if ($onlyemail && $email != $onlyemail) continue;
72 72
     if ($fromemail && strtolower($email) == $fromemail) $fromflag = true;
73 73
     if ($fromemail && !$fromflag) continue;
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 
144 144
 $sss = "Active alerts: $active\nEmail lookups: $registered registered, $unregistered unregistered\nQuery lookups: $queries\nSent emails: $sentemails\n";
145 145
 if ($globalsuccess) {
146
-      $sss .= 'Everything went swimmingly, in ';
146
+        $sss .= 'Everything went swimmingly, in ';
147 147
 } else {
148
-      $sss .= 'Something went wrong! Total time: ';
148
+        $sss .= 'Something went wrong! Total time: ';
149 149
 }
150 150
 $sss .= (getmicrotime()-$global_start)."\n\n";
151 151
 mlog($sss);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
     global $globalsuccess, $sentemails, $nomail, $start_time;
156 156
 
157 157
     $sentemails++;
158
-    mlog("SEND $sentemails : Sending email to $current[email] ... ");
158
+    mlog("send $sentemails : Sending email to $current[email] ... ");
159 159
     $d = array('to' => $current['email'], 'template' => $template);
160 160
     $m = array(
161 161
         'DATA' => join("\n", $data),
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $fromflag = false;
22 22
 $toemail = '';
23 23
 $template = 'alert_new_mp';
24
-for ($k=1; $k<$argc; $k++) {
24
+for ($k = 1; $k < $argc; $k++) {
25 25
 	if ($argv[$k] == '--nomail')
26 26
 		$nomail = true;
27 27
 	if (preg_match('#^--only=(.*)$#', $argv[$k], $m))
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
     // skip if they didn't lose their westminster seat in the most recent election
92 92
     if ($member->left_house(1)['date'] != $END_DATE) continue;
93 93
 
94
-    if ( !isset($cons[$member->constituency]) ) {
94
+    if (!isset($cons[$member->constituency])) {
95 95
         $cons_member = new MEMBER(array('constituency' => $member->constituency, 'house' => 1));
96
-        if ( !$cons_member ) {
96
+        if (!$cons_member) {
97 97
             continue;
98 98
         }
99 99
         $cons[$member->constituency] = $cons_member;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     }
103 103
 
104 104
     // these should never happen but let's just be sure
105
-    if ( $cons_member->person_id == $member->person_id ) continue;
105
+    if ($cons_member->person_id == $member->person_id) continue;
106 106
     if (!$cons_member->current_member_anywhere()) continue;
107 107
 
108 108
     if ($email != $current['email']) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             $user_id = 0;
123 123
             $unregistered++;
124 124
         }
125
-        mlog("\nEMAIL: $email, uid $user_id; memory usage : ".memory_get_usage()."\n");
125
+        mlog("\nEMAIL: $email, uid $user_id; memory usage : " . memory_get_usage() . "\n");
126 126
     }
127 127
 
128 128
     $lh = $member->left_house();
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 } else {
148 148
       $sss .= 'Something went wrong! Total time: ';
149 149
 }
150
-$sss .= (getmicrotime()-$global_start)."\n\n";
150
+$sss .= (getmicrotime() - $global_start) . "\n\n";
151 151
 mlog($sss);
152 152
 mlog(date('r') . "\n");
153 153
 
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
     $m = array(
161 161
         'DATA' => join("\n", $data),
162 162
         'CHANGE' => join("\n", $change),
163
-        'ALERT_IS' => count($data)==1 ? 'alert is' : 'alerts are',
164
-        'MPS' => count($data)==1 ? 'This MP' : 'These MPs',
165
-        'MPS2' => count($data)==1 ? 'MP' : 'MPs',
166
-        'ALERTS' => count($data)==1 ? 'an alert' : 'some alerts',
167
-        'ALERTS2' => count($data)==1 ? 'alert' : 'alerts',
168
-        'LINKS' => count($data)==1 ? 'link' : 'links',
163
+        'ALERT_IS' => count($data) == 1 ? 'alert is' : 'alerts are',
164
+        'MPS' => count($data) == 1 ? 'This MP' : 'These MPs',
165
+        'MPS2' => count($data) == 1 ? 'MP' : 'MPs',
166
+        'ALERTS' => count($data) == 1 ? 'an alert' : 'some alerts',
167
+        'ALERTS2' => count($data) == 1 ? 'alert' : 'alerts',
168
+        'LINKS' => count($data) == 1 ? 'link' : 'links',
169 169
     );
170 170
     if (!$nomail) {
171 171
         $success = send_template_email($d, $m, true);
172 172
         mlog("sent ... ");
173 173
         # sleep if time between sending mails is less than a certain number of seconds on average
174
-        if (((time() - $start_time) / $sentemails) < 0.5 ) { # number of seconds per mail not to be quicker than
174
+        if (((time() - $start_time) / $sentemails) < 0.5) { # number of seconds per mail not to be quicker than
175 175
             mlog("pausing ... ");
176 176
             sleep(1);
177 177
         }
Please login to merge, or discard this patch.
Braces   +56 added lines, -26 removed lines patch added patch discarded remove patch
@@ -22,23 +22,30 @@  discard block
 block discarded – undo
22 22
 $toemail = '';
23 23
 $template = 'alert_new_mp';
24 24
 for ($k=1; $k<$argc; $k++) {
25
-	if ($argv[$k] == '--nomail')
26
-		$nomail = true;
27
-	if (preg_match('#^--only=(.*)$#', $argv[$k], $m))
28
-		$onlyemail = $m[1];
29
-	if (preg_match('#^--from=(.*)$#', $argv[$k], $m))
30
-		$fromemail = $m[1];
31
-	if (preg_match('#^--to=(.*)$#', $argv[$k], $m))
32
-		$toemail = $m[1];
33
-}
34
-
35
-if (DEVSITE)
25
+	if ($argv[$k] == '--nomail') {
26
+			$nomail = true;
27
+	}
28
+	if (preg_match('#^--only=(.*)$#', $argv[$k], $m)) {
29
+			$onlyemail = $m[1];
30
+	}
31
+	if (preg_match('#^--from=(.*)$#', $argv[$k], $m)) {
32
+			$fromemail = $m[1];
33
+	}
34
+	if (preg_match('#^--to=(.*)$#', $argv[$k], $m)) {
35
+			$toemail = $m[1];
36
+	}
37
+	}
38
+
39
+if (DEVSITE) {
36 40
   $nomail = true;
41
+}
37 42
 
38 43
 # Change this to the end date
39 44
 $END_DATE = '2017-05-03';
40 45
 
41
-if ($nomail) mlog("NOT SENDING EMAIL\n");
46
+if ($nomail) {
47
+    mlog("NOT SENDING EMAIL\n");
48
+}
42 49
 if (($fromemail && $onlyemail) || ($toemail && $onlyemail)) {
43 50
 	mlog("Can't have both from/to and only!\n");
44 51
 	exit;
@@ -68,14 +75,24 @@  discard block
 block discarded – undo
68 75
 foreach ($alertdata as $alertitem) {
69 76
 	$active++;
70 77
 	$email = $alertitem['email'];
71
-    if ($onlyemail && $email != $onlyemail) continue;
72
-    if ($fromemail && strtolower($email) == $fromemail) $fromflag = true;
73
-    if ($fromemail && !$fromflag) continue;
74
-    if ($toemail && strtolower($email) >= $toemail) continue;
78
+    if ($onlyemail && $email != $onlyemail) {
79
+        continue;
80
+    }
81
+    if ($fromemail && strtolower($email) == $fromemail) {
82
+        $fromflag = true;
83
+    }
84
+    if ($fromemail && !$fromflag) {
85
+        continue;
86
+    }
87
+    if ($toemail && strtolower($email) >= $toemail) {
88
+        continue;
89
+    }
75 90
     $criteria_raw = $alertitem['criteria'];
76 91
 
77 92
     // we only care about alerts for people speaking
78
-    if (!strstr($criteria_raw, 'speaker:')) continue;
93
+    if (!strstr($criteria_raw, 'speaker:')) {
94
+        continue;
95
+    }
79 96
 
80 97
     preg_match('#speaker:(\d+)#', $criteria_raw, $m);
81 98
     $person_id = $m[1];
@@ -86,10 +103,14 @@  discard block
 block discarded – undo
86 103
     $member = $members[$person_id];
87 104
 
88 105
     // if they're still elected then don't send the email
89
-    if ($member->current_member_anywhere()) continue;
106
+    if ($member->current_member_anywhere()) {
107
+        continue;
108
+    }
90 109
 
91 110
     // skip if they didn't lose their westminster seat in the most recent election
92
-    if ($member->left_house(1)['date'] != $END_DATE) continue;
111
+    if ($member->left_house(1)['date'] != $END_DATE) {
112
+        continue;
113
+    }
93 114
 
94 115
     if ( !isset($cons[$member->constituency]) ) {
95 116
         $cons_member = new MEMBER(array('constituency' => $member->constituency, 'house' => 1));
@@ -97,13 +118,18 @@  discard block
 block discarded – undo
97 118
             continue;
98 119
         }
99 120
         $cons[$member->constituency] = $cons_member;
100
-    } else {
121
+    }
122
+    else {
101 123
         $cons_member = $cons[$member->constituency];
102 124
     }
103 125
 
104 126
     // these should never happen but let's just be sure
105
-    if ( $cons_member->person_id == $member->person_id ) continue;
106
-    if (!$cons_member->current_member_anywhere()) continue;
127
+    if ( $cons_member->person_id == $member->person_id ) {
128
+        continue;
129
+    }
130
+    if (!$cons_member->current_member_anywhere()) {
131
+        continue;
132
+    }
107 133
 
108 134
     if ($email != $current['email']) {
109 135
         if ($email_text && $change_text) {
@@ -118,7 +144,8 @@  discard block
 block discarded – undo
118 144
         if ($q->rows() > 0) {
119 145
             $user_id = $q->field(0, 'user_id');
120 146
             $registered++;
121
-        } else {
147
+        }
148
+        else {
122 149
             $user_id = 0;
123 150
             $unregistered++;
124 151
         }
@@ -144,7 +171,8 @@  discard block
 block discarded – undo
144 171
 $sss = "Active alerts: $active\nEmail lookups: $registered registered, $unregistered unregistered\nQuery lookups: $queries\nSent emails: $sentemails\n";
145 172
 if ($globalsuccess) {
146 173
       $sss .= 'Everything went swimmingly, in ';
147
-} else {
174
+}
175
+else {
148 176
       $sss .= 'Something went wrong! Total time: ';
149 177
 }
150 178
 $sss .= (getmicrotime()-$global_start)."\n\n";
@@ -171,11 +199,13 @@  discard block
 block discarded – undo
171 199
         $success = send_template_email($d, $m, true);
172 200
         mlog("sent ... ");
173 201
         # sleep if time between sending mails is less than a certain number of seconds on average
174
-        if (((time() - $start_time) / $sentemails) < 0.5 ) { # number of seconds per mail not to be quicker than
202
+        if (((time() - $start_time) / $sentemails) < 0.5 ) {
203
+# number of seconds per mail not to be quicker than
175 204
             mlog("pausing ... ");
176 205
             sleep(1);
177 206
         }
178
-    } else {
207
+    }
208
+    else {
179 209
         mlog(join('', $data));
180 210
         $success = 1;
181 211
     }
Please login to merge, or discard this patch.
scripts/video-mark-missing.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 $date = substr($from, 0, 10);
18 18
 $from = 'uk.org.publicwhip/debate/' . $from;
19
-if ($to) $to = 'uk.org.publicwhip/debate/' . $to;
19
+if ($to) {
20
+    $to = 'uk.org.publicwhip/debate/' . $to;
21
+}
20 22
 
21 23
 $q = $db->query('select hpos from hansard where gid="' . $from . '"');
22 24
 $hpos_from = $q->field(0, 'hpos');
@@ -34,8 +36,9 @@  discard block
 block discarded – undo
34 36
 
35 37
 $query = "update hansard set video_status = video_status | 8
36 38
     where major=1 and hdate='$date' and hpos>=$hpos_from";
37
-if ($to)
39
+if ($to) {
38 40
     $query .= " and hpos<=$hpos_to";
41
+}
39 42
 
40 43
 print "Executing $query...\n";
41 44
 $q = $db->query($query);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,6 +37,6 @@
 block discarded – undo
37 37
 if ($to)
38 38
     $query .= " and hpos<=$hpos_to";
39 39
 
40
-print "Executing $query...\n";
40
+print "executing $query...\n";
41 41
 $q = $db->query($query);
42 42
 print '  ' . $q->affected_rows() . " rows have been marked as missing\n";
Please login to merge, or discard this patch.
scripts/wranstats.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 $db = new ParlDB;
7 7
 
8 8
 $q = $db->query(
9
-	'select person_id,
9
+    'select person_id,
10 10
 		count(hansard.epobject_id) as wrans,
11 11
 		sum(yes_votes) + IFNULL((select sum(vote) from uservotes, hansard as hansard2
12 12
 				  where uservotes.epobject_id=hansard2.epobject_id
@@ -20,23 +20,23 @@  discard block
 block discarded – undo
20 20
 	group by person_id');
21 21
 
22 22
 for ($i=0; $i<$q->rows(); $i++) {
23
-	$p_id = $q->field($i, 'person_id');
24
-	$name = $q->field($i, 'first_name') . ' ' . $q->field($i, 'last_name');
25
-	$con = $q->field($i, 'constituency');
26
-	$wrans = $q->field($i, 'wrans');
27
-	$yes = $q->field($i, 'yes');
28
-	$no = $q->field($i, 'no');
29
-	if ($p_id) {
30
-	$qq = $db->query('(select hansard.epobject_id from hansard, uservotes
23
+    $p_id = $q->field($i, 'person_id');
24
+    $name = $q->field($i, 'first_name') . ' ' . $q->field($i, 'last_name');
25
+    $con = $q->field($i, 'constituency');
26
+    $wrans = $q->field($i, 'wrans');
27
+    $yes = $q->field($i, 'yes');
28
+    $no = $q->field($i, 'no');
29
+    if ($p_id) {
30
+    $qq = $db->query('(select hansard.epobject_id from hansard, uservotes
31 31
 			where hansard.epobject_id=uservotes.epobject_id
32 32
             and hansard.person_id = '.$p_id.' and major=3 and minor=2 and left_house>curdate())
33 33
 		union
34 34
 			(select hansard.epobject_id from hansard,member,anonvotes
35 35
 			 where hansard.epobject_id=anonvotes.epobject_id
36 36
              and hansard.person_id = '.$p_id.' and major=3 and minor=2 and left_house>curdate())');
37
-	$wrans_with_votes = $qq->rows();
38
-	} else {
39
-		$wrans_with_votes = '';
40
-	}
41
-	print "$name\t$con\t$wrans\t$wrans_with_votes\t$yes\t$no\n";
37
+    $wrans_with_votes = $qq->rows();
38
+    } else {
39
+        $wrans_with_votes = '';
40
+    }
41
+    print "$name\t$con\t$wrans\t$wrans_with_votes\t$yes\t$no\n";
42 42
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		where major = 3 and minor = 2 and left_house > curdate()
20 20
 	group by person_id');
21 21
 
22
-for ($i=0; $i<$q->rows(); $i++) {
22
+for ($i = 0; $i < $q->rows(); $i++) {
23 23
 	$p_id = $q->field($i, 'person_id');
24 24
 	$name = $q->field($i, 'first_name') . ' ' . $q->field($i, 'last_name');
25 25
 	$con = $q->field($i, 'constituency');
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 	if ($p_id) {
30 30
 	$qq = $db->query('(select hansard.epobject_id from hansard, uservotes
31 31
 			where hansard.epobject_id=uservotes.epobject_id
32
-            and hansard.person_id = '.$p_id.' and major=3 and minor=2 and left_house>curdate())
32
+            and hansard.person_id = '.$p_id . ' and major=3 and minor=2 and left_house>curdate())
33 33
 		union
34 34
 			(select hansard.epobject_id from hansard,member,anonvotes
35 35
 			 where hansard.epobject_id=anonvotes.epobject_id
36
-             and hansard.person_id = '.$p_id.' and major=3 and minor=2 and left_house>curdate())');
36
+             and hansard.person_id = '.$p_id . ' and major=3 and minor=2 and left_house>curdate())');
37 37
 	$wrans_with_votes = $qq->rows();
38 38
 	} else {
39 39
 		$wrans_with_votes = '';
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@
 block discarded – undo
35 35
 			 where hansard.epobject_id=anonvotes.epobject_id
36 36
              and hansard.person_id = '.$p_id.' and major=3 and minor=2 and left_house>curdate())');
37 37
 	$wrans_with_votes = $qq->rows();
38
-	} else {
38
+	}
39
+	else {
39 40
 		$wrans_with_votes = '';
40 41
 	}
41 42
 	print "$name\t$con\t$wrans\t$wrans_with_votes\t$yes\t$no\n";
Please login to merge, or discard this patch.
scripts/video-check.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@
 block discarded – undo
10 10
 	order by hdate, hpos');
11 11
 $last = array('hdate'=>'');
12 12
 for ($i=0; $i<$q->rows(); $i++) {
13
-	$row = array(
14
-		'atime' => $q->field($i, 'atime'),
15
-		'hdate' => $q->field($i, 'hdate'),
16
-		'gid' => $q->field($i, 'gid'),
17
-		'hpos' => $q->field($i, 'hpos')
18
-	);
19
-	if ($row['hdate'] != $last['hdate'])
20
-		$last = array();
21
-	if ($last && $row['atime'] < $last['atime']-5) {
22
-		print "PROBLEM; current row is $row[gid] $row[hdate] $row[atime]\n";
23
-		print "  Last was $last[gid] $last[hdate] $last[atime]\n";
24
-	}
25
-	$last = $row;
13
+    $row = array(
14
+        'atime' => $q->field($i, 'atime'),
15
+        'hdate' => $q->field($i, 'hdate'),
16
+        'gid' => $q->field($i, 'gid'),
17
+        'hpos' => $q->field($i, 'hpos')
18
+    );
19
+    if ($row['hdate'] != $last['hdate'])
20
+        $last = array();
21
+    if ($last && $row['atime'] < $last['atime']-5) {
22
+        print "PROBLEM; current row is $row[gid] $row[hdate] $row[atime]\n";
23
+        print "  Last was $last[gid] $last[hdate] $last[atime]\n";
24
+    }
25
+    $last = $row;
26 26
 }
27 27
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 		and (user_id is null or user_id != -1) and deleted=0
10 10
 	order by hdate, hpos');
11 11
 $last = array('hdate'=>'');
12
-for ($i=0; $i<$q->rows(); $i++) {
12
+for ($i = 0; $i < $q->rows(); $i++) {
13 13
 	$row = array(
14 14
 		'atime' => $q->field($i, 'atime'),
15 15
 		'hdate' => $q->field($i, 'hdate'),
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	);
19 19
 	if ($row['hdate'] != $last['hdate'])
20 20
 		$last = array();
21
-	if ($last && $row['atime'] < $last['atime']-5) {
21
+	if ($last && $row['atime'] < $last['atime'] - 5) {
22 22
 		print "PROBLEM; current row is $row[gid] $row[hdate] $row[atime]\n";
23 23
 		print "  Last was $last[gid] $last[hdate] $last[atime]\n";
24 24
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@
 block discarded – undo
16 16
 		'gid' => $q->field($i, 'gid'),
17 17
 		'hpos' => $q->field($i, 'hpos')
18 18
 	);
19
-	if ($row['hdate'] != $last['hdate'])
20
-		$last = array();
19
+	if ($row['hdate'] != $last['hdate']) {
20
+			$last = array();
21
+	}
21 22
 	if ($last && $row['atime'] < $last['atime']-5) {
22 23
 		print "PROBLEM; current row is $row[gid] $row[hdate] $row[atime]\n";
23 24
 		print "  Last was $last[gid] $last[hdate] $last[atime]\n";
Please login to merge, or discard this patch.
scripts/daily-api-usage.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@
 block discarded – undo
52 52
 <br><small style='color:#666'>$reason</small>
53 53
 ";
54 54
 }
55
-if (!$out) exit;
55
+if (!$out) {
56
+    exit;
57
+}
56 58
 
57 59
 $headers =
58 60
     "From: TheyWorkForYou <" . CONTACTEMAIL . ">\r\n" .
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 ');
23 23
 
24 24
 $keys = array();
25
-for ($i=0; $i<$q->rows(); $i++) {
25
+for ($i = 0; $i < $q->rows(); $i++) {
26 26
     $keys[] = $q->field($i, 'api_key');
27 27
 }
28 28
 $keys = join("','", $keys);
@@ -34,18 +34,18 @@  discard block
 block discarded – undo
34 34
     GROUP BY api_key
35 35
 ");
36 36
 $summary = array();
37
-for ($i=0; $i<$q2->rows(); $i++) {
37
+for ($i = 0; $i < $q2->rows(); $i++) {
38 38
     $row = $q2->row($i);
39 39
     $summary[$row['api_key']] = array($row['first_use'], $row['count']);
40 40
 }
41 41
 
42 42
 $out = '';
43
-for ($i=0; $i<$q->rows(); $i++) {
43
+for ($i = 0; $i < $q->rows(); $i++) {
44 44
     $row = $q->row($i);
45 45
     $reason = preg_replace("/\r?\n/", ' ', $row['reason']);
46
-    $comm = $row['commercial']==1 ? ', commercial' : '';
47
-    $ipa = $row['ip_addresses']!=1 ? 'es' : '';
48
-    $hp = $row['count']!=1 ? 's' : '';
46
+    $comm = $row['commercial'] == 1 ? ', commercial' : '';
47
+    $ipa = $row['ip_addresses'] != 1 ? 'es' : '';
48
+    $hp = $row['count'] != 1 ? 's' : '';
49 49
     list($first, $total) = $summary[$row['api_key']];
50 50
     $out .= "<p><b>$row[count] hit$hp, from $row[ip_addresses] IP address$ipa.</b> $row[firstname] $row[lastname] &lt;$row[email]&gt;
51 51
 <br>$row[api_key], created $row[created], first use $first$comm, total calls $total
@@ -61,5 +61,5 @@  discard block
 block discarded – undo
61 61
     "Content-Transfer-Encoding: 8bit\r\n";
62 62
 $subject = 'Daily TheyWorkForYou API usage';
63 63
 $to = join(chr(64), array('commercial', 'mysociety.org'));
64
-mail ($to, $subject, $out, $headers);
64
+mail($to, $subject, $out, $headers);
65 65
 
Please login to merge, or discard this patch.