Passed
Push — master ( 8b88f4...c5ef2d )
by Christian
07:24 queued 10s
created
drupal/sites/default/boinc/modules/boincstats/boincstats.module 1 patch
Indentation   +179 added lines, -179 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 charting features for statistics
7
-  */
5
+ * @file
6
+ * Enable BOINC charting features for statistics
7
+ */
8 8
 
9 9
 
10 10
 /*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
19 19
 
20 20
 /**
21
-  * Implementation of hook_menu().
22
-  */
21
+ * Implementation of hook_menu().
22
+ */
23 23
 function boincstats_menu() {
24
-  $items['admin/boinc/stats'] = array(
24
+    $items['admin/boinc/stats'] = array(
25 25
     'title' => 'Environment: Statistics setup',
26 26
     'description' => 'Configure the stats system for generating charts and 
27 27
       providing cross project data.',
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
     'access arguments' => array('administer site configuration'),
31 31
     'type' => MENU_NORMAL_ITEM,
32 32
     'file' => 'boincstats.admin.inc'
33
-  );
34
-  $items['charts/user'] = array(
33
+    );
34
+    $items['charts/user'] = array(
35 35
     'page callback' => 'boincstats_get_user_stats_chart',
36 36
     'access arguments' => array('access content'),
37 37
     'type' => MENU_CALLBACK
38
-  );
39
-  $items['charts/project'] = array(
38
+    );
39
+    $items['charts/project'] = array(
40 40
     'page callback' => 'boincstats_get_project_stats_chart',
41 41
     'access arguments' => array('access content'),
42 42
     'type' => MENU_CALLBACK
43
-  );
44
-  return $items;
43
+    );
44
+    return $items;
45 45
 }
46 46
 
47 47
 
@@ -50,31 +50,31 @@  discard block
 block discarded – undo
50 50
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
51 51
  
