Passed
Pull Request — master (#3042)
by Christian
07:09
created
drupal/sites/default/boinc/modules/boincimport/includes/import_team.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,56 +11,56 @@  discard block
 block discarded – undo
11 11
  * at a time and avoid exhausting memory.
12 12
  */
13 13
 
14
-  require_once('./includes/bootstrap.inc');
15
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
16
-  require_boinc('db');
14
+    require_once('./includes/bootstrap.inc');
15
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
16
+    require_boinc('db');
17 17
   
18
-  // Parse arguments
19
-  $team_id = isset($argv[1]) ? $argv[1] : null;
20
-  $team_type_tid = isset($argv[2]) ? $argv[2] : null;
21
-  $input_format = isset($argv[3]) ? $argv[3] : null;
18
+    // Parse arguments
19
+    $team_id = isset($argv[1]) ? $argv[1] : null;
20
+    $team_type_tid = isset($argv[2]) ? $argv[2] : null;
21
+    $input_format = isset($argv[3]) ? $argv[3] : null;
22 22
   
23
-  $count = 0;
23
+    $count = 0;
24 24
   
25
-  // Get teams from BOINC
26
-  db_set_active('boinc_rw');
27
-  $boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id)));
28
-  $boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id));
29
-  $boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
30
-  db_set_active('default');
25
+    // Get teams from BOINC
26
+    db_set_active('boinc_rw');
27
+    $boincteam = db_fetch_object(db_query('SELECT * FROM team WHERE id=%d', array($team_id)));
28
+    $boincteam_members = db_query('SELECT id FROM user WHERE teamid=%d', array($team_id));
29
+    $boincteam_admin = (int) db_result(db_query('SELECT userid FROM team_admin WHERE teamid=%d', array($team_id)));
30
+    db_set_active('default');
31 31
   
32
-  $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
33
-  // FIXME: $team_exists==FALSE should be handled as an error and return an error code!
32
+    $team_exists = db_query('SELECT team_id FROM {boincteam} WHERE team_id = %d', $boincteam->id);
33
+    // FIXME: $team_exists==FALSE should be handled as an error and return an error code!
34 34
 
35
-  if ($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
35
+    if ($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
36 36
     $boincteam->description = _boincimport_text_sanitize($boincteam->description);
37 37
     $teaser = node_teaser($boincteam->description);
38 38
     
39 39
     // Construct the team as an organic group node
40 40
     $node = array(
41
-      'type' => 'team',
42
-      'title' => $boincteam->name,
43
-      'body' => $boincteam->description,
44
-      'teaser' => $teaser,
45
-      'uid' => boincuser_lookup_uid($boincteam->userid),
46
-      'path' => null,
47
-      'status' => 1,  // published or not - always publish
48
-      'promote' => 0,
49
-      'created' => $boincteam->create_time,
50
-      'comment' => 0,  // comments disabled
51
-      'moderate' => 0,
52
-      'sticky' => 0,
53
-      'format' => $input_format
41
+        'type' => 'team',
42
+        'title' => $boincteam->name,
43
+        'body' => $boincteam->description,
44
+        'teaser' => $teaser,
45
+        'uid' => boincuser_lookup_uid($boincteam->userid),
46
+        'path' => null,
47
+        'status' => 1,  // published or not - always publish
48
+        'promote' => 0,
49
+        'created' => $boincteam->create_time,
50
+        'comment' => 0,  // comments disabled
51
+        'moderate' => 0,
52
+        'sticky' => 0,
53
+        'format' => $input_format
54 54
     );
55 55
     
56 56
     // Use pathauto function, if available, to clean up the path
57 57
     if (module_exists('pathauto')) {
58
-      module_load_include('inc', 'pathauto', 'pathauto');
59
-      $node['path'] = pathauto_cleanstring($boincteam->name);
58
+        module_load_include('inc', 'pathauto', 'pathauto');
59
+        $node['path'] = pathauto_cleanstring($boincteam->name);
60 60
     }
61 61
     else {
62
-      echo 'Pathauto module is required!';
63
-      exit;
62
+        echo 'Pathauto module is required!';
63
+        exit;
64 64
     }
65 65
     
66 66
     $node = (object) $node; // node_save requires an object form
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
     
73 73
     // Save the team IDs to a BOINC <--> Drupal reference table.
74 74
     db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam->id, $node->nid);
75
-  }
75
+    }
76 76
   
77
-  // Determine team membership
78
-  db_set_active('boinc_rw');
79
-  $boincteam_member_ids = array();
80
-  while ($boincuser = db_fetch_object($boincteam_members)) $boincteam_member_ids[] = $boincuser->id;
81
-  db_set_active('default');
82
-  if ($boincteam_member_ids) {
77
+    // Determine team membership
78
+    db_set_active('boinc_rw');
79
+    $boincteam_member_ids = array();
80
+    while ($boincuser = db_fetch_object($boincteam_members)) $boincteam_member_ids[] = $boincuser->id;
81
+    db_set_active('default');
82
+    if ($boincteam_member_ids) {
83 83
     $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids));
84 84
     $team_admin = (int) db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
85 85
     
86 86
     while ($drupal_user = db_fetch_object($team_members)) {
87
-      // Add action to take on member accounts?
88
-      $count++;
87
+        // Add action to take on member accounts?
88
+        $count++;
89
+    }
89 90
     }
90
-  }
91 91
   
92
-  echo $count;
92
+    echo $count;
93 93
   
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincimport/includes/import_users.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 
15
-  require_once('./includes/bootstrap.inc');
16
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
-  require_boinc('db');
15
+    require_once('./includes/bootstrap.inc');
16
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
17
+    require_boinc('db');
18 18
   
19
-  // Parse arguments
20
-  $import_lurkers = isset($argv[1]) ? $argv[1] : false;
21
-  $record_offset = isset($argv[2]) ? $argv[2] : 0;
22
-  $chunk_size = isset($argv[3]) ? $argv[3] : 100;
19
+    // Parse arguments
20
+    $import_lurkers = isset($argv[1]) ? $argv[1] : false;
21
+    $record_offset = isset($argv[2]) ? $argv[2] : 0;
22
+    $chunk_size = isset($argv[3]) ? $argv[3] : 100;
23 23
   
24
-  // Construct sql conditions
25
-  $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
24
+    // Construct sql conditions
25
+    $limit = sprintf('LIMIT %d,%d', $record_offset, $chunk_size);
26 26
   
27
-  $count = 0;
27
+    $count = 0;
28 28
   
29
-  db_set_active('boinc_rw');
30
-  if ($import_lurkers) {
29
+    db_set_active('boinc_rw');
30
+    if ($import_lurkers) {
31 31
     $boinc_accounts = db_query('SELECT id FROM user ORDER BY id %s', $limit);
32
-  }
33
-  //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit);
34
-  else {
32
+    }
33
+    //else $boinc_accounts = db_query('SELECT DISTINCT user AS boinc_id FROM post ORDER BY boinc_id %s', $limit);
34
+    else {
35 35
     // Need to import any user who is currently ignored in order to keep them
36 36
     // ignored... not particularly clean (ignored users are stored in a string)
37 37
     $ignored_user_list = array();
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
       ORDER BY userid ASC"
43 43
     );
44 44
     while ($ignoring_user = db_fetch_object($ignoring_users)) {
45
-      $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1);
45
+        $ignored_user_list = $ignored_user_list + array_fill_keys(explode('|', trim($ignoring_user->ignorelist, '|')), 1);
46 46
     }
47 47
     $ignored_user_list = array_keys($ignored_user_list);
48 48
     $boinc_accounts = db_query("
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
         (SELECT DISTINCT senderid FROM {private_messages})
59 59
       ) AS usersToImport ORDER BY id ASC %s", implode(',', $ignored_user_list), $limit
60 60
     );
61
-  }
62
-  db_set_active('default');
61
+    }
62
+    db_set_active('default');
63 63
   
64
-  while ($boinc_account = db_fetch_object($boinc_accounts)) {
64
+    while ($boinc_account = db_fetch_object($boinc_accounts)) {
65 65
     // Grab the BOINC user object and create a Drupal user from it
66 66
     if (boincuser_register_make_drupal_user($boinc_account->id)) {
67
-      $count++;
67
+        $count++;
68
+    }
68 69
     }
69
-  }
70 70
   
71
-  echo $count;
71
+    echo $count;
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/boincwork.views.inc 1 patch
Indentation   +793 added lines, -793 removed lines patch added patch discarded remove patch
@@ -13,1660 +13,1660 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function boincwork_views_data() {
15 15
   
16
-  // -----------------------------------------------------------------------------------------------
17
-  // Definition for host table
18
-  // -----------------------------------------------------------------------------------------------
16
+    // -----------------------------------------------------------------------------------------------
17
+    // Definition for host table
18
+    // -----------------------------------------------------------------------------------------------
19 19
   
20
-  $data['host']['table']['group'] = t('BOINC');
20
+    $data['host']['table']['group'] = t('BOINC');
21 21
   
22
-  $data['host']['table']['base'] = array(
23
-      'field' => 'id',
24
-      'title' => t('BOINC host'),
25
-      'help' => t('Computers attached to BOINC'),
26
-      'database' => 'boinc_ro'
27
-  );
22
+    $data['host']['table']['base'] = array(
23
+        'field' => 'id',
24
+        'title' => t('BOINC host'),
25
+        'help' => t('Computers attached to BOINC'),
26
+        'database' => 'boinc_ro'
27
+    );
28 28
   
29
-  // This table references the {user} table.
30
-  // This join creates an 'implicit' relationship to the user table, so that when
31
-  // "User" is the base table, the fields are automatically available.
29
+    // This table references the {user} table.
30
+    // This join creates an 'implicit' relationship to the user table, so that when
31
+    // "User" is the base table, the fields are automatically available.
32 32
   
33
-  // Index this array by the table name to which this table refers.
34
-  // 'left_field' is the primary key in the referenced table.
35
-  // 'field' is the foreign key in this table.
33
+    // Index this array by the table name to which this table refers.
34
+    // 'left_field' is the primary key in the referenced table.
35
+    // 'field' is the foreign key in this table.
36 36
   
37
-  $data['host']['table']['join'] = array(
37
+    $data['host']['table']['join'] = array(
38 38
     'user' => array(
39
-      'left_field' => 'id',
40
-      'field' => 'userid',
39
+        'left_field' => 'id',
40
+        'field' => 'userid',
41 41
     )
42
-  );
42
+    );
43 43
 
44
-  // Describe each of the individual fields in this table to Views. For
45
-  // each field, you may define what field, sort, argument, and/or filter
46
-  // handlers it supports. This will determine where in the Views interface you
47
-  // may use the field.
44
+    // Describe each of the individual fields in this table to Views. For
45
+    // each field, you may define what field, sort, argument, and/or filter
46
+    // handlers it supports. This will determine where in the Views interface you
47
+    // may use the field.
48 48
   
49
-  // Primary keys allowed as arguments
49
+    // Primary keys allowed as arguments
50 50
   
51
-  $data['host']['id'] = array(
51
+    $data['host']['id'] = array(
52 52
     'title' => bts('Computer ID', array(), NULL, 'boinc:host-list'),
53 53
     'help' => t('The ID number of this host.'),
54 54
     'field' => array(
55
-      'handler' => 'views_handler_field_numeric',
56
-      'click sortable' => TRUE
55
+        'handler' => 'views_handler_field_numeric',
56
+        'click sortable' => TRUE
57 57
     ),
58 58
     'argument' => array(
59
-      'handler' => 'views_handler_argument',
60
-      'name field' => 'title',
61
-      'numeric' => TRUE,
62
-      'validate type' => 'id'
59
+        'handler' => 'views_handler_argument',
60
+        'name field' => 'title',
61
+        'numeric' => TRUE,
62
+        'validate type' => 'id'
63 63
     ),
64 64
     'filter' => array(
65
-      'handler' => 'views_handler_filter_numeric'
65
+        'handler' => 'views_handler_filter_numeric'
66 66
     ),
67 67
     'sort' => array(
68
-      'handler' => 'views_handler_sort_numeric'
68
+        'handler' => 'views_handler_sort_numeric'
69 69
     )
70
-  );
71
-  $data['host']['venue'] = array(
70
+    );
71
+    $data['host']['venue'] = array(
72 72
     'title' => bts('Location', array(), NULL, 'boinc:host-list'),
73 73
     'help' => t('The name of the preference set assigned to this host.'),
74 74
     'field' => array(
75
-      'handler' => 'views_handler_field',
76
-      'click sortable' => TRUE
75
+        'handler' => 'views_handler_field',
76
+        'click sortable' => TRUE
77 77
     ),
78 78
     'argument' => array(
79
-      'handler' => 'views_handler_argument',
80
-      'name field' => 'title'
79
+        'handler' => 'views_handler_argument',
80
+        'name field' => 'title'
81 81
     ),
82 82
     'filter' => array(
83
-      'handler' => 'views_handler_filter_string'
83
+        'handler' => 'views_handler_filter_string'
84 84
     ),
85 85
     'sort' => array(
86
-      'handler' => 'views_handler_sort_string'
86
+        'handler' => 'views_handler_sort_string'
87 87
     )
88
-  );
88
+    );
89 89
   
90
-  // Foreign key fields
90
+    // Foreign key fields
91 91
   
92
-  $data['host']['userid'] = array(
92
+    $data['host']['userid'] = array(
93 93
     'title' => bts('User ID', array(), NULL, 'boinc:user-details'),
94 94
     'help' => t('The owner of this host.'),
95 95
     // Because this is a foreign key to the {user} table. This allows us to
96 96
     // have, when the view is configured with this relationship, all the fields
97 97
     // for the related node available.
98 98
     'argument' => array(
99
-      'handler' => 'views_handler_argument_boincuser_id',
100
-      'name field' => 'title',
101
-      'numeric' => TRUE,
102
-      'validate type' => 'id'
99
+        'handler' => 'views_handler_argument_boincuser_id',
100
+        'name field' => 'title',
101
+        'numeric' => TRUE,
102
+        'validate type' => 'id'
103 103
     ),
104 104
     'relationship' => array(
105
-      'base' => 'user',
106
-      'field' => 'userid',
107
-      'handler' => 'views_handler_relationship',
108
-      'label' => t('User')
105
+        'base' => 'user',
106
+        'field' => 'userid',
107
+        'handler' => 'views_handler_relationship',
108
+        'label' => t('User')
109 109
     ),
110 110
     'field' => array(
111
-      'handler' => 'views_handler_field_numeric',
112
-      'click sortable' => TRUE
111
+        'handler' => 'views_handler_field_numeric',
112
+        'click sortable' => TRUE
113 113
     ),
114 114
     'filter' => array(
115
-      'handler' => 'views_handler_filter_numeric'
115
+        'handler' => 'views_handler_filter_numeric'
116 116
     ),
117 117
     'sort' => array(
118
-      'handler' => 'views_handler_sort_numeric'
118
+        'handler' => 'views_handler_sort_numeric'
119 119
     )
120
-  );
120
+    );
121 121
   
122
-  // Descriptions of general host fields (alphabetized)
122
+    // Descriptions of general host fields (alphabetized)
123 123
   
124
-  $data['host']['active_frac'] = array(
124
+    $data['host']['active_frac'] = array(
125 125
     'title' => bts('While BOINC running, % of time work is allowed', array(), NULL, 'boinc:host-details'),
126 126
     'help' => t('The percentage of time that work is allowed.'),
127 127
     'field' => array(
128
-      'handler' => 'views_handler_field_numeric',
129
-      'click sortable' => TRUE,
130
-      'float' => TRUE
128
+        'handler' => 'views_handler_field_numeric',
129
+        'click sortable' => TRUE,
130
+        'float' => TRUE
131 131
     ),
132 132
     'filter' => array(
133
-      'handler' => 'views_handler_filter_numeric'
133
+        'handler' => 'views_handler_filter_numeric'
134 134
     ),
135 135
     'sort' => array(
136
-      'handler' => 'views_handler_sort_numeric'
136
+        'handler' => 'views_handler_sort_numeric'
137 137
     )
138
-  );
139
-  $data['host']['avg_turnaround'] = array(
138
+    );
139
+    $data['host']['avg_turnaround'] = array(
140 140
     'title' => bts('Average turnaround time', array(), NULL, 'boinc:host-details'),
141 141
     'help' => t('The average time required for work to be completed.'),
142 142
     'field' => array(
143
-      'handler' => 'views_handler_field_numeric',
144
-      'click sortable' => TRUE,
145
-      'float' => TRUE
143
+        'handler' => 'views_handler_field_numeric',
144
+        'click sortable' => TRUE,
145
+        'float' => TRUE
146 146
     ),
147 147
     'filter' => array(
148
-      'handler' => 'views_handler_filter_numeric'
148
+        'handler' => 'views_handler_filter_numeric'
149 149
     ),
150 150
     'sort' => array(
151
-      'handler' => 'views_handler_sort_numeric'
151
+        'handler' => 'views_handler_sort_numeric'
152 152
     )
153
-  );
154
-  $data['host']['create_time'] = array(
153
+    );
154
+    $data['host']['create_time'] = array(
155 155
     'title' => bts('Created', array(), NULL, 'boinc:host-details'),
156 156
     'help' => t('The time the host record was created.'),
157 157
     'field' => array(
158
-      'handler' => 'views_handler_field_date',
159
-      'click sortable' => TRUE
158
+        'handler' => 'views_handler_field_date',
159
+        'click sortable' => TRUE
160 160
     ),
161 161
     'filter' => array(
162
-      'handler' => 'views_handler_filter_date'
162
+        'handler' => 'views_handler_filter_date'
163 163
     ),
164 164
     'sort' => array(
165
-      'handler' => 'views_handler_sort_date'
165
+        'handler' => 'views_handler_sort_date'
166 166
     )
167
-  );
168
-  $data['host']['connected_frac'] = array(
167
+    );
168
+    $data['host']['connected_frac'] = array(
169 169
     'title' => bts('While BOINC running, % of time host has an Internet connection', array(), NULL, 'boinc:host-details'),
170 170
     'help' => t('The percentage of time that the host has an Internet connection.'),
171 171
     'field' => array(
172
-      'handler' => 'views_handler_field_numeric',
173
-      'click sortable' => TRUE,
174
-      'float' => TRUE
172
+        'handler' => 'views_handler_field_numeric',
173
+        'click sortable' => TRUE,
174
+        'float' => TRUE
175 175
     ),
176 176
     'filter' => array(
177
-      'handler' => 'views_handler_filter_numeric'
177
+        'handler' => 'views_handler_filter_numeric'
178 178
     ),
179 179
     'sort' => array(
180
-      'handler' => 'views_handler_sort_numeric'
180
+        'handler' => 'views_handler_sort_numeric'
181 181
     )
182
-  );
183
-  $data['host']['cpu_efficiency'] = array(
182
+    );
183
+    $data['host']['cpu_efficiency'] = array(
184 184
     'title' => bts('Average CPU efficiency', array(), NULL, 'boinc:host-details'),
185 185
     'help' => t('The average efficiency of the host CPU.'),
186 186
     'field' => array(
187
-      'handler' => 'views_handler_field_numeric',
188
-      'click sortable' => TRUE,
189
-      'float' => TRUE
187
+        'handler' => 'views_handler_field_numeric',
188
+        'click sortable' => TRUE,
189
+        'float' => TRUE
190 190
     ),
191 191
     'filter' => array(
192
-      'handler' => 'views_handler_filter_numeric'
192
+        'handler' => 'views_handler_filter_numeric'
193 193
     ),
194 194
     'sort' => array(
195
-      'handler' => 'views_handler_sort_numeric'
195
+        'handler' => 'views_handler_sort_numeric'
196 196
     )
197
-  );
198
-  $data['host']['d_free'] = array(
197
+    );
198
+    $data['host']['d_free'] = array(
199 199
     'title' => bts('Free disk space', array(), NULL, 'boinc:host-details'),
200 200
     'help' => t('The amount of disk space that is not in use.'),
201 201
     'field' => array(
202
-      'handler' => 'views_handler_field_numeric',
203
-      'click sortable' => TRUE
202
+        'handler' => 'views_handler_field_numeric',
203
+        'click sortable' => TRUE
204 204
     ),
205 205
     'filter' => array(
206
-      'handler' => 'views_handler_filter_numeric'
206
+        'handler' => 'views_handler_filter_numeric'
207 207
     ),
208 208
     'sort' => array(
209
-      'handler' => 'views_handler_sort_numeric'
209
+        'handler' => 'views_handler_sort_numeric'
210 210
     )
211
-  );
212
-  $data['host']['d_total'] = array(
211
+    );
212
+    $data['host']['d_total'] = array(
213 213
     'title' => bts('Total disk space', array(), NULL, 'boinc:host-details'),
214 214
     'help' => t('The size of the disk on which BOINC is installed.'),
215 215
     'field' => array(
216
-      'handler' => 'views_handler_field_numeric',
217
-      'click sortable' => TRUE
216
+        'handler' => 'views_handler_field_numeric',
217
+        'click sortable' => TRUE
218 218
     ),
219 219
     'filter' => array(
220
-      'handler' => 'views_handler_filter_numeric'
220
+        'handler' => 'views_handler_filter_numeric'
221 221
     ),
222 222
     'sort' => array(
223
-      'handler' => 'views_handler_sort_numeric'
223
+        'handler' => 'views_handler_sort_numeric'
224 224
     )
225
-  );
226
-  $data['host']['domain_name'] = array(
225
+    );
226
+    $data['host']['domain_name'] = array(
227 227
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
228 228
     'help' => t('The name of the host.'),
229 229
     'field' => array(
230
-      'handler' => 'views_handler_field',
231
-      'click sortable' => TRUE
230
+        'handler' => 'views_handler_field',
231
+        'click sortable' => TRUE
232 232
     ),
233 233
     'filter' => array(
234
-      'handler' => 'views_handler_filter_string'
234
+        'handler' => 'views_handler_filter_string'
235 235
     ),
236 236
     'sort' => array(
237
-      'handler' => 'views_handler_sort_string'
237
+        'handler' => 'views_handler_sort_string'
238 238
     )
239
-  );
240
-  $data['host']['duration_correction_factor'] = array(
239
+    );
240
+    $data['host']['duration_correction_factor'] = array(
241 241
     'title' => bts('Task duration correction factor', array(), NULL, 'boinc:host-details'),
242 242
     'help' => t('Task duration correction factor.'),
243 243
     'field' => array(
244
-      'handler' => 'views_handler_field_numeric',
245
-      'click sortable' => TRUE,
246
-      'float' => TRUE
244
+        'handler' => 'views_handler_field_numeric',
245
+        'click sortable' => TRUE,
246
+        'float' => TRUE
247 247
     ),
248 248
     'filter' => array(
249
-      'handler' => 'views_handler_filter_numeric'
249
+        'handler' => 'views_handler_filter_numeric'
250 250
     ),
251 251
     'sort' => array(
252
-      'handler' => 'views_handler_sort_numeric'
252
+        'handler' => 'views_handler_sort_numeric'
253 253
     )
254
-  );
255
-  $data['host']['expavg_credit'] = array(
254
+    );
255
+    $data['host']['expavg_credit'] = array(
256 256
     'title' => bts('Avg. credit', array(), NULL, 'boinc:host-details'),
257 257
     'help' => t('A decaying average of credit per day.'),
258 258
     'field' => array(
259
-      'handler' => 'views_handler_field_numeric',
260
-      'click sortable' => TRUE,
261
-      'float' => TRUE
259
+        'handler' => 'views_handler_field_numeric',
260
+        'click sortable' => TRUE,
261
+        'float' => TRUE
262 262
     ),
263 263
     'filter' => array(
264
-      'handler' => 'views_handler_filter_numeric'
264
+        'handler' => 'views_handler_filter_numeric'
265 265
     ),
266 266
     'sort' => array(
267
-      'handler' => 'views_handler_sort_numeric'
267
+        'handler' => 'views_handler_sort_numeric'
268 268
     )
269
-  );
270
-  $data['host']['external_ip_addr'] = array(
269
+    );
270
+    $data['host']['external_ip_addr'] = array(
271 271
     'title' => bts('External IP address', array(), NULL, 'boinc:host-details'),
272 272
     'help' => t('The IP address from which the host last communicated.'),
273 273
     'field' => array(
274
-      'handler' => 'views_handler_field',
275
-      'click sortable' => TRUE
274
+        'handler' => 'views_handler_field',
275
+        'click sortable' => TRUE
276 276
     ),
277 277
     'filter' => array(
278
-      'handler' => 'views_handler_filter_string'
278
+        'handler' => 'views_handler_filter_string'
279 279
     ),
280 280
     'sort' => array(
281
-      'handler' => 'views_handler_sort_string'
281
+        'handler' => 'views_handler_sort_string'
282 282
     )
283
-  );
284
-  $data['host']['host_cpid'] = array(
283
+    );
284
+    $data['host']['host_cpid'] = array(
285 285
     'title' => bts('Cross project ID', array(), NULL, 'boinc:host-details'),
286 286
     'help' => t('The consistent identifier of the host across projects.'),
287 287
     'field' => array(
288
-      'handler' => 'views_handler_field',
289
-      'click sortable' => TRUE
288
+        'handler' => 'views_handler_field',
289
+        'click sortable' => TRUE
290 290
     ),
291 291
     'filter' => array(
292
-      'handler' => 'views_handler_filter_string'
292
+        'handler' => 'views_handler_filter_string'
293 293
     ),
294 294
     'sort' => array(
295
-      'handler' => 'views_handler_sort_string'
295
+        'handler' => 'views_handler_sort_string'
296 296
     )
297
-  );
298
-  $data['host']['last_ip_addr'] = array(
297
+    );
298
+    $data['host']['last_ip_addr'] = array(
299 299
     'title' => bts('Last IP address', array(), NULL, 'boinc:host-details'),
300 300
     'help' => t('The IP address of the host at last communication.'),
301 301
     'field' => array(
302
-      'handler' => 'views_handler_field',
303
-      'click sortable' => TRUE
302
+        'handler' => 'views_handler_field',
303
+        'click sortable' => TRUE
304 304
     ),
305 305
     'filter' => array(
306
-      'handler' => 'views_handler_filter_string'
306
+        'handler' => 'views_handler_filter_string'
307 307
     ),
308 308
     'sort' => array(
309
-      'handler' => 'views_handler_sort_string'
309
+        'handler' => 'views_handler_sort_string'
310 310
     )
311
-  );
312
-  $data['host']['m_cache'] = array(
311
+    );
312
+    $data['host']['m_cache'] = array(
313 313
     'title' => bts('Cache', array(), NULL, 'boinc:host-details'),
314 314
     'help' => t('The amount of cache on the processor(s).'),
315 315
     'field' => array(
316
-      'handler' => 'views_handler_field_numeric',
317
-      'click sortable' => TRUE
316
+        'handler' => 'views_handler_field_numeric',
317
+        'click sortable' => TRUE
318 318
     ),
319 319
     'filter' => array(
320
-      'handler' => 'views_handler_filter_numeric'
320
+        'handler' => 'views_handler_filter_numeric'
321 321
     ),
322 322
     'sort' => array(
323
-      'handler' => 'views_handler_sort_numeric'
323
+        'handler' => 'views_handler_sort_numeric'
324 324
     )
325
-  );
326
-  $data['host']['m_nbytes'] = array(
325
+    );
326
+    $data['host']['m_nbytes'] = array(
327 327
     'title' => bts('Memory', array(), NULL, 'boinc:host-details'),
328 328
     'help' => t('The amount of memory installed.'),
329 329
     'field' => array(
330
-      'handler' => 'views_handler_field_numeric',
331
-      'click sortable' => TRUE
330
+        'handler' => 'views_handler_field_numeric',
331
+        'click sortable' => TRUE
332 332
     ),
333 333
     'filter' => array(
334
-      'handler' => 'views_handler_filter_numeric'
334
+        'handler' => 'views_handler_filter_numeric'
335 335
     ),
336 336
     'sort' => array(
337
-      'handler' => 'views_handler_sort_numeric'
337
+        'handler' => 'views_handler_sort_numeric'
338 338
     )
339
-  );
340
-  $data['host']['m_swap'] = array(
339
+    );
340
+    $data['host']['m_swap'] = array(
341 341
     'title' => bts('Swap space', array(), NULL, 'boinc:host-details'),
342 342
     'help' => t('The amount of swap space configured.'),
343 343
     'field' => array(
344
-      'handler' => 'views_handler_field_numeric',
345
-      'click sortable' => TRUE
344
+        'handler' => 'views_handler_field_numeric',
345
+        'click sortable' => TRUE
346 346
     ),
347 347
     'filter' => array(
348
-      'handler' => 'views_handler_filter_numeric'
348
+        'handler' => 'views_handler_filter_numeric'
349 349
     ),
350 350
     'sort' => array(
351
-      'handler' => 'views_handler_sort_numeric'
351
+        'handler' => 'views_handler_sort_numeric'
352 352
     )
353
-  );
354
-  $data['host']['max_results_day'] = array(
353
+    );
354
+    $data['host']['max_results_day'] = array(
355 355
     'title' => bts('Maximum daily WU quota per CPU', array(), NULL, 'boinc:host-details'),
356 356
     'help' => t('The maximum number of workunits to be allocated per CPU.'),
357 357
     'field' => array(
358
-      'handler' => 'views_handler_field_numeric',
359
-      'click sortable' => TRUE
358
+        'handler' => 'views_handler_field_numeric',
359
+        'click sortable' => TRUE
360 360
     ),
361 361
     'filter' => array(
362
-      'handler' => 'views_handler_filter_numeric'
362
+        'handler' => 'views_handler_filter_numeric'
363 363
     ),
364 364
     'sort' => array(
365
-      'handler' => 'views_handler_sort_numeric'
365
+        'handler' => 'views_handler_sort_numeric'
366 366
     )
367
-  );
368
-  $data['host']['n_bwdown'] = array(
367
+    );
368
+    $data['host']['n_bwdown'] = array(
369 369
     'title' => bts('Average download rate', array(), NULL, 'boinc:host-details'),
370 370
     'help' => t('The average rate at which new work is downloaded.'),
371 371
     'field' => array(
372
-      'handler' => 'views_handler_field_numeric',
373
-      'click sortable' => TRUE,
374
-      'float' => TRUE
372
+        'handler' => 'views_handler_field_numeric',
373
+        'click sortable' => TRUE,
374
+        'float' => TRUE
375 375
     ),
376 376
     'filter' => array(
377
-      'handler' => 'views_handler_filter_numeric'
377
+        'handler' => 'views_handler_filter_numeric'
378 378
     ),
379 379
     'sort' => array(
380
-      'handler' => 'views_handler_sort_numeric'
380
+        'handler' => 'views_handler_sort_numeric'
381 381
     )
382
-  );
383
-  $data['host']['n_bwup'] = array(
382
+    );
383
+    $data['host']['n_bwup'] = array(
384 384
     'title' => bts('Average upload rate', array(), NULL, 'boinc:host-details'),
385 385
     'help' => t('The average rate at which completed work is uploaded.'),
386 386
     'field' => array(
387
-      'handler' => 'views_handler_field_numeric',
388
-      'click sortable' => TRUE,
389
-      'float' => TRUE
387
+        'handler' => 'views_handler_field_numeric',
388
+        'click sortable' => TRUE,
389
+        'float' => TRUE
390 390
     ),
391 391
     'filter' => array(
392
-      'handler' => 'views_handler_filter_numeric'
392
+        'handler' => 'views_handler_filter_numeric'
393 393
     ),
394 394
     'sort' => array(
395
-      'handler' => 'views_handler_sort_numeric'
395
+        'handler' => 'views_handler_sort_numeric'
396 396
     )
397
-  );
398
-  $data['host']['nsame_ip_addr'] = array(
397
+    );
398
+    $data['host']['nsame_ip_addr'] = array(
399 399
     'title' => bts('Same IP address count', array(), NULL, 'boinc:host-details'),
400 400
     'help' => t('The number of times the last IP address.'),
401 401
     'field' => array(
402
-      'handler' => 'views_handler_field',
403
-      'click sortable' => TRUE
402
+        'handler' => 'views_handler_field',
403
+        'click sortable' => TRUE
404 404
     ),
405 405
     'filter' => array(
406
-      'handler' => 'views_handler_filter_string'
406
+        'handler' => 'views_handler_filter_string'
407 407
     ),
408 408
     'sort' => array(
409
-      'handler' => 'views_handler_sort_string'
409
+        'handler' => 'views_handler_sort_string'
410 410
     )
411
-  );
412
-  $data['host']['on_frac'] = array(
411
+    );
412
+    $data['host']['on_frac'] = array(
413 413
     'title' => bts('% of time BOINC client is running', array(), NULL, 'boinc:host-details'),
414 414
     'help' => t('The percentage of time that the BOINC client is running.'),
415 415
     'field' => array(
416
-      'handler' => 'views_handler_field_numeric',
417
-      'click sortable' => TRUE,
418
-      'float' => TRUE
416
+        'handler' => 'views_handler_field_numeric',
417
+        'click sortable' => TRUE,
418
+        'float' => TRUE
419 419
     ),
420 420
     'filter' => array(
421
-      'handler' => 'views_handler_filter_numeric'
421
+        'handler' => 'views_handler_filter_numeric'
422 422
     ),
423 423
     'sort' => array(
424
-      'handler' => 'views_handler_sort_numeric'
424
+        'handler' => 'views_handler_sort_numeric'
425 425
     )
426
-  );
427
-  $data['host']['os_name'] = array(
426
+    );
427
+    $data['host']['os_name'] = array(
428 428
     'title' => bts('Operating system', array(), NULL, 'boinc:host-details'),
429 429
     'help' => t('The name of the host operating system.'),
430 430
     'field' => array(
431
-      'handler' => 'views_handler_field',
432
-      'click sortable' => TRUE
431
+        'handler' => 'views_handler_field',
432
+        'click sortable' => TRUE
433 433
     ),
434 434
     'filter' => array(
435
-      'handler' => 'views_handler_filter_string'
435
+        'handler' => 'views_handler_filter_string'
436 436
     ),
437 437
     'sort' => array(
438
-      'handler' => 'views_handler_sort_string'
438
+        'handler' => 'views_handler_sort_string'
439 439
     )
440
-  );  
441
-  $data['host']['os_version'] = array(
440
+    );  
441
+    $data['host']['os_version'] = array(
442 442
     'title' => bts('Operating system version', array(), NULL, 'boinc:host-details'),
443 443
     'help' => t('The version of the host operating system.'),
444 444
     'field' => array(
445
-      'handler' => 'views_handler_field',
446
-      'click sortable' => TRUE
445
+        'handler' => 'views_handler_field',
446
+        'click sortable' => TRUE
447 447
     ),
448 448
     'filter' => array(
449
-      'handler' => 'views_handler_filter_string'
449
+        'handler' => 'views_handler_filter_string'
450 450
     ),
451 451
     'sort' => array(
452
-      'handler' => 'views_handler_sort_string'
452
+        'handler' => 'views_handler_sort_string'
453 453
     )
454
-  );
455
-  $data['host']['p_fpops'] = array(
454
+    );
455
+    $data['host']['p_fpops'] = array(
456 456
     'title' => bts('Measured floating point speed', array(), NULL, 'boinc:host-details'),
457 457
     'help' => t('The capability of the host in floating point operations per second.'),
458 458
     'field' => array(
459
-      'handler' => 'views_handler_field_numeric',
460
-      'click sortable' => TRUE,
461
-      'float' => TRUE
459
+        'handler' => 'views_handler_field_numeric',
460
+        'click sortable' => TRUE,
461
+        'float' => TRUE
462 462
     ),
463 463
     'filter' => array(
464
-      'handler' => 'views_handler_filter_numeric'
464
+        'handler' => 'views_handler_filter_numeric'
465 465
     ),
466 466
     'sort' => array(
467
-      'handler' => 'views_handler_sort_numeric'
467
+        'handler' => 'views_handler_sort_numeric'
468 468
     )
469
-  );
470
-  $data['host']['p_iops'] = array(
469
+    );
470
+    $data['host']['p_iops'] = array(
471 471
     'title' => bts('Measured integer speed', array(), NULL, 'boinc:host-details'),
472 472
     'help' => t('The capability of the host in integer operations per second.'),
473 473
     'field' => array(
474
-      'handler' => 'views_handler_field_numeric',
475
-      'click sortable' => TRUE,
476
-      'float' => TRUE
474
+        'handler' => 'views_handler_field_numeric',
475
+        'click sortable' => TRUE,
476
+        'float' => TRUE
477 477
     ),
478 478
     'filter' => array(
479
-      'handler' => 'views_handler_filter_numeric'
479
+        'handler' => 'views_handler_filter_numeric'
480 480
     ),
481 481
     'sort' => array(
482
-      'handler' => 'views_handler_sort_numeric'
482
+        'handler' => 'views_handler_sort_numeric'
483 483
     )
484
-  );
485
-  $data['host']['p_model'] = array(
484
+    );
485
+    $data['host']['p_model'] = array(
486 486
     'title' => bts('CPU model', array(), NULL, 'boinc:host-details'),
487 487
     'help' => t('The model of the CPU in the host.'),
488 488
     'field' => array(
489
-      'handler' => 'views_handler_field',
490
-      'click sortable' => TRUE
489
+        'handler' => 'views_handler_field',
490
+        'click sortable' => TRUE
491 491
     ),
492 492
     'filter' => array(
493
-      'handler' => 'views_handler_filter_string'
493
+        'handler' => 'views_handler_filter_string'
494 494
     ),
495 495
     'sort' => array(
496
-      'handler' => 'views_handler_sort_string'
496
+        'handler' => 'views_handler_sort_string'
497 497
     )
498
-  );
499
-  $data['host']['p_ncpus'] = array(
498
+    );
499
+    $data['host']['p_ncpus'] = array(
500 500
     'title' => bts('Number of processors', array(), NULL, 'boinc:host-details'),
501 501
     'help' => t('The count of CPU cores in the system.'),
502 502
     'field' => array(
503
-      'handler' => 'views_handler_field',
504
-      'click sortable' => TRUE
503
+        'handler' => 'views_handler_field',
504
+        'click sortable' => TRUE
505 505
     ),
506 506
     'filter' => array(
507
-      'handler' => 'views_handler_filter_string'
507
+        'handler' => 'views_handler_filter_string'
508 508
     ),
509 509
     'sort' => array(
510
-      'handler' => 'views_handler_sort_string'
510
+        'handler' => 'views_handler_sort_string'
511 511
     )
512
-  );
513
-  $data['host']['p_vendor'] = array(
512
+    );
513
+    $data['host']['p_vendor'] = array(
514 514
     'title' => bts('CPU', array(), NULL, 'boinc:host-details'),
515 515
     'help' => t('The manufacturer of the CPU in the host.'),
516 516
     'field' => array(
517
-      'handler' => 'views_handler_field',
518
-      'click sortable' => TRUE
517
+        'handler' => 'views_handler_field',
518
+        'click sortable' => TRUE
519 519
     ),
520 520
     'filter' => array(
521
-      'handler' => 'views_handler_filter_string'
521
+        'handler' => 'views_handler_filter_string'
522 522
     ),
523 523
     'sort' => array(
524
-      'handler' => 'views_handler_sort_string'
524
+        'handler' => 'views_handler_sort_string'
525 525
     )
526
-  );
527
-  $data['host']['rpc_seqno'] = array(
526
+    );
527
+    $data['host']['rpc_seqno'] = array(
528 528
     'title' => bts('Number of times client has contacted server', array(), NULL, 'boinc:host-details'),
529 529
     'help' => t('The number of times the client has contacted the server.'),
530 530
     'field' => array(
531
-      'handler' => 'views_handler_field_numeric',
532
-      'click sortable' => TRUE
531
+        'handler' => 'views_handler_field_numeric',
532
+        'click sortable' => TRUE
533 533
     ),
534 534
     'filter' => array(
535
-      'handler' => 'views_handler_filter_numeric'
535
+        'handler' => 'views_handler_filter_numeric'
536 536
     ),
537 537
     'sort' => array(
538
-      'handler' => 'views_handler_sort_numeric'
538
+        'handler' => 'views_handler_sort_numeric'
539 539
     )
540
-  );
541
-  $data['host']['rpc_time'] = array(
540
+    );
541
+    $data['host']['rpc_time'] = array(
542 542
     'title' => bts('Last contact', array(), NULL, 'boinc:host-details'),
543 543
     'help' => t('The time of the last RPC contact with the host.'),
544 544
     'field' => array(
545
-      'handler' => 'views_handler_field_date',
546
-      'click sortable' => TRUE
545
+        'handler' => 'views_handler_field_date',
546
+        'click sortable' => TRUE
547 547
     ),
548 548
     'filter' => array(
549
-      'handler' => 'views_handler_filter_date'
549
+        'handler' => 'views_handler_filter_date'
550 550
     ),
551 551
     'sort' => array(
552
-      'handler' => 'views_handler_sort_date'
552
+        'handler' => 'views_handler_sort_date'
553 553
     )
554
-  );
555
-  $data['host']['serialnum'] = array(
554
+    );
555
+    $data['host']['serialnum'] = array(
556 556
     'title' => bts('Serial number', array(), NULL, 'boinc:host-details'),
557 557
     'help' => t('Contains the release number of the BOINC application in use and the GPU of the host.'),
558 558
     'field' => array(
559
-      'handler' => 'views_handler_field',
560
-      'click sortable' => TRUE
559
+        'handler' => 'views_handler_field',
560
+        'click sortable' => TRUE
561 561
     ),
562 562
     'filter' => array(
563
-      'handler' => 'views_handler_filter_string'
563
+        'handler' => 'views_handler_filter_string'
564 564
     ),
565 565
     'sort' => array(
566
-      'handler' => 'views_handler_sort_string'
566
+        'handler' => 'views_handler_sort_string'
567 567
     )
568
-  );
569
-  $data['host']['timezone'] = array(
568
+    );
569
+    $data['host']['timezone'] = array(
570 570
     'title' => bts('Timezone', array(), NULL, 'boinc:host-details'),
571 571
     'help' => t('The UTC offset of the local time.'),
572 572
     'field' => array(
573
-      'handler' => 'views_handler_field_numeric',
574
-      'click sortable' => TRUE
573
+        'handler' => 'views_handler_field_numeric',
574
+        'click sortable' => TRUE
575 575
     ),
576 576
     'filter' => array(
577
-      'handler' => 'views_handler_filter_numeric'
577
+        'handler' => 'views_handler_filter_numeric'
578 578
     ),
579 579
     'sort' => array(
580
-      'handler' => 'views_handler_sort_numeric'
580
+        'handler' => 'views_handler_sort_numeric'
581 581
     )
582
-  );
583
-  $data['host']['total_credit'] = array(
582
+    );
583
+    $data['host']['total_credit'] = array(
584 584
     'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'),
585 585
     'help' => t('The total accumulated BOINC credit for a host.'),
586 586
     'field' => array(
587
-      'handler' => 'views_handler_field_numeric',
588
-      'click sortable' => TRUE,
589
-      'float' => TRUE
587
+        'handler' => 'views_handler_field_numeric',
588
+        'click sortable' => TRUE,
589
+        'float' => TRUE
590 590
     ),
591 591
     'filter' => array(
592
-      'handler' => 'views_handler_filter_numeric'
592
+        'handler' => 'views_handler_filter_numeric'
593 593
     ),
594 594
     'sort' => array(
595
-      'handler' => 'views_handler_sort_numeric'
595
+        'handler' => 'views_handler_sort_numeric'
596 596
     )
597
-  );
597
+    );
598 598
   
