Passed
Pull Request — master (#4685)
by
unknown
09:55
created
html/inc/keywords.inc 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -24,71 +24,71 @@
 block discarded – undo
24 24
 define('KW_CATEGORY_SCIENCE', 0);
25 25
 define('KW_CATEGORY_LOC', 1);
26 26
 
27
-define('KW_ASTRONOMY',      1);
28
-define('KW_SETI',           2);
29
-define('KW_PULSARS',        3);
30
-define('KW_GW',             4);
31
-define('KW_COSMOLOGY',      5);
32
-define('KW_PHYSICS',        6);
27
+define('KW_ASTRONOMY', 1);
28
+define('KW_SETI', 2);
29
+define('KW_PULSARS', 3);
30
+define('KW_GW', 4);
31
+define('KW_COSMOLOGY', 5);
32
+define('KW_PHYSICS', 6);
33 33
 define('KW_PARTICLE_PHYSICS', 7);
34
-define('KW_NANOSCIENCE',    8);
35
-define('KW_BIOMED',         9);
34
+define('KW_NANOSCIENCE', 8);
35
+define('KW_BIOMED', 9);
36 36
 define('KW_DRUG_DISCOVERY', 10);
37
-define('KW_PROTEINS',       11);
38
-define('KW_GENETICS',       12);
39
-define('KW_DISEASE',        13);
40
-define('KW_CANCER',         14);
41
-define('KW_MATH_CS',        15);
42
-define('KW_AI',             16);
43
-define('KW_OCEANIA',        17);
44
-define('KW_AUSTRALIA',      18);
37
+define('KW_PROTEINS', 11);
38
+define('KW_GENETICS', 12);
39
+define('KW_DISEASE', 13);
40
+define('KW_CANCER', 14);
41
+define('KW_MATH_CS', 15);
42
+define('KW_AI', 16);
43
+define('KW_OCEANIA', 17);
44
+define('KW_AUSTRALIA', 18);
45 45
 
46
-define('KW_EUROPE',         20);
47
-define('KW_GERMANY',        21);
48
-define('KW_ASIA',           22);
49
-define('KW_AMERICAS',       23);
50
-define('KW_US',             24);
51
-define('KW_UCB',            25);
52
-define('KW_AEI',            26);
53
-define('KW_CERN',           27);
54
-define('KW_UW',             28);
55
-define('KW_EARTH_SCI',      29);
56
-define('KW_SPAIN',          30);
57
-define('KW_SAN_JORGE',      31);
58
-define('KW_NUMBER_THEORY',  32);
59
-define('KW_CRYPTO',         33);
60
-define('KW_ENV_RESEARCH',   34);
61
-define('KW_CLIMATE',        35);
62
-define('KW_CZECH',          36);
46
+define('KW_EUROPE', 20);
47
+define('KW_GERMANY', 21);
48
+define('KW_ASIA', 22);
49
+define('KW_AMERICAS', 23);
50
+define('KW_US', 24);
51
+define('KW_UCB', 25);
52
+define('KW_AEI', 26);
53
+define('KW_CERN', 27);
54
+define('KW_UW', 28);
55
+define('KW_EARTH_SCI', 29);
56
+define('KW_SPAIN', 30);
57
+define('KW_SAN_JORGE', 31);
58
+define('KW_NUMBER_THEORY', 32);
59
+define('KW_CRYPTO', 33);
60
+define('KW_ENV_RESEARCH', 34);
61
+define('KW_CLIMATE', 35);
62
+define('KW_CZECH', 36);
63 63
 define('KW_CHARLES_PRAGUE', 37);
64
-define('KW_RECHENKRAFT',    38);
65
-define('KW_RHEINMAIN',      39);
66
-define('KW_HUNGARY',        40);
67
-define('KW_IRELAND',        41);
68
-define('KW_UC_DUBLIN',      42);
69
-define('KW_POLAND',         43);
70
-define('KW_RUSSIA',         44);
64
+define('KW_RECHENKRAFT', 38);
65
+define('KW_RHEINMAIN', 39);
66
+define('KW_HUNGARY', 40);
67
+define('KW_IRELAND', 41);
68
+define('KW_UC_DUBLIN', 42);
69
+define('KW_POLAND', 43);
70
+define('KW_RUSSIA', 44);
71 71
 define('KW_SW_STATE_RUSSIA', 45);
72
-define('KW_RAS',            46);
73
-define('KW_PRBB',           47);
74
-define('KW_UK',             48);
75
-define('KW_OXFORD',         49);
76
-define('KW_CHINA',          50);
77
-define('KW_U_DAYTON',       51);
78
-define('KW_WRIGHT_STATE',   52);
79
-define('KW_USC',            53);
80
-define('KW_FULLERTON',      54);
81
-define('KW_ARIZONA_STATE',  55);
82
-define('KW_U_ILLINOIS',     56);
83
-define('KW_U_WARSAW',       57);
84
-define('KW_RPI',            58);
85
-define('KW_INTERNATIONAL',  59);
86
-define('KW_UND',            60);
87
-define('KW_HOLLAND',        61);
88
-define('KW_CHEMISTRY',      62);
89
-define('KW_GAMES',          63);
90
-define('KW_VIRUS',          64);
91
-define('KW_FRANCE',         65);
72
+define('KW_RAS', 46);
73
+define('KW_PRBB', 47);
74
+define('KW_UK', 48);
75
+define('KW_OXFORD', 49);
76
+define('KW_CHINA', 50);
77
+define('KW_U_DAYTON', 51);
78
+define('KW_WRIGHT_STATE', 52);
79
+define('KW_USC', 53);
80
+define('KW_FULLERTON', 54);
81
+define('KW_ARIZONA_STATE', 55);
82
+define('KW_U_ILLINOIS', 56);
83
+define('KW_U_WARSAW', 57);
84
+define('KW_RPI', 58);
85
+define('KW_INTERNATIONAL', 59);
86
+define('KW_UND', 60);
87
+define('KW_HOLLAND', 61);
88
+define('KW_CHEMISTRY', 62);
89
+define('KW_GAMES', 63);
90
+define('KW_VIRUS', 64);
91
+define('KW_FRANCE', 65);
92 92
 
93 93
 $job_keywords = array();
94 94
 
Please login to merge, or discard this patch.
html/inc/language_names.inc 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
     global $language_names;
64 64
     $supported_languages = get_supported_languages();
65 65
     $supported_languages[] = "en";
66
-    $sel = $cur_lang_name?"":"selected";
66
+    $sel = $cur_lang_name ? "" : "selected";
67 67
     echo "
68 68
         <option $sel value=auto>Language: default
69 69
     ";
70 70
     foreach ($language_names as $lang) {
71 71
         if (!in_array($lang[0], $supported_languages)) continue;
72
-        $sel = ($cur_lang_name == $lang[0])?"selected":"";
72
+        $sel = ($cur_lang_name == $lang[0]) ? "selected" : "";
73 73
         if ($lang[0] == "en") {
74 74
             echo "<option $sel value=".$lang[0].">".$lang[1];
75 75
         } else {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 // show a menu of supported languages
83 83
 //
84
-function language_form($cur_lang_name=null) {
84
+function language_form($cur_lang_name = null) {
85 85
     echo '
86 86
         <form name="language" method="get" action="set_language.php">
87 87
         <select class="selectbox form-control" name="lang" onchange="javascript: submit()">
Please login to merge, or discard this patch.
html/inc/bootstrap.inc 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
         // prefix for links; needed for pages not in top dir
142 142
     $user,
143 143
         // logged-in user, if any
144
-    $fixed=false,
144
+    $fixed = false,
145 145
         // if true, navbar is fixed at top of page.
146 146
         // NOTE: if you do this, you must set a global var $fixed_navbar
147 147
         // to true at compile time
148 148
         // (it needs to be set when page_head() is called).
149
-    $inverse=false
149
+    $inverse = false
150 150
         // white on black?
151 151
 ) {
152 152
     global $master_url;
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 // output a panel.
215 215
 // $content_func is a function that generates the panel contents
216 216
 //
217
-function panel($title, $content_func, $class="panel-primary", $body_class="") {
217
+function panel($title, $content_func, $class = "panel-primary", $body_class = "") {
218 218
     echo sprintf('<div class="panel %s">
219 219
         ', $class
220 220
     );
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 // are functions that generate the top, left, and right content
241 241
 // $left_width is the width of left column in 1/12 units.
242 242
 //
243
-function grid($top_func, $left_func, $right_func, $left_width=6) {
243
+function grid($top_func, $left_func, $right_func, $left_width = 6) {
244 244
     echo '
245 245
         <div class="container-fluid">
246 246
     ';
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             </div>
256 256
         ';
257 257
     }
258
-    $right_width = 12-$left_width;
258
+    $right_width = 12 - $left_width;
259 259
     echo '
260 260
         <div class="row">
261 261
         <div class="col-sm-'.$left_width.'">
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
     ';
274 274
 }
275 275
 
276
-function form_start($action, $method='get') {
276
+function form_start($action, $method = 'get') {
277 277
     echo sprintf(
278 278
         '<div class="container">
279 279
         <form class="form-horizontal" method="%s" action="%s">'
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 define('FORM_LEFT_OFFSET', 'col-sm-offset-4');
298 298
 define('FORM_RIGHT_CLASS', 'col-sm-8');
299 299
 
300
-function form_input_text($label, $name, $value='', $type='text', $attrs='', $extra='') {
300
+function form_input_text($label, $name, $value = '', $type = 'text', $attrs = '', $extra = '') {
301 301
     echo sprintf('
302 302
         <div class="form-group">
303 303
             <label class="control-label %s">%s</label>
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     );
325 325
 }
326 326
 
327
-function form_input_textarea($label, $name, $value='') {
327
+function form_input_textarea($label, $name, $value = '') {
328 328
     echo sprintf('
329 329
         <div class="form-group">
330 330
             <label class="control-label %s" for="%s">%s</label>
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     );
374 374
     $n = 0;
375 375
     foreach ($items as $i) {
376
-        $s = ($flags && $flags[$n])?'selected':'';
376
+        $s = ($flags && $flags[$n]) ? 'selected' : '';
377 377
         echo '<option '.$s.' value="'.$i[0].'">'.$i[1].'</option>
378 378
         ';
379 379
         $n++;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 
384 384
 // $items is list of (name, label, checked)
385 385
 //
386
-function form_checkboxes($label, $items, $attrs='') {
386
+function form_checkboxes($label, $items, $attrs = '') {
387 387
     echo sprintf('
388 388
         <div class="form-group">
389 389
             <label class="control-label %s">%s</label>
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
         }
401 401
         echo sprintf('<input %s type="checkbox" name="%s" %s> %s
402 402
             ',
403
-            $attrs, $i[0], $i[2]?"checked":"", $i[1]
403
+            $attrs, $i[0], $i[2] ? "checked" : "", $i[1]
404 404
         );
405 405
     }
406 406
     echo '</div>
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS
420 420
     );
421 421
     foreach ($items as $i) {
422
-        $checked = ($selected == $i[0])?"checked":"";
422
+        $checked = ($selected == $i[0]) ? "checked" : "";
423 423
         echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br>
424 424
             ',
425 425
             $name, $i[0], $checked, $i[1]
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 ';
453 453
 }
454 454
 
455
-function form_submit($text, $attrs='') {
455
+function form_submit($text, $attrs = '') {
456 456
     form_general(
457 457
         "",
458 458
         sprintf('<button %s type="submit" class="btn btn-success">%s</button>',
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
     );
462 462
 }
463 463
 
464
-function form_checkbox($label, $name, $checked=false) {
464
+function form_checkbox($label, $name, $checked = false) {
465 465
     echo sprintf('
466 466
         <div class="form-group">
467 467
             <input type="checkbox" name="%s" %s> &nbsp; <span class="lead">%s</span>
468 468
         </div>
469
-        ', $name, $checked?"checked":"", $label
469
+        ', $name, $checked ? "checked" : "", $label
470 470
     );
471 471
 }
Please login to merge, or discard this patch.
html/user/openid.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 
70 70
     function __construct()
71 71
     {
72
-        $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
72
+        $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
73 73
         $uri = rtrim(preg_replace('#((?<=\?)|&)openid\.[^&]+#', '', $_SERVER['REQUEST_URI']), '?');
74
-        $this->returnUrl = $this->trustRoot . $uri;
74
+        $this->returnUrl = $this->trustRoot.$uri;
75 75
 
76 76
         $this->data = $_POST + $_GET; # OPs may send data as POST or GET.
77 77
 
78
-        if(!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) {
78
+        if (!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) {
79 79
             throw new ErrorException('You must have either https wrappers or curl enabled.');
80 80
         }
81 81
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     {
85 85
         switch ($name) {
86 86
         case 'identity':
87
-            if (strlen($value = trim((String) $value))) {
87
+            if (strlen($value = trim((String)$value))) {
88 88
                 if (preg_match('#^xri:/*#i', $value, $m)) {
89 89
                     $value = substr($value, strlen($m[0]));
90 90
                 } elseif (!preg_match('/^(?:[=@+\$!\(]|https?:)/i', $value)) {
@@ -139,23 +139,23 @@  discard block
 block discarded – undo
139 139
         return !!gethostbynamel($server);
140 140
     }
141 141
 
142
-    protected function request_curl($url, $method='GET', $params=array())
142
+    protected function request_curl($url, $method = 'GET', $params = array())
143 143
     {
144 144
         $params = http_build_query($params, '', '&');
145
-        $curl = curl_init($url . ($method == 'GET' && $params ? '?' . $params : ''));
145
+        $curl = curl_init($url.($method == 'GET' && $params ? '?'.$params : ''));
146 146
         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
147 147
         curl_setopt($curl, CURLOPT_HEADER, false);
148 148
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
149 149
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
150 150
         curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*'));
151 151
 
152
-        if($this->verify_peer !== null) {
152
+        if ($this->verify_peer !== null) {
153 153
             curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
154
-            if($this->capath) {
154
+            if ($this->capath) {
155 155
                 curl_setopt($curl, CURLOPT_CAPATH, $this->capath);
156 156
             }
157 157
 
158
-            if($this->cainfo) {
158
+            if ($this->cainfo) {
159 159
                 curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo);
160 160
             }
161 161
         }
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
         }
172 172
         $response = curl_exec($curl);
173 173
 
174
-        if($method == 'HEAD') {
174
+        if ($method == 'HEAD') {
175 175
             $headers = array();
176
-            foreach(explode("\n", $response) as $header) {
177
-                $pos = strpos($header,':');
176
+            foreach (explode("\n", $response) as $header) {
177
+                $pos = strpos($header, ':');
178 178
                 $name = strtolower(trim(substr($header, 0, $pos)));
179
-                $headers[$name] = trim(substr($header, $pos+1));
179
+                $headers[$name] = trim(substr($header, $pos + 1));
180 180
             }
181 181
 
182 182
             # Updating claimed_id in case of redirections.
183 183
             $effective_url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
184
-            if($effective_url != $url) {
184
+            if ($effective_url != $url) {
185 185
                 $this->identity = $this->claimed_id = $effective_url;
186 186
             }
187 187
 
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
         return $response;
196 196
     }
197 197
 
198
-    protected function request_streams($url, $method='GET', $params=array())
198
+    protected function request_streams($url, $method = 'GET', $params = array())
199 199
     {
200
-        if(!$this->hostExists($url)) {
200
+        if (!$this->hostExists($url)) {
201 201
             throw new ErrorException('Invalid request.');
202 202
         }
203 203
 
204 204
         $params = http_build_query($params, '', '&');
205
-        switch($method) {
205
+        switch ($method) {
206 206
         case 'GET':
207 207
             $opts = array(
208 208
                 'http' => array(
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                     'ignore_errors' => true,
212 212
                 )
213 213
             );
214
-            $url = $url . ($params ? '?' . $params : '');
214
+            $url = $url.($params ? '?'.$params : '');
215 215
             break;
216 216
         case 'POST':
217 217
             $opts = array(
@@ -236,31 +236,31 @@  discard block
 block discarded – undo
236 236
                 ))
237 237
             );
238 238
 
239
-            $url = $url . ($params ? '?' . $params : '');
240
-            $headers_tmp = get_headers ($url);
241
-            if(!$headers_tmp) {
239
+            $url = $url.($params ? '?'.$params : '');
240
+            $headers_tmp = get_headers($url);
241
+            if (!$headers_tmp) {
242 242
                 return array();
243 243
             }
244 244
 
245 245
             # Parsing headers.
246 246
             $headers = array();
247
-            foreach($headers_tmp as $header) {
248
-                $pos = strpos($header,':');
247
+            foreach ($headers_tmp as $header) {
248
+                $pos = strpos($header, ':');
249 249
                 $name = strtolower(trim(substr($header, 0, $pos)));
250
-                $headers[$name] = trim(substr($header, $pos+1));
250
+                $headers[$name] = trim(substr($header, $pos + 1));
251 251
 
252 252
                 # Following possible redirections. The point is just to have
253 253
                 # claimed_id change with them, because get_headers() will
254 254
                 # follow redirections automatically.
255 255
                 # We ignore redirections with relative paths.
256 256
                 # If any known provider uses them, file a bug report.
257
-                if($name == 'location') {
258
-                    if(strpos($headers[$name], 'http') === 0) {
257
+                if ($name == 'location') {
258
+                    if (strpos($headers[$name], 'http') === 0) {
259 259
                         $this->identity = $this->claimed_id = $headers[$name];
260
-                    } elseif($headers[$name][0] == '/') {
260
+                    } elseif ($headers[$name][0] == '/') {
261 261
                         $parsed_url = parse_url($this->claimed_id);
262 262
                         $this->identity =
263
-                        $this->claimed_id = $parsed_url['scheme'] . '://'
263
+                        $this->claimed_id = $parsed_url['scheme'].'://'
264 264
                                           . $parsed_url['host']
265 265
                                           . $headers[$name];
266 266
                     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             return $headers;
273 273
         }
274 274
 
275
-        if($this->verify_peer) {
275
+        if ($this->verify_peer) {
276 276
             $opts += array('ssl' => array(
277 277
                 'verify_peer' => true,
278 278
                 'capath'      => $this->capath,
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
             ));
281 281
         }
282 282
 
283
-        $context = stream_context_create ($opts);
283
+        $context = stream_context_create($opts);
284 284
 
285 285
         return file_get_contents($url, false, $context);
286 286
     }
287 287
 
288
-    protected function request($url, $method='GET', $params=array())
288
+    protected function request($url, $method = 'GET', $params = array())
289 289
     {
290
-        if(function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
290
+        if (function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
291 291
             return $this->request_curl($url, $method, $params);
292 292
         }
293 293
         return $this->request_streams($url, $method, $params);
@@ -296,19 +296,19 @@  discard block
 block discarded – undo
296 296
     protected function build_url($url, $parts)
297 297
     {
298 298
         if (isset($url['query'], $parts['query'])) {
299
-            $parts['query'] = $url['query'] . '&' . $parts['query'];
299
+            $parts['query'] = $url['query'].'&'.$parts['query'];
300 300
         }
301 301
 
302 302
         $url = $parts + $url;
303
-        $url = $url['scheme'] . '://'
304
-             . (empty($url['username'])?''
305
-                 :(empty($url['password'])? "{$url['username']}@"
303
+        $url = $url['scheme'].'://'
304
+             . (empty($url['username']) ? ''
305
+                 :(empty($url['password']) ? "{$url['username']}@"
306 306
                  :"{$url['username']}:{$url['password']}@"))
307 307
              . $url['host']
308
-             . (empty($url['port'])?'':":{$url['port']}")
309
-             . (empty($url['path'])?'':$url['path'])
310
-             . (empty($url['query'])?'':"?{$url['query']}")
311
-             . (empty($url['fragment'])?'':"#{$url['fragment']}");
308
+             . (empty($url['port']) ? '' : ":{$url['port']}")
309
+             . (empty($url['path']) ? '' : $url['path'])
310
+             . (empty($url['query']) ? '' : "?{$url['query']}")
311
+             . (empty($url['fragment']) ? '' : "#{$url['fragment']}");
312 312
         return $url;
313 313
     }
314 314
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*/?>#i", $content, $matches2);
323 323
 
324 324
         $result = array_merge($matches1[1], $matches2[1]);
325
-        return empty($result)?false:$result[0];
325
+        return empty($result) ?false:$result[0];
326 326
     }
327 327
 
328 328
     /**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $yadis = true;
349 349
 
350 350
         # We'll jump a maximum of 5 times, to avoid endless redirections.
351
-        for ($i = 0; $i < 5; $i ++) {
351
+        for ($i = 0; $i < 5; $i++) {
352 352
             if ($yadis) {
353 353
                 $headers = $this->request($url, 'HEAD');
354 354
 
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
                     $content = $this->request($url, 'GET');
371 371
 
372 372
                     preg_match_all('#<Service.*?>(.*?)</Service>#s', $content, $m);
373
-                    foreach($m[1] as $content) {
374
-                        $content = ' ' . $content; # The space is added, so that strpos doesn't return 0.
373
+                    foreach ($m[1] as $content) {
374
+                        $content = ' '.$content; # The space is added, so that strpos doesn't return 0.
375 375
 
376 376
                         # OpenID 2
377 377
                         $ns = preg_quote('http://specs.openid.net/auth/2.0/');
378
-                        if(preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) {
378
+                        if (preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) {
379 379
                             if ($type[1] == 'server') $this->identifier_select = true;
380 380
 
381 381
                             preg_match('#<URI.*?>(.*)</URI>#', $content, $server);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                                 return false;
385 385
                             }
386 386
                             # Does the server advertise support for either AX or SREG?
387
-                            $this->ax   = (bool) strpos($content, '<Type>http://openid.net/srv/ax/1.0</Type>');
387
+                            $this->ax   = (bool)strpos($content, '<Type>http://openid.net/srv/ax/1.0</Type>');
388 388
                             $this->sreg = strpos($content, '<Type>http://openid.net/sreg/1.0</Type>')
389 389
                                        || strpos($content, '<Type>http://openid.net/extensions/sreg/1.1</Type>');
390 390
 
@@ -498,33 +498,33 @@  discard block
 block discarded – undo
498 498
         if ($this->required || $this->optional) {
499 499
             $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
500 500
             $params['openid.ax.mode'] = 'fetch_request';
501
-            $this->aliases  = array();
501
+            $this->aliases = array();
502 502
             $counts   = array();
503 503
             $required = array();
504 504
             $optional = array();
505
-            foreach (array('required','optional') as $type) {
505
+            foreach (array('required', 'optional') as $type) {
506 506
                 foreach ($this->$type as $alias => $field) {
507 507
                     if (is_int($alias)) $alias = strtr($field, '/', '_');
508
-                    $this->aliases[$alias] = 'http://axschema.org/' . $field;
508
+                    $this->aliases[$alias] = 'http://axschema.org/'.$field;
509 509
                     if (empty($counts[$alias])) $counts[$alias] = 0;
510 510
                     $counts[$alias] += 1;
511 511
                     ${$type}[] = $alias;
512 512
                 }
513 513
             }
514 514
             foreach ($this->aliases as $alias => $ns) {
515
-                $params['openid.ax.type.' . $alias] = $ns;
515
+                $params['openid.ax.type.'.$alias] = $ns;
516 516
             }
517 517
             foreach ($counts as $alias => $count) {
518 518
                 if ($count == 1) continue;
519
-                $params['openid.ax.count.' . $alias] = $count;
519
+                $params['openid.ax.count.'.$alias] = $count;
520 520
             }
521 521
 
522 522
             # Don't send empty ax.requied and ax.if_available.
523 523
             # Google and possibly other providers refuse to support ax when one of these is empty.
524
-            if($required) {
524
+            if ($required) {
525 525
                 $params['openid.ax.required'] = implode(',', $required);
526 526
             }
527
-            if($optional) {
527
+            if ($optional) {
528 528
                 $params['openid.ax.if_available'] = implode(',', $optional);
529 529
             }
530 530
         }
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
         # If we have an openid.delegate that is different from our claimed id,
538 538
         # we need to somehow preserve the claimed id between requests.
539 539
         # The simplest way is to just send it along with the return_to url.
540
-        if($this->identity != $this->claimed_id) {
541
-            $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?') . 'openid.claimed_id=' . $this->claimed_id;
540
+        if ($this->identity != $this->claimed_id) {
541
+            $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?').'openid.claimed_id='.$this->claimed_id;
542 542
         }
543 543
 
544 544
         $params = array(
@@ -612,15 +612,15 @@  discard block
 block discarded – undo
612 612
         # by presenting user_setup_url (for 1.1) or reporting
613 613
         # mode 'setup_needed' (for 2.0). Also catching all modes other than
614 614
         # id_res, in order to avoid throwing errors.
615
-        if(isset($this->data['openid_user_setup_url'])) {
615
+        if (isset($this->data['openid_user_setup_url'])) {
616 616
             $this->setup_url = $this->data['openid_user_setup_url'];
617 617
             return false;
618 618
         }
619
-        if($this->mode != 'id_res') {
619
+        if ($this->mode != 'id_res') {
620 620
             return false;
621 621
         }
622 622
 
623
-        $this->claimed_id = isset($this->data['openid_claimed_id'])?$this->data['openid_claimed_id']:$this->data['openid_identity'];
623
+        $this->claimed_id = isset($this->data['openid_claimed_id']) ? $this->data['openid_claimed_id'] : $this->data['openid_identity'];
624 624
         $params = array(
625 625
             'openid.assoc_handle' => $this->data['openid_assoc_handle'],
626 626
             'openid.signed'       => $this->data['openid_signed'],
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
             # If it's an OpenID 1 provider, and we've got claimed_id,
639 639
             # we have to append it to the returnUrl, like authUrl_v1 does.
640 640
             $this->returnUrl .= (strpos($this->returnUrl, '?') ? '&' : '?')
641
-                             .  'openid.claimed_id=' . $this->claimed_id;
641
+                             .  'openid.claimed_id='.$this->claimed_id;
642 642
         }
643 643
 
644 644
         if ($this->data['openid_return_to'] != $this->returnUrl) {
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
             # In such case, validation would fail, since we'd send different data than OP
657 657
             # wants to verify. stripslashes() should solve that problem, but we can't
658 658
             # use it when magic_quotes is off.
659
-            $value = $this->data['openid_' . str_replace('.','_',$item)];
660
-            $params['openid.' . $item] = (version_compare(PHP_VERSION, '5.4.0') < 0 && get_magic_quotes_gpc()) ? stripslashes($value) : $value;
659
+            $value = $this->data['openid_'.str_replace('.', '_', $item)];
660
+            $params['openid.'.$item] = (version_compare(PHP_VERSION, '5.4.0') < 0 && get_magic_quotes_gpc()) ? stripslashes($value) : $value;
661 661
 
662 662
         }
663 663
 
@@ -695,18 +695,18 @@  discard block
 block discarded – undo
695 695
 
696 696
         $attributes = array();
697 697
         foreach ($this->data as $key => $value) {
698
-            $keyMatch = 'openid_' . $alias . '_value_';
698
+            $keyMatch = 'openid_'.$alias.'_value_';
699 699
             if (substr($key, 0, strlen($keyMatch)) != $keyMatch) {
700 700
                 continue;
701 701
             }
702 702
             $key = substr($key, strlen($keyMatch));
703
-            if (!isset($this->data['openid_' . $alias . '_type_' . $key])) {
703
+            if (!isset($this->data['openid_'.$alias.'_type_'.$key])) {
704 704
                 # OP is breaking the spec by returning a field without
705 705
                 # associated ns. This shouldn't happen, but it's better
706 706
                 # to check, than cause an E_NOTICE.
707 707
                 continue;
708 708
             }
709
-            $key = substr($this->data['openid_' . $alias . '_type_' . $key],
709
+            $key = substr($this->data['openid_'.$alias.'_type_'.$key],
710 710
                           strlen('http://axschema.org/'));
711 711
             $attributes[$key] = $value;
712 712
         }
Please login to merge, or discard this patch.
html/user/download_software.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 //
65 65
 function get_platform($user_agent) {
66 66
     if (strstr($user_agent, 'Windows')) {
67
-        if (strstr($user_agent, 'Win64')||strstr($user_agent, 'WOW64')) {
67
+        if (strstr($user_agent, 'Win64') || strstr($user_agent, 'WOW64')) {
68 68
             return 'windows_x86_64';
69 69
         } else {
70 70
             return 'windows_intelx86';
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         $token,
139 139
         $user->id,
140 140
         (string)$v->filename,
141
-        $green?"btn-success":"btn-info",
141
+        $green ? "btn-success" : "btn-info",
142 142
         (string)$v->platform,
143 143
         (string)$v->size_mb,
144 144
         (string)$v->version_num
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
 function download_button_vbox($v, $project_id, $token, $user) {
149 149
     // if no vbox version exists for platform, don't show vbox button
150
-    if(!$v->vbox_filename) {
150
+    if (!$v->vbox_filename) {
151 151
         return;
152 152
     }
153 153
     return sprintf(
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     handle_get_info();
437 437
 } else {
438 438
     $dev = get_str("dev", true);
439
-    $user_agent = get_str("user_agent", true);      // for debugging
439
+    $user_agent = get_str("user_agent", true); // for debugging
440 440
     if (!$user_agent) {
441 441
         $user_agent = $_SERVER['HTTP_USER_AGENT'];
442 442
     }
Please login to merge, or discard this patch.
html/inc/web_rpc_api.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     // Adapt to your web site. The following assumes Bootstrap.
137 137
     //
138 138
     function show_download_button($info, $is_vbox) {
139
-        $desc = $is_vbox?$info->boinc_vbox:$info->boinc;
139
+        $desc = $is_vbox ? $info->boinc_vbox : $info->boinc;
140 140
         echo sprintf('
141 141
 <form action="https://boinc.berkeley.edu/concierge.php" method="post">
142 142
     <input type=hidden name=project_id value="%d">
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             (string)$info->token,
151 151
             (int)$info->user_id,
152 152
             (string)$desc->filename,
153
-            $is_vbox?" + VirtualBox":"",
153
+            $is_vbox ? " + VirtualBox" : "",
154 154
             (string)$info->platform,
155 155
             (string)$desc->size_mb
156 156
         );
Please login to merge, or discard this patch.
html/inc/rss.inc 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 // You can pass a function $filter;
56 56
 // if $filter(item) returns true, don't show it.
57 57
 //
58
-function show_rss_items($items, $n=0, $filter=null) {
58
+function show_rss_items($items, $n = 0, $filter = null) {
59 59
     $i = 0;
60 60
     foreach ($items as $item) {
61 61
         if ($filter && $filter($item)) {
Please login to merge, or discard this patch.
html/inc/team.inc 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     row2('<b>'.tra('Search criteria (use one or more)').'</b>', '');
41 41
     row2(
42 42
         tra('Key words').'<br><small>'.tra('Find teams with these words in their names or descriptions').'</small>',
43
-        '<input class="form-control" type="text" name="keywords" value="' . htmlspecialchars($params->keywords) . '">');
43
+        '<input class="form-control" type="text" name="keywords" value="'.htmlspecialchars($params->keywords).'">');
44 44
     row2_init(tra('Country'), '');
45 45
     echo '<select class="form-control" name="country"><option value="" selected>---</option>';
46 46
     $country = $params->country;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     echo country_select_options($country);
49 49
     echo "</select></td></tr>\n";
50 50
     row2(tra('Type of team'), team_type_select($params->type, true));
51
-    $checked = $params->active?"checked":"";
51
+    $checked = $params->active ? "checked" : "";
52 52
     row2(tra('Show only active teams'), "<input type=checkbox name=active $checked>");
53 53
     row2("", "<input class=\"btn btn-primary\" type=submit name=submit value=\"".tra('Search')."\">");
54 54
     end_table();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     row2("Created", date_str($team->create_time));
97 97
     if (defined("SHOW_NONVALIDATED_TEAMS")) {
98 98
         $founder = $team->founder;
99
-        row2("Founder email validated", $founder->email_validated?"Yes":"No (team will not be exported)");
99
+        row2("Founder email validated", $founder->email_validated ? "Yes" : "No (team will not be exported)");
100 100
     }
101 101
     if (strlen($team->url)) {;
102 102
         if (strstr($team->url, "http://")) {
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     }
170 170
     row1(tra('Members'));
171 171
     row2(tra('Founder'),
172
-        $team->founder?user_links($team->founder, BADGE_HEIGHT_MEDIUM):"---"
172
+        $team->founder ?user_links($team->founder, BADGE_HEIGHT_MEDIUM) : "---"
173 173
     );
174 174
     if (count($team->admins)) {
175 175
         $first = true;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     foreach ($deltas as $delta) {
355 355
         $u = BoincUser::lookup_id($delta->userid);
356 356
         if ($u->teamid == $teamid) {
357
-            $new_members[] = $u;  // they might have later quit
357
+            $new_members[] = $u; // they might have later quit
358 358
         }
359 359
     }
360 360
     return array_unique($new_members);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     if (!$user->teamid) return;
437 437
     $user->update("teamid=0");
438 438
     $team = BoincTeam::lookup_id($user->teamid);
439
-    if ($team && $team->ping_user==$user->id) {
439
+    if ($team && $team->ping_user == $user->id) {
440 440
         $team->update("ping_user=-ping_user");
441 441
     }
442 442
     BoincTeamAdmin::delete("teamid=$user->teamid and userid=$user->id");
@@ -475,34 +475,34 @@  discard block
 block discarded – undo
475 475
     start_table();
476 476
     row2(tra('Team name, text version').'
477 477
         <br><p class=\"text-muted\">'.tra('Don\'t use HTML tags.').'</p>',
478
-        '<input class="form-control" name="name" type="text" size="50" value="'.($team?$team->name:"").'">'
478
+        '<input class="form-control" name="name" type="text" size="50" value="'.($team ? $team->name : "").'">'
479 479
     );
480 480
     row2(tra('Team name, HTML version').'
481 481
         <br><p class=\"text-muted\">
482 482
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
483 483
         '.tra('If you don\'t know HTML, leave this box blank.').'</p>',
484
-        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"',"'",($team?$team->name_html:"")).'">'
484
+        '<input class="form-control" name="name_html" type="text" size="50" value="'.str_replace('"', "'", ($team ? $team->name_html : "")).'">'
485 485
     );
486 486
     row2(tra('URL of team web page, if any').':<br><font size=-2>('.tra('without "http://"').')
487 487
         '.tra('This URL will be linked to from the team\'s page on this site.'),
488
-        '<input class="form-control" type="text" name="url" size="60" value="'.($team?$team->url:"").'">'
488
+        '<input class="form-control" type="text" name="url" size="60" value="'.($team ? $team->url : "").'">'
489 489
     );
490 490
     row2(tra('Description of team').':
491 491
         <br><p class=\"text-muted\">
492 492
         '.tra('You may use %1 limited HTML tags %2.', '<a href="html.php" target="_new">', '</a>').'
493 493
         </p>',
494
-        '<textarea class="form-control" name="description" rows=10>'.($team?$team->description:"").'</textarea>'
494
+        '<textarea class="form-control" name="description" rows=10>'.($team ? $team->description : "").'</textarea>'
495 495
     );
496 496
 
497
-    row2(tra('Type of team').':', team_type_select($team?$team->type:null));
497
+    row2(tra('Type of team').':', team_type_select($team ? $team->type : null));
498 498
 
499 499
     row2_init(tra('Country'),
500 500
         '<select class="form-control" name="country">'
501 501
     );
502
-    echo country_select_options($team?$team->country:null);
502
+    echo country_select_options($team ? $team->country : null);
503 503
 
504 504
     echo "</select></td></tr>\n";
505
-    $x = (!$team || $team->joinable)?"checked":"";
505
+    $x = (!$team || $team->joinable) ? "checked" : "";
506 506
     row2(tra("Accept new members?"), "<input type=checkbox name=joinable $x>");
507 507
     // Check if we're using reCaptcha to prevent spam accounts
508 508
     //
@@ -566,12 +566,12 @@  discard block
 block discarded – undo
566 566
 //
567 567
 function new_transfer_request_ok($team, $now) {
568 568
     if ($team->ping_user <= 0) {
569
-        if ($team->ping_time < $now - 60 * 86400) {
569
+        if ($team->ping_time < $now - 60*86400) {
570 570
             return true;
571 571
         }
572 572
         return false;
573 573
     }
574
-    if ($team->ping_time < $now - 90 * 86400) {
574
+    if ($team->ping_time < $now - 90*86400) {
575 575
         return true;
576 576
     }
577 577
     return false;
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
     if (!is_valid_country($country)) {
607 607
         $country = tra('None');
608 608
     }
609
-    $country = BoincDb::escape_string($country);  // for Cote d'Ivoire
609
+    $country = BoincDb::escape_string($country); // for Cote d'Ivoire
610 610
 
611 611
     $clause = sprintf(
612 612
         "(userid, create_time, name, name_lc, url, type, name_html, description, country, nusers, expavg_time) values(%d, %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, unix_timestamp())",
@@ -629,6 +629,6 @@  discard block
 block discarded – undo
629 629
     }
630 630
 }
631 631
 
632
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
632
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
633 633
 
634 634
 ?>
Please login to merge, or discard this patch.
html/inc/util.inc 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
 //
38 38
 $config = get_config();
39 39
 global $master_url;
40
-$master_url = parse_config($config , "<master_url>");
40
+$master_url = parse_config($config, "<master_url>");
41 41
 $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>");
42 42
 $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>");
43 43
 
44 44
 // the following default to on
45 45
 //
46 46
 $x = parse_config($config, "<user_country>");
47
-define('USER_COUNTRY', ($x===null)?1:(int)$x);
47
+define('USER_COUNTRY', ($x === null) ? 1 : (int)$x);
48 48
 
49 49
 $x = parse_config($config, "<user_url>");
50
-define('USER_URL', ($x===null)?1:(int)$x);
50
+define('USER_URL', ($x === null) ? 1 : (int)$x);
51 51
 
52 52
 // don't allow /... at the end of URL
53 53
 //
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 }
142 142
 
143 143
 function url_base() {
144
-    return is_https()?secure_url_base():URL_BASE;
144
+    return is_https() ?secure_url_base() : URL_BASE;
145 145
 }
146 146
 
147
-function send_cookie($name, $value, $permanent, $ops=false) {
147
+function send_cookie($name, $value, $permanent, $ops = false) {
148 148
     global $master_url;
149 149
 
150 150
     // the following allows independent login for projects on the same server
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
         $path = substr($path, 0, -1);
156 156
         $path .= "_ops/";
157 157
     }
158
-    $expire = $permanent?time()+3600*24*365:0;
158
+    $expire = $permanent ?time() + 3600*24*365 : 0;
159 159
     setcookie($name, $value, $expire, $path);
160 160
 }
161 161
 
162
-function clear_cookie($name, $ops=false) {
162
+function clear_cookie($name, $ops = false) {
163 163
     global $master_url;
164 164
     $url = parse_url($master_url);
165 165
     $path = $url['path'];
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
         $path = substr($path, 0, -1);
168 168
         $path .= "_ops/";
169 169
     }
170
-    setcookie($name, '', time()-3600, $path);
170
+    setcookie($name, '', time() - 3600, $path);
171 171
 }
172 172
 
173 173
 $g_logged_in_user = null;
174 174
 $got_logged_in_user = false;
175 175
 
176
-function get_logged_in_user($must_be_logged_in=true) {
176
+function get_logged_in_user($must_be_logged_in = true) {
177 177
     global $g_logged_in_user, $got_logged_in_user;
178 178
     if ($got_logged_in_user) return $g_logged_in_user;
179 179
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             $next_url = $_SERVER['REQUEST_URI'];
193 193
             $n = strrpos($next_url, "/");
194 194
             if ($n) {
195
-                $next_url = substr($next_url, $n+1);
195
+                $next_url = substr($next_url, $n + 1);
196 196
             }
197 197
         }
198 198
         $next_url = urlencode($next_url);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     return $g_logged_in_user;
204 204
 }
205 205
 
206
-function show_login_info($prefix="") {
206
+function show_login_info($prefix = "") {
207 207
     $user = get_logged_in_user(false);
208 208
     if ($user) {
209 209
         $url_tokens = url_tokens($user->authenticator);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     }
214 214
 }
215 215
 
216
-$cache_control_extra="";
216
+$cache_control_extra = "";
217 217
 $is_login_page = false;
218 218
 
219 219
 // Call this to start pages.
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 // with an existing web framework can more easily do so.
226 226
 // To do so, define page_head() in the project include file.
227 227
 //
228
-if (!function_exists("page_head")){
228
+if (!function_exists("page_head")) {
229 229
 function page_head(
230 230
     $title,
231 231
         // page title. Put in <title>, used as title for browser tab.
232
-    $body_attrs=null,
232
+    $body_attrs = null,
233 233
         // <body XXXX>
234 234
         // e.g. Javascript to put focus in an input field
235 235
         // (onload="document.form.foo.focus()")
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
         // if set, include schedulers.txt.
239 239
         // also pass to project_banner() in case you want a different
240 240
         // header for your main page.
241
-    $url_prefix="",
241
+    $url_prefix = "",
242 242
         // prepend this to links.
243 243
         // Use for web pages not in the top directory
244
-    $head_extra=null
244
+    $head_extra = null
245 245
         // extra stuff to put in <head>. E.g.:
246 246
         // reCAPTCHA code (create_profile.php)
247 247
         // bbcode javascript (forums)
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         header("Content-type: text/html; charset=utf-8");
264 264
         header("Expires: Mon, 26 Jul 1997 05:00:00 UTC");
265 265
             // Date in the past
266
-        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC");
266
+        header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC");
267 267
             // always modified
268 268
         header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0");
269 269
             // for HTTP/1.1
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
     if ($head_extra) {
285 285
         echo "\n$head_extra\n";
286 286
     }
287
-    if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) {
287
+    if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) {
288 288
         readfile("schedulers.txt");
289 289
     }
290 290
 
291
-    $t = $title?$title:PROJECT;
291
+    $t = $title ? $title : PROJECT;
292 292
     echo "<title>$t</title>\n";
293 293
     echo '
294 294
         <meta charset="utf-8">
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     echo '<div class="container-fluid">
346 346
     ';
347 347
 
348
-    switch($title) {    //kludge
348
+    switch ($title) {    //kludge
349 349
     case tra("Log in"):
350 350
     case tra("Create an account"):
351 351
     case tra("Server status page"):
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
 
361 361
 // See the comments for page_head()
362 362
 //
363
-if (!function_exists("page_tail")){
363
+if (!function_exists("page_tail")) {
364 364
 function page_tail(
365
-    $show_date=false,
365
+    $show_date = false,
366 366
         // true for pages that are generated periodically rather than on the fly
367
-    $url_prefix="",
367
+    $url_prefix = "",
368 368
         // use for pages not at top level
369
-    $is_main=false
369
+    $is_main = false
370 370
         // passed to project_footer;
371 371
 ) {
372 372
     echo "<br>\n";
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 }
382 382
 }
383 383
 
384
-function display_cvs_versions(){
384
+function display_cvs_versions() {
385 385
     global $cvs_version_tracker;
386 386
     echo "\n<!-- SVN VERSIONS -->\n";
387
-    for ($i=0;$i<sizeof($cvs_version_tracker);$i++) {
387
+    for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) {
388 388
         echo "<!-- ".$cvs_version_tracker[$i]." -->\n";
389 389
     }
390 390
 }
@@ -409,23 +409,23 @@  discard block
 block discarded – undo
409 409
 // takes argument in second and returns a human formatted time string
410 410
 // in the form D days + h Hours + m Min + s sec.
411 411
 
412
-function time_diff($x, $res=3) {
412
+function time_diff($x, $res = 3) {
413 413
     $days    = (int)($x/86400);
414
-    $hours   = (int)(($x-$days*86400)/3600);
415
-    $minutes = (int)(($x-$days*86400-$hours*3600)/60);
416
-    $seconds = (int)($x % 60);
414
+    $hours   = (int)(($x - $days*86400)/3600);
415
+    $minutes = (int)(($x - $days*86400 - $hours*3600)/60);
416
+    $seconds = (int)($x%60);
417 417
 
418 418
     $datestring = "";
419 419
     if ($days) {
420 420
         $datestring .= "$days ".tra("days")." ";
421 421
     }
422
-    if ($res>0 && ($hours || strlen($datestring))) {
422
+    if ($res > 0 && ($hours || strlen($datestring))) {
423 423
         $datestring .= "$hours ".tra("hours")." ";
424 424
     }
425
-    if ($res>1 && ($minutes || strlen($datestring))) {
425
+    if ($res > 1 && ($minutes || strlen($datestring))) {
426 426
         $datestring .= "$minutes ".tra("min")." ";
427 427
     }
428
-    if ($res>2 && ($seconds)) {
428
+    if ($res > 2 && ($seconds)) {
429 429
         $datestring .= "$seconds ".tra("sec")." ";
430 430
     }
431 431
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 
441 441
 function time_str($x) {
442 442
     if ($x == 0) return "---";
443
-    return gmdate('j M Y, G:i:s', $x) . " UTC";
443
+    return gmdate('j M Y, G:i:s', $x)." UTC";
444 444
 }
445 445
 
446 446
 function local_time_str($x) {
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
     return time_str($x);
453 453
 }
454 454
 
455
-function start_table_str($class="", $style="") {
456
-    $s = $style?'style="'.$style.'"':'';
455
+function start_table_str($class = "", $style = "") {
456
+    $s = $style ? 'style="'.$style.'"' : '';
457 457
     return '<div class="table">
458 458
       <table '.$s.' width="100%" class="table table-condensed '.$class.'" >
459 459
     ';
460 460
 }
461 461
 
462
-function start_table($class="", $style="") {
462
+function start_table($class = "", $style = "") {
463 463
     echo start_table_str($class, $style);
464 464
 }
465 465
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     echo "</tr>\n";
505 505
 }
506 506
 
507
-function row1($x, $ncols=2, $class="heading") {
507
+function row1($x, $ncols = 2, $class = "heading") {
508 508
     if ($class == "heading") {
509 509
         echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n";
510 510
     } else {
@@ -516,10 +516,10 @@  discard block
 block discarded – undo
516 516
 define('VALUE_ATTRS', 'style="padding-left:12px"');
517 517
 define('VALUE_ATTRS_ERR', 'class="danger" style="padding-left:12px"');
518 518
 
519
-function row2($x, $y, $show_error=false, $lwidth='40%') {
520
-    if ($x==="") $x="<br>";
521
-    if ($y==="") $y="<br>";
522
-    $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS;
519
+function row2($x, $y, $show_error = false, $lwidth = '40%') {
520
+    if ($x === "") $x = "<br>";
521
+    if ($y === "") $y = "<br>";
522
+    $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS;
523 523
     echo "<tr>
524 524
         <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td>
525 525
         <td $attrs >$y</td>
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
     ";
528 528
 }
529 529
 
530
-function row2_init($x, $y, $lwidth='40%') {
530
+function row2_init($x, $y, $lwidth = '40%') {
531 531
     echo '<tr>
532 532
         <td class="text-right " width="'.$lwidth.'"  style="padding-right: 20px;">'.$x.'</td>
533 533
         <td '.VALUE_ATTRS.'>'.$y.'
@@ -550,20 +550,20 @@  discard block
 block discarded – undo
550 550
     echo "</tr>\n";
551 551
 }
552 552
 
553
-define ('ALIGN_RIGHT', 'style="text-align:right;"');
553
+define('ALIGN_RIGHT', 'style="text-align:right;"');
554 554
 
555
-function row_heading_array($x, $attrs=null, $class='bg-primary') {
555
+function row_heading_array($x, $attrs = null, $class = 'bg-primary') {
556 556
     echo "<tr>";
557 557
     $i = 0;
558 558
     foreach ($x as $h) {
559
-        $a = $attrs?$attrs[$i]:"";
559
+        $a = $attrs ? $attrs[$i] : "";
560 560
         echo "<th $a class=\"$class\">$h</th>";
561 561
         $i++;
562 562
     }
563 563
     echo "</tr>\n";
564 564
 }
565 565
 
566
-function row_heading($x, $class='bg-primary') {
566
+function row_heading($x, $class = 'bg-primary') {
567 567
     echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr>
568 568
         ', $class, $x
569 569
     );
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 // If $ellipsis is true, then an ellipsis is added to any sentence which
624 624
 // is cut short.
625 625
 
626
-function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) {
626
+function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) {
627 627
     $words = explode($delimiter, $sentence);
628 628
     $total_chars = 0;
629 629
     $trunc = false;
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 
707 707
 // returns null if the arg is optional and missing
708 708
 //
709
-function get_int($name, $optional=false) {
710
-    $x=null;
709
+function get_int($name, $optional = false) {
710
+    $x = null;
711 711
     if (isset($_GET[$name])) $x = $_GET[$name];
712 712
     if (!is_numeric($x)) {
713 713
         if ($optional) {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 
727 727
 // returns null if the arg is optional and missing
728 728
 //
729
-function post_num($name, $optional=false) {
729
+function post_num($name, $optional = false) {
730 730
     $x = null;
731 731
     if (isset($_POST[$name])) $x = $_POST[$name];
732 732
     if (!is_numeric($x)) {
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 
742 742
 // returns null if the arg is optional and missing
743 743
 //
744
-function post_int($name, $optional=false) {
744
+function post_int($name, $optional = false) {
745 745
     $x = post_num($name, $optional);
746 746
     if (is_null($x)) return null;
747 747
     $y = (int)$x;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
     }
760 760
 }
761 761
 
762
-function get_str($name, $optional=false) {
762
+function get_str($name, $optional = false) {
763 763
     if (isset($_GET[$name])) {
764 764
         $x = $_GET[$name];
765 765
     } else {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
     return undo_magic_quotes($x);
772 772
 }
773 773
 
774
-function post_str($name, $optional=false) {
774
+function post_str($name, $optional = false) {
775 775
     if (isset($_POST[$name])) {
776 776
         $x = $_POST[$name];
777 777
     } else {
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
     return undo_magic_quotes($x);
784 784
 }
785 785
 
786
-function post_arr($name, $optional=false) {
786
+function post_arr($name, $optional = false) {
787 787
     if (isset($_POST[$name]) && is_array($_POST[$name])) {
788 788
         $x = $_POST[$name];
789 789
     } else {
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
     // the mb_* functions are not included by default
800 800
     // return (mb_detect_encoding($passwd) -= 'ASCII');
801 801
 
802
-    for ($i=0; $i<strlen($str); $i++) {
802
+    for ($i = 0; $i < strlen($str); $i++) {
803 803
         $c = ord(substr($str, $i));
804 804
         if ($c < 32 || $c > 127) return false;
805 805
     }
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
     $number = str_replace(',', '.', $number); // replace the german decimal separator
824 824
     // if no value was entered and this is ok
825 825
     //
826
-    if ($number=='' && !$low) return true;
826
+    if ($number == '' && !$low) return true;
827 827
 
828 828
     // the supplied value contains alphabetic characters
829 829
     //
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 
841 841
 // Generate a "select" element from an array of values
842 842
 //
843
-function select_from_array($name, $array, $selection=null, $width=240) {
843
+function select_from_array($name, $array, $selection = null, $width = 240) {
844 844
     $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"';
845 845
 
846 846
     foreach ($array as $key => $value) {
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
     return $str;
866 866
 }
867 867
 
868
-function strip_bbcode($string){
869
-    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string);
868
+function strip_bbcode($string) {
869
+    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string);
870 870
 }
871 871
 
872 872
 function current_url() {
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 // @param class The optional CSS class of the button. Defaults to a standard button
895 895
 //
896 896
 
897
-function button_text($url, $text, $desc=null, $class="btn-success btn-sm") {
897
+function button_text($url, $text, $desc = null, $class = "btn-success btn-sm") {
898 898
     if (!$desc) {
899 899
         $desc = $text;
900 900
     }
@@ -903,19 +903,19 @@  discard block
 block discarded – undo
903 903
     );
904 904
 }
905 905
 
906
-function show_button($url, $text, $desc=null, $class="btn-success btn-sm") {
907
-    echo button_text($url, $text, $desc=null, $class);
906
+function show_button($url, $text, $desc = null, $class = "btn-success btn-sm") {
907
+    echo button_text($url, $text, $desc = null, $class);
908 908
 }
909 909
 
910 910
 // for places with a bunch of buttons, like forum posts
911 911
 //
912
-function show_button_small($url, $text, $desc=null) {
912
+function show_button_small($url, $text, $desc = null) {
913 913
     echo button_text($url, $text, $desc, "btn-primary btn-xs");
914 914
 }
915 915
 
916 916
 // used for showing icons
917 917
 //
918
-function show_image($src, $title, $alt, $height=null) {
918
+function show_image($src, $title, $alt, $height = null) {
919 919
     $h = "";
920 920
     if ($height) {
921 921
         $h = "height=\"$height\"";
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 // tries instead to connect to <replica_db_host> if tag exists.
953 953
 // DEPRECATED - use boinc_db.inc
954 954
 //
955
-function db_init($try_replica=false) {
955
+function db_init($try_replica = false) {
956 956
     check_web_stopped();
957 957
     $retval = db_init_aux($try_replica);
958 958
     if ($retval == 1) {
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 function sanitize_numeric($x) {
1024 1024
     if (is_numeric($x)) {
1025 1025
         return $x;
1026
-    } else if (trim($x) == '' ) {
1026
+    } else if (trim($x) == '') {
1027 1027
         return '';
1028 1028
     } else {
1029 1029
         return "not numeric";
@@ -1046,9 +1046,9 @@  discard block
 block discarded – undo
1046 1046
     return $c/(200/24);
1047 1047
 }
1048 1048
 
1049
-function do_download($path,$name="") {
1050
-    if (strcmp($name,"") == 0) {
1051
-        $name=basename($path);
1049
+function do_download($path, $name = "") {
1050
+    if (strcmp($name, "") == 0) {
1051
+        $name = basename($path);
1052 1052
     }
1053 1053
     header('Content-Description: File Transfer');
1054 1054
     header('Content-Type: application/octet-stream');
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
     header('Expires: 0');
1058 1058
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
1059 1059
     header('Pragma: public');
1060
-    header('Content-Length: ' . filesize($path));
1060
+    header('Content-Length: '.filesize($path));
1061 1061
     flush();
1062 1062
     readfile($path);
1063 1063
 }
@@ -1106,10 +1106,10 @@  discard block
 block discarded – undo
1106 1106
 // Otherwise return 0.
1107 1107
 // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)"
1108 1108
 //
1109
-function boinc_client_version(){
1109
+function boinc_client_version() {
1110 1110
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0;
1111 1111
     $x = $_SERVER['HTTP_USER_AGENT'];
1112
-    $e =  "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1112
+    $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1113 1113
     if (preg_match($e, $x, $matches)) {
1114 1114
         return $matches[1]*10000 + $matches[2]*100 + $matches[3];
1115 1115
     }
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
     $rem_name = $name."_remaining";
1139 1139
     return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\"
1140 1140
         onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea>
1141
-        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1141
+        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1142 1142
     ;
1143 1143
 }
1144 1144
 
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 // use the following around text with long lines,
1169 1169
 // to limit the width and make it more readable.
1170 1170
 //
1171
-function text_start($width=640) {
1171
+function text_start($width = 640) {
1172 1172
     echo sprintf("<div style=\"max-width: %dpx;\">\n", $width);
1173 1173
 }
1174 1174
 function text_end() {
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 }
1186 1186
 
1187 1187
 function cert_filename() {
1188
-    return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php";
1188
+    return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php";
1189 1189
 }
1190 1190
 
1191 1191
 // if user hasn't validated their email addr, tell them to
@@ -1202,6 +1202,6 @@  discard block
 block discarded – undo
1202 1202
     }
1203 1203
 }
1204 1204
 
1205
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
1205
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
1206 1206
 
1207 1207
 ?>
Please login to merge, or discard this patch.