Failed Conditions
Pull Request — master (#1326)
by Nick
26:02 queued 20:44
created
www/docs/admin/featured.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $out = '';
13 13
 if (get_http_var('preview')) {
14 14
     preview_featured();
15
-} else if ( get_http_var('confirm') ) {
15
+} else if (get_http_var('confirm')) {
16 16
     $out = update_featured();
17 17
 }
18 18
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 print '</div>';
24 24
 
25 25
 function gid_to_url($gid) {
26
-    if ( !$gid ) {
26
+    if (!$gid) {
27 27
         return '';
28 28
     }
29 29
     global $hansardmajors;
30 30
     global $db;
31 31
 
32
-    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array( ':gid' => $gid ));
32
+    $q = $db->query("SELECT major FROM hansard WHERE gid = :gid", array(':gid' => $gid));
33 33
     $url_gid = fix_gid_from_db($gid);
34 34
     $url = new \URL($hansardmajors[$q->field(0, 'major')]['page']);
35 35
     $url->insert(array('id' => $url_gid));
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     $related = $featured->get_related();
44 44
     $context = $featured->get_context();
45 45
 
46
-    if ( get_http_var('url') ) {
46
+    if (get_http_var('url')) {
47 47
         $url = get_http_var('url');
48 48
         $title = get_http_var('title');
49 49
         $context = get_http_var('context');
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
     $related_gid3 = $related3 ? get_gid_from_url($related3) : NULL;
114 114
 
115 115
     print "<h2>Preview Content</h2>";
116
-    if ( $gid !== NULL ) {
116
+    if ($gid !== NULL) {
117 117
         $h = new MySociety\TheyWorkForYou\Homepage;
118
-        $featured = $h->getFeaturedDebate($gid, $title, $context, array( $related_gid1, $related_gid2, $related_gid3 ));
118
+        $featured = $h->getFeaturedDebate($gid, $title, $context, array($related_gid1, $related_gid2, $related_gid3));
119 119
 
120
-        include INCLUDESPATH . 'easyparliament/templates/html/homepage/featured.php';
120
+        include INCLUDESPATH.'easyparliament/templates/html/homepage/featured.php';
121 121
     } else {
122 122
         print "<p>A random debate from the last 7 days will be displayed</p>";
123 123
     }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     $parts = parse_url($url);
158 158
     parse_str($parts['query'], $query);
159 159
 
160
-    if ( $query['id'] ) {
160
+    if ($query['id']) {
161 161
         if (strpos($parts['path'], 'lords') !== false) {
162 162
             $gid = 'uk.org.publicwhip/lords/';
163 163
         } elseif (strpos($parts['path'], 'whall') !== false) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     $featured->set_related(array($related1, $related2, $related3));
187 187
 
188 188
     $out = "<h4>update successful</h4>";
189
-    $out .= "<p>Title set to " . _htmlspecialchars($title) . " and gid to " . _htmlspecialchars($gid) . "</p>";
189
+    $out .= "<p>Title set to "._htmlspecialchars($title)." and gid to "._htmlspecialchars($gid)."</p>";
190 190
 
191 191
     return $out;
192 192
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
     $related2 = get_http_var('related2');
108 108
     $related3 = get_http_var('related3');
109 109
 
110
-    $gid = $url ? get_gid_from_url($url) : NULL;
111
-    $related_gid1 = $related1 ? get_gid_from_url($related1) : NULL;
112
-    $related_gid2 = $related2 ? get_gid_from_url($related2) : NULL;
113
-    $related_gid3 = $related3 ? get_gid_from_url($related3) : NULL;
110
+    $gid = $url ? get_gid_from_url($url) : null;
111
+    $related_gid1 = $related1 ? get_gid_from_url($related1) : null;
112
+    $related_gid2 = $related2 ? get_gid_from_url($related2) : null;
113
+    $related_gid3 = $related3 ? get_gid_from_url($related3) : null;
114 114
 
115 115
     print "<h2>Preview Content</h2>";
116
-    if ( $gid !== NULL ) {
116
+    if ( $gid !== null ) {
117 117
         $h = new MySociety\TheyWorkForYou\Homepage;
118 118
         $featured = $h->getFeaturedDebate($gid, $title, $context, array( $related_gid1, $related_gid2, $related_gid3 ));
119 119
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 }
154 154
 
155 155
 function get_gid_from_url($url) {
156
-    $gid = NULL;
156
+    $gid = null;
157 157
     $parts = parse_url($url);
158 158
     parse_str($parts['query'], $query);
159 159
 
Please login to merge, or discard this patch.
www/docs/admin/banner.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $out = '<form action="banner.php" method="post">';
51 51
     $out .= '<input name="action" type="hidden" value="Save">';
52 52
     $out .= '<p><label for="banner">Contents (HTML permitted)</label><br>';
53
-    $out .= '<textarea id="banner_text" name="banner" rows="5" cols="80">' . htmlentities($text) . "</textarea></p>\n";
53
+    $out .= '<textarea id="banner_text" name="banner" rows="5" cols="80">'.htmlentities($text)."</textarea></p>\n";
54 54
     $out .= '<span class="formw"><input type="button" id="preview" value="Preview"> <input name="btnaction" type="submit" value="Save"></span>';
55 55
     $out .= '</form>';
56 56
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     global $banner;
62 62
     $banner_text = get_http_var('banner');
63 63
 
64
-    if ( $banner->set_text($banner_text) ) {
64
+    if ($banner->set_text($banner_text)) {
65 65
         $out = "<h4>update successful</h4>";
66 66
         $out .= "<p>Banner text is now:</p><p>$banner_text</p>";
67 67
     } else {
Please login to merge, or discard this patch.
www/docs/admin/badusers.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 $rows = array();
33 33
 $USERURL = new URL('userview');
34 34
 
35
-for ($row=0; $row<$q->rows(); $row++) {
35
+for ($row = 0; $row < $q->rows(); $row++) {
36 36
 
37 37
     $user_id = $q->field($row, 'user_id');
38 38
 
39 39
     // Get the total comments posted for this user.
40 40
     $r = $db->query("SELECT COUNT(*) AS totalcount
41 41
                     FROM	comments
42
-                    WHERE	user_id = '" . $user_id . "'");
42
+                    WHERE	user_id = '" . $user_id."'");
43 43
 
44 44
     $totalcomments = $r->field(0, 'totalcount');
45 45
 
46
-    $percentagedeleted = ( $q->field($row, 'deletedcount') / $totalcomments ) * 100;
46
+    $percentagedeleted = ($q->field($row, 'deletedcount') / $totalcomments) * 100;
47 47
 
48 48
 
49 49
     // Get complaints made about this user's comments, but not upheld.
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 
60 60
     $USERURL->insert(array('u'=>$user_id));
61 61
 
62
-    $rows[] = array (
63
-        '<a href="' . $USERURL->generate() . '">' . $q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname') . '</a>',
62
+    $rows[] = array(
63
+        '<a href="'.$USERURL->generate().'">'.$q->field($row, 'firstname').' '.$q->field($row, 'lastname').'</a>',
64 64
         $totalcomments,
65 65
         $q->field($row, 'deletedcount'),
66 66
         $percentagedeleted.'%',
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
     );
69 69
 }
70 70
 
71
-$tabledata = array (
72
-    'header' => array (
71
+$tabledata = array(
72
+    'header' => array(
73 73
         'Name',
74 74
         'Total comments',
75 75
         'Number deleted',
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 $rows = array();
106 106
 $USERURL = new URL('userview');
107 107
 
108
-for ($row=0; $row<$q->rows(); $row++) {
108
+for ($row = 0; $row < $q->rows(); $row++) {
109 109
 
110 110
     $user_id = $q->field($row, 'user_id');
111 111
 
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
                     WHERE	user_id = '$user_id'
118 118
                     AND		upheld = '1'");
119 119
 
120
-    $rows[] = array (
121
-        '<a href="' . $USERURL->generate() . '">' . $q->field($row, 'firstname') . ' ' . $q->field($row, 'lastname') . '</a>',
120
+    $rows[] = array(
121
+        '<a href="'.$USERURL->generate().'">'.$q->field($row, 'firstname').' '.$q->field($row, 'lastname').'</a>',
122 122
         $q->field($row, 'rejectedcount'),
123 123
         $r->field(0, 'upheldcount')
124 124
     );
125 125
 
126 126
 }
127
-$tabledata = array (
128
-    'header' => array (
127
+$tabledata = array(
128
+    'header' => array(
129 129
         'Name',
130 130
         'Reports not upheld',
131 131
         'Reports upheld'
Please login to merge, or discard this patch.
www/docs/admin/reporting_stats.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 $PAGE->page_start();
9 9
 $PAGE->stripe_start();
10
-$PAGE->block_start(array ('id'=>'alerts', 'title'=>'Reporting Statistics'));
10
+$PAGE->block_start(array('id'=>'alerts', 'title'=>'Reporting Statistics'));
11 11
 $db = new ParlDB;
12 12
 $q = $db->query('select year(created) as the_year, month(created) as the_month, count(*) as c from alerts where confirmed and not deleted group by year(created) desc, month(created) desc');
13 13
 print '<h3>Alert signups per month</h3> <table>';
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 print '<thead><tr><th>Year</th><th style="padding-right: 15px;">Month</th><th>Sign Ups</th><tr></thead>';
17 17
 
18 18
 $row_count = $q->rows();
19
-for ($i=0; $i<$row_count; $i++) {
19
+for ($i = 0; $i < $row_count; $i++) {
20 20
     $year = $q->field($i, 'the_year');
21 21
     $month = $q->field($i, 'the_month');
22 22
     $count = $q->field($i, 'c');
Please login to merge, or discard this patch.
www/docs/admin/websites.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 include_once '../../includes/easyparliament/init.php';
4 4
 #include_once INCLUDESPATH . 'easyparliament/commentreportlist.php';
5 5
 #include_once INCLUDESPATH . 'easyparliament/searchengine.php';
6
-include_once INCLUDESPATH . 'easyparliament/member.php';
6
+include_once INCLUDESPATH.'easyparliament/member.php';
7 7
 #include_once INCLUDESPATH . 'easyparliament/people.php';
8 8
 
9 9
 $this_page = 'admin_mpurls';
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 
55 55
         $out = "<h3>Edit person: $name</h3>\n";
56 56
 
57
-        $out .= '<form action="websites.php?editperson=' . $q->field($row, 'person_id') . '" method="post">';
57
+        $out .= '<form action="websites.php?editperson='.$q->field($row, 'person_id').'" method="post">';
58 58
         $out .= '<input name="action" type="hidden" value="SaveURL">';
59 59
         $out .= '<label for="url">URL:</label>';
60
-        $out .= '<span class="formw"><input id="url" name="url" type="text"  size="60" value="' . $q->field($row, 'mp_website') . '"></span>' . "\n";
60
+        $out .= '<span class="formw"><input id="url" name="url" type="text"  size="60" value="'.$q->field($row, 'mp_website').'"></span>'."\n";
61 61
         $out .= '<span class="formw"><input name="btnaction" type="submit" value="Save URL"></span>';
62 62
         $out .= '</form>';
63 63
     }
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
         $out .= '<li>';
84 84
         $name = member_full_name($q->field($row, 'house'), $q->field($row, 'title'), $q->field($row, 'given_name'), $q->field($row, 'family_name'), $q->field($row, 'lordofname'));
85 85
         $mp_website = $q->field($row, 'data_value');
86
-        $out .= ' <small>[<a href="websites.php?editperson=' . $q->field($row, 'person_id') . '"';
86
+        $out .= ' <small>[<a href="websites.php?editperson='.$q->field($row, 'person_id').'"';
87 87
         if ($mp_website) {
88
-            $out .= ' title="Change URL ' . $mp_website . '">Edit URL</a>]</small>';
88
+            $out .= ' title="Change URL '.$mp_website.'">Edit URL</a>]</small>';
89 89
         } else {
90 90
             $out .= '>Add URL</a>]</small>';
91 91
         }
92
-        $out .= ' ' . $name;
92
+        $out .= ' '.$name;
93 93
         if ($q->field($row, 'constituency')) {
94
-            $out .= ' (' . $q->field($row, 'constituency') . ')';
94
+            $out .= ' ('.$q->field($row, 'constituency').')';
95 95
         }
96 96
         $out .= "</li>\n";
97 97
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     $sysretval = 0;
108 108
     $personid = get_http_var('editperson');
109 109
 
110
-    $q  = $db->query("DELETE FROM personinfo WHERE data_key = 'mp_website' AND personinfo.person_id = :person_id", array(
110
+    $q = $db->query("DELETE FROM personinfo WHERE data_key = 'mp_website' AND personinfo.person_id = :person_id", array(
111 111
         ':person_id' => $personid
112 112
         ));
113 113
 
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
     }
120 120
 
121 121
     if ($q->success()) {
122
-        exec($scriptpath . "/db2xml.pl --update_person --personid=" . escapeshellarg($personid) . " --debug", $exec_output);
122
+        exec($scriptpath."/db2xml.pl --update_person --personid=".escapeshellarg($personid)." --debug", $exec_output);
123 123
         $out = '<p id="warning">';
124
-        foreach ($exec_output as $message) {$out .= $message . "<br>";}
124
+        foreach ($exec_output as $message) {$out .= $message."<br>"; }
125 125
         $out .= '</p>';
126 126
         # ../../../scripts/db2xml.pl  --update_person --personid=10001
127 127
     }
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 
141 141
     $rettext .= '<div id="subnav_websites">';
142 142
     foreach ($subnav as $label => $path) {
143
-        $rettext .=  '<a href="'. $path . '">'. $label .'</a>';
143
+        $rettext .= '<a href="'.$path.'">'.$label.'</a>';
144 144
     }
145
-    $rettext .=  '</div>';
145
+    $rettext .= '</div>';
146 146
 
147 147
     return $rettext;
148 148
 }
Please login to merge, or discard this patch.
www/docs/admin/glossary.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 $EDITQUEUE = new GLOSSEDITQUEUE();
11 11
 
12
-$args = array (
12
+$args = array(
13 13
     'sort' => "regexp_replace"
14 14
 );
15 15
 
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
 if (get_http_var('approve')) {
23 23
     $approve = get_http_var('approve');
24 24
     if (!is_array($approve)) {
25
-        $approve = array ( $approve );
25
+        $approve = array($approve);
26 26
     }
27 27
     // Add all approved items
28
-    $data = array (
28
+    $data = array(
29 29
         'approvals' => $approve,
30 30
         'epobject_type' => 2
31 31
     );
32 32
     $EDITQUEUE->approve($data);
33 33
 }
34 34
 elseif (get_http_var('decline')) {
35
-    $decline = array (get_http_var('decline'));
35
+    $decline = array(get_http_var('decline'));
36 36
     // Dump all declined items
37
-    $data = array (
37
+    $data = array(
38 38
         'declines' => $decline,
39 39
         'epobject_type' => 2
40 40
     );
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
         'epobject_type' => 2
31 31
     );
32 32
     $EDITQUEUE->approve($data);
33
-}
34
-elseif (get_http_var('decline')) {
33
+} elseif (get_http_var('decline')) {
35 34
     $decline = array (get_http_var('decline'));
36 35
     // Dump all declined items
37 36
     $data = array (
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
         'epobject_type' => 2
40 39
     );
41 40
     $EDITQUEUE->decline($data);
42
-}
43
-elseif (get_http_var('delete_confirm')) {
41
+} elseif (get_http_var('delete_confirm')) {
44 42
     $delete_id = get_http_var('delete_confirm');
45 43
     // Delete the existing glossary entry
46 44
     $GLOSSARY->delete($delete_id);
Please login to merge, or discard this patch.
www/docs/admin/policies.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 include_once '../../includes/easyparliament/init.php';
4 4
 #include_once INCLUDESPATH . 'easyparliament/commentreportlist.php';
5 5
 #include_once INCLUDESPATH . 'easyparliament/searchengine.php';
6
-include_once INCLUDESPATH . 'easyparliament/member.php';
6
+include_once INCLUDESPATH.'easyparliament/member.php';
7 7
 #include_once INCLUDESPATH . 'easyparliament/people.php';
8 8
 
9 9
 $this_page = 'admin_policies';
@@ -47,24 +47,24 @@  discard block
 block discarded – undo
47 47
 
48 48
     for ($row = 0; $row < $q->rows(); $row++) {
49 49
 
50
-        $out = "<h3>Edit policy: " . $q->field($row, 'title') . "</h3>\n";
50
+        $out = "<h3>Edit policy: ".$q->field($row, 'title')."</h3>\n";
51 51
 
52
-        $out .= '<form action="policies.php?editpolicy=' . $q->field($row, 'policy_id') . '" method="post">';
52
+        $out .= '<form action="policies.php?editpolicy='.$q->field($row, 'policy_id').'" method="post">';
53 53
         $out .= '<input name="action" type="hidden" value="Save">';
54 54
         $out .= '<p><label for="title">Title: </label>';
55
-        $out .= '<span class="formw"><input id="title-textbox" name="title" type="text"  size="60" value="' . htmlentities($q->field($row, 'title')) . '"></span>' . "</p>\n";
55
+        $out .= '<span class="formw"><input id="title-textbox" name="title" type="text"  size="60" value="'.htmlentities($q->field($row, 'title')).'"></span>'."</p>\n";
56 56
         $out .= '<p><label for="description">Description</label><br>';
57
-        $out .= '<span class="formw"><textarea id="description" name="description" rows="10" cols="100">' . htmlentities($q->field($row, 'description')) . '</textarea></span>' . "</p>\n";
57
+        $out .= '<span class="formw"><textarea id="description" name="description" rows="10" cols="100">'.htmlentities($q->field($row, 'description')).'</textarea></span>'."</p>\n";
58 58
         $out .= '<p><label for="image">Image URL: </label>';
59
-        $out .= '<span class="formw"><input id="image" name="image" type="text"  size="60" value="' . htmlentities($q->field($row, 'image')) . '"></span>' . "</p>\n";
59
+        $out .= '<span class="formw"><input id="image" name="image" type="text"  size="60" value="'.htmlentities($q->field($row, 'image')).'"></span>'."</p>\n";
60 60
         $out .= '<p><label for="image_attrib">Image attribution: </label>';
61
-        $out .= '<span class="formw"><input id="image_attrib" name="image_attrib" type="text"  size="60" value="' . htmlentities($q->field($row, 'image_attrib')) . '"></span>' . "</p>\n";
61
+        $out .= '<span class="formw"><input id="image_attrib" name="image_attrib" type="text"  size="60" value="'.htmlentities($q->field($row, 'image_attrib')).'"></span>'."</p>\n";
62 62
         $out .= '<p><label for="image_license">Image license: </label>';
63
-        $out .= '<span class="formw"><input id="image_license" name="image_license" type="text"  size="60" value="' . htmlentities($q->field($row, 'image_license')) . '"></span>' . "</p>\n";
63
+        $out .= '<span class="formw"><input id="image_license" name="image_license" type="text"  size="60" value="'.htmlentities($q->field($row, 'image_license')).'"></span>'."</p>\n";
64 64
         $out .= '<p><label for="image_license_url">Image license URL: </label>';
65
-        $out .= '<span class="formw"><input id="image_license_url" name="image_license_url" type="text"  size="60" value="' . htmlentities($q->field($row, 'image_license_url')) . '"></span>' . "</p>\n";
65
+        $out .= '<span class="formw"><input id="image_license_url" name="image_license_url" type="text"  size="60" value="'.htmlentities($q->field($row, 'image_license_url')).'"></span>'."</p>\n";
66 66
         $out .= '<p><label for="image_source">Image source: </label>';
67
-        $out .= '<span class="formw"><input id="image_source" name="image_source" type="text"  size="60" value="' . htmlentities($q->field($row, 'image_source')) . '"></span>' . "</p>\n";
67
+        $out .= '<span class="formw"><input id="image_source" name="image_source" type="text"  size="60" value="'.htmlentities($q->field($row, 'image_source')).'"></span>'."</p>\n";
68 68
         $out .= '<p><span class="formw"><input name="btnaction" type="submit" value="Save"></span>';
69 69
         $out .= '</form>';
70 70
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     for ($row = 0; $row < $q->rows(); $row++) {
82 82
         $out .= '<li style="margin-bottom: 1em;">';
83 83
         $out .= sprintf('<strong>%d</strong>: %s - %s', $q->field($row, 'policy_id'), htmlentities($q->field($row, 'title')), htmlentities($q->field($row, 'description')));
84
-        $out .= ' <small>[<a href="policies.php?editpolicy=' . $q->field($row, 'policy_id') . '">Edit Policy</a>]</small>';
84
+        $out .= ' <small>[<a href="policies.php?editpolicy='.$q->field($row, 'policy_id').'">Edit Policy</a>]</small>';
85 85
         $out .= "</li>\n";
86 86
     }
87 87
     $out .= '</ul>';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         )
111 111
     );
112 112
 
113
-    if ( $q->success() ) {
113
+    if ($q->success()) {
114 114
         $out = "<h4>update successful</h4>";
115 115
     }
116 116
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 
126 126
     $rettext .= '<div id="subnav_websites">';
127 127
     foreach ($subnav as $label => $path) {
128
-        $rettext .=  '<a href="'. $path . '">'. $label .'</a>';
128
+        $rettext .= '<a href="'.$path.'">'.$label.'</a>';
129 129
     }
130
-    $rettext .=  '</div>';
130
+    $rettext .= '</div>';
131 131
 
132 132
     return $rettext;
133 133
 }
Please login to merge, or discard this patch.
www/docs/admin/photos.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 include_once '../../includes/easyparliament/init.php';
4
-include_once INCLUDESPATH . 'easyparliament/commentreportlist.php';
5
-include_once INCLUDESPATH . 'easyparliament/searchengine.php';
6
-include_once INCLUDESPATH . 'easyparliament/member.php';
7
-include_once INCLUDESPATH . 'easyparliament/people.php';
4
+include_once INCLUDESPATH.'easyparliament/commentreportlist.php';
5
+include_once INCLUDESPATH.'easyparliament/searchengine.php';
6
+include_once INCLUDESPATH.'easyparliament/member.php';
7
+include_once INCLUDESPATH.'easyparliament/people.php';
8 8
 
9 9
 $this_page = 'admin_photos';
10 10
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
     if ($errors)
74 74
         return display_photo_form($errors);
75
-    return "<p><em>Photo uploaded and resized for pid $pid</em> &mdash; check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>" . display_photo_form();
75
+    return "<p><em>Photo uploaded and resized for pid $pid</em> &mdash; check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>".display_photo_form();
76 76
 }
77 77
 
78 78
 function person_drop_down() {
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 
95 95
     $houses = array(1 => 'MP', 'Lord', 'MLA', 'MSP');
96 96
 
97
-    for ($i=0; $i<$q->rows(); $i++) {
97
+    for ($i = 0; $i < $q->rows(); $i++) {
98 98
         $p_id = $q->field($i, 'person_id');
99 99
         $house = $q->field($i, 'house');
100
-        $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) .
101
-                " " . $houses[$house];
102
-        if ($q->field($i, 'party')) $desc .= ' (' . $q->field($i, 'party') . ')';
100
+        $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')).
101
+                " ".$houses[$house];
102
+        if ($q->field($i, 'party')) $desc .= ' ('.$q->field($i, 'party').')';
103 103
         if ($q->field($i, 'constituency')) {
104
-            $desc .= ', ' . $q->field($i, 'constituency');
104
+            $desc .= ', '.$q->field($i, 'constituency');
105 105
         }
106 106
 
107 107
         list($dummy, $sz) = MySociety\TheyWorkForYou\Utility\Member::findMemberImage($p_id);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         } else {
113 113
             $desc .= ' [no photo]';
114 114
         }
115
-        $out .= '<option value="'.$p_id.'">'.$desc.'</option>' . "\n";
115
+        $out .= '<option value="'.$p_id.'">'.$desc.'</option>'."\n";
116 116
     }
117 117
 
118 118
     $out .= ' </select></span> </div> ';
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 function display_photo_form($errors = array()) {
124 124
     $out = '';
125 125
     if ($errors) {
126
-        $out .= '<ul class="error"><li>' . join('</li><li>', $errors) . '</li></ul>';
126
+        $out .= '<ul class="error"><li>'.join('</li><li>', $errors).'</li></ul>';
127 127
     }
128 128
     $out .= '<form method="post" action="photos.php" enctype="multipart/form-data">';
129 129
     $out .= person_drop_down();
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
         ':attr_link' => $attr_link
170 170
         ));
171 171
 
172
-    return "<p><em>Attribution text/link set for pid $pid</em> &mdash; check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>" . display_attribution_form();
172
+    return "<p><em>Attribution text/link set for pid $pid</em> &mdash; check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>".display_attribution_form();
173 173
 }
174 174
 
175 175
 function display_attribution_form($errors = array()) {
176 176
     $out = '';
177 177
     if ($errors) {
178
-        $out .= '<ul class="error"><li>' . join('</li><li>', $errors) . '</li></ul>';
178
+        $out .= '<ul class="error"><li>'.join('</li><li>', $errors).'</li></ul>';
179 179
     }
180 180
     $out .= '<form method="post" action="photos.php">';
181 181
     $out .= person_drop_down();
Please login to merge, or discard this patch.
Braces   +36 added lines, -26 removed lines patch added patch discarded remove patch
@@ -36,28 +36,33 @@  discard block
 block discarded – undo
36 36
     $pid = intval(get_http_var('pid'));
37 37
     $errors = array();
38 38
 
39
-    if (!array_key_exists('photo', $_FILES))
40
-        array_push($errors, 'Not got the photo.');
41
-    elseif ($_FILES['photo']['error'] > 0)
42
-        array_push($errors, 'There was an error uploading the photo.');
43
-    elseif (!is_uploaded_file($_FILES['photo']['tmp_name']))
44
-        array_push($errors, 'Did not get an uploaded file.');
45
-    else {
39
+    if (!array_key_exists('photo', $_FILES)) {
40
+            array_push($errors, 'Not got the photo.');
41
+    } elseif ($_FILES['photo']['error'] > 0) {
42
+            array_push($errors, 'There was an error uploading the photo.');
43
+    } elseif (!is_uploaded_file($_FILES['photo']['tmp_name'])) {
44
+            array_push($errors, 'Did not get an uploaded file.');
45
+    } else {
46 46
         $tmp_name = $_FILES['photo']['tmp_name'];
47 47
 
48 48
         $image = new Imagick();
49 49
         $image->readImage($tmp_name);
50
-        if (!$image)
51
-            array_push($errors, 'Failed to read image from uploaded file');
50
+        if (!$image) {
51
+                    array_push($errors, 'Failed to read image from uploaded file');
52
+        }
52 53
             $imageS = clone $image;
53
-        if (!$image->scaleImage(0, 118))
54
-            array_push($errors, 'Scaling large failed');
55
-        if (!$imageS->scaleImage(0, 59))
56
-            array_push($errors, 'Scaling small failed');
57
-        if (!$image->writeImage("$dir/mpsL/$pid.jpeg"))
58
-            array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed");
59
-        if (!$imageS->writeImage("$dir/mps/$pid.jpeg"))
60
-            array_push($errors, "Saving to $dir/mps/$pid.jpeg failed");
54
+        if (!$image->scaleImage(0, 118)) {
55
+                    array_push($errors, 'Scaling large failed');
56
+        }
57
+        if (!$imageS->scaleImage(0, 59)) {
58
+                    array_push($errors, 'Scaling small failed');
59
+        }
60
+        if (!$image->writeImage("$dir/mpsL/$pid.jpeg")) {
61
+                    array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed");
62
+        }
63
+        if (!$imageS->writeImage("$dir/mps/$pid.jpeg")) {
64
+                    array_push($errors, "Saving to $dir/mps/$pid.jpeg failed");
65
+        }
61 66
         if (!$errors) {
62 67
             print "<pre>";
63 68
             chdir($dir);
@@ -70,8 +75,9 @@  discard block
 block discarded – undo
70 75
         }
71 76
     }
72 77
 
73
-    if ($errors)
74
-        return display_photo_form($errors);
78
+    if ($errors) {
79
+            return display_photo_form($errors);
80
+    }
75 81
     return "<p><em>Photo uploaded and resized for pid $pid</em> &mdash; check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>" . display_photo_form();
76 82
 }
77 83
 
@@ -99,7 +105,9 @@  discard block
 block discarded – undo
99 105
         $house = $q->field($i, 'house');
100 106
         $desc = member_full_name($house, $q->field($i, 'title'), $q->field($i, 'given_name'), $q->field($i, 'family_name'), $q->field($i, 'lordofname')) .
101 107
                 " " . $houses[$house];
102
-        if ($q->field($i, 'party')) $desc .= ' (' . $q->field($i, 'party') . ')';
108
+        if ($q->field($i, 'party')) {
109
+            $desc .= ' (' . $q->field($i, 'party') . ')';
110
+        }
103 111
         if ($q->field($i, 'constituency')) {
104 112
             $desc .= ', ' . $q->field($i, 'constituency');
105 113
         }
@@ -150,13 +158,15 @@  discard block
 block discarded – undo
150 158
     $attr_link = get_http_var('attr_link');
151 159
     $errors = array();
152 160
 
153
-    if (!$pid || !$attr_text)
154
-        array_push($errors, 'Missing information');
155
-    elseif ($attr_link && substr($attr_link, 0, 4) != 'http')
156
-        array_push($errors, 'Bad link');
161
+    if (!$pid || !$attr_text) {
162
+            array_push($errors, 'Missing information');
163
+    } elseif ($attr_link && substr($attr_link, 0, 4) != 'http') {
164
+            array_push($errors, 'Bad link');
165
+    }
157 166
 
158
-    if ($errors)
159
-        return display_attribution_form($errors);
167
+    if ($errors) {
168
+            return display_attribution_form($errors);
169
+    }
160 170
 
161 171
     # UPDATE
162 172
     global $db;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 </form>
140 140
 
141 141
 <p style="clear:both; margin-top: 3em"><a href="/images/mps/photo-status.php">List MPs without photos</a></p>
142
-EOF;
142
+eof;
143 143
 
144 144
     return $out;
145 145
 }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     <span class="formw"><input type="submit" name="submit" value="Update attribution"></span>
194 194
 </div>
195 195
 </form>
196
-EOF;
196
+eof;
197 197
 
198 198
     return $out;
199 199
 }
Please login to merge, or discard this patch.
www/docs/admin/searchlogs.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     $host = trim_characters($host, strlen($host) - 25, 100);
19 19
     $time = relative_time($row['query_time']);
20 20
     $time = str_replace(" ago", "", $time);
21
-    $rows[] = array (
22
-        '<a href="'.$row['url'].'">' . _htmlentities($row['query']) . '</a>',
21
+    $rows[] = array(
22
+        '<a href="'.$row['url'].'">'._htmlentities($row['query']).'</a>',
23 23
         $row['page_number'],
24 24
         $row['count_hits'],
25 25
         $host,
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
     );
28 28
 }
29 29
 
30
-$tabledata = array (
31
-    'header' => array (
30
+$tabledata = array(
31
+    'header' => array(
32 32
         'Query',
33 33
         'Page',
34 34
         'Hits',
Please login to merge, or discard this patch.