Passed
Pull Request — master (#4563)
by
unknown
15:40 queued 06:49
created
modules/boinc_solr_search/boinc_solr_comments/boinc_solr_comments.module 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
  * Implementation of hook_menu()
15 15
  */
16 16
 function boinc_solr_comments_menu() {
17
-  $items = array();
18
-  $base_path = 'admin/settings/apachesolr/indexcomments';
19
-  $items[$base_path] = array(
20
-      'title' => 'Index Comments',
21
-      'description' => 'Administer Indexing of Comments',
22
-      'page callback' => 'drupal_get_form',
23
-      'page arguments' => array('boinc_solr_comments_form'),
24
-      'access arguments' => array('administer search'),
25
-      'file' => 'boinc_solr_comments.admin.inc',
26
-      'weight' => '10',
27
-  );
28
-
29
-  return $items;
17
+    $items = array();
18
+    $base_path = 'admin/settings/apachesolr/indexcomments';
19
+    $items[$base_path] = array(
20
+        'title' => 'Index Comments',
21
+        'description' => 'Administer Indexing of Comments',
22
+        'page callback' => 'drupal_get_form',
23
+        'page arguments' => array('boinc_solr_comments_form'),
24
+        'access arguments' => array('administer search'),
25
+        'file' => 'boinc_solr_comments.admin.inc',
26
+        'weight' => '10',
27
+    );
28
+
29
+    return $items;
30 30
 }
31 31
 
32 32
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
  *   Environment ID for apache solr.
59 59
  */
60 60
 function boinc_solr_comments_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) {
61
-  $comdocs = array();
61
+    $comdocs = array();
62 62
 
63
-  // Array of node types that will have comments indexed.
64
-  $node_types = variable_get('boinc_solr_comments_nodetypes', '');
65
-  if (empty($node_types)) {
63
+    // Array of node types that will have comments indexed.
64
+    $node_types = variable_get('boinc_solr_comments_nodetypes', '');
65
+    if (empty($node_types)) {
66 66
     // If the variable has not been set, then by default index
67 67
     // comments for all known node types.
68 68
     $node_types = array(
@@ -72,28 +72,28 @@  discard block
 block discarded – undo
72 72
         'story'      => 'story',
73 73
         'team_forum' => 'team_forum',
74 74
     );
75
-  }
75
+    }
76 76
   
77
-  // Loop over all documents and alter:
78
-  foreach ($documents as $document) {
77
+    // Loop over all documents and alter:
78
+    foreach ($documents as $document) {
79 79
     //dd($document, "index documents alter - document");
80 80
 
81 81
     $to_process = ( array_key_exists($document->bundle, $node_types) AND $node_types[$document->bundle] );
82 82
     if ( $document->entity_type=='node' AND $to_process) {
83 83
       
84
-      // Remove ts_comments if present.
85
-      if (isset($document->ts_comments)) {
84
+        // Remove ts_comments if present.
85
+        if (isset($document->ts_comments)) {
86 86
         unset($document->ts_comments);
87
-      }
88
-      // Node information.
89
-      $nid = $document->entity_id;
90
-      $node = node_load($nid);
87
+        }
88
+        // Node information.
89
+        $nid = $document->entity_id;
90
+        $node = node_load($nid);
91 91
       
92
-      // Query database for comments of node. Only return comments
93
-      // with status 0 (0 is published for comments).
94
-      $sql = 'SELECT cid from {comments} WHERE nid = %d AND status = 0 ORDER by timestamp DESC';
95
-      $resource = db_query($sql, $nid);
96
-      while ($row = db_fetch_array($resource)) {
92
+        // Query database for comments of node. Only return comments
93
+        // with status 0 (0 is published for comments).
94
+        $sql = 'SELECT cid from {comments} WHERE nid = %d AND status = 0 ORDER by timestamp DESC';
95
+        $resource = db_query($sql, $nid);
96
+        while ($row = db_fetch_array($resource)) {
97 97
         // Load the comment from cid.
98 98
         $comment = _comment_load($row['cid']);
99 99
 
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         // Comment object has no language
117 117
         $comment_document->ss_language = 'und';
118 118
         if (function_exists('drupal_get_path_alias')) {
119
-          $output = drupal_get_path_alias($comment_document->path, NULL);
120
-          if ($output && $output != $document->path) {
119
+            $output = drupal_get_path_alias($comment_document->path, NULL);
120
+            if ($output && $output != $document->path) {
121 121
             $comment_document->path_alias = $output;
122
-          }
122
+            }
123 123
         }
124 124
         
125 125
         // Code derived from apachesolr_index_node_solr_document
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 
130 130
         // Author information
131 131
         if ($comment->uid == 0 || strlen($comment->name) == 0) {
132
-          // @see user_validate_name(). !'0' === TRUE.
133
-          $comment_document->ss_name = '0';
132
+            // @see user_validate_name(). !'0' === TRUE.
133
+            $comment_document->ss_name = '0';
134 134
         }
135 135
         else {
136
-          $comment_document->ss_name = $comment->name;
137
-          // We want the name to be searchable for keywords.
138
-          $comment_document->tos_name = $comment->name;
136
+            $comment_document->ss_name = $comment->name;
137
+            // We want the name to be searchable for keywords.
138
+            $comment_document->tos_name = $comment->name;
139 139
         }
140 140
 
141 141
         // Index formatted username so it can be searched and sorted
@@ -157,59 +157,59 @@  discard block
 block discarded – undo
157 157
         // Unset the following fields (if set) that don't make sense
158 158
         // for a comment.
159 159
         if (isset($comment_document->bs_sticky)) {
160
-          unset($comment_document->bs_sticky);
160
+            unset($comment_document->bs_sticky);
161 161
         }
162 162
         if (isset($comment_document->bs_promote)) {
163
-          unset($comment_document->bs_promote);
163
+            unset($comment_document->bs_promote);
164 164
         }    
165 165
         if (isset($comment_document->is_tnid)) {
166
-          unset($comment_document->is_tnid);
166
+            unset($comment_document->is_tnid);
167 167
         }
168 168
         if (isset($comment_document->bs_translate)) {
169
-          unset($comment_document->bs_translate);
169
+            unset($comment_document->bs_translate);
170 170
         }
171 171
         if (isset($comment_document->ts_last_comment_timestamp)) {
172
-          unset($comment_document->ts_last_comment_timestamp);
172
+            unset($comment_document->ts_last_comment_timestamp);
173 173
         }
174 174
         if (isset($comment_document->ds_last_comment_or_change)) {
175
-          unset($comment_document->ds_last_comment_or_change);
175
+            unset($comment_document->ds_last_comment_or_change);
176 176
         }
177 177
         if (isset($comment_document->is_comment_count)) {
178
-          unset($comment_document->is_comment_count);
178
+            unset($comment_document->is_comment_count);
179 179
         }
180 180
 
181 181
         // Loop over fields in document and copy relevant values into
182 182
         // comment_document.
183 183
         foreach ($document as $fieldName => $fieldValue) {
184 184
 
185
-          // Copy over fields [im_taxonomy_vid_1], [tid], [im_vid_1],
186
-          // [im_vid_Forums], [tm_vid_1_names]
187
-          if ( ( preg_match('/tid/', $fieldName) OR preg_match('/vid/', $fieldName) ) AND is_array($fieldValue) ) {
185
+            // Copy over fields [im_taxonomy_vid_1], [tid], [im_vid_1],
186
+            // [im_vid_Forums], [tm_vid_1_names]
187
+            if ( ( preg_match('/tid/', $fieldName) OR preg_match('/vid/', $fieldName) ) AND is_array($fieldValue) ) {
188 188
             foreach ($fieldValue as $subkey => $subvalue) {
189
-              $comment_document->addField($fieldName, $subvalue);
189
+                $comment_document->addField($fieldName, $subvalue);
190 190
             }
191
-          }// if preg_match
191
+            }// if preg_match
192 192
                
193
-          // Set the access keys so this module will work with
194
-          // apachesolr_access.
195
-          if (module_exists('apachesolr_access')) {
193
+            // Set the access keys so this module will work with
194
+            // apachesolr_access.
195
+            if (module_exists('apachesolr_access')) {
196 196
             if (preg_match('/^access/', $fieldName) AND is_array($fieldValue)) {
197
-              foreach ($fieldValue as $subkey => $subvalue) {
197
+                foreach ($fieldValue as $subkey => $subvalue) {
198 198
                 $comment_document->addField($fieldName, $subvalue);
199
-              }
199
+                }
200 200
             }// if preg_match
201
-          }// if module_exist
201
+            }// if module_exist
202 202
             
203 203
         }// foreach document
204 204
         
205 205
         $comdocs[] = $comment_document;
206
-      }// while
206
+        }// while
207 207
     }// if entity_type=node
208
-  }// documents
208
+    }// documents
209 209
 
210
-  // Merge the comment documents with the input documents array. These
211
-  // documents will now be added to the Solr search index.
212
-  $documents = array_merge($documents, $comdocs);
210
+    // Merge the comment documents with the input documents array. These
211
+    // documents will now be added to the Solr search index.
212
+    $documents = array_merge($documents, $comdocs);
213 213
 }
214 214
 
215 215
 /**
@@ -225,19 +225,19 @@  discard block
 block discarded – undo
225 225
  *   The Solr query used for the search.
226 226
  */
227 227
 function boinc_solr_comments_apachesolr_process_results(&$results, DrupalSolrQueryInterface $query) {
228
-  //dpm($query->getSolrParams(), "process_results query getSolrParams");
229
-  foreach($results as $id => $result) {
228
+    //dpm($query->getSolrParams(), "process_results query getSolrParams");
229
+    foreach($results as $id => $result) {
230 230
     if ($result['entity_type']=='comment') {
231 231
         $results[$id]['type'] = 'Comment';
232 232
         $results[$id]['date'] = $result['fields']['changed'];
233 233
         if (isset($result['fields']['is_uid'])) {
234
-          $uid = $result['fields']['is_uid'];
235
-          $results[$id]['uid']  = $uid;
236
-          $results[$id]['user'] = theme('username', user_load($uid));
234
+            $uid = $result['fields']['is_uid'];
235
+            $results[$id]['uid']  = $uid;
236
+            $results[$id]['user'] = theme('username', user_load($uid));
237 237
         }
238 238
     } //if result entity_type == comment
239
-  }// foreach $result
240
-  //dpm($results, "process_results array_results");
239
+    }// foreach $result
240
+    //dpm($results, "process_results array_results");
241 241
 }