599
-  // ------------------------------------------------------------------------------------------------
600
-  // Definition for platform table
601
-  // ------------------------------------------------------------------------------------------------
599
+    // ------------------------------------------------------------------------------------------------
600
+    // Definition for platform table
601
+    // ------------------------------------------------------------------------------------------------
602 602
   
603
-  $data['platform']['table']['group'] = t('BOINC');
604
-  $data['platform']['table']['base'] = array(
605
-      'field' => 'id',
606
-      'title' => t('BOINC platform'),
607
-      'help' => t('Operating system platforms'),
608
-      'database' => 'boinc_ro'
609
-  );
603
+    $data['platform']['table']['group'] = t('BOINC');
604
+    $data['platform']['table']['base'] = array(
605
+        'field' => 'id',
606
+        'title' => t('BOINC platform'),
607
+        'help' => t('Operating system platforms'),
608
+        'database' => 'boinc_ro'
609
+    );
610 610
   
611
-  // Primary keys allowed as arguments
611
+    // Primary keys allowed as arguments
612 612
 
613
-  $data['platform']['id'] = array(
613
+    $data['platform']['id'] = array(
614 614
     'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'),
615 615
     'help' => t('The ID number of the platform.'),
616 616
     'field' => array(
617
-      'handler' => 'views_handler_field_numeric',
618
-      'click sortable' => TRUE
617
+        'handler' => 'views_handler_field_numeric',
618
+        'click sortable' => TRUE
619 619
     ),
620 620
     'argument' => array(
621
-      'handler' => 'views_handler_argument',
622
-      'name field' => 'title',
623
-      'numeric' => TRUE,
624
-      'validate type' => 'id'
621
+        'handler' => 'views_handler_argument',
622
+        'name field' => 'title',
623
+        'numeric' => TRUE,
624
+        'validate type' => 'id'
625 625
     ),
626 626
     'filter' => array(
627
-      'handler' => 'views_handler_filter_numeric'
627
+        'handler' => 'views_handler_filter_numeric'
628 628
     ),
629 629
     'sort' => array(
630
-      'handler' => 'views_handler_sort_numeric'
630
+        'handler' => 'views_handler_sort_numeric'
631 631
     )
632
-  );
632
+    );
633 633
   
634
-  // Descriptions of app fields (alphabetized)
634
+    // Descriptions of app fields (alphabetized)
635 635
   
636
-  $data['platform']['name'] = array(
636
+    $data['platform']['name'] = array(
637 637
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
638 638
     'help' => t('The name of the platform.'),
639 639
     'field' => array(
640
-      'handler' => 'views_handler_field',
641
-      'click sortable' => TRUE
640
+        'handler' => 'views_handler_field',
641
+        'click sortable' => TRUE
642 642
     ),
643 643
     'filter' => array(
644
-      'handler' => 'views_handler_filter_string'
644
+        'handler' => 'views_handler_filter_string'
645 645
     ),
646 646
     'sort' => array(
647
-      'handler' => 'views_handler_sort_string'
647
+        'handler' => 'views_handler_sort_string'
648 648
     )
649
-  );
649
+    );
650 650
   
651
-  // ------------------------------------------------------------------------------------------------
652
-  // Definition for result (task) table
653
-  // ------------------------------------------------------------------------------------------------
651
+    // ------------------------------------------------------------------------------------------------
652
+    // Definition for result (task) table
653
+    // ------------------------------------------------------------------------------------------------
654 654
   
655
-  $data['result']['table']['group'] = t('BOINC');
656
-  $data['result']['table']['base'] = array(
657
-      'field' => 'id',
658
-      'title' => t('BOINC result'),
659
-      'help' => t('Results produced by BOINC'),
660
-      'database' => 'boinc_ro'
661
-  );
655
+    $data['result']['table']['group'] = t('BOINC');
656
+    $data['result']['table']['base'] = array(
657
+        'field' => 'id',
658
+        'title' => t('BOINC result'),
659
+        'help' => t('Results produced by BOINC'),
660
+        'database' => 'boinc_ro'
661
+    );
662 662
   
663
-  // Create implicit relationships to the user, workunit, and host tables
663
+    // Create implicit relationships to the user, workunit, and host tables
664 664
   
665
-  $data['result']['table']['join'] = array(
665
+    $data['result']['table']['join'] = array(
666 666
     'user' => array(
667
-      'left_field' => 'id',
668
-      'field' => 'userid'
667
+        'left_field' => 'id',
668
+        'field' => 'userid'
669 669
     ),
670 670
     'workunit' => array(
671
-      'left_field' => 'id',
672
-      'field' => 'workunitid'
671
+        'left_field' => 'id',
672
+        'field' => 'workunitid'
673 673
     ),
674 674
     'host' => array(
675
-      'left_field' => 'id',
676
-      'field' => 'hostid'
675
+        'left_field' => 'id',
676
+        'field' => 'hostid'
677 677
     )
678
-  );
678
+    );
679 679
   
680
-  // Primary keys allowed as arguments
680
+    // Primary keys allowed as arguments
681 681
 
682
-  $data['result']['id'] = array(
682
+    $data['result']['id'] = array(
683 683
     'title' => bts('Task ID', array(), NULL, 'boinc:task-details'),
684 684
     'help' => t('The ID number of this result.'),
685 685
     'field' => array(
686
-      'handler' => 'views_handler_field_numeric',
687
-      'click sortable' => TRUE
686
+        'handler' => 'views_handler_field_numeric',
687
+        'click sortable' => TRUE
688 688
     ),
689 689
     'argument' => array(
690
-      'handler' => 'views_handler_argument',
691
-      'name field' => 'title',
692
-      'numeric' => TRUE,
693
-      'validate type' => 'id'
690
+        'handler' => 'views_handler_argument',
691
+        'name field' => 'title',
692
+        'numeric' => TRUE,
693
+        'validate type' => 'id'
694 694
     ),
695 695
     'filter' => array(
696
-      'handler' => 'views_handler_filter_numeric'
696
+        'handler' => 'views_handler_filter_numeric'
697 697
     ),
698 698
     'sort' => array(
699
-      'handler' => 'views_handler_sort_numeric'
699
+        'handler' => 'views_handler_sort_numeric'
700 700
     )
701
-  );
701
+    );
702 702
   
703
-  // Foreign key fields
703
+    // Foreign key fields
704 704
   
705
-  $data['result']['userid'] = array(
705
+    $data['result']['userid'] = array(
706 706
     'title' => bts('User ID', array(), NULL, 'boinc:user-details'),
707 707
     'help' => t('The owner of this result.'),
708 708
     // Foreign key to the {user} table
709 709
     'argument' => array(
710
-      'handler' => 'views_handler_argument_boincuser_id',
711
-      'name field' => 'title',
712
-      'numeric' => TRUE,
713
-      'validate type' => 'id'
710
+        'handler' => 'views_handler_argument_boincuser_id',
711
+        'name field' => 'title',
712
+        'numeric' => TRUE,
713
+        'validate type' => 'id'
714 714
     ),
715 715
     'relationship' => array(
716
-      'base' => 'user',
717
-      'field' => 'userid',
718
-      'handler' => 'views_handler_relationship',
719
-      'label' => t('User')
716
+        'base' => 'user',
717
+        'field' => 'userid',
718
+        'handler' => 'views_handler_relationship',
719
+        'label' => t('User')
720 720
     )
721
-  );
722
-  $data['result']['workunitid'] = array(
721
+    );
722
+    $data['result']['workunitid'] = array(
723 723
     'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'),
724 724
     'help' => t('The workunit associated with this result.'),
725 725
     // Foreign key to the {workunit} table
726 726
     'argument' => array(
727
-      'handler' => 'views_handler_argument',
728
-      'name field' => 'title',
729
-      'numeric' => TRUE,
730
-      'validate type' => 'id'
727
+        'handler' => 'views_handler_argument',
728
+        'name field' => 'title',
729
+        'numeric' => TRUE,
730
+        'validate type' => 'id'
731 731
     ),
732 732
     'relationship' => array(
733
-      'base' => 'workunit',
734
-      'field' => 'workunitid',
735
-      'handler' => 'views_handler_relationship',
736
-      'label' => t('Workunit')
733
+        'base' => 'workunit',
734
+        'field' => 'workunitid',
735
+        'handler' => 'views_handler_relationship',
736
+        'label' => t('Workunit')
737 737
     ),
738 738
     'field' => array(
739
-      'handler' => 'views_handler_field_numeric',
740
-      'click sortable' => TRUE
739
+        'handler' => 'views_handler_field_numeric',
740
+        'click sortable' => TRUE
741 741
     ),
742 742
     'filter' => array(
743
-      'handler' => 'views_handler_filter_numeric'
743
+        'handler' => 'views_handler_filter_numeric'
744 744
     ),
745 745
     'sort' => array(
746
-      'handler' => 'views_handler_sort_numeric'
746
+        'handler' => 'views_handler_sort_numeric'
747 747
     )
748
-  );
749
-  $data['result']['hostid'] = array(
748
+    );
749
+    $data['result']['hostid'] = array(
750 750
     'title' => bts('Host ID', array(), NULL, 'boinc:task-details'),
751 751
     'help' => t('The host associated with this result.'),
752 752
     // Foreign key to the {host} table
753 753
     'argument' => array(
754
-      'handler' => 'views_handler_argument',
755
-      'name field' => 'title',
756
-      'numeric' => TRUE,
757
-      'validate type' => 'id'
754
+        'handler' => 'views_handler_argument',
755
+        'name field' => 'title',
756
+        'numeric' => TRUE,
757
+        'validate type' => 'id'
758 758
     ),
759 759
     'relationship' => array(
760
-      'base' => 'host',
761
-      'field' => 'hostid',
762
-      'handler' => 'views_handler_relationship',
763
-      'label' => t('Host')
760
+        'base' => 'host',
761
+        'field' => 'hostid',
762
+        'handler' => 'views_handler_relationship',
763
+        'label' => t('Host')
764 764
     ),
765 765
     'field' => array(
766
-      'handler' => 'views_handler_field_numeric',
767
-      'click sortable' => TRUE
766
+        'handler' => 'views_handler_field_numeric',
767
+        'click sortable' => TRUE
768 768
     ),
769 769
     'filter' => array(
770
-      'handler' => 'views_handler_filter_numeric'
770
+        'handler' => 'views_handler_filter_numeric'
771 771
     ),
772 772
     'sort' => array(
773
-      'handler' => 'views_handler_sort_numeric'
773
+        'handler' => 'views_handler_sort_numeric'
774 774
     )
775
-  );
775
+    );
776 776
   
777
-  // Descriptions of result fields (alphabetized)
777
+    // Descriptions of result fields (alphabetized)
778 778
   
779
-  $data['result']['appid'] = array(
779
+    $data['result']['appid'] = array(
780 780
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
781 781
     'help' => t('The ID number of the application.'),
782 782
     'field' => array(
783
-      'handler' => 'views_handler_field_numeric',
784
-      'click sortable' => TRUE
783
+        'handler' => 'views_handler_field_numeric',
784
+        'click sortable' => TRUE
785 785
     ),
786 786
     'filter' => array(
787
-      'handler' => 'views_handler_filter_numeric'
787
+        'handler' => 'views_handler_filter_numeric'
788 788
     ),
789 789
     'sort' => array(
790
-      'handler' => 'views_handler_sort_numeric'
790
+        'handler' => 'views_handler_sort_numeric'
791 791
     )
792
-  );
793
-  $data['result']['app_version_id'] = array(
792
+    );
793
+    $data['result']['app_version_id'] = array(
794 794
     'title' => bts('Application version', array(), NULL, 'boinc:task-details'),
795 795
     'help' => t('The version number of the application.'),
796 796
     'field' => array(
797
-      'handler' => 'views_handler_field_numeric',
798
-      'click sortable' => TRUE
797
+        'handler' => 'views_handler_field_numeric',
798
+        'click sortable' => TRUE
799 799
     ),
800 800
     'filter' => array(
801
-      'handler' => 'views_handler_filter_numeric'
801
+        'handler' => 'views_handler_filter_numeric'
802 802
     ),
803 803
     'sort' => array(
804
-      'handler' => 'views_handler_sort_numeric'
804
+        'handler' => 'views_handler_sort_numeric'
805 805
     )
806
-  );
807
-  $data['result']['claimed_credit'] = array(
806
+    );
807
+    $data['result']['claimed_credit'] = array(
808 808
     'title' => bts('Claimed credit', array(), NULL, 'boinc:task-details'),
809 809
     'help' => t('The credit claimed for this result.'),
810 810
     'field' => array(
811
-      'handler' => 'views_handler_field_numeric',
812
-      'click sortable' => TRUE,
813
-      'float' => TRUE
811
+        'handler' => 'views_handler_field_numeric',
812
+        'click sortable' => TRUE,
813
+        'float' => TRUE
814 814
     ),
815 815
     'filter' => array(
816
-      'handler' => 'views_handler_filter_numeric'
816
+        'handler' => 'views_handler_filter_numeric'
817 817
     ),
818 818
     'sort' => array(
819
-      'handler' => 'views_handler_sort_numeric'
819
+        'handler' => 'views_handler_sort_numeric'
820 820
     )
821
-  );
822
-  $data['result']['client_state'] = array(
821
+    );
822
+    $data['result']['client_state'] = array(
823 823
     'title' => bts('Client state', array(), NULL, 'boinc:task-details'),
824 824
     'help' => t('The state of the task on the client side.'),
825 825
     'field' => array(
826
-      'handler' => 'views_handler_field_numeric',
827
-      'click sortable' => TRUE
826
+        'handler' => 'views_handler_field_numeric',
827
+        'click sortable' => TRUE
828 828
     ),
829 829
     'filter' => array(
830
-      'handler' => 'views_handler_filter_numeric'
830
+        'handler' => 'views_handler_filter_numeric'
831 831
     ),
832 832
     'sort' => array(
833
-      'handler' => 'views_handler_sort_numeric'
833
+        'handler' => 'views_handler_sort_numeric'
834 834
     )
835
-  );
836
-  $data['result']['cpu_time'] = array(
835
+    );
836
+    $data['result']['cpu_time'] = array(
837 837
     'title' => bts('CPU time', array(), NULL, 'boinc:task-details'),
838 838
     'help' => t('The CPU time spent on the task.'),
839 839
     'field' => array(
840
-      'handler' => 'views_handler_field_numeric',
841
-      'click sortable' => TRUE,
842
-      'float' => TRUE
840
+        'handler' => 'views_handler_field_numeric',
841
+        'click sortable' => TRUE,
842
+        'float' => TRUE
843 843
     ),
844 844
     'filter' => array(
845
-      'handler' => 'views_handler_filter_numeric'
845
+        'handler' => 'views_handler_filter_numeric'
846 846
     ),
847 847
     'sort' => array(
848
-      'handler' => 'views_handler_sort_numeric'
848
+        'handler' => 'views_handler_sort_numeric'
849 849
     )
850
-  );
851
-  $data['result']['create_time'] = array(
850
+    );
851
+    $data['result']['create_time'] = array(
852 852
     'title' => bts('Created', array(), NULL, 'boinc:task-details:-1:ignoreoverwrite'),
853 853
     'help' => t('The time that the task was created.'),
854 854
     'field' => array(
855
-      'handler' => 'views_handler_field_date',
856
-      'click sortable' => TRUE
855
+        'handler' => 'views_handler_field_date',
856
+        'click sortable' => TRUE
857 857
     ),
858 858
     'filter' => array(
859
-      'handler' => 'views_handler_filter_date'
859
+        'handler' => 'views_handler_filter_date'
860 860
     ),
861 861
     'sort' => array(
862
-      'handler' => 'views_handler_sort_date'
862
+        'handler' => 'views_handler_sort_date'
863 863
     )
864
-  );
865
-  $data['result']['elapsed_time'] = array(
864
+    );
865
+    $data['result']['elapsed_time'] = array(
866 866
     'title' => bts('Run time', array(), NULL, 'boinc:task-details'),
867 867
     'help' => t('The run time of the task.'),
868 868
     'field' => array(
869
-      'handler' => 'views_handler_field_numeric',
870
-      'click sortable' => TRUE,
871
-      'float' => TRUE
869
+        'handler' => 'views_handler_field_numeric',
870
+        'click sortable' => TRUE,
871
+        'float' => TRUE
872 872
     ),
873 873
     'filter' => array(
874
-      'handler' => 'views_handler_filter_numeric'
874
+        'handler' => 'views_handler_filter_numeric'
875 875
     ),
876 876
     'sort' => array(
877
-      'handler' => 'views_handler_sort_numeric'
877
+        'handler' => 'views_handler_sort_numeric'
878 878
     )
879
-  );
880
-  $data['result']['exit_status'] = array(
879
+    );
880
+    $data['result']['exit_status'] = array(
881 881
     'title' => bts('Exit status', array(), NULL, 'boinc:task-details'),
882 882
     'help' => t('The exit code of the task.'),
883 883
     'field' => array(
884
-      'handler' => 'views_handler_field_numeric',
885
-      'click sortable' => TRUE
884
+        'handler' => 'views_handler_field_numeric',
885
+        'click sortable' => TRUE
886 886
     ),
887 887
     'filter' => array(
888
-      'handler' => 'views_handler_filter_numeric'
888
+        'handler' => 'views_handler_filter_numeric'
889 889
     ),
890 890
     'sort' => array(
891
-      'handler' => 'views_handler_sort_numeric'
891
+        'handler' => 'views_handler_sort_numeric'
892 892
     )
893
-  );
894
-  $data['result']['granted_credit'] = array(
893
+    );
894
+    $data['result']['granted_credit'] = array(
895 895
     'title' => bts('Granted credit', array(), NULL, 'boinc:task-details'),
896 896
     'help' => t('The credit granted for this result.'),
897 897
     'field' => array(
898
-      'handler' => 'views_handler_field_numeric',
899
-      'click sortable' => TRUE,
900
-      'float' => TRUE
898
+        'handler' => 'views_handler_field_numeric',
899
+        'click sortable' => TRUE,
900
+        'float' => TRUE
901 901
     ),
902 902
     'filter' => array(
903
-      'handler' => 'views_handler_filter_numeric'
903
+        'handler' => 'views_handler_filter_numeric'
904 904
     ),
905 905
     'sort' => array(
906
-      'handler' => 'views_handler_sort_numeric'
906
+        'handler' => 'views_handler_sort_numeric'
907 907
     )
908
-  );
909
-  $data['result']['name'] = array(
908
+    );
909
+    $data['result']['name'] = array(
910 910
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
911 911
     'help' => t('The name of the task.'),
912 912
     'field' => array(
913
-      'handler' => 'views_handler_field',
914
-      'click sortable' => TRUE
913
+        'handler' => 'views_handler_field',
914
+        'click sortable' => TRUE
915 915
     ),
916 916
     'filter' => array(
917
-      'handler' => 'views_handler_filter_string'
917
+        'handler' => 'views_handler_filter_string'
918 918
     ),
919 919
     'sort' => array(
920
-      'handler' => 'views_handler_sort_string'
920
+        'handler' => 'views_handler_sort_string'
921 921
     )
922
-  );
923
-  $data['result']['outcome'] = array(
922
+    );
923
+    $data['result']['outcome'] = array(
924 924
     'title' => bts('Outcome', array(), NULL, 'boinc:task-details'),
925 925
     'help' => t('The outcome of the task.'),
926 926
     'field' => array(
927
-      'handler' => 'views_handler_field_numeric',
928
-      'click sortable' => TRUE
927
+        'handler' => 'views_handler_field_numeric',
928
+        'click sortable' => TRUE
929 929
     ),
930 930
     'filter' => array(
931
-      'handler' => 'views_handler_filter_numeric'
931
+        'handler' => 'views_handler_filter_numeric'
932 932
     ),
933 933
     'sort' => array(
934
-      'handler' => 'views_handler_sort_numeric'
934
+        'handler' => 'views_handler_sort_numeric'
935 935
     )
936
-  );
937
-  $data['result']['received_time'] = array(
936
+    );
937
+    $data['result']['received_time'] = array(
938 938
     'title' => bts('Received time', array(), NULL, 'boinc:task-details'),
939 939
     'help' => t('The time that the result was received.'),
940 940
     'field' => array(
941
-      'handler' => 'views_handler_field_date',
942
-      'click sortable' => TRUE
941
+        'handler' => 'views_handler_field_date',
942
+        'click sortable' => TRUE
943 943
     ),
944 944
     'filter' => array(
945
-      'handler' => 'views_handler_filter_date'
945
+        'handler' => 'views_handler_filter_date'
946 946
     ),
947 947
     'sort' => array(
948
-      'handler' => 'views_handler_sort_date'
948
+        'handler' => 'views_handler_sort_date'
949 949
     )
950
-  );
951
-  $data['result']['report_deadline'] = array(
950
+    );
951
+    $data['result']['report_deadline'] = array(
952 952
     'title' => bts('Report deadline', array(), NULL, 'boinc:task-details'),
953 953
     'help' => t('The deadline for the task.'),
954 954
     'field' => array(
955
-      'handler' => 'views_handler_field_date',
956
-      'click sortable' => TRUE
955
+        'handler' => 'views_handler_field_date',
956
+        'click sortable' => TRUE
957 957
     ),
958 958
     'filter' => array(
959
-      'handler' => 'views_handler_filter_date'
959
+        'handler' => 'views_handler_filter_date'
960 960
     ),
961 961
     'sort' => array(
962
-      'handler' => 'views_handler_sort_date'
962
+        'handler' => 'views_handler_sort_date'
963 963
     )
964
-  );
965
-  $data['result']['sent_time'] = array(
964
+    );
965
+    $data['result']['sent_time'] = array(
966 966
     'title' => bts('Sent', array(), NULL, 'boinc:task-details'),
967 967
     'help' => t('The time that the task was sent.'),
968 968
     'field' => array(
969
-      'handler' => 'views_handler_field_date',
970
-      'click sortable' => TRUE
969
+        'handler' => 'views_handler_field_date',
970
+        'click sortable' => TRUE
971 971
     ),
972 972
     'filter' => array(
973
-      'handler' => 'views_handler_filter_date'
973
+        'handler' => 'views_handler_filter_date'
974 974
     ),
975 975
     'sort' => array(
976
-      'handler' => 'views_handler_sort_date'
976
+        'handler' => 'views_handler_sort_date'
977 977
     )
978
-  );
979
-  $data['result']['server_state'] = array(
978
+    );
979
+    $data['result']['server_state'] = array(
980 980
     'title' => bts('Server state', array(), NULL, 'boinc:task-details'),
981 981
     'help' => t('The state of task on the server side.'),
982 982
     'field' => array(
983
-      'handler' => 'views_handler_field_numeric',
984
-      'click sortable' => TRUE
983
+        'handler' => 'views_handler_field_numeric',
984
+        'click sortable' => TRUE
985 985
     ),
986 986
     'filter' => array(
987
-      'handler' => 'views_handler_filter_numeric'
987
+        'handler' => 'views_handler_filter_numeric'
988 988
     ),
989 989
     'sort' => array(
990
-      'handler' => 'views_handler_sort_numeric'
990
+        'handler' => 'views_handler_sort_numeric'
991 991
     )
992
-  );
993
-  $data['result']['stderr_out'] = array(
992
+    );
993
+    $data['result']['stderr_out'] = array(
994 994
     'title' => bts('Stderr out', array(), NULL, 'boinc:task-details'),
995 995
     'help' => t('The output to standard error.'),
996 996
     'field' => array(
997
-      'handler' => 'views_handler_field',
998
-      'click sortable' => TRUE
997
+        'handler' => 'views_handler_field',
998
+        'click sortable' => TRUE
999 999
     ),
1000 1000
     'filter' => array(
1001
-      'handler' => 'views_handler_filter_string'
1001
+        'handler' => 'views_handler_filter_string'
1002 1002
     ),
1003 1003
     'sort' => array(
1004
-      'handler' => 'views_handler_sort_string'
1004
+        'handler' => 'views_handler_sort_string'
1005 1005
     )
1006
-  );
1007
-  $data['result']['validate_state'] = array(
1006
+    );
1007
+    $data['result']['validate_state'] = array(
1008 1008
     'title' => bts('Validation state', array(), NULL, 'boinc:task-details'),
1009 1009
     'help' => t('The state of validation of this result.'),
1010 1010
     'field' => array(
1011
-      'handler' => 'views_handler_field_numeric',
1012
-      'click sortable' => TRUE
1011
+        'handler' => 'views_handler_field_numeric',
1012
+        'click sortable' => TRUE
1013 1013
     ),
1014 1014
     'filter' => array(
1015
-      'handler' => 'views_handler_filter_numeric'
1015
+        'handler' => 'views_handler_filter_numeric'
1016 1016
     ),
1017 1017
     'sort' => array(
1018
-      'handler' => 'views_handler_sort_numeric'
1018
+        'handler' => 'views_handler_sort_numeric'
1019 1019
     )
1020
-  );
1021
-  $data['result']['peak_working_set_size'] = array(
1020
+    );
1021
+    $data['result']['peak_working_set_size'] = array(
1022 1022
     'title' => bts('Peak working set size', array(), NULL, 'boinc:task-details'),
1023 1023
     'help' => t('Peak working set size.'),
1024 1024
     'field' => array(
1025
-      'handler' => 'views_handler_field_numeric',
1026
-      'click sortable' => TRUE
1025
+        'handler' => 'views_handler_field_numeric',
1026
+        'click sortable' => TRUE
1027 1027
     ),
1028 1028
     'filter' => array(
1029
-      'handler' => 'views_handler_filter_numeric'
1029
+        'handler' => 'views_handler_filter_numeric'
1030 1030
     ),
1031 1031
     'sort' => array(
1032
-      'handler' => 'views_handler_sort_numeric'
1032
+        'handler' => 'views_handler_sort_numeric'
1033 1033
     )
1034
-  );
1035
-  $data['result']['peak_swap_size'] = array(
1034
+    );
1035
+    $data['result']['peak_swap_size'] = array(
1036 1036
     'title' => bts('Peak swap size', array(), NULL, 'boinc:task-details'),
1037 1037
     'help' => t('Peak swap size.'),
1038 1038
     'field' => array(
1039
-      'handler' => 'views_handler_field_numeric',
1040
-      'click sortable' => TRUE
1039
+        'handler' => 'views_handler_field_numeric',
1040
+        'click sortable' => TRUE
1041 1041
     ),
1042 1042
     'filter' => array(
1043
-      'handler' => 'views_handler_filter_numeric'
1043
+        'handler' => 'views_handler_filter_numeric'
1044 1044
     ),
1045 1045
     'sort' => array(
1046
-      'handler' => 'views_handler_sort_numeric'
1046
+        'handler' => 'views_handler_sort_numeric'
1047 1047
     )
1048
-  );
1048
+    );
1049 1049
     $data['result']['peak_disk_usage'] = array(
1050 1050
     'title' => bts('Peak disk usage', array(), NULL, 'boinc:task-details'),
1051 1051
     'help' => t('Peak disk usage.'),
1052 1052
     'field' => array(
1053
-      'handler' => 'views_handler_field_numeric',
1054
-      'click sortable' => TRUE
1053
+        'handler' => 'views_handler_field_numeric',
1054
+        'click sortable' => TRUE
1055 1055
     ),
1056 1056
     'filter' => array(
1057
-      'handler' => 'views_handler_filter_numeric'
1057
+        'handler' => 'views_handler_filter_numeric'
1058 1058
     ),
1059 1059
     'sort' => array(
1060
-      'handler' => 'views_handler_sort_numeric'
1060
+        'handler' => 'views_handler_sort_numeric'
1061 1061
     )
1062
-  );
1062
+    );
1063 1063
 
