@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | } |
| 644 | 644 | break; |
| 645 | 645 | |
| 646 | - default: |
|
| 647 | - // Don't generate form elements for things that aren't explicitly form |
|
| 648 | - // elements (i.e. 'title', '@attributes' keys, and the like) |
|
| 646 | + default: |
|
| 647 | + // Don't generate form elements for things that aren't explicitly form |
|
| 648 | + // elements (i.e. 'title', '@attributes' keys, and the like) |
|
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | |
@@ -1990,29 +1990,29 @@ discard block |
||
| 1990 | 1990 | */ |
| 1991 | 1991 | function pretty_application_version($appverid, $vernum, $plan_class, $plfm) { |
| 1992 | 1992 | switch ($appverid) { |
| 1993 | - case ANON_PLATFORM_UNKNOWN: |
|
| 1994 | - return "Anonymous platform"; |
|
| 1995 | - case ANON_PLATFORM_CPU: |
|
| 1996 | - return "Anonymous platform CPU"; |
|
| 1997 | - case ANON_PLATFORM_NVIDIA: |
|
| 1998 | - return "Anonymous platform NVIDIA GPU"; |
|
| 1999 | - case ANON_PLATFORM_ATI: |
|
| 2000 | - return "Anonymous platform AMD GPU"; |
|
| 2001 | - case ANON_PLATFORM_INTEL: |
|
| 2002 | - return "Anonymous platform Intel GPU"; |
|
| 2003 | - case 0: |
|
| 2004 | - return "---"; |
|
| 2005 | - default: |
|
| 2006 | - // Handle the case where the appversid is still negative. This |
|
| 2007 | - // may be cause BOINC has introduced a new anonymous platform |
|
| 2008 | - // that is not handled by the above case statements. |
|
| 2009 | - if ($appverid < 0) { |
|
| 2010 | - return "Unknown Anonymous platform"; |
|
| 2011 | - } |
|
| 2012 | - else { |
|
| 2013 | - $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100); |
|
| 2014 | - $prettyc = ($plan_class) ? "($av->plan_class)" : ''; |
|
| 2015 | - return "v$prettyv $prettyc $plfm"; |
|
| 2016 | - } |
|
| 1993 | + case ANON_PLATFORM_UNKNOWN: |
|
| 1994 | + return "Anonymous platform"; |
|
| 1995 | + case ANON_PLATFORM_CPU: |
|
| 1996 | + return "Anonymous platform CPU"; |
|
| 1997 | + case ANON_PLATFORM_NVIDIA: |
|
| 1998 | + return "Anonymous platform NVIDIA GPU"; |
|
| 1999 | + case ANON_PLATFORM_ATI: |
|
| 2000 | + return "Anonymous platform AMD GPU"; |
|
| 2001 | + case ANON_PLATFORM_INTEL: |
|
| 2002 | + return "Anonymous platform Intel GPU"; |
|
| 2003 | + case 0: |
|
| 2004 | + return "---"; |
|
| 2005 | + default: |
|
| 2006 | + // Handle the case where the appversid is still negative. This |
|
| 2007 | + // may be cause BOINC has introduced a new anonymous platform |
|
| 2008 | + // that is not handled by the above case statements. |
|
| 2009 | + if ($appverid < 0) { |
|
| 2010 | + return "Unknown Anonymous platform"; |
|
| 2011 | + } |
|
| 2012 | + else { |
|
| 2013 | + $prettyv = sprintf("%d.%02d", $vernum/100, $vernum%100); |
|
| 2014 | + $prettyc = ($plan_class) ? "($av->plan_class)" : ''; |
|
| 2015 | + return "v$prettyv $prettyc $plfm"; |
|
| 2016 | + } |
|
| 2017 | 2017 | } |
| 2018 | 2018 | } |
@@ -1049,24 +1049,24 @@ |
||
| 1049 | 1049 | log_write("----- Handling RPC; command ".$r->getName()); |
| 1050 | 1050 | |
| 1051 | 1051 | switch ($r->getName()) { |
| 1052 | - case 'abort_batch': handle_abort_batch($r); break; |
|
| 1053 | - case 'abort_jobs': handle_abort_jobs($r); break; |
|
| 1054 | - case 'create_batch': create_batch($r); break; |
|
| 1055 | - case 'estimate_batch': estimate_batch($r); break; |
|
| 1056 | - case 'get_templates': get_templates($r); break; |
|
| 1057 | - case 'ping': ping($r); break; |
|
| 1058 | - case 'query_batch': query_batch($r); break; |
|
| 1059 | - case 'query_batch2': query_batch2($r); break; |
|
| 1060 | - case 'query_batches': query_batches($r); break; |
|
| 1061 | - case 'query_job': query_job($r); break; |
|
| 1062 | - case 'query_completed_job': query_completed_job($r); break; |
|
| 1063 | - case 'retire_batch': handle_retire_batch($r); break; |
|
| 1064 | - case 'set_expire_time': handle_set_expire_time($r); break; |
|
| 1065 | - case 'submit_batch': submit_batch($r); break; |
|
| 1066 | - default: |
|
| 1067 | - log_write("bad command"); |
|
| 1068 | - xml_error(-1, "bad command: ".$r->getName()); |
|
| 1069 | - break; |
|
| 1052 | +case 'abort_batch': handle_abort_batch($r); break; |
|
| 1053 | +case 'abort_jobs': handle_abort_jobs($r); break; |
|
| 1054 | +case 'create_batch': create_batch($r); break; |
|
| 1055 | +case 'estimate_batch': estimate_batch($r); break; |
|
| 1056 | +case 'get_templates': get_templates($r); break; |
|
| 1057 | +case 'ping': ping($r); break; |
|
| 1058 | +case 'query_batch': query_batch($r); break; |
|
| 1059 | +case 'query_batch2': query_batch2($r); break; |
|
| 1060 | +case 'query_batches': query_batches($r); break; |
|
| 1061 | +case 'query_job': query_job($r); break; |
|
| 1062 | +case 'query_completed_job': query_completed_job($r); break; |
|
| 1063 | +case 'retire_batch': handle_retire_batch($r); break; |
|
| 1064 | +case 'set_expire_time': handle_set_expire_time($r); break; |
|
| 1065 | +case 'submit_batch': submit_batch($r); break; |
|
| 1066 | +default: |
|
| 1067 | + log_write("bad command"); |
|
| 1068 | + xml_error(-1, "bad command: ".$r->getName()); |
|
| 1069 | + break; |
|
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | log_write("RPC done"); |
@@ -16,39 +16,39 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | function boincteam_rules_event_info() { |
| 19 | - return array( |
|
| 20 | - 'boincteam_create_team_error' => array( |
|
| 21 | - 'label' => bts('Error creating a new BOINC team - general error.', array(), NULL, 'boinc:rule-event'), |
|
| 22 | - 'module' => 'Boincteam', |
|
| 23 | - 'arguments' => rules_events_hook_boincteam_arguments(), |
|
| 24 | - ), |
|
| 25 | - 'boincteam_create_team_nopathauto_error' => array( |
|
| 26 | - 'label' => bts('Error creating a new BOINC team - no pathauto module.', array(), NULL, 'boinc:rule-event'), |
|
| 27 | - 'module' => 'Boincteam', |
|
| 28 | - 'arguments' => rules_events_hook_boincteam_arguments(), |
|
| 29 | - ), |
|
| 30 | - ); |
|
| 19 | +return array( |
|
| 20 | +'boincteam_create_team_error' => array( |
|
| 21 | + 'label' => bts('Error creating a new BOINC team - general error.', array(), NULL, 'boinc:rule-event'), |
|
| 22 | + 'module' => 'Boincteam', |
|
| 23 | + 'arguments' => rules_events_hook_boincteam_arguments(), |
|
| 24 | +), |
|
| 25 | +'boincteam_create_team_nopathauto_error' => array( |
|
| 26 | + 'label' => bts('Error creating a new BOINC team - no pathauto module.', array(), NULL, 'boinc:rule-event'), |
|
| 27 | + 'module' => 'Boincteam', |
|
| 28 | + 'arguments' => rules_events_hook_boincteam_arguments(), |
|
| 29 | +), |
|
| 30 | +); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Arguments suitable for boincteam |
| 35 | 35 | **/ |
| 36 | 36 | function rules_events_hook_boincteam_arguments() { |
| 37 | - return array( |
|
| 38 | - 'team_name' => array( |
|
| 39 | - 'type' => 'string', |
|
| 40 | - 'label' => 'team name', |
|
| 41 | - 'required' => TRUE, |
|
| 42 | - ), |
|
| 43 | - ) + rules_events_hook_boincteam_adminnotify_argument(); |
|
| 37 | +return array( |
|
| 38 | +'team_name' => array( |
|
| 39 | + 'type' => 'string', |
|
| 40 | + 'label' => 'team name', |
|
| 41 | + 'required' => TRUE, |
|
| 42 | +), |
|
| 43 | +) + rules_events_hook_boincteam_adminnotify_argument(); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | function rules_events_hook_boincteam_adminnotify_argument() { |
| 47 | - return array( |
|
| 48 | - 'subject_tag' => array( |
|
| 49 | - 'type' => 'string', |
|
| 50 | - 'label' => 'Subject tag for email filtering', |
|
| 51 | - 'required' => TRUE, |
|
| 52 | - ), |
|
| 53 | - ) + rules_events_global_user_argument(); |
|
| 47 | +return array( |
|
| 48 | +'subject_tag' => array( |
|
| 49 | + 'type' => 'string', |
|
| 50 | + 'label' => 'Subject tag for email filtering', |
|
| 51 | + 'required' => TRUE, |
|
| 52 | +), |
|
| 53 | +) + rules_events_global_user_argument(); |
|
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -15,42 +15,42 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | function boincteam_sync() { |
| 17 | 17 | |
| 18 | - // Get the list of teams to import |
|
| 19 | - db_set_active('boinc_rw'); |
|
| 20 | - $boinc_teams = db_query(' |
|
| 18 | +// Get the list of teams to import |
|
| 19 | +db_set_active('boinc_rw'); |
|
| 20 | +$boinc_teams = db_query(' |
|
| 21 | 21 | SELECT id, name, description, userid, create_time, seti_id |
| 22 | 22 | FROM team |
| 23 | 23 | WHERE mod_time > FROM_UNIXTIME(%d)', |
| 24 | - variable_get('boincteam_last_sync', 0) |
|
| 25 | - ); |
|
| 26 | - db_set_active('default'); |
|
| 24 | +variable_get('boincteam_last_sync', 0) |
|
| 25 | +); |
|
| 26 | +db_set_active('default'); |
|
| 27 | 27 | |
| 28 | - $existing_teams = array(); |
|
| 28 | +$existing_teams = array(); |
|
| 29 | 29 | |
| 30 | - // Get the list of teams already in Drupal to be sure we're not importing |
|
| 31 | - // any twice |
|
| 32 | - $result = db_query(' |
|
| 30 | +// Get the list of teams already in Drupal to be sure we're not importing |
|
| 31 | +// any twice |
|
| 32 | +$result = db_query(' |
|
| 33 | 33 | SELECT nid, team_id FROM {boincteam}' |
| 34 | - ); |
|
| 35 | - while ($row = db_fetch_object($result)) { |
|
| 36 | - $existing_teams[$row->team_id] = $row->nid; |
|
| 37 | - } |
|
| 34 | +); |
|
| 35 | +while ($row = db_fetch_object($result)) { |
|
| 36 | +$existing_teams[$row->team_id] = $row->nid; |
|
| 37 | +} |
|
| 38 | 38 | |
| 39 | - while ($boinc_team = db_fetch_object($boinc_teams)) { |
|
| 40 | - $success = NULL; |
|
| 41 | - if (isset($existing_teams[$boinc_team->id])) { |
|
| 42 | - if ($boinc_team->seti_id > 0) { |
|
| 43 | - // Sync BOINC-wide teams |
|
| 44 | - $nid = $existing_teams[$boinc_team->id]; |
|
| 45 | - $success = boincteam_import($boinc_team, $nid); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - else { |
|
| 49 | - // Import new teams created by RPC or ops/team_import.php |
|
| 50 | - $success = boincteam_import($boinc_team); |
|
| 51 | - } |
|
| 39 | +while ($boinc_team = db_fetch_object($boinc_teams)) { |
|
| 40 | +$success = NULL; |
|
| 41 | +if (isset($existing_teams[$boinc_team->id])) { |
|
| 42 | + if ($boinc_team->seti_id > 0) { |
|
| 43 | + // Sync BOINC-wide teams |
|
| 44 | + $nid = $existing_teams[$boinc_team->id]; |
|
| 45 | + $success = boincteam_import($boinc_team, $nid); |
|
| 52 | 46 | } |
| 53 | 47 | } |
| 48 | +else { |
|
| 49 | + // Import new teams created by RPC or ops/team_import.php |
|
| 50 | + $success = boincteam_import($boinc_team); |
|
| 51 | +} |
|
| 52 | +} |
|
| 53 | +} |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -58,58 +58,58 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | function boincteam_import($boincteam, $nid = NULL) { |
| 60 | 60 | |
| 61 | - $input_format = variable_get('boincimport_input_format', 0); |
|
| 62 | - $team_type_map = variable_get('boincimport_team_types', array()); |
|
| 61 | +$input_format = variable_get('boincimport_input_format', 0); |
|
| 62 | +$team_type_map = variable_get('boincimport_team_types', array()); |
|
| 63 | 63 | |
| 64 | - // Save the team type affiliation |
|
| 65 | - $team_type_tid = $team_type_map[$boincteam->type]; |
|
| 64 | +// Save the team type affiliation |
|
| 65 | +$team_type_tid = $team_type_map[$boincteam->type]; |
|
| 66 | 66 | |
| 67 | - $boincteam->description = html_entity_decode($boincteam->description, ENT_QUOTES, 'utf-8'); |
|
| 68 | - // Be sure the text is filtered for the default input format |
|
| 69 | - $boincteam->description = check_markup($boincteam->description, $input_format); |
|
| 67 | +$boincteam->description = html_entity_decode($boincteam->description, ENT_QUOTES, 'utf-8'); |
|
| 68 | +// Be sure the text is filtered for the default input format |
|
| 69 | +$boincteam->description = check_markup($boincteam->description, $input_format); |
|
| 70 | 70 | |
| 71 | - $teaser = node_teaser($boincteam->description); |
|
| 71 | +$teaser = node_teaser($boincteam->description); |
|
| 72 | 72 | |
| 73 | - if ($nid) { |
|
| 74 | - // Update an existing node |
|
| 75 | - $node = node_load($nid); |
|
| 76 | - $node->title = $boincteam->name; |
|
| 77 | - $node->body = $boincteam->description; |
|
| 78 | - $node->teaser = $teaser; |
|
| 79 | - $node->uid = boincuser_lookup_uid($boincteam->userid); |
|
| 80 | - } |
|
| 81 | - else { |
|
| 82 | - // Construct the team as a new node |
|
| 83 | - $node = array( |
|
| 84 | - 'type' => 'team', |
|
| 85 | - 'title' => $boincteam->name, |
|
| 86 | - 'body' => $boincteam->description, |
|
| 87 | - 'teaser' => $teaser, |
|
| 88 | - 'uid' => boincuser_lookup_uid($boincteam->userid), |
|
| 89 | - 'path' => null, |
|
| 90 | - 'status' => 1, // published or not - always publish |
|
| 91 | - 'promote' => 0, |
|
| 92 | - 'created' => $boincteam->create_time, |
|
| 93 | - 'comment' => 0, // comments disabled |
|
| 94 | - 'moderate' => 0, |
|
| 95 | - 'sticky' => 0, |
|
| 96 | - 'format' => $input_format |
|
| 97 | - ); |
|
| 98 | - $node = (object) $node; // node_save requires an object form |
|
| 99 | - } |
|
| 73 | +if ($nid) { |
|
| 74 | +// Update an existing node |
|
| 75 | +$node = node_load($nid); |
|
| 76 | +$node->title = $boincteam->name; |
|
| 77 | +$node->body = $boincteam->description; |
|
| 78 | +$node->teaser = $teaser; |
|
| 79 | +$node->uid = boincuser_lookup_uid($boincteam->userid); |
|
| 80 | +} |
|
| 81 | +else { |
|
| 82 | +// Construct the team as a new node |
|
| 83 | +$node = array( |
|
| 84 | + 'type' => 'team', |
|
| 85 | + 'title' => $boincteam->name, |
|
| 86 | + 'body' => $boincteam->description, |
|
| 87 | + 'teaser' => $teaser, |
|
| 88 | + 'uid' => boincuser_lookup_uid($boincteam->userid), |
|
| 89 | + 'path' => null, |
|
| 90 | + 'status' => 1, // published or not - always publish |
|
| 91 | + 'promote' => 0, |
|
| 92 | + 'created' => $boincteam->create_time, |
|
| 93 | + 'comment' => 0, // comments disabled |
|
| 94 | + 'moderate' => 0, |
|
| 95 | + 'sticky' => 0, |
|
| 96 | + 'format' => $input_format |
|
| 97 | +); |
|
| 98 | +$node = (object) $node; // node_save requires an object form |
|
| 99 | +} |
|
| 100 | 100 | |
| 101 | - $node->taxonomy[] = taxonomy_get_term($team_type_tid); |
|
| 101 | +$node->taxonomy[] = taxonomy_get_term($team_type_tid); |
|
| 102 | 102 | |
| 103 | - // Save the team node |
|
| 104 | - node_save($node); |
|
| 105 | - $success = ($node->nid) ? TRUE : FALSE; |
|
| 103 | +// Save the team node |
|
| 104 | +node_save($node); |
|
| 105 | +$success = ($node->nid) ? TRUE : FALSE; |
|
| 106 | 106 | |
| 107 | - if (!$nid) { |
|
| 108 | - // Save the team IDs to a BOINC <--> Drupal reference table, if needed |
|
| 109 | - db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam->id, $node->nid); |
|
| 110 | - } |
|
| 107 | +if (!$nid) { |
|
| 108 | +// Save the team IDs to a BOINC <--> Drupal reference table, if needed |
|
| 109 | +db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam->id, $node->nid); |
|
| 110 | +} |
|
| 111 | 111 | |
| 112 | - return $success; |
|
| 112 | +return $success; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -126,25 +126,25 @@ discard block |
||
| 126 | 126 | * respected. This is useful the list of users are to be contacted. |
| 127 | 127 | */ |
| 128 | 128 | function _boincteam_userids($boincteamid, $boincid=TRUE, $respectprivacy=TRUE) { |
| 129 | - $sql = 'SELECT user.id as id FROM {user} user WHERE user.teamid=%s'; |
|
| 130 | - if ($respectprivacy) { |
|
| 131 | - $sql .= ' AND user.send_email=1'; |
|
| 132 | - } |
|
| 129 | +$sql = 'SELECT user.id as id FROM {user} user WHERE user.teamid=%s'; |
|
| 130 | +if ($respectprivacy) { |
|
| 131 | +$sql .= ' AND user.send_email=1'; |
|
| 132 | +} |
|
| 133 | 133 | |
| 134 | - db_set_active('boinc_ro'); |
|
| 135 | - $dbres = db_query($sql, $boincteamid); |
|
| 136 | - db_set_active('default'); |
|
| 134 | +db_set_active('boinc_ro'); |
|
| 135 | +$dbres = db_query($sql, $boincteamid); |
|
| 136 | +db_set_active('default'); |
|
| 137 | 137 | |
| 138 | - $ids = array(); |
|
| 139 | - while (($result = db_fetch_object($dbres)) != FALSE) { |
|
| 140 | - $ids[] = $result->id; |
|
| 141 | - } |
|
| 142 | - if ($boincid) { |
|
| 143 | - return $ids; |
|
| 144 | - } |
|
| 145 | - else { |
|
| 146 | - return array_map('boincuser_lookup_uid', $ids); |
|
| 147 | - } |
|
| 138 | +$ids = array(); |
|
| 139 | +while (($result = db_fetch_object($dbres)) != FALSE) { |
|
| 140 | +$ids[] = $result->id; |
|
| 141 | +} |
|
| 142 | +if ($boincid) { |
|
| 143 | +return $ids; |
|
| 144 | +} |
|
| 145 | +else { |
|
| 146 | +return array_map('boincuser_lookup_uid', $ids); |
|
| 147 | +} |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -158,18 +158,18 @@ discard block |
||
| 158 | 158 | * respected. This is useful the list of users are to be contacted. |
| 159 | 159 | */ |
| 160 | 160 | function _boincteam_emails($boincteamid, $respectprivacy=TRUE) { |
| 161 | - $sql = 'SELECT user.email_addr as email_addr FROM {user} user WHERE user.teamid=%s'; |
|
| 162 | - if ($respectprivacy) { |
|
| 163 | - $sql .= ' AND user.send_email=1'; |
|
| 164 | - } |
|
| 161 | +$sql = 'SELECT user.email_addr as email_addr FROM {user} user WHERE user.teamid=%s'; |
|
| 162 | +if ($respectprivacy) { |
|
| 163 | +$sql .= ' AND user.send_email=1'; |
|
| 164 | +} |
|
| 165 | 165 | |
| 166 | - db_set_active('boinc_ro'); |
|
| 167 | - $dbres = db_query($sql, $boincteamid); |
|
| 168 | - db_set_active('default'); |
|
| 166 | +db_set_active('boinc_ro'); |
|
| 167 | +$dbres = db_query($sql, $boincteamid); |
|
| 168 | +db_set_active('default'); |
|
| 169 | 169 | |
| 170 | - $emails = array(); |
|
| 171 | - while (($result = db_fetch_object($dbres)) != FALSE) { |
|
| 172 | - $emails[] = $result->email_addr; |
|
| 173 | - } |
|
| 174 | - return $emails; |
|
| 170 | +$emails = array(); |
|
| 171 | +while (($result = db_fetch_object($dbres)) != FALSE) { |
|
| 172 | +$emails[] = $result->email_addr; |
|
| 173 | +} |
|
| 174 | +return $emails; |
|
| 175 | 175 | } |