@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | // return a string for navigating pages |
| 240 | 240 | // |
| 241 | -function page_links($url, $nitems, $items_per_page, $start){ |
|
| 241 | +function page_links($url, $nitems, $items_per_page, $start) { |
|
| 242 | 242 | // How many pages to potentially show before and after this one: |
| 243 | 243 | $preshow = 3; |
| 244 | 244 | $postshow = 3; |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | // If this is not the first page, display "previous" |
| 253 | 253 | // |
| 254 | - if ($curpage > 0){ |
|
| 254 | + if ($curpage > 0) { |
|
| 255 | 255 | $x .= page_link( |
| 256 | 256 | $url, $curpage-1, $items_per_page, |
| 257 | 257 | tra("Previous")." · " |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | // Display a list of pages surrounding this one |
| 270 | 270 | // |
| 271 | - for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){ |
|
| 271 | + for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++) { |
|
| 272 | 272 | $page_str = (string)($i+1); |
| 273 | 273 | if ($i < 0) continue; |
| 274 | 274 | if ($i >= $npages) break; |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | // If there is a next page |
| 291 | 291 | // |
| 292 | - if ($curpage < $npages-1){ |
|
| 292 | + if ($curpage < $npages-1) { |
|
| 293 | 293 | $x .= page_link( |
| 294 | 294 | $url, $curpage+1, $items_per_page, |
| 295 | 295 | " · ".tra("Next") |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | // If the user no longer exists, skip the post |
| 520 | 520 | // |
| 521 | - if (!$user){ |
|
| 521 | + if (!$user) { |
|
| 522 | 522 | return; |
| 523 | 523 | } |
| 524 | 524 | |
@@ -539,9 +539,9 @@ discard block |
||
| 539 | 539 | // check whether the poster is on the list of people to ignore |
| 540 | 540 | // |
| 541 | 541 | $ignore_poster = false; |
| 542 | - if ($logged_in_user){ |
|
| 542 | + if ($logged_in_user) { |
|
| 543 | 543 | $tokens = url_tokens($logged_in_user->authenticator); |
| 544 | - if (is_ignoring($logged_in_user, $user)){ |
|
| 544 | + if (is_ignoring($logged_in_user, $user)) { |
|
| 545 | 545 | $ignore_poster = true; |
| 546 | 546 | } |
| 547 | 547 | } |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | // Highlight special users if set in prefs; |
| 580 | 580 | // |
| 581 | - if ($logged_in_user && $logged_in_user->prefs){ |
|
| 581 | + if ($logged_in_user && $logged_in_user->prefs) { |
|
| 582 | 582 | $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special; |
| 583 | 583 | } else { |
| 584 | 584 | $highlight = $is_posted_by_special; |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | echo "<span class=\"small\">"; |
| 600 | 600 | if ($fstatus) echo "$fstatus"; |
| 601 | 601 | |
| 602 | - if (!$filter || !$ignore_poster){ |
|
| 602 | + if (!$filter || !$ignore_poster) { |
|
| 603 | 603 | if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) { |
| 604 | 604 | echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>"; |
| 605 | 605 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | $user->nposts = BoincPost::count("user=$user->id"); |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | - if (function_exists('project_forum_user_info')){ |
|
| 618 | + if (function_exists('project_forum_user_info')) { |
|
| 619 | 619 | project_forum_user_info($user); |
| 620 | 620 | } else { |
| 621 | 621 | echo tra("Posts: %1", $user->nposts)."<br>"; |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">"; |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | - if ($logged_in_user && $post->timestamp > $latest_viewed){ |
|
| 657 | + if ($logged_in_user && $post->timestamp > $latest_viewed) { |
|
| 658 | 658 | show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT); |
| 659 | 659 | } |
| 660 | 660 | |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | if ($post->modified) { |
| 675 | 675 | echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified)); |
| 676 | 676 | } |
| 677 | - if ($ignore_poster && $filter){ |
|
| 677 | + if ($ignore_poster && $filter) { |
|
| 678 | 678 | echo "<br>" .tra( |
| 679 | 679 | "This post is hidden because the sender is on your 'ignore' list. Click %1 here %2 to view hidden posts", |
| 680 | 680 | "<a href=\"?id=".$thread->id."&filter=false&start=$start#".$post->id."\">", |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | <p> |
| 689 | 689 | "; |
| 690 | 690 | |
| 691 | - if (!$filter || !$ignore_poster){ |
|
| 691 | + if (!$filter || !$ignore_poster) { |
|
| 692 | 692 | $posttext = $post->content; |
| 693 | 693 | |
| 694 | 694 | // If the creator of this post has a signature and |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | // user has signatures enabled: show it |
| 697 | 697 | // |
| 698 | 698 | $posttext = output_transform($posttext, $options); |
| 699 | - if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){ |
|
| 699 | + if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) { |
|
| 700 | 700 | $sig = output_transform($user->prefs->signature, $options); |
| 701 | 701 | $posttext .= "<hr>$sig\n"; |
| 702 | 702 | } |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | $content = output_transform($post->content, $options); |
| 756 | 756 | $when = time_diff_str($post->timestamp, time()); |
| 757 | 757 | $user = BoincUser::lookup_id($post->user); |
| 758 | - if (!$user){ |
|
| 758 | + if (!$user) { |
|
| 759 | 759 | return; |
| 760 | 760 | } |
| 761 | 761 | |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | |
| 1090 | 1090 | $sql = 'forum = ' . $forumID ; |
| 1091 | 1091 | $stickysql = ""; |
| 1092 | - if ($sticky){ |
|
| 1092 | + if ($sticky) { |
|
| 1093 | 1093 | $stickysql = "sticky DESC, "; |
| 1094 | 1094 | } |
| 1095 | 1095 | if (!$show_hidden) { |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | // |
| 1171 | 1171 | function show_post_moderation_links( |
| 1172 | 1172 | $config, $logged_in_user, $post, $forum, $tokens |
| 1173 | -){ |
|
| 1173 | +) { |
|
| 1174 | 1174 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
| 1175 | 1175 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
| 1176 | 1176 | |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $owner = BoincUser::lookup_id($thread->owner); |
| 38 | -if ($logged_in_user->id == $owner->id){ |
|
| 38 | +if ($logged_in_user->id == $owner->id) { |
|
| 39 | 39 | $action = get_str("action"); |
| 40 | 40 | if ($action == "set") { |
| 41 | 41 | $ret = $thread->update("status=1"); |
| 42 | 42 | } else { |
| 43 | 43 | $ret = $thread->update("status=0"); |
| 44 | 44 | } |
| 45 | - if (!$ret){ |
|
| 45 | + if (!$ret) { |
|
| 46 | 46 | error_page("Could not update the status of the thread: ".$thread->id); |
| 47 | 47 | } |
| 48 | 48 | } else { |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | proc_terminate($p); |
| 39 | 39 | // echo "child process is $ret\n"; |
| 40 | 40 | $pids=preg_split('/\s+/',$ret); |
| 41 | - foreach($pids as $pid){ |
|
| 42 | - if(is_numeric($pid)){ |
|
| 41 | + foreach($pids as $pid) { |
|
| 42 | + if(is_numeric($pid)) { |
|
| 43 | 43 | if($GLOBALS["debug"])echo "killing child process $pid\n"; |
| 44 | 44 | posix_kill($pid,9); |
| 45 | 45 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $p = proc_open("$cmd", $descs, $pipes); |
| 61 | 61 | while (1) { |
| 62 | 62 | $ctime=time(); |
| 63 | - if($ctime-$stime >=2 and ! file_exists("log.1")){ |
|
| 63 | + if($ctime-$stime >=2 and ! file_exists("log.1")) { |
|
| 64 | 64 | if($GLOBALS["debug"]) echo "time out "."<br>"; |
| 65 | 65 | terminate_job($p); |
| 66 | 66 | break; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $steps = $end_step-$start_step; |
| 158 | 158 | $avg_cpu = $cpu/$steps; |
| 159 | 159 | #$avg_cpu = $cpu/$count; |
| 160 | - if ($GLOBALS["debug"]){ |
|
| 160 | + if ($GLOBALS["debug"]) { |
|
| 161 | 161 | echo "test steps is ".$steps."<br>"; |
| 162 | 162 | echo "avg_cpu is ".$avg_cpu."<br>"; |
| 163 | 163 | } |
@@ -169,20 +169,19 @@ discard block |
||
| 169 | 169 | return array($avg_cpu,$test_steps); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | -function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){ |
|
| 172 | +function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps) { |
|
| 173 | 173 | $dump_types = 0; |
| 174 | 174 | $fd = fopen($lammps_script,"r"); |
| 175 | - if (!$fd){ |
|
| 175 | + if (!$fd) { |
|
| 176 | 176 | echo "can not open file $lammps_script\n"; |
| 177 | 177 | exit(-1); |
| 178 | 178 | } |
| 179 | - while (!feof($fd)){ |
|
| 179 | + while (!feof($fd)) { |
|
| 180 | 180 | $line = fgets($fd, 4096); |
| 181 | 181 | //if (preg_match("/^\s*dump/", $line) |
| 182 | 182 | // and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER)) |
| 183 | 183 | |
| 184 | - if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
|
| 185 | - { |
|
| 184 | + if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) { |
|
| 186 | 185 | if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
| 187 | 186 | |
| 188 | 187 | $dump_types=(int)$matches[1]; |
@@ -194,7 +193,7 @@ discard block |
||
| 194 | 193 | |
| 195 | 194 | $structure_file_size = filesize($structure_file); |
| 196 | 195 | $fd = fopen($cmd_file,"r"); |
| 197 | - if (!$fd){ |
|
| 196 | + if (!$fd) { |
|
| 198 | 197 | echo "can not open file $cmd_file\n"; |
| 199 | 198 | exit(-1); |
| 200 | 199 | } |
@@ -202,10 +201,10 @@ discard block |
||
| 202 | 201 | |
| 203 | 202 | $loopno=1; |
| 204 | 203 | $looprun=1; |
| 205 | - while (!feof($fd)){ |
|
| 204 | + while (!feof($fd)) { |
|
| 206 | 205 | $line = fgets($fd,4096); |
| 207 | - if(preg_match("/loopnumber\s+\d+/", $line, $matches)){ |
|
| 208 | - if(preg_match("/\d+/", $matches[0], $no)){ |
|
| 206 | + if(preg_match("/loopnumber\s+\d+/", $line, $matches)) { |
|
| 207 | + if(preg_match("/\d+/", $matches[0], $no)) { |
|
| 209 | 208 | //$loopno=$no[0]; |
| 210 | 209 | if($no[0]>$loopno)$loopno=$no[0]; |
| 211 | 210 | } |
@@ -215,7 +214,7 @@ discard block |
||
| 215 | 214 | } |
| 216 | 215 | } |
| 217 | 216 | fclose($fd); |
| 218 | - if($GLOBALS["debug"]){ |
|
| 217 | + if($GLOBALS["debug"]) { |
|
| 219 | 218 | print "max loopno(number of loops to run)=".$loopno."<br>"; |
| 220 | 219 | print "max looprun(steps for each loop)=".$looprun."<br>"; |
| 221 | 220 | } |
@@ -231,7 +230,7 @@ discard block |
||
| 231 | 230 | $app_fixed_size = 5e7; |
| 232 | 231 | $est_size = $log_size+$dump_size+$app_fixed_size; |
| 233 | 232 | |
| 234 | - if($GLOBALS["debug"]){ |
|
| 233 | + if($GLOBALS["debug"]) { |
|
| 235 | 234 | print "test_steps=".$test_steps."<br>"; |
| 236 | 235 | print "test_log_size=".$test_log_size."<br>"; |
| 237 | 236 | print "log_size1=".$log_size1."<br>"; |
@@ -367,7 +366,7 @@ discard block |
||
| 367 | 366 | $err="Your test job <strong>failed</strong> |
| 368 | 367 | <br>Please refer to the following Error Message:<br><p> |
| 369 | 368 | "; |
| 370 | - foreach($err_msgs as $line){ |
|
| 369 | + foreach($err_msgs as $line) { |
|
| 371 | 370 | $err=$err.$line."<br>"; |
| 372 | 371 | } |
| 373 | 372 | $err=$err." <p> |
@@ -380,9 +379,9 @@ discard block |
||
| 380 | 379 | $info->rsc_fpops_est = $est_cpu_time * 1.5e9; |
| 381 | 380 | $info->rsc_fpops_bound = $info->rsc_fpops_est * 20; |
| 382 | 381 | |
| 383 | - if ($disk==0){ |
|
| 382 | + if ($disk==0) { |
|
| 384 | 383 | $info->rsc_disk_bound=1000000; |
| 385 | - } else{ |
|
| 384 | + } else { |
|
| 386 | 385 | $info->rsc_disk_bound = $disk; |
| 387 | 386 | } |
| 388 | 387 | |
@@ -444,7 +443,7 @@ discard block |
||
| 444 | 443 | |
| 445 | 444 | $njobs=0; |
| 446 | 445 | $cmdlines = file($info->cmdline_file_path); |
| 447 | - foreach ($cmdlines as $cmdline){ |
|
| 446 | + foreach ($cmdlines as $cmdline) { |
|
| 448 | 447 | if (preg_match("/^\s*-var/", $cmdline)) { |
| 449 | 448 | $njobs++; |
| 450 | 449 | } |
@@ -460,7 +459,7 @@ discard block |
||
| 460 | 459 | |
| 461 | 460 | $i = 0; |
| 462 | 461 | foreach ($cmdlines as $cmdline) { |
| 463 | - if (preg_match("/^\s*-var/", $cmdline)){ |
|
| 462 | + if (preg_match("/^\s*-var/", $cmdline)) { |
|
| 464 | 463 | submit_job($app, $batch_id, $info, $cmdline, $i); |
| 465 | 464 | $i++; |
| 466 | 465 | } |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | $format = get_str("format", true); |
| 41 | 41 | |
| 42 | -if ($format=="xml"){ |
|
| 42 | +if ($format=="xml") { |
|
| 43 | 43 | // don't do caching for XML |
| 44 | 44 | xml_header(); |
| 45 | 45 | $retval = db_init_xml(); |
| 46 | 46 | if ($retval) xml_error($retval); |
| 47 | - if ($auth){ |
|
| 47 | + if ($auth) { |
|
| 48 | 48 | $user = BoincUser::lookup_auth($auth); |
| 49 | 49 | $show_hosts = true; |
| 50 | 50 | } else { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // |
| 61 | 61 | $cache_args="userid=".$id; |
| 62 | 62 | $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args); |
| 63 | - if ($cached_data){ |
|
| 63 | + if ($cached_data) { |
|
| 64 | 64 | // We found some old but non-stale data, let's use it |
| 65 | 65 | $data = unserialize($cached_data); |
| 66 | 66 | $user = $data->user; |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Delete a user if they have no credit, results, or posts |
| 41 | 41 | // |
| 42 | -function possibly_delete_user($user){ |
|
| 43 | - if ($user->total_credit > 0.0){ |
|
| 42 | +function possibly_delete_user($user) { |
|
| 43 | + if ($user->total_credit > 0.0) { |
|
| 44 | 44 | admin_error_page("Cannot delete user: User has credit."); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | admin_error_page("Cannot delete user: User has forum posts."); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if ($user->teamid){ |
|
| 59 | + if ($user->teamid) { |
|
| 60 | 60 | user_quit_team($user); |
| 61 | 61 | } |
| 62 | 62 | delete_user($user); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // put a timestamp in wiki to trigger re-validation of credentials |
| 102 | 102 | |
| 103 | - if (function_exists('touch_wiki_user')){ |
|
| 103 | + if (function_exists('touch_wiki_user')) { |
|
| 104 | 104 | touch_wiki_user($user); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -43,14 +43,15 @@ |
||
| 43 | 43 | $forum_preferencess = _mysql_query("select * from forum_preferences where userid>$start_id order by userid"); |
| 44 | 44 | echo _mysql_error(); |
| 45 | 45 | $i=0; |
| 46 | - while ($forum_preferences = _mysql_fetch_object($forum_preferencess)){ |
|
| 46 | + while ($forum_preferences = _mysql_fetch_object($forum_preferencess)) { |
|
| 47 | 47 | $i++; |
| 48 | - if ($i%100 == 0) { //For every 100 forum_preferencess |
|
| 48 | + if ($i%100 == 0) { |
|
| 49 | +//For every 100 forum_preferencess |
|
| 49 | 50 | echo $forum_preferences->userid.". "; flush(); // print out where we are |
| 50 | 51 | //usleep(200000); |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - if ($forum_preferences->userid > $start_id){ |
|
| 54 | + if ($forum_preferences->userid > $start_id) { |
|
| 54 | 55 | fix_forum_preferences($forum_preferences); |
| 55 | 56 | } |
| 56 | 57 | } |
@@ -45,14 +45,15 @@ |
||
| 45 | 45 | $posts = _mysql_query("select * from post where id>$start_id order by id"); |
| 46 | 46 | echo _mysql_error(); |
| 47 | 47 | $i=0; |
| 48 | - while ($post = _mysql_fetch_object($posts)){ |
|
| 48 | + while ($post = _mysql_fetch_object($posts)) { |
|
| 49 | 49 | $i++; |
| 50 | - if ($i%100 == 0) { //For every 100 posts |
|
| 50 | + if ($i%100 == 0) { |
|
| 51 | +//For every 100 posts |
|
| 51 | 52 | echo $post->id.". "; flush(); // print out where we are |
| 52 | 53 | //usleep(200000); |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | - if ($post->id > $start_id){ |
|
| 56 | + if ($post->id > $start_id) { |
|
| 56 | 57 | fix_post($post); |
| 57 | 58 | } |
| 58 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $email_validated = $row->email_validated; |
| 68 | 68 | |
| 69 | 69 | $team_name=""; |
| 70 | - if($row->teamid > 0){ |
|
| 70 | + if($row->teamid > 0) { |
|
| 71 | 71 | $team = BoincTeam::lookup_id($row->teamid); |
| 72 | 72 | $team_name = $team->name; |
| 73 | 73 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | if ($special_bits != "0") { |
| 81 | 81 | for ($i = 0; $i < 7; $i++) { |
| 82 | 82 | $bit = substr($special_bits, $i, 1); |
| 83 | - if ($bit == '1'){ |
|
| 83 | + if ($bit == '1') { |
|
| 84 | 84 | if (!empty($roles)) { |
| 85 | 85 | $roles .= ", "; |
| 86 | 86 | } |
@@ -97,8 +97,7 @@ discard block |
||
| 97 | 97 | $dt = $user->banished_until - time(); |
| 98 | 98 | if( $dt > 0 ) { |
| 99 | 99 | $x = "<span style=\"color: #ff0000\">Currently banished</span>"; |
| 100 | - } |
|
| 101 | - else { |
|
| 100 | + } else { |
|
| 102 | 101 | $x = "<span style=\"color: #ff9900\">Previously banished</span>"; |
| 103 | 102 | } |
| 104 | 103 | $roles .= $x; |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | FROM forum_preferences as prefs, user |
| 38 | 38 | WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id" |
| 39 | 39 | ); |
| 40 | -for ($i=1; $i<=_mysql_num_rows($result); $i++){ |
|
| 40 | +for ($i=1; $i<=_mysql_num_rows($result); $i++) { |
|
| 41 | 41 | $foo = _mysql_fetch_object($result); |
| 42 | 42 | echo "<form action=\"manage_special_users_action.php\" method=\"POST\">\n"; |
| 43 | 43 | echo "<input type=\"hidden\" name=\"userid\" value=\"$foo->userid\" |