1064 1064
   
1065
-  // ------------------------------------------------------------------------------------------------
1066
-  // Definition for workunit table
1067
-  // ------------------------------------------------------------------------------------------------
1065
+    // ------------------------------------------------------------------------------------------------
1066
+    // Definition for workunit table
1067
+    // ------------------------------------------------------------------------------------------------
1068 1068
   
1069
-  $data['workunit']['table']['group'] = t('BOINC');
1070
-  $data['workunit']['table']['base'] = array(
1071
-      'field' => 'id',
1072
-      'title' => t('BOINC workunit'),
1073
-      'help' => t('Workunits produced by BOINC'),
1074
-      'database' => 'boinc_ro'
1075
-  );
1069
+    $data['workunit']['table']['group'] = t('BOINC');
1070
+    $data['workunit']['table']['base'] = array(
1071
+        'field' => 'id',
1072
+        'title' => t('BOINC workunit'),
1073
+        'help' => t('Workunits produced by BOINC'),
1074
+        'database' => 'boinc_ro'
1075
+    );
1076 1076
   
1077
-  // Create implicit relationship to the app table
1077
+    // Create implicit relationship to the app table
1078 1078
   
1079
-  $data['workunit']['table']['join'] = array(
1079
+    $data['workunit']['table']['join'] = array(
1080 1080
     'app' => array(
1081
-      'left_field' => 'id',
1082
-      'field' => 'appid'
1081
+        'left_field' => 'id',
1082
+        'field' => 'appid'
1083 1083
     )
1084
-  );
1084
+    );
1085 1085
   
1086
-  // Primary keys allowed as arguments
1086
+    // Primary keys allowed as arguments
1087 1087
   
1088
-  $data['workunit']['id'] = array(
1088
+    $data['workunit']['id'] = array(
1089 1089
     'title' => bts('Workunit ID', array(), NULL, 'boinc:workunit-details'),
1090 1090
     'help' => t('The ID number of this workunit.'),
1091 1091
     'field' => array(
1092
-      'handler' => 'views_handler_field_numeric',
1093
-      'click sortable' => TRUE
1092
+        'handler' => 'views_handler_field_numeric',
1093
+        'click sortable' => TRUE
1094 1094
     ),
1095 1095
     'argument' => array(
1096
-      'handler' => 'views_handler_argument',
1097
-      'name field' => 'title',
1098
-      'numeric' => TRUE,
1099
-      'validate type' => 'id'
1096
+        'handler' => 'views_handler_argument',
1097
+        'name field' => 'title',
1098
+        'numeric' => TRUE,
1099
+        'validate type' => 'id'
1100 1100
     ),
1101 1101
     'filter' => array(
1102
-      'handler' => 'views_handler_filter_numeric'
1102
+        'handler' => 'views_handler_filter_numeric'
1103 1103
     ),
1104 1104
     'sort' => array(
1105
-      'handler' => 'views_handler_sort_numeric'
1105
+        'handler' => 'views_handler_sort_numeric'
1106 1106
     )
1107
-  );
1107
+    );
1108 1108
   
1109
-  // Foreign key fields
1109
+    // Foreign key fields
1110 1110
   
1111
-  $data['workunit']['appid'] = array(
1111
+    $data['workunit']['appid'] = array(
1112 1112
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1113 1113
     'help' => t('The application associated with this workunit.'), 
1114 1114
     'argument' => array( // foreign key to the {app} table
1115
-      'handler' => 'views_handler_argument',
1116
-      'name field' => 'title',
1117
-      'numeric' => TRUE,
1118
-      'validate type' => 'id'
1115
+        'handler' => 'views_handler_argument',
1116
+        'name field' => 'title',
1117
+        'numeric' => TRUE,
1118
+        'validate type' => 'id'
1119 1119
     ),
1120 1120
     'relationship' => array(
1121
-      'base' => 'app',
1122
-      'field' => 'appid',
1123
-      'handler' => 'views_handler_relationship',
1124
-      'label' => t('Application')
1121
+        'base' => 'app',
1122
+        'field' => 'appid',
1123
+        'handler' => 'views_handler_relationship',
1124
+        'label' => t('Application')
1125 1125
     ),
1126 1126
     'field' => array(
1127
-      'handler' => 'views_handler_field_numeric',
1128
-      'click sortable' => TRUE
1127
+        'handler' => 'views_handler_field_numeric',
1128
+        'click sortable' => TRUE
1129 1129
     ),
1130 1130
     'filter' => array(
1131
-      'handler' => 'views_handler_filter_numeric'
1131
+        'handler' => 'views_handler_filter_numeric'
1132 1132
     ),
1133 1133
     'sort' => array(
1134
-      'handler' => 'views_handler_sort_numeric'
1134
+        'handler' => 'views_handler_sort_numeric'
1135 1135
     )
1136
-  );
1136
+    );
1137 1137
   
1138
-  // Descriptions of workunit fields (alphabetized)
1138
+    // Descriptions of workunit fields (alphabetized)
1139 1139
   
1140
-  $data['workunit']['canonical_credit'] = array(
1140
+    $data['workunit']['canonical_credit'] = array(
1141 1141
     'title' => bts('Canonical credit', array(), NULL, 'boinc:workunit-details'),
1142 1142
     'help' => t('The canonical credit of the workunit.'),
1143 1143
     'field' => array(
1144
-      'handler' => 'views_handler_field_numeric',
1145
-      'click sortable' => TRUE,
1146
-      'float' => TRUE
1144
+        'handler' => 'views_handler_field_numeric',
1145
+        'click sortable' => TRUE,
1146
+        'float' => TRUE
1147 1147
     ),
1148 1148
     'filter' => array(
1149
-      'handler' => 'views_handler_filter_numeric'
1149
+        'handler' => 'views_handler_filter_numeric'
1150 1150
     ),
1151 1151
     'sort' => array(
1152
-      'handler' => 'views_handler_sort_numeric'
1152
+        'handler' => 'views_handler_sort_numeric'
1153 1153
     )
1154
-  );
1155
-  $data['workunit']['canonical_resultid'] = array(
1154
+    );
1155
+    $data['workunit']['canonical_resultid'] = array(
1156 1156
     'title' => bts('Canonical result ID', array(), NULL, 'boinc:workunit-details'),
1157 1157
     'help' => t('The ID of the canonical result associated with the workunit.'),
1158 1158
     'field' => array(
1159
-      'handler' => 'views_handler_field_numeric',
1160
-      'click sortable' => TRUE
1159
+        'handler' => 'views_handler_field_numeric',
1160
+        'click sortable' => TRUE
1161 1161
     ),
1162 1162
     'filter' => array(
1163
-      'handler' => 'views_handler_filter_numeric'
1163
+        'handler' => 'views_handler_filter_numeric'
1164 1164
     ),
1165 1165
     'sort' => array(
1166
-      'handler' => 'views_handler_sort_numeric'
1166
+        'handler' => 'views_handler_sort_numeric'
1167 1167
     )
1168
-  );
1169
-  $data['workunit']['create_time'] = array(
1168
+    );
1169
+    $data['workunit']['create_time'] = array(
1170 1170
     'title' => bts('Created time', array(), NULL, 'boinc:workunit-details'),
1171 1171
     'help' => t('The time that the workunit was created.'),
1172 1172
     'field' => array(
1173
-      'handler' => 'views_handler_field_date',
1174
-      'click sortable' => TRUE
1173
+        'handler' => 'views_handler_field_date',
1174
+        'click sortable' => TRUE
1175 1175
     ),
1176 1176
     'filter' => array(
1177
-      'handler' => 'views_handler_filter_date'
1177
+        'handler' => 'views_handler_filter_date'
1178 1178
     ),
1179 1179
     'sort' => array(
1180
-      'handler' => 'views_handler_sort_date'
1180
+        'handler' => 'views_handler_sort_date'
1181 1181
     )
1182
-  );
1183
-  $data['workunit']['error_mask'] = array(
1182
+    );
1183
+    $data['workunit']['error_mask'] = array(
1184 1184
     'title' => bts('Error mask', array(), NULL, 'boinc:workunit-details'),
1185 1185
     'help' => t('Error mask of the workunit.'),
1186 1186
     'field' => array(
1187
-      'handler' => 'views_handler_field_numeric',
1188
-      'click sortable' => TRUE
1187
+        'handler' => 'views_handler_field_numeric',
1188
+        'click sortable' => TRUE
1189 1189
     ),
1190 1190
     'filter' => array(
1191
-      'handler' => 'views_handler_filter_numeric'
1191
+        'handler' => 'views_handler_filter_numeric'
1192 1192
     ),
1193 1193
     'sort' => array(
1194
-      'handler' => 'views_handler_sort_numeric'
1194
+        'handler' => 'views_handler_sort_numeric'
1195 1195
     )
1196
-  );
1197
-  $data['workunit']['min_quorum'] = array(
1196
+    );
1197
+    $data['workunit']['min_quorum'] = array(
1198 1198
     'title' => bts('Minimum quorum', array(), NULL, 'boinc:workunit-details'),
1199 1199
     'help' => t('Minimum quorum of the workunit.'),
1200 1200
     'field' => array(
1201
-      'handler' => 'views_handler_field_numeric',
1202
-      'click sortable' => TRUE
1201
+        'handler' => 'views_handler_field_numeric',
1202
+        'click sortable' => TRUE
1203 1203
     ),
1204 1204
     'filter' => array(
1205
-      'handler' => 'views_handler_filter_numeric'
1205
+        'handler' => 'views_handler_filter_numeric'
1206 1206
     ),
1207 1207
     'sort' => array(
1208
-      'handler' => 'views_handler_sort_numeric'
1208
+        'handler' => 'views_handler_sort_numeric'
1209 1209
     )
1210
-  );
1211
-  $data['workunit']['name'] = array(
1210
+    );
1211
+    $data['workunit']['name'] = array(
1212 1212
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreovewrite'),
1213 1213
     'help' => t('The name of the workunit.'),
1214 1214
     'field' => array(
1215
-      'handler' => 'views_handler_field',
1216
-      'click sortable' => TRUE
1215
+        'handler' => 'views_handler_field',
1216
+        'click sortable' => TRUE
1217 1217
     ),
1218 1218
     'filter' => array(
1219
-      'handler' => 'views_handler_filter_string'
1219
+        'handler' => 'views_handler_filter_string'
1220 1220
     ),
1221 1221
     'sort' => array(
1222
-      'handler' => 'views_handler_sort_string'
1222
+        'handler' => 'views_handler_sort_string'
1223 1223
     )
1224
-  );
1225
-  $data['workunit']['max_error_results'] = array(
1224
+    );
1225
+    $data['workunit']['max_error_results'] = array(
1226 1226
     'title' => bts('Max error tasks', array(), NULL, 'boinc:workunit-details'),
1227 1227
     'help' => t('The maximum number of error tasks in the workunit.'),
1228 1228
     'field' => array(
1229
-      'handler' => 'views_handler_field_numeric',
1230
-      'click sortable' => TRUE
1229
+        'handler' => 'views_handler_field_numeric',
1230
+        'click sortable' => TRUE
1231 1231
     ),
1232 1232
     'filter' => array(
1233
-      'handler' => 'views_handler_filter_numeric'
1233
+        'handler' => 'views_handler_filter_numeric'
1234 1234
     ),
1235 1235
     'sort' => array(
1236
-      'handler' => 'views_handler_sort_numeric'
1236
+        'handler' => 'views_handler_sort_numeric'
1237 1237
     )
1238
-  );
1239
-  $data['workunit']['max_success_results'] = array(
1238
+    );
1239
+    $data['workunit']['max_success_results'] = array(
1240 1240
     'title' => bts('Max success tasks', array(), NULL, 'boinc:workunit-details'),
1241 1241
     'help' => t('The maximum number of successful tasks in the workunit.'),
1242 1242
     'field' => array(
1243
-      'handler' => 'views_handler_field_numeric',
1244
-      'click sortable' => TRUE
1243
+        'handler' => 'views_handler_field_numeric',
1244
+        'click sortable' => TRUE
1245 1245
     ),
1246 1246
     'filter' => array(
1247
-      'handler' => 'views_handler_filter_numeric'
1247
+        'handler' => 'views_handler_filter_numeric'
1248 1248
     ),
1249 1249
     'sort' => array(
1250
-      'handler' => 'views_handler_sort_numeric'
1250
+        'handler' => 'views_handler_sort_numeric'
1251 1251
     )
1252
-  );
1253
-  $data['workunit']['max_total_results'] = array(
1252
+    );
1253
+    $data['workunit']['max_total_results'] = array(
1254 1254
     'title' => bts('Max total tasks', array(), NULL, 'boinc:workunit-details'),
1255 1255
     'help' => t('The maximum number of total tasks in the workunit.'),
1256 1256
     'field' => array(
1257
-      'handler' => 'views_handler_field_numeric',
1258
-      'click sortable' => TRUE
1257
+        'handler' => 'views_handler_field_numeric',
1258
+        'click sortable' => TRUE
1259 1259
     ),
1260 1260
     'filter' => array(
1261
-      'handler' => 'views_handler_filter_numeric'
1261
+        'handler' => 'views_handler_filter_numeric'
1262 1262
     ),
1263 1263
     'sort' => array(
1264
-      'handler' => 'views_handler_sort_numeric'
1264
+        'handler' => 'views_handler_sort_numeric'
1265 1265
     )
1266
-  );
1267
-  $data['workunit']['need_validate'] = array(
1266
+    );
1267
+    $data['workunit']['need_validate'] = array(
1268 1268
     'title' => bts('Needs validation', array(), NULL, 'boinc:workunit-details'),
1269 1269
     'help' => t('Whether or not a workunit needs validation.'),
1270 1270
     'field' => array(
1271
-      'handler' => 'views_handler_field_numeric',
1272
-      'click sortable' => TRUE
1271
+        'handler' => 'views_handler_field_numeric',
1272
+        'click sortable' => TRUE
1273 1273
     ),
1274 1274
     'filter' => array(
1275
-      'handler' => 'views_handler_filter_numeric'
1275
+        'handler' => 'views_handler_filter_numeric'
1276 1276
     ),
1277 1277
     'sort' => array(
1278
-      'handler' => 'views_handler_sort_numeric'
1278
+        'handler' => 'views_handler_sort_numeric'
1279 1279
     )
1280
-  );
1281
-  $data['workunit']['target_nresults'] = array(
1280
+    );
1281
+    $data['workunit']['target_nresults'] = array(
1282 1282
     'title' => bts('Initial replication', array(), NULL, 'boinc:workunit-details'),
1283 1283
     'help' => t('The target number of results for the workunit.'),
1284 1284
     'field' => array(
1285
-      'handler' => 'views_handler_field_numeric',
1286
-      'click sortable' => TRUE
1285
+        'handler' => 'views_handler_field_numeric',
1286
+        'click sortable' => TRUE
1287 1287
     ),
1288 1288
     'filter' => array(
1289
-      'handler' => 'views_handler_filter_numeric'
1289
+        'handler' => 'views_handler_filter_numeric'
1290 1290
     ),
1291 1291
     'sort' => array(
1292
-      'handler' => 'views_handler_sort_numeric'
1292
+        'handler' => 'views_handler_sort_numeric'
1293 1293
     )
1294
-  );
1294
+    );
1295 1295
   
1296
-  // ------------------------------------------------------------------------------------------------
1297
-  // Definition for app table
1298
-  // ------------------------------------------------------------------------------------------------
1296
+    // ------------------------------------------------------------------------------------------------
1297
+    // Definition for app table
1298
+    // ------------------------------------------------------------------------------------------------
1299 1299
   
1300
-  $data['app']['table']['group'] = t('BOINC');
1301
-  $data['app']['table']['base'] = array(
1302
-      'field' => 'id',
1303
-      'title' => t('BOINC app'),
1304
-      'help' => t('Research applications run by BOINC'),
1305
-      'database' => 'boinc_ro'
1306
-  );
1300
+    $data['app']['table']['group'] = t('BOINC');
1301
+    $data['app']['table']['base'] = array(
1302
+        'field' => 'id',
1303
+        'title' => t('BOINC app'),
1304
+        'help' => t('Research applications run by BOINC'),
1305
+        'database' => 'boinc_ro'
1306
+    );
1307 1307
   
1308
-  // Primary keys allowed as arguments
1308
+    // Primary keys allowed as arguments
1309 1309
 
1310
-  $data['app']['id'] = array(
1310
+    $data['app']['id'] = array(
1311 1311
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1312 1312
     'help' => t('The ID number of this application.'),
1313 1313
     'field' => array(
1314
-      'handler' => 'views_handler_field_numeric',
1315
-      'click sortable' => TRUE
1314
+        'handler' => 'views_handler_field_numeric',
1315
+        'click sortable' => TRUE
1316 1316
     ),
1317 1317
     'argument' => array(
1318
-      'handler' => 'views_handler_argument',
1319
-      'name field' => 'title',
1320
-      'numeric' => TRUE,
1321
-      'validate type' => 'id'
1318
+        'handler' => 'views_handler_argument',
1319
+        'name field' => 'title',
1320
+        'numeric' => TRUE,
1321
+        'validate type' => 'id'
1322 1322
     ),
1323 1323
     'filter' => array(
1324
-      'handler' => 'views_handler_filter_numeric'
1324
+        'handler' => 'views_handler_filter_numeric'
1325 1325
     ),
1326 1326
     'sort' => array(
1327
-      'handler' => 'views_handler_sort_numeric'
1327
+        'handler' => 'views_handler_sort_numeric'
1328 1328
     )
1329
-  );
1329
+    );
1330 1330
   
1331
-  // Descriptions of app fields (alphabetized)
1331
+    // Descriptions of app fields (alphabetized)
1332 1332
   
1333
-  $data['app']['target_nresults'] = array(
1333
+    $data['app']['target_nresults'] = array(
1334 1334
     'title' => bts('Target number of results', array(), NULL, 'boinc:application-details'),
1335 1335
     'help' => t('The number of times to replicate tasks in this application.'),
1336 1336
     'field' => array(
1337
-      'handler' => 'views_handler_field_numeric',
1338
-      'click sortable' => TRUE
1337
+        'handler' => 'views_handler_field_numeric',
1338
+        'click sortable' => TRUE
1339 1339
     ),
1340 1340
     'filter' => array(
1341
-      'handler' => 'views_handler_filter_numeric'
1341
+        'handler' => 'views_handler_filter_numeric'
1342 1342
     ),
1343 1343
     'sort' => array(
1344
-      'handler' => 'views_handler_sort_numeric'
1344
+        'handler' => 'views_handler_sort_numeric'
1345 1345
     )
1346
-  );
1347
-  $data['app']['user_friendly_name'] = array(
1346
+    );
1347
+    $data['app']['user_friendly_name'] = array(
1348 1348
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1349 1349
     'help' => t('The user friendly name of the application.'),
1350 1350
     'field' => array(
1351
-      'handler' => 'views_handler_field',
1352
-      'click sortable' => TRUE
1351
+        'handler' => 'views_handler_field',
1352
+        'click sortable' => TRUE
1353 1353
     ),
1354 1354
     'filter' => array(
1355
-      'handler' => 'views_handler_filter_string'
1355
+        'handler' => 'views_handler_filter_string'
1356 1356
     ),
1357 1357
     'sort' => array(
1358
-      'handler' => 'views_handler_sort_string'
1358
+        'handler' => 'views_handler_sort_string'
1359 1359
     )
1360
-  );
1360
+    );
1361 1361
   
1362
-  // ------------------------------------------------------------------------------------------------
1363
-  // Definition for app_version table
1364
-  // ------------------------------------------------------------------------------------------------
1362
+    // ------------------------------------------------------------------------------------------------
1363
+    // Definition for app_version table
1364
+    // ------------------------------------------------------------------------------------------------
1365 1365
   
1366
-  $data['app_version']['table']['group'] = t('BOINC');
1367
-  $data['app_version']['table']['base'] = array(
1368
-      'field' => 'id',
1369
-      'title' => t('BOINC app version'),
1370
-      'help' => t('Versions of research applications run by BOINC'),
1371
-      'database' => 'boinc_ro'
1372
-  );
1366
+    $data['app_version']['table']['group'] = t('BOINC');
1367
+    $data['app_version']['table']['base'] = array(
1368
+        'field' => 'id',
1369
+        'title' => t('BOINC app version'),
1370
+        'help' => t('Versions of research applications run by BOINC'),
1371
+        'database' => 'boinc_ro'
1372
+    );
1373 1373
   
1374
-  // Primary keys allowed as arguments
1374
+    // Primary keys allowed as arguments
1375 1375
 
1376
-  $data['app_version']['id'] = array(
1376
+    $data['app_version']['id'] = array(
1377 1377
     'title' => bts('Application version ID', array(), NULL, 'boinc:application-details'),
1378 1378
     'help' => t('The ID number of this application version.'),
1379 1379
     'field' => array(
1380
-      'handler' => 'views_handler_field_numeric',
1381
-      'click sortable' => TRUE
1380
+        'handler' => 'views_handler_field_numeric',
1381
+        'click sortable' => TRUE
1382 1382
     ),
1383 1383
     'argument' => array(
1384
-      'handler' => 'views_handler_argument',
1385
-      'name field' => 'title',
1386
-      'numeric' => TRUE,
1387
-      'validate type' => 'id'
1384
+        'handler' => 'views_handler_argument',
1385
+        'name field' => 'title',
1386
+        'numeric' => TRUE,
1387
+        'validate type' => 'id'
1388 1388
     ),
1389 1389
     'filter' => array(
1390
-      'handler' => 'views_handler_filter_numeric'
1390
+        'handler' => 'views_handler_filter_numeric'
1391 1391
     ),
1392 1392
     'sort' => array(
1393
-      'handler' => 'views_handler_sort_numeric'
1393
+        'handler' => 'views_handler_sort_numeric'
1394 1394
     )
1395
-  );
1395
+    );
1396 1396
   
1397
-  // Foreign key fields
1397
+    // Foreign key fields
1398 1398
   
1399
-  $data['app_version']['appid'] = array(
1399
+    $data['app_version']['appid'] = array(
1400 1400
     'title' => bts('Application ID', array(), NULL, 'boinc:application-details'),
1401 1401
     'help' => t('The application ID associated with this app version.'),
1402 1402
     // Because this is a foreign key to the {app} table. This allows us to
1403 1403
     // have, when the view is configured with this relationship, all the fields
1404 1404
     // for the related node available.
1405 1405
     'argument' => array(
1406
-      'handler' => 'views_handler_argument_numeric',
1407
-      'name field' => 'title',
1408
-      'numeric' => TRUE,
1409
-      'validate type' => 'id'
1406
+        'handler' => 'views_handler_argument_numeric',
1407
+        'name field' => 'title',
1408
+        'numeric' => TRUE,
1409
+        'validate type' => 'id'
1410 1410
     ),
1411 1411
     'relationship' => array(
1412
-      'base' => 'app',
1413
-      'field' => 'id',
1414
-      'handler' => 'views_handler_relationship',
1415
-      'label' => t('App ID')
1412
+        'base' => 'app',
1413
+        'field' => 'id',
1414
+        'handler' => 'views_handler_relationship',
1415
+        'label' => t('App ID')
1416 1416
     ),
1417 1417
     'field' => array(
1418
-      'handler' => 'views_handler_field_numeric',
1419
-      'click sortable' => TRUE
1418
+        'handler' => 'views_handler_field_numeric',
1419
+        'click sortable' => TRUE
1420 1420
     ),
1421 1421
     'filter' => array(
1422
-      'handler' => 'views_handler_filter_numeric'
1422
+        'handler' => 'views_handler_filter_numeric'
1423 1423
     ),
1424 1424
     'sort' => array(
1425
-      'handler' => 'views_handler_sort_numeric'
1425
+        'handler' => 'views_handler_sort_numeric'
1426 1426
     )
1427
-  );
1427
+    );
1428 1428
   
1429
-  $data['app_version']['platformid'] = array(
1429
+    $data['app_version']['platformid'] = array(
1430 1430
     'title' => bts('Platform ID', array(), NULL, 'boinc:platform-details'),
1431 1431
     'help' => t('The platform ID associated with this app version.'),
1432 1432
     // Because this is a foreign key to the {platform} table. This allows us to
1433 1433
     // have, when the view is configured with this relationship, all the fields
1434 1434
     // for the related node available.
1435 1435
     'argument' => array(
1436
-      'handler' => 'views_handler_argument_numeric',
1437
-      'name field' => 'title',
1438
-      'numeric' => TRUE,
1439
-      'validate type' => 'id'
1436
+        'handler' => 'views_handler_argument_numeric',
1437
+        'name field' => 'title',
1438
+        'numeric' => TRUE,
1439
+        'validate type' => 'id'
1440 1440
     ),
1441 1441
     'relationship' => array(
1442
-      'base' => 'platform',
1443
-      'field' => 'id',
1444
-      'handler' => 'views_handler_relationship',
1445
-      'label' => t('Platform ID')
1442
+        'base' => 'platform',
1443
+        'field' => 'id',
1444
+        'handler' => 'views_handler_relationship',
1445
+        'label' => t('Platform ID')
1446 1446
     ),
1447 1447
     'field' => array(
1448
-      'handler' => 'views_handler_field_numeric',
1449
-      'click sortable' => TRUE
1448
+        'handler' => 'views_handler_field_numeric',
1449
+        'click sortable' => TRUE
1450 1450
     ),
1451 1451
     'filter' => array(
1452
-      'handler' => 'views_handler_filter_numeric'
1452
+        'handler' => 'views_handler_filter_numeric'
1453 1453
     ),
1454 1454
     'sort' => array(
1455
-      'handler' => 'views_handler_sort_numeric'
1455
+        'handler' => 'views_handler_sort_numeric'
1456 1456
     )
1457
-  );
1457
+    );
1458 1458
   
1459
-  // Descriptions of app fields (alphabetized)
1459
+    // Descriptions of app fields (alphabetized)
1460 1460
   
