Passed
Push — dpa_get_output ( 1f92a4 )
by David
10:50
created
sites/default/boinc/modules/node_comment_block/node_comment_block.module 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,45 +9,45 @@  discard block
 block discarded – undo
9 9
  * Implements hook_block() for Drupal 6 compatibility
10 10
  */
11 11
 function node_comment_block_block($op = 'list', $delta = 0, $edit = array()) {
12
-  switch ($op) {
13
-  case 'view':
12
+    switch ($op) {
13
+    case 'view':
14 14
     //$block = node_comment_block_block_view($delta);
15 15
     $block = array();
16 16
     if ($delta == 'node_comments') {
17
-      if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
17
+        if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
18 18
         $node = node_load($nid);
19 19
         if ($node->comment !== 0) {
20
-          $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
21
-          $block['content'] = '';
22
-          if ($node->comment) {
20
+            $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
21
+            $block['content'] = '';
22
+            if ($node->comment) {
23 23
             $block['content'] .= comment_render($node);
24
-          }
24
+            }
25
+        }
25 26
         }
26
-      }
27 27
     }
28 28
     break;
29
-  case 'list':
29
+    case 'list':
30 30
     $blocks = node_comment_block_block_info();
31 31
     return $blocks;
32 32
     break;
33
-  default:
33
+    default:
34 34
   }
35
-  return $block;
35
+    return $block;
36 36
 }
37 37
 
38 38
 /**
39 39
  * Port Drupal 7 render() function to Drupal 6
40 40
  */
41 41
 function render(&$element) {
42
-  if (is_array($element)) {
42
+    if (is_array($element)) {
43 43
     show($element);
44 44
     return drupal_render($element);
45
-  }
46
-  else {
45
+    }
46
+    else {
47 47
     // Safe-guard for inappropriate use of render() on flat variables: return
48 48
     // the variable as-is.
49 49
     return $element;
50
-  }
50
+    }
51 51
 }
52 52
 
53 53
 
@@ -56,50 +56,50 @@  discard block
 block discarded – undo
56 56
  * Implements hook_block_info().
57 57
  */
58 58
 function node_comment_block_block_info() {
59
-  $blocks['node_comments'] = array(
59
+    $blocks['node_comments'] = array(
60 60
     'info' => t('Node comments'),
61
-  );
61
+    );
62 62
 
63
-  return $blocks;
63
+    return $blocks;
64 64
 }
65 65
 
66 66
 /**
67 67
  * Implements hook_block_view().
68 68
  */
69 69
 function node_comment_block_block_view($delta = '') {
70
-  $block = array();
70
+    $block = array();
71 71
 
72
-  if ($delta == 'node_comments') {
72
+    if ($delta == 'node_comments') {
73 73
     if (arg(0) == 'node' && is_numeric($nid = arg(1)) && !arg(2)) {
74
-      $node = node_load($nid);
74
+        $node = node_load($nid);
75 75
 
76
-      if ($node->comment !== 0) {
76
+        if ($node->comment !== 0) {
77 77
         $block['subject'] = NULL; // This should be NULL otherwise there will be duplicate h2 elements.
78 78
         $block['content'] = '';
79 79
 
80 80
         $node = node_view($node);
81 81
 
82 82
         if ($node['comments']) {
83
-          $block['content'] .= render($node['comments']);
83
+            $block['content'] .= render($node['comments']);
84
+        }
84 85
         }
85
-      }
86 86
     }
87
-  }
87
+    }
88 88
 
89
-  return $block;
89
+    return $block;
90 90
 }
91 91
 
92 92
 /**
93 93
  * Implements hook_preprocess_HOOK() for nodes.
94 94
  */
95 95
 function node_comment_block_preprocess_node(&$variables) {
96
-  $node = $variables['node'];
97
-  // Only hide standard comments for news content
98
-  if ($variables['type'] == 'news') {
96
+    $node = $variables['node'];
97
+    // Only hide standard comments for news content
98
+    if ($variables['type'] == 'news') {
99 99
     $variables['node']->comment = 0;
100
-  }
100
+    }
101 101
   
102
-  /* Drupal 7...
102
+    /* Drupal 7...
103 103
   if ($node->comment !== 0 && $variables['view_mode'] == 'full') {
104 104
     if (isset($variables['content']['comments'])) {
105 105
       unset($variables['content']['comments']);
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
  * Implements hook_form_FORM_ID_alter() for block_admin_configure.
114 114
  */
115 115
 function node_comment_block_form_block_admin_configure_alter(&$form, &$form_state) {
116
-  if (isset($form['delta'])) {
116
+    if (isset($form['delta'])) {
117 117
     if ($form['delta']['#value'] == 'node_comments') {
118
-      $form['settings']['title']['#disabled'] = TRUE;
119
-      $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
118
+        $form['settings']['title']['#disabled'] = TRUE;
119
+        $form['settings']['title']['#description'] = t('The title for this block cannot be overridden.');
120
+    }
120 121
     }
121
-  }
122 122
 }
Please login to merge, or discard this patch.
modules/boinc_solr_search/boinc_solr_comments/boinc_solr_comments.module 2 patches
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
   }
281 281
 
282 282
   switch ($op) {
283
-    case 'delete':
284
-      // Only call delete function on certain node types
285
-      if (in_array( $node->type, $node_types)) {
286
-        boinc_solr_comments_delete($node);
287
-      }
288
-      break;
283
+  case 'delete':
284
+    // Only call delete function on certain node types
285
+    if (in_array( $node->type, $node_types)) {
286
+      boinc_solr_comments_delete($node);
287
+    }
288
+    break;
289 289
   } //switch
290 290
 }
291 291
 
@@ -335,13 +335,13 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function boinc_solr_comments_comment(&$a1, $op) {
337 337
   switch ($op) {
338
-    case 'view':
339
-    case 'update':
340
-      break;
341
-    case 'delete':
342
-      // $a1 should be a comment object
343
-      boinc_solr_comments_deletecomment($a1);
344
-      break;
338
+  case 'view':
339
+  case 'update':
340
+    break;
341
+  case 'delete':
342
+    // $a1 should be a comment object
343
+    boinc_solr_comments_deletecomment($a1);
344
+    break;
345 345
   }// switch
346 346
 }
347 347
 
Please login to merge, or discard this patch.
Indentation   +117 added lines, -117 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);
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)) {
87
+        }
88
+        // Node information.
89
+        $nid = $document->entity_id;
90
+        $node = node_load($nid);
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)) {
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 2 patches
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
   foreach (content_types() as $key => $info) {
20 20
     // Exclude node types profile, team, and panel
21 21
     switch ($key) {
22
-      case 'profile':
23
-      case 'team':
24
-      case 'panel':
25
-        continue 2;
22
+    case 'profile':
23
+    case 'team':
24
+    case 'panel':
25
+      continue 2;
26 26
     }// switch key
27 27
     $options[$key] = $info['name'];
28 28
   }
Please login to merge, or discard this 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.
boinc/modules/boincteam/includes/views_handler_argument_boincteam_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincteam_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
boinc/modules/boincwork/views/views_handler_argument_boincuser_id.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
  */
8 8
 
9 9
 class views_handler_argument_boincuser_id extends views_handler_argument_numeric {
10
-  function construct() {
10
+    function construct() {
11 11
     parent::construct();
12
-  }
12
+    }
13 13
 
14
-  function set_argument($arg) {
14
+    function set_argument($arg) {
15 15
     // When setting the ID argument, convert to BOINC ID
16 16
     $id = is_numeric($arg) ? $arg : 0;
17 17
     $boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id));
18 18
     $this->argument = $boinc_id;
19 19
     return $this->validate_arg($boinc_id);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
modules/boincwork/views/views_handler_field_boincwork_host_app_et_avg.inc 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_host_app_et_avg extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     $gflops = 0;
15 15
     if ($values->host_app_version_et_avg) {
16
-      $gflops = 1e-9 / $values->host_app_version_et_avg;
16
+        $gflops = 1e-9 / $values->host_app_version_et_avg;
17 17
     }
18 18
     return round($gflops, 2) . ' GFLOPS';
19
-  }
19
+    }
20 20
 }
