@@ -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; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $app = BoincApp::lookup_id($id); |
26 | 26 | if (!$app) admin_error_page("no such app"); |
27 | 27 | |
28 | - $n = post_str("deprecated", true)?1:0; |
|
28 | + $n = post_str("deprecated", true) ? 1 : 0; |
|
29 | 29 | $app->update("deprecated=$n"); |
30 | 30 | |
31 | 31 | $n = post_num("weight"); |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | $n = post_int("target_nresults"); |
38 | 38 | $app->update("target_nresults=$n"); |
39 | 39 | |
40 | - $n = post_str("homogeneous_app_version", true)?1:0; |
|
40 | + $n = post_str("homogeneous_app_version", true) ? 1 : 0; |
|
41 | 41 | $app->update("homogeneous_app_version=$n"); |
42 | 42 | |
43 | - $n = post_str("non_cpu_intensive", true)?1:0; |
|
43 | + $n = post_str("non_cpu_intensive", true) ? 1 : 0; |
|
44 | 44 | $app->update("non_cpu_intensive=$n"); |
45 | 45 | |
46 | - $n = post_str("beta", true)?1:0; |
|
46 | + $n = post_str("beta", true) ? 1 : 0; |
|
47 | 47 | $app->update("beta=$n"); |
48 | 48 | |
49 | - $n = post_str("fraction_done_exact", true)?1:0; |
|
49 | + $n = post_str("fraction_done_exact", true) ? 1 : 0; |
|
50 | 50 | $app->update("fraction_done_exact=$n"); |
51 | 51 | |
52 | 52 | echo "Application $id updated. |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | function add_app() { |
59 | 59 | $name = BoincDb::escape_string(post_str('add_name')); |
60 | 60 | $user_friendly_name = BoincDb::escape_string(post_str('add_user_friendly_name')); |
61 | - if (empty($name) || empty($user_friendly_name) ) { |
|
61 | + if (empty($name) || empty($user_friendly_name)) { |
|
62 | 62 | admin_error_page( |
63 | 63 | "To add a new application please supply both a brief name and a longer 'user-friendly' name.</font></p>" |
64 | 64 | ); |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | <h2>Edit applications</h2> |
82 | 82 | "; |
83 | 83 | |
84 | - $app_clause="deprecated=0"; |
|
85 | - $action_url="manage_apps.php"; |
|
86 | - if($all) { |
|
84 | + $app_clause = "deprecated=0"; |
|
85 | + $action_url = "manage_apps.php"; |
|
86 | + if ($all) { |
|
87 | 87 | $app_clause = ""; |
88 | - $action_url="manage_apps.php?all=1"; |
|
88 | + $action_url = "manage_apps.php?all=1"; |
|
89 | 89 | echo "<a href=\"manage_apps.php\">Don't show deprecated applications</a>"; |
90 | 90 | } else { |
91 | 91 | echo "<a href=\"manage_apps.php?all=1\">Show deprecated applications</a>"; |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | $apps = BoincApp::enum($app_clause); |
118 | 118 | foreach ($apps as $app) { |
119 | 119 | // grey-out deprecated versions |
120 | - $f1=$f2=''; |
|
121 | - if ($app->deprecated==1) { |
|
120 | + $f1 = $f2 = ''; |
|
121 | + if ($app->deprecated == 1) { |
|
122 | 122 | $f1 = "<font color='GREY'>"; |
123 | 123 | $f2 = "</font>"; |
124 | 124 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | echo " <TD align='left'>$f1<a href=app_details.php?appid=$app->id>$app->name</a><br> $app->user_friendly_name $f2</TD>\n"; |
130 | 130 | |
131 | - echo " <TD align='center'>$f1 " .date_str($app->create_time)."$f2</TD>\n"; |
|
131 | + echo " <TD align='center'>$f1 ".date_str($app->create_time)."$f2</TD>\n"; |
|
132 | 132 | |
133 | 133 | $v = $app->weight; |
134 | 134 | echo " <TD align='center'> |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | "; |
152 | 152 | |
153 | 153 | $v = ''; |
154 | - if ($app->homogeneous_app_version) $v=' CHECKED '; |
|
154 | + if ($app->homogeneous_app_version) $v = ' CHECKED '; |
|
155 | 155 | echo " <TD align='center'> |
156 | 156 | <input name='homogeneous_app_version' type='checkbox' $v></TD> |
157 | 157 | "; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | break; |
139 | 139 | default: |
140 | 140 | end($page_list); |
141 | - $page_list[key($page_list)] = 'and ' . $page_list[key($page_list)]; |
|
141 | + $page_list[key($page_list)] = 'and '.$page_list[key($page_list)]; |
|
142 | 142 | $page_list = implode(', ', $page_list); |
143 | 143 | } |
144 | 144 | drupal_set_message(t('Default content has been generated for the @listed |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'type' => 'page', |
196 | 196 | 'title' => t('Help'), |
197 | 197 | 'uid' => 1, |
198 | - 'status' => 1, // published |
|
198 | + 'status' => 1, // published |
|
199 | 199 | 'promote' => 0, // not promoted to front page |
200 | 200 | 'path' => 'help', |
201 | 201 | 'pathauto_perform_alias' => FALSE, |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | 'format' => 4, |
217 | 217 | //'teaser' => $teaser, |
218 | 218 | ); |
219 | - $node = (object) $node; // node_save requires an object |
|
219 | + $node = (object)$node; // node_save requires an object |
|
220 | 220 | node_save($node); |
221 | 221 | |
222 | 222 | $item = array( |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | 'type' => 'page', |
238 | 238 | 'title' => t('Rules and Policies'), |
239 | 239 | 'uid' => 1, |
240 | - 'status' => 1, // published |
|
240 | + 'status' => 1, // published |
|
241 | 241 | 'promote' => 0, // not promoted to front page |
242 | 242 | 'path' => 'rules-and-policies', |
243 | 243 | 'pathauto_perform_alias' => FALSE, |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | 'format' => 4, |
252 | 252 | //'teaser' => $teaser, |
253 | 253 | ); |
254 | - $node = (object) $node; // node_save requires an object |
|
254 | + $node = (object)$node; // node_save requires an object |
|
255 | 255 | node_save($node); |
256 | 256 | |
257 | 257 | // Create menu item to node |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | 'type' => 'page', |
274 | 274 | 'title' => t('Moderation'), |
275 | 275 | 'uid' => 1, |
276 | - 'status' => 1, // published |
|
276 | + 'status' => 1, // published |
|
277 | 277 | 'promote' => 0, // not promoted to front page |
278 | 278 | 'path' => 'moderation', |
279 | 279 | 'pathauto_perform_alias' => FALSE, |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | 'format' => 4, |
288 | 288 | //'teaser' => $teaser, |
289 | 289 | ); |
290 | - $node = (object) $node; // node_save requires an object |
|
290 | + $node = (object)$node; // node_save requires an object |
|
291 | 291 | node_save($node); |
292 | 292 | |
293 | 293 | // Create menu item to node |
@@ -52,7 +52,7 @@ |
||
52 | 52 | */ |
53 | 53 | function boinc_solr_search_block_view($delta = 0) { |
54 | 54 | $block = array(); |
55 | - switch($delta) { |
|
55 | + switch ($delta) { |
|
56 | 56 | case 'boinc_solr_search_0': |
57 | 57 | $items = array( |
58 | 58 | bts('By default a search matches ANY search term. Results with more than one term will be presented higher in the search results.', array(), NULL, 'boinc:search-help-sidebar-block'), |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | ); |
17 | 17 | |
18 | 18 | // Build confirm form from elements, depending on node type. |
19 | - $description = bts('This action cannot be undone.', array(), NULL, 'boinc:delete-node'); |
|
19 | + $description = bts('This action cannot be undone.', array(), NULL, 'boinc:delete-node'); |
|
20 | 20 | $no = bts('Cancel', array(), NULL, 'boinc:form-cancel'); |
21 | 21 | |
22 | - switch($node->type) { |
|
22 | + switch ($node->type) { |
|
23 | 23 | case 'profile': |
24 | 24 | $question = bts('Are you sure you want to clear your profile?', array(), NULL, 'boinc:delete-node'); |
25 | 25 | $path = isset($_GET['destination']) ? $_GET['destination'] : 'account'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | default: |
30 | 30 | $question = bts('Are you sure you want to Delete %title?', array('%title' => $node->title), NULL, 'boinc:delete-node'); |
31 | - $path = isset($_GET['destination']) ? $_GET['destination'] : 'node/'. $node->nid; |
|
31 | + $path = isset($_GET['destination']) ? $_GET['destination'] : 'node/'.$node->nid; |
|
32 | 32 | $yes = bts('Delete', array(), NULL, 'boinc:form-delete'); |
33 | 33 | } |
34 | 34 | return confirm_form($form, $question, $path, $description, $yes, $no); |