1461
-  $data['app_version']['plan_class'] = array(
1461
+    $data['app_version']['plan_class'] = array(
1462 1462
     'title' => bts('Plan class', array(), NULL, 'boinc:application-details'),
1463 1463
     'help' => t('App version plan class.'),
1464 1464
     'field' => array(
1465
-      'handler' => 'views_handler_field',
1466
-      'click sortable' => TRUE
1465
+        'handler' => 'views_handler_field',
1466
+        'click sortable' => TRUE
1467 1467
     ),
1468 1468
     'filter' => array(
1469
-      'handler' => 'views_handler_filter_string'
1469
+        'handler' => 'views_handler_filter_string'
1470 1470
     ),
1471 1471
     'sort' => array(
1472
-      'handler' => 'views_handler_sort_string'
1472
+        'handler' => 'views_handler_sort_string'
1473 1473
     )
1474
-  );
1475
-  $data['app_version']['version_num'] = array(
1474
+    );
1475
+    $data['app_version']['version_num'] = array(
1476 1476
     'title' => bts('Version number', array(), NULL, 'boinc:application-details'),
1477 1477
     'help' => t('The application version number.'),
1478 1478
     'field' => array(
1479
-      'handler' => 'views_handler_field_boincwork_app_version_number',
1480
-      'click sortable' => TRUE,
1481
-      'float' => TRUE,
1479
+        'handler' => 'views_handler_field_boincwork_app_version_number',
1480
+        'click sortable' => TRUE,
1481
+        'float' => TRUE,
1482 1482
     ),
1483 1483
     'filter' => array(
1484
-      'handler' => 'views_handler_filter_numeric'
1484
+        'handler' => 'views_handler_filter_numeric'
1485 1485
     ),
1486 1486
     'sort' => array(
1487
-      'handler' => 'views_handler_sort_numeric'
1487
+        'handler' => 'views_handler_sort_numeric'
1488 1488
     )
1489
-  );
1489
+    );
1490 1490
   
1491
-  // ------------------------------------------------------------------------------------------------
1492
-  // Definition for host_app_version table
1493
-  // ------------------------------------------------------------------------------------------------
1491
+    // ------------------------------------------------------------------------------------------------
1492
+    // Definition for host_app_version table
1493
+    // ------------------------------------------------------------------------------------------------
1494 1494
   
1495
-  $data['host_app_version']['table']['group'] = t('BOINC');
1495
+    $data['host_app_version']['table']['group'] = t('BOINC');
1496 1496
   
1497
-  // This table references the {host} table.
1498
-  // This join creates an 'implicit' relationship to the host table, so that when
1499
-  // "Host" is the base table, the fields are automatically available.
1497
+    // This table references the {host} table.
1498
+    // This join creates an 'implicit' relationship to the host table, so that when
1499
+    // "Host" is the base table, the fields are automatically available.
1500 1500
   
1501
-  // Index this array by the table name to which this table refers.
1502
-  // 'left_field' is the primary key in the referenced table.
1503
-  // 'field' is the foreign key in this table.
1501
+    // Index this array by the table name to which this table refers.
1502
+    // 'left_field' is the primary key in the referenced table.
1503
+    // 'field' is the foreign key in this table.
1504 1504
   
1505
-  $data['host_app_version']['table']['join'] = array(
1505
+    $data['host_app_version']['table']['join'] = array(
1506 1506
     'host' => array(
1507
-      'left_field' => 'id',
1508
-      'field' => 'host_id',
1507
+        'left_field' => 'id',
1508
+        'field' => 'host_id',
1509 1509
     )
1510
-  );
1510
+    );
1511 1511
   
1512
-  // Primary keys allowed as arguments
1512
+    // Primary keys allowed as arguments
1513 1513
 
1514
-  $data['host_app_version']['host_id'] = array(
1514
+    $data['host_app_version']['host_id'] = array(
1515 1515
     'title' => bts('Computer', array(), NULL, 'boinc:host-details'),
1516 1516
     'help' => t('The host ID connected to this app version data.'),
1517 1517
     'field' => array(
1518
-      'handler' => 'views_handler_field_numeric',
1519
-      'click sortable' => TRUE
1518
+        'handler' => 'views_handler_field_numeric',
1519
+        'click sortable' => TRUE
1520 1520
     ),
1521 1521
     'argument' => array(
1522
-      'handler' => 'views_handler_argument',
1523
-      'name field' => 'title',
1524
-      'numeric' => TRUE,
1525
-      'validate type' => 'id'
1522
+        'handler' => 'views_handler_argument',
1523
+        'name field' => 'title',
1524
+        'numeric' => TRUE,
1525
+        'validate type' => 'id'
1526 1526
     ),
1527 1527
     'filter' => array(
1528
-      'handler' => 'views_handler_filter_numeric'
1528
+        'handler' => 'views_handler_filter_numeric'
1529 1529
     ),
1530 1530
     'sort' => array(
1531
-      'handler' => 'views_handler_sort_numeric'
1531
+        'handler' => 'views_handler_sort_numeric'
1532 1532
     )
1533
-  );
1533
+    );
1534 1534
   
1535
-  // Foreign key fields
1535
+    // Foreign key fields
1536 1536
   
1537
-  $data['host_app_version']['app_version_id'] = array(
1537
+    $data['host_app_version']['app_version_id'] = array(
1538 1538
     'title' => bts('App version ID', array(), NULL, 'boinc:application-details'),
1539 1539
     'help' => t('The app version ID connected to this host data.'),
1540 1540
     // Because this is a foreign key to the {host} table. This allows us to
1541 1541
     // have, when the view is configured with this relationship, all the fields
1542 1542
     // for the related node available.
1543 1543
     'argument' => array(
1544
-      'handler' => 'views_handler_argument_numeric',
1545
-      'name field' => 'title',
1546
-      'numeric' => TRUE,
1547
-      'validate type' => 'id'
1544
+        'handler' => 'views_handler_argument_numeric',
1545
+        'name field' => 'title',
1546
+        'numeric' => TRUE,
1547
+        'validate type' => 'id'
1548 1548
     ),
1549 1549
     'relationship' => array(
1550
-      'base' => 'app_version',
1551
-      'field' => 'id',
1552
-      'handler' => 'views_handler_relationship',
1553
-      'label' => t('App version')
1550
+        'base' => 'app_version',
1551
+        'field' => 'id',
1552
+        'handler' => 'views_handler_relationship',
1553
+        'label' => t('App version')
1554 1554
     ),
1555 1555
     'field' => array(
1556
-      'handler' => 'views_handler_field_numeric',
1557
-      'click sortable' => TRUE
1556
+        'handler' => 'views_handler_field_numeric',
1557
+        'click sortable' => TRUE
1558 1558
     ),
1559 1559
     'filter' => array(
1560
-      'handler' => 'views_handler_filter_numeric'
1560
+        'handler' => 'views_handler_filter_numeric'
1561 1561
     ),
1562 1562
     'sort' => array(
1563
-      'handler' => 'views_handler_sort_numeric'
1563
+        'handler' => 'views_handler_sort_numeric'
1564 1564
     )
1565
-  );
1565
+    );
1566 1566
   
1567
-  // Descriptions of host_app_version fields (alphabetized)
1567
+    // Descriptions of host_app_version fields (alphabetized)
1568 1568
   
1569
-  $data['host_app_version']['consecutive_valid'] = array(
1569
+    $data['host_app_version']['consecutive_valid'] = array(
1570 1570
     'title' => bts('Consecutive valid tasks', array(), NULL, 'boinc:application-details'),
1571 1571
     'help' => t('The number of consecutive valid tasks for this app and by this host.'),
1572 1572
     'field' => array(
1573
-      'handler' => 'views_handler_field_numeric',
1574
-      'click sortable' => TRUE
1573
+        'handler' => 'views_handler_field_numeric',
1574
+        'click sortable' => TRUE
1575 1575
     ),
1576 1576
     'filter' => array(
1577
-      'handler' => 'views_handler_filter_numeric'
1577
+        'handler' => 'views_handler_filter_numeric'
1578 1578
     ),
1579 1579
     'sort' => array(
1580
-      'handler' => 'views_handler_sort_numeric'
1580
+        'handler' => 'views_handler_sort_numeric'
1581 1581
     )
1582
-  );
1583
-  $data['host_app_version']['et_avg'] = array(
1582
+    );
1583
+    $data['host_app_version']['et_avg'] = array(
1584 1584
     'title' => t('Average processing rate'),
1585 1585
     'help' => t('The "et_avg" for this app and by this host.'),
1586 1586
     'field' => array(
1587
-      'handler' => 'views_handler_field_boincwork_host_app_et_avg',
1588
-      'click sortable' => TRUE
1587
+        'handler' => 'views_handler_field_boincwork_host_app_et_avg',
1588
+        'click sortable' => TRUE
1589 1589
     ),
1590 1590
     'filter' => array(
1591
-      'handler' => 'views_handler_filter_numeric'
1591
+        'handler' => 'views_handler_filter_numeric'
1592 1592
     ),
1593 1593
     'sort' => array(
1594
-      'handler' => 'views_handler_sort_numeric'
1594
+        'handler' => 'views_handler_sort_numeric'
1595 1595
     )
1596
-  );
1597
-  $data['host_app_version']['et_n'] = array(
1596
+    );
1597
+    $data['host_app_version']['et_n'] = array(
1598 1598
     'title' => bts('Number of tasks completed', array(), NULL, 'boinc:application-details'),
1599 1599
     'help' => t('The tasks completed for this app and by this host.'),
1600 1600
     'field' => array(
1601
-      'handler' => 'views_handler_field_numeric',
1602
-      'click sortable' => TRUE
1601
+        'handler' => 'views_handler_field_numeric',
1602
+        'click sortable' => TRUE
1603 1603
     ),
1604 1604
     'filter' => array(
1605
-      'handler' => 'views_handler_filter_numeric'
1605
+        'handler' => 'views_handler_filter_numeric'
1606 1606
     ),
1607 1607
     'sort' => array(
1608
-      'handler' => 'views_handler_sort_numeric'
1608
+        'handler' => 'views_handler_sort_numeric'
1609 1609
     )
1610
-  );
1611
-  $data['host_app_version']['max_jobs_per_day'] = array(
1610
+    );
1611
+    $data['host_app_version']['max_jobs_per_day'] = array(
1612 1612
     'title' => bts('Max tasks per day', array(), NULL, 'boinc:application-details'),
1613 1613
     'help' => t('The maximum tasks per day for this app and by this host.'),
1614 1614
     'field' => array(
1615
-      'handler' => 'views_handler_field_numeric',
1616
-      'click sortable' => TRUE
1615
+        'handler' => 'views_handler_field_numeric',
1616
+        'click sortable' => TRUE
1617 1617
     ),
1618 1618
     'filter' => array(
1619
-      'handler' => 'views_handler_filter_numeric'
1619
+        'handler' => 'views_handler_filter_numeric'
1620 1620
     ),
1621 1621
     'sort' => array(
1622
-      'handler' => 'views_handler_sort_numeric'
1622
+        'handler' => 'views_handler_sort_numeric'
1623 1623
     )
1624
-  );
1625
-  $data['host_app_version']['n_jobs_today'] = array(
1624
+    );
1625
+    $data['host_app_version']['n_jobs_today'] = array(
1626 1626
     'title' => bts('Number of tasks today', array(), NULL, 'boinc:application-details'),
1627 1627
     'help' => t('The number of tasks today for this app and by this host.'),
1628 1628
     'field' => array(
1629
-      'handler' => 'views_handler_field_numeric',
1630
-      'click sortable' => TRUE
1629
+        'handler' => 'views_handler_field_numeric',
1630
+        'click sortable' => TRUE
1631 1631
     ),
1632 1632
     'filter' => array(
1633
-      'handler' => 'views_handler_filter_numeric'
1633
+        'handler' => 'views_handler_filter_numeric'
1634 1634
     ),
1635 1635
     'sort' => array(
1636
-      'handler' => 'views_handler_sort_numeric'
1636
+        'handler' => 'views_handler_sort_numeric'
1637 1637
     )
1638
-  );
1639
-  $data['host_app_version']['turnaround_avg'] = array(
1638
+    );
1639
+    $data['host_app_version']['turnaround_avg'] = array(
1640 1640
     'title' => bts('Average turnaround time', array(), NULL, 'boinc:application-details:-1:ignoreoverwrite'),
1641 1641
     'help' => t('The average turnaround time per task for this app and by this host.'),
1642 1642
     'field' => array(
1643
-      'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg',
1644
-      'click sortable' => TRUE,
1645
-      'float' => TRUE,
1643
+        'handler' => 'views_handler_field_boincwork_host_app_turnaround_avg',
1644
+        'click sortable' => TRUE,
1645
+        'float' => TRUE,
1646 1646
     ),
1647 1647
     'filter' => array(
1648
-      'handler' => 'views_handler_filter_numeric'
1648
+        'handler' => 'views_handler_filter_numeric'
1649 1649
     ),
1650 1650
     'sort' => array(
1651
-      'handler' => 'views_handler_sort_numeric'
1651
+        'handler' => 'views_handler_sort_numeric'
1652 1652
     )
1653
-  );
1654
-  $data['host_app_version']['user_friendly_name'] = array(
1653
+    );
1654
+    $data['host_app_version']['user_friendly_name'] = array(
1655 1655
     'title' => bts('Name', array(), NULL, 'boinc:details:-1:name-of-the-host-or-task-or-workunit-etc-being-viewed-ignoreoverwrite'),
1656 1656
     'help' => t('The user friendly name of the application.'),
1657 1657
     'field' => array(
1658
-      'handler' => 'views_handler_field',
1659
-      'click sortable' => TRUE
1658
+        'handler' => 'views_handler_field',
1659
+        'click sortable' => TRUE
1660 1660
     ),
1661 1661
     'filter' => array(
1662
-      'handler' => 'views_handler_filter_string'
1662
+        'handler' => 'views_handler_filter_string'
1663 1663
     ),
1664 1664
     'sort' => array(
1665
-      'handler' => 'views_handler_sort_string'
1665
+        'handler' => 'views_handler_sort_string'
1666 1666
     )
1667
-  );
1667
+    );
1668 1668
   
1669
-  return $data;
1669
+    return $data;
1670 1670
 }
1671 1671
 
1672 1672
 /*
@@ -1678,23 +1678,23 @@  discard block
 block discarded – undo
1678 1678
 
1679 1679
 function boincwork_views_handlers() {
1680 1680
   
1681
-  return array(
1681
+    return array(
1682 1682
     'info' => array(
1683
-      'path' => drupal_get_path('module', 'boincwork') . '/views',
1683
+        'path' => drupal_get_path('module', 'boincwork') . '/views',
1684 1684
     ),
1685 1685
     'handlers' => array(
1686
-      'views_handler_argument_boincuser_id' => array(
1686
+        'views_handler_argument_boincuser_id' => array(
1687 1687
         'parent' => 'views_handler_argument_numeric'
1688
-      ),
1689
-      'views_handler_field_boincwork_app_version_number' => array(
1688
+        ),
1689
+        'views_handler_field_boincwork_app_version_number' => array(
1690 1690
         'parent' => 'views_handler_field_numeric'
1691
-      ),
1692
-      'views_handler_field_boincwork_host_app_et_avg' => array(
1691
+        ),
1692
+        'views_handler_field_boincwork_host_app_et_avg' => array(
1693 1693
         'parent' => 'views_handler_field_numeric'
1694
-      ),
1695
-      'views_handler_field_boincwork_host_app_turnaround_avg' => array(
1694
+        ),
1695
+        'views_handler_field_boincwork_host_app_turnaround_avg' => array(
1696 1696
         'parent' => 'views_handler_field_numeric'
1697
-      ),
1697
+        ),
1698 1698
     )
1699
-  );
1699
+    );
1700 1700
 }
Please login to merge, or discard this patch.
drupal/sites/default/settings.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
  */
115 115
 require_once('dbconfig.php');
116 116
 if (!isset($dbserver) || empty($dbserver))
117
-  $dbserver='localhost';
117
+    $dbserver='localhost';
118 118
 $db_url = array(
119
-  'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}",
120
-  'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}"
119
+    'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}",
120
+    'boinc_rw' => "{$boinc_rw_dbtype}://{$boinc_rw_dbuser}:".urlencode($boinc_rw_dbpass)."@{$boinc_rw_dbserver}/{$boinc_rw_dbname}"
121 121
 );
122 122
 $db_prefix = '';
123 123
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 // 'boinc_rw' entry as 'boinc_ro'.
126 126
 
127 127
 if (isset($boinc_ro_dbtype) && isset($boinc_ro_dbuser) && isset($boinc_ro_dbpass) && isset($boinc_ro_dbserver) && isset($boinc_ro_dbname)) {
128
-  $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}";
128
+    $db_url['boinc_ro'] = "{$boinc_ro_dbtype}://{$boinc_ro_dbuser}:".urlencode($boinc_ro_dbpass)."@{$boinc_ro_dbserver}/{$boinc_ro_dbname}";
129 129
 }
130 130
 else {
131
-  $db_url['boinc_ro'] = $db_url['boinc_rw'];
131
+    $db_url['boinc_ro'] = $db_url['boinc_rw'];
132 132
 }
133 133
 
134 134
 /**
@@ -216,5 +216,5 @@  discard block
 block discarded – undo
216 216
  */
217 217
 