52 52
 /**
53
-  * User stats chart menu callback
54
-  * Called to generate the daily credit status chart for a user (dashboard)
55
-  */
53
+ * User stats chart menu callback
54
+ * Called to generate the daily credit status chart for a user (dashboard)
55
+ */
56 56
 function boincstats_get_user_stats_chart($cpid = null, $chart_size = 'medium') {
57 57
   
58
-  // pChart library inclusions
59
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class');
60
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class');
61
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class');
62
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class');
58
+    // pChart library inclusions
59
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class');
60
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class');
61
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class');
62
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class');
63 63
   
64
-  init_theme();
65
-  global $theme_key;
66
-  $cache_name = "{$theme_key}_";
64
+    init_theme();
65
+    global $theme_key;
66
+    $cache_name = "{$theme_key}_";
67 67
   
68
-  $dataset_size = 0;
69
-  $chart_height = 0;
70
-  $chart_width = 0;
71
-  $draw_x_lines = FALSE;
72
-  $label_x_axis = FALSE;
68
+    $dataset_size = 0;
69
+    $chart_height = 0;
70
+    $chart_width = 0;
71
+    $draw_x_lines = FALSE;
72
+    $label_x_axis = FALSE;
73 73
   
74
-  $stats_xml = NULL;
74
+    $stats_xml = NULL;
75 75
   
76
-  switch($chart_size) {
77
-  case 'small':
76
+    switch($chart_size) {
77
+    case 'small':
78 78
     $cache_name .= "{$cpid}_small";
79 79
     $dataset_size = 30;
80 80
     $chart_height = 80;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     $draw_x_lines = FALSE;
84 84
     $label_x_axis = FALSE;
85 85
     break;
86
-  case 'medium':
86
+    case 'medium':
87 87
   default:
88 88
     $cache_name .= $cpid;
89 89
     $dataset_size = 60;
@@ -91,32 +91,32 @@  discard block
 block discarded – undo
91 91
     $chart_width = 589;
92 92
     $draw_x_lines = TRUE;
93 93
     $label_x_axis = TRUE;
94
-  }
94
+    }
95 95
   
96
-  // Sanity check for cache directory
97
-  if (!boincstats_check_cache_dir()) {
96
+    // Sanity check for cache directory
97
+    if (!boincstats_check_cache_dir()) {
98 98
     return;
99
-  }
99
+    }
100 100
   
101
-  // Initialize the cache object and flush stale images
102
-  $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache'));
103
-  $myCache->removeOlderThan(60*60*24);
101
+    // Initialize the cache object and flush stale images
102
+    $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache'));
103
+    $myCache->removeOlderThan(60*60*24);
104 104
   
105
-  if ($myCache->isInCache($cache_name)) {
105
+    if ($myCache->isInCache($cache_name)) {
106 106
     $myCache->strokeFromCache($cache_name);
107
-  }
108
-  else {
107
+    }
108
+    else {
109 109
     // Initialize dataset
110 110
     $dataset = array();
111 111
     $stats_xml = boincstats_get_project_stats('daily', $cpid);
112 112
     if ($stats_xml) {
113
-      // Get the last 60 days of stats for the chart
114
-      for ($j = 30; $j < 90; $j++) {
113
+        // Get the last 60 days of stats for the chart
114
+        for ($j = 30; $j < 90; $j++) {
115 115
         $dataset[] = (int) $stats_xml->records->record[$j];
116
-      }
116
+        }
117 117
     }
118 118
     else {
119
-      for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0;
119
+        for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0;
120 120
     }
121 121
     
122 122
     // Get color configuration
@@ -145,39 +145,39 @@  discard block
 block discarded – undo
145 145
     // Define the chart area
146 146
     $myPicture->setGraphArea(0, 3, $chart_width, $chart_height);
147 147
     if ($backdrop_color) {
148
-      $myPicture->drawFilledRectangle(0, 0, $chart_width, $chart_height, $backdrop_color);
148
+        $myPicture->drawFilledRectangle(0, 0, $chart_width, $chart_height, $backdrop_color);
149 149
     }
150 150
     
151 151
     // Draw the scale
152 152
     $scaleSettings = array(
153
-      'Mode' => SCALE_MODE_START0,
154
-      'DrawYLines' => false,
155
-      'DrawXLines' => $draw_x_lines,
156
-      'GridTicks' => 2,
157
-      'LabelSkip' => 9,
158
-      'SkippedAxisAlpha' => 0,
159
-      'SkippedInnerTickWidth' => 0,
160
-      'SkippedOuterTickWidth' => 0,
161
-      'AxisAlpha' => 0,
162
-      'InnerTickWidth' => 0,
163
-      'OuterTickWidth' => 0,
164
-      'XMargin' => 1,
165
-      'YMargin' => 0,
166
-      'Floating' => TRUE,
167
-      'GridR' => 200,
168
-      'GridG' => 200,
169
-      'GridB' => 200,
170
-      'DrawSubTicks' => false,
171
-      'CycleBackground' => false
153
+        'Mode' => SCALE_MODE_START0,
154
+        'DrawYLines' => false,
155
+        'DrawXLines' => $draw_x_lines,
156
+        'GridTicks' => 2,
157
+        'LabelSkip' => 9,
158
+        'SkippedAxisAlpha' => 0,
159
+        'SkippedInnerTickWidth' => 0,
160
+        'SkippedOuterTickWidth' => 0,
161
+        'AxisAlpha' => 0,
162
+        'InnerTickWidth' => 0,
163
+        'OuterTickWidth' => 0,
164
+        'XMargin' => 1,
165
+        'YMargin' => 0,
166
+        'Floating' => TRUE,
167
+        'GridR' => 200,
168
+        'GridG' => 200,
169
+        'GridB' => 200,
170
+        'DrawSubTicks' => false,
171
+        'CycleBackground' => false
172 172
     );
173 173
     $myPicture->setFontProperties(array('FontSize' => 10));
174 174
     $myPicture->drawScale($scaleSettings);
175 175
     
176 176
     if ($label_x_axis) {
177
-      for ($i = 5; $i >= 0; $i--) {
177
+        for ($i = 5; $i >= 0; $i--) {
178 178
         $label = ($i) ? -10*$i : 'Today';
179 179
         $myPicture->drawText(589-587*($i/6)-5, 2, $label, array('Align' => TEXT_ALIGN_TOPRIGHT));
180
-      }
180
+        }
181 181
     }
182 182
 
183 183
     // Draw the area chart
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     // Render the picture (choose the best way)
190 190
     //$myPicture->autoOutput('pictures/example.drawAreaChart.simple.png');
191 191
     $myPicture->stroke();
192
-  }
192
+    }
193 193
 }