Please login to merge, or discard this patch.
boincwork/views/views_handler_field_boincwork_host_app_turnaround_avg.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_host_app_turnaround_avg extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     $time_in_days = $values->host_app_version_turnaround_avg / (24*60*60);
15 15
     return round($time_in_days, 2) . ' ' . t('days');
16
-  }
16
+    }
17 17
 }
Please login to merge, or discard this patch.
boincwork/views/views_handler_field_boincwork_app_version_number.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 class views_handler_field_boincwork_app_version_number extends views_handler_field {
9
-  function construct() {
9
+    function construct() {
10 10
     parent::construct();
11
-  }
11
+    }
12 12
 
13
-  function render($values) {
13
+    function render($values) {
14 14
     return sprintf("%01.2f", $values->app_version_host_app_version_version_num / 100);
15
-  }
15
+    }
16 16
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/boincwork/boincwork.module 2 patches
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -180,12 +180,12 @@
 block discarded – undo
180 180
  */
181 181
 function boincwork_locale($op = 'groups', $group = NULL) {
182 182
   switch ($op) {
183
-    case 'groups':
184
-      return array('project' => bts('Project'));
185
-    case 'info':
186
-      $info['project']['refresh callback'] = 'boincwork_locale_refresh';
187
-      $info['project']['format'] = FALSE;
188
-      return $info;
183
+  case 'groups':
184
+    return array('project' => bts('Project'));
185
+  case 'info':
186
+    $info['project']['refresh callback'] = 'boincwork_locale_refresh';
187
+    $info['project']['format'] = FALSE;
188
+    return $info;
189 189
   }
190 190
 }
191 191
 
Please login to merge, or discard this patch.
Indentation   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 // $Id$
3 3
 
4 4
 /**
5
-  * @file
6
-  * Enable BOINC features related to processing work and credit.
7
-  */
5
+ * @file
6
+ * Enable BOINC features related to processing work and credit.
7
+ */
8 8
 
9 9
 
10 10
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -21,70 +21,70 @@  discard block
 block discarded – undo
21 21
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
22 22
 
23 23
 /**
24
-  * Implementation of hook_menu().
25
-  */
24
+ * Implementation of hook_menu().
25
+ */
26 26
 function boincwork_menu() {
27
-  require_boinc('util');
28
-  $items['account/prefs'] = array(
27
+    require_boinc('util');
28
+    $items['account/prefs'] = array(
29 29
     'title' => 'Computing',
30 30
     'description' => '',
31 31
     'page callback' => 'generalprefs_page',
32 32
     'access callback' => 'user_is_logged_in',
33 33
     'type' => MENU_NORMAL_ITEM
34
-  );
35
-  $items['account/prefs/computing'] = array(
34
+    );
35
+    $items['account/prefs/computing'] = array(
36 36
     'title' => 'Computing',
37 37
     'page callback' => 'generalprefs_page',
38 38
     'access callback' => 'user_is_logged_in',
39 39
     'type' => MENU_DEFAULT_LOCAL_TASK,
40 40
     'weight' => 0
41
-  );
42
-  $items['account/prefs/project'] = array(
41
+    );
42
+    $items['account/prefs/project'] = array(
43 43
     'title' => 'Project',
44 44
     'page callback' => 'projectprefs_page',
45 45
     'access callback' => 'user_is_logged_in',
46 46
     'type' => MENU_LOCAL_TASK,
47 47
     'weight' => 5
48
-  );
49
-  $items['account/prefs/community'] = array(
48
+    );
49
+    $items['account/prefs/community'] = array(
50 50
     'title' => 'Community',
51 51
     'page callback' => 'communityprefs_page',
52 52
     'access callback' => 'user_is_logged_in',
53 53
     'type' => MENU_LOCAL_TASK,
54 54
     'weight' => 10
55
-  );
56
-  $items['account/prefs/privacy'] = array(
55
+    );
56
+    $items['account/prefs/privacy'] = array(
57 57
     'title' => 'Privacy',
58 58
     'page callback' => 'privacyprefs_page',
59 59
     'access callback' => 'user_is_logged_in',
60 60
     'type' => MENU_LOCAL_TASK,
61 61
     'weight' => 15
62
-  );
63
-  if (module_exists('ignore_user')) {
62
+    );
63
+    if (module_exists('ignore_user')) {
64 64
     $items['account/prefs/privacy/ignore_user/add'] = array(
65
-      'title' => 'Add from ignore list',
66
-      'description' => 'Add user that you with to ignore to your ignore list.',
67
-      'page callback' => 'boincwork_ignore_user_add_user',
68
-      'access callback' => 'user_access',
69
-      'access arguments' => array('ignore user'),
70
-      'type' => MENU_CALLBACK,
65
+        'title' => 'Add from ignore list',
66
+        'description' => 'Add user that you with to ignore to your ignore list.',
67
+        'page callback' => 'boincwork_ignore_user_add_user',
68
+        'access callback' => 'user_access',
69
+        'access arguments' => array('ignore user'),
70
+        'type' => MENU_CALLBACK,
71 71
     );
72 72
     $items['account/prefs/privacy/ignore_user/remove'] = array(
73
-      'title' => 'Remove from ignore list',
74
-      'description' => 'Remove user from your ignore list.',
75
-      'page callback' => 'boincwork_ignore_user_remove_user',
76
-      'access callback' => 'user_access',
77
-      'access arguments' => array('ignore user'),
78
-      'type' => MENU_CALLBACK,
73
+        'title' => 'Remove from ignore list',
74
+        'description' => 'Remove user from your ignore list.',
75
+        'page callback' => 'boincwork_ignore_user_remove_user',
76
+        'access callback' => 'user_access',
77
+        'access arguments' => array('ignore user'),
78
+        'type' => MENU_CALLBACK,
79 79
     );
80
-  }// endif module_exists
81
-  $items['account/certs'] = array(
80
+    }// endif module_exists
81
+    $items['account/certs'] = array(
82 82
     'title' =>'Account certificate',
83 83
     'page callback' => 'boincwork_certificates',
84 84
     'access arguments' => array('access content'),
85 85
     'type' => MENU_CALLBACK
86
-  );
87
-  $items['admin/boinc/prefs/general'] = array(
86
+    );
87
+    $items['admin/boinc/prefs/general'] = array(
88 88
     'title' => 'Preferences: General',
89 89
     'description' => 'Set options for BOINC preference set pages',
90 90
     'page callback' => 'drupal_get_form',
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
     'access arguments' => array('administer site configuration'),
93 93
     'type' => MENU_NORMAL_ITEM,
94 94
     'file' => 'boincwork.admin.inc'
95
-  );
96
-  $items['admin/boinc/prefs/presets'] = array(
95
+    );
96
+    $items['admin/boinc/prefs/presets'] = array(
97 97
     'title' => 'Preferences: Presets',
98 98
     'description' => 'Set values for BOINC preference set presets.',
99 99
     'page callback' => 'boincwork_admin_prefs_presets_page',
100 100
     'access arguments' => array('administer site configuration'),
101 101
     'type' => MENU_NORMAL_ITEM,
102 102
     'file' => 'boincwork.admin.inc'
103
-  );
104
-  $items['admin/boinc/prefs/upload'] = array(
103
+    );
104
+    $items['admin/boinc/prefs/upload'] = array(
105 105
     'title' => 'Preferences: Project-specific XML upload',
106 106
     'description' => 'Upload XML configuration for project specific preferences.',
107 107
     'page callback' => 'drupal_get_form',
@@ -109,153 +109,153 @@  discard block
 block discarded – undo
109 109
     'access arguments' => array('administer site configuration'),
110 110
     'type' => MENU_NORMAL_ITEM,
111 111
     'file' => 'boincwork.admin.inc'
112
-  );
113
-  $items['host/%/delete'] = array(
112
+    );
113
+    $items['host/%/delete'] = array(
114 114
     'title' => 'Delete host',
115 115
     'page callback' => 'boincwork_host_delete',
116 116
     'page arguments' => array(1),
117 117
     'access callback' => 'user_is_logged_in',
118 118
     'type' => MENU_CALLBACK,
119
-  );
120
-  $items['host/%/log'] = array(
119
+    );
120
+    $items['host/%/log'] = array(
121 121
     'title' => 'Host log',
122 122
     'page callback' => 'boincwork_host_log',
123 123
     'page arguments' => array(1),
124 124
     'access callback' => 'user_is_logged_in',
125 125
     'type' => MENU_CALLBACK,
126
-  );
127
-  $items['host/%/merge'] = array(
126
+    );
127
+    $items['host/%/merge'] = array(
128 128
     'title' => 'Merge computer',
129 129
     'page callback' => 'drupal_get_form',
130 130
     'page arguments' => array('boincwork_host_merge_form', 1),
131 131
     'access callback' => 'user_is_logged_in',
132 132
     'type' => MENU_CALLBACK,
133
-  );
134
-  $items['host/%/set-venue/%'] = array(
133
+    );
134
+    $items['host/%/set-venue/%'] = array(
135 135
     'title' => 'Set host venue',
136 136
     'page callback' => 'boincwork_host_set_venue',
137 137
     'page arguments' => array(1,3),
138 138
     'access callback' => 'user_is_logged_in',
139 139
     'type' => MENU_CALLBACK,
140
-  );
141
-  $items['user/%/mobile'] = array(
140
+    );
141
+    $items['user/%/mobile'] = array(
142 142
     'title' => 'Mobile stats',
143 143
     'page callback' => 'boincwork_mobile_stats',
144 144
     'page arguments' => array(1),
145 145
     'access callback' => 'user_is_logged_in',
146 146
     'type' => MENU_CALLBACK
147
-  );
148
-  $items['server_status.php'] = array(
147
+    );
148
+    $items['server_status.php'] = array(
149 149
     'title' => 'Server status',
150 150
     'page callback' => 'boincwork_server_status',
151 151
     'access arguments' => array('access content'),
152 152
     'type' => MENU_CALLBACK
153
-  );
154
-  $items['job_file.php'] = array(
153
+    );
154
+    $items['job_file.php'] = array(
155 155
     'title' => 'Job file input',
156 156
     'page callback' => 'boincwork_job_file',
157 157
     'access arguments' => array('access content'),
158 158
     'type' => MENU_CALLBACK
159
-  );
160
-  $items['get_output.php'] = array(
159
+    );
160
+    $items['get_output.php'] = array(
161 161
     'title' => 'Get output file',
162 162
     'page callback' => 'boincwork_get_output',
163 163
     'access arguments' => array('access content'),
164 164
     'type' => MENU_CALLBACK
165
-  );
166
-  $items['get_project_config.php'] = array(
165
+    );
166
+    $items['get_project_config.php'] = array(
167 167
     'title' => 'Project config',
168 168
     'page callback' => 'boincwork_get_project_config',
169 169
     'access arguments' => array('access content'),
170 170
     'type' => MENU_CALLBACK
171
-  );
172
-  $items['submit_rpc_handler.php'] = array(
171
+    );
172
+    $items['submit_rpc_handler.php'] = array(
173 173
     'title' => 'Remote job submission',
174 174
     'page callback' => 'boincwork_submit_rpc_handler',
175 175
     'access arguments' => array('access content'),
176 176
     'type' => MENU_CALLBACK
177
-  );
178
-  $items['userw.php'] = array(
177
+    );
178
+    $items['userw.php'] = array(
179 179
     'title' => 'User WAP',
180 180
     'page callback' => 'boincwork_user_wap',
181 181
     'access arguments' => array('access content'),
182 182
     'type' => MENU_CALLBACK
183
-  );
184
-  $items['account/tasks/%/%'] = array(
183
+    );
184
+    $items['account/tasks/%/%'] = array(
185 185
     'title' => 'Account Tasks Table',
186 186
     'description' => '',
187 187
     'page callback' => 'boincwork_account_task_table',
188 188
     'page arguments' => array(2,3),
189 189
     'access arguments' => array('access content'),
190 190
     'type' => MENU_CALLBACK,
191
-  );
192
-  $items['host/%/tasks/%/%'] = array(
191
+    );
192
+    $items['host/%/tasks/%/%'] = array(
193 193
     'title' => 'Host Tasks Table',
194 194
     'description' => '',
195 195
     'page callback' => 'boincwork_host_task_table',
196 196
     'page arguments' => array(1,3,4),
197 197
     'access arguments' => array('access content'),
198 198
     'type' => MENU_CALLBACK,
199
-  );
200
-  // Workunit task table disabled
201
-  //$items['workunit/%/tasks/%/%'] = array(
202
-  //  'title' => 'Workunit Tasks Table',
203
-  //  'description' => '',
204
-  //  'page callback' => 'boincwork_workunit_task_table',
205
-  //  'page arguments' => array(1,3,4),
206
-  //  'access arguments' => array('access content'),
207
-  //  'type' => MENU_CALLBACK,
208
-  //);
209
-  return $items;
199
+    );
200
+    // Workunit task table disabled
201
+    //$items['workunit/%/tasks/%/%'] = array(
202
+    //  'title' => 'Workunit Tasks Table',
203
+    //  'description' => '',
204
+    //  'page callback' => 'boincwork_workunit_task_table',
205
+    //  'page arguments' => array(1,3,4),
206
+    //  'access arguments' => array('access content'),
207
+    //  'type' => MENU_CALLBACK,
208
+    //);
209
+    return $items;
210 210
 }
211 211
 
212 212
 /**
213 213
  * Implementation of hook_theme().
214 214
  */
215 215
 function boincwork_theme() {
216
-  return array(
216
+    return array(
217 217
     'boincwork_privacyprefs_form' => array(
218
-      'arguments' => array('form'),
218
+        'arguments' => array('form'),
219 219
     ),
220
-  );
220
+    );
221 221
 }
222 222
 
223 223
 /**
224 224
 * Implementation of hook_views_api().
225 225
 */
226 226
 function boincwork_views_api() {
227
-  return array(
227
+    return array(
228 228
     'api' => 2.0,
229 229
     'path' => drupal_get_path('module', 'boincwork')
230
-  );
230
+    );
231 231
 }
232 232
 
233 233
 /**
234 234
  * Implementation of hook_locale().
235 235
  */
236 236
 function boincwork_locale($op = 'groups', $group = NULL) {
237
-  switch ($op) {
237
+    switch ($op) {
238 238
     case 'groups':
239 239
       return array('project' => bts('Project'));
240 240
     case 'info':
241 241
       $info['project']['refresh callback'] = 'boincwork_locale_refresh';
242
-      $info['project']['format'] = FALSE;
243
-      return $info;
244
-  }
242
+        $info['project']['format'] = FALSE;
243
+        return $info;
244
+    }
245 245
 }
246 246
 
247 247
 /**
248 248
  * Refresh strings.
249 249
  */
250 250
 function boincwork_locale_refresh() {
251
-  // Mimic process of adding project specific prefs to the project preferences
252
-  // form -- this parses the prefs XML and calls i18nstrings_update()
253
-  $form = array();
254
-  $prefs = array(
251
+    // Mimic process of adding project specific prefs to the project preferences
252
+    // form -- this parses the prefs XML and calls i18nstrings_update()
253
+    $form = array();
254
+    $prefs = array(
255 255
     'project_specific' => array(),
256
-  );
257
-  boincwork_add_project_specific_prefs($form, $prefs);
258
-  return TRUE; // Meaning it completed with no issues
256
+    );
257
+    boincwork_add_project_specific_prefs($form, $prefs);
258
+    return TRUE; // Meaning it completed with no issues
259 259
 }
260 260
 
261 261
 
@@ -264,43 +264,43 @@  discard block
 block discarded – undo
264 264
  */
265 265
 
266 266
 function boincwork_privatemsg_message_view_alter(&$vars) {
267
-  global $user;
267
+    global $user;
268 268
 
269
-  $author = $vars['message']['author'];
270
-  if (!isset($vars['message']['thread_id'])) {
269
+    $author = $vars['message']['author'];
270
+    if (!isset($vars['message']['thread_id'])) {
271 271
     // No thread id, this is probably only a preview
272 272
     return;
273
-  }
274
-  $thread_id = $vars['message']['thread_id'];
273
+    }
274
+    $thread_id = $vars['message']['thread_id'];
275 275
 
276
-  if ($user->uid != $author->uid) {
276
+    if ($user->uid != $author->uid) {
277 277
     if ($vars['message']['is_blocked']) {
278
-      $vars['message_actions']['unignore_user'] = array(
278
+        $vars['message_actions']['unignore_user'] = array(
279 279
         'title' => bts('Stop Ignoring User', array(), NULL, 'boinc:ignore-user-remove'),
280 280
         'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid,
281 281
         'query' => 'destination=messages/view/' . $thread_id,
282
-      );
282
+        );
283 283
     }
284 284
     else {
285
-      $vars['message_actions']['ignore_user'] = array(
285
+        $vars['message_actions']['ignore_user'] = array(
286 286
         'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'),
287 287
         'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid,
288 288
         'query' => 'destination=messages/view/' . $thread_id,
289
-      );
289
+        );
290
+    }
290 291
     }
291
-  }
292 292
 }
