Passed
Pull Request — master (#5599)
by Vitalii
21:21 queued 10:05
created
html/inc/cache.inc 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
         mkdir("../cache", 0770);
33 33
         chmod("../cache", 0770);
34 34
     }
35
-    for ($i=0;$i<256;$i++) {
36
-        $j=sprintf("%02x",$i);
35
+    for ($i = 0; $i < 256; $i++) {
36
+        $j = sprintf("%02x", $i);
37 37
         if (!@filemtime("../cache/$j")) {
38 38
             mkdir("../cache/$j", 0770);
39 39
             chmod("../cache/$j", 0770);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     }
42 42
 }
43 43
 
44
-function get_path($params, $phpfile=null) {
44
+function get_path($params, $phpfile = null) {
45 45
     if (!@filemtime("../cache/00")) make_cache_dirs();
46 46
     if ($phpfile) {
47 47
         $z = $phpfile;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     // add a layer of subdirectories for reducing file lookup time
54
-    $sz = substr(md5($z."_".urlencode($params)),1,2);
54
+    $sz = substr(md5($z."_".urlencode($params)), 1, 2);
55 55
     $path = "../cache/".$sz."/".$z;
56 56
     if ($params) {
57 57
         $path = $path."_".urlencode($params);
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 function disk_usage($dir) {
63
-    $usage=0;
64
-    if ($handle=@opendir($dir)) {
65
-        while ($file=readdir($handle)) {
63
+    $usage = 0;
64
+    if ($handle = @opendir($dir)) {
65
+        while ($file = readdir($handle)) {
66 66
             if (($file != ".") && ($file != "..")) {
67 67
                 if (@is_dir($dir."/".$file)) {
68
-                    $usage+=disk_usage($dir."/".$file);
68
+                    $usage += disk_usage($dir."/".$file);
69 69
                 } else {
70
-                    $usage+=@filesize($dir."/".$file);
70
+                    $usage += @filesize($dir."/".$file);
71 71
                 }
72 72
             }
73 73
         }
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     if (!chdir($dir)) {
82 82
         return;
83 83
     }
84
-    if ($handle=@opendir(".")) {
85
-        while ($file=readdir($handle)) {
84
+    if ($handle = @opendir(".")) {
85
+        while ($file = readdir($handle)) {
86 86
             if ($file == ".") continue;
87 87
             if ($file == "..") continue;
88 88
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             if (@is_dir($file)) {
94 94
                 clean_cache($max_age, $file);
95 95
             } else {
96
-                if ((time()-@filemtime($file))>$max_age) {
96
+                if ((time() - @filemtime($file)) > $max_age) {
97 97
                     //echo "unlinking ".getcwd()."/$file\n";
98 98
                     @unlink($file);
99 99
                 }
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 
108 108
 // check cache size every once in a while, purge if too big
109 109
 //
110
-function cache_check_diskspace(){
111
-    if ((rand() % CACHE_SIZE_CHECK_FREQ)) return;
110
+function cache_check_diskspace() {
111
+    if ((rand()%CACHE_SIZE_CHECK_FREQ)) return;
112 112
     if (disk_usage("../cache") < MAX_CACHE_USAGE) return;
113 113
     $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL,
114 114
         USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     clean_cache($x, "../cache");
117 117
 }
118 118
 
119
-function cache_need_to_regenerate($path, $max_age){
119
+function cache_need_to_regenerate($path, $max_age) {
120 120
     $regenerate = false;
121 121
     $request = apache_request_headers();
122 122
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         // and touch the cached copy so other processes
129 129
         // don't regenerate at the same time
130 130
         //
131
-        if ($lastmodified<time()-$max_age) {
131
+        if ($lastmodified < time() - $max_age) {
132 132
             $regenerate = true;
133 133
             @touch($path);
134 134
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 // Returns cached data or false if nothing was found
142
-function get_cached_data($max_age, $params=""){
142
+function get_cached_data($max_age, $params = "") {
143 143
     global $no_cache;
144 144
 
145 145
     if ($no_cache) return;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             }
156 156
         } else {
157 157
             cache_check_diskspace();
158
-            $regenerate=cache_need_to_regenerate($path, $max_age);
158
+            $regenerate = cache_need_to_regenerate($path, $max_age);
159 159
             if (!$regenerate) {
160 160
                 return file_get_contents($path);
161 161
             }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 // DEPRECATED
168
-function start_cache($max_age, $params=""){
168
+function start_cache($max_age, $params = "") {
169 169
     global $no_cache, $caching, $memcache;
170 170
 
171 171
     if ($no_cache) return;
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
             $regenerate = cache_need_to_regenerate($path, $max_age);
189 189
         }
190 190
         //Is the stored version too old, do we need to regenerate it?
191
-        if ($regenerate){
191
+        if ($regenerate) {
192 192
             // If cached version is too old (or non-existent)
193 193
             // generate the page and write to cache
194 194
             //
195 195
             ob_start();
196 196
             ob_implicit_flush(0);
197
-            Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
198
-            Header("Expires: " . gmdate("D, d M Y H:i:s",time()+$max_age) . " GMT");
199
-            Header("Cache-Control: public, max-age=" . $max_age);
197
+            Header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
198
+            Header("Expires: ".gmdate("D, d M Y H:i:s", time() + $max_age)." GMT");
199
+            Header("Cache-Control: public, max-age=".$max_age);
200 200
 
201 201
             // allow the calling page to see cache period
202 202
             //
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
             if (strstr($params, "format=xml")) {
209 209
                 header('Content-type: text/xml');
210 210
             }
211
-            Header("Last-Modified: " . gmdate("D, d M Y H:i:s",$lastmodified) . " GMT");
212
-            Header("Expires: " . gmdate("D, d M Y H:i:s",$lastmodified+$max_age) . " GMT");
213
-            Header("Cache-Control: public, max-age=" . $max_age );
211
+            Header("Last-Modified: ".gmdate("D, d M Y H:i:s", $lastmodified)." GMT");
212
+            Header("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + $max_age)." GMT");
213
+            Header("Cache-Control: public, max-age=".$max_age);
214 214
             if ($cache && $cache->content) {
215 215
                 echo $cache->content;
216 216
                 exit;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 // write output buffer both to client and to cache
230 230
 // DEPRECATED
231
-function end_cache($max_age,$params=""){
231
+function end_cache($max_age, $params = "") {
232 232
     global $no_cache;
233 233
     if ($no_cache) return;
234 234
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     }
254 254
 }
255 255
 
256
-function set_cached_data($max_age, $data, $params=""){
256
+function set_cached_data($max_age, $data, $params = "") {
257 257
     // for the benefit of hackers
258 258
     if (strstr($params, "..")) {
259 259
         return "bad params";
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
             self::$instance->setOption(Memcached::OPT_PREFIX_KEY, MEMCACHE_PREFIX);
295 295
         }
296 296
         $servers = explode('|', MEMCACHE_SERVERS);
297
-        foreach($servers as &$server) {
297
+        foreach ($servers as &$server) {
298 298
             list($ip, $port) = explode(':', $server);
299 299
             if (!$port) { $port = 11211; }
300 300
             $server = array($ip, $port);
Please login to merge, or discard this patch.
html/inc/forum_banishment_vote.inc 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 db_init();
27 27
 
28 28
 function current_tally($voteid) {
29
-    $query="select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid;
29
+    $query = "select sum(yes) as ayes,count(id)-sum(yes) as nays from banishment_votes where voteid=".$voteid;
30 30
     $result = _mysql_query($query);
31 31
     $foobar = _mysql_fetch_object($result);
32 32
     echo "<b>Current Tally</b>    Ayes: ".$foobar->ayes." Nays: ".$foobar->nays."<p>";
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 
36 36
 function vote_is_in_progress($userid) {
37 37
     // check whether a vote is already ongoing
38
-    $now=time();
39
-    $query="select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now;
38
+    $now = time();
39
+    $query = "select count(id) as count from banishment_vote where userid=".$userid." and end_time>".$now;
40 40
     $result = _mysql_query($query);
41 41
     if (!$result) {
42 42
         echo "Database error attempting to read banishment_vote table 1.<p>";
@@ -51,56 +51,56 @@  discard block
 block discarded – undo
51 51
     return $foobar->count;
52 52
 }
53 53
 
54
-function start_vote($config,$logged_in_user,$user,$category,$reason) {
55
-    $now=time();
56
-    $fin=$now+21600;
54
+function start_vote($config, $logged_in_user, $user, $category, $reason) {
55
+    $now = time();
56
+    $fin = $now + 21600;
57 57
 
58 58
 
59
-    if ( vote_is_in_progress($user->id) !=0 ) {
59
+    if (vote_is_in_progress($user->id) != 0) {
60 60
         echo "A banishment vote is already underway for this user.<p>";
61 61
         return 0;
62 62
     }
63
-    $query="insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")";
63
+    $query = "insert into banishment_vote (userid,modid,start_time,end_time) values (".$user->id.",".$logged_in_user->id.",".$now.",".$fin.")";
64 64
     $result = _mysql_query($query);
65 65
     if (!$result) {
66 66
         echo "Database error attempting to insert to banishment_vote table.<p>";
67 67
         return 0;
68 68
     }
69 69
 
70
-    $voteid=_mysql_insert_id();
71
-    $query="insert into banishment_votes (voteid,modid,time,yes) values (". $voteid .",". $logged_in_user->id .",". $now .",1)";
70
+    $voteid = _mysql_insert_id();
71
+    $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)";
72 72
     $result = _mysql_query($query);
73 73
     if (!$result) {
74 74
         echo "Database error attempting to insert to banishment_votes table.<p>";
75 75
         return 0;
76 76
     }
77 77
 
78
-    $query="update forum_preferences set banished_until=".$fin." where userid=".$user->id;
78
+    $query = "update forum_preferences set banished_until=".$fin." where userid=".$user->id;
79 79
     $result = _mysql_query($query);
80 80
 
81 81
     echo "Banishment vote started.<p><p>";
82 82
     current_tally($voteid);
83
-    return send_banish_vote_email($user, 86400*14, $reason, $now+21600);
83
+    return send_banish_vote_email($user, 86400*14, $reason, $now + 21600);
84 84
 }
85 85
 
86
-function vote_yes($config,$logged_in_user,$user) {
87
-    $now=time();
86
+function vote_yes($config, $logged_in_user, $user) {
87
+    $now = time();
88 88
     // Check that a vote is underway.
89
-    if (vote_is_in_progress($user->id)<1) {
89
+    if (vote_is_in_progress($user->id) < 1) {
90 90
         echo "No banishment vote is underway for this user.<p><p>";
91 91
         return 0;
92 92
     }
93 93
     // Find the voteid
94
-    $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
94
+    $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
95 95
     $result = _mysql_query($query);
96 96
     $foobar = _mysql_fetch_object($result);
97 97
     if (!$foobar) {
98 98
         echo "Database error attempting to read banishment_vote table.<p>";
99 99
         return 0;
100 100
     }
101
-    $voteid=$foobar->voteid;
101
+    $voteid = $foobar->voteid;
102 102
     // Check whether mod has voted already.
103
-    $query="select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id;
103
+    $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id;
104 104
     $result = _mysql_query($query);
105 105
     $foobar = _mysql_fetch_object($result);
106 106
     if (!$foobar) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         return 0;
114 114
     }
115 115
     // insert the vote
116
-    $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",1)";
116
+    $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",1)";
117 117
     $result = _mysql_query($query);
118 118
     if (!$result) {
119 119
         echo "Database error attempting to insert to banishment_votes table.<p>";
@@ -124,24 +124,24 @@  discard block
 block discarded – undo
124 124
     return 1;
125 125
 }
126 126
 
127
-function vote_no($config,$logged_in_user,$user) {
127
+function vote_no($config, $logged_in_user, $user) {
128 128
     // Check that a vote is underway.
129
-    $now=time();
130
-    if (vote_is_in_progress($user->id)<1) {
129
+    $now = time();
130
+    if (vote_is_in_progress($user->id) < 1) {
131 131
         echo "No banishment vote is underway for this user.<p>";
132 132
         return 0;
133 133
     }
134 134
     // Find the voteid
135
-    $query="select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
135
+    $query = "select id as voteid from banishment_vote where userid=".$user->id." and end_time>".$now;
136 136
     $result = _mysql_query($query);
137 137
     $foobar = _mysql_fetch_object($result);
138 138
     if (!$foobar) {
139 139
         echo "Database error attempting to read banishment_vote table.<p>";
140 140
         return 0;
141 141
     }
142
-    $voteid=$foobar->voteid;
142
+    $voteid = $foobar->voteid;
143 143
     // Check whether mod has voted already.
144
-    $query="select count(id) as count from banishment_votes where voteid=".$voteid ." and modid=".$logged_in_user->id;
144
+    $query = "select count(id) as count from banishment_votes where voteid=".$voteid." and modid=".$logged_in_user->id;
145 145
     $result = _mysql_query($query);
146 146
     $foobar = _mysql_fetch_object($result);
147 147
     if (!$foobar) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         return 0;
155 155
     }
156 156
     // insert the vote
157
-    $query="insert into banishment_votes (voteid,modid,time,yes) values (" . $voteid .",". $logged_in_user->id .",". $now .",0)";
157
+    $query = "insert into banishment_votes (voteid,modid,time,yes) values (".$voteid.",".$logged_in_user->id.",".$now.",0)";
158 158
     $result = _mysql_query($query);
159 159
     if (!$result) {
160 160
         echo "Database error attempting to insert to banishment_votes table.<p>";
Please login to merge, or discard this patch.
html/user/forum_search_action.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 // Optionally filters by forum, user, time, or hidden if specified.
32 32
 //
33 33
 function search_thread_titles(
34
-    $keyword_list, $forum="", $user="", $time="", $limit=200,
35
-    $sort_style=CREATE_TIME_NEW, $show_hidden = false
36
-){
37
-    $search_string="%";
34
+    $keyword_list, $forum = "", $user = "", $time = "", $limit = 200,
35
+    $sort_style = CREATE_TIME_NEW, $show_hidden = false
36
+) {
37
+    $search_string = "%";
38 38
     foreach ($keyword_list as $key => $word) {
39 39
         $search_string .= BoincDb::escape_string($word)."%";
40 40
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     if (!$show_hidden) {
52 52
         $query .= " and thread.hidden = 0";
53 53
     }
54
-    switch($sort_style) {
54
+    switch ($sort_style) {
55 55
     case MODIFIED_NEW:
56 56
         $query .= ' ORDER BY timestamp DESC';
57 57
         break;
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
 //
85 85
 function search_post_content(
86 86
     $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden
87
-){
87
+) {
88 88
     $db = BoincDb::get();
89 89
 
90
-    $search_string="%";
91
-    foreach ($keyword_list as $key => $word){
90
+    $search_string = "%";
91
+    foreach ($keyword_list as $key => $word) {
92 92
         $search_string .= BoincDb::escape_string($word)."%";
93 93
     }
94 94
     $optional_join = "";
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
     }
101 101
     $query = "select post.* from ".$db->db_name.".post".$optional_join." where content like '".$search_string."'";
102 102
     if ($forum) {
103
-        $query.=" and forum = $forum->id";
103
+        $query .= " and forum = $forum->id";
104 104
     }
105 105
     if ($user) {
106
-        $query.=" and post.user = $user->id ";
106
+        $query .= " and post.user = $user->id ";
107 107
     }
108 108
     if ($time) {
109
-        $query.=" and post.timestamp > $time";
109
+        $query .= " and post.timestamp > $time";
110 110
     }
111 111
     if (!$show_hidden) {
112 112
         $query .= " AND post.hidden = 0";
113 113
     }
114
-    switch($sort_style) {
114
+    switch ($sort_style) {
115 115
     case VIEWS_MOST:
116
-        $query.= ' ORDER BY views DESC';
116
+        $query .= ' ORDER BY views DESC';
117 117
         break;
118 118
     case CREATE_TIME_NEW:
119 119
         $query .= ' ORDER by post.timestamp desc';
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
         $query .= ' ORDER BY post.timestamp DESC';
129 129
         break;
130 130
     }
131
-    $query.= " limit $limit";
131
+    $query .= " limit $limit";
132 132
     return BoincPost::enum_general($query);
133 133
 }
134 134
 
135 135
 $logged_in_user = get_logged_in_user(false);
136 136
 BoincForumPrefs::lookup($logged_in_user);
137
-if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){
137
+if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) {
138 138
     $show_hidden_posts = true;
139 139
 } else {
140 140
     $show_hidden_posts = false;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 $search_max_time = post_int("search_max_time");
148 148
 $search_forum = post_int("search_forum");
149 149
 $search_sort = post_int("search_sort");
150
-$search_list = explode(" ",$search_keywords);
150
+$search_list = explode(" ", $search_keywords);
151 151
 if ($search_max_time) {
152 152
     $min_timestamp = time() - ($search_max_time*3600*24);
153 153
 } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
 $limit = 100;
158 158
 
159
-if ($search_forum==-1){
159
+if ($search_forum == -1) {
160 160
     $forum = null;
161 161
 } else if ($search_forum) {
162 162
     $forum = BoincForum::lookup_id($search_forum);
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 
174 174
 // Display the threads while we search for posts
175 175
 //
176
-if (count($threads)){
177
-    echo "<h3>" . tra("Thread titles matching your query:") . "</h3>";
176
+if (count($threads)) {
177
+    echo "<h3>".tra("Thread titles matching your query:")."</h3>";
178 178
     show_thread_and_context_header();
179
-    foreach ($threads as $thread){
179
+    foreach ($threads as $thread) {
180 180
         if ($thread->hidden) continue;
181 181
         show_thread_and_context($thread, $logged_in_user);
182 182
     }
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
     $show_hidden_posts
193 193
 );
194 194
 
195
-if (count($posts)){
196
-    echo "<h3>" . tra("Messages matching your query:") . "</h3>";
195
+if (count($posts)) {
196
+    echo "<h3>".tra("Messages matching your query:")."</h3>";
197 197
     start_table();
198 198
     $n = 1;
199 199
     $options = get_output_options($logged_in_user);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     end_table();
216 216
 }
217 217
 
218
-if (!count($threads) && !count($posts)){
218
+if (!count($threads) && !count($posts)) {
219 219
     echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p>
220 220
     <p>"
221 221
     .tra("You can also %1 try the same search on Google. %2",
@@ -226,5 +226,5 @@  discard block
 block discarded – undo
226 226
 echo "<p><a href=\"forum_search.php\">".tra("Perform another search")."</a></p>";
227 227
 page_tail();
228 228
 
229
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
229
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
230 230
 ?>
Please login to merge, or discard this patch.
html/user/download_network.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
25 25
 page_head(tra("Download BOINC add-on software"));
26 26
 echo "
27 27
     <p>" .
28
-    tra("You can download applications in several categories.") ."
28
+    tra("You can download applications in several categories.")."
29 29
     <ul>
30 30
     <li>".
31
-    tra("These applications are not endorsed by %1 and you use them at your own risk.", PROJECT) ."
31
+    tra("These applications are not endorsed by %1 and you use them at your own risk.", PROJECT)."
32 32
     <li>" .
33 33
     tra("We do not provide instructions for installing these applications.
34 34
 However, the author may have provided some help on installing or uninstalling the application.
35 35
 If this is not enough you should contact the author.").
36 36
     tra("Instructions for installing and running BOINC are %1 here %2.", "<a href=https://boinc.berkeley.edu/download.php>", "</a>")
37
-    . "<li>" .
38
-    tra("This list is managed centrally at %1 the BOINC website %2.", "<a href=\"https://boinc.berkeley.edu/addons.php\">", "</a>") ."
37
+    . "<li>".
38
+    tra("This list is managed centrally at %1 the BOINC website %2.", "<a href=\"https://boinc.berkeley.edu/addons.php\">", "</a>")."
39 39
     </ul>
40 40
 ";
41 41
 
Please login to merge, or discard this patch.
html/user/edit_forum_preferences_form.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 // ------------ Notification -----------
39 39
 
40 40
 row1(tra("Notifications"));
41
-$ch0 = $user->prefs->pm_notification==0?"checked":"";
42
-$ch1 = $user->prefs->pm_notification==1?"checked":"";
43
-$ch2 = $user->prefs->pm_notification==2?"checked":"";
41
+$ch0 = $user->prefs->pm_notification == 0 ? "checked" : "";
42
+$ch1 = $user->prefs->pm_notification == 1 ? "checked" : "";
43
+$ch2 = $user->prefs->pm_notification == 2 ? "checked" : "";
44 44
 row2(
45 45
     tra("How should we notify you of new private messages, friend requests, posts in subscribed threads, and other events?"),
46 46
     "<input type=radio name=pm_notification value=0 $ch0> ".tra("On my Account page (no email)")."
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 // ------------ Forum identity -----------
54 54
 
55 55
 $select_0 = $select_1 = $select_2 = "";
56
-if (strlen($user->prefs->avatar)){
57
-    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar
56
+if (strlen($user->prefs->avatar)) {
57
+    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18) == "//www.gravatar.com") { // Gravatar
58 58
         $select_1 = "checked=\"true\"";
59 59
     } else {
60 60
         $select_2 = "checked=\"true\"";
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
     <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2.">
74 74
         <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">"
75 75
 );
76
-if (strlen($user->prefs->avatar)){
76
+if (strlen($user->prefs->avatar)) {
77 77
     row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>",
78 78
     "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">");
79 79
 }
80 80
 
81
-$signature_by_default = $user->prefs->no_signature_by_default==false?"checked=\"checked\"":"";
81
+$signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : "";
82 82
 
83
-$signature=$user->prefs->signature;
84
-$maxlen=250;
83
+$signature = $user->prefs->signature;
84
+$maxlen = 250;
85 85
 row2(
86 86
     tra("Signature for message board posts")
87 87
     .bbcode_info()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     textarea_with_counter("signature", 250, $signature)
93 93
     ."<br><input type=\"checkbox\" name=\"signature_by_default\" ".$signature_by_default."> ".tra("Attach signature by default")
94 94
 );
95
-if ($user->prefs->signature!=""){
95
+if ($user->prefs->signature != "") {
96 96
     row2(tra("Signature preview").
97 97
         "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>",
98 98
         output_transform($user->prefs->signature)
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 
102 102
 // ------------ Message display  -----------
103 103
 
104
-$forum_hide_avatars = $user->prefs->hide_avatars?"checked=\"checked\"":"";
105
-$forum_hide_signatures = $user->prefs->hide_signatures?"checked=\"checked\"":"";
106
-$forum_link_popup = $user->prefs->link_popup?"checked=\"checked\"":"";
107
-$forum_image_as_link = $user->prefs->images_as_links?"checked=\"checked\"":"";
108
-$forum_jump_to_unread = $user->prefs->jump_to_unread?"checked=\"checked\"":"";
109
-$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts?"checked=\"checked\"":"";
110
-$forum_highlight_special = $user->prefs->highlight_special?"checked=\"checked\"":"";
104
+$forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : "";
105
+$forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : "";
106
+$forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : "";
107
+$forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : "";
108
+$forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : "";
109
+$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : "";
110
+$forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : "";
111 111
 
112 112
 $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount);
113 113
 $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 $filtered_userlist = get_ignored_list($user);
140 140
 $forum_filtered_userlist = "";
141
-for ($i=0; $i<sizeof($filtered_userlist); $i++){
141
+for ($i = 0; $i < sizeof($filtered_userlist); $i++) {
142 142
     $id = (int)$filtered_userlist[$i];
143 143
     if ($id) {
144 144
         $filtered_user = BoincUser::lookup_id($id);
@@ -168,5 +168,5 @@  discard block
 block discarded – undo
168 168
 end_table();
169 169
 page_tail();
170 170
 
171
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
171
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
172 172
 ?>
Please login to merge, or discard this patch.
html/user/forum_search.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
     </select>");
57 57
 
58 58
 $forumid = null;
59
-if (get_str("forumid",true)){
59
+if (get_str("forumid", true)) {
60 60
     $forumid = get_str("forumid");
61 61
 }
62
-$forumlist="<option value=\"-1\">".tra("All")."</option>";
62
+$forumlist = "<option value=\"-1\">".tra("All")."</option>";
63 63
 $categories = BoincCategory::enum();
64 64
 foreach ($categories as $category) {
65 65
     $forums = BoincForum::enum("parent_type=0 and category=$category->id");
66 66
     foreach ($forums as $forum) {
67
-        if ($forum->id==$forumid){
68
-            $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>";
67
+        if ($forum->id == $forumid) {
68
+            $forumlist .= "<option selected value=\"".$forum->id."\">".$forum->title."</option>";
69 69
         } else {
70
-            $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>";
70
+            $forumlist .= "<option value=\"".$forum->id."\">".$forum->title."</option>";
71 71
         }
72 72
     }
73 73
 }
@@ -76,22 +76,22 @@  discard block
 block discarded – undo
76 76
     '<select class="form-control" name="search_forum">'.$forumlist.'</select');
77 77
 
78 78
 $sortlist = null;
79
-foreach ($thread_sort_styles as $id => $style){
80
-    if ($id == CREATE_TIME_NEW){
81
-        $sortlist.="<option selected value=\"".$id."\">".$style."</option>";
79
+foreach ($thread_sort_styles as $id => $style) {
80
+    if ($id == CREATE_TIME_NEW) {
81
+        $sortlist .= "<option selected value=\"".$id."\">".$style."</option>";
82 82
     } else {
83
-        $sortlist.="<option value=\"".$id."\">".$style."</option>";
83
+        $sortlist .= "<option value=\"".$id."\">".$style."</option>";
84 84
     }
85 85
 }
86 86
 row2(tra("Sort by"),
87 87
     '<select class="form-control" name="search_sort">'.$sortlist.'</select');
88 88
 
89 89
 row1("&nbsp;");
90
-row2("","<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
90
+row2("", "<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
91 91
 echo "</form>";
92 92
 end_table();
93 93
 
94 94
 page_tail();
95 95
 
96
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
96
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
97 97
 ?>
Please login to merge, or discard this patch.
html/user/forum_moderate_post.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 start_table();
50 50
 
51 51
 $get_reason = true;
52
-if (get_str('action')=="hide") {
52
+if (get_str('action') == "hide") {
53 53
     //display input that selects reason
54 54
     echo "<input type=hidden name=action value=hide>";
55 55
     row1(tra("Hide post"));
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
             )
67 67
         )
68 68
     );
69
-} elseif (get_str('action')=="move") {
69
+} elseif (get_str('action') == "move") {
70 70
     row1(tra("Move post"));
71 71
     echo "<input type=hidden name=action value=move>";
72 72
     row2(tra("Destination thread ID:"), "<input name=\"threadid\">");
73 73
     // TODO: display where to move the post as a dropdown instead of having to get ID
74
-} elseif (get_str('action')=="banish_user") {
74
+} elseif (get_str('action') == "banish_user") {
75 75
     $userid = get_int('userid');
76 76
     $user = BoincUser::lookup_id($userid);
77 77
     BoincForumPrefs::lookup($user);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         error_page("no user found");
80 80
     }
81 81
     $x = $user->prefs->banished_until;
82
-    if ($x>time()) {
82
+    if ($x > time()) {
83 83
         error_page(tra("User is already banished"));
84 84
     }
85 85
     row1(tra("Banish user"));
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     echo "<input type=\"hidden\" name=\"id\" value=\"".$postid."\">\n";
98 98
     echo "<input type=\"hidden\" name=\"userid\" value=\"".$userid."\">\n";
99 99
     echo "<input type=\"hidden\" name=\"confirmed\" value=\"yes\">\n";
100
-} elseif (get_str('action')=="delete") {
100
+} elseif (get_str('action') == "delete") {
101 101
     echo "<input type=hidden name=action value=delete>";
102 102
     row2(
103 103
         "Are you sure want to delete this post?  This cannot be undone.",
Please login to merge, or discard this patch.
html/user/team_search.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 // where team includes a field "refcnt".
32 32
 //
33 33
 function merge_lists($list1, &$list2, $weight) {
34
-    foreach($list1 as $team) {
34
+    foreach ($list1 as $team) {
35 35
         $id = $team->id;
36 36
         if (array_key_exists($id, $list2)) {
37 37
             $list2[$id]->refcnt += $weight;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         if (defined("SHOW_NONVALIDATED_TEAMS")) {
98 98
             $user = BoincUser::lookup_id($team->userid);
99 99
             echo "<td>";
100
-            echo $user->email_validated?"Yes":"No";
100
+            echo $user->email_validated ? "Yes" : "No";
101 101
             echo "</td>\n";
102 102
         }
103 103
         echo "
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     xml_header();
138 138
     echo "<teams>\n";
139 139
     sort_list($list);
140
-    foreach($list as $team) {
140
+    foreach ($list as $team) {
141 141
         show_team_xml($team);
142 142
     }
143 143
     echo "</teams>\n";
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
         merge_lists($list2, $list, 3);
165 165
         $tried = true;
166 166
     }
167
-    if (strlen($params->country) && $params->country!='None') {
167
+    if (strlen($params->country) && $params->country != 'None') {
168 168
         $country = BoincDb::escape_string($params->country);
169 169
         $list2 = get_teams("country = '$country'", $params->active);
170 170
         //echo "<br>country matches: ",sizeof($list2);
171 171
         merge_lists($list2, $list, 1);
172 172
         $tried = true;
173 173
     }
174
-    if ($params->type and $params->type>1) {
174
+    if ($params->type and $params->type > 1) {
175 175
         $list2 = get_teams("type=$params->type", $params->active);
176 176
         //echo "<br>type matches: ",sizeof($list2);
177 177
         merge_lists($list2, $list, 2);
Please login to merge, or discard this patch.
html/user/forum_thread_status.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
 }
36 36
 
37 37
 $owner = BoincUser::lookup_id($thread->owner);
38
-if ($logged_in_user->id == $owner->id){
38
+if ($logged_in_user->id == $owner->id) {
39 39
     $action = get_str("action");
40 40
     if ($action == "set") {
41 41
         $ret = $thread->update("status=1");
42 42
     } else {
43 43
         $ret = $thread->update("status=0");
44 44
     }
45
-    if (!$ret){
45
+    if (!$ret) {
46 46
         error_page("Could not update the status of the thread: ".$thread->id);
47 47
     }
48 48
 } else {
Please login to merge, or discard this patch.