@@ -231,6 +231,9 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | +/** |
|
| 235 | + * @param resource $log |
|
| 236 | + */ |
|
| 234 | 237 | function do_batch($startid, $n, $log) { |
| 235 | 238 | $result = _mysql_query( |
| 236 | 239 | "select * from user where id>$startid order by id limit $n" |
@@ -245,6 +248,9 @@ discard block |
||
| 245 | 248 | return $startid; |
| 246 | 249 | } |
| 247 | 250 | |
| 251 | +/** |
|
| 252 | + * @param resource $log |
|
| 253 | + */ |
|
| 248 | 254 | function do_one($thisid, $log) { |
| 249 | 255 | $result = _mysql_query( |
| 250 | 256 | "select * from user where id=$thisid" |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $globals->batch = 1000; |
| 56 | 56 | $globals->lapsed_interval = 60*86400; |
| 57 | 57 | |
| 58 | -for ($i=1; $i<$argc; $i++) { |
|
| 58 | +for ($i = 1; $i < $argc; $i++) { |
|
| 59 | 59 | if ($argv[$i] == "--batch") { |
| 60 | 60 | $i++; |
| 61 | 61 | $globals->batch = $argv[$i]; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | gmdate('d F Y', $user->create_time), |
| 170 | 170 | number_format($user->total_credit, 0), |
| 171 | 171 | opt_out_url($user), |
| 172 | - floor((time() - $user->last_rpc_time) / 86400), |
|
| 172 | + floor((time() - $user->last_rpc_time)/86400), |
|
| 173 | 173 | ); |
| 174 | 174 | return preg_replace($pat, $rep, $template); |
| 175 | 175 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | while ($user = _mysql_fetch_object($result)) { |
| 239 | 239 | handle_user($user); |
| 240 | 240 | $startid = $user->id; |
| 241 | - fputs($log, $user->id . "\n"); |
|
| 241 | + fputs($log, $user->id."\n"); |
|
| 242 | 242 | fflush($log); |
| 243 | 243 | } |
| 244 | 244 | _mysql_free_result($result); |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $user = _mysql_fetch_object($result); |
| 253 | 253 | if ($user) { |
| 254 | 254 | handle_user($user); |
| 255 | - fputs($log, $user->id . "\n"); |
|
| 255 | + fputs($log, $user->id."\n"); |
|
| 256 | 256 | fflush($log); |
| 257 | 257 | } |
| 258 | 258 | _mysql_free_result($result); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } else { |
| 290 | 290 | $fid = fopen($id_file, 'r'); |
| 291 | 291 | if (!$fid) { |
| 292 | - echo $id_file . ' not found - create ID list and run again\n'; |
|
| 292 | + echo $id_file.' not found - create ID list and run again\n'; |
|
| 293 | 293 | exit(); |
| 294 | 294 | } |
| 295 | 295 | $thisid = 0; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | fclose($fid); |
| 302 | 302 | } |
| 303 | - echo 'All done!' . "\n"; |
|
| 303 | + echo 'All done!'."\n"; |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | if (!function_exists('make_php_mailer')) { |
@@ -39,6 +39,9 @@ |
||
| 39 | 39 | BoincNotify::delete_aux("create_time < $t"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | +/** |
|
| 43 | + * @param string $message |
|
| 44 | + */ |
|
| 42 | 45 | function send_notify_email($userid, $message) { |
| 43 | 46 | $user = BoincUser::lookup_id($userid); |
| 44 | 47 | $subject = "Daily notification summary from ".PROJECT; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // delete notifications older than 90 days |
| 36 | 36 | // |
| 37 | 37 | function delete_old_notifies() { |
| 38 | - $t = time()-90*86400; |
|
| 38 | + $t = time() - 90*86400; |
|
| 39 | 39 | BoincNotify::delete_aux("create_time < $t"); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | function send_notify_emails() { |
| 62 | 62 | $db = BoincDb::get(); |
| 63 | 63 | |
| 64 | - $t = time() - (86400 + 3600); // 1-hour slop factor |
|
| 64 | + $t = time() - (86400 + 3600); // 1-hour slop factor |
|
| 65 | 65 | $query = "select notify.* from ".$db->db_name.".notify, ".$db->db_name.".forum_preferences where forum_preferences.pm_notification=2 and notify.userid = forum_preferences.userid and notify.create_time > $t"; |
| 66 | 66 | |
| 67 | 67 | $notifies = BoincNotify::enum_general($query); |
@@ -41,6 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // see if a web server is running at the given URL |
| 43 | 43 | // |
| 44 | +/** |
|
| 45 | + * @param string $url |
|
| 46 | + */ |
|
| 44 | 47 | function web_server_running($url) { |
| 45 | 48 | $u = parse_url($url); |
| 46 | 49 | $url = $u['scheme']."://".$u['host']; |
@@ -56,6 +59,9 @@ discard block |
||
| 56 | 59 | |
| 57 | 60 | // see if the given daemon is running on the host by checking its PID |
| 58 | 61 | // |
| 62 | +/** |
|
| 63 | + * @param string $host |
|
| 64 | + */ |
|
| 59 | 65 | function is_daemon_running($host, $d) { |
| 60 | 66 | if ($d->pid_file) { |
| 61 | 67 | $path = "../../pid_$host/".(string)$d->pid_file; |
@@ -80,41 +80,41 @@ |
||
| 80 | 80 | die("can't parse config file\n"); |
| 81 | 81 | } |
| 82 | 82 | $config = $c->config; |
| 83 | - $master_url = (string) $config->master_url; |
|
| 83 | + $master_url = (string)$config->master_url; |
|
| 84 | 84 | $u = parse_url($master_url); |
| 85 | 85 | $master_host = $u["host"]; |
| 86 | 86 | |
| 87 | - $url = (string) $config->download_url; |
|
| 87 | + $url = (string)$config->download_url; |
|
| 88 | 88 | $u = parse_url($url); |
| 89 | 89 | $h = $u["host"]; |
| 90 | 90 | if ($h != $master_host) { |
| 91 | 91 | $y = new StdClass; |
| 92 | 92 | $y->cmd = 'Download server'; |
| 93 | 93 | $y->host = $h; |
| 94 | - $y->status = web_server_running($url)?1:0; |
|
| 94 | + $y->status = web_server_running($url) ? 1 : 0; |
|
| 95 | 95 | $x[] = $y; |
| 96 | 96 | } |
| 97 | - $url = (string) $config->upload_url; |
|
| 97 | + $url = (string)$config->upload_url; |
|
| 98 | 98 | $u = parse_url($url); |
| 99 | 99 | $h = $u["host"]; |
| 100 | 100 | if ($h != $master_host) { |
| 101 | 101 | $y = new StdClass; |
| 102 | 102 | $y->cmd = 'Upload server'; |
| 103 | 103 | $y->host = $h; |
| 104 | - $y->status = web_server_running($url)?1:0; |
|
| 104 | + $y->status = web_server_running($url) ? 1 : 0; |
|
| 105 | 105 | $x[] = $y; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $main_host = (string)$c->config->host; |
| 109 | 109 | if ($c->config->www_host) { |
| 110 | - $web_host = (string) $c->config->www_host; |
|
| 110 | + $web_host = (string)$c->config->www_host; |
|
| 111 | 111 | } else { |
| 112 | 112 | $web_host = $main_host; |
| 113 | 113 | } |
| 114 | 114 | $daemons = $c->daemons; |
| 115 | 115 | foreach ($daemons->daemon as $d) { |
| 116 | 116 | if ((int)$d->disabled != 0) continue; |
| 117 | - $host = $d->host?(string)$d->host:$main_host; |
|
| 117 | + $host = $d->host ? (string)$d->host : $main_host; |
|
| 118 | 118 | if ($host != $web_host) { |
| 119 | 119 | $y = new StdClass; |
| 120 | 120 | $y->cmd = (string)$d->cmd; |
@@ -107,10 +107,18 @@ |
||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | +/** |
|
| 111 | + * @param integer $i |
|
| 112 | + * |
|
| 113 | + * @return string |
|
| 114 | + */ |
|
| 110 | 115 | function app_version_dir($app_name, $i, $platform) { |
| 111 | 116 | return "apps/$app_name/1.$i/$platform"; |
| 112 | 117 | } |
| 113 | 118 | |
| 119 | +/** |
|
| 120 | + * @param integer $i |
|
| 121 | + */ |
|
| 114 | 122 | function make_app_version_dir($app_name, $i, $platform) { |
| 115 | 123 | @mkdir("apps/$app_name"); |
| 116 | 124 | @mkdir("apps/$app_name/1.$i"); |
@@ -58,6 +58,9 @@ |
||
| 58 | 58 | return $x; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | +/** |
|
| 62 | + * @param resource $f |
|
| 63 | + */ |
|
| 61 | 64 | function handle_team($team, $f) { |
| 62 | 65 | echo "Team: $team->name\n"; |
| 63 | 66 | $user = BoincUser::lookup_id($team->userid); |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | $f = fopen("temp.xml", "w"); |
| 101 | 101 | $teams = BoincTeam::enum(null); |
| 102 | 102 | fwrite($f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<teams>\n"); |
| 103 | - foreach($teams as $team) { |
|
| 103 | + foreach ($teams as $team) { |
|
| 104 | 104 | handle_team($team, $f); |
| 105 | 105 | } |
| 106 | 106 | fwrite($f, "</teams>\n"); |
@@ -88,6 +88,9 @@ discard block |
||
| 88 | 88 | return null; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | +/** |
|
| 92 | + * @param stdClass $t |
|
| 93 | + */ |
|
| 91 | 94 | function valid_team($t) { |
| 92 | 95 | if (!$t->id) return false; |
| 93 | 96 | if (!$t->name) return false; |
@@ -96,6 +99,9 @@ discard block |
||
| 96 | 99 | return true; |
| 97 | 100 | } |
| 98 | 101 | |
| 102 | +/** |
|
| 103 | + * @param stdClass $t |
|
| 104 | + */ |
|
| 99 | 105 | function update_team($t, $team, $user) { |
| 100 | 106 | global $dry_run; |
| 101 | 107 | if ( |
@@ -126,6 +132,9 @@ discard block |
||
| 126 | 132 | } |
| 127 | 133 | } |
| 128 | 134 | |
| 135 | +/** |
|
| 136 | + * @param stdClass $t |
|
| 137 | + */ |
|
| 129 | 138 | function insert_case($t, $user) { |
| 130 | 139 | global $master_url; |
| 131 | 140 | global $dry_run; |
@@ -227,7 +227,7 @@ |
||
| 227 | 227 | if ($team->seti_id) { |
| 228 | 228 | if ($team->seti_id == $t->id) { |
| 229 | 229 | echo " case 1\n"; |
| 230 | - update_team($t, $team, $user); // update1 case |
|
| 230 | + update_team($t, $team, $user); // update1 case |
|
| 231 | 231 | } else { |
| 232 | 232 | echo " team exists but has wrong seti_id\n"; |
| 233 | 233 | } |
@@ -63,8 +63,7 @@ discard block |
||
| 63 | 63 | $t->user_postal_code = decode($t->user_postal_code); |
| 64 | 64 | $t->user_url = decode($t->user_url); |
| 65 | 65 | return $t; |
| 66 | - } |
|
| 67 | - else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
| 66 | + } else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
| 68 | 67 | else if (strstr($s, '<url>')) $t->url = parse_element($s, '<url>'); |
| 69 | 68 | else if (strstr($s, '<type>')) $t->type = parse_element($s, '<type>'); |
| 70 | 69 | else if (strstr($s, '<name_html>')) $t->name_html = parse_element($s, '<name_html>'); |
@@ -73,14 +72,12 @@ discard block |
||
| 73 | 72 | if (strstr($s, '</description>')) break; |
| 74 | 73 | $t->description .= $s; |
| 75 | 74 | } |
| 76 | - } |
|
| 77 | - else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
| 75 | + } else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
| 78 | 76 | else if (strstr($s, '<id>')) $t->id = parse_element($s, '<id>'); |
| 79 | 77 | else if (strstr($s, '<user_email_munged>')) { |
| 80 | 78 | $user_email_munged = parse_element($s, '<user_email_munged>'); |
| 81 | 79 | $t->user_email = str_rot13($user_email_munged); |
| 82 | - } |
|
| 83 | - else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
| 80 | + } else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
| 84 | 81 | else if (strstr($s, '<user_country>')) $t->user_country = parse_element($s, '<user_country>'); |
| 85 | 82 | else if (strstr($s, '<user_postal_code>')) $t->user_postal_code = parse_element($s, '<user_postal_code>'); |
| 86 | 83 | else if (strstr($s, '<user_url>')) $t->user_url = parse_element($s, '<user_url>'); |
@@ -212,7 +212,7 @@ |
||
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - echo "Processing $t->name $t->user_email\n"; |
|
| 215 | + echo "processing $t->name $t->user_email\n"; |
|
| 216 | 216 | $user = BoincUser::lookup_email_addr($t->user_email); |
| 217 | 217 | $team = BoincTeam::lookup_name($t->name); |
| 218 | 218 | if ($team) { |
@@ -98,6 +98,9 @@ discard block |
||
| 98 | 98 | // Generates a standard set of links between associated multi-page documents. |
| 99 | 99 | // All linked files must be of the form "$filename_<page number>.html". |
| 100 | 100 | |
| 101 | +/** |
|
| 102 | + * @param integer $currPageNum |
|
| 103 | + */ |
|
| 101 | 104 | function write_page_links($filename, $currPageNum, $numPages) { |
| 102 | 105 | echo "<p>Page $currPageNum of $numPages</p>"; |
| 103 | 106 | |
@@ -332,6 +335,11 @@ discard block |
||
| 332 | 335 | // A generalized function to produce some number of pages summarizing a |
| 333 | 336 | // set of user profiles. |
| 334 | 337 | |
| 338 | +/** |
|
| 339 | + * @param integer $rowsPerPage |
|
| 340 | + * @param integer $colsPerPage |
|
| 341 | + * @param string $dir |
|
| 342 | + */ |
|
| 335 | 343 | function build_profile_pages( |
| 336 | 344 | $members, $title, $rowsPerPage, $colsPerPage, $dir, $base_filename |
| 337 | 345 | ) { |
@@ -200,7 +200,7 @@ |
||
| 200 | 200 | for ($row = 0; $row < $height; $row++) { |
| 201 | 201 | echo "<tr>"; |
| 202 | 202 | for ($col = 0; $col < $width; $col++) { |
| 203 | - if ($count < $numIds) { |
|
| 203 | + if ($count < $numIds) { |
|
| 204 | 204 | echo "<td class=\"bordered\" align=\"center\"> |
| 205 | 205 | <a href=\"".secure_url_base()."view_profile.php?userid=".$userIds[$count]."\"><img src=\"".secure_url_base().IMAGE_URL.$userIds[$count]."_sm.jpg\"></a> |
| 206 | 206 | </td>"; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // TODO: convert to new DB interface |
| 41 | 41 | |
| 42 | -$alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9'); |
|
| 42 | +$alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | // Builds a summary table of user profiles. |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | function show_user_table($members, $offset, $numToDisplay, $cols) { |
| 54 | 54 | start_table(); |
| 55 | 55 | |
| 56 | - $rows = ceil($numToDisplay / $cols); |
|
| 56 | + $rows = ceil($numToDisplay/$cols); |
|
| 57 | 57 | $count = $offset; |
| 58 | 58 | $numMembers = count($members); |
| 59 | 59 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | // Build an array of IDs of all users with pictures in their profiles. |
| 152 | 152 | $userIds = array(); |
| 153 | 153 | $numIds = 0; |
| 154 | - foreach($profiles as $profile) { |
|
| 154 | + foreach ($profiles as $profile) { |
|
| 155 | 155 | $user = BoincUser::lookup_id($profile->userid); |
| 156 | 156 | if (!$user) continue; // maybe we should delete the profile if user is non-existent anymore? |
| 157 | 157 | if ($user->name) { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | // shuffle($userIds); |
| 172 | 172 | // } |
| 173 | 173 | |
| 174 | - $numPages = ceil(count($userIds)/($width * $height)); |
|
| 174 | + $numPages = ceil(count($userIds)/($width*$height)); |
|
| 175 | 175 | |
| 176 | 176 | // Make sure that a page is generated even when no profiles with pictures |
| 177 | 177 | // exist in order to avoid 404 errors from the profile_menu page. |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $count = 0; |
| 186 | 186 | |
| 187 | 187 | for ($page = 1; $page <= $numPages; $page++) { |
| 188 | - $filename = PROFILE_PATH . "user_gallery_" . $page . ".html"; |
|
| 188 | + $filename = PROFILE_PATH."user_gallery_".$page.".html"; |
|
| 189 | 189 | open_output_buffer(); |
| 190 | 190 | |
| 191 | 191 | page_head("Profile gallery: page $page of $numPages", null, false, "../"); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | // of the userids who belong to those countries. |
| 245 | 245 | // Format: array[country][index] = userid. |
| 246 | 246 | |
| 247 | - foreach($profiles as $profile) { |
|
| 247 | + foreach ($profiles as $profile) { |
|
| 248 | 248 | $user = BoincUser::lookup_id($profile->userid); |
| 249 | 249 | if (!$user) continue; // maybe we should delete the profile if user is non-existent anymore? |
| 250 | 250 | if ($user->country) { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | // TODO: Define a constant for the desired number of rows per page. |
| 265 | 265 | |
| 266 | 266 | foreach ($countries as $country) { |
| 267 | - $baseFileName = "profile_country_" . get_legal_filename($country); |
|
| 267 | + $baseFileName = "profile_country_".get_legal_filename($country); |
|
| 268 | 268 | build_profile_pages( |
| 269 | 269 | $countryMembers[$country], |
| 270 | 270 | "User Profiles from $country", 5, 2, |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $numIds = 0; |
| 291 | 291 | $members = array(); |
| 292 | 292 | |
| 293 | - foreach($profiles as $profile) { |
|
| 293 | + foreach ($profiles as $profile) { |
|
| 294 | 294 | $user = BoincUser::lookup_id($profile->userid); |
| 295 | 295 | if (!$user) continue; // maybe we should delete the profile if user is non-existent anymore? |
| 296 | 296 | if ($user->name) { |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | function build_profile_pages( |
| 336 | 336 | $members, $title, $rowsPerPage, $colsPerPage, $dir, $base_filename |
| 337 | 337 | ) { |
| 338 | - $numPerPage = $rowsPerPage * $colsPerPage; |
|
| 339 | - $numPages = ceil(count($members) / $numPerPage); |
|
| 338 | + $numPerPage = $rowsPerPage*$colsPerPage; |
|
| 339 | + $numPages = ceil(count($members)/$numPerPage); |
|
| 340 | 340 | |
| 341 | 341 | for ($page = 1; $page <= $numPages; $page++) { |
| 342 | - $filename = $dir . $base_filename . "_" . $page . ".html"; |
|
| 342 | + $filename = $dir.$base_filename."_".$page.".html"; |
|
| 343 | 343 | open_output_buffer(); |
| 344 | 344 | |
| 345 | 345 | $pagetitle = $title.": Page $page of $numPages"; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | echo "Last updated ", pretty_time_str(time()), "<p>\n"; |
| 349 | 349 | |
| 350 | - $offset = (($page-1) * $rowsPerPage * $colsPerPage); |
|
| 350 | + $offset = (($page - 1)*$rowsPerPage*$colsPerPage); |
|
| 351 | 351 | |
| 352 | 352 | show_user_table($members, $offset, $numPerPage, $colsPerPage); |
| 353 | 353 | |
@@ -364,11 +364,11 @@ discard block |
||
| 364 | 364 | print_debug_msg("Beginning to build country summary page..."); |
| 365 | 365 | $countries = array_keys($countryMembers); |
| 366 | 366 | |
| 367 | - $filename = PROFILE_PATH . "profile_country.html"; |
|
| 367 | + $filename = PROFILE_PATH."profile_country.html"; |
|
| 368 | 368 | open_output_buffer(); |
| 369 | 369 | |
| 370 | 370 | page_head("User Profiles by Country", null, null, "../"); |
| 371 | - echo "Last updated " . pretty_time_str(time()) . "<p>"; |
|
| 371 | + echo "Last updated ".pretty_time_str(time())."<p>"; |
|
| 372 | 372 | |
| 373 | 373 | start_table(); |
| 374 | 374 | row_heading_array(array("Country", "Profiles")); |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | $caching = true; |
| 415 | 415 | |
| 416 | -if (@$argv[1]=="-d") $debug=true; |
|
| 416 | +if (@$argv[1] == "-d") $debug = true; |
|
| 417 | 417 | |
| 418 | 418 | build_country_pages(); |
| 419 | 419 | build_alpha_pages(); |
@@ -180,7 +180,7 @@ |
||
| 180 | 180 | $numPages = 1; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - print_debug_msg("Generating $numPages pages"); |
|
| 183 | + print_debug_msg("generating $numPages pages"); |
|
| 184 | 184 | |
| 185 | 185 | $count = 0; |
| 186 | 186 | |
@@ -23,6 +23,9 @@ |
||
| 23 | 23 | $cli_only = true; |
| 24 | 24 | include_once("util_ops.inc"); |
| 25 | 25 | |
| 26 | +/** |
|
| 27 | + * @param string $x |
|
| 28 | + */ |
|
| 26 | 29 | function fail($x) { |
| 27 | 30 | $f = fopen("error_log", "a"); |
| 28 | 31 | if (!$f) return false; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return $lines; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -function write_count_file($n,$m) { |
|
| 44 | +function write_count_file($n, $m) { |
|
| 45 | 45 | $f = fopen("nresults", "w"); |
| 46 | 46 | if (!$f) return false; |
| 47 | 47 | $x = sprintf("%d\n%d\n", $n, $m); |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | $n = read_count_file(); |
| 82 | 82 | if ($n == false) { |
| 83 | - write_count_file($m,$p); |
|
| 83 | + write_count_file($m, $p); |
|
| 84 | 84 | exit(); |
| 85 | 85 | } |
| 86 | 86 | if (trim($n[0]) == $m && trim($n[1]) == $p) { |
| 87 | 87 | fail("Result count hasn't changed\n"); |
| 88 | 88 | } |
| 89 | - write_count_file($m,$p); |
|
| 89 | + write_count_file($m, $p); |
|
| 90 | 90 | |
| 91 | 91 | ?> |
@@ -32,6 +32,9 @@ discard block |
||
| 32 | 32 | // Parse form variables into XML, and return it. |
| 33 | 33 | // Also error-check values, and return errors in $errors->* |
| 34 | 34 | |
| 35 | +/** |
|
| 36 | + * @param string $name |
|
| 37 | + */ |
|
| 35 | 38 | function option($name, $val) { |
| 36 | 39 | $x = ($name == $val) ? "selected" : ""; |
| 37 | 40 | return "<option name='$name' $x>$name\n"; |
@@ -90,6 +93,10 @@ discard block |
||
| 90 | 93 | return $x; |
| 91 | 94 | } |
| 92 | 95 | |
| 96 | +/** |
|
| 97 | + * @param string $name |
|
| 98 | + * @param integer $max |
|
| 99 | + */ |
|
| 93 | 100 | function number_select($name, $max, $n) { |
| 94 | 101 | $sel = ($n == 0) ? "selected":""; |
| 95 | 102 | $x = "<select class=\"form-control input-sm\" name=$name> <option value=0 $sel>".tra("No limit")."</option>"; |
@@ -106,6 +113,9 @@ discard block |
||
| 106 | 113 | return tra("No limit"); |
| 107 | 114 | } |
| 108 | 115 | |
| 116 | +/** |
|
| 117 | + * @param stdClass $prefs |
|
| 118 | + */ |
|
| 109 | 119 | function project_specific_prefs_edit($prefs, $error=false) { |
| 110 | 120 | global $app_array; |
| 111 | 121 | if (COLOR_PREFS) { |
@@ -162,6 +172,9 @@ discard block |
||
| 162 | 172 | } |
| 163 | 173 | } |
| 164 | 174 | |
| 175 | +/** |
|
| 176 | + * @param boolean $error |
|
| 177 | + */ |
|
| 165 | 178 | function project_specific_prefs_parse_form(&$error) { |
| 166 | 179 | global $app_array; |
| 167 | 180 | $x = ""; |
@@ -216,6 +229,9 @@ discard block |
||
| 216 | 229 | return $x; |
| 217 | 230 | } |
| 218 | 231 | |
| 232 | +/** |
|
| 233 | + * @param stdClass $prefs |
|
| 234 | + */ |
|
| 219 | 235 | function project_specific_prefs_show($prefs, $columns=false) { |
| 220 | 236 | global $app_array; |
| 221 | 237 | if ($columns) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | // Also error-check values, and return errors in $errors->* |
| 34 | 34 | |
| 35 | 35 | function option($name, $val) { |
| 36 | - $x = ($name == $val) ? "selected" : ""; |
|
| 36 | + $x = ($name == $val) ? "selected" : ""; |
|
| 37 | 37 | return "<option name='$name' $x>$name\n"; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | if (APP_SELECT_PREFS) { |
| 54 | 54 | $app_array = array(); |
| 55 | 55 | $apps = BoincApp::enum("deprecated=0"); |
| 56 | - foreach($apps as $app) { |
|
| 56 | + foreach ($apps as $app) { |
|
| 57 | 57 | $app_array[] = array($app->id, $app->user_friendly_name); |
| 58 | 58 | } |
| 59 | 59 | } else { |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | function number_select($name, $max, $n) { |
| 94 | - $sel = ($n == 0) ? "selected":""; |
|
| 94 | + $sel = ($n == 0) ? "selected" : ""; |
|
| 95 | 95 | $x = "<select class=\"form-control input-sm\" name=$name> <option value=0 $sel>".tra("No limit")."</option>"; |
| 96 | - for ($i=1; $i<=$max; $i++) { |
|
| 97 | - $sel = ($n == $i) ? "selected":""; |
|
| 96 | + for ($i = 1; $i <= $max; $i++) { |
|
| 97 | + $sel = ($n == $i) ? "selected" : ""; |
|
| 98 | 98 | $x .= "<option value=$i $sel>$i</option>"; |
| 99 | 99 | } |
| 100 | 100 | $x .= "</select>"; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | return tra("No limit"); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | -function project_specific_prefs_edit($prefs, $error=false) { |
|
| 109 | +function project_specific_prefs_edit($prefs, $error = false) { |
|
| 110 | 110 | global $app_array; |
| 111 | 111 | if (COLOR_PREFS) { |
| 112 | 112 | $x = $prefs->color_scheme; |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | } else { |
| 133 | 133 | $present = true; |
| 134 | 134 | } |
| 135 | - $checked = $present?"checked":""; |
|
| 135 | + $checked = $present ? "checked" : ""; |
|
| 136 | 136 | $x .= "<input type=checkbox name=app_id_$app_id $checked> $app_name<br>"; |
| 137 | 137 | } |
| 138 | 138 | tooltip_row2(APP_SELECT_TOOLTIP, APP_SELECT_DESC, $x); |
| 139 | - $checked = $prefs->allow_non_preferred_apps?"checked":""; |
|
| 139 | + $checked = $prefs->allow_non_preferred_apps ? "checked" : ""; |
|
| 140 | 140 | row2(ACCEPT_ANY_DESC, "<input type=checkbox name=allow_non_preferred_apps $checked>"); |
| 141 | 141 | } |
| 142 | 142 | if (NON_GRAPHICAL_PREF) { |
| 143 | - $checked = $prefs->non_graphical?"checked":""; |
|
| 143 | + $checked = $prefs->non_graphical ? "checked" : ""; |
|
| 144 | 144 | row2( |
| 145 | 145 | NON_GRAPHICAL_DESC, |
| 146 | 146 | "<input type=checkbox name=non_graphical $checked>" |
@@ -216,11 +216,11 @@ discard block |
||
| 216 | 216 | return $x; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | -function project_specific_prefs_show($prefs, $columns=false) { |
|
| 219 | +function project_specific_prefs_show($prefs, $columns = false) { |
|
| 220 | 220 | global $app_array; |
| 221 | 221 | if ($columns) { |
| 222 | 222 | if (COLOR_PREFS) { |
| 223 | - row_defs(COLOR_DESC,"color_scheme", "", "", $prefs); |
|
| 223 | + row_defs(COLOR_DESC, "color_scheme", "", "", $prefs); |
|
| 224 | 224 | } |
| 225 | 225 | if (GFX_CPU_PREFS) { |
| 226 | 226 | row_defs(MAX_GFX_CPU_PCT_DESC, "max_gfx_cpu_pct", "", "", $prefs); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | row2(ACCEPT_ANY_DESC, $prefs->allow_non_preferred_apps_text); |
| 255 | 255 | } |
| 256 | 256 | if (NON_GRAPHICAL_PREF) { |
| 257 | - row2(NON_GRAPHICAL_DESC, $prefs->non_graphical?tra("yes"):tra("no")); |
|
| 257 | + row2(NON_GRAPHICAL_DESC, $prefs->non_graphical ?tra("yes") : tra("no")); |
|
| 258 | 258 | } |
| 259 | 259 | if (MAX_JOBS_PREF) { |
| 260 | 260 | row2(tra("Max # jobs"), limit_string($prefs->max_jobs)); |
@@ -277,12 +277,12 @@ discard block |
||
| 277 | 277 | $cursor = 0; |
| 278 | 278 | while ($thisxml = parse_next_element($prefs_xml, "<app_id>", $cursor)) { |
| 279 | 279 | if (is_numeric($thisxml)) { |
| 280 | - $n = (int) $thisxml; |
|
| 280 | + $n = (int)$thisxml; |
|
| 281 | 281 | $prefs->app_ids[] = $n; |
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | $prefs->allow_non_preferred_apps = parse_element($prefs_xml, "<allow_non_preferred_apps>"); |
| 285 | - $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps?"yes":"no"; |
|
| 285 | + $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps ? "yes" : "no"; |
|
| 286 | 286 | } |
| 287 | 287 | if (NON_GRAPHICAL_PREF) { |
| 288 | 288 | $prefs->non_graphical = parse_bool($prefs_xml, "non_graphical"); |
@@ -296,6 +296,6 @@ discard block |
||
| 296 | 296 | return $prefs; |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 299 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 300 | 300 | |
| 301 | 301 | ?> |