293 293
 
294 294
 /**
295 295
  * Implementation of hook_cron()
296 296
  */
297 297
 function boincwork_cron() {
298
-  // Delete expired hosts in the BOINC database, host_delete table.
299
-  require_boinc('boinc_db');
300
-  $num_deleted = BoincHostDeleted::delete_expired();
301
-  if ($num_deleted>0) {
298
+    // Delete expired hosts in the BOINC database, host_delete table.
299
+    require_boinc('boinc_db');
300
+    $num_deleted = BoincHostDeleted::delete_expired();
301
+    if ($num_deleted>0) {
302 302
     watchdog('boincwork', "Deleted ${num_deleted} hosts from host_deleted table", WATCHDOG_NOTICE);
303
-  }
303
+    }
304 304
 }
305 305
 
306 306
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -308,41 +308,41 @@  discard block
 block discarded – undo
308 308
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
309 309
 
310 310
 /**
311
-  * General preferences menu callback.
312
-  * Called when user goes to edit preferences page
313
-  */
311
+ * General preferences menu callback.
312
+ * Called when user goes to edit preferences page
313
+ */
314 314
 function generalprefs_page($action = null, $venue = null, $advanced = FALSE) {
315 315
 
316
-  // Keep the venue selected across preference pages
317
-  boincwork_select_venue($venue);
316
+    // Keep the venue selected across preference pages
317
+    boincwork_select_venue($venue);
318 318
 
319
-  $pref_sets = array('generic', 'home', 'school', 'work');
320
-  $output = null;
321
-  // Set the page title
322
-  $title = 'Computing';
323
-  drupal_set_title($title);
319
+    $pref_sets = array('generic', 'home', 'school', 'work');
320
+    $output = null;
321
+    // Set the page title
322
+    $title = 'Computing';
323
+    drupal_set_title($title);
324 324
 
325
-  switch ($action) {
325
+    switch ($action) {
326 326
 
327
-  case 'clear':
327
+    case 'clear':
328 328
     // Remove settings from this preference set
329 329
     if ($venue AND $venue != 'generic') {
330
-      boincwork_save_prefs(NULL, 'general', $venue);
331
-      drupal_set_message(t('Settings for the "@name" preference set have been
330
+        boincwork_save_prefs(NULL, 'general', $venue);
331
+        drupal_set_message(t('Settings for the "@name" preference set have been
332 332
         cleared', array('@name' => ucfirst($venue))));
333
-      // Set the generic preference set as active
334
-      $_SESSION['prefs venue'] = 'generic';
333
+        // Set the generic preference set as active
334
+        $_SESSION['prefs venue'] = 'generic';
335 335
     }
336 336
     drupal_goto();
337 337
     break;
338 338
 
339
-  case 'combined':
339
+    case 'combined':
340 340
     // Compare preference sets; tabular view
341 341
 
342 342
     foreach ($pref_sets as $pref_set) {
343
-      $form_state = array();
344
-      $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set);
345
-      drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state);
343
+        $form_state = array();
344
+        $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set);
345
+        drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state);
346 346
     }
347 347
 
348 348
     $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>';
@@ -355,29 +355,29 @@  discard block
 block discarded – undo
355 355
     $prefs_table = boincwork_make_prefs_table($prefs['generic']['prefs']['advanced']);
356 356
 
357 357
     foreach ($prefs_table as $category => $section) {
358
-      $output .= '<tr class="section-heading">';
359
-      $output .= "<td>{$section['name']}</td>";
360
-      foreach ($pref_sets as $pref_set) {
358
+        $output .= '<tr class="section-heading">';
359
+        $output .= "<td>{$section['name']}</td>";
360
+        foreach ($pref_sets as $pref_set) {
361 361
         $output .= '<td>' . $pref_set . '</td>';
362
-      }
363
-      $output .= '</tr>';
364
-      foreach ($section['elements'] as $name => $setting) {
362
+        }
363
+        $output .= '</tr>';
364
+        foreach ($section['elements'] as $name => $setting) {
365 365
         // Output the setting name and description, with an ugly exception
366 366
         // made for preferences with special formatting
367 367
         $special_map = array(
368
-          'start_hour' => 'end_hour',
369
-          'net_start_hour'=> 'net_end_hour',
370
-          'daily_xfer_limit_mb' => 'daily_xfer_period_days',
368
+            'start_hour' => 'end_hour',
369
+            'net_start_hour'=> 'net_end_hour',
370
+            'daily_xfer_limit_mb' => 'daily_xfer_period_days',
371 371
         );
372 372
         $special_delimiter = array(
373
-          'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'),
374
-          'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'),
375
-          'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'),
373
+            'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'),
374
+            'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'),
375
+            'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'),
376 376
         );