194 194
 
195 195
 /**
@@ -197,48 +197,48 @@  discard block
 block discarded – undo
197 197
  * Called to generate the daily credit status chart for the whole project
198 198
  */
199 199
 function boincstats_get_project_stats_chart() {
200
-  // pChart library inclusions
201
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class');
202
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class');
203
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class');
204
-  module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class');
200
+    // pChart library inclusions
201
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pData.class');
202
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pDraw.class');
203
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pImage.class');
204
+    module_load_include('php', 'boincstats', 'includes/pchart/class/pCache.class');
205 205
   
206
-  init_theme();
207
-  global $theme_key;
208
-  $cache_name = "{$theme_key}_project_chart";
206
+    init_theme();
207
+    global $theme_key;
208
+    $cache_name = "{$theme_key}_project_chart";
209 209
   
210
-  $color_keys = array('R', 'G', 'B');
210
+    $color_keys = array('R', 'G', 'B');
211 211
   
212
-  // Get color configuration
213
-  $palette_color_hex = theme_get_setting('boinc_stats_chart_color');
214
-  $palette_color = array_combine($color_keys, sscanf($palette_color_hex, "#%02x%02x%02x"));
215
-  $backdrop_color_hex = theme_get_setting('boinc_stats_chart_bcolor');
216
-  $backdrop_color = array_combine($color_keys, sscanf($backdrop_color_hex, "#%02x%02x%02x"));
212
+    // Get color configuration
213
+    $palette_color_hex = theme_get_setting('boinc_stats_chart_color');
214
+    $palette_color = array_combine($color_keys, sscanf($palette_color_hex, "#%02x%02x%02x"));
215
+    $backdrop_color_hex = theme_get_setting('boinc_stats_chart_bcolor');
216
+    $backdrop_color = array_combine($color_keys, sscanf($backdrop_color_hex, "#%02x%02x%02x"));
217 217
    
218
-  // Sanity check for cache directory
219
-  if (!boincstats_check_cache_dir()) {
218
+    // Sanity check for cache directory
219
+    if (!boincstats_check_cache_dir()) {
220 220
     return;
221
-  }
221
+    }
222 222
   
223
-  // Initialize the cache object and flush stale images
224
-  $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache'));
225
-  $myCache->removeOlderThan(60*60*24);
223
+    // Initialize the cache object and flush stale images
224
+    $myCache = new pCache(array('CacheFolder' => realpath('.') . '/' . conf_path() . '/files/cache'));
225
+    $myCache->removeOlderThan(60*60*24);
226 226
   
227
-  if ($myCache->isInCache($cache_name)) {
227
+    if ($myCache->isInCache($cache_name)) {
228 228
     $myCache->strokeFromCache($cache_name);
229
-  }
230
-  else {
229
+    }
230
+    else {
231 231
     // Initialize dataset
232 232
     $dataset = array();
233 233
     $stats_xml = boincstats_get_project_stats('daily');
234 234
     if ($stats_xml) {
235
-      // Get the last 60 days of stats for the chart
236
-      for ($j = 30; $j < 90; $j++) {
235
+        // Get the last 60 days of stats for the chart
236
+        for ($j = 30; $j < 90; $j++) {
237 237
         $dataset[] = (int) $stats_xml->records->record[$j];
238
-      }
238
+        }
239 239
     }
240 240
     else {
241
-      for ($i = 0; $i <= 30; $i++) $dataset[] = 0;
241
+        for ($i = 0; $i <= 30; $i++) $dataset[] = 0;
242 242
     }
243 243
     
244 244
     // Create and populate the pData object
@@ -263,25 +263,25 @@  discard block
 block discarded – undo
263 263
 
264 264
     // Draw the scale
265 265
     $scaleSettings = array(
266
-      'Mode' => SCALE_MODE_START0,
267
-      'DrawYLines' => false,
268
-      'DrawXLines' => false,
269
-      'GridTicks' => 2,
270
-      'LabelSkip' => 9,
271
-      'SkippedAxisAlpha' => 0,
272
-      'SkippedInnerTickWidth' => 0,
273
-      'SkippedOuterTickWidth' => 0,
274
-      'AxisAlpha' => 0,
275
-      'InnerTickWidth' => 0,
276
-      'OuterTickWidth' => 0,
277
-      'XMargin' => 1,
278
-      'YMargin' => 0,
279
-      'Floating' => TRUE,
280
-      'GridR' => 200,
281
-      'GridG' => 200,
282
-      'GridB' => 200,
283
-      'DrawSubTicks' => false,
284
-      'CycleBackground' => false
266
+        'Mode' => SCALE_MODE_START0,
267
+        'DrawYLines' => false,
268
+        'DrawXLines' => false,
269
+        'GridTicks' => 2,
270
+        'LabelSkip' => 9,
271
+        'SkippedAxisAlpha' => 0,
272
+        'SkippedInnerTickWidth' => 0,
273
+        'SkippedOuterTickWidth' => 0,
274
+        'AxisAlpha' => 0,
275
+        'InnerTickWidth' => 0,
276
+        'OuterTickWidth' => 0,
277
+        'XMargin' => 1,
278
+        'YMargin' => 0,
279
+        'Floating' => TRUE,
280
+        'GridR' => 200,
281
+        'GridG' => 200,
282
+        'GridB' => 200,
283
+        'DrawSubTicks' => false,
284
+        'CycleBackground' => false
285 285
     );
286 286
     $myPicture->setFontProperties(array('FontSize' => 10));
287 287
     $myPicture->drawScale($scaleSettings);
@@ -300,41 +300,41 @@  discard block
 block discarded – undo
300 300
     // Render the picture (choose the best way)
301 301
     //$myPicture->autoOutput('pictures/example.drawAreaChart.simple.png');
302 302
     $myPicture->stroke();
303
-  }
303
+    }
304 304
 }