242 242
 
243 243
 /**
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
  *   The Solr query used for the search.
252 252
  */
253 253
 function boinc_solr_comments_apachesolr_query_alter($query) {
254
-  // Add custom field to query results
255
-  $query->addParam('fl','tos_content_extra');
254
+    // Add custom field to query results
255
+    $query->addParam('fl','tos_content_extra');
256 256
 }
257 257
 
258 258
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
  * 
266 266
  */
267 267
 function boinc_solr_comments_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
268
-  // Array of node types that will have comments indexed.
269
-  $node_types = variable_get('boinc_solr_comments_nodetypes', '');
270
-  if (empty($node_types)) {
268
+    // Array of node types that will have comments indexed.
269
+    $node_types = variable_get('boinc_solr_comments_nodetypes', '');
270
+    if (empty($node_types)) {
271 271
     // If the variable has not been set, then by default index
272 272
     // comments for all known node types.
273 273
     $node_types = array(
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
         'story'      => 'story',
278 278
         'team_forum' => 'team_forum',
279 279
     );
280
-  }
280
+    }
281 281
 
282
-  switch ($op) {
282
+    switch ($op) {
283 283
     case 'delete':
284 284
       // Only call delete function on certain node types
285 285
       if (in_array( $node->type, $node_types)) {
286 286
         boinc_solr_comments_delete($node);
287
-      }
288
-      break;
289
-  } //switch
287
+        }
288
+        break;
289
+    } //switch
290 290
 }
291 291
 
292 292
 
@@ -303,30 +303,30 @@  discard block
 block discarded – undo
303 303
  *   Returns TRUE if the comment was deleted, otherwise return FALSE.
304 304
  */
305 305
 function boinc_solr_comments_delete($node) {
306
-  // Load the Solr environment.
307
-  $env_id = apachesolr_default_environment();
308
-  // Check to see if Solr is read-only.
309
-  if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
306
+    // Load the Solr environment.
307
+    $env_id = apachesolr_default_environment();
308
+    // Check to see if Solr is read-only.
309
+    if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
310 310
     return FALSE;
311
-  }
311
+    }
312 312
   
313
-  // Code derived from apachesolr_index_delete_entity_from_index
314
-  try {
313
+    // Code derived from apachesolr_index_delete_entity_from_index
314
+    try {
315 315
     $solr = apachesolr_get_solr($env_id);
316 316
     // Custom query to find all comments with parent nid of the node bing deleted.
317 317
     $query = "entity_type:comment AND tos_content_extra:" . $node->nid;
318 318
     $solr->deleteByQuery($query);
319 319
     // Log the query used for deletion.
320 320
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
321
-  }
322
-  catch (Exception $e) {
323
-      watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
324
-      return FALSE;
325
-  }// try
326
-
327
-  // all deletions sucessful
328
-  apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
329
-  return TRUE;
321
+    }
322
+    catch (Exception $e) {
323
+        watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
324
+        return FALSE;
325
+    }// try
326
+
327
+    // all deletions sucessful
328
+    apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
329
+    return TRUE;
330 330
 }
331 331
 
332 332
 /**
@@ -334,15 +334,15 @@  discard block
 block discarded – undo
334 334
  *
335 335
  */
336 336
 function boinc_solr_comments_comment(&$a1, $op) {
337
-  switch ($op) {
337
+    switch ($op) {
338 338
     case 'view':
339 339
     case 'update':
340 340
       break;
341 341
     case 'delete':
342 342
       // $a1 should be a comment object
343 343
       boinc_solr_comments_deletecomment($a1);
344
-      break;
345
-  }// switch
344
+        break;
345
+    }// switch
346 346
 }
347 347
 
348 348
 /** 
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
  *   Returns TRUE if the comment was deleted, otherwise return FALSE.
359 359
  */
360 360
 function boinc_solr_comments_deletecomment($comment) {
361
-  // Load the Solr environment.
362
-  $env_id = apachesolr_default_environment();
363
-  // Check to see if Solr is read-only.
364
-  if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
361
+    // Load the Solr environment.
362
+    $env_id = apachesolr_default_environment();
363
+    // Check to see if Solr is read-only.
364
+    if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) {
365 365
     return FALSE;
366
-  }
367
-  //dd($comment->cid, "delete - nid begin");
366
+    }
367
+    //dd($comment->cid, "delete - nid begin");
368 368
     
369
-  // Code derived from apachesolr_index_delete_entity_from_index.
370
-  try {
369
+    // Code derived from apachesolr_index_delete_entity_from_index.
370
+    try {
371 371
     $solr = apachesolr_get_solr($env_id);
372 372
     $entity_id = $comment->cid;
373 373
     $entity_type = 'comment';
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
     // Log the query used for deletion.
378 378
     watchdog('Apache Solr', 'Deleted documents from index with query @query', array('@query' => $query), WATCHDOG_INFO);
379 379
     }
380
-  catch (Exception $e) {
380
+    catch (Exception $e) {
381 381
     watchdog('Apache Solr', nl2br(check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
382 382
     return FALSE;
383
-  }// try
383
+    }// try
384 384
 
385
-  // deletion sucessful
386
-  apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
387
-  return TRUE;
385
+    // deletion sucessful
386
+    apachesolr_set_last_index_updated($env_id, APACHESOLR_REQUEST_TIME);
387
+    return TRUE;
388 388
 }
389 389
 
390 390
 
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
  */
400 400
 
401 401
 function boinc_solr_comments_enable() {
402
-  drupal_set_message( bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), NULL, 'boinc:admin-solr-index-comments-message'), 'warning');
402
+    drupal_set_message( bts('Warning: Your content <a href="@url">must be re-indexed</a> before Apache Solr will search comments.', array('@url' => url('admin/settings/apachesolr/index')), NULL, 'boinc:admin-solr-index-comments-message'), 'warning');
403 403
 }
404 404
 
405 405
 /** 
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
  *   The comment to be published (unhidden).
411 411
  */
412 412
 function boinc_solr_comments_publish($comment) {
413
-  if ( ($comment->cid) AND ($comment->nid) ) {
413
+    if ( ($comment->cid) AND ($comment->nid) ) {
414 414
     $node = node_load($comment->nid);
415 415
     // Tell Solr that the node has been updated, so the comment can be
416 416
     // indexed.
417 417
     apachesolr_entity_update($node, 'node');
418
-  }
418
+    }
419 419
 }
420 420
 
421 421
 /** 
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
  *   The comment to be unpublished (hidden). 
427 427
  */
428 428
 function boinc_solr_comments_unpublish($comment) {
429
-  if ( ($comment->cid) ) {
429
+    if ( ($comment->cid) ) {
430 430
     // Call the deletecomment function for hook comment.
431 431
     boinc_solr_comments_deletecomment($comment);
432
-  }
432
+    }
433 433
 }
434 434
 
Please login to merge, or discard this patch.
modules/boinc_solr_search/boinc_solr_comments/boinc_solr_comments.admin.inc 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,48 +7,48 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 function boinc_solr_comments_form(&$form_state) {
10
-  $form = array();
10
+    $form = array();
11 11
 
12
-  $form['config'] = array(
12
+    $form['config'] = array(
13 13
     '#type' => 'fieldset',
14 14
     '#title' => t('Configuration'),
15 15
     '#collapsible' => TRUE,
16
-  );
16
+    );
17 17
 
18
-  $options = array();
19
-  foreach (content_types() as $key => $info) {
18
+    $options = array();
19
+    foreach (content_types() as $key => $info) {
20 20
     // Exclude node types profile, team, and panel
21 21
     switch ($key) {
22
-      case 'profile':
22
+        case 'profile':
23 23
       case 'team':
24 24
       case 'panel':
25 25
         continue 2;
26 26
     }// switch key
27 27
     $options[$key] = $info['name'];
28
-  }
29
-  asort($options);
28
+    }
29
+    asort($options);
30 30
   
31
-  // Form defaults
32
-  $default = array(
31
+    // Form defaults
32
+    $default = array(
33 33
     'boinc_solr_comments_nodetypes' => variable_get('boinc_solr_comments_nodetypes', ''),
34
-  );
35
-  if (empty($default['boinc_solr_comments_nodetypes'])) {
34
+    );
35
+    if (empty($default['boinc_solr_comments_nodetypes'])) {
36 36
     $default['boinc_solr_comments_nodetypes'] = array('forum','team_forum','news','page','story');
37
-  }
37
+    }
38 38
   
39
-  // Define the form
40
-  $form['config']['nodes'] = array(
39
+    // Define the form
40
+    $form['config']['nodes'] = array(
41 41
     '#type'  => 'markup',
42 42
     '#value' => bts('Select the content types where the comments are indexed by Apace Solr. Your content must be re-indexed after changing this configuration.', array(), NULL, 'boinc:admin-solr-search-comments-option'),
43
-  );
43
+    );
44 44
       
45
-  $form['config']['boinc_solr_comments_nodetypes'] = array(
45
+    $form['config']['boinc_solr_comments_nodetypes'] = array(
46 46
     '#type'          => 'checkboxes',
47 47
     '#title'         => 'node',
48 48
     '#options'       => $options,
49 49
     '#default_value' => $default['boinc_solr_comments_nodetypes'],
50
-  );
50
+    );
51 51
 
52
-  return system_settings_form($form);
52
+    return system_settings_form($form);
53 53
 }
54 54
 
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/boincwork.admin.inc 1 patch
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -10,80 +10,80 @@  discard block
 block discarded – undo
10 10
  * Allow configuration of general options for preference pages
11 11
  */
12 12
 function boincwork_admin_prefs_options_form(&$form_state) {
13
-  $form = array(); 
14
-  $form['beta'] = array(
13
+    $form = array(); 
14
+    $form['beta'] = array(
15 15
     '#type' => 'checkbox',
16 16
     '#title' => t('Allow users to opt in to test beta applications'),
17 17
     '#default_value' => variable_get('boinc_prefs_options_beta', 0),
18 18
     '#required' => TRUE
19
-  );
20
-  $form['submit'] = array(
19
+    );
20
+    $form['submit'] = array(
21 21
     '#type' => 'submit',
22 22
     '#value' => t('Submit')
23
-  );
24
-  // Add the official mechanical things and return
25
-  //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
26
-  return $form;
23
+    );
24
+    // Add the official mechanical things and return
25
+    //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
26
+    return $form;
27 27
 } 