377 377
         $special = isset($special_map[$name]);
378 378
         $very_special = in_array($name, $special_map);
379 379
         if ($very_special) {
380
-          continue;
380
+            continue;
381 381
         }
382 382
         $output .= '<tr>';
383 383
         $output .= '<td>';
@@ -387,35 +387,35 @@  discard block
 block discarded – undo
387 387
         // Output values for each preference set, again with ugly hacks for
388 388
         // time range preferences
389 389
         foreach ($pref_sets as $pref_set) {
390
-          if (($prefs[$pref_set]) AND
390
+            if (($prefs[$pref_set]) AND
391 391
               $prefs[$pref_set]['#established'] AND
392 392
               isset($prefs[$pref_set]['prefs']['advanced'][$category])) {
393 393
             $pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$name];
394 394
             $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value'];
395 395
             if ($value == '') {
396
-              $value = '---';
396
+                $value = '---';
397 397
             }
398 398
             if (!isset($pref_setting['#field_suffix'])) {
399
-              $pref_setting['#field_suffix'] = '';
399
+                $pref_setting['#field_suffix'] = '';
400 400
             }
401 401
             if (!$special) {
402
-              $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>";
402
+                $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>";
403 403
             }
404 404
             else {
405
-              // The "very special" case where we merge two prefs
406
-              $second_pref = $special_map[$name];
407
-              $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref];
408
-              $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value'];
409
-              $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" .
405
+                // The "very special" case where we merge two prefs
406
+                $second_pref = $special_map[$name];
407
+                $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref];
408
+                $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value'];
409
+                $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" .
410 410
                 " {$second_value} {$second_pref_setting['#field_suffix']} </td>";
411 411
             }
