Passed
Push — master ( d950b6...dd6b70 )
by Vitalii
01:14 queued 19s
created
html/inc/translation.inc 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
     $dh = opendir($langdir.$transdir);
65 65
     if (!$dh) die("can't open translation dir");
66 66
     while (($file = readdir($dh)) !== false) {
67
-        if ($file==".." || $file==".") {
67
+        if ($file == ".." || $file == ".") {
68 68
             continue;
69 69
         }
70 70
         // only do files ending in .po
71
-        if (substr($file,-3) != ".po"){
71
+        if (substr($file, -3) != ".po") {
72 72
             //debug("File $file with unknown extension found in $info_dir");
73 73
             continue;
74 74
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             "-------------Compiling $transdir$file------------", 0
77 77
         );
78 78
         $language = parse_po_file($langdir.$transdir.$file);
79
-        if (!$language){
79
+        if (!$language) {
80 80
             language_log(
81 81
                 "WARNING: Could not parse language ".$file
82 82
             );
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
             );
96 96
             exit;
97 97
         }
98
-        foreach ($language as $key => $value){
98
+        foreach ($language as $key => $value) {
99 99
             if ($value !== "") {
100 100
                 // Skip if the msgstr is empty
101
-                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n");
101
+                fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n");
102 102
             }
103 103
         }
104 104
         // don't write \?\> - may append
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 function parse_po_file($file) {
116 116
     $translation_file = file($file);
117 117
     $first_entry = true;
118
-    $current_token_text="";
119
-    $current_token ="";
118
+    $current_token_text = "";
119
+    $current_token = "";
120 120
     $parsing_token = false;
121 121
     $parsing_text = false;
122 122
     $size = sizeof($translation_file);
123 123
     $output = array();
124
-    for ($i=0; $i<$size; $i++){
124
+    for ($i = 0; $i < $size; $i++) {
125 125
         $entry = trim($translation_file[$i]);
126 126
         //echo "line $i: $entry\n";
127
-        if (substr($entry, 0, 1)=="#") {
127
+        if (substr($entry, 0, 1) == "#") {
128 128
             continue;
129 129
         } elseif (strpos($entry, "msgid") !== false) {
130
-            if (!$first_entry){
130
+            if (!$first_entry) {
131 131
                 //If this is not the first, save the previous entry
132
-                $output[$current_token]=$current_token_text;
132
+                $output[$current_token] = $current_token_text;
133 133
             }
134 134
             $current_token = get_po_line($entry, $file);
135
-            $current_token_text="";
135
+            $current_token_text = "";
136 136
             $parsing_token = true;
137 137
             $parsing_text = false;
138
-            $first_entry=false;
138
+            $first_entry = false;
139 139
         } elseif (strpos($entry, "msgstr") !== false) {
140 140
             $current_token_text = get_po_line($entry, $file);
141 141
             $parsing_token = false;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     // Get the last token
151 151
     //
152
-    if ($current_token && $current_token_text){
152
+    if ($current_token && $current_token_text) {
153 153
         $output[$current_token] = $current_token_text;
154 154
     }
155 155
     return $output;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 // Returns the contents of a line (ie removes "" from start and end)
160 160
 //
161 161
 function get_po_line($line, $file) {
162
-    $start = strpos($line, '"')+1;
162
+    $start = strpos($line, '"') + 1;
163 163
     $stop = strrpos($line, '"');
164
-    $x = substr($line, $start, $stop-$start);
164
+    $x = substr($line, $start, $stop - $start);
165 165
     $n = preg_match("/[^\\\\]\"/", $x);
166 166
     if ($n) {
167 167
         echo "ERROR - MISMATCHED QUOTES IN $file: $line\n";
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 
181 181
     // Find the string in the user's language
182 182
     //
183
-    foreach ($languages_in_use as $language){
183
+    foreach ($languages_in_use as $language) {
184 184
         if (isset($language_lookup_array[$language][$text])) {
185 185
             $text = $language_lookup_array[$language][$text];
186 186
             break;
187
-        } else if ($language=="en"){
187
+        } else if ($language == "en") {
188 188
             // This language is defined in the code and is always available
189 189
             break;
190 190
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     // Replace relevant substrings with given arguments.
194 194
     // Use strtr to avoid problems if an argument contains %n.
195 195
     $replacements = array();
196
-    for ($i=1; $i<func_num_args(); $i++){
196
+    for ($i = 1; $i < func_num_args(); $i++) {
197 197
         $replacements["%".$i] = func_get_arg($i);
198 198
     }
199 199
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
     return $text;
211 211
 }
212 212
 
213
-function language_log($message, $loglevel=0) {
213
+function language_log($message, $loglevel = 0) {
214 214
     global $lang_log_level;
215 215
     $msg = "";
216
-    if ($loglevel==0) $msg = "[ Debug    ]";
217
-    if ($loglevel==1) $msg = "[ Warning  ]";
218
-    if ($loglevel==2) $msg = "[ CRITICAL ]";
216
+    if ($loglevel == 0) $msg = "[ Debug    ]";
217
+    if ($loglevel == 1) $msg = "[ Warning  ]";
218
+    if ($loglevel == 2) $msg = "[ CRITICAL ]";
219 219
 
220
-    if ($loglevel >= $lang_log_level){
220
+    if ($loglevel >= $lang_log_level) {
221 221
         echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n";
222 222
     }
223 223
 }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 // (by looking at cookies and browser settings)
227 227
 // cookies have highest priority.
228 228
 
229
-if (isset($_COOKIE['lang'])){
229
+if (isset($_COOKIE['lang'])) {
230 230
     $language_string = $_COOKIE['lang'].",";
231 231
 } else {
232 232
     $language_string = '';
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 // Loop over languages that the client requests
258 258
 //
259 259
 $size = sizeof($client_languages);
260
-for ($i=0; $i<$size; $i++) {
261
-    if ((strlen($client_languages[$i])>2)
260
+for ($i = 0; $i < $size; $i++) {
261
+    if ((strlen($client_languages[$i]) > 2)
262 262
         && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
263
-    ){
263
+    ) {
264 264
         // If this is defined as primary-secondary, represent it as xx_YY
265 265
         //
266 266
         $language = substr(
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
     // if main language is english, look no further
281 281
     //
282
-    if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) {
282
+    if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) {
283 283
         break;
284 284
     }
285 285
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     //
288 288
     $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
289 289
     if (file_exists($file_name)) {
290
-        if (!in_array($language, $languages_in_use)){
290
+        if (!in_array($language, $languages_in_use)) {
291 291
             require_once($file_name);
292 292
             $languages_in_use[] = $language;
293 293
         }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     if ($language2) {
296 296
         $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc";
297 297
         if (file_exists($file_name)) {
298
-            if (!in_array($language2, $languages_in_use)){
298
+            if (!in_array($language2, $languages_in_use)) {
299 299
                 require_once($file_name);
300 300
                 $languages_in_use[] = $language2;
301 301
             }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     }
304 304
 }
305 305
 
306
-$GLOBALS['languages_in_use'] = $languages_in_use;   // for Drupal
306
+$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal
307 307
 
308
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
308
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
309 309
 ?>
Please login to merge, or discard this patch.
html/inc/countries.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     "Zimbabwe"
258 258
 );
259 259
 
260
-$country_to_iso3166_2 = array (
260
+$country_to_iso3166_2 = array(
261 261
     "Afghanistan" => "af",
262 262
     "Albania" => "al",
263 263
     "Algeria" => "dz",
@@ -493,25 +493,25 @@  discard block
 block discarded – undo
493 493
 
494 494
 // return a list of country options for a <select>
495 495
 //
496
-function country_select_options($selected_country="None") {
496
+function country_select_options($selected_country = "None") {
497 497
     global $countries;
498 498
 
499 499
     require_once("../inc/geoip.inc");
500 500
 
501 501
     // See if we can find the user's country and select it as default:
502 502
     //
503
-    $gi = geoip_open("../inc/GeoIP.dat",GEOIP_STANDARD);
504
-    $geoip_country = geoip_country_name_by_addr($gi,$_SERVER["REMOTE_ADDR"]);
503
+    $gi = geoip_open("../inc/GeoIP.dat", GEOIP_STANDARD);
504
+    $geoip_country = geoip_country_name_by_addr($gi, $_SERVER["REMOTE_ADDR"]);
505 505
     geoip_close($gi);
506 506
 
507
-    if ($selected_country=="") $selected_country="None";
508
-    if ($selected_country=="None" and $geoip_country!=""){
509
-        $selected_country=$geoip_country;
507
+    if ($selected_country == "") $selected_country = "None";
508
+    if ($selected_country == "None" and $geoip_country != "") {
509
+        $selected_country = $geoip_country;
510 510
     }
511 511
 
512 512
     $x = "";
513 513
     foreach ($countries as $country) {
514
-        $selected = ($selected_country == $country ? "selected":"");
514
+        $selected = ($selected_country == $country ? "selected" : "");
515 515
         $x .= "<option value=\"$country\" $selected>$country</option>\n";
516 516
     }
517 517
     return $x;
Please login to merge, or discard this patch.
html/inc/prefs.inc 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         new NUM_SPEC(tra("% of the CPUs"), 1, 100, 0)
109 109
     ),
110 110
     new PREF_NUM(
111
-        tra("Use at most") ."<br><font size=-2>Requires BOINC 7.20.3+</font>",
111
+        tra("Use at most")."<br><font size=-2>Requires BOINC 7.20.3+</font>",
112 112
         // xgettext:no-php-format
113 113
         tra("Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat."),
114 114
         "niu_cpu_usage_limit",
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
     $dp->disk_max_used_pct = parse_config($config, "<default_disk_max_used_pct>");
296 296
     $dp->disk_min_free_gb = parse_config($config, "<default_disk_min_free_gb>");
297 297
     // set some defaults if not found
298
-    if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0;  // no limit
298
+    if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit
299 299
     if (!$dp->disk_max_used_pct) $dp->disk_max_used_pct = 90; // 90 percent
300
-    if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1;   // 1 GB
300
+    if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1; // 1 GB
301 301
     // set mininimum free space scheduler allows
302 302
     // - depends on which scheduler is running
303 303
     $dp->new_sched_flag = 1;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
     global $text;
324 324
     global $venue_name;
325 325
 
326
-    switch($name) {
326
+    switch ($name) {
327 327
     case "venue":
328 328
         if (array_key_exists("name", $attrs)) {
329 329
             $venue_name = $attrs["name"];
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
             return;
374 374
         }
375 375
     }
376
-    switch($name) {
376
+    switch ($name) {
377 377
     case "venue":
378 378
         $top_parse_result->$venue_name = $parse_result;
379 379
         $parse_result = $top_parse_result;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     }
548 548
 }
549 549
 
550
-function print_prefs_display_global($user, $columns=false) {
550
+function print_prefs_display_global($user, $columns = false) {
551 551
     $global_prefs = prefs_parse_global($user->global_prefs);
552 552
 
553 553
     echo tra("These settings apply to all computers using this account except")
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         .tra("Android devices")
558 558
         ."</ul>
559 559
     ";
560
-    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=". (int)!$columns .">".tra("(Switch view)")."</a></font>";
560
+    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=".(int)!$columns.">".tra("(Switch view)")."</a></font>";
561 561
     if ($columns) {
562 562
         echo "<h3>".tra("Combined preferences").$switch_link."</h3>";
563 563
         start_table();
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 // otherwise false
595 595
 //
596 596
 function print_prefs_form(
597
-    $action, $subset, $venue, $user, $prefs, $cols, $error=false,
598
-    $project_error=false
599
-){
597
+    $action, $subset, $venue, $user, $prefs, $cols, $error = false,
598
+    $project_error = false
599
+) {
600 600
     if ($action == "add") {
601 601
         $script = "add_venue.php";
602 602
         $submit_value = tra("Add preferences");
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 //
637 637
 // Functions to display preference subsets as forms
638 638
 //
639
-function prefs_form_global($user, $prefs, $error=false) {
639
+function prefs_form_global($user, $prefs, $error = false) {
640 640
     global $in_use_prefs;
641 641
     global $not_in_use_prefs;
642 642
     global $job_prefs;
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
 //
674 674
 function prefs_form_radio_buttons($name, $yesno) {
675 675
     $rb = tra("yes")." <input type=radio name=$name value=yes "
676
-        .($yesno?"checked":"")
676
+        .($yesno ? "checked" : "")
677 677
         ."> ".tra("no")." <input type=radio name=$name value=no "
678
-        .($yesno?"":"checked")
678
+        .($yesno ? "" : "checked")
679 679
         .">\n";
680 680
     return $rb;
681 681
 }
@@ -694,12 +694,12 @@  discard block
 block discarded – undo
694 694
 }
695 695
 function venue_show($user) {
696 696
     $venue = $user->venue;
697
-    if ($venue =='') $venue = '---';
697
+    if ($venue == '') $venue = '---';
698 698
     tooltip_row2(VENUE_TOOLTIP, VENUE_DESC, $venue);
699 699
 }
700 700
 
701 701
 function venue_form($user) {
702
-    $n=$h=$w=$s=$m='';
702
+    $n = $h = $w = $s = $m = '';
703 703
     if ($user->venue == '') $n = 'selected';
704 704
     if ($user->venue == 'home') $h = 'selected';
705 705
     if ($user->venue == 'work') $w = 'selected';
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 //
758 758
 // convert prefs from structure to XML
759 759
 //
760
-function global_prefs_make_xml($prefs, $primary=true) {
760
+function global_prefs_make_xml($prefs, $primary = true) {
761 761
     global $in_use_prefs;
762 762
     global $not_in_use_prefs;
763 763
     global $job_prefs;
Please login to merge, or discard this patch.
html/inc/boinc_db.inc 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
         $db = BoincDb::get();
209 209
         return $db->update($this, 'user', $clause);
210 210
     }
211
-    static function enum($where_clause, $order_clause=null) {
211
+    static function enum($where_clause, $order_clause = null) {
212 212
         $db = BoincDb::get();
213 213
         return $db->enum('user', 'BoincUser', $where_clause, $order_clause);
214 214
     }
215
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
215
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
216 216
         $db = BoincDb::get();
217 217
         return $db->enum_fields(
218 218
             'user', 'BoincUser', $fields, $where_clause, $order_clause
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $db = BoincDb::get();
262 262
         return $db->update($this, 'team', $clause);
263 263
     }
264
-    static function enum($where_clause, $order_clause=null) {
264
+    static function enum($where_clause, $order_clause = null) {
265 265
         $db = BoincDb::get();
266 266
         return $db->enum('team', 'BoincTeam', $where_clause, $order_clause);
267 267
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $db = BoincDb::get();
287 287
         return $db->max('team', $field);
288 288
     }
289
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
289
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
290 290
         $db = BoincDb::get();
291 291
         return $db->enum_fields(
292 292
             'team', 'BoincTeam', $fields, $where_clause, $order_clause
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
         $db = BoincDb::get();
323 323
         return $db->delete($this, 'host');
324 324
     }
325
-    static function enum($where_clause, $order_clause=null) {
325
+    static function enum($where_clause, $order_clause = null) {
326 326
         $db = BoincDb::get();
327 327
         return $db->enum('host', 'BoincHost', $where_clause, $order_clause);
328 328
     }
329
-    static function enum_fields($fields, $where_clause, $order_clause=null) {
329
+    static function enum_fields($fields, $where_clause, $order_clause = null) {
330 330
         $db = BoincDb::get();
331 331
         return $db->enum_fields(
332 332
             'host', 'BoincHost', $fields, $where_clause, $order_clause
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $db = BoincDb::get();
446 446
         return $db->update($this, 'app', $clause);
447 447
     }
448
-    static function sum($field, $clause=null) {
448
+    static function sum($field, $clause = null) {
449 449
         $db = BoincDb::get();
450 450
         return $db->sum('app', $field, $clause);
451 451
     }
@@ -501,11 +501,11 @@  discard block
 block discarded – undo
501 501
         $db = BoincDb::get();
502 502
         return $db->insert('profile', $clause);
503 503
     }
504
-    static function enum($where_clause=null, $order_clause=null) {
504
+    static function enum($where_clause = null, $order_clause = null) {
505 505
         $db = BoincDb::get();
506 506
         return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause);
507 507
     }
508
-    static function enum_fields($fields, $where_clause=null, $order_clause=null) {
508
+    static function enum_fields($fields, $where_clause = null, $order_clause = null) {
509 509
         $db = BoincDb::get();
510 510
         return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause);
511 511
     }
@@ -889,12 +889,12 @@  discard block
 block discarded – undo
889 889
         return $db->enum('consent', 'BoincConsent', $where_clause);
890 890
     }
891 891
 
892
-    static function insert ($clause) {
892
+    static function insert($clause) {
893 893
         $db = BoincDb::get();
894 894
         return $db->insert('consent', $clause);
895 895
     }
896 896
 
897
-    static function update ($clause) {
897
+    static function update($clause) {
898 898
         $db = BoincDb::get();
899 899
         return $db->update_aux('consent', $clause);
900 900
     }
@@ -918,17 +918,17 @@  discard block
 block discarded – undo
918 918
         return $db->lookup('consent_type', 'BoincConsentType', $clause);
919 919
     }
920 920
 
921
-    static function enum($where_clause, $order_clause=null) {
921
+    static function enum($where_clause, $order_clause = null) {
922 922
         $db = BoincDb::get();
923 923
         return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause);
924 924
     }
925 925
 
926
-    static function insert ($clause) {
926
+    static function insert($clause) {
927 927
         $db = BoincDb::get();
928 928
         return $db->insert('consent_type', $clause);
929 929
     }
930 930
 
931
-    static function update ($clause) {
931
+    static function update($clause) {
932 932
         $db = BoincDb::get();
933 933
         return $db->update_aux('consent_type', $clause);
934 934
     }
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
         return $db->lookup('latest_consent', 'BoincLatestConsent', $clause);
954 954
     }
955 955
 
956
-    static function enum($where_clause, $order_clause=null) {
956
+    static function enum($where_clause, $order_clause = null) {
957 957
         $db = BoincDb::get();
958 958
         return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause);
959 959
     }
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 // apply this to any user-supplied strings used in queries
965 965
 //
966 966
 function boinc_real_escape_string($x) {
967
-    if (version_compare(phpversion(),"4.3.0")>=0) {
967
+    if (version_compare(phpversion(), "4.3.0") >= 0) {
968 968
         return BoincDb::escape_string($x);
969 969
     } else {
970 970
         $x = str_replace("'", "\'", $x);
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/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.