28 28
 
29 29
 /**
30
-  * Handle validation of preference general settings form.
31
-  */
30
+ * Handle validation of preference general settings form.
31
+ */
32 32
 function boincwork_admin_prefs_options_form_validate($form, &$form_state) {
33 33
 }
34 34
 
35 35
 /**
36
-  * Handle submission of preference general settings form.
37
-  */
36
+ * Handle submission of preference general settings form.
37
+ */
38 38
 function boincwork_admin_prefs_options_form_submit($form, &$form_state) {
39
-  variable_set('boinc_prefs_options_beta', $form_state['values']['beta']);
40
-  drupal_set_message('Preference options have been updated.');
39
+    variable_set('boinc_prefs_options_beta', $form_state['values']['beta']);
40
+    drupal_set_message('Preference options have been updated.');
41 41
 }
42 42
 
43 43
 /**
44 44
  * 
45 45
  */
46 46
 function boincwork_admin_prefs_upload_form(&$form_state) {
47
-  $form = array(); 
48
-  $form['prefs_xml'] = array(
47
+    $form = array(); 
48
+    $form['prefs_xml'] = array(
49 49
     '#type' => 'textarea',
50 50
     '#title' => t('Project specific preferences XML'),
51 51
     '#default_value' => variable_get('boinc_project_specific_prefs_config', "<project_specific_preferences>\n\n</project_specific_preferences>"),
52 52
     '#required' => TRUE
53
-  );
54
-  $form['submit'] = array(
53
+    );
54
+    $form['submit'] = array(
55 55
     '#type' => 'submit',
56 56
     '#value' => t('Submit')
57
-  );
58
-  // Add the official mechanical things and return
59
-  //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
60
-  return $form;
57
+    );
58
+    // Add the official mechanical things and return
59
+    //drupal_prepare_form('boincwork_admin_prefs_upload_form', $form, $form_state);
60
+    return $form;
61 61
 } 
62 62
 
63 63
 /**
64
-  * Handle validation of preference upload form.
65
-  */
64
+ * Handle validation of preference upload form.
65
+ */
66 66
 function boincwork_admin_prefs_upload_form_validate($form, &$form_state) {
67 67
   
68
-  $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
69
-  libxml_use_internal_errors(true);
70
-  $xml = new DomDocument();
71
-  $xml->loadXML($form_state['values']['prefs_xml'], LIBXML_NOBLANKS);
72
-  if (!$xml->schemaValidate($xsd)) {
68
+    $xsd = './' . drupal_get_path('module', 'boincwork') . '/includes/projectprefs.xsd';
69
+    libxml_use_internal_errors(true);
70
+    $xml = new DomDocument();
71
+    $xml->loadXML($form_state['values']['prefs_xml'], LIBXML_NOBLANKS);
72
+    if (!$xml->schemaValidate($xsd)) {
73 73
     $errors = libxml_get_errors();
74 74
     $lines = explode("\r", $form_state['values']['prefs_xml']);
75 75
     drupal_set_message("{$errors[0]->message} at line {$errors[0]->line}" .
76
-      ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
76
+        ': <br/>' . htmlentities($lines[$errors[0]->line - 1]), 'error');
77 77
     form_set_error('upload', t('XML file failed validation'));
78
-  }
78
+    }
79 79
 }
80 80
 