218 218
 if (stream_resolve_include_path('settings.local.php')) {
219
-  include 'settings.local.php';
219
+    include 'settings.local.php';
220 220
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincuser/boincuser.views.inc 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -13,255 +13,255 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function boincuser_views_data() {
15 15
   
16
-  // -----------------------------------------------------------------------------------------------
17
-  // Definition for user table
18
-  // -----------------------------------------------------------------------------------------------
16
+    // -----------------------------------------------------------------------------------------------
17
+    // Definition for user table
18
+    // -----------------------------------------------------------------------------------------------
19 19
   
20
-  $data['user']['table']['group'] = t('BOINC');
20
+    $data['user']['table']['group'] = t('BOINC');
21 21
   
22
-  $data['user']['table']['base'] = array(
23
-      'field' => 'id',
24
-      'title' => t('BOINC user'),
25
-      'help' => t('BOINC account data for a user'),
26
-      'database' => 'boinc_ro'
27
-  );
22
+    $data['user']['table']['base'] = array(
23
+        'field' => 'id',
24
+        'title' => t('BOINC user'),
25
+        'help' => t('BOINC account data for a user'),
26
+        'database' => 'boinc_ro'
27
+    );
28 28
 
29
-  // Describe each of the individual fields in this table to Views. For
30
-  // each field, you may define what field, sort, argument, and/or filter
31
-  // handlers it supports. This will determine where in the Views interface you
32
-  // may use the field.
29
+    // Describe each of the individual fields in this table to Views. For
30
+    // each field, you may define what field, sort, argument, and/or filter
31
+    // handlers it supports. This will determine where in the Views interface you
32
+    // may use the field.
33 33
   
34
-  // Primary keys allowed as arguments
34
+    // Primary keys allowed as arguments
35 35
   
36
-  $data['user']['id'] = array(
36
+    $data['user']['id'] = array(
37 37
     'title' => bts('Id', array(), NULL, 'boinc:user-id'),
38 38
     'help' => t('The BOINC ID of the user account.'),
39 39
     'field' => array(
40
-      'handler' => 'views_handler_field_numeric',
41
-      'click sortable' => TRUE
40
+        'handler' => 'views_handler_field_numeric',
41
+        'click sortable' => TRUE
42 42
     ),
43 43
     'argument' => array(
44
-      'handler' => 'views_handler_argument_boincuser_id', // custom handler
45
-      'name field' => 'title', // the field to display in the summary.
46
-      'numeric' => TRUE,
47
-      'validate type' => 'id'
44
+        'handler' => 'views_handler_argument_boincuser_id', // custom handler
45
+        'name field' => 'title', // the field to display in the summary.
46
+        'numeric' => TRUE,
47
+        'validate type' => 'id'
48 48
     ),
49 49
     'filter' => array(
50
-      'handler' => 'views_handler_filter_numeric'
50
+        'handler' => 'views_handler_filter_numeric'
51 51
     ),
52 52
     'sort' => array(
53
-      'handler' => 'views_handler_sort_numeric'
53
+        'handler' => 'views_handler_sort_numeric'
54 54
     )
55
-  );
56
-  $data['user']['teamid'] = array(
55
+    );
56
+    $data['user']['teamid'] = array(
57 57
     'title' => bts('Team ID', array(), NULL, 'boinc:team-id'),
58 58
     'help' => t('The ID of the user\'s team.'),
59 59
     'field' => array(
60
-      'handler' => 'views_handler_field_numeric',
61
-      'click sortable' => TRUE,
60
+        'handler' => 'views_handler_field_numeric',
61
+        'click sortable' => TRUE,
62 62
     ),
63 63
     'argument' => array(
64
-      'handler' => 'views_handler_argument_boincteam_id', // custom handler
65
-      'name field' => 'title', // the field to display in the summary.
66
-      'numeric' => TRUE,
67
-      'validate type' => 'id'
64
+        'handler' => 'views_handler_argument_boincteam_id', // custom handler
65
+        'name field' => 'title', // the field to display in the summary.
66
+        'numeric' => TRUE,
67
+        'validate type' => 'id'
68 68
     ),
69 69
     'filter' => array(
70
-      'handler' => 'views_handler_filter_numeric'
70
+        'handler' => 'views_handler_filter_numeric'
71 71
     ),
72 72
     'sort' => array(
73
-      'handler' => 'views_handler_sort_numeric'
73
+        'handler' => 'views_handler_sort_numeric'
74 74
     )
75
-  );
75
+    );
76 76
   
77
-  // Descriptions of general host fields (alphabetized)
77
+    // Descriptions of general host fields (alphabetized)
78 78
   
79
-  $data['user']['authenticator'] = array(
79
+    $data['user']['authenticator'] = array(
80 80
     'title' => bts('Account Key', array(), NULL, 'boinc:user-info'),
81 81
     'help' => t('The BOINC account key of the user.'),
82 82
     'field' => array(
83
-      'handler' => 'views_handler_field',
84
-      'click sortable' => TRUE
83
+        'handler' => 'views_handler_field',
84
+        'click sortable' => TRUE
85 85
     ),
86 86
     'filter' => array(
87
-      'handler' => 'views_handler_filter_string'
87
+        'handler' => 'views_handler_filter_string'
88 88
     ),
89 89
     'sort' => array(
90
-      'handler' => 'views_handler_sort_string'
90
+        'handler' => 'views_handler_sort_string'
91 91
     )
92
-  );
93
-  $data['user']['country'] = array(
92
+    );
93
+    $data['user']['country'] = array(
94 94
     'title' => bts('Country', array(), NULL, 'boinc:country-of-origin'),
95 95
     'help' => t('The country of the user.'),
96 96
     'field' => array(
97
-      'handler' => 'views_handler_field',
98
-      'click sortable' => TRUE
97
+        'handler' => 'views_handler_field',
98
+        'click sortable' => TRUE
99 99
     ),
100 100
     'filter' => array(
101
-      'handler' => 'views_handler_filter_string'
101
+        'handler' => 'views_handler_filter_string'
102 102
     ),
103 103
     'sort' => array(
104
-      'handler' => 'views_handler_sort_string'
104
+        'handler' => 'views_handler_sort_string'
105 105
     )
106
-  );
107
-  $data['user']['create_time'] = array(
106
+    );
107
+    $data['user']['create_time'] = array(
108 108
     'title' => bts('Member since', array(), NULL, 'boinc:user-info'),
109 109
     'help' => t('When the BOINC account was created.'),
110 110
     'field' => array(
111
-      'handler' => 'views_handler_field_date',
112
-      'click sortable' => TRUE
111
+        'handler' => 'views_handler_field_date',
112
+        'click sortable' => TRUE
113 113
     ),
114 114
     'filter' => array(
115
-      'handler' => 'views_handler_filter_date'
115
+        'handler' => 'views_handler_filter_date'
116 116
     ),
117 117
     'sort' => array(
118
-      'handler' => 'views_handler_sort_date'
118
+        'handler' => 'views_handler_sort_date'
119 119
     )
120
-  );
121
-  $data['user']['cross_project_id'] = array(
120
+    );
121
+    $data['user']['cross_project_id'] = array(
122 122
     'title' => bts('CPID', array(), NULL, 'boinc:user-info'),
123 123
     'help' => t('The cross project user identifier.'),
124 124
     'field' => array(
125
-      'handler' => 'views_handler_field',
126
-      'click sortable' => TRUE
125
+        'handler' => 'views_handler_field',
126
+        'click sortable' => TRUE
127 127
     ),
128 128
     'filter' => array(
129
-      'handler' => 'views_handler_filter_string'
129
+        'handler' => 'views_handler_filter_string'
130 130
     ),
131 131
     'sort' => array(
132
-      'handler' => 'views_handler_sort_string'
132
+        'handler' => 'views_handler_sort_string'
133 133
     )
134
-  );
135
-  $data['user']['email_addr'] = array(
136
-      'title' => bts('Email Address', array(), NULL, 'boinc:user-info'),
134
+    );
135
+    $data['user']['email_addr'] = array(
136
+        'title' => bts('Email Address', array(), NULL, 'boinc:user-info'),
137 137
     'help' => t('The BOINC account email address.'),
138 138
     'field' => array(
139
-      'handler' => 'views_handler_field',
140
-      'click sortable' => TRUE
139
+        'handler' => 'views_handler_field',
140
+        'click sortable' => TRUE
141 141
     ),
142 142
     'filter' => array(
143
-      'handler' => 'views_handler_filter_string'
143
+        'handler' => 'views_handler_filter_string'
144 144
     ),
145 145
     'sort' => array(
146
-      'handler' => 'views_handler_sort_string'
146
+        'handler' => 'views_handler_sort_string'
147 147
     )
148
-  );
149
-  $data['user']['expavg_credit'] = array(
148
+    );
149
+    $data['user']['expavg_credit'] = array(
150 150
     'title' => bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC'),
151 151
     'help' => t('A decaying average of credit per day for the user.'),
152 152
     'field' => array(
153
-      'handler' => 'views_handler_field_numeric',
154
-      'click sortable' => TRUE,
155
-      'float' => TRUE
153
+        'handler' => 'views_handler_field_numeric',
154
+        'click sortable' => TRUE,
155
+        'float' => TRUE
156 156
     ),
157 157
     'filter' => array(
158
-      'handler' => 'views_handler_filter_numeric'
158
+        'handler' => 'views_handler_filter_numeric'
159 159
     ),
160 160
     'sort' => array(
161
-      'handler' => 'views_handler_sort_numeric'
161
+        'handler' => 'views_handler_sort_numeric'
162 162
     )
163
-  );
164
-  $data['user']['name'] = array(
163
+    );
164
+    $data['user']['name'] = array(
165 165
     'title' => bts('Name', array(), NULL, 'boinc:user-or-team-name'),
166 166
     'help' => t('The BOINC account user name.'),
167 167
     'field' => array(
168
-      'handler' => 'views_handler_field',
169
-      'click sortable' => TRUE
168
+        'handler' => 'views_handler_field',
169
+        'click sortable' => TRUE
170 170
     ),
171 171
     'filter' => array(
172
-      'handler' => 'views_handler_filter_string'
172
+        'handler' => 'views_handler_filter_string'
173 173
     ),
174 174
     'sort' => array(
175
-      'handler' => 'views_handler_sort_string'
175
+        'handler' => 'views_handler_sort_string'
176 176
     )                           
177
-  );
178
-  $data['user']['passwd_hash'] = array(
177
+    );
178
+    $data['user']['passwd_hash'] = array(
179 179
     'title' => bts('Password Hash', array(), NULL, 'boinc:user-info'),
180 180
     'help' => t('The user password hash'),
181 181
     'field' => array(
182
-      'handler' => 'views_handler_field',
183
-      'click sortable' => TRUE
182
+        'handler' => 'views_handler_field',
183
+        'click sortable' => TRUE
184 184
     ),
185 185
     'filter' => array(
186
-      'handler' => 'views_handler_filter_string'
186
+        'handler' => 'views_handler_filter_string'
187 187
     ),
188 188
     'sort' => array(
189
-      'handler' => 'views_handler_sort_string'
189
+        'handler' => 'views_handler_sort_string'
190 190
     )
191
-  );
192
-  $data['user']['postal_code'] = array(
191
+    );
192
+    $data['user']['postal_code'] = array(
193 193
     'title' => bts('Postal Code', array(), NULL, 'boinc:user-info'),
194 194
     'help' => t('The postal code of the user.'),
195 195
     'field' => array(
196
-      'handler' => 'views_handler_field',
197
-      'click sortable' => TRUE
196
+        'handler' => 'views_handler_field',
197
+        'click sortable' => TRUE
198 198
     ),
199 199
     'filter' => array(
200
-      'handler' => 'views_handler_filter_string'
200
+        'handler' => 'views_handler_filter_string'
201 201
     ),
202 202
     'sort' => array(
203
-      'handler' => 'views_handler_sort_string'
203
+        'handler' => 'views_handler_sort_string'
204 204
     )
205
-  );
206
-  $data['user']['send_email'] = array(
205
+    );
206
+    $data['user']['send_email'] = array(
207 207
     'title' => bts('Send Email', array(), NULL, 'boinc:user-info'),
208 208
     'help' => t('User preference to allow email communications.'),
209 209
     'field' => array(
210
-      'handler' => 'views_handler_field_numeric',
211
-      'click sortable' => TRUE
210
+        'handler' => 'views_handler_field_numeric',
211
+        'click sortable' => TRUE
212 212
     ),
213 213
     'filter' => array(
214
-      'handler' => 'views_handler_filter_numeric'
214
+        'handler' => 'views_handler_filter_numeric'
215 215
     ),
216 216
     'sort' => array(
217
-      'handler' => 'views_handler_sort_numeric'
217
+        'handler' => 'views_handler_sort_numeric'
218 218
     )
219
-  );
220
-  $data['user']['show_hosts'] = array(
219
+    );
220
+    $data['user']['show_hosts'] = array(
221 221
     'title' => bts('Show Hosts', array(), NULL, 'boinc:user-info'),
222 222
     'help' => t('User preference to display owned computers.'),
223 223
     'field' => array(
224
-      'handler' => 'views_handler_field_numeric',
225
-      'click sortable' => TRUE
224
+        'handler' => 'views_handler_field_numeric',
225
+        'click sortable' => TRUE
226 226
     ),
227 227
     'filter' => array(
228
-      'handler' => 'views_handler_filter_numeric'
228
+        'handler' => 'views_handler_filter_numeric'
229 229
     ),
230 230
     'sort' => array(
231
-      'handler' => 'views_handler_sort_numeric'
231
+        'handler' => 'views_handler_sort_numeric'
232 232
     )
233
-  );
234
-  $data['user']['total_credit'] = array(
233
+    );
234
+    $data['user']['total_credit'] = array(
235 235
     'title' => bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits'),
236 236
     'help' => t('The total accumulated BOINC credit for the user.'),
237 237
     'field' => array(
238
-      'handler' => 'views_handler_field_numeric',
239
-      'click sortable' => TRUE,
240
-      'float' => TRUE
238
+        'handler' => 'views_handler_field_numeric',
239
+        'click sortable' => TRUE,
240
+        'float' => TRUE
241 241
     ),
242 242
     'filter' => array(
243
-      'handler' => 'views_handler_filter_numeric'
243
+        'handler' => 'views_handler_filter_numeric'
244 244
     ),
245 245
     'sort' => array(
246
-      'handler' => 'views_handler_sort_numeric'
246
+        'handler' => 'views_handler_sort_numeric'
247 247
     )
248
-  );
249
-  $data['user']['url'] = array(
248
+    );
249
+    $data['user']['url'] = array(
250 250
     'title' => bts('URL', array(), NULL, 'boinc:website-of-user-or-team'),
251 251
     'help' => t('The URL provided by the user'),
252 252
     'field' => array(
253
-      'handler' => 'views_handler_field',
254
-      'click sortable' => TRUE
253
+        'handler' => 'views_handler_field',
254
+        'click sortable' => TRUE
255 255
     ),
256 256
     'filter' => array(
257
-      'handler' => 'views_handler_filter_string'
257
+        'handler' => 'views_handler_filter_string'
258 258
     ),
259 259
     'sort' => array(
260
-      'handler' => 'views_handler_sort_string'
260
+        'handler' => 'views_handler_sort_string'
261 261
     )
262
-  );
262
+    );
263 263
   
264
-  return $data;
264
+    return $data;
265 265
 }
266 266
 
267 267
 /*
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
  */
273 273
 
274 274
 function boincuser_views_handlers() {
275
-  return array(
275
+    return array(
276 276
     'info' => array(
277
-      'path' => drupal_get_path('module', 'boincuser') . '/views',
277
+        'path' => drupal_get_path('module', 'boincuser') . '/views',
278 278
     ),
279 279
     'handlers' => array(
280
-      'views_handler_argument_boincuser_id' => array(
280
+        'views_handler_argument_boincuser_id' => array(
281 281
         'parent' => 'views_handler_argument_numeric'
282
-      ),
283
-      'views_handler_argument_boincteam_id' => array(
282
+        ),
283
+        'views_handler_argument_boincteam_id' => array(
284 284
         'parent' => 'views_handler_argument_numeric'
285
-      ),
285
+        ),
286 286
     )
287
-  );
287
+    );
288 288
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincteam/boincteam.admin.inc 1 patch
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -17,15 +17,15 @@  discard block
 block discarded – undo
17 17
  * Utility Form to delete teams suspected of being spammers.
18 18
  */
19 19
 function boincteam_utility_delete(&$form_state) {
20
-  $form = array();
20
+    $form = array();
21 21
 
22
-  $form['help'] = array(
22
+    $form['help'] = array(
23 23
     '#type' => 'fieldset',
24 24
     '#title' => t('Help'),
25 25
     '#collapsible' => TRUE,
26
-  );
26
+    );
27 27
 
28
-  $form['help']['text'] = array(
28
+    $form['help']['text'] = array(
29 29
     '#type' => 'item',
30 30
     '#description' => t('This utility page will help in identifying BOINC teams created by SPAMMERs which can be deleted. The search will find BOINC teams that meet the following criteria.
31 31
 <ul>
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
 <p> <i>How teams are deleted</i>: Select the teams to be deleted from the table below. Click "Delete Selected Teams" button to begin a batch operation to delete the teams. If you select teams, and then page through to another page of the table, your selections will be lost. I.e., only the teams select on the current page will be deleted.
39 39
 <p> The site must be offline/in maintenance mode before searching for and deleting teams. If not, the delete button below is disabled.
40 40
 '),
41
-  );
41
+    );
42 42
 
43
-  // This variable name has been changed for Drupal 7/8.
44
-  $maintenance_mode = variable_get('site_offline');
45
-  if (!$maintenance_mode) {
43
+    // This variable name has been changed for Drupal 7/8.
44
+    $maintenance_mode = variable_get('site_offline');
45
+    if (!$maintenance_mode) {
46 46
     drupal_set_message(t('WARNING: Site is online (not in maintenance mode)! Deleting teams is only allowed when site is offline. Change this setting in ') . l(t('Site maintenance'), '/admin/settings/site-maintenance'), 'warning');
47
-  }
47
+    }
48 48
 
49
-  $form['teamdelete'] = array(
49
+    $form['teamdelete'] = array(
50 50
     '#type' => 'fieldset',
51 51
     '#title' => t('Teams to delete'),
52
-  );
53
-  $form['teamdelete']['deleteall'] = array(
52
+    );
53
+    $form['teamdelete']['deleteall'] = array(
54 54
     '#type' => 'submit',
55 55
     '#disabled' => !($maintenance_mode),
56 56
     '#value' => t('Delete Selected Teams'),
@@ -58,101 +58,101 @@  discard block
 block discarded – undo
58 58
     '#attributes' => array(
59 59
         'onclick' => 'return confirm(\'' . t('You are about to delete the selected teams suspected of being SPAM. Do you want to continue?') . '\')',
60 60
     ),
61
-  );
62
-  $form['teamdelete']['results_table'] = array(
61
+    );
62
+    $form['teamdelete']['results_table'] = array(
63 63
     '#value' => drupal_get_form('boincteam_utility_team_table'),
64
-  );
64
+    );
65 65
 
66
-  return $form;
66
+    return $form;
67 67
 }
68 68
 
69 69
 function boincteam_utility_team_table() {
70 70
 
71
-  $limit=50;
72
-  $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'";
71
+    $limit=50;
72
+    $sql = "SELECT team.id AS id, team.name AS name, team.nusers AS nusers FROM {team} WHERE team.nusers<2 AND team.total_credit=0 AND team.seti_id=0 AND team.description REGEXP '<a href'";
73 73
 
74
-  // @todo - add bts() or t()
75
-  $resultheader = array(
74
+    // @todo - add bts() or t()
75
+    $resultheader = array(
76 76
     array(
77
-      'data' => 'Team ID',
78
-      'field' => 'id',
79
-      'sort' => 'asc',
77
+        'data' => 'Team ID',
78
+        'field' => 'id',
79
+        'sort' => 'asc',
80 80
     ),
81 81
     array(
82
-      'data' => 'Team Name',
83
-      'field' => 'name',
82
+        'data' => 'Team Name',
83
+        'field' => 'name',
84 84
     ),
85 85
     array(
86
-      'data' => 'Num Users',
87
-      'field' => 'nusers',
86
+        'data' => 'Num Users',
87
+        'field' => 'nusers',
88 88
     ),
89 89
     array(
90
-      'data' => 'Link to Team',
91
-      'field' => 'link',
90
+        'data' => 'Link to Team',
91
+        'field' => 'link',
92 92
     ),
93
-  );
93
+    );
94 94
 
95
-  $tablesort = tablesort_sql($resultheader);
96
-  db_set_active('boinc_rw');
97
-  $db_res = pager_query($sql . $tablesort, $limit);
98
-  db_set_active('default');
95
+    $tablesort = tablesort_sql($resultheader);
96
+    db_set_active('boinc_rw');
97
+    $db_res = pager_query($sql . $tablesort, $limit);
98
+    db_set_active('default');
99 99
 
100
-  $form = array();
101
-  $form['options'] = array();
102
-  $checkboxes = array();
103
-  if ($db_res) {
100
+    $form = array();
101
+    $form['options'] = array();
102
+    $checkboxes = array();
103
+    if ($db_res) {
104 104
     while ($result = db_fetch_object($db_res)) {
105
-      $drupalnid = boincteam_lookup_nid($result->id);
106
-      if ($drupalnid) {
105
+        $drupalnid = boincteam_lookup_nid($result->id);
106
+        if ($drupalnid) {
107 107
         $tlink = l($result->name, '/community/teams/' . $drupalnid);
108
-      }
109
-      else {
108
+        }
109
+        else {
110 110
         $tlink = '';
111
-      }
112
-      // only keys no values
113
-      $checkboxes[$result->id] = '';
111
+        }
112
+        // only keys no values
113
+        $checkboxes[$result->id] = '';
114 114
 
115
-      $form['id'][$result->id] = array(
115
+        $form['id'][$result->id] = array(
116 116
         '#value' => $result->id,
117
-      );
118
-      $form['name'][$result->id] = array(
117
+        );
118
+        $form['name'][$result->id] = array(
119 119
         '#value' => $result->name,
120
-      );
121
-      $form['nusers'][$result->id] = array(
120
+        );
121
+        $form['nusers'][$result->id] = array(
122 122
         '#value' => $result->nusers,
123
-      );
124
-      $form['link'][$result->id] = array(
123
+        );
124
+        $form['link'][$result->id] = array(
125 125
         '#value' => $tlink,
126
-      );
126
+        );
127 127
     }
128 128
 
129 129
     $form['checkboxes'] = array('#type' => 'checkboxes', '#options' => $checkboxes);
130 130
     $form['pager'] = array('#value' => theme('pager', NULL, $limit, 0));
131 131
 
132 132
     return $form;
133
-  }
134
-  return "<p>No teams matched the criteria for a SPAM team.</p>";
133
+    }
134
+    return "<p>No teams matched the criteria for a SPAM team.</p>";
135 135
 }
136 136
 
137 137
 /**
138 138
  * Submit handler - also creates the batch job to delete the teams.
139 139
  */
140 140
 function boincteam_utility_delete_team($form, &$form_state) {
141
-  $checkedteamids = $form_state['clicked_button']['#post']['checkboxes'];
142
-  // Use batch to delete teams
143
-  $operations = array();
144
-  foreach ($checkedteamids as $id) {
141
+    $checkedteamids = $form_state['clicked_button']['#post']['checkboxes'];
142
+    // Use batch to delete teams
143
+    $operations = array();
144
+    foreach ($checkedteamids as $id) {
145 145
     $operations[] = array('boincteam_utility_batch_process', array($id));
146
-  }
147
-  $batch = array(
146
+    }
147
+    $batch = array(
148 148
     'title' => t('Processing BOINC Teams'),
149 149
     'operations' => $operations,
150 150
     'init_message' => t('Starting team deletion'),
151 151
     'finished' => 'boincteam_utility_batch_finished',
152 152
     'file' => drupal_get_path('module', 'boincteam') . '/boincteam.admin.inc',
153
-  );
154
-  batch_set($batch);
155
-  //batch_process('/admin/boinc/utility-team-delete');
153
+    );
154
+    batch_set($batch);
155
+    //batch_process('/admin/boinc/utility-team-delete');
156 156
 }
157 157
 
158 158
 /*
@@ -163,37 +163,37 @@  discard block
 block discarded – undo
163 163
  *     Input form (table)
164 164
  */
165 165
 function theme_boincteam_utility_team_table($form) {
166
-  //define table header
167
-  $header = array(
166
+    //define table header
167
+    $header = array(
168 168
     theme('table_select_header_cell'), //using that previously empty field
169 169
     array('data' => t('Team ID'), 'field' => 'id', 'sort' => 'asc'),
170 170
     array('data' => t('Name'), 'field' => 'name'),
171 171
     array('data' => t('Num Users'), 'field' => 'nusers'),
172 172
     array('data' => t('Link to Team'), 'field' => 'link'),
173
-  );
174
-  $rows = array();
175
-  $output = "";
176
-  if(!empty($form['checkboxes']['#options'])) {
173
+    );
174
+    $rows = array();
175
+    $output = "";
176
+    if(!empty($form['checkboxes']['#options'])) {
177 177
     foreach (element_children($form['id']) as $key) {
178
-      $rows[] = array(
178
+        $rows[] = array(
179 179
         drupal_render($form['checkboxes'][$key]),
180 180
         drupal_render($form['id'][$key]),
181 181
         drupal_render($form['name'][$key]),
182 182
         drupal_render($form['nusers'][$key]),
183 183
         drupal_render($form['link'][$key]),
184
-      );
184
+        );
185
+    }
185 186
     }
186
-  }
187
-  else {
187
+    else {
188 188
     $rows[] = array(array('data' => '<div class="error">No teams found</div>', 'colspan' => 5));
189
-  }
190
-  $output .= theme('table', $header, $rows);
191
-  if ($form['pager']['#value']) {
189
+    }
190
+    $output .= theme('table', $header, $rows);
191
+    if ($form['pager']['#value']) {
192 192
     $output .= drupal_render($form['pager']);
193
-  }
193
+    }
194 194
 
195
-  $output .= drupal_render($form);
196
-  return $output;
195
+    $output .= drupal_render($form);
196
+    return $output;
197 197
 }
198 198
 
199 199
 /**
@@ -202,26 +202,26 @@  discard block
 block discarded – undo
202 202
  * table. It also removes the team's drupal page (node) if found.
203 203
  */
204 204
 function boincteam_utility_batch_process($id, &$context) {
205
-  $boincteam = boincteam_load($id);
206
-  $drupalid = boincteam_lookup_nid($id);
205
+    $boincteam = boincteam_load($id);
206
+    $drupalid = boincteam_lookup_nid($id);
207 207
 
208
-  // Delete entry in team table
209
-  db_set_active('boinc_rw');
210
-  $sql1='DELETE FROM {team} WHERE id=%d';
211
-  $db_res = db_query($sql1, $id);
212
-  db_set_active('default');
208
+    // Delete entry in team table
209
+    db_set_active('boinc_rw');
210
+    $sql1='DELETE FROM {team} WHERE id=%d';
211
+    $db_res = db_query($sql1, $id);
212
+    db_set_active('default');
213 213
 
214
-  // Delete entry in boincteam table
215
-  $sql2='DELETE FROM {boincteam} WHERE id=%d';
216
-  $db_res = db_query($sql2, $id);
214
+    // Delete entry in boincteam table
215
+    $sql2='DELETE FROM {boincteam} WHERE id=%d';
216
+    $db_res = db_query($sql2, $id);
217 217
 
218
-  // Delete the drupal node (if present)
219
-  if ($drupalid) {
218
+    // Delete the drupal node (if present)
219
+    if ($drupalid) {
220 220
     node_delete($drupalid);
221
-  }
221
+    }
222 222
 
223
-  $context['results'][] = $id . ' : ' . check_plain($boincteam->name);
224
-  $context['message'] = t('Processing team @name', array('@name' => $boincteam->name));
223
+    $context['results'][] = $id . ' : ' . check_plain($boincteam->name);
224
+    $context['message'] = t('Processing team @name', array('@name' => $boincteam->name));
225 225
 }
226 226
 
227 227
 /**
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
  * or failure.
230 230
  */
231 231
 function boincteam_utility_batch_finished($success, $results, $operations) {
232
-  if ($success) {
232
+    if ($success) {
233 233
     $message = 'Info: Delete SPAM Teams utility- ' . count($results) . ' team(s) deleted.';
234 234
     drupal_set_message($message, 'info');
235
-  }
236
-  else {
235
+    }
236
+    else {
237 237
     // An error occurred.
238 238
     // $operations contains the operations that remained unprocessed.
239 239
     $error_operation = reset($operations);
240 240
     $message = 'Error: An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
241 241
     drupal_set_message($message, 'error');
242
-  }
242
+    }
243 243
 }
244 244
\ No newline at end of file
Please login to merge, or discard this patch.
default/boinc/modules/boinctranslate/includes/boinctranslate.helpers.inc 1 patch
Indentation   +642 added lines, -642 removed lines patch added patch discarded remove patch
@@ -15,30 +15,30 @@  discard block
 block discarded – undo
15 15
  */
16 16
 function boinctranslate_initialize_languages() {
17 17
 
18
-  require_once(getcwd() . '/includes/locale.inc');
18
+    require_once(getcwd() . '/includes/locale.inc');
19 19
 
20
-  $api_base_url = 'https://www.transifex.com/api/2';
21
-  $project_name = variable_get(
20
+    $api_base_url = 'https://www.transifex.com/api/2';
21
+    $project_name = variable_get(
22 22
     'boinc_translate_transifex_project_name', ''
23
-  );
24
-  $operations = array();
23
+    );
24
+    $operations = array();
25 25
 
26
-  if ($project_name) {
26
+    if ($project_name) {
27 27
     // Get all languages configured for this project at Transifex
28 28
     $path = "project/{$project_name}/languages";
29 29
     $response = boinctranslate_transifex_request($path);
30 30
 
31 31
     if ($response == '404 NOT FOUND') {
32
-      drupal_set_message(
32
+        drupal_set_message(
33 33
         t('Unable to get languages for %project.',
34
-          array(
34
+            array(
35 35
             '%project' => $project_name,
36
-          )
36
+            )
37 37
         ), 'warning'
38
-      );
38
+        );
39 39
     }
40 40
     elseif ($response) {
41
-      if (is_array($response)) {
41
+        if (is_array($response)) {
42 42
 
43 43
         $installed_languages = language_list();
44 44
         $available_languages = _locale_get_predefined_list();
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 
49 49
         // Set up Transifex languages in Drupal
50 50
         foreach ($response as $language) {
51
-          $posix_code = $language['language_code'];
52
-          $rfc_code = strtolower(str_replace('_', '-', $posix_code));
53
-          $transifex_languages[$rfc_code] = $language;
54
-          if (!isset($installed_languages[$rfc_code])) {
51
+            $posix_code = $language['language_code'];
52
+            $rfc_code = strtolower(str_replace('_', '-', $posix_code));
53
+            $transifex_languages[$rfc_code] = $language;
54
+            if (!isset($installed_languages[$rfc_code])) {
55 55
             // See if this language can be installed from a predefined list
56 56
             if (isset($available_languages[$rfc_code])) {
57
-              locale_add_language(
57
+                locale_add_language(
58 58
                 $rfc_code,
59 59
                 NULL,
60 60
                 NULL,
@@ -62,30 +62,30 @@  discard block
 block discarded – undo
62 62
                 NULL,
63 63
                 NULL,
64 64
                 FALSE
65
-              );
66
-              drupal_set_message(
65
+                );
66
+                drupal_set_message(
67 67
                 'Added predefined language: '.$available_languages[$rfc_code][0]
68
-              );
69
-              db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code);
68
+                );
69
+                db_query("UPDATE {languages} SET enabled = 1 WHERE language = '%s'", $rfc_code);
70 70
             }
71 71
             else {
72
-              // Retrieve language details from Transifex
73
-              $path = "language/{$posix_code}";
74
-              $response = boinctranslate_transifex_request($path);
72
+                // Retrieve language details from Transifex
73
+                $path = "language/{$posix_code}";
74
+                $response = boinctranslate_transifex_request($path);
75 75
 
76
-              if ($response == '404 NOT FOUND') {
76
+                if ($response == '404 NOT FOUND') {
77 77
                 drupal_set_message(
78
-                  t('Unable to get details for language %code.',
78
+                    t('Unable to get details for language %code.',
79 79
                     array(
80
-                      '%code' => $posix_code,
80
+                        '%code' => $posix_code,
81 81
                     )
82
-                  ), 'warning'
82
+                    ), 'warning'
83 83
                 );
84
-              }
85
-              elseif ($response) {
84
+                }
85
+                elseif ($response) {
86 86
                 if (!empty($response['name'])) {
87
-                  // Add a custom language to Drupal and enable
88
-                  locale_add_language(
87
+                    // Add a custom language to Drupal and enable
88
+                    locale_add_language(
89 89
                     $rfc_code,
90 90
                     $response['name'],
91 91
                     $response['name'],
@@ -93,362 +93,362 @@  discard block
 block discarded – undo
93 93
                     NULL,
94 94
                     NULL,
95 95
                     TRUE
96
-                  );
97
-                  drupal_set_message(
96
+                    );
97
+                    drupal_set_message(
98 98
                     'Added new language: '.$response['name']
99
-                  );
99
+                    );
100 100
                 }
101 101
                 else {
102
-                  $variables = array(
102
+                    $variables = array(
103 103
                     '%code' => $posix_code,
104
-                  );
105
-                  drupal_set_message(
104
+                    );
105
+                    drupal_set_message(
106 106
                     t('Unable to get details for language %code.', $variables),
107 107
                     'error'
108
-                  );
109
-                  watchdog(
108
+                    );
109
+                    watchdog(
110 110
                     'boinctranslate',
111 111
                     'Unable to get details for language %code.',
112 112
                     $variables,
113 113
                     WATCHDOG_ERROR
114
-                  );
114
+                    );
115
+                }
115 116
                 }
116
-              }
117
-              else {
118
-               $variables = array(
119
-                  '%code' => $posix_code,
117
+                else {
118
+                $variables = array(
119
+                    '%code' => $posix_code,
120 120
                 );
121 121
                 drupal_set_message(
122
-                  t('Invalid response while getting details for language %code.', $variables),
123
-                  'error'
122
+                    t('Invalid response while getting details for language %code.', $variables),
123
+                    'error'
124 124
                 );
125 125
                 watchdog(
126
-                  'boinctranslate',
127
-                  'Invalid response while getting details for language %code.',
128
-                  $variables,
129
-                  WATCHDOG_ERROR
126
+                    'boinctranslate',
127
+                    'Invalid response while getting details for language %code.',
128
+                    $variables,
129
+                    WATCHDOG_ERROR
130 130
                 );
131
-              }
131
+                }
132 132
             }
133 133
             // Import any language files for the newly added language
134 134
             if ($batch = locale_batch_by_language($rfc_code, '_locale_batch_language_finished')) {
135
-              $operations = array_merge($operations, $batch['operations']);
136
-              $process_batches = TRUE;
135
+                $operations = array_merge($operations, $batch['operations']);
136
+                $process_batches = TRUE;
137
+            }
137 138
             }
138
-          }
139 139
         }
140 140
         drupal_set_message('Finished installing official BOINC languages.');
141 141
         // Disable languages that are not in Transifex
142 142
         foreach ($installed_languages as $langcode => $language) {
143
-          if (!isset($transifex_languages[$langcode])) {
143
+            if (!isset($transifex_languages[$langcode])) {
144 144
             $disabled_languages[$langcode] = $langcode;
145 145
             db_query("UPDATE {languages} SET enabled = 0 WHERE language = '%s'", $langcode);
146
-          }
146
+            }
147 147
         }
148 148
         if ($disabled_languages) {
149
-          drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages));
149
+            drupal_set_message('The following languages were not found in Transifex and were disabled: ' . implode(' ', $disabled_languages));
150 150
         }
151 151
         if ($process_batches) {
152
-          $batch = array(
152
+            $batch = array(
153 153
             'operations' => $operations,
154
-          );
155
-          batch_set($batch);
156
-          batch_process('admin/boinc/translation');
154
+            );
155
+            batch_set($batch);
156
+            batch_process('admin/boinc/translation');
157
+        }
157 158
         }
158
-      }
159
-      else {
159
+        else {
160 160
         $variables = array(
161
-          '%project' => $project_name,
161
+            '%project' => $project_name,
162 162
         );
163 163
         drupal_set_message(
164
-          t('No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', $variables),
165
-          'error'
164
+            t('No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)', $variables),
165
+            'error'
166 166
         );
167 167
         watchdog(
168
-          'boinctranslate',
169
-          'No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)',
170
-          $variables,
171
-          WATCHDOG_ERROR
168
+            'boinctranslate',
169
+            'No languages found for %project. (Does the configured account have sufficient privileges at Transifex?)',
170
+            $variables,
171
+            WATCHDOG_ERROR
172 172
         );
173
-      }
173
+        }
174 174
     }
175 175
     else {
176
-     $variables = array(
176
+        $variables = array(
177 177
         '%project' => $project_name,
178
-      );
179
-      drupal_set_message(
178
+        );
179
+        drupal_set_message(
180 180
         t('Invalid response while getting languages for %project.', $variables),
181 181
         'error'
182
-      );
183
-      watchdog(
182
+        );
183
+        watchdog(
184 184
         'boinctranslate',
185 185
         'Invalid response while getting languages for %project.',
186 186
         $variables,
187 187
         WATCHDOG_ERROR
188
-      );
188
+        );
189 189
     }
190
-  }
191
-  drupal_goto('admin/boinc/translation');
190
+    }
191
+    drupal_goto('admin/boinc/translation');
192 192
 }
193 193
 
194 194
 /**
195 195
  *
196 196
  */
197 197
 function boinctranslate_export_translations() {
198
-  require_once(getcwd() . '/includes/locale.inc');
199
-  $project_name = variable_get(
198
+    require_once(getcwd() . '/includes/locale.inc');
199
+    $project_name = variable_get(
200 200
     'boinc_translate_transifex_project_name', ''
201
-  );
202
-  // Get resource names from local config
203
-  $resource_config = (variable_get(
201
+    );
202
+    // Get resource names from local config
203
+    $resource_config = (variable_get(
204 204
     'boinc_translate_transifex_project_resources', ''
205
-  ));
206
-  $resource_names = boinctranslate_parse_resources($resource_config);
207
-  $primary_resource = reset($resource_names);
205
+    ));
206
+    $resource_names = boinctranslate_parse_resources($resource_config);
207
+    $primary_resource = reset($resource_names);
208 208
 
209
-  if ($project_name AND $primary_resource) {
209
+    if ($project_name AND $primary_resource) {
210 210
     // Create or update the translation source, if needed
211 211
     $source_exists = FALSE;
212 212
     $path = "project/{$project_name}/resources";
213 213
     $resources = boinctranslate_transifex_request($path);
214 214
     if ($resources AND is_array($resources)) {
215
-      foreach ($resources as $resource) {
215
+        foreach ($resources as $resource) {
216 216
         if ($resource['slug'] == $primary_resource) {
217
-          $source_exists = TRUE;
218
-          break;
217
+            $source_exists = TRUE;
218
+            break;
219 219
         }
220
-      }
221
-      if (!$source_exists) {
220
+        }
221
+        if (!$source_exists) {
222 222
         // Create the source
223 223
         $path = "project/{$project_name}/resources";
224 224
         $post = array(
225
-          'slug' => $primary_resource,
226
-          'name' => 'Drupal-Project',
227
-          'i18n_type' => 'PO',
228
-          'category' => 'Drupal',
229
-          'content' => boinctranslate_get_po('en', 'project'),
225
+            'slug' => $primary_resource,
226
+            'name' => 'Drupal-Project',
227
+            'i18n_type' => 'PO',
228
+            'category' => 'Drupal',
229
+            'content' => boinctranslate_get_po('en', 'project'),
230 230
         );
231 231
         $result = boinctranslate_transifex_request($path, $post);
232
-      }
233
-      else {
232
+        }
233
+        else {
234 234
         // Update the source
235 235
         $path = "project/{$project_name}/resource/{$primary_resource}/content";
236 236
         $post = array(
237
-          'content' => boinctranslate_get_po('en', 'project')
237
+            'content' => boinctranslate_get_po('en', 'project')
238 238
         );
239 239
         $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
240
-      }
240
+        }
241 241
     }
242 242
 
243 243
     if (is_array($result) OR substr($result, 0, 6) != 'ERROR:') {
244
-      $enabled_languages = locale_language_list();
245
-      if ($source_exists) {
244
+        $enabled_languages = locale_language_list();
245
+        if ($source_exists) {
246 246
         drupal_set_message('Updated source translation strings at Transifex');
247
-      }
248
-      else {
247
+        }
248
+        else {
249 249
         drupal_set_message('Established new translation resource at Transifex');
250
-      }
251
-      // Try to export translations for all enabled languages
252
-      foreach ($enabled_languages as $langcode => $language_name) {
250
+        }
251
+        // Try to export translations for all enabled languages
252
+        foreach ($enabled_languages as $langcode => $language_name) {
253 253
         if ($langcode == 'en') {
254
-          continue;
254
+            continue;
255 255
         }
256 256
         $po_file = boinctranslate_get_po($langcode, 'project');
257 257
         if ($po_file) {
258
-          $path = "project/{$project_name}/resource/{$primary_resource}/translation/{$langcode}";
259
-          $post = array(
258
+            $path = "project/{$project_name}/resource/{$primary_resource}/translation/{$langcode}";
259
+            $post = array(
260 260
             'content' => $po_file,
261
-          );
262
-          $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
263
-          if (!is_array($result)
261
+            );
262
+            $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
263
+            if (!is_array($result)
264 264
           AND substr($result, 0, 6) == 'ERROR:') {
265 265
             drupal_set_message(
266
-              "Unable to update {$language_name} translations: {$result}",
267
-              'warning'
266
+                "Unable to update {$language_name} translations: {$result}",
267
+                'warning'
268 268
             );
269
-          }
270
-          else {
269
+            }
270
+            else {
271 271
             drupal_set_message("Updated {$language_name} translations");
272 272
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
273
-          }
273
+            }
274 274
         }
275 275
         else {
276
-          drupal_set_message("No translations to export for {$language_name}");
276
+            drupal_set_message("No translations to export for {$language_name}");
277
+        }
277 278
         }
278
-      }
279 279
     }
280 280
     else {
281
-      drupal_set_message(
281
+        drupal_set_message(
282 282
         "Unable to update the translation source: {$result}",
283 283
         'warning'
284
-      );
284
+        );
285 285
     }
286
-  }
287
-  else {
286
+    }
287
+    else {
288 288
     drupal_set_message(
289
-      'Failed to export translations: Transifex settings are not intiailized.',
290
-      'error'
289
+        'Failed to export translations: Transifex settings are not intiailized.',
290
+        'error'
291 291
     );
292
-  }
293
-  drupal_goto('admin/boinc/translation');
292
+    }
293
+    drupal_goto('admin/boinc/translation');
294 294
 }
295 295
 
296 296
 /**
297 297
  *
298 298
  */
299 299
 function boinctranslate_update_official_boinc_translations() {
300
-  require_once(getcwd() . '/includes/locale.inc');
301
-  $project_name = variable_get(
300
+    require_once(getcwd() . '/includes/locale.inc');
301
+    $project_name = variable_get(
302 302
     'boinc_translate_transifex_standard_name', ''
303
-  );
304
-  $drupal_resource = variable_get(
303
+    );
304
+    $drupal_resource = variable_get(
305 305
     'boinc_translate_transifex_boinc_drupal_resource', ''
306
-  );
306
+    );
307 307
 
308
-  if ($project_name AND $drupal_resource) {
308
+    if ($project_name AND $drupal_resource) {
309 309
     // Create or update the translation source, if needed
310 310
     $source_exists = FALSE;
311 311
     $path = "project/{$project_name}/resources";
312 312
     $resources = boinctranslate_transifex_request($path);
313 313
     if ($resources AND is_array($resources)) {
314
-      foreach ($resources as $resource) {
314
+        foreach ($resources as $resource) {
315 315
         if ($resource['slug'] == $drupal_resource) {
316
-          $source_exists = TRUE;
317
-          break;
316
+            $source_exists = TRUE;
317
+            break;
318
+        }
318 319
         }
319
-      }
320 320
     }
321 321
 
322 322
     if ($source_exists) {
323
-      $enabled_languages = locale_language_list();
324
-      // Try to export translations for all enabled languages
325
-      foreach ($enabled_languages as $langcode => $language_name) {
323
+        $enabled_languages = locale_language_list();
324
+        // Try to export translations for all enabled languages
325
+        foreach ($enabled_languages as $langcode => $language_name) {
326 326
         if ($langcode == 'en') {
327
-          continue;
327
+            continue;
328 328
         }
329 329
         $po_file = boinctranslate_get_po($langcode, 'boinc');
330 330
         if ($po_file) {
331
-          $path = "project/{$project_name}/resource/{$drupal_resource}/translation/{$langcode}";
332
-          $post = array(
331
+            $path = "project/{$project_name}/resource/{$drupal_resource}/translation/{$langcode}";
332
+            $post = array(
333 333
             'content' => $po_file,
334
-          );
335
-          $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
334
+            );
335
+            $result = boinctranslate_transifex_request($path, $post, TRUE, TRUE);
336 336
 
337
-          if (!is_array($result)) {
337
+            if (!is_array($result)) {
338 338
             if (substr($result, 0, 6) == 'ERROR:') {
339
-              drupal_set_message(
339
+                drupal_set_message(
340 340
                 "Unable to update {$language_name} official BOINC translations: {$result}",
341 341
                 'warning'
342
-              );
342
+                );
343 343
             }
344 344
             elseif ($result == '401 UNAUTHORIZED') {
345
-              drupal_set_message(
345
+                drupal_set_message(
346 346
                 'Not authorized to update official BOINC translations',
347 347
                 'warning'
348
-              );
349
-              break;
348
+                );
349
+                break;
350 350
             }
351 351
             elseif ($result == 'success') {
352
-              drupal_set_message("Updated {$language_name} official BOINC translations");
352
+                drupal_set_message("Updated {$language_name} official BOINC translations");
353 353
             }
354 354
             else {
355
-              drupal_set_message(
355
+                drupal_set_message(
356 356
                 "Unexpected response for {$language_name}: {$result}",
357 357
                 'warning'
358
-              );
358
+                );
359 359
             }
360
-          }
361
-          else {
360
+            }
361
+            else {
362 362
             drupal_set_message("Updated {$language_name} official BOINC translations");
363 363
             //drupal_set_message('DEBUG: <pre>'.print_r($result,1).'</pre>');
364
-          }
364
+            }
365 365
         }
366 366
         else {
367
-          drupal_set_message("No official BOINC translations to export for {$language_name}");
367
+            drupal_set_message("No official BOINC translations to export for {$language_name}");
368
+        }
368 369
         }
369
-      }
370 370
     }
371 371
     else {
372
-      drupal_set_message(
372
+        drupal_set_message(
373 373
         "The {$drupal_resource} resource does not exist in the {$project_name} project at Transifex",
374 374
         'warning'
375
-      );
375
+        );
376 376
     }
377
-  }
378
-  else {
377
+    }
378
+    else {
379 379
     drupal_set_message(
380
-      'Failed to export official BOINC translations: Transifex settings are not intiailized.',
381
-      'error'
380
+        'Failed to export official BOINC translations: Transifex settings are not intiailized.',
381
+        'error'
382 382
     );
383
-  }
384
-  drupal_goto('admin/boinc/translation');
383
+    }
384
+    drupal_goto('admin/boinc/translation');
385 385
 }
386 386
 
387 387
 /**
388 388
  *
389 389
  */
390 390
 function boinctranslate_download_pot($type = 'boinc') {
391
-  $po = boinctranslate_get_po(NULL, $type);
392
-  _locale_export_po(NULL, $po);
391
+    $po = boinctranslate_get_po(NULL, $type);
392
+    _locale_export_po(NULL, $po);
393 393
 }
394 394
 
395 395
 /**
396 396
  *
397 397
  */
398 398
 function boinctranslate_transifex_request($path, $post = NULL, $json = TRUE, $use_put = FALSE, $username = '', $password = '') {
399
-  $debug_mode = variable_get('boinc_debug_mode', 0);
399
+    $debug_mode = variable_get('boinc_debug_mode', 0);
400 400
 
401
-  // Transifex details
402
-  $api_base_url = 'https://www.transifex.com/api/2';
403
-  if (!$username) $username = variable_get('boinc_translate_transifex_user', '');
404
-  if (!$password) $password = variable_get('boinc_translate_transifex_pass', '');
401
+    // Transifex details
402
+    $api_base_url = 'https://www.transifex.com/api/2';
403
+    if (!$username) $username = variable_get('boinc_translate_transifex_user', '');
404
+    if (!$password) $password = variable_get('boinc_translate_transifex_pass', '');
405 405
 
406
-  $url = "{$api_base_url}/{$path}";
407
-  $headers = array(
406
+    $url = "{$api_base_url}/{$path}";
407
+    $headers = array(
408 408
     'Authorization' => 'Basic ' . base64_encode($username . ":" . $password),
409
-  );
410
-  $data = NULL;
409
+    );
410
+    $data = NULL;
411 411
 
412
-  if ($post) {
412
+    if ($post) {
413 413
     if ($json) {
414
-      $headers['Content-Type'] = 'application/json';
415
-      $data = json_encode($post);
414
+        $headers['Content-Type'] = 'application/json';
415
+        $data = json_encode($post);
416 416
     }
417 417
     else {
418
-      $data = drupal_query_string_encode($post);
418
+        $data = drupal_query_string_encode($post);
419 419
     }
420 420
     $method = ($use_put) ? 'PUT' : 'POST';
421
-  }
422
-  else {
421
+    }
422
+    else {
423 423
     $method = 'GET';
424
-  }
424
+    }
425 425
 
426
-  $response = drupal_http_request($url, $headers, $method, $data, 1, 10);
426
+    $response = drupal_http_request($url, $headers, $method, $data, 1, 10);
427 427
 
428
-  switch ($response->code) {
429
-  case 200:
428
+    switch ($response->code) {
429
+    case 200:
430 430
   case 304:
431 431
     if ($json) {
432
-      // Process as JSON
433
-      return json_decode($response->data, TRUE);
432
+        // Process as JSON
433
+        return json_decode($response->data, TRUE);
434 434
     }
435 435
     else {
436
-      return (string) $response->data;
436
+        return (string) $response->data;
437 437
     }
438 438
     break;
439
-  case 404:
439
+    case 404:
440 440
     return '404 NOT FOUND';
441
-  case 401:
441
+    case 401:
442 442
     return '401 UNAUTHORIZED';
443
-  case 400:
443
+    case 400:
444 444
     if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING);
445 445
     return "ERROR: {$response->data}";
446
-  case 405:
446
+    case 405:
447 447
     if ($debug_mode) watchdog('boinctranslate', "The following response was received when trying to communicate with the Transifex system: \n{$response}", array(), WATCHDOG_WARNING);
448 448
     return "ERROR: User not allowed to perform this action";
449
-  }
449
+    }
450 450
 
451
-  return NULL;
451
+    return NULL;
452 452
 }