412
-          }
413
-          else  {
412
+            }
413
+            else  {
414 414
             $output .= '<td>---</td>';
415
-          }
415
+            }
416 416
         }
417 417
         $output .= '</tr>';
418
-      }
418
+        }
419 419
     }
420 420
 
421 421
     // Empty line above action links... :/
@@ -431,24 +431,24 @@  discard block
 block discarded – undo
431 431
     $output .= '<tr>';
432 432
     $output .= '<td></td>';
433 433
     foreach ($pref_sets as $pref_set) {
434
-      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
435
-      $output .= '<td><ul class="tab-list"><li class="first tab">';
436
-      $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1",
434
+        $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
435
+        $output .= '<td><ul class="tab-list"><li class="first tab">';
436
+        $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1",
437 437
         array('fragment' => "")
438
-      );
439
-      // Show Clear links for established preference sets
440
-      if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
438
+        );
439
+        // Show Clear links for established preference sets
440
+        if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
441 441
         $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}",
442
-          array(
442
+            array(
443 443
             'query' => drupal_get_destination(),
444 444
             'attributes' => array(
445
-              'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
445
+                'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
446 446
                 array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')'
447 447
             )
448
-          )
448
+            )
449 449
         );
450
-      }
451
-      $output .= '</li></ul></td>';
450
+        }
451
+        $output .= '</li></ul></td>';
452 452
     }
453 453
     $output .= '</tr>';
454 454
 
@@ -456,28 +456,28 @@  discard block
 block discarded – undo
456 456
 
457 457
     break;
458 458
 
459
-  case 'edit':
459
+    case 'edit':
460 460
   default:
461 461
 
462 462
     // Return the HTML generated from the $form data structure.
463 463
     if (function_exists('jump_quickly')) {
464
-      $path = 'account/prefs/computing/edit';
465
-      $venues = array(
464
+        $path = 'account/prefs/computing/edit';
465
+        $venues = array(
466 466
         "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
467 467
         "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
468 468
         "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'),
469 469
         "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
470
-      );
471
-      variable_set('jump_use_js_venues-Array', 1);
472
-      drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
473
-      drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
474
-
475
-      $output .= '<div id="venue-selector" class="simple-form-controls">';
476
-      $output .= '  <div class="form-item venue">';
477
-      $output .= '    <label>Preference set:</label>';
478
-      $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
479
-      $output .= '  </div>';
480
-      $output .= '</div>';
470
+        );
471
+        variable_set('jump_use_js_venues-Array', 1);
472
+        drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
473
+        drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
474
+
475
+        $output .= '<div id="venue-selector" class="simple-form-controls">';
476
+        $output .= '  <div class="form-item venue">';
477
+        $output .= '    <label>Preference set:</label>';
478
+        $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
479
+        $output .= '  </div>';
480
+        $output .= '</div>';
481 481
     }
482 482
     $output .= drupal_get_form('boincwork_generalprefs_form', $venue, NULL, $advanced);
483 483
 
@@ -488,54 +488,54 @@  discard block
 block discarded – undo
488 488
     drupal_prepare_form('boincwork_generalprefs_form', $current_set, $form_state);
489 489
 
490 490
     if (!$current_set['#established']) {
491
-      drupal_set_message(bts(
492
-          "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
493
-          array( '@venue' => $venue, ),
494
-          NULL, 'boinc:account-preferences'), 'status');
491
+        drupal_set_message(bts(
492
+            "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
493
+            array( '@venue' => $venue, ),
494
+            NULL, 'boinc:account-preferences'), 'status');
495 495
     }
496 496
 
497 497
     break;
498
-  }
498
+    }
499 499
 
500
-  return $output;
500
+    return $output;
501 501
 }
502 502
 
503 503
 /**
504
-  * Project preferences menu callback
505
-  * Called when user goes to edit project preferences page.
506
-  */
504
+ * Project preferences menu callback
505
+ * Called when user goes to edit project preferences page.
506
+ */
507 507
 function projectprefs_page($action = null, $venue = null) {
508 508
 
509
-  // Keep the venue selected across preference pages
510
-  boincwork_select_venue($venue);
509
+    // Keep the venue selected across preference pages
510
+    boincwork_select_venue($venue);
511 511
 
512
-  require_boinc(array('util', 'prefs'));
513
-  global $project_has_beta;
514
-  $pref_sets = array('generic', 'home', 'school', 'work');
515
-  $output = null;
512
+    require_boinc(array('util', 'prefs'));
513
+    global $project_has_beta;
514
+    $pref_sets = array('generic', 'home', 'school', 'work');
515
+    $output = null;
516 516
 
517
-  $title = 'Project';
518
-  drupal_set_title($title);
517
+    $title = 'Project';
518
+    drupal_set_title($title);
519 519
 
520
-  switch ($action) {
520
+    switch ($action) {
521 521
 
522
-  case 'clear':
522
+    case 'clear':
523 523
     // Remove settings from this preference set
524 524
     if ($venue AND $venue != 'generic') {
525
-      boincwork_save_prefs(NULL, 'project', $venue);
526
-      drupal_set_message(t('Settings for the "@name" preference set have been
525
+        boincwork_save_prefs(NULL, 'project', $venue);
526
+        drupal_set_message(t('Settings for the "@name" preference set have been
527 527
         cleared', array('@name' => ucfirst($venue))));
528 528
 
529
-      // Set the generic preference set as active
530
-      $_SESSION['prefs venue'] = 'generic';
529
+        // Set the generic preference set as active
530
+        $_SESSION['prefs venue'] = 'generic';
531 531
 
532
-      // If the user has removed their default preference set, make it generic
533
-      boincwork_set_default_venue();
532
+        // If the user has removed their default preference set, make it generic
533
+        boincwork_set_default_venue();
534 534
     }
535 535
     drupal_goto();
536 536
     break;
537 537
 
538
-  case 'combined':
538
+    case 'combined':
539 539
 
540 540
     // Compare preference sets; tabular view
541 541
 
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
     $boincuser = BoincUser::lookup_id($account->boincuser_id);
545 545
 
546 546
     foreach ($pref_sets as $pref_set) {
547
-      $form_state = array();
548
-      $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set);
549
-      drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state);
547
+        $form_state = array();
548
+        $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set);
549
+        drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state);
550 550
     }
551 551
 
552 552
     $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>';
@@ -557,20 +557,20 @@  discard block
 block discarded – undo
557 557
     $prefs_table = boincwork_make_prefs_table($prefs['generic']);
558 558
 
559 559
     foreach ($prefs_table as $category => $section) {
560
-      $output .= '<tr class="section-heading">';
561
-      $output .= "<td>{$section['name']}</td>";
562
-      foreach ($pref_sets as $pref_set) {
560
+        $output .= '<tr class="section-heading">';
561
+        $output .= "<td>{$section['name']}</td>";
562
+        foreach ($pref_sets as $pref_set) {
563 563
         $output .= '<td>' . $pref_set . '</td>';
564
-      }
565
-      $output .= '</tr>';
566
-      foreach ($section['elements'] as $name => $setting) {
564
+        }
565
+        $output .= '</tr>';
566
+        foreach ($section['elements'] as $name => $setting) {
567 567
         $output .= '<tr>';
568 568
         $output .= '<td>';
569 569
         $output .= "<div class=\"title\">{$setting['name']}</div>";
570 570
         $output .= "<div class=\"description\">{$setting['description']}</div>";
571 571
         $output .= '</td>';
572 572
         foreach ($pref_sets as $pref_set) {
573
-          if (($prefs[$pref_set]) AND
573
+            if (($prefs[$pref_set]) AND
574 574
               $prefs[$pref_set]['#established'] AND
575 575
               isset($prefs[$pref_set][$category])) {
576 576
             $pref_setting = $prefs[$pref_set][$category][$name];
@@ -578,10 +578,10 @@  discard block
 block discarded – undo
578 578
             if ($value == '') $value = '---';
579 579
             if (!isset($pref_setting['#field_suffix'])) $pref_setting['#field_suffix'] = '';
580 580
             $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>";
581
-          } else $output .= '<td>---</td>';
581
+            } else $output .= '<td>---</td>';
582 582
         }
583 583
         $output .= '</tr>';
584
-      }
584
+        }
585 585
     }
586 586
 
587 587
     // Empty line above action links... :/
@@ -597,29 +597,29 @@  discard block
 block discarded – undo
597 597
     $output .= '<tr>';
598 598
     $output .= '<td></td>';
599 599
     foreach ($pref_sets as $pref_set) {
600
-      $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
601
-      $output .= '<td><ul class="tab-list"><li class="first tab">';
602
-      $output .= l($action_text, "account/prefs/project/edit/{$pref_set}");
603
-      // Show Clear links for established preference sets
604
-      if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
600
+        $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add');
601
+        $output .= '<td><ul class="tab-list"><li class="first tab">';
602
+        $output .= l($action_text, "account/prefs/project/edit/{$pref_set}");
603
+        // Show Clear links for established preference sets
604
+        if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) {
605 605
         $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}",
606
-          array(
606
+            array(
607 607
             'query' => drupal_get_destination(),
608 608
             'attributes' => array(
609
-              'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
609
+                'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?',
610 610
                 array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')'
611 611
             )
612
-          )
612
+            )
613 613
         );
614
-      }
615
-      $output .= '</li></ul></td>';
614
+        }
615
+        $output .= '</li></ul></td>';
616 616
     }