81 81
 /**
82
-  * Handle submission of preference upload form.
83
-  */
82
+ * Handle submission of preference upload form.
83
+ */
84 84
 function boincwork_admin_prefs_upload_form_submit($form, &$form_state) {
85
-  variable_set('boinc_project_specific_prefs_config', $form_state['values']['prefs_xml']);
86
-  drupal_set_message('The XML has been validated and any changes to
85
+    variable_set('boinc_project_specific_prefs_config', $form_state['values']['prefs_xml']);
86
+    drupal_set_message('The XML has been validated and any changes to
87 87
       preferences are now in place.');
88 88
 }
89 89
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
  * 
92 92
  */
93 93
 function boincwork_admin_prefs_presets_page($preset = 'standard') {
94
-  // Configure preference presets
95
-  if (function_exists('jump_quickly')) {
94
+    // Configure preference presets
95
+    if (function_exists('jump_quickly')) {
96 96
     $path = 'admin/boinc/prefs/presets';
97 97
     $preset_options = array(
98
-      "{$path}/standard" => t('Standard'),
99
-      "{$path}/maximum" => t('Maximum'),
100
-      "{$path}/green" => t('Green'),
101
-      "{$path}/minimum" => t('Minimum')
98
+        "{$path}/standard" => t('Standard'),
99
+        "{$path}/maximum" => t('Maximum'),
100
+        "{$path}/green" => t('Green'),
101
+        "{$path}/minimum" => t('Minimum')
102 102
     );
103 103
     variable_set('jump_use_js_presets-Array', 1);
104 104
     drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
     $output .= '<label>Preset:</label>';
107 107
     $output .= jump_quickly($preset_options, 'presets');
108 108
     $output .= '</div></div>';
109
-  }
110
-  $output .= drupal_get_form('boincwork_admin_prefs_presets_form', $preset);
109
+    }
110
+    $output .= drupal_get_form('boincwork_admin_prefs_presets_form', $preset);
111 111
 
112
-  $output .= '<div>';
113
-  $output .= bts('Usage: \'Save configuration\' will save the above preferences into the drupal database. These will be the preset computing (global) preferences that will fill in the preferences form once a user loads the Account Preferences page.', array(), NULL, 'boinc:admin-boinc-preference-presets');
114
-  $output .= '<p>';
115
-  $output .= bts('\'Save configuration with disk usage settings from config.xml\' will save the above preferences into the drupal database, but also load disk usage settings from the BOINC project\'s config.xml file. These will overwrite any disk usage settings you have placed above. Caution: A user\'s personal preferences will not change if you load the disk usage settings from config.xml here into the drupal database. They must change their preference settings manually.', array(), NULL, 'boinc:admin-boinc-preference-presets');
116
-  $output .= '</div>';
117
-  return $output;
112
+    $output .= '<div>';
113
+    $output .= bts('Usage: \'Save configuration\' will save the above preferences into the drupal database. These will be the preset computing (global) preferences that will fill in the preferences form once a user loads the Account Preferences page.', array(), NULL, 'boinc:admin-boinc-preference-presets');
114
+    $output .= '<p>';
115
+    $output .= bts('\'Save configuration with disk usage settings from config.xml\' will save the above preferences into the drupal database, but also load disk usage settings from the BOINC project\'s config.xml file. These will overwrite any disk usage settings you have placed above. Caution: A user\'s personal preferences will not change if you load the disk usage settings from config.xml here into the drupal database. They must change their preference settings manually.', array(), NULL, 'boinc:admin-boinc-preference-presets');
116
+    $output .= '</div>';
117
+    return $output;
118 118
 }
119 119
 
120 120
 /**
@@ -122,141 +122,141 @@  discard block
 block discarded – undo
122 122
  */
123 123
 function boincwork_admin_prefs_presets_form(&$form_state, $preset = 'standard') {
124 124
 
125
-  // Check database for preset prefs
126
-  if (!variable_get('boincwork_preset_prefs', null))
125
+    // Check database for preset prefs
126
+    if (!variable_get('boincwork_preset_prefs', null))
127 127
     drupal_set_message(bts('No presets found in database, loading a default set of preferences for each preset. These will be saved to the database once you click \'Save configuration\'.', array(), NULL, 'boinc:admin-boinc-preference-presets'), 'status');
128 128
 
129
-  // Load a copy of the general prefs form
130
-  $form = boincwork_generalprefs_form($form_state, NULL, $preset);
131
-  if ($key = array_search('boincwork_generalprefs_form_submit', $form['#submit'])) {
129
+    // Load a copy of the general prefs form
130
+    $form = boincwork_generalprefs_form($form_state, NULL, $preset);
131
+    if ($key = array_search('boincwork_generalprefs_form_submit', $form['#submit'])) {
132 132
     unset($form['#submit'][$key]);
133
-  }
134
-  $form['#submit'][] = 'boincwork_admin_prefs_presets_form_submit';
133
+    }
134
+    $form['#submit'][] = 'boincwork_admin_prefs_presets_form_submit';
135 135
   
136
-  // Just keep the necessary items
137
-  $form['processor'] = $form['prefs']['advanced']['processor'];
138
-  $form['storage'] = $form['prefs']['advanced']['storage'];
139
-  $form['network'] = $form['prefs']['advanced']['network'];
140
-  unset($form['prefs']);
136
+    // Just keep the necessary items
137
+    $form['processor'] = $form['prefs']['advanced']['processor'];
138
+    $form['storage'] = $form['prefs']['advanced']['storage'];
139
+    $form['network'] = $form['prefs']['advanced']['network'];
140
+    unset($form['prefs']);
141 141
   
142
-  // Tweak some things so it behaves a little better
143
-  $form['#tree'] = TRUE;
144
-  $form['processor']['#collapsible'] = TRUE;
145
-  $form['storage']['#collapsible'] = TRUE;
146
-  $form['network']['#collapsible'] = TRUE;
142
+    // Tweak some things so it behaves a little better
143
+    $form['#tree'] = TRUE;
144
+    $form['processor']['#collapsible'] = TRUE;
145
+    $form['storage']['#collapsible'] = TRUE;
146
+    $form['network']['#collapsible'] = TRUE;
147 147
   
148
-  // Add a submit button and a hidden field to pass the preset
149
-  $form['submit'] = array(
148
+    // Add a submit button and a hidden field to pass the preset
149
+    $form['submit'] = array(
150 150
     '#type' => 'submit',
151 151
     '#value' => t('Save configuration')
152
-  );
153
-  $form['saveuseconfigxml'] = array (
154
-      '#type' => 'submit',
155
-      '#value' => t('Save configuration with disk usage settings from config.xml'),
156
-      '#validate' => array('boincwork_admin_prefs_preset_saveuseconfigxml'),
157
-  );
158
-  $form['preset'] = array(
152
+    );
153
+    $form['saveuseconfigxml'] = array (
154
+        '#type' => 'submit',
155
+        '#value' => t('Save configuration with disk usage settings from config.xml'),
156
+        '#validate' => array('boincwork_admin_prefs_preset_saveuseconfigxml'),
157
+    );
158
+    $form['preset'] = array(
159 159
     '#type' => 'hidden',
160 160
     '#value' => $preset
161
-  );
161
+    );
162 162
   
163
-  // Add the official mechanical things and return
164
-  drupal_prepare_form('boincwork_admin_prefs_presets_form', $form, $form_state);
165
-  return $form;
163
+    // Add the official mechanical things and return
164
+    drupal_prepare_form('boincwork_admin_prefs_presets_form', $form, $form_state);
165
+    return $form;
166 166
 }
167 167
 
168 168
 /**
169
-  * Validate the preference presets form.
170
-  */
169
+ * Validate the preference presets form.
170
+ */
171 171
 function boincwork_admin_prefs_presets_form_validate($form, &$form_state) {
172
-  require_boinc('util');
173
-  $values = $form_state['values'];
172
+    require_boinc('util');
173
+    $values = $form_state['values'];
174 174
   
175
-  // Verify all non-boolean user input values and notify form API of failures
175
+    // Verify all non-boolean user input values and notify form API of failures
176 176
   
177
-  // Processing preferences
178
-  if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for') . " \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
-  if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for') . " \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
-  if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for') . " \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
-  if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for') . " \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
-  if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for') . " \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
-  if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for') . " \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
-  if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for') . " \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
-  if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for') . " \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
177
+    // Processing preferences
178
+    if (!verify_numeric($values['processor']['idle_time_to_run'], 1, 9999)) form_set_error('idle_time_to_run', t('Invalid setting for') . " \"{$form['processor']['idle_time_to_run']['#title']} [x] {$form['processor']['idle_time_to_run']['#field_suffix']}\"");
179
+    if (!verify_numeric($values['processor']['suspend_if_no_recent_input'], 0, 9999)) form_set_error('suspend_if_no_recent_input', t('Invalid setting for') . " \"{$form['processor']['suspend_if_no_recent_input']['#title']} [x] {$form['processor']['suspend_if_no_recent_input']['#field_suffix']}\"");
180
+    if (!verify_numeric($values['processor']['suspend_cpu_usage'], 0, 100)) form_set_error('suspend_cpu_usage', t('Invalid setting for') . " \"{$form['processor']['suspend_cpu_usage']['#title']} [x] {$form['processor']['suspend_cpu_usage']['#field_suffix']}\"");
181
+    if (!verify_numeric($values['processor']['start_hour'], 0, 23)) form_set_error('start_hour', t('Invalid setting for') . " \"{$form['processor']['start_hour']['#title']} [x] {$form['processor']['start_hour']['#field_suffix']}\"");
182
+    if (!verify_numeric($values['processor']['end_hour'], 0, 23)) form_set_error('end_hour', t('Invalid setting for') . " \"{$form['processor']['end_hour']['#title']} [x] {$form['processor']['end_hour']['#field_suffix']}\"");
183
+    if (!verify_numeric($values['processor']['cpu_scheduling_period_minutes'], 1, 9999)) form_set_error('cpu_scheduling_period_minutes', t('Invalid setting for') . " \"{$form['processor']['cpu_scheduling_period_minutes']['#title']} [x] {$form['processor']['cpu_scheduling_period_minutes']['#field_suffix']}\"");
184
+    if (!verify_numeric($values['processor']['max_ncpus_pct'], 0, 100)) form_set_error('max_ncpus_pct', t('Invalid setting for') . " \"{$form['processor']['max_ncpus_pct']['#title']} [x] {$form['processor']['max_ncpus_pct']['#field_suffix']}\"");
185
+    if (!verify_numeric($values['processor']['cpu_usage_limit'], 0, 100)) form_set_error('cpu_usage_limit', t('Invalid setting for') . " \"{$form['processor']['cpu_usage_limit']['#title']} [x] {$form['processor']['cpu_usage_limit']['#field_suffix']}\"");
186 186
 
187
-  // Storage preferences
188
-  if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
-  if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for') . " \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
-  if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
-  if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for') . " \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
-  if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
-  if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
-  if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
187
+    // Storage preferences
188
+    if (!verify_numeric($values['storage']['disk_max_used_gb'], 0, 9999999)) form_set_error('disk_max_used_gb', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_gb']['#title']} [x] {$form['storage']['disk_max_used_gb']['#field_suffix']}\"");
189
+    if (!verify_numeric($values['storage']['disk_min_free_gb'], 0.001, 9999999)) form_set_error('disk_min_free_gb', t('Invalid setting for') . " \"{$form['storage']['disk_min_free_gb']['#title']} [x] {$form['storage']['disk_min_free_gb']['#field_suffix']}\"");
190
+    if (!verify_numeric($values['storage']['disk_max_used_pct'], 0, 100)) form_set_error('disk_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['disk_max_used_pct']['#title']} [x] {$form['storage']['disk_max_used_pct']['#field_suffix']}\"");
191
+    if (!verify_numeric($values['storage']['disk_interval'], 0, 9999999)) form_set_error('disk_interval', t('Invalid setting for') . " \"{$form['storage']['disk_interval']['#title']} [x] {$form['storage']['disk_interval']['#field_suffix']}\"");
192
+    if (!verify_numeric($values['storage']['vm_max_used_pct'], 0, 100)) form_set_error('vm_max_used_pct', t('Invalid setting for') . " \"{$form['storage']['vm_max_used_pct']['#title']} [x] {$form['storage']['vm_max_used_pct']['#field_suffix']}\"");
193
+    if (!verify_numeric($values['storage']['ram_max_used_busy_pct'], 0, 100)) form_set_error('ram_max_used_busy_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_busy_pct']['#title']} [x] {$form['storage']['ram_max_used_busy_pct']['#field_suffix']}\"");
194
+    if (!verify_numeric($values['storage']['ram_max_used_idle_pct'], 0, 100)) form_set_error('ram_max_used_idle_pct', t('Invalid setting for') . " \"{$form['storage']['ram_max_used_idle_pct']['#title']} [x] {$form['storage']['ram_max_used_idle_pct']['#field_suffix']}\"");
195 195
 
196
-  // Network preferences
197
-  if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for') . " \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
-  if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for') . " \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
-  if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
-  if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
-  if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for') . " \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
-  if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for') . " \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
-  if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
-  if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
196
+    // Network preferences
197
+    if (!verify_numeric($values['network']['work_buf_min_days'], 0, 10)) form_set_error('work_buf_min_days', t('Invalid setting for') . " \"{$form['network']['work_buf_min_days']['#title']} [x] {$form['network']['work_buf_min_days']['#field_suffix']}\"");
198
+    if (!verify_numeric($values['network']['work_buf_additional_days'], 0, 10)) form_set_error('work_buf_additional_days', t('Invalid setting for') . " \"{$form['network']['work_buf_additional_days']['#title']} [x] {$form['network']['work_buf_additional_days']['#field_suffix']}\"");
199
+    if (!verify_numeric($values['network']['max_bytes_sec_down'], 0, 9999.999)) form_set_error('max_bytes_sec_down', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_down']['#title']} [x] {$form['network']['max_bytes_sec_down']['#field_suffix']}\"");
200
+    if (!verify_numeric($values['network']['max_bytes_sec_up'], 0, 9999.999)) form_set_error('max_bytes_sec_up', t('Invalid setting for') . " \"{$form['network']['max_bytes_sec_up']['#title']} [x] {$form['network']['max_bytes_sec_up']['#field_suffix']}\"");
201
+    if (!verify_numeric($values['network']['net_start_hour'], 0, 23)) form_set_error('net_start_hour', t('Invalid setting for') . " \"{$form['network']['net_start_hour']['#title']} [x] {$form['network']['net_start_hour']['#field_suffix']}\"");
202
+    if (!verify_numeric($values['network']['net_end_hour'], 0, 23)) form_set_error('net_end_hour', t('Invalid setting for') . " \"{$form['network']['net_end_hour']['#title']} [x] {$form['network']['net_end_hour']['#field_suffix']}\"");
203
+    if (!verify_numeric($values['network']['daily_xfer_limit_mb'], 0, 9999999)) form_set_error('daily_xfer_limit_mb', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
204
+    if (!verify_numeric($values['network']['daily_xfer_period_days'], 0, 9999999)) form_set_error('daily_xfer_period_days', t('Invalid setting for') . " \"{$form['network']['daily_xfer_limit_mb']['#title']} [x] {$form['network']['daily_xfer_limit_mb']['#field_suffix']}\"");
205 205
 }
206 206
 
207 207
 /**
208
-  * Handle post-validation submission of preference presets form.
209
-  */
208
+ * Handle post-validation submission of preference presets form.
209
+ */
210 210
 function boincwork_admin_prefs_presets_form_submit($form, &$form_state) {
211
-  $values = $form_state['values'];
212
-  $preset = $form_state['values']['preset'];
211
+    $values = $form_state['values'];
212
+    $preset = $form_state['values']['preset'];
213 213
   
214
-  // Load baseline settings from configuration
215
-  $prefs = boincwork_get_preset_prefs($preset);
214
+    // Load baseline settings from configuration
215
+    $prefs = boincwork_get_preset_prefs($preset);
216 216
   
217
-  // Processing preferences
218
-  $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1;
219
-  $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1;
220
-  $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0: 1;
221
-  $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run'];
222
-  $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input'];
223
-  $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage'];
224
-  $prefs['start_hour'] = $values['processor']['start_hour'];
225
-  $prefs['end_hour'] = $values['processor']['end_hour'];
226
-  $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0;
227
-  $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes'];
228
-  $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct'];
229
-  $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit'];
217
+    // Processing preferences
218
+    $prefs['run_on_batteries'] = ($values['processor']['run_on_batteries']) ? 0 : 1;
219
+    $prefs['run_if_user_active'] = ($values['processor']['run_if_user_active']) ? 0 : 1;
220
+    $prefs['run_gpu_if_user_active'] = ($values['processor']['run_gpu_if_user_active']) ? 0: 1;
221
+    $prefs['idle_time_to_run'] = $values['processor']['idle_time_to_run'];
222
+    $prefs['suspend_if_no_recent_input'] = $values['processor']['suspend_if_no_recent_input'];
223
+    $prefs['suspend_cpu_usage'] = $values['processor']['suspend_cpu_usage'];
224
+    $prefs['start_hour'] = $values['processor']['start_hour'];
225
+    $prefs['end_hour'] = $values['processor']['end_hour'];
226
+    $prefs['leave_apps_in_memory'] = ($values['processor']['leave_apps_in_memory']) ? 1 : 0;
227
+    $prefs['cpu_scheduling_period_minutes'] = $values['processor']['cpu_scheduling_period_minutes'];
228
+    $prefs['max_ncpus_pct'] = $values['processor']['max_ncpus_pct'];
229
+    $prefs['cpu_usage_limit'] = $values['processor']['cpu_usage_limit'];
230 230
   
231
-  // Storage preferences
232
-  $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb'];
233
-  $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb'];
234
-  $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct'];
235
-  $prefs['disk_interval'] = $values['storage']['disk_interval'];
236
-  $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct'];
237
-  $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct'];
238
-  $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct'];
231
+    // Storage preferences
232
+    $prefs['disk_max_used_gb'] = $values['storage']['disk_max_used_gb'];
233
+    $prefs['disk_min_free_gb'] = $values['storage']['disk_min_free_gb'];
234
+    $prefs['disk_max_used_pct'] = $values['storage']['disk_max_used_pct'];
235
+    $prefs['disk_interval'] = $values['storage']['disk_interval'];
236
+    $prefs['vm_max_used_pct'] = $values['storage']['vm_max_used_pct'];
237
+    $prefs['ram_max_used_busy_pct'] = $values['storage']['ram_max_used_busy_pct'];
238
+    $prefs['ram_max_used_idle_pct'] = $values['storage']['ram_max_used_idle_pct'];
239 239
   
240
-  // Network preferences
241
-  $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days'];
242
-  $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days'];
243
-  $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0;
244
-  $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0;
245
-  $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000;
246
-  $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000;
247
-  $prefs['net_start_hour'] = $values['network']['net_start_hour'];
248
-  $prefs['net_end_hour'] = $values['network']['net_end_hour'];
249
-  $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb'];
250
-  $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days'];
251
-  $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0;
240
+    // Network preferences
241
+    $prefs['work_buf_min_days'] = $values['network']['work_buf_min_days'];
242
+    $prefs['work_buf_additional_days'] = $values['network']['work_buf_additional_days'];
243
+    $prefs['confirm_before_connecting'] = ($values['network']['confirm_before_connecting']) ? 1 : 0;
244
+    $prefs['hangup_if_dialed'] = ($values['network']['hangup_if_dialed']) ? 1 : 0;
245
+    $prefs['max_bytes_sec_down'] = $values['network']['max_bytes_sec_down']*1000;
246
+    $prefs['max_bytes_sec_up'] = $values['network']['max_bytes_sec_up']*1000;
247
+    $prefs['net_start_hour'] = $values['network']['net_start_hour'];
248
+    $prefs['net_end_hour'] = $values['network']['net_end_hour'];
249
+    $prefs['daily_xfer_limit_mb'] = $values['network']['daily_xfer_limit_mb'];
250
+    $prefs['daily_xfer_period_days'] = $values['network']['daily_xfer_period_days'];
251
+    $prefs['dont_verify_images'] = ($values['network']['dont_verify_images']) ? 1 : 0;
252 252
   
253
-  //Remove @attributes to match new format (see boincwork.forms.inc
254
-  //function boincwork_generalprefs_form)
255
-  unset($prefs['@attributes']['preset']);
253
+    //Remove @attributes to match new format (see boincwork.forms.inc
254
+    //function boincwork_generalprefs_form)
255
+    unset($prefs['@attributes']['preset']);
256 256
   
257
-  // Update the configuration
258
-  boincwork_save_preset_prefs($prefs, $preset);
259
-  drupal_set_message(t('The "@name" preset has been updated.',
257
+    // Update the configuration
258
+    boincwork_save_preset_prefs($prefs, $preset);
259
+    drupal_set_message(t('The "@name" preset has been updated.',
260 260
     array('@name' => $preset)));
261 261
 }
262 262
 
@@ -265,26 +265,26 @@  discard block
 block discarded – undo
265 265
  */
266 266
 function boincwork_save_preset_prefs($updated_prefs, $preset = 'standard') {
267 267
   
268
-  // Get the full configuration
269
-  $all_presets = boincwork_get_preset_prefs();
270
-  $all_presets = (array) $all_presets['general_preferences'];
268
+    // Get the full configuration
269
+    $all_presets = boincwork_get_preset_prefs();
270
+    $all_presets = (array) $all_presets['general_preferences'];
271 271
   
272
-  // Check for sane config
273
-  if (isset($all_presets['preset'])) {
272
+    // Check for sane config
273
+    if (isset($all_presets['preset'])) {
274 274
     if (!is_numeric(key($all_presets['preset']))) {
275
-      $all_presets['preset'] = array($all_presets['preset']);
275
+        $all_presets['preset'] = array($all_presets['preset']);
276 276
     }
277 277
     foreach ($all_presets['preset'] as $key => $old_preset) {
278
-      // Find the preset being updated and... update it
279
-      if (isset($old_preset['@attributes']['name']) AND $old_preset['@attributes']['name'] == $preset) {
278
+        // Find the preset being updated and... update it
279
+        if (isset($old_preset['@attributes']['name']) AND $old_preset['@attributes']['name'] == $preset) {
280 280
         $all_presets['preset'][$key] = $updated_prefs + $old_preset;
281
-      }
281
+        }
282
+    }
282 283
     }
283
-  }
284 284
   
285
-  // Convert prefs back to XML and save to database
286
-  $all_presets = array('general_preferences' => $all_presets);
287
-  variable_set('boincwork_preset_prefs', save_configuration($all_presets));
285
+    // Convert prefs back to XML and save to database
286
+    $all_presets = array('general_preferences' => $all_presets);
287
+    variable_set('boincwork_preset_prefs', save_configuration($all_presets));
288 288
 }
289 289
 
290 290
 /**
Please login to merge, or discard this patch.
sites/default/boinc/modules/flag_comment_notify/flag_comment_notify.module 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  * Implementation of hook_comment(); 
27 27
  */
28 28
 function flag_comment_notify_comment(&$a1, $op) {
29
-  switch ($op) {
30
-  case 'insert':
29
+    switch ($op) {
30
+    case 'insert':
31 31
     module_load_include('inc', 'drupal_queue', 'drupal_queue');
32 32
     $queue = DrupalQueue::get('flag_comment_notify');
33 33
     $subscribed_users = array_keys((array) flag_get_content_flags('node', $a1['nid'], 'subscriptions'));
34 34
     foreach ($subscribed_users as $uid) {
35
-      $queue->createItem(array('uid' => $uid, 'cid' => (int) $a1['cid']));
35
+        $queue->createItem(array('uid' => $uid, 'cid' => (int) $a1['cid']));
36 36
     }
37 37
     break;
38
-  default:
38
+    default:
39 39
   }
40 40
 }
41 41
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
  * Implementation of hook_cron_queue_info()
44 44
  */
45 45
 function flag_comment_notify_cron_queue_info() {
46
-  $queues = array();
47
-  $queues['flag_comment_notify'] = array(
46
+    $queues = array();
47
+    $queues['flag_comment_notify'] = array(
48 48
     'worker callback' => 'flag_comment_notify_send_notification',
49 49
     'time' => 60,
50
-  );
51
-  return $queues;
50
+    );
51
+    return $queues;
52 52
 }
53 53
 
54 54
 
@@ -57,44 +57,44 @@  discard block
 block discarded – undo
57 57
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
58 58
 
59 59
 function flag_comment_notify_send_notification($data) {
60
-  $account = user_load($data['uid']);
61
-  $comment = _comment_load($data['cid']);
62
-  $node = node_load($comment->nid);
63
-  $author = user_load($comment->uid);
64
-  if ($account->mail AND $node->nid) {
60
+    $account = user_load($data['uid']);
61
+    $comment = _comment_load($data['cid']);
62
+    $node = node_load($comment->nid);
63
+    $author = user_load($comment->uid);
64
+    if ($account->mail AND $node->nid) {
65 65
     // Don't send notifications to the author of the comment
66 66
     if ($account->uid != $author->uid) {
67
-      $params['account'] = $account;
68
-      $params['comment'] = $comment;
69
-      $params['node'] = $node;
70
-      $params['author'] = $author;
71
-      drupal_mail('flag_comment_notify', 'comment_posted', $account->mail,
67
+        $params['account'] = $account;
68
+        $params['comment'] = $comment;
69
+        $params['node'] = $node;
70
+        $params['author'] = $author;
71
+        drupal_mail('flag_comment_notify', 'comment_posted', $account->mail,
72 72
         user_preferred_language($account), $params);
73 73
     }
74
-  }
74
+    }
75 75
 }
76 76
 
77 77
 
78 78
 function flag_comment_notify_mail($key, &$message, $params) {
79
-  $language = $message['language'];
80
-  $variables = user_mail_tokens($params['account'], $language);
81
-  $variables['!comment_url'] = url(
79
+    $language = $message['language'];
80
+    $variables = user_mail_tokens($params['account'], $language);
81
+    $variables['!comment_url'] = url(
82 82
     "goto/comment/{$params['comment']->cid}",
83 83
     array(
84
-      'absolute' => TRUE,
84
+        'absolute' => TRUE,
85 85
     )
86
-  );
87
-  $variables['!topic_name'] = $params['node']->title;
88
-  $variables['!author'] = $params['author']->name;
89
-  switch($key) {
90
-  case 'comment_posted':
86
+    );
87
+    $variables['!topic_name'] = $params['node']->title;
88
+    $variables['!author'] = $params['author']->name;
89
+    switch($key) {
90
+    case 'comment_posted':
91 91
     $message['subject'] = bts('!site: comment posted to "!topic_name"', $variables,
92
-      $language->language, 'boinc:forum-topic-subscription-email-notification');
92
+        $language->language, 'boinc:forum-topic-subscription-email-notification');
93 93
     $message['body'][] = bts('!author has posted a reply to "!topic_name".',
94
-      $variables, $language->language, 'boinc:forum-topic-subscription-email-notification');
94
+        $variables, $language->language, 'boinc:forum-topic-subscription-email-notification');
95 95
     $message['body'][] = bts("To view this topic at !site, click here: \n!comment_url",
96
-      $variables, $language->language, 'boinc:forum-topic-subscription-email-notification');
96
+        $variables, $language->language, 'boinc:forum-topic-subscription-email-notification');
97 97
     break;
98
-  default:
98
+    default:
99 99
   }
100 100
 }
Please login to merge, or discard this patch.
sites/default/boinc/modules/boincteam/includes/boincteam_forum.forms.inc 1 patch
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -14,84 +14,84 @@  discard block
 block discarded – undo
14 14
  * The definition of the create team form
15 15
  */
16 16
 function boincteam_forum_create_form(&$form_state) {
17
-  $form = array();
17
+    $form = array();
18 18
   
19
-  global $user;
20
-  $account = user_load($user->uid);
19
+    global $user;
20
+    $account = user_load($user->uid);
21 21
   
22
-  $default = array(
22
+    $default = array(
23 23
     'title' => '',
24 24
     'min_time_between_posts' => '',
25 25
     'min_total_credit_to_post' => '',
26 26
     'min_avg_credit_to_post' => '',
27 27
     'public' => 0,
28 28
     'description' => '',
29
-  );
29
+    );
30 30
   
31
-  // Standard option sets
32
-  $form['boolean_options'] = array(
31
+    // Standard option sets
32
+    $form['boolean_options'] = array(
33 33
     '#type' => 'value',
34 34
     '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')),
35
-  );
35
+    );
36 36
   
37
-  // Form elements
38
-  $form['title'] = array(
37
+    // Form elements
38
+    $form['title'] = array(
39 39
     '#title' => bts('Message board title', array(), NULL, 'boinc:team-forum-create/edit'),
40 40
     '#type' => 'textfield',
41 41
     '#default_value' => $default['title'],
42 42
     '#size' => 34,
43 43
     '#description' => bts('Text only, no HTML tags', array(), NULL, 'boinc:team-form-help'),
44
-  );
45
-  $form['min_time_between_posts'] = array(
44
+    );
45
+    $form['min_time_between_posts'] = array(
46 46
     '#title' => bts('Minimum time between posts', array(), NULL, 'boinc:team-forum-create/edit'),
47 47
     '#type' => 'textfield',
48 48
     '#default_value' => $default['min_time_between_posts'],
49 49
     '#size' => 12,
50 50
     '#description' => bts('seconds', array(), NULL, 'boinc:unit-of-time'),
51
-  );
52
-  $form['min_total_credit_to_post'] = array(
51
+    );
52
+    $form['min_total_credit_to_post'] = array(
53 53
     '#title' => bts('Minimum total credit to post', array(), NULL, 'boinc:team-forum-create/edit'),
54 54
     '#type' => 'textfield',
55 55
     '#default_value' => $default['min_total_credit_to_post'],
56 56
     '#size' => 12,
57
-  );
58
-  $form['min_avg_credit_to_post'] = array(
57
+    );
58
+    $form['min_avg_credit_to_post'] = array(
59 59
     '#title' => bts('Minimum avg credit to post', array(), NULL, 'boinc:team-forum-create/edit'),
60 60
     '#type' => 'textfield',
61 61
     '#default_value' => $default['min_avg_credit_to_post'],
62 62
     '#size' => 12,
63
-  );
64
-  $form['public'] = array(
63
+    );
64
+    $form['public'] = array(
65 65
     '#title' => bts('Allow public to read board?', array(), NULL, 'boinc:team-forum-create/edit'),
66 66
     '#type' => 'radios',
67 67
     '#options' => $form['boolean_options']['#value'],
68 68
     '#attributes' => array('class' => 'fancy'),
69 69
     '#default_value' => $default['public'],
70
-  );
71
-  $form['description'] = array(
70
+    );
71
+    $form['description'] = array(
72 72
     '#title' => bts('Description', array(), NULL, 'boinc:team-forum-create/edit:-1:ignoreoverwrite'),
73 73
     '#type' => 'textarea',
74 74
     '#default_value' => $default['description'],
75 75
     '#size' => 5,
76
-  );
76
+    );
77 77
   
78
-  // Form control
79
-  $form['form control tabs prefix'] = array(
78
+    // Form control
79
+    $form['form control tabs prefix'] = array(
80 80
     '#value' => '<ul class="form-control tab-list">'
81
-  );
82
-  $form['submit'] = array(
81
+    );
82
+    $form['submit'] = array(
83 83
     '#prefix' => '<li class="first tab">',
84 84
     '#type' => 'submit',
85 85
     '#value' => bts('Create message board', array(), NULL, 'boinc:team-forum-create/edit'),
86 86
     '#suffix' => '</li>',
87
-  );
88
-  $form['form control tabs'] = array(
87
+    );
88
+    $form['form control tabs'] = array(
89 89
     '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/forum/add', TRUE)) . '</li>'
90
-  );
90
+    );
91 91
   
92
-  $form['#redirect'] = "community/teams/{$account->team}";
92
+    $form['#redirect'] = "community/teams/{$account->team}";
93 93
   
94
-  return $form;
94
+    return $form;
95 95
 }
96 96
 
97 97
 /**
@@ -99,33 +99,33 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function boincteam_forum_create_form_validate($form, &$form_state) {
101 101
 
102
-  $values = $form_state['values'];
102
+    $values = $form_state['values'];
103 103
   
104
-  if (!$values['title']) {
104
+    if (!$values['title']) {
105 105
     form_set_error('name', bts('Message board title is required.', array(), NULL, 'boinc:team-forum-create/edit'));
106
-  }
107
-  if (!is_numeric($values['min_time_between_posts']) OR
106
+    }
107
+    if (!is_numeric($values['min_time_between_posts']) OR
108 108
       $values['min_time_between_posts'] < 0) {
109 109
     form_set_error('min_time_between_posts',
110
-      bts('Please set the minimum time required between posts.', array(), NULL, 'boinc:team-forum-create/edit')
110
+        bts('Please set the minimum time required between posts.', array(), NULL, 'boinc:team-forum-create/edit')
111 111
     );
112
-  }
113
-  if (!is_numeric($values['min_total_credit_to_post']) OR
112
+    }
113
+    if (!is_numeric($values['min_total_credit_to_post']) OR
114 114
       $values['min_total_credit_to_post'] < 0) {
115 115
     form_set_error('min_total_credit_to_post',
116
-      bts('Please set the minimum total credit that a user'
116
+        bts('Please set the minimum total credit that a user'
117 117
         . ' must earn in order to post to this message board.',
118 118
         array(), NULL, 'boinc:team-forum-create/edit')
119 119
     );
120
-  }
121
-  if (!is_numeric($values['min_avg_credit_to_post']) OR
120
+    }
121
+    if (!is_numeric($values['min_avg_credit_to_post']) OR
122 122
       $values['min_avg_credit_to_post'] < 0) {
123 123
     form_set_error('min_avg_credit_to_post',
124
-      bts('Please set the minimum average credit that a user'
124
+        bts('Please set the minimum average credit that a user'
125 125
         . ' is required to have in order to post to this message board.',
126 126
         array(), NULL, 'boinc:team-forum-create/edit')
127 127
     );
128
-  }
128
+    }
129 129
 }
130 130
 
131 131
 /**
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
  */
134 134
 function boincteam_forum_create_form_submit($form, &$form_state) {
135 135
   
136
-  $values = $form_state['values'];
136
+    $values = $form_state['values'];
137 137
   
138
-  global $user;
139
-  $account = user_load($user->uid);
138
+    global $user;
139
+    $account = user_load($user->uid);
140 140
   
141
-  // Add the team forum to the db
142
-  db_query("
141
+    // Add the team forum to the db
142
+    db_query("
143 143
     INSERT INTO {boincteam_forum} SET
144 144
       nid = %d,
145 145
       title = '%s',
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
     (int) $values['min_avg_credit_to_post'],
158 158
     ($values['public']) ? 1 : 0,
159 159
     $values['description']
160
-  );
160
+    );
161 161
   
162
-  drupal_set_message(t('Message board "@forum" has been created.',
162
+    drupal_set_message(t('Message board "@forum" has been created.',
163 163
     array('@forum' => $values['title'])));
164 164
 }
165 165
 
@@ -171,84 +171,84 @@  discard block
 block discarded – undo
171 171
  * The definition of the edit team forum form
172 172
  */
173 173
 function boincteam_forum_edit_form(&$form_state, $tfid) {
174
-  $form = array();
175
-  $boincteam_forum = boincteam_forum_load($tfid);
174
+    $form = array();
175
+    $boincteam_forum = boincteam_forum_load($tfid);
176 176
   
177
-  $form_state['storage']['tfid'] = $tfid;
177
+    $form_state['storage']['tfid'] = $tfid;
178 178
   
179
-  $default = array(
179
+    $default = array(
180 180
     'title' => $boincteam_forum->title,
181 181
     'min_time_between_posts' => $boincteam_forum->min_time_between_posts,
182 182
     'min_total_credit_to_post' => $boincteam_forum->min_total_credit_to_post,
183 183
     'min_avg_credit_to_post' => $boincteam_forum->min_avg_credit_to_post,
184 184
     'public' => ($boincteam_forum->public) ? 1 : 0,
185 185
     'description' => $boincteam_forum->description,
186
-  );
186
+    );
187 187
   
188
-  // Standard option sets
189
-  $form['boolean_options'] = array(
188
+    // Standard option sets
189
+    $form['boolean_options'] = array(
190 190
     '#type' => 'value',
191 191
     '#value' => array(1 => bts('yes', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-no'), 0 => bts('no', array(), NULL, 'boinc:form-yes-no:-1:binary-form-option-pairs-with-yes')),
192
-  );
192
+    );
193 193
   
194
-  // Form elements
195
-  $form['title'] = array(
194
+    // Form elements
195
+    $form['title'] = array(
196 196
     '#title' => bts('Message board title', array(), NULL, 'boinc:team-forum-create/edit'),
197 197
     '#type' => 'textfield',
198 198
     '#default_value' => $default['title'],
199 199
     '#size' => 34,
200 200
     '#description' => bts('Text only, no HTML tags', array(), NULL, 'boinc:team-form-help'),
201
-  );
202
-  $form['min_time_between_posts'] = array(
201
+    );
202
+    $form['min_time_between_posts'] = array(
203 203
     '#title' => bts('Minimum time between posts', array(), NULL, 'boinc:team-forum-create/edit'),
204 204
     '#type' => 'textfield',
205 205
     '#default_value' => $default['min_time_between_posts'],
206 206
     '#size' => 12,
207 207
     '#description' => bts('seconds', array(), NULL, 'boinc:unit-of-time'),
208
-  );
209
-  $form['min_total_credit_to_post'] = array(
208
+    );
209
+    $form['min_total_credit_to_post'] = array(
210 210
     '#title' => bts('Minimum total credit to post', array(), NULL, 'boinc:team-forum-create/edit'),
211 211
     '#type' => 'textfield',
212 212
     '#default_value' => $default['min_total_credit_to_post'],
213 213
     '#size' => 12,
214
-  );
215
-  $form['min_avg_credit_to_post'] = array(
214
+    );
215
+    $form['min_avg_credit_to_post'] = array(
216 216
     '#title' => bts('Minimum avg credit to post', array(), NULL, 'boinc:team-forum-create/edit'),
217 217
     '#type' => 'textfield',
218 218
     '#default_value' => $default['min_avg_credit_to_post'],
219 219
     '#size' => 12,
220
-  );
221
-  $form['public'] = array(
220
+    );
221
+    $form['public'] = array(
222 222
     '#title' => bts('Allow public to read board?', array(), NULL, 'boinc:team-forum-create/edit'),
223 223
     '#type' => 'radios',
224 224
     '#options' => $form['boolean_options']['#value'],
225 225
     '#attributes' => array('class' => 'fancy'),
226 226
     '#default_value' => $default['public'],
227
-  );
228
-  $form['description'] = array(
227
+    );
228
+    $form['description'] = array(
229 229
     '#title' => bts('Description', array(), NULL, 'boinc:team-forum-create/edit:-1:ignoreoverwrite'),
230 230
     '#type' => 'textarea',
231 231
     '#default_value' => $default['description'],
232 232
     '#size' => 5,
233
-  );
233
+    );
234 234
   
235
-  // Form control
236
-  $form['form control tabs prefix'] = array(
235
+    // Form control
236
+    $form['form control tabs prefix'] = array(
237 237
     '#value' => '<ul class="form-control tab-list">'
238
-  );
239
-  $form['submit'] = array(
238
+    );
239
+    $form['submit'] = array(
240 240
     '#prefix' => '<li class="first tab">',
241 241
     '#type' => 'submit',
242 242
     '#value' => bts('Save message board', array(), NULL, 'boinc:team-forum-create/edit'),
243 243
     '#suffix' => '</li>',
244
-  );
245
-  $form['form control tabs'] = array(
244
+    );
245
+    $form['form control tabs'] = array(
246 246
     '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), strstr($_GET['q'], '/forum', TRUE)) . '</li>'
247
-  );
247
+    );
248 248
   
249
-  $form['#redirect'] = "community/teams/{$boincteam_forum->nid}";
249
+    $form['#redirect'] = "community/teams/{$boincteam_forum->nid}";
250 250
   
251
-  return $form;
251
+    return $form;
252 252
 }
253 253
 
254 254
 /**
@@ -256,33 +256,33 @@  discard block
 block discarded – undo
256 256
  */
257 257
 function boincteam_forum_edit_form_validate($form, &$form_state) {
258 258
 
259
-  $values = $form_state['values'];
259
+    $values = $form_state['values'];
260 260
   
261
-  if (!$values['title']) {
261
+    if (!$values['title']) {
262 262
     form_set_error('name', bts('Message board title is required.', array(), NULL, 'boinc:team-forum-create/edit'));
263
-  }
264
-  if (!is_numeric($values['min_time_between_posts']) OR
263
+    }
264
+    if (!is_numeric($values['min_time_between_posts']) OR
265 265
       $values['min_time_between_posts'] < 0) {
266 266
     form_set_error('min_time_between_posts', 
267
-      bts('Please set the minimum time required between posts.', array(), NULL, 'boinc:team-forum-create/edit')
267
+        bts('Please set the minimum time required between posts.', array(), NULL, 'boinc:team-forum-create/edit')
268 268
     );
269
-  }
270
-  if (!is_numeric($values['min_total_credit_to_post']) OR
269
+    }
270
+    if (!is_numeric($values['min_total_credit_to_post']) OR
271 271
       $values['min_total_credit_to_post'] < 0) {
272 272
     form_set_error('min_total_credit_to_post',
273
-      bts('Please set the minimum total credit that a user'
273
+        bts('Please set the minimum total credit that a user'
274 274
         . ' must earn in order to post to this message board.',
275 275
         array(), NULL, 'boinc:team-forum-create/edit')
276 276
     );
277
-  }
278
-  if (!is_numeric($values['min_avg_credit_to_post']) OR
277
+    }
278
+    if (!is_numeric($values['min_avg_credit_to_post']) OR
279 279
       $values['min_avg_credit_to_post'] < 0) {
280 280
     form_set_error('min_avg_credit_to_post', 
281
-      bts('Please set the minimum average credit that a user'
281
+        bts('Please set the minimum average credit that a user'
282 282
         . ' is required to have in order to post to this message board.',
283 283
         array(), NULL, 'boinc:team-forum-create/edit')
284 284
     );
285
-  }
285
+    }
286 286
 }
287 287
 
288 288
 /**
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
  */
291 291
 function boincteam_forum_edit_form_submit($form, &$form_state) {
292 292
   
293
-  $tfid = $form_state['storage']['tfid'];
294
-  $values = $form_state['values'];
293
+    $tfid = $form_state['storage']['tfid'];
294
+    $values = $form_state['values'];
295 295
   
296
-  // Update the team forum in the db
297
-  db_query("
296
+    // Update the team forum in the db
297
+    db_query("
298 298
     UPDATE {boincteam_forum} SET
299 299
       title = '%s',
300 300
       min_time_between_posts = '%d',
@@ -311,11 +311,11 @@  discard block
 block discarded – undo
311 311
     ($values['public']) ? 1 : 0,
312 312
     $values['description'],
313 313
     $tfid
314
-  );
314
+    );
315 315
   
316
-  drupal_set_message(t('Details for message board "@forum" have been updated.',
316
+    drupal_set_message(t('Details for message board "@forum" have been updated.',
317 317
     array('@forum' => $values['title'])));
318 318
   
319
-  // The storage variable quietly kills redirection for some reason... unset it
320
-  unset($form_state['storage']);
319
+    // The storage variable quietly kills redirection for some reason... unset it
320
+    unset($form_state['storage']);
321 321
 }
Please login to merge, or discard this patch.
html/ops/show_log.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 echo 'Hint: Example greps: "RESULT#106876", "26fe99aa_25636_00119.wu_1", "WU#8152", "too many errors", "2003-07-17", "CRITICAL" <br>';
61 61
 
62 62
 if (strlen($f)) {
63
-	$f = "../log*/". $f;
63
+    $f = "../log*/". $f;
64 64
 } else {
65 65
     $f = "../log*/*.log";
66 66
 }
Please login to merge, or discard this patch.
user_account_project_list/user_account_project_list.panels_default.inc 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -4,33 +4,33 @@  discard block
 block discarded – undo
4 4
  * Implementation of hook_default_panels_mini().
5 5
  */
6 6
 function user_account_project_list_default_panels_mini() {
7
-  $export = array();
7
+    $export = array();
8 8
 
9
-  $mini = new stdClass;
10
-  $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
-  $mini->api_version = 1;
12
-  $mini->name = 'user_project_list';
13
-  $mini->category = 'BOINC';
14
-  $mini->admin_title = 'User project list';
15
-  $mini->admin_description = 'A list of all BOINC projects in which a user is participating';
16
-  $mini->requiredcontexts = array();
17
-  $mini->contexts = array();
18
-  $mini->relationships = array();
19
-  $display = new panels_display;
20
-  $display->layout = 'onecol';
21
-  $display->layout_settings = array();
22
-  $display->panel_settings = array(
9
+    $mini = new stdClass;
10
+    $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
+    $mini->api_version = 1;
12
+    $mini->name = 'user_project_list';
13
+    $mini->category = 'BOINC';
14
+    $mini->admin_title = 'User project list';
15
+    $mini->admin_description = 'A list of all BOINC projects in which a user is participating';
16
+    $mini->requiredcontexts = array();
17
+    $mini->contexts = array();
18
+    $mini->relationships = array();
19
+    $display = new panels_display;
20
+    $display->layout = 'onecol';
21
+    $display->layout_settings = array();
22
+    $display->panel_settings = array(
23 23
     'style_settings' => array(
24
-      'default' => NULL,
25
-      'middle' => NULL,
24
+        'default' => NULL,
25
+        'middle' => NULL,
26 26
     ),
27
-  );
28
-  $display->cache = array();
29
-  $display->title = '';
30
-  $display->storage_type = 'panels_mini';
31
-  $display->storage_id = 'user_project_list';
32
-  $display->content = array();
33
-  $display->panels = array();
27
+    );
28
+    $display->cache = array();
29
+    $display->title = '';
30
+    $display->storage_type = 'panels_mini';
31
+    $display->storage_id = 'user_project_list';
32
+    $display->content = array();
33
+    $display->panels = array();
34 34
     $pane = new stdClass;
35 35
     $pane->pid = 'new-1';
36 36
     $pane->panel = 'middle';
@@ -39,25 +39,25 @@  discard block
 block discarded – undo
39 39
     $pane->shown = TRUE;
40 40
     $pane->access = array();
41 41
     $pane->configuration = array(
42
-      'admin_title' => 'Dashboard project table',
43
-      'title' => bts('Projects', array(), NULL, 'boinc:account-dashboard'),
44
-      'body' => '<?php echo boincuser_get_projects_table(); ?>',
45
-      'format' => '3',
46
-      'substitute' => TRUE,
42
+        'admin_title' => 'Dashboard project table',
43
+        'title' => bts('Projects', array(), NULL, 'boinc:account-dashboard'),
44
+        'body' => '<?php echo boincuser_get_projects_table(); ?>',
45
+        'format' => '3',
46
+        'substitute' => TRUE,
47 47
     );
48 48
     $pane->cache = array();
49 49
     $pane->style = array(
50
-      'settings' => NULL,
50
+        'settings' => NULL,
51 51
     );
52 52
     $pane->css = array();
53 53
     $pane->extras = array();
54 54
     $pane->position = 0;
55 55
     $display->content['new-1'] = $pane;
56 56
     $display->panels['middle'][0] = 'new-1';
57
-  $display->hide_title = PANELS_TITLE_FIXED;
58
-  $display->title_pane = 'new-1';
59
-  $mini->display = $display;
60
-  $export['user_project_list'] = $mini;
57
+    $display->hide_title = PANELS_TITLE_FIXED;
58
+    $display->title_pane = 'new-1';
59
+    $mini->display = $display;
60
+    $export['user_project_list'] = $mini;
61 61
 
62
-  return $export;
62
+    return $export;
63 63
 }
Please login to merge, or discard this patch.
drupal/sites/all/features/user_profiles/user_profiles.panels_default.inc 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -4,40 +4,40 @@  discard block
 block discarded – undo
4 4
  * Implementation of hook_default_panels_mini().
5 5
  */
6 6
 function user_profiles_default_panels_mini() {
7
-  $export = array();
7
+    $export = array();
8 8
 
9
-  $mini = new stdClass;
10
-  $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
-  $mini->api_version = 1;
12
-  $mini->name = 'user_profile';
13
-  $mini->category = 'BOINC';
14
-  $mini->admin_title = 'User profile';
15
-  $mini->admin_description = 'A user\'s profile information, including background and opinions';
16
-  $mini->requiredcontexts = array(
9
+    $mini = new stdClass;
10
+    $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
+    $mini->api_version = 1;
12
+    $mini->name = 'user_profile';
13
+    $mini->category = 'BOINC';
14
+    $mini->admin_title = 'User profile';
15
+    $mini->admin_description = 'A user\'s profile information, including background and opinions';
16
+    $mini->requiredcontexts = array(
17 17
     0 => array(
18
-      'name' => 'user',
19
-      'id' => 1,
20
-      'identifier' => 'User',
21
-      'keyword' => 'user',
18
+        'name' => 'user',
19
+        'id' => 1,
20
+        'identifier' => 'User',
21
+        'keyword' => 'user',
22 22
     ),
23
-  );
24
-  $mini->contexts = array();
25
-  $mini->relationships = array();
26
-  $display = new panels_display;
27
-  $display->layout = 'onecol';
28
-  $display->layout_settings = array();
29
-  $display->panel_settings = array(
23
+    );
24
+    $mini->contexts = array();
25
+    $mini->relationships = array();
26
+    $display = new panels_display;
27
+    $display->layout = 'onecol';
28
+    $display->layout_settings = array();
29
+    $display->panel_settings = array(
30 30
     'style_settings' => array(
31
-      'default' => NULL,
32
-      'middle' => NULL,
31
+        'default' => NULL,
32
+        'middle' => NULL,
33 33
     ),
34
-  );
35
-  $display->cache = array();
36
-  $display->title = '';
37
-  $display->storage_type = 'panels_mini';
38
-  $display->storage_id = 'user_profile';
39
-  $display->content = array();
40
-  $display->panels = array();
34
+    );
35
+    $display->cache = array();
36
+    $display->title = '';
37
+    $display->storage_type = 'panels_mini';
38
+    $display->storage_id = 'user_profile';
39
+    $display->content = array();
40
+    $display->panels = array();
41 41
     $pane = new stdClass;
42 42
     $pane->pid = 'new-1';
43 43
     $pane->panel = 'middle';
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
     $pane->shown = TRUE;
47 47
     $pane->access = array();
48 48
     $pane->configuration = array(
49
-      'context' => 'requiredcontext_user_1',
50
-      'override_title' => 1,
51
-      'override_title_text' => '',
49
+        'context' => 'requiredcontext_user_1',
50
+        'override_title' => 1,
51
+        'override_title_text' => '',
52 52
     );
53 53
     $pane->cache = array();
54 54
     $pane->style = array(
55
-      'settings' => NULL,
55
+        'settings' => NULL,
56 56
     );
57 57
     $pane->css = array();
58 58
     $pane->extras = array();
@@ -67,25 +67,25 @@  discard block
 block discarded – undo
67 67
     $pane->shown = TRUE;
68 68
     $pane->access = array();
69 69
     $pane->configuration = array(
70
-      'admin_title' => 'Flag user',
71
-      'title' => '',
72
-      'body' => '<?php print boincuser_get_profile_links(%user:uid); ?>',
73
-      'format' => '3',
74
-      'substitute' => 1,
70
+        'admin_title' => 'Flag user',
71
+        'title' => '',
72
+        'body' => '<?php print boincuser_get_profile_links(%user:uid); ?>',
73
+        'format' => '3',
74
+        'substitute' => 1,
75 75
     );
76 76
     $pane->cache = array();
77 77
     $pane->style = array(
78
-      'settings' => NULL,
78
+        'settings' => NULL,
79 79
     );
80 80
     $pane->css = array();
81 81
     $pane->extras = array();
82 82
     $pane->position = 1;
83 83
     $display->content['new-2'] = $pane;
84 84
     $display->panels['middle'][1] = 'new-2';
85
-  $display->hide_title = PANELS_TITLE_NONE;
86
-  $display->title_pane = 'new-1';
87
-  $mini->display = $display;
88
-  $export['user_profile'] = $mini;
85
+    $display->hide_title = PANELS_TITLE_NONE;
86
+    $display->title_pane = 'new-1';
87
+    $mini->display = $display;
88
+    $export['user_profile'] = $mini;
89 89
 
90
-  return $export;
90
+    return $export;
91 91
 }
Please login to merge, or discard this patch.
drupal/sites/all/features/boinc_standard/boinc_standard.panels_default.inc 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -4,36 +4,36 @@  discard block
 block discarded – undo
4 4
  * Implementation of hook_default_panels_mini().
5 5
  */
6 6
 function boinc_standard_default_panels_mini() {
7
-  $export = array();
7
+    $export = array();
8 8
 
9
-  $mini = new stdClass;
10
-  $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
-  $mini->api_version = 1;
12
-  $mini->name = 'dashboard_tables';
13
-  $mini->category = 'BOINC';
14
-  $mini->admin_title = 'Dashboard tables';
15
-  $mini->admin_description = 'Tables of computers and projects for a user';
16
-  $mini->requiredcontexts = array();
17
-  $mini->contexts = array();
18
-  $mini->relationships = array();
19
-  $display = new panels_display;
20
-  $display->layout = 'twocol_stacked';
21
-  $display->layout_settings = array();
22
-  $display->panel_settings = array(
9
+    $mini = new stdClass;
10
+    $mini->disabled = FALSE; /* Edit this to true to make a default mini disabled initially */
11
+    $mini->api_version = 1;
12
+    $mini->name = 'dashboard_tables';
13
+    $mini->category = 'BOINC';
14
+    $mini->admin_title = 'Dashboard tables';
15
+    $mini->admin_description = 'Tables of computers and projects for a user';
16
+    $mini->requiredcontexts = array();
17
+    $mini->contexts = array();
18
+    $mini->relationships = array();
19
+    $display = new panels_display;
20
+    $display->layout = 'twocol_stacked';
21
+    $display->layout_settings = array();
22
+    $display->panel_settings = array(
23 23
     'style_settings' => array(
24
-      'default' => NULL,
25
-      'left' => NULL,
26
-      'right' => NULL,
27
-      'top' => NULL,
28
-      'bottom' => NULL,
24
+        'default' => NULL,
25
+        'left' => NULL,
26
+        'right' => NULL,
27
+        'top' => NULL,
28
+        'bottom' => NULL,
29 29
     ),
30
-  );
31
-  $display->cache = array();
32
-  $display->title = '';
33
-  $display->storage_type = 'panels_mini';
34
-  $display->storage_id = 'dashboard_tables';
35
-  $display->content = array();
36
-  $display->panels = array();
30
+    );
31
+    $display->cache = array();
32
+    $display->title = '';
33
+    $display->storage_type = 'panels_mini';
34
+    $display->storage_id = 'dashboard_tables';
35
+    $display->content = array();
36
+    $display->panels = array();
37 37
     $pane = new stdClass;
38 38
     $pane->pid = 'new-1';
39 39
     $pane->panel = 'left';
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     $pane->configuration = array();
45 45
     $pane->cache = array();
46 46
     $pane->style = array(
47
-      'settings' => NULL,
47
+        'settings' => NULL,
48 48
     );
49 49
     $pane->css = array();
50 50
     $pane->extras = array();
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
     $pane->shown = TRUE;
60 60
     $pane->access = array();
61 61
     $pane->configuration = array(
62
-      'override_title' => 0,
63
-      'override_title_text' => '',
62
+        'override_title' => 0,
63
+        'override_title_text' => '',
64 64
     );
65 65
     $pane->cache = array();
66 66
     $pane->style = array(
67
-      'settings' => NULL,
67
+        'settings' => NULL,
68 68
     );
69 69
     $pane->css = array();
70 70
     $pane->extras = array();
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
     $pane->configuration = array();
82 82
     $pane->cache = array();
83 83
     $pane->style = array(
84
-      'settings' => NULL,
84
+        'settings' => NULL,
85 85
     );
86 86
     $pane->css = array();
87 87
     $pane->extras = array();
88 88
     $pane->position = 0;
89 89
     $display->content['new-3'] = $pane;
90 90
     $display->panels['top'][0] = 'new-3';
91
-  $display->hide_title = PANELS_TITLE_NONE;
92
-  $display->title_pane = '0';
93
-  $mini->display = $display;
94
-  $export['dashboard_tables'] = $mini;
91
+    $display->hide_title = PANELS_TITLE_NONE;
92
+    $display->title_pane = '0';
93
+    $mini->display = $display;
94
+    $export['dashboard_tables'] = $mini;
95 95
 
96
-  return $export;
96
+    return $export;
97 97
 }
Please login to merge, or discard this patch.