453 453
 
454 454
 /**
@@ -456,58 +456,58 @@  discard block
 block discarded – undo
456 456
  */
457 457
 function boinctranslate_get_po($langcode, $type = 'standard') {
458 458
 
459
-  require_once(getcwd() . '/includes/locale.inc');
459
+    require_once(getcwd() . '/includes/locale.inc');
460 460
 
461
-  $all_languages = language_list();
462
-  $language = $langcode ? $all_languages[$langcode] : NULL;
463
-  $textgroups = array();
464
-  $strings = array();
461
+    $all_languages = language_list();
462
+    $language = $langcode ? $all_languages[$langcode] : NULL;
463
+    $textgroups = array();
464
+    $strings = array();
465 465
 
466
-  switch ($type) {
467
-  case 'standard':
466
+    switch ($type) {
467
+    case 'standard':
468 468
     $textgroups = array(
469
-      'default',
470
-      'taxonomy',
471
-      'views',
469
+        'default',
470
+        'taxonomy',
471
+        'views',
472 472
     );
473 473
     break;
474
-  case 'boinc':
474
+    case 'boinc':
475 475
     $textgroups = array(
476
-      'boinc',
476
+        'boinc',
477 477
     );
478 478
     break;
479
-  case 'project':
479
+    case 'project':
480 480
     $textgroups = array(
481
-      'blocks',
482
-      'menu',
483
-      'project',
481
+        'blocks',
482
+        'menu',
483
+        'project',
484 484
     );
485 485
     break;
486
-  default:
486
+    default:
487 487
   }
488 488
 
489
-  // Merge textgroup strings together for export as one file
490
-  foreach ($textgroups as $textgroup) {
489
+    // Merge textgroup strings together for export as one file
490
+    foreach ($textgroups as $textgroup) {
491 491
     $strings += _locale_export_get_strings($language, $textgroup);
492
-  }
493
-  ksort($strings);
494
-  foreach ($strings as $id => $string) {
492
+    }
493
+    ksort($strings);
494
+    foreach ($strings as $id => $string) {
495 495
     // Set the string context
496 496
     $strings[$id]['context'] = trim($string['comment']);
497
-  }
498
-  if ($langcode AND $langcode != 'en') {
497
+    }
498
+    if ($langcode AND $langcode != 'en') {
499 499
     // If not the source language, remove untranslated strings from the ouput
500 500
     foreach ($strings as $i => $string) {
501
-      if (!$string['translation']) {
501
+        if (!$string['translation']) {
502 502
         unset($strings[$i]);
503
-      }
503
+        }
504 504
     }
505
-  }
506
-  if ($strings) {
505
+    }
506
+    if ($strings) {
507 507
     return boinctranslate_export_po_generate($language, $strings, NULL, $type);
508
-  }
508
+    }
509 509
 
510
-  return NULL;
510
+    return NULL;
511 511
 }
512 512
 
513 513
 /**
@@ -515,21 +515,21 @@  discard block
 block discarded – undo
515 515
  */
516 516
 function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) {
517 517
 
518
-  require_once(getcwd() . '/includes/locale.inc');
519
-  global $user;
518
+    require_once(getcwd() . '/includes/locale.inc');
519
+    global $user;
520 520
 
521
-  // unset $language to indicate template creation
522
-  if (isset($language) && $language->language == "en") {
521
+    // unset $language to indicate template creation
522
+    if (isset($language) && $language->language == "en") {
523 523
     $language = NULL;
524
-  }
524
+    }
525 525
 
526
-  if (!isset($header)) {
526
+    if (!isset($header)) {
527 527
     if (isset($type) && $type == "project") {
528
-      $header = "# ".variable_get('site_name', 'Drupal-BOINC')." drupal localization template\n";
529
-      $header .= "# Copyright (C) ".date("Y")." ".variable_get('site_name', 'Drupal-BOINC')."\n";
528
+        $header = "# ".variable_get('site_name', 'Drupal-BOINC')." drupal localization template\n";
529
+        $header .= "# Copyright (C) ".date("Y")." ".variable_get('site_name', 'Drupal-BOINC')."\n";
530 530
     } else {
531
-      $header = "# BOINC drupal localization template\n";
532
-      $header .= "# Copyright (C) ".date("Y")." University of California\n";
531
+        $header = "# BOINC drupal localization template\n";
532
+        $header .= "# Copyright (C) ".date("Y")." University of California\n";
533 533
     }
534 534
     $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n";
535 535
     $header .= "#\n";
@@ -538,201 +538,201 @@  discard block
 block discarded – undo
538 538
     $header .= "msgid \"\"\n";
539 539
     $header .= "msgstr \"\"\n";
540 540
     if (isset($type) && $type == "project") {
541
-      $header .= "\"Project-Id-Version: ".variable_get('site_name', 'Drupal-BOINC')." ".date("Y-m-d-H:iO")."\\n\"\n";
541
+        $header .= "\"Project-Id-Version: ".variable_get('site_name', 'Drupal-BOINC')." ".date("Y-m-d-H:iO")."\\n\"\n";
542 542
     } else {
543
-      $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here
543
+        $header .= "\"Project-Id-Version: BOINC unknown\\n\"\n"; // TODO: add SHA1 of source checkout here
544 544
     }
545 545
     $header .= "\"Report-Msgid-Bugs-To: BOINC translation team <[email protected]>\\n\"\n";
546 546
     $header .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
547 547
     if (isset($language)) {
548
-      $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
548
+        $header .= "\"PO-Revision-Date: " . date("Y-m-d H:iO") . "\\n\"\n";
549 549
     }
550 550
     $header .= "\"Last-Translator: Generated automatically from Drupal translate interface\\n\"\n";
551 551
     $header .= "\"MIME-Version: 1.0\\n\"\n";
552 552
     $header .= "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
553 553
     $header .= "\"Content-Transfer-Encoding: 8bit\\n\"\n";
554 554
     if (isset($language)) {
555
-      $header .= "\"Language: ".$language->language."\\n\"";
556
-      if ($language->formula && $language->plurals) {
555
+        $header .= "\"Language: ".$language->language."\\n\"";
556
+        if ($language->formula && $language->plurals) {
557 557
         $header .= "\"Plural-Forms: nplurals=" . $language->plurals . "; plural=" . strtr($language->formula, array('$' => '')) . ";\\n\"\n";
558
-      }
558
+        }
559 559
     }
560 560
     $header .= "\"X-Poedit-SourceCharset: utf-8\\n\"\n";
561
-  }
561
+    }
562 562
 
563
-  $output = $header . "\n";
563
+    $output = $header . "\n";
564 564
 
565
-  foreach ($strings as $lid => $string) {
565
+    foreach ($strings as $lid => $string) {
566 566
     // Only process non-children, children are output below their parent.
567 567
     if (!isset($string['child'])) {
568
-      if ($string['comment']) {
568
+        if ($string['comment']) {
569 569
         $output .= '#: ' . $string['comment'] . "\n";
570
-      }
571
-      if ($string['context']) {
570
+        }
571
+        if ($string['context']) {
572 572
         $output .= 'msgctxt "' . $string['context'] . "\"\n";
573
-      }
574
-      $output .= 'msgid ' . _locale_export_string($string['source']);
575
-      if (!empty($string['plural'])) {
573
+        }
574
+        $output .= 'msgid ' . _locale_export_string($string['source']);
575
+        if (!empty($string['plural'])) {
576 576
         $plural = $string['plural'];
577 577
         $output .= 'msgid_plural ' . _locale_export_string($strings[$plural]['source']);
578 578
         if (isset($language)) {
579
-          $translation = $string['translation'];
580
-          for ($i = 0; $i < $language->plurals; $i++) {
579
+            $translation = $string['translation'];
580
+            for ($i = 0; $i < $language->plurals; $i++) {
581 581
             $output .= 'msgstr[' . $i . '] ' . _locale_export_string($translation);
582 582
             if ($plural) {
583
-              $translation = _locale_export_remove_plural($strings[$plural]['translation']);
584
-              $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0;
583
+                $translation = _locale_export_remove_plural($strings[$plural]['translation']);
584
+                $plural = isset($strings[$plural]['plural']) ? $strings[$plural]['plural'] : 0;
585 585
             }
586 586
             else {
587
-              $translation = '';
587
+                $translation = '';
588
+            }
588 589
             }
589
-          }
590 590
         }
591 591
         else {
592
-          $output .= 'msgstr[0] ""' . "\n";
593
-          $output .= 'msgstr[1] ""' . "\n";
592
+            $output .= 'msgstr[0] ""' . "\n";
593
+            $output .= 'msgstr[1] ""' . "\n";
594
+        }
594 595
         }
595
-      }
596
-      else {
596
+        else {
597 597
         $output .= 'msgstr ' . _locale_export_string($string['translation']);
598
-      }
599
-      $output .= "\n";
598
+        }
599
+        $output .= "\n";
600 600
     }
601
-  }
602
-  return $output;
601
+    }
602
+    return $output;
603 603
 }
604 604
 
605 605
 /**
606 606
  *
607 607
  */
608 608
 function boinctranslate_refresh_translations() {
609
-  require_once(getcwd() . '/includes/locale.inc');
610
-  $errors = array();
611
-  $languages = locale_language_list();
612
-  $translation_resources = array();
613
-  $operations = array();
614
-  $debug_mode = variable_get('boinc_debug_mode', 0);
615
-
616
-  $boinc_name = variable_get(
609
+    require_once(getcwd() . '/includes/locale.inc');
610
+    $errors = array();
611
+    $languages = locale_language_list();
612
+    $translation_resources = array();
613
+    $operations = array();
614
+    $debug_mode = variable_get('boinc_debug_mode', 0);
615
+
616
+    $boinc_name = variable_get(
617 617
     'boinc_translate_transifex_standard_name', ''
618
-  );
619
-  $boinc_resources = boinctranslate_parse_resources(
618
+    );
619
+    $boinc_resources = boinctranslate_parse_resources(
620 620
     variable_get('boinc_translate_transifex_standard_resources', array())
621
-  );
622
-  // Add the Official BOINC resource to the list of BOINC resources;
623
-  // The official resource overrides any additional resources provided, so it
624
-  // should be added to the end so as to be processed last
625
-  $drupal_resource = variable_get(
621
+    );
622
+    // Add the Official BOINC resource to the list of BOINC resources;
623
+    // The official resource overrides any additional resources provided, so it
624
+    // should be added to the end so as to be processed last
625
+    $drupal_resource = variable_get(
626 626
     'boinc_translate_transifex_boinc_drupal_resource', ''
627
-  );
628
-  $boinc_resources[] = $drupal_resource;
629
-  if ($boinc_name AND $boinc_resources) {
627
+    );
628
+    $boinc_resources[] = $drupal_resource;
629
+    if ($boinc_name AND $boinc_resources) {
630 630
     $translation_resources[$boinc_name] = array(
631
-      'resources' => $boinc_resources,
632
-      'textgroups' => array(
631
+        'resources' => $boinc_resources,
632
+        'textgroups' => array(
633 633
         'boinc',
634 634
         'default',
635 635
         'taxonomy',
636 636
         'views',
637
-      ),
637
+        ),
638 638
     );
639
-  }
640
-  $project_name = variable_get(
639
+    }
640
+    $project_name = variable_get(
641 641
     'boinc_translate_transifex_project_name', ''
642
-  );
643
-  $project_resources = boinctranslate_parse_resources(
642
+    );
643
+    $project_resources = boinctranslate_parse_resources(
644 644
     variable_get('boinc_translate_transifex_project_resources', array())
645
-  );
646
-  if ($project_name AND $project_resources) {
645
+    );
646
+    if ($project_name AND $project_resources) {
647 647
     $translation_resources[$project_name] = array(
648
-      'resources' => $project_resources,
649
-      'textgroups' => array(
648
+        'resources' => $project_resources,
649
+        'textgroups' => array(
650 650
         'blocks',
651 651
         'menu',
652 652
         'project',
653
-      ),
653
+        ),
654 654
     );
655 655
     // Be sure any strings from the override file are added to the boinc group
656 656
     $override_file = './' . drupal_get_path('module', 'boinctranslate') . '/includes/other-boinc-translation-strings.txt';
657 657
     $other_strings = file($override_file);
658 658
     if ($other_strings) {
659
-      foreach ($other_strings as $string) {
659
+        foreach ($other_strings as $string) {
660 660
         $string = trim($string);
661 661
         if ($string) {
662
-          // Ignore lines starting with '#' i.e., comments.
663
-          if ($string[0] === "#")
662
+            // Ignore lines starting with '#' i.e., comments.
663
+            if ($string[0] === "#")
664 664
             continue;
665 665
 
666
-          // Use '|' as delimiter to split string and context info.
667
-          $line = explode("|", $string);
668
-          if ($line) {
666
+            // Use '|' as delimiter to split string and context info.
667
+            $line = explode("|", $string);
668
+            if ($line) {
669 669
             if (count($line)==1) {
670
-              $tl0 = trim($line[0]);
671
-              if ($tl0) {
670
+                $tl0 = trim($line[0]);
671
+                if ($tl0) {
672 672
                 bts($tl0);
673
-              }
673
+                }
674 674
             }
675 675
             elseif (count($line)>1) {
676
-              $tl0 = trim($line[0]);
677
-              $tl1 = trim($line[1]);
678
-              if ($tl0 and $tl1) {
676
+                $tl0 = trim($line[0]);
677
+                $tl1 = trim($line[1]);
678
+                if ($tl0 and $tl1) {
679 679
                 bts($tl0, array(), NULL, $tl1);
680
-              }
680
+                }
681 681
             }
682
-          }// if ($line)
682
+            }// if ($line)
683 683
 
684 684
         }// if ($string)
685
-      }// foreach
685
+        }// foreach
686 686
     }// if ($other_strings)
687
-  }
687
+    }
688 688
 
689
-  foreach ($languages as $langcode => $language) {
689
+    foreach ($languages as $langcode => $language) {
690 690
     if ($langcode == 'en') {
691
-      continue;
691
+        continue;
692 692
     }
693 693
 
694 694
     $import_stats = array(
695
-      'new' => 0,
696
-      'updated' => 0,
697
-      'deleted' => 0,
698
-      'skipped' => 0,
695
+        'new' => 0,
696
+        'updated' => 0,
697
+        'deleted' => 0,
698
+        'skipped' => 0,
699 699
     );
700 700
 
701 701
     foreach ($translation_resources as $project => $translation) {
702
-      foreach ($translation['resources'] as $resource) {
702
+        foreach ($translation['resources'] as $resource) {
703 703
 
704 704
         // Add this language to the batch operations
705 705
         $operations[] = array(
706
-          'boinctranslate_refresh_translations_op',
707
-          array(
706
+            'boinctranslate_refresh_translations_op',
707
+            array(
708 708
             $project, $resource, $langcode, $language, $translation['textgroups'], $debug_mode
709
-          ),
709
+            ),
710 710
         );
711
-      }
711
+        }
712 712
     }
713 713
     if ($batch = locale_batch_by_language($langcode)) {
714
-      foreach ($batch['operations'] as $op) {
714
+        foreach ($batch['operations'] as $op) {
715 715
         $operations[] = array(
716
-          'boinctranslate_refresh_translations_op',
717
-          array(
716
+            'boinctranslate_refresh_translations_op',
717
+            array(
718 718
             NULL, $op[1][0], $langcode, $language, array('default'), $debug_mode
719
-          ),
719
+            ),
720 720
         );
721
-      }
721
+        }
722
+    }
722 723
     }
723
-  }
724 724
 
725
-  $batch = array(
725
+    $batch = array(
726 726
     'operations' => $operations,
727 727
     'finished' => 'boinctranslate_refresh_translations_finished',
728 728
     'title' => t('Importing translations'),
729 729
     'init_message' => t('Beginning translation import...'),
730 730
     'progress_message' => t('Applied @current out of @total translation updates.'),
731 731
     'error_message' => t('Translation import has encountered an error.'),
732
-  );
732
+    );
733 733
 
734
-  batch_set($batch);
735
-  batch_process();
734
+    batch_set($batch);
735
+    batch_process();
736 736
 }
737 737
 
738 738
 
@@ -741,18 +741,18 @@  discard block
 block discarded – undo
741 741
  */
742 742
 function boinctranslate_refresh_translations_op($project, $resource, $langcode, $language, $textgroups, $debug_mode, &$context) {
743 743
 
744
-  require_once(getcwd() . '/includes/locale.inc');
744
+    require_once(getcwd() . '/includes/locale.inc');
745 745
 
746
-  if ($debug_mode) {
746
+    if ($debug_mode) {
747 747
     watchdog(
748
-      'boinctranslate',
749
-      'Checking for @language updates in @project:@resource',
750
-      array('@language' => $language, '@project' => $project, '@resource' => $resource),
751
-      WATCHDOG_INFO
748
+        'boinctranslate',
749
+        'Checking for @language updates in @project:@resource',
750
+        array('@language' => $language, '@project' => $project, '@resource' => $resource),
751
+        WATCHDOG_INFO
752 752
     );
753
-  }
753
+    }
754 754
 
755
-  if ($project) {
755
+    if ($project) {
756 756
     // Import the configured resources
757 757
     $success = FALSE;
758 758
     $message = '';
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
     $response = boinctranslate_transifex_request($path);
761 761
 
762 762
     if ($response == '404 NOT FOUND') {
763
-      $message = "Project resource {$project}:{$resource} not found in {$language}.";
763
+        $message = "Project resource {$project}:{$resource} not found in {$language}.";
764 764
     }
765 765
     elseif ($response) {
766
-      if (!empty($response['content'])) {
766
+        if (!empty($response['content'])) {
767 767
         $po_text = $response['content'];
768 768
 
769 769
         // Write the translation file to a temporary location
@@ -771,163 +771,163 @@  discard block
 block discarded – undo
771 771
         $file->filepath = file_save_data($po_text, NULL);
772 772
         $file->filename = basename($file->filepath);
773 773
         if (!$file->filepath) {
774
-          $message = 'Unable to create temporary file in '
774
+            $message = 'Unable to create temporary file in '
775 775
             . file_directory_temp() . " for {$language} translation "
776 776
             . "resource {$project}:{$resource}";
777 777
         }
778 778
 
779 779
         foreach ($textgroups as $textgroup) {
780
-          // Import the translations from the file to each related textgroup
781
-          if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
780
+            // Import the translations from the file to each related textgroup
781
+            if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
782 782
             $message = "The {$language} translation import of"
783
-              . " {$project}:{$resource} failed.";
783
+                . " {$project}:{$resource} failed.";
784 784
             $success = FALSE;
785 785
             break;
786
-          }
787
-          else {
786
+            }
787
+            else {
788 788
             $success = TRUE;
789
-          }
789
+            }
790
+        }
790 791
         }
791
-      }
792
-      else {
792
+        else {
793 793
         $message = "Unable to read response for {$language} translation import"
794
-          . " of {$project}:{$resource}.";
795
-      }
794
+            . " of {$project}:{$resource}.";
795
+        }
796 796
     }
797 797
     else {
798
-      $message = "Translation data not found in response for {$language}"
798
+        $message = "Translation data not found in response for {$language}"
799 799
         . " translation import of {$project}:{$resource}.";
800 800
     }
801
-  }
802
-  else {
801
+    }
802
+    else {
803 803
     // If project isn't specified, import as a local Drupal resource
804 804
     $project = 'drupal.local';
805 805
     $file = new stdClass();
806 806
     $file->filepath = $resource;
807 807
     $file->filename = basename($file->filepath);
808 808
     if (!$results = _boinctranslate_locale_import_po($file, $langcode, LOCALE_IMPORT_OVERWRITE, $textgroup)) {
809
-      $message = "The {$language} translation import of"
809
+        $message = "The {$language} translation import of"
810 810
         . " local file {$resource} failed.";
811
-      $success = FALSE;
811
+        $success = FALSE;
812 812
     }
813 813
     else {
814
-      $success = TRUE;
814
+        $success = TRUE;
815
+    }
815 816
     }
816
-  }
817 817
 
818
-  if ($success) {
818
+    if ($success) {
819 819
     // Store some result for post-processing in the finished callback.
820 820
     $context['results']['success'][] = "{$langcode}:{$textgroup}";
821 821
     $message = "Imported {$language} translations in {$project}:{$resource} ({$results['new']} added, {$results['updated']} refreshed, {$results['deleted']} removed)";
822 822
 
823 823
     if ($debug_mode) {
824
-      watchdog(
824
+        watchdog(
825 825
         'boinctranslate',
826 826
         $message,
827 827
         array(),
828 828
         WATCHDOG_INFO
829
-      );
829
+        );
830 830
     }
831
-  }
832
-  else {
831
+    }
832
+    else {
833 833
     $context['results']['failure'][] = "{$langcode}:{$textgroup}";
834 834
     watchdog(
835
-      'boinctranslate',
836
-      $message,
837
-      array(),
838
-      WATCHDOG_WARNING
835
+        'boinctranslate',
836
+        $message,
837
+        array(),
838
+        WATCHDOG_WARNING
839 839
     );
840
-  }
840
+    }
841 841
 
842
-  // Update our progress information.
843
-  $context['sandbox']['progress']++;
844
-  $context['sandbox']['language'] = $langcode;
845
-  $context['message'] = $message;
842
+    // Update our progress information.
843
+    $context['sandbox']['progress']++;
844
+    $context['sandbox']['language'] = $langcode;
845
+    $context['message'] = $message;
846 846
 
847
-  // Update the progress for the batch engine
848
-  if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
847
+    // Update the progress for the batch engine
848
+    if ($context['sandbox']['progress'] >= $context['sandbox']['max']) {
849 849
     $context['finished'] = 1;
850
-  }
851
-  else {
850
+    }
851
+    else {
852 852
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
853
-  }
853
+    }
854 854
 }
855 855
 
856 856
 /**
857 857
  * Batch 'finished' callback
858 858
  */
859 859
 function boinctranslate_refresh_translations_finished($success, $results, $operations) {
860
-  if ($success) {
860
+    if ($success) {
861 861
     // Let's count our successes
862 862
     $count = count($results['success']);
863 863
     $message = "Successfully completed {$count} import operations";
864 864
     watchdog(
865
-      'boinctranslate',
866
-      'Successfully completed @count import operations.',
867
-      array('@count' => $count),
868
-      WATCHDOG_INFO
865
+        'boinctranslate',
866
+        'Successfully completed @count import operations.',
867
+        array('@count' => $count),
868
+        WATCHDOG_INFO
869 869
     ); 
870
-  }
871
-  else {
870
+    }
871
+    else {
872 872
     // An error occurred.
873 873
     // $operations contains the operations that remained unprocessed.
874 874
     $error_operation = reset($operations);
875 875
     $message = 'An error occurred while processing ' . $error_operation[0] . ' with arguments :' . print_r($error_operation[0], TRUE);
876 876
     watchdog(
877
-      'boinctranslate',
878
-      $message,
879
-      array(),
880
-      WATCHDOG_WARNING
877
+        'boinctranslate',
878
+        $message,
879
+        array(),
880
+        WATCHDOG_WARNING
881 881
     );
882
-  }
883
-  drupal_set_message($message);
884
-  drupal_goto('admin/boinc/translation');
882
+    }
883
+    drupal_set_message($message);
884
+    drupal_goto('admin/boinc/translation');
885 885
 }
886 886
 
887 887
 /**
888 888
  *
889 889
  */
890 890
 function _boinctranslate_locale_import_po($file, $langcode, $mode, $group = NULL) {
891
-  // Try to allocate enough time to parse and import the data.
892
-  if (function_exists('set_time_limit')) {
891
+    // Try to allocate enough time to parse and import the data.
892
+    if (function_exists('set_time_limit')) {
893 893
     @set_time_limit(240);
894
-  }
894
+    }
895 895
 
896
-  require_once(getcwd() . '/includes/locale.inc');
896
+    require_once(getcwd() . '/includes/locale.inc');
897 897
 
898
-  // Check if we have the language already in the database.
899
-  if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) {
898
+    // Check if we have the language already in the database.
899
+    if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) {
900 900
     drupal_set_message(t('The language selected for import is not supported.'), 'error');
901 901
     return FALSE;
902
-  }
902
+    }
903 903
 
904
-  // Get strings from file (returns on failure after a partial import, or on success)
905
-  $status = _boinctranslate_locale_import_read_po('db-store', $file, $mode, $langcode, $group);
906
-  if ($status === FALSE) {
904
+    // Get strings from file (returns on failure after a partial import, or on success)
905
+    $status = _boinctranslate_locale_import_read_po('db-store', $file, $mode, $langcode, $group);
906
+    if ($status === FALSE) {
907 907
     // Error messages are set in _locale_import_read_po().
908 908
     return FALSE;
909
-  }
909
+    }
910 910
 
911
-  // Get status information on import process.
912
-  list($headerdone, $additions, $updates, $deletes, $skips) = _boinctranslate_locale_import_one_string('db-report');
911
+    // Get status information on import process.
912
+    list($headerdone, $additions, $updates, $deletes, $skips) = _boinctranslate_locale_import_one_string('db-report');
913 913
 
914
-  if (!$headerdone) {
914
+    if (!$headerdone) {
915 915
     drupal_set_message(t('The translation file %filename appears to have a missing or malformed header.', array('%filename' => $file->filename)), 'error');
916
-  }
916
+    }
917 917
 
918
-  // Clear cache and force refresh of JavaScript translations.
919
-  _locale_invalidate_js($langcode);
920
-  cache_clear_all('locale:', 'cache', TRUE);
918
+    // Clear cache and force refresh of JavaScript translations.
919
+    _locale_invalidate_js($langcode);
920
+    cache_clear_all('locale:', 'cache', TRUE);
921 921
 
922
-  // Rebuild the menu, strings may have changed.
923
-  menu_rebuild();
922
+    // Rebuild the menu, strings may have changed.
923
+    menu_rebuild();
924 924
 
925
-  return array(
925
+    return array(
926 926
     'new' => $additions,
927 927
     'updated' => $updates,
928 928
     'deleted' => $deletes,
929 929
     'skipped' => $skips,
930
-  );
930
+    );
931 931
 }
932 932
 
933 933
 /**
@@ -935,253 +935,253 @@  discard block
 block discarded – undo
935 935
  */
936 936
 function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') {
937 937
 
938
-  require_once(getcwd() . '/includes/locale.inc');
938
+    require_once(getcwd() . '/includes/locale.inc');
939 939
 
940
-  $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return
941
-  if (!$fd) {
940
+    $fd = fopen($file->filepath, "rb"); // File will get closed by PHP on return
941
+    if (!$fd) {
942 942
     watchdog(
943
-      'boinctranslate',
944
-      'The translation import for %lang failed, because %filename could not be read.',
945
-      array('%lang' => $lang, '%filename' => $file->filename),
946
-      WATCHDOG_WARNING
943
+        'boinctranslate',
944
+        'The translation import for %lang failed, because %filename could not be read.',
945
+        array('%lang' => $lang, '%filename' => $file->filename),
946
+        WATCHDOG_WARNING
947 947
     );
948 948
     _locale_import_message('The translation import failed, because the file %filename could not be read.', $file);
949 949
     return FALSE;
950
-  }
950
+    }
951 951
 
952
-  $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR
953
-  $current = array(); // Current entry being read
954
-  $plural = 0; // Current plural form
955
-  $lineno = 0; // Current line
952
+    $context = "COMMENT"; // Parser context: COMMENT, MSGID, MSGID_PLURAL, MSGSTR and MSGSTR_ARR
953
+    $current = array(); // Current entry being read
954
+    $plural = 0; // Current plural form
955
+    $lineno = 0; // Current line
956 956
 
957
-  while (!feof($fd)) {
957
+    while (!feof($fd)) {
958 958
     $line = fgets($fd, 10 * 1024); // A line should not be this long
959 959
     if ($lineno == 0) {
960
-      // The first line might come with a UTF-8 BOM, which should be removed.
961
-      $line = str_replace("\xEF\xBB\xBF", '', $line);
960
+        // The first line might come with a UTF-8 BOM, which should be removed.
961
+        $line = str_replace("\xEF\xBB\xBF", '', $line);
962 962
     }
963 963
     $lineno++;
964 964
     $line = trim(strtr($line, array("\\\n" => "")));
965 965
 
966 966
     if (!strncmp("#", $line, 1)) { // A comment
967
-      if ($context == "COMMENT") { // Already in comment context: add
967
+        if ($context == "COMMENT") { // Already in comment context: add
968 968
         $current["#"][] = substr($line, 1);
969
-      }
970
-      elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
969
+        }
970
+        elseif (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
971 971
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
972 972
         $current = array();
973 973
         $current["#"][] = substr($line, 1);
974 974
         $context = "COMMENT";
975
-      }
976
-      else { // Parse error
975
+        }
976
+        else { // Parse error
977 977
         watchdog(
978
-          'boinctranslate',
979
-          'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.',
980
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
981
-          WATCHDOG_WARNING
978
+            'boinctranslate',
979
+            'The translation file %filename for %lang contains an error: "msgstr" was expected but not found on line %line.',
980
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
981
+            WATCHDOG_WARNING
982 982
         );
983 983
         _locale_import_message('The translation file %filename contains an error: "msgstr" was expected but not found on line %line.', $file, $lineno);
984 984
         return FALSE;
985
-      }
985
+        }
986 986
     }
987 987
     elseif (!strncmp("msgctxt", $line, 7)) {
988
-      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
988
+        if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
989 989
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
990 990
         $current = array();
991
-      }
992
-      elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error
991
+        }
992
+        elseif (($context == "MSGID") || ($context == "MSGCTXT")) { // Already in this context? Parse error
993 993
         watchdog(
994
-          'boinctranslate',
995
-          'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.',
996
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
997
-          WATCHDOG_WARNING
994
+            'boinctranslate',
995
+            'The translation file %filename for %lang contains an error: "msgctxt" is unexpected on line %line.',
996
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
997
+            WATCHDOG_WARNING
998 998
         );
999 999
         _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno);