617 617
 
618 618
     $output .= '</table>';
619 619
 
620 620
     break;
621 621
 
622
-  case 'set-default':
622
+    case 'set-default':
623 623
     // Set this preference set as the one to use for any new hosts attached
624 624
     // to the user account
625 625
     boincwork_set_default_venue($venue);
@@ -627,30 +627,30 @@  discard block
 block discarded – undo
627 627
     drupal_goto('account/prefs/project/combined');
628 628
     break;
629 629
 
630
-  case 'edit':
630
+    case 'edit':
631 631
   default:
632 632
 
633 633
     // Return the HTML generated from the $form data structure.
634 634
     require_boinc('util');
635 635
 
636 636
     if (function_exists('jump_quickly')) {
637
-      $path = 'account/prefs/project/edit';
638
-      $venues = array(
637
+        $path = 'account/prefs/project/edit';
638
+        $venues = array(
639 639
         "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'),
640 640
         "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'),
641 641
         "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'),
642 642
         "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location')
643
-      );
644
-      variable_set('jump_use_js_venues-Array', 1);
645
-      drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
646
-      drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
647
-
648
-      $output .= '<div id="venue-selector" class="simple-form-controls">';
649
-      $output .= '  <div class="form-item venue">';
650
-      $output .= '    <label>Preference set:</label>';
651
-      $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
652
-      $output .= '  </div>';
653
-      $output .= '</div>';
643
+        );
644
+        variable_set('jump_use_js_venues-Array', 1);
645
+        drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
646
+        drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme');
647
+
648
+        $output .= '<div id="venue-selector" class="simple-form-controls">';
649
+        $output .= '  <div class="form-item venue">';
650
+        $output .= '    <label>Preference set:</label>';
651
+        $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}");
652
+        $output .= '  </div>';
653
+        $output .= '</div>';
654 654
     }
655 655
     $output .= drupal_get_form('boincwork_projectprefs_form', $venue);
656 656
 
@@ -661,63 +661,63 @@  discard block
 block discarded – undo
661 661
     drupal_prepare_form('boincwork_projectprefs_form', $current_set, $form_state);
662 662
 
663 663
     if (!$current_set['#established']) {
664
-      drupal_set_message(bts(
665
-          "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
666
-          array( '@venue' => $venue, ),
667
-          NULL, 'boinc:account-preferences'), 'status');
664
+        drupal_set_message(bts(
665
+            "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.",
666
+            array( '@venue' => $venue, ),
667
+            NULL, 'boinc:account-preferences'), 'status');
668 668
     }
669 669
 
670 670
     break;
671 671
 
672
-  }
673
-  return $output;
672
+    }
673
+    return $output;
674 674
 }
675 675
 
676 676
 /**
677
-  * Community preferences menu callback
678
-  * Called when user goes to edit community preferences page.
679
-  */
677
+ * Community preferences menu callback
678
+ * Called when user goes to edit community preferences page.
679
+ */
680 680
 function communityprefs_page($action = null) {
681 681
 
682
-  require_boinc(array('util', 'prefs'));
683
-  $output = null;
682
+    require_boinc(array('util', 'prefs'));
683
+    $output = null;
684 684
 
685
-  $title = 'Community';
686
-  drupal_set_title($title);
685
+    $title = 'Community';
686
+    drupal_set_title($title);
687 687
 
688
-  //$output .= '<h2>Community preferences</h2>';
688
+    //$output .= '<h2>Community preferences</h2>';
689 689
 
690
-  $output .= drupal_get_form('communityprefs_form');
690
+    $output .= drupal_get_form('communityprefs_form');
691 691
 
692
-  return $output;
692
+    return $output;
693 693
 }
694 694
 
695 695
 /**
696
-  * Privacy preferences menu callback
697
-  * Called when user goes to edit privacy preferences page.
698
-  */
696
+ * Privacy preferences menu callback
697
+ * Called when user goes to edit privacy preferences page.
698
+ */
699 699
 function privacyprefs_page($action = null) {
700 700
 
701
-  require_boinc(array('util', 'prefs'));
702
-  $output = null;
703
-  $title = 'Privacy';
704
-  drupal_set_title($title);
701
+    require_boinc(array('util', 'prefs'));
702
+    $output = null;
703
+    $title = 'Privacy';
704
+    drupal_set_title($title);
705 705
 
706
-  switch ($action) {
707
-  case 'view':
706
+    switch ($action) {
707
+    case 'view':
708 708
     $form_state = array();
709 709
     $prefs = drupal_retrieve_form('boincwork_privacyprefs_form', $form_state);
710 710
     drupal_prepare_form('boincwork_privacyprefs_form', $prefs, $form_state);
711 711
     $output .= '<table>';
712 712
 
713 713
     $sections = array(
714
-      'privacy' => $prefs['privacy']
714
+        'privacy' => $prefs['privacy']
715 715
     );
716 716
 
717 717
     foreach ($sections as $section) {
718
-      $output .= '<tr class="section-heading">';
719
-      $output .= "<td>{$section['#title']}</td></tr>";
720
-      foreach ($section as $name => $setting) {
718
+        $output .= '<tr class="section-heading">';
719
+        $output .= "<td>{$section['#title']}</td></tr>";
720
+        foreach ($section as $name => $setting) {
721 721
         if ($name{0} == '#') continue;
722 722
         $value = isset($setting['#default_value']) ? $setting['#default_value'] : '';
723 723
         if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value];
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
         $output .= "<td>{$setting['#title']}<br/>{$setting['#description']}</td>";
730 730
         $output .= "<td>{$value} {$setting['#field_suffix']}</td>";
731 731
         $output .= '</tr>';
732
-      }
732
+        }
733 733
     }
734 734
 
735 735
     // Edit preferences link
@@ -742,33 +742,33 @@  discard block
 block discarded – undo
742 742
 
743 743
     break;
744 744
 
745
-  case 'edit':
745
+    case 'edit':
746 746
   default:
747 747
     require_boinc('util');
748 748
     // Return the HTML generated from the $form data structure.
749 749
     $output .= drupal_get_form('boincwork_privacyprefs_form');
750 750
     break;
751 751
 
752
-  }
752
+    }
753 753
 
