@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | if ($checkct) { |
45 | 45 | $consent_result = BoincLatestConsent::lookup("userid={$user->id} AND consent_type_id=$ctid AND consent_flag=1"); |
46 | 46 | if ($consent_result) { |
47 | - return TRUE; |
|
47 | + return true; |
|
48 | 48 | } |
49 | 49 | } |
50 | - return FALSE; |
|
50 | + return false; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Checks to see if a particular consent_type name is in |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | // if checkenabled=TRUE, if the consent_type is enabled/available for |
57 | 57 | // use. The integer is the consent_type_id- the id from consent_type |
58 | 58 | // table. If the boolean is FALSE, the integer returned is -1. |
59 | -function check_consent_type($name, $checkenabled=TRUE) { |
|
59 | +function check_consent_type($name, $checkenabled=true) { |
|
60 | 60 | $ct = BoincConsentType::lookup("shortname = '{$name}'"); |
61 | 61 | if ($ct and ( !$checkenabled or ($ct->enabled)) ) { |
62 | - return array(TRUE, $ct->id); |
|
62 | + return array(true, $ct->id); |
|
63 | 63 | } |
64 | - return array(FALSE, -1); |
|
64 | + return array(false, -1); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // When a user uses the Web site to login, this funtion checks the |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | require_once("../inc/boinc_db.inc"); |
22 | 22 | require_once("../inc/util.inc"); |
23 | 23 | |
24 | -define('CONSENT_TYPE_ENROLL','ENROLL'); |
|
24 | +define('CONSENT_TYPE_ENROLL', 'ENROLL'); |
|
25 | 25 | |
26 | 26 | // Utility function to check the terms of use. |
27 | 27 | function check_termsofuse() { |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | function consent_to_a_policy($user, $consent_type_id, $consent_flag, $consent_not_required, $source, $ctime = 0) { |
32 | 32 | $mys = BoincDb::escape_string($source); |
33 | - if ($ctime==0) { |
|
33 | + if ($ctime == 0) { |
|
34 | 34 | $mytime = $user->create_time; |
35 | 35 | } else { |
36 | 36 | $mytime = $ctime; |
37 | 37 | } |
38 | 38 | return BoincConsent::insert( |
39 | - "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) " . |
|
39 | + "(userid, consent_type_id, consent_time, consent_flag, consent_not_required, source) ". |
|
40 | 40 | "values($user->id, $consent_type_id, $mytime, $consent_flag, $consent_not_required, '$mys')" |
41 | 41 | ); |
42 | 42 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | // if checkenabled=TRUE, if the consent_type is enabled/available for |
61 | 61 | // use. The integer is the consent_type_id- the id from consent_type |
62 | 62 | // table. If the boolean is FALSE, the integer returned is -1. |
63 | -function check_consent_type($name, $checkenabled=TRUE) { |
|
63 | +function check_consent_type($name, $checkenabled = TRUE) { |
|
64 | 64 | $ct = BoincConsentType::lookup("shortname = '{$name}'"); |
65 | - if ($ct and ( !$checkenabled or ($ct->enabled)) ) { |
|
65 | + if ($ct and (!$checkenabled or ($ct->enabled))) { |
|
66 | 66 | return array(TRUE, $ct->id); |
67 | 67 | } |
68 | 68 | return array(FALSE, -1); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | function intercept_login($user, $perm, $in_next_url = "") { |
75 | 75 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
76 | 76 | $config = get_config(); |
77 | - if ( parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) { |
|
77 | + if (parse_bool($config, "enable_login_mustagree_termsofuse") and $checkct and check_termsofuse() and (!check_user_consent($user, CONSENT_TYPE_ENROLL))) { |
|
78 | 78 | // sent user to terms-of-use Web form after login |
79 | 79 | $mytoken = create_token($user->id, TOKEN_TYPE_LOGIN_INTERCEPT, TOKEN_DURATION_TWO_HOURS); |
80 | 80 | send_cookie('logintoken', $mytoken, false); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $name = substr($name, 0, $name_limit)."..."; |
344 | 344 | } |
345 | 345 | $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>"; |
346 | - if (function_exists("project_user_links")){ |
|
346 | + if (function_exists("project_user_links")) { |
|
347 | 347 | $x .= project_user_links($user); |
348 | 348 | } |
349 | 349 | if ($badge_height) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | // Returns a cacheable community links data object |
465 | 465 | // @param user The user to produce a community links object for |
466 | 466 | |
467 | -function get_community_links_object($user){ |
|
467 | +function get_community_links_object($user) { |
|
468 | 468 | $cache_object = new StdClass; |
469 | 469 | $cache_object->post_count = total_posts($user); |
470 | 470 | $cache_object->user = $user; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | return $cache_object; |
481 | 481 | } |
482 | 482 | |
483 | -function community_links($clo, $logged_in_user){ |
|
483 | +function community_links($clo, $logged_in_user) { |
|
484 | 484 | $user = $clo->user; |
485 | 485 | $team = $clo->team; |
486 | 486 | $friends = $clo->friends; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // they've participated in |
34 | 34 | // |
35 | 35 | function get_other_projects($user) { |
36 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
36 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
37 | 37 | $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid; |
38 | 38 | |
39 | 39 | // Check the cache for that URL |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | if (!NO_STATS) { |
177 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
177 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
178 | 178 | $x = ""; |
179 | 179 | shuffle($cpid_stats_sites); |
180 | 180 | foreach ($cpid_stats_sites as $site) { |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // if $badge_height is > 0, show badges |
329 | 329 | // if $name_limit, limit name to N chars |
330 | 330 | // |
331 | -function user_links($user, $badge_height=0, $name_limit=0) { |
|
331 | +function user_links($user, $badge_height = 0, $name_limit = 0) { |
|
332 | 332 | BoincForumPrefs::lookup($user); |
333 | 333 | if (is_banished($user)) { |
334 | 334 | return "(banished: ID $user->id)"; |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | $name = substr($name, 0, $name_limit)."..."; |
344 | 344 | } |
345 | 345 | $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>"; |
346 | - if (function_exists("project_user_links")){ |
|
346 | + if (function_exists("project_user_links")) { |
|
347 | 347 | $x .= project_user_links($user); |
348 | 348 | } |
349 | 349 | if ($badge_height) { |
350 | 350 | $x .= badges_string(true, $user, $badge_height); |
351 | 351 | } |
352 | - return $name_limit?"<nobr>$x</nobr>":$x; |
|
352 | + return $name_limit ? "<nobr>$x</nobr>" : $x; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | function show_community_private($user) { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | // if there's a foundership request, notify the founder |
398 | 398 | // |
399 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
399 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
400 | 400 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
401 | 401 | } |
402 | 402 | row2(tra("Member of team"), $x); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n"; |
422 | 422 | $n = count($friends); |
423 | 423 | if ($n) { |
424 | - foreach($friends as $friend) { |
|
424 | + foreach ($friends as $friend) { |
|
425 | 425 | $fuser = BoincUser::lookup_id($friend->user_dest); |
426 | 426 | if (!$fuser) continue; |
427 | 427 | $x .= friend_links($fuser); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | // Returns a cacheable community links data object |
465 | 465 | // @param user The user to produce a community links object for |
466 | 466 | |
467 | -function get_community_links_object($user){ |
|
467 | +function get_community_links_object($user) { |
|
468 | 468 | $cache_object = new StdClass; |
469 | 469 | $cache_object->post_count = total_posts($user); |
470 | 470 | $cache_object->user = $user; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $cache_object->friends = array(); |
473 | 473 | |
474 | 474 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
475 | - foreach($friends as $friend) { |
|
475 | + foreach ($friends as $friend) { |
|
476 | 476 | $fuser = BoincUser::lookup_id($friend->user_dest); |
477 | 477 | if (!$fuser) continue; |
478 | 478 | $cache_object->friends[] = $fuser; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | return $cache_object; |
481 | 481 | } |
482 | 482 | |
483 | -function community_links($clo, $logged_in_user){ |
|
483 | +function community_links($clo, $logged_in_user) { |
|
484 | 484 | $user = $clo->user; |
485 | 485 | $team = $clo->team; |
486 | 486 | $friends = $clo->friends; |
@@ -506,15 +506,15 @@ discard block |
||
506 | 506 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
507 | 507 | ); |
508 | 508 | } else if ($friend) { |
509 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
509 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
510 | 510 | } else { |
511 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
511 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | 515 | if ($friends) { |
516 | 516 | $x = ""; |
517 | - foreach($friends as $friend) { |
|
517 | + foreach ($friends as $friend) { |
|
518 | 518 | $x .= friend_links($friend); |
519 | 519 | } |
520 | 520 | row2(tra("Friends")." (".sizeof($friends).")", $x); |
@@ -558,6 +558,6 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | |
561 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
561 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
562 | 562 | |
563 | 563 | ?> |
@@ -286,11 +286,11 @@ |
||
286 | 286 | |
287 | 287 | require_once("../inc/account_ownership.inc"); |
288 | 288 | if (file_exists($account_ownership_private_key_file_path)) { |
289 | - // If the server has keys configured show the account ownership form |
|
290 | - row2( |
|
291 | - tra("Account Ownership"), |
|
292 | - "<a href=\"account_ownership.php?$url_tokens\">Generate ownership proof</a>" |
|
293 | - ); |
|
289 | + // If the server has keys configured show the account ownership form |
|
290 | + row2( |
|
291 | + tra("Account Ownership"), |
|
292 | + "<a href=\"account_ownership.php?$url_tokens\">Generate ownership proof</a>" |
|
293 | + ); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | } |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | WHERE n.type = 'profile' |
166 | 166 | AND n.status = 1 |
167 | 167 | AND n.moderate = 0 |
168 | - " . ($never_been_picked ? " AND bu.uotd_time = 0 " : '') . " |
|
169 | - " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '') . " |
|
168 | + " . ($never_been_picked ? " AND bu.uotd_time = 0 " : '')." |
|
169 | + " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '')." |
|
170 | 170 | ORDER BY RAND() |
171 | 171 | LIMIT 1" |
172 | 172 | )); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * this function is called, it may be called with optional parameters |
213 | 213 | * new and prev email. |
214 | 214 | */ |
215 | -function _boincuser_send_emailchange($account, $new_email=NULL, $prev_email=NULL, $adminuser=FALSE) { |
|
215 | +function _boincuser_send_emailchange($account, $new_email = NULL, $prev_email = NULL, $adminuser = FALSE) { |
|
216 | 216 | require_boinc('token'); |
217 | 217 | module_load_include('inc', 'rules', 'modules/system.rules'); |
218 | 218 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // Name is limited to 60 characters, but we want to leave space to add a |
304 | 304 | // tally if needed (for users with duplicate names); Limit to 56 chars and |
305 | 305 | // replace the middle of the string with "..." if too long |
306 | - $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length-56)+3); |
|
306 | + $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length - 56) + 3); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // Determine if there are duplicate names, if so append a number to end. |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | // delimiters. Curly brace is not really allowed un URLs, but a |
374 | 374 | // more robust function would first check for these curly braces |
375 | 375 | // in the path_to_ignore patterms, just in case. |
376 | - if (preg_match('{' . $pi . '}', $path)) { |
|
376 | + if (preg_match('{'.$pi.'}', $path)) { |
|
377 | 377 | return TRUE; |
378 | 378 | } |
379 | 379 | } |
@@ -499,15 +499,15 @@ discard block |
||
499 | 499 | elseif (!in_array($_GET['q'], $page_blacklist)) { |
500 | 500 | watchdog('boincuser', 'The BOINC scheduling server settings are not yet |
501 | 501 | configured. Please !verify for the settings to become effective.', |
502 | - array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
503 | - t('and') . '</strong> ' . t('save the configuration'), |
|
502 | + array('!verify' => l(t('verify the default values').' <strong>'. |
|
503 | + t('and').'</strong> '.t('save the configuration'), |
|
504 | 504 | 'admin/boinc/scheduler', array('html' => TRUE)) |
505 | 505 | ), WATCHDOG_WARNING); |
506 | 506 | if (user_access('administer site configuration')) { |
507 | 507 | drupal_set_message(t('The BOINC scheduling server settings are not yet |
508 | 508 | configured. Please !verify for the settings to become effective', |
509 | - array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
510 | - t('and') . '</strong> ' . t('save the configuration'), |
|
509 | + array('!verify' => l(t('verify the default values').' <strong>'. |
|
510 | + t('and').'</strong> '.t('save the configuration'), |
|
511 | 511 | 'admin/boinc/scheduler', array('html' => TRUE)) |
512 | 512 | )), 'warning', FALSE); |
513 | 513 | } |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | function _boincuser_node_profile_delete_submit($form, &$form_state) { |
571 | 571 | $node = $form['#node']; |
572 | - $deleteurl = 'node/'. $node->nid .'/delete'; |
|
572 | + $deleteurl = 'node/'.$node->nid.'/delete'; |
|
573 | 573 | $afterq = 'destination=account'; |
574 | 574 | drupal_goto($deleteurl, $afterq); |
575 | 575 | } |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | $view = views_get_current_view(); |
600 | 600 | $account_id = $view->args[0]; |
601 | 601 | $friend_count = flag_friend_get_friend_count($account_id); |
602 | - return '<h2 class="pane-title">' . bts('Friends (@count)', |
|
603 | - array('@count' => $friend_count)) . '</h2>'; |
|
602 | + return '<h2 class="pane-title">'.bts('Friends (@count)', |
|
603 | + array('@count' => $friend_count)).'</h2>'; |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | /** |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $result = db_query_range("SELECT id,name FROM {user} WHERE name LIKE '%s%'", $string, 0, 10); |
614 | 614 | db_set_active('default'); |
615 | 615 | while ($user = db_fetch_object($result)) { |
616 | - $matches[$user->name . '_' . $user->id] = htmlentities($user->name) . " (" . $user->id . ')'; |
|
616 | + $matches[$user->name.'_'.$user->id] = htmlentities($user->name)." (".$user->id.')'; |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | drupal_json((object)$matches); |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
12 | 12 | |
13 | 13 | if (!function_exists('user_load_by_mail')) { |
14 | - /** |
|
15 | - * user_load_by_mail will be broken out of user_load |
|
16 | - */ |
|
17 | - function user_load_by_mail($mail) { |
|
14 | + /** |
|
15 | + * user_load_by_mail will be broken out of user_load |
|
16 | + */ |
|
17 | + function user_load_by_mail($mail) { |
|
18 | 18 | return user_load(array('mail' => $mail)); |
19 | - } |
|
19 | + } |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | * Get an image object from a given file and cck field |
29 | 29 | */ |
30 | 30 | function get_cck_image_object($image_path, $field_name, $content_type, $ignore_resolution = FALSE) { |
31 | - $field = content_fields($field_name, $content_type); |
|
32 | - $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field)); |
|
33 | - if ($ignore_resolution) { |
|
31 | + $field = content_fields($field_name, $content_type); |
|
32 | + $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field)); |
|
33 | + if ($ignore_resolution) { |
|
34 | 34 | unset($validators['filefield_validate_image_resolution']); |
35 | - } |
|
36 | - $target_path = filefield_widget_file_path($field); |
|
37 | - // Create the image object |
|
38 | - return field_file_save_file($image_path, $validators, $target_path, FILE_EXISTS_REPLACE); |
|
35 | + } |
|
36 | + $target_path = filefield_widget_file_path($field); |
|
37 | + // Create the image object |
|
38 | + return field_file_save_file($image_path, $validators, $target_path, FILE_EXISTS_REPLACE); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -47,73 +47,73 @@ discard block |
||
47 | 47 | * |
48 | 48 | */ |
49 | 49 | function boincuser_check_credit_requirements() { |
50 | - global $user; |
|
51 | - if (!$user->uid) { |
|
50 | + global $user; |
|
51 | + if (!$user->uid) { |
|
52 | 52 | return FALSE; |
53 | - } |
|
54 | - $account = user_load($user->uid); |
|
55 | - $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
56 | - $community_role = array_search('community member', user_roles(true)); |
|
57 | - $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
53 | + } |
|
54 | + $account = user_load($user->uid); |
|
55 | + $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
|
56 | + $community_role = array_search('community member', user_roles(true)); |
|
57 | + $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
58 | 58 | |
59 | - // Set user roles based on current penalty status... |
|
60 | - if ($account->boincuser_penalty_expiration > time()) { |
|
59 | + // Set user roles based on current penalty status... |
|
60 | + if ($account->boincuser_penalty_expiration > time()) { |
|
61 | 61 | drupal_set_message(bts( |
62 | - 'You are banned from community participation until @date', |
|
63 | - array('@date' => format_date($account->boincuser_penalty_expiration)) |
|
62 | + 'You are banned from community participation until @date', |
|
63 | + array('@date' => format_date($account->boincuser_penalty_expiration)) |
|
64 | 64 | ), 'warning', FALSE); |
65 | 65 | if (isset($account->roles[$community_role])) { |
66 | - // Remove from the community role, if not already |
|
67 | - unset($account->roles[$community_role]); |
|
66 | + // Remove from the community role, if not already |
|
67 | + unset($account->roles[$community_role]); |
|
68 | 68 | } |
69 | 69 | if (isset($account->roles[$unrestricted_role])) { |
70 | - // Likewise, revoke extra privileges |
|
71 | - unset($account->roles[$unrestricted_role]); |
|
70 | + // Likewise, revoke extra privileges |
|
71 | + unset($account->roles[$unrestricted_role]); |
|
72 | 72 | } |
73 | 73 | user_save($account, array('roles' => $account->roles)); |
74 | - } |
|
75 | - else { |
|
74 | + } |
|
75 | + else { |
|
76 | 76 | if (!isset($account->roles[$community_role])) { |
77 | - // The user should be a 'community member' role. If the user was |
|
78 | - // previously banned, this will restore that role. |
|
79 | - $account->roles[$community_role] = 'community member'; |
|
80 | - user_save($account, array('roles' => $account->roles)); |
|
77 | + // The user should be a 'community member' role. If the user was |
|
78 | + // previously banned, this will restore that role. |
|
79 | + $account->roles[$community_role] = 'community member'; |
|
80 | + user_save($account, array('roles' => $account->roles)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // ... and total credit. |
84 | 84 | if ($account->boincuser_total_credit >= $min_credit_to_post) { |
85 | - if (!isset($account->roles[$unrestricted_role])) { |
|
85 | + if (!isset($account->roles[$unrestricted_role])) { |
|
86 | 86 | // This user is now above the credit threshold and is allowed full |
87 | 87 | // privileges |
88 | 88 | $account->roles[$unrestricted_role] = 'verified contributor'; |
89 | 89 | user_save($account, array('roles' => $account->roles)); |
90 | - } |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | else { |
93 | - drupal_set_message(bts( |
|
93 | + drupal_set_message(bts( |
|
94 | 94 | 'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.', |
95 | 95 | array('@count' => $min_credit_to_post - $account->boincuser_total_credit) |
96 | - ), 'warning', FALSE); |
|
97 | - if (isset($account->roles[$unrestricted_role])) { |
|
96 | + ), 'warning', FALSE); |
|
97 | + if (isset($account->roles[$unrestricted_role])) { |
|
98 | 98 | // Either the threshold has been raised or credits have been revoked; |
99 | 99 | // this user no longer qualifies for full privileges |
100 | 100 | unset($account->roles[$unrestricted_role]); |
101 | 101 | user_save($account, array('roles' => $account->roles)); |
102 | - } |
|
102 | + } |
|
103 | 103 | } |
104 | 104 | |
105 | - } |
|
105 | + } |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Get the cid of the first comment the user has not seen on a given node |
110 | 110 | */ |
111 | 111 | function boincuser_get_first_unread_comment_id($nid, $uid = NULL) { |
112 | - if (!$uid) { |
|
112 | + if (!$uid) { |
|
113 | 113 | global $user; |
114 | 114 | $uid = $user->uid; |
115 | - } |
|
116 | - return db_result(db_query(" |
|
115 | + } |
|
116 | + return db_result(db_query(" |
|
117 | 117 | SELECT c.cid |
118 | 118 | FROM {node} n |
119 | 119 | INNER JOIN {comments} c ON c.nid = n.nid |
@@ -124,40 +124,40 @@ discard block |
||
124 | 124 | ORDER BY c.timestamp ASC |
125 | 125 | LIMIT 1", |
126 | 126 | $uid, $nid |
127 | - )); |
|
127 | + )); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Choose and set the user of the day |
132 | 132 | */ |
133 | 133 | function boincuser_select_user_of_the_day() { |
134 | - // First get a list of users with recent credit |
|
135 | - db_set_active('boinc_rw'); |
|
136 | - $users_with_credit = db_query(" |
|
134 | + // First get a list of users with recent credit |
|
135 | + db_set_active('boinc_rw'); |
|
136 | + $users_with_credit = db_query(" |
|
137 | 137 | SELECT |
138 | 138 | id |
139 | 139 | FROM {user} u |
140 | 140 | JOIN {profile} p ON p.userid = u.id |
141 | 141 | WHERE expavg_credit > 1 |
142 | 142 | ORDER BY uotd_time ASC, RAND()" |
143 | - ); |
|
144 | - db_set_active('default'); |
|
145 | - $active_users = array(); |
|
146 | - while ($user_with_credit = db_fetch_object($users_with_credit)) { |
|
143 | + ); |
|
144 | + db_set_active('default'); |
|
145 | + $active_users = array(); |
|
146 | + while ($user_with_credit = db_fetch_object($users_with_credit)) { |
|
147 | 147 | $active_users[] = $user_with_credit->id; |
148 | - } |
|
149 | - $active_users = implode(',', $active_users); |
|
150 | - // Limit to users who have never been user of the day, if there are any |
|
151 | - $never_been_picked = db_result(db_query(" |
|
148 | + } |
|
149 | + $active_users = implode(',', $active_users); |
|
150 | + // Limit to users who have never been user of the day, if there are any |
|
151 | + $never_been_picked = db_result(db_query(" |
|
152 | 152 | SELECT COUNT(*) |
153 | 153 | FROM {boincuser} bu |
154 | 154 | WHERE bu.uotd_time = 0 |
155 | 155 | " . ($active_users ? " AND bu.boinc_id IN ({$active_users}) " : '') |
156 | - )); |
|
157 | - $new_uotd_uid = 0; |
|
158 | - while (!$new_uotd_uid) { |
|
156 | + )); |
|
157 | + $new_uotd_uid = 0; |
|
158 | + while (!$new_uotd_uid) { |
|
159 | 159 | // Select a user of the day randomly from the pool |
160 | - $new_uotd_uid = db_result(db_query(" |
|
160 | + $new_uotd_uid = db_result(db_query(" |
|
161 | 161 | SELECT |
162 | 162 | n.uid |
163 | 163 | FROM {node} n |
@@ -171,31 +171,31 @@ discard block |
||
171 | 171 | LIMIT 1" |
172 | 172 | )); |
173 | 173 | if (!$new_uotd_uid) { |
174 | - // Can't find a user with a profile; remove constraints on the pool |
|
175 | - if ($never_been_picked) { |
|
174 | + // Can't find a user with a profile; remove constraints on the pool |
|
175 | + if ($never_been_picked) { |
|
176 | 176 | // Allow users who have been previously selected |
177 | 177 | $never_been_picked = FALSE; |
178 | - } |
|
179 | - elseif ($active_users) { |
|
178 | + } |
|
179 | + elseif ($active_users) { |
|
180 | 180 | // Allow users who are not even active (getting desperate) |
181 | 181 | $active_users = FALSE; |
182 | - } |
|
183 | - else { |
|
182 | + } |
|
183 | + else { |
|
184 | 184 | // Process failed... |
185 | 185 | return FALSE; |
186 | - } |
|
186 | + } |
|
187 | 187 | } |
188 | - } |
|
189 | - $uotd = user_load($new_uotd_uid); |
|
190 | - if ($uotd->uid) { |
|
188 | + } |
|
189 | + $uotd = user_load($new_uotd_uid); |
|
190 | + if ($uotd->uid) { |
|
191 | 191 | db_query(" |
192 | 192 | UPDATE {boincuser} |
193 | 193 | SET uotd_time = '%d' |
194 | 194 | WHERE uid = '%d'", |
195 | - time(), $uotd->uid |
|
195 | + time(), $uotd->uid |
|
196 | 196 | ); |
197 | - } |
|
198 | - return $uotd; |
|
197 | + } |
|
198 | + return $uotd; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -213,71 +213,71 @@ discard block |
||
213 | 213 | * new and prev email. |
214 | 214 | */ |
215 | 215 | function _boincuser_send_emailchange($account, $new_email=NULL, $prev_email=NULL, $adminuser=FALSE) { |
216 | - require_boinc('token'); |
|
217 | - module_load_include('inc', 'rules', 'modules/system.rules'); |
|
216 | + require_boinc('token'); |
|
217 | + module_load_include('inc', 'rules', 'modules/system.rules'); |
|
218 | 218 | |
219 | - global $base_url; |
|
220 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
219 | + global $base_url; |
|
220 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
221 | 221 | |
222 | - if (is_null($new_email)) { |
|
222 | + if (is_null($new_email)) { |
|
223 | 223 | $new_email = $account->mail; |
224 | - } |
|
225 | - if (is_null($prev_email)) { |
|
224 | + } |
|
225 | + if (is_null($prev_email)) { |
|
226 | 226 | $prev_email = $account->boincuser_previous_email_addr; |
227 | - } |
|
228 | - |
|
229 | - // @todo - set constant in drupal, or use BOINC contsants |
|
230 | - $duration = TOKEN_DURATION_ONE_WEEK; |
|
231 | - $changedate = date('F j, Y \a\t G:i T', time()); |
|
232 | - $newdate = date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration); |
|
233 | - $token = create_token($account->boincuser_id, TOKEN_TYPE_CHANGE_EMAIL, $duration); |
|
234 | - if ($adminuser) { |
|
227 | + } |
|
228 | + |
|
229 | + // @todo - set constant in drupal, or use BOINC contsants |
|
230 | + $duration = TOKEN_DURATION_ONE_WEEK; |
|
231 | + $changedate = date('F j, Y \a\t G:i T', time()); |
|
232 | + $newdate = date('F j, Y \a\t G:i T', $account->boincuser_email_addr_change_time + $duration); |
|
233 | + $token = create_token($account->boincuser_id, TOKEN_TYPE_CHANGE_EMAIL, $duration); |
|
234 | + if ($adminuser) { |
|
235 | 235 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
236 | - . "on {$changedate}. If you need to reverse this change, please look for " |
|
237 | - . "an email send to the email address: {$prev_email}.\n"; |
|
238 | - } |
|
239 | - else { |
|
236 | + . "on {$changedate}. If you need to reverse this change, please look for " |
|
237 | + . "an email send to the email address: {$prev_email}.\n"; |
|
238 | + } |
|
239 | + else { |
|
240 | 240 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
241 | - . "on {$changedate}. You will not be able to change your email address " |
|
242 | - . "until {$newdate}. If you need to reverse this change, please look for " |
|
243 | - . "an email send to the email address: {$prev_email}.\n"; |
|
244 | - } |
|
245 | - |
|
246 | - // Send email #1 to current address |
|
247 | - $mysubject = "Notification of email change at {$site_name}"; |
|
248 | - $mymessage = '' |
|
249 | - . "{$account->boincuser_name},\n" |
|
250 | - . "\n" |
|
251 | - . $graf1 |
|
252 | - . "\n" |
|
253 | - . "Thanks, \n" |
|
254 | - . "{$site_name} support team\n"; |
|
255 | - |
|
256 | - $settings = array( |
|
241 | + . "on {$changedate}. You will not be able to change your email address " |
|
242 | + . "until {$newdate}. If you need to reverse this change, please look for " |
|
243 | + . "an email send to the email address: {$prev_email}.\n"; |
|
244 | + } |
|
245 | + |
|
246 | + // Send email #1 to current address |
|
247 | + $mysubject = "Notification of email change at {$site_name}"; |
|
248 | + $mymessage = '' |
|
249 | + . "{$account->boincuser_name},\n" |
|
250 | + . "\n" |
|
251 | + . $graf1 |
|
252 | + . "\n" |
|
253 | + . "Thanks, \n" |
|
254 | + . "{$site_name} support team\n"; |
|
255 | + |
|
256 | + $settings = array( |
|
257 | 257 | 'from' => '', |
258 | 258 | 'to' => $new_email, |
259 | 259 | 'subject' => $mysubject, |
260 | 260 | 'message' => $mymessage, |
261 | - ); |
|
262 | - rules_action_mail_to_user($account, $settings); |
|
263 | - |
|
264 | - // Send email #2 to previous address. |
|
265 | - $mymessage = '' |
|
266 | - . "Your email address has been changed. If you did not intend to take this action, then please click this link to reverse this change, or copy-and-paste the link into your browser location bar. You will need to change your password as well.\n" |
|
267 | - . "\n" |
|
268 | - . "{$base_url}/user/{$account->uid}/recoveremail/{$token}\n" |
|
269 | - . "\n" |
|
270 | - . "Thanks, \n" |
|
271 | - . "{$site_name} support team\n"; |
|
272 | - |
|
273 | - $settings = array( |
|
261 | + ); |
|
262 | + rules_action_mail_to_user($account, $settings); |
|
263 | + |
|
264 | + // Send email #2 to previous address. |
|
265 | + $mymessage = '' |
|
266 | + . "Your email address has been changed. If you did not intend to take this action, then please click this link to reverse this change, or copy-and-paste the link into your browser location bar. You will need to change your password as well.\n" |
|
267 | + . "\n" |
|
268 | + . "{$base_url}/user/{$account->uid}/recoveremail/{$token}\n" |
|
269 | + . "\n" |
|
270 | + . "Thanks, \n" |
|
271 | + . "{$site_name} support team\n"; |
|
272 | + |
|
273 | + $settings = array( |
|
274 | 274 | 'from' => '', |
275 | 275 | 'to' => $prev_email, |
276 | 276 | 'subject' => $mysubject, |
277 | 277 | 'message' => $mymessage, |
278 | - ); |
|
278 | + ); |
|
279 | 279 | |
280 | - rules_action_mail($settings); |
|
280 | + rules_action_mail($settings); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -287,32 +287,32 @@ discard block |
||
287 | 287 | * |
288 | 288 | */ |
289 | 289 | function create_proper_drupalname($requested_name) { |
290 | - if (!$requested_name) { |
|
290 | + if (!$requested_name) { |
|
291 | 291 | // If the name is empty, set it |
292 | 292 | $requested_name = 'anonymous'; |
293 | - } |
|
294 | - $same_name_tally = 1; |
|
295 | - |
|
296 | - // Remove extra spaces |
|
297 | - $name2 = preg_replace("/ {2,}/", " ", trim($requested_name)); |
|
298 | - // Remove any non-valid characters |
|
299 | - $cleaned_name = preg_replace('/[^a-zA-Z0-9_ \.-]/s', '_', $name2); |
|
300 | - // Truncate name |
|
301 | - $name_length = strlen($cleaned_name); |
|
302 | - if ($name_length > 56) { |
|
293 | + } |
|
294 | + $same_name_tally = 1; |
|
295 | + |
|
296 | + // Remove extra spaces |
|
297 | + $name2 = preg_replace("/ {2,}/", " ", trim($requested_name)); |
|
298 | + // Remove any non-valid characters |
|
299 | + $cleaned_name = preg_replace('/[^a-zA-Z0-9_ \.-]/s', '_', $name2); |
|
300 | + // Truncate name |
|
301 | + $name_length = strlen($cleaned_name); |
|
302 | + if ($name_length > 56) { |
|
303 | 303 | // Name is limited to 60 characters, but we want to leave space to add a |
304 | 304 | // tally if needed (for users with duplicate names); Limit to 56 chars and |
305 | 305 | // replace the middle of the string with "..." if too long |
306 | 306 | $cleaned_name = substr_replace($cleaned_name, '...', 28, ($name_length-56)+3); |
307 | - } |
|
307 | + } |
|
308 | 308 | |
309 | - // Determine if there are duplicate names, if so append a number to end. |
|
310 | - $unique_name = $cleaned_name; |
|
311 | - while (db_result(db_query("SELECT uid FROM {users} WHERE name = '{$unique_name}' LIMIT 1"))) { |
|
309 | + // Determine if there are duplicate names, if so append a number to end. |
|
310 | + $unique_name = $cleaned_name; |
|
311 | + while (db_result(db_query("SELECT uid FROM {users} WHERE name = '{$unique_name}' LIMIT 1"))) { |
|
312 | 312 | $same_name_tally++; |
313 | 313 | $unique_name = "{$cleaned_name}_{$same_name_tally}"; |
314 | - } |
|
315 | - return $unique_name; |
|
314 | + } |
|
315 | + return $unique_name; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | * |
327 | 327 | */ |
328 | 328 | function boincuser_check_termsofuse($user) { |
329 | - require_boinc('consent'); |
|
330 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
331 | - return check_user_consent($boinc_user, CONSENT_TYPE_ENROLL); |
|
329 | + require_boinc('consent'); |
|
330 | + $boinc_user = boincuser_load($user->uid, TRUE); |
|
331 | + return check_user_consent($boinc_user, CONSENT_TYPE_ENROLL); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -339,33 +339,33 @@ discard block |
||
339 | 339 | * |
340 | 340 | */ |
341 | 341 | function boincuser_consentto_termsofuse($user) { |
342 | - require_boinc('consent'); |
|
343 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
342 | + require_boinc('consent'); |
|
343 | + $boinc_user = boincuser_load($user->uid, TRUE); |
|
344 | 344 | |
345 | - list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
|
346 | - if ($checkct) { |
|
345 | + list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
|
346 | + if ($checkct) { |
|
347 | 347 | $rc1 = consent_to_a_policy($boinc_user, $ctid, 1, 0, 'Webform', time()); |
348 | 348 | if (!$rc1) { |
349 | - drupal_set_message( |
|
349 | + drupal_set_message( |
|
350 | 350 | bts("ERROR: Database error when attempting to INSERT into table consent with ID=@id. The @project administrators have been notified.", |
351 | 351 | array( |
352 | - '@id' => $boinc_user->id, |
|
353 | - '@project' => variable_get('site_name', 'Drupal-BOINC'), NULL, 'boinc:add-new-user' |
|
352 | + '@id' => $boinc_user->id, |
|
353 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), NULL, 'boinc:add-new-user' |
|
354 | 354 | ), |
355 | 355 | 'NULL', 'boinc:consent-termsofuse'), |
356 | - 'error'); |
|
357 | - rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
|
356 | + 'error'); |
|
357 | + rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
|
358 | 358 | } |
359 | 359 | return $rc1; |
360 | - } |
|
361 | - else { |
|
360 | + } |
|
361 | + else { |
|
362 | 362 | drupal_set_message( |
363 | - bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
|
363 | + bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
|
364 | 364 | array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'), |
365 | 365 | 'error'); |
366 | 366 | rules_invoke_event('boincuser_general_consent_type_error', CONSENT_TYPE_ENROLL, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
367 | - } |
|
368 | - return FALSE; |
|
367 | + } |
|
368 | + return FALSE; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -374,16 +374,16 @@ discard block |
||
374 | 374 | */ |
375 | 375 | function _boincuser_ignore_paths($path, $paths_to_ignore) { |
376 | 376 | |
377 | - foreach ($paths_to_ignore as $pi) { |
|
377 | + foreach ($paths_to_ignore as $pi) { |
|
378 | 378 | // @todo Currently this function uses {} as PHP regexp |
379 | 379 | // delimiters. Curly brace is not really allowed un URLs, but a |
380 | 380 | // more robust function would first check for these curly braces |
381 | 381 | // in the path_to_ignore patterms, just in case. |
382 | 382 | if (preg_match('{' . $pi . '}', $path)) { |
383 | - return TRUE; |
|
383 | + return TRUE; |
|
384 | 384 | } |
385 | - } |
|
386 | - return FALSE; |
|
385 | + } |
|
386 | + return FALSE; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -391,20 +391,20 @@ discard block |
||
391 | 391 | * Drupal's recover email path. |
392 | 392 | */ |
393 | 393 | function _boincuser_redirect_recover_email() { |
394 | - $params = array( |
|
394 | + $params = array( |
|
395 | 395 | 'boincid' => isset($_GET['id']) ? $_GET['id'] : '', |
396 | 396 | 'token' => isset($_GET['token']) ? $_GET['token'] : '' |
397 | - ); |
|
397 | + ); |
|
398 | 398 | |
399 | - // If boincid or token is not present, then go to the home page. |
|
400 | - if (empty($params['boincid']) or empty($params['token'])) { |
|
399 | + // If boincid or token is not present, then go to the home page. |
|
400 | + if (empty($params['boincid']) or empty($params['token'])) { |
|
401 | 401 | $redirect = ''; |
402 | - } |
|
403 | - else { |
|
402 | + } |
|
403 | + else { |
|
404 | 404 | $uid = boincuser_lookup_uid($params['boincid']); |
405 | 405 | $redirect = "/user/${uid}/recoveremail/${params['token']}"; |
406 | - } |
|
407 | - drupal_goto($redirect); |
|
406 | + } |
|
407 | + drupal_goto($redirect); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -415,17 +415,17 @@ discard block |
||
415 | 415 | * Require BOINC library |
416 | 416 | */ |
417 | 417 | function require_boinc($libraries) { |
418 | - if ($include_dir = boinc_get_path('html_inc')) { |
|
418 | + if ($include_dir = boinc_get_path('html_inc')) { |
|
419 | 419 | $working_dir = getcwd(); |
420 | 420 | chdir($include_dir); |
421 | 421 | if (!is_array($libraries)) { |
422 | - $libraries = array($libraries); |
|
422 | + $libraries = array($libraries); |
|
423 | 423 | } |
424 | 424 | foreach ($libraries as $library) { |
425 | - require_once("{$library}.inc"); |
|
425 | + require_once("{$library}.inc"); |
|
426 | 426 | } |
427 | 427 | chdir($working_dir); |
428 | - } |
|
428 | + } |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * The path from the BOINC html root must be included (e.g. user/file.php) |
434 | 434 | */ |
435 | 435 | function include_boinc($file) { |
436 | - if ($include_dir = boinc_get_path()) { |
|
436 | + if ($include_dir = boinc_get_path()) { |
|
437 | 437 | $include_dir .= '/html'; |
438 | 438 | $workingDir = getcwd(); |
439 | 439 | $path = dirname($file); |
@@ -441,84 +441,84 @@ discard block |
||
441 | 441 | chdir("{$include_dir}/{$path}"); |
442 | 442 | include($file); |
443 | 443 | chdir($workingDir); |
444 | - } |
|
444 | + } |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Get the BOINC include path |
449 | 449 | */ |
450 | 450 | function boinc_get_path($type = 'root') { |
451 | - $dir = "boinc_{$type}_dir"; |
|
452 | - if ($include_dir = variable_get("boinc_{$type}_dir", '')) { |
|
451 | + $dir = "boinc_{$type}_dir"; |
|
452 | + if ($include_dir = variable_get("boinc_{$type}_dir", '')) { |
|
453 | 453 | return $include_dir; |
454 | - } |
|
455 | - else { |
|
454 | + } |
|
455 | + else { |
|
456 | 456 | // Don't show errors on blacklisted pages |
457 | 457 | $page_blacklist = array( |
458 | - 'admin/boinc/environment' |
|
458 | + 'admin/boinc/environment' |
|
459 | 459 | ); |
460 | 460 | if (!in_array($_GET['q'], $page_blacklist)) { |
461 | - watchdog('boincuser', 'The BOINC environment is not configured. Please |
|
461 | + watchdog('boincuser', 'The BOINC environment is not configured. Please |
|
462 | 462 | !configure_it', array('!configure_it' => l(t('configure it now'), |
463 | 463 | 'admin/boinc/environment')), WATCHDOG_WARNING); |
464 | - if (user_access('administer site configuration')) { |
|
464 | + if (user_access('administer site configuration')) { |
|
465 | 465 | drupal_set_message(t('The BOINC environment is not configured. Please |
466 | 466 | !configure_it', array('!configure_it' => l(t('configure it now'), |
467 | 467 | 'admin/boinc/environment'))), 'warning', FALSE); |
468 | - } |
|
469 | - else { |
|
468 | + } |
|
469 | + else { |
|
470 | 470 | drupal_set_message(t('There is a problem with the site. Please contact |
471 | 471 | the system administrator.'), 'error', FALSE); |
472 | - } |
|
473 | - // Redirect home to display the error message and avoid fatal errors |
|
474 | - // (unless on a blacklisted page) |
|
475 | - $redirect_blacklist = array( |
|
472 | + } |
|
473 | + // Redirect home to display the error message and avoid fatal errors |
|
474 | + // (unless on a blacklisted page) |
|
475 | + $redirect_blacklist = array( |
|
476 | 476 | 'admin/settings/performance', |
477 | 477 | 'admin/boinc/environment', |
478 | 478 | 'home', |
479 | 479 | '' |
480 | - ); |
|
481 | - if (!in_array($_GET['q'], $redirect_blacklist)) { |
|
480 | + ); |
|
481 | + if (!in_array($_GET['q'], $redirect_blacklist)) { |
|
482 | 482 | drupal_goto(''); |
483 | - } |
|
483 | + } |
|
484 | 484 | } |
485 | 485 | else { |
486 | - // Clear the messages on the environment config page |
|
487 | - drupal_get_messages(); |
|
486 | + // Clear the messages on the environment config page |
|
487 | + drupal_get_messages(); |
|
488 | 488 | } |
489 | - } |
|
490 | - return FALSE; |
|
489 | + } |
|
490 | + return FALSE; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
494 | 494 | * Get the configured scheduler tags |
495 | 495 | */ |
496 | 496 | function boinc_get_scheduler_tags() { |
497 | - // Don't generate messages for blacklisted pages |
|
498 | - $page_blacklist = array( |
|
497 | + // Don't generate messages for blacklisted pages |
|
498 | + $page_blacklist = array( |
|
499 | 499 | 'admin/boinc/environment', |
500 | 500 | 'admin/boinc/scheduler' |
501 | - ); |
|
502 | - if ($url_config = variable_get('boinc_scheduler_urls', '')) { |
|
501 | + ); |
|
502 | + if ($url_config = variable_get('boinc_scheduler_urls', '')) { |
|
503 | 503 | return explode("\r\n", $url_config); |
504 | - } |
|
505 | - elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
504 | + } |
|
505 | + elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
506 | 506 | watchdog('boincuser', 'The BOINC scheduling server settings are not yet |
507 | 507 | configured. Please !verify for the settings to become effective.', |
508 | - array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
508 | + array('!verify' => l(t('verify the default values') . ' <strong>' . |
|
509 | 509 | t('and') . '</strong> ' . t('save the configuration'), |
510 | 510 | 'admin/boinc/scheduler', array('html' => TRUE)) |
511 | - ), WATCHDOG_WARNING); |
|
511 | + ), WATCHDOG_WARNING); |
|
512 | 512 | if (user_access('administer site configuration')) { |
513 | - drupal_set_message(t('The BOINC scheduling server settings are not yet |
|
513 | + drupal_set_message(t('The BOINC scheduling server settings are not yet |
|
514 | 514 | configured. Please !verify for the settings to become effective', |
515 | 515 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
516 | - t('and') . '</strong> ' . t('save the configuration'), |
|
517 | - 'admin/boinc/scheduler', array('html' => TRUE)) |
|
516 | + t('and') . '</strong> ' . t('save the configuration'), |
|
517 | + 'admin/boinc/scheduler', array('html' => TRUE)) |
|
518 | 518 | )), 'warning', FALSE); |
519 | 519 | } |
520 | - } |
|
521 | - return array(); |
|
520 | + } |
|
521 | + return array(); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -530,41 +530,41 @@ discard block |
||
530 | 530 | * Determine if a BOINC ID matches the logged in user |
531 | 531 | */ |
532 | 532 | function is_current_boinc_user($boinc_id) { |
533 | - global $user; |
|
534 | - if (!$user->uid) { |
|
533 | + global $user; |
|
534 | + if (!$user->uid) { |
|
535 | 535 | return FALSE; |
536 | - } |
|
537 | - // boincuser_id is not stored in the global user, so load a new instance |
|
538 | - $drupuser = user_load($user->uid); |
|
539 | - return ($boinc_id == $drupuser->boincuser_id); |
|
536 | + } |
|
537 | + // boincuser_id is not stored in the global user, so load a new instance |
|
538 | + $drupuser = user_load($user->uid); |
|
539 | + return ($boinc_id == $drupuser->boincuser_id); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | /** |
543 | 543 | * Convert a BOINC ID to a Drupal ID |
544 | 544 | */ |
545 | 545 | function boincuser_lookup_uid($boinc_id) { |
546 | - $drupal_id = db_result(db_query("SELECT uid FROM {boincuser} WHERE boinc_id='%d'", $boinc_id)); |
|
547 | - return $drupal_id; |
|
546 | + $drupal_id = db_result(db_query("SELECT uid FROM {boincuser} WHERE boinc_id='%d'", $boinc_id)); |
|
547 | + return $drupal_id; |
|
548 | 548 | } |
549 | 549 | function get_drupal_id($boinc_id) { |
550 | - return boincuser_lookup_uid($boinc_id); |
|
550 | + return boincuser_lookup_uid($boinc_id); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | /** |
554 | 554 | * Get a BOINC user object |
555 | 555 | */ |
556 | 556 | function boincuser_load($user_id = NULL, $is_drupal_id = FALSE) { |
557 | - if (!$user_id) { |
|
557 | + if (!$user_id) { |
|
558 | 558 | global $user; |
559 | 559 | $user_id = $user->uid; |
560 | 560 | $is_drupal_id = TRUE; |
561 | - } |
|
562 | - if ($is_drupal_id) { |
|
561 | + } |
|
562 | + if ($is_drupal_id) { |
|
563 | 563 | $account = user_load($user_id); |
564 | 564 | $user_id = $account->boincuser_id; |
565 | - } |
|
566 | - require_boinc('boinc_db'); |
|
567 | - return BoincUser::lookup_id($user_id); |
|
565 | + } |
|
566 | + require_boinc('boinc_db'); |
|
567 | + return BoincUser::lookup_id($user_id); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -574,10 +574,10 @@ discard block |
||
574 | 574 | * page, delete button. |
575 | 575 | */ |
576 | 576 | function _boincuser_node_profile_delete_submit($form, &$form_state) { |
577 | - $node = $form['#node']; |
|
578 | - $deleteurl = 'node/'. $node->nid .'/delete'; |
|
579 | - $afterq = 'destination=account'; |
|
580 | - drupal_goto($deleteurl, $afterq); |
|
577 | + $node = $form['#node']; |
|
578 | + $deleteurl = 'node/'. $node->nid .'/delete'; |
|
579 | + $afterq = 'destination=account'; |
|
580 | + drupal_goto($deleteurl, $afterq); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -588,8 +588,8 @@ discard block |
||
588 | 588 | * Wrapper for boinc_version() function |
589 | 589 | */ |
590 | 590 | function get_boinc_version($x) { |
591 | - require_boinc('host'); |
|
592 | - return function_exists('boinc_version') ? boinc_version($x) : 'err!'; |
|
591 | + require_boinc('host'); |
|
592 | + return function_exists('boinc_version') ? boinc_version($x) : 'err!'; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | |
@@ -598,14 +598,14 @@ discard block |
||
598 | 598 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
599 | 599 | |
600 | 600 | /** |
601 | - * Generate the friend block header |
|
602 | - */ |
|
601 | + * Generate the friend block header |
|
602 | + */ |
|
603 | 603 | function boincuser_views_friends_block_header($context = null) { |
604 | - // Get the friend count for the user being viewed |
|
605 | - $view = views_get_current_view(); |
|
606 | - $account_id = $view->args[0]; |
|
607 | - $friend_count = flag_friend_get_friend_count($account_id); |
|
608 | - return '<h2 class="pane-title">' . bts('Friends (@count)', |
|
604 | + // Get the friend count for the user being viewed |
|
605 | + $view = views_get_current_view(); |
|
606 | + $account_id = $view->args[0]; |
|
607 | + $friend_count = flag_friend_get_friend_count($account_id); |
|
608 | + return '<h2 class="pane-title">' . bts('Friends (@count)', |
|
609 | 609 | array('@count' => $friend_count)) . '</h2>'; |
610 | 610 | } |
611 | 611 | |
@@ -614,13 +614,13 @@ discard block |
||
614 | 614 | * database. |
615 | 615 | */ |
616 | 616 | function _boincuser_user_name_autocomplete($string) { |
617 | - $matches = array(); |
|
618 | - db_set_active('boinc_ro'); |
|
619 | - $result = db_query_range("SELECT id,name FROM {user} WHERE name LIKE '%s%'", $string, 0, 10); |
|
620 | - db_set_active('default'); |
|
621 | - while ($user = db_fetch_object($result)) { |
|
622 | - $matches[$user->name . '_' . $user->id] = htmlentities($user->name) . " (" . $user->id . ')'; |
|
623 | - } |
|
624 | - |
|
625 | - drupal_json((object)$matches); |
|
617 | + $matches = array(); |
|
618 | + db_set_active('boinc_ro'); |
|
619 | + $result = db_query_range("SELECT id,name FROM {user} WHERE name LIKE '%s%'", $string, 0, 10); |
|
620 | + db_set_active('default'); |
|
621 | + while ($user = db_fetch_object($result)) { |
|
622 | + $matches[$user->name . '_' . $user->id] = htmlentities($user->name) . " (" . $user->id . ')'; |
|
623 | + } |
|
624 | + |
|
625 | + drupal_json((object)$matches); |
|
626 | 626 | } |
@@ -71,8 +71,7 @@ discard block |
||
71 | 71 | unset($account->roles[$unrestricted_role]); |
72 | 72 | } |
73 | 73 | user_save($account, array('roles' => $account->roles)); |
74 | - } |
|
75 | - else { |
|
74 | + } else { |
|
76 | 75 | if (!isset($account->roles[$community_role])) { |
77 | 76 | // The user should be a 'community member' role. If the user was |
78 | 77 | // previously banned, this will restore that role. |
@@ -88,8 +87,7 @@ discard block |
||
88 | 87 | $account->roles[$unrestricted_role] = 'verified contributor'; |
89 | 88 | user_save($account, array('roles' => $account->roles)); |
90 | 89 | } |
91 | - } |
|
92 | - else { |
|
90 | + } else { |
|
93 | 91 | drupal_set_message(bts( |
94 | 92 | 'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.', |
95 | 93 | array('@count' => $min_credit_to_post - $account->boincuser_total_credit) |
@@ -175,12 +173,10 @@ discard block |
||
175 | 173 | if ($never_been_picked) { |
176 | 174 | // Allow users who have been previously selected |
177 | 175 | $never_been_picked = FALSE; |
178 | - } |
|
179 | - elseif ($active_users) { |
|
176 | + } elseif ($active_users) { |
|
180 | 177 | // Allow users who are not even active (getting desperate) |
181 | 178 | $active_users = FALSE; |
182 | - } |
|
183 | - else { |
|
179 | + } else { |
|
184 | 180 | // Process failed... |
185 | 181 | return FALSE; |
186 | 182 | } |
@@ -235,8 +231,7 @@ discard block |
||
235 | 231 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
236 | 232 | . "on {$changedate}. If you need to reverse this change, please look for " |
237 | 233 | . "an email send to the email address: {$prev_email}.\n"; |
238 | - } |
|
239 | - else { |
|
234 | + } else { |
|
240 | 235 | $graf1 = "Your email address was changed from {$prev_email} to {$new_email} " |
241 | 236 | . "on {$changedate}. You will not be able to change your email address " |
242 | 237 | . "until {$newdate}. If you need to reverse this change, please look for " |
@@ -357,8 +352,7 @@ discard block |
||
357 | 352 | rules_invoke_event('boincuser_general_consent_error', variable_get('boinc_admin_mailing_list_subject_tag', '')); |
358 | 353 | } |
359 | 354 | return $rc1; |
360 | - } |
|
361 | - else { |
|
355 | + } else { |
|
362 | 356 | drupal_set_message( |
363 | 357 | bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
364 | 358 | array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'), |
@@ -399,8 +393,7 @@ discard block |
||
399 | 393 | // If boincid or token is not present, then go to the home page. |
400 | 394 | if (empty($params['boincid']) or empty($params['token'])) { |
401 | 395 | $redirect = ''; |
402 | - } |
|
403 | - else { |
|
396 | + } else { |
|
404 | 397 | $uid = boincuser_lookup_uid($params['boincid']); |
405 | 398 | $redirect = "/user/${uid}/recoveremail/${params['token']}"; |
406 | 399 | } |
@@ -451,8 +444,7 @@ discard block |
||
451 | 444 | $dir = "boinc_{$type}_dir"; |
452 | 445 | if ($include_dir = variable_get("boinc_{$type}_dir", '')) { |
453 | 446 | return $include_dir; |
454 | - } |
|
455 | - else { |
|
447 | + } else { |
|
456 | 448 | // Don't show errors on blacklisted pages |
457 | 449 | $page_blacklist = array( |
458 | 450 | 'admin/boinc/environment' |
@@ -465,8 +457,7 @@ discard block |
||
465 | 457 | drupal_set_message(t('The BOINC environment is not configured. Please |
466 | 458 | !configure_it', array('!configure_it' => l(t('configure it now'), |
467 | 459 | 'admin/boinc/environment'))), 'warning', FALSE); |
468 | - } |
|
469 | - else { |
|
460 | + } else { |
|
470 | 461 | drupal_set_message(t('There is a problem with the site. Please contact |
471 | 462 | the system administrator.'), 'error', FALSE); |
472 | 463 | } |
@@ -481,8 +472,7 @@ discard block |
||
481 | 472 | if (!in_array($_GET['q'], $redirect_blacklist)) { |
482 | 473 | drupal_goto(''); |
483 | 474 | } |
484 | - } |
|
485 | - else { |
|
475 | + } else { |
|
486 | 476 | // Clear the messages on the environment config page |
487 | 477 | drupal_get_messages(); |
488 | 478 | } |
@@ -501,8 +491,7 @@ discard block |
||
501 | 491 | ); |
502 | 492 | if ($url_config = variable_get('boinc_scheduler_urls', '')) { |
503 | 493 | return explode("\r\n", $url_config); |
504 | - } |
|
505 | - elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
494 | + } elseif (!in_array($_GET['q'], $page_blacklist)) { |
|
506 | 495 | watchdog('boincuser', 'The BOINC scheduling server settings are not yet |
507 | 496 | configured. Please !verify for the settings to become effective.', |
508 | 497 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Get an image object from a given file and cck field |
29 | 29 | */ |
30 | -function get_cck_image_object($image_path, $field_name, $content_type, $ignore_resolution = FALSE) { |
|
30 | +function get_cck_image_object($image_path, $field_name, $content_type, $ignore_resolution = false) { |
|
31 | 31 | $field = content_fields($field_name, $content_type); |
32 | 32 | $validators = array_merge(filefield_widget_upload_validators($field), imagefield_widget_upload_validators($field)); |
33 | 33 | if ($ignore_resolution) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | function boincuser_check_credit_requirements() { |
50 | 50 | global $user; |
51 | 51 | if (!$user->uid) { |
52 | - return FALSE; |
|
52 | + return false; |
|
53 | 53 | } |
54 | 54 | $account = user_load($user->uid); |
55 | 55 | $min_credit_to_post = variable_get('boinc_comment_min_credit', 0); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | drupal_set_message(bts( |
62 | 62 | 'You are banned from community participation until @date', |
63 | 63 | array('@date' => format_date($account->boincuser_penalty_expiration)) |
64 | - ), 'warning', FALSE); |
|
64 | + ), 'warning', false); |
|
65 | 65 | if (isset($account->roles[$community_role])) { |
66 | 66 | // Remove from the community role, if not already |
67 | 67 | unset($account->roles[$community_role]); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | drupal_set_message(bts( |
94 | 94 | 'You must earn @count more credits to be able to post comments on this site and create or modify your user profile.', |
95 | 95 | array('@count' => $min_credit_to_post - $account->boincuser_total_credit) |
96 | - ), 'warning', FALSE); |
|
96 | + ), 'warning', false); |
|
97 | 97 | if (isset($account->roles[$unrestricted_role])) { |
98 | 98 | // Either the threshold has been raised or credits have been revoked; |
99 | 99 | // this user no longer qualifies for full privileges |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | /** |
109 | 109 | * Get the cid of the first comment the user has not seen on a given node |
110 | 110 | */ |
111 | -function boincuser_get_first_unread_comment_id($nid, $uid = NULL) { |
|
111 | +function boincuser_get_first_unread_comment_id($nid, $uid = null) { |
|
112 | 112 | if (!$uid) { |
113 | 113 | global $user; |
114 | 114 | $uid = $user->uid; |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | // Can't find a user with a profile; remove constraints on the pool |
175 | 175 | if ($never_been_picked) { |
176 | 176 | // Allow users who have been previously selected |
177 | - $never_been_picked = FALSE; |
|
177 | + $never_been_picked = false; |
|
178 | 178 | } |
179 | 179 | elseif ($active_users) { |
180 | 180 | // Allow users who are not even active (getting desperate) |
181 | - $active_users = FALSE; |
|
181 | + $active_users = false; |
|
182 | 182 | } |
183 | 183 | else { |
184 | 184 | // Process failed... |
185 | - return FALSE; |
|
185 | + return false; |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * this function is called, it may be called with optional parameters |
213 | 213 | * new and prev email. |
214 | 214 | */ |
215 | -function _boincuser_send_emailchange($account, $new_email=NULL, $prev_email=NULL, $adminuser=FALSE) { |
|
215 | +function _boincuser_send_emailchange($account, $new_email=null, $prev_email=null, $adminuser=false) { |
|
216 | 216 | require_boinc('token'); |
217 | 217 | module_load_include('inc', 'rules', 'modules/system.rules'); |
218 | 218 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function boincuser_check_termsofuse($user) { |
329 | 329 | require_boinc('consent'); |
330 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
330 | + $boinc_user = boincuser_load($user->uid, true); |
|
331 | 331 | return check_user_consent($boinc_user, CONSENT_TYPE_ENROLL); |
332 | 332 | } |
333 | 333 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | */ |
341 | 341 | function boincuser_consentto_termsofuse($user) { |
342 | 342 | require_boinc('consent'); |
343 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
343 | + $boinc_user = boincuser_load($user->uid, true); |
|
344 | 344 | |
345 | 345 | list($checkct, $ctid) = check_consent_type(CONSENT_TYPE_ENROLL); |
346 | 346 | if ($checkct) { |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | bts("ERROR: Database error when attempting to INSERT into table consent with ID=@id. The @project administrators have been notified.", |
351 | 351 | array( |
352 | 352 | '@id' => $boinc_user->id, |
353 | - '@project' => variable_get('site_name', 'Drupal-BOINC'), NULL, 'boinc:add-new-user' |
|
353 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), null, 'boinc:add-new-user' |
|
354 | 354 | ), |
355 | 355 | 'NULL', 'boinc:consent-termsofuse'), |
356 | 356 | 'error'); |
@@ -361,11 +361,11 @@ discard block |
||
361 | 361 | else { |
362 | 362 | drupal_set_message( |
363 | 363 | bts('ERROR: Consent type for enrollment not found. The @project administrators have been nofitifed.', |
364 | - array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:consent-termsofuse'), |
|
364 | + array('@project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:consent-termsofuse'), |
|
365 | 365 | 'error'); |
366 | 366 | rules_invoke_event('boincuser_general_consent_type_error', CONSENT_TYPE_ENROLL, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
367 | 367 | } |
368 | - return FALSE; |
|
368 | + return false; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
@@ -380,10 +380,10 @@ discard block |
||
380 | 380 | // more robust function would first check for these curly braces |
381 | 381 | // in the path_to_ignore patterms, just in case. |
382 | 382 | if (preg_match('{' . $pi . '}', $path)) { |
383 | - return TRUE; |
|
383 | + return true; |
|
384 | 384 | } |
385 | 385 | } |
386 | - return FALSE; |
|
386 | + return false; |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | if (user_access('administer site configuration')) { |
465 | 465 | drupal_set_message(t('The BOINC environment is not configured. Please |
466 | 466 | !configure_it', array('!configure_it' => l(t('configure it now'), |
467 | - 'admin/boinc/environment'))), 'warning', FALSE); |
|
467 | + 'admin/boinc/environment'))), 'warning', false); |
|
468 | 468 | } |
469 | 469 | else { |
470 | 470 | drupal_set_message(t('There is a problem with the site. Please contact |
471 | - the system administrator.'), 'error', FALSE); |
|
471 | + the system administrator.'), 'error', false); |
|
472 | 472 | } |
473 | 473 | // Redirect home to display the error message and avoid fatal errors |
474 | 474 | // (unless on a blacklisted page) |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | drupal_get_messages(); |
488 | 488 | } |
489 | 489 | } |
490 | - return FALSE; |
|
490 | + return false; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -507,15 +507,15 @@ discard block |
||
507 | 507 | configured. Please !verify for the settings to become effective.', |
508 | 508 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
509 | 509 | t('and') . '</strong> ' . t('save the configuration'), |
510 | - 'admin/boinc/scheduler', array('html' => TRUE)) |
|
510 | + 'admin/boinc/scheduler', array('html' => true)) |
|
511 | 511 | ), WATCHDOG_WARNING); |
512 | 512 | if (user_access('administer site configuration')) { |
513 | 513 | drupal_set_message(t('The BOINC scheduling server settings are not yet |
514 | 514 | configured. Please !verify for the settings to become effective', |
515 | 515 | array('!verify' => l(t('verify the default values') . ' <strong>' . |
516 | 516 | t('and') . '</strong> ' . t('save the configuration'), |
517 | - 'admin/boinc/scheduler', array('html' => TRUE)) |
|
518 | - )), 'warning', FALSE); |
|
517 | + 'admin/boinc/scheduler', array('html' => true)) |
|
518 | + )), 'warning', false); |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | return array(); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | function is_current_boinc_user($boinc_id) { |
533 | 533 | global $user; |
534 | 534 | if (!$user->uid) { |
535 | - return FALSE; |
|
535 | + return false; |
|
536 | 536 | } |
537 | 537 | // boincuser_id is not stored in the global user, so load a new instance |
538 | 538 | $drupuser = user_load($user->uid); |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | /** |
554 | 554 | * Get a BOINC user object |
555 | 555 | */ |
556 | -function boincuser_load($user_id = NULL, $is_drupal_id = FALSE) { |
|
556 | +function boincuser_load($user_id = null, $is_drupal_id = false) { |
|
557 | 557 | if (!$user_id) { |
558 | 558 | global $user; |
559 | 559 | $user_id = $user->uid; |
560 | - $is_drupal_id = TRUE; |
|
560 | + $is_drupal_id = true; |
|
561 | 561 | } |
562 | 562 | if ($is_drupal_id) { |
563 | 563 | $account = user_load($user_id); |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | -function xml_error($num, $msg=null, $file=null, $line=null) { |
|
49 | +function xml_error($num, $msg = null, $file = null, $line = null) { |
|
50 | 50 | global $xml_outer_tag; |
51 | 51 | if (!$msg) { |
52 | - switch($num) { |
|
52 | + switch ($num) { |
|
53 | 53 | case -112: $msg = "Invalid XML"; break; |
54 | 54 | case -136: $msg = "Not found"; break; |
55 | 55 | case -137: $msg = "Name or email address is not unique"; break; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // If it's a single-tag element, and it's present, just return the tag |
96 | 96 | // |
97 | 97 | function parse_element($xml, $tag) { |
98 | - $closetag = "</" . substr($tag,1); |
|
98 | + $closetag = "</".substr($tag, 1); |
|
99 | 99 | $x = strstr($xml, $tag); |
100 | 100 | if ($x) { |
101 | 101 | if (strstr($tag, "/>")) return $tag; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | function parse_next_element($xml, $tag, &$cursor) { |
113 | 113 | $element = null; |
114 | - $closetag = "</" . substr($tag,1); |
|
115 | - $pos = substr($xml,$cursor); |
|
114 | + $closetag = "</".substr($tag, 1); |
|
115 | + $pos = substr($xml, $cursor); |
|
116 | 116 | $x = strstr($pos, $tag); |
117 | 117 | if ($x) { |
118 | 118 | if (strstr($tag, "/>")) return $tag; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $globals->batch = 1000; |
56 | 56 | $globals->lapsed_interval = 60*86400; |
57 | 57 | |
58 | -for ($i=1; $i<$argc; $i++) { |
|
58 | +for ($i = 1; $i < $argc; $i++) { |
|
59 | 59 | if ($argv[$i] == "--batch") { |
60 | 60 | $i++; |
61 | 61 | $globals->batch = $argv[$i]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | gmdate('d F Y', $user->create_time), |
170 | 170 | number_format($user->total_credit, 0), |
171 | 171 | opt_out_url($user), |
172 | - floor((time() - $user->last_rpc_time) / 86400), |
|
172 | + floor((time() - $user->last_rpc_time)/86400), |
|
173 | 173 | ); |
174 | 174 | return preg_replace($pat, $rep, $template); |
175 | 175 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | while ($user = _mysql_fetch_object($result)) { |
239 | 239 | handle_user($user); |
240 | 240 | $startid = $user->id; |
241 | - fputs($log, $user->id . "\n"); |
|
241 | + fputs($log, $user->id."\n"); |
|
242 | 242 | fflush($log); |
243 | 243 | } |
244 | 244 | _mysql_free_result($result); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $user = _mysql_fetch_object($result); |
253 | 253 | if ($user) { |
254 | 254 | handle_user($user); |
255 | - fputs($log, $user->id . "\n"); |
|
255 | + fputs($log, $user->id."\n"); |
|
256 | 256 | fflush($log); |
257 | 257 | } |
258 | 258 | _mysql_free_result($result); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } else { |
290 | 290 | $fid = fopen($id_file, 'r'); |
291 | 291 | if (!$fid) { |
292 | - echo $id_file . ' not found - create ID list and run again\n'; |
|
292 | + echo $id_file.' not found - create ID list and run again\n'; |
|
293 | 293 | exit(); |
294 | 294 | } |
295 | 295 | $thisid = 0; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | fclose($fid); |
302 | 302 | } |
303 | - echo 'All done!' . "\n"; |
|
303 | + echo 'All done!'."\n"; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | if (!function_exists('make_php_mailer')) { |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $dh = opendir($langdir.$transdir); |
65 | 65 | if (!$dh) die("can't open translation dir"); |
66 | 66 | while (($file = readdir($dh)) !== false) { |
67 | - if ($file==".." || $file==".") { |
|
67 | + if ($file == ".." || $file == ".") { |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | // only do files ending in .po |
71 | - if (substr($file,-3) != ".po"){ |
|
71 | + if (substr($file, -3) != ".po") { |
|
72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
73 | 73 | continue; |
74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | "-------------Compiling $transdir$file------------", 0 |
77 | 77 | ); |
78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
79 | - if (!$language){ |
|
79 | + if (!$language) { |
|
80 | 80 | language_log( |
81 | 81 | "WARNING: Could not parse language ".$file |
82 | 82 | ); |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | ); |
96 | 96 | exit; |
97 | 97 | } |
98 | - foreach ($language as $key => $value){ |
|
98 | + foreach ($language as $key => $value) { |
|
99 | 99 | if ($value !== "") { |
100 | 100 | // Skip if the msgstr is empty |
101 | - fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
101 | + fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | // don't write \?\> - may append |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | function parse_po_file($file) { |
116 | 116 | $translation_file = file($file); |
117 | 117 | $first_entry = true; |
118 | - $current_token_text=""; |
|
119 | - $current_token =""; |
|
118 | + $current_token_text = ""; |
|
119 | + $current_token = ""; |
|
120 | 120 | $parsing_token = false; |
121 | 121 | $parsing_text = false; |
122 | 122 | $size = sizeof($translation_file); |
123 | 123 | $output = array(); |
124 | - for ($i=0; $i<$size; $i++){ |
|
124 | + for ($i = 0; $i < $size; $i++) { |
|
125 | 125 | $entry = trim($translation_file[$i]); |
126 | 126 | //echo "line $i: $entry\n"; |
127 | - if (substr($entry, 0, 1)=="#") { |
|
127 | + if (substr($entry, 0, 1) == "#") { |
|
128 | 128 | continue; |
129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
130 | - if (!$first_entry){ |
|
130 | + if (!$first_entry) { |
|
131 | 131 | //If this is not the first, save the previous entry |
132 | - $output[$current_token]=$current_token_text; |
|
132 | + $output[$current_token] = $current_token_text; |
|
133 | 133 | } |
134 | 134 | $current_token = get_po_line($entry, $file); |
135 | - $current_token_text=""; |
|
135 | + $current_token_text = ""; |
|
136 | 136 | $parsing_token = true; |
137 | 137 | $parsing_text = false; |
138 | - $first_entry=false; |
|
138 | + $first_entry = false; |
|
139 | 139 | } elseif (strpos($entry, "msgstr") !== false) { |
140 | 140 | $current_token_text = get_po_line($entry, $file); |
141 | 141 | $parsing_token = false; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Get the last token |
151 | 151 | // |
152 | - if ($current_token && $current_token_text){ |
|
152 | + if ($current_token && $current_token_text) { |
|
153 | 153 | $output[$current_token] = $current_token_text; |
154 | 154 | } |
155 | 155 | return $output; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | // Returns the contents of a line (ie removes "" from start and end) |
160 | 160 | // |
161 | 161 | function get_po_line($line, $file) { |
162 | - $start = strpos($line, '"')+1; |
|
162 | + $start = strpos($line, '"') + 1; |
|
163 | 163 | $stop = strrpos($line, '"'); |
164 | - $x = substr($line, $start, $stop-$start); |
|
164 | + $x = substr($line, $start, $stop - $start); |
|
165 | 165 | $n = preg_match("/[^\\\\]\"/", $x); |
166 | 166 | if ($n) { |
167 | 167 | echo "ERROR - MISMATCHED QUOTES IN $file: $line\n"; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | // Find the string in the user's language |
182 | 182 | // |
183 | - foreach ($languages_in_use as $language){ |
|
183 | + foreach ($languages_in_use as $language) { |
|
184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
185 | 185 | $text = $language_lookup_array[$language][$text]; |
186 | 186 | break; |
187 | - } else if ($language=="en"){ |
|
187 | + } else if ($language == "en") { |
|
188 | 188 | // This language is defined in the code and is always available |
189 | 189 | break; |
190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Replace relevant substrings with given arguments. |
194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
195 | 195 | $replacements = array(); |
196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
196 | + for ($i = 1; $i < func_num_args(); $i++) { |
|
197 | 197 | $replacements["%".$i] = func_get_arg($i); |
198 | 198 | } |
199 | 199 | |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | return $text; |
211 | 211 | } |
212 | 212 | |
213 | -function language_log($message, $loglevel=0) { |
|
213 | +function language_log($message, $loglevel = 0) { |
|
214 | 214 | global $lang_log_level; |
215 | 215 | $msg = ""; |
216 | - if ($loglevel==0) $msg = "[ Debug ]"; |
|
217 | - if ($loglevel==1) $msg = "[ Warning ]"; |
|
218 | - if ($loglevel==2) $msg = "[ CRITICAL ]"; |
|
216 | + if ($loglevel == 0) $msg = "[ Debug ]"; |
|
217 | + if ($loglevel == 1) $msg = "[ Warning ]"; |
|
218 | + if ($loglevel == 2) $msg = "[ CRITICAL ]"; |
|
219 | 219 | |
220 | - if ($loglevel >= $lang_log_level){ |
|
220 | + if ($loglevel >= $lang_log_level) { |
|
221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
222 | 222 | } |
223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // (by looking at cookies and browser settings) |
227 | 227 | // cookies have highest priority. |
228 | 228 | |
229 | -if (isset($_COOKIE['lang'])){ |
|
229 | +if (isset($_COOKIE['lang'])) { |
|
230 | 230 | $language_string = $_COOKIE['lang'].","; |
231 | 231 | } else { |
232 | 232 | $language_string = ''; |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | // Loop over languages that the client requests |
258 | 258 | // |
259 | 259 | $size = sizeof($client_languages); |
260 | -for ($i=0; $i<$size; $i++) { |
|
261 | - if ((strlen($client_languages[$i])>2) |
|
260 | +for ($i = 0; $i < $size; $i++) { |
|
261 | + if ((strlen($client_languages[$i]) > 2) |
|
262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
263 | - ){ |
|
263 | + ) { |
|
264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
265 | 265 | // |
266 | 266 | $language = substr( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // if main language is english, look no further |
281 | 281 | // |
282 | - if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) { |
|
282 | + if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) { |
|
283 | 283 | break; |
284 | 284 | } |
285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | // |
288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
289 | 289 | if (file_exists($file_name)) { |
290 | - if (!in_array($language, $languages_in_use)){ |
|
290 | + if (!in_array($language, $languages_in_use)) { |
|
291 | 291 | require_once($file_name); |
292 | 292 | $languages_in_use[] = $language; |
293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if ($language2) { |
296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
297 | 297 | if (file_exists($file_name)) { |
298 | - if (!in_array($language2, $languages_in_use)){ |
|
298 | + if (!in_array($language2, $languages_in_use)) { |
|
299 | 299 | require_once($file_name); |
300 | 300 | $languages_in_use[] = $language2; |
301 | 301 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
306 | +$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
307 | 307 | |
308 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
308 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
309 | 309 | ?> |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | // only do files ending in .po |
71 | - if (substr($file,-3) != ".po"){ |
|
71 | + if (substr($file,-3) != ".po") { |
|
72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
73 | 73 | continue; |
74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | "-------------Compiling $transdir$file------------", 0 |
77 | 77 | ); |
78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
79 | - if (!$language){ |
|
79 | + if (!$language) { |
|
80 | 80 | language_log( |
81 | 81 | "WARNING: Could not parse language ".$file |
82 | 82 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | exit; |
97 | 97 | } |
98 | - foreach ($language as $key => $value){ |
|
98 | + foreach ($language as $key => $value) { |
|
99 | 99 | if ($value !== "") { |
100 | 100 | // Skip if the msgstr is empty |
101 | 101 | fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | $parsing_text = false; |
122 | 122 | $size = sizeof($translation_file); |
123 | 123 | $output = array(); |
124 | - for ($i=0; $i<$size; $i++){ |
|
124 | + for ($i=0; $i<$size; $i++) { |
|
125 | 125 | $entry = trim($translation_file[$i]); |
126 | 126 | //echo "line $i: $entry\n"; |
127 | 127 | if (substr($entry, 0, 1)=="#") { |
128 | 128 | continue; |
129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
130 | - if (!$first_entry){ |
|
130 | + if (!$first_entry) { |
|
131 | 131 | //If this is not the first, save the previous entry |
132 | 132 | $output[$current_token]=$current_token_text; |
133 | 133 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Get the last token |
151 | 151 | // |
152 | - if ($current_token && $current_token_text){ |
|
152 | + if ($current_token && $current_token_text) { |
|
153 | 153 | $output[$current_token] = $current_token_text; |
154 | 154 | } |
155 | 155 | return $output; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | // Find the string in the user's language |
182 | 182 | // |
183 | - foreach ($languages_in_use as $language){ |
|
183 | + foreach ($languages_in_use as $language) { |
|
184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
185 | 185 | $text = $language_lookup_array[$language][$text]; |
186 | 186 | break; |
187 | - } else if ($language=="en"){ |
|
187 | + } else if ($language=="en") { |
|
188 | 188 | // This language is defined in the code and is always available |
189 | 189 | break; |
190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Replace relevant substrings with given arguments. |
194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
195 | 195 | $replacements = array(); |
196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
196 | + for ($i=1; $i<func_num_args(); $i++) { |
|
197 | 197 | $replacements["%".$i] = func_get_arg($i); |
198 | 198 | } |
199 | 199 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | if ($loglevel==1) $msg = "[ Warning ]"; |
218 | 218 | if ($loglevel==2) $msg = "[ CRITICAL ]"; |
219 | 219 | |
220 | - if ($loglevel >= $lang_log_level){ |
|
220 | + if ($loglevel >= $lang_log_level) { |
|
221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
222 | 222 | } |
223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // (by looking at cookies and browser settings) |
227 | 227 | // cookies have highest priority. |
228 | 228 | |
229 | -if (isset($_COOKIE['lang'])){ |
|
229 | +if (isset($_COOKIE['lang'])) { |
|
230 | 230 | $language_string = $_COOKIE['lang'].","; |
231 | 231 | } else { |
232 | 232 | $language_string = ''; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | for ($i=0; $i<$size; $i++) { |
261 | 261 | if ((strlen($client_languages[$i])>2) |
262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
263 | - ){ |
|
263 | + ) { |
|
264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
265 | 265 | // |
266 | 266 | $language = substr( |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | // |
288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
289 | 289 | if (file_exists($file_name)) { |
290 | - if (!in_array($language, $languages_in_use)){ |
|
290 | + if (!in_array($language, $languages_in_use)) { |
|
291 | 291 | require_once($file_name); |
292 | 292 | $languages_in_use[] = $language; |
293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if ($language2) { |
296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
297 | 297 | if (file_exists($file_name)) { |
298 | - if (!in_array($language2, $languages_in_use)){ |
|
298 | + if (!in_array($language2, $languages_in_use)) { |
|
299 | 299 | require_once($file_name); |
300 | 300 | $languages_in_use[] = $language2; |
301 | 301 | } |
@@ -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 | } |
@@ -655,8 +654,7 @@ discard block |
||
655 | 654 | // Save the preset selection (or lack thereof) |
656 | 655 | if (!$preset OR $preset == 'custom') { |
657 | 656 | $prefs['preset'] = 'custom'; |
658 | - } |
|
659 | - else { |
|
657 | + } else { |
|
660 | 658 | $prefs['preset'] = $preset; |
661 | 659 | } |
662 | 660 | |
@@ -671,8 +669,7 @@ discard block |
||
671 | 669 | if (!$result) { |
672 | 670 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
673 | 671 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
674 | - } |
|
675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
672 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
676 | 673 | // Show this message if the set wasn't created automatically (in which case |
677 | 674 | // there is a message tailored to that) { |
678 | 675 | drupal_set_message(t('Your preferences have been updated. |
@@ -927,8 +924,7 @@ discard block |
||
927 | 924 | if (boincwork_host_merge($old_host, $current_host, $message)) { |
928 | 925 | $merged[$old_host->id] = $old_host->id; |
929 | 926 | $current_host = boincwork_host_get_info($current_host_id); |
930 | - } |
|
931 | - else { |
|
927 | + } else { |
|
932 | 928 | $errors[$old_host->id] = $message; |
933 | 929 | } |
934 | 930 | } |
@@ -944,8 +940,7 @@ discard block |
||
944 | 940 | $oxford_comma = ''; |
945 | 941 | } |
946 | 942 | $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
947 | - } |
|
948 | - else { |
|
943 | + } else { |
|
949 | 944 | $list = $last; |
950 | 945 | } |
951 | 946 | if (count($merged) == 1) { |
@@ -956,8 +951,7 @@ discard block |
||
956 | 951 | '@id' => $current_host_id |
957 | 952 | ), |
958 | 953 | NULL, 'boinc:account-host-merge')); |
959 | - } |
|
960 | - else { |
|
954 | + } else { |
|
961 | 955 | drupal_set_message(bts( |
962 | 956 | 'Computers @old_ids have been merged successfully into @id.', |
963 | 957 | array( |
@@ -1023,11 +1017,9 @@ discard block |
||
1023 | 1017 | if ($account->boincuser_default_pref_set == $venue) { |
1024 | 1018 | $venue_is_default = TRUE; |
1025 | 1019 | } |
1026 | - } |
|
1027 | - elseif (!$venue OR $venue == 'generic') { |
|
1020 | + } elseif (!$venue OR $venue == 'generic') { |
|
1028 | 1021 | $venue_is_default = TRUE; |
1029 | - } |
|
1030 | - else { |
|
1022 | + } else { |
|
1031 | 1023 | $venue_is_default = FALSE; |
1032 | 1024 | } |
1033 | 1025 | |
@@ -1047,8 +1039,7 @@ discard block |
||
1047 | 1039 | if (isset($prefs[$name]['@value'])) { |
1048 | 1040 | $default[$name] = $prefs[$name]['@value']; |
1049 | 1041 | } |
1050 | - } |
|
1051 | - else { |
|
1042 | + } else { |
|
1052 | 1043 | $default[$name] = $prefs[$name]; |
1053 | 1044 | } |
1054 | 1045 | } |
@@ -1232,16 +1223,13 @@ discard block |
||
1232 | 1223 | foreach ($element as $ordered_element) { |
1233 | 1224 | if (isset($ordered_element['@position'])) { |
1234 | 1225 | $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
1235 | - } |
|
1236 | - else { |
|
1226 | + } else { |
|
1237 | 1227 | $unordered_array[] = array($type => $ordered_element); |
1238 | 1228 | } |
1239 | 1229 | } |
1240 | - } |
|
1241 | - elseif (isset($element['@position'])) { |
|
1230 | + } elseif (isset($element['@position'])) { |
|
1242 | 1231 | $ordered_array[$element['@position']] = array($type => $element); |
1243 | - } |
|
1244 | - else { |
|
1232 | + } else { |
|
1245 | 1233 | $unordered_array[] = array($type => $element); |
1246 | 1234 | } |
1247 | 1235 | } |
@@ -1356,8 +1344,7 @@ discard block |
||
1356 | 1344 | // Update the user's default preference set |
1357 | 1345 | if ($edit['default_set']['default_venue']) { |
1358 | 1346 | boincwork_set_default_venue($venue); |
1359 | - } |
|
1360 | - elseif ($venue == $account->boincuser_default_pref_set) { |
|
1347 | + } elseif ($venue == $account->boincuser_default_pref_set) { |
|
1361 | 1348 | // User has cleared out the default venue setting |
1362 | 1349 | boincwork_set_default_venue(); |
1363 | 1350 | } |
@@ -1365,8 +1352,7 @@ discard block |
||
1365 | 1352 | if (!$result) { |
1366 | 1353 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
1367 | 1354 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
1368 | - } |
|
1369 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
1355 | + } elseif (!drupal_get_messages('status', FALSE)) { |
|
1370 | 1356 | // Show this message if the set wasn't created automatically (in which case |
1371 | 1357 | // there is a message tailored to that) |
1372 | 1358 | drupal_set_message(t('Your preferences have been updated. |
@@ -1519,8 +1505,7 @@ discard block |
||
1519 | 1505 | // Upload an avatar (pulled from profile_node_form): |
1520 | 1506 | if (!empty($profile_form['field_image'])) { |
1521 | 1507 | $form['field_image'] = $profile_form['field_image']; |
1522 | - } |
|
1523 | - else { |
|
1508 | + } else { |
|
1524 | 1509 | $form['field_image'] = array( |
1525 | 1510 | '#value' => '<div class="form-item">' |
1526 | 1511 | . '<label class="placeholder">' |
@@ -1690,8 +1675,7 @@ discard block |
||
1690 | 1675 | global $base_url; |
1691 | 1676 | if ($edit['language'] != language_default('language')) { |
1692 | 1677 | $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
1693 | - } |
|
1694 | - else { |
|
1678 | + } else { |
|
1695 | 1679 | $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
1696 | 1680 | } |
1697 | 1681 | } |
@@ -1882,8 +1866,7 @@ discard block |
||
1882 | 1866 | $row[] = drupal_render($form['ignoreblock']['delete'][$key]); |
1883 | 1867 | $rows[] = $row; |
1884 | 1868 | } |
1885 | - } |
|
1886 | - else { |
|
1869 | + } else { |
|
1887 | 1870 | $rows[] = array( |
1888 | 1871 | array( |
1889 | 1872 | 'data' => bts('You have not added any users to your Ignore List.', array(), NULL, 'boinc:ignore-user-list'), |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | * The structure of the general preferences form |
16 | 16 | */ |
17 | 17 | function boincwork_generalprefs_form(&$form_state, $venue, $prefs_preset = null, $advanced = FALSE) { |
18 | - $form = array(); |
|
19 | - $prefs = null; |
|
20 | - $established = TRUE; |
|
18 | + $form = array(); |
|
19 | + $prefs = null; |
|
20 | + $established = TRUE; |
|
21 | 21 | |
22 | - // Enable AHAH form support for dynamically updating content based on preset |
|
23 | - ahah_helper_register($form, $form_state); |
|
22 | + // Enable AHAH form support for dynamically updating content based on preset |
|
23 | + ahah_helper_register($form, $form_state); |
|
24 | 24 | |
25 | - if (!$prefs_preset) { |
|
25 | + if (!$prefs_preset) { |
|
26 | 26 | if (isset($form_state['storage']['prefs']['preset'])) { |
27 | - $prefs_preset = $form_state['storage']['prefs']['preset']; |
|
27 | + $prefs_preset = $form_state['storage']['prefs']['preset']; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // Load preferences from BOINC account |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // Take note if this is not an established preference set on the account |
34 | 34 | if (isset($prefs['@attributes']['cleared'])) { |
35 | - $established = FALSE; |
|
35 | + $established = FALSE; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Determine if a preset is selected or if these are custom settings |
@@ -47,45 +47,45 @@ discard block |
||
47 | 47 | $prefs_preset = $prefs['preset']['@value']; |
48 | 48 | } |
49 | 49 | }// if !$prefs_preset |
50 | - } |
|
51 | - // Extract mod_time tag if present, because it will be erased with |
|
52 | - // boincwork_get_preset_prefs() below. |
|
53 | - $mod_time = null; |
|
54 | - if (isset($prefs['mod_time']['@value'])) { |
|
55 | - $mod_time = $prefs['mod_time']['@value']; |
|
56 | - } |
|
57 | - |
|
58 | - if (isset($form_state['storage']['wip'])) { |
|
59 | - switch ($prefs_preset) { |
|
60 | - case 'standard': |
|
50 | + } |
|
51 | + // Extract mod_time tag if present, because it will be erased with |
|
52 | + // boincwork_get_preset_prefs() below. |
|
53 | + $mod_time = null; |
|
54 | + if (isset($prefs['mod_time']['@value'])) { |
|
55 | + $mod_time = $prefs['mod_time']['@value']; |
|
56 | + } |
|
57 | + |
|
58 | + if (isset($form_state['storage']['wip'])) { |
|
59 | + switch ($prefs_preset) { |
|
60 | + case 'standard': |
|
61 | 61 | case 'maximum': |
62 | 62 | case 'green': |
63 | 63 | case 'minimum': |
64 | 64 | $prefs = boincwork_get_preset_prefs($prefs_preset); |
65 | - break; |
|
66 | - case 'custom': |
|
65 | + break; |
|
66 | + case 'custom': |
|
67 | 67 | default: |
68 | 68 | // Just keeps prefs as they are |
69 | 69 | unset($prefs['preset']); |
70 | - break; |
|
71 | - }// switch |
|
72 | - } else { |
|
73 | - $form_state['storage']['wip'] = TRUE; |
|
74 | - if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
|
75 | - if ($established) { |
|
76 | - $prefs_preset = 'custom'; |
|
77 | - } else { |
|
78 | - $prefs_preset = 'standard'; |
|
79 | - $prefs = boincwork_get_preset_prefs($prefs_preset); |
|
80 | - }// if $established |
|
81 | - }// if $prefs_preset |
|
82 | - }// if WIP |
|
83 | - |
|
84 | - // This set of preferences is used in the form if no preferences |
|
85 | - // have been set above, in variable $prefs. |
|
86 | - require_boinc(array('db', 'prefs')); |
|
87 | - $disk_space_config = get_disk_space_config(); |
|
88 | - $default = array( |
|
70 | + break; |
|
71 | + }// switch |
|
72 | + } else { |
|
73 | + $form_state['storage']['wip'] = TRUE; |
|
74 | + if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
|
75 | + if ($established) { |
|
76 | + $prefs_preset = 'custom'; |
|
77 | + } else { |
|
78 | + $prefs_preset = 'standard'; |
|
79 | + $prefs = boincwork_get_preset_prefs($prefs_preset); |
|
80 | + }// if $established |
|
81 | + }// if $prefs_preset |
|
82 | + }// if WIP |
|
83 | + |
|
84 | + // This set of preferences is used in the form if no preferences |
|
85 | + // have been set above, in variable $prefs. |
|
86 | + require_boinc(array('db', 'prefs')); |
|
87 | + $disk_space_config = get_disk_space_config(); |
|
88 | + $default = array( |
|
89 | 89 | 'preset' => $prefs_preset, |
90 | 90 | // Processing... |
91 | 91 | 'run_on_batteries' => 0, |
@@ -120,385 +120,385 @@ discard block |
||
120 | 120 | 'daily_xfer_limit_mb' => 0, |
121 | 121 | 'daily_xfer_period_days' => 0, |
122 | 122 | 'dont_verify_images' => 0 |
123 | - ); |
|
124 | - foreach ($default as $name => $value) { |
|
123 | + ); |
|
124 | + foreach ($default as $name => $value) { |
|
125 | 125 | if (isset($prefs[$name])) { |
126 | - if (is_array($prefs[$name])) { |
|
126 | + if (is_array($prefs[$name])) { |
|
127 | 127 | if (isset($prefs[$name]['@value'])) { |
128 | - $default[$name] = $prefs[$name]['@value']; |
|
128 | + $default[$name] = $prefs[$name]['@value']; |
|
129 | + } |
|
129 | 130 | } |
130 | - } |
|
131 | - else { |
|
131 | + else { |
|
132 | 132 | $default[$name] = $prefs[$name]; |
133 | - } |
|
133 | + } |
|
134 | + } |
|
134 | 135 | } |
135 | - } |
|
136 | 136 | |
137 | - // Standard option sets |
|
138 | - $form['boolean_options'] = array( |
|
137 | + // Standard option sets |
|
138 | + $form['boolean_options'] = array( |
|
139 | 139 | '#type' => 'value', |
140 | 140 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
141 | - ); |
|
142 | - $form['hour_options'] = array( |
|
141 | + ); |
|
142 | + $form['hour_options'] = array( |
|
143 | 143 | '#type' => 'value', |
144 | 144 | '#value' => array('0:00','1:00','2:00','3:00','4:00', |
145 | - '5:00','6:00','7:00','8:00','9:00','10:00','11:00', |
|
146 | - '12:00','13:00','14:00','15:00','16:00','17:00', |
|
147 | - '18:00','19:00','20:00','21:00','22:00','23:00') |
|
148 | - ); |
|
149 | - |
|
150 | - // Identify preference sets that are established to distinguish what has been |
|
151 | - // saved to the database from what is just showing default values |
|
152 | - $form['#established'] = $established; |
|
145 | + '5:00','6:00','7:00','8:00','9:00','10:00','11:00', |
|
146 | + '12:00','13:00','14:00','15:00','16:00','17:00', |
|
147 | + '18:00','19:00','20:00','21:00','22:00','23:00') |
|
148 | + ); |
|
149 | + |
|
150 | + // Identify preference sets that are established to distinguish what has been |
|
151 | + // saved to the database from what is just showing default values |
|
152 | + $form['#established'] = $established; |
|
153 | 153 | |
154 | - // Set up the preference container for AHAH |
|
155 | - $form['prefs'] = array( |
|
154 | + // Set up the preference container for AHAH |
|
155 | + $form['prefs'] = array( |
|
156 | 156 | '#title' => '', |
157 | 157 | '#type' => 'fieldset', |
158 | 158 | '#prefix' => '<div id="prefs-wrapper">', // This is our wrapper div. |
159 | 159 | '#attributes' => array('class' => 'ahah-container'), |
160 | 160 | '#suffix' => '</div>', |
161 | 161 | '#tree' => TRUE |
162 | - ); |
|
163 | - //$form['prefs']['debug'] = array('#value' => '<pre>' . print_r($form_state, true) . '</pre>'); |
|
162 | + ); |
|
163 | + //$form['prefs']['debug'] = array('#value' => '<pre>' . print_r($form_state, true) . '</pre>'); |
|
164 | 164 | |
165 | - // Hidden elements |
|
166 | - $form['prefs']['modified'] = array( |
|
165 | + // Hidden elements |
|
166 | + $form['prefs']['modified'] = array( |
|
167 | 167 | '#type' => 'hidden', |
168 | 168 | '#value' => $mod_time |
169 | - ); |
|
170 | - $form['prefs']['venue'] = array( |
|
169 | + ); |
|
170 | + $form['prefs']['venue'] = array( |
|
171 | 171 | '#type' => 'hidden', |
172 | 172 | '#value' => $venue |
173 | - ); |
|
173 | + ); |
|
174 | 174 | |
175 | - $form['prefs']['separator_top'] = array( |
|
175 | + $form['prefs']['separator_top'] = array( |
|
176 | 176 | '#value' => '<div class="separator"></div>' |
177 | - ); |
|
177 | + ); |
|
178 | 178 | |
179 | - // Simplified selectors |
|
180 | - $form['prefs']['preset'] = array( |
|
181 | - '#title' => bts('Presets', array(), NULL, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
179 | + // Simplified selectors |
|
180 | + $form['prefs']['preset'] = array( |
|
181 | + '#title' => bts('Presets', array(), NULL, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
182 | 182 | '#type' => 'radios', |
183 | 183 | '#description' => ' ', |
184 | 184 | '#options' => array( |
185 | - 'standard' => bts('Standard', array(), NULL, 'boinc:account-preferences-preset'), |
|
186 | - 'maximum' => bts('Maximum', array(), NULL, 'boinc:account-preferences-preset'), |
|
187 | - 'green' => bts('Green', array(), NULL, 'boinc:account-preferences-preset'), |
|
188 | - 'minimum' => bts('Minimum', array(), NULL, 'boinc:account-preferences-preset'), |
|
189 | - 'custom' => bts('Custom', array(), NULL, 'boinc:account-preferences-preset') |
|
185 | + 'standard' => bts('Standard', array(), NULL, 'boinc:account-preferences-preset'), |
|
186 | + 'maximum' => bts('Maximum', array(), NULL, 'boinc:account-preferences-preset'), |
|
187 | + 'green' => bts('Green', array(), NULL, 'boinc:account-preferences-preset'), |
|
188 | + 'minimum' => bts('Minimum', array(), NULL, 'boinc:account-preferences-preset'), |
|
189 | + 'custom' => bts('Custom', array(), NULL, 'boinc:account-preferences-preset') |
|
190 | 190 | ), |
191 | 191 | '#prefix' => '<div class="simple-form-controls">', |
192 | 192 | '#suffix' => '</div>', |
193 | 193 | '#default_value' => $default['preset'], |
194 | 194 | '#ahah' => array( |
195 | - 'event' => 'change', |
|
196 | - 'path' => ahah_helper_path(array('prefs')), |
|
197 | - 'wrapper' => 'prefs-wrapper' |
|
195 | + 'event' => 'change', |
|
196 | + 'path' => ahah_helper_path(array('prefs')), |
|
197 | + 'wrapper' => 'prefs-wrapper' |
|
198 | 198 | ) |
199 | - ); |
|
200 | - $form['prefs']['select preset'] = array( |
|
199 | + ); |
|
200 | + $form['prefs']['select preset'] = array( |
|
201 | 201 | '#type' => 'submit', |
202 | 202 | '#value' => bts('Update preset', array(), NULL, 'boinc:account-preferences-preset'), |
203 | 203 | '#submit' => array('ahah_helper_generic_submit'), |
204 | 204 | // The 'no-js' class only displays this button if javascript is disabled |
205 | 205 | '#attributes' => array('class' => 'no-js'), |
206 | - ); |
|
206 | + ); |
|
207 | 207 | |
208 | - // Advanced preferences |
|
209 | - $form['prefs']['advanced'] = array( |
|
208 | + // Advanced preferences |
|
209 | + $form['prefs']['advanced'] = array( |
|
210 | 210 | '#title' => bts('Advanced settings', array(), NULL, 'boinc:account-preferences-option'), |
211 | 211 | '#type' => 'fieldset', |
212 | 212 | '#description' => '', |
213 | 213 | '#collapsible' => TRUE, |
214 | 214 | '#collapsed' => !$advanced, |
215 | 215 | '#attributes' => array('class' => 'advanced-settings'), |
216 | - ); |
|
216 | + ); |
|
217 | 217 | |
218 | - // Processing preferences |
|
218 | + // Processing preferences |
|
219 | 219 | |
220 | - $form['prefs']['advanced']['anchor'] = array( |
|
220 | + $form['prefs']['advanced']['anchor'] = array( |
|
221 | 221 | '#value' => '<a name="advanced"></a>' |
222 | - ); |
|
222 | + ); |
|
223 | 223 | |
224 | - $form['prefs']['advanced']['separator_top'] = array( |
|
224 | + $form['prefs']['advanced']['separator_top'] = array( |
|
225 | 225 | '#value' => '<div class="separator"></div>' |
226 | - ); |
|
226 | + ); |
|
227 | 227 | |
228 | - $form['prefs']['advanced']['processor'] = array( |
|
228 | + $form['prefs']['advanced']['processor'] = array( |
|
229 | 229 | '#title' => bts('Processor usage', array(), NULL, 'boinc:account-preferences-computing'), |
230 | 230 | '#type' => 'fieldset', |
231 | 231 | '#description' => '', |
232 | 232 | '#collapsible' => FALSE, |
233 | 233 | '#collapsed' => FALSE |
234 | - ); |
|
235 | - $form['prefs']['advanced']['processor']['run_on_batteries'] = array( |
|
234 | + ); |
|
235 | + $form['prefs']['advanced']['processor']['run_on_batteries'] = array( |
|
236 | 236 | '#title' => bts('Suspend when computer is on battery?', array(), NULL, 'boinc:account-preferences-computing'), |
237 | 237 | '#type' => 'radios', |
238 | 238 | '#description' => bts('Suspends computing on portables when running on battery power.', array(), NULL, 'boinc:account-preferences-computing'), |
239 | 239 | '#options' => $form['boolean_options']['#value'], |
240 | 240 | '#attributes' => array('class' => 'fancy'), |
241 | 241 | '#default_value' => ($default['run_on_batteries']) ? 0 : 1 // intentional inversion of setting |
242 | - ); |
|
243 | - $form['prefs']['advanced']['processor']['run_if_user_active'] = array( |
|
242 | + ); |
|
243 | + $form['prefs']['advanced']['processor']['run_if_user_active'] = array( |
|
244 | 244 | '#title' => bts('Suspend when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
245 | 245 | '#type' => 'radios', |
246 | 246 | '#description' => bts("Suspends computing and file transfers when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
247 | 247 | '#options' => $form['boolean_options']['#value'], |
248 | 248 | '#attributes' => array('class' => 'fancy'), |
249 | 249 | '#default_value' => ($default['run_if_user_active']) ? 0 : 1 // intentional inversion of setting |
250 | - ); |
|
251 | - $form['prefs']['advanced']['processor']['run_gpu_if_user_active'] = array( |
|
250 | + ); |
|
251 | + $form['prefs']['advanced']['processor']['run_gpu_if_user_active'] = array( |
|
252 | 252 | '#title' => bts('Suspend GPU computing when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
253 | 253 | '#type' => 'radios', |
254 | 254 | '#description' => bts("Suspends GPU computing when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
255 | 255 | '#options' => $form['boolean_options']['#value'], |
256 | 256 | '#attributes' => array('class' => 'fancy'), |
257 | 257 | '#default_value' => ($default['run_gpu_if_user_active']) ? 0 : 1 // intentional inversion of setting |
258 | - ); |
|
259 | - $form['prefs']['advanced']['processor']['idle_time_to_run'] = array( |
|
260 | - '#title' => bts('"In use" means mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
258 | + ); |
|
259 | + $form['prefs']['advanced']['processor']['idle_time_to_run'] = array( |
|
260 | + '#title' => bts('"In use" means mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
261 | 261 | '#type' => 'textfield', |
262 | 262 | '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
263 | 263 | '#default_value' => $default['idle_time_to_run'], |
264 | 264 | '#size' => 1, |
265 | 265 | '#description' => bts('This determines when the computer is considered "in use".', array(), NULL, 'boinc:account-preferences-computing') |
266 | - ); |
|
267 | - $form['prefs']['advanced']['processor']['suspend_if_no_recent_input'] = array( |
|
266 | + ); |
|
267 | + $form['prefs']['advanced']['processor']['suspend_if_no_recent_input'] = array( |
|
268 | 268 | '#title' => bts('Suspend when no mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
269 | 269 | '#type' => 'textfield', |
270 | 270 | '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
271 | 271 | '#default_value' => $default['suspend_if_no_recent_input'], |
272 | 272 | '#size' => 1, |
273 | 273 | '#description' => bts('This allows some computers to enter low-power mode when not in use.', array(), NULL, 'boinc:account-preferences-computing') |
274 | - ); |
|
275 | - $form['prefs']['advanced']['processor']['suspend_cpu_usage'] = array( |
|
274 | + ); |
|
275 | + $form['prefs']['advanced']['processor']['suspend_cpu_usage'] = array( |
|
276 | 276 | '#title' => bts('Suspend when non-BOINC CPU usage is above', array(), NULL, 'boinc:account-preferences-computing'), |
277 | 277 | '#type' => 'textfield', |
278 | 278 | '#field_suffix' => '%', |
279 | 279 | '#default_value' => $default['suspend_cpu_usage'], |
280 | 280 | '#size' => 1, |
281 | 281 | '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), NULL, 'boinc:account-preferences-computing'), |
282 | - ); |
|
283 | - $form['prefs']['advanced']['processor']['hour_label'] = array( |
|
282 | + ); |
|
283 | + $form['prefs']['advanced']['processor']['hour_label'] = array( |
|
284 | 284 | '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
285 | - ); |
|
286 | - $form['prefs']['advanced']['processor']['start_hour'] = array( |
|
285 | + ); |
|
286 | + $form['prefs']['advanced']['processor']['start_hour'] = array( |
|
287 | 287 | '#type' => 'select', |
288 | 288 | '#options' => $form['hour_options']['#value'], |
289 | 289 | '#default_value' => $default['start_hour'] |
290 | - ); |
|
291 | - $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
|
290 | + ); |
|
291 | + $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
|
292 | 292 | '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
293 | - ); |
|
294 | - $form['prefs']['advanced']['processor']['end_hour'] = array( |
|
293 | + ); |
|
294 | + $form['prefs']['advanced']['processor']['end_hour'] = array( |
|
295 | 295 | '#type' => 'select', |
296 | 296 | '#options' => $form['hour_options']['#value'], |
297 | 297 | '#default_value' => $default['end_hour'] |
298 | - ); |
|
299 | - $form['prefs']['advanced']['processor']['hour_description'] = array( |
|
298 | + ); |
|
299 | + $form['prefs']['advanced']['processor']['hour_description'] = array( |
|
300 | 300 | '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
301 | - ); |
|
302 | - $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
|
301 | + ); |
|
302 | + $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
|
303 | 303 | '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), NULL, 'boinc:account-preferences-computing'), |
304 | 304 | '#type' => 'radios', |
305 | 305 | '#options' => $form['boolean_options']['#value'], |
306 | 306 | '#attributes' => array('class' => 'fancy'), |
307 | 307 | '#default_value' => $default['leave_apps_in_memory'], |
308 | 308 | '#description' => bts('If "Yes", suspended tasks stay in memory, and resume with no work lost. If "No", suspended tasks are removed from memory, and resume from their last checkpoint.', array(), NULL, 'boinc:account-preferences-computing') |
309 | - ); |
|
310 | - $form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes'] = array( |
|
309 | + ); |
|
310 | + $form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes'] = array( |
|
311 | 311 | '#title' => bts('Switch between tasks every', array(), NULL, 'boinc:account-preferences-computing'), |
312 | 312 | '#type' => 'textfield', |
313 | 313 | '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
314 | 314 | '#default_value' => $default['cpu_scheduling_period_minutes'], |
315 | 315 | '#size' => 1, |
316 | 316 | '#description' => bts('If you run several projects, BOINC may switch between them this often.', array(), NULL, 'boinc:account-preferences-computing') |
317 | - ); |
|
318 | - $form['prefs']['advanced']['processor']['max_ncpus_pct'] = array( |
|
317 | + ); |
|
318 | + $form['prefs']['advanced']['processor']['max_ncpus_pct'] = array( |
|
319 | 319 | '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
320 | 320 | '#type' => 'textfield', |
321 | 321 | '#field_suffix' => bts('% of the processors', array(), NULL, 'boinc:account-preferences-computing'), |
322 | 322 | '#default_value' => $default['max_ncpus_pct'], |
323 | 323 | '#size' => 1, |
324 | 324 | '#description' => bts('Keep some CPUs free for other applications. Example: 75% means use 6 cores on an 8-core CPU.', array(), NULL, 'boinc:account-preferences-computing'), |
325 | - ); |
|
326 | - $form['prefs']['advanced']['processor']['cpu_usage_limit'] = array( |
|
325 | + ); |
|
326 | + $form['prefs']['advanced']['processor']['cpu_usage_limit'] = array( |
|
327 | 327 | '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
328 | 328 | '#type' => 'textfield', |
329 | 329 | '#field_suffix' => bts('% of the CPU time', array(), NULL, 'boinc:account-preferences-computing'), |
330 | 330 | '#default_value' => $default['cpu_usage_limit'], |
331 | 331 | '#size' => 1, |
332 | 332 | '#description' => bts('Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat.', array(), NULL, 'boinc:account-preferences-computing') |
333 | - ); |
|
333 | + ); |
|
334 | 334 | |
335 | - // Disk and memory preferences |
|
336 | - $form['prefs']['advanced']['storage'] = array( |
|
335 | + // Disk and memory preferences |
|
336 | + $form['prefs']['advanced']['storage'] = array( |
|
337 | 337 | '#title' => bts('Disk and memory usage', array(), NULL, 'boinc:account-preferences-computing'), |
338 | 338 | '#type' => 'fieldset', |
339 | 339 | '#description' => '', |
340 | 340 | '#collapsible' => FALSE, |
341 | 341 | '#collapsed' => FALSE |
342 | - ); |
|
343 | - $form['prefs']['advanced']['storage']['disk_max_used_gb'] = array( |
|
342 | + ); |
|
343 | + $form['prefs']['advanced']['storage']['disk_max_used_gb'] = array( |
|
344 | 344 | '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
345 | 345 | '#type' => 'textfield', |
346 | 346 | '#field_suffix' => 'GB', |
347 | 347 | '#default_value' => $default['disk_max_used_gb'], |
348 | 348 | '#size' => 1, |
349 | 349 | '#description' => bts('Limit the total amount of disk space used by BOINC.', array(), NULL, 'boinc:account-preferences-computing'), |
350 | - ); |
|
351 | - $form['prefs']['advanced']['storage']['disk_min_free_gb'] = array( |
|
350 | + ); |
|
351 | + $form['prefs']['advanced']['storage']['disk_min_free_gb'] = array( |
|
352 | 352 | '#title' => bts('Disk: leave at least', array(), NULL, 'boinc:account-preferences-computing'), |
353 | 353 | '#type' => 'textfield', |
354 | 354 | '#field_suffix' => 'GB free', |
355 | 355 | '#default_value' => $default['disk_min_free_gb'], |
356 | 356 | '#size' => 1, |
357 | 357 | '#description' => bts('Limit disk usage to leave this much free space on the volume where BOINC stores data.', array(), NULL, 'boinc:account-preferences-computing'), |
358 | - ); |
|
359 | - $form['prefs']['advanced']['storage']['disk_max_used_pct'] = array( |
|
358 | + ); |
|
359 | + $form['prefs']['advanced']['storage']['disk_max_used_pct'] = array( |
|
360 | 360 | '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
361 | 361 | '#type' => 'textfield', |
362 | 362 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
363 | 363 | '#default_value' => $default['disk_max_used_pct'], |
364 | 364 | '#size' => 1, |
365 | 365 | '#description' => bts('Limit the percentage of disk space used by BOINC on the volume where it stores data.', array(), NULL, 'boinc:account-preferences-computing') |
366 | - ); |
|
367 | - $form['prefs']['advanced']['storage']['disk_interval'] = array( |
|
366 | + ); |
|
367 | + $form['prefs']['advanced']['storage']['disk_interval'] = array( |
|
368 | 368 | '#title' => bts('Request tasks to checkpoint at most every', array(), NULL, 'boinc:account-preferences-computing'), |
369 | 369 | '#type' => 'textfield', |
370 | 370 | '#field_suffix' => bts('seconds', array(), NULL, 'boinc:unit-of-time'), |
371 | 371 | '#default_value' => $default['disk_interval'], |
372 | 372 | '#size' => 1, |
373 | 373 | '#description' => bts('This controls how often tasks save their state to disk, so that later they can be continued from that point.', array(), NULL, 'boinc:account-preferences-computing') |
374 | - ); |
|
375 | - $form['prefs']['advanced']['storage']['vm_max_used_pct'] = array( |
|
374 | + ); |
|
375 | + $form['prefs']['advanced']['storage']['vm_max_used_pct'] = array( |
|
376 | 376 | '#title' => bts('Page/swap file: use at most', array(), NULL, 'boinc:account-preferences-computing'), |
377 | 377 | '#type' => 'textfield', |
378 | 378 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
379 | 379 | '#default_value' => $default['vm_max_used_pct'], |
380 | 380 | '#size' => 1, |
381 | 381 | '#description' => bts('Limit the swap space (page file) used by BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
382 | - ); |
|
383 | - $form['prefs']['advanced']['storage']['ram_max_used_busy_pct'] = array( |
|
382 | + ); |
|
383 | + $form['prefs']['advanced']['storage']['ram_max_used_busy_pct'] = array( |
|
384 | 384 | '#title' => bts('Memory: when computer is in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
385 | 385 | '#type' => 'textfield', |
386 | 386 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
387 | 387 | '#default_value' => $default['ram_max_used_busy_pct'], |
388 | 388 | '#size' => 1, |
389 | 389 | '#description' => bts("Limit the memory used by BOINC when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
390 | - ); |
|
391 | - $form['prefs']['advanced']['storage']['ram_max_used_idle_pct'] = array( |
|
390 | + ); |
|
391 | + $form['prefs']['advanced']['storage']['ram_max_used_idle_pct'] = array( |
|
392 | 392 | '#title' => bts('Memory: when computer is not in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
393 | 393 | '#type' => 'textfield', |
394 | 394 | '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
395 | 395 | '#default_value' => $default['ram_max_used_idle_pct'], |
396 | 396 | '#size' => 1, |
397 | 397 | '#description' => bts("Limit the memory used by BOINC when you're not using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
398 | - ); |
|
398 | + ); |
|
399 | 399 | |
400 | - // Network preferences |
|
401 | - $form['prefs']['advanced']['network'] = array( |
|
400 | + // Network preferences |
|
401 | + $form['prefs']['advanced']['network'] = array( |
|
402 | 402 | '#title' => bts('Network usage', array(), NULL, 'boinc:account-preferences-computing'), |
403 | 403 | '#type' => 'fieldset', |
404 | 404 | '#description' => '', |
405 | 405 | '#collapsible' => FALSE, |
406 | 406 | '#collapsed' => FALSE |
407 | - ); |
|
408 | - $form['prefs']['advanced']['network']['work_buf_min_days'] = array( |
|
407 | + ); |
|
408 | + $form['prefs']['advanced']['network']['work_buf_min_days'] = array( |
|
409 | 409 | '#title' => bts('Store at least', array(), NULL, 'boinc:account-preferences-computing'), |
410 | 410 | '#type' => 'textfield', |
411 | 411 | '#field_suffix' => bts('days of work', array(), NULL, 'boinc:account-preferences-computing'), |
412 | 412 | '#default_value' => $default['work_buf_min_days'], |
413 | 413 | '#size' => 1, |
414 | 414 | '#description' => bts('Store at least enough tasks to keep the computer busy for this long.', array(), NULL, 'boinc:account-preferences-computing') |
415 | - ); |
|
416 | - $form['prefs']['advanced']['network']['work_buf_additional_days'] = array( |
|
415 | + ); |
|
416 | + $form['prefs']['advanced']['network']['work_buf_additional_days'] = array( |
|
417 | 417 | '#title' => bts('Store up to an additional', array(), NULL, 'boinc:account-preferences-computing'), |
418 | 418 | '#type' => 'textfield', |
419 | 419 | '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
420 | 420 | '#default_value' => $default['work_buf_additional_days'], |
421 | 421 | '#size' => 1, |
422 | 422 | '#description' => bts('Store additional tasks above the minimum level. Determines how much work is requested when contacting a project.', array(), NULL, 'boinc:account-preferences-computing') |
423 | - ); |
|
424 | - $form['prefs']['advanced']['network']['confirm_before_connecting'] = array( |
|
423 | + ); |
|
424 | + $form['prefs']['advanced']['network']['confirm_before_connecting'] = array( |
|
425 | 425 | '#title' => bts('Confirm before connecting to Internet?', array(), NULL, 'boinc:account-preferences-computing'), |
426 | 426 | '#type' => 'radios', |
427 | 427 | '#options' => $form['boolean_options']['#value'], |
428 | 428 | '#attributes' => array('class' => 'fancy'), |
429 | 429 | '#default_value' => $default['confirm_before_connecting'], |
430 | 430 | '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
431 | - ); |
|
432 | - $form['prefs']['advanced']['network']['hangup_if_dialed'] = array( |
|
431 | + ); |
|
432 | + $form['prefs']['advanced']['network']['hangup_if_dialed'] = array( |
|
433 | 433 | '#title' => bts('Disconnect when done?', array(), NULL, 'boinc:account-preferences-computing'), |
434 | 434 | '#type' => 'radios', |
435 | 435 | '#options' => $form['boolean_options']['#value'], |
436 | 436 | '#attributes' => array('class' => 'fancy'), |
437 | 437 | '#default_value' => $default['hangup_if_dialed'], |
438 | 438 | '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
439 | - ); |
|
440 | - $form['prefs']['advanced']['network']['max_bytes_sec_down'] = array( |
|
439 | + ); |
|
440 | + $form['prefs']['advanced']['network']['max_bytes_sec_down'] = array( |
|
441 | 441 | '#title' => bts('Limit download rate to', array(), NULL, 'boinc:account-preferences-computing'), |
442 | 442 | '#type' => 'textfield', |
443 | 443 | '#field_suffix' => 'Kbytes/sec', |
444 | 444 | '#default_value' => $default['max_bytes_sec_down']/1000, |
445 | 445 | '#size' => 1, |
446 | 446 | '#description' => bts('Limit the download rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
447 | - ); |
|
448 | - $form['prefs']['advanced']['network']['max_bytes_sec_up'] = array( |
|
447 | + ); |
|
448 | + $form['prefs']['advanced']['network']['max_bytes_sec_up'] = array( |
|
449 | 449 | '#title' => bts('Limit upload rate to', array(), NULL, 'boinc:account-preferences-computing'), |
450 | 450 | '#type' => 'textfield', |
451 | 451 | '#field_suffix' => 'Kbytes/sec', |
452 | 452 | '#default_value' => $default['max_bytes_sec_up']/1000, |
453 | 453 | '#size' => 1, |
454 | 454 | '#description' => bts('Limit the upload rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
455 | - ); |
|
456 | - $form['prefs']['advanced']['network']['hour_label'] = array( |
|
455 | + ); |
|
456 | + $form['prefs']['advanced']['network']['hour_label'] = array( |
|
457 | 457 | '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
458 | - ); |
|
459 | - $form['prefs']['advanced']['network']['net_start_hour'] = array( |
|
458 | + ); |
|
459 | + $form['prefs']['advanced']['network']['net_start_hour'] = array( |
|
460 | 460 | '#type' => 'select', |
461 | 461 | '#options' => $form['hour_options']['#value'], |
462 | 462 | '#default_value' => $default['net_start_hour'] |
463 | - ); |
|
464 | - $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
|
463 | + ); |
|
464 | + $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
|
465 | 465 | '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
466 | - ); |
|
467 | - $form['prefs']['advanced']['network']['net_end_hour'] = array( |
|
466 | + ); |
|
467 | + $form['prefs']['advanced']['network']['net_end_hour'] = array( |
|
468 | 468 | '#type' => 'select', |
469 | 469 | '#options' => $form['hour_options']['#value'], |
470 | 470 | '#default_value' => $default['net_end_hour'] |
471 | - ); |
|
472 | - $form['prefs']['advanced']['network']['hour_description'] = array( |
|
471 | + ); |
|
472 | + $form['prefs']['advanced']['network']['hour_description'] = array( |
|
473 | 473 | '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
474 | - ); |
|
475 | - $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
|
474 | + ); |
|
475 | + $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
|
476 | 476 | '#title' => bts('Limit usage to', array(), NULL, 'boinc:account-preferences-computing'), |
477 | 477 | '#type' => 'textfield', |
478 | 478 | '#field_suffix' => 'Mbytes', |
479 | 479 | '#default_value' => $default['daily_xfer_limit_mb'], |
480 | 480 | '#size' => 1 |
481 | - ); |
|
482 | - $form['prefs']['advanced']['network']['daily_xfer_period_days'] = array( |
|
481 | + ); |
|
482 | + $form['prefs']['advanced']['network']['daily_xfer_period_days'] = array( |
|
483 | 483 | '#field_prefix' => 'every', |
484 | 484 | '#type' => 'textfield', |
485 | 485 | '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
486 | 486 | '#default_value' => $default['daily_xfer_period_days'], |
487 | 487 | '#size' => 1, |
488 | 488 | '#description' => bts('Example: BOINC should transfer at most 2000 MB of data every 30 days.', array(), NULL, 'boinc:account-preferences-computing'), |
489 | - ); |
|
490 | - $form['prefs']['advanced']['network']['dont_verify_images'] = array( |
|
489 | + ); |
|
490 | + $form['prefs']['advanced']['network']['dont_verify_images'] = array( |
|
491 | 491 | '#title' => bts('Skip data verification for image files?', array(), NULL, 'boinc:account-preferences-computing'), |
492 | 492 | '#type' => 'radios', |
493 | 493 | '#options' => $form['boolean_options']['#value'], |
494 | 494 | '#attributes' => array('class' => 'fancy'), |
495 | 495 | '#default_value' => $default['dont_verify_images'], |
496 | 496 | '#description' => bts('Only select "Yes" if your Internet provider modifies image files. Skipping verification reduces the security of BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
497 | - ); |
|
497 | + ); |
|
498 | 498 | |
499 | - // The "fancy radios" are made via javascript on document load. In order for |
|
500 | - // these to work with AHAH, we need this crazy setTimeout() call. |
|
501 | - $form['prefs']['fancy-radios'] = array( |
|
499 | + // The "fancy radios" are made via javascript on document load. In order for |
|
500 | + // these to work with AHAH, we need this crazy setTimeout() call. |
|
501 | + $form['prefs']['fancy-radios'] = array( |
|
502 | 502 | '#value' => ' |
503 | 503 | <script> |
504 | 504 | setTimeout( |
@@ -509,177 +509,177 @@ discard block |
||
509 | 509 | 300 |
510 | 510 | ) |
511 | 511 | </script>' |
512 | - ); |
|
513 | - $form['prefs']['view advanced'] = array( |
|
512 | + ); |
|
513 | + $form['prefs']['view advanced'] = array( |
|
514 | 514 | '#type' => 'hidden', |
515 | 515 | '#value' => 1 |
516 | - ); |
|
516 | + ); |
|
517 | 517 | |
518 | - $form['prefs']['separator_bottom'] = array( |
|
518 | + $form['prefs']['separator_bottom'] = array( |
|
519 | 519 | '#value' => '<div class="separator buttons"></div>' |
520 | - ); |
|
520 | + ); |
|
521 | 521 | |
522 | - // Form control |
|
523 | - $form['prefs']['form control tabs prefix'] = array( |
|
522 | + // Form control |
|
523 | + $form['prefs']['form control tabs prefix'] = array( |
|
524 | 524 | '#value' => '<ul class="form-control tab-list">' |
525 | - ); |
|
526 | - $form['prefs']['submit'] = array( |
|
525 | + ); |
|
526 | + $form['prefs']['submit'] = array( |
|
527 | 527 | '#prefix' => '<li class="first tab">', |
528 | 528 | '#type' => 'submit', |
529 | 529 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
530 | 530 | '#suffix' => '</li>' |
531 | - ); |
|
532 | - $form['prefs']['form control tabs'] = array( |
|
531 | + ); |
|
532 | + $form['prefs']['form control tabs'] = array( |
|
533 | 533 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
534 | - ); |
|
535 | - if ($venue AND $venue != 'generic') { |
|
534 | + ); |
|
535 | + if ($venue AND $venue != 'generic') { |
|
536 | 536 | global $base_path; |
537 | 537 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
538 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
538 | + l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
539 | 539 | array( |
540 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
541 | - 'attributes' => array( |
|
540 | + 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
541 | + 'attributes' => array( |
|
542 | 542 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
543 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
544 | - ) |
|
543 | + array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
544 | + ) |
|
545 | 545 | ) |
546 | - ) . '</li>'; |
|
547 | - } |
|
548 | - $form['prefs']['view control'] = array( |
|
546 | + ) . '</li>'; |
|
547 | + } |
|
548 | + $form['prefs']['view control'] = array( |
|
549 | 549 | '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
550 | - ); |
|
551 | - $form['prefs']['form control tabs suffix'] = array( |
|
550 | + ); |
|
551 | + $form['prefs']['form control tabs suffix'] = array( |
|
552 | 552 | '#value' => '</ul>' |
553 | - ); |
|
554 | - $form['#submit'][] = 'boincwork_generalprefs_form_submit'; |
|
553 | + ); |
|
554 | + $form['#submit'][] = 'boincwork_generalprefs_form_submit'; |
|
555 | 555 | |
556 | - return $form; |
|
556 | + return $form; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
560 | - * Validate the general preferences form. |
|
561 | - */ |
|
560 | + * Validate the general preferences form. |
|
561 | + */ |
|
562 | 562 | function boincwork_generalprefs_form_validate($form, &$form_state) { |
563 | - require_boinc('util'); |
|
564 | - $values = $form_state['values']['prefs']['advanced']; |
|
565 | - |
|
566 | - //drupal_set_message('<pre>' . print_r($form_state['values'], true) . '</pre>'); |
|
567 | - // Verify all non-boolean user input values and notify form API of failures |
|
568 | - |
|
569 | - // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
578 | - |
|
579 | - // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
587 | - |
|
588 | - // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-prefrences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
563 | + require_boinc('util'); |
|
564 | + $values = $form_state['values']['prefs']['advanced']; |
|
565 | + |
|
566 | + //drupal_set_message('<pre>' . print_r($form_state['values'], true) . '</pre>'); |
|
567 | + // Verify all non-boolean user input values and notify form API of failures |
|
568 | + |
|
569 | + // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
578 | + |
|
579 | + // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
587 | + |
|
588 | + // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-prefrences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
600 | - * Handle post-validation submission of general preferences form. |
|
601 | - */ |
|
600 | + * Handle post-validation submission of general preferences form. |
|
601 | + */ |
|
602 | 602 | function boincwork_generalprefs_form_submit($form, &$form_state) { |
603 | - global $user; |
|
604 | - $account = user_load($user->uid); |
|
605 | - |
|
606 | - $values = $form_state['values']['prefs']['advanced']; |
|
607 | - $venue = $form_state['values']['prefs']['venue']; |
|
608 | - $preset = $form_state['values']['prefs']['preset']; |
|
609 | - |
|
610 | - // Load preferences from BOINC account |
|
611 | - $prefs = boincwork_load_prefs('general', $venue); |
|
612 | - |
|
613 | - // Processing preferences |
|
614 | - $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1; |
|
615 | - $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1; |
|
616 | - $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0 : 1; |
|
617 | - $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run']; |
|
618 | - $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input']; |
|
619 | - $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage']; |
|
620 | - $prefs['start_hour'] = $values['processor']['start_hour']; |
|
621 | - $prefs['end_hour'] = $values['processor']['end_hour']; |
|
622 | - $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0; |
|
623 | - $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes']; |
|
624 | - $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct']; |
|
625 | - $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit']; |
|
626 | - |
|
627 | - // Storage preferences |
|
628 | - $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb']; |
|
629 | - $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb']; |
|
630 | - $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct']; |
|
631 | - $prefs['disk_interval'] = $values['storage']['disk_interval']; |
|
632 | - $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct']; |
|
633 | - $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct']; |
|
634 | - $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct']; |
|
635 | - |
|
636 | - // Network preferences |
|
637 | - $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days']; |
|
638 | - $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days']; |
|
639 | - $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0; |
|
640 | - $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0; |
|
641 | - $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000; |
|
642 | - $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000; |
|
643 | - $prefs['net_start_hour'] = $values['network']['net_start_hour']; |
|
644 | - $prefs['net_end_hour'] = $values['network']['net_end_hour']; |
|
645 | - $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb']; |
|
646 | - $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days']; |
|
647 | - $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0; |
|
648 | - |
|
649 | - // transform old way to store the preset into new way |
|
650 | - // ideally this should already have happened in boincwork_generalprefs_form() |
|
651 | - if (isset($prefs['@attributes']['preset'])) { |
|
603 | + global $user; |
|
604 | + $account = user_load($user->uid); |
|
605 | + |
|
606 | + $values = $form_state['values']['prefs']['advanced']; |
|
607 | + $venue = $form_state['values']['prefs']['venue']; |
|
608 | + $preset = $form_state['values']['prefs']['preset']; |
|
609 | + |
|
610 | + // Load preferences from BOINC account |
|
611 | + $prefs = boincwork_load_prefs('general', $venue); |
|
612 | + |
|
613 | + // Processing preferences |
|
614 | + $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1; |
|
615 | + $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1; |
|
616 | + $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0 : 1; |
|
617 | + $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run']; |
|
618 | + $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input']; |
|
619 | + $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage']; |
|
620 | + $prefs['start_hour'] = $values['processor']['start_hour']; |
|
621 | + $prefs['end_hour'] = $values['processor']['end_hour']; |
|
622 | + $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0; |
|
623 | + $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes']; |
|
624 | + $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct']; |
|
625 | + $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit']; |
|
626 | + |
|
627 | + // Storage preferences |
|
628 | + $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb']; |
|
629 | + $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb']; |
|
630 | + $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct']; |
|
631 | + $prefs['disk_interval'] = $values['storage']['disk_interval']; |
|
632 | + $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct']; |
|
633 | + $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct']; |
|
634 | + $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct']; |
|
635 | + |
|
636 | + // Network preferences |
|
637 | + $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days']; |
|
638 | + $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days']; |
|
639 | + $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0; |
|
640 | + $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0; |
|
641 | + $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000; |
|
642 | + $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000; |
|
643 | + $prefs['net_start_hour'] = $values['network']['net_start_hour']; |
|
644 | + $prefs['net_end_hour'] = $values['network']['net_end_hour']; |
|
645 | + $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb']; |
|
646 | + $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days']; |
|
647 | + $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0; |
|
648 | + |
|
649 | + // transform old way to store the preset into new way |
|
650 | + // ideally this should already have happened in boincwork_generalprefs_form() |
|
651 | + if (isset($prefs['@attributes']['preset'])) { |
|
652 | 652 | $prefs['preset'] = $prefs['@attributes']['preset']; |
653 | 653 | unset($prefs['@attributes']['preset']); |
654 | - } |
|
655 | - // Save the preset selection (or lack thereof) |
|
656 | - if (!$preset OR $preset == 'custom') { |
|
654 | + } |
|
655 | + // Save the preset selection (or lack thereof) |
|
656 | + if (!$preset OR $preset == 'custom') { |
|
657 | 657 | $prefs['preset'] = 'custom'; |
658 | - } |
|
659 | - else { |
|
658 | + } |
|
659 | + else { |
|
660 | 660 | $prefs['preset'] = $preset; |
661 | - } |
|
661 | + } |
|
662 | 662 | |
663 | - // If this is a new preference set, be sure to unset the "cleared" attribute |
|
664 | - if (isset($prefs['@attributes']['cleared'])) { |
|
663 | + // If this is a new preference set, be sure to unset the "cleared" attribute |
|
664 | + if (isset($prefs['@attributes']['cleared'])) { |
|
665 | 665 | unset($prefs['@attributes']['cleared']); |
666 | - } |
|
666 | + } |
|
667 | 667 | |
668 | - // Update database |
|
669 | - $result = boincwork_save_prefs($prefs, 'general', $venue); |
|
668 | + // Update database |
|
669 | + $result = boincwork_save_prefs($prefs, 'general', $venue); |
|
670 | 670 | |
671 | - if (!$result) { |
|
671 | + if (!$result) { |
|
672 | 672 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
673 | 673 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
674 | - } |
|
675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
674 | + } |
|
675 | + elseif (!drupal_get_messages('status', FALSE)) { |
|
676 | 676 | // Show this message if the set wasn't created automatically (in which case |
677 | 677 | // there is a message tailored to that) { |
678 | 678 | drupal_set_message(t('Your preferences have been updated. |
679 | 679 | Client-related preferences will take effect when your computer |
680 | 680 | communicates with @project or you issue the "Update" |
681 | 681 | command from the BOINC client.', array('@project' => PROJECT))); |
682 | - } |
|
682 | + } |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | |
@@ -691,116 +691,116 @@ discard block |
||
691 | 691 | * Find compatible hosts for merging |
692 | 692 | */ |
693 | 693 | function boincwork_host_get_compatible_hosts($host_id) { |
694 | - require_boinc('host'); |
|
695 | - global $user; |
|
696 | - $account = user_load($user->uid); |
|
697 | - $compatible_hosts = array(); |
|
698 | - $host_count = 0; |
|
699 | - db_set_active('boinc_ro'); |
|
700 | - $current_host = db_fetch_object(db_query(" |
|
694 | + require_boinc('host'); |
|
695 | + global $user; |
|
696 | + $account = user_load($user->uid); |
|
697 | + $compatible_hosts = array(); |
|
698 | + $host_count = 0; |
|
699 | + db_set_active('boinc_ro'); |
|
700 | + $current_host = db_fetch_object(db_query(" |
|
701 | 701 | SELECT id, domain_name, create_time, total_credit, rpc_time, os_name, |
702 | 702 | p_vendor, p_model |
703 | 703 | FROM {host} |
704 | 704 | WHERE userid = '%d' AND id = '%d'", |
705 | 705 | $account->boincuser_id, $host_id |
706 | - )); |
|
707 | - db_set_active('default'); |
|
708 | - $current_host->task_count = boincwork_host_get_task_count($current_host->id); |
|
709 | - $current_host->is_new = !$current_host->total_credit AND !$current_host->task_count; |
|
710 | - // Get the list of all other hosts owned by this user for comparison |
|
711 | - db_set_active('boinc_ro'); |
|
712 | - $all_other_hosts = db_query(" |
|
706 | + )); |
|
707 | + db_set_active('default'); |
|
708 | + $current_host->task_count = boincwork_host_get_task_count($current_host->id); |
|
709 | + $current_host->is_new = !$current_host->total_credit AND !$current_host->task_count; |
|
710 | + // Get the list of all other hosts owned by this user for comparison |
|
711 | + db_set_active('boinc_ro'); |
|
712 | + $all_other_hosts = db_query(" |
|
713 | 713 | SELECT id, domain_name, create_time, total_credit, rpc_time, os_name, |
714 | 714 | p_vendor, p_model |
715 | 715 | FROM {host} |
716 | 716 | WHERE userid = '%d' AND id <> '%d'", |
717 | 717 | $account->boincuser_id, $host_id |
718 | - ); |
|
719 | - db_set_active('default'); |
|
720 | - // Compare all hosts to see if any are plausible duplicates |
|
721 | - while ($other_host = db_fetch_object($all_other_hosts)) { |
|
718 | + ); |
|
719 | + db_set_active('default'); |
|
720 | + // Compare all hosts to see if any are plausible duplicates |
|
721 | + while ($other_host = db_fetch_object($all_other_hosts)) { |
|
722 | 722 | // First, disqualify if hosts were active at the same time |
723 | 723 | if (!$current_host->is_new) { |
724 | - $other_host->task_count = boincwork_host_get_task_count($other_host->id); |
|
725 | - $other_host->is_new = !$other_host->total_credit AND !$other_host->task_count; |
|
726 | - if (!$other_host->is_new) { |
|
724 | + $other_host->task_count = boincwork_host_get_task_count($other_host->id); |
|
725 | + $other_host->is_new = !$other_host->total_credit AND !$other_host->task_count; |
|
726 | + if (!$other_host->is_new) { |
|
727 | 727 | // If both hosts being compared are not new, see if times overlap |
728 | 728 | if (!times_disjoint($current_host, $other_host)) { |
729 | - // Hosts were active at the same time; can't be a duplicate |
|
730 | - continue; |
|
729 | + // Hosts were active at the same time; can't be a duplicate |
|
730 | + continue; |
|
731 | + } |
|
731 | 732 | } |
732 | - } |
|
733 | 733 | } |
734 | 734 | // Next, disqualify if hosts have different OS platforms |
735 | 735 | if (!os_compatible($current_host, $other_host)) { |
736 | - // Hosts have different OS platforms; not really a duplicate |
|
737 | - continue; |
|
736 | + // Hosts have different OS platforms; not really a duplicate |
|
737 | + continue; |
|
738 | 738 | } |
739 | 739 | // Finally, disqualify if hosts have different CPUs |
740 | 740 | if (!cpus_compatible($current_host, $other_host)) { |
741 | - // CPUs don't match; not a duplicate |
|
742 | - continue; |
|
741 | + // CPUs don't match; not a duplicate |
|
742 | + continue; |
|
743 | 743 | } |
744 | 744 | // If not disqualified, this host is available for merging |
745 | 745 | $hosts[] = $other_host; |
746 | 746 | $host_count++; |
747 | 747 | if ($host_count == 500) { |
748 | - // This is enough! |
|
749 | - break; |
|
748 | + // This is enough! |
|
749 | + break; |
|
750 | + } |
|
750 | 751 | } |
751 | - } |
|
752 | - return $hosts; |
|
752 | + return $hosts; |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | /** |
756 | 756 | * Perform the database updates to merge the old host into the new host |
757 | 757 | */ |
758 | 758 | function boincwork_host_merge($old_host, $new_host, &$message = NULL) { |
759 | - // Decay the average credit of the two hosts |
|
760 | - require_boinc('credit'); |
|
761 | - $now = time(); |
|
762 | - update_average($now, 0, 0, $old_host->expavg_credit, $old_host->expavg_time); |
|
763 | - update_average($now, 0, 0, $new_host->expavg_credit, $new_host->expavg_time); |
|
759 | + // Decay the average credit of the two hosts |
|
760 | + require_boinc('credit'); |
|
761 | + $now = time(); |
|
762 | + update_average($now, 0, 0, $old_host->expavg_credit, $old_host->expavg_time); |
|
763 | + update_average($now, 0, 0, $new_host->expavg_credit, $new_host->expavg_time); |
|
764 | 764 | |
765 | - // Update the database: |
|
766 | - // - add credit from old host to new host |
|
767 | - // - change results to refer to the new host |
|
768 | - // - put old host in "zombie" state (userid=0, rpc_seqno=[new_host_id]) |
|
765 | + // Update the database: |
|
766 | + // - add credit from old host to new host |
|
767 | + // - change results to refer to the new host |
|
768 | + // - put old host in "zombie" state (userid=0, rpc_seqno=[new_host_id]) |
|
769 | 769 | |
770 | - $total_credit = $old_host->total_credit + $new_host->total_credit; |
|
771 | - $recent_credit = $old_host->expavg_credit + $new_host->expavg_credit; |
|
770 | + $total_credit = $old_host->total_credit + $new_host->total_credit; |
|
771 | + $recent_credit = $old_host->expavg_credit + $new_host->expavg_credit; |
|
772 | 772 | |
773 | - if ($new_host->rpc_seqno == $old_host->id) { |
|
773 | + if ($new_host->rpc_seqno == $old_host->id) { |
|
774 | 774 | rules_invoke_event('boincwork_circular_merge_error', $old_host->id, $new_host->id, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
775 | 775 | watchdog('boincwork', |
776 | - 'Circular merge attempted, target host rpc_seqno is equal to old host\'s id: old host id=%old_host, target host id=%new_host', |
|
777 | - array( |
|
776 | + 'Circular merge attempted, target host rpc_seqno is equal to old host\'s id: old host id=%old_host, target host id=%new_host', |
|
777 | + array( |
|
778 | 778 | '%old_host' => $old_host->id, |
779 | 779 | '%new_host' => $new_host->id, |
780 | - ), |
|
781 | - WATCHDOG_WARNING |
|
780 | + ), |
|
781 | + WATCHDOG_WARNING |
|
782 | 782 | ); |
783 | 783 | $message = 'Could not merge due to a circular merge error. The site administrators have been contacted about this issue, and will investigate further.'; |
784 | 784 | return FALSE; |
785 | - } |
|
785 | + } |
|
786 | 786 | |
787 | - if ($new_host->userid==0) { |
|
787 | + if ($new_host->userid==0) { |
|
788 | 788 | rules_invoke_event('boincwork_zombie_merge_error', $old_host->id, $new_host->id, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
789 | 789 | watchdog('boincwork', |
790 | - 'Zombie merge attempted, target host has userid=0: old host id=%old_host, target host id=%new_host', |
|
791 | - array( |
|
790 | + 'Zombie merge attempted, target host has userid=0: old host id=%old_host, target host id=%new_host', |
|
791 | + array( |
|
792 | 792 | '%old_host' => $old_host->id, |
793 | 793 | '%new_host' => $new_host->id, |
794 | - ), |
|
795 | - WATCHDOG_WARNING |
|
794 | + ), |
|
795 | + WATCHDOG_WARNING |
|
796 | 796 | ); |
797 | 797 | $message = 'Could not merge because the target host has userid=0. The site administrators have been contacted about this issue, and will investigate further.'; |
798 | 798 | return FALSE; |
799 | - } |
|
799 | + } |
|
800 | 800 | |
801 | - // Move credit from the old host to the new host |
|
802 | - db_set_active('boinc_rw'); |
|
803 | - $credit_updated = db_query(" |
|
801 | + // Move credit from the old host to the new host |
|
802 | + db_set_active('boinc_rw'); |
|
803 | + $credit_updated = db_query(" |
|
804 | 804 | UPDATE {host} |
805 | 805 | SET |
806 | 806 | total_credit = '%d', |
@@ -808,34 +808,34 @@ discard block |
||
808 | 808 | expavg_time = '%d' |
809 | 809 | WHERE id = '%d'", |
810 | 810 | $total_credit, $recent_credit, $now, $new_host->id |
811 | - ); |
|
812 | - db_set_active('default'); |
|
813 | - if (!$credit_updated) { |
|
811 | + ); |
|
812 | + db_set_active('default'); |
|
813 | + if (!$credit_updated) { |
|
814 | 814 | if ($message !== NULL) { |
815 | - $message = bts('Could not update credit', array(), NULL, 'boinc:account-host-merge'); |
|
815 | + $message = bts('Could not update credit', array(), NULL, 'boinc:account-host-merge'); |
|
816 | 816 | } |
817 | 817 | return FALSE; |
818 | - } |
|
818 | + } |
|
819 | 819 | |
820 | - // Move results from the old host to the new host |
|
821 | - db_set_active('boinc_rw'); |
|
822 | - $results_updated = db_query(" |
|
820 | + // Move results from the old host to the new host |
|
821 | + db_set_active('boinc_rw'); |
|
822 | + $results_updated = db_query(" |
|
823 | 823 | UPDATE {result} |
824 | 824 | SET hostid = '%d' |
825 | 825 | WHERE hostid = '%d'", |
826 | 826 | $new_host->id, $old_host->id |
827 | - ); |
|
828 | - db_set_active('default'); |
|
829 | - if (!$results_updated) { |
|
827 | + ); |
|
828 | + db_set_active('default'); |
|
829 | + if (!$results_updated) { |
|
830 | 830 | if ($message !== NULL) { |
831 | - $message = bts('Could not update results', array(), NULL, 'boinc:account-host-merge'); |
|
831 | + $message = bts('Could not update results', array(), NULL, 'boinc:account-host-merge'); |
|
832 | 832 | } |
833 | 833 | return FALSE; |
834 | - } |
|
834 | + } |
|
835 | 835 | |
836 | - // Retire the old host |
|
837 | - db_set_active('boinc_rw'); |
|
838 | - $old_host_retired = db_query(" |
|
836 | + // Retire the old host |
|
837 | + db_set_active('boinc_rw'); |
|
838 | + $old_host_retired = db_query(" |
|
839 | 839 | UPDATE {host} |
840 | 840 | SET |
841 | 841 | total_credit = '0', |
@@ -844,16 +844,16 @@ discard block |
||
844 | 844 | rpc_seqno = '%d' |
845 | 845 | WHERE id = '%d'", |
846 | 846 | $new_host->id, $old_host->id |
847 | - ); |
|
848 | - db_set_active('default'); |
|
849 | - if (!$old_host_retired) { |
|
847 | + ); |
|
848 | + db_set_active('default'); |
|
849 | + if (!$old_host_retired) { |
|
850 | 850 | if ($message !== NULL) { |
851 | - $message = bts('Could not retire old computer', array(), NULL, 'boinc:account-host-merge'); |
|
851 | + $message = bts('Could not retire old computer', array(), NULL, 'boinc:account-host-merge'); |
|
852 | 852 | } |
853 | 853 | return FALSE; |
854 | - } |
|
854 | + } |
|
855 | 855 | |
856 | - return TRUE; |
|
856 | + return TRUE; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | /** |
@@ -861,75 +861,75 @@ discard block |
||
861 | 861 | */ |
862 | 862 | function boincwork_host_merge_form(&$form_state, $host_id) { |
863 | 863 | |
864 | - if (!boincwork_host_user_is_owner($host_id)) { |
|
864 | + if (!boincwork_host_user_is_owner($host_id)) { |
|
865 | 865 | drupal_goto("host/{$host_id}"); |
866 | - } |
|
866 | + } |
|
867 | 867 | |
868 | - $form = array(); |
|
869 | - $form_state['storage']['current_host_id'] = $host_id; |
|
870 | - $current_host = boincwork_host_get_info($host_id); |
|
868 | + $form = array(); |
|
869 | + $form_state['storage']['current_host_id'] = $host_id; |
|
870 | + $current_host = boincwork_host_get_info($host_id); |
|
871 | 871 | |
872 | - // Get hosts that could be merged with this one |
|
873 | - $hosts = boincwork_host_get_compatible_hosts($host_id); |
|
872 | + // Get hosts that could be merged with this one |
|
873 | + $hosts = boincwork_host_get_compatible_hosts($host_id); |
|
874 | 874 | |
875 | - if (!$hosts) { |
|
875 | + if (!$hosts) { |
|
876 | 876 | drupal_set_message(t('There are no computers eligible for merging with this |
877 | 877 | one'), 'warning' |
878 | 878 | ); |
879 | 879 | drupal_goto("host/{$host_id}"); |
880 | - } |
|
880 | + } |
|
881 | 881 | |
882 | - $form['overview'] = array( |
|
882 | + $form['overview'] = array( |
|
883 | 883 | '#value' => '<p>' . bts('Sometimes BOINC assigns separate identities to' |
884 | - . ' the same computer by mistake. You can correct this by merging old' |
|
885 | - . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
886 | - . '<p>' |
|
887 | - . bts('Check the computers that are the same as @name' |
|
888 | - . ' (created on @date at @time with computer ID @id)', |
|
884 | + . ' the same computer by mistake. You can correct this by merging old' |
|
885 | + . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
886 | + . '<p>' |
|
887 | + . bts('Check the computers that are the same as @name' |
|
888 | + . ' (created on @date at @time with computer ID @id)', |
|
889 | 889 | array( |
890 | - '@name' => $current_host->domain_name, |
|
891 | - '@date' => date('j M Y', $current_host->create_time), |
|
892 | - '@time' => date('G:i:s T', $current_host->create_time), |
|
893 | - '@id' => $current_host->id, |
|
890 | + '@name' => $current_host->domain_name, |
|
891 | + '@date' => date('j M Y', $current_host->create_time), |
|
892 | + '@time' => date('G:i:s T', $current_host->create_time), |
|
893 | + '@id' => $current_host->id, |
|
894 | 894 | ), |
895 | 895 | NULL, 'boinc:account-host-merge') . '</p>', |
896 | - ); |
|
896 | + ); |
|
897 | 897 | |
898 | - $options = array(); |
|
899 | - foreach ($hosts as $host) { |
|
898 | + $options = array(); |
|
899 | + foreach ($hosts as $host) { |
|
900 | 900 | $options[$host->id] = array( |
901 | - $host->domain_name, |
|
902 | - date('j M Y G:i:s T', $host->create_time), |
|
903 | - $host->id, |
|
901 | + $host->domain_name, |
|
902 | + date('j M Y G:i:s T', $host->create_time), |
|
903 | + $host->id, |
|
904 | 904 | ); |
905 | - } |
|
905 | + } |
|
906 | 906 | |
907 | - $form['merge'] = array( |
|
907 | + $form['merge'] = array( |
|
908 | 908 | '#title' => '', |
909 | 909 | '#type' => 'tableselect', |
910 | 910 | '#header' => array(bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), bts('Created', array(), NULL, 'boinc:host-details'), bts('Computer ID', array(), NULL, 'boinc:host-list')), |
911 | 911 | '#options' => $options, |
912 | - ); |
|
912 | + ); |
|
913 | 913 | |
914 | - $form['prefs']['separator_bottom'] = array( |
|
915 | - // '#value' => '<div class="separator buttons"></div>' |
|
916 | - ); |
|
914 | + $form['prefs']['separator_bottom'] = array( |
|
915 | + // '#value' => '<div class="separator buttons"></div>' |
|
916 | + ); |
|
917 | 917 | |
918 | - // Form control |
|
919 | - $form['prefs']['form control tabs prefix'] = array( |
|
918 | + // Form control |
|
919 | + $form['prefs']['form control tabs prefix'] = array( |
|
920 | 920 | '#value' => '<ul class="form-control tab-list">' |
921 | - ); |
|
922 | - $form['prefs']['submit'] = array( |
|
921 | + ); |
|
922 | + $form['prefs']['submit'] = array( |
|
923 | 923 | '#prefix' => '<li class="first tab">', |
924 | 924 | '#type' => 'submit', |
925 | 925 | '#value' => bts('Merge', array(), NULL, 'boinc:form-merge'), |
926 | 926 | '#suffix' => '</li>' |
927 | - ); |
|
928 | - $form['prefs']['form control tabs'] = array( |
|
927 | + ); |
|
928 | + $form['prefs']['form control tabs'] = array( |
|
929 | 929 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
930 | - ); |
|
930 | + ); |
|
931 | 931 | |
932 | - return $form; |
|
932 | + return $form; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | /** |
@@ -942,76 +942,76 @@ discard block |
||
942 | 942 | * Handle submission of the merge host form |
943 | 943 | */ |
944 | 944 | function boincwork_host_merge_form_submit($form, &$form_state) { |
945 | - $merged = array(); |
|
946 | - $errors = array(); |
|
947 | - $current_host_id = $form_state['storage']['current_host_id']; |
|
948 | - $current_host = boincwork_host_get_info($current_host_id); |
|
949 | - $selected_hosts = array_filter($form_state['values']['merge']); |
|
945 | + $merged = array(); |
|
946 | + $errors = array(); |
|
947 | + $current_host_id = $form_state['storage']['current_host_id']; |
|
948 | + $current_host = boincwork_host_get_info($current_host_id); |
|
949 | + $selected_hosts = array_filter($form_state['values']['merge']); |
|
950 | 950 | |
951 | - foreach ($selected_hosts as $host_id) { |
|
951 | + foreach ($selected_hosts as $host_id) { |
|
952 | 952 | // Attempt to merge each host, noting the results |
953 | 953 | $message = ''; |
954 | 954 | $old_host = boincwork_host_get_info($host_id); |
955 | 955 | if (boincwork_host_merge($old_host, $current_host, $message)) { |
956 | - $merged[$old_host->id] = $old_host->id; |
|
957 | - $current_host = boincwork_host_get_info($current_host_id); |
|
956 | + $merged[$old_host->id] = $old_host->id; |
|
957 | + $current_host = boincwork_host_get_info($current_host_id); |
|
958 | 958 | } |
959 | 959 | else { |
960 | - $errors[$old_host->id] = $message; |
|
960 | + $errors[$old_host->id] = $message; |
|
961 | + } |
|
961 | 962 | } |
962 | - } |
|
963 | 963 | |
964 | - if ($merged) { |
|
964 | + if ($merged) { |
|
965 | 965 | // Generate a natural language list of IDs that were merged |
966 | 966 | $oxford_comma = ','; |
967 | 967 | $conjunction = bts('and', array(), NULL, 'boinc:account-preference'); |
968 | 968 | $list = array_keys($merged); |
969 | 969 | $last = array_pop($list); |
970 | 970 | if ($list) { |
971 | - if (count($merged) == 2) { |
|
971 | + if (count($merged) == 2) { |
|
972 | 972 | $oxford_comma = ''; |
973 | - } |
|
974 | - $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
|
973 | + } |
|
974 | + $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
|
975 | 975 | } |
976 | 976 | else { |
977 | - $list = $last; |
|
977 | + $list = $last; |
|
978 | 978 | } |
979 | 979 | if (count($merged) == 1) { |
980 | - drupal_set_message(bts( |
|
980 | + drupal_set_message(bts( |
|
981 | 981 | 'Computer @old_id has been merged successfully into @id.', |
982 | 982 | array( |
983 | - '@old_id' => $list, |
|
984 | - '@id' => $current_host_id |
|
983 | + '@old_id' => $list, |
|
984 | + '@id' => $current_host_id |
|
985 | 985 | ), |
986 | 986 | NULL, 'boinc:account-host-merge')); |
987 | 987 | } |
988 | 988 | else { |
989 | - drupal_set_message(bts( |
|
989 | + drupal_set_message(bts( |
|
990 | 990 | 'Computers @old_ids have been merged successfully into @id.', |
991 | 991 | array( |
992 | - '@old_ids' => $list, |
|
993 | - '@id' => $current_host_id |
|
992 | + '@old_ids' => $list, |
|
993 | + '@id' => $current_host_id |
|
994 | 994 | ), |
995 | 995 | NULL, 'boinc:account-host-merge')); |
996 | 996 | } |
997 | - } |
|
997 | + } |
|
998 | 998 | |
999 | - if ($errors) { |
|
999 | + if ($errors) { |
|
1000 | 1000 | // Report any hosts that failed to merge |
1001 | 1001 | foreach ($errors as $id => $error) { |
1002 | - drupal_set_message( |
|
1002 | + drupal_set_message( |
|
1003 | 1003 | bts('Computer @old_id failed to merge: @message', |
1004 | - array( |
|
1004 | + array( |
|
1005 | 1005 | '@old_id' => $id, |
1006 | 1006 | '@message' => $error, |
1007 | - ), |
|
1008 | - NULL, 'boinc:account-host-merge'), |
|
1007 | + ), |
|
1008 | + NULL, 'boinc:account-host-merge'), |
|
1009 | 1009 | 'warning' |
1010 | - ); |
|
1010 | + ); |
|
1011 | + } |
|
1011 | 1012 | } |
1012 | - } |
|
1013 | 1013 | |
1014 | - drupal_goto("host/{$current_host_id}"); |
|
1014 | + drupal_goto("host/{$current_host_id}"); |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -1023,44 +1023,44 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | function boincwork_projectprefs_form(&$form_state, $venue) { |
1025 | 1025 | |
1026 | - global $user; |
|
1027 | - $account = user_load($user->uid); |
|
1026 | + global $user; |
|
1027 | + $account = user_load($user->uid); |
|
1028 | 1028 | |
1029 | - $established = TRUE; |
|
1029 | + $established = TRUE; |
|
1030 | 1030 | |
1031 | - // Get availability of special BOINC preferences |
|
1032 | - require_boinc(array('util')); |
|
1033 | - $app_types = get_app_types(); |
|
1031 | + // Get availability of special BOINC preferences |
|
1032 | + require_boinc(array('util')); |
|
1033 | + $app_types = get_app_types(); |
|
1034 | 1034 | |
1035 | - // Load any existing preferences from BOINC account |
|
1036 | - $prefs = boincwork_load_prefs('project', $venue); |
|
1035 | + // Load any existing preferences from BOINC account |
|
1036 | + $prefs = boincwork_load_prefs('project', $venue); |
|
1037 | 1037 | |
1038 | - // Take note if this is not an established preference set on the account |
|
1039 | - if (isset($prefs['@attributes']['cleared'])) { |
|
1038 | + // Take note if this is not an established preference set on the account |
|
1039 | + if (isset($prefs['@attributes']['cleared'])) { |
|
1040 | 1040 | $established = FALSE; |
1041 | - } |
|
1041 | + } |
|
1042 | 1042 | |
1043 | - // Extract modified tag if present |
|
1044 | - $modified = NULL; |
|
1045 | - if (isset($prefs['modified']['@value'])) { |
|
1043 | + // Extract modified tag if present |
|
1044 | + $modified = NULL; |
|
1045 | + if (isset($prefs['modified']['@value'])) { |
|
1046 | 1046 | $modified = $prefs['modified']['@value']; |
1047 | - } |
|
1047 | + } |
|
1048 | 1048 | |
1049 | - $venue_is_default = FALSE; |
|
1050 | - if ($account->boincuser_default_pref_set) { |
|
1049 | + $venue_is_default = FALSE; |
|
1050 | + if ($account->boincuser_default_pref_set) { |
|
1051 | 1051 | if ($account->boincuser_default_pref_set == $venue) { |
1052 | - $venue_is_default = TRUE; |
|
1052 | + $venue_is_default = TRUE; |
|
1053 | + } |
|
1053 | 1054 | } |
1054 | - } |
|
1055 | - elseif (!$venue OR $venue == 'generic') { |
|
1055 | + elseif (!$venue OR $venue == 'generic') { |
|
1056 | 1056 | $venue_is_default = TRUE; |
1057 | - } |
|
1058 | - else { |
|
1057 | + } |
|
1058 | + else { |
|
1059 | 1059 | $venue_is_default = FALSE; |
1060 | - } |
|
1060 | + } |
|
1061 | 1061 | |
1062 | - // Define form defaults |
|
1063 | - $default = array( |
|
1062 | + // Define form defaults |
|
1063 | + $default = array( |
|
1064 | 1064 | 'resource_share' => 100, |
1065 | 1065 | 'no_cpu' => 0, |
1066 | 1066 | 'no_cuda' => 0, |
@@ -1068,333 +1068,333 @@ discard block |
||
1068 | 1068 | 'no_intel_gpu' => 0, |
1069 | 1069 | 'default_venue' => $venue_is_default, |
1070 | 1070 | 'allow_beta_work' => $prefs['allow_beta_work'], |
1071 | - ); |
|
1072 | - foreach ($default as $name => $value) { |
|
1071 | + ); |
|
1072 | + foreach ($default as $name => $value) { |
|
1073 | 1073 | if (isset($prefs[$name])) { |
1074 | - if (is_array($prefs[$name])) { |
|
1074 | + if (is_array($prefs[$name])) { |
|
1075 | 1075 | if (isset($prefs[$name]['@value'])) { |
1076 | - $default[$name] = $prefs[$name]['@value']; |
|
1076 | + $default[$name] = $prefs[$name]['@value']; |
|
1077 | 1077 | } |
1078 | - } |
|
1079 | - else { |
|
1078 | + } |
|
1079 | + else { |
|
1080 | 1080 | $default[$name] = $prefs[$name]; |
1081 | - } |
|
1081 | + } |
|
1082 | + } |
|
1082 | 1083 | } |
1083 | - } |
|
1084 | 1084 | |
1085 | - // Standard option sets |
|
1086 | - $form['boolean_options'] = array( |
|
1085 | + // Standard option sets |
|
1086 | + $form['boolean_options'] = array( |
|
1087 | 1087 | '#type' => 'value', |
1088 | 1088 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
1089 | - ); |
|
1089 | + ); |
|
1090 | 1090 | |
1091 | - // Identify preference sets that are established to distinguish what has been |
|
1092 | - // saved to the database from what is just showing default values |
|
1093 | - $form['#established'] = $established; |
|
1091 | + // Identify preference sets that are established to distinguish what has been |
|
1092 | + // saved to the database from what is just showing default values |
|
1093 | + $form['#established'] = $established; |
|
1094 | 1094 | |
1095 | - // Top level form options |
|
1096 | - $form['#tree'] = TRUE; |
|
1095 | + // Top level form options |
|
1096 | + $form['#tree'] = TRUE; |
|
1097 | 1097 | |
1098 | - // Hidden elements |
|
1099 | - $form['modified'] = array( |
|
1098 | + // Hidden elements |
|
1099 | + $form['modified'] = array( |
|
1100 | 1100 | '#type' => 'hidden', |
1101 | 1101 | '#value' => $modified, |
1102 | - ); |
|
1103 | - $form['venue'] = array( |
|
1102 | + ); |
|
1103 | + $form['venue'] = array( |
|
1104 | 1104 | '#type' => 'hidden', |
1105 | 1105 | '#value' => $venue, |
1106 | - ); |
|
1106 | + ); |
|
1107 | 1107 | |
1108 | - $form['separator_top'] = array( |
|
1108 | + $form['separator_top'] = array( |
|
1109 | 1109 | '#value' => '<div class="separator"></div>' |
1110 | - ); |
|
1110 | + ); |
|
1111 | 1111 | |
1112 | - // Common project preferences |
|
1113 | - $form['resource'] = array( |
|
1112 | + // Common project preferences |
|
1113 | + $form['resource'] = array( |
|
1114 | 1114 | '#title' => bts('Resource settings', array(), NULL, 'boinc:account-preferences-project'), |
1115 | 1115 | '#type' => 'fieldset', |
1116 | 1116 | '#description' => null, |
1117 | 1117 | '#collapsible' => TRUE, |
1118 | 1118 | '#collapsed' => FALSE |
1119 | - ); |
|
1120 | - $form['resource']['resource_share'] = array( |
|
1119 | + ); |
|
1120 | + $form['resource']['resource_share'] = array( |
|
1121 | 1121 | '#title' => bts('Resource share', array(), NULL, 'boinc:account-preferences-project'), |
1122 | 1122 | '#type' => 'textfield', |
1123 | 1123 | '#default_value' => $default['resource_share'], |
1124 | 1124 | '#size' => 5, |
1125 | 1125 | '#description' => bts("Determines the proportion of your computer's resources allocated to this project. Example: if you participate in two BOINC projects with resource shares of 100 and 200, the first will get 1/3 of your resources and the second will get 2/3.", array(), NULL, 'boinc:account-preferences-project') |
1126 | - ); |
|
1127 | - if ($app_types->count > 1) { |
|
1126 | + ); |
|
1127 | + if ($app_types->count > 1) { |
|
1128 | 1128 | if ($app_types->cpu) { |
1129 | - $form['resource']['no_cpu'] = array( |
|
1129 | + $form['resource']['no_cpu'] = array( |
|
1130 | 1130 | '#title' => bts('Use CPU', array(), NULL, 'boinc:account-preferences-project'), |
1131 | 1131 | '#type' => 'radios', |
1132 | 1132 | '#options' => $form['boolean_options']['#value'], |
1133 | 1133 | '#attributes' => array('class' => 'fancy'), |
1134 | 1134 | '#default_value' => $default['no_cpu'] ? 0 : 1, |
1135 | 1135 | '#description' => bts('Request CPU-only tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
1136 | - ); |
|
1136 | + ); |
|
1137 | 1137 | } |
1138 | 1138 | if ($app_types->cuda) { |
1139 | - $form['resource']['no_cuda'] = array( |
|
1139 | + $form['resource']['no_cuda'] = array( |
|
1140 | 1140 | '#title' => bts('Use NVIDIA GPU', array(), NULL, 'boinc:account-preferences-project'), |
1141 | 1141 | '#type' => 'radios', |
1142 | 1142 | '#options' => $form['boolean_options']['#value'], |
1143 | 1143 | '#attributes' => array('class' => 'fancy'), |
1144 | 1144 | '#default_value' => $default['no_cuda'] ? 0 : 1, |
1145 | 1145 | '#description' => bts('Request NVIDIA GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
1146 | - ); |
|
1146 | + ); |
|
1147 | 1147 | } |
1148 | 1148 | if ($app_types->ati) { |
1149 | - $form['resource']['no_ati'] = array( |
|
1149 | + $form['resource']['no_ati'] = array( |
|
1150 | 1150 | '#title' => bts('Use AMD GPU', array(), NULL, 'boinc:account-preferences-project'), |
1151 | 1151 | '#type' => 'radios', |
1152 | 1152 | '#options' => $form['boolean_options']['#value'], |
1153 | 1153 | '#attributes' => array('class' => 'fancy'), |
1154 | 1154 | '#default_value' => $default['no_ati'] ? 0 : 1, |
1155 | 1155 | '#description' => bts('Request AMD GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
1156 | - ); |
|
1156 | + ); |
|
1157 | 1157 | } |
1158 | 1158 | if ($app_types->intel_gpu) { |
1159 | - $form['resource']['no_intel_gpu'] = array( |
|
1159 | + $form['resource']['no_intel_gpu'] = array( |
|
1160 | 1160 | '#title' => bts('Use INTEL GPU', array(), NULL, 'boinc:account-preferences-project'), |
1161 | 1161 | '#type' => 'radios', |
1162 | 1162 | '#options' => $form['boolean_options']['#value'], |
1163 | 1163 | '#attributes' => array('class' => 'fancy'), |
1164 | 1164 | '#default_value' => $default['no_intel_gpu'] ? 0 : 1, |
1165 | 1165 | '#description' => bts('Request Intel GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
1166 | - ); |
|
1166 | + ); |
|
1167 | + } |
|
1167 | 1168 | } |
1168 | - } |
|
1169 | 1169 | |
1170 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
1170 | + if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
1171 | 1171 | $form['beta'] = array( |
1172 | - '#title' => bts('Beta settings', array(), NULL, 'boinc:account-preferences-project'), |
|
1173 | - '#type' => 'fieldset', |
|
1174 | - '#description' => null, |
|
1175 | - '#collapsible' => TRUE, |
|
1176 | - '#collapsed' => FALSE |
|
1172 | + '#title' => bts('Beta settings', array(), NULL, 'boinc:account-preferences-project'), |
|
1173 | + '#type' => 'fieldset', |
|
1174 | + '#description' => null, |
|
1175 | + '#collapsible' => TRUE, |
|
1176 | + '#collapsed' => FALSE |
|
1177 | 1177 | ); |
1178 | 1178 | $form['beta']['allow_beta_work'] = array( |
1179 | - '#title' => bts('Run test applications?', array(), NULL, 'boinc:account-preferences-project'), |
|
1180 | - '#type' => 'radios', |
|
1181 | - '#options' => $form['boolean_options']['#value'], |
|
1182 | - '#attributes' => array('class' => 'fancy'), |
|
1183 | - '#default_value' => ($default['allow_beta_work']) ? 1 : 0, |
|
1184 | - '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), NULL, 'boinc:account-preferences-project') |
|
1179 | + '#title' => bts('Run test applications?', array(), NULL, 'boinc:account-preferences-project'), |
|
1180 | + '#type' => 'radios', |
|
1181 | + '#options' => $form['boolean_options']['#value'], |
|
1182 | + '#attributes' => array('class' => 'fancy'), |
|
1183 | + '#default_value' => ($default['allow_beta_work']) ? 1 : 0, |
|
1184 | + '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), NULL, 'boinc:account-preferences-project') |
|
1185 | 1185 | ); |
1186 | - } |
|
1186 | + } |
|
1187 | 1187 | |
1188 | - // Add project specific prefs to the form |
|
1189 | - boincwork_add_project_specific_prefs($form, $prefs); |
|
1188 | + // Add project specific prefs to the form |
|
1189 | + boincwork_add_project_specific_prefs($form, $prefs); |
|
1190 | 1190 | |
1191 | - // Set whether to use this preference set by default for new computers |
|
1192 | - $form['default_set'] = array( |
|
1191 | + // Set whether to use this preference set by default for new computers |
|
1192 | + $form['default_set'] = array( |
|
1193 | 1193 | '#title' => bts('Default set', array(), NULL, 'boinc:account-preferences-project'), |
1194 | 1194 | '#type' => 'fieldset', |
1195 | 1195 | '#description' => null, |
1196 | 1196 | '#collapsible' => TRUE, |
1197 | 1197 | '#collapsed' => FALSE |
1198 | - ); |
|
1199 | - $form['default_set']['default_venue'] = array( |
|
1198 | + ); |
|
1199 | + $form['default_set']['default_venue'] = array( |
|
1200 | 1200 | '#title' => bts('Set used for new computers', array(), NULL, 'boinc:account-preferences-project'), |
1201 | 1201 | '#type' => 'radios', |
1202 | 1202 | '#options' => $form['boolean_options']['#value'], |
1203 | 1203 | '#attributes' => array('class' => 'fancy'), |
1204 | 1204 | '#default_value' => $default['default_venue'] ? 1 : 0, |
1205 | 1205 | '#description' => '' |
1206 | - ); |
|
1206 | + ); |
|
1207 | 1207 | |
1208 | - $form['prefs']['separator_bottom'] = array( |
|
1208 | + $form['prefs']['separator_bottom'] = array( |
|
1209 | 1209 | '#value' => '<div class="separator buttons"></div>' |
1210 | - ); |
|
1210 | + ); |
|
1211 | 1211 | |
1212 | - // Form control |
|
1213 | - $form['prefs']['form control tabs prefix'] = array( |
|
1212 | + // Form control |
|
1213 | + $form['prefs']['form control tabs prefix'] = array( |
|
1214 | 1214 | '#value' => '<ul class="form-control tab-list">' |
1215 | - ); |
|
1216 | - $form['prefs']['submit'] = array( |
|
1215 | + ); |
|
1216 | + $form['prefs']['submit'] = array( |
|
1217 | 1217 | '#prefix' => '<li class="first tab">', |
1218 | 1218 | '#type' => 'submit', |
1219 | 1219 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
1220 | 1220 | '#suffix' => '</li>' |
1221 | - ); |
|
1222 | - $form['prefs']['form control tabs'] = array( |
|
1221 | + ); |
|
1222 | + $form['prefs']['form control tabs'] = array( |
|
1223 | 1223 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
1224 | - ); |
|
1225 | - if ($venue AND $venue != 'generic') { |
|
1224 | + ); |
|
1225 | + if ($venue AND $venue != 'generic') { |
|
1226 | 1226 | global $base_path; |
1227 | 1227 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
1228 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
1228 | + l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
1229 | 1229 | array( |
1230 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
1231 | - 'attributes' => array( |
|
1230 | + 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
1231 | + 'attributes' => array( |
|
1232 | 1232 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
1233 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
1234 | - ) |
|
1233 | + array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
1234 | + ) |
|
1235 | 1235 | ) |
1236 | - ) . '</li>'; |
|
1237 | - } |
|
1238 | - $form['prefs']['view control'] = array( |
|
1239 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
1240 | - ); |
|
1241 | - $form['prefs']['form control tabs suffix'] = array( |
|
1236 | + ) . '</li>'; |
|
1237 | + } |
|
1238 | + $form['prefs']['view control'] = array( |
|
1239 | + '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
1240 | + ); |
|
1241 | + $form['prefs']['form control tabs suffix'] = array( |
|
1242 | 1242 | '#value' => '</ul>' |
1243 | - ); |
|
1243 | + ); |
|
1244 | 1244 | |
1245 | - return $form; |
|
1245 | + return $form; |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | /** |
1249 | 1249 | * Add project specific preferences to the project preferences form |
1250 | 1250 | */ |
1251 | 1251 | function boincwork_add_project_specific_prefs(&$form, $prefs) { |
1252 | - // Load project specific preferences from XML config |
|
1253 | - $xml = boincwork_get_project_specific_config(); |
|
1252 | + // Load project specific preferences from XML config |
|
1253 | + $xml = boincwork_get_project_specific_config(); |
|
1254 | 1254 | |
1255 | - // Respect the order of the top level elements |
|
1256 | - $ordered_array = array(); |
|
1257 | - $unordered_array = array(); |
|
1258 | - foreach ($xml['project_specific_preferences'] as $type => $element) { |
|
1255 | + // Respect the order of the top level elements |
|
1256 | + $ordered_array = array(); |
|
1257 | + $unordered_array = array(); |
|
1258 | + foreach ($xml['project_specific_preferences'] as $type => $element) { |
|
1259 | 1259 | if (is_array($element) AND is_numeric(key($element))) { |
1260 | - foreach ($element as $ordered_element) { |
|
1260 | + foreach ($element as $ordered_element) { |
|
1261 | 1261 | if (isset($ordered_element['@position'])) { |
1262 | - $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
|
1262 | + $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
|
1263 | 1263 | } |
1264 | 1264 | else { |
1265 | - $unordered_array[] = array($type => $ordered_element); |
|
1265 | + $unordered_array[] = array($type => $ordered_element); |
|
1266 | + } |
|
1266 | 1267 | } |
1267 | - } |
|
1268 | 1268 | } |
1269 | 1269 | elseif (isset($element['@position'])) { |
1270 | - $ordered_array[$element['@position']] = array($type => $element); |
|
1270 | + $ordered_array[$element['@position']] = array($type => $element); |
|
1271 | 1271 | } |
1272 | 1272 | else { |
1273 | - $unordered_array[] = array($type => $element); |
|
1273 | + $unordered_array[] = array($type => $element); |
|
1274 | 1274 | } |
1275 | - } |
|
1276 | - ksort($ordered_array); |
|
1277 | - $primed_array = array_merge($ordered_array, $unordered_array); |
|
1278 | - $xml = array('project_specific_preferences' => $primed_array); |
|
1275 | + } |
|
1276 | + ksort($ordered_array); |
|
1277 | + $primed_array = array_merge($ordered_array, $unordered_array); |
|
1278 | + $xml = array('project_specific_preferences' => $primed_array); |
|
1279 | 1279 | |
1280 | - foreach ($xml['project_specific_preferences'] as $wrapped_element) { |
|
1280 | + foreach ($xml['project_specific_preferences'] as $wrapped_element) { |
|
1281 | 1281 | $type = key($wrapped_element); |
1282 | 1282 | $element= reset($wrapped_element); |
1283 | 1283 | boincwork_generate_prefs_element($form, $type, $element, $prefs['project_specific']); |
1284 | - } |
|
1284 | + } |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | /** |
1288 | - * Validate the project preferences form. |
|
1289 | - */ |
|
1288 | + * Validate the project preferences form. |
|
1289 | + */ |
|
1290 | 1290 | function boincwork_projectprefs_form_validate($form, &$form_state) { |
1291 | 1291 | |
1292 | - // Verify all text user input values and notify form API of failures |
|
1293 | - $validation_rules = array( |
|
1292 | + // Verify all text user input values and notify form API of failures |
|
1293 | + $validation_rules = array( |
|
1294 | 1294 | 'resource' => array( |
1295 | - 'resource_share' => array( |
|
1295 | + 'resource_share' => array( |
|
1296 | 1296 | 'datatype' => 'integer', |
1297 | 1297 | 'min' => 0 |
1298 | - ), |
|
1298 | + ), |
|
1299 | 1299 | ), |
1300 | - ); |
|
1300 | + ); |
|
1301 | 1301 | |
1302 | - // Add validation rules for project specific settings |
|
1303 | - $validation_rules += boincwork_get_project_specific_config_validation_rules(); |
|
1302 | + // Add validation rules for project specific settings |
|
1303 | + $validation_rules += boincwork_get_project_specific_config_validation_rules(); |
|
1304 | 1304 | |
1305 | - // Perform validation |
|
1306 | - boincwork_validate_form($validation_rules, $form_state['values']); |
|
1305 | + // Perform validation |
|
1306 | + boincwork_validate_form($validation_rules, $form_state['values']); |
|
1307 | 1307 | |
1308 | - // Check for app validation |
|
1309 | - if (isset($validation_rules['apps'])) { |
|
1308 | + // Check for app validation |
|
1309 | + if (isset($validation_rules['apps'])) { |
|
1310 | 1310 | if (isset($validation_rules['apps']['minimum selected']) |
1311 | 1311 | AND $validation_rules['apps']['minimum selected'] > 0) { |
1312 | - $apps_selected = 0; |
|
1313 | - foreach ($validation_rules['apps']['list'] as $app) { |
|
1312 | + $apps_selected = 0; |
|
1313 | + foreach ($validation_rules['apps']['list'] as $app) { |
|
1314 | 1314 | if ($form_state['values']['applications'][$app]) $apps_selected++; |
1315 | - } |
|
1316 | - if ($apps_selected < $validation_rules['apps']['minimum selected']) { |
|
1315 | + } |
|
1316 | + if ($apps_selected < $validation_rules['apps']['minimum selected']) { |
|
1317 | 1317 | form_set_error( |
1318 | - 'applications', |
|
1319 | - bts('At least one application must be selected', array(), NULL, 'boinc:account-preferences-project') |
|
1318 | + 'applications', |
|
1319 | + bts('At least one application must be selected', array(), NULL, 'boinc:account-preferences-project') |
|
1320 | 1320 | ); |
1321 | - } |
|
1322 | - if ($apps_selected == count($validation_rules['apps']['list'])) { |
|
1321 | + } |
|
1322 | + if ($apps_selected == count($validation_rules['apps']['list'])) { |
|
1323 | 1323 | foreach ($validation_rules['apps']['list'] as $app) { |
1324 | - unset($form_state['values']['applications'][$app]); |
|
1324 | + unset($form_state['values']['applications'][$app]); |
|
1325 | 1325 | } |
1326 | 1326 | $form_state['storage']['all apps selected'] = TRUE; |
1327 | - } |
|
1327 | + } |
|
1328 | + } |
|
1328 | 1329 | } |
1329 | - } |
|
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | /** |
1333 | - * Handle post-validation submission of project preferences form. |
|
1334 | - */ |
|
1333 | + * Handle post-validation submission of project preferences form. |
|
1334 | + */ |
|
1335 | 1335 | function boincwork_projectprefs_form_submit($form, &$form_state) { |
1336 | - global $user; |
|
1337 | - global $site_name; |
|
1336 | + global $user; |
|
1337 | + global $site_name; |
|
1338 | 1338 | |
1339 | - require_boinc(array('util')); |
|
1340 | - $app_types = get_app_types(); |
|
1339 | + require_boinc(array('util')); |
|
1340 | + $app_types = get_app_types(); |
|
1341 | 1341 | |
1342 | - $account = user_load($user->uid); |
|
1343 | - $edit = $form_state['values']; |
|
1344 | - $venue = $edit['venue']; |
|
1342 | + $account = user_load($user->uid); |
|
1343 | + $edit = $form_state['values']; |
|
1344 | + $venue = $edit['venue']; |
|
1345 | 1345 | |
1346 | - // Load preferences from BOINC account |
|
1347 | - $prefs = boincwork_load_prefs('project', $venue); |
|
1346 | + // Load preferences from BOINC account |
|
1347 | + $prefs = boincwork_load_prefs('project', $venue); |
|
1348 | 1348 | |
1349 | - // Resource preferences |
|
1350 | - $prefs['resource_share'] = $edit['resource']['resource_share']; |
|
1351 | - if ($app_types->count > 1) { |
|
1349 | + // Resource preferences |
|
1350 | + $prefs['resource_share'] = $edit['resource']['resource_share']; |
|
1351 | + if ($app_types->count > 1) { |
|
1352 | 1352 | if ($app_types->cpu) $prefs['no_cpu'] = ($edit['resource']['no_cpu']) ? 0 : 1; |
1353 | 1353 | if ($app_types->cuda) $prefs['no_cuda'] = ($edit['resource']['no_cuda']) ? 0 : 1; |
1354 | 1354 | if ($app_types->ati) $prefs['no_ati'] = ($edit['resource']['no_ati']) ? 0 : 1; |
1355 | 1355 | if ($app_types->intel_gpu) $prefs['no_intel_gpu'] = ($edit['resource']['no_intel_gpu']) ? 0 : 1; |
1356 | - } |
|
1356 | + } |
|
1357 | 1357 | |
1358 | - // Beta preferences |
|
1359 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
1358 | + // Beta preferences |
|
1359 | + if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
1360 | 1360 | $prefs['allow_beta_work'] = ($edit['beta']['allow_beta_work']) ? 1 : 0; |
1361 | - } |
|
1361 | + } |
|
1362 | 1362 | |
1363 | - // Load project specific preferences from XML config |
|
1364 | - $xml = boincwork_get_project_specific_config(); |
|
1365 | - $updated_prefs = array( |
|
1363 | + // Load project specific preferences from XML config |
|
1364 | + $xml = boincwork_get_project_specific_config(); |
|
1365 | + $updated_prefs = array( |
|
1366 | 1366 | 'project_specific' => boincwork_format_project_specific_prefs_data($edit) |
1367 | - ); |
|
1368 | - $prefs = $updated_prefs + $prefs; |
|
1367 | + ); |
|
1368 | + $prefs = $updated_prefs + $prefs; |
|
1369 | 1369 | |
1370 | - // Don't specify apps if all are selected |
|
1371 | - if (isset($form_state['storage']['all apps selected'])) { |
|
1370 | + // Don't specify apps if all are selected |
|
1371 | + if (isset($form_state['storage']['all apps selected'])) { |
|
1372 | 1372 | unset($prefs['project_specific']['app_id']); |
1373 | 1373 | unset($form_state['storage']['all apps selected']); |
1374 | - } |
|
1374 | + } |
|
1375 | 1375 | |
1376 | - // If this is a new preference set, be sure to unset the "cleared" attribute |
|
1377 | - if (isset($prefs['@attributes']['cleared'])) { |
|
1376 | + // If this is a new preference set, be sure to unset the "cleared" attribute |
|
1377 | + if (isset($prefs['@attributes']['cleared'])) { |
|
1378 | 1378 | unset($prefs['@attributes']['cleared']); |
1379 | - } |
|
1379 | + } |
|
1380 | 1380 | |
1381 | - // Save preferences back to the BOINC account |
|
1382 | - $result = boincwork_save_prefs($prefs, 'project', $venue); |
|
1381 | + // Save preferences back to the BOINC account |
|
1382 | + $result = boincwork_save_prefs($prefs, 'project', $venue); |
|
1383 | 1383 | |
1384 | - // Update the user's default preference set |
|
1385 | - if ($edit['default_set']['default_venue']) { |
|
1384 | + // Update the user's default preference set |
|
1385 | + if ($edit['default_set']['default_venue']) { |
|
1386 | 1386 | boincwork_set_default_venue($venue); |
1387 | - } |
|
1388 | - elseif ($venue == $account->boincuser_default_pref_set) { |
|
1387 | + } |
|
1388 | + elseif ($venue == $account->boincuser_default_pref_set) { |
|
1389 | 1389 | // User has cleared out the default venue setting |
1390 | 1390 | boincwork_set_default_venue(); |
1391 | - } |
|
1391 | + } |
|
1392 | 1392 | |
1393 | - if (!$result) { |
|
1393 | + if (!$result) { |
|
1394 | 1394 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
1395 | 1395 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
1396 | - } |
|
1397 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
1396 | + } |
|
1397 | + elseif (!drupal_get_messages('status', FALSE)) { |
|
1398 | 1398 | // Show this message if the set wasn't created automatically (in which case |
1399 | 1399 | // there is a message tailored to that) |
1400 | 1400 | drupal_set_message(t('Your preferences have been updated. |
@@ -1402,53 +1402,53 @@ discard block |
||
1402 | 1402 | communicates with @project or you issue the "Update" |
1403 | 1403 | command from the BOINC client.', |
1404 | 1404 | array('@project' => $site_name))); |
1405 | - } |
|
1405 | + } |
|
1406 | 1406 | } |
1407 | 1407 | |
1408 | 1408 | /** |
1409 | 1409 | * The structure of the community preferences form |
1410 | 1410 | */ |
1411 | 1411 | function communityprefs_form(&$form_state) { |
1412 | - global $user; |
|
1413 | - $account = user_load($user->uid); |
|
1414 | - $form = array(); |
|
1415 | - |
|
1416 | - // Pull in some elements from the profile form |
|
1417 | - $profile_form_state = array(); |
|
1418 | - $profile = new stdClass(); |
|
1419 | - $profile->type = 'profile'; |
|
1420 | - $profile->language = ''; |
|
1421 | - if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
|
1412 | + global $user; |
|
1413 | + $account = user_load($user->uid); |
|
1414 | + $form = array(); |
|
1415 | + |
|
1416 | + // Pull in some elements from the profile form |
|
1417 | + $profile_form_state = array(); |
|
1418 | + $profile = new stdClass(); |
|
1419 | + $profile->type = 'profile'; |
|
1420 | + $profile->language = ''; |
|
1421 | + if ($profile_nid = content_profile_profile_exists($profile, $account->uid)) { |
|
1422 | 1422 | $profile_node = node_load($profile_nid); |
1423 | 1423 | $form_state['storage']['profile_node'] = $profile_node; |
1424 | 1424 | module_load_include('inc', 'node', 'node.pages'); |
1425 | 1425 | $profile_form = drupal_retrieve_form('profile_node_form', $profile_form_state, $profile_node); |
1426 | 1426 | drupal_prepare_form('profile_node_form', $profile_form, $profile_form_state); |
1427 | - } |
|
1427 | + } |
|
1428 | 1428 | |
1429 | - // Standard option sets |
|
1430 | - $form['boolean_options'] = array( |
|
1429 | + // Standard option sets |
|
1430 | + $form['boolean_options'] = array( |
|
1431 | 1431 | '#type' => 'value', |
1432 | 1432 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
1433 | - ); |
|
1433 | + ); |
|
1434 | 1434 | |
1435 | - $default = array( |
|
1435 | + $default = array( |
|
1436 | 1436 | 'pm_send_notification' => '', // This is set already in pm_email_notify_user |
1437 | 1437 | 'friend_notification' => isset($account->friend_notification) ? $account->friend_notification : 0, |
1438 | 1438 | 'comments_per_page' => (isset($account->comments_per_page) AND $account->comments_per_page) ? $account->comments_per_page : variable_get('comment_default_per_page_forum', 50), |
1439 | 1439 | 'comments_order' => (isset($account->sort) AND $account->sort) ? $account->sort : variable_get('comment_default_order_forum', COMMENT_ORDER_OLDEST_FIRST), |
1440 | - ); |
|
1440 | + ); |
|
1441 | 1441 | |
1442 | - // General options |
|
1443 | - $form['general'] = array( |
|
1442 | + // General options |
|
1443 | + $form['general'] = array( |
|
1444 | 1444 | '#type' => 'fieldset', |
1445 | 1445 | '#title' => bts('General settings', array(), NULL, 'boinc:account-preferences-community'), |
1446 | 1446 | '#weight' => 0, |
1447 | 1447 | '#collapsible' => TRUE, |
1448 | 1448 | '#collapsed' => FALSE |
1449 | - ); |
|
1450 | - // Add the BOINC user name (non-unique, user editable) |
|
1451 | - $form['general']['boincuser_name'] = array( |
|
1449 | + ); |
|
1450 | + // Add the BOINC user name (non-unique, user editable) |
|
1451 | + $form['general']['boincuser_name'] = array( |
|
1452 | 1452 | '#type' => 'textfield', |
1453 | 1453 | '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
1454 | 1454 | '#default_value' => $account->boincuser_name, |
@@ -1456,252 +1456,252 @@ discard block |
||
1456 | 1456 | '#required' => TRUE, |
1457 | 1457 | '#description' => '', |
1458 | 1458 | '#size' => 40 |
1459 | - ); |
|
1460 | - // Time zone |
|
1461 | - if (variable_get('configurable_timezones', 1)) { |
|
1459 | + ); |
|
1460 | + // Time zone |
|
1461 | + if (variable_get('configurable_timezones', 1)) { |
|
1462 | 1462 | $zones = _system_zonelist(); |
1463 | 1463 | $form['general']['timezone'] = array( |
1464 | - '#type' => 'select', |
|
1465 | - '#title' => bts('Time zone', array(), NULL, 'boinc:account-preferences-community'), |
|
1466 | - '#default_value' => ($account->timezone !== NULL) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
1467 | - '#options' => $zones, |
|
1468 | - '#description' => '', |
|
1464 | + '#type' => 'select', |
|
1465 | + '#title' => bts('Time zone', array(), NULL, 'boinc:account-preferences-community'), |
|
1466 | + '#default_value' => ($account->timezone !== NULL) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
1467 | + '#options' => $zones, |
|
1468 | + '#description' => '', |
|
1469 | 1469 | ); |
1470 | - } |
|
1470 | + } |
|
1471 | 1471 | |
1472 | - // Notification options |
|
1473 | - $form['notifications'] = array( |
|
1472 | + // Notification options |
|
1473 | + $form['notifications'] = array( |
|
1474 | 1474 | '#type' => 'fieldset', |
1475 | 1475 | '#title' => bts('Notification settings', array(), NULL, 'boinc:account-preferences-community'), |
1476 | 1476 | '#weight' => 5, |
1477 | 1477 | '#collapsible' => TRUE, |
1478 | 1478 | '#collapsed' => FALSE |
1479 | - ); |
|
1480 | - // Pull in private message notification handling and tweak the form |
|
1481 | - $pm_notify = pm_email_notify_user('form', $edit, $account, 'account'); |
|
1482 | - $form['notifications']['pm_send_notifications'] = array_replace( |
|
1479 | + ); |
|
1480 | + // Pull in private message notification handling and tweak the form |
|
1481 | + $pm_notify = pm_email_notify_user('form', $edit, $account, 'account'); |
|
1482 | + $form['notifications']['pm_send_notifications'] = array_replace( |
|
1483 | 1483 | $pm_notify['enable_pm_mail']['pm_send_notifications'], |
1484 | 1484 | array( |
1485 | - '#type' => 'radios', |
|
1486 | - '#title' => bts('Receive email notification for private messages?', array(), NULL, 'boinc:account-preferences-community'), |
|
1487 | - '#description' => ' ', |
|
1488 | - '#options' => $form['boolean_options']['#value'], |
|
1489 | - '#attributes' => array('class' => 'fancy') |
|
1485 | + '#type' => 'radios', |
|
1486 | + '#title' => bts('Receive email notification for private messages?', array(), NULL, 'boinc:account-preferences-community'), |
|
1487 | + '#description' => ' ', |
|
1488 | + '#options' => $form['boolean_options']['#value'], |
|
1489 | + '#attributes' => array('class' => 'fancy') |
|
1490 | 1490 | ) |
1491 | - ); |
|
1492 | - $form['notifications']['friend_notification'] = array( |
|
1491 | + ); |
|
1492 | + $form['notifications']['friend_notification'] = array( |
|
1493 | 1493 | '#type' => 'radios', |
1494 | 1494 | '#title' => bts('Receive email notification for friend requests?', array(), NULL, 'boinc:account-preferences-community'), |
1495 | 1495 | '#description' => ' ', |
1496 | 1496 | '#options' => array(0 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), -1 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
1497 | 1497 | '#attributes' => array('class' => 'fancy'), |
1498 | 1498 | '#default_value' => $default['friend_notification'] |
1499 | - ); |
|
1499 | + ); |
|
1500 | 1500 | |
1501 | - // Internationalization options |
|
1502 | - if (module_exists('internationalization')) { |
|
1501 | + // Internationalization options |
|
1502 | + if (module_exists('internationalization')) { |
|
1503 | 1503 | $languages = language_list('enabled'); |
1504 | 1504 | $languages = $languages[1]; |
1505 | 1505 | $names = array(); |
1506 | 1506 | foreach ($languages as $langcode => $item) { |
1507 | - $name = t($item->name); |
|
1508 | - $names[check_plain($langcode)] = check_plain($name . ($item->native != $name ? ' ('. $item->native .')' : '')); |
|
1507 | + $name = t($item->name); |
|
1508 | + $names[check_plain($langcode)] = check_plain($name . ($item->native != $name ? ' ('. $item->native .')' : '')); |
|
1509 | 1509 | } |
1510 | 1510 | $form['locale'] = array( |
1511 | - '#type' => 'fieldset', |
|
1512 | - '#title' => bts('Language settings', array(), NULL, 'boinc:account-preferences-community'), |
|
1513 | - '#weight' => 10, |
|
1514 | - '#collapsible' => TRUE, |
|
1515 | - '#collapsed' => FALSE, |
|
1511 | + '#type' => 'fieldset', |
|
1512 | + '#title' => bts('Language settings', array(), NULL, 'boinc:account-preferences-community'), |
|
1513 | + '#weight' => 10, |
|
1514 | + '#collapsible' => TRUE, |
|
1515 | + '#collapsed' => FALSE, |
|
1516 | 1516 | ); |
1517 | 1517 | |
1518 | 1518 | // Get language negotiation settings. |
1519 | 1519 | $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); |
1520 | 1520 | $user_preferred_language = user_preferred_language($account); |
1521 | 1521 | $form['locale']['language'] = array( |
1522 | - '#type' => 'select', |
|
1523 | - '#title' => bts('Language', array(), NULL, 'boinc:account-preferences-community'), |
|
1524 | - '#default_value' => check_plain($user_preferred_language->language), |
|
1525 | - '#options' => $names, |
|
1526 | - '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), NULL, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), NULL, 'boinc:account-preferences-community'), |
|
1522 | + '#type' => 'select', |
|
1523 | + '#title' => bts('Language', array(), NULL, 'boinc:account-preferences-community'), |
|
1524 | + '#default_value' => check_plain($user_preferred_language->language), |
|
1525 | + '#options' => $names, |
|
1526 | + '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), NULL, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), NULL, 'boinc:account-preferences-community'), |
|
1527 | 1527 | ); |
1528 | - } |
|
1528 | + } |
|
1529 | 1529 | |
1530 | - // Avatar options |
|
1531 | - $form['gravatar'] = array( |
|
1530 | + // Avatar options |
|
1531 | + $form['gravatar'] = array( |
|
1532 | 1532 | '#type' => 'item', |
1533 | 1533 | '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
1534 | 1534 | '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), NULL, 'boinc:account-preferences-community'), |
1535 | - ); |
|
1536 | - if (user_access('disable own gravatar', $account)) { |
|
1535 | + ); |
|
1536 | + if (user_access('disable own gravatar', $account)) { |
|
1537 | 1537 | $form['gravatar'] = array( |
1538 | - '#type' => 'checkbox', |
|
1539 | - '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
1540 | - '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
|
1541 | - '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
|
1542 | - '#disabled' => !empty($account->picture), |
|
1543 | - ); |
|
1544 | - } |
|
1545 | - $form['gravatar']['#weight'] = 15; |
|
1546 | - $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
1547 | - // Upload an avatar (pulled from profile_node_form): |
|
1548 | - if (!empty($profile_form['field_image'])) { |
|
1538 | + '#type' => 'checkbox', |
|
1539 | + '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
1540 | + '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
|
1541 | + '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
|
1542 | + '#disabled' => !empty($account->picture), |
|
1543 | + ); |
|
1544 | + } |
|
1545 | + $form['gravatar']['#weight'] = 15; |
|
1546 | + $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
1547 | + // Upload an avatar (pulled from profile_node_form): |
|
1548 | + if (!empty($profile_form['field_image'])) { |
|
1549 | 1549 | $form['field_image'] = $profile_form['field_image']; |
1550 | - } |
|
1551 | - else { |
|
1550 | + } |
|
1551 | + else { |
|
1552 | 1552 | $form['field_image'] = array( |
1553 | - '#value' => '<div class="form-item">' |
|
1553 | + '#value' => '<div class="form-item">' |
|
1554 | 1554 | . '<label class="placeholder">' |
1555 | 1555 | . bts('This is not available until your profile is set up.', array(), NULL, 'boinc:account-preferences-community') |
1556 | 1556 | . '</label>' |
1557 | 1557 | . l(bts('Create a profile', array(), NULL, 'boinc:account-preferences-community'), 'account/profile/edit', array('attributes' => array('class' => 'form-link'))) |
1558 | 1558 | . '</div>', |
1559 | 1559 | ); |
1560 | - } |
|
1561 | - $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), NULL, 'boinc:account-preferences-community'); |
|
1562 | - $form['field_image']['#weight'] = 20; |
|
1563 | - $form['field_image']['#suffix'] = '</fieldset>'; |
|
1560 | + } |
|
1561 | + $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), NULL, 'boinc:account-preferences-community'); |
|
1562 | + $form['field_image']['#weight'] = 20; |
|
1563 | + $form['field_image']['#suffix'] = '</fieldset>'; |
|
1564 | 1564 | |
1565 | - // Forum options |
|
1566 | - $form['forums'] = array( |
|
1565 | + // Forum options |
|
1566 | + $form['forums'] = array( |
|
1567 | 1567 | '#type' => 'fieldset', |
1568 | 1568 | '#title' => bts('Forum settings', array(), NULL, 'boinc:account-preferences-community'), |
1569 | 1569 | '#weight' => 25, |
1570 | 1570 | '#collapsible' => TRUE, |
1571 | 1571 | '#collapsed' => FALSE |
1572 | - ); |
|
1573 | - $form['forums']['comments_per_page'] = array( |
|
1572 | + ); |
|
1573 | + $form['forums']['comments_per_page'] = array( |
|
1574 | 1574 | '#type' => 'select', |
1575 | 1575 | '#title' => bts('In discussion topics, show at most @comments_per_page', array('@comments_per_page' => ''), NULL, 'boinc:account-preferences-community'), |
1576 | 1576 | '#options' => array(10 => 10, 20 => 20, 30 => 30, 50 => 50, 100 => 100), |
1577 | 1577 | '#default_value' => $default['comments_per_page'] |
1578 | - ); |
|
1579 | - // Can't have a typical Drupal form suffix on a select box? |
|
1580 | - $form['forums']['comments_per_page_suffix'] = array( |
|
1578 | + ); |
|
1579 | + // Can't have a typical Drupal form suffix on a select box? |
|
1580 | + $form['forums']['comments_per_page_suffix'] = array( |
|
1581 | 1581 | '#value' => '<span>' . bts('comments per page', array(), NULL, 'boinc:account-preferences-community') . '</span>' |
1582 | - ); |
|
1583 | - $form['forums']['comments_order'] = array( |
|
1582 | + ); |
|
1583 | + $form['forums']['comments_order'] = array( |
|
1584 | 1584 | '#type' => 'select', |
1585 | 1585 | '#title' => bts('Sort comments in discussions', array(), NULL, 'boinc:account-preferences-community'), |
1586 | 1586 | '#options' => array(1 => bts('Newest post first', array(), NULL, 'boinc:account-preferences-community'), 2 => bts('Oldest post first', array(), NULL, 'boinc:account-preferences-community')), |
1587 | 1587 | '#default_value' => $default['comments_order'] |
1588 | - ); |
|
1589 | - // Signature (pulled from user_edit_form): |
|
1590 | - if (variable_get('user_signatures', 0) && module_exists('comment')) { |
|
1588 | + ); |
|
1589 | + // Signature (pulled from user_edit_form): |
|
1590 | + if (variable_get('user_signatures', 0) && module_exists('comment')) { |
|
1591 | 1591 | $form['forums']['signature'] = array( |
1592 | - '#type' => 'textarea', |
|
1593 | - '#title' => bts('Signature', array(), NULL, 'boinc:account-preferences-community'), |
|
1594 | - '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), NULL, 'boinc:account-preferences-community'), |
|
1595 | - '#default_value' => $account->signature |
|
1596 | - ); |
|
1592 | + '#type' => 'textarea', |
|
1593 | + '#title' => bts('Signature', array(), NULL, 'boinc:account-preferences-community'), |
|
1594 | + '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), NULL, 'boinc:account-preferences-community'), |
|
1595 | + '#default_value' => $account->signature |
|
1596 | + ); |
|
1597 | 1597 | // Prevent a "validation error" message when the user attempts to save with a default value they |
1598 | 1598 | // do not have access to. |
1599 | 1599 | if (!filter_access($account->signature_format) && empty($_POST)) { |
1600 | - drupal_set_message(t("The signature input format has been set to a format you don't have access to. It will be changed to a format you have access to when you save this page.")); |
|
1601 | - $edit['signature_format'] = FILTER_FORMAT_DEFAULT; |
|
1600 | + drupal_set_message(t("The signature input format has been set to a format you don't have access to. It will be changed to a format you have access to when you save this page.")); |
|
1601 | + $edit['signature_format'] = FILTER_FORMAT_DEFAULT; |
|
1602 | 1602 | } |
1603 | 1603 | $form['forums']['signature_format'] = filter_form($account->signature_format, NULL, array('signature_format')); |
1604 | 1604 | // Optionally hide signatures from comments |
1605 | 1605 | $form['forums']['hide_signatures'] = array( |
1606 | - '#type' => 'radios', |
|
1607 | - '#title' => bts('Hide signatures in forums', array(), NULL, 'boinc:account-preferences-community'), |
|
1608 | - '#description' => ' ', |
|
1609 | - '#options' => $form['boolean_options']['#value'], |
|
1610 | - '#attributes' => array('class' => 'fancy'), |
|
1611 | - '#default_value' => isset($account->hide_signatures) ? $account->hide_signatures : 0, |
|
1606 | + '#type' => 'radios', |
|
1607 | + '#title' => bts('Hide signatures in forums', array(), NULL, 'boinc:account-preferences-community'), |
|
1608 | + '#description' => ' ', |
|
1609 | + '#options' => $form['boolean_options']['#value'], |
|
1610 | + '#attributes' => array('class' => 'fancy'), |
|
1611 | + '#default_value' => isset($account->hide_signatures) ? $account->hide_signatures : 0, |
|
1612 | 1612 | ); |
1613 | - } |
|
1613 | + } |
|
1614 | 1614 | |
1615 | - //Bottom separator |
|
1616 | - $form['separator_bottom'] = array( |
|
1615 | + //Bottom separator |
|
1616 | + $form['separator_bottom'] = array( |
|
1617 | 1617 | '#value' => '<div class="separator buttons"></div>', |
1618 | 1618 | '#weight' => 999, |
1619 | - ); |
|
1619 | + ); |
|
1620 | 1620 | |
1621 | - // Form control |
|
1622 | - $form['form control tabs prefix'] = array( |
|
1621 | + // Form control |
|
1622 | + $form['form control tabs prefix'] = array( |
|
1623 | 1623 | '#value' => '<ul class="form-control tab-list">', |
1624 | 1624 | '#weight' => 1001, |
1625 | - ); |
|
1626 | - $form['submit'] = array( |
|
1625 | + ); |
|
1626 | + $form['submit'] = array( |
|
1627 | 1627 | '#prefix' => '<li class="first tab">', |
1628 | 1628 | '#type' => 'submit', |
1629 | 1629 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
1630 | 1630 | '#suffix' => '</li>', |
1631 | 1631 | '#weight' => 1002, |
1632 | - ); |
|
1633 | - $form['form control tabs'] = array( |
|
1632 | + ); |
|
1633 | + $form['form control tabs'] = array( |
|
1634 | 1634 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
1635 | 1635 | '#weight' => 1003, |
1636 | - ); |
|
1637 | - $form['form control tabs suffix'] = array( |
|
1636 | + ); |
|
1637 | + $form['form control tabs suffix'] = array( |
|
1638 | 1638 | '#value' => '</ul>', |
1639 | 1639 | '#weight' => 1004, |
1640 | - ); |
|
1641 | - return $form; |
|
1640 | + ); |
|
1641 | + return $form; |
|
1642 | 1642 | } |
1643 | 1643 | |
1644 | 1644 | /** |
1645 | - * Handle validation submission of community preferences form. |
|
1646 | - */ |
|
1645 | + * Handle validation submission of community preferences form. |
|
1646 | + */ |
|
1647 | 1647 | function communityprefs_form_validate($form, &$form_state) { |
1648 | - // require_boinc(); |
|
1649 | - global $user; |
|
1650 | - $account = user_load($user->uid); |
|
1651 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
1652 | - $edit = $form_state['values']; |
|
1648 | + // require_boinc(); |
|
1649 | + global $user; |
|
1650 | + $account = user_load($user->uid); |
|
1651 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
1652 | + $edit = $form_state['values']; |
|
1653 | 1653 | |
1654 | - if ($edit['boincuser_name'] != $boinc_user->name) { |
|
1654 | + if ($edit['boincuser_name'] != $boinc_user->name) { |
|
1655 | 1655 | $blacklist1 = preg_split('/\r\n|\r|\n/', variable_get('boinc_weboptions_blacklisted_usernames', "admin\nadministrator\nmoderator")); |
1656 | 1656 | $blacklist2 = array(); |
1657 | 1657 | if (is_array($blacklist1)) { |
1658 | - $blacklist2 = array_map('strtolower', $blacklist1); |
|
1658 | + $blacklist2 = array_map('strtolower', $blacklist1); |
|
1659 | 1659 | } |
1660 | 1660 | if (in_array(strtolower($edit['boincuser_name']), $blacklist2)) { |
1661 | - form_set_error('boincuser_name', |
|
1661 | + form_set_error('boincuser_name', |
|
1662 | 1662 | bts('You may not use username @blname, as that name is not allowed. Please choose another name.', |
1663 | 1663 | array('@blname' => $edit['boincuser_name']), |
1664 | 1664 | NULL, 'boinc:account-preferences-community')); |
1665 | - return false; |
|
1665 | + return false; |
|
1666 | + } |
|
1666 | 1667 | } |
1667 | - } |
|
1668 | 1668 | |
1669 | - return true; |
|
1669 | + return true; |
|
1670 | 1670 | } |
1671 | 1671 | |
1672 | 1672 | /** |
1673 | - * Handle post-validation submission of community preferences form. |
|
1674 | - */ |
|
1673 | + * Handle post-validation submission of community preferences form. |
|
1674 | + */ |
|
1675 | 1675 | function communityprefs_form_submit($form, &$form_state) { |
1676 | - require_boinc('boinc_db'); |
|
1677 | - global $user; |
|
1678 | - $account = user_load($user->uid); |
|
1679 | - $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
1680 | - $edit = $form_state['values']; |
|
1681 | - $profile_node = $form_state['storage']['profile_node']; |
|
1682 | - |
|
1683 | - // Display name |
|
1684 | - if ($edit['boincuser_name'] != $boinc_user->name) { |
|
1676 | + require_boinc('boinc_db'); |
|
1677 | + global $user; |
|
1678 | + $account = user_load($user->uid); |
|
1679 | + $boinc_user = BoincUser::lookup_id($account->boincuser_id); |
|
1680 | + $edit = $form_state['values']; |
|
1681 | + $profile_node = $form_state['storage']['profile_node']; |
|
1682 | + |
|
1683 | + // Display name |
|
1684 | + if ($edit['boincuser_name'] != $boinc_user->name) { |
|
1685 | 1685 | $boincuser_name = $edit['boincuser_name']; |
1686 | 1686 | $result = $boinc_user->update( |
1687 | 1687 | "name='{$boincuser_name}'" |
1688 | 1688 | ); |
1689 | - } |
|
1689 | + } |
|
1690 | 1690 | |
1691 | - // Private message settings |
|
1692 | - pm_email_notify_user('submit', $edit, $user); |
|
1691 | + // Private message settings |
|
1692 | + pm_email_notify_user('submit', $edit, $user); |
|
1693 | 1693 | |
1694 | - // Avatar settings - only set if profile_node exists. |
|
1695 | - if ($profile_node) { |
|
1694 | + // Avatar settings - only set if profile_node exists. |
|
1695 | + if ($profile_node) { |
|
1696 | 1696 | if (!$edit['field_image']) $edit['field_image'] = array(); |
1697 | 1697 | $profile_node->field_image = $edit['field_image']; |
1698 | 1698 | node_save($profile_node); |
1699 | 1699 | // Flush this from the node cache or changes won't show up immediately! |
1700 | 1700 | $profile_node = node_load($profile_node->nid, NULL, TRUE); |
1701 | - } |
|
1701 | + } |
|
1702 | 1702 | |
1703 | - // All other settings |
|
1704 | - $settings = array( |
|
1703 | + // All other settings |
|
1704 | + $settings = array( |
|
1705 | 1705 | 'signature' => $edit['signature'], |
1706 | 1706 | 'signature_format' => $edit['signature_format'], |
1707 | 1707 | 'timezone' => $edit['timezone'], |
@@ -1710,197 +1710,197 @@ discard block |
||
1710 | 1710 | 'hide_signatures' => $edit['hide_signatures'], |
1711 | 1711 | 'sort' => $edit['comments_order'], |
1712 | 1712 | 'gravatar' => $edit['gravatar'], |
1713 | - ); |
|
1714 | - if (module_exists('internationalization')) { |
|
1713 | + ); |
|
1714 | + if (module_exists('internationalization')) { |
|
1715 | 1715 | $settings['language'] = $edit['language']; |
1716 | 1716 | global $language; |
1717 | 1717 | if ($user->language != $edit['language']) { |
1718 | - global $base_url; |
|
1719 | - if ($edit['language'] != language_default('language')) { |
|
1718 | + global $base_url; |
|
1719 | + if ($edit['language'] != language_default('language')) { |
|
1720 | 1720 | $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
1721 | - } |
|
1722 | - else { |
|
1721 | + } |
|
1722 | + else { |
|
1723 | 1723 | $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
1724 | - } |
|
1724 | + } |
|
1725 | + } |
|
1725 | 1726 | } |
1726 | - } |
|
1727 | - user_save($user, $settings); |
|
1727 | + user_save($user, $settings); |
|
1728 | 1728 | |
1729 | - drupal_set_message(bts('Your community preferences have been updated.', array(), NULL, 'boinc:account-preferences-community')); |
|
1729 | + drupal_set_message(bts('Your community preferences have been updated.', array(), NULL, 'boinc:account-preferences-community')); |
|
1730 | 1730 | |
1731 | - // Form will not redirect if storage is set; not good if language changes |
|
1732 | - unset($form_state['storage']); |
|
1731 | + // Form will not redirect if storage is set; not good if language changes |
|
1732 | + unset($form_state['storage']); |
|
1733 | 1733 | } |
1734 | 1734 | |
1735 | 1735 | /** |
1736 | 1736 | * The structure of the privacy preferences form |
1737 | 1737 | */ |
1738 | 1738 | function boincwork_privacyprefs_form(&$form_state) { |
1739 | - require_boinc(array('user', 'prefs', 'util', 'consent')); |
|
1739 | + require_boinc(array('user', 'prefs', 'util', 'consent')); |
|
1740 | 1740 | |
1741 | - global $user; |
|
1742 | - $account = user_load($user->uid); |
|
1743 | - $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
1741 | + global $user; |
|
1742 | + $account = user_load($user->uid); |
|
1743 | + $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
1744 | 1744 | |
1745 | - // Load preferences from BOINC account |
|
1746 | - $prefs = boincwork_load_prefs('project'); |
|
1745 | + // Load preferences from BOINC account |
|
1746 | + $prefs = boincwork_load_prefs('project'); |
|
1747 | 1747 | |
1748 | - //if (!$prefs AND !$initialize_if_empty) return null; |
|
1748 | + //if (!$prefs AND !$initialize_if_empty) return null; |
|
1749 | 1749 | |
1750 | - $privacy_consent_types = boincwork_load_privacyconsenttypes(); |
|
1750 | + $privacy_consent_types = boincwork_load_privacyconsenttypes(); |
|
1751 | 1751 | |
1752 | - // Define form defaults |
|
1753 | - $default = array( |
|
1752 | + // Define form defaults |
|
1753 | + $default = array( |
|
1754 | 1754 | 'privacy' => array( |
1755 | - 'send_email' => ($boincuser->send_email) ? 1 : 0, |
|
1756 | - 'show_hosts' => ($boincuser->show_hosts) ? 1 : 0 |
|
1755 | + 'send_email' => ($boincuser->send_email) ? 1 : 0, |
|
1756 | + 'show_hosts' => ($boincuser->show_hosts) ? 1 : 0 |
|
1757 | 1757 | ) |
1758 | - ); |
|
1758 | + ); |
|
1759 | 1759 | |
1760 | - // Standard option sets |
|
1761 | - $form['boolean_options'] = array( |
|
1760 | + // Standard option sets |
|
1761 | + $form['boolean_options'] = array( |
|
1762 | 1762 | '#type' => 'value', |
1763 | 1763 | '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
1764 | - ); |
|
1764 | + ); |
|
1765 | 1765 | |
1766 | - $form['privacy'] = array( |
|
1766 | + $form['privacy'] = array( |
|
1767 | 1767 | '#title' => bts('Privacy settings', array(), NULL, 'boinc:account-preferences-privacy'), |
1768 | 1768 | '#type' => 'fieldset', |
1769 | 1769 | '#description' => null, |
1770 | 1770 | '#collapsible' => TRUE, |
1771 | 1771 | '#collapsed' => FALSE |
1772 | - ); |
|
1773 | - $form['privacy']['send_email'] = array( |
|
1772 | + ); |
|
1773 | + $form['privacy']['send_email'] = array( |
|
1774 | 1774 | '#title' => bts('Is it OK for @project and your team (if any) to email you?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
1775 | 1775 | '#type' => 'radios', |
1776 | 1776 | '#options' => $form['boolean_options']['#value'], |
1777 | 1777 | '#attributes' => array('class' => 'fancy'), |
1778 | 1778 | '#default_value' => $default['privacy']['send_email'] |
1779 | - ); |
|
1780 | - $form['privacy']['show_hosts'] = array( |
|
1779 | + ); |
|
1780 | + $form['privacy']['show_hosts'] = array( |
|
1781 | 1781 | '#title' => bts('Should @project show your computers on its website?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
1782 | 1782 | '#description' => bts('At times, you may be asked to enable this option in order to receive help from the forums. Advanced users may need to be able to inspect your computers\' information in order to help diagnose any problems.', array(), NULL, 'boinc:account-preferences-privacy'), |
1783 | 1783 | '#type' => 'radios', |
1784 | 1784 | '#options' => $form['boolean_options']['#value'], |
1785 | 1785 | '#attributes' => array('class' => 'fancy'), |
1786 | 1786 | '#default_value' => $default['privacy']['show_hosts'] |
1787 | - ); |
|
1787 | + ); |
|
1788 | 1788 | |
1789 | - // Loop over privacy consent types and create form question for each |
|
1790 | - // option that deals with privacy. |
|
1791 | - foreach ($privacy_consent_types as $ct) { |
|
1789 | + // Loop over privacy consent types and create form question for each |
|
1790 | + // option that deals with privacy. |
|
1791 | + foreach ($privacy_consent_types as $ct) { |
|
1792 | 1792 | |
1793 | 1793 | $currstate = (check_user_consent($boincuser, $ct['shortname'])) ? 1 : 0 ; |
1794 | 1794 | // Set name to 'privacyconsent_SHORTNAME', which can be parsed |
1795 | 1795 | // later in the submit function. |
1796 | 1796 | $form['privacy']['privacyconsent_'.$ct['shortname']] = array( |
1797 | - '#title' => bts($ct['description'], array(), NULL, 'boinc:account-preferences-privacy'), |
|
1798 | - '#type' => 'radios', |
|
1799 | - '#options' => $form['boolean_options']['#value'], |
|
1800 | - '#attributes' => array('class' => 'fancy'), |
|
1801 | - '#default_value' => $currstate, |
|
1797 | + '#title' => bts($ct['description'], array(), NULL, 'boinc:account-preferences-privacy'), |
|
1798 | + '#type' => 'radios', |
|
1799 | + '#options' => $form['boolean_options']['#value'], |
|
1800 | + '#attributes' => array('class' => 'fancy'), |
|
1801 | + '#default_value' => $currstate, |
|
1802 | 1802 | ); |
1803 | 1803 | |
1804 | 1804 | // Add a description with link to the question 'Do you consent to |
1805 | 1805 | // exporting your data...'. |
1806 | 1806 | $mypatt = '/Do you consent to exporting your data/'; |
1807 | 1807 | if (preg_match($mypatt, $ct['description']) ) { |
1808 | - $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
|
1809 | - array( |
|
1808 | + $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
|
1809 | + array( |
|
1810 | 1810 | '!privacy_policy_link' => l( |
1811 | - bts('privacy policy', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1812 | - '/privacy' |
|
1811 | + bts('privacy policy', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1812 | + '/privacy' |
|
1813 | 1813 | ) |
1814 | - ), |
|
1815 | - NULL, 'boinc:account-preferences-privacy'); |
|
1814 | + ), |
|
1815 | + NULL, 'boinc:account-preferences-privacy'); |
|
1816 | + } |
|
1816 | 1817 | } |
1817 | - } |
|
1818 | 1818 | |
1819 | - // Ignore and block users |
|
1820 | - if (module_exists('ignore_user')) { |
|
1819 | + // Ignore and block users |
|
1820 | + if (module_exists('ignore_user')) { |
|
1821 | 1821 | $form['ignoreblock'] = array( |
1822 | - '#title' => bts('Ignore Users', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1823 | - '#type' => 'fieldset', |
|
1824 | - '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), NULL, 'boinc:ignore-user-help'), |
|
1825 | - '#collapsible' => TRUE, |
|
1826 | - '#collapsed' => FALSE |
|
1822 | + '#title' => bts('Ignore Users', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1823 | + '#type' => 'fieldset', |
|
1824 | + '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), NULL, 'boinc:ignore-user-help'), |
|
1825 | + '#collapsible' => TRUE, |
|
1826 | + '#collapsed' => FALSE |
|
1827 | 1827 | ); |
1828 | 1828 | |
1829 | 1829 | // Table for ignored users |
1830 | 1830 | $form['ignoreblock']['current_ignore_section'] = array( |
1831 | - '#type' => 'item', |
|
1832 | - '#value' => bts('Current users on your Ignore List', array(), NULL, 'boinc:ignore-user-list'), |
|
1833 | - '#prefix' => '<h4>', |
|
1834 | - '#suffix' => '</h4>', |
|
1835 | - '#weight' => -20, |
|
1831 | + '#type' => 'item', |
|
1832 | + '#value' => bts('Current users on your Ignore List', array(), NULL, 'boinc:ignore-user-list'), |
|
1833 | + '#prefix' => '<h4>', |
|
1834 | + '#suffix' => '</h4>', |
|
1835 | + '#weight' => -20, |
|
1836 | 1836 | ); |
1837 | 1837 | |
1838 | 1838 | $ignored_users = _ignore_user_ignored_users(); |
1839 | 1839 | foreach ($ignored_users as $ignored_user) { |
1840 | - $form['ignoreblock']['username'][$ignored_user['iuid']] = array( |
|
1840 | + $form['ignoreblock']['username'][$ignored_user['iuid']] = array( |
|
1841 | 1841 | '#value' => $ignored_user['username'], |
1842 | - ); |
|
1843 | - $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
|
1842 | + ); |
|
1843 | + $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
|
1844 | 1844 | '#value' => l( |
1845 | - bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
|
1846 | - 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
|
1847 | - array() |
|
1845 | + bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
|
1846 | + 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
|
1847 | + array() |
|
1848 | 1848 | ), |
1849 | - ); |
|
1849 | + ); |
|
1850 | 1850 | } |
1851 | 1851 | $form['ignoreblock']['pager'] = array('#value' => theme('pager', NULL, 10, 0)); |
1852 | 1852 | |
1853 | 1853 | // Sub-form to add user to ignore list |
1854 | 1854 | $form['ignoreblock']['add_ignore_user_section'] = array( |
1855 | - '#type' => 'item', |
|
1856 | - '#value' => bts('Add user to Ignore List', array(), NULL, 'boinc:ignore-user-add'), |
|
1857 | - '#prefix' => '<h4>', |
|
1858 | - '#suffix' => '</h4>', |
|
1859 | - '#weight' => 10, |
|
1855 | + '#type' => 'item', |
|
1856 | + '#value' => bts('Add user to Ignore List', array(), NULL, 'boinc:ignore-user-add'), |
|
1857 | + '#prefix' => '<h4>', |
|
1858 | + '#suffix' => '</h4>', |
|
1859 | + '#weight' => 10, |
|
1860 | 1860 | ); |
1861 | 1861 | |
1862 | 1862 | $form['ignoreblock']['addusername_toignorelist'] = array( |
1863 | - '#type' => 'textfield', |
|
1864 | - '#title' => bts('Username', array(), NULL, 'boinc:ignore-user-searchbox'), |
|
1865 | - '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), NULL, 'boinc:ignore-user-searchbox-help'), |
|
1866 | - '#weight' => 11, |
|
1867 | - '#size' => 50, |
|
1868 | - '#autocomplete_path' => 'boincuser/autocomplete', |
|
1863 | + '#type' => 'textfield', |
|
1864 | + '#title' => bts('Username', array(), NULL, 'boinc:ignore-user-searchbox'), |
|
1865 | + '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), NULL, 'boinc:ignore-user-searchbox-help'), |
|
1866 | + '#weight' => 11, |
|
1867 | + '#size' => 50, |
|
1868 | + '#autocomplete_path' => 'boincuser/autocomplete', |
|
1869 | 1869 | ); |
1870 | 1870 | |
1871 | 1871 | $form['ignoreblock']['addusername_submit'] = array( |
1872 | - '#type' => 'submit', |
|
1873 | - '#value' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
|
1874 | - '#submit' => array('_boincwork_ignore_list_form_submit'), |
|
1875 | - '#weight' => 12, |
|
1876 | - '#attributes' => array('class' => 'add_ignore_user'), |
|
1872 | + '#type' => 'submit', |
|
1873 | + '#value' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
|
1874 | + '#submit' => array('_boincwork_ignore_list_form_submit'), |
|
1875 | + '#weight' => 12, |
|
1876 | + '#attributes' => array('class' => 'add_ignore_user'), |
|
1877 | 1877 | ); |
1878 | - }// endif module_exists |
|
1878 | + }// endif module_exists |
|
1879 | 1879 | |
1880 | - $form['prefs']['separator_bottom'] = array( |
|
1880 | + $form['prefs']['separator_bottom'] = array( |
|
1881 | 1881 | '#value' => '<div class="separator buttons"></div>' |
1882 | - ); |
|
1882 | + ); |
|
1883 | 1883 | |
1884 | - // Form control |
|
1885 | - $form['prefs']['form control tabs prefix'] = array( |
|
1884 | + // Form control |
|
1885 | + $form['prefs']['form control tabs prefix'] = array( |
|
1886 | 1886 | '#value' => '<ul class="form-control tab-list">' |
1887 | - ); |
|
1888 | - $form['prefs']['submit'] = array( |
|
1887 | + ); |
|
1888 | + $form['prefs']['submit'] = array( |
|
1889 | 1889 | '#prefix' => '<li class="first tab">', |
1890 | 1890 | '#type' => 'submit', |
1891 | 1891 | '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
1892 | 1892 | '#validate' => array('boincwork_privacyprefs_form_validate'), |
1893 | 1893 | '#submit' => array('boincwork_privacyprefs_form_submit'), |
1894 | 1894 | '#suffix' => '</li>' |
1895 | - ); |
|
1896 | - $form['prefs']['form control tabs'] = array( |
|
1895 | + ); |
|
1896 | + $form['prefs']['form control tabs'] = array( |
|
1897 | 1897 | '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
1898 | - ); |
|
1899 | - $form['prefs']['form control tabs suffix'] = array( |
|
1898 | + ); |
|
1899 | + $form['prefs']['form control tabs suffix'] = array( |
|
1900 | 1900 | '#value' => '</ul>' |
1901 | - ); |
|
1901 | + ); |
|
1902 | 1902 | |
1903 | - return $form; |
|
1903 | + return $form; |
|
1904 | 1904 | } |
1905 | 1905 | |
1906 | 1906 | /** |
@@ -1908,93 +1908,93 @@ discard block |
||
1908 | 1908 | */ |
1909 | 1909 | function theme_boincwork_privacyprefs_form($form) { |
1910 | 1910 | |
1911 | - $output = ''; |
|
1912 | - $output .= drupal_render($form['privacy']); |
|
1911 | + $output = ''; |
|
1912 | + $output .= drupal_render($form['privacy']); |
|
1913 | 1913 | |
1914 | - $header = array( |
|
1914 | + $header = array( |
|
1915 | 1915 | bts('Username', array(), NULL, 'boinc:ignore-user-list'), |
1916 | 1916 | bts('Operations', array(), NULL, 'boinc:ignore-user-list') |
1917 | - ); |
|
1917 | + ); |
|
1918 | 1918 | |
1919 | - $rows = array(); |
|
1920 | - if (isset($form['ignoreblock']['username']) && is_array($form['ignoreblock']['username'])) { |
|
1919 | + $rows = array(); |
|
1920 | + if (isset($form['ignoreblock']['username']) && is_array($form['ignoreblock']['username'])) { |
|
1921 | 1921 | foreach (element_children($form['ignoreblock']['username']) as $key) { |
1922 | - $row = array(); |
|
1923 | - $row[] = drupal_render($form['ignoreblock']['username'][$key]); |
|
1924 | - $row[] = drupal_render($form['ignoreblock']['delete'][$key]); |
|
1925 | - $rows[] = $row; |
|
1922 | + $row = array(); |
|
1923 | + $row[] = drupal_render($form['ignoreblock']['username'][$key]); |
|
1924 | + $row[] = drupal_render($form['ignoreblock']['delete'][$key]); |
|
1925 | + $rows[] = $row; |
|
1926 | 1926 | } |
1927 | - } |
|
1928 | - else { |
|
1927 | + } |
|
1928 | + else { |
|
1929 | 1929 | $rows[] = array( |
1930 | - array( |
|
1930 | + array( |
|
1931 | 1931 | 'data' => bts('You have not added any users to your Ignore List.', array(), NULL, 'boinc:ignore-user-list'), |
1932 | 1932 | 'colspan' => '2', |
1933 | - ) |
|
1933 | + ) |
|
1934 | 1934 | ); |
1935 | - } |
|
1935 | + } |
|
1936 | 1936 | |
1937 | - $attr = array('class' => 'ignore_user'); |
|
1938 | - $form['ignoreblock']['current_list']['ignored_users']['#value'] = theme('table', $header, $rows, $attr); |
|
1939 | - $output .= drupal_render($form['current_list']); |
|
1937 | + $attr = array('class' => 'ignore_user'); |
|
1938 | + $form['ignoreblock']['current_list']['ignored_users']['#value'] = theme('table', $header, $rows, $attr); |
|
1939 | + $output .= drupal_render($form['current_list']); |
|
1940 | 1940 | |
1941 | - if ($form['pager']['#value']) { |
|
1941 | + if ($form['pager']['#value']) { |
|
1942 | 1942 | $output .= drupal_render($form['pager']); |
1943 | - } |
|
1943 | + } |
|
1944 | 1944 | |
1945 | - $output .= drupal_render($form); |
|
1945 | + $output .= drupal_render($form); |
|
1946 | 1946 | |
1947 | - return $output; |
|
1947 | + return $output; |
|
1948 | 1948 | } |
1949 | 1949 | |
1950 | 1950 | /** |
1951 | - * Validate the privacy preferences form. |
|
1952 | - */ |
|
1951 | + * Validate the privacy preferences form. |
|
1952 | + */ |
|
1953 | 1953 | function boincwork_privacyprefs_form_validate($form, &$form_state) { |
1954 | - require_boinc('util'); |
|
1954 | + require_boinc('util'); |
|
1955 | 1955 | |
1956 | - // Verify all non-boolean user input values and notify form API of failures |
|
1957 | - // ... currently there are no non-boolean values! |
|
1956 | + // Verify all non-boolean user input values and notify form API of failures |
|
1957 | + // ... currently there are no non-boolean values! |
|
1958 | 1958 | } |
1959 | 1959 | |
1960 | 1960 | /** |
1961 | - * Handle post-validation submission of privacy preferences form. |
|
1962 | - */ |
|
1961 | + * Handle post-validation submission of privacy preferences form. |
|
1962 | + */ |
|
1963 | 1963 | function boincwork_privacyprefs_form_submit($form, &$form_state) { |
1964 | - require_boinc(array('user', 'prefs', 'consent')); |
|
1964 | + require_boinc(array('user', 'prefs', 'consent')); |
|
1965 | 1965 | |
1966 | - global $user; |
|
1967 | - $account = user_load($user->uid); |
|
1966 | + global $user; |
|
1967 | + $account = user_load($user->uid); |
|
1968 | 1968 | |
1969 | - // Load BOINC account |
|
1970 | - $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
1969 | + // Load BOINC account |
|
1970 | + $boincuser = BoincUser::lookup_id($account->boincuser_id); |
|
1971 | 1971 | |
1972 | - // Privacy preferences |
|
1973 | - $boincuser->send_email = ($form_state['values']['send_email']) ? true : false; |
|
1974 | - $boincuser->show_hosts = ($form_state['values']['show_hosts']) ? true : false; |
|
1972 | + // Privacy preferences |
|
1973 | + $boincuser->send_email = ($form_state['values']['send_email']) ? true : false; |
|
1974 | + $boincuser->show_hosts = ($form_state['values']['show_hosts']) ? true : false; |
|
1975 | 1975 | |
1976 | - // Privacy consent options, extract the 'privacyconsent_SHORTNAME' |
|
1977 | - // from values array, and loop over them; each is checked with |
|
1978 | - // check_consent_type(). Also check the current state of the option |
|
1979 | - // in the database. If the form value is a new state, then set it. |
|
1980 | - $result = preg_grep("/^privacyconsent/", array_keys($form_state['values'])); |
|
1981 | - $privacyconsent_prefs = array_intersect_key($form_state['values'], array_flip($result)); |
|
1982 | - foreach ($privacyconsent_prefs as $name => $newstate) { |
|
1976 | + // Privacy consent options, extract the 'privacyconsent_SHORTNAME' |
|
1977 | + // from values array, and loop over them; each is checked with |
|
1978 | + // check_consent_type(). Also check the current state of the option |
|
1979 | + // in the database. If the form value is a new state, then set it. |
|
1980 | + $result = preg_grep("/^privacyconsent/", array_keys($form_state['values'])); |
|
1981 | + $privacyconsent_prefs = array_intersect_key($form_state['values'], array_flip($result)); |
|
1982 | + foreach ($privacyconsent_prefs as $name => $newstate) { |
|
1983 | 1983 | $subname = explode('_', $name)[1]; |
1984 | 1984 | $currstate = (check_user_consent($boincuser, $subname)) ? 1 : 0 ; |
1985 | 1985 | list($checkct, $ctid) = check_consent_type($subname); |
1986 | 1986 | if ($checkct && ($currstate != $newstate)) { |
1987 | - consent_to_a_policy($boincuser, $ctid, $newstate, 0, 'Webform', time()); |
|
1987 | + consent_to_a_policy($boincuser, $ctid, $newstate, 0, 'Webform', time()); |
|
1988 | + } |
|
1988 | 1989 | } |
1989 | - } |
|
1990 | 1990 | |
1991 | - //project_prefs_update($boincuser, $main_prefs); |
|
1991 | + //project_prefs_update($boincuser, $main_prefs); |
|
1992 | 1992 | |
1993 | - db_set_active('boinc_rw'); |
|
1994 | - db_query("UPDATE user SET send_email = '{$boincuser->send_email}', show_hosts = '{$boincuser->show_hosts}' WHERE id = '{$boincuser->id}'"); |
|
1995 | - db_set_active('default'); |
|
1993 | + db_set_active('boinc_rw'); |
|
1994 | + db_query("UPDATE user SET send_email = '{$boincuser->send_email}', show_hosts = '{$boincuser->show_hosts}' WHERE id = '{$boincuser->id}'"); |
|
1995 | + db_set_active('default'); |
|
1996 | 1996 | |
1997 | - drupal_set_message(t('Your privacy preferences have been updated.')); |
|
1997 | + drupal_set_message(t('Your privacy preferences have been updated.')); |
|
1998 | 1998 | } |
1999 | 1999 | |
2000 | 2000 | /** |
@@ -2002,14 +2002,14 @@ discard block |
||
2002 | 2002 | * ignore list. |
2003 | 2003 | */ |
2004 | 2004 | function _boincwork_ignore_list_form_submit($form, $form_state) { |
2005 | - boincwork_ignore_user_add_user_username($form_state['values']['addusername_toignorelist']); |
|
2006 | - drupal_set_message( |
|
2005 | + boincwork_ignore_user_add_user_username($form_state['values']['addusername_toignorelist']); |
|
2006 | + drupal_set_message( |
|
2007 | 2007 | bts('@username has been added to your ignore list. See your !privacy_preferences for more details.', |
2008 | - array( |
|
2008 | + array( |
|
2009 | 2009 | '@username' => $form_state['values']['addusername_toignorelist'], |
2010 | 2010 | '!privacy_preferences' => l(bts('privacy preferences', array(), NULL, 'boinc:ignore-user-add'), 'account/prefs/privacy'), |
2011 | - ), |
|
2012 | - NULL, 'boinc:ignore-user-add'), |
|
2011 | + ), |
|
2012 | + NULL, 'boinc:ignore-user-add'), |
|
2013 | 2013 | 'status'); |
2014 | 2014 | } |
2015 | 2015 | |
@@ -2018,37 +2018,37 @@ discard block |
||
2018 | 2018 | */ |
2019 | 2019 | function boincwork_selectapp_form(&$form_state, $apps, $current_app) { |
2020 | 2020 | |
2021 | - $form['selectapp'] = array( |
|
2021 | + $form['selectapp'] = array( |
|
2022 | 2022 | '#type' => 'select', |
2023 | 2023 | '#attributes' => array( |
2024 | - 'class' => 'task-app-filter', |
|
2025 | - 'onchange' => 'this.form.submit();', |
|
2024 | + 'class' => 'task-app-filter', |
|
2025 | + 'onchange' => 'this.form.submit();', |
|
2026 | 2026 | ), |
2027 | 2027 | '#default_value' => $current_app, |
2028 | 2028 | '#options' => $apps, |
2029 | 2029 | '#post_render' => array('_boincwork_selectapp_form_callback'), |
2030 | - ); |
|
2030 | + ); |
|
2031 | 2031 | |
2032 | - // Class task-app-filter-submit for this form is used in |
|
2033 | - // theming. CSS sets 'display:none' if javascript is present. Thus |
|
2034 | - // only non-js users/browsers will see the Apply Filter button. |
|
2035 | - $form['submit'] = array( |
|
2032 | + // Class task-app-filter-submit for this form is used in |
|
2033 | + // theming. CSS sets 'display:none' if javascript is present. Thus |
|
2034 | + // only non-js users/browsers will see the Apply Filter button. |
|
2035 | + $form['submit'] = array( |
|
2036 | 2036 | '#type' => 'submit', |
2037 | 2037 | '#value' => bts('Apply Filter', array(), NULL, 'boinc:form-save'), |
2038 | 2038 | '#attributes' => array('class' => 'js-hide',), |
2039 | - ); |
|
2039 | + ); |
|
2040 | 2040 | |
2041 | - return $form; |
|
2041 | + return $form; |
|
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | /** |
2045 | 2045 | * Submit function for select appliacation form. |
2046 | 2046 | */ |
2047 | 2047 | function boincwork_selectapp_form_submit($form, &$form_state) { |
2048 | - $myargs = arg(); |
|
2049 | - array_pop($myargs); |
|
2050 | - $newpath = implode('/', $myargs ) . '/' . $form['selectapp']['#value']; |
|
2051 | - $form_state['redirect'] = $newpath; |
|
2048 | + $myargs = arg(); |
|
2049 | + array_pop($myargs); |
|
2050 | + $newpath = implode('/', $myargs ) . '/' . $form['selectapp']['#value']; |
|
2051 | + $form_state['redirect'] = $newpath; |
|
2052 | 2052 | } |
2053 | 2053 | |
2054 | 2054 | /** |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | * 'title' for the Application drop down box. |
2059 | 2059 | */ |
2060 | 2060 | function _boincwork_selectapp_form_callback($theContent, $theElement) { |
2061 | - $disabled = '<option value="-1" disabled hidden'; |
|
2062 | - $newContent = preg_replace('/<option value="-1"/', $disabled, $theContent); |
|
2063 | - return $newContent; |
|
2061 | + $disabled = '<option value="-1" disabled hidden'; |
|
2062 | + $newContent = preg_replace('/<option value="-1"/', $disabled, $theContent); |
|
2063 | + return $newContent; |
|
2064 | 2064 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | }// switch |
72 | 72 | } else { |
73 | 73 | $form_state['storage']['wip'] = TRUE; |
74 | - if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
|
74 | + if (!in_array($prefs_preset, array('standard', 'maximum', 'green', 'minimum', 'custom'))) { |
|
75 | 75 | if ($established) { |
76 | 76 | $prefs_preset = 'custom'; |
77 | 77 | } else { |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | ); |
142 | 142 | $form['hour_options'] = array( |
143 | 143 | '#type' => 'value', |
144 | - '#value' => array('0:00','1:00','2:00','3:00','4:00', |
|
145 | - '5:00','6:00','7:00','8:00','9:00','10:00','11:00', |
|
146 | - '12:00','13:00','14:00','15:00','16:00','17:00', |
|
147 | - '18:00','19:00','20:00','21:00','22:00','23:00') |
|
144 | + '#value' => array('0:00', '1:00', '2:00', '3:00', '4:00', |
|
145 | + '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', |
|
146 | + '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', |
|
147 | + '18:00', '19:00', '20:00', '21:00', '22:00', '23:00') |
|
148 | 148 | ); |
149 | 149 | |
150 | 150 | // Identify preference sets that are established to distinguish what has been |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), NULL, 'boinc:account-preferences-computing'), |
282 | 282 | ); |
283 | 283 | $form['prefs']['advanced']['processor']['hour_label'] = array( |
284 | - '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
284 | + '#value' => '<div class="form-item"><label>'.bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing').'</label></div>' |
|
285 | 285 | ); |
286 | 286 | $form['prefs']['advanced']['processor']['start_hour'] = array( |
287 | 287 | '#type' => 'select', |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | '#default_value' => $default['start_hour'] |
290 | 290 | ); |
291 | 291 | $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
292 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
292 | + '#value' => '<span>'.bts('and', array(), NULL, 'boinc:account-preference').'</span>' |
|
293 | 293 | ); |
294 | 294 | $form['prefs']['advanced']['processor']['end_hour'] = array( |
295 | 295 | '#type' => 'select', |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | '#default_value' => $default['end_hour'] |
298 | 298 | ); |
299 | 299 | $form['prefs']['advanced']['processor']['hour_description'] = array( |
300 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
300 | + '#value' => '<div class="form-item slim"><div class="description">'.bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing').'</div></div>' |
|
301 | 301 | ); |
302 | 302 | $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
303 | 303 | '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), NULL, 'boinc:account-preferences-computing'), |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | '#description' => bts('Limit the upload rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
455 | 455 | ); |
456 | 456 | $form['prefs']['advanced']['network']['hour_label'] = array( |
457 | - '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
457 | + '#value' => '<div class="form-item"><label>'.bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing').'</label></div>' |
|
458 | 458 | ); |
459 | 459 | $form['prefs']['advanced']['network']['net_start_hour'] = array( |
460 | 460 | '#type' => 'select', |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | '#default_value' => $default['net_start_hour'] |
463 | 463 | ); |
464 | 464 | $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
465 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
465 | + '#value' => '<span>'.bts('and', array(), NULL, 'boinc:account-preference').'</span>' |
|
466 | 466 | ); |
467 | 467 | $form['prefs']['advanced']['network']['net_end_hour'] = array( |
468 | 468 | '#type' => 'select', |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | '#default_value' => $default['net_end_hour'] |
471 | 471 | ); |
472 | 472 | $form['prefs']['advanced']['network']['hour_description'] = array( |
473 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
473 | + '#value' => '<div class="form-item slim"><div class="description">'.bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing').'</div></div>' |
|
474 | 474 | ); |
475 | 475 | $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
476 | 476 | '#title' => bts('Limit usage to', array(), NULL, 'boinc:account-preferences-computing'), |
@@ -530,23 +530,23 @@ discard block |
||
530 | 530 | '#suffix' => '</li>' |
531 | 531 | ); |
532 | 532 | $form['prefs']['form control tabs'] = array( |
533 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
|
533 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")).'</li>' |
|
534 | 534 | ); |
535 | 535 | if ($venue AND $venue != 'generic') { |
536 | 536 | global $base_path; |
537 | - $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
|
537 | + $form['prefs']['form control tabs']['#value'] .= '<li class="tab">'. |
|
538 | 538 | l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
539 | 539 | array( |
540 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
540 | + 'query' => 'destination='.urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
|
541 | 541 | 'attributes' => array( |
542 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
543 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
542 | + 'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
543 | + array('@name' => $venue), NULL, 'boinc:account-preferences').'\')' |
|
544 | 544 | ) |
545 | 545 | ) |
546 | - ) . '</li>'; |
|
546 | + ).'</li>'; |
|
547 | 547 | } |
548 | 548 | $form['prefs']['view control'] = array( |
549 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
|
549 | + '#value' => '<li class="first alt tab">'.l('('.bts('Show comparison view', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/computing/combined').'</li>' |
|
550 | 550 | ); |
551 | 551 | $form['prefs']['form control tabs suffix'] = array( |
552 | 552 | '#value' => '</ul>' |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | return FALSE; |
785 | 785 | } |
786 | 786 | |
787 | - if ($new_host->userid==0) { |
|
787 | + if ($new_host->userid == 0) { |
|
788 | 788 | rules_invoke_event('boincwork_zombie_merge_error', $old_host->id, $new_host->id, variable_get('boinc_admin_mailing_list_subject_tag', '')); |
789 | 789 | watchdog('boincwork', |
790 | 790 | 'Zombie merge attempted, target host has userid=0: old host id=%old_host, target host id=%new_host', |
@@ -880,9 +880,9 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | $form['overview'] = array( |
883 | - '#value' => '<p>' . bts('Sometimes BOINC assigns separate identities to' |
|
883 | + '#value' => '<p>'.bts('Sometimes BOINC assigns separate identities to' |
|
884 | 884 | . ' the same computer by mistake. You can correct this by merging old' |
885 | - . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
885 | + . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge').'</p>' |
|
886 | 886 | . '<p>' |
887 | 887 | . bts('Check the computers that are the same as @name' |
888 | 888 | . ' (created on @date at @time with computer ID @id)', |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | '@time' => date('G:i:s T', $current_host->create_time), |
893 | 893 | '@id' => $current_host->id, |
894 | 894 | ), |
895 | - NULL, 'boinc:account-host-merge') . '</p>', |
|
895 | + NULL, 'boinc:account-host-merge').'</p>', |
|
896 | 896 | ); |
897 | 897 | |
898 | 898 | $options = array(); |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | '#suffix' => '</li>' |
927 | 927 | ); |
928 | 928 | $form['prefs']['form control tabs'] = array( |
929 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
|
929 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}").'</li>' |
|
930 | 930 | ); |
931 | 931 | |
932 | 932 | return $form; |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | if (count($merged) == 2) { |
972 | 972 | $oxford_comma = ''; |
973 | 973 | } |
974 | - $list = implode(', ', $list) . $oxford_comma . ' ' . $conjunction . ' ' . $last; |
|
974 | + $list = implode(', ', $list).$oxford_comma.' '.$conjunction.' '.$last; |
|
975 | 975 | } |
976 | 976 | else { |
977 | 977 | $list = $last; |
@@ -1220,23 +1220,23 @@ discard block |
||
1220 | 1220 | '#suffix' => '</li>' |
1221 | 1221 | ); |
1222 | 1222 | $form['prefs']['form control tabs'] = array( |
1223 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
1223 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>' |
|
1224 | 1224 | ); |
1225 | 1225 | if ($venue AND $venue != 'generic') { |
1226 | 1226 | global $base_path; |
1227 | - $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
|
1227 | + $form['prefs']['form control tabs']['#value'] .= '<li class="tab">'. |
|
1228 | 1228 | l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
1229 | 1229 | array( |
1230 | - 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
1230 | + 'query' => 'destination='.urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
|
1231 | 1231 | 'attributes' => array( |
1232 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
1233 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
1232 | + 'onclick' => 'return confirm(\''.bts('This will remove all of your settings from the @name preference set. Are you sure?', |
|
1233 | + array('@name' => $venue), NULL, 'boinc:account-preferences').'\')' |
|
1234 | 1234 | ) |
1235 | 1235 | ) |
1236 | - ) . '</li>'; |
|
1236 | + ).'</li>'; |
|
1237 | 1237 | } |
1238 | 1238 | $form['prefs']['view control'] = array( |
1239 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
1239 | + '#value' => '<li class="first alt tab">'.l('('.bts('Show comparison view', array(), NULL, 'boinc:account-preferences').')', 'account/prefs/project/combined').'</li>' |
|
1240 | 1240 | ); |
1241 | 1241 | $form['prefs']['form control tabs suffix'] = array( |
1242 | 1242 | '#value' => '</ul>' |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | |
1280 | 1280 | foreach ($xml['project_specific_preferences'] as $wrapped_element) { |
1281 | 1281 | $type = key($wrapped_element); |
1282 | - $element= reset($wrapped_element); |
|
1282 | + $element = reset($wrapped_element); |
|
1283 | 1283 | boincwork_generate_prefs_element($form, $type, $element, $prefs['project_specific']); |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1505,7 +1505,7 @@ discard block |
||
1505 | 1505 | $names = array(); |
1506 | 1506 | foreach ($languages as $langcode => $item) { |
1507 | 1507 | $name = t($item->name); |
1508 | - $names[check_plain($langcode)] = check_plain($name . ($item->native != $name ? ' ('. $item->native .')' : '')); |
|
1508 | + $names[check_plain($langcode)] = check_plain($name.($item->native != $name ? ' ('.$item->native.')' : '')); |
|
1509 | 1509 | } |
1510 | 1510 | $form['locale'] = array( |
1511 | 1511 | '#type' => 'fieldset', |
@@ -1530,20 +1530,20 @@ discard block |
||
1530 | 1530 | // Avatar options |
1531 | 1531 | $form['gravatar'] = array( |
1532 | 1532 | '#type' => 'item', |
1533 | - '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
1533 | + '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/'.$account->mail), NULL, 'boinc:account-preferences-community'), |
|
1534 | 1534 | '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), NULL, 'boinc:account-preferences-community'), |
1535 | 1535 | ); |
1536 | 1536 | if (user_access('disable own gravatar', $account)) { |
1537 | 1537 | $form['gravatar'] = array( |
1538 | 1538 | '#type' => 'checkbox', |
1539 | - '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
1539 | + '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/'.$account->mail), NULL, 'boinc:account-preferences-community'), |
|
1540 | 1540 | '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
1541 | 1541 | '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
1542 | 1542 | '#disabled' => !empty($account->picture), |
1543 | 1543 | ); |
1544 | 1544 | } |
1545 | 1545 | $form['gravatar']['#weight'] = 15; |
1546 | - $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
1546 | + $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">'.bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community').'</a></legend>'; |
|
1547 | 1547 | // Upload an avatar (pulled from profile_node_form): |
1548 | 1548 | if (!empty($profile_form['field_image'])) { |
1549 | 1549 | $form['field_image'] = $profile_form['field_image']; |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | ); |
1579 | 1579 | // Can't have a typical Drupal form suffix on a select box? |
1580 | 1580 | $form['forums']['comments_per_page_suffix'] = array( |
1581 | - '#value' => '<span>' . bts('comments per page', array(), NULL, 'boinc:account-preferences-community') . '</span>' |
|
1581 | + '#value' => '<span>'.bts('comments per page', array(), NULL, 'boinc:account-preferences-community').'</span>' |
|
1582 | 1582 | ); |
1583 | 1583 | $form['forums']['comments_order'] = array( |
1584 | 1584 | '#type' => 'select', |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | '#weight' => 1002, |
1632 | 1632 | ); |
1633 | 1633 | $form['form control tabs'] = array( |
1634 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1634 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
1635 | 1635 | '#weight' => 1003, |
1636 | 1636 | ); |
1637 | 1637 | $form['form control tabs suffix'] = array( |
@@ -1717,10 +1717,10 @@ discard block |
||
1717 | 1717 | if ($user->language != $edit['language']) { |
1718 | 1718 | global $base_url; |
1719 | 1719 | if ($edit['language'] != language_default('language')) { |
1720 | - $form_state['redirect'] = $base_url . '/' . $edit['language'] . '/' . $_GET['q']; |
|
1720 | + $form_state['redirect'] = $base_url.'/'.$edit['language'].'/'.$_GET['q']; |
|
1721 | 1721 | } |
1722 | 1722 | else { |
1723 | - $form_state['redirect'] = $base_url . '/' . $_GET['q']; |
|
1723 | + $form_state['redirect'] = $base_url.'/'.$_GET['q']; |
|
1724 | 1724 | } |
1725 | 1725 | } |
1726 | 1726 | } |
@@ -1790,7 +1790,7 @@ discard block |
||
1790 | 1790 | // option that deals with privacy. |
1791 | 1791 | foreach ($privacy_consent_types as $ct) { |
1792 | 1792 | |
1793 | - $currstate = (check_user_consent($boincuser, $ct['shortname'])) ? 1 : 0 ; |
|
1793 | + $currstate = (check_user_consent($boincuser, $ct['shortname'])) ? 1 : 0; |
|
1794 | 1794 | // Set name to 'privacyconsent_SHORTNAME', which can be parsed |
1795 | 1795 | // later in the submit function. |
1796 | 1796 | $form['privacy']['privacyconsent_'.$ct['shortname']] = array( |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | // Add a description with link to the question 'Do you consent to |
1805 | 1805 | // exporting your data...'. |
1806 | 1806 | $mypatt = '/Do you consent to exporting your data/'; |
1807 | - if (preg_match($mypatt, $ct['description']) ) { |
|
1807 | + if (preg_match($mypatt, $ct['description'])) { |
|
1808 | 1808 | $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
1809 | 1809 | array( |
1810 | 1810 | '!privacy_policy_link' => l( |
@@ -1843,7 +1843,7 @@ discard block |
||
1843 | 1843 | $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
1844 | 1844 | '#value' => l( |
1845 | 1845 | bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
1846 | - 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
|
1846 | + 'account/prefs/privacy/ignore_user/remove/'.$ignored_user['iuid'], |
|
1847 | 1847 | array() |
1848 | 1848 | ), |
1849 | 1849 | ); |
@@ -1894,7 +1894,7 @@ discard block |
||
1894 | 1894 | '#suffix' => '</li>' |
1895 | 1895 | ); |
1896 | 1896 | $form['prefs']['form control tabs'] = array( |
1897 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
1897 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>' |
|
1898 | 1898 | ); |
1899 | 1899 | $form['prefs']['form control tabs suffix'] = array( |
1900 | 1900 | '#value' => '</ul>' |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | $privacyconsent_prefs = array_intersect_key($form_state['values'], array_flip($result)); |
1982 | 1982 | foreach ($privacyconsent_prefs as $name => $newstate) { |
1983 | 1983 | $subname = explode('_', $name)[1]; |
1984 | - $currstate = (check_user_consent($boincuser, $subname)) ? 1 : 0 ; |
|
1984 | + $currstate = (check_user_consent($boincuser, $subname)) ? 1 : 0; |
|
1985 | 1985 | list($checkct, $ctid) = check_consent_type($subname); |
1986 | 1986 | if ($checkct && ($currstate != $newstate)) { |
1987 | 1987 | consent_to_a_policy($boincuser, $ctid, $newstate, 0, 'Webform', time()); |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | function boincwork_selectapp_form_submit($form, &$form_state) { |
2048 | 2048 | $myargs = arg(); |
2049 | 2049 | array_pop($myargs); |
2050 | - $newpath = implode('/', $myargs ) . '/' . $form['selectapp']['#value']; |
|
2050 | + $newpath = implode('/', $myargs).'/'.$form['selectapp']['#value']; |
|
2051 | 2051 | $form_state['redirect'] = $newpath; |
2052 | 2052 | } |
2053 | 2053 |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * The structure of the general preferences form |
16 | 16 | */ |
17 | -function boincwork_generalprefs_form(&$form_state, $venue, $prefs_preset = null, $advanced = FALSE) { |
|
17 | +function boincwork_generalprefs_form(&$form_state, $venue, $prefs_preset = null, $advanced = false) { |
|
18 | 18 | $form = array(); |
19 | 19 | $prefs = null; |
20 | - $established = TRUE; |
|
20 | + $established = true; |
|
21 | 21 | |
22 | 22 | // Enable AHAH form support for dynamically updating content based on preset |
23 | 23 | ahah_helper_register($form, $form_state); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // Take note if this is not an established preference set on the account |
34 | 34 | if (isset($prefs['@attributes']['cleared'])) { |
35 | - $established = FALSE; |
|
35 | + $established = false; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Determine if a preset is selected or if these are custom settings |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | break; |
71 | 71 | }// switch |
72 | 72 | } else { |
73 | - $form_state['storage']['wip'] = TRUE; |
|
73 | + $form_state['storage']['wip'] = true; |
|
74 | 74 | if ( !in_array($prefs_preset, array('standard','maximum','green','minimum','custom')) ) { |
75 | 75 | if ($established) { |
76 | 76 | $prefs_preset = 'custom'; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // Standard option sets |
138 | 138 | $form['boolean_options'] = array( |
139 | 139 | '#type' => 'value', |
140 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
140 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
141 | 141 | ); |
142 | 142 | $form['hour_options'] = array( |
143 | 143 | '#type' => 'value', |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | '#prefix' => '<div id="prefs-wrapper">', // This is our wrapper div. |
159 | 159 | '#attributes' => array('class' => 'ahah-container'), |
160 | 160 | '#suffix' => '</div>', |
161 | - '#tree' => TRUE |
|
161 | + '#tree' => true |
|
162 | 162 | ); |
163 | 163 | //$form['prefs']['debug'] = array('#value' => '<pre>' . print_r($form_state, true) . '</pre>'); |
164 | 164 | |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | |
179 | 179 | // Simplified selectors |
180 | 180 | $form['prefs']['preset'] = array( |
181 | - '#title' => bts('Presets', array(), NULL, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
181 | + '#title' => bts('Presets', array(), null, 'boinc:account-preferences-preset:-1:for a user to choose a computing or project preference preset.'), |
|
182 | 182 | '#type' => 'radios', |
183 | 183 | '#description' => ' ', |
184 | 184 | '#options' => array( |
185 | - 'standard' => bts('Standard', array(), NULL, 'boinc:account-preferences-preset'), |
|
186 | - 'maximum' => bts('Maximum', array(), NULL, 'boinc:account-preferences-preset'), |
|
187 | - 'green' => bts('Green', array(), NULL, 'boinc:account-preferences-preset'), |
|
188 | - 'minimum' => bts('Minimum', array(), NULL, 'boinc:account-preferences-preset'), |
|
189 | - 'custom' => bts('Custom', array(), NULL, 'boinc:account-preferences-preset') |
|
185 | + 'standard' => bts('Standard', array(), null, 'boinc:account-preferences-preset'), |
|
186 | + 'maximum' => bts('Maximum', array(), null, 'boinc:account-preferences-preset'), |
|
187 | + 'green' => bts('Green', array(), null, 'boinc:account-preferences-preset'), |
|
188 | + 'minimum' => bts('Minimum', array(), null, 'boinc:account-preferences-preset'), |
|
189 | + 'custom' => bts('Custom', array(), null, 'boinc:account-preferences-preset') |
|
190 | 190 | ), |
191 | 191 | '#prefix' => '<div class="simple-form-controls">', |
192 | 192 | '#suffix' => '</div>', |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | ); |
200 | 200 | $form['prefs']['select preset'] = array( |
201 | 201 | '#type' => 'submit', |
202 | - '#value' => bts('Update preset', array(), NULL, 'boinc:account-preferences-preset'), |
|
202 | + '#value' => bts('Update preset', array(), null, 'boinc:account-preferences-preset'), |
|
203 | 203 | '#submit' => array('ahah_helper_generic_submit'), |
204 | 204 | // The 'no-js' class only displays this button if javascript is disabled |
205 | 205 | '#attributes' => array('class' => 'no-js'), |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | |
208 | 208 | // Advanced preferences |
209 | 209 | $form['prefs']['advanced'] = array( |
210 | - '#title' => bts('Advanced settings', array(), NULL, 'boinc:account-preferences-option'), |
|
210 | + '#title' => bts('Advanced settings', array(), null, 'boinc:account-preferences-option'), |
|
211 | 211 | '#type' => 'fieldset', |
212 | 212 | '#description' => '', |
213 | - '#collapsible' => TRUE, |
|
213 | + '#collapsible' => true, |
|
214 | 214 | '#collapsed' => !$advanced, |
215 | 215 | '#attributes' => array('class' => 'advanced-settings'), |
216 | 216 | ); |
@@ -226,62 +226,62 @@ discard block |
||
226 | 226 | ); |
227 | 227 | |
228 | 228 | $form['prefs']['advanced']['processor'] = array( |
229 | - '#title' => bts('Processor usage', array(), NULL, 'boinc:account-preferences-computing'), |
|
229 | + '#title' => bts('Processor usage', array(), null, 'boinc:account-preferences-computing'), |
|
230 | 230 | '#type' => 'fieldset', |
231 | 231 | '#description' => '', |
232 | - '#collapsible' => FALSE, |
|
233 | - '#collapsed' => FALSE |
|
232 | + '#collapsible' => false, |
|
233 | + '#collapsed' => false |
|
234 | 234 | ); |
235 | 235 | $form['prefs']['advanced']['processor']['run_on_batteries'] = array( |
236 | - '#title' => bts('Suspend when computer is on battery?', array(), NULL, 'boinc:account-preferences-computing'), |
|
236 | + '#title' => bts('Suspend when computer is on battery?', array(), null, 'boinc:account-preferences-computing'), |
|
237 | 237 | '#type' => 'radios', |
238 | - '#description' => bts('Suspends computing on portables when running on battery power.', array(), NULL, 'boinc:account-preferences-computing'), |
|
238 | + '#description' => bts('Suspends computing on portables when running on battery power.', array(), null, 'boinc:account-preferences-computing'), |
|
239 | 239 | '#options' => $form['boolean_options']['#value'], |
240 | 240 | '#attributes' => array('class' => 'fancy'), |
241 | 241 | '#default_value' => ($default['run_on_batteries']) ? 0 : 1 // intentional inversion of setting |
242 | 242 | ); |
243 | 243 | $form['prefs']['advanced']['processor']['run_if_user_active'] = array( |
244 | - '#title' => bts('Suspend when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
|
244 | + '#title' => bts('Suspend when computer is in use?', array(), null, 'boinc:account-preferences-computing'), |
|
245 | 245 | '#type' => 'radios', |
246 | - '#description' => bts("Suspends computing and file transfers when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
|
246 | + '#description' => bts("Suspends computing and file transfers when you're using the computer.", array(), null, 'boinc:account-preferences-computing'), |
|
247 | 247 | '#options' => $form['boolean_options']['#value'], |
248 | 248 | '#attributes' => array('class' => 'fancy'), |
249 | 249 | '#default_value' => ($default['run_if_user_active']) ? 0 : 1 // intentional inversion of setting |
250 | 250 | ); |
251 | 251 | $form['prefs']['advanced']['processor']['run_gpu_if_user_active'] = array( |
252 | - '#title' => bts('Suspend GPU computing when computer is in use?', array(), NULL, 'boinc:account-preferences-computing'), |
|
252 | + '#title' => bts('Suspend GPU computing when computer is in use?', array(), null, 'boinc:account-preferences-computing'), |
|
253 | 253 | '#type' => 'radios', |
254 | - '#description' => bts("Suspends GPU computing when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing'), |
|
254 | + '#description' => bts("Suspends GPU computing when you're using the computer.", array(), null, 'boinc:account-preferences-computing'), |
|
255 | 255 | '#options' => $form['boolean_options']['#value'], |
256 | 256 | '#attributes' => array('class' => 'fancy'), |
257 | 257 | '#default_value' => ($default['run_gpu_if_user_active']) ? 0 : 1 // intentional inversion of setting |
258 | 258 | ); |
259 | 259 | $form['prefs']['advanced']['processor']['idle_time_to_run'] = array( |
260 | - '#title' => bts('"In use" means mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
260 | + '#title' => bts('"In use" means mouse/keyboard input in last', array(), null, 'boinc:account-preferences-computing'), |
|
261 | 261 | '#type' => 'textfield', |
262 | - '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
|
262 | + '#field_suffix' => bts('minutes', array(), null, 'boinc:unit-of-time'), |
|
263 | 263 | '#default_value' => $default['idle_time_to_run'], |
264 | 264 | '#size' => 1, |
265 | - '#description' => bts('This determines when the computer is considered "in use".', array(), NULL, 'boinc:account-preferences-computing') |
|
265 | + '#description' => bts('This determines when the computer is considered "in use".', array(), null, 'boinc:account-preferences-computing') |
|
266 | 266 | ); |
267 | 267 | $form['prefs']['advanced']['processor']['suspend_if_no_recent_input'] = array( |
268 | - '#title' => bts('Suspend when no mouse/keyboard input in last', array(), NULL, 'boinc:account-preferences-computing'), |
|
268 | + '#title' => bts('Suspend when no mouse/keyboard input in last', array(), null, 'boinc:account-preferences-computing'), |
|
269 | 269 | '#type' => 'textfield', |
270 | - '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
|
270 | + '#field_suffix' => bts('minutes', array(), null, 'boinc:unit-of-time'), |
|
271 | 271 | '#default_value' => $default['suspend_if_no_recent_input'], |
272 | 272 | '#size' => 1, |
273 | - '#description' => bts('This allows some computers to enter low-power mode when not in use.', array(), NULL, 'boinc:account-preferences-computing') |
|
273 | + '#description' => bts('This allows some computers to enter low-power mode when not in use.', array(), null, 'boinc:account-preferences-computing') |
|
274 | 274 | ); |
275 | 275 | $form['prefs']['advanced']['processor']['suspend_cpu_usage'] = array( |
276 | - '#title' => bts('Suspend when non-BOINC CPU usage is above', array(), NULL, 'boinc:account-preferences-computing'), |
|
276 | + '#title' => bts('Suspend when non-BOINC CPU usage is above', array(), null, 'boinc:account-preferences-computing'), |
|
277 | 277 | '#type' => 'textfield', |
278 | 278 | '#field_suffix' => '%', |
279 | 279 | '#default_value' => $default['suspend_cpu_usage'], |
280 | 280 | '#size' => 1, |
281 | - '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), NULL, 'boinc:account-preferences-computing'), |
|
281 | + '#description' => bts('Suspend computing when your computer is busy running other programs.', array(), null, 'boinc:account-preferences-computing'), |
|
282 | 282 | ); |
283 | 283 | $form['prefs']['advanced']['processor']['hour_label'] = array( |
284 | - '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
284 | + '#value' => '<div class="form-item"><label>' . bts('Compute only between:', array(), null, 'boinc:account-preferences-computing') . '</label></div>' |
|
285 | 285 | ); |
286 | 286 | $form['prefs']['advanced']['processor']['start_hour'] = array( |
287 | 287 | '#type' => 'select', |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | '#default_value' => $default['start_hour'] |
290 | 290 | ); |
291 | 291 | $form['prefs']['advanced']['processor']['hour_delimiter'] = array( |
292 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
292 | + '#value' => '<span>' . bts('and', array(), null, 'boinc:account-preference') . '</span>' |
|
293 | 293 | ); |
294 | 294 | $form['prefs']['advanced']['processor']['end_hour'] = array( |
295 | 295 | '#type' => 'select', |
@@ -297,164 +297,164 @@ discard block |
||
297 | 297 | '#default_value' => $default['end_hour'] |
298 | 298 | ); |
299 | 299 | $form['prefs']['advanced']['processor']['hour_description'] = array( |
300 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
300 | + '#value' => '<div class="form-item slim"><div class="description">' . bts('Compute only during a particular period each day.', array(), null, 'boinc:account-preferences-computing') . '</div></div>' |
|
301 | 301 | ); |
302 | 302 | $form['prefs']['advanced']['processor']['leave_apps_in_memory'] = array( |
303 | - '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), NULL, 'boinc:account-preferences-computing'), |
|
303 | + '#title' => bts('Leave non-GPU tasks in memory while suspended?', array(), null, 'boinc:account-preferences-computing'), |
|
304 | 304 | '#type' => 'radios', |
305 | 305 | '#options' => $form['boolean_options']['#value'], |
306 | 306 | '#attributes' => array('class' => 'fancy'), |
307 | 307 | '#default_value' => $default['leave_apps_in_memory'], |
308 | - '#description' => bts('If "Yes", suspended tasks stay in memory, and resume with no work lost. If "No", suspended tasks are removed from memory, and resume from their last checkpoint.', array(), NULL, 'boinc:account-preferences-computing') |
|
308 | + '#description' => bts('If "Yes", suspended tasks stay in memory, and resume with no work lost. If "No", suspended tasks are removed from memory, and resume from their last checkpoint.', array(), null, 'boinc:account-preferences-computing') |
|
309 | 309 | ); |
310 | 310 | $form['prefs']['advanced']['processor']['cpu_scheduling_period_minutes'] = array( |
311 | - '#title' => bts('Switch between tasks every', array(), NULL, 'boinc:account-preferences-computing'), |
|
311 | + '#title' => bts('Switch between tasks every', array(), null, 'boinc:account-preferences-computing'), |
|
312 | 312 | '#type' => 'textfield', |
313 | - '#field_suffix' => bts('minutes', array(), NULL, 'boinc:unit-of-time'), |
|
313 | + '#field_suffix' => bts('minutes', array(), null, 'boinc:unit-of-time'), |
|
314 | 314 | '#default_value' => $default['cpu_scheduling_period_minutes'], |
315 | 315 | '#size' => 1, |
316 | - '#description' => bts('If you run several projects, BOINC may switch between them this often.', array(), NULL, 'boinc:account-preferences-computing') |
|
316 | + '#description' => bts('If you run several projects, BOINC may switch between them this often.', array(), null, 'boinc:account-preferences-computing') |
|
317 | 317 | ); |
318 | 318 | $form['prefs']['advanced']['processor']['max_ncpus_pct'] = array( |
319 | - '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
319 | + '#title' => bts('Use at most', array(), null, 'boinc:account-preferences-computing'), |
|
320 | 320 | '#type' => 'textfield', |
321 | - '#field_suffix' => bts('% of the processors', array(), NULL, 'boinc:account-preferences-computing'), |
|
321 | + '#field_suffix' => bts('% of the processors', array(), null, 'boinc:account-preferences-computing'), |
|
322 | 322 | '#default_value' => $default['max_ncpus_pct'], |
323 | 323 | '#size' => 1, |
324 | - '#description' => bts('Keep some CPUs free for other applications. Example: 75% means use 6 cores on an 8-core CPU.', array(), NULL, 'boinc:account-preferences-computing'), |
|
324 | + '#description' => bts('Keep some CPUs free for other applications. Example: 75% means use 6 cores on an 8-core CPU.', array(), null, 'boinc:account-preferences-computing'), |
|
325 | 325 | ); |
326 | 326 | $form['prefs']['advanced']['processor']['cpu_usage_limit'] = array( |
327 | - '#title' => bts('Use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
327 | + '#title' => bts('Use at most', array(), null, 'boinc:account-preferences-computing'), |
|
328 | 328 | '#type' => 'textfield', |
329 | - '#field_suffix' => bts('% of the CPU time', array(), NULL, 'boinc:account-preferences-computing'), |
|
329 | + '#field_suffix' => bts('% of the CPU time', array(), null, 'boinc:account-preferences-computing'), |
|
330 | 330 | '#default_value' => $default['cpu_usage_limit'], |
331 | 331 | '#size' => 1, |
332 | - '#description' => bts('Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat.', array(), NULL, 'boinc:account-preferences-computing') |
|
332 | + '#description' => bts('Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat.', array(), null, 'boinc:account-preferences-computing') |
|
333 | 333 | ); |
334 | 334 | |
335 | 335 | // Disk and memory preferences |
336 | 336 | $form['prefs']['advanced']['storage'] = array( |
337 | - '#title' => bts('Disk and memory usage', array(), NULL, 'boinc:account-preferences-computing'), |
|
337 | + '#title' => bts('Disk and memory usage', array(), null, 'boinc:account-preferences-computing'), |
|
338 | 338 | '#type' => 'fieldset', |
339 | 339 | '#description' => '', |
340 | - '#collapsible' => FALSE, |
|
341 | - '#collapsed' => FALSE |
|
340 | + '#collapsible' => false, |
|
341 | + '#collapsed' => false |
|
342 | 342 | ); |
343 | 343 | $form['prefs']['advanced']['storage']['disk_max_used_gb'] = array( |
344 | - '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
|
344 | + '#title' => bts('Disk: use no more than', array(), null, 'boinc:account-preferences-computing'), |
|
345 | 345 | '#type' => 'textfield', |
346 | 346 | '#field_suffix' => 'GB', |
347 | 347 | '#default_value' => $default['disk_max_used_gb'], |
348 | 348 | '#size' => 1, |
349 | - '#description' => bts('Limit the total amount of disk space used by BOINC.', array(), NULL, 'boinc:account-preferences-computing'), |
|
349 | + '#description' => bts('Limit the total amount of disk space used by BOINC.', array(), null, 'boinc:account-preferences-computing'), |
|
350 | 350 | ); |
351 | 351 | $form['prefs']['advanced']['storage']['disk_min_free_gb'] = array( |
352 | - '#title' => bts('Disk: leave at least', array(), NULL, 'boinc:account-preferences-computing'), |
|
352 | + '#title' => bts('Disk: leave at least', array(), null, 'boinc:account-preferences-computing'), |
|
353 | 353 | '#type' => 'textfield', |
354 | 354 | '#field_suffix' => 'GB free', |
355 | 355 | '#default_value' => $default['disk_min_free_gb'], |
356 | 356 | '#size' => 1, |
357 | - '#description' => bts('Limit disk usage to leave this much free space on the volume where BOINC stores data.', array(), NULL, 'boinc:account-preferences-computing'), |
|
357 | + '#description' => bts('Limit disk usage to leave this much free space on the volume where BOINC stores data.', array(), null, 'boinc:account-preferences-computing'), |
|
358 | 358 | ); |
359 | 359 | $form['prefs']['advanced']['storage']['disk_max_used_pct'] = array( |
360 | - '#title' => bts('Disk: use no more than', array(), NULL, 'boinc:account-preferences-computing'), |
|
360 | + '#title' => bts('Disk: use no more than', array(), null, 'boinc:account-preferences-computing'), |
|
361 | 361 | '#type' => 'textfield', |
362 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
362 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
363 | 363 | '#default_value' => $default['disk_max_used_pct'], |
364 | 364 | '#size' => 1, |
365 | - '#description' => bts('Limit the percentage of disk space used by BOINC on the volume where it stores data.', array(), NULL, 'boinc:account-preferences-computing') |
|
365 | + '#description' => bts('Limit the percentage of disk space used by BOINC on the volume where it stores data.', array(), null, 'boinc:account-preferences-computing') |
|
366 | 366 | ); |
367 | 367 | $form['prefs']['advanced']['storage']['disk_interval'] = array( |
368 | - '#title' => bts('Request tasks to checkpoint at most every', array(), NULL, 'boinc:account-preferences-computing'), |
|
368 | + '#title' => bts('Request tasks to checkpoint at most every', array(), null, 'boinc:account-preferences-computing'), |
|
369 | 369 | '#type' => 'textfield', |
370 | - '#field_suffix' => bts('seconds', array(), NULL, 'boinc:unit-of-time'), |
|
370 | + '#field_suffix' => bts('seconds', array(), null, 'boinc:unit-of-time'), |
|
371 | 371 | '#default_value' => $default['disk_interval'], |
372 | 372 | '#size' => 1, |
373 | - '#description' => bts('This controls how often tasks save their state to disk, so that later they can be continued from that point.', array(), NULL, 'boinc:account-preferences-computing') |
|
373 | + '#description' => bts('This controls how often tasks save their state to disk, so that later they can be continued from that point.', array(), null, 'boinc:account-preferences-computing') |
|
374 | 374 | ); |
375 | 375 | $form['prefs']['advanced']['storage']['vm_max_used_pct'] = array( |
376 | - '#title' => bts('Page/swap file: use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
376 | + '#title' => bts('Page/swap file: use at most', array(), null, 'boinc:account-preferences-computing'), |
|
377 | 377 | '#type' => 'textfield', |
378 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
378 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
379 | 379 | '#default_value' => $default['vm_max_used_pct'], |
380 | 380 | '#size' => 1, |
381 | - '#description' => bts('Limit the swap space (page file) used by BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
|
381 | + '#description' => bts('Limit the swap space (page file) used by BOINC.', array(), null, 'boinc:account-preferences-computing') |
|
382 | 382 | ); |
383 | 383 | $form['prefs']['advanced']['storage']['ram_max_used_busy_pct'] = array( |
384 | - '#title' => bts('Memory: when computer is in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
384 | + '#title' => bts('Memory: when computer is in use, use at most', array(), null, 'boinc:account-preferences-computing'), |
|
385 | 385 | '#type' => 'textfield', |
386 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
386 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
387 | 387 | '#default_value' => $default['ram_max_used_busy_pct'], |
388 | 388 | '#size' => 1, |
389 | - '#description' => bts("Limit the memory used by BOINC when you're using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
|
389 | + '#description' => bts("Limit the memory used by BOINC when you're using the computer.", array(), null, 'boinc:account-preferences-computing') |
|
390 | 390 | ); |
391 | 391 | $form['prefs']['advanced']['storage']['ram_max_used_idle_pct'] = array( |
392 | - '#title' => bts('Memory: when computer is not in use, use at most', array(), NULL, 'boinc:account-preferences-computing'), |
|
392 | + '#title' => bts('Memory: when computer is not in use, use at most', array(), null, 'boinc:account-preferences-computing'), |
|
393 | 393 | '#type' => 'textfield', |
394 | - '#field_suffix' => bts('% of total', array(), NULL, 'boinc:account-preferences-computing'), |
|
394 | + '#field_suffix' => bts('% of total', array(), null, 'boinc:account-preferences-computing'), |
|
395 | 395 | '#default_value' => $default['ram_max_used_idle_pct'], |
396 | 396 | '#size' => 1, |
397 | - '#description' => bts("Limit the memory used by BOINC when you're not using the computer.", array(), NULL, 'boinc:account-preferences-computing') |
|
397 | + '#description' => bts("Limit the memory used by BOINC when you're not using the computer.", array(), null, 'boinc:account-preferences-computing') |
|
398 | 398 | ); |
399 | 399 | |
400 | 400 | // Network preferences |
401 | 401 | $form['prefs']['advanced']['network'] = array( |
402 | - '#title' => bts('Network usage', array(), NULL, 'boinc:account-preferences-computing'), |
|
402 | + '#title' => bts('Network usage', array(), null, 'boinc:account-preferences-computing'), |
|
403 | 403 | '#type' => 'fieldset', |
404 | 404 | '#description' => '', |
405 | - '#collapsible' => FALSE, |
|
406 | - '#collapsed' => FALSE |
|
405 | + '#collapsible' => false, |
|
406 | + '#collapsed' => false |
|
407 | 407 | ); |
408 | 408 | $form['prefs']['advanced']['network']['work_buf_min_days'] = array( |
409 | - '#title' => bts('Store at least', array(), NULL, 'boinc:account-preferences-computing'), |
|
409 | + '#title' => bts('Store at least', array(), null, 'boinc:account-preferences-computing'), |
|
410 | 410 | '#type' => 'textfield', |
411 | - '#field_suffix' => bts('days of work', array(), NULL, 'boinc:account-preferences-computing'), |
|
411 | + '#field_suffix' => bts('days of work', array(), null, 'boinc:account-preferences-computing'), |
|
412 | 412 | '#default_value' => $default['work_buf_min_days'], |
413 | 413 | '#size' => 1, |
414 | - '#description' => bts('Store at least enough tasks to keep the computer busy for this long.', array(), NULL, 'boinc:account-preferences-computing') |
|
414 | + '#description' => bts('Store at least enough tasks to keep the computer busy for this long.', array(), null, 'boinc:account-preferences-computing') |
|
415 | 415 | ); |
416 | 416 | $form['prefs']['advanced']['network']['work_buf_additional_days'] = array( |
417 | - '#title' => bts('Store up to an additional', array(), NULL, 'boinc:account-preferences-computing'), |
|
417 | + '#title' => bts('Store up to an additional', array(), null, 'boinc:account-preferences-computing'), |
|
418 | 418 | '#type' => 'textfield', |
419 | - '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
|
419 | + '#field_suffix' => bts('days', array(), null, 'boinc:unit-of-time'), |
|
420 | 420 | '#default_value' => $default['work_buf_additional_days'], |
421 | 421 | '#size' => 1, |
422 | - '#description' => bts('Store additional tasks above the minimum level. Determines how much work is requested when contacting a project.', array(), NULL, 'boinc:account-preferences-computing') |
|
422 | + '#description' => bts('Store additional tasks above the minimum level. Determines how much work is requested when contacting a project.', array(), null, 'boinc:account-preferences-computing') |
|
423 | 423 | ); |
424 | 424 | $form['prefs']['advanced']['network']['confirm_before_connecting'] = array( |
425 | - '#title' => bts('Confirm before connecting to Internet?', array(), NULL, 'boinc:account-preferences-computing'), |
|
425 | + '#title' => bts('Confirm before connecting to Internet?', array(), null, 'boinc:account-preferences-computing'), |
|
426 | 426 | '#type' => 'radios', |
427 | 427 | '#options' => $form['boolean_options']['#value'], |
428 | 428 | '#attributes' => array('class' => 'fancy'), |
429 | 429 | '#default_value' => $default['confirm_before_connecting'], |
430 | - '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
|
430 | + '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), null, 'boinc:account-preferences-computing') |
|
431 | 431 | ); |
432 | 432 | $form['prefs']['advanced']['network']['hangup_if_dialed'] = array( |
433 | - '#title' => bts('Disconnect when done?', array(), NULL, 'boinc:account-preferences-computing'), |
|
433 | + '#title' => bts('Disconnect when done?', array(), null, 'boinc:account-preferences-computing'), |
|
434 | 434 | '#type' => 'radios', |
435 | 435 | '#options' => $form['boolean_options']['#value'], |
436 | 436 | '#attributes' => array('class' => 'fancy'), |
437 | 437 | '#default_value' => $default['hangup_if_dialed'], |
438 | - '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), NULL, 'boinc:account-preferences-computing') |
|
438 | + '#description' => bts('Useful only if you have a modem, ISDN or VPN connection.', array(), null, 'boinc:account-preferences-computing') |
|
439 | 439 | ); |
440 | 440 | $form['prefs']['advanced']['network']['max_bytes_sec_down'] = array( |
441 | - '#title' => bts('Limit download rate to', array(), NULL, 'boinc:account-preferences-computing'), |
|
441 | + '#title' => bts('Limit download rate to', array(), null, 'boinc:account-preferences-computing'), |
|
442 | 442 | '#type' => 'textfield', |
443 | 443 | '#field_suffix' => 'Kbytes/sec', |
444 | 444 | '#default_value' => $default['max_bytes_sec_down']/1000, |
445 | 445 | '#size' => 1, |
446 | - '#description' => bts('Limit the download rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
|
446 | + '#description' => bts('Limit the download rate of file transfers.', array(), null, 'boinc:account-preferences-computing') |
|
447 | 447 | ); |
448 | 448 | $form['prefs']['advanced']['network']['max_bytes_sec_up'] = array( |
449 | - '#title' => bts('Limit upload rate to', array(), NULL, 'boinc:account-preferences-computing'), |
|
449 | + '#title' => bts('Limit upload rate to', array(), null, 'boinc:account-preferences-computing'), |
|
450 | 450 | '#type' => 'textfield', |
451 | 451 | '#field_suffix' => 'Kbytes/sec', |
452 | 452 | '#default_value' => $default['max_bytes_sec_up']/1000, |
453 | 453 | '#size' => 1, |
454 | - '#description' => bts('Limit the upload rate of file transfers.', array(), NULL, 'boinc:account-preferences-computing') |
|
454 | + '#description' => bts('Limit the upload rate of file transfers.', array(), null, 'boinc:account-preferences-computing') |
|
455 | 455 | ); |
456 | 456 | $form['prefs']['advanced']['network']['hour_label'] = array( |
457 | - '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), NULL, 'boinc:account-preferences-computing') . '</label></div>' |
|
457 | + '#value' => '<div class="form-item"><label>' . bts('Transfer files only between', array(), null, 'boinc:account-preferences-computing') . '</label></div>' |
|
458 | 458 | ); |
459 | 459 | $form['prefs']['advanced']['network']['net_start_hour'] = array( |
460 | 460 | '#type' => 'select', |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | '#default_value' => $default['net_start_hour'] |
463 | 463 | ); |
464 | 464 | $form['prefs']['advanced']['network']['hour_delimiter'] = array( |
465 | - '#value' => '<span>' . bts('and', array(), NULL, 'boinc:account-preference') . '</span>' |
|
465 | + '#value' => '<span>' . bts('and', array(), null, 'boinc:account-preference') . '</span>' |
|
466 | 466 | ); |
467 | 467 | $form['prefs']['advanced']['network']['net_end_hour'] = array( |
468 | 468 | '#type' => 'select', |
@@ -470,10 +470,10 @@ discard block |
||
470 | 470 | '#default_value' => $default['net_end_hour'] |
471 | 471 | ); |
472 | 472 | $form['prefs']['advanced']['network']['hour_description'] = array( |
473 | - '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), NULL, 'boinc:account-preferences-computing') . '</div></div>' |
|
473 | + '#value' => '<div class="form-item slim"><div class="description">' . bts('Transfer files only during a particular period each day.', array(), null, 'boinc:account-preferences-computing') . '</div></div>' |
|
474 | 474 | ); |
475 | 475 | $form['prefs']['advanced']['network']['daily_xfer_limit_mb'] = array( |
476 | - '#title' => bts('Limit usage to', array(), NULL, 'boinc:account-preferences-computing'), |
|
476 | + '#title' => bts('Limit usage to', array(), null, 'boinc:account-preferences-computing'), |
|
477 | 477 | '#type' => 'textfield', |
478 | 478 | '#field_suffix' => 'Mbytes', |
479 | 479 | '#default_value' => $default['daily_xfer_limit_mb'], |
@@ -482,18 +482,18 @@ discard block |
||
482 | 482 | $form['prefs']['advanced']['network']['daily_xfer_period_days'] = array( |
483 | 483 | '#field_prefix' => 'every', |
484 | 484 | '#type' => 'textfield', |
485 | - '#field_suffix' => bts('days', array(), NULL, 'boinc:unit-of-time'), |
|
485 | + '#field_suffix' => bts('days', array(), null, 'boinc:unit-of-time'), |
|
486 | 486 | '#default_value' => $default['daily_xfer_period_days'], |
487 | 487 | '#size' => 1, |
488 | - '#description' => bts('Example: BOINC should transfer at most 2000 MB of data every 30 days.', array(), NULL, 'boinc:account-preferences-computing'), |
|
488 | + '#description' => bts('Example: BOINC should transfer at most 2000 MB of data every 30 days.', array(), null, 'boinc:account-preferences-computing'), |
|
489 | 489 | ); |
490 | 490 | $form['prefs']['advanced']['network']['dont_verify_images'] = array( |
491 | - '#title' => bts('Skip data verification for image files?', array(), NULL, 'boinc:account-preferences-computing'), |
|
491 | + '#title' => bts('Skip data verification for image files?', array(), null, 'boinc:account-preferences-computing'), |
|
492 | 492 | '#type' => 'radios', |
493 | 493 | '#options' => $form['boolean_options']['#value'], |
494 | 494 | '#attributes' => array('class' => 'fancy'), |
495 | 495 | '#default_value' => $default['dont_verify_images'], |
496 | - '#description' => bts('Only select "Yes" if your Internet provider modifies image files. Skipping verification reduces the security of BOINC.', array(), NULL, 'boinc:account-preferences-computing') |
|
496 | + '#description' => bts('Only select "Yes" if your Internet provider modifies image files. Skipping verification reduces the security of BOINC.', array(), null, 'boinc:account-preferences-computing') |
|
497 | 497 | ); |
498 | 498 | |
499 | 499 | // The "fancy radios" are made via javascript on document load. In order for |
@@ -526,27 +526,27 @@ discard block |
||
526 | 526 | $form['prefs']['submit'] = array( |
527 | 527 | '#prefix' => '<li class="first tab">', |
528 | 528 | '#type' => 'submit', |
529 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
529 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
530 | 530 | '#suffix' => '</li>' |
531 | 531 | ); |
532 | 532 | $form['prefs']['form control tabs'] = array( |
533 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
|
533 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), drupal_get_path_alias("account/prefs/computing/edit")) . '</li>' |
|
534 | 534 | ); |
535 | - if ($venue AND $venue != 'generic') { |
|
535 | + if ($venue and $venue != 'generic') { |
|
536 | 536 | global $base_path; |
537 | 537 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
538 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
538 | + l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/computing/clear/{$venue}", |
|
539 | 539 | array( |
540 | 540 | 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/computing/combined')), |
541 | 541 | 'attributes' => array( |
542 | 542 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
543 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
543 | + array('@name' => $venue), null, 'boinc:account-preferences') . '\')' |
|
544 | 544 | ) |
545 | 545 | ) |
546 | 546 | ) . '</li>'; |
547 | 547 | } |
548 | 548 | $form['prefs']['view control'] = array( |
549 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
|
549 | + '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/computing/combined') . '</li>' |
|
550 | 550 | ); |
551 | 551 | $form['prefs']['form control tabs suffix'] = array( |
552 | 552 | '#value' => '</ul>' |
@@ -567,33 +567,33 @@ discard block |
||
567 | 567 | // Verify all non-boolean user input values and notify form API of failures |
568 | 568 | |
569 | 569 | // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
578 | 578 | |
579 | 579 | // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
587 | 587 | |
588 | 588 | // 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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-prefrences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), NULL, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-prefrences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
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']}"), null, 'boinc:account-preferences-computing')); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | unset($prefs['@attributes']['preset']); |
654 | 654 | } |
655 | 655 | // Save the preset selection (or lack thereof) |
656 | - if (!$preset OR $preset == 'custom') { |
|
656 | + if (!$preset or $preset == 'custom') { |
|
657 | 657 | $prefs['preset'] = 'custom'; |
658 | 658 | } |
659 | 659 | else { |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | watchdog('boincwork', 'Error updating global prefs for user @id: @message', array('@id' => $account->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
673 | 673 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
674 | 674 | } |
675 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
675 | + elseif (!drupal_get_messages('status', false)) { |
|
676 | 676 | // Show this message if the set wasn't created automatically (in which case |
677 | 677 | // there is a message tailored to that) { |
678 | 678 | drupal_set_message(t('Your preferences have been updated. |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | )); |
707 | 707 | db_set_active('default'); |
708 | 708 | $current_host->task_count = boincwork_host_get_task_count($current_host->id); |
709 | - $current_host->is_new = !$current_host->total_credit AND !$current_host->task_count; |
|
709 | + $current_host->is_new = !$current_host->total_credit and !$current_host->task_count; |
|
710 | 710 | // Get the list of all other hosts owned by this user for comparison |
711 | 711 | db_set_active('boinc_ro'); |
712 | 712 | $all_other_hosts = db_query(" |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | // First, disqualify if hosts were active at the same time |
723 | 723 | if (!$current_host->is_new) { |
724 | 724 | $other_host->task_count = boincwork_host_get_task_count($other_host->id); |
725 | - $other_host->is_new = !$other_host->total_credit AND !$other_host->task_count; |
|
725 | + $other_host->is_new = !$other_host->total_credit and !$other_host->task_count; |
|
726 | 726 | if (!$other_host->is_new) { |
727 | 727 | // If both hosts being compared are not new, see if times overlap |
728 | 728 | if (!times_disjoint($current_host, $other_host)) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | /** |
756 | 756 | * Perform the database updates to merge the old host into the new host |
757 | 757 | */ |
758 | -function boincwork_host_merge($old_host, $new_host, &$message = NULL) { |
|
758 | +function boincwork_host_merge($old_host, $new_host, &$message = null) { |
|
759 | 759 | // Decay the average credit of the two hosts |
760 | 760 | require_boinc('credit'); |
761 | 761 | $now = time(); |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | WATCHDOG_WARNING |
782 | 782 | ); |
783 | 783 | $message = 'Could not merge due to a circular merge error. The site administrators have been contacted about this issue, and will investigate further.'; |
784 | - return FALSE; |
|
784 | + return false; |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | if ($new_host->userid==0) { |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | WATCHDOG_WARNING |
796 | 796 | ); |
797 | 797 | $message = 'Could not merge because the target host has userid=0. The site administrators have been contacted about this issue, and will investigate further.'; |
798 | - return FALSE; |
|
798 | + return false; |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | // Move credit from the old host to the new host |
@@ -811,10 +811,10 @@ discard block |
||
811 | 811 | ); |
812 | 812 | db_set_active('default'); |
813 | 813 | if (!$credit_updated) { |
814 | - if ($message !== NULL) { |
|
815 | - $message = bts('Could not update credit', array(), NULL, 'boinc:account-host-merge'); |
|
814 | + if ($message !== null) { |
|
815 | + $message = bts('Could not update credit', array(), null, 'boinc:account-host-merge'); |
|
816 | 816 | } |
817 | - return FALSE; |
|
817 | + return false; |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | // Move results from the old host to the new host |
@@ -827,10 +827,10 @@ discard block |
||
827 | 827 | ); |
828 | 828 | db_set_active('default'); |
829 | 829 | if (!$results_updated) { |
830 | - if ($message !== NULL) { |
|
831 | - $message = bts('Could not update results', array(), NULL, 'boinc:account-host-merge'); |
|
830 | + if ($message !== null) { |
|
831 | + $message = bts('Could not update results', array(), null, 'boinc:account-host-merge'); |
|
832 | 832 | } |
833 | - return FALSE; |
|
833 | + return false; |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | // Retire the old host |
@@ -847,13 +847,13 @@ discard block |
||
847 | 847 | ); |
848 | 848 | db_set_active('default'); |
849 | 849 | if (!$old_host_retired) { |
850 | - if ($message !== NULL) { |
|
851 | - $message = bts('Could not retire old computer', array(), NULL, 'boinc:account-host-merge'); |
|
850 | + if ($message !== null) { |
|
851 | + $message = bts('Could not retire old computer', array(), null, 'boinc:account-host-merge'); |
|
852 | 852 | } |
853 | - return FALSE; |
|
853 | + return false; |
|
854 | 854 | } |
855 | 855 | |
856 | - return TRUE; |
|
856 | + return true; |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | /** |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $form['overview'] = array( |
883 | 883 | '#value' => '<p>' . bts('Sometimes BOINC assigns separate identities to' |
884 | 884 | . ' the same computer by mistake. You can correct this by merging old' |
885 | - . ' identities with the newest one.', array(), NULL, 'boinc:account-host-merge') . '</p>' |
|
885 | + . ' identities with the newest one.', array(), null, 'boinc:account-host-merge') . '</p>' |
|
886 | 886 | . '<p>' |
887 | 887 | . bts('Check the computers that are the same as @name' |
888 | 888 | . ' (created on @date at @time with computer ID @id)', |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | '@time' => date('G:i:s T', $current_host->create_time), |
893 | 893 | '@id' => $current_host->id, |
894 | 894 | ), |
895 | - NULL, 'boinc:account-host-merge') . '</p>', |
|
895 | + null, 'boinc:account-host-merge') . '</p>', |
|
896 | 896 | ); |
897 | 897 | |
898 | 898 | $options = array(); |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | $form['merge'] = array( |
908 | 908 | '#title' => '', |
909 | 909 | '#type' => 'tableselect', |
910 | - '#header' => array(bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), bts('Created', array(), NULL, 'boinc:host-details'), bts('Computer ID', array(), NULL, 'boinc:host-list')), |
|
910 | + '#header' => array(bts('Name', array(), null, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'), bts('Created', array(), null, 'boinc:host-details'), bts('Computer ID', array(), null, 'boinc:host-list')), |
|
911 | 911 | '#options' => $options, |
912 | 912 | ); |
913 | 913 | |
@@ -922,11 +922,11 @@ discard block |
||
922 | 922 | $form['prefs']['submit'] = array( |
923 | 923 | '#prefix' => '<li class="first tab">', |
924 | 924 | '#type' => 'submit', |
925 | - '#value' => bts('Merge', array(), NULL, 'boinc:form-merge'), |
|
925 | + '#value' => bts('Merge', array(), null, 'boinc:form-merge'), |
|
926 | 926 | '#suffix' => '</li>' |
927 | 927 | ); |
928 | 928 | $form['prefs']['form control tabs'] = array( |
929 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
|
929 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), "host/{$host_id}") . '</li>' |
|
930 | 930 | ); |
931 | 931 | |
932 | 932 | return $form; |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | if ($merged) { |
965 | 965 | // Generate a natural language list of IDs that were merged |
966 | 966 | $oxford_comma = ','; |
967 | - $conjunction = bts('and', array(), NULL, 'boinc:account-preference'); |
|
967 | + $conjunction = bts('and', array(), null, 'boinc:account-preference'); |
|
968 | 968 | $list = array_keys($merged); |
969 | 969 | $last = array_pop($list); |
970 | 970 | if ($list) { |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | '@old_id' => $list, |
984 | 984 | '@id' => $current_host_id |
985 | 985 | ), |
986 | - NULL, 'boinc:account-host-merge')); |
|
986 | + null, 'boinc:account-host-merge')); |
|
987 | 987 | } |
988 | 988 | else { |
989 | 989 | drupal_set_message(bts( |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | '@old_ids' => $list, |
993 | 993 | '@id' => $current_host_id |
994 | 994 | ), |
995 | - NULL, 'boinc:account-host-merge')); |
|
995 | + null, 'boinc:account-host-merge')); |
|
996 | 996 | } |
997 | 997 | } |
998 | 998 | |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | '@old_id' => $id, |
1006 | 1006 | '@message' => $error, |
1007 | 1007 | ), |
1008 | - NULL, 'boinc:account-host-merge'), |
|
1008 | + null, 'boinc:account-host-merge'), |
|
1009 | 1009 | 'warning' |
1010 | 1010 | ); |
1011 | 1011 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | global $user; |
1027 | 1027 | $account = user_load($user->uid); |
1028 | 1028 | |
1029 | - $established = TRUE; |
|
1029 | + $established = true; |
|
1030 | 1030 | |
1031 | 1031 | // Get availability of special BOINC preferences |
1032 | 1032 | require_boinc(array('util')); |
@@ -1037,26 +1037,26 @@ discard block |
||
1037 | 1037 | |
1038 | 1038 | // Take note if this is not an established preference set on the account |
1039 | 1039 | if (isset($prefs['@attributes']['cleared'])) { |
1040 | - $established = FALSE; |
|
1040 | + $established = false; |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | // Extract modified tag if present |
1044 | - $modified = NULL; |
|
1044 | + $modified = null; |
|
1045 | 1045 | if (isset($prefs['modified']['@value'])) { |
1046 | 1046 | $modified = $prefs['modified']['@value']; |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - $venue_is_default = FALSE; |
|
1049 | + $venue_is_default = false; |
|
1050 | 1050 | if ($account->boincuser_default_pref_set) { |
1051 | 1051 | if ($account->boincuser_default_pref_set == $venue) { |
1052 | - $venue_is_default = TRUE; |
|
1052 | + $venue_is_default = true; |
|
1053 | 1053 | } |
1054 | 1054 | } |
1055 | - elseif (!$venue OR $venue == 'generic') { |
|
1056 | - $venue_is_default = TRUE; |
|
1055 | + elseif (!$venue or $venue == 'generic') { |
|
1056 | + $venue_is_default = true; |
|
1057 | 1057 | } |
1058 | 1058 | else { |
1059 | - $venue_is_default = FALSE; |
|
1059 | + $venue_is_default = false; |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | // Define form defaults |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | // Standard option sets |
1086 | 1086 | $form['boolean_options'] = array( |
1087 | 1087 | '#type' => 'value', |
1088 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
1088 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
1089 | 1089 | ); |
1090 | 1090 | |
1091 | 1091 | // Identify preference sets that are established to distinguish what has been |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | $form['#established'] = $established; |
1094 | 1094 | |
1095 | 1095 | // Top level form options |
1096 | - $form['#tree'] = TRUE; |
|
1096 | + $form['#tree'] = true; |
|
1097 | 1097 | |
1098 | 1098 | // Hidden elements |
1099 | 1099 | $form['modified'] = array( |
@@ -1111,77 +1111,77 @@ discard block |
||
1111 | 1111 | |
1112 | 1112 | // Common project preferences |
1113 | 1113 | $form['resource'] = array( |
1114 | - '#title' => bts('Resource settings', array(), NULL, 'boinc:account-preferences-project'), |
|
1114 | + '#title' => bts('Resource settings', array(), null, 'boinc:account-preferences-project'), |
|
1115 | 1115 | '#type' => 'fieldset', |
1116 | 1116 | '#description' => null, |
1117 | - '#collapsible' => TRUE, |
|
1118 | - '#collapsed' => FALSE |
|
1117 | + '#collapsible' => true, |
|
1118 | + '#collapsed' => false |
|
1119 | 1119 | ); |
1120 | 1120 | $form['resource']['resource_share'] = array( |
1121 | - '#title' => bts('Resource share', array(), NULL, 'boinc:account-preferences-project'), |
|
1121 | + '#title' => bts('Resource share', array(), null, 'boinc:account-preferences-project'), |
|
1122 | 1122 | '#type' => 'textfield', |
1123 | 1123 | '#default_value' => $default['resource_share'], |
1124 | 1124 | '#size' => 5, |
1125 | - '#description' => bts("Determines the proportion of your computer's resources allocated to this project. Example: if you participate in two BOINC projects with resource shares of 100 and 200, the first will get 1/3 of your resources and the second will get 2/3.", array(), NULL, 'boinc:account-preferences-project') |
|
1125 | + '#description' => bts("Determines the proportion of your computer's resources allocated to this project. Example: if you participate in two BOINC projects with resource shares of 100 and 200, the first will get 1/3 of your resources and the second will get 2/3.", array(), null, 'boinc:account-preferences-project') |
|
1126 | 1126 | ); |
1127 | 1127 | if ($app_types->count > 1) { |
1128 | 1128 | if ($app_types->cpu) { |
1129 | 1129 | $form['resource']['no_cpu'] = array( |
1130 | - '#title' => bts('Use CPU', array(), NULL, 'boinc:account-preferences-project'), |
|
1130 | + '#title' => bts('Use CPU', array(), null, 'boinc:account-preferences-project'), |
|
1131 | 1131 | '#type' => 'radios', |
1132 | 1132 | '#options' => $form['boolean_options']['#value'], |
1133 | 1133 | '#attributes' => array('class' => 'fancy'), |
1134 | 1134 | '#default_value' => $default['no_cpu'] ? 0 : 1, |
1135 | - '#description' => bts('Request CPU-only tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
1135 | + '#description' => bts('Request CPU-only tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
1136 | 1136 | ); |
1137 | 1137 | } |
1138 | 1138 | if ($app_types->cuda) { |
1139 | 1139 | $form['resource']['no_cuda'] = array( |
1140 | - '#title' => bts('Use NVIDIA GPU', array(), NULL, 'boinc:account-preferences-project'), |
|
1140 | + '#title' => bts('Use NVIDIA GPU', array(), null, 'boinc:account-preferences-project'), |
|
1141 | 1141 | '#type' => 'radios', |
1142 | 1142 | '#options' => $form['boolean_options']['#value'], |
1143 | 1143 | '#attributes' => array('class' => 'fancy'), |
1144 | 1144 | '#default_value' => $default['no_cuda'] ? 0 : 1, |
1145 | - '#description' => bts('Request NVIDIA GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
1145 | + '#description' => bts('Request NVIDIA GPU tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
1146 | 1146 | ); |
1147 | 1147 | } |
1148 | 1148 | if ($app_types->ati) { |
1149 | 1149 | $form['resource']['no_ati'] = array( |
1150 | - '#title' => bts('Use AMD GPU', array(), NULL, 'boinc:account-preferences-project'), |
|
1150 | + '#title' => bts('Use AMD GPU', array(), null, 'boinc:account-preferences-project'), |
|
1151 | 1151 | '#type' => 'radios', |
1152 | 1152 | '#options' => $form['boolean_options']['#value'], |
1153 | 1153 | '#attributes' => array('class' => 'fancy'), |
1154 | 1154 | '#default_value' => $default['no_ati'] ? 0 : 1, |
1155 | - '#description' => bts('Request AMD GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
1155 | + '#description' => bts('Request AMD GPU tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
1156 | 1156 | ); |
1157 | 1157 | } |
1158 | 1158 | if ($app_types->intel_gpu) { |
1159 | 1159 | $form['resource']['no_intel_gpu'] = array( |
1160 | - '#title' => bts('Use INTEL GPU', array(), NULL, 'boinc:account-preferences-project'), |
|
1160 | + '#title' => bts('Use INTEL GPU', array(), null, 'boinc:account-preferences-project'), |
|
1161 | 1161 | '#type' => 'radios', |
1162 | 1162 | '#options' => $form['boolean_options']['#value'], |
1163 | 1163 | '#attributes' => array('class' => 'fancy'), |
1164 | 1164 | '#default_value' => $default['no_intel_gpu'] ? 0 : 1, |
1165 | - '#description' => bts('Request Intel GPU tasks from this project.', array(), NULL, 'boinc:account-preferences-project') |
|
1165 | + '#description' => bts('Request Intel GPU tasks from this project.', array(), null, 'boinc:account-preferences-project') |
|
1166 | 1166 | ); |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | 1169 | |
1170 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
1170 | + if (variable_get('boinc_prefs_options_beta', false)) { |
|
1171 | 1171 | $form['beta'] = array( |
1172 | - '#title' => bts('Beta settings', array(), NULL, 'boinc:account-preferences-project'), |
|
1172 | + '#title' => bts('Beta settings', array(), null, 'boinc:account-preferences-project'), |
|
1173 | 1173 | '#type' => 'fieldset', |
1174 | 1174 | '#description' => null, |
1175 | - '#collapsible' => TRUE, |
|
1176 | - '#collapsed' => FALSE |
|
1175 | + '#collapsible' => true, |
|
1176 | + '#collapsed' => false |
|
1177 | 1177 | ); |
1178 | 1178 | $form['beta']['allow_beta_work'] = array( |
1179 | - '#title' => bts('Run test applications?', array(), NULL, 'boinc:account-preferences-project'), |
|
1179 | + '#title' => bts('Run test applications?', array(), null, 'boinc:account-preferences-project'), |
|
1180 | 1180 | '#type' => 'radios', |
1181 | 1181 | '#options' => $form['boolean_options']['#value'], |
1182 | 1182 | '#attributes' => array('class' => 'fancy'), |
1183 | 1183 | '#default_value' => ($default['allow_beta_work']) ? 1 : 0, |
1184 | - '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), NULL, 'boinc:account-preferences-project') |
|
1184 | + '#description' => bts('This helps us develop applications, but may cause jobs to fail on your computer', array(), null, 'boinc:account-preferences-project') |
|
1185 | 1185 | ); |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1190,14 +1190,14 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | // Set whether to use this preference set by default for new computers |
1192 | 1192 | $form['default_set'] = array( |
1193 | - '#title' => bts('Default set', array(), NULL, 'boinc:account-preferences-project'), |
|
1193 | + '#title' => bts('Default set', array(), null, 'boinc:account-preferences-project'), |
|
1194 | 1194 | '#type' => 'fieldset', |
1195 | 1195 | '#description' => null, |
1196 | - '#collapsible' => TRUE, |
|
1197 | - '#collapsed' => FALSE |
|
1196 | + '#collapsible' => true, |
|
1197 | + '#collapsed' => false |
|
1198 | 1198 | ); |
1199 | 1199 | $form['default_set']['default_venue'] = array( |
1200 | - '#title' => bts('Set used for new computers', array(), NULL, 'boinc:account-preferences-project'), |
|
1200 | + '#title' => bts('Set used for new computers', array(), null, 'boinc:account-preferences-project'), |
|
1201 | 1201 | '#type' => 'radios', |
1202 | 1202 | '#options' => $form['boolean_options']['#value'], |
1203 | 1203 | '#attributes' => array('class' => 'fancy'), |
@@ -1216,27 +1216,27 @@ discard block |
||
1216 | 1216 | $form['prefs']['submit'] = array( |
1217 | 1217 | '#prefix' => '<li class="first tab">', |
1218 | 1218 | '#type' => 'submit', |
1219 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
1219 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
1220 | 1220 | '#suffix' => '</li>' |
1221 | 1221 | ); |
1222 | 1222 | $form['prefs']['form control tabs'] = array( |
1223 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
1223 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
1224 | 1224 | ); |
1225 | - if ($venue AND $venue != 'generic') { |
|
1225 | + if ($venue and $venue != 'generic') { |
|
1226 | 1226 | global $base_path; |
1227 | 1227 | $form['prefs']['form control tabs']['#value'] .= '<li class="tab">' . |
1228 | - l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
1228 | + l(bts('Clear', array(), null, 'boinc:form-clear'), "account/prefs/project/clear/{$venue}", |
|
1229 | 1229 | array( |
1230 | 1230 | 'query' => 'destination=' . urlencode(drupal_get_path_alias('account/prefs/project/combined')), |
1231 | 1231 | 'attributes' => array( |
1232 | 1232 | 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the @name preference set. Are you sure?', |
1233 | - array('@name' => $venue), NULL, 'boinc:account-preferences') . '\')' |
|
1233 | + array('@name' => $venue), null, 'boinc:account-preferences') . '\')' |
|
1234 | 1234 | ) |
1235 | 1235 | ) |
1236 | 1236 | ) . '</li>'; |
1237 | 1237 | } |
1238 | 1238 | $form['prefs']['view control'] = array( |
1239 | - '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), NULL, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
1239 | + '#value' => '<li class="first alt tab">' . l('(' . bts('Show comparison view', array(), null, 'boinc:account-preferences') . ')', 'account/prefs/project/combined') . '</li>' |
|
1240 | 1240 | ); |
1241 | 1241 | $form['prefs']['form control tabs suffix'] = array( |
1242 | 1242 | '#value' => '</ul>' |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | $ordered_array = array(); |
1257 | 1257 | $unordered_array = array(); |
1258 | 1258 | foreach ($xml['project_specific_preferences'] as $type => $element) { |
1259 | - if (is_array($element) AND is_numeric(key($element))) { |
|
1259 | + if (is_array($element) and is_numeric(key($element))) { |
|
1260 | 1260 | foreach ($element as $ordered_element) { |
1261 | 1261 | if (isset($ordered_element['@position'])) { |
1262 | 1262 | $ordered_array[$ordered_element['@position']] = array($type => $ordered_element); |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | // Check for app validation |
1309 | 1309 | if (isset($validation_rules['apps'])) { |
1310 | 1310 | if (isset($validation_rules['apps']['minimum selected']) |
1311 | - AND $validation_rules['apps']['minimum selected'] > 0) { |
|
1311 | + and $validation_rules['apps']['minimum selected'] > 0) { |
|
1312 | 1312 | $apps_selected = 0; |
1313 | 1313 | foreach ($validation_rules['apps']['list'] as $app) { |
1314 | 1314 | if ($form_state['values']['applications'][$app]) $apps_selected++; |
@@ -1316,14 +1316,14 @@ discard block |
||
1316 | 1316 | if ($apps_selected < $validation_rules['apps']['minimum selected']) { |
1317 | 1317 | form_set_error( |
1318 | 1318 | 'applications', |
1319 | - bts('At least one application must be selected', array(), NULL, 'boinc:account-preferences-project') |
|
1319 | + bts('At least one application must be selected', array(), null, 'boinc:account-preferences-project') |
|
1320 | 1320 | ); |
1321 | 1321 | } |
1322 | 1322 | if ($apps_selected == count($validation_rules['apps']['list'])) { |
1323 | 1323 | foreach ($validation_rules['apps']['list'] as $app) { |
1324 | 1324 | unset($form_state['values']['applications'][$app]); |
1325 | 1325 | } |
1326 | - $form_state['storage']['all apps selected'] = TRUE; |
|
1326 | + $form_state['storage']['all apps selected'] = true; |
|
1327 | 1327 | } |
1328 | 1328 | } |
1329 | 1329 | } |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | // Beta preferences |
1359 | - if (variable_get('boinc_prefs_options_beta', FALSE)) { |
|
1359 | + if (variable_get('boinc_prefs_options_beta', false)) { |
|
1360 | 1360 | $prefs['allow_beta_work'] = ($edit['beta']['allow_beta_work']) ? 1 : 0; |
1361 | 1361 | } |
1362 | 1362 | |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | watchdog('boincwork', 'Error updating project prefs for user @id: @message', array('@id' => $user->id, '@message' => mysqli_error()), WATCHDOG_ERROR); |
1395 | 1395 | drupal_set_message(t('Your changes could not be saved. Please contact support!'), 'error'); |
1396 | 1396 | } |
1397 | - elseif (!drupal_get_messages('status', FALSE)) { |
|
1397 | + elseif (!drupal_get_messages('status', false)) { |
|
1398 | 1398 | // Show this message if the set wasn't created automatically (in which case |
1399 | 1399 | // there is a message tailored to that) |
1400 | 1400 | drupal_set_message(t('Your preferences have been updated. |
@@ -1429,31 +1429,31 @@ discard block |
||
1429 | 1429 | // Standard option sets |
1430 | 1430 | $form['boolean_options'] = array( |
1431 | 1431 | '#type' => 'value', |
1432 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
1432 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
1433 | 1433 | ); |
1434 | 1434 | |
1435 | 1435 | $default = array( |
1436 | 1436 | 'pm_send_notification' => '', // This is set already in pm_email_notify_user |
1437 | 1437 | 'friend_notification' => isset($account->friend_notification) ? $account->friend_notification : 0, |
1438 | - 'comments_per_page' => (isset($account->comments_per_page) AND $account->comments_per_page) ? $account->comments_per_page : variable_get('comment_default_per_page_forum', 50), |
|
1439 | - 'comments_order' => (isset($account->sort) AND $account->sort) ? $account->sort : variable_get('comment_default_order_forum', COMMENT_ORDER_OLDEST_FIRST), |
|
1438 | + 'comments_per_page' => (isset($account->comments_per_page) and $account->comments_per_page) ? $account->comments_per_page : variable_get('comment_default_per_page_forum', 50), |
|
1439 | + 'comments_order' => (isset($account->sort) and $account->sort) ? $account->sort : variable_get('comment_default_order_forum', COMMENT_ORDER_OLDEST_FIRST), |
|
1440 | 1440 | ); |
1441 | 1441 | |
1442 | 1442 | // General options |
1443 | 1443 | $form['general'] = array( |
1444 | 1444 | '#type' => 'fieldset', |
1445 | - '#title' => bts('General settings', array(), NULL, 'boinc:account-preferences-community'), |
|
1445 | + '#title' => bts('General settings', array(), null, 'boinc:account-preferences-community'), |
|
1446 | 1446 | '#weight' => 0, |
1447 | - '#collapsible' => TRUE, |
|
1448 | - '#collapsed' => FALSE |
|
1447 | + '#collapsible' => true, |
|
1448 | + '#collapsed' => false |
|
1449 | 1449 | ); |
1450 | 1450 | // Add the BOINC user name (non-unique, user editable) |
1451 | 1451 | $form['general']['boincuser_name'] = array( |
1452 | 1452 | '#type' => 'textfield', |
1453 | - '#title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'), |
|
1453 | + '#title' => bts('Name', array(), null, 'boinc:user-or-team-name'), |
|
1454 | 1454 | '#default_value' => $account->boincuser_name, |
1455 | 1455 | '#maxlength' => USERNAME_MAX_LENGTH, |
1456 | - '#required' => TRUE, |
|
1456 | + '#required' => true, |
|
1457 | 1457 | '#description' => '', |
1458 | 1458 | '#size' => 40 |
1459 | 1459 | ); |
@@ -1462,8 +1462,8 @@ discard block |
||
1462 | 1462 | $zones = _system_zonelist(); |
1463 | 1463 | $form['general']['timezone'] = array( |
1464 | 1464 | '#type' => 'select', |
1465 | - '#title' => bts('Time zone', array(), NULL, 'boinc:account-preferences-community'), |
|
1466 | - '#default_value' => ($account->timezone !== NULL) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
1465 | + '#title' => bts('Time zone', array(), null, 'boinc:account-preferences-community'), |
|
1466 | + '#default_value' => ($account->timezone !== null) ? $account->timezone : variable_get('date_default_timezone', 0), |
|
1467 | 1467 | '#options' => $zones, |
1468 | 1468 | '#description' => '', |
1469 | 1469 | ); |
@@ -1472,10 +1472,10 @@ discard block |
||
1472 | 1472 | // Notification options |
1473 | 1473 | $form['notifications'] = array( |
1474 | 1474 | '#type' => 'fieldset', |
1475 | - '#title' => bts('Notification settings', array(), NULL, 'boinc:account-preferences-community'), |
|
1475 | + '#title' => bts('Notification settings', array(), null, 'boinc:account-preferences-community'), |
|
1476 | 1476 | '#weight' => 5, |
1477 | - '#collapsible' => TRUE, |
|
1478 | - '#collapsed' => FALSE |
|
1477 | + '#collapsible' => true, |
|
1478 | + '#collapsed' => false |
|
1479 | 1479 | ); |
1480 | 1480 | // Pull in private message notification handling and tweak the form |
1481 | 1481 | $pm_notify = pm_email_notify_user('form', $edit, $account, 'account'); |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | $pm_notify['enable_pm_mail']['pm_send_notifications'], |
1484 | 1484 | array( |
1485 | 1485 | '#type' => 'radios', |
1486 | - '#title' => bts('Receive email notification for private messages?', array(), NULL, 'boinc:account-preferences-community'), |
|
1486 | + '#title' => bts('Receive email notification for private messages?', array(), null, 'boinc:account-preferences-community'), |
|
1487 | 1487 | '#description' => ' ', |
1488 | 1488 | '#options' => $form['boolean_options']['#value'], |
1489 | 1489 | '#attributes' => array('class' => 'fancy') |
@@ -1491,9 +1491,9 @@ discard block |
||
1491 | 1491 | ); |
1492 | 1492 | $form['notifications']['friend_notification'] = array( |
1493 | 1493 | '#type' => 'radios', |
1494 | - '#title' => bts('Receive email notification for friend requests?', array(), NULL, 'boinc:account-preferences-community'), |
|
1494 | + '#title' => bts('Receive email notification for friend requests?', array(), null, 'boinc:account-preferences-community'), |
|
1495 | 1495 | '#description' => ' ', |
1496 | - '#options' => array(0 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), -1 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
1496 | + '#options' => array(0 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), -1 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')), |
|
1497 | 1497 | '#attributes' => array('class' => 'fancy'), |
1498 | 1498 | '#default_value' => $default['friend_notification'] |
1499 | 1499 | ); |
@@ -1509,10 +1509,10 @@ discard block |
||
1509 | 1509 | } |
1510 | 1510 | $form['locale'] = array( |
1511 | 1511 | '#type' => 'fieldset', |
1512 | - '#title' => bts('Language settings', array(), NULL, 'boinc:account-preferences-community'), |
|
1512 | + '#title' => bts('Language settings', array(), null, 'boinc:account-preferences-community'), |
|
1513 | 1513 | '#weight' => 10, |
1514 | - '#collapsible' => TRUE, |
|
1515 | - '#collapsed' => FALSE, |
|
1514 | + '#collapsible' => true, |
|
1515 | + '#collapsed' => false, |
|
1516 | 1516 | ); |
1517 | 1517 | |
1518 | 1518 | // Get language negotiation settings. |
@@ -1520,30 +1520,30 @@ discard block |
||
1520 | 1520 | $user_preferred_language = user_preferred_language($account); |
1521 | 1521 | $form['locale']['language'] = array( |
1522 | 1522 | '#type' => 'select', |
1523 | - '#title' => bts('Language', array(), NULL, 'boinc:account-preferences-community'), |
|
1523 | + '#title' => bts('Language', array(), null, 'boinc:account-preferences-community'), |
|
1524 | 1524 | '#default_value' => check_plain($user_preferred_language->language), |
1525 | 1525 | '#options' => $names, |
1526 | - '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), NULL, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), NULL, 'boinc:account-preferences-community'), |
|
1526 | + '#description' => ($mode == LANGUAGE_NEGOTIATION_PATH) ? bts("This account's default language for e-mails and preferred language for site presentation.", array(), null, 'boinc:account-preferences-community') : bts("This account's default language for e-mails.", array(), null, 'boinc:account-preferences-community'), |
|
1527 | 1527 | ); |
1528 | 1528 | } |
1529 | 1529 | |
1530 | 1530 | // Avatar options |
1531 | 1531 | $form['gravatar'] = array( |
1532 | 1532 | '#type' => 'item', |
1533 | - '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
1534 | - '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), NULL, 'boinc:account-preferences-community'), |
|
1533 | + '#value' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, it will be used for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), null, 'boinc:account-preferences-community'), |
|
1534 | + '#description' => bts('Your Gravatar will not be shown if you upload a user picture.', array(), null, 'boinc:account-preferences-community'), |
|
1535 | 1535 | ); |
1536 | 1536 | if (user_access('disable own gravatar', $account)) { |
1537 | 1537 | $form['gravatar'] = array( |
1538 | 1538 | '#type' => 'checkbox', |
1539 | - '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), NULL, 'boinc:account-preferences-community'), |
|
1540 | - '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), NULL, 'boinc:account-preferences-community'), |
|
1539 | + '#title' => bts('If you have a <a href="@gravatar-check">valid Gravatar</a> associated with your e-mail address, use it for your user picture.', array('@gravatar-check' => 'http://en.gravatar.com/site/check/' . $account->mail), null, 'boinc:account-preferences-community'), |
|
1540 | + '#description' => bts('Gravatar will not be shown if an avatar is uploaded.', array(), null, 'boinc:account-preferences-community'), |
|
1541 | 1541 | '#default_value' => isset($account->gravatar) ? $account->gravatar : 0, |
1542 | 1542 | '#disabled' => !empty($account->picture), |
1543 | 1543 | ); |
1544 | 1544 | } |
1545 | 1545 | $form['gravatar']['#weight'] = 15; |
1546 | - $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), NULL, 'boinc:account-preferences-community') . '</a></legend>'; |
|
1546 | + $form['gravatar']['#prefix'] = '<fieldset class="collapsible"><legend><a href="#">' . bts('Avatar settings', array(), null, 'boinc:account-preferences-community') . '</a></legend>'; |
|
1547 | 1547 | // Upload an avatar (pulled from profile_node_form): |
1548 | 1548 | if (!empty($profile_form['field_image'])) { |
1549 | 1549 | $form['field_image'] = $profile_form['field_image']; |
@@ -1552,46 +1552,46 @@ discard block |
||
1552 | 1552 | $form['field_image'] = array( |
1553 | 1553 | '#value' => '<div class="form-item">' |
1554 | 1554 | . '<label class="placeholder">' |
1555 | - . bts('This is not available until your profile is set up.', array(), NULL, 'boinc:account-preferences-community') |
|
1555 | + . bts('This is not available until your profile is set up.', array(), null, 'boinc:account-preferences-community') |
|
1556 | 1556 | . '</label>' |
1557 | - . l(bts('Create a profile', array(), NULL, 'boinc:account-preferences-community'), 'account/profile/edit', array('attributes' => array('class' => 'form-link'))) |
|
1557 | + . l(bts('Create a profile', array(), null, 'boinc:account-preferences-community'), 'account/profile/edit', array('attributes' => array('class' => 'form-link'))) |
|
1558 | 1558 | . '</div>', |
1559 | 1559 | ); |
1560 | 1560 | } |
1561 | - $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), NULL, 'boinc:account-preferences-community'); |
|
1561 | + $form['field_image'][0]['#title'] = bts('Upload an avatar', array(), null, 'boinc:account-preferences-community'); |
|
1562 | 1562 | $form['field_image']['#weight'] = 20; |
1563 | 1563 | $form['field_image']['#suffix'] = '</fieldset>'; |
1564 | 1564 | |
1565 | 1565 | // Forum options |
1566 | 1566 | $form['forums'] = array( |
1567 | 1567 | '#type' => 'fieldset', |
1568 | - '#title' => bts('Forum settings', array(), NULL, 'boinc:account-preferences-community'), |
|
1568 | + '#title' => bts('Forum settings', array(), null, 'boinc:account-preferences-community'), |
|
1569 | 1569 | '#weight' => 25, |
1570 | - '#collapsible' => TRUE, |
|
1571 | - '#collapsed' => FALSE |
|
1570 | + '#collapsible' => true, |
|
1571 | + '#collapsed' => false |
|
1572 | 1572 | ); |
1573 | 1573 | $form['forums']['comments_per_page'] = array( |
1574 | 1574 | '#type' => 'select', |
1575 | - '#title' => bts('In discussion topics, show at most @comments_per_page', array('@comments_per_page' => ''), NULL, 'boinc:account-preferences-community'), |
|
1575 | + '#title' => bts('In discussion topics, show at most @comments_per_page', array('@comments_per_page' => ''), null, 'boinc:account-preferences-community'), |
|
1576 | 1576 | '#options' => array(10 => 10, 20 => 20, 30 => 30, 50 => 50, 100 => 100), |
1577 | 1577 | '#default_value' => $default['comments_per_page'] |
1578 | 1578 | ); |
1579 | 1579 | // Can't have a typical Drupal form suffix on a select box? |
1580 | 1580 | $form['forums']['comments_per_page_suffix'] = array( |
1581 | - '#value' => '<span>' . bts('comments per page', array(), NULL, 'boinc:account-preferences-community') . '</span>' |
|
1581 | + '#value' => '<span>' . bts('comments per page', array(), null, 'boinc:account-preferences-community') . '</span>' |
|
1582 | 1582 | ); |
1583 | 1583 | $form['forums']['comments_order'] = array( |
1584 | 1584 | '#type' => 'select', |
1585 | - '#title' => bts('Sort comments in discussions', array(), NULL, 'boinc:account-preferences-community'), |
|
1586 | - '#options' => array(1 => bts('Newest post first', array(), NULL, 'boinc:account-preferences-community'), 2 => bts('Oldest post first', array(), NULL, 'boinc:account-preferences-community')), |
|
1585 | + '#title' => bts('Sort comments in discussions', array(), null, 'boinc:account-preferences-community'), |
|
1586 | + '#options' => array(1 => bts('Newest post first', array(), null, 'boinc:account-preferences-community'), 2 => bts('Oldest post first', array(), null, 'boinc:account-preferences-community')), |
|
1587 | 1587 | '#default_value' => $default['comments_order'] |
1588 | 1588 | ); |
1589 | 1589 | // Signature (pulled from user_edit_form): |
1590 | 1590 | if (variable_get('user_signatures', 0) && module_exists('comment')) { |
1591 | 1591 | $form['forums']['signature'] = array( |
1592 | 1592 | '#type' => 'textarea', |
1593 | - '#title' => bts('Signature', array(), NULL, 'boinc:account-preferences-community'), |
|
1594 | - '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), NULL, 'boinc:account-preferences-community'), |
|
1593 | + '#title' => bts('Signature', array(), null, 'boinc:account-preferences-community'), |
|
1594 | + '#description' => bts('Your signature will be publicly displayed at the end of your comments.', array(), null, 'boinc:account-preferences-community'), |
|
1595 | 1595 | '#default_value' => $account->signature |
1596 | 1596 | ); |
1597 | 1597 | // Prevent a "validation error" message when the user attempts to save with a default value they |
@@ -1600,11 +1600,11 @@ discard block |
||
1600 | 1600 | drupal_set_message(t("The signature input format has been set to a format you don't have access to. It will be changed to a format you have access to when you save this page.")); |
1601 | 1601 | $edit['signature_format'] = FILTER_FORMAT_DEFAULT; |
1602 | 1602 | } |
1603 | - $form['forums']['signature_format'] = filter_form($account->signature_format, NULL, array('signature_format')); |
|
1603 | + $form['forums']['signature_format'] = filter_form($account->signature_format, null, array('signature_format')); |
|
1604 | 1604 | // Optionally hide signatures from comments |
1605 | 1605 | $form['forums']['hide_signatures'] = array( |
1606 | 1606 | '#type' => 'radios', |
1607 | - '#title' => bts('Hide signatures in forums', array(), NULL, 'boinc:account-preferences-community'), |
|
1607 | + '#title' => bts('Hide signatures in forums', array(), null, 'boinc:account-preferences-community'), |
|
1608 | 1608 | '#description' => ' ', |
1609 | 1609 | '#options' => $form['boolean_options']['#value'], |
1610 | 1610 | '#attributes' => array('class' => 'fancy'), |
@@ -1626,12 +1626,12 @@ discard block |
||
1626 | 1626 | $form['submit'] = array( |
1627 | 1627 | '#prefix' => '<li class="first tab">', |
1628 | 1628 | '#type' => 'submit', |
1629 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
1629 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
1630 | 1630 | '#suffix' => '</li>', |
1631 | 1631 | '#weight' => 1002, |
1632 | 1632 | ); |
1633 | 1633 | $form['form control tabs'] = array( |
1634 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1634 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1635 | 1635 | '#weight' => 1003, |
1636 | 1636 | ); |
1637 | 1637 | $form['form control tabs suffix'] = array( |
@@ -1661,7 +1661,7 @@ discard block |
||
1661 | 1661 | form_set_error('boincuser_name', |
1662 | 1662 | bts('You may not use username @blname, as that name is not allowed. Please choose another name.', |
1663 | 1663 | array('@blname' => $edit['boincuser_name']), |
1664 | - NULL, 'boinc:account-preferences-community')); |
|
1664 | + null, 'boinc:account-preferences-community')); |
|
1665 | 1665 | return false; |
1666 | 1666 | } |
1667 | 1667 | } |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | $profile_node->field_image = $edit['field_image']; |
1698 | 1698 | node_save($profile_node); |
1699 | 1699 | // Flush this from the node cache or changes won't show up immediately! |
1700 | - $profile_node = node_load($profile_node->nid, NULL, TRUE); |
|
1700 | + $profile_node = node_load($profile_node->nid, null, true); |
|
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | // All other settings |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | } |
1727 | 1727 | user_save($user, $settings); |
1728 | 1728 | |
1729 | - drupal_set_message(bts('Your community preferences have been updated.', array(), NULL, 'boinc:account-preferences-community')); |
|
1729 | + drupal_set_message(bts('Your community preferences have been updated.', array(), null, 'boinc:account-preferences-community')); |
|
1730 | 1730 | |
1731 | 1731 | // Form will not redirect if storage is set; not good if language changes |
1732 | 1732 | unset($form_state['storage']); |
@@ -1760,26 +1760,26 @@ discard block |
||
1760 | 1760 | // Standard option sets |
1761 | 1761 | $form['boolean_options'] = array( |
1762 | 1762 | '#type' => 'value', |
1763 | - '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
1763 | + '#value' => array(1 => bts('yes', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), null, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')) |
|
1764 | 1764 | ); |
1765 | 1765 | |
1766 | 1766 | $form['privacy'] = array( |
1767 | - '#title' => bts('Privacy settings', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1767 | + '#title' => bts('Privacy settings', array(), null, 'boinc:account-preferences-privacy'), |
|
1768 | 1768 | '#type' => 'fieldset', |
1769 | 1769 | '#description' => null, |
1770 | - '#collapsible' => TRUE, |
|
1771 | - '#collapsed' => FALSE |
|
1770 | + '#collapsible' => true, |
|
1771 | + '#collapsed' => false |
|
1772 | 1772 | ); |
1773 | 1773 | $form['privacy']['send_email'] = array( |
1774 | - '#title' => bts('Is it OK for @project and your team (if any) to email you?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
|
1774 | + '#title' => bts('Is it OK for @project and your team (if any) to email you?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:account-preferences-privacy'), |
|
1775 | 1775 | '#type' => 'radios', |
1776 | 1776 | '#options' => $form['boolean_options']['#value'], |
1777 | 1777 | '#attributes' => array('class' => 'fancy'), |
1778 | 1778 | '#default_value' => $default['privacy']['send_email'] |
1779 | 1779 | ); |
1780 | 1780 | $form['privacy']['show_hosts'] = array( |
1781 | - '#title' => bts('Should @project show your computers on its website?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:account-preferences-privacy'), |
|
1782 | - '#description' => bts('At times, you may be asked to enable this option in order to receive help from the forums. Advanced users may need to be able to inspect your computers\' information in order to help diagnose any problems.', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1781 | + '#title' => bts('Should @project show your computers on its website?', array('@project' => variable_get('site_name', 'Drupal-BOINC')), null, 'boinc:account-preferences-privacy'), |
|
1782 | + '#description' => bts('At times, you may be asked to enable this option in order to receive help from the forums. Advanced users may need to be able to inspect your computers\' information in order to help diagnose any problems.', array(), null, 'boinc:account-preferences-privacy'), |
|
1783 | 1783 | '#type' => 'radios', |
1784 | 1784 | '#options' => $form['boolean_options']['#value'], |
1785 | 1785 | '#attributes' => array('class' => 'fancy'), |
@@ -1794,7 +1794,7 @@ discard block |
||
1794 | 1794 | // Set name to 'privacyconsent_SHORTNAME', which can be parsed |
1795 | 1795 | // later in the submit function. |
1796 | 1796 | $form['privacy']['privacyconsent_'.$ct['shortname']] = array( |
1797 | - '#title' => bts($ct['description'], array(), NULL, 'boinc:account-preferences-privacy'), |
|
1797 | + '#title' => bts($ct['description'], array(), null, 'boinc:account-preferences-privacy'), |
|
1798 | 1798 | '#type' => 'radios', |
1799 | 1799 | '#options' => $form['boolean_options']['#value'], |
1800 | 1800 | '#attributes' => array('class' => 'fancy'), |
@@ -1808,28 +1808,28 @@ discard block |
||
1808 | 1808 | $form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics exports.', |
1809 | 1809 | array( |
1810 | 1810 | '!privacy_policy_link' => l( |
1811 | - bts('privacy policy', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1811 | + bts('privacy policy', array(), null, 'boinc:account-preferences-privacy'), |
|
1812 | 1812 | '/privacy' |
1813 | 1813 | ) |
1814 | 1814 | ), |
1815 | - NULL, 'boinc:account-preferences-privacy'); |
|
1815 | + null, 'boinc:account-preferences-privacy'); |
|
1816 | 1816 | } |
1817 | 1817 | } |
1818 | 1818 | |
1819 | 1819 | // Ignore and block users |
1820 | 1820 | if (module_exists('ignore_user')) { |
1821 | 1821 | $form['ignoreblock'] = array( |
1822 | - '#title' => bts('Ignore Users', array(), NULL, 'boinc:account-preferences-privacy'), |
|
1822 | + '#title' => bts('Ignore Users', array(), null, 'boinc:account-preferences-privacy'), |
|
1823 | 1823 | '#type' => 'fieldset', |
1824 | - '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), NULL, 'boinc:ignore-user-help'), |
|
1825 | - '#collapsible' => TRUE, |
|
1826 | - '#collapsed' => FALSE |
|
1824 | + '#description' => bts('<p>You may ignore users in the forums and block users from sending you private messages.<p>', array(), null, 'boinc:ignore-user-help'), |
|
1825 | + '#collapsible' => true, |
|
1826 | + '#collapsed' => false |
|
1827 | 1827 | ); |
1828 | 1828 | |
1829 | 1829 | // Table for ignored users |
1830 | 1830 | $form['ignoreblock']['current_ignore_section'] = array( |
1831 | 1831 | '#type' => 'item', |
1832 | - '#value' => bts('Current users on your Ignore List', array(), NULL, 'boinc:ignore-user-list'), |
|
1832 | + '#value' => bts('Current users on your Ignore List', array(), null, 'boinc:ignore-user-list'), |
|
1833 | 1833 | '#prefix' => '<h4>', |
1834 | 1834 | '#suffix' => '</h4>', |
1835 | 1835 | '#weight' => -20, |
@@ -1842,18 +1842,18 @@ discard block |
||
1842 | 1842 | ); |
1843 | 1843 | $form['ignoreblock']['delete'][$ignored_user['iuid']] = array( |
1844 | 1844 | '#value' => l( |
1845 | - bts('delete', array(), NULL, 'boinc:ignore-user-delete-button'), |
|
1845 | + bts('delete', array(), null, 'boinc:ignore-user-delete-button'), |
|
1846 | 1846 | 'account/prefs/privacy/ignore_user/remove/'. $ignored_user['iuid'], |
1847 | 1847 | array() |
1848 | 1848 | ), |
1849 | 1849 | ); |
1850 | 1850 | } |
1851 | - $form['ignoreblock']['pager'] = array('#value' => theme('pager', NULL, 10, 0)); |
|
1851 | + $form['ignoreblock']['pager'] = array('#value' => theme('pager', null, 10, 0)); |
|
1852 | 1852 | |
1853 | 1853 | // Sub-form to add user to ignore list |
1854 | 1854 | $form['ignoreblock']['add_ignore_user_section'] = array( |
1855 | 1855 | '#type' => 'item', |
1856 | - '#value' => bts('Add user to Ignore List', array(), NULL, 'boinc:ignore-user-add'), |
|
1856 | + '#value' => bts('Add user to Ignore List', array(), null, 'boinc:ignore-user-add'), |
|
1857 | 1857 | '#prefix' => '<h4>', |
1858 | 1858 | '#suffix' => '</h4>', |
1859 | 1859 | '#weight' => 10, |
@@ -1861,8 +1861,8 @@ discard block |
||
1861 | 1861 | |
1862 | 1862 | $form['ignoreblock']['addusername_toignorelist'] = array( |
1863 | 1863 | '#type' => 'textfield', |
1864 | - '#title' => bts('Username', array(), NULL, 'boinc:ignore-user-searchbox'), |
|
1865 | - '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), NULL, 'boinc:ignore-user-searchbox-help'), |
|
1864 | + '#title' => bts('Username', array(), null, 'boinc:ignore-user-searchbox'), |
|
1865 | + '#description' => bts('To lookup a username start typing in the search box. A list of usernames will appear as you type. The number appearing in the suffix is the BOINC id. You can find a user\'s BOINC id on their user profile page.', array(), null, 'boinc:ignore-user-searchbox-help'), |
|
1866 | 1866 | '#weight' => 11, |
1867 | 1867 | '#size' => 50, |
1868 | 1868 | '#autocomplete_path' => 'boincuser/autocomplete', |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | |
1871 | 1871 | $form['ignoreblock']['addusername_submit'] = array( |
1872 | 1872 | '#type' => 'submit', |
1873 | - '#value' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
|
1873 | + '#value' => bts('Ignore user', array(), null, 'boinc:ignore-user-add'), |
|
1874 | 1874 | '#submit' => array('_boincwork_ignore_list_form_submit'), |
1875 | 1875 | '#weight' => 12, |
1876 | 1876 | '#attributes' => array('class' => 'add_ignore_user'), |
@@ -1888,13 +1888,13 @@ discard block |
||
1888 | 1888 | $form['prefs']['submit'] = array( |
1889 | 1889 | '#prefix' => '<li class="first tab">', |
1890 | 1890 | '#type' => 'submit', |
1891 | - '#value' => bts('Save changes', array(), NULL, 'boinc:form-save'), |
|
1891 | + '#value' => bts('Save changes', array(), null, 'boinc:form-save'), |
|
1892 | 1892 | '#validate' => array('boincwork_privacyprefs_form_validate'), |
1893 | 1893 | '#submit' => array('boincwork_privacyprefs_form_submit'), |
1894 | 1894 | '#suffix' => '</li>' |
1895 | 1895 | ); |
1896 | 1896 | $form['prefs']['form control tabs'] = array( |
1897 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
1897 | + '#value' => '<li class="tab">' . l(bts('Cancel', array(), null, 'boinc:form-cancel'), $_GET['q']) . '</li>' |
|
1898 | 1898 | ); |
1899 | 1899 | $form['prefs']['form control tabs suffix'] = array( |
1900 | 1900 | '#value' => '</ul>' |
@@ -1912,8 +1912,8 @@ discard block |
||
1912 | 1912 | $output .= drupal_render($form['privacy']); |
1913 | 1913 | |
1914 | 1914 | $header = array( |
1915 | - bts('Username', array(), NULL, 'boinc:ignore-user-list'), |
|
1916 | - bts('Operations', array(), NULL, 'boinc:ignore-user-list') |
|
1915 | + bts('Username', array(), null, 'boinc:ignore-user-list'), |
|
1916 | + bts('Operations', array(), null, 'boinc:ignore-user-list') |
|
1917 | 1917 | ); |
1918 | 1918 | |
1919 | 1919 | $rows = array(); |
@@ -1928,7 +1928,7 @@ discard block |
||
1928 | 1928 | else { |
1929 | 1929 | $rows[] = array( |
1930 | 1930 | array( |
1931 | - 'data' => bts('You have not added any users to your Ignore List.', array(), NULL, 'boinc:ignore-user-list'), |
|
1931 | + 'data' => bts('You have not added any users to your Ignore List.', array(), null, 'boinc:ignore-user-list'), |
|
1932 | 1932 | 'colspan' => '2', |
1933 | 1933 | ) |
1934 | 1934 | ); |
@@ -2007,9 +2007,9 @@ discard block |
||
2007 | 2007 | bts('@username has been added to your ignore list. See your !privacy_preferences for more details.', |
2008 | 2008 | array( |
2009 | 2009 | '@username' => $form_state['values']['addusername_toignorelist'], |
2010 | - '!privacy_preferences' => l(bts('privacy preferences', array(), NULL, 'boinc:ignore-user-add'), 'account/prefs/privacy'), |
|
2010 | + '!privacy_preferences' => l(bts('privacy preferences', array(), null, 'boinc:ignore-user-add'), 'account/prefs/privacy'), |
|
2011 | 2011 | ), |
2012 | - NULL, 'boinc:ignore-user-add'), |
|
2012 | + null, 'boinc:ignore-user-add'), |
|
2013 | 2013 | 'status'); |
2014 | 2014 | } |
2015 | 2015 | |
@@ -2034,7 +2034,7 @@ discard block |
||
2034 | 2034 | // only non-js users/browsers will see the Apply Filter button. |
2035 | 2035 | $form['submit'] = array( |
2036 | 2036 | '#type' => 'submit', |
2037 | - '#value' => bts('Apply Filter', array(), NULL, 'boinc:form-save'), |
|
2037 | + '#value' => bts('Apply Filter', array(), null, 'boinc:form-save'), |
|
2038 | 2038 | '#attributes' => array('class' => 'js-hide',), |
2039 | 2039 | ); |
2040 | 2040 |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | |
30 | 30 | $border = get_str("border", true); |
31 | 31 | |
32 | -if ($border=="no") { |
|
32 | +if ($border == "no") { |
|
33 | 33 | $border = 0; |
34 | 34 | } else { |
35 | - $border=8; |
|
35 | + $border = 8; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $font = "\"Optima,Lucida Bright,Times New Roman\""; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr> |
76 | 76 | "; |
77 | 77 | foreach ($user->projects as $p) { |
78 | - if ($p->total_credit<100) continue; |
|
78 | + if ($p->total_credit < 100) continue; |
|
79 | 79 | show_proj($p); |
80 | 80 | } |
81 | 81 | echo " |
@@ -62,21 +62,21 @@ discard block |
||
62 | 62 | ); |
63 | 63 | $items['community/teams/%/edit/admins/remove/%'] = array( |
64 | 64 | 'page callback' => 'boincteam_remove_admin', |
65 | - 'page arguments' => array(2,6), |
|
65 | + 'page arguments' => array(2, 6), |
|
66 | 66 | 'access callback' => 'boincteam_is_founder', |
67 | 67 | 'access arguments' => array(2), |
68 | 68 | 'type' => MENU_CALLBACK |
69 | 69 | ); |
70 | 70 | $items['community/teams/%/edit/founder/set/%'] = array( |
71 | 71 | 'page callback' => 'boincteam_set_founder', |
72 | - 'page arguments' => array(2,6), |
|
72 | + 'page arguments' => array(2, 6), |
|
73 | 73 | 'access callback' => 'boincteam_is_founder', |
74 | 74 | 'access arguments' => array(2), |
75 | 75 | 'type' => MENU_CALLBACK |
76 | 76 | ); |
77 | 77 | $items['community/teams/%/edit/members/remove/%'] = array( |
78 | 78 | 'page callback' => 'boincteam_remove_member', |
79 | - 'page arguments' => array(2,6), |
|
79 | + 'page arguments' => array(2, 6), |
|
80 | 80 | 'access callback' => 'boincteam_is_founder', |
81 | 81 | 'access arguments' => array(2), |
82 | 82 | 'type' => MENU_CALLBACK |
@@ -724,12 +724,12 @@ discard block |
||
724 | 724 | $boincteam = boincteam_load($boincteam_id); |
725 | 725 | $now = time(); |
726 | 726 | if ($boincteam->ping_user <= 0) { |
727 | - if ($boincteam->ping_time < $now - 60 * (24*60*60)) { |
|
727 | + if ($boincteam->ping_time < $now - 60*(24*60*60)) { |
|
728 | 728 | return TRUE; |
729 | 729 | } |
730 | 730 | return FALSE; |
731 | 731 | } |
732 | - if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
732 | + if ($boincteam->ping_time < $now - 90*(24*60*60)) { |
|
733 | 733 | return TRUE; |
734 | 734 | } |
735 | 735 | return FALSE; |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | * responded to the request |
741 | 741 | */ |
742 | 742 | function boincteam_foundership_transfer_ok_time($boincteam) { |
743 | - return $boincteam->ping_time + 60 * (24*60*60); |
|
743 | + return $boincteam->ping_time + 60*(24*60*60); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | /** |
@@ -778,26 +778,26 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function boincteam_about_admins_panel() { |
780 | 780 | $output = ''; |
781 | - $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
781 | + $output .= '<h2 class="pane-title">'.bts('About team admins', array(), NULL, 'boinc:team-admins-panel').'</h2>'; |
|
782 | 782 | $output .= '<div>'; |
783 | - $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
783 | + $output .= '<p>'.bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel').'</p>'; |
|
784 | 784 | $output .= '<ul>'; |
785 | - $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
786 | - $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | - $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | - $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | - $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
785 | + $output .= ' <li>'.bts('Edit team information', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
786 | + $output .= ' <li>'.bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
787 | + $output .= ' <li>'.bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
788 | + $output .= ' <li>'.bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
789 | + $output .= ' <li>'.bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
790 | 790 | $output .= '</ul>'; |
791 | 791 | $output .= '</div>'; |
792 | 792 | $output .= '<div>'; |
793 | - $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
793 | + $output .= '<p>'.bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel').'</p>'; |
|
794 | 794 | $output .= '<ul>'; |
795 | - $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
796 | - $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | - $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
795 | + $output .= ' <li>'.bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
796 | + $output .= ' <li>'.bts('Remove members', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
797 | + $output .= ' <li>'.bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel').'</li>'; |
|
798 | 798 | $output .= '</ul>'; |
799 | 799 | $output .= '</div>'; |
800 | - $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
800 | + $output .= '<p>'.bts('If a team admin quits the team, they cease to be a' |
|
801 | 801 | . ' team admin. We recommend only selecting people you know and trust', array(), NULL, 'boinc:team-admins-panel') |
802 | 802 | . '</p>'; |
803 | 803 | return $output; |
@@ -808,26 +808,26 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function boincteam_about_founder_panel() { |
810 | 810 | $output = ''; |
811 | - $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
811 | + $output .= '<h2 class="pane-title">'.bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
812 | 812 | . '</h2>'; |
813 | 813 | $output .= '<div>'; |
814 | - $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
814 | + $output .= '<p>'.bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel').'</p>'; |
|
815 | 815 | $output .= '<ul>'; |
816 | - $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
817 | - $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
816 | + $output .= ' <li>'.bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
817 | + $output .= ' <li>'.bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
818 | 818 | $output .= '</ul>'; |
819 | 819 | $output .= '</div>'; |
820 | 820 | $output .= '<div>'; |
821 | - $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
821 | + $output .= '<p>'.bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
822 | 822 | . '</p>'; |
823 | 823 | $output .= '<ul>'; |
824 | - $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
825 | - $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
824 | + $output .= ' <li>'.bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
825 | + $output .= ' <li>'.bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
826 | 826 | . '</li>'; |
827 | - $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
827 | + $output .= ' <li>'.bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
828 | 828 | . '</li>'; |
829 | - $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
830 | - . ' request', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
829 | + $output .= ' <li>'.bts('Current founder has 60 days to respond to a' |
|
830 | + . ' request', array(), NULL, 'boinc:team-founder-panel').'</li>'; |
|
831 | 831 | $output .= '</ul>'; |
832 | 832 | $output .= '</div>'; |
833 | 833 | return $output; |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | $account = user_load($user->uid); |
842 | 842 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
843 | 843 | $output = ''; |
844 | - $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
845 | - $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
846 | - . ' can create a team.', array(), NULL, 'boinc:create-team-panel') . '</p>'; |
|
844 | + $output .= '<h2 class="pane-title">'.bts('Create a new team', array(), NULL, 'boinc:create-team-panel').'</h2>'; |
|
845 | + $output .= '<p>'.bts('If you cannot find a team that is right for you, you' |
|
846 | + . ' can create a team.', array(), NULL, 'boinc:create-team-panel').'</p>'; |
|
847 | 847 | $output .= '<ul class="tab-list">'; |
848 | 848 | $output .= ' <li class="first last tab">'; |
849 | 849 | if (isset($account->roles[$unrestricted_role])) { |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | */ |
880 | 880 | function boincteam_create_team_panel() { |
881 | 881 | $output = ''; |
882 | - $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
882 | + $output .= '<h2 class="pane-title">'.bts('Create a team', array(), NULL, 'boinc:create-team-panel').'</h2>'; |
|
883 | 883 | $output .= drupal_get_form('boincteam_create_form'); |
884 | 884 | |
885 | 885 | return $output; |
@@ -897,26 +897,26 @@ discard block |
||
897 | 897 | $account = user_load($uid); |
898 | 898 | if ($account->team) { |
899 | 899 | $team = boincteam_load(boincteam_lookup_id($account->team)); |
900 | - $output .= '<h2 class="pane-title">' . bts('Team', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
900 | + $output .= '<h2 class="pane-title">'.bts('Team', array(), NULL, 'boinc:team-dashboard').'</h2>'; |
|
901 | 901 | $output .= '<div class="stats">'; |
902 | - $output .= ' <label>' . bts('Name', array(), NULL, 'boinc:user-or-team-name') . ': </label>'; |
|
903 | - $output .= ' <span>' . l($team->name, "community/teams/{$account->team}") . '</span>'; |
|
904 | - $output .= '</div>' . "\n"; |
|
902 | + $output .= ' <label>'.bts('Name', array(), NULL, 'boinc:user-or-team-name').': </label>'; |
|
903 | + $output .= ' <span>'.l($team->name, "community/teams/{$account->team}").'</span>'; |
|
904 | + $output .= '</div>'."\n"; |
|
905 | 905 | $output .= '<div class="stats">'; |
906 | - $output .= ' <label>' . bts('Member since', array(), NULL, 'boinc:user-info') . ': </label>'; |
|
907 | - $output .= ' <span>' . date('j F Y', boincteam_get_member_join_date($team->id, $account->boincuser_id)) . '</span>'; |
|
908 | - $output .= '</div>' . "\n"; |
|
906 | + $output .= ' <label>'.bts('Member since', array(), NULL, 'boinc:user-info').': </label>'; |
|
907 | + $output .= ' <span>'.date('j F Y', boincteam_get_member_join_date($team->id, $account->boincuser_id)).'</span>'; |
|
908 | + $output .= '</div>'."\n"; |
|
909 | 909 | $output .= '<div class="stats">'; |
910 | - $output .= ' <label>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': </label>'; |
|
911 | - $output .= ' <span>' . $team->country . '</span>'; |
|
912 | - $output .= '</div>' . "\n"; |
|
910 | + $output .= ' <label>'.bts('Country', array(), NULL, 'boinc:country-of-origin').': </label>'; |
|
911 | + $output .= ' <span>'.$team->country.'</span>'; |
|
912 | + $output .= '</div>'."\n"; |
|
913 | 913 | $output .= '<div class="stats">'; |
914 | - $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
|
915 | - $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
|
916 | - $output .= '</div>' . "\n"; |
|
914 | + $output .= ' <label>'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').': </label>'; |
|
915 | + $output .= ' <span>'.number_format($team->total_credit, 0).'</span>'; |
|
916 | + $output .= '</div>'."\n"; |
|
917 | 917 | } |
918 | 918 | else if ($user->uid == $account->uid) { |
919 | - $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
919 | + $output .= '<h2 class="pane-title">'.bts('Team (None)', array(), NULL, 'boinc:team-dashboard').'</h2>'; |
|
920 | 920 | $output .= '<ul class="tab-list action-list">'; |
921 | 921 | $output .= '<li class="tab primary">'; |
922 | 922 | $output .= l(bts('Join a Team', array(), NULL, 'boinc:team-dashboard'), 'community/teams'); |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | function boincteam_edit_team_panel($team_id) { |
933 | 933 | $team = node_load($team_id); |
934 | 934 | $output = ''; |
935 | - $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
935 | + $output .= '<h2 class="pane-title">'.$team->title.'</h2>'; |
|
936 | 936 | $output .= drupal_get_form('boincteam_edit_form', $team_id); |
937 | 937 | |
938 | 938 | return $output; |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | function boincteam_join_team_panel($team_id) { |
945 | 945 | $team = node_load($team_id); |
946 | 946 | $output = ''; |
947 | - $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
948 | - $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
949 | - array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel') . '</p>'; |
|
947 | + $output .= '<h2 class="pane-title">'.bts('Join team', array(), NULL, 'boinc:join-team-panel').'</h2>'; |
|
948 | + $output .= '<p>'.bts('Click here to become a member of @this_team', |
|
949 | + array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel').'</p>'; |
|
950 | 950 | $output .= '<ul class="tab-list">'; |
951 | - $output .= ' <li class="first last tab">' . |
|
952 | - l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
|
951 | + $output .= ' <li class="first last tab">'. |
|
952 | + l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join").'</li>'; |
|
953 | 953 | $output .= '</ul>'; |
954 | 954 | return $output; |
955 | 955 | } |
@@ -960,12 +960,12 @@ discard block |
||
960 | 960 | function boincteam_leave_team_panel($team_id) { |
961 | 961 | $team = node_load($team_id); |
962 | 962 | $output = ''; |
963 | - $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
964 | - $output .= '<p>' . bts('Click here to revoke your membership with' |
|
965 | - . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel') . '</p>'; |
|
963 | + $output .= '<h2 class="pane-title">'.bts('Leave team', array(), NULL, 'boinc:leave-team-panel').'</h2>'; |
|
964 | + $output .= '<p>'.bts('Click here to revoke your membership with' |
|
965 | + . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel').'</p>'; |
|
966 | 966 | $output .= '<ul class="tab-list">'; |
967 | - $output .= ' <li class="first last tab">' . |
|
968 | - l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
|
967 | + $output .= ' <li class="first last tab">'. |
|
968 | + l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave").'</li>'; |
|
969 | 969 | $output .= '</ul>'; |
970 | 970 | return $output; |
971 | 971 | } |
@@ -975,10 +975,10 @@ discard block |
||
975 | 975 | */ |
976 | 976 | function boincteam_manage_admins_panel_header($team_id) { |
977 | 977 | $output = ''; |
978 | - $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
978 | + $output .= '<h4>'.bts('Add team admin', array(), NULL, 'boinc:team-manage-admins').'</h4>'; |
|
979 | 979 | $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
980 | 980 | $output .= '<div class="clearfix"></div>'; |
981 | - $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
981 | + $output .= '<h4>'.bts('Current team admins', array(), NULL, 'boinc:team-manage-admins').'</h4>'; |
|
982 | 982 | |
983 | 983 | return $output; |
984 | 984 | } |
@@ -991,17 +991,17 @@ discard block |
||
991 | 991 | $team = node_load($team_id); |
992 | 992 | |
993 | 993 | $output = ''; |
994 | - $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
994 | + $output .= '<h2 class="pane-title">'.bts('Manage team', array(), NULL, 'boinc:team-manage').'</h2>'; |
|
995 | 995 | |
996 | 996 | // PM all members |
997 | 997 | if (module_exists('privatemsg')) { |
998 | 998 | $output .= '<div class="form-item">'; |
999 | 999 | $output .= ' <ul class="tab-list action-list">'; |
1000 | - $output .= ' <li class="first tab primary">' . |
|
1001 | - l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
|
1000 | + $output .= ' <li class="first tab primary">'. |
|
1001 | + l('Send message to team', "community/teams/{$team_id}/message-all-members").'</li>'; |
|
1002 | 1002 | $output .= ' </ul>'; |
1003 | 1003 | $output .= ' <div class="description">'; |
1004 | - $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
|
1004 | + $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
|
1005 | 1005 | $output .= ' </div>'; |
1006 | 1006 | $output .= '</div>'; |
1007 | 1007 | } |
@@ -1019,13 +1019,13 @@ discard block |
||
1019 | 1019 | } |
1020 | 1020 | $output .= '<div class="form-item">'; |
1021 | 1021 | $output .= ' <ul class="tab-list action-list">'; |
1022 | - $output .= ' <li class="first tab primary">' . |
|
1022 | + $output .= ' <li class="first tab primary">'. |
|
1023 | 1023 | l(bts('Manage team message board', array(), NULL, 'boinc:team-manage'), |
1024 | 1024 | "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
1025 | 1025 | ); |
1026 | 1026 | $output .= ' </li>'; |
1027 | 1027 | $output .= ' <div class="description">'; |
1028 | - $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1028 | + $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1029 | 1029 | $output .= ' </div>'; |
1030 | 1030 | $output .= '</div>'; |
1031 | 1031 | } |
@@ -1033,15 +1033,15 @@ discard block |
||
1033 | 1033 | |
1034 | 1034 | // Team history |
1035 | 1035 | $output .= '<div class="form-item">'; |
1036 | - $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1036 | + $output .= ' <label>'.bts('View change history', array(), NULL, 'boinc:team-manage').'</label>'; |
|
1037 | 1037 | $output .= ' <ul class="tab-list">'; |
1038 | - $output .= ' <li class="first tab primary">' . |
|
1039 | - l('HTML', "community/teams/{$team_id}/history") . '</li>'; |
|
1040 | - $output .= ' <li class="last tab primary">' . |
|
1041 | - l('XML', "community/teams/{$team_id}/history/xml") . '</li>'; |
|
1038 | + $output .= ' <li class="first tab primary">'. |
|
1039 | + l('HTML', "community/teams/{$team_id}/history").'</li>'; |
|
1040 | + $output .= ' <li class="last tab primary">'. |
|
1041 | + l('XML', "community/teams/{$team_id}/history/xml").'</li>'; |
|
1042 | 1042 | $output .= ' </ul>'; |
1043 | 1043 | $output .= ' <div class="description">'; |
1044 | - $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1044 | + $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1045 | 1045 | $output .= ' </div>'; |
1046 | 1046 | $output .= '</div>'; |
1047 | 1047 | |
@@ -1049,30 +1049,30 @@ discard block |
||
1049 | 1049 | $output .= ' <ul class="tab-list action-list">'; |
1050 | 1050 | |
1051 | 1051 | // Edit team information |
1052 | - $output .= ' <li class="first tab primary">' . |
|
1053 | - l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
|
1052 | + $output .= ' <li class="first tab primary">'. |
|
1053 | + l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info").'</li>'; |
|
1054 | 1054 | |
1055 | 1055 | // Member list |
1056 | - $output .= ' <li class="tab primary">' . |
|
1057 | - l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
|
1056 | + $output .= ' <li class="tab primary">'. |
|
1057 | + l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members").'</li>'; |
|
1058 | 1058 | |
1059 | 1059 | // Remove members |
1060 | - $output .= ' <li class="tab primary">' . |
|
1061 | - l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
|
1060 | + $output .= ' <li class="tab primary">'. |
|
1061 | + l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members").'</li>'; |
|
1062 | 1062 | |
1063 | 1063 | if ($is_founder) { |
1064 | 1064 | |
1065 | 1065 | // Change founder |
1066 | - $output .= ' <li class="tab primary">' . |
|
1067 | - l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1066 | + $output .= ' <li class="tab primary">'. |
|
1067 | + l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder").'</li>'; |
|
1068 | 1068 | |
1069 | 1069 | // Manage admins |
1070 | - $output .= ' <li class="tab primary">' . |
|
1071 | - l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1070 | + $output .= ' <li class="tab primary">'. |
|
1071 | + l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins").'</li>'; |
|
1072 | 1072 | |
1073 | 1073 | // Delete the team |
1074 | - $output .= ' <li class="last tab primary">' . |
|
1075 | - l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1074 | + $output .= ' <li class="last tab primary">'. |
|
1075 | + l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete").'</li>'; |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | $output .= ' </ul>'; |
@@ -1089,12 +1089,12 @@ discard block |
||
1089 | 1089 | $account = user_load($user->uid); |
1090 | 1090 | $team = node_load($account->team); |
1091 | 1091 | $output = ''; |
1092 | - $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1093 | - $output .= '<p>' . bts('You are a member of @team.', |
|
1094 | - array('@team' => $team->title), NULL, 'boinc:account-team-panel') . '</p>'; |
|
1092 | + $output .= '<h2 class="pane-title">'.bts('My team', array(), NULL, 'boinc:account-team-panel').'</h2>'; |
|
1093 | + $output .= '<p>'.bts('You are a member of @team.', |
|
1094 | + array('@team' => $team->title), NULL, 'boinc:account-team-panel').'</p>'; |
|
1095 | 1095 | $output .= '<ul class="tab-list">'; |
1096 | - $output .= ' <li class="first last tab">' . |
|
1097 | - l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
|
1096 | + $output .= ' <li class="first last tab">'. |
|
1097 | + l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}").'</li>'; |
|
1098 | 1098 | $output .= '</ul>'; |
1099 | 1099 | return $output; |
1100 | 1100 | } |
@@ -1110,11 +1110,11 @@ discard block |
||
1110 | 1110 | $boincteam = boincteam_load($boincteam_id); |
1111 | 1111 | $boincuser_id = $account->boincuser_id; |
1112 | 1112 | $output = ''; |
1113 | - $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1113 | + $output .= '<h2 class="pane-title">'.bts('Request foundership', array(), NULL, 'boinc:team-request-foundership').'</h2>'; |
|
1114 | 1114 | |
1115 | 1115 | if (boincteam_user_requested_foundership($team_id)) { |
1116 | 1116 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
1117 | - $days_to_deadline = ceil(($deadline - time()) / (24*60*60)); |
|
1117 | + $days_to_deadline = ceil(($deadline - time())/(24*60*60)); |
|
1118 | 1118 | $request_age = 60 - $days_to_deadline; |
1119 | 1119 | $days_to_respond = 30 + $days_to_deadline; |
1120 | 1120 | if (time() > $deadline) { |
@@ -1142,8 +1142,8 @@ discard block |
||
1142 | 1142 | } |
1143 | 1143 | $output .= '</p>'; |
1144 | 1144 | $output .= '<ul class="tab-list">'; |
1145 | - $output .= ' <li class="first last tab">' . |
|
1146 | - l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
|
1145 | + $output .= ' <li class="first last tab">'. |
|
1146 | + l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership").'</li>'; |
|
1147 | 1147 | $output .= '</ul>'; |
1148 | 1148 | } |
1149 | 1149 | else { |
@@ -1167,29 +1167,29 @@ discard block |
||
1167 | 1167 | // who made the request has 30 additional days to assume foundership if |
1168 | 1168 | // there is no response to the request) |
1169 | 1169 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
1170 | - $days_to_deadline = ceil(($deadline - time()) / (24*60*60)) + 30; |
|
1170 | + $days_to_deadline = ceil(($deadline - time())/(24*60*60)) + 30; |
|
1171 | 1171 | $output .= '<p>'; |
1172 | 1172 | $output .= bts('A team foundership change was already requested recently.' |
1173 | 1173 | . ' Only one request is allowed within a period of 90 days.', |
1174 | 1174 | NULL, 'boinc:team-request-foundership'); |
1175 | 1175 | if ($days_to_deadline == 1) { |
1176 | - $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1176 | + $output .= ' ('.bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership').')'; |
|
1177 | 1177 | } |
1178 | 1178 | else { |
1179 | - $output .= ' (' . bts('@count days remaining', |
|
1179 | + $output .= ' ('.bts('@count days remaining', |
|
1180 | 1180 | array('@count' => $days_to_deadline), |
1181 | - NULL, 'boinc:team-request-foundership') . ')'; |
|
1181 | + NULL, 'boinc:team-request-foundership').')'; |
|
1182 | 1182 | } |
1183 | 1183 | $output .= '</p>'; |
1184 | 1184 | } |
1185 | 1185 | else { |
1186 | - $output .= '<p>' . bts('If the team founder is not active and you want to' |
|
1186 | + $output .= '<p>'.bts('If the team founder is not active and you want to' |
|
1187 | 1187 | . ' assume the role of founder, click below to request foundership of' |
1188 | 1188 | . ' @this_team.', |
1189 | - array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1189 | + array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership').'</p>'; |
|
1190 | 1190 | $output .= '<ul class="tab-list">'; |
1191 | - $output .= ' <li class="first last tab">' . |
|
1192 | - l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1191 | + $output .= ' <li class="first last tab">'. |
|
1192 | + l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership").'</li>'; |
|
1193 | 1193 | $output .= '</ul>'; |
1194 | 1194 | } |
1195 | 1195 | return $output; |
@@ -1210,15 +1210,15 @@ discard block |
||
1210 | 1210 | if ($boincteam->ping_user) { |
1211 | 1211 | if ($boincteam->ping_user < 0) { |
1212 | 1212 | $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
1213 | - $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1213 | + $output .= '<h2 class="pane-title">'.bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1214 | 1214 | . '</h2>'; |
1215 | - $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
1215 | + $output .= '<p>'.bts('Team member @name requested team foundership on' |
|
1216 | 1216 | . ' @date, but then left the team. This request is now canceled.', |
1217 | 1217 | array( |
1218 | 1218 | '@name' => $member->boincuser_name, |
1219 | 1219 | '@date' => date('j M Y', $boincteam->ping_time), |
1220 | 1220 | ), |
1221 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1221 | + NULL, 'boinc:team-request-foundership-response').'</p>'; |
|
1222 | 1222 | // Automatically cancel the request |
1223 | 1223 | db_set_active('boinc_rw'); |
1224 | 1224 | db_query(" |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | else { |
1233 | 1233 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1234 | - $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1234 | + $output .= '<h2 class="pane-title">'.bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1235 | 1235 | . '</h2>'; |
1236 | - $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
1236 | + $output .= '<p>'.bts('Team member @name has requested team foundership.' |
|
1237 | 1237 | . ' This may be because you left the team or have not had contact with' |
1238 | 1238 | . ' the team for a long time.', array( |
1239 | 1239 | '@name' => $member->boincuser_name, |
1240 | 1240 | ) |
1241 | - , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1242 | - $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
1241 | + , array(), NULL, 'boinc:team-request-foundership-response').'</p>'; |
|
1242 | + $output .= '<p>'.bts("If you don't decline the request by @date, @name" |
|
1243 | 1243 | . ' will have the option of assuming team foundership. (note: To' |
1244 | 1244 | . ' accept the request, assign foundership to @name using the form' |
1245 | 1245 | . ' below)', |
@@ -1247,10 +1247,10 @@ discard block |
||
1247 | 1247 | '@name' => $member->boincuser_name, |
1248 | 1248 | '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
1249 | 1249 | ), |
1250 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1250 | + NULL, 'boinc:team-request-foundership-response').'</p>'; |
|
1251 | 1251 | $output .= '<ul class="tab-list">'; |
1252 | - $output .= ' <li class="first last tab">' . |
|
1253 | - l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
|
1252 | + $output .= ' <li class="first last tab">'. |
|
1253 | + l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request").'</li>'; |
|
1254 | 1254 | $output .= '</ul>'; |
1255 | 1255 | } |
1256 | 1256 | } |
@@ -1260,9 +1260,9 @@ discard block |
||
1260 | 1260 | function boincteam_search_panel() { |
1261 | 1261 | $output = ''; |
1262 | 1262 | if (module_exists('global_search_teams_solr')) { |
1263 | - $output .= '<h2 class="pane-title">' . bts('Search teams', array(), NULL, 'boinc:search-team') . '</h2>'; |
|
1263 | + $output .= '<h2 class="pane-title">'.bts('Search teams', array(), NULL, 'boinc:search-team').'</h2>'; |
|
1264 | 1264 | //$output .= '<p>' . bts('Render a search form here.', array(), NULL, 'boinc:search-team') . '</p>'; |
1265 | - $output .= '<p>' . boincteam_search_view() . '</p>'; |
|
1265 | + $output .= '<p>'.boincteam_search_view().'</p>'; |
|
1266 | 1266 | } |
1267 | 1267 | return $output; |
1268 | 1268 | } |
@@ -1278,20 +1278,20 @@ discard block |
||
1278 | 1278 | * General info about the concept of teams |
1279 | 1279 | */ |
1280 | 1280 | function boincteam_topic_overview_panel() { |
1281 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1281 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1282 | 1282 | $output = ''; |
1283 | - $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1283 | + $output .= '<h2 class="pane-title">'.bts('Teams', array(), NULL, 'boinc:team-general-info').'</h2>'; |
|
1284 | 1284 | $output .= '<div class="">'; |
1285 | - $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
1285 | + $output .= '<p>'.bts('@project participants may form teams. You may belong' |
|
1286 | 1286 | . ' to only one team. You can join or quit a team at any time. To join a' |
1287 | 1287 | . ' team, visit its team page and click "Join this team". Each team has a' |
1288 | - . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info') . '</p>'; |
|
1288 | + . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info').'</p>'; |
|
1289 | 1289 | $output .= '<ul>'; |
1290 | - $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1291 | - $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | - $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | - $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | - $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1290 | + $output .= ' <li>'.bts('Private Message all team members', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1291 | + $output .= ' <li>'.bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1292 | + $output .= ' <li>'.bts('add or remove team admins', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1293 | + $output .= ' <li>'.bts('remove members from the team', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1294 | + $output .= ' <li>'.bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info').'</li>'; |
|
1295 | 1295 | $output .= '</ul>'; |
1296 | 1296 | $output .= '</div>'; |
1297 | 1297 | return $output; |
@@ -1336,34 +1336,34 @@ discard block |
||
1336 | 1336 | } |
1337 | 1337 | } |
1338 | 1338 | $output = ''; |
1339 | - $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
1339 | + $output .= '<h2 class="pane-title">'.$boincteam->name.'</h2>'; |
|
1340 | 1340 | $output .= '<div>'; |
1341 | 1341 | $output .= '<div class="left-column">'; |
1342 | 1342 | $output .= '<ul class="stats">'; |
1343 | - $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | - $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | - $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | - $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1343 | + $output .= ' <li>'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').': '.number_format($boincteam->total_credit, 0).'</li>'; |
|
1344 | + $output .= ' <li>'.bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC').': '.number_format($boincteam->expavg_credit, 2).'</li>'; |
|
1345 | + $output .= ' <li>'.bts('Country', array(), NULL, 'boinc:country-of-origin').': '.$boincteam->country.'</li>'; |
|
1346 | + $output .= ' <li>'.bts('Type', array(), NULL, 'boinc:view-team-info').': '.boincteam_get_type($team_id).'</li>'; |
|
1347 | 1347 | $output .= '</ul>'; |
1348 | 1348 | $output .= '</div>'; |
1349 | 1349 | $output .= '<div class="right-column">'; |
1350 | 1350 | $output .= '<ul class="stats">'; |
1351 | - $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | - $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | - $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | - $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | - $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1351 | + $output .= ' <li>'.bts('Founder', array(), NULL, 'boinc:view-team-info').': '.l($founder->boincuser_name, "account/{$founder->uid}").'</li>'; |
|
1352 | + $output .= ' <li>'.bts('New members in last day', array(), NULL, 'boinc:view-team-info').': '.implode('·', $new_members).'</li>'; |
|
1353 | + $output .= ' <li>'.bts('Total members', array(), NULL, 'boinc:view-team-info').': '.l($boincteam->nusers, "community/teams/{$team_id}/members").'</li>'; |
|
1354 | + $output .= ' <li>'.bts('Active members', array(), NULL, 'boinc:view-team-info').': '.$boincteam->nusers_active.'</li>'; |
|
1355 | + $output .= ' <li>'.bts('Members with credit', array(), NULL, 'boinc:view-team-info').': '.$boincteam->nusers_worked.'</li>'; |
|
1356 | 1356 | $output .= '</ul>'; |
1357 | 1357 | $output .= '</div>'; |
1358 | 1358 | $output .= '</div>'; |
1359 | 1359 | $output .= '<div class="clearfix"></div>'; |
1360 | 1360 | if ($boincteam->url) { |
1361 | 1361 | $output .= '<div class="stats">'; |
1362 | - $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1362 | + $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team').': '.l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1363 | 1363 | $output .= '</div>'; |
1364 | 1364 | } |
1365 | 1365 | if ($team->body) { |
1366 | - $output .= '<h3>' . bts('Description', array(), NULL, 'boinc:team-description') . '</h3>'; |
|
1366 | + $output .= '<h3>'.bts('Description', array(), NULL, 'boinc:team-description').'</h3>'; |
|
1367 | 1367 | $output .= check_markup($team->body, $team->format); |
1368 | 1368 | $output .= '</div>'; |
1369 | 1369 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | 'type' => MENU_CALLBACK, |
103 | 103 | ); |
104 | 104 | $items['community/teams/%/message-all-members'] = array( |
105 | - 'title' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
|
106 | - 'description' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
|
105 | + 'title' => bts('Send Message to Team', array(), null, 'boinc:team-manage'), |
|
106 | + 'description' => bts('Send Message to Team', array(), null, 'boinc:team-manage'), |
|
107 | 107 | 'page callback' => 'drupal_get_form', |
108 | 108 | 'page arguments' => array('boincteam_sendmessagetoteam', 2), |
109 | 109 | 'access callback' => 'boincteam_is_admin', |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | return array( |
141 | 141 | 'boincteam_utility_team_table' => array( |
142 | - 'arguments' => array('form' => NULL), |
|
142 | + 'arguments' => array('form' => null), |
|
143 | 143 | 'file' => 'boincteam.admin.inc', |
144 | 144 | ), |
145 | 145 | ); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | function boincteam_delete($team_id) { |
274 | 274 | $team = node_load($team_id); |
275 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
275 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), true); |
|
276 | 276 | if ($boincteam->nusers == 1) { |
277 | 277 | require_boinc('team'); |
278 | 278 | $boincuser = boincuser_load(); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | else { |
289 | 289 | drupal_set_message(t('All members must be removed from @team before the |
290 | 290 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
291 | - drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
|
291 | + drupal_goto(strstr($_GET['q'], '/delete', true)); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | /** |
318 | 318 | * Get the join date of a user |
319 | 319 | */ |
320 | -function boincteam_get_member_join_date($boincteam_id, $boincuser_id = NULL) { |
|
320 | +function boincteam_get_member_join_date($boincteam_id, $boincuser_id = null) { |
|
321 | 321 | if (!$boincuser_id) { |
322 | 322 | global $user; |
323 | 323 | $account = user_load($user->uid); |
@@ -415,10 +415,10 @@ discard block |
||
415 | 415 | /** |
416 | 416 | * Get a BOINC team object |
417 | 417 | */ |
418 | -function boincteam_load($boincteam_id, $full_object = FALSE) { |
|
418 | +function boincteam_load($boincteam_id, $full_object = false) { |
|
419 | 419 | require_boinc(array('team')); |
420 | 420 | $team = BoincTeam::lookup_id($boincteam_id); |
421 | - if ($team AND $full_object) { |
|
421 | + if ($team and $full_object) { |
|
422 | 422 | $team->nusers = BoincUser::count("teamid={$team->id}"); |
423 | 423 | $team->nusers_worked = BoincUser::count("teamid={$team->id} and total_credit>0"); |
424 | 424 | $team->nusers_active = BoincUser::count("teamid={$team->id} and expavg_credit>0.1"); |
@@ -433,39 +433,39 @@ discard block |
||
433 | 433 | /** |
434 | 434 | * Check if a user is the team founder |
435 | 435 | */ |
436 | -function boincteam_is_founder($nid, $uid = NULL) { |
|
436 | +function boincteam_is_founder($nid, $uid = null) { |
|
437 | 437 | if (!$uid) { |
438 | 438 | global $user; |
439 | 439 | $uid = $user->uid; |
440 | 440 | } |
441 | 441 | if (!boincteam_is_member($nid, $uid)) { |
442 | - return FALSE; |
|
442 | + return false; |
|
443 | 443 | } |
444 | 444 | $team_id = boincteam_lookup_id($nid); |
445 | 445 | require_boinc('team'); |
446 | - return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
446 | + return is_team_founder(boincuser_load($uid, true), boincteam_load($team_id)); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Check if a user is a team admin |
451 | 451 | */ |
452 | -function boincteam_is_admin($nid, $uid = NULL) { |
|
452 | +function boincteam_is_admin($nid, $uid = null) { |
|
453 | 453 | if (!$uid) { |
454 | 454 | global $user; |
455 | 455 | $uid = $user->uid; |
456 | 456 | } |
457 | 457 | if (!boincteam_is_member($nid, $uid)) { |
458 | - return FALSE; |
|
458 | + return false; |
|
459 | 459 | } |
460 | 460 | $team_id = boincteam_lookup_id($nid); |
461 | 461 | require_boinc('team'); |
462 | - return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
462 | + return is_team_admin(boincuser_load($uid, true), boincteam_load($team_id)); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Check if a user is a team member |
467 | 467 | */ |
468 | -function boincteam_is_member($nid, $uid = NULL) { |
|
468 | +function boincteam_is_member($nid, $uid = null) { |
|
469 | 469 | if (!$uid) { |
470 | 470 | global $user; |
471 | 471 | $uid = $user->uid; |
@@ -492,9 +492,9 @@ discard block |
||
492 | 492 | drupal_set_message( |
493 | 493 | bts( |
494 | 494 | 'A foundership transfer request has been made for your team. Please !respond.', |
495 | - array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | - NULL, 'boinc:team-founder-change'), |
|
497 | - 'warning', FALSE |
|
495 | + array('!respond' => l(bts('respond to the request', array(), null, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | + null, 'boinc:team-founder-change'), |
|
497 | + 'warning', false |
|
498 | 498 | ); |
499 | 499 | } |
500 | 500 | } |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | $boincteam_id = boincteam_lookup_id($team_id); |
513 | 513 | $boincteam = boincteam_load($boincteam_id); |
514 | - if ($boincteam->joinable AND $account->team != $team_id) { |
|
514 | + if ($boincteam->joinable and $account->team != $team_id) { |
|
515 | 515 | require_boinc('team'); |
516 | 516 | $boincuser = boincuser_load(); |
517 | 517 | if (user_join_team($boincteam, $boincuser)) { |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | $boincteam = boincteam_load($boincteam_id); |
604 | 604 | if ($account->team == $team_id) { |
605 | 605 | require_boinc('team'); |
606 | - $boincuser = boincuser_load($user_id, TRUE); |
|
606 | + $boincuser = boincuser_load($user_id, true); |
|
607 | 607 | user_quit_team($boincuser); |
608 | 608 | drupal_set_message(t('@user has been removed from @team.', |
609 | 609 | array( |
@@ -725,14 +725,14 @@ discard block |
||
725 | 725 | $now = time(); |
726 | 726 | if ($boincteam->ping_user <= 0) { |
727 | 727 | if ($boincteam->ping_time < $now - 60 * (24*60*60)) { |
728 | - return TRUE; |
|
728 | + return true; |
|
729 | 729 | } |
730 | - return FALSE; |
|
730 | + return false; |
|
731 | 731 | } |
732 | 732 | if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
733 | - return TRUE; |
|
733 | + return true; |
|
734 | 734 | } |
735 | - return FALSE; |
|
735 | + return false; |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | /** |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | /** |
754 | 754 | * Check if a user has an active foundership request with a team |
755 | 755 | */ |
756 | -function boincteam_user_requested_foundership($team_id, $user_id = NULL) { |
|
756 | +function boincteam_user_requested_foundership($team_id, $user_id = null) { |
|
757 | 757 | if (!$user_id) { |
758 | 758 | global $user; |
759 | 759 | $user_id = $user->uid; |
@@ -778,27 +778,27 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function boincteam_about_admins_panel() { |
780 | 780 | $output = ''; |
781 | - $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
781 | + $output .= '<h2 class="pane-title">' . bts('About team admins', array(), null, 'boinc:team-admins-panel') . '</h2>'; |
|
782 | 782 | $output .= '<div>'; |
783 | - $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
783 | + $output .= '<p>' . bts('Team admins can:', array(), null, 'boinc:team-admins-panel') . '</p>'; |
|
784 | 784 | $output .= '<ul>'; |
785 | - $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
786 | - $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | - $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | - $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | - $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
785 | + $output .= ' <li>' . bts('Edit team information', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
786 | + $output .= ' <li>' . bts("View the team's join / quit history", array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
787 | + $output .= ' <li>' . bts('Moderate the team forum', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
788 | + $output .= ' <li>' . bts('Remove members from the team', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
789 | + $output .= ' <li>' . bts('Disband a team if it has no members', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
790 | 790 | $output .= '</ul>'; |
791 | 791 | $output .= '</div>'; |
792 | 792 | $output .= '<div>'; |
793 | - $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
793 | + $output .= '<p>' . bts('Team admins cannot:', array(), null, 'boinc:team-admins-panel') . '</p>'; |
|
794 | 794 | $output .= '<ul>'; |
795 | - $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
796 | - $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | - $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
795 | + $output .= ' <li>' . bts('Change the team founder', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
796 | + $output .= ' <li>' . bts('Remove members', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
797 | + $output .= ' <li>' . bts('Add / Remove team admins', array(), null, 'boinc:team-admins-panel') . '</li>'; |
|
798 | 798 | $output .= '</ul>'; |
799 | 799 | $output .= '</div>'; |
800 | 800 | $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
801 | - . ' team admin. We recommend only selecting people you know and trust', array(), NULL, 'boinc:team-admins-panel') |
|
801 | + . ' team admin. We recommend only selecting people you know and trust', array(), null, 'boinc:team-admins-panel') |
|
802 | 802 | . '</p>'; |
803 | 803 | return $output; |
804 | 804 | } |
@@ -808,26 +808,26 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function boincteam_about_founder_panel() { |
810 | 810 | $output = ''; |
811 | - $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
811 | + $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), null, 'boinc:team-founder-panel') |
|
812 | 812 | . '</h2>'; |
813 | 813 | $output .= '<div>'; |
814 | - $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
814 | + $output .= '<p>' . bts('Notes about changes in foundership:', array(), null, 'boinc:team-founder-panel') . '</p>'; |
|
815 | 815 | $output .= '<ul>'; |
816 | - $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
817 | - $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
816 | + $output .= ' <li>' . bts('Any member of the team is eligible', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
817 | + $output .= ' <li>' . bts('Current founder becomes a normal user', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
818 | 818 | $output .= '</ul>'; |
819 | 819 | $output .= '</div>'; |
820 | 820 | $output .= '<div>'; |
821 | - $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
821 | + $output .= '<p>' . bts('Foundership can be requested by team members:', array(), null, 'boinc:team-founder-panel') |
|
822 | 822 | . '</p>'; |
823 | 823 | $output .= '<ul>'; |
824 | - $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
825 | - $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
824 | + $output .= ' <li>' . bts('One request is allowed at a time', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
825 | + $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), null, 'boinc:team-founder-panel') |
|
826 | 826 | . '</li>'; |
827 | - $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
827 | + $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), null, 'boinc:team-founder-panel') |
|
828 | 828 | . '</li>'; |
829 | 829 | $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
830 | - . ' request', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
830 | + . ' request', array(), null, 'boinc:team-founder-panel') . '</li>'; |
|
831 | 831 | $output .= '</ul>'; |
832 | 832 | $output .= '</div>'; |
833 | 833 | return $output; |
@@ -841,16 +841,16 @@ discard block |
||
841 | 841 | $account = user_load($user->uid); |
842 | 842 | $unrestricted_role = array_search('verified contributor', user_roles(true)); |
843 | 843 | $output = ''; |
844 | - $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
844 | + $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), null, 'boinc:create-team-panel') . '</h2>'; |
|
845 | 845 | $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
846 | - . ' can create a team.', array(), NULL, 'boinc:create-team-panel') . '</p>'; |
|
846 | + . ' can create a team.', array(), null, 'boinc:create-team-panel') . '</p>'; |
|
847 | 847 | $output .= '<ul class="tab-list">'; |
848 | 848 | $output .= ' <li class="first last tab">'; |
849 | 849 | if (isset($account->roles[$unrestricted_role])) { |
850 | - $output .= l(bts('Create new team', array(), NULL, 'boinc:create-team-panel'), 'community/teams/add'); |
|
850 | + $output .= l(bts('Create new team', array(), null, 'boinc:create-team-panel'), 'community/teams/add'); |
|
851 | 851 | } elseif ($account->uid <= 0) { |
852 | 852 | $output .= l( |
853 | - bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
853 | + bts('Login to create a new team', array(), null, 'boinc:create-team-panel'), |
|
854 | 854 | 'user/login', |
855 | 855 | array('query' => drupal_get_destination()) |
856 | 856 | ); |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | $credit_needed = $min_credit_needed - $account->boincuser_total_credit; |
860 | 860 | $output .= '['; |
861 | 861 | if ($credit_needed == 1) { |
862 | - $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
862 | + $output .= bts('You must earn 1 more credit!', array(), null, 'boinc:create-team-panel'); |
|
863 | 863 | } |
864 | 864 | else { |
865 | 865 | $output .= bts('You must earn @count more credits!', |
866 | 866 | array('@count' => $credit_needed), |
867 | - NULL, 'boinc:create-team-panel' |
|
867 | + null, 'boinc:create-team-panel' |
|
868 | 868 | ); |
869 | 869 | } |
870 | 870 | $output .= ']'; |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | */ |
880 | 880 | function boincteam_create_team_panel() { |
881 | 881 | $output = ''; |
882 | - $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
882 | + $output .= '<h2 class="pane-title">' . bts('Create a team', array(), null, 'boinc:create-team-panel') . '</h2>'; |
|
883 | 883 | $output .= drupal_get_form('boincteam_create_form'); |
884 | 884 | |
885 | 885 | return $output; |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | /** |
889 | 889 | * Link to user's team |
890 | 890 | */ |
891 | -function boincteam_dashboard_panel($uid = NULL) { |
|
891 | +function boincteam_dashboard_panel($uid = null) { |
|
892 | 892 | global $user; |
893 | 893 | if (!$uid) { |
894 | 894 | $uid = $user->uid; |
@@ -897,29 +897,29 @@ discard block |
||
897 | 897 | $account = user_load($uid); |
898 | 898 | if ($account->team) { |
899 | 899 | $team = boincteam_load(boincteam_lookup_id($account->team)); |
900 | - $output .= '<h2 class="pane-title">' . bts('Team', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
900 | + $output .= '<h2 class="pane-title">' . bts('Team', array(), null, 'boinc:team-dashboard') . '</h2>'; |
|
901 | 901 | $output .= '<div class="stats">'; |
902 | - $output .= ' <label>' . bts('Name', array(), NULL, 'boinc:user-or-team-name') . ': </label>'; |
|
902 | + $output .= ' <label>' . bts('Name', array(), null, 'boinc:user-or-team-name') . ': </label>'; |
|
903 | 903 | $output .= ' <span>' . l($team->name, "community/teams/{$account->team}") . '</span>'; |
904 | 904 | $output .= '</div>' . "\n"; |
905 | 905 | $output .= '<div class="stats">'; |
906 | - $output .= ' <label>' . bts('Member since', array(), NULL, 'boinc:user-info') . ': </label>'; |
|
906 | + $output .= ' <label>' . bts('Member since', array(), null, 'boinc:user-info') . ': </label>'; |
|
907 | 907 | $output .= ' <span>' . date('j F Y', boincteam_get_member_join_date($team->id, $account->boincuser_id)) . '</span>'; |
908 | 908 | $output .= '</div>' . "\n"; |
909 | 909 | $output .= '<div class="stats">'; |
910 | - $output .= ' <label>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': </label>'; |
|
910 | + $output .= ' <label>' . bts('Country', array(), null, 'boinc:country-of-origin') . ': </label>'; |
|
911 | 911 | $output .= ' <span>' . $team->country . '</span>'; |
912 | 912 | $output .= '</div>' . "\n"; |
913 | 913 | $output .= '<div class="stats">'; |
914 | - $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
|
914 | + $output .= ' <label>' . bts('Total credit', array(), null, 'boinc:user-or-team-total-credits') . ': </label>'; |
|
915 | 915 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
916 | 916 | $output .= '</div>' . "\n"; |
917 | 917 | } |
918 | 918 | else if ($user->uid == $account->uid) { |
919 | - $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
|
919 | + $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), null, 'boinc:team-dashboard') . '</h2>'; |
|
920 | 920 | $output .= '<ul class="tab-list action-list">'; |
921 | 921 | $output .= '<li class="tab primary">'; |
922 | - $output .= l(bts('Join a Team', array(), NULL, 'boinc:team-dashboard'), 'community/teams'); |
|
922 | + $output .= l(bts('Join a Team', array(), null, 'boinc:team-dashboard'), 'community/teams'); |
|
923 | 923 | $output .= '</li>'; |
924 | 924 | $output .= '</ul>'; |
925 | 925 | } |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | function boincteam_join_team_panel($team_id) { |
945 | 945 | $team = node_load($team_id); |
946 | 946 | $output = ''; |
947 | - $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
947 | + $output .= '<h2 class="pane-title">' . bts('Join team', array(), null, 'boinc:join-team-panel') . '</h2>'; |
|
948 | 948 | $output .= '<p>' . bts('Click here to become a member of @this_team', |
949 | - array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel') . '</p>'; |
|
949 | + array('@this_team' =>$team->title), null, 'boinc:join-team-panel') . '</p>'; |
|
950 | 950 | $output .= '<ul class="tab-list">'; |
951 | 951 | $output .= ' <li class="first last tab">' . |
952 | - l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
|
952 | + l(bts('Join this team', array(), null, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
|
953 | 953 | $output .= '</ul>'; |
954 | 954 | return $output; |
955 | 955 | } |
@@ -960,12 +960,12 @@ discard block |
||
960 | 960 | function boincteam_leave_team_panel($team_id) { |
961 | 961 | $team = node_load($team_id); |
962 | 962 | $output = ''; |
963 | - $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
963 | + $output .= '<h2 class="pane-title">' . bts('Leave team', array(), null, 'boinc:leave-team-panel') . '</h2>'; |
|
964 | 964 | $output .= '<p>' . bts('Click here to revoke your membership with' |
965 | - . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel') . '</p>'; |
|
965 | + . ' @this_team', array('@this_team' =>$team->title), null, 'boinc:leave-team-panel') . '</p>'; |
|
966 | 966 | $output .= '<ul class="tab-list">'; |
967 | 967 | $output .= ' <li class="first last tab">' . |
968 | - l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
|
968 | + l(bts('Leave this team', array(), null, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
|
969 | 969 | $output .= '</ul>'; |
970 | 970 | return $output; |
971 | 971 | } |
@@ -975,10 +975,10 @@ discard block |
||
975 | 975 | */ |
976 | 976 | function boincteam_manage_admins_panel_header($team_id) { |
977 | 977 | $output = ''; |
978 | - $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
978 | + $output .= '<h4>' . bts('Add team admin', array(), null, 'boinc:team-manage-admins') . '</h4>'; |
|
979 | 979 | $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
980 | 980 | $output .= '<div class="clearfix"></div>'; |
981 | - $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
981 | + $output .= '<h4>' . bts('Current team admins', array(), null, 'boinc:team-manage-admins') . '</h4>'; |
|
982 | 982 | |
983 | 983 | return $output; |
984 | 984 | } |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | $team = node_load($team_id); |
992 | 992 | |
993 | 993 | $output = ''; |
994 | - $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
994 | + $output .= '<h2 class="pane-title">' . bts('Manage team', array(), null, 'boinc:team-manage') . '</h2>'; |
|
995 | 995 | |
996 | 996 | // PM all members |
997 | 997 | if (module_exists('privatemsg')) { |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
1002 | 1002 | $output .= ' </ul>'; |
1003 | 1003 | $output .= ' <div class="description">'; |
1004 | - $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
|
1004 | + $output .= bts('Contact all team members using e-mail.', array(), null, 'boinc:team-manage'); |
|
1005 | 1005 | $output .= ' </div>'; |
1006 | 1006 | $output .= '</div>'; |
1007 | 1007 | } |
@@ -1020,12 +1020,12 @@ discard block |
||
1020 | 1020 | $output .= '<div class="form-item">'; |
1021 | 1021 | $output .= ' <ul class="tab-list action-list">'; |
1022 | 1022 | $output .= ' <li class="first tab primary">' . |
1023 | - l(bts('Manage team message board', array(), NULL, 'boinc:team-manage'), |
|
1023 | + l(bts('Manage team message board', array(), null, 'boinc:team-manage'), |
|
1024 | 1024 | "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
1025 | 1025 | ); |
1026 | 1026 | $output .= ' </li>'; |
1027 | 1027 | $output .= ' <div class="description">'; |
1028 | - $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1028 | + $output .= bts('Create or manage message board', array(), null, 'boinc:team-manage'); |
|
1029 | 1029 | $output .= ' </div>'; |
1030 | 1030 | $output .= '</div>'; |
1031 | 1031 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | |
1034 | 1034 | // Team history |
1035 | 1035 | $output .= '<div class="form-item">'; |
1036 | - $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1036 | + $output .= ' <label>' . bts('View change history', array(), null, 'boinc:team-manage') . '</label>'; |
|
1037 | 1037 | $output .= ' <ul class="tab-list">'; |
1038 | 1038 | $output .= ' <li class="first tab primary">' . |
1039 | 1039 | l('HTML', "community/teams/{$team_id}/history") . '</li>'; |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | l('XML', "community/teams/{$team_id}/history/xml") . '</li>'; |
1042 | 1042 | $output .= ' </ul>'; |
1043 | 1043 | $output .= ' <div class="description">'; |
1044 | - $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1044 | + $output .= bts('See member activity', array(), null, 'boinc:team-manage'); |
|
1045 | 1045 | $output .= ' </div>'; |
1046 | 1046 | $output .= '</div>'; |
1047 | 1047 | |
@@ -1050,29 +1050,29 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | // Edit team information |
1052 | 1052 | $output .= ' <li class="first tab primary">' . |
1053 | - l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
|
1053 | + l(bts('Edit team info', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
|
1054 | 1054 | |
1055 | 1055 | // Member list |
1056 | 1056 | $output .= ' <li class="tab primary">' . |
1057 | - l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
|
1057 | + l(bts('View member list', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
|
1058 | 1058 | |
1059 | 1059 | // Remove members |
1060 | 1060 | $output .= ' <li class="tab primary">' . |
1061 | - l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
|
1061 | + l(bts('Remove members', array(), null, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
|
1062 | 1062 | |
1063 | 1063 | if ($is_founder) { |
1064 | 1064 | |
1065 | 1065 | // Change founder |
1066 | 1066 | $output .= ' <li class="tab primary">' . |
1067 | - l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1067 | + l(bts('Change founder', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1068 | 1068 | |
1069 | 1069 | // Manage admins |
1070 | 1070 | $output .= ' <li class="tab primary">' . |
1071 | - l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1071 | + l(bts('Manage team admins', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1072 | 1072 | |
1073 | 1073 | // Delete the team |
1074 | 1074 | $output .= ' <li class="last tab primary">' . |
1075 | - l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1075 | + l(bts('Remove team', array(), null, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | $output .= ' </ul>'; |
@@ -1089,12 +1089,12 @@ discard block |
||
1089 | 1089 | $account = user_load($user->uid); |
1090 | 1090 | $team = node_load($account->team); |
1091 | 1091 | $output = ''; |
1092 | - $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1092 | + $output .= '<h2 class="pane-title">' . bts('My team', array(), null, 'boinc:account-team-panel') . '</h2>'; |
|
1093 | 1093 | $output .= '<p>' . bts('You are a member of @team.', |
1094 | - array('@team' => $team->title), NULL, 'boinc:account-team-panel') . '</p>'; |
|
1094 | + array('@team' => $team->title), null, 'boinc:account-team-panel') . '</p>'; |
|
1095 | 1095 | $output .= '<ul class="tab-list">'; |
1096 | 1096 | $output .= ' <li class="first last tab">' . |
1097 | - l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
|
1097 | + l(bts('View my team', array(), null, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
|
1098 | 1098 | $output .= '</ul>'; |
1099 | 1099 | return $output; |
1100 | 1100 | } |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | $boincteam = boincteam_load($boincteam_id); |
1111 | 1111 | $boincuser_id = $account->boincuser_id; |
1112 | 1112 | $output = ''; |
1113 | - $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1113 | + $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), null, 'boinc:team-request-foundership') . '</h2>'; |
|
1114 | 1114 | |
1115 | 1115 | if (boincteam_user_requested_foundership($team_id)) { |
1116 | 1116 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
@@ -1121,29 +1121,29 @@ discard block |
||
1121 | 1121 | $output .= '<p>'; |
1122 | 1122 | if ($request_age == 1) { |
1123 | 1123 | $output .= bts('1 day has elapsed since your request and' |
1124 | - . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
1124 | + . ' the founder has not responded.', array(), null, 'boinc:team-request-foundership'); |
|
1125 | 1125 | } |
1126 | 1126 | else { |
1127 | 1127 | $output .= bts('@count days have elapsed since your request and' |
1128 | 1128 | . ' the founder has not responded.', |
1129 | 1129 | array('@count' => $request_age), |
1130 | - NULL, 'boinc:team-request-foundership'); |
|
1130 | + null, 'boinc:team-request-foundership'); |
|
1131 | 1131 | } |
1132 | 1132 | $output .= ' '; |
1133 | 1133 | if ($days_to_respond == 1) { |
1134 | 1134 | $output .= bts('You now have 1 day to assume foundership before' |
1135 | - . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
1135 | + . ' another team member may submit a request.', array(), null, 'boinc:team-request-foundership'); |
|
1136 | 1136 | } |
1137 | 1137 | else { |
1138 | 1138 | $output .= bts('You now have @count days to assume foundership before' |
1139 | 1139 | . ' another team member may submit a request.', |
1140 | 1140 | array('@count' => $days_to_respond), |
1141 | - NULL, 'boinc:team-request-foundership'); |
|
1141 | + null, 'boinc:team-request-foundership'); |
|
1142 | 1142 | } |
1143 | 1143 | $output .= '</p>'; |
1144 | 1144 | $output .= '<ul class="tab-list">'; |
1145 | 1145 | $output .= ' <li class="first last tab">' . |
1146 | - l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
|
1146 | + l(bts('Assume foundership', array(), null, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
|
1147 | 1147 | $output .= '</ul>'; |
1148 | 1148 | } |
1149 | 1149 | else { |
@@ -1151,12 +1151,12 @@ discard block |
||
1151 | 1151 | if ($days_to_deadline == 1) { |
1152 | 1152 | $output .= bts('The team founder has 1 day to respond to your' |
1153 | 1153 | . ' transfer request.', |
1154 | - NULL, 'boinc:team-request-foundership'); |
|
1154 | + null, 'boinc:team-request-foundership'); |
|
1155 | 1155 | } |
1156 | 1156 | else { |
1157 | 1157 | $output .= bts('The team founder has @count days to respond to your' |
1158 | 1158 | . ' transfer request.', array('@count' => $days_to_deadline), |
1159 | - NULL, 'boinc:team-request-foundership'); |
|
1159 | + null, 'boinc:team-request-foundership'); |
|
1160 | 1160 | } |
1161 | 1161 | $output .= '</p>'; |
1162 | 1162 | } |
@@ -1171,14 +1171,14 @@ discard block |
||
1171 | 1171 | $output .= '<p>'; |
1172 | 1172 | $output .= bts('A team foundership change was already requested recently.' |
1173 | 1173 | . ' Only one request is allowed within a period of 90 days.', |
1174 | - NULL, 'boinc:team-request-foundership'); |
|
1174 | + null, 'boinc:team-request-foundership'); |
|
1175 | 1175 | if ($days_to_deadline == 1) { |
1176 | - $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1176 | + $output .= ' (' . bts('1 day remaining', array(), null, 'boinc:team-request-foundership') . ')'; |
|
1177 | 1177 | } |
1178 | 1178 | else { |
1179 | 1179 | $output .= ' (' . bts('@count days remaining', |
1180 | 1180 | array('@count' => $days_to_deadline), |
1181 | - NULL, 'boinc:team-request-foundership') . ')'; |
|
1181 | + null, 'boinc:team-request-foundership') . ')'; |
|
1182 | 1182 | } |
1183 | 1183 | $output .= '</p>'; |
1184 | 1184 | } |
@@ -1186,10 +1186,10 @@ discard block |
||
1186 | 1186 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1187 | 1187 | . ' assume the role of founder, click below to request foundership of' |
1188 | 1188 | . ' @this_team.', |
1189 | - array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1189 | + array('@this_team' =>$team->title), null, 'boinc:team-request-foundership') . '</p>'; |
|
1190 | 1190 | $output .= '<ul class="tab-list">'; |
1191 | 1191 | $output .= ' <li class="first last tab">' . |
1192 | - l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1192 | + l(bts('Initiate request', array(), null, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1193 | 1193 | $output .= '</ul>'; |
1194 | 1194 | } |
1195 | 1195 | return $output; |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | if ($boincteam->ping_user) { |
1211 | 1211 | if ($boincteam->ping_user < 0) { |
1212 | 1212 | $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
1213 | - $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1213 | + $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), null, 'boinc:team-request-foundership-response') |
|
1214 | 1214 | . '</h2>'; |
1215 | 1215 | $output .= '<p>' . bts('Team member @name requested team foundership on' |
1216 | 1216 | . ' @date, but then left the team. This request is now canceled.', |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | '@name' => $member->boincuser_name, |
1219 | 1219 | '@date' => date('j M Y', $boincteam->ping_time), |
1220 | 1220 | ), |
1221 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1221 | + null, 'boinc:team-request-foundership-response') . '</p>'; |
|
1222 | 1222 | // Automatically cancel the request |
1223 | 1223 | db_set_active('boinc_rw'); |
1224 | 1224 | db_query(" |
@@ -1231,14 +1231,14 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | else { |
1233 | 1233 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1234 | - $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1234 | + $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), null, 'boinc:team-request-foundership-response') |
|
1235 | 1235 | . '</h2>'; |
1236 | 1236 | $output .= '<p>' . bts('Team member @name has requested team foundership.' |
1237 | 1237 | . ' This may be because you left the team or have not had contact with' |
1238 | 1238 | . ' the team for a long time.', array( |
1239 | 1239 | '@name' => $member->boincuser_name, |
1240 | 1240 | ) |
1241 | - , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1241 | + , array(), null, 'boinc:team-request-foundership-response') . '</p>'; |
|
1242 | 1242 | $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
1243 | 1243 | . ' will have the option of assuming team foundership. (note: To' |
1244 | 1244 | . ' accept the request, assign foundership to @name using the form' |
@@ -1247,10 +1247,10 @@ discard block |
||
1247 | 1247 | '@name' => $member->boincuser_name, |
1248 | 1248 | '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
1249 | 1249 | ), |
1250 | - NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1250 | + null, 'boinc:team-request-foundership-response') . '</p>'; |
|
1251 | 1251 | $output .= '<ul class="tab-list">'; |
1252 | 1252 | $output .= ' <li class="first last tab">' . |
1253 | - l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
|
1253 | + l(bts('Deny request', array(), null, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
|
1254 | 1254 | $output .= '</ul>'; |
1255 | 1255 | } |
1256 | 1256 | } |
@@ -1260,7 +1260,7 @@ discard block |
||
1260 | 1260 | function boincteam_search_panel() { |
1261 | 1261 | $output = ''; |
1262 | 1262 | if (module_exists('global_search_teams_solr')) { |
1263 | - $output .= '<h2 class="pane-title">' . bts('Search teams', array(), NULL, 'boinc:search-team') . '</h2>'; |
|
1263 | + $output .= '<h2 class="pane-title">' . bts('Search teams', array(), null, 'boinc:search-team') . '</h2>'; |
|
1264 | 1264 | //$output .= '<p>' . bts('Render a search form here.', array(), NULL, 'boinc:search-team') . '</p>'; |
1265 | 1265 | $output .= '<p>' . boincteam_search_view() . '</p>'; |
1266 | 1266 | } |
@@ -1280,18 +1280,18 @@ discard block |
||
1280 | 1280 | function boincteam_topic_overview_panel() { |
1281 | 1281 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1282 | 1282 | $output = ''; |
1283 | - $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1283 | + $output .= '<h2 class="pane-title">' . bts('Teams', array(), null, 'boinc:team-general-info') . '</h2>'; |
|
1284 | 1284 | $output .= '<div class="">'; |
1285 | 1285 | $output .= '<p>' . bts('@project participants may form teams. You may belong' |
1286 | 1286 | . ' to only one team. You can join or quit a team at any time. To join a' |
1287 | 1287 | . ' team, visit its team page and click "Join this team". Each team has a' |
1288 | - . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info') . '</p>'; |
|
1288 | + . ' founder who may:', array('@project' => $site_name), null, 'boinc:team-general-info') . '</p>'; |
|
1289 | 1289 | $output .= '<ul>'; |
1290 | - $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1291 | - $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | - $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | - $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | - $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1290 | + $output .= ' <li>' . bts('Private Message all team members', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1291 | + $output .= ' <li>' . bts("edit the team's name and description", array(), null, 'boinc:team-general-info') . '</li>'; |
|
1292 | + $output .= ' <li>' . bts('add or remove team admins', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1293 | + $output .= ' <li>' . bts('remove members from the team', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1294 | + $output .= ' <li>' . bts('disband a team if it has no members', array(), null, 'boinc:team-general-info') . '</li>'; |
|
1295 | 1295 | $output .= '</ul>'; |
1296 | 1296 | $output .= '</div>'; |
1297 | 1297 | return $output; |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | if ($team->type != "team") { |
1327 | 1327 | return; |
1328 | 1328 | } |
1329 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
1329 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), true); |
|
1330 | 1330 | $founder = user_load(get_drupal_id($boincteam->userid)); |
1331 | 1331 | $new_members = array(); |
1332 | 1332 | if ($boincteam->new_members) { |
@@ -1340,30 +1340,30 @@ discard block |
||
1340 | 1340 | $output .= '<div>'; |
1341 | 1341 | $output .= '<div class="left-column">'; |
1342 | 1342 | $output .= '<ul class="stats">'; |
1343 | - $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | - $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | - $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | - $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1343 | + $output .= ' <li>' . bts('Total credit', array(), null, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1344 | + $output .= ' <li>' . bts('Recent average credit', array(), null, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1345 | + $output .= ' <li>' . bts('Country', array(), null, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1346 | + $output .= ' <li>' . bts('Type', array(), null, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1347 | 1347 | $output .= '</ul>'; |
1348 | 1348 | $output .= '</div>'; |
1349 | 1349 | $output .= '<div class="right-column">'; |
1350 | 1350 | $output .= '<ul class="stats">'; |
1351 | - $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | - $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | - $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | - $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | - $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1351 | + $output .= ' <li>' . bts('Founder', array(), null, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1352 | + $output .= ' <li>' . bts('New members in last day', array(), null, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1353 | + $output .= ' <li>' . bts('Total members', array(), null, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1354 | + $output .= ' <li>' . bts('Active members', array(), null, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1355 | + $output .= ' <li>' . bts('Members with credit', array(), null, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1356 | 1356 | $output .= '</ul>'; |
1357 | 1357 | $output .= '</div>'; |
1358 | 1358 | $output .= '</div>'; |
1359 | 1359 | $output .= '<div class="clearfix"></div>'; |
1360 | 1360 | if ($boincteam->url) { |
1361 | 1361 | $output .= '<div class="stats">'; |
1362 | - $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1362 | + $output .= bts('Website', array(), null, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
|
1363 | 1363 | $output .= '</div>'; |
1364 | 1364 | } |
1365 | 1365 | if ($team->body) { |
1366 | - $output .= '<h3>' . bts('Description', array(), NULL, 'boinc:team-description') . '</h3>'; |
|
1366 | + $output .= '<h3>' . bts('Description', array(), null, 'boinc:team-description') . '</h3>'; |
|
1367 | 1367 | $output .= check_markup($team->body, $team->format); |
1368 | 1368 | $output .= '</div>'; |
1369 | 1369 | } |
@@ -26,82 +26,82 @@ discard block |
||
26 | 26 | * Implementation of hook_menu() |
27 | 27 | */ |
28 | 28 | function boincteam_menu() { |
29 | - $items = array(); |
|
30 | - $items['community/teams/%/assume-foundership'] = array( |
|
29 | + $items = array(); |
|
30 | + $items['community/teams/%/assume-foundership'] = array( |
|
31 | 31 | 'page callback' => 'boincteam_assume_foundership', |
32 | 32 | 'page arguments' => array(2), |
33 | 33 | 'access callback' => 'boincteam_is_member', |
34 | 34 | 'access arguments' => array(2), |
35 | 35 | 'type' => MENU_CALLBACK |
36 | - ); |
|
37 | - $items['community/teams/%/join'] = array( |
|
36 | + ); |
|
37 | + $items['community/teams/%/join'] = array( |
|
38 | 38 | 'page callback' => 'boincteam_join', |
39 | 39 | 'page arguments' => array(2), |
40 | 40 | 'access arguments' => array('join boincteam'), |
41 | 41 | 'type' => MENU_CALLBACK |
42 | - ); |
|
43 | - $items['community/teams/%/leave'] = array( |
|
42 | + ); |
|
43 | + $items['community/teams/%/leave'] = array( |
|
44 | 44 | 'page callback' => 'boincteam_leave', |
45 | 45 | 'page arguments' => array(2), |
46 | 46 | 'access arguments' => array('join boincteam'), |
47 | 47 | 'type' => MENU_CALLBACK |
48 | - ); |
|
49 | - $items['community/teams/%/delete'] = array( |
|
48 | + ); |
|
49 | + $items['community/teams/%/delete'] = array( |
|
50 | 50 | 'page callback' => 'boincteam_delete', |
51 | 51 | 'page arguments' => array(2), |
52 | 52 | 'access callback' => 'boincteam_is_founder', |
53 | 53 | 'access arguments' => array(2), |
54 | 54 | 'type' => MENU_CALLBACK |
55 | - ); |
|
56 | - $items['community/teams/%/deny-foundership-request'] = array( |
|
55 | + ); |
|
56 | + $items['community/teams/%/deny-foundership-request'] = array( |
|
57 | 57 | 'page callback' => 'boincteam_deny_foundership_request', |
58 | 58 | 'page arguments' => array(2), |
59 | 59 | 'access callback' => 'boincteam_is_founder', |
60 | 60 | 'access arguments' => array(2), |
61 | 61 | 'type' => MENU_CALLBACK |
62 | - ); |
|
63 | - $items['community/teams/%/edit/admins/remove/%'] = array( |
|
62 | + ); |
|
63 | + $items['community/teams/%/edit/admins/remove/%'] = array( |
|
64 | 64 | 'page callback' => 'boincteam_remove_admin', |
65 | 65 | 'page arguments' => array(2,6), |
66 | 66 | 'access callback' => 'boincteam_is_founder', |
67 | 67 | 'access arguments' => array(2), |
68 | 68 | 'type' => MENU_CALLBACK |
69 | - ); |
|
70 | - $items['community/teams/%/edit/founder/set/%'] = array( |
|
69 | + ); |
|
70 | + $items['community/teams/%/edit/founder/set/%'] = array( |
|
71 | 71 | 'page callback' => 'boincteam_set_founder', |
72 | 72 | 'page arguments' => array(2,6), |
73 | 73 | 'access callback' => 'boincteam_is_founder', |
74 | 74 | 'access arguments' => array(2), |
75 | 75 | 'type' => MENU_CALLBACK |
76 | - ); |
|
77 | - $items['community/teams/%/edit/members/remove/%'] = array( |
|
76 | + ); |
|
77 | + $items['community/teams/%/edit/members/remove/%'] = array( |
|
78 | 78 | 'page callback' => 'boincteam_remove_member', |
79 | 79 | 'page arguments' => array(2,6), |
80 | 80 | 'access callback' => 'boincteam_is_founder', |
81 | 81 | 'access arguments' => array(2), |
82 | 82 | 'type' => MENU_CALLBACK |
83 | - ); |
|
84 | - $items['community/teams/%/history/xml'] = array( |
|
83 | + ); |
|
84 | + $items['community/teams/%/history/xml'] = array( |
|
85 | 85 | 'page callback' => 'boincteam_history_xml', |
86 | 86 | 'page arguments' => array(2), |
87 | 87 | 'access callback' => 'boincteam_is_admin', |
88 | 88 | 'access arguments' => array(2), |
89 | 89 | 'type' => MENU_CALLBACK |
90 | - ); |
|
91 | - $items['community/teams/%/request-foundership'] = array( |
|
90 | + ); |
|
91 | + $items['community/teams/%/request-foundership'] = array( |
|
92 | 92 | 'page callback' => 'boincteam_request_foundership', |
93 | 93 | 'page arguments' => array(2), |
94 | 94 | 'access callback' => 'boincteam_is_member', |
95 | 95 | 'access arguments' => array(2), |
96 | 96 | 'type' => MENU_CALLBACK |
97 | - ); |
|
98 | - $items['community/teams/%/user-name-autocomplete'] = array( |
|
97 | + ); |
|
98 | + $items['community/teams/%/user-name-autocomplete'] = array( |
|
99 | 99 | 'page callback' => '_boincuser_user_name_autocomplete', |
100 | 100 | 'access callback' => 'boincteam_is_founder', |
101 | 101 | 'access arguments' => array(2), |
102 | 102 | 'type' => MENU_CALLBACK, |
103 | - ); |
|
104 | - $items['community/teams/%/message-all-members'] = array( |
|
103 | + ); |
|
104 | + $items['community/teams/%/message-all-members'] = array( |
|
105 | 105 | 'title' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
106 | 106 | 'description' => bts('Send Message to Team', array(), NULL, 'boinc:team-manage'), |
107 | 107 | 'page callback' => 'drupal_get_form', |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | 'access callback' => 'boincteam_is_admin', |
110 | 110 | 'access arguments' => array(2), |
111 | 111 | 'type' => MENU_CALLBACK, |
112 | - ); |
|
113 | - $items['admin/boinc/utility-team-delete'] = array( |
|
112 | + ); |
|
113 | + $items['admin/boinc/utility-team-delete'] = array( |
|
114 | 114 | 'title' => 'Utility: Delete SPAM Teams', |
115 | 115 | 'description' => 'Utililities to help delete BOINC teams created by SPAMMERs.', |
116 | 116 | 'page callback' => 'drupal_get_form', |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | 'access arguments' => array('administer site configuration'), |
119 | 119 | 'type' => MENU_NORMAL_ITEM, |
120 | 120 | 'file' => 'boincteam.admin.inc', |
121 | - ); |
|
121 | + ); |
|
122 | 122 | |
123 | - return $items; |
|
123 | + return $items; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -137,41 +137,41 @@ discard block |
||
137 | 137 | |
138 | 138 | See https://www.drupal.org/node/945102 |
139 | 139 | */ |
140 | - return array( |
|
140 | + return array( |
|
141 | 141 | 'boincteam_utility_team_table' => array( |
142 | - 'arguments' => array('form' => NULL), |
|
143 | - 'file' => 'boincteam.admin.inc', |
|
142 | + 'arguments' => array('form' => NULL), |
|
143 | + 'file' => 'boincteam.admin.inc', |
|
144 | 144 | ), |
145 | - ); |
|
145 | + ); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
149 | 149 | * Implementation of hook_views_api(). |
150 | 150 | */ |
151 | 151 | function boincteam_views_api() { |
152 | - return array( |
|
152 | + return array( |
|
153 | 153 | 'api' => 2.0, |
154 | 154 | 'path' => drupal_get_path('module', 'boincteam') |
155 | - ); |
|
155 | + ); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Implementation of hook_perm() |
160 | 160 | */ |
161 | 161 | function boincteam_perm() { |
162 | - return array('join boincteam', 'create boincteam', 'manage boincteam'); |
|
162 | + return array('join boincteam', 'create boincteam', 'manage boincteam'); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Implementation of hook_cron() |
167 | 167 | */ |
168 | 168 | function boincteam_cron() { |
169 | - // Sync teams from BOINC DB every day to catch BOINC-wide team updates |
|
170 | - $last_sync = variable_get('boincteam_last_sync', 0); |
|
171 | - if ($last_sync < time() - 24*60*60) { |
|
169 | + // Sync teams from BOINC DB every day to catch BOINC-wide team updates |
|
170 | + $last_sync = variable_get('boincteam_last_sync', 0); |
|
171 | + if ($last_sync < time() - 24*60*60) { |
|
172 | 172 | boincteam_sync(); |
173 | 173 | variable_set('boincteam_last_sync', time()); |
174 | - } |
|
174 | + } |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,41 +185,41 @@ discard block |
||
185 | 185 | * Implementation of hook_views_pre_execute(). |
186 | 186 | */ |
187 | 187 | function boincteam_views_pre_execute(&$view) { |
188 | - /* Specific boinc_teams sub-views use the boinc readonly replica |
|
188 | + /* Specific boinc_teams sub-views use the boinc readonly replica |
|
189 | 189 | * DB. These sub-views defined below by their title. If additional |
190 | 190 | * sub-views need to be added, add their title to the list of cases |
191 | 191 | * below. If a sub-view needs to be reverted to use the master DB, |
192 | 192 | * then remove it from the list of cases. |
193 | 193 | */ |
194 | - if ($view->name == 'boinc_teams') { |
|
194 | + if ($view->name == 'boinc_teams') { |
|
195 | 195 | switch ($view->display[$view->current_display]->display_title) { |
196 | 196 | case 'Top teams overview pane': |
197 | 197 | case 'Top teams pane': |
198 | 198 | case 'Page': |
199 | 199 | $view->base_database = 'boinc_ro'; |
200 | 200 | } |
201 | - } |
|
201 | + } |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
205 | 205 | * Implementation of hook_cron_queue_info() |
206 | 206 | */ |
207 | 207 | function boincteam_cron_queue_info() { |
208 | - $queues = array(); |
|
209 | - $queues['queue_teamdelete'] = array( |
|
208 | + $queues = array(); |
|
209 | + $queues['queue_teamdelete'] = array( |
|
210 | 210 | 'worker callback' => 'boincteam_delete', |
211 | 211 | 'time' => 60, |
212 | - ); |
|
212 | + ); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
216 | 216 | * Implementation of hook_mail_alter() |
217 | 217 | */ |
218 | 218 | function boincteam_mail_alter(&$message) { |
219 | - if (isset($message['params']['boincteam_headers'])) { |
|
219 | + if (isset($message['params']['boincteam_headers'])) { |
|
220 | 220 | $message['headers']['Bcc'] = $message['params']['boincteam_headers']['Bcc']; |
221 | 221 | $message['to'] = ''; |
222 | - } |
|
222 | + } |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -231,49 +231,49 @@ discard block |
||
231 | 231 | * assume the role of founder |
232 | 232 | */ |
233 | 233 | function boincteam_assume_foundership($team_id) { |
234 | - global $user; |
|
235 | - $account = user_load($user->uid); |
|
236 | - $team = node_load($team_id); |
|
237 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
238 | - $boincteam = boincteam_load($boincteam_id); |
|
239 | - $boincuser_id = $account->boincuser_id; |
|
234 | + global $user; |
|
235 | + $account = user_load($user->uid); |
|
236 | + $team = node_load($team_id); |
|
237 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
238 | + $boincteam = boincteam_load($boincteam_id); |
|
239 | + $boincuser_id = $account->boincuser_id; |
|
240 | 240 | |
241 | - if (boincteam_foundership_transfer_ok($boincteam)) { |
|
241 | + if (boincteam_foundership_transfer_ok($boincteam)) { |
|
242 | 242 | if ($boincuser_id == $boincteam->ping_user) { |
243 | - db_set_active('boinc_rw'); |
|
244 | - db_query(" |
|
243 | + db_set_active('boinc_rw'); |
|
244 | + db_query(" |
|
245 | 245 | UPDATE {team} |
246 | 246 | SET userid = '%d', ping_user = '0', ping_time = '0' |
247 | 247 | WHERE id = '%d'", |
248 | 248 | $boincuser_id, $boincteam_id |
249 | - ); |
|
250 | - db_set_active('default'); |
|
251 | - drupal_set_message(t('You are now the founder of @team', array( |
|
249 | + ); |
|
250 | + db_set_active('default'); |
|
251 | + drupal_set_message(t('You are now the founder of @team', array( |
|
252 | 252 | '@team' => $team->title |
253 | - ))); |
|
254 | - watchdog('boincteam', 'User @user assumed foundership of team @nid', |
|
253 | + ))); |
|
254 | + watchdog('boincteam', 'User @user assumed foundership of team @nid', |
|
255 | 255 | array( |
256 | - '@current_user' => $account->uid, |
|
257 | - '@nid' => $team_id |
|
256 | + '@current_user' => $account->uid, |
|
257 | + '@nid' => $team_id |
|
258 | 258 | ), WATCHDOG_NOTICE |
259 | - ); |
|
259 | + ); |
|
260 | 260 | } |
261 | - } |
|
262 | - else { |
|
261 | + } |
|
262 | + else { |
|
263 | 263 | drupal_set_message(t('You are not allowed to assume foundership of this |
264 | 264 | team.' |
265 | 265 | )); |
266 | - } |
|
267 | - drupal_goto("community/teams/{$team_id}"); |
|
266 | + } |
|
267 | + drupal_goto("community/teams/{$team_id}"); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Delete the team, if empty |
272 | 272 | */ |
273 | 273 | function boincteam_delete($team_id) { |
274 | - $team = node_load($team_id); |
|
275 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
276 | - if ($boincteam->nusers == 1) { |
|
274 | + $team = node_load($team_id); |
|
275 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
276 | + if ($boincteam->nusers == 1) { |
|
277 | 277 | require_boinc('team'); |
278 | 278 | $boincuser = boincuser_load(); |
279 | 279 | user_quit_team($boincuser); |
@@ -282,35 +282,35 @@ discard block |
||
282 | 282 | $team->uid = 0; |
283 | 283 | node_save($team); |
284 | 284 | drupal_set_message(t('@team has been removed.', |
285 | - array('@team' => $boincteam->name))); |
|
285 | + array('@team' => $boincteam->name))); |
|
286 | 286 | drupal_goto('community/teams'); |
287 | - } |
|
288 | - else { |
|
287 | + } |
|
288 | + else { |
|
289 | 289 | drupal_set_message(t('All members must be removed from @team before the |
290 | 290 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
291 | 291 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
292 | - } |
|
292 | + } |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Deny a foundership transfer request |
297 | 297 | */ |
298 | 298 | function boincteam_deny_foundership_request($team_id) { |
299 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
300 | - // Remove the request from the BOINC database |
|
301 | - db_set_active('boinc_rw'); |
|
302 | - db_query(" |
|
299 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
300 | + // Remove the request from the BOINC database |
|
301 | + db_set_active('boinc_rw'); |
|
302 | + db_query(" |
|
303 | 303 | UPDATE {team} |
304 | 304 | SET ping_user=0 |
305 | 305 | WHERE id = '%d'", |
306 | 306 | $boincteam_id |
307 | - ); |
|
308 | - db_set_active('default'); |
|
307 | + ); |
|
308 | + db_set_active('default'); |
|
309 | 309 | |
310 | - drupal_set_message(t('The transfer request has been denied. No additional |
|
310 | + drupal_set_message(t('The transfer request has been denied. No additional |
|
311 | 311 | requests will be allowed until 90 days have passed since this request was |
312 | 312 | made.')); |
313 | - drupal_goto("community/teams/{$team_id}/edit/founder"); |
|
313 | + drupal_goto("community/teams/{$team_id}/edit/founder"); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | |
@@ -318,62 +318,62 @@ discard block |
||
318 | 318 | * Get the join date of a user |
319 | 319 | */ |
320 | 320 | function boincteam_get_member_join_date($boincteam_id, $boincuser_id = NULL) { |
321 | - if (!$boincuser_id) { |
|
321 | + if (!$boincuser_id) { |
|
322 | 322 | global $user; |
323 | 323 | $account = user_load($user->uid); |
324 | 324 | $boincuser_id = $account->boincuser_id; |
325 | - } |
|
326 | - db_set_active('boinc_rw'); |
|
327 | - $timestamp = db_result(db_query(" |
|
325 | + } |
|
326 | + db_set_active('boinc_rw'); |
|
327 | + $timestamp = db_result(db_query(" |
|
328 | 328 | SELECT timestamp FROM {team_delta} WHERE |
329 | 329 | userid = %d AND teamid = %d AND joining = 1 |
330 | 330 | ORDER BY timestamp DESC LIMIT 1", |
331 | 331 | $boincuser_id, $boincteam_id |
332 | - )); |
|
333 | - db_set_active('default'); |
|
334 | - return $timestamp; |
|
332 | + )); |
|
333 | + db_set_active('default'); |
|
334 | + return $timestamp; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Get the team type for display |
339 | 339 | */ |
340 | 340 | function boincteam_get_type($team_id) { |
341 | - //$vid = boincteam_get_vocabulary_by_name('Teams'); $team->vid = $vid; |
|
342 | - $team = node_load($team_id); |
|
343 | - $terms = taxonomy_node_get_terms($team); |
|
344 | - if ($terms) { |
|
341 | + //$vid = boincteam_get_vocabulary_by_name('Teams'); $team->vid = $vid; |
|
342 | + $team = node_load($team_id); |
|
343 | + $terms = taxonomy_node_get_terms($team); |
|
344 | + if ($terms) { |
|
345 | 345 | $term = reset($terms); |
346 | 346 | return $term->name; |
347 | - } else { |
|
347 | + } else { |
|
348 | 348 | return null; |
349 | - } |
|
349 | + } |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Access a vocabulary of terms by name |
354 | 354 | */ |
355 | 355 | function boincteam_get_vocabulary_by_name($name) { |
356 | - $vocabs = taxonomy_get_vocabularies('team'); |
|
357 | - foreach ($vocabs as $vocab) { |
|
356 | + $vocabs = taxonomy_get_vocabularies('team'); |
|
357 | + foreach ($vocabs as $vocab) { |
|
358 | 358 | if ($vocab->name == $name) return $vocab->vid; |
359 | - } |
|
360 | - return null; |
|
359 | + } |
|
360 | + return null; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Output the XML of the team history |
365 | 365 | */ |
366 | 366 | function boincteam_history_xml($team_id) { |
367 | - $team = node_load($team_id); |
|
368 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
369 | - $team_history = array( |
|
367 | + $team = node_load($team_id); |
|
368 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
369 | + $team_history = array( |
|
370 | 370 | 'actions' => array( |
371 | - 'action' => array(), |
|
371 | + 'action' => array(), |
|
372 | 372 | ), |
373 | - ); |
|
373 | + ); |
|
374 | 374 | |
375 | - db_set_active('boinc_rw'); |
|
376 | - $result = db_query(" |
|
375 | + db_set_active('boinc_rw'); |
|
376 | + $result = db_query(" |
|
377 | 377 | SELECT |
378 | 378 | td.userid AS id, |
379 | 379 | u.name, |
@@ -385,40 +385,40 @@ discard block |
||
385 | 385 | WHERE td.teamid = %d |
386 | 386 | ORDER BY timestamp ASC", |
387 | 387 | $boincteam_id |
388 | - ); |
|
389 | - db_set_active('default'); |
|
388 | + ); |
|
389 | + db_set_active('default'); |
|
390 | 390 | |
391 | - while ($record = db_fetch_array($result)) { |
|
391 | + while ($record = db_fetch_array($result)) { |
|
392 | 392 | $team_history['actions']['action'][] = $record; |
393 | - } |
|
393 | + } |
|
394 | 394 | |
395 | - header('Content-type: text/xml'); |
|
396 | - echo xml_to_text(array_to_xml($team_history)); |
|
395 | + header('Content-type: text/xml'); |
|
396 | + echo xml_to_text(array_to_xml($team_history)); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
400 | 400 | * Convert a BOINC team ID to a Drupal team ID |
401 | 401 | */ |
402 | 402 | function boincteam_lookup_nid($boinc_id) { |
403 | - $drupal_id = db_result(db_query("SELECT nid FROM {boincteam} WHERE team_id='%d'", $boinc_id)); |
|
404 | - return $drupal_id; |
|
403 | + $drupal_id = db_result(db_query("SELECT nid FROM {boincteam} WHERE team_id='%d'", $boinc_id)); |
|
404 | + return $drupal_id; |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
408 | 408 | * Convert a Drupal team ID to a BOINC team ID |
409 | 409 | */ |
410 | 410 | function boincteam_lookup_id($nid) { |
411 | - $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = '%d'", $nid)); |
|
412 | - return $boinc_id; |
|
411 | + $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = '%d'", $nid)); |
|
412 | + return $boinc_id; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
416 | 416 | * Get a BOINC team object |
417 | 417 | */ |
418 | 418 | function boincteam_load($boincteam_id, $full_object = FALSE) { |
419 | - require_boinc(array('team')); |
|
420 | - $team = BoincTeam::lookup_id($boincteam_id); |
|
421 | - if ($team AND $full_object) { |
|
419 | + require_boinc(array('team')); |
|
420 | + $team = BoincTeam::lookup_id($boincteam_id); |
|
421 | + if ($team AND $full_object) { |
|
422 | 422 | $team->nusers = BoincUser::count("teamid={$team->id}"); |
423 | 423 | $team->nusers_worked = BoincUser::count("teamid={$team->id} and total_credit>0"); |
424 | 424 | $team->nusers_active = BoincUser::count("teamid={$team->id} and expavg_credit>0.1"); |
@@ -426,314 +426,314 @@ discard block |
||
426 | 426 | $team->new_members = new_member_list($boincteam_id); |
427 | 427 | $team->admins = admin_list($boincteam_id); |
428 | 428 | $team->founder = BoincUser::lookup_id($team->userid); |
429 | - } |
|
430 | - return $team; |
|
429 | + } |
|
430 | + return $team; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | /** |
434 | 434 | * Check if a user is the team founder |
435 | 435 | */ |
436 | 436 | function boincteam_is_founder($nid, $uid = NULL) { |
437 | - if (!$uid) { |
|
437 | + if (!$uid) { |
|
438 | 438 | global $user; |
439 | 439 | $uid = $user->uid; |
440 | - } |
|
441 | - if (!boincteam_is_member($nid, $uid)) { |
|
440 | + } |
|
441 | + if (!boincteam_is_member($nid, $uid)) { |
|
442 | 442 | return FALSE; |
443 | - } |
|
444 | - $team_id = boincteam_lookup_id($nid); |
|
445 | - require_boinc('team'); |
|
446 | - return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
443 | + } |
|
444 | + $team_id = boincteam_lookup_id($nid); |
|
445 | + require_boinc('team'); |
|
446 | + return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Check if a user is a team admin |
451 | 451 | */ |
452 | 452 | function boincteam_is_admin($nid, $uid = NULL) { |
453 | - if (!$uid) { |
|
453 | + if (!$uid) { |
|
454 | 454 | global $user; |
455 | 455 | $uid = $user->uid; |
456 | - } |
|
457 | - if (!boincteam_is_member($nid, $uid)) { |
|
456 | + } |
|
457 | + if (!boincteam_is_member($nid, $uid)) { |
|
458 | 458 | return FALSE; |
459 | - } |
|
460 | - $team_id = boincteam_lookup_id($nid); |
|
461 | - require_boinc('team'); |
|
462 | - return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
459 | + } |
|
460 | + $team_id = boincteam_lookup_id($nid); |
|
461 | + require_boinc('team'); |
|
462 | + return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Check if a user is a team member |
467 | 467 | */ |
468 | 468 | function boincteam_is_member($nid, $uid = NULL) { |
469 | - if (!$uid) { |
|
469 | + if (!$uid) { |
|
470 | 470 | global $user; |
471 | 471 | $uid = $user->uid; |
472 | - } |
|
473 | - $account = user_load($uid); |
|
474 | - return ($account->team == $nid); |
|
472 | + } |
|
473 | + $account = user_load($uid); |
|
474 | + return ($account->team == $nid); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
478 | 478 | * Display any persistent team messages |
479 | 479 | */ |
480 | 480 | function boincteam_show_messages() { |
481 | - global $user; |
|
482 | - $uid = $user->uid; |
|
483 | - $account = user_load($uid); |
|
484 | - if ($account->team) { |
|
481 | + global $user; |
|
482 | + $uid = $user->uid; |
|
483 | + $account = user_load($uid); |
|
484 | + if ($account->team) { |
|
485 | 485 | if (boincteam_is_founder($account->team, $account->uid)) { |
486 | - // Set a notice of any pending foundership requests |
|
487 | - $boincteam_id = boincteam_lookup_id($account->team); |
|
488 | - $boincteam = boincteam_load($boincteam_id); |
|
489 | - if ($boincteam->ping_user > 0) { |
|
486 | + // Set a notice of any pending foundership requests |
|
487 | + $boincteam_id = boincteam_lookup_id($account->team); |
|
488 | + $boincteam = boincteam_load($boincteam_id); |
|
489 | + if ($boincteam->ping_user > 0) { |
|
490 | 490 | $foundership_url = "community/teams/{$account->team}/edit/founder"; |
491 | 491 | if (substr($_GET['q'], 0, strlen($foundership_url)) != $foundership_url) { |
492 | - drupal_set_message( |
|
492 | + drupal_set_message( |
|
493 | 493 | bts( |
494 | - 'A foundership transfer request has been made for your team. Please !respond.', |
|
495 | - array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | - NULL, 'boinc:team-founder-change'), |
|
494 | + 'A foundership transfer request has been made for your team. Please !respond.', |
|
495 | + array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
496 | + NULL, 'boinc:team-founder-change'), |
|
497 | 497 | 'warning', FALSE |
498 | - ); |
|
498 | + ); |
|
499 | + } |
|
499 | 500 | } |
500 | - } |
|
501 | 501 | } |
502 | - } |
|
502 | + } |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
506 | 506 | * Add a user to a team |
507 | 507 | */ |
508 | 508 | function boincteam_join($team_id) { |
509 | - global $user; |
|
510 | - $account = user_load($user->uid); |
|
509 | + global $user; |
|
510 | + $account = user_load($user->uid); |
|
511 | 511 | |
512 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
513 | - $boincteam = boincteam_load($boincteam_id); |
|
514 | - if ($boincteam->joinable AND $account->team != $team_id) { |
|
512 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
513 | + $boincteam = boincteam_load($boincteam_id); |
|
514 | + if ($boincteam->joinable AND $account->team != $team_id) { |
|
515 | 515 | require_boinc('team'); |
516 | 516 | $boincuser = boincuser_load(); |
517 | 517 | if (user_join_team($boincteam, $boincuser)) { |
518 | - drupal_set_message(t('You are now a member of @team!', |
|
518 | + drupal_set_message(t('You are now a member of @team!', |
|
519 | 519 | array('@team' => $boincteam->name))); |
520 | - watchdog('boincteam', 'added user @uid to team @nid', |
|
520 | + watchdog('boincteam', 'added user @uid to team @nid', |
|
521 | 521 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
522 | 522 | } |
523 | 523 | else { |
524 | - // @todo - consider another rule/error event here |
|
525 | - drupal_set_message(t('There was a problem joining @team, please try again |
|
524 | + // @todo - consider another rule/error event here |
|
525 | + drupal_set_message(t('There was a problem joining @team, please try again |
|
526 | 526 | later', array('@team' => $boincteam->name))); |
527 | - watchdog('boincteam', 'error adding user @uid to team @nid', |
|
527 | + watchdog('boincteam', 'error adding user @uid to team @nid', |
|
528 | 528 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_ERROR); |
529 | 529 | } |
530 | - } |
|
531 | - drupal_goto("community/teams/{$team_id}"); |
|
530 | + } |
|
531 | + drupal_goto("community/teams/{$team_id}"); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | /** |
535 | 535 | * Leave a team |
536 | 536 | */ |
537 | 537 | function boincteam_leave($team_id) { |
538 | - global $user; |
|
539 | - $account = user_load($user->uid); |
|
538 | + global $user; |
|
539 | + $account = user_load($user->uid); |
|
540 | 540 | |
541 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
542 | - $boincteam = boincteam_load($boincteam_id); |
|
543 | - if ($account->team == $team_id) { |
|
541 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
542 | + $boincteam = boincteam_load($boincteam_id); |
|
543 | + if ($account->team == $team_id) { |
|
544 | 544 | require_boinc('team'); |
545 | 545 | $boincuser = boincuser_load(); |
546 | 546 | user_quit_team($boincuser); |
547 | 547 | drupal_set_message(t('You are no longer a member of @team.', |
548 | - array('@team' => $boincteam->name))); |
|
548 | + array('@team' => $boincteam->name))); |
|
549 | 549 | watchdog('boincteam', 'removed user @uid from team @nid', |
550 | - array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
|
551 | - } |
|
552 | - else { |
|
553 | - drupal_set_message(t('You are not a member of @team, so you cannot revoke |
|
550 | + array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
|
551 | + } |
|
552 | + else { |
|
553 | + drupal_set_message(t('You are not a member of @team, so you cannot revoke |
|
554 | 554 | your membership to it.', array('@team' => $boincteam->name))); |
555 | - } |
|
556 | - drupal_goto("community/teams/{$team_id}"); |
|
555 | + } |
|
556 | + drupal_goto("community/teams/{$team_id}"); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
560 | 560 | * Remove team admin status from a user |
561 | 561 | */ |
562 | 562 | function boincteam_remove_admin($team_id, $user_id) { |
563 | - global $user; |
|
564 | - $account = user_load($user_id); |
|
565 | - $team = node_load($team_id); |
|
566 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
567 | - $boincuser_id = $account->boincuser_id; |
|
563 | + global $user; |
|
564 | + $account = user_load($user_id); |
|
565 | + $team = node_load($team_id); |
|
566 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
567 | + $boincuser_id = $account->boincuser_id; |
|
568 | 568 | |
569 | - if (boincteam_is_admin($team_id, $account->uid)) { |
|
569 | + if (boincteam_is_admin($team_id, $account->uid)) { |
|
570 | 570 | // Update the team in the BOINC db |
571 | 571 | db_set_active('boinc_rw'); |
572 | 572 | db_query(" |
573 | 573 | DELETE FROM {team_admin} WHERE |
574 | 574 | teamid = '%d' AND userid = '%d'", |
575 | - $boincteam_id, |
|
576 | - $boincuser_id |
|
575 | + $boincteam_id, |
|
576 | + $boincuser_id |
|
577 | 577 | ); |
578 | 578 | db_set_active('default'); |
579 | 579 | drupal_set_message(t('@user is no longer an admin of @team.', |
580 | - array( |
|
580 | + array( |
|
581 | 581 | '@user' => $account->boincuser_name, |
582 | 582 | '@team' => $team->title |
583 | - ) |
|
583 | + ) |
|
584 | 584 | )); |
585 | 585 | watchdog('boincteam', 'User @current_user removed admin status for user |
586 | 586 | @uid from team @nid', |
587 | - array( |
|
587 | + array( |
|
588 | 588 | '@current_user' => $user->uid, |
589 | 589 | '@uid' => $account->uid, |
590 | 590 | '@nid' => $team_id |
591 | - ), WATCHDOG_NOTICE); |
|
592 | - } |
|
593 | - drupal_goto("community/teams/{$team_id}/edit/admins"); |
|
591 | + ), WATCHDOG_NOTICE); |
|
592 | + } |
|
593 | + drupal_goto("community/teams/{$team_id}/edit/admins"); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
597 | 597 | * Remove a user from a team |
598 | 598 | */ |
599 | 599 | function boincteam_remove_member($team_id, $user_id) { |
600 | - global $user; |
|
601 | - $account = user_load($user_id); |
|
600 | + global $user; |
|
601 | + $account = user_load($user_id); |
|
602 | 602 | |
603 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
604 | - $boincteam = boincteam_load($boincteam_id); |
|
605 | - if ($account->team == $team_id) { |
|
603 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
604 | + $boincteam = boincteam_load($boincteam_id); |
|
605 | + if ($account->team == $team_id) { |
|
606 | 606 | require_boinc('team'); |
607 | 607 | $boincuser = boincuser_load($user_id, TRUE); |
608 | 608 | user_quit_team($boincuser); |
609 | 609 | drupal_set_message(t('@user has been removed from @team.', |
610 | - array( |
|
610 | + array( |
|
611 | 611 | '@user' => $account->boincuser_name, |
612 | 612 | '@team' => $boincteam->name |
613 | - ) |
|
613 | + ) |
|
614 | 614 | )); |
615 | 615 | watchdog('boincteam', 'User @current_user removed user @uid from team @nid', |
616 | - array( |
|
616 | + array( |
|
617 | 617 | '@current_user' => $user->uid, |
618 | 618 | '@uid' => $account->uid, |
619 | 619 | '@nid' => $team_id |
620 | - ), WATCHDOG_NOTICE); |
|
621 | - } |
|
622 | - else { |
|
623 | - drupal_set_message(t('@user is not a member of @team, so you cannot |
|
620 | + ), WATCHDOG_NOTICE); |
|
621 | + } |
|
622 | + else { |
|
623 | + drupal_set_message(t('@user is not a member of @team, so you cannot |
|
624 | 624 | revoke the membership.', array( |
625 | - '@user' => $account->boincuser_name, |
|
626 | - '@team' => $boincteam->name |
|
625 | + '@user' => $account->boincuser_name, |
|
626 | + '@team' => $boincteam->name |
|
627 | 627 | ) |
628 | - )); |
|
629 | - } |
|
630 | - drupal_goto("community/teams/{$team_id}/edit/members"); |
|
628 | + )); |
|
629 | + } |
|
630 | + drupal_goto("community/teams/{$team_id}/edit/members"); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | /** |
634 | 634 | * Request a foundership transfer |
635 | 635 | */ |
636 | 636 | function boincteam_request_foundership($team_id) { |
637 | - global $user; |
|
638 | - $account = user_load($user->uid); |
|
639 | - $team = node_load($team_id); |
|
640 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
641 | - $boincteam = boincteam_load($boincteam_id); |
|
642 | - $boincuser_id = $account->boincuser_id; |
|
637 | + global $user; |
|
638 | + $account = user_load($user->uid); |
|
639 | + $team = node_load($team_id); |
|
640 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
641 | + $boincteam = boincteam_load($boincteam_id); |
|
642 | + $boincuser_id = $account->boincuser_id; |
|
643 | 643 | |
644 | - if (boincteam_is_founder($team_id, $account->uid)) { |
|
644 | + if (boincteam_is_founder($team_id, $account->uid)) { |
|
645 | 645 | // Shouldn't even be here... |
646 | 646 | drupal_set_message(t('@user is already the team founder.', |
647 | - array( |
|
647 | + array( |
|
648 | 648 | '@user' => $account->boincuser_name |
649 | - ) |
|
649 | + ) |
|
650 | 650 | ), 'warning'); |
651 | - } |
|
652 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
651 | + } |
|
652 | + elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
653 | 653 | // It hasn't been long enough since the last transfer request |
654 | 654 | drupal_set_message(t('A foundership change was requested during the last 90 |
655 | 655 | days, so new requests are not allowed. Please try again later.' |
656 | 656 | ), 'warning'); |
657 | - } |
|
658 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
657 | + } |
|
658 | + elseif (boincteam_is_member($team_id, $account->uid)) { |
|
659 | 659 | // Log the transfer request |
660 | 660 | db_set_active('boinc_rw'); |
661 | 661 | db_query(" |
662 | 662 | UPDATE {team} |
663 | 663 | SET ping_user = '%d', ping_time='%d' |
664 | 664 | WHERE id = '%d'", |
665 | - $boincuser_id, time(), $boincteam_id |
|
665 | + $boincuser_id, time(), $boincteam_id |
|
666 | 666 | ); |
667 | 667 | db_set_active('default'); |
668 | 668 | drupal_set_message(t('You have requested foundership of @team. The current |
669 | 669 | founder has 60 days to respond to this request.', |
670 | - array( |
|
670 | + array( |
|
671 | 671 | '@team' => $team->title |
672 | - ) |
|
672 | + ) |
|
673 | 673 | )); |
674 | 674 | watchdog('boincteam', 'User @user requested foundership of team @nid', |
675 | - array( |
|
675 | + array( |
|
676 | 676 | '@current_user' => $account->uid, |
677 | 677 | '@nid' => $team_id |
678 | - ), WATCHDOG_NOTICE); |
|
679 | - } |
|
680 | - drupal_goto("community/teams/{$team_id}"); |
|
678 | + ), WATCHDOG_NOTICE); |
|
679 | + } |
|
680 | + drupal_goto("community/teams/{$team_id}"); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** |
684 | 684 | * Transfer foundership to another team member |
685 | 685 | */ |
686 | 686 | function boincteam_set_founder($team_id, $user_id) { |
687 | - global $user; |
|
688 | - $account = user_load($user_id); |
|
689 | - $team = node_load($team_id); |
|
690 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
691 | - $boincuser_id = $account->boincuser_id; |
|
687 | + global $user; |
|
688 | + $account = user_load($user_id); |
|
689 | + $team = node_load($team_id); |
|
690 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
691 | + $boincuser_id = $account->boincuser_id; |
|
692 | 692 | |
693 | - if (boincteam_is_member($team_id, $account->uid)) { |
|
693 | + if (boincteam_is_member($team_id, $account->uid)) { |
|
694 | 694 | // Update the team in the BOINC db |
695 | 695 | db_set_active('boinc_rw'); |
696 | 696 | db_query(" |
697 | 697 | UPDATE {team} |
698 | 698 | SET userid = '%d', ping_user=0 |
699 | 699 | WHERE id = '%d'", |
700 | - $boincuser_id, $boincteam_id |
|
700 | + $boincuser_id, $boincteam_id |
|
701 | 701 | ); |
702 | 702 | db_set_active('default'); |
703 | 703 | drupal_set_message(t('Foundership of @team has been transfered to @user.', |
704 | - array( |
|
704 | + array( |
|
705 | 705 | '@user' => $account->boincuser_name, |
706 | 706 | '@team' => $team->title |
707 | - ) |
|
707 | + ) |
|
708 | 708 | )); |
709 | 709 | watchdog('boincteam', 'User @current_user transferred foundership of team |
710 | 710 | @nid to user @uid', |
711 | - array( |
|
711 | + array( |
|
712 | 712 | '@current_user' => $user->uid, |
713 | 713 | '@uid' => $account->uid, |
714 | 714 | '@nid' => $team_id |
715 | - ), WATCHDOG_NOTICE); |
|
716 | - } |
|
717 | - drupal_goto("community/teams/{$team_id}"); |
|
715 | + ), WATCHDOG_NOTICE); |
|
716 | + } |
|
717 | + drupal_goto("community/teams/{$team_id}"); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | /** |
721 | 721 | * See if a new foundership transfer request is allowed |
722 | 722 | */ |
723 | 723 | function boincteam_new_foundership_transfer_request_ok($team_id) { |
724 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
725 | - $boincteam = boincteam_load($boincteam_id); |
|
726 | - $now = time(); |
|
727 | - if ($boincteam->ping_user <= 0) { |
|
724 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
725 | + $boincteam = boincteam_load($boincteam_id); |
|
726 | + $now = time(); |
|
727 | + if ($boincteam->ping_user <= 0) { |
|
728 | 728 | if ($boincteam->ping_time < $now - 60 * (24*60*60)) { |
729 | - return TRUE; |
|
729 | + return TRUE; |
|
730 | 730 | } |
731 | 731 | return FALSE; |
732 | - } |
|
733 | - if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
732 | + } |
|
733 | + if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
734 | 734 | return TRUE; |
735 | - } |
|
736 | - return FALSE; |
|
735 | + } |
|
736 | + return FALSE; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
@@ -755,18 +755,18 @@ discard block |
||
755 | 755 | * Check if a user has an active foundership request with a team |
756 | 756 | */ |
757 | 757 | function boincteam_user_requested_foundership($team_id, $user_id = NULL) { |
758 | - if (!$user_id) { |
|
758 | + if (!$user_id) { |
|
759 | 759 | global $user; |
760 | 760 | $user_id = $user->uid; |
761 | - } |
|
762 | - $account = user_load($user_id); |
|
763 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
764 | - $boincteam = boincteam_load($boincteam_id); |
|
761 | + } |
|
762 | + $account = user_load($user_id); |
|
763 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
764 | + $boincteam = boincteam_load($boincteam_id); |
|
765 | 765 | |
766 | - if ($boincteam->ping_user == $account->boincuser_id) { |
|
766 | + if ($boincteam->ping_user == $account->boincuser_id) { |
|
767 | 767 | // Be sure the request is still active |
768 | 768 | return !boincteam_new_foundership_transfer_request_ok($team_id); |
769 | - } |
|
769 | + } |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | |
@@ -778,125 +778,125 @@ discard block |
||
778 | 778 | * General info about team admins |
779 | 779 | */ |
780 | 780 | function boincteam_about_admins_panel() { |
781 | - $output = ''; |
|
782 | - $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
783 | - $output .= '<div>'; |
|
784 | - $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
785 | - $output .= '<ul>'; |
|
786 | - $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | - $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | - $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | - $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
790 | - $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
791 | - $output .= '</ul>'; |
|
792 | - $output .= '</div>'; |
|
793 | - $output .= '<div>'; |
|
794 | - $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
795 | - $output .= '<ul>'; |
|
796 | - $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | - $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
798 | - $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
799 | - $output .= '</ul>'; |
|
800 | - $output .= '</div>'; |
|
801 | - $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
781 | + $output = ''; |
|
782 | + $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
783 | + $output .= '<div>'; |
|
784 | + $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
785 | + $output .= '<ul>'; |
|
786 | + $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
787 | + $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
788 | + $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
789 | + $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
790 | + $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
791 | + $output .= '</ul>'; |
|
792 | + $output .= '</div>'; |
|
793 | + $output .= '<div>'; |
|
794 | + $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
795 | + $output .= '<ul>'; |
|
796 | + $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
797 | + $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
798 | + $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
799 | + $output .= '</ul>'; |
|
800 | + $output .= '</div>'; |
|
801 | + $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
802 | 802 | . ' team admin. We recommend only selecting people you know and trust', array(), NULL, 'boinc:team-admins-panel') |
803 | 803 | . '</p>'; |
804 | - return $output; |
|
804 | + return $output; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
808 | 808 | * General info about changing the team founder |
809 | 809 | */ |
810 | 810 | function boincteam_about_founder_panel() { |
811 | - $output = ''; |
|
812 | - $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
811 | + $output = ''; |
|
812 | + $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
813 | 813 | . '</h2>'; |
814 | - $output .= '<div>'; |
|
815 | - $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
816 | - $output .= '<ul>'; |
|
817 | - $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
818 | - $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
819 | - $output .= '</ul>'; |
|
820 | - $output .= '</div>'; |
|
821 | - $output .= '<div>'; |
|
822 | - $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
814 | + $output .= '<div>'; |
|
815 | + $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
816 | + $output .= '<ul>'; |
|
817 | + $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
818 | + $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
819 | + $output .= '</ul>'; |
|
820 | + $output .= '</div>'; |
|
821 | + $output .= '<div>'; |
|
822 | + $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
823 | 823 | . '</p>'; |
824 | - $output .= '<ul>'; |
|
825 | - $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
826 | - $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
824 | + $output .= '<ul>'; |
|
825 | + $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
826 | + $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
827 | 827 | . '</li>'; |
828 | - $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
828 | + $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
829 | 829 | . '</li>'; |
830 | - $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
830 | + $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
831 | 831 | . ' request', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
832 | - $output .= '</ul>'; |
|
833 | - $output .= '</div>'; |
|
834 | - return $output; |
|
832 | + $output .= '</ul>'; |
|
833 | + $output .= '</div>'; |
|
834 | + return $output; |
|
835 | 835 | } |
836 | 836 | |
837 | 837 | /** |
838 | 838 | * Link to create a new team |
839 | 839 | */ |
840 | 840 | function boincteam_create_team_link_panel() { |
841 | - global $user; |
|
842 | - $account = user_load($user->uid); |
|
843 | - $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
844 | - $output = ''; |
|
845 | - $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
846 | - $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
841 | + global $user; |
|
842 | + $account = user_load($user->uid); |
|
843 | + $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
844 | + $output = ''; |
|
845 | + $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
846 | + $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
847 | 847 | . ' can create a team.', array(), NULL, 'boinc:create-team-panel') . '</p>'; |
848 | - $output .= '<ul class="tab-list">'; |
|
849 | - $output .= ' <li class="first last tab">'; |
|
850 | - if (isset($account->roles[$unrestricted_role])) { |
|
848 | + $output .= '<ul class="tab-list">'; |
|
849 | + $output .= ' <li class="first last tab">'; |
|
850 | + if (isset($account->roles[$unrestricted_role])) { |
|
851 | 851 | $output .= l(bts('Create new team', array(), NULL, 'boinc:create-team-panel'), 'community/teams/add'); |
852 | - } elseif ($account->uid <= 0) { |
|
852 | + } elseif ($account->uid <= 0) { |
|
853 | 853 | $output .= l( |
854 | - bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
855 | - 'user/login', |
|
856 | - array('query' => drupal_get_destination()) |
|
854 | + bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
855 | + 'user/login', |
|
856 | + array('query' => drupal_get_destination()) |
|
857 | 857 | ); |
858 | - } else { |
|
858 | + } else { |
|
859 | 859 | $min_credit_needed = variable_get('boinc_comment_min_credit', 0); |
860 | 860 | $credit_needed = $min_credit_needed - $account->boincuser_total_credit; |
861 | 861 | $output .= '['; |
862 | 862 | if ($credit_needed == 1) { |
863 | - $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
863 | + $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
864 | 864 | } |
865 | 865 | else { |
866 | - $output .= bts('You must earn @count more credits!', |
|
866 | + $output .= bts('You must earn @count more credits!', |
|
867 | 867 | array('@count' => $credit_needed), |
868 | - NULL, 'boinc:create-team-panel' |
|
869 | - ); |
|
868 | + NULL, 'boinc:create-team-panel' |
|
869 | + ); |
|
870 | 870 | } |
871 | 871 | $output .= ']'; |
872 | - } |
|
873 | - $output .= ' </li>'; |
|
874 | - $output .= '</ul>'; |
|
875 | - return $output; |
|
872 | + } |
|
873 | + $output .= ' </li>'; |
|
874 | + $output .= '</ul>'; |
|
875 | + return $output; |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | /** |
879 | 879 | * Create team form |
880 | 880 | */ |
881 | 881 | function boincteam_create_team_panel() { |
882 | - $output = ''; |
|
883 | - $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
884 | - $output .= drupal_get_form('boincteam_create_form'); |
|
882 | + $output = ''; |
|
883 | + $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
884 | + $output .= drupal_get_form('boincteam_create_form'); |
|
885 | 885 | |
886 | - return $output; |
|
886 | + return $output; |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | /** |
890 | 890 | * Link to user's team |
891 | 891 | */ |
892 | 892 | function boincteam_dashboard_panel($uid = NULL) { |
893 | - global $user; |
|
894 | - if (!$uid) { |
|
893 | + global $user; |
|
894 | + if (!$uid) { |
|
895 | 895 | $uid = $user->uid; |
896 | - } |
|
897 | - $output = ''; |
|
898 | - $account = user_load($uid); |
|
899 | - if ($account->team) { |
|
896 | + } |
|
897 | + $output = ''; |
|
898 | + $account = user_load($uid); |
|
899 | + if ($account->team) { |
|
900 | 900 | $team = boincteam_load(boincteam_lookup_id($account->team)); |
901 | 901 | $output .= '<h2 class="pane-title">' . bts('Team', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
902 | 902 | $output .= '<div class="stats">'; |
@@ -915,254 +915,254 @@ discard block |
||
915 | 915 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
916 | 916 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
917 | 917 | $output .= '</div>' . "\n"; |
918 | - } |
|
919 | - else if ($user->uid == $account->uid) { |
|
918 | + } |
|
919 | + else if ($user->uid == $account->uid) { |
|
920 | 920 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
921 | 921 | $output .= '<ul class="tab-list action-list">'; |
922 | 922 | $output .= '<li class="tab primary">'; |
923 | 923 | $output .= l(bts('Join a Team', array(), NULL, 'boinc:team-dashboard'), 'community/teams'); |
924 | 924 | $output .= '</li>'; |
925 | 925 | $output .= '</ul>'; |
926 | - } |
|
927 | - return $output; |
|
926 | + } |
|
927 | + return $output; |
|
928 | 928 | } |
929 | 929 | |
930 | 930 | /** |
931 | 931 | * Edit team form |
932 | 932 | */ |
933 | 933 | function boincteam_edit_team_panel($team_id) { |
934 | - $team = node_load($team_id); |
|
935 | - $output = ''; |
|
936 | - $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
937 | - $output .= drupal_get_form('boincteam_edit_form', $team_id); |
|
934 | + $team = node_load($team_id); |
|
935 | + $output = ''; |
|
936 | + $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
937 | + $output .= drupal_get_form('boincteam_edit_form', $team_id); |
|
938 | 938 | |
939 | - return $output; |
|
939 | + return $output; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | /** |
943 | 943 | * Link to join a team |
944 | 944 | */ |
945 | 945 | function boincteam_join_team_panel($team_id) { |
946 | - $team = node_load($team_id); |
|
947 | - $output = ''; |
|
948 | - $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
949 | - $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
946 | + $team = node_load($team_id); |
|
947 | + $output = ''; |
|
948 | + $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
949 | + $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
950 | 950 | array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel') . '</p>'; |
951 | - $output .= '<ul class="tab-list">'; |
|
952 | - $output .= ' <li class="first last tab">' . |
|
951 | + $output .= '<ul class="tab-list">'; |
|
952 | + $output .= ' <li class="first last tab">' . |
|
953 | 953 | l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
954 | - $output .= '</ul>'; |
|
955 | - return $output; |
|
954 | + $output .= '</ul>'; |
|
955 | + return $output; |
|
956 | 956 | } |
957 | 957 | |
958 | 958 | /** |
959 | 959 | * Link to leave a team |
960 | 960 | */ |
961 | 961 | function boincteam_leave_team_panel($team_id) { |
962 | - $team = node_load($team_id); |
|
963 | - $output = ''; |
|
964 | - $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
965 | - $output .= '<p>' . bts('Click here to revoke your membership with' |
|
962 | + $team = node_load($team_id); |
|
963 | + $output = ''; |
|
964 | + $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
965 | + $output .= '<p>' . bts('Click here to revoke your membership with' |
|
966 | 966 | . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel') . '</p>'; |
967 | - $output .= '<ul class="tab-list">'; |
|
968 | - $output .= ' <li class="first last tab">' . |
|
967 | + $output .= '<ul class="tab-list">'; |
|
968 | + $output .= ' <li class="first last tab">' . |
|
969 | 969 | l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
970 | - $output .= '</ul>'; |
|
971 | - return $output; |
|
970 | + $output .= '</ul>'; |
|
971 | + return $output; |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | /** |
975 | 975 | * General info about team admins |
976 | 976 | */ |
977 | 977 | function boincteam_manage_admins_panel_header($team_id) { |
978 | - $output = ''; |
|
979 | - $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
980 | - $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
|
981 | - $output .= '<div class="clearfix"></div>'; |
|
982 | - $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
978 | + $output = ''; |
|
979 | + $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
980 | + $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
|
981 | + $output .= '<div class="clearfix"></div>'; |
|
982 | + $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
983 | 983 | |
984 | - return $output; |
|
984 | + return $output; |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | /** |
988 | 988 | * Team management tools |
989 | 989 | */ |
990 | 990 | function boincteam_management_panel($team_id) { |
991 | - $is_founder = boincteam_is_founder($team_id); |
|
992 | - $team = node_load($team_id); |
|
991 | + $is_founder = boincteam_is_founder($team_id); |
|
992 | + $team = node_load($team_id); |
|
993 | 993 | |
994 | - $output = ''; |
|
995 | - $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
994 | + $output = ''; |
|
995 | + $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
996 | 996 | |
997 | - // PM all members |
|
998 | - if (module_exists('privatemsg')) { |
|
997 | + // PM all members |
|
998 | + if (module_exists('privatemsg')) { |
|
999 | 999 | $output .= '<div class="form-item">'; |
1000 | 1000 | $output .= ' <ul class="tab-list action-list">'; |
1001 | 1001 | $output .= ' <li class="first tab primary">' . |
1002 | - l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
|
1002 | + l('Send message to team', "community/teams/{$team_id}/message-all-members") . '</li>'; |
|
1003 | 1003 | $output .= ' </ul>'; |
1004 | 1004 | $output .= ' <div class="description">'; |
1005 | 1005 | $output .= bts('Contact all team members using e-mail.', array(), NULL, 'boinc:team-manage'); |
1006 | 1006 | $output .= ' </div>'; |
1007 | 1007 | $output .= '</div>'; |
1008 | - } |
|
1008 | + } |
|
1009 | 1009 | |
1010 | - // Team forum |
|
1011 | - if (module_exists('boincteam_forum')) { |
|
1010 | + // Team forum |
|
1011 | + if (module_exists('boincteam_forum')) { |
|
1012 | 1012 | if ($is_founder) { |
1013 | - // Determine whether to create a forum or edit the existing forum |
|
1014 | - // (multiple forums per team could be supported in the future) |
|
1015 | - $team_forum_link_path = 'add'; |
|
1016 | - $team_forums = boincteam_forum_list(); |
|
1017 | - if ($team_forums) { |
|
1013 | + // Determine whether to create a forum or edit the existing forum |
|
1014 | + // (multiple forums per team could be supported in the future) |
|
1015 | + $team_forum_link_path = 'add'; |
|
1016 | + $team_forums = boincteam_forum_list(); |
|
1017 | + if ($team_forums) { |
|
1018 | 1018 | $team_forum = reset($team_forums); |
1019 | 1019 | $team_forum_link_path = "{$team_forum->tfid}/edit"; |
1020 | - } |
|
1021 | - $output .= '<div class="form-item">'; |
|
1022 | - $output .= ' <ul class="tab-list action-list">'; |
|
1023 | - $output .= ' <li class="first tab primary">' . |
|
1020 | + } |
|
1021 | + $output .= '<div class="form-item">'; |
|
1022 | + $output .= ' <ul class="tab-list action-list">'; |
|
1023 | + $output .= ' <li class="first tab primary">' . |
|
1024 | 1024 | l(bts('Manage team message board', array(), NULL, 'boinc:team-manage'), |
1025 | - "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
|
1025 | + "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
|
1026 | 1026 | ); |
1027 | - $output .= ' </li>'; |
|
1028 | - $output .= ' <div class="description">'; |
|
1029 | - $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1030 | - $output .= ' </div>'; |
|
1031 | - $output .= '</div>'; |
|
1027 | + $output .= ' </li>'; |
|
1028 | + $output .= ' <div class="description">'; |
|
1029 | + $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
1030 | + $output .= ' </div>'; |
|
1031 | + $output .= '</div>'; |
|
1032 | + } |
|
1032 | 1033 | } |
1033 | - } |
|
1034 | 1034 | |
1035 | - // Team history |
|
1036 | - $output .= '<div class="form-item">'; |
|
1037 | - $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1038 | - $output .= ' <ul class="tab-list">'; |
|
1039 | - $output .= ' <li class="first tab primary">' . |
|
1035 | + // Team history |
|
1036 | + $output .= '<div class="form-item">'; |
|
1037 | + $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
1038 | + $output .= ' <ul class="tab-list">'; |
|
1039 | + $output .= ' <li class="first tab primary">' . |
|
1040 | 1040 | l('HTML', "community/teams/{$team_id}/history") . '</li>'; |
1041 | - $output .= ' <li class="last tab primary">' . |
|
1041 | + $output .= ' <li class="last tab primary">' . |
|
1042 | 1042 | l('XML', "community/teams/{$team_id}/history/xml") . '</li>'; |
1043 | - $output .= ' </ul>'; |
|
1044 | - $output .= ' <div class="description">'; |
|
1045 | - $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1046 | - $output .= ' </div>'; |
|
1047 | - $output .= '</div>'; |
|
1043 | + $output .= ' </ul>'; |
|
1044 | + $output .= ' <div class="description">'; |
|
1045 | + $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
1046 | + $output .= ' </div>'; |
|
1047 | + $output .= '</div>'; |
|
1048 | 1048 | |
1049 | - $output .= '<div class="form-item">'; |
|
1050 | - $output .= ' <ul class="tab-list action-list">'; |
|
1049 | + $output .= '<div class="form-item">'; |
|
1050 | + $output .= ' <ul class="tab-list action-list">'; |
|
1051 | 1051 | |
1052 | - // Edit team information |
|
1053 | - $output .= ' <li class="first tab primary">' . |
|
1052 | + // Edit team information |
|
1053 | + $output .= ' <li class="first tab primary">' . |
|
1054 | 1054 | l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
1055 | 1055 | |
1056 | - // Member list |
|
1057 | - $output .= ' <li class="tab primary">' . |
|
1056 | + // Member list |
|
1057 | + $output .= ' <li class="tab primary">' . |
|
1058 | 1058 | l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
1059 | 1059 | |
1060 | - // Remove members |
|
1061 | - $output .= ' <li class="tab primary">' . |
|
1060 | + // Remove members |
|
1061 | + $output .= ' <li class="tab primary">' . |
|
1062 | 1062 | l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
1063 | 1063 | |
1064 | - if ($is_founder) { |
|
1064 | + if ($is_founder) { |
|
1065 | 1065 | |
1066 | 1066 | // Change founder |
1067 | 1067 | $output .= ' <li class="tab primary">' . |
1068 | - l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1068 | + l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
1069 | 1069 | |
1070 | - // Manage admins |
|
1070 | + // Manage admins |
|
1071 | 1071 | $output .= ' <li class="tab primary">' . |
1072 | - l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1072 | + l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
1073 | 1073 | |
1074 | 1074 | // Delete the team |
1075 | 1075 | $output .= ' <li class="last tab primary">' . |
1076 | - l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1077 | - } |
|
1076 | + l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
1077 | + } |
|
1078 | 1078 | |
1079 | - $output .= ' </ul>'; |
|
1080 | - $output .= '</div>'; |
|
1079 | + $output .= ' </ul>'; |
|
1080 | + $output .= '</div>'; |
|
1081 | 1081 | |
1082 | - return $output; |
|
1082 | + return $output; |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | /** |
1086 | 1086 | * Link to user's team |
1087 | 1087 | */ |
1088 | 1088 | function boincteam_member_link_panel() { |
1089 | - global $user; |
|
1090 | - $account = user_load($user->uid); |
|
1091 | - $team = node_load($account->team); |
|
1092 | - $output = ''; |
|
1093 | - $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1094 | - $output .= '<p>' . bts('You are a member of @team.', |
|
1089 | + global $user; |
|
1090 | + $account = user_load($user->uid); |
|
1091 | + $team = node_load($account->team); |
|
1092 | + $output = ''; |
|
1093 | + $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
1094 | + $output .= '<p>' . bts('You are a member of @team.', |
|
1095 | 1095 | array('@team' => $team->title), NULL, 'boinc:account-team-panel') . '</p>'; |
1096 | - $output .= '<ul class="tab-list">'; |
|
1097 | - $output .= ' <li class="first last tab">' . |
|
1096 | + $output .= '<ul class="tab-list">'; |
|
1097 | + $output .= ' <li class="first last tab">' . |
|
1098 | 1098 | l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
1099 | - $output .= '</ul>'; |
|
1100 | - return $output; |
|
1099 | + $output .= '</ul>'; |
|
1100 | + return $output; |
|
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | /** |
1104 | 1104 | * Link to request foundership transfer of a team |
1105 | 1105 | */ |
1106 | 1106 | function boincteam_request_foundership_panel($team_id) { |
1107 | - global $user; |
|
1108 | - $account = user_load($user->uid); |
|
1109 | - $team = node_load($team_id); |
|
1110 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
1111 | - $boincteam = boincteam_load($boincteam_id); |
|
1112 | - $boincuser_id = $account->boincuser_id; |
|
1113 | - $output = ''; |
|
1114 | - $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1107 | + global $user; |
|
1108 | + $account = user_load($user->uid); |
|
1109 | + $team = node_load($team_id); |
|
1110 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
1111 | + $boincteam = boincteam_load($boincteam_id); |
|
1112 | + $boincuser_id = $account->boincuser_id; |
|
1113 | + $output = ''; |
|
1114 | + $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
1115 | 1115 | |
1116 | - if (boincteam_user_requested_foundership($team_id)) { |
|
1116 | + if (boincteam_user_requested_foundership($team_id)) { |
|
1117 | 1117 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
1118 | 1118 | $days_to_deadline = ceil(($deadline - time()) / (24*60*60)); |
1119 | 1119 | $request_age = 60 - $days_to_deadline; |
1120 | 1120 | $days_to_respond = 30 + $days_to_deadline; |
1121 | 1121 | if (time() > $deadline) { |
1122 | - $output .= '<p>'; |
|
1123 | - if ($request_age == 1) { |
|
1122 | + $output .= '<p>'; |
|
1123 | + if ($request_age == 1) { |
|
1124 | 1124 | $output .= bts('1 day has elapsed since your request and' |
1125 | - . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
1126 | - } |
|
1127 | - else { |
|
1125 | + . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
1126 | + } |
|
1127 | + else { |
|
1128 | 1128 | $output .= bts('@count days have elapsed since your request and' |
1129 | - . ' the founder has not responded.', |
|
1130 | - array('@count' => $request_age), |
|
1131 | - NULL, 'boinc:team-request-foundership'); |
|
1132 | - } |
|
1133 | - $output .= ' '; |
|
1134 | - if ($days_to_respond == 1) { |
|
1129 | + . ' the founder has not responded.', |
|
1130 | + array('@count' => $request_age), |
|
1131 | + NULL, 'boinc:team-request-foundership'); |
|
1132 | + } |
|
1133 | + $output .= ' '; |
|
1134 | + if ($days_to_respond == 1) { |
|
1135 | 1135 | $output .= bts('You now have 1 day to assume foundership before' |
1136 | - . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
1137 | - } |
|
1138 | - else { |
|
1136 | + . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
1137 | + } |
|
1138 | + else { |
|
1139 | 1139 | $output .= bts('You now have @count days to assume foundership before' |
1140 | - . ' another team member may submit a request.', |
|
1141 | - array('@count' => $days_to_respond), |
|
1142 | - NULL, 'boinc:team-request-foundership'); |
|
1143 | - } |
|
1144 | - $output .= '</p>'; |
|
1145 | - $output .= '<ul class="tab-list">'; |
|
1146 | - $output .= ' <li class="first last tab">' . |
|
1140 | + . ' another team member may submit a request.', |
|
1141 | + array('@count' => $days_to_respond), |
|
1142 | + NULL, 'boinc:team-request-foundership'); |
|
1143 | + } |
|
1144 | + $output .= '</p>'; |
|
1145 | + $output .= '<ul class="tab-list">'; |
|
1146 | + $output .= ' <li class="first last tab">' . |
|
1147 | 1147 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
1148 | - $output .= '</ul>'; |
|
1148 | + $output .= '</ul>'; |
|
1149 | 1149 | } |
1150 | 1150 | else { |
1151 | - $output .= '<p>'; |
|
1152 | - if ($days_to_deadline == 1) { |
|
1151 | + $output .= '<p>'; |
|
1152 | + if ($days_to_deadline == 1) { |
|
1153 | 1153 | $output .= bts('The team founder has 1 day to respond to your' |
1154 | - . ' transfer request.', |
|
1155 | - NULL, 'boinc:team-request-foundership'); |
|
1156 | - } |
|
1157 | - else { |
|
1154 | + . ' transfer request.', |
|
1155 | + NULL, 'boinc:team-request-foundership'); |
|
1156 | + } |
|
1157 | + else { |
|
1158 | 1158 | $output .= bts('The team founder has @count days to respond to your' |
1159 | - . ' transfer request.', array('@count' => $days_to_deadline), |
|
1160 | - NULL, 'boinc:team-request-foundership'); |
|
1161 | - } |
|
1162 | - $output .= '</p>'; |
|
1159 | + . ' transfer request.', array('@count' => $days_to_deadline), |
|
1160 | + NULL, 'boinc:team-request-foundership'); |
|
1161 | + } |
|
1162 | + $output .= '</p>'; |
|
1163 | 1163 | } |
1164 | - } |
|
1165 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1164 | + } |
|
1165 | + elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1166 | 1166 | // If this user does not have a transfer request pending, but new requests |
1167 | 1167 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
1168 | 1168 | // who made the request has 30 additional days to assume foundership if |
@@ -1171,131 +1171,131 @@ discard block |
||
1171 | 1171 | $days_to_deadline = ceil(($deadline - time()) / (24*60*60)) + 30; |
1172 | 1172 | $output .= '<p>'; |
1173 | 1173 | $output .= bts('A team foundership change was already requested recently.' |
1174 | - . ' Only one request is allowed within a period of 90 days.', |
|
1175 | - NULL, 'boinc:team-request-foundership'); |
|
1174 | + . ' Only one request is allowed within a period of 90 days.', |
|
1175 | + NULL, 'boinc:team-request-foundership'); |
|
1176 | 1176 | if ($days_to_deadline == 1) { |
1177 | - $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1177 | + $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
1178 | 1178 | } |
1179 | 1179 | else { |
1180 | - $output .= ' (' . bts('@count days remaining', |
|
1180 | + $output .= ' (' . bts('@count days remaining', |
|
1181 | 1181 | array('@count' => $days_to_deadline), |
1182 | 1182 | NULL, 'boinc:team-request-foundership') . ')'; |
1183 | 1183 | } |
1184 | 1184 | $output .= '</p>'; |
1185 | - } |
|
1186 | - else { |
|
1185 | + } |
|
1186 | + else { |
|
1187 | 1187 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1188 | - . ' assume the role of founder, click below to request foundership of' |
|
1189 | - . ' @this_team.', |
|
1190 | - array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1188 | + . ' assume the role of founder, click below to request foundership of' |
|
1189 | + . ' @this_team.', |
|
1190 | + array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
1191 | 1191 | $output .= '<ul class="tab-list">'; |
1192 | 1192 | $output .= ' <li class="first last tab">' . |
1193 | - l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1193 | + l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
1194 | 1194 | $output .= '</ul>'; |
1195 | - } |
|
1196 | - return $output; |
|
1195 | + } |
|
1196 | + return $output; |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | /** |
1200 | 1200 | * Respond to foundership transfer requests for a team |
1201 | 1201 | */ |
1202 | 1202 | function boincteam_request_foundership_response_panel($team_id) { |
1203 | - global $user; |
|
1204 | - $account = user_load($user->uid); |
|
1205 | - $team = node_load($team_id); |
|
1206 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
1207 | - $boincteam = boincteam_load($boincteam_id); |
|
1208 | - $boincuser_id = $account->boincuser_id; |
|
1209 | - $output = ''; |
|
1203 | + global $user; |
|
1204 | + $account = user_load($user->uid); |
|
1205 | + $team = node_load($team_id); |
|
1206 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
1207 | + $boincteam = boincteam_load($boincteam_id); |
|
1208 | + $boincuser_id = $account->boincuser_id; |
|
1209 | + $output = ''; |
|
1210 | 1210 | |
1211 | - if ($boincteam->ping_user) { |
|
1211 | + if ($boincteam->ping_user) { |
|
1212 | 1212 | if ($boincteam->ping_user < 0) { |
1213 | - $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
|
1214 | - $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1213 | + $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
|
1214 | + $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1215 | 1215 | . '</h2>'; |
1216 | - $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
1216 | + $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
1217 | 1217 | . ' @date, but then left the team. This request is now canceled.', |
1218 | 1218 | array( |
1219 | - '@name' => $member->boincuser_name, |
|
1220 | - '@date' => date('j M Y', $boincteam->ping_time), |
|
1219 | + '@name' => $member->boincuser_name, |
|
1220 | + '@date' => date('j M Y', $boincteam->ping_time), |
|
1221 | 1221 | ), |
1222 | 1222 | NULL, 'boinc:team-request-foundership-response') . '</p>'; |
1223 | - // Automatically cancel the request |
|
1224 | - db_set_active('boinc_rw'); |
|
1225 | - db_query(" |
|
1223 | + // Automatically cancel the request |
|
1224 | + db_set_active('boinc_rw'); |
|
1225 | + db_query(" |
|
1226 | 1226 | UPDATE {team} |
1227 | 1227 | SET ping_user=0 |
1228 | 1228 | WHERE id = '%d'", |
1229 | 1229 | $boincteam_id |
1230 | - ); |
|
1231 | - db_set_active('default'); |
|
1230 | + ); |
|
1231 | + db_set_active('default'); |
|
1232 | 1232 | } |
1233 | 1233 | else { |
1234 | - $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
|
1235 | - $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1234 | + $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
|
1235 | + $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
1236 | 1236 | . '</h2>'; |
1237 | - $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
1237 | + $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
1238 | 1238 | . ' This may be because you left the team or have not had contact with' |
1239 | 1239 | . ' the team for a long time.', array( |
1240 | - '@name' => $member->boincuser_name, |
|
1240 | + '@name' => $member->boincuser_name, |
|
1241 | 1241 | ) |
1242 | - , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1243 | - $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
1242 | + , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
1243 | + $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
1244 | 1244 | . ' will have the option of assuming team foundership. (note: To' |
1245 | 1245 | . ' accept the request, assign foundership to @name using the form' |
1246 | 1246 | . ' below)', |
1247 | 1247 | array( |
1248 | - '@name' => $member->boincuser_name, |
|
1249 | - '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
|
1248 | + '@name' => $member->boincuser_name, |
|
1249 | + '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
|
1250 | 1250 | ), |
1251 | 1251 | NULL, 'boinc:team-request-foundership-response') . '</p>'; |
1252 | - $output .= '<ul class="tab-list">'; |
|
1253 | - $output .= ' <li class="first last tab">' . |
|
1252 | + $output .= '<ul class="tab-list">'; |
|
1253 | + $output .= ' <li class="first last tab">' . |
|
1254 | 1254 | l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
1255 | - $output .= '</ul>'; |
|
1255 | + $output .= '</ul>'; |
|
1256 | 1256 | } |
1257 | - } |
|
1258 | - return $output; |
|
1257 | + } |
|
1258 | + return $output; |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | function boincteam_search_panel() { |
1262 | - $output = ''; |
|
1263 | - if (module_exists('global_search_teams_solr')) { |
|
1262 | + $output = ''; |
|
1263 | + if (module_exists('global_search_teams_solr')) { |
|
1264 | 1264 | $output .= '<h2 class="pane-title">' . bts('Search teams', array(), NULL, 'boinc:search-team') . '</h2>'; |
1265 | 1265 | //$output .= '<p>' . bts('Render a search form here.', array(), NULL, 'boinc:search-team') . '</p>'; |
1266 | 1266 | $output .= '<p>' . boincteam_search_view() . '</p>'; |
1267 | - } |
|
1268 | - return $output; |
|
1267 | + } |
|
1268 | + return $output; |
|
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | function boincteam_search_view($type = 'team') { |
1272 | - // Get the team search form |
|
1273 | - $search_page = apachesolr_search_page_load('team_search'); |
|
1274 | - module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages'); |
|
1275 | - return drupal_get_form('apachesolr_search_custom_page_search_form', $search_page); |
|
1272 | + // Get the team search form |
|
1273 | + $search_page = apachesolr_search_page_load('team_search'); |
|
1274 | + module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages'); |
|
1275 | + return drupal_get_form('apachesolr_search_custom_page_search_form', $search_page); |
|
1276 | 1276 | } |
1277 | 1277 | |
1278 | 1278 | /** |
1279 | 1279 | * General info about the concept of teams |
1280 | 1280 | */ |
1281 | 1281 | function boincteam_topic_overview_panel() { |
1282 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1283 | - $output = ''; |
|
1284 | - $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1285 | - $output .= '<div class="">'; |
|
1286 | - $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
1282 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
1283 | + $output = ''; |
|
1284 | + $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
1285 | + $output .= '<div class="">'; |
|
1286 | + $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
1287 | 1287 | . ' to only one team. You can join or quit a team at any time. To join a' |
1288 | 1288 | . ' team, visit its team page and click "Join this team". Each team has a' |
1289 | 1289 | . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info') . '</p>'; |
1290 | - $output .= '<ul>'; |
|
1291 | - $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | - $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | - $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | - $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1295 | - $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1296 | - $output .= '</ul>'; |
|
1297 | - $output .= '</div>'; |
|
1298 | - return $output; |
|
1290 | + $output .= '<ul>'; |
|
1291 | + $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1292 | + $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1293 | + $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1294 | + $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1295 | + $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
1296 | + $output .= '</ul>'; |
|
1297 | + $output .= '</div>'; |
|
1298 | + return $output; |
|
1299 | 1299 | } |
1300 | 1300 | |
1301 | 1301 | /** |
@@ -1323,50 +1323,50 @@ discard block |
||
1323 | 1323 | * Link to view a team |
1324 | 1324 | */ |
1325 | 1325 | function boincteam_view_team_panel($team_id) { |
1326 | - $team = node_load($team_id); |
|
1327 | - if ($team->type != "team") { |
|
1326 | + $team = node_load($team_id); |
|
1327 | + if ($team->type != "team") { |
|
1328 | 1328 | return; |
1329 | - } |
|
1330 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
1331 | - $founder = user_load(get_drupal_id($boincteam->userid)); |
|
1332 | - $new_members = array(); |
|
1333 | - if ($boincteam->new_members) { |
|
1329 | + } |
|
1330 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
1331 | + $founder = user_load(get_drupal_id($boincteam->userid)); |
|
1332 | + $new_members = array(); |
|
1333 | + if ($boincteam->new_members) { |
|
1334 | 1334 | foreach ($boincteam->new_members as $member) { |
1335 | - $account = user_load(get_drupal_id($member->id)); |
|
1336 | - $new_members[] = l($account->boincuser_name, "account/{$account->uid}"); |
|
1335 | + $account = user_load(get_drupal_id($member->id)); |
|
1336 | + $new_members[] = l($account->boincuser_name, "account/{$account->uid}"); |
|
1337 | 1337 | } |
1338 | - } |
|
1339 | - $output = ''; |
|
1340 | - $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
1341 | - $output .= '<div>'; |
|
1342 | - $output .= '<div class="left-column">'; |
|
1343 | - $output .= '<ul class="stats">'; |
|
1344 | - $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1345 | - $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1346 | - $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1347 | - $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1348 | - $output .= '</ul>'; |
|
1349 | - $output .= '</div>'; |
|
1350 | - $output .= '<div class="right-column">'; |
|
1351 | - $output .= '<ul class="stats">'; |
|
1352 | - $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1353 | - $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1354 | - $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1355 | - $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1356 | - $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1357 | - $output .= '</ul>'; |
|
1358 | - $output .= '</div>'; |
|
1359 | - $output .= '</div>'; |
|
1360 | - $output .= '<div class="clearfix"></div>'; |
|
1361 | - if ($boincteam->url) { |
|
1338 | + } |
|
1339 | + $output = ''; |
|
1340 | + $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
1341 | + $output .= '<div>'; |
|
1342 | + $output .= '<div class="left-column">'; |
|
1343 | + $output .= '<ul class="stats">'; |
|
1344 | + $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
1345 | + $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
1346 | + $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
1347 | + $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
1348 | + $output .= '</ul>'; |
|
1349 | + $output .= '</div>'; |
|
1350 | + $output .= '<div class="right-column">'; |
|
1351 | + $output .= '<ul class="stats">'; |
|
1352 | + $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
1353 | + $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
1354 | + $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
1355 | + $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
1356 | + $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
1357 | + $output .= '</ul>'; |
|
1358 | + $output .= '</div>'; |
|
1359 | + $output .= '</div>'; |
|
1360 | + $output .= '<div class="clearfix"></div>'; |
|
1361 | + if ($boincteam->url) { |
|
1362 | 1362 | $output .= '<div class="stats">'; |
1363 | 1363 | $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
1364 | 1364 | $output .= '</div>'; |
1365 | - } |
|
1366 | - if ($team->body) { |
|
1365 | + } |
|
1366 | + if ($team->body) { |
|
1367 | 1367 | $output .= '<h3>' . bts('Description', array(), NULL, 'boinc:team-description') . '</h3>'; |
1368 | 1368 | $output .= check_markup($team->body, $team->format); |
1369 | 1369 | $output .= '</div>'; |
1370 | - } |
|
1371 | - return $output; |
|
1370 | + } |
|
1371 | + return $output; |
|
1372 | 1372 | } |
@@ -258,8 +258,7 @@ discard block |
||
258 | 258 | ), WATCHDOG_NOTICE |
259 | 259 | ); |
260 | 260 | } |
261 | - } |
|
262 | - else { |
|
261 | + } else { |
|
263 | 262 | drupal_set_message(t('You are not allowed to assume foundership of this |
264 | 263 | team.' |
265 | 264 | )); |
@@ -284,8 +283,7 @@ discard block |
||
284 | 283 | drupal_set_message(t('@team has been removed.', |
285 | 284 | array('@team' => $boincteam->name))); |
286 | 285 | drupal_goto('community/teams'); |
287 | - } |
|
288 | - else { |
|
286 | + } else { |
|
289 | 287 | drupal_set_message(t('All members must be removed from @team before the |
290 | 288 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
291 | 289 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
@@ -519,8 +517,7 @@ discard block |
||
519 | 517 | array('@team' => $boincteam->name))); |
520 | 518 | watchdog('boincteam', 'added user @uid to team @nid', |
521 | 519 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
522 | - } |
|
523 | - else { |
|
520 | + } else { |
|
524 | 521 | // @todo - consider another rule/error event here |
525 | 522 | drupal_set_message(t('There was a problem joining @team, please try again |
526 | 523 | later', array('@team' => $boincteam->name))); |
@@ -548,8 +545,7 @@ discard block |
||
548 | 545 | array('@team' => $boincteam->name))); |
549 | 546 | watchdog('boincteam', 'removed user @uid from team @nid', |
550 | 547 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
551 | - } |
|
552 | - else { |
|
548 | + } else { |
|
553 | 549 | drupal_set_message(t('You are not a member of @team, so you cannot revoke |
554 | 550 | your membership to it.', array('@team' => $boincteam->name))); |
555 | 551 | } |
@@ -618,8 +614,7 @@ discard block |
||
618 | 614 | '@uid' => $account->uid, |
619 | 615 | '@nid' => $team_id |
620 | 616 | ), WATCHDOG_NOTICE); |
621 | - } |
|
622 | - else { |
|
617 | + } else { |
|
623 | 618 | drupal_set_message(t('@user is not a member of @team, so you cannot |
624 | 619 | revoke the membership.', array( |
625 | 620 | '@user' => $account->boincuser_name, |
@@ -648,14 +643,12 @@ discard block |
||
648 | 643 | '@user' => $account->boincuser_name |
649 | 644 | ) |
650 | 645 | ), 'warning'); |
651 | - } |
|
652 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
646 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
653 | 647 | // It hasn't been long enough since the last transfer request |
654 | 648 | drupal_set_message(t('A foundership change was requested during the last 90 |
655 | 649 | days, so new requests are not allowed. Please try again later.' |
656 | 650 | ), 'warning'); |
657 | - } |
|
658 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
651 | + } elseif (boincteam_is_member($team_id, $account->uid)) { |
|
659 | 652 | // Log the transfer request |
660 | 653 | db_set_active('boinc_rw'); |
661 | 654 | db_query(" |
@@ -861,8 +854,7 @@ discard block |
||
861 | 854 | $output .= '['; |
862 | 855 | if ($credit_needed == 1) { |
863 | 856 | $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
864 | - } |
|
865 | - else { |
|
857 | + } else { |
|
866 | 858 | $output .= bts('You must earn @count more credits!', |
867 | 859 | array('@count' => $credit_needed), |
868 | 860 | NULL, 'boinc:create-team-panel' |
@@ -915,8 +907,7 @@ discard block |
||
915 | 907 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
916 | 908 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
917 | 909 | $output .= '</div>' . "\n"; |
918 | - } |
|
919 | - else if ($user->uid == $account->uid) { |
|
910 | + } else if ($user->uid == $account->uid) { |
|
920 | 911 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
921 | 912 | $output .= '<ul class="tab-list action-list">'; |
922 | 913 | $output .= '<li class="tab primary">'; |
@@ -1123,8 +1114,7 @@ discard block |
||
1123 | 1114 | if ($request_age == 1) { |
1124 | 1115 | $output .= bts('1 day has elapsed since your request and' |
1125 | 1116 | . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
1126 | - } |
|
1127 | - else { |
|
1117 | + } else { |
|
1128 | 1118 | $output .= bts('@count days have elapsed since your request and' |
1129 | 1119 | . ' the founder has not responded.', |
1130 | 1120 | array('@count' => $request_age), |
@@ -1134,8 +1124,7 @@ discard block |
||
1134 | 1124 | if ($days_to_respond == 1) { |
1135 | 1125 | $output .= bts('You now have 1 day to assume foundership before' |
1136 | 1126 | . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
1137 | - } |
|
1138 | - else { |
|
1127 | + } else { |
|
1139 | 1128 | $output .= bts('You now have @count days to assume foundership before' |
1140 | 1129 | . ' another team member may submit a request.', |
1141 | 1130 | array('@count' => $days_to_respond), |
@@ -1146,23 +1135,20 @@ discard block |
||
1146 | 1135 | $output .= ' <li class="first last tab">' . |
1147 | 1136 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
1148 | 1137 | $output .= '</ul>'; |
1149 | - } |
|
1150 | - else { |
|
1138 | + } else { |
|
1151 | 1139 | $output .= '<p>'; |
1152 | 1140 | if ($days_to_deadline == 1) { |
1153 | 1141 | $output .= bts('The team founder has 1 day to respond to your' |
1154 | 1142 | . ' transfer request.', |
1155 | 1143 | NULL, 'boinc:team-request-foundership'); |
1156 | - } |
|
1157 | - else { |
|
1144 | + } else { |
|
1158 | 1145 | $output .= bts('The team founder has @count days to respond to your' |
1159 | 1146 | . ' transfer request.', array('@count' => $days_to_deadline), |
1160 | 1147 | NULL, 'boinc:team-request-foundership'); |
1161 | 1148 | } |
1162 | 1149 | $output .= '</p>'; |
1163 | 1150 | } |
1164 | - } |
|
1165 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1151 | + } elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
1166 | 1152 | // If this user does not have a transfer request pending, but new requests |
1167 | 1153 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
1168 | 1154 | // who made the request has 30 additional days to assume foundership if |
@@ -1175,15 +1161,13 @@ discard block |
||
1175 | 1161 | NULL, 'boinc:team-request-foundership'); |
1176 | 1162 | if ($days_to_deadline == 1) { |
1177 | 1163 | $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
1178 | - } |
|
1179 | - else { |
|
1164 | + } else { |
|
1180 | 1165 | $output .= ' (' . bts('@count days remaining', |
1181 | 1166 | array('@count' => $days_to_deadline), |
1182 | 1167 | NULL, 'boinc:team-request-foundership') . ')'; |
1183 | 1168 | } |
1184 | 1169 | $output .= '</p>'; |
1185 | - } |
|
1186 | - else { |
|
1170 | + } else { |
|
1187 | 1171 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
1188 | 1172 | . ' assume the role of founder, click below to request foundership of' |
1189 | 1173 | . ' @this_team.', |
@@ -1229,8 +1213,7 @@ discard block |
||
1229 | 1213 | $boincteam_id |
1230 | 1214 | ); |
1231 | 1215 | db_set_active('default'); |
1232 | - } |
|
1233 | - else { |
|
1216 | + } else { |
|
1234 | 1217 | $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
1235 | 1218 | $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
1236 | 1219 | . '</h2>'; |