@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | // changing the tree in a loop has strange results so do it separately |
77 | 77 | $to_remove = array(); |
78 | 78 | $ids = array(); |
79 | - foreach($appids as $elem) { |
|
79 | + foreach ($appids as $elem) { |
|
80 | 80 | $ids[] = $elem->nodeValue; |
81 | 81 | $to_remove[] = $elem; |
82 | 82 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | exit(1); |
95 | 95 | } |
96 | 96 | $appids = $node->getElementsByTagName("app_id"); |
97 | - if ($appids->length == 0 ) return; |
|
97 | + if ($appids->length == 0) return; |
|
98 | 98 | // changing the tree in a loop has strange results so do it separately |
99 | 99 | $to_remove = array(); |
100 | 100 | $ids = array(); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $to_remove = array(); |
130 | 130 | foreach ($subNodes as $subNode) { |
131 | 131 | // ignore empty text nodes which are basically whitespace from indentation (only relevant if preserveWhiteSpace is set to true above) |
132 | - if (($subNode->nodeType != XML_TEXT_NODE) || (($subNode->nodeType == XML_TEXT_NODE) &&(strlen(trim($subNode->wholeText))>=1))) { |
|
132 | + if (($subNode->nodeType != XML_TEXT_NODE) || (($subNode->nodeType == XML_TEXT_NODE) && (strlen(trim($subNode->wholeText)) >= 1))) { |
|
133 | 133 | if ($subNode->nodeName == "venue") { |
134 | 134 | if (!$subNode->hasChildNodes()) { |
135 | 135 | // empty venue tag, clean this up too |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // In Drupal 7, these operation cases will all exist as their own hooks, |
80 | 80 | // so let's approximate that here so that this function can simply be removed |
81 | 81 | // upon migration to 7 |
82 | - switch($op) { |
|
82 | + switch ($op) { |
|
83 | 83 | case 'update': |
84 | 84 | boinctranslate_node_update($node); |
85 | 85 | break; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | function boinctranslate_node_update($node) { |
99 | 99 | // Only process nodes of certain types as defined by the individual |
100 | 100 | // node's setting for field_boinctranslate_transifex. |
101 | - if ( ($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value']=='1') ) { |
|
101 | + if (($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value'] == '1')) { |
|
102 | 102 | // Add page content to translation table. |
103 | 103 | $textgroup = 'project'; |
104 | 104 | $location = "node:{$node->nid}:body"; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | // Only process this chunk if there is a hash associated with it. |
127 | 127 | if ($chunk['hash']) { |
128 | - $chunkloc = $location . ":{$chunk['hash']}"; |
|
128 | + $chunkloc = $location.":{$chunk['hash']}"; |
|
129 | 129 | |
130 | 130 | // If the hash for this chunk is in the hash table, logically |
131 | 131 | // the chunk is already in the database locales_source table. As |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * is viewed (forward compatible to Drupal 7) |
180 | 180 | */ |
181 | 181 | function boinctranslate_node_view($node, $view_mode, $langcode) { |
182 | - switch($node->type) { |
|
182 | + switch ($node->type) { |
|
183 | 183 | case 'page': |
184 | 184 | break; |
185 | 185 | default: |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | array( |
203 | 203 | '!token' => l('#SPLIT_TOKEN#', "filter/tips/$format", |
204 | 204 | array( |
205 | - 'fragment' => 'filter-boinctranslate-' . $delta, |
|
205 | + 'fragment' => 'filter-boinctranslate-'.$delta, |
|
206 | 206 | 'attributes' => |
207 | 207 | array( |
208 | 208 | 'target'=>'_blank', |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | return $text; |
239 | 239 | } |
240 | 240 | |
241 | - if ( ($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value']=='1') ) { |
|
241 | + if (($node->field_boinctranslate_transifex) and ($node->field_boinctranslate_transifex[0]['value'] == '1')) { |
|
242 | 242 | if (variable_get("boinctranslate_filter_debug_$format", 0)) { |
243 | 243 | $timing_start = explode(' ', microtime()); |
244 | 244 | $ret = _boinctranslate_filter_process($text, $format, $mynid); |
245 | 245 | $timing_stop = explode(' ', microtime()); |
246 | 246 | $elapsed = $timing_stop[1] - $timing_start[1]; |
247 | 247 | $elapsed += $timing_stop[0] - $timing_start[0]; |
248 | - $mess = 'DEBUG ' . l('BOINC translate', "filter/tips/$format") .' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.'; |
|
248 | + $mess = 'DEBUG '.l('BOINC translate', "filter/tips/$format").' parsed on '.date('r').'<br />Execution time: '.$elapsed.' seconds.'; |
|
249 | 249 | drupal_set_message($mess, 'warning'); |
250 | 250 | return $ret; |
251 | 251 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $chunks = array(); |
309 | 309 | foreach ($parts as $key => $value) { |
310 | 310 | if (preg_match('/(#SPLIT_TOKEN#)/', $value)) { |
311 | - $chunks[] = array ('delimiter' => $value,); |
|
311 | + $chunks[] = array('delimiter' => $value,); |
|
312 | 312 | } |
313 | 313 | else { |
314 | 314 | $cleaned = preg_replace('/\s|\n/', '', $value); |
@@ -65,7 +65,7 @@ |
||
65 | 65 | // (so that bad guys can't tell if they have an unreplicated job) |
66 | 66 | |
67 | 67 | $config = get_config(); |
68 | - if ($app->target_nresults>0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) { |
|
68 | + if ($app->target_nresults > 0 && !$wu->canonical_resultid && !$wu->error_mask && !parse_bool($config, "dont_suppress_pending")) { |
|
69 | 69 | row2(tra("Tasks in progress"), tra("suppressed pending completion")); |
70 | 70 | end_table(); |
71 | 71 | } else { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // |
33 | 33 | function get_pct_badges($badge_name_prefix, $badge_pctiles, $badge_images) { |
34 | 34 | $badges = array(); |
35 | - for ($i=0; $i<3; $i++) { |
|
35 | + for ($i = 0; $i < 3; $i++) { |
|
36 | 36 | $badges[$i] = get_badge($badge_name_prefix."_".$i, "Top ".$badge_pctiles[$i]."% in average credit", $badge_images[$i]); |
37 | 37 | } |
38 | 38 | return $badges; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | // |
43 | 43 | function get_percentiles($is_user, $badge_pctiles) { |
44 | 44 | $percentiles = array(); |
45 | - for ($i=0; $i<3; $i++) { |
|
45 | + for ($i = 0; $i < 3; $i++) { |
|
46 | 46 | if ($is_user) { |
47 | - $percentiles[$i] = BoincUser::percentile("expavg_credit", "expavg_credit>1", 100-$badge_pctiles[$i]); |
|
47 | + $percentiles[$i] = BoincUser::percentile("expavg_credit", "expavg_credit>1", 100 - $badge_pctiles[$i]); |
|
48 | 48 | } else { |
49 | - $percentiles[$i] = BoincTeam::percentile("expavg_credit", "expavg_credit>1", 100-$badge_pctiles[$i]); |
|
49 | + $percentiles[$i] = BoincTeam::percentile("expavg_credit", "expavg_credit>1", 100 - $badge_pctiles[$i]); |
|
50 | 50 | } |
51 | 51 | if ($percentiles[$i] === false) { |
52 | 52 | die("Can't get percentiles\n"); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // Unassign other badges. |
60 | 60 | // |
61 | 61 | function assign_pct_badge($is_user, $item, $percentiles, $badges) { |
62 | - for ($i=0; $i<3; $i++) { |
|
62 | + for ($i = 0; $i < 3; $i++) { |
|
63 | 63 | if ($item->expavg_credit >= $percentiles[$i]) { |
64 | 64 | assign_badge($is_user, $item, $badges[$i]); |
65 | 65 | unassign_badges($is_user, $item, $badges, $i); |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | // and assign/unassign RAC badges |
74 | 74 | // |
75 | 75 | function assign_badges($is_user, $badge_pctiles, $badge_images) { |
76 | - $kind = $is_user?"user":"team"; |
|
76 | + $kind = $is_user ? "user" : "team"; |
|
77 | 77 | $badges = get_pct_badges($kind."_pct", $badge_pctiles, $badge_images); |
78 | 78 | $pctiles = get_percentiles($is_user, $badge_pctiles); |
79 | 79 | //echo "thresholds for $kind badges: $pctiles[0] $pctiles[1] $pctiles[2]\n"; |
80 | 80 | |
81 | 81 | $n = 0; |
82 | - $maxid = $is_user?BoincUser::max("id"):BoincTeam::max("id"); |
|
82 | + $maxid = $is_user ?BoincUser::max("id") : BoincTeam::max("id"); |
|
83 | 83 | while ($n <= $maxid) { |
84 | 84 | $m = $n + 1000; |
85 | 85 | if ($is_user) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ) { |
78 | 78 | $badges = array(); |
79 | 79 | $limit = count($badge_level_names); |
80 | - for ($i=0; $i < $limit; $i++) { |
|
80 | + for ($i = 0; $i < $limit; $i++) { |
|
81 | 81 | $badges[$i] = get_badge($badge_name_prefix."_".$sub_project["short_name"]."_".$i, "$badge_level_names[$i] in ".$sub_project["name"]." credit", $sub_project["short_name"].$badge_images[$i]); |
82 | 82 | } |
83 | 83 | return $badges; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | // count from highest to lowest level, so the user get's assigned the |
91 | 91 | // highest possible level and the lower levels get removed |
92 | 92 | // |
93 | - for ($i=count($levels)-1; $i>=0; $i--) { |
|
93 | + for ($i = count($levels) - 1; $i >= 0; $i--) { |
|
94 | 94 | if ($item->total_credit >= $levels[$i]) { |
95 | 95 | assign_badge($is_user, $item, $badges[$i]); |
96 | 96 | unassign_badges($is_user, $item, $badges, $i); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // count from highest to lowest level, so the user get's assigned the |
115 | 115 | // highest possible level and the lower levels get removed |
116 | 116 | // |
117 | - for ($i=count($levels)-1; $i>=0; $i--) { |
|
117 | + for ($i = count($levels) - 1; $i >= 0; $i--) { |
|
118 | 118 | if ($sub_total >= $levels[$i]) { |
119 | 119 | assign_badge($is_user, $item, $badges[$i]); |
120 | 120 | unassign_badges($is_user, $item, $badges, $i); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $is_user, $badge_levels, $badge_level_names, $badge_images, |
135 | 135 | $subprojects_list |
136 | 136 | ) { |
137 | - $kind = $is_user?"user":"team"; |
|
137 | + $kind = $is_user ? "user" : "team"; |
|
138 | 138 | |
139 | 139 | // get badges for all subprojects including total |
140 | 140 | // |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $n = 0; |
146 | - $maxid = $is_user?BoincUser::max("id"):BoincTeam::max("id"); |
|
146 | + $maxid = $is_user ?BoincUser::max("id") : BoincTeam::max("id"); |
|
147 | 147 | while ($n <= $maxid) { |
148 | 148 | $m = $n + 1000; |
149 | 149 | if ($is_user) { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | assign_tot_badge($is_user, $item, $badge_levels, $badges["total"]); |
162 | 162 | } else { |
163 | 163 | // appids come from project/project.inc |
164 | - $where_clause = "appid in (". implode(',', $sp["appids"]) .")"; |
|
164 | + $where_clause = "appid in (".implode(',', $sp["appids"]).")"; |
|
165 | 165 | assign_sub_badge( |
166 | 166 | $is_user, $item, $badge_levels, $badges[$sp["short_name"]], |
167 | 167 | $where_clause |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | function export_item($item, $is_user, $f) { |
29 | 29 | global $sub_projects; |
30 | 30 | |
31 | - fprintf($f, $is_user?"<user>\n":"<team>\n"); |
|
31 | + fprintf($f, $is_user ? "<user>\n" : "<team>\n"); |
|
32 | 32 | fprintf($f, " <id>$item->id</id>\n"); |
33 | - $crs = $is_user? |
|
33 | + $crs = $is_user ? |
|
34 | 34 | BoincCreditUser::enum("userid=$item->id") |
35 | 35 | : BoincCreditTeam::enum("teamid=$item->id") |
36 | 36 | ; |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - fprintf($f, $is_user?"</user>\n":"</team>\n"); |
|
59 | + fprintf($f, $is_user ? "</user>\n" : "</team>\n"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | function export($is_user, $dir) { |
63 | 63 | $n = 0; |
64 | - $filename = $is_user?"$dir/user_work":"$dir/team_work"; |
|
64 | + $filename = $is_user ? "$dir/user_work" : "$dir/team_work"; |
|
65 | 65 | $f = fopen($filename, "w"); |
66 | 66 | if (!$f) die("fopen"); |
67 | - $is_user? fprintf($f, "<users>\n"): fprintf($f, "<teams>\n"); |
|
68 | - $maxid = $is_user?BoincUser::max("id"):BoincTeam::max("id"); |
|
67 | + $is_user ? fprintf($f, "<users>\n") : fprintf($f, "<teams>\n"); |
|
68 | + $maxid = $is_user ?BoincUser::max("id") : BoincTeam::max("id"); |
|
69 | 69 | while ($n <= $maxid) { |
70 | 70 | $m = $n + 1000; |
71 | 71 | if ($is_user) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } |
79 | 79 | $n = $m; |
80 | 80 | } |
81 | - $is_user? fprintf($f, "</users>\n"): fprintf($f, "</teams>\n"); |
|
81 | + $is_user ? fprintf($f, "</users>\n") : fprintf($f, "</teams>\n"); |
|
82 | 82 | fclose($f); |
83 | 83 | system("gzip -f $filename"); |
84 | 84 | } |
@@ -26,38 +26,38 @@ |
||
26 | 26 | |
27 | 27 | page_head(tra("Teams")); |
28 | 28 | |
29 | -echo "<p>".tra("%1 participants may form %2 teams %3.", PROJECT, "<b>", "</b>") ." |
|
29 | +echo "<p>".tra("%1 participants may form %2 teams %3.", PROJECT, "<b>", "</b>")." |
|
30 | 30 | <p> |
31 | - ". tra("You may belong to only one team. You can join or quit a team at any time."). " |
|
31 | + ". tra("You may belong to only one team. You can join or quit a team at any time.")." |
|
32 | 32 | <p>" . |
33 | - tra("Each team has a %1 founder %2 who may:", "<b>", "</b>") . " |
|
33 | + tra("Each team has a %1 founder %2 who may:", "<b>", "</b>")." |
|
34 | 34 | <ul> |
35 | - <li> " . tra("edit the team's name and description") . " |
|
36 | - <li> " . tra("add or remove team admins") . " |
|
37 | - <li> " . tra("remove members from the team") . " |
|
38 | - <li> " . tra("disband a team if it has no members") . " |
|
35 | + <li> " . tra("edit the team's name and description")." |
|
36 | + <li> " . tra("add or remove team admins")." |
|
37 | + <li> " . tra("remove members from the team")." |
|
38 | + <li> " . tra("disband a team if it has no members")." |
|
39 | 39 | </ul> |
40 | 40 | <p>" . |
41 | - tra("To join a team, visit its team page and click %1 Join this team %2.", "<b>", "</b>") . " |
|
42 | - <h3>" . tra("Find a team") . "</h3> |
|
41 | + tra("To join a team, visit its team page and click %1 Join this team %2.", "<b>", "</b>")." |
|
42 | + <h3>" . tra("Find a team")."</h3> |
|
43 | 43 | "; |
44 | 44 | team_search_form(null); |
45 | 45 | echo " |
46 | 46 | |
47 | - <h3>" . tra("Top teams") . "</h3> |
|
47 | + <h3>" . tra("Top teams")."</h3> |
|
48 | 48 | <ul> |
49 | - <li> <a href=\"top_teams.php\">" . tra("All teams") . "</a> |
|
49 | + <li> <a href=\"top_teams.php\">" . tra("All teams")."</a> |
|
50 | 50 | "; |
51 | 51 | |
52 | -for ($i=1; $i<count($team_types); $i++) { |
|
52 | +for ($i = 1; $i < count($team_types); $i++) { |
|
53 | 53 | echo "<li> <a href=\"top_teams.php?type=".$i."\">".tra("%1 teams", team_type_name($i))."</a> |
54 | 54 | "; |
55 | 55 | } |
56 | 56 | |
57 | 57 | echo " |
58 | 58 | </ul> |
59 | - <h3>" . tra("Create a new team") . "</h3> |
|
60 | - " . tra("If you cannot find a team that is right for you, you can %1 create a team %2.", "<a href=\"team_create_form.php\">","</a>"); |
|
59 | + <h3>" . tra("Create a new team")."</h3> |
|
60 | + " . tra("If you cannot find a team that is right for you, you can %1 create a team %2.", "<a href=\"team_create_form.php\">", "</a>"); |
|
61 | 61 | page_tail(); |
62 | 62 | |
63 | 63 | ?> |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | } |
33 | 33 | define('ITEM_LIMIT', 10000); |
34 | 34 | |
35 | -function get_top_teams($offset, $sort_by, $type){ |
|
35 | +function get_top_teams($offset, $sort_by, $type) { |
|
36 | 36 | global $teams_per_page; |
37 | 37 | $db = BoincDb::get(true); |
38 | 38 | $type_clause = null; |
39 | - if ($type){ |
|
39 | + if ($type) { |
|
40 | 40 | $type_clause = "type=$type"; |
41 | 41 | } |
42 | 42 | if ($sort_by == "total_credit") { |
@@ -60,26 +60,26 @@ discard block |
||
60 | 60 | if ($type < 0 || $type >= count($team_types)) { |
61 | 61 | $type = 0; |
62 | 62 | } |
63 | -$type_url=""; |
|
64 | -$type_name=""; |
|
63 | +$type_url = ""; |
|
64 | +$type_name = ""; |
|
65 | 65 | if ($type) { |
66 | 66 | $type_url = "&type=$type"; |
67 | 67 | $type_name = team_type_name($type); |
68 | 68 | } |
69 | 69 | |
70 | 70 | $offset = get_int("offset", true); |
71 | -if (!$offset) $offset=0; |
|
72 | -if ($offset % $teams_per_page) $offset = 0; |
|
71 | +if (!$offset) $offset = 0; |
|
72 | +if ($offset%$teams_per_page) $offset = 0; |
|
73 | 73 | |
74 | 74 | if ($offset < ITEM_LIMIT) { |
75 | 75 | $cache_args = "sort_by=$sort_by&offset=$offset$type_url"; |
76 | - $cacheddata = get_cached_data(TOP_PAGES_TTL,$cache_args); |
|
76 | + $cacheddata = get_cached_data(TOP_PAGES_TTL, $cache_args); |
|
77 | 77 | //If we have got the data in cache |
78 | - if ($cacheddata){ |
|
78 | + if ($cacheddata) { |
|
79 | 79 | $data = unserialize($cacheddata); // use the cached data |
80 | 80 | } else { |
81 | 81 | //if not do queries etc to generate new data |
82 | - $data = get_top_teams($offset,$sort_by,$type); |
|
82 | + $data = get_top_teams($offset, $sort_by, $type); |
|
83 | 83 | |
84 | 84 | // Calculate nusers before storing into the cache |
85 | 85 | foreach ($data as $team) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | echo "<a href=top_teams.php?sort_by=$sort_by&offset=$new_offset".$type_url.">".tra("Previous %1", $teams_per_page)."</a> · "; |
116 | 116 | |
117 | 117 | } |
118 | - if ($n==$teams_per_page){ //If we aren't on the last page |
|
118 | + if ($n == $teams_per_page) { //If we aren't on the last page |
|
119 | 119 | $new_offset = $offset + $teams_per_page; |
120 | 120 | echo "<a href=top_teams.php?sort_by=$sort_by&offset=$new_offset".$type_url.">".tra("Next %1", $teams_per_page)."</a>"; |
121 | 121 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $b->create_time = (double)($batch->create_time); |
171 | 171 | $b->est_completion_time = (double)($batch->est_completion_time); |
172 | 172 | $b->njobs = (int)($batch->njobs); |
173 | - $b->fraction_done = (double) $batch->fraction_done; |
|
173 | + $b->fraction_done = (double)$batch->fraction_done; |
|
174 | 174 | $b->nerror_jobs = (int)($batch->nerror_jobs); |
175 | 175 | $b->state = (int)($batch->state); |
176 | 176 | $b->completion_time = (double)($batch->completion_time); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | </result> |
399 | 399 | </output_template> |
400 | 400 | "; |
401 | - for ($i=0; $i<2; $i++) { |
|
401 | + for ($i = 0; $i < 2; $i++) { |
|
402 | 402 | $job = new StdClass; |
403 | 403 | $job->input_files = array(); |
404 | 404 | $job->input_files[] = $f; |