754
-  return $output;
754
+    return $output;
755 755
 }
756 756
 
757 757
 /**
758
-  * Certificates menu callback
759
-  * Called when user goes to account certificate pages
760
-  */
758
+ * Certificates menu callback
759
+ * Called when user goes to account certificate pages
760
+ */
761 761
 function boincwork_certificates($type = null, $border = null) {
762
-  global $user;
763
-  $drupuser = user_load($user->uid);
764
-  // Load BOINC account and pre-authenticate with BOINC code
765
-  require_boinc(array('util', 'cert'));
766
-  $boincuser = BoincUser::lookup_id($drupuser->boincuser_id);
767
-  //global $g_logged_in_user;
768
-  //$g_logged_in_user = $boincuser;
769
-  //print_r($boincuser); exit;
770
-  switch ($type) {
771
-  case 'all':
762
+    global $user;
763
+    $drupuser = user_load($user->uid);
764
+    // Load BOINC account and pre-authenticate with BOINC code
765
+    require_boinc(array('util', 'cert'));
766
+    $boincuser = BoincUser::lookup_id($drupuser->boincuser_id);
767
+    //global $g_logged_in_user;
768
+    //$g_logged_in_user = $boincuser;
769
+    //print_r($boincuser); exit;
770
+    switch ($type) {
771
+    case 'all':
772 772
     //include_boinc('user/cert_all.php');
773 773
     require_boinc(array('util','cert','user'));
774 774
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
     ";
839 839
     break;
840 840
 
841
-  case 'account':
841
+    case 'account':
842 842
   default:
843 843
     //include_boinc('user/cert1.php');
844 844
     require_boinc(array('util','cert'));
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
     echo "
915 915
     </td><tr></table>
916 916
     ";
917
-  }
917
+    }
918 918
 }
919 919
 
920 920
 /**
@@ -922,42 +922,42 @@  discard block
 block discarded – undo
922 922
  * Called when user selects to delete a host
923 923
  */
924 924
 function boincwork_host_delete($host_id) {
925
-  // Verify that host has no tasks
926
-  if (boincwork_host_user_is_owner($host_id)) {
925
+    // Verify that host has no tasks
926
+    if (boincwork_host_user_is_owner($host_id)) {
927 927
     if (!boincwork_host_get_task_count($host_id)) {
928
-      // Delete the host record
929
-      db_set_active('boinc_rw');
930
-      $host_deleted = db_query(
928
+        // Delete the host record
929
+        db_set_active('boinc_rw');
930
+        $host_deleted = db_query(
931 931
         "DELETE FROM {host} WHERE id = '%d'",
932 932
         $host_id
933
-      );
934
-      db_set_active('default');
935
-      if ($host_deleted) {
933
+        );
934
+        db_set_active('default');
935
+        if ($host_deleted) {
936 936
         drupal_set_message(t('Host @id has been removed from your account.',
937
-          array('@id' => $host_id)));
937
+            array('@id' => $host_id)));
938 938
         drupal_goto('account/computers');
939
-      }
940
-      else {
939
+        }
940
+        else {
941 941
         drupal_set_message(t('Host @id could not be deleted. Not sure why...',
942
-          array('@id' => $host_id)), 'error'
942
+            array('@id' => $host_id)), 'error'
943 943
         );
944
-      }
944
+        }
945 945
     }
946 946
     else {
947
-      drupal_set_message(t('Host @id cannot be deleted because it still has
947
+        drupal_set_message(t('Host @id cannot be deleted because it still has
948 948
         tasks associated with it. These tasks should be processed within the
949 949
         next few days, after which the host can be deleted.',
950 950
         array('@id' => $host_id)), 'warning'
951
-      );
951
+        );
952
+    }
952 953
     }
953
-  }
954
-  else {
954
+    else {
955 955
     drupal_set_message(t('You are not the owner of host @id, so you cannot
956 956
       delete it.',
957
-      array('@id' => $host_id)), 'error'
957
+        array('@id' => $host_id)), 'error'
958 958
     );
959
-  }
960
-  drupal_goto("host/{$host_id}");
959
+    }
960
+    drupal_goto("host/{$host_id}");
961 961
 }
962 962
 
963 963
 /**
@@ -965,55 +965,55 @@  discard block
 block discarded – undo
965 965
  * Called when user accesses the log for a host
966 966
  */
967 967
 function boincwork_host_log($host_id = null) {
968
-  $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
969
-  $log = '';
970
-  if ($root_log_dir AND $host_id) {
968
+    $root_log_dir = variable_get('boinc_host_sched_logs_dir', '');
969
+    $log = '';
970
+    if ($root_log_dir AND $host_id) {
971 971
     $subdir = substr($host_id, 0, -3) OR $subdir = 0;
972 972
     $log = implode('/', array($root_log_dir, $subdir, $host_id));
973
-  }
974
-  if ($log AND file_exists($log)) {
973
+    }
974
+    if ($log AND file_exists($log)) {
975 975
     header('Content-type: text/plain');
976 976
     include($log);
977
-  }
977
+    }
978 978
 }
979 979
 
980 980
 function boincwork_host_set_venue($host_id = NULL, $venue = NULL) {
981
-  global $user;
982
-  $account = user_load($user->uid);
983
-  db_set_active('boinc_ro');
984
-  // Verify that this is my host
985
-  $host_owner = db_result(db_query(
981
+    global $user;
982
+    $account = user_load($user->uid);
983
+    db_set_active('boinc_ro');
984
+    // Verify that this is my host
985
+    $host_owner = db_result(db_query(
986 986
     "SELECT userid FROM {host} WHERE id = '%d'",
987 987
     $host_id
988
-  ));
989
-  db_set_active('default');
990
-  if ($host_owner AND $host_owner == $account->boincuser_id) {
988
+    ));
989
+    db_set_active('default');
990
+    if ($host_owner AND $host_owner == $account->boincuser_id) {
991 991
     db_set_active('boinc_rw');
992 992
     $updated = db_query(
993
-      "UPDATE {host} SET venue = '%s' WHERE id = '%d'",
994
-      $venue, $host_id
993
+        "UPDATE {host} SET venue = '%s' WHERE id = '%d'",
994
+        $venue, $host_id
995 995
     );
996 996
     db_set_active('default');
997 997
     if ($updated) {
998
-      drupal_set_message(
998
+        drupal_set_message(
999 999
         bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details')
1000 1000
         . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details')
1001
-      );
1001
+        );
1002 1002
     }
1003 1003
     else {
1004
-      drupal_set_message(
1004
+        drupal_set_message(
1005 1005
         bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'),
1006 1006
         'error'
1007
-      );
1007
+        );
1008 1008
     }
1009
-  }
1010
-  else {
1009
+    }
1010
+    else {
1011 1011
     drupal_set_message(
1012
-      bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'),
1013
-      'warning'
1012
+        bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'),
1013
+        'warning'
1014 1014
     );
1015
-  }
1016
-  drupal_goto("host/{$host_id}");
1015
+    }
1016
+    drupal_goto("host/{$host_id}");
1017 1017
 }
1018 1018
 