305 305
 
306 306
 /*
307 307
  *
308 308
  */
309 309
 function boincstats_check_cache_dir($cache_path = 'files/cache') {
310
-  $cache_dir = realpath('.') . '/' . conf_path() . '/' . $cache_path;
311
-  if (!is_writeable($cache_dir)) {
310
+    $cache_dir = realpath('.') . '/' . conf_path() . '/' . $cache_path;
311
+    if (!is_writeable($cache_dir)) {
312 312
     if (!is_dir($cache_dir)) {
313
-      if (!is_writeable(dirname($cache_dir))) {
313
+        if (!is_writeable(dirname($cache_dir))) {
314 314
         // If the parent "files" dir isn't even writeable...
315 315
         watchdog('boincstats', '@parent_dir directory is not writeable. This
316 316
           directory must be writeable by the web server.',
317
-          array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR);
317
+            array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR);
318 318
         return FALSE;
319
-      }
320
-      else {
319
+        }
320
+        else {
321 321
         // Create the cache dir
322 322
         if (!mkdir($cache_dir, 0775)) {
323
-          watchdog('boincstats', 'Failed to create @cache_dir directory. Check
323
+            watchdog('boincstats', 'Failed to create @cache_dir directory. Check
324 324
             filesystem permissions...?',
325 325
             array('@cache_dir' => $cache_dir), WATCHDOG_ERROR);
326
-          return FALSE;
326
+            return FALSE;
327
+        }
327 328
         }
328
-      }
329 329
     }
330 330
     else {
331
-      watchdog('boincstats', 'Cache directory at @cache_dir is not writeable.
331
+        watchdog('boincstats', 'Cache directory at @cache_dir is not writeable.
332 332
         Please allow webserver write access.',
333 333
         array('@cache_dir' => $cache_dir), WATCHDOG_ERROR);
334
-      return FALSE;
334
+        return FALSE;
335 335
     }
336
-  }
337
-  return TRUE;
336
+    }
337
+    return TRUE;
338 338
 }
339 339
 
340 340
 /*
@@ -342,87 +342,87 @@  discard block
 block discarded – undo
342 342
  */
343 343
 function boincstats_get_project_stats($type = 'total', $cpid = NULL) {
344 344
   
345
-  // Determine the stats environment
346
-  boincstats_check_configuration();
347
-  $stats_server = variable_get('boinc_stats_server', '');
348
-  $stats_rpc = variable_get('boinc_stats_project_credit_history_rpc', '');
349
-  $project_id = variable_get('boinc_stats_remote_project_id', '');
345
+    // Determine the stats environment
346
+    boincstats_check_configuration();
347
+    $stats_server = variable_get('boinc_stats_server', '');
348
+    $stats_rpc = variable_get('boinc_stats_project_credit_history_rpc', '');
349
+    $project_id = variable_get('boinc_stats_remote_project_id', '');
350 350
   
351
-  $get = array(
351
+    $get = array(
352 352
     'id' => $project_id
353
-  );
354
-  switch ($type) {
355
-  case 'daily':
353
+    );
354
+    switch ($type) {
355
+    case 'daily':
356 356
     $get['daily'] = NULL;
357 357
     break;
358
-  case 'total':
358
+    case 'total':
359 359
   default:
360 360
   }
361 361
   
362
-  if ($cpid) {
362
+    if ($cpid) {
363 363
     // If a user CPID has been provided, limit scope to that user
364 364
     $stats_rpc = variable_get('boinc_stats_user_credit_history_rpc', '');
365 365
     $get['cpid'] = $cpid;
366
-  }
366
+    }
367 367
   
368
-  // Construct query string
369
-  $args = array();
370
-  foreach ($get as $arg => $value) {
368
+    // Construct query string
369
+    $args = array();
370
+    foreach ($get as $arg => $value) {
371 371
     if ($value !== NULL) {
372
-      $args[] = "{$arg}=" . rawurlencode($value);
372
+        $args[] = "{$arg}=" . rawurlencode($value);
373 373
     }
374 374
     else {
375
-      $args[] = $arg;
375
+        $args[] = $arg;
376 376
     }
377
-  }
378
-  $query = '?' . implode('&', $args);
377
+    }
378
+    $query = '?' . implode('&', $args);
379 379
   
380
-  // Load XML from RPC
381
-  $stats_xml = NULL;
382
-  $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
383
-  $result = drupal_http_request($target_url);
384
-  if (in_array($result->code, array(200, 304))) {
380
+    // Load XML from RPC
381
+    $stats_xml = NULL;
382
+    $target_url = "http://{$stats_server}/{$stats_rpc}{$query}";
383
+    $result = drupal_http_request($target_url);
384
+    if (in_array($result->code, array(200, 304))) {
385 385
     $stats_xml = simplexml_load_string($result->data);
386
-  }
387
-  watchdog('boincstats', $target_url);
388
-  return $stats_xml;
386
+    }
387
+    watchdog('boincstats', $target_url);
388
+    return $stats_xml;
389 389
 }
390 390
 
391 391
 /*
392 392
  *
393 393
  */
394 394
 function boincstats_get_project_total_credit() {
395
-  $stats_xml = boincstats_get_project_stats();
396
-  $last_record = end($stats_xml->records->record);
397
-  return ($last_record) ? (int) $last_record : 0;
395
+    $stats_xml = boincstats_get_project_stats();
396
+    $last_record = end($stats_xml->records->record);
397
+    return ($last_record) ? (int) $last_record : 0;
398 398
 }
399 399
 
400 400
 /*
401 401
  *
402 402
  */
403 403
 function boincstats_get_project_avg_credit() {
404
-  $stats_xml = boincstats_get_project_stats();
405
-  return (isset($stats_xml->recent_avg)) ? $stats_xml->recent_avg : 0;
404
+    $stats_xml = boincstats_get_project_stats();
405
+    return (isset($stats_xml->recent_avg)) ? $stats_xml->recent_avg : 0;
406 406
 }
407 407
 
408 408
 /*
409 409
  *
410 410
  */
411 411
 function boincstats_credit_to_ghours($credit) {
412
-  return $credit / (100 * 365);
412
+    return $credit / (100 * 365);
413 413
 }
414 414
 
415 415
 /*
416 416
  *
417 417
  */
418 418
 function boincstats_credit_to_flops($credit, $prefix = 0) {
419
-  $factor = array(
419
+    $factor = array(
420 420
     '0' => 0,
421 421
     'g' => 3,
422 422
     't' => 6,
423 423
     'p' => 9
424
-  );
425
-  return $credit / (pow(10, (int) $factor[$prefix]) / 10);
424
+    );
425
+    return $credit / (pow(10, (int) $factor[$prefix]) / 10);
426 426
 }
427 427
 
428 428
 
@@ -431,22 +431,22 @@  discard block
 block discarded – undo
431 431
  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */
432 432
 
433 433
 function boincstats_get_project_stats_overview($type = 'basic') {
434
-  global $base_path;
435
-  $output = '';
436
-  switch ($type) {
437
-  case 'basic':
434
+    global $base_path;
435
+    $output = '';
436
+    switch ($type) {
437
+    case 'basic':
438 438
     $output .= '<div class="overlay"><span>(' . bts('Credits per day', array(), NULL, 'boinc:front-page') . ')</span></div>' . "\n";
439 439
     $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n";
440 440
     break;
441
-  case 'detailed':
441
+    case 'detailed':
442 442
     $output .= '<div class="stats"><label>' . bts('Total G-hours', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_ghours(boincstats_get_project_total_credit())) . '</span></div>' . "\n";
443 443
     $output .= '<div class="stats"><label>' . bts('Avg TFlops', array(), NULL, 'boinc:front-page') . ': </label><span>' . number_format(boincstats_credit_to_flops(boincstats_get_project_avg_credit(), 't')) . '</span></div>' . "\n";
444 444
     //$output .= '<div class="stats"><a href="#">' . bts('Pending credits', array(), NULL, 'boinc:front-page') . '</a></div>' . "\n";
445 445
     $output .= '<div class="chart"><img src="' . $base_path . 'charts/project" /></div>' . "\n";
446 446
     break;
447
-  default:
447
+    default:
448 448
   }
449
-  return $output;
449
+    return $output;
450 450
 }
451 451
 
452 452
 
@@ -458,19 +458,19 @@  discard block
 block discarded – undo
458 458
  * Check that the stats system is configured, report if it isn't
459 459
  */
460 460
 function boincstats_check_configuration() {
461
-  $project_id = variable_get('boinc_stats_remote_project_id', '');
462
-  if (!$project_id) {
461
+    $project_id = variable_get('boinc_stats_remote_project_id', '');
462
+    if (!$project_id) {
463 463
     watchdog('boincstats', 'The BOINC stats system is not configured. Please
464 464
         !configure_it', array('!configure_it' => l(t('configure it now'),
465
-          'admin/boinc/stats')), WATCHDOG_ERROR);
465
+            'admin/boinc/stats')), WATCHDOG_ERROR);
466 466
     if (user_access('administer site configuration')) {
467
-      drupal_set_message(t('The BOINC stats system is not configured. Please
467
+        drupal_set_message(t('The BOINC stats system is not configured. Please
468 468
         !configure_it', array('!configure_it' => l(t('configure it now'),
469
-          'admin/boinc/stats'))), 'error', FALSE);
469
+            'admin/boinc/stats'))), 'error', FALSE);
470 470
     }
471 471
     else {
472
-      drupal_set_message(t('There is a problem with the site. Please contact
472
+        drupal_set_message(t('There is a problem with the site. Please contact
473 473
         the system administrator.'), 'error', FALSE);
474 474
     }
475
-  }
475
+    }
476 476
 }
Please login to merge, or discard this patch.
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.