1000 1000
         return FALSE;
1001
-      }
1002
-      $line = trim(substr($line, 7));
1003
-      $quoted = _locale_import_parse_quoted($line);
1004
-      if ($quoted === FALSE) {
1001
+        }
1002
+        $line = trim(substr($line, 7));
1003
+        $quoted = _locale_import_parse_quoted($line);
1004
+        if ($quoted === FALSE) {
1005 1005
         watchdog(
1006
-          'boinctranslate',
1007
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1008
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1009
-          WATCHDOG_WARNING
1006
+            'boinctranslate',
1007
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1008
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1009
+            WATCHDOG_WARNING
1010 1010
         );
1011 1011
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1012 1012
         return FALSE;
1013
-      }
1014
-      $current["msgctxt"] = $quoted;
1015
-      $context = "MSGCTXT";
1013
+        }
1014
+        $current["msgctxt"] = $quoted;
1015
+        $context = "MSGCTXT";
1016 1016
     }
1017 1017
     elseif (!strncmp("msgid_plural", $line, 12)) {
1018
-      if ($context != "MSGID") { // Must be plural form for current entry
1018
+        if ($context != "MSGID") { // Must be plural form for current entry
1019 1019
         watchdog(
1020
-          'boinctranslate',
1021
-          'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.',
1022
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1023
-          WATCHDOG_WARNING
1020
+            'boinctranslate',
1021
+            'The translation file %filename for %lang contains an error: "msgid_plural" was expected but not found on line %line.',
1022
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1023
+            WATCHDOG_WARNING
1024 1024
         );
1025 1025
         _locale_import_message('The translation file %filename contains an error: "msgid_plural" was expected but not found on line %line.', $file, $lineno);
1026 1026
         return FALSE;
1027
-      }
1028
-      $line = trim(substr($line, 12));
1029
-      $quoted = _locale_import_parse_quoted($line);
1030
-      if ($quoted === FALSE) {
1027
+        }
1028
+        $line = trim(substr($line, 12));
1029
+        $quoted = _locale_import_parse_quoted($line);
1030
+        if ($quoted === FALSE) {
1031 1031
         watchdog(
1032
-          'boinctranslate',
1033
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1034
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1035
-          WATCHDOG_WARNING
1032
+            'boinctranslate',
1033
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1034
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1035
+            WATCHDOG_WARNING
1036 1036
         );
1037 1037
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1038 1038
         return FALSE;
1039
-      }
1040
-      $current["msgid"] = $current["msgid"] . "\0" . $quoted;
1041
-      $context = "MSGID_PLURAL";
1039
+        }
1040
+        $current["msgid"] = $current["msgid"] . "\0" . $quoted;
1041
+        $context = "MSGID_PLURAL";
1042 1042
     }
1043 1043
     elseif (!strncmp("msgid", $line, 5)) {
1044
-      if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
1044
+        if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) { // End current entry, start a new one
1045 1045
         _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
1046 1046
         $current = array();
1047
-      }
1048
-      elseif ($context == "MSGID") { // Already in this context? Parse error
1047
+        }
1048
+        elseif ($context == "MSGID") { // Already in this context? Parse error
1049 1049
         watchdog(
1050
-          'boinctranslate',
1051
-          'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.',
1052
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1053
-          WATCHDOG_WARNING
1050
+            'boinctranslate',
1051
+            'The translation file %filename for %lang contains an error: "msgid" is unexpected on line %line.',
1052
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1053
+            WATCHDOG_WARNING
1054 1054
         );
1055 1055
         _locale_import_message('The translation file %filename contains an error: "msgid" is unexpected on line %line.', $file, $lineno);
1056 1056
         return FALSE;
1057
-      }
1058
-      $line = trim(substr($line, 5));
1059
-      $quoted = _locale_import_parse_quoted($line);
1060
-      if ($quoted === FALSE) {
1057
+        }
1058
+        $line = trim(substr($line, 5));
1059
+        $quoted = _locale_import_parse_quoted($line);
1060
+        if ($quoted === FALSE) {
1061 1061
         watchdog(
1062
-          'boinctranslate',
1063
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1064
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1065
-          WATCHDOG_WARNING
1062
+            'boinctranslate',
1063
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1064
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1065
+            WATCHDOG_WARNING
1066 1066
         );
1067 1067
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1068 1068
         return FALSE;
1069
-      }
1070
-      $current["msgid"] = $quoted;
1071
-      $context = "MSGID";
1069
+        }
1070
+        $current["msgid"] = $quoted;
1071
+        $context = "MSGID";
1072 1072
     }
1073 1073
     elseif (!strncmp("msgstr[", $line, 7)) {
1074
-      if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[]
1074
+        if (($context != "MSGID") && ($context != "MSGID_PLURAL") && ($context != "MSGSTR_ARR")) { // Must come after msgid, msgid_plural, or msgstr[]
1075 1075
         watchdog(
1076
-          'boinctranslate',
1077
-          'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.',
1078
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1079
-          WATCHDOG_WARNING
1076
+            'boinctranslate',
1077
+            'The translation file %filename for %lang contains an error: "msgstr[]" is unexpected on line %line.',
1078
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1079
+            WATCHDOG_WARNING
1080 1080
         );
1081 1081
         _locale_import_message('The translation file %filename contains an error: "msgstr[]" is unexpected on line %line.', $file, $lineno);
1082 1082
         return FALSE;
1083
-      }
1084
-      if (strpos($line, "]") === FALSE) {
1083
+        }
1084
+        if (strpos($line, "]") === FALSE) {
1085 1085
         watchdog(
1086
-          'boinctranslate',
1087
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1088
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1089
-          WATCHDOG_WARNING
1086
+            'boinctranslate',
1087
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1088
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1089
+            WATCHDOG_WARNING
1090 1090
         );
1091 1091
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1092 1092
         return FALSE;
1093
-      }
1094
-      $frombracket = strstr($line, "[");
1095
-      $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1);
1096
-      $line = trim(strstr($line, " "));
1097
-      $quoted = _locale_import_parse_quoted($line);
1098
-      if ($quoted === FALSE) {
1093
+        }
1094
+        $frombracket = strstr($line, "[");
1095
+        $plural = substr($frombracket, 1, strpos($frombracket, "]") - 1);
1096
+        $line = trim(strstr($line, " "));
1097
+        $quoted = _locale_import_parse_quoted($line);
1098
+        if ($quoted === FALSE) {
1099 1099
         watchdog(
1100
-          'boinctranslate',
1101
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1102
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1103
-          WATCHDOG_WARNING
1100
+            'boinctranslate',
1101
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1102
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1103
+            WATCHDOG_WARNING
1104 1104
         );
1105 1105
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1106 1106
         return FALSE;
1107
-      }
1108
-      $current["msgstr"][$plural] = $quoted;
1109
-      $context = "MSGSTR_ARR";
1107
+        }
1108
+        $current["msgstr"][$plural] = $quoted;
1109
+        $context = "MSGSTR_ARR";
1110 1110
     }
1111 1111
     elseif (!strncmp("msgstr", $line, 6)) {
1112
-      if ($context != "MSGID") { // Should come just after a msgid block
1112
+        if ($context != "MSGID") { // Should come just after a msgid block
1113 1113
         watchdog(
1114
-          'boinctranslate',
1115
-          'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.',
1116
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1117
-          WATCHDOG_WARNING
1114
+            'boinctranslate',
1115
+            'The translation file %filename for %lang contains an error: "msgstr" is unexpected on line %line.',
1116
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1117
+            WATCHDOG_WARNING
1118 1118
         );
1119 1119
         _locale_import_message('The translation file %filename contains an error: "msgstr" is unexpected on line %line.', $file, $lineno);
1120 1120
         return FALSE;
1121
-      }
1122
-      $line = trim(substr($line, 6));
1123
-      $quoted = _locale_import_parse_quoted($line);
1124
-      if ($quoted === FALSE) {
1121
+        }
1122
+        $line = trim(substr($line, 6));
1123
+        $quoted = _locale_import_parse_quoted($line);
1124
+        if ($quoted === FALSE) {
1125 1125
         watchdog(
1126
-          'boinctranslate',
1127
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1128
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1129
-          WATCHDOG_WARNING
1126
+            'boinctranslate',
1127
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1128
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1129
+            WATCHDOG_WARNING
1130 1130
         );
1131 1131
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1132 1132
         return FALSE;
1133
-      }
1134
-      $current["msgstr"] = $quoted;
1135
-      $context = "MSGSTR";
1133
+        }
1134
+        $current["msgstr"] = $quoted;
1135
+        $context = "MSGSTR";
1136 1136
     }
1137 1137
     elseif ($line != "") {
1138
-      $quoted = _locale_import_parse_quoted($line);
1139
-      if ($quoted === FALSE) {
1138
+        $quoted = _locale_import_parse_quoted($line);
1139
+        if ($quoted === FALSE) {
1140 1140
         watchdog(
1141
-          'boinctranslate',
1142
-          'The translation file %filename for language %lang contains a syntax error on line %line.',
1143
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1144
-          WATCHDOG_WARNING
1141
+            'boinctranslate',
1142
+            'The translation file %filename for language %lang contains a syntax error on line %line.',
1143
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1144
+            WATCHDOG_WARNING
1145 1145
         );
1146 1146
         _locale_import_message('The translation file %filename contains a syntax error on line %line.', $file, $lineno);
1147 1147
         return FALSE;
1148
-      }
1149
-      if (($context == "MSGID") || ($context == "MSGID_PLURAL")) {
1148
+        }
1149
+        if (($context == "MSGID") || ($context == "MSGID_PLURAL")) {
1150 1150
         $current["msgid"] .= $quoted;
1151
-      }
1152
-      elseif ($context == "MSGSTR") {
1151
+        }
1152
+        elseif ($context == "MSGSTR") {
1153 1153
         $current["msgstr"] .= $quoted;
1154
-      }
1155
-      elseif ($context == "MSGSTR_ARR") {
1154
+        }
1155
+        elseif ($context == "MSGSTR_ARR") {
1156 1156
         $current["msgstr"][$plural] .= $quoted;
1157
-      }
1158
-      else {
1157
+        }
1158
+        else {
1159 1159
         watchdog(
1160
-          'boinctranslate',
1161
-          'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.',
1162
-          array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1163
-          WATCHDOG_WARNING
1160
+            'boinctranslate',
1161
+            'The translation file %filename for %lang contains an error: there is an unexpected string on line %line.',
1162
+            array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1163
+            WATCHDOG_WARNING
1164 1164
         );
1165 1165
         _locale_import_message('The translation file %filename contains an error: there is an unexpected string on line %line.', $file, $lineno);
1166 1166
         return FALSE;
1167
-      }
1167
+        }
1168
+    }
1168 1169
     }
1169
-  }
1170 1170
 
1171
-  // End of PO file, flush last entry
1172
-  if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
1171
+    // End of PO file, flush last entry
1172
+    if (($context == "MSGSTR") || ($context == "MSGSTR_ARR")) {
1173 1173
     _boinctranslate_locale_import_one_string($op, $current, $mode, $lang, $file, $group);
1174
-  }
1175
-  elseif ($context != "COMMENT") {
1174
+    }
1175
+    elseif ($context != "COMMENT") {
1176 1176
     watchdog(
1177
-      'boinctranslate',
1178
-      'The translation file %filename for %lang ended unexpectedly at line %line.',
1179
-      array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1180
-      WATCHDOG_WARNING
1177
+        'boinctranslate',
1178
+        'The translation file %filename for %lang ended unexpectedly at line %line.',
1179
+        array('%filename' => $file->filename, '%lang' => $lang, '%line' => $lineno),
1180
+        WATCHDOG_WARNING
1181 1181
     );
1182 1182
     _locale_import_message('The translation file %filename ended unexpectedly at line %line.', $file, $lineno);
1183 1183
     return FALSE;
1184
-  }
1184
+    }
1185 1185
 
1186 1186
 }
1187 1187
 
@@ -1190,28 +1190,28 @@  discard block
 block discarded – undo
1190 1190
  */
1191 1191
 function _boinctranslate_locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') {
1192 1192
 
1193
-  require_once(getcwd() . '/includes/locale.inc');
1193
+    require_once(getcwd() . '/includes/locale.inc');
1194 1194
 
1195
-  static $report = array(
1195
+    static $report = array(
1196 1196
     'additions' => 0,
1197 1197
     'updates' => 0,
1198 1198
     'deletes' => 0,
1199 1199
     'skips' => 0,
1200
-  );
1201
-  static $headerdone = FALSE;
1202
-  static $strings = array();
1200
+    );
1201
+    static $headerdone = FALSE;
1202
+    static $strings = array();
1203 1203
 
1204
-  switch ($op) {
1204
+    switch ($op) {
1205 1205
     // Return stored strings
1206 1206
     case 'mem-report':
1207 1207
       return $strings;
1208 1208
 
1209
-      // Store string in memory (only supports single strings)
1209
+        // Store string in memory (only supports single strings)
1210 1210
     case 'mem-store':
1211 1211
       $strings[$value['msgid']] = $value['msgstr'];
1212
-      return;
1212
+        return;
1213 1213
 
1214
-      // Called at end of import to inform the user
1214
+        // Called at end of import to inform the user
1215 1215
     case 'db-report':
1216 1216
       return array(
1217 1217
         $headerdone,
@@ -1219,57 +1219,57 @@  discard block
 block discarded – undo
1219 1219
         $report['updates'],
1220 1220
         $report['deletes'],
1221 1221
         $report['skips'],
1222
-      );
1222
+        );
1223 1223
 
1224
-      // Store the string we got in the database.
1224
+        // Store the string we got in the database.
1225 1225
     case 'db-store':
1226 1226
       // We got header information.
1227 1227
       if ($value['msgid'] == '') {
1228 1228
         $languages = language_list();
1229 1229
         if (($mode != LOCALE_IMPORT_KEEP) || empty($languages[$lang]->plurals)) {
1230
-          // Since we only need to parse the header if we ought to update the
1231
-          // plural formula, only run this if we don't need to keep existing
1232
-          // data untouched or if we don't have an existing plural formula.
1233
-          $header = _locale_import_parse_header($value['msgstr']);
1230
+            // Since we only need to parse the header if we ought to update the
1231
+            // plural formula, only run this if we don't need to keep existing
1232
+            // data untouched or if we don't have an existing plural formula.
1233
+            $header = _locale_import_parse_header($value['msgstr']);
1234 1234
 
1235
-          // Get and store the plural formula if available.
1236
-          if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1235
+            // Get and store the plural formula if available.
1236
+            if (isset($header["Plural-Forms"]) && $p = _locale_import_parse_plural_forms($header["Plural-Forms"], $file->filename)) {
1237 1237
             list($nplurals, $plural) = $p;
1238 1238
             db_query("UPDATE {languages} SET plurals = %d, formula = '%s' WHERE language = '%s'", $nplurals, $plural, $lang);
1239
-          }
1239
+            }
1240 1240
         }
1241 1241
         $headerdone = TRUE;
1242
-      }
1242
+        }
1243 1243
 
1244
-      else {
1244
+        else {
1245 1245
         // Some real string to import.
1246 1246
         $comments = _locale_import_shorten_comments(empty($value['#']) ? array() : $value['#']);
1247 1247
 
1248 1248
         if (strpos($value['msgid'], "\0")) {
1249
-          // This string has plural versions.
1250
-          $english = explode("\0", $value['msgid'], 2);
1251
-          $entries = array_keys($value['msgstr']);
1252
-          for ($i = 3; $i <= count($entries); $i++) {
1249
+            // This string has plural versions.
1250
+            $english = explode("\0", $value['msgid'], 2);
1251
+            $entries = array_keys($value['msgstr']);
1252
+            for ($i = 3; $i <= count($entries); $i++) {
1253 1253
             $english[] = $english[1];
1254
-          }
1255
-          $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1256
-          $english = array_map('_locale_import_append_plural', $english, $entries);
1257
-          foreach ($translation as $key => $trans) {
1254
+            }
1255
+            $translation = array_map('_locale_import_append_plural', $value['msgstr'], $entries);
1256
+            $english = array_map('_locale_import_append_plural', $english, $entries);
1257
+            foreach ($translation as $key => $trans) {
1258 1258
             if ($key == 0) {
1259
-              $plid = 0;
1259
+                $plid = 0;
1260 1260
             }
1261 1261
             $plid = _boinctranslate_locale_import_one_string_db($report, $lang, $english[$key], $trans, $group, $comments, $mode, $plid, $key);
1262
-          }
1262
+            }
1263 1263
         }
1264 1264
 
1265 1265
         else {
1266
-          // A simple string to import.
1267
-          $english = $value['msgid'];
1268
-          $translation = $value['msgstr'];
1269
-          _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1266
+            // A simple string to import.
1267
+            $english = $value['msgid'];
1268
+            $translation = $value['msgstr'];
1269
+            _boinctranslate_locale_import_one_string_db($report, $lang, $english, $translation, $group, $comments, $mode);
1270 1270
         }
1271
-      }
1272
-  } // end of db-store operation
1271
+        }
1272
+    } // end of db-store operation
1273 1273
 }
1274 1274
 
1275 1275
 /**
@@ -1286,15 +1286,15 @@  discard block
 block discarded – undo
1286 1286
  */
1287 1287
 function _boinctranslate_locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = NULL, $plural = NULL) {
1288 1288
 
1289
-  $ignoreoverwrite = FALSE;
1290
-  $lid = 0;
1289
+    $ignoreoverwrite = FALSE;
1290
+    $lid = 0;
1291 1291
 
1292
-  // Use different DB query depending on the textgroup.
1293
-  $uselocation = array("boinc", "project");
1294
-  if (in_array($textgroup, $uselocation)) {
1292
+    // Use different DB query depending on the textgroup.
1293
+    $uselocation = array("boinc", "project");
1294
+    if (in_array($textgroup, $uselocation)) {
1295 1295
     $resource = db_query("SELECT lid FROM {locales_source} WHERE location = '%s' AND source = '%s' AND textgroup = '%s'", $location, $source, $textgroup);
1296
-  }
1297
-  else {
1296
+    }
1297
+    else {
1298 1298
     $resource = db_query("SELECT lid FROM {locales_source} WHERE source = '%s' AND textgroup = '%s'", $source, $textgroup);
1299 1299
 
1300 1300
     // Parse the location string for the string ignoreoverwrite, which
@@ -1303,61 +1303,61 @@  discard block
 block discarded – undo
1303 1303
     // location string.
1304 1304
     $parts = explode(':', $location);
1305 1305
     if (!empty($parts[2])) {
1306
-      if (preg_match('/(ignoreoverwrite)/', $parts[2])) {
1306
+        if (preg_match('/(ignoreoverwrite)/', $parts[2])) {
1307 1307
         $ignoreoverwrite = TRUE;
1308
-      }
1308
+        }
1309 1309
     }
1310
-  }// if (in_array($textgroup, $uselocation))
1310
+    }// if (in_array($textgroup, $uselocation))
1311 1311
 
1312
-  if (!empty($translation)) {
1312
+    if (!empty($translation)) {
1313 1313
     // Skip this string unless it passes a check for dangerous code.
1314 1314
     // Text groups other than default still can contain HTML tags
1315 1315
     // (i.e. translatable blocks).
1316 1316
     if ($textgroup == "default" && !locale_string_is_safe($translation)) {
1317
-      $report['skips']++;
1318
-      $lid = 0;
1317
+        $report['skips']++;
1318
+        $lid = 0;
1319 1319
     }
1320 1320
     elseif ($resource) {
1321
-      // We have this source string saved already. Loop over the db results from locales_source table.
1322
-      while ($row = db_fetch_array($resource)) {
1321
+        // We have this source string saved already. Loop over the db results from locales_source table.
1322
+        while ($row = db_fetch_array($resource)) {
1323 1323
 
1324 1324
         $lid = $row['lid'];
1325 1325
         // Check of if one or more translations exist for this lid in locales_target table.
1326 1326
         $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1327 1327
         if (!$exists) {
1328
-          // No translation in this language, insert translation into locales_target table.
1329
-          db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural);
1330
-          $report['additions']++;
1328
+            // No translation in this language, insert translation into locales_target table.
1329
+            db_query("INSERT INTO {locales_target} (lid, language, translation, plid, plural) VALUES (%d, '%s', '%s', %d, %d)", $lid, $langcode, $translation, $plid, $plural);
1330
+            $report['additions']++;
1331 1331
         }
1332 1332
         else if ( ($mode == LOCALE_IMPORT_OVERWRITE) and (!$ignoreoverwrite) ) {
1333
-          // Translation exists, only overwrite if instructed.
1334
-          db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid);
1335
-          $report['updates']++;
1333
+            // Translation exists, only overwrite if instructed.
1334
+            db_query("UPDATE {locales_target} SET translation = '%s', plid = %d, plural = %d WHERE language = '%s' AND lid = %d", $translation, $plid, $plural, $langcode, $lid);
1335
+            $report['updates']++;
1336 1336
         }
1337 1337
         else {
1338
-          $report['skips']++;
1338
+            $report['skips']++;
1339 1339
         }// end if !$exists
1340 1340
 
1341
-      }// while
1341
+        }// while
1342 1342
     }
1343
-  }
1344
-  elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) {
1343
+    }
1344
+    elseif ($mode == LOCALE_IMPORT_OVERWRITE AND $resource) {
1345 1345
     // Loop over db results from locales_source table.
1346 1346
     while ($row = db_fetch_array($resource)) {
1347
-      $lid = $row['lid'];
1348
-      $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1349
-      if ($exists) {
1347
+        $lid = $row['lid'];
1348
+        $exists = (bool) db_result(db_query("SELECT lid FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $langcode));
1349
+        if ($exists) {
1350 1350
         // Empty translation, remove existing if instructed.
1351 1351
         db_query("DELETE FROM {locales_target} WHERE language = '%s' AND lid = %d AND plid = %d AND plural = %d", $langcode, $lid, $plid, $plural);
1352 1352
         $report['deletes']++;
1353
-      }// if $exists
1353
+        }// if $exists
1354 1354
     }// while
1355
-  }
1356
-  else {
1355
+    }
1356
+    else {
1357 1357
     $report['skips']++;
1358
-  }
1358
+    }
1359 1359
 
1360
-  return $lid;
1360
+    return $lid;
1361 1361
 }
1362 1362
 
1363 1363
 
@@ -1366,17 +1366,17 @@  discard block
 block discarded – undo
1366 1366
  * Parse valid resources out of configuration
1367 1367
  */
1368 1368
 function boinctranslate_parse_resources($resource_text) {
1369
-  $resources = array();
1370
-  $resource_array = explode(
1369
+    $resources = array();
1370
+    $resource_array = explode(
1371 1371
     "\n", $resource_text
1372
-  );
1373
-  foreach ($resource_array as $resource) {
1372
+    );
1373
+    foreach ($resource_array as $resource) {
1374 1374
     $resource = trim($resource);
1375 1375
     if ($resource AND $resource[0] != '#') {
1376
-      $resources[] = $resource;
1376
+        $resources[] = $resource;
1377 1377
     }
1378
-  }
1379
-  return $resources;
1378
+    }
1379
+    return $resources;
1380 1380
 }
1381 1381
 
1382 1382
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -1403,5 +1403,5 @@  discard block
 block discarded – undo
1403 1403
  * database.
1404 1404
  */
1405 1405
 function _boinctranslate_supertrim($instr) {
1406
-  return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) );
1406
+    return implode("\n", array_map('trim', preg_split('/\r\n|\r|\n/', $instr) ) );
1407 1407
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/themes/boinc/template.php 1 patch
Indentation   +322 added lines, -322 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  * Implementation of HOOK_theme().
68 68
  */
69 69
 function boinc_theme(&$existing, $type, $theme, $path) {
70
-  $hooks = zen_theme($existing, $type, $theme, $path);
71
-  // Add your theme hooks like this:
72
-  /*
70
+    $hooks = zen_theme($existing, $type, $theme, $path);
71
+    // Add your theme hooks like this:
72
+    /*
73 73
   $hooks['hook_name_here'] = array( // Details go here );
74 74
   */
75
-  // @TODO: Needs detailed comments. Patches welcome!
76
-  return $hooks;
75
+    // @TODO: Needs detailed comments. Patches welcome!
76
+    return $hooks;
77 77
 }
78 78
 
79 79
 
@@ -81,43 +81,43 @@  discard block
 block discarded – undo
81 81
  * Adjust the rendering of the menu
82 82
  */
83 83
 function boinc_links__system_main_menu($links, $menu, $element) {
84
-  $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n";
85
-  $item_count = count($links);
86
-  $i = 1;
87
-  foreach ($links as $key => $link) {
84
+    $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n";
85
+    $item_count = count($links);
86
+    $i = 1;
87
+    foreach ($links as $key => $link) {
88 88
     $classes = array($key);
89 89
     if (strpos($key, 'active-trail')) $classes[] = 'active';
90 90
     if ($i == 1) $classes[] = 'first';
91 91
     if ($i == $item_count) $classes[] = 'last';
92 92
     $html .= '<li class="' . implode(' ', $classes) .'">';
93 93
     if ($link['title'] == 'Home') {
94
-      $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link');
94
+        $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link');
95 95
     }
96 96
     if (module_exists('privatemsg')) {
97
-      // Put a new mail notification next to the Account menu item
98
-      if ($link['href'] == 'dashboard') {
97
+        // Put a new mail notification next to the Account menu item
98
+        if ($link['href'] == 'dashboard') {
99 99
         $item_count = privatemsg_unread_count();
100 100
         if ($item_count) {
101
-          $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
102
-          $link['html'] = TRUE;
103
-          $link['attributes']['class'] = 'compound';
101
+            $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
102
+            $link['html'] = TRUE;
103
+            $link['attributes']['class'] = 'compound';
104
+        }
104 105
         }
105
-      }
106 106
     }
107 107
     // Put a count of items on the Moderation menu item
108 108
     if ($link['href'] == 'moderate') {
109
-      $item_count = boincuser_moderation_queue_count();
110
-      if ($item_count) {
109
+        $item_count = boincuser_moderation_queue_count();
110
+        if ($item_count) {
111 111
         $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>';
112 112
         $link['html'] = TRUE;
113
-      }
113
+        }
114 114
     }
115 115
     $html .= l($link['title'], $link['href'], $link);
116 116
     $html .= '</li>';
117 117
     $i++;
118
-  }
119
-  $html .= '</ul>' . "\n";
120
-  return $html;
118
+    }
119
+    $html .= '</ul>' . "\n";
120
+    return $html;
121 121
 }
122 122
 
123 123
 
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
  * Remove undesired local task tabs
126 126
  */
127 127
 function boinc_menu_local_task($link, $active = FALSE) {
128
-  if (strpos($link, 'admin/build/pages') !== FALSE
128
+    if (strpos($link, 'admin/build/pages') !== FALSE
129 129
   AND strpos($link, 'Edit Panel')) {
130 130
     // Remove Edit Panel tab
131 131
     return '';
132
-  }
133
-  else {
132
+    }
133
+    else {
134 134
     return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n";
135
-  }
135
+    }
136 136
 }
137 137
 
138 138
 
@@ -168,103 +168,103 @@  discard block
 block discarded – undo
168 168
  *   The name of the template being rendered ("page" in this case.)
169 169
  */
170 170
 function boinc_preprocess_page(&$vars, $hook) {
171
-  // Responsive Design: Add viewport meta tag to HTML head
172
-  drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />');
173
-  $vars['head'] = drupal_get_html_head();
174
-  //dpm($vars['head'], "preprocess (all) vars[head]");
175
-
176
-  // Expose comments to template files; this is needed so that comments can be
177
-  // rendered in locations other than directly below the node content
178
-  $vars['comments'] = $vars['comment_form'] = '';
179
-  if (module_exists('comment') && isset($vars['node'])) {
171
+    // Responsive Design: Add viewport meta tag to HTML head
172
+    drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />');
173
+    $vars['head'] = drupal_get_html_head();
174
+    //dpm($vars['head'], "preprocess (all) vars[head]");
175
+
176
+    // Expose comments to template files; this is needed so that comments can be
177
+    // rendered in locations other than directly below the node content
178
+    $vars['comments'] = $vars['comment_form'] = '';
179
+    if (module_exists('comment') && isset($vars['node'])) {
180 180
     $vars['comments'] = comment_render($vars['node']);
181 181
     $vars['comment_form'] = drupal_get_form('comment_form', array('nid' => $vars['node']->nid));
182
-  }
182
+    }
183 183
 
184
-  // Determine locale region code so the correct flag is displayed in footer
185
-  global $language;
186
-  global $theme_path;
187
-  $locality = $language->language;
188
-  if (strpos($language->language, '-')) {
184
+    // Determine locale region code so the correct flag is displayed in footer
185
+    global $language;
186
+    global $theme_path;
187
+    $locality = $language->language;
188
+    if (strpos($language->language, '-')) {
189 189
     $flag_icon = "{$theme_path}/images/flags/{$language->language}.png";
190 190
     if (!file_exists($flag_icon)) {
191
-      $lang_code = explode('-', $language->language);
192
-      $locality = $lang_code[0];
191
+        $lang_code = explode('-', $language->language);
192
+        $locality = $lang_code[0];
193 193
     }
194
-  }
195
-  // If there is no language set for some reason, default to English (en).
196
-  if (empty($locality)) {
194
+    }
195
+    // If there is no language set for some reason, default to English (en).
196
+    if (empty($locality)) {
197 197
     $locality = "en";
198
-  }
199
-  $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png";
198
+    }
199
+    $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png";
200 200
 
201
-  $server_status_url = variable_get('boinc_server_status_url', '');
202
-  if (!$server_status_url) {
201
+    $server_status_url = variable_get('boinc_server_status_url', '');
202
+    if (!$server_status_url) {
203 203
     $server_status_url = 'server_status.php';
204
-  }
205
-  $vars['server_status_url'] = $server_status_url;
204
+    }
205
+    $vars['server_status_url'] = $server_status_url;
206 206
 
207
-  $app_list_url = variable_get('boinc_app_list_url', '');
208
-  if (!$app_list_url) {
207
+    $app_list_url = variable_get('boinc_app_list_url', '');
208
+    if (!$app_list_url) {
209 209
     $app_list_url = 'apps.php';
210
-  }
211
-  $vars['app_list_url'] = $app_list_url;
212
-
213
-  // Remove title from certain pages using URL.
214
-  // This is a kludge to remove the title of the page but not the
215
-  // "head_title" which is placed in the HTML <head> section. Most of
216
-  // these pages are defined in the Page Manager module.
217
-  // See: https://dev.gridrepublic.org/browse/DBOINC-65
218
-  if (arg(0) == 'search') { 
210
+    }
211
+    $vars['app_list_url'] = $app_list_url;
212
+
213
+    // Remove title from certain pages using URL.
214
+    // This is a kludge to remove the title of the page but not the
215
+    // "head_title" which is placed in the HTML <head> section. Most of
216
+    // these pages are defined in the Page Manager module.
217
+    // See: https://dev.gridrepublic.org/browse/DBOINC-65
218
+    if (arg(0) == 'search') { 
219 219
     unset($vars['title']);
220
-  }
221
-  else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
220
+    }
221
+    else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) {
222 222
     unset($vars['title']);
223
-  }
224
-  else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
223
+    }
224
+    else if ( (arg(0)=='account') AND (arg(1)=='profile') ) {
225 225
     unset($vars['title']);
226
-  }
227
-  else if ( (arg(0)=='dashboard') ) {
226
+    }
227
+    else if ( (arg(0)=='dashboard') ) {
228 228
     unset($vars['title']);
229
-  }
230
-  else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
229
+    }
230
+    else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) {
231 231
     unset($vars['title']);
232
-  }
232
+    }
233 233
 