1019 1019
 /**
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
  * Called when user accesses cell phone stats
1022 1022
  */
1023 1023
 function boincwork_mobile_stats($userid = null) {
1024
-  $_GET['id'] = $userid;
1025
-  include_boinc('user/userw.php');
1024
+    $_GET['id'] = $userid;
1025
+    include_boinc('user/userw.php');
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
  * Called to build the server status page
1031 1031
  */
1032 1032
 function boincwork_server_status() {
1033
-  include_boinc('user/server_status.php');
1033
+    include_boinc('user/server_status.php');
1034 1034
 }
1035 1035
 
1036 1036
 /**
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
  * RPC for managing job input files
1039 1039
  */
1040 1040
 function boincwork_job_file() {
1041
-  include_boinc('user/job_file.php');
1041
+    include_boinc('user/job_file.php');
1042 1042
 }
1043 1043
 
1044 1044
 /**
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
  * Get output file from remote job submission
1047 1047
  */
1048 1048
 function boincwork_get_output() {
1049
-  include_boinc('user/get_output.php');
1049
+    include_boinc('user/get_output.php');
1050 1050
 }
1051 1051
 
1052 1052
 /**
@@ -1054,28 +1054,28 @@  discard block
 block discarded – undo
1054 1054
  * Get the project configuration XML; used by client software
1055 1055
  */
1056 1056
 function boincwork_get_project_config() {
1057
-  ob_start();
1058
-  include_boinc('user/get_project_config.php');
1059
-  $xml = ob_get_clean();
1060
-  $xml = load_configuration($xml);
1061
-
1062
-  // obtain Drupal variables
1063
-  $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
1064
-  $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE);
1065
-
1066
-  // If terms of use string exists and override is true, set terms-of-use
1067
-  // to Drupal varaible.
1068
-  if ( (!empty($termsofuse) && ($overrideboinctou)) ) {
1057
+    ob_start();
1058
+    include_boinc('user/get_project_config.php');
1059
+    $xml = ob_get_clean();
1060
+    $xml = load_configuration($xml);
1061
+
1062
+    // obtain Drupal variables
1063
+    $termsofuse = variable_get('boinc_weboptions_termsofuse', '');
1064
+    $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE);
1065
+
1066
+    // If terms of use string exists and override is true, set terms-of-use
1067
+    // to Drupal varaible.
1068
+    if ( (!empty($termsofuse) && ($overrideboinctou)) ) {
1069 1069
     if (!empty($xml['project_config']['terms_of_use'])) {
1070
-      // Remove any existing terms of use
1071
-      unset($xml['project_config']['terms_of_use']);
1070
+        // Remove any existing terms of use
1071
+        unset($xml['project_config']['terms_of_use']);
1072 1072
     }
1073 1073
 
1074 1074
     // Add terms of use from Drupal
1075 1075
     $xml['project_config']['terms_of_use']['@value'] = $termsofuse;
1076
-  }
1076
+    }
1077 1077
 
1078
-  print save_configuration($xml);
1078
+    print save_configuration($xml);
1079 1079
 }
1080 1080
 
1081 1081
 
@@ -1083,16 +1083,16 @@  discard block
 block discarded – undo
1083 1083
  * Page callback for the remote job submission RPC (submit_rpc_handler.php).
1084 1084
  */
1085 1085
 function boincwork_submit_rpc_handler() {
1086
-  include_boinc('user/submit_rpc_handler.php');
1086
+    include_boinc('user/submit_rpc_handler.php');
1087 1087
 }
1088 1088
 
1089 1089
 /**
1090 1090
  * Page callback for user WAP (userw.php).
1091 1091
  */
1092 1092
 function boincwork_user_wap() {
1093
-  // Remove q from the GET request or BOINC will panic
1094
-  unset($_GET['q']);
1095
-  include_boinc('user/userw.php');
1093
+    // Remove q from the GET request or BOINC will panic
1094
+    unset($_GET['q']);
1095
+    include_boinc('user/userw.php');
1096 1096
 }
1097 1097
 
1098 1098
 
@@ -1100,44 +1100,44 @@  discard block
 block discarded – undo
1100 1100
  * Page callback for user account task table
1101 1101
  */
1102 1102
 function boincwork_account_task_table($tselect = NULL, $app_id = NULL) {
1103
-  $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table');
1104
-  drupal_set_title($title);
1103
+    $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table');
1104
+    drupal_set_title($title);
1105 1105
 
1106
-  global $user;
1107
-  $account = user_load($user->uid);
1108
-  return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id);
1106
+    global $user;
1107
+    $account = user_load($user->uid);
1108
+    return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id);
1109 1109
 }
1110 1110
 
1111 1111
 /**
1112 1112
  * Page callback for host task table
1113 1113
  */
1114 1114
 function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) {
1115
-  require_boinc( array('util', 'result') );
1115
+    require_boinc( array('util', 'result') );
1116 1116
 
1117
-  $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table');
1118
-  drupal_set_title($title);
1117
+    $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table');
1118
+    drupal_set_title($title);
1119 1119
 
1120
-  if (is_null($host_id)) {
1120
+    if (is_null($host_id)) {
1121 1121
     drupal_set_message(bts('ERROR: Invalid host ID', array(), NULL, 'boinc:host-task-table'), 'error');
1122 1122
     return '';
1123
-  }
1123
+    }
1124 1124
 
1125
-  return boincwork_tasktable(2, $host_id, $tselect, $app_id);
1125
+    return boincwork_tasktable(2, $host_id, $tselect, $app_id);
1126 1126
 }
1127 1127
 
1128 1128
 /**
1129 1129
  * Page callback for workunit task table
1130 1130
  */
1131 1131
 function boincwork_workunit_task_table($workunit_id = NULL, $tselect = NULL, $app_id = NULL) {
1132
-  $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table');
1133
-  drupal_set_title($title);
1132
+    $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table');
1133
+    drupal_set_title($title);
1134 1134
 
1135
-  if (is_null($workunit_id)) {
1135
+    if (is_null($workunit_id)) {
1136 1136
     drupal_set_message(bts('ERROR: Invalid workunit ID', array(), NULL, 'boinc:workunit-task-table'), 'error');
1137 1137
     return '';
1138
-  }
1138
+    }
1139 1139
 
1140
-  return boincwork_tasktable(1, $workunit_id, $tselect, $app_id);
1140
+    return boincwork_tasktable(1, $workunit_id, $tselect, $app_id);
1141 1141
 }
1142 1142
 
1143 1143
 /**
@@ -1145,8 +1145,8 @@  discard block
 block discarded – undo
1145 1145
  * Take a node ID and render that node as a page
1146 1146
  */
1147 1147
 function boincwork_view_page($nid) {
1148
-  $node = node_load($nid);
1149
-  return node_page_view($node);
1148
+    $node = node_load($nid);
1149
+    return node_page_view($node);
1150 1150
 }
1151 1151
 
1152 1152
 
@@ -1158,16 +1158,16 @@  discard block
 block discarded – undo
1158 1158
  * Determine which venue should be selected
1159 1159
  */
1160 1160
 function boincwork_select_venue(&$venue) {
1161
-  if (!$venue) {
1161
+    if (!$venue) {
1162 1162
     $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : NULL;
1163 1163
     if ($active_venue) {
1164
-      $venue = $active_venue;
1165
-      //unset($_SESSION['prefs venue']);
1164
+        $venue = $active_venue;
1165
+        //unset($_SESSION['prefs venue']);
1166
+    }
1166 1167
     }
1167
-  }
1168
-  else {
1168
+    else {
1169 1169
     // Set the active venue to keep it selected between computing and project
1170 1170
     // preference pages
1171 1171
     $_SESSION['prefs venue'] = $venue;
1172
-  }
1172
+    }
1173 1173
 }
Please login to merge, or discard this patch.