@@ -200,8 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | if ($Verbose) |
203 | - { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); } |
|
204 | - else |
|
203 | + { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); } else |
|
205 | 204 | { return(TRUE); } |
206 | 205 | } |
207 | 206 | } |
@@ -215,10 +214,11 @@ discard block |
||
215 | 214 | /* Automatic output method based on the calling interface */ |
216 | 215 | function autoOutput($ID,$Destination="output.png") |
217 | 216 | { |
218 | - if (php_sapi_name() == "cli") |
|
219 | - $this->saveFromCache($ID,$Destination); |
|
220 | - else |
|
221 | - $this->strokeFromCache($ID); |
|
217 | + if (php_sapi_name() == "cli") { |
|
218 | + $this->saveFromCache($ID,$Destination); |
|
219 | + } else { |
|
220 | + $this->strokeFromCache($ID); |
|
221 | + } |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | function strokeFromCache($ID) |
@@ -52,12 +52,13 @@ discard block |
||
52 | 52 | if ( $X < 0 || $X >$this->GridSizeX ) { return(0); } |
53 | 53 | if ( $Y < 0 || $Y >$this->GridSizeY ) { return(0); } |
54 | 54 | |
55 | - if ( $this->Points[$X][$Y] == UNKNOWN || $Force ) |
|
56 | - $this->Points[$X][$Y] = $Value; |
|
57 | - elseif ( $this->Points[$X][$Y] == UNKNOWN ) |
|
58 | - $this->Points[$X][$Y] = $Value; |
|
59 | - else |
|
60 | - $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2; |
|
55 | + if ( $this->Points[$X][$Y] == UNKNOWN || $Force ) { |
|
56 | + $this->Points[$X][$Y] = $Value; |
|
57 | + } elseif ( $this->Points[$X][$Y] == UNKNOWN ) { |
|
58 | + $this->Points[$X][$Y] = $Value; |
|
59 | + } else { |
|
60 | + $this->Points[$X][$Y] = ($this->Points[$X][$Y] + $Value)/2; |
|
61 | + } |
|
61 | 62 | } |
62 | 63 | |
63 | 64 | /* Write the X labels */ |
@@ -84,24 +85,24 @@ discard block |
||
84 | 85 | $YPos = $this->pChartObject->GraphAreaY1 - $Padding; |
85 | 86 | if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; } |
86 | 87 | if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; } |
87 | - } |
|
88 | - elseif ( $Position == LABEL_POSITION_BOTTOM ) |
|
88 | + } elseif ( $Position == LABEL_POSITION_BOTTOM ) |
|
89 | 89 | { |
90 | 90 | $YPos = $this->pChartObject->GraphAreaY2 + $Padding; |
91 | 91 | if ($Angle == 0 ) { $Settings["Align"] = TEXT_ALIGN_TOPMIDDLE; } |
92 | 92 | if ($Angle != 0 ) { $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; } |
93 | - } |
|
94 | - else |
|
95 | - return(-1); |
|
93 | + } else { |
|
94 | + return(-1); |
|
95 | + } |
|
96 | 96 | |
97 | 97 | for($X=0;$X<=$this->GridSizeX;$X++) |
98 | 98 | { |
99 | 99 | $XPos = floor($X0+$X*$XSize + $XSize/2); |
100 | 100 | |
101 | - if( $Labels == NULL || !isset($Labels[$X]) ) |
|
102 | - $Value = $X+$CountOffset; |
|
103 | - else |
|
104 | - $Value = $Labels[$X]; |
|
101 | + if( $Labels == NULL || !isset($Labels[$X]) ) { |
|
102 | + $Value = $X+$CountOffset; |
|
103 | + } else { |
|
104 | + $Value = $Labels[$X]; |
|
105 | + } |
|
105 | 106 | |
106 | 107 | $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings); |
107 | 108 | } |
@@ -127,20 +128,20 @@ discard block |
||
127 | 128 | |
128 | 129 | $Settings = array("Angle"=>$Angle,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
129 | 130 | if ( $Position == LABEL_POSITION_LEFT ) |
130 | - { $XPos = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; } |
|
131 | - elseif ( $Position == LABEL_POSITION_RIGHT ) |
|
132 | - { $XPos = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; } |
|
133 | - else |
|
134 | - return(-1); |
|
131 | + { $XPos = $this->pChartObject->GraphAreaX1 - $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLERIGHT; } elseif ( $Position == LABEL_POSITION_RIGHT ) |
|
132 | + { $XPos = $this->pChartObject->GraphAreaX2 + $Padding; $Settings["Align"] = TEXT_ALIGN_MIDDLELEFT; } else { |
|
133 | + return(-1); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | for($Y=0;$Y<=$this->GridSizeY;$Y++) |
137 | 137 | { |
138 | 138 | $YPos = floor($Y0+$Y*$YSize + $YSize/2); |
139 | 139 | |
140 | - if( $Labels == NULL || !isset($Labels[$Y]) ) |
|
141 | - $Value = $Y+$CountOffset; |
|
142 | - else |
|
143 | - $Value = $Labels[$Y]; |
|
140 | + if( $Labels == NULL || !isset($Labels[$Y]) ) { |
|
141 | + $Value = $Y+$CountOffset; |
|
142 | + } else { |
|
143 | + $Value = $Labels[$Y]; |
|
144 | + } |
|
144 | 145 | |
145 | 146 | $this->pChartObject->drawText($XPos,$YPos,$Value,$Settings); |
146 | 147 | } |
@@ -176,14 +177,18 @@ discard block |
||
176 | 177 | $X2 = floor($X0+$X*$XSize+$XSize); |
177 | 178 | $Y2 = floor($Y0+$Y*$YSize+$YSize); |
178 | 179 | |
179 | - if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold) |
|
180 | - $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,$Color); |
|
181 | - if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold) |
|
182 | - $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,$Color); |
|
183 | - if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold) |
|
184 | - $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,$Color); |
|
185 | - if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold) |
|
186 | - $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,$Color); |
|
180 | + if ( $X > 0 && $this->Points[$X-1][$Y] != UNKNOWN && $this->Points[$X-1][$Y] != IGNORED && $this->Points[$X-1][$Y] < $Threshold) { |
|
181 | + $this->pChartObject->drawLine($X1,$Y1,$X1,$Y2,$Color); |
|
182 | + } |
|
183 | + if ( $Y > 0 && $this->Points[$X][$Y-1] != UNKNOWN && $this->Points[$X][$Y-1] != IGNORED && $this->Points[$X][$Y-1] < $Threshold) { |
|
184 | + $this->pChartObject->drawLine($X1,$Y1,$X2,$Y1,$Color); |
|
185 | + } |
|
186 | + if ( $X < $this->GridSizeX && $this->Points[$X+1][$Y] != UNKNOWN && $this->Points[$X+1][$Y] != IGNORED && $this->Points[$X+1][$Y] < $Threshold) { |
|
187 | + $this->pChartObject->drawLine($X2,$Y1,$X2,$Y2,$Color); |
|
188 | + } |
|
189 | + if ( $Y < $this->GridSizeY && $this->Points[$X][$Y+1] != UNKNOWN && $this->Points[$X][$Y+1] != IGNORED && $this->Points[$X][$Y+1] < $Threshold) { |
|
190 | + $this->pChartObject->drawLine($X1,$Y2,$X2,$Y2,$Color); |
|
191 | + } |
|
187 | 192 | } |
188 | 193 | } |
189 | 194 | } |
@@ -232,8 +237,7 @@ discard block |
||
232 | 237 | if ( isset($Palette[$Value]) && isset($Palette[$Value]["G"]) ) { $G = $Palette[$Value]["G"]; } else { $G = 0; } |
233 | 238 | if ( isset($Palette[$Value]) && isset($Palette[$Value]["B"]) ) { $B = $Palette[$Value]["B"]; } else { $B = 0; } |
234 | 239 | if ( isset($Palette[$Value]) && isset($Palette[$Value]["Alpha"]) ) { $Alpha = $Palette[$Value]["Alpha"]; } else { $Alpha = 1000; } |
235 | - } |
|
236 | - else |
|
240 | + } else |
|
237 | 241 | { |
238 | 242 | $R = (($ShadeR2-$ShadeR1)/100)*$Value + $ShadeR1; |
239 | 243 | $G = (($ShadeG2-$ShadeG1)/100)*$Value + $ShadeG1; |
@@ -259,8 +263,9 @@ discard block |
||
259 | 263 | { |
260 | 264 | for($Y=0;$Y<=$this->GridSizeY;$Y++) |
261 | 265 | { |
262 | - if ( $this->Points[$X][$Y] == UNKNOWN ) |
|
263 | - $Missing[] = $X.",".$Y; |
|
266 | + if ( $this->Points[$X][$Y] == UNKNOWN ) { |
|
267 | + $Missing[] = $X.",".$Y; |
|
268 | + } |
|
264 | 269 | } |
265 | 270 | } |
266 | 271 | shuffle($Missing); |
@@ -117,15 +117,16 @@ discard block |
||
117 | 117 | |
118 | 118 | if ($myCache->isInCache($cache_name)) { |
119 | 119 | $myCache->strokeFromCache($cache_name); |
120 | - } |
|
121 | - else { |
|
120 | + } else { |
|
122 | 121 | // Construct query string |
123 | 122 | $get = array( |
124 | 123 | 'cpid' => $cpid, |
125 | 124 | 'projectid' => $project_id |
126 | 125 | ); |
127 | 126 | $args = array(); |
128 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
127 | + foreach ($get as $arg => $value) { |
|
128 | + $args[] = "{$arg}=" . rawurlencode($value); |
|
129 | + } |
|
129 | 130 | $query = '?' . implode('&', $args); |
130 | 131 | |
131 | 132 | // Load XML from RPC |
@@ -147,9 +148,10 @@ discard block |
||
147 | 148 | $credit[$i] = isset($stats_xml->total_credit_history_last_91_days->$day) ? (int) $stats_xml->total_credit_history_last_91_days->$day : 0; |
148 | 149 | $dataset[$i] = ($i) ? ($credit[$i] - $credit[$i-1]) : 0; |
149 | 150 | } |
150 | - } |
|
151 | - else { |
|
152 | - for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0; |
|
151 | + } else { |
|
152 | + for ($i = 0; $i <= $dataset_size; $i++) { |
|
153 | + $dataset[] = 0; |
|
154 | + } |
|
153 | 155 | } |
154 | 156 | |
155 | 157 | $MyData->addPoints($dataset, 'series1'); |
@@ -253,8 +255,7 @@ discard block |
||
253 | 255 | |
254 | 256 | if ($myCache->isInCache($cache_name)) { |
255 | 257 | $myCache->strokeFromCache($cache_name); |
256 | - } |
|
257 | - else { |
|
258 | + } else { |
|
258 | 259 | // Initialize dataset |
259 | 260 | $dataset = array(); |
260 | 261 | if ($stats_xml) { |
@@ -264,9 +265,10 @@ discard block |
||
264 | 265 | $credit[$i] = isset($stats_xml->$day) ? (int) $stats_xml->$day : 0; |
265 | 266 | $dataset[$i] = ($i) ? ($credit[$i] - $credit[$i-1]) : 0; |
266 | 267 | } |
267 | - } |
|
268 | - else { |
|
269 | - for ($i = 0; $i <= 30; $i++) $dataset[] = 0; |
|
268 | + } else { |
|
269 | + for ($i = 0; $i <= 30; $i++) { |
|
270 | + $dataset[] = 0; |
|
271 | + } |
|
270 | 272 | } |
271 | 273 | |
272 | 274 | $MyData->addPoints($dataset, 'series1'); |
@@ -341,8 +343,7 @@ discard block |
||
341 | 343 | directory must be writeable by the web server.', |
342 | 344 | array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
343 | 345 | return FALSE; |
344 | - } |
|
345 | - else { |
|
346 | + } else { |
|
346 | 347 | // Create the cache dir |
347 | 348 | if (!mkdir($cache_dir, 0775)) { |
348 | 349 | watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
@@ -351,8 +352,7 @@ discard block |
||
351 | 352 | return FALSE; |
352 | 353 | } |
353 | 354 | } |
354 | - } |
|
355 | - else { |
|
355 | + } else { |
|
356 | 356 | watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
357 | 357 | Please allow webserver write access.', |
358 | 358 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
@@ -378,7 +378,9 @@ discard block |
||
378 | 378 | 'projectid' => $project_id |
379 | 379 | ); |
380 | 380 | $args = array(); |
381 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
381 | + foreach ($get as $arg => $value) { |
|
382 | + $args[] = "{$arg}=" . rawurlencode($value); |
|
383 | + } |
|
382 | 384 | $query = '?' . implode('&', $args); |
383 | 385 | |
384 | 386 | // Load XML from RPC |
@@ -412,7 +414,9 @@ discard block |
||
412 | 414 | for ($i = 61; $i <= 91; $i++) { |
413 | 415 | $day = "day_{$i}"; |
414 | 416 | $daily_totals[$i] = isset($stats_xml->$day) ? (int) $stats_xml->$day : 0; |
415 | - if ($i == 61) continue; |
|
417 | + if ($i == 61) { |
|
418 | + continue; |
|
419 | + } |
|
416 | 420 | $daily_values[$i] = ($i) ? ($daily_totals[$i] - $daily_totals[$i-1]) : 0; |
417 | 421 | } |
418 | 422 | } |
@@ -481,8 +485,7 @@ discard block |
||
481 | 485 | drupal_set_message(t('The BOINC stats system is not configured. Please |
482 | 486 | !configure_it', array('!configure_it' => l(t('configure it now'), |
483 | 487 | 'admin/boinc/stats'))), 'error', FALSE); |
484 | - } |
|
485 | - else { |
|
488 | + } else { |
|
486 | 489 | drupal_set_message(t('There is a problem with the site. Please contact |
487 | 490 | the system administrator.'), 'error', FALSE); |
488 | 491 | } |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | if (!$name) { |
137 | 137 | form_set_error('name', bts('Team name is required.')); |
138 | - } |
|
139 | - else { |
|
138 | + } else { |
|
140 | 139 | require_boinc('boinc_db'); |
141 | 140 | if (BoincTeam::lookup_name($name)) { |
142 | 141 | form_set_error('name', bts('A team named "@name" already exists.', |
@@ -177,8 +176,7 @@ discard block |
||
177 | 176 | if ($boinc_team) { |
178 | 177 | $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
179 | 178 | user_join_team($boinc_team, $boinc_user); |
180 | - } |
|
181 | - else { |
|
179 | + } else { |
|
182 | 180 | drupal_set_message(t('Teams cannot be created at this time. Please |
183 | 181 | contact the @project administrators!', array('@project' => PROJECT))); |
184 | 182 | watchdog('BOINC team', 'BOINC teams cannot be created for an unknown |
@@ -212,8 +210,7 @@ discard block |
||
212 | 210 | if (module_exists('pathauto')) { |
213 | 211 | module_load_include('inc', 'pathauto', 'pathauto'); |
214 | 212 | $node['path'] = pathauto_cleanstring($values['name']); |
215 | - } |
|
216 | - else { |
|
213 | + } else { |
|
217 | 214 | drupal_set_message(t('Teams cannot be created at this time. Please |
218 | 215 | contact the @project administrators!', array('@project' => PROJECT))); |
219 | 216 | watchdog('BOINC team', 'BOINC teams require the Pathauto module. Teams |
@@ -381,8 +378,7 @@ discard block |
||
381 | 378 | $form['form control tabs'] = array( |
382 | 379 | '#value' => '<li class="tab">' . l(bts('Cancel'), strstr($_GET['q'], '/edit', TRUE)) . '</li>' |
383 | 380 | ); |
384 | - } |
|
385 | - else { |
|
381 | + } else { |
|
386 | 382 | $form['description'] = array( |
387 | 383 | '#prefix' => '<div class="form-item"><label>' . bts('Description') . ':</label></div><div class="form-item">', |
388 | 384 | '#value' => $default['description'], |
@@ -412,12 +408,10 @@ discard block |
||
412 | 408 | |
413 | 409 | if ($form_state['storage']['is_boinc_wide']) { |
414 | 410 | form_set_error('none', bts('This team is managed by the BOINC-wide teams system and cannot be updated here.')); |
415 | - } |
|
416 | - else { |
|
411 | + } else { |
|
417 | 412 | if (!$name) { |
418 | 413 | form_set_error('name', bts('Team name is required.')); |
419 | - } |
|
420 | - else { |
|
414 | + } else { |
|
421 | 415 | $team = node_load($form_state['storage']['team_id']); |
422 | 416 | if ($name != $team->title) { |
423 | 417 | // If changing the name ("title" in Drupal terms), check that the new name is available |
@@ -558,29 +552,25 @@ discard block |
||
558 | 552 | |
559 | 553 | if (!$values['email']) { |
560 | 554 | form_set_error('email', bts('Email address is required.')); |
561 | - } |
|
562 | - else { |
|
555 | + } else { |
|
563 | 556 | $account = user_load(array('mail' => $values['email'])); |
564 | 557 | if ((!$account) OR ($account->team != $team_id)) { |
565 | 558 | form_set_error('email', bts('There is no user on your team with that email address.')); |
566 | - } |
|
567 | - elseif (boincteam_is_founder($team_id, $account->uid)) { |
|
559 | + } elseif (boincteam_is_founder($team_id, $account->uid)) { |
|
568 | 560 | form_set_error('email', bts('@user is the founder of @team!', |
569 | 561 | array( |
570 | 562 | '@user' => $account->boincuser_name, |
571 | 563 | '@team' => $team->title, |
572 | 564 | ) |
573 | 565 | )); |
574 | - } |
|
575 | - elseif (boincteam_is_admin($team_id, $account->uid)) { |
|
566 | + } elseif (boincteam_is_admin($team_id, $account->uid)) { |
|
576 | 567 | form_set_error('email', bts('@user is already an admin of @team.', |
577 | 568 | array( |
578 | 569 | '@user' => $account->boincuser_name, |
579 | 570 | '@team' => $team->title, |
580 | 571 | ) |
581 | 572 | )); |
582 | - } |
|
583 | - else { |
|
573 | + } else { |
|
584 | 574 | $form_state['storage']['boincuser_id'] = $account->boincuser_id; |
585 | 575 | $form_state['storage']['boincuser_name'] = $account->boincuser_name; |
586 | 576 | } |
@@ -44,8 +44,7 @@ discard block |
||
44 | 44 | $nid = $existing_teams[$boinc_team->id]; |
45 | 45 | $success = boincteam_import($boinc_team, $nid); |
46 | 46 | } |
47 | - } |
|
48 | - else { |
|
47 | + } else { |
|
49 | 48 | // Import new teams created by RPC or ops/team_import.php |
50 | 49 | $success = boincteam_import($boinc_team); |
51 | 50 | } |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | $node->body = $boincteam->description; |
78 | 77 | $node->teaser = $teaser; |
79 | 78 | $node->uid = boincuser_lookup_uid($boincteam->userid); |
80 | - } |
|
81 | - else { |
|
79 | + } else { |
|
82 | 80 | // Construct the team as a new node |
83 | 81 | $node = array( |
84 | 82 | 'type' => 'team', |
@@ -387,8 +387,7 @@ |
||
387 | 387 | $team = node_load($nid); |
388 | 388 | $output .= '<p>' . bts('You may create a message board for use by @team', |
389 | 389 | array('@team' => $team->title)) . ':</p>'; |
390 | - } |
|
391 | - else { |
|
390 | + } else { |
|
392 | 391 | $output .= '<p>' . bts('This is a team-only message board') . ':</p>'; |
393 | 392 | } |
394 | 393 | $output .= '<ul>'; |
@@ -179,8 +179,7 @@ discard block |
||
179 | 179 | ), WATCHDOG_NOTICE |
180 | 180 | ); |
181 | 181 | } |
182 | - } |
|
183 | - else { |
|
182 | + } else { |
|
184 | 183 | drupal_set_message(t('You are not allowed to assume foundership of this |
185 | 184 | team.' |
186 | 185 | )); |
@@ -205,8 +204,7 @@ discard block |
||
205 | 204 | drupal_set_message(t('@team has been removed.', |
206 | 205 | array('@team' => $boincteam->name))); |
207 | 206 | drupal_goto('community/teams'); |
208 | - } |
|
209 | - else { |
|
207 | + } else { |
|
210 | 208 | drupal_set_message(t('All members must be removed from @team before the |
211 | 209 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
212 | 210 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
@@ -276,7 +274,9 @@ discard block |
||
276 | 274 | function boincteam_get_vocabulary_by_name($name) { |
277 | 275 | $vocabs = taxonomy_get_vocabularies('team'); |
278 | 276 | foreach ($vocabs as $vocab) { |
279 | - if ($vocab->name == $name) return $vocab->vid; |
|
277 | + if ($vocab->name == $name) { |
|
278 | + return $vocab->vid; |
|
279 | + } |
|
280 | 280 | } |
281 | 281 | return null; |
282 | 282 | } |
@@ -440,8 +440,7 @@ discard block |
||
440 | 440 | array('@team' => $boincteam->name))); |
441 | 441 | watchdog('boincteam', 'added user @uid to team @nid', |
442 | 442 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
443 | - } |
|
444 | - else { |
|
443 | + } else { |
|
445 | 444 | drupal_set_message(t('There was a problem joining @team, please try again |
446 | 445 | later', array('@team' => $boincteam->name))); |
447 | 446 | watchdog('boincteam', 'error adding user @uid to team @nid', |
@@ -468,8 +467,7 @@ discard block |
||
468 | 467 | array('@team' => $boincteam->name))); |
469 | 468 | watchdog('boincteam', 'removed user @uid from team @nid', |
470 | 469 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
471 | - } |
|
472 | - else { |
|
470 | + } else { |
|
473 | 471 | drupal_set_message(t('You are not a member of @team, so you cannot revoke |
474 | 472 | your membership to it.', array('@team' => $boincteam->name))); |
475 | 473 | } |
@@ -565,8 +563,7 @@ discard block |
||
565 | 563 | '@uid' => $account->uid, |
566 | 564 | '@nid' => $team_id |
567 | 565 | ), WATCHDOG_NOTICE); |
568 | - } |
|
569 | - else { |
|
566 | + } else { |
|
570 | 567 | drupal_set_message(t('@user is not a member of @team, so you cannot |
571 | 568 | revoke the membership.', array( |
572 | 569 | '@user' => $account->boincuser_name, |
@@ -595,14 +592,12 @@ discard block |
||
595 | 592 | '@user' => $account->boincuser_name |
596 | 593 | ) |
597 | 594 | ), 'warning'); |
598 | - } |
|
599 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
595 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
600 | 596 | // It hasn't been long enough since the last transfer request |
601 | 597 | drupal_set_message(t('A foundership change was requested during the last 90 |
602 | 598 | days, so new requests are not allowed. Please try again later.' |
603 | 599 | ), 'warning'); |
604 | - } |
|
605 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
600 | + } elseif (boincteam_is_member($team_id, $account->uid)) { |
|
606 | 601 | // Log the transfer request |
607 | 602 | db_set_active('boinc'); |
608 | 603 | db_query(" |
@@ -808,8 +803,7 @@ discard block |
||
808 | 803 | $output .= '['; |
809 | 804 | if ($credit_needed == 1) { |
810 | 805 | $output .= bts('You must earn 1 more credit!'); |
811 | - } |
|
812 | - else { |
|
806 | + } else { |
|
813 | 807 | $output .= bts('You must earn @count more credits!', |
814 | 808 | array('@count' => $credit_needed) |
815 | 809 | ); |
@@ -1059,8 +1053,7 @@ discard block |
||
1059 | 1053 | if ($request_age == 1) { |
1060 | 1054 | $output .= bts('1 day has elapsed since your request and' |
1061 | 1055 | . ' the founder has not responded.'); |
1062 | - } |
|
1063 | - else { |
|
1056 | + } else { |
|
1064 | 1057 | $output .= bts('@count days have elapsed since your request and' |
1065 | 1058 | . ' the founder has not responded.', |
1066 | 1059 | array('@count' => $request_age) |
@@ -1070,8 +1063,7 @@ discard block |
||
1070 | 1063 | if ($days_to_respond == 1) { |
1071 | 1064 | $output .= bts('You now have 1 day to assume foundership before' |
1072 | 1065 | . ' another team member may submit a request.'); |
1073 | - } |
|
1074 | - else { |
|
1066 | + } else { |
|
1075 | 1067 | $output .= bts('You now have @count days to assume foundership before' |
1076 | 1068 | . ' another team member may submit a request.', |
1077 | 1069 | array('@count' => $days_to_respond) |
@@ -1082,23 +1074,20 @@ discard block |
||
1082 | 1074 | $output .= ' <li class="first last tab">' . |
1083 | 1075 | l(bts('Assume foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
1084 | 1076 | $output .= '</ul>'; |
1085 | - } |
|
1086 | - else { |
|
1077 | + } else { |
|
1087 | 1078 | $output .= '<p>'; |
1088 | 1079 | if ($days_to_deadline == 1) { |
1089 | 1080 | $output .= bts('The team founder has 1 day to respond to your' |
1090 | 1081 | . ' transfer request.' |
1091 | 1082 | ); |
1092 | - } |
|
1093 | - else { |
|
1083 | + } else { |
|
1094 | 1084 | $output .= bts('The team founder has @count days to respond to your' |
1095 | 1085 | . ' transfer request.', array('@count' => $days_to_deadline) |
1096 | 1086 | ); |
1097 | 1087 | } |
1098 | 1088 | $output .= '</p>'; |
1099 | 1089 | } |
1100 | - } |
|
1101 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1090 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1102 | 1091 | // If this user does not have a transfer request pending, but new requests |
1103 | 1092 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
1104 | 1093 | // who made the request has 30 additional days to assume foundership if |
@@ -1111,15 +1100,13 @@ discard block |
||
1111 | 1100 | ); |
1112 | 1101 | if ($days_to_deadline == 1) { |
1113 | 1102 | $output .= ' (' . bts('1 day remaining') . ')'; |
1114 | - } |
|
1115 | - else { |
|
1103 | + } else { |
|
1116 | 1104 | $output .= ' (' . bts('@count days remaining', |
1117 | 1105 | array('@count' => $days_to_deadline) |
1118 | 1106 | ) . ')'; |
1119 | 1107 | } |
1120 | 1108 | $output .= '</p>'; |
1121 | - } |
|
1122 | - else { |
|
1109 | + } else { |
|
1123 | 1110 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1124 | 1111 | . ' assume the role of founder, click below to request foundership of' |
1125 | 1112 | . ' @this_team.', |
@@ -1165,8 +1152,7 @@ discard block |
||
1165 | 1152 | $boincteam_id |
1166 | 1153 | ); |
1167 | 1154 | db_set_active('default'); |
1168 | - } |
|
1169 | - else { |
|
1155 | + } else { |
|
1170 | 1156 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1171 | 1157 | $output .= '<h2 class="pane-title">' . bts('Respond to transfer request') |
1172 | 1158 | . '</h2>'; |
@@ -127,8 +127,7 @@ discard block |
||
127 | 127 | if (isset($prefs[$name]['@value'])) { |
128 | 128 | $default[$name] = $prefs[$name]['@value']; |
129 | 129 | } |
130 | - } |
|
131 | - else { |
|
130 | + } else { |
|
132 | 131 | $default[$name] = $prefs[$name]; |
133 | 132 | } |
134 | 133 | } |
@@ -567,34 +566,80 @@ discard block |
||
567 | 566 | // Verify all non-boolean user input values and notify form API of failures |
568 | 567 | |
569 | 568 | // Processing preferences |
570 | - if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['idle_time_to_run']['#title']} [x] {$form['prefs']['advanced']['processor']['idle_time_to_run']['#field_suffix']}"))); |
|
571 | - if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#field_suffix']}"))); |
|
572 | - if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#field_suffix']}"))); |
|
573 | - if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['start_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['start_hour']['#field_suffix']}"))); |
|
574 | - if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['end_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['end_hour']['#field_suffix']}"))); |
|
575 | - if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#field_suffix']}"))); |
|
576 | - if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['max_ncpus_pct']['#title']} [x] {$form['prefs']['advanced']['processor']['max_ncpus_pct']['#field_suffix']}"))); |
|
577 | - if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_usage_limit']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_usage_limit']['#field_suffix']}"))); |
|
569 | + if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) { |
|
570 | + form_set_error('idle_time_to_run', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['idle_time_to_run']['#title']} [x] {$form['prefs']['advanced']['processor']['idle_time_to_run']['#field_suffix']}"))); |
|
571 | + } |
|
572 | + if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) { |
|
573 | + form_set_error('suspend_if_no_recent_input', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_if_no_recent_input']['#field_suffix']}"))); |
|
574 | + } |
|
575 | + if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) { |
|
576 | + form_set_error('suspend_cpu_usage', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#title']} [x] {$form['prefs']['advanced']['processor']['suspend_cpu_usage']['#field_suffix']}"))); |
|
577 | + } |
|
578 | + if (!verify_numeric($values['processor']['start_hour'], 0, 23)) { |
|
579 | + form_set_error('start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['start_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['start_hour']['#field_suffix']}"))); |
|
580 | + } |
|
581 | + if (!verify_numeric($values['processor']['end_hour'], 0, 23)) { |
|
582 | + form_set_error('end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['end_hour']['#title']} [x] {$form['prefs']['advanced']['processor']['end_hour']['#field_suffix']}"))); |
|
583 | + } |
|
584 | + if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) { |
|
585 | + form_set_error('cpu_scheduling_period_minutes', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes']['#field_suffix']}"))); |
|
586 | + } |
|
587 | + if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) { |
|
588 | + form_set_error('max_ncpus_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['max_ncpus_pct']['#title']} [x] {$form['prefs']['advanced']['processor']['max_ncpus_pct']['#field_suffix']}"))); |
|
589 | + } |
|
590 | + if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) { |
|
591 | + form_set_error('cpu_usage_limit', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['processor']['cpu_usage_limit']['#title']} [x] {$form['prefs']['advanced']['processor']['cpu_usage_limit']['#field_suffix']}"))); |
|
592 | + } |
|
578 | 593 | |
579 | 594 | // Storage preferences |
580 | - if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_gb']['#field_suffix']}"))); |
|
581 | - if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_min_free_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_min_free_gb']['#field_suffix']}"))); |
|
582 | - if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_pct']['#field_suffix']}"))); |
|
583 | - if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_interval']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_interval']['#field_suffix']}"))); |
|
584 | - if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['vm_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['vm_max_used_pct']['#field_suffix']}"))); |
|
585 | - if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#field_suffix']}"))); |
|
586 | - if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#field_suffix']}"))); |
|
595 | + if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) { |
|
596 | + form_set_error('disk_max_used_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_gb']['#field_suffix']}"))); |
|
597 | + } |
|
598 | + if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) { |
|
599 | + form_set_error('disk_min_free_gb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_min_free_gb']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_min_free_gb']['#field_suffix']}"))); |
|
600 | + } |
|
601 | + if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) { |
|
602 | + form_set_error('disk_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_max_used_pct']['#field_suffix']}"))); |
|
603 | + } |
|
604 | + if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) { |
|
605 | + form_set_error('disk_interval', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['disk_interval']['#title']} [x] {$form['prefs']['advanced']['storage']['disk_interval']['#field_suffix']}"))); |
|
606 | + } |
|
607 | + if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) { |
|
608 | + form_set_error('vm_max_used_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['vm_max_used_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['vm_max_used_pct']['#field_suffix']}"))); |
|
609 | + } |
|
610 | + if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) { |
|
611 | + form_set_error('ram_max_used_busy_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_busy_pct']['#field_suffix']}"))); |
|
612 | + } |
|
613 | + if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) { |
|
614 | + form_set_error('ram_max_used_idle_pct', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['prefs']['advanced']['storage']['ram_max_used_idle_pct']['#field_suffix']}"))); |
|
615 | + } |
|
587 | 616 | |
588 | 617 | // Network preferences |
589 | - if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_min_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_min_days']['#field_suffix']}"))); |
|
590 | - if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_additional_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_additional_days']['#field_suffix']}"))); |
|
591 | - if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_down']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_down']['#field_suffix']}"))); |
|
592 | - if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_up']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_up']['#field_suffix']}"))); |
|
593 | - if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_start_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_start_hour']['#field_suffix']}"))); |
|
594 | - if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_end_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_end_hour']['#field_suffix']}"))); |
|
595 | - if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"))); |
|
596 | - if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"))); |
|
597 | -} |
|
618 | + if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) { |
|
619 | + form_set_error('work_buf_min_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_min_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_min_days']['#field_suffix']}"))); |
|
620 | + } |
|
621 | + if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) { |
|
622 | + form_set_error('work_buf_additional_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['work_buf_additional_days']['#title']} [x] {$form['prefs']['advanced']['network']['work_buf_additional_days']['#field_suffix']}"))); |
|
623 | + } |
|
624 | + if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) { |
|
625 | + form_set_error('max_bytes_sec_down', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_down']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_down']['#field_suffix']}"))); |
|
626 | + } |
|
627 | + if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) { |
|
628 | + form_set_error('max_bytes_sec_up', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['max_bytes_sec_up']['#title']} [x] {$form['prefs']['advanced']['network']['max_bytes_sec_up']['#field_suffix']}"))); |
|
629 | + } |
|
630 | + if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) { |
|
631 | + form_set_error('net_start_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_start_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_start_hour']['#field_suffix']}"))); |
|
632 | + } |
|
633 | + if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) { |
|
634 | + form_set_error('net_end_hour', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['net_end_hour']['#title']} [x] {$form['prefs']['advanced']['network']['net_end_hour']['#field_suffix']}"))); |
|
635 | + } |
|
636 | + if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) { |
|
637 | + form_set_error('daily_xfer_limit_mb', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"))); |
|
638 | + } |
|
639 | + if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) { |
|
640 | + form_set_error('daily_xfer_period_days', bts('Invalid setting for "%preference"', array('%preference' => "{$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#title']} [x] {$form['prefs']['advanced']['network']['daily_xfer_limit_mb']['#field_suffix']}"))); |
|
641 | + } |
|
642 | + } |
|
598 | 643 | |
599 | 644 | /** |
600 | 645 | * Handle post-validation submission of general preferences form. |
@@ -655,8 +700,7 @@ discard block |
||
655 | 700 | // Save the preset selection (or lack thereof) |
656 | 701 | if (!$preset OR $preset == 'custom') { |
657 | 702 | $prefs['preset'] = 'custom'; |
658 | - } |
|
659 | - else { |
|
703 | + } else { |
|
660 | 704 | $prefs['preset'] = $preset; |
661 | 705 | } |
662 | 706 | |
@@ -671,8 +715,7 @@ discard block |
||
671 | 715 | if (!$result) { |
672 | 716 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysql_error()), WATCHDOG_ERROR); |
673 | 717 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
674 | - } |
|
675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
718 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
676 | 719 | // Show this message if the set wasn't created automatically (in which case |
677 | 720 | // there is a message tailored to that) { |
678 | 721 | drupal_set_message(t('Your preferences have been updated. |
@@ -927,8 +970,7 @@ discard block |
||
927 | 970 | if (boincwork_host_merge($old_host, $current_host, $message)) { |
928 | 971 | $merged[$old_host->id] = $old_host->id; |
929 | 972 | $current_host = boincwork_host_get_info($current_host_id); |
930 | - } |
|
931 | - else { |
|
973 | + } else { |
|
932 | 974 | $errors[$old_host->id] = $message; |
933 | 975 | } |
934 | 976 | } |
@@ -944,8 +986,7 @@ discard block |
||
944 | 986 | $oxford_comma = ''; |
945 | 987 | } |
946 | 988 | $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
947 | - } |
|
948 | - else { |
|
989 | + } else { |
|
949 | 990 | $list = $last; |
950 | 991 | } |
951 | 992 | if (count($merged) == 1) { |
@@ -956,8 +997,7 @@ discard block |
||
956 | 997 | '@id' => $current_host_id |
957 | 998 | ) |
958 | 999 | )); |
959 | - } |
|
960 | - else { |
|
1000 | + } else { |
|
961 | 1001 | drupal_set_message(bts( |
962 | 1002 | 'Computers @old_ids have been merged successfully into @id.', |
963 | 1003 | array( |
@@ -1017,11 +1057,9 @@ discard block |
||
1017 | 1057 | if ($account->boincuser_default_pref_set == $venue) { |
1018 | 1058 | $venue_is_default = TRUE; |
1019 | 1059 | } |
1020 | - } |
|
1021 | - elseif (!$venue OR $venue == 'generic') { |
|
1060 | + } elseif (!$venue OR $venue == 'generic') { |
|
1022 | 1061 | $venue_is_default = TRUE; |
1023 | - } |
|
1024 | - else { |
|
1062 | + } else { |
|
1025 | 1063 | $venue_is_default = FALSE; |
1026 | 1064 | } |
1027 | 1065 | |
@@ -1041,8 +1079,7 @@ discard block |
||
1041 | 1079 | if (isset($prefs[$name]['@value'])) { |
1042 | 1080 | $default[$name] = $prefs[$name]['@value']; |
1043 | 1081 | } |
1044 | - } |
|
1045 | - else { |
|
1082 | + } else { |
|
1046 | 1083 | $default[$name] = $prefs[$name]; |
1047 | 1084 | } |
1048 | 1085 | } |
@@ -1222,16 +1259,13 @@ discard block |
||
1222 | 1259 | foreach ($element as $ordered_element) { |
1223 | 1260 | if (isset($ordered_element['@position'])) { |
1224 | 1261 | $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
1225 | - } |
|
1226 | - else { |
|
1262 | + } else { |
|
1227 | 1263 | $unordered_array[] = array($type => $ordered_element); |
1228 | 1264 | } |
1229 | 1265 | } |
1230 | - } |
|
1231 | - elseif (isset($element['@position'])) { |
|
1266 | + } elseif (isset($element['@position'])) { |
|
1232 | 1267 | $ordered_array[$element['@position']] = array($type => $element); |
1233 | - } |
|
1234 | - else { |
|
1268 | + } else { |
|
1235 | 1269 | $unordered_array[] = array($type => $element); |
1236 | 1270 | } |
1237 | 1271 | } |
@@ -1273,7 +1307,9 @@ discard block |
||
1273 | 1307 | AND $validation_rules['apps']['minimum selected'] > 0) { |
1274 | 1308 | $apps_selected = 0; |
1275 | 1309 | foreach ($validation_rules['apps']['list'] as $app) { |
1276 | - if ($form_state['values']['applications'][$app]) $apps_selected++; |
|
1310 | + if ($form_state['values']['applications'][$app]) { |
|
1311 | + $apps_selected++; |
|
1312 | + } |
|
1277 | 1313 | } |
1278 | 1314 | if ($apps_selected < $validation_rules['apps']['minimum selected']) { |
1279 | 1315 | form_set_error( |
@@ -1311,10 +1347,18 @@ discard block |
||
1311 | 1347 | // Resource preferences |
1312 | 1348 | $prefs['resource_share'] = $edit['resource']['resource_share']; |
1313 | 1349 | if ($app_types->count > 1) { |
1314 | - if ($app_types->cpu) $prefs['no_cpu'] = ($edit['resource']['no_cpu']) ? 0 : 1; |
|
1315 | - if ($app_types->cuda) $prefs['no_cuda'] = ($edit['resource']['no_cuda']) ? 0 : 1; |
|
1316 | - if ($app_types->ati) $prefs['no_ati'] = ($edit['resource']['no_ati']) ? 0 : 1; |
|
1317 | - if ($app_types->intel_gpu) $prefs['no_intel_gpu'] = ($edit['resource']['no_intel_gpu']) ? 0 : 1; |
|
1350 | + if ($app_types->cpu) { |
|
1351 | + $prefs['no_cpu'] = ($edit['resource']['no_cpu']) ? 0 : 1; |
|
1352 | + } |
|
1353 | + if ($app_types->cuda) { |
|
1354 | + $prefs['no_cuda'] = ($edit['resource']['no_cuda']) ? 0 : 1; |
|
1355 | + } |
|
1356 | + if ($app_types->ati) { |
|
1357 | + $prefs['no_ati'] = ($edit['resource']['no_ati']) ? 0 : 1; |
|
1358 | + } |
|
1359 | + if ($app_types->intel_gpu) { |
|
1360 | + $prefs['no_intel_gpu'] = ($edit['resource']['no_intel_gpu']) ? 0 : 1; |
|
1361 | + } |
|
1318 | 1362 | } |
1319 | 1363 | |
1320 | 1364 | // Beta preferences |
@@ -1346,8 +1390,7 @@ discard block |
||
1346 | 1390 | // Update the user's default preference set |
1347 | 1391 | if ($edit['default_set']['default_venue']) { |
1348 | 1392 | boincwork_set_default_venue($venue); |
1349 | - } |
|
1350 | - elseif ($venue == $account->boincuser_default_pref_set) { |
|
1393 | + } elseif ($venue == $account->boincuser_default_pref_set) { |
|
1351 | 1394 | // User has cleared out the default venue setting |
1352 | 1395 | boincwork_set_default_venue(); |
1353 | 1396 | } |
@@ -1355,8 +1398,7 @@ discard block |
||
1355 | 1398 | if (!$result) { |
1356 | 1399 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysql_error()), WATCHDOG_ERROR); |
1357 | 1400 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
1358 | - } |
|
1359 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
1401 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
1360 | 1402 | // Show this message if the set wasn't created automatically (in which case |
1361 | 1403 | // there is a message tailored to that) |
1362 | 1404 | drupal_set_message(t('Your preferences have been updated. |
@@ -1509,8 +1551,7 @@ discard block |
||
1509 | 1551 | // Upload an avatar (pulled from profile_node_form): |
1510 | 1552 | if (!empty($profile_form['field_image'])) { |
1511 | 1553 | $form['field_image'] = $profile_form['field_image']; |
1512 | - } |
|
1513 | - else { |
|
1554 | + } else { |
|
1514 | 1555 | $form['field_image'] = array( |
1515 | 1556 | '#value' => '<div class="form-item">' |
1516 | 1557 | . '<label class="placeholder">' |
@@ -1643,7 +1684,9 @@ discard block |
||
1643 | 1684 | pm_email_notify_user('submit', $edit, $user); |
1644 | 1685 | |
1645 | 1686 | // Avatar settings |
1646 | - if (!$edit['field_image']) $edit['field_image'] = array(); |
|
1687 | + if (!$edit['field_image']) { |
|
1688 | + $edit['field_image'] = array(); |
|
1689 | + } |
|
1647 | 1690 | $profile_node->field_image = $edit['field_image']; |
1648 | 1691 | node_save($profile_node); |
1649 | 1692 | // Flush this from the node cache or changes won't show up immediately! |
@@ -1667,8 +1710,7 @@ discard block |
||
1667 | 1710 | global $base_url; |
1668 | 1711 | if ($edit['language'] != language_default('language')) { |
1669 | 1712 | $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
1670 | - } |
|
1671 | - else { |
|
1713 | + } else { |
|
1672 | 1714 | $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
1673 | 1715 | } |
1674 | 1716 | } |
@@ -332,8 +332,7 @@ discard block |
||
332 | 332 | $name = $element['@attributes']['name']; |
333 | 333 | if (isset($element['@attributes']['entitytype']) AND $element['@attributes']['entitytype'] == 'attribute') { |
334 | 334 | $defaults['@attributes'][$name] = $values[$name]; |
335 | - } |
|
336 | - else { |
|
335 | + } else { |
|
337 | 336 | $defaults[$name] = $values[$name]; |
338 | 337 | } |
339 | 338 | } |
@@ -384,8 +383,7 @@ discard block |
||
384 | 383 | if (isset($user_pref[$name])) { |
385 | 384 | if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) { |
386 | 385 | $value = $user_pref[$name]['@value']; |
387 | - } |
|
388 | - else { |
|
386 | + } else { |
|
389 | 387 | $value = $user_pref[$name]; |
390 | 388 | } |
391 | 389 | } |
@@ -447,8 +445,7 @@ discard block |
||
447 | 445 | if (isset($user_pref[$name])) { |
448 | 446 | if (is_array($user_pref[$name]) AND isset($user_pref[$name]['@value'])) { |
449 | 447 | $value = $user_pref[$name]['@value']; |
450 | - } |
|
451 | - else { |
|
448 | + } else { |
|
452 | 449 | $value = $user_pref[$name]; |
453 | 450 | } |
454 | 451 | } |
@@ -492,8 +489,7 @@ discard block |
||
492 | 489 | isset($item['@attributes']['selected'])) { |
493 | 490 | $default = ($item['@attributes']['selected'] == 'true') ? $item['@value'] : null; |
494 | 491 | } |
495 | - } |
|
496 | - else { |
|
492 | + } else { |
|
497 | 493 | $value = $item; |
498 | 494 | } |
499 | 495 | $options[$value] = $value; |
@@ -552,7 +548,9 @@ discard block |
||
552 | 548 | $user_prefs['app_id'] = array($user_prefs['app_id']); |
553 | 549 | } |
554 | 550 | foreach ($user_prefs['app_id'] as $app) { |
555 | - if (!$app) continue; |
|
551 | + if (!$app) { |
|
552 | + continue; |
|
553 | + } |
|
556 | 554 | if (is_array($app) AND isset($app['@value'])) { |
557 | 555 | $app = $app['@value']; |
558 | 556 | } |
@@ -696,8 +694,7 @@ discard block |
||
696 | 694 | ); |
697 | 695 | if ($top_level) { |
698 | 696 | $uncategorized[$key] = $prefs_element; |
699 | - } |
|
700 | - else { |
|
697 | + } else { |
|
701 | 698 | $prefs_table[$key] = $prefs_element; |
702 | 699 | } |
703 | 700 | break; |
@@ -711,8 +708,7 @@ discard block |
||
711 | 708 | 'name' => bts('Other settings'), |
712 | 709 | 'elements' => $uncategorized, |
713 | 710 | ); |
714 | - } |
|
715 | - elseif ($uncategorized) { |
|
711 | + } elseif ($uncategorized) { |
|
716 | 712 | // If nothing is categorized, output all prefs under a general "settings" |
717 | 713 | $prefs_table['settings'] = array( |
718 | 714 | 'name' => bts('Settings'), |
@@ -745,8 +741,7 @@ discard block |
||
745 | 741 | $main_prefs = load_configuration($boincuser->project_prefs); |
746 | 742 | $main_prefs = (array) $main_prefs['project_preferences']; |
747 | 743 | } |
748 | - } |
|
749 | - else { |
|
744 | + } else { |
|
750 | 745 | if ($boincuser->global_prefs) { |
751 | 746 | $main_prefs = load_configuration($boincuser->global_prefs); |
752 | 747 | $main_prefs = (array) $main_prefs['global_preferences']; |
@@ -759,11 +754,11 @@ discard block |
||
759 | 754 | // Use the length of the $main_prefs array as a condition as to |
760 | 755 | // whether the preferences have already been set. This is |
761 | 756 | // HARDCODED here. |
762 | - if (count($main_prefs) < 3) |
|
763 | - $main_prefs['@attributes'] = array('cleared' => 1); |
|
757 | + if (count($main_prefs) < 3) { |
|
758 | + $main_prefs['@attributes'] = array('cleared' => 1); |
|
759 | + } |
|
764 | 760 | return $main_prefs; |
765 | - } |
|
766 | - else { |
|
761 | + } else { |
|
767 | 762 | if (isset($main_prefs['venue'])) { |
768 | 763 | if (!is_numeric(key($main_prefs['venue']))) { |
769 | 764 | $main_prefs['venue'] = array($main_prefs['venue']); |
@@ -803,8 +798,7 @@ discard block |
||
803 | 798 | $main_prefs = load_configuration($boincuser->project_prefs); |
804 | 799 | $main_prefs = (array) $main_prefs['project_preferences']; |
805 | 800 | } |
806 | - } |
|
807 | - else { |
|
801 | + } else { |
|
808 | 802 | if ($boincuser->global_prefs) { |
809 | 803 | $main_prefs = load_configuration($boincuser->global_prefs); |
810 | 804 | $main_prefs = (array) $main_prefs['global_preferences']; |
@@ -817,8 +811,7 @@ discard block |
||
817 | 811 | if (!$venue OR $venue == 'generic') { |
818 | 812 | //$main_prefs = $prefs; |
819 | 813 | $main_prefs = $prefs + $main_prefs; |
820 | - } |
|
821 | - else { |
|
814 | + } else { |
|
822 | 815 | if (isset($main_prefs['venue'])) { |
823 | 816 | if (!is_numeric(key($main_prefs['venue']))) { |
824 | 817 | $main_prefs['venue'] = array($main_prefs['venue']); |
@@ -827,8 +820,7 @@ discard block |
||
827 | 820 | if (isset($prefs_venue['@attributes']['name']) AND $prefs_venue['@attributes']['name'] == $venue) { |
828 | 821 | if ($prefs) { |
829 | 822 | $main_prefs['venue'][$key] = $prefs; |
830 | - } |
|
831 | - else { |
|
823 | + } else { |
|
832 | 824 | // If prefs is null, clear out this preference set |
833 | 825 | unset($main_prefs['venue'][$key]); |
834 | 826 | if (count($main_prefs['venue']) == 0) { |
@@ -870,8 +862,7 @@ discard block |
||
870 | 862 | db_set_active('boinc'); |
871 | 863 | $result = db_query("UPDATE user SET project_prefs = '{$boincuser->project_prefs}' WHERE id = '{$boincuser->id}'"); |
872 | 864 | db_set_active('default'); |
873 | - } |
|
874 | - else { |
|
865 | + } else { |
|
875 | 866 | $main_prefs = array('global_preferences' => $main_prefs); |
876 | 867 | $boincuser->global_prefs = save_configuration($main_prefs); |
877 | 868 | db_set_active('boinc'); |
@@ -919,15 +910,13 @@ discard block |
||
919 | 910 | // Process nested form elements |
920 | 911 | $parents[] = $field; |
921 | 912 | boincwork_validate_form($rules, $values[$field], $parents); |
922 | - } |
|
923 | - else { |
|
913 | + } else { |
|
924 | 914 | if ($parents) { |
925 | 915 | // form_set_error() identifies nested form elements with '][' as a |
926 | 916 | // delimiter between each parent and child element |
927 | 917 | $parents[] = $field; |
928 | 918 | $form_field = implode('][', $parents); |
929 | - } |
|
930 | - else { |
|
919 | + } else { |
|
931 | 920 | $form_field = $field; |
932 | 921 | } |
933 | 922 | if (isset($rules['datatype']) AND !boincwork_validate_datatype($values[$field], $rules['datatype'])) { |
@@ -990,7 +979,9 @@ discard block |
||
990 | 979 | 7 => 'Z', |
991 | 980 | 8 => 'Y' |
992 | 981 | ); |
993 | - if (!is_numeric($number)) $number = 0; |
|
982 | + if (!is_numeric($number)) { |
|
983 | + $number = 0; |
|
984 | + } |
|
994 | 985 | |
995 | 986 | $digits = floor(log($number, 10)) + 1; |
996 | 987 | $magnitude = 0; |
@@ -1012,8 +1003,12 @@ discard block |
||
1012 | 1003 | |
1013 | 1004 | function load_configuration($text) |
1014 | 1005 | { |
1015 | - if (preg_match('/^\<\?xml .*\?\>$/i', $text)) return null; |
|
1016 | - if ($xml = text_to_xml($text)) return xml_to_array($xml); |
|
1006 | + if (preg_match('/^\<\?xml .*\?\>$/i', $text)) { |
|
1007 | + return null; |
|
1008 | + } |
|
1009 | + if ($xml = text_to_xml($text)) { |
|
1010 | + return xml_to_array($xml); |
|
1011 | + } |
|
1017 | 1012 | return false; |
1018 | 1013 | } |
1019 | 1014 | |
@@ -1023,7 +1018,9 @@ discard block |
||
1023 | 1018 | |
1024 | 1019 | function save_configuration($array) |
1025 | 1020 | { |
1026 | - if ($xml = array_to_xml($array)) return xml_to_text($xml, false, true); |
|
1021 | + if ($xml = array_to_xml($array)) { |
|
1022 | + return xml_to_text($xml, false, true); |
|
1023 | + } |
|
1027 | 1024 | return false; |
1028 | 1025 | } |
1029 | 1026 | |
@@ -1034,7 +1031,9 @@ discard block |
||
1034 | 1031 | |
1035 | 1032 | function array_to_xml($array, $dom = false, $parent_node = false) { |
1036 | 1033 | $is_root = false; |
1037 | - if (!$dom) $dom = new DomDocument('1.0'); |
|
1034 | + if (!$dom) { |
|
1035 | + $dom = new DomDocument('1.0'); |
|
1036 | + } |
|
1038 | 1037 | if (!$parent_node) { |
1039 | 1038 | $parent_node = $dom; |
1040 | 1039 | $is_root = true; |
@@ -1054,26 +1053,22 @@ discard block |
||
1054 | 1053 | $ordered_array[$item['@position']] = array( |
1055 | 1054 | $name => $item |
1056 | 1055 | ); |
1057 | - } |
|
1058 | - else { |
|
1056 | + } else { |
|
1059 | 1057 | $unordered_array[] = array( |
1060 | 1058 | $name => $item |
1061 | 1059 | ); |
1062 | 1060 | } |
1063 | 1061 | } |
1064 | - } |
|
1065 | - elseif (isset($value['@position'])) { |
|
1062 | + } elseif (isset($value['@position'])) { |
|
1066 | 1063 | $ordered_array[$value['@position']] = array( |
1067 | 1064 | $name => $value |
1068 | 1065 | ); |
1069 | - } |
|
1070 | - else { |
|
1066 | + } else { |
|
1071 | 1067 | $unordered_array[] = array( |
1072 | 1068 | $name => $value |
1073 | 1069 | ); |
1074 | 1070 | } |
1075 | - } |
|
1076 | - else { |
|
1071 | + } else { |
|
1077 | 1072 | $unordered_array[] = array( |
1078 | 1073 | $name => $value |
1079 | 1074 | ); |
@@ -1087,12 +1082,16 @@ discard block |
||
1087 | 1082 | foreach ($primed_array as $item) { |
1088 | 1083 | list($name, $value) = each($item); |
1089 | 1084 | if (strcmp($name, '@attributes') == 0) { |
1090 | - if (!is_array($value)) continue; |
|
1085 | + if (!is_array($value)) { |
|
1086 | + continue; |
|
1087 | + } |
|
1091 | 1088 | foreach ($value as $attributeName => $attributeValue) { |
1092 | 1089 | $parent_node->setAttribute($attributeName, $attributeValue); |
1093 | 1090 | } |
1094 | 1091 | } elseif (strcmp($name, '@value') == 0) { |
1095 | - if (isset($value)) $parent_node->nodeValue = $value; |
|
1092 | + if (isset($value)) { |
|
1093 | + $parent_node->nodeValue = $value; |
|
1094 | + } |
|
1096 | 1095 | } elseif (strcmp($name, '@position') == 0) { |
1097 | 1096 | continue; |
1098 | 1097 | } else { |
@@ -1114,7 +1113,9 @@ discard block |
||
1114 | 1113 | $parent_node->appendChild(array_to_xml($value, $dom, $current_node)); |
1115 | 1114 | } |
1116 | 1115 | } else { |
1117 | - if (isset($value)) $current_item->nodeValue = $value; |
|
1116 | + if (isset($value)) { |
|
1117 | + $current_item->nodeValue = $value; |
|
1118 | + } |
|
1118 | 1119 | $parent_node->appendChild($current_item); |
1119 | 1120 | } |
1120 | 1121 | } |
@@ -1178,7 +1179,9 @@ discard block |
||
1178 | 1179 | |
1179 | 1180 | function text_to_xml($text) { |
1180 | 1181 | $xml = new DomDocument(); |
1181 | - if ( !($xml->loadXML($text)) ) return false; |
|
1182 | + if ( !($xml->loadXML($text)) ) { |
|
1183 | + return false; |
|
1184 | + } |
|
1182 | 1185 | return $xml; |
1183 | 1186 | } |
1184 | 1187 | |
@@ -1195,7 +1198,9 @@ discard block |
||
1195 | 1198 | while (!is_null($node)) { |
1196 | 1199 | switch ($node->nodeType) { |
1197 | 1200 | case XML_TEXT_NODE: |
1198 | - if (trim($node->nodeValue) != '') $result = $node->nodeValue; |
|
1201 | + if (trim($node->nodeValue) != '') { |
|
1202 | + $result = $node->nodeValue; |
|
1203 | + } |
|
1199 | 1204 | break; |
1200 | 1205 | case XML_ELEMENT_NODE: |
1201 | 1206 | $node_name = $node->nodeName; |
@@ -1203,10 +1208,14 @@ discard block |
||
1203 | 1208 | $sibling = $node->nextSibling; |
1204 | 1209 | |
1205 | 1210 | // Determine if this node forms a set with siblings (share a node name) |
1206 | - while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->nextSibling; |
|
1211 | + while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) { |
|
1212 | + $sibling = $sibling->nextSibling; |
|
1213 | + } |
|
1207 | 1214 | if (!$sibling) { |
1208 | 1215 | $sibling = $node->previousSibling; |
1209 | - while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) $sibling = $sibling->previousSibling; |
|
1216 | + while (($sibling) AND (($sibling->nodeType != XML_ELEMENT_NODE) OR ($sibling->nodeName != $node->nodeName))) { |
|
1217 | + $sibling = $sibling->previousSibling; |
|
1218 | + } |
|
1210 | 1219 | } |
1211 | 1220 | |
1212 | 1221 | if ($sibling) { |
@@ -1301,8 +1310,7 @@ discard block |
||
1301 | 1310 | . ' computers. Computers will be displayed when they have earned their' |
1302 | 1311 | . ' first credits.') . '</p>'; |
1303 | 1312 | } |
1304 | - } |
|
1305 | - else { |
|
1313 | + } else { |
|
1306 | 1314 | $output .= '<h2>' . bts('Computers hidden') . '</h2>'; |
1307 | 1315 | $output .= '<p>' . bts('This user has chosen not to show information' |
1308 | 1316 | . ' about their computers.') . '</p>'; |
@@ -1462,8 +1470,7 @@ discard block |
||
1462 | 1470 | if (!$received_time) { |
1463 | 1471 | if (time() < $deadline) { |
1464 | 1472 | $output = '<span class="on-time">' . $output . '</span>'; |
1465 | - } |
|
1466 | - else { |
|
1473 | + } else { |
|
1467 | 1474 | $output = '<span class="past-due">' . $output . '</span>'; |
1468 | 1475 | } |
1469 | 1476 | } |