234
-  // Apply classes to tabs to allow for better styling options
235
-  $tabs = explode("\n", $vars['tabs']);
236
-  array_pop($tabs);
237
-  end($tabs);
238
-  $last_key = key($tabs);
239
-
240
-  foreach ($tabs as $key => &$tab) {
241
-      if (strpos($tab, 'li class=')) {
242
-          if ($key == 0) {
243
-              $tab = str_replace('li class="', 'li class="first ', $tab);
244
-          }
245
-          if ($key == $last_key) {
246
-              $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>';
247
-          }
248
-      }
249
-      elseif (strpos($tab, 'li ')) {
250
-          if ($key == 0) {
251
-              $tab = str_replace('li ', 'li class="first" ', $tab);
252
-          }
253
-          if ($key == $last_key) {
254
-              $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>';
255
-          }
256
-      }
257
-  }
258
-  $vars['tabs'] = implode("\n", $tabs);
234
+    // Apply classes to tabs to allow for better styling options
235
+    $tabs = explode("\n", $vars['tabs']);
236
+    array_pop($tabs);
237
+    end($tabs);
238
+    $last_key = key($tabs);
239
+
240
+    foreach ($tabs as $key => &$tab) {
241
+        if (strpos($tab, 'li class=')) {
242
+            if ($key == 0) {
243
+                $tab = str_replace('li class="', 'li class="first ', $tab);
244
+            }
245
+            if ($key == $last_key) {
246
+                $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>';
247
+            }
248
+        }
249
+        elseif (strpos($tab, 'li ')) {
250
+            if ($key == 0) {
251
+                $tab = str_replace('li ', 'li class="first" ', $tab);
252
+            }
253
+            if ($key == $last_key) {
254
+                $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>';
255
+            }
256
+        }
257
+    }
258
+    $vars['tabs'] = implode("\n", $tabs);
259 259
 
260
-  // Get the main menu but only for the branch the page is on.
261
-  $vars['menu_tree_onlyactive'] = menu_tree('primary-links');
260
+    // Get the main menu but only for the branch the page is on.
261
+    $vars['menu_tree_onlyactive'] = menu_tree('primary-links');
262 262
 
263
-  // Create tertiary menu
264
-  $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2);
263
+    // Create tertiary menu
264
+    $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2);
265 265
 
266
-  // Create action links
267
-  $vars['action_links'] = _boinc_action_links();
266
+    // Create action links
267
+    $vars['action_links'] = _boinc_action_links();
268 268
 }
269 269
 
270 270
 /**
@@ -277,79 +277,79 @@  discard block
 block discarded – undo
277 277
  */
278 278
 function boinc_preprocess_node(&$vars, $hook) {
279 279
 
280
-  //$vars['sample_variable'] = t('Lorem ipsum.');
280
+    //$vars['sample_variable'] = t('Lorem ipsum.');
281 281
 
282
-  // Detach subscribe link from the links list. Subscribe link will be placed
283
-  // on page separately from links.
284
-  if (!empty($vars['node']->links['flag-subscriptions']['title'])) {
282
+    // Detach subscribe link from the links list. Subscribe link will be placed
283
+    // on page separately from links.
284
+    if (!empty($vars['node']->links['flag-subscriptions']['title'])) {
285 285
     $vars['subscribe_link'] = $vars['node']->links['flag-subscriptions']['title'];
286 286
     unset($vars['node']->links['flag-subscriptions']);
287
-  }
287
+    }
288 288
 
289
-  // Optionally, run node-type-specific preprocess functions, like
290
-  // boinc_preprocess_node_page() or boinc_preprocess_node_story().
291
-  $function = __FUNCTION__ . '_' . $vars['node']->type;
292
-  if (function_exists($function)) {
289
+    // Optionally, run node-type-specific preprocess functions, like
290
+    // boinc_preprocess_node_page() or boinc_preprocess_node_story().
291
+    $function = __FUNCTION__ . '_' . $vars['node']->type;
292
+    if (function_exists($function)) {
293 293
     $function($vars, $hook);
294
-  }
294
+    }
295 295
 }
296 296
 
297 297
 /**
298 298
  * Preprocessing for forum lists
299 299
  */
300 300
 function boinc_preprocess_forums(&$vars, $hook) {
301
-  // Add a link to mark all forums as read
302
-  module_load_include('inc', 'forum_tweaks', 'includes/mark-read');
303
-  forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']);
304
-  if (!$vars['parents']) {
301
+    // Add a link to mark all forums as read
302
+    module_load_include('inc', 'forum_tweaks', 'includes/mark-read');
303
+    forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']);
304
+    if (!$vars['parents']) {
305 305
     // Remove the "Post new forum topic" link from the top level forum list
306 306
     unset($vars['links']['forum']);
307 307
     // Add a link to manage subscriptions for the user
308 308
     $vars['links']['subscriptions'] = array(
309
-      'title' => bts('Manage subscriptions', array(), NULL, 'boinc:forum-footer'),
310
-      'href' => 'account/prefs/subscriptions',
309
+        'title' => bts('Manage subscriptions', array(), NULL, 'boinc:forum-footer'),
310
+        'href' => 'account/prefs/subscriptions',
311 311
     );
312
-  }
312
+    }
313 313
 }
314 314
 
315 315
 /**
316 316
  * Preprocessing for forum type nodes
317 317
  */
318 318
 function boinc_preprocess_node_forum(&$vars, $hook) {
319
-  global $language;
320
-  global $user;
319
+    global $language;
320
+    global $user;
321 321
 
322
-  // Locality
323
-  $vars['locality'] = $language->language;
322
+    // Locality
323
+    $vars['locality'] = $language->language;
324 324
 
325
-  // Get the author of the node
326
-  $account = user_load($vars['uid']);
327
-  $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50);
325
+    // Get the author of the node
326
+    $account = user_load($vars['uid']);
327
+    $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50);
328 328
   
329
-  // Add signature
330
-  $vars['signature'] = check_markup($account->signature, $vars['node']->format);
329
+    // Add signature
330
+    $vars['signature'] = check_markup($account->signature, $vars['node']->format);
331 331
   
332
-  // Show signatures based on user preference
333
-  $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
332
+    // Show signatures based on user preference
333
+    $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
334 334
   
335
-  // Expose comment sort order so that the template can put the topic node
336
-  // content (i.e. initial post) at the very end if "Newest post first" is the
337
-  // preference used by this user
338
-  $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE;
339
-  $vars['node']->comment = 0;
335
+    // Expose comment sort order so that the template can put the topic node
336
+    // content (i.e. initial post) at the very end if "Newest post first" is the
337
+    // preference used by this user
338
+    $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE;
339
+    $vars['node']->comment = 0;
340 340
   
341
-  $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1));
342
-  $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1);
343
-  $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1));
344
-
345
-  $links = $vars['links'];
346
-  $moderator_links = array();
347
-  _boinc_create_moderator_links($links, $moderator_links);
348
-  $vars['links'] = $links;
349
-  $vars['moderator_links'] = $moderator_links;
350
-
351
-  // Ignore user link
352
-  $vars['ignore_link'] = _boinc_ignore_user_link('node', $vars['node']);
341
+    $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1));
342
+    $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1);
343
+    $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1));
344
+
345
+    $links = $vars['links'];
346
+    $moderator_links = array();
347
+    _boinc_create_moderator_links($links, $moderator_links);
348
+    $vars['links'] = $links;
349
+    $vars['moderator_links'] = $moderator_links;
350
+
351
+    // Ignore user link
352
+    $vars['ignore_link'] = _boinc_ignore_user_link('node', $vars['node']);
353 353
 }
354 354
 
355 355
 
@@ -370,48 +370,48 @@  discard block
 block discarded – undo
370 370
  *   The name of the template being rendered ("comment" in this case.)
371 371
  */
372 372
 function boinc_preprocess_comment(&$vars, $hook) {
373
-  global $language;
374
-  global $user;
373
+    global $language;
374
+    global $user;
375 375
 
376
-  // Locality
377
-  $vars['locality'] = $language->language;
376
+    // Locality
377
+    $vars['locality'] = $language->language;
378 378
 
379
-  // Show signatures based on user preference
380
-  $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
379
+    // Show signatures based on user preference
380
+    $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE;
381 381
 
382
-  $links = $vars['links'];
383
-  $moderator_links = array();
384
-  _boinc_create_moderator_links($links, $moderator_links);
385
-  $vars['links'] = $links;
386
-  $vars['moderator_links'] = $moderator_links;
382
+    $links = $vars['links'];
383
+    $moderator_links = array();
384
+    _boinc_create_moderator_links($links, $moderator_links);
385
+    $vars['links'] = $links;
386
+    $vars['moderator_links'] = $moderator_links;
387 387
 
388
-  // Ignore user link
389
-  $vars['ignore_link'] = _boinc_ignore_user_link('comment', $vars['comment']);
388
+    // Ignore user link
389
+    $vars['ignore_link'] = _boinc_ignore_user_link('comment', $vars['comment']);
390 390
 }
391 391
 
392 392
 /**
393 393
  *
394 394
  */
395 395
 function boinc_preprocess_forum_topic_list(&$variables) {
396
-  if (!empty($variables['topics'])) {
396
+    if (!empty($variables['topics'])) {
397 397
     foreach ($variables['topics'] as $id => $topic) {
398
-      if ($topic->new_replies) {
398
+        if ($topic->new_replies) {
399 399
         $cid = boincuser_get_first_unread_comment_id($topic->nid);
400 400
         if ($cid) {
401
-          $variables['topics'][$id]->new_url = url("goto/comment/{$cid}");
401
+            $variables['topics'][$id]->new_url = url("goto/comment/{$cid}");
402 402
         }
403 403
         else {
404
-          // User hasn't visited this topic before, so all replies are new...
405
-          $topic->new_replies = NULL;
404
+            // User hasn't visited this topic before, so all replies are new...
405
+            $topic->new_replies = NULL;
406
+        }
406 407
         }
407
-      }
408
-      // Use same logic in forum.module to change message if topic has
409
-      // moved. Changed link to match boinc path-added "community".
410
-      if ($topic->forum_tid != $variables['tid']) {
408
+        // Use same logic in forum.module to change message if topic has
409
+        // moved. Changed link to match boinc path-added "community".
410
+        if ($topic->forum_tid != $variables['tid']) {
411 411
         $variables['topics'][$id]->message = l(t('This topic has been moved'), "community/forum/$topic->forum_tid");
412
-      }
412
+        }
413
+    }
413 414
     }
414
-  }
415 415
 }
416 416
 
417 417
 /**
@@ -424,79 +424,79 @@  discard block
 block discarded – undo
424 424
  */
425 425
 ///* -- Delete this line if you want to use this function
426 426
 function boinc_preprocess_views_view(&$vars, $hook) {
427
-  switch ($vars['name']) {
428
-  case 'boinc_account_computers': 
427
+    switch ($vars['name']) {
428
+    case 'boinc_account_computers': 
429 429
     switch ($vars['display_id']) {
430 430
     case 'page_1':
431 431
     case 'panel_pane_1':
432 432
       $vars['empty'] = boincwork_views_host_list_empty_text();
433
-      break;
433
+        break;
434 434
     case 'page_2':
435 435
       $vars['empty'] = boincwork_views_host_list_empty_text('active');
436
-      break;
436
+        break;
437 437
     case 'block_1':
438 438
       $vars['empty'] = boincwork_views_host_list_empty_text('preferences');
439
-      break;
439
+        break;
440 440
     default:
441 441
     }
442 442
     break;
443
-  case 'boinc_account_tasks_all':
443
+    case 'boinc_account_tasks_all':
444 444
     $vars['empty'] = boincwork_views_task_list_empty_text();
445 445
     break;
446
-  case 'boinc_friends':
446
+    case 'boinc_friends':
447 447
     if ($vars['display_id'] == 'block_1') {
448
-      $vars['header'] = boincuser_views_friends_block_header(); 
448
+        $vars['header'] = boincuser_views_friends_block_header(); 
449 449
     }
450 450
     break;
451
-  case 'boinc_host':
451
+    case 'boinc_host':
452 452
       $view = views_get_current_view();
453
-      if (!($view->result)) {
453
+        if (!($view->result)) {
454 454
         $vars['footer'] = '<h3>' . bts ('Host not found in database.', array(), NULL, 'boinc:host-details') . '</h3>';
455
-      }
455
+        }
456 456
     break;
457
-  case 'boinc_host_list':
457
+    case 'boinc_host_list':
458 458
     if ($vars['display_id'] == 'page_2') {
459
-     $vars['empty'] = boincwork_views_host_list_empty_text();
459
+        $vars['empty'] = boincwork_views_host_list_empty_text();
460 460
     }
461 461
     elseif ($vars['display_id'] == 'page_1') {
462
-      $vars['empty'] = boincwork_views_host_list_empty_text('active');
462
+        $vars['empty'] = boincwork_views_host_list_empty_text('active');
463 463
     }
464 464
     break;
465
-  case 'boinc_task':
465
+    case 'boinc_task':
466 466
     // Load view object (view data is not available in header / footer); execute view query
467 467
     $view = views_get_current_view();
468 468
     $view->execute();
469 469
     $result = reset($view->result);
470 470
 
471 471
     if ($result) {
472
-      // Display the stderr output in the footer
473
-      $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>';
474
-      $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>';
472
+        // Display the stderr output in the footer
473
+        $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>';
474
+        $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>';
475 475
     } else {
476
-      $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>';
476
+        $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>';
477 477
     }
478 478
     break;
479
-  case 'boinc_teams':
479
+    case 'boinc_teams':
480 480
     if ($vars['display_id'] == 'panel_pane_3') {
481
-      $team_id = arg(2);
482
-      $vars['header'] = boincteam_manage_admins_panel_header($team_id);
481
+        $team_id = arg(2);
482
+        $vars['header'] = boincteam_manage_admins_panel_header($team_id);
483 483
     }
484 484
     break;
485
-  case 'boinc_workunit':
485
+    case 'boinc_workunit':
486 486
     ob_start();
487 487
     // Get the workunit ID from the URL
488 488
     $result_id = arg(1);
489 489
     require_boinc(array('util','boinc_db'));
490 490
     $wu = BoincWorkunit::lookup_id($result_id);
491 491
     if ($wu) {
492
-      // Output from admin defined BOINC project-specific function
493
-      project_workunit($wu);
494
-      // Output of project_workunit() gets caught in the buffer
495
-      $vars['footer'] = ob_get_clean();
492
+        // Output from admin defined BOINC project-specific function
493
+        project_workunit($wu);
494
+        // Output of project_workunit() gets caught in the buffer
495
+        $vars['footer'] = ob_get_clean();
496 496
     } else {
497
-      $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>';
497
+        $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>';
498 498
     }
499
-  default:
499
+    default:
500 500
   }
501 501
 }
502 502
 // */
@@ -509,19 +509,19 @@  discard block
 block discarded – undo
509 509
  */
510 510
 ///* -- Delete this line if you want to use this function
511 511
 function boinc_preprocess_privatemsg_view(&$vars, $hook) {
512
-  $author_picture = '<div class="picture">';
513
-  $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid);
514
-  if ($user_image) {
512
+    $author_picture = '<div class="picture">';
513
+    $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid);
514
+    if ($user_image) {
515 515
     if (is_array($user_image) AND $user_image['image']['filepath']) {
516
-      $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false);
516
+        $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false);
517 517
     }
518 518
     elseif (is_string($user_image)) {
519
-      $author_picture .= '<img src="' . $user_image . '"/>';
519
+        $author_picture .= '<img src="' . $user_image . '"/>';
520 520
     }
521
-  }
522
-  $author_picture .= '</div>';
523
-  $vars['author_picture'] = $author_picture;
524
-  $vars['message_timestamp'] = date('j M Y G:i:s T', $vars['message']['timestamp']);
521
+    }
522
+    $author_picture .= '</div>';
523
+    $vars['author_picture'] = $author_picture;
524
+    $vars['message_timestamp'] = date('j M Y G:i:s T', $vars['message']['timestamp']);
525 525
 }
526 526
 // */
527 527
 
@@ -540,19 +540,19 @@  discard block
 block discarded – undo
540 540
 // */ 
541 541
 
542 542
 function boinc_preprocess_search_result(&$variables) {
543
-  global $language;
544
-  // Locality
545
-  $variables['locality'] = $language->language;
543
+    global $language;
544
+    // Locality
545
+    $variables['locality'] = $language->language;
546 546
 
547
-  // Change the format of the search result date/time in the info string.
548
-  if ($variables['result']['date']) {
547
+    // Change the format of the search result date/time in the info string.
548
+    if ($variables['result']['date']) {
549 549
     $variables['info_split']['date'] = date('j M Y G:i:s T', $variables['result']['date']);
550
-  }
551
-  $variables['info'] = implode(' - ', $variables['info_split']);
550
+    }
551
+    $variables['info'] = implode(' - ', $variables['info_split']);
552 552
 
553
-  $type = strtolower($variables['result']['bundle']);
554
-  switch ($type) {
555
-  case 'profile':
553
+    $type = strtolower($variables['result']['bundle']);
554
+    switch ($type) {
555
+    case 'profile':
556 556
   case 'user':
557 557
     $node = $variables['result']['node'];
558 558
     $variables['url'] = url('account/' . $node->is_uid);
@@ -560,20 +560,20 @@  discard block
 block discarded – undo
560 560
     $variables['user_image'] = boincuser_get_user_profile_image($node->is_uid);
561 561
     $variables['account'] = user_load($node->is_uid);
562 562
     break;
563
-  case 'team':
563
+    case 'team':
564 564
     $node = $variables['result']['node'];
565 565
     $variables['url'] = url('/community/teams/' . $node->entity_id);;
566 566
     break;
567
-  case 'forum':
567
+    case 'forum':
568 568
     $node = $variables['result']['node'];
569 569
     $drupalnode = node_load($node->entity_id);
570 570
     // Get the taxonomy for the node, creates a link to the parent forum
571 571
     $taxonomy = reset($drupalnode->taxonomy);
572 572
     if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
573
-      $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
573
+        $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
574 574
     }
575 575
     break;
576
-  case 'comment':
576
+    case 'comment':
577 577
     // Get the node id for this comment
578 578
     $nid = $variables['result']['fields']['tos_content_extra'];
579 579
     $drupalnode = node_load($nid);
@@ -584,21 +584,21 @@  discard block
 block discarded – undo
584 584
     // Get the taxonomy for the node, creates a link to the parent forum
585 585
     $taxonomy = reset($drupalnode->taxonomy);
586 586
     if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
587
-      $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
587
+        $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}");
588 588
     }
589
-  break;
590
-  default:
589
+    break;
590
+    default:
591 591
   }
592 592
 }
593 593
 
594 594
 // Remove the mess of text under the search form and don't display "no results"
595 595
 // if a search hasn't even been submitted
596 596
 function boinc_apachesolr_search_noresults() {
597
-  $message = bts('No results found...', array(), NULL, 'boinc:search-with-no-results');
598
-  if (!arg(2)) {
597
+    $message = bts('No results found...', array(), NULL, 'boinc:search-with-no-results');
598
+    if (!arg(2)) {
599 599
     $message = '';
600
-  }
601
-  return '<p>' . $message . '</p>';
600
+    }
601
+    return '<p>' . $message . '</p>';
602 602
 }
603 603
 
604 604
 /**
@@ -607,42 +607,42 @@  discard block
 block discarded – undo
607 607
  */
608 608
 function phptemplate_username($object) {
609 609
   
610
-  if ($object->uid && $object->name) {
610
+    if ($object->uid && $object->name) {
611 611
     
612 612
     // Show the profile name in general, not the username
613 613
     $name = user_load($object->uid)->boincuser_name;
614 614
     
615 615
     // Shorten the name when it is too long or it will break many tables.
616 616
     if (drupal_strlen($name) > 20) {
617
-      $name = drupal_substr($name, 0, 15) . '...';
617
+        $name = drupal_substr($name, 0, 15) . '...';
618 618
     }
619 619
 
620 620
     if (user_access('access user profiles')) {
621
-      $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
621
+        $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table'))));
622 622
     }
623 623
     else {
624
-      $output = check_plain($name);
624
+        $output = check_plain($name);
625 625
     }
626
-  }
627
-  else if ($object->name) {
626
+    }
627
+    else if ($object->name) {
628 628
     // Sometimes modules display content composed by people who are
629 629
     // not registered members of the site (e.g. mailing list or news
630 630
     // aggregator modules). This clause enables modules to display
631 631
     // the true author of the content.
632 632
     if (!empty($object->homepage)) {
633
-      $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
633
+        $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
634 634
     }
635 635
     else {
636
-      $output = check_plain($object->name);
636
+        $output = check_plain($object->name);
637 637
     }
638 638
 
639 639
     $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')';
640
-  }
641
-  else {
640
+    }
641
+    else {
642 642
     $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user')));
643
-  }
643
+    }
644 644
 
645
-  return $output;
645
+    return $output;
646 646
 }
647 647
 
648 648
 /**
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
  * "More information about formatting options"
651 651
  */
652 652
 function boinc_filter_tips_more_info () {
653
-  return '';
653
+    return '';
654 654
 }
655 655
 
656 656
 /**
@@ -668,19 +668,19 @@  discard block
 block discarded – undo
668 668
  *   An array containing the email [type] (mailkey), [subject] and [body].
669 669
  */
670 670
 function boinc_flag_friend_message_email($status, $flag, $recipient, $sender) {
671
-  $email = array();
672
-  $email['type'] = 'flag-friend';
673
-  // Reload the sender to get a full user object
674
-  $sender = user_load($sender->uid);
671
+    $email = array();
672
+    $email['type'] = 'flag-friend';
673
+    // Reload the sender to get a full user object
674
+    $sender = user_load($sender->uid);
675 675
   
676
-  switch ($status) {
676
+    switch ($status) {
677 677
     case FLAG_FRIEND_FLAGGED:
678 678
       // Sender accepted recipient's friend request
679 679
       $email['subject'] = bts('!name accepted your friend request [!site]', array(
680 680
         '!name' => $sender->boincuser_name,
681 681
         '!site' => variable_get('site_name', 'Drupal-BOINC'),
682 682
         ), NULL, 'boinc:friend-request-email');
683
-      $email['body'] = bts('!name confirmed you as a friend on !site.
683
+        $email['body'] = bts('!name confirmed you as a friend on !site.
684 684
 
685 685
 Follow this link to view his or her profile:
686 686
 !link
@@ -694,12 +694,12 @@  discard block
 block discarded – undo
694 694
         '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
695 695
         '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)),
696 696
         ), array(), NULL, 'boinc:friend-request-email');
697
-      break;
697
+        break;
698 698
 
699 699
     case FLAG_FRIEND_PENDING:
700 700
       // Sender is requesting to be recipient's friend
701 701
       $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email');
702
-      $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
702
+        $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts.
703 703
 
704 704
 Follow the link below to view this request:
705 705
 !link
@@ -713,26 +713,26 @@  discard block
 block discarded – undo
713 713
         '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '',
714 714
         '!link' => url('goto/friend-requests', array('absolute' => TRUE)),
715 715
         ),
716
-      array(), NULL, 'boinc:friend-request-email');
717
-      break;
718
-  }
719
-  return $email;
716
+        array(), NULL, 'boinc:friend-request-email');
717
+        break;
718
+    }
719
+    return $email;
720 720
 }
721 721
 
722 722
 /**
723 723
  * Edit action links
724 724
  */
725 725
 function phptemplate_links($links, $attributes = array('class' => 'links')) {
726
-  if ($links){
726
+    if ($links){
727 727
     // Remove flag-subscriptions link. It will be placed elsewhere.
728 728
     if (isset($links['flag-subscriptions'])) {
729
-      unset($links['flag-subscriptions']);
729
+        unset($links['flag-subscriptions']);
730 730
     }
731 731
     // Reorder the links however you need them.
732 732
     $links = reorder_links($links, array('comment_edit','quote','comment_add','comment_reply','flag-abuse_comment','flag-abuse_node'), array('comment_delete'));
733 733
     // Use the built-in theme_links() function to format the $links array.
734 734
     return theme_links($links, $attributes);
735
-  }
735
+    }
736 736
 }
737 737
 
738 738
 /**
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
  * That is to say, get rid of it and use the views-view-table.tpl.php template.
777 777
  */
778 778
 function boinc_tablesort_indicator($style) {
779
-  return '';
780
-  /*
779
+    return '';
780
+    /*
781 781
   if ($style == "asc") {
782 782
     return theme('image', 'misc/arrow-asc.png', t('sort icon'), t('sort ascending'));
783 783
   }
@@ -800,48 +800,48 @@  discard block
 block discarded – undo
800 800
  *
801 801
  */
802 802
 function _boinc_create_moderator_links(&$links, &$moderator_links) {
803
-  // If there are no links, then do nothing
804
-  if (empty($links)) {
803
+    // If there are no links, then do nothing
804
+    if (empty($links)) {
805 805
     return;
806
-  }
806
+    }
807 807
 
808
-  $alllinks = array();
809
-  $modlinks = array();
808
+    $alllinks = array();
809
+    $modlinks = array();
810 810
 
811
-  // Create an array of HTML elements from the $links string, keys
812
-  // are the class attribute for the <li> tags.
813
-  $dom = new DOMDocument;
814
-  $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8'));
815
-  foreach($dom->getElementsByTagName('li') as $node) {
811
+    // Create an array of HTML elements from the $links string, keys
812
+    // are the class attribute for the <li> tags.
813
+    $dom = new DOMDocument;
814
+    $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8'));
815
+    foreach($dom->getElementsByTagName('li') as $node) {
816 816
     $key = $node->getAttribute("class");
817 817
     $alllinks[$key] = $dom->saveHTML($node);
818
-  }
818
+    }
819 819
 
820
-  // Select classes to be placed into moderator links array
821
-  $selected_classes = array(
820
+    // Select classes to be placed into moderator links array
821
+    $selected_classes = array(
822 822
     "make_sticky", "make_unsticky",
823 823
     "lock", "unlock",
824 824
     "convert",
825 825
     "hide", "unhide",
826 826
     "comment_delete",
827
-  );
828
-  foreach(array_keys($alllinks) as $key1) {
827
+    );
828
+    foreach(array_keys($alllinks) as $key1) {
829 829
     // Select string up to first space, if present.
830 830
     $class1 = strtok($key1, ' ');
831 831
     if (in_array($class1, $selected_classes)) {
832
-      if (empty($modlinks)) {
832
+        if (empty($modlinks)) {
833 833
         _boinc_firstlink($alllinks[$key1]);
834
-      }
835
-      $modlinks[$key1] = $alllinks[$key1];
836
-      unset($alllinks[$key1]);
834
+        }
835
+        $modlinks[$key1] = $alllinks[$key1];
836
+        unset($alllinks[$key1]);
837 837
     }
838
-  }
839
-  // Convert the HTML arrays back into strings, wrap them in <ul>
840
-  // tags
841
-  $links = "<ul class=\"links\">".implode($alllinks)."</ul>";
842
-  $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>";
838
+    }
839
+    // Convert the HTML arrays back into strings, wrap them in <ul>
840
+    // tags
841
+    $links = "<ul class=\"links\">".implode($alllinks)."</ul>";
842
+    $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>";
843 843
 
844
-  return;
844
+    return;
845 845
 }
846 846
 
847 847
 /*
@@ -849,38 +849,38 @@  discard block
 block discarded – undo
849 849
  * attribute to class.
850 850
  */
851 851
 function _boinc_firstlink(&$alink) {
852
-  if (!empty($alink)) {
852
+    if (!empty($alink)) {
853 853
     $dom = new DomDocument;
854 854
     $dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8'));
855 855
 
856 856
     $myli = $dom->getElementsByTagName('li');
857 857
     if ($myli->length>0) {
858
-      $newclasses = trim(($myli[0]->getAttribute("class"))." first");
859
-      $myli[0]->setAttribute("class", $newclasses);
860
-      $alink = $dom->saveHTML($myli[0]);
858
+        $newclasses = trim(($myli[0]->getAttribute("class"))." first");
859
+        $myli[0]->setAttribute("class", $newclasses);
860
+        $alink = $dom->saveHTML($myli[0]);
861
+    }
861 862
     }
862
-  }
863 863
 }
864 864
 
865 865
 /*
866 866
  * Private function to generate the action links
867 867
  */
868 868
 function _boinc_action_links() {
869
-  global $user;
870
-  global $base_path;
869
+    global $user;
870
+    global $base_path;
871 871
 
872
-  $output = '<ul class="menu"><li class="first">';
873
-  if ($user->uid) {
872
+    $output = '<ul class="menu"><li class="first">';
873
+    if ($user->uid) {
874 874
     $output .= '<a href="' . url('logout') . '">' . bts('Logout', array(), NULL, 'boinc:menu-link') . '</a>';
875
-  } else {
875
+    } else {
876 876
     $output .= '<a href="' . url('user/login', array('query' => drupal_get_destination()) ) . '">' . bts('Login', array(), NULL, 'boinc:menu-link') . '</a>';
877
-  }
878
-  $output .= '</li>';
879
-  if (module_exists('global_search') OR module_exists('global_search_solr')) {
877
+    }
878
+    $output .= '</li>';
879
+    if (module_exists('global_search') OR module_exists('global_search_solr')) {
880 880
     $output .= '<li class="last"> <a class="search" href="' . url('search/site') . '">' . bts('search', array(), NULL, 'boinc:menu-link') .'</a> </l1>';
881
-  }
882
-  $output .= '</ul>';
883
-  return $output;
881
+    }
882
+    $output .= '</ul>';
883
+    return $output;
884 884
 }
885 885
 
886 886
 /**
@@ -888,47 +888,47 @@  discard block
 block discarded – undo
888 888
  * function. Modified for boinc functionality.
889 889
  */
890 890
 function _boinc_ignore_user_link($type, $object = NULL, $teaser = FALSE) {
891
-  global $user;
891
+    global $user;
892 892
 
893
-  if (!$user || !$user->uid) {
893
+    if (!$user || !$user->uid) {
894 894
     return;
895
-  }
895
+    }
896 896
 
897
-  static $ignored;
898
-  $links = array();
897
+    static $ignored;
898
+    $links = array();
899 899
 
900
-  if ($type == 'node' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
900
+    if ($type == 'node' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
901 901
     if (!isset($ignored[$object->uid])) {
902
-      $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
902
+        $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
903 903
     }
904 904
     if ($ignored[$object->uid] == 0) {
905
-      $links['ignore_user'] = array(
905
+        $links['ignore_user'] = array(
906 906
         'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
907 907
         'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
908 908
         'query' => 'destination='. $_GET['q'],
909 909
         'attributes' => array(
910
-          'class' => 'ignore-user',
911
-          'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
910
+            'class' => 'ignore-user',
911
+            'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
912 912
         ),
913
-      );
913
+        );
914 914
     }
915
-  }
916
-  else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
915
+    }
916
+    else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) {
917 917
     if (!isset($ignored[$object->uid])) {
918
-      $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
918
+        $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid));
919 919
     }
920 920
     if ($ignored[$object->uid] == 0) {
921
-      $links['ignore_user'] = array(
921
+        $links['ignore_user'] = array(
922 922
         'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'),
923 923
         'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid,
924 924
         'query' => 'destination='. $_GET['q'],
925 925
         'attributes' => array(
926
-          'class' => 'ignore-user',
927
-          'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
926
+            'class' => 'ignore-user',
927
+            'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'),
928 928
         ),
929
-      );
929
+        );
930
+    }
930 931
     }
931
-  }
932 932
 
933
-  return $links;
933
+    return $links;
934 934
 }
935 935
\ No newline at end of file
Please login to merge, or discard this patch.
html/user/recover_email.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@
 block discarded – undo
56 56
                 "email_addr=previous_email_addr, previous_email_addr='', email_addr_change_time=0, passwd_hash='$database_passwd_hash', email_validated=0"
57 57
             );
58 58
             $result = delete_token($userid, $token, TOKEN_TYPE_CHANGE_EMAIL);
59
-	}
59
+    }
60 60
     } else {
61
-	echo tra("Invalid token.");
61
+    echo tra("Invalid token.");
62 62
     }
63 63
 } else {
64 64
     echo tra("Invalid token.");
Please login to merge, or discard this patch.