Passed
Push — master ( 8e685f...ce48d5 )
by Kevin
13:20
created
drupal/sites/default/boinc/modules/contrib/jump/jump.module 2 patches
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
  * @return array
13 13
  */
14 14
 function jump_menu() {
15
-  $items = array();
16
-  $items['admin/settings/jump'] = array(
15
+    $items = array();
16
+    $items['admin/settings/jump'] = array(
17 17
     'title' => 'Jump Settings',
18 18
     'description' => 'Configure Jump module settings.',
19 19
     'page callback' => 'drupal_get_form',
20 20
     'page arguments' => array('jump_settings'),
21 21
     'access callback' => 'user_access',
22 22
     'access arguments' => array('administer menu'),
23
-  );
24
-  return $items;
23
+    );
24
+    return $items;
25 25
 }
26 26
 
27 27
 /**
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
  * @return string
31 31
  */
32 32
 function jump_settings() {
33
-  $form['jump_activepageinmenu'] = array(
33
+    $form['jump_activepageinmenu'] = array(
34 34
     '#type' => 'checkbox',
35 35
     '#title' => t('Show active page in menu.'),
36 36
     '#default_value' => variable_get('jump_activepageinmenu', 1),
37 37
     '#description' => t('This setting will force the jump menu to show the current page as the default selection in the jump menu when checked.  If you have a menu option that you would always like displayed at the top of the menu, like <em>Select a menu item</em>, you will want to uncheck this. This setting controls this behavior for all jump menus sitewide.  You can override this setting on a block-by-block basis.'),
38
-  );
39
-  return system_settings_form($form);
38
+    );
39
+    return system_settings_form($form);
40 40
 }
41 41
 
42 42
 /**
@@ -48,64 +48,64 @@  discard block
 block discarded – undo
48 48
  * @return array
49 49
  */
50 50
 function jump_block($op = 'list', $delta = 0, $edit = array()) {
51
-  switch ($op) {
51
+    switch ($op) {
52 52
     case 'list':
53 53
       $blocks = array();
54
-      foreach (menu_get_menus() as $name => $title) {
54
+        foreach (menu_get_menus() as $name => $title) {
55 55
         $blocks['menu-' . $name] = array(
56
-          'info' => t('Jump menu: !menu', array('!menu' => $name))
56
+            'info' => t('Jump menu: !menu', array('!menu' => $name))
57 57
         );
58
-      }
58
+        }
59 59
 
60
-      $vocs = taxonomy_get_vocabularies();
61
-      foreach ($vocs as $vid => $vocabulary) {
60
+        $vocs = taxonomy_get_vocabularies();
61
+        foreach ($vocs as $vid => $vocabulary) {
62 62
         $blocks['taxo-' . $vid] = array(
63
-          'info' => t('Jump menu: !voc', array('!voc' => $vocabulary->name))
63
+            'info' => t('Jump menu: !voc', array('!voc' => $vocabulary->name))
64 64
         );
65
-      }
66
-      return $blocks;
65
+        }
66
+        return $blocks;
67 67
     case 'configure':
68 68
       $form = array();
69
-      $form['block_settings']['jump_activepageinmenu_' . $delta] = array(
69
+        $form['block_settings']['jump_activepageinmenu_' . $delta] = array(
70 70
         '#type' => 'checkbox',
71 71
         '#title' => t('Show active page in jump menu.'),
72 72
         '#default_value' => variable_get('jump_activepageinmenu_' . $delta, 1),
73 73
         '#description' => t('This setting will force the jump menu to show the current page as the default selection in this block\'s jump menu.'),
74
-      );
75
-      // Do the rest of the form additions in hook_form_alter() since we can't do ahah here.
76
-      return $form;
74
+        );
75
+        // Do the rest of the form additions in hook_form_alter() since we can't do ahah here.
76
+        return $form;
77 77
     case 'save':
78 78
       variable_set('jump_activepageinmenu_' . $delta, $edit['jump_activepageinmenu_' . $delta]);
79
-      variable_set('jump_use_js_' . $delta, $edit['jump_use_js_' . $delta]);
80
-      variable_set('jump_add_select_' . $delta, $edit['jump_add_select_' . $delta]);
81
-      variable_set('jump_add_select_text_' . $delta, $edit['jump_add_select_text_' . $delta]);
82
-      break;
79
+        variable_set('jump_use_js_' . $delta, $edit['jump_use_js_' . $delta]);
80
+        variable_set('jump_add_select_' . $delta, $edit['jump_add_select_' . $delta]);
81
+        variable_set('jump_add_select_text_' . $delta, $edit['jump_add_select_text_' . $delta]);
82
+        break;
83 83
     case 'view':
84 84
       // The first 5 characters of $delta should be one of:
85 85
       //    menu-
86 86
       //    taxo-
87 87
       $subject = '';
88
-      $jumpmenu_type = substr($delta, 0, 4);
89
-      $jumpmenu_name = substr($delta, 5);
90
-      $active = jump_get_active_setting($delta);
91
-      if ($jumpmenu_type == 'menu') {
88
+        $jumpmenu_type = substr($delta, 0, 4);
89
+        $jumpmenu_name = substr($delta, 5);
90
+        $active = jump_get_active_setting($delta);
91
+        if ($jumpmenu_type == 'menu') {
92 92
         $form = jump_quickly($jumpmenu_name, 'menu', $active);
93 93
 
94 94
         // Use the menu label as the default block subject
95 95
         $menus = menu_get_menus();
96 96
         $subject = $menus[$jumpmenu_name];
97
-      }
98
-      else if ($jumpmenu_type == 'taxo') {
97
+        }
98
+        else if ($jumpmenu_type == 'taxo') {
99 99
         $form = jump_quickly($jumpmenu_name, 'taxo', $active);
100 100
 
101 101
         // Use the vocabulary name as the default block subject
102 102
         $vocab = taxonomy_vocabulary_load($jumpmenu_name);
103 103
         $subject = $vocab->name;
104
-      }
105
-      if (variable_get('jump_use_js_' . $delta, 0) === 1) drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
106
-      return array('subject' => $subject, 'content' => $form);
107
-      break;
108
-  }
104
+        }
105
+        if (variable_get('jump_use_js_' . $delta, 0) === 1) drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js');
106
+        return array('subject' => $subject, 'content' => $form);
107
+        break;
108
+    }
109 109
 }
110 110
 
111 111
 /**
@@ -124,36 +124,36 @@  discard block
 block discarded – undo
124 124
  * @return array
125 125
  */
126 126
 function jump_quickly($name = 'navigation', $type = 'menu', $active = -1, $override = '') {
127
-  // Reconstruct the $delta
128
-  $delta = $type . '-' . $name;
129
-  if ($active === -1) {
127
+    // Reconstruct the $delta
128
+    $delta = $type . '-' . $name;
129
+    if ($active === -1) {
130 130
     $active = variable_get('jump_activepageinmenu', 1);
131
-  }
132
-  $menu_state = array(
131
+    }
132
+    $menu_state = array(
133 133
     'delta' => $delta,
134 134
     'active' => $active,
135 135
     'override' => $override
136
-  );
136
+    );
137 137
 
138
-  if (is_array($name)) {
138
+    if (is_array($name)) {
139 139
     $options = $name;
140
-  }
141
-  else {
140
+    }
141
+    else {
142 142
     $options = array();
143 143
     if ($type == 'menu') {
144
-      jump_menu_get_menu_options($options, $name);
144
+        jump_menu_get_menu_options($options, $name);
145 145
     }
146 146
     elseif ($type == 'taxo') {
147
-      jump_menu_get_taxo_options($options, $name);
147
+        jump_menu_get_taxo_options($options, $name);
148
+    }
148 149
     }
149
-  }
150 150
 
151
-  // Give each form on the page a unique id so we can handle multiple
152
-  // jump forms...
153
-  static $num_jump_forms = 0;
154
-  $num_jump_forms++;
151
+    // Give each form on the page a unique id so we can handle multiple
152
+    // jump forms...
153
+    static $num_jump_forms = 0;
154
+    $num_jump_forms++;
155 155
 
156
-  return drupal_get_form('jump_quickly_form_' . $num_jump_forms, $options, $menu_state);
156
+    return drupal_get_form('jump_quickly_form_' . $num_jump_forms, $options, $menu_state);
157 157
 }
158 158
 
159 159
 /**
@@ -165,43 +165,43 @@  discard block
 block discarded – undo
165 165
  * @return array
166 166
  */
167 167
 function jump_quickly_form(&$form_state, $options, $menu_state) {
168
-  $default = '';
169
-  if ($menu_state['active'] === 1) {
168
+    $default = '';
169
+    if ($menu_state['active'] === 1) {
170 170
     if (isset($options[$_GET['q']])) {
171
-      $default = $_GET['q'];
171
+        $default = $_GET['q'];
172
+    }
172 173
     }
173
-  }
174
-  if ($menu_state['override']) {
174
+    if ($menu_state['override']) {
175 175
     $default = $menu_state['override'];
176
-  }
176
+    }
177 177
 
178
-  $form = array();
179
-  $form['#submit'][] = 'jump_quickly_form_submit';
180
-  $form['#theme'] = 'jump_quickly_form';
181
-  $form['#attributes']['class'] = 'jump-quickly';
182
-  $form['jump_goto'] = array(
178
+    $form = array();
179
+    $form['#submit'][] = 'jump_quickly_form_submit';
180
+    $form['#theme'] = 'jump_quickly_form';
181
+    $form['#attributes']['class'] = 'jump-quickly';
182
+    $form['jump_goto'] = array(
183 183
     '#type' => 'select',
184 184
     '#default_value' => $default,
185 185
     '#options' => $options
186
-  );
187
-  $form['submit'] = array(
186
+    );
187
+    $form['submit'] = array(
188 188
     '#type' => 'submit',
189 189
     '#value' => t('Go')
190
-  );
191
-  if (variable_get('jump_use_js_' . $menu_state['delta'], 0) === 1) {
190
+    );
191
+    if (variable_get('jump_use_js_' . $menu_state['delta'], 0) === 1) {
192 192
     // Give each menu a unique name.
193 193
     $form['#attributes']['name'] = 'jumpquickly' . $menu_state['delta'];
194 194
     $form['#attributes']['class'] .= ' js-enabled';
195 195
 //    unset($form['submit']);
196 196
     if (variable_get('jump_add_select_' . $menu_state['delta'], 0) === 1) {
197
-      $form['jump_goto']['#attributes']['class'] = 'first-no-jump';
198
-      // Add the extra empty select option to the top of the array.
199
-      $form['jump_goto']['#options'] = array('' => variable_get('jump_add_select_text_' . $menu_state['delta'], t('Select Option'))) + $options;
200
-      $form['jump_goto']['#default_value'] = (array_key_exists($default, $options)) ? $default : '';
197
+        $form['jump_goto']['#attributes']['class'] = 'first-no-jump';
198
+        // Add the extra empty select option to the top of the array.
199
+        $form['jump_goto']['#options'] = array('' => variable_get('jump_add_select_text_' . $menu_state['delta'], t('Select Option'))) + $options;
200
+        $form['jump_goto']['#default_value'] = (array_key_exists($default, $options)) ? $default : '';
201
+    }
201 202
     }
202
-  }
203 203
 
204
-  return $form;
204
+    return $form;
205 205
 }
206 206
 
207 207
 /**
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
  * @param array $form_state
212 212
  */
213 213
 function jump_quickly_form_submit($form, &$form_state) {
214
-  if (!empty($form_state['values']['jump_goto'])) {
214
+    if (!empty($form_state['values']['jump_goto'])) {
215 215
     $fragment = explode('#', $form_state['values']['jump_goto']);
216 216
     if (isset($fragment[1])) {
217
-      drupal_goto($fragment[0], NULL, $fragment[1]);
217
+        drupal_goto($fragment[0], NULL, $fragment[1]);
218 218
     }
219 219
     else {
220
-      drupal_goto($form_state['values']['jump_goto']);
220
+        drupal_goto($form_state['values']['jump_goto']);
221
+    }
221 222
     }
222
-  }
223 223
 }
224 224
 
225 225
 /**
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
  * @return string
230 230
  */
231 231
 function theme_jump_quickly_form($form) {
232
-  $output = '<div class="container-inline">';
233
-  $output .= drupal_render($form['jump_goto']);
234
-  $output .= drupal_render($form['submit']);
235
-  $output .= '</div>';
236
-  $output .= drupal_render($form);
237
-  return $output;
232
+    $output = '<div class="container-inline">';
233
+    $output .= drupal_render($form['jump_goto']);
234
+    $output .= drupal_render($form['submit']);
235
+    $output .= '</div>';
236
+    $output .= drupal_render($form);
237
+    return $output;
238 238
 }
239 239
 
240 240
 /**
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
  * @param string $name
245 245
  */
246 246
 function jump_menu_get_menu_options(&$options, $name) {
247
-  $tree = menu_tree_page_data($name);
248
-  $front = variable_get('site_frontpage', 'node');
249
-  foreach ($tree as $data) {
247
+    $tree = menu_tree_page_data($name);
248
+    $front = variable_get('site_frontpage', 'node');
249
+    foreach ($tree as $data) {
250 250
     if (!$data['link']['hidden']) {
251
-      $href = ($data['link']['href'] == '<front>') ? $front : $data['link']['href'];
252
-      $href = (isset($data['link']['options']['fragment'])) ? $href . '#' . $data['link']['options']['fragment'] : $href;
253
-      $options[$href] = $data['link']['title'];
251
+        $href = ($data['link']['href'] == '<front>') ? $front : $data['link']['href'];
252
+        $href = (isset($data['link']['options']['fragment'])) ? $href . '#' . $data['link']['options']['fragment'] : $href;
253
+        $options[$href] = $data['link']['title'];
254
+    }
254 255
     }
255
-  }
256 256
 }
257 257
 
258 258
 /**
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
  * @param integer $vid
263 263
  */
264 264
 function jump_menu_get_taxo_options(&$options, $vid) {
265
-  $tree = taxonomy_get_tree($vid);
266
-  foreach ($tree as $term) {
265
+    $tree = taxonomy_get_tree($vid);
266
+    foreach ($tree as $term) {
267 267
     $options[taxonomy_term_path($term)] = $term->name;
268
-  }
268
+    }
269 269
 }
270 270
 
271 271
 /**
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
  * @return array
277 277
  */
278 278
 function jump_forms($form_id) {
279
-  // Ensure we map a callback for our form and not something else
280
-  $forms = array();
281
-  if (strpos($form_id, 'jump_quickly_form') === 0) {
279
+    // Ensure we map a callback for our form and not something else
280
+    $forms = array();
281
+    if (strpos($form_id, 'jump_quickly_form') === 0) {
282 282
     // Let the forms API know where to get the form data corresponding
283 283
     // to this form id.
284 284
     $forms[$form_id] = array('callback' => 'jump_quickly_form');
285
-  }
286
-  return $forms;
285
+    }
286
+    return $forms;
287 287
 }
288 288
 
289 289
 /**
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
  * @return array
293 293
  */
294 294
 function jump_theme() {
295
-  return array(
295
+    return array(
296 296
     'jump_quickly_form' => array(
297
-      'arguments' => array('form')
297
+        'arguments' => array('form')
298 298
     )
299
-  );
299
+    );
300 300
 }
301 301
 
302 302
 /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
  * @param string $form_id
309 309
  */
310 310
 function jump_form_alter(&$form, $form_state, $form_id) {
311
-  switch ($form_id) {
311
+    switch ($form_id) {
312 312
     case 'block_admin_configure':
313 313
       if ($form['module']['#value'] === 'jump' && function_exists('ahah_helper_register')) {
314 314
         $delta = $form['delta']['#value'];
@@ -317,45 +317,45 @@  discard block
 block discarded – undo
317 317
         $default_jump_add_select = (!isset($form_state['storage']['jump_add_select_' . $delta])) ? variable_get('jump_add_select_' . $delta, 0) : $form_state['storage']['jump_add_select_' . $delta];
318 318
 
319 319
         $form['block_settings']['jump_wrapper'] = array(
320
-          '#prefix' => '<div id="jump-wrapper">',
321
-          '#suffix' => '</div>',
322
-          '#type' => 'markup'
320
+            '#prefix' => '<div id="jump-wrapper">',
321
+            '#suffix' => '</div>',
322
+            '#type' => 'markup'
323 323
         );
324 324
         $form['block_settings']['jump_wrapper']['jump_use_js_' . $delta] = array(
325
-          '#type' => 'checkbox',
326
-          '#title' => t('Hide the submit button and use Javascript to automatically jump to the selected menu item'),
327
-          '#default_value' => $default_jump_use_js,
328
-          '#disabled' => ($default_jump_add_select === 1) ? TRUE : FALSE,
329
-          '#ahah' => array(
325
+            '#type' => 'checkbox',
326
+            '#title' => t('Hide the submit button and use Javascript to automatically jump to the selected menu item'),
327
+            '#default_value' => $default_jump_use_js,
328
+            '#disabled' => ($default_jump_add_select === 1) ? TRUE : FALSE,
329
+            '#ahah' => array(
330 330
             'event' => 'change',
331 331
             'path' => ahah_helper_path(array('block_settings', 'jump_wrapper')),
332 332
             'wrapper' => 'jump-wrapper',
333
-          ),
333
+            ),
334 334
         );
335 335
         if ($default_jump_use_js === 1) {
336
-          $form['block_settings']['jump_wrapper']['jump_add_select_' . $delta] = array(
336
+            $form['block_settings']['jump_wrapper']['jump_add_select_' . $delta] = array(
337 337
             '#type' => 'checkbox',
338 338
             '#title' => t('Add an empty select option into the list of options'),
339 339
             '#default_value' => $default_jump_add_select,
340 340
             '#weight' => 1,
341 341
             '#ahah' => array(
342
-              'event' => 'change',
343
-              'path' => ahah_helper_path(array('block_settings', 'jump_wrapper')),
344
-              'wrapper' => 'jump-wrapper',
342
+                'event' => 'change',
343
+                'path' => ahah_helper_path(array('block_settings', 'jump_wrapper')),
344
+                'wrapper' => 'jump-wrapper',
345 345
             ),
346
-          );
347
-          if ($default_jump_add_select === 1) {
346
+            );
347
+            if ($default_jump_add_select === 1) {
348 348
             $form['block_settings']['jump_wrapper']['jump_add_select_text_' . $delta] = array(
349
-              '#type' => 'textfield',
350
-              '#title' => t('Text to use for the empty select option'),
351
-              '#default_value' => variable_get('jump_add_select_text_' . $delta, t('Select Option')),
352
-              '#weight' => 2
349
+                '#type' => 'textfield',
350
+                '#title' => t('Text to use for the empty select option'),
351
+                '#default_value' => variable_get('jump_add_select_text_' . $delta, t('Select Option')),
352
+                '#weight' => 2
353 353
             );
354
-          }
354
+            }
355 355
         }
356
-      }
357
-      break;
358
-  }
356
+        }
357
+        break;
358
+    }
359 359
 }
360 360
 
361 361
 /**
@@ -365,16 +365,16 @@  discard block
 block discarded – undo
365 365
  * @return integer
366 366
  */
367 367
 function jump_get_active_setting($delta) {
368
-  $active_site_default = variable_get('jump_activepageinmenu', 1);
369
-  $active = variable_get('jump_activepageinmenu_' . $delta, $active_site_default);
370
-  return $active;
368
+    $active_site_default = variable_get('jump_activepageinmenu', 1);
369
+    $active = variable_get('jump_activepageinmenu_' . $delta, $active_site_default);
370
+    return $active;
371 371
 }
372 372
 
373 373
 /**
374 374
  * Implementation of hook_views_api().
375 375
  */
376 376
 function jump_views_api() {
377
-  return array(
377
+    return array(
378 378
     'api' => 2,
379
-  );
379
+    );
380 380
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -94,8 +94,7 @@  discard block
 block discarded – undo
94 94
         // Use the menu label as the default block subject
95 95
         $menus = menu_get_menus();
96 96
         $subject = $menus[$jumpmenu_name];
97
-      }
98
-      else if ($jumpmenu_type == 'taxo') {
97
+      } else if ($jumpmenu_type == 'taxo') {
99 98
         $form = jump_quickly($jumpmenu_name, 'taxo', $active);
100 99
 
101 100
         // Use the vocabulary name as the default block subject
@@ -137,13 +136,11 @@  discard block
 block discarded – undo
137 136
 
138 137
   if (is_array($name)) {
139 138
     $options = $name;
140
-  }
141
-  else {
139
+  } else {
142 140
     $options = array();
143 141
     if ($type == 'menu') {
144 142
       jump_menu_get_menu_options($options, $name);
145
-    }
146
-    elseif ($type == 'taxo') {
143
+    } elseif ($type == 'taxo') {
147 144
       jump_menu_get_taxo_options($options, $name);
148 145
     }
149 146
   }
@@ -215,8 +212,7 @@  discard block
 block discarded – undo
215 212
     $fragment = explode('#', $form_state['values']['jump_goto']);
216 213
     if (isset($fragment[1])) {
217 214
       drupal_goto($fragment[0], NULL, $fragment[1]);
218
-    }
219
-    else {
215
+    } else {
220 216
       drupal_goto($form_state['values']['jump_goto']);
221 217
     }
222 218
   }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/jump/jump.views.inc 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  * Implementation of hook_views_plugins().
10 10
  */
11 11
 function jump_views_plugins() {
12
-  return array(
12
+    return array(
13 13
     'style' => array(
14
-      'jump_views' => array(
14
+        'jump_views' => array(
15 15
         'title' => t('Jump menu'),
16 16
         'theme' => 'jump_views_plugin_style',
17 17
         'help' => t('Displays items as a select list jump menu.'),
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         'uses fields' => TRUE,
21 21
         'uses options' => TRUE,
22 22
         'type' => 'normal',
23
-      ),
23
+        ),
24 24
     ),
25
-  );
25
+    );
26 26
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/jump/jump.views_default.inc 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@  discard block
 block discarded – undo
9 9
  * Implementation of hook_views_default_views().
10 10
  */
11 11
 function jump_views_default_views() {
12
-  $view = new view;
13
-  $view->name = 'recent_nodes_jump_menu';
14
-  $view->description = 'Recent nodes in a jump menu.';
15
-  $view->tag = '';
16
-  $view->view_php = '';
17
-  $view->base_table = 'node';
18
-  $view->is_cacheable = FALSE;
19
-  $view->api_version = 2;
20
-  $view->disabled = TRUE;
21
-  $handler = $view->new_display('default', 'Defaults', 'default');
22
-  $handler->override_option('fields', array(
12
+    $view = new view;
13
+    $view->name = 'recent_nodes_jump_menu';
14
+    $view->description = 'Recent nodes in a jump menu.';
15
+    $view->tag = '';
16
+    $view->view_php = '';
17
+    $view->base_table = 'node';
18
+    $view->is_cacheable = FALSE;
19
+    $view->api_version = 2;
20
+    $view->disabled = TRUE;
21
+    $handler = $view->new_display('default', 'Defaults', 'default');
22
+    $handler->override_option('fields', array(
23 23
     'nid' => array(
24
-      'label' => 'Nid',
25
-      'alter' => array(
24
+        'label' => 'Nid',
25
+        'alter' => array(
26 26
         'alter_text' => 1,
27 27
         'text' => 'node/[nid]',
28 28
         'make_link' => 0,
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
         'ellipsis' => 1,
39 39
         'strip_tags' => 0,
40 40
         'html' => 0,
41
-      ),
42
-      'link_to_node' => 0,
43
-      'exclude' => 1,
44
-      'id' => 'nid',
45
-      'table' => 'node',
46
-      'field' => 'nid',
47
-      'relationship' => 'none',
41
+        ),
42
+        'link_to_node' => 0,
43
+        'exclude' => 1,
44
+        'id' => 'nid',
45
+        'table' => 'node',
46
+        'field' => 'nid',
47
+        'relationship' => 'none',
48 48
     ),
49 49
     'title' => array(
50
-      'label' => '',
51
-      'alter' => array(
50
+        'label' => '',
51
+        'alter' => array(
52 52
         'alter_text' => 0,
53 53
         'text' => '',
54 54
         'make_link' => 0,
@@ -64,60 +64,60 @@  discard block
 block discarded – undo
64 64
         'ellipsis' => 1,
65 65
         'strip_tags' => 0,
66 66
         'html' => 0,
67
-      ),
68
-      'link_to_node' => 0,
69
-      'exclude' => 0,
70
-      'id' => 'title',
71
-      'table' => 'node',
72
-      'field' => 'title',
73
-      'relationship' => 'none',
67
+        ),
68
+        'link_to_node' => 0,
69
+        'exclude' => 0,
70
+        'id' => 'title',
71
+        'table' => 'node',
72
+        'field' => 'title',
73
+        'relationship' => 'none',
74 74
     ),
75
-  ));
76
-  $handler->override_option('sorts', array(
75
+    ));
76
+    $handler->override_option('sorts', array(
77 77
     'changed' => array(
78
-      'order' => 'DESC',
79
-      'granularity' => 'second',
80
-      'id' => 'changed',
81
-      'table' => 'node',
82
-      'field' => 'changed',
83
-      'relationship' => 'none',
78
+        'order' => 'DESC',
79
+        'granularity' => 'second',
80
+        'id' => 'changed',
81
+        'table' => 'node',
82
+        'field' => 'changed',
83
+        'relationship' => 'none',
84 84
     ),
85
-  ));
86
-  $handler->override_option('filters', array(
85
+    ));
86
+    $handler->override_option('filters', array(
87 87
     'status_extra' => array(
88
-      'operator' => '=',
89
-      'value' => '',
90
-      'group' => '0',
91
-      'exposed' => FALSE,
92
-      'expose' => array(
88
+        'operator' => '=',
89
+        'value' => '',
90
+        'group' => '0',
91
+        'exposed' => FALSE,
92
+        'expose' => array(
93 93
         'operator' => FALSE,
94 94
         'label' => '',
95
-      ),
96
-      'id' => 'status_extra',
97
-      'table' => 'node',
98
-      'field' => 'status_extra',
99
-      'relationship' => 'none',
95
+        ),
96
+        'id' => 'status_extra',
97
+        'table' => 'node',
98
+        'field' => 'status_extra',
99
+        'relationship' => 'none',
100 100
     ),
101
-  ));
102
-  $handler->override_option('access', array(
101
+    ));
102
+    $handler->override_option('access', array(
103 103
     'type' => 'none',
104
-  ));
105
-  $handler->override_option('cache', array(
104
+    ));
105
+    $handler->override_option('cache', array(
106 106
     'type' => 'none',
107
-  ));
108
-  $handler->override_option('style_plugin', 'jump_views');
109
-  $handler->override_option('style_options', array(
107
+    ));
108
+    $handler->override_option('style_plugin', 'jump_views');
109
+    $handler->override_option('style_options', array(
110 110
     'grouping' => '',
111 111
     'keys' => array(
112
-      'nid' => 'nid',
113
-      'title' => 0,
112
+        'nid' => 'nid',
113
+        'title' => 0,
114 114
     ),
115 115
     'first_item' => 'Recent nodes',
116
-  ));
117
-  $handler = $view->new_display('block', 'Block', 'block_1');
118
-  $handler->override_option('block_description', '');
119
-  $handler->override_option('block_caching', -1);
116
+    ));
117
+    $handler = $view->new_display('block', 'Block', 'block_1');
118
+    $handler->override_option('block_description', '');
119
+    $handler->override_option('block_caching', -1);
120 120
 
121
-  $views[$view->name] = $view;
122
-  return $views;
121
+    $views[$view->name] = $view;
122
+    return $views;
123 123
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/jump/jump_views_plugin_style.inc 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
7 7
 
8 8
 class jump_views_plugin_style extends views_plugin_style {
9 9
 
10
-  function render() {
10
+    function render() {
11 11
     // Build an array of field / field_alias pairs.
12 12
     $this->field_map = array();
13 13
     foreach ($this->view->field as $field_name => $object) {
14
-      $this-> field_map[$object->field_alias] = $field_name;
14
+        $this-> field_map[$object->field_alias] = $field_name;
15 15
     }
16 16
 
17 17
     // $keys contains the fields used to build up the path.
@@ -21,116 +21,116 @@  discard block
 block discarded – undo
21 21
     // callback.
22 22
     $select = array();
23 23
     if (!empty($this->options['first_item'])) {
24
-      $select[0] = $this->options['first_item'];
24
+        $select[0] = $this->options['first_item'];
25 25
     }
26 26
 
27 27
     foreach ($this->view->result as $row) {
28
-      $select_key = array();
29
-      // For each field in the row, we first check if it's to be used
30
-      // as part of the select key, then run views token replacement
31
-      // on it. This allows for paths like node/n/revisions/6 to be built
32
-      // easily.
33
-      foreach ($row as $field => $value) {
28
+        $select_key = array();
29
+        // For each field in the row, we first check if it's to be used
30
+        // as part of the select key, then run views token replacement
31
+        // on it. This allows for paths like node/n/revisions/6 to be built
32
+        // easily.
33
+        foreach ($row as $field => $value) {
34 34
         if (in_array($this->field_map[$field], $keys)) {
35
-          $field_object = $this->view->field[$this->field_map[$field]];
36
-          // Re-implementing some of the code from views_handler_field.inc
37
-          // since we need to operate on $result, and to avoid using
38
-          // a row style or templates.
39
-          if (!empty($field_object->options['alter']['alter_text']) && !empty($field_object->options['alter']['text'])) {
35
+            $field_object = $this->view->field[$this->field_map[$field]];
36
+            // Re-implementing some of the code from views_handler_field.inc
37
+            // since we need to operate on $result, and to avoid using
38
+            // a row style or templates.
39
+            if (!empty($field_object->options['alter']['alter_text']) && !empty($field_object->options['alter']['text'])) {
40 40
             $tokens = $this->get_render_tokens($this->field_map[$field], $row);
41 41
             $value = $field_object->render_altered($tokens);
42
-          }
43
-          $select_key[] = $value;
42
+            }
43
+            $select_key[] = $value;
44 44
         }
45
-      }
46
-      // For the value of the select, just use the output of the row, but strip
47
-      // all markup first.
48
-      $select_key = implode('/', $select_key);
49
-      $raw_select_value = $this->row_plugin->render($row);
50
-      $select_value = trim(html_entity_decode(strip_tags($raw_select_value), ENT_QUOTES));
51
-      $select[$select_key] = $select_value;
45
+        }
46
+        // For the value of the select, just use the output of the row, but strip
47
+        // all markup first.
48
+        $select_key = implode('/', $select_key);
49
+        $raw_select_value = $this->row_plugin->render($row);
50
+        $select_value = trim(html_entity_decode(strip_tags($raw_select_value), ENT_QUOTES));
51
+        $select[$select_key] = $select_value;
52 52
     }
53 53
 
54 54
     return jump_quickly($select);
55
-  }
55
+    }
56 56
 
57
-  function option_definition() {
57
+    function option_definition() {
58 58
     $options = parent::option_definition();
59 59
     $options['keys'] = array('default' => array());
60 60
     $options['first_item'] = array('default' => '');
61 61
     return $options;
62
-  }
62
+    }
63 63
 
64
-  function options_form(&$form, $form_state) {
64
+    function options_form(&$form, $form_state) {
65 65
     parent::options_form($form, $form_state);
66 66
     $handlers = $this->display->handler->get_handlers('field');
67 67
     if (empty($handlers)) {
68
-      $form['error_markup'] = array(
68
+        $form['error_markup'] = array(
69 69
         '#value' => t('You need at least one field before you can configure your jump menu settings'),
70 70
         '#prefix' => '<div class="error form-item description">',
71 71
         '#suffix' => '</div>',
72
-      );
73
-      return;
72
+        );
73
+        return;
74 74
     }
75 75
     // Create an array of fields from the data we know.
76 76
     foreach ($handlers as $field => $handler) {
77
-      if ($label = $handler->label()) {
77
+        if ($label = $handler->label()) {
78 78
         $field_names[$field] = $label;
79
-      }
80
-      else {
79
+        }
80
+        else {
81 81
         $field_names[$field] = $handler->ui_name();
82
-      }
82
+        }
83 83
     }
84 84
     $form['keys'] = array(
85
-      '#type' => 'checkboxes',
86
-      '#title' => t('Select keys'),
87
-      '#default_value' => $this->options['keys'],
88
-      '#description' => t("These fields will be used to build the path for each row, used as the 'key' in the select options, and will be automatically separated by '/'"),
89
-      '#options' => $field_names,
85
+        '#type' => 'checkboxes',
86
+        '#title' => t('Select keys'),
87
+        '#default_value' => $this->options['keys'],
88
+        '#description' => t("These fields will be used to build the path for each row, used as the 'key' in the select options, and will be automatically separated by '/'"),
89
+        '#options' => $field_names,
90 90
     );
91 91
     $form['first_item'] = array(
92
-      '#type' => 'textfield',
93
-      '#title' => 'First item',
94
-      '#default_value' => $this->options['first_item'],
95
-      '#description' => t('This will be used as the first item in your select list, for example <em>Choose one</em>'),
92
+        '#type' => 'textfield',
93
+        '#title' => 'First item',
94
+        '#default_value' => $this->options['first_item'],
95
+        '#description' => t('This will be used as the first item in your select list, for example <em>Choose one</em>'),
96 96
     );
97
-  }
97
+    }
98 98
 
99
-  /**
100
-   * Get the 'render' tokens to use for advanced rendering.
101
-   *
102
-   * This runs through all of the fields and arguments that
103
-   * are available and gets their values. This will then be
104
-   * used in one giant str_replace().
105
-   * Slightly modified from views_handler_field.inc
106
-   */
107
-  function get_render_tokens($field_name, $row) {
99
+    /**
100
+     * Get the 'render' tokens to use for advanced rendering.
101
+     *
102
+     * This runs through all of the fields and arguments that
103
+     * are available and gets their values. This will then be
104
+     * used in one giant str_replace().
105
+     * Slightly modified from views_handler_field.inc
106
+     */
107
+    function get_render_tokens($field_name, $row) {
108 108
     $tokens = array();
109 109
     if (!empty($this->view->build_info['substitutions'])) {
110
-      $tokens = $this->view->build_info['substitutions'];
110
+        $tokens = $this->view->build_info['substitutions'];
111 111
     }
112 112
 
113 113
     $count = 0;
114 114
     foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
115
-      $token = '%'. ++$count;
116
-      if (!isset($tokens[$token])) {
115
+        $token = '%'. ++$count;
116
+        if (!isset($tokens[$token])) {
117 117
         $tokens[$token] = '';
118
-      }
118
+        }
119 119
     }
120 120
 
121 121
     // Now add replacements for our fields.
122 122
     $options = array();
123 123
     $map = array_flip($this->field_map);
124 124
     foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
125
-      $map = array_flip($this->field_map);
126
-      if (isset($row->$map[$field])) {
125
+        $map = array_flip($this->field_map);
126
+        if (isset($row->$map[$field])) {
127 127
         $tokens["[$field]"] = $row->$map[$field];
128
-      }
129
-      else {
128
+        }
129
+        else {
130 130
         $tokens["[$field]"] = '';
131
-      }
131
+        }
132 132
     }
133 133
 
134 134
     return $tokens;
135
-  }
135
+    }
136 136
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
76 76
     foreach ($handlers as $field => $handler) {
77 77
       if ($label = $handler->label()) {
78 78
         $field_names[$field] = $label;
79
-      }
80
-      else {
79
+      } else {
81 80
         $field_names[$field] = $handler->ui_name();
82 81
       }
83 82
     }
@@ -125,8 +124,7 @@  discard block
 block discarded – undo
125 124
       $map = array_flip($this->field_map);
126 125
       if (isset($row->$map[$field])) {
127 126
         $tokens["[$field]"] = $row->$map[$field];
128
-      }
129
-      else {
127
+      } else {
130 128
         $tokens["[$field]"] = '';
131 129
       }
132 130
     }
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/forum_access/forum_access.admin.inc 2 patches
Indentation   +470 added lines, -470 removed lines patch added patch discarded remove patch
@@ -12,33 +12,33 @@  discard block
 block discarded – undo
12 12
  * Rewrite the forum administration page with our new access rules.
13 13
  */
14 14
 function _forum_access_forum_form(&$form, &$form_state, $is_container) {
15
-  $tid = (isset($form['tid']['#value']) ? $form['tid']['#value'] : NULL);
16
-  if (isset($tid) && !forum_access_access($tid, 'view', NULL, FALSE)) {
15
+    $tid = (isset($form['tid']['#value']) ? $form['tid']['#value'] : NULL);
16
+    if (isset($tid) && !forum_access_access($tid, 'view', NULL, FALSE)) {
17 17
     drupal_access_denied();  // Deny access if the user doesn't have View access.
18 18
     module_invoke_all('exit');
19 19
     exit;
20
-  }
20
+    }
21 21
 
22
-  $roles = user_roles();
23
-  if (isset($tid)) {  // edit
22
+    $roles = user_roles();
23
+    if (isset($tid)) {  // edit
24 24
     $template_tid = variable_get('forum_access_default_template_tid', 0);
25 25
     $settings = _forum_access_get_settings($tid);
26
-  }
27
-  else {  // create
26
+    }
27
+    else {  // create
28 28
     $template_tid = variable_get('forum_access_new_template_tid', NULL);
29 29
     $settings = _forum_access_get_settings($template_tid);
30
-  }
31
-  $fa_priority = $settings['priority'];
30
+    }
31
+    $fa_priority = $settings['priority'];
32 32
 
33
-  $form['forum_access'] = array(
33
+    $form['forum_access'] = array(
34 34
     '#type' => 'fieldset',
35 35
     '#title' => t('Access control'),
36 36
     '#collapsible' => TRUE,
37 37
     '#tree' => TRUE,
38
-  );
38
+    );
39 39
 
40
-  $tr = 't';
41
-  $variables = array(
40
+    $tr = 't';
41
+    $variables = array(
42 42
     '!access_content'                 => '<em>'. l($tr('access content'), 'admin/user/permissions', array('fragment' => 'module-node', 'html' => TRUE)) .'</em>',
43 43
     '!access_comments'                => '<em>'. l($tr('access comments'), 'admin/user/permissions', array('fragment' => 'module-comment', 'html' => TRUE)) .'</em>',
44 44
     '!create_forum_topics'            => '<em>'. l($tr('create forum topics'), 'admin/user/permissions', array('fragment' => 'module-forum', 'html' => TRUE)) .'</em>',
@@ -51,368 +51,368 @@  discard block
 block discarded – undo
51 51
     '!administer_comments'            => '<em>'. l($tr('administer comments'), 'admin/user/permissions', array('fragment' => 'module-comment', 'html' => TRUE)) .'</em>',
52 52
     '!administer_forums'              => '<em>'. l($tr('administer forums'), 'admin/user/permissions', array('fragment' => 'module-forum', 'html' => TRUE)) .'</em>',
53 53
     '!administer_nodes'               => '<em>'. l($tr('administer nodes'), 'admin/user/permissions', array('fragment' => 'module-node', 'html' => TRUE)) .'</em>',
54
-  );
55
-  if (!$is_container) {
54
+    );
55
+    if (!$is_container) {
56 56
     $form['forum_access']['permissions'] = array(
57
-      '#type' => 'fieldset',
58
-      '#title' => $tr('Permissions information'),
59
-      '#collapsible' => TRUE,
60
-      '#collapsed' => TRUE,
57
+        '#type' => 'fieldset',
58
+        '#title' => $tr('Permissions information'),
59
+        '#collapsible' => TRUE,
60
+        '#collapsed' => TRUE,
61 61
     );
62 62
     $form['forum_access']['permissions'][] = array(
63
-      '#type' => 'markup',
64
-      '#value' => '<div>'. t('Note that users need') .'<ul style="margin-top: 0"><li>'.
65
-                           t('the !access_content and !access_comments permissions <strong>AND <em>View</em></strong> to be able to see this forum and its content at all,', $variables) .'</li><li>'.
66
-                           t('the !create_forum_topics (and similar) permissions <strong>AND <em>Post</em></strong> to be able to create forum content, and', $variables) .'</li><li>'.
67
-                           t('the !post_comments and (probably) !post_comments_without_approval permission <!TAG>AND <em>Comment</em></!TAG> to be able to post comments/replies;', $variables + array('!TAG' => (variable_get('forum_access_D5_legacy_mode', FALSE) ? 'del title="'. t('Drupal 5 legacy mode') .'"' : 'strong'))) .'</li><li>'.
68
-                           t('the !edit_own_forum_topics or !edit_any_forum_topics (and similar) permissions <strong>AND (<em>Edit</em> AND <em>Comment</em></strong>) can be added if desired, <strong>plus</strong>', $variables) .'</li><li>'.
69
-                           t('the !delete_own_forum_topics or !delete_any_forum_topics (and similar) permissions (<strong>OR <em>Delete</em></strong>) if desired;', $variables) .'</li><li>'.
70
-                           t('the !administer_comments (global!) permission <strong>OR <em>Edit</em>/<em>Delete</em></strong> to be able to edit/delete comments;', $variables) .'</li><li>'.
71
-                           t('the !administer_forums permission <strong>AND <em>View</em></strong> to be able to administer forums (and change access!).', $variables) .'</li></ul>'.
72
-                           t('Furthermore note that content which is not published is treated in a different way by Drupal: it can be viewed only by its author or by users with the !administer_nodes permission. Unpublished comments and replies are accessible to users with <strong><em>Edit</em> OR <em>Delete</em></strong>, <strong>OR</strong> with the !administer_comments permission, but they are never counted on the forum page.', $variables) .'</div>',
73
-    );
74
-  }
75
-
76
-  // Load a template:
77
-  $vid = _forum_access_get_vid();
78
-  $form['forum_access']['template'] = array(
79
-      '#type' => 'fieldset',
80
-      '#title' => $tr('Template'),
81
-      '#collapsible' => TRUE,
82
-      '#collapsed' => empty($template_tid),
83
-  );
84
-  $form['forum_access']['template']['taxonomy'][$vid] = taxonomy_form($vid, array($template_tid), '');
85
-  $form['forum_access']['template']['taxonomy'][$vid]['#description'] = t("Select a forum and click !Load to retrieve that forum's settings as a starting point for this forum or container.", array('!Load' => '['. t('Load') .']'));
86
-  $form['forum_access']['template']['load_button'] = array(
63
+        '#type' => 'markup',
64
+        '#value' => '<div>'. t('Note that users need') .'<ul style="margin-top: 0"><li>'.
65
+                            t('the !access_content and !access_comments permissions <strong>AND <em>View</em></strong> to be able to see this forum and its content at all,', $variables) .'</li><li>'.
66
+                            t('the !create_forum_topics (and similar) permissions <strong>AND <em>Post</em></strong> to be able to create forum content, and', $variables) .'</li><li>'.
67
+                            t('the !post_comments and (probably) !post_comments_without_approval permission <!TAG>AND <em>Comment</em></!TAG> to be able to post comments/replies;', $variables + array('!TAG' => (variable_get('forum_access_D5_legacy_mode', FALSE) ? 'del title="'. t('Drupal 5 legacy mode') .'"' : 'strong'))) .'</li><li>'.
68
+                            t('the !edit_own_forum_topics or !edit_any_forum_topics (and similar) permissions <strong>AND (<em>Edit</em> AND <em>Comment</em></strong>) can be added if desired, <strong>plus</strong>', $variables) .'</li><li>'.
69
+                            t('the !delete_own_forum_topics or !delete_any_forum_topics (and similar) permissions (<strong>OR <em>Delete</em></strong>) if desired;', $variables) .'</li><li>'.
70
+                            t('the !administer_comments (global!) permission <strong>OR <em>Edit</em>/<em>Delete</em></strong> to be able to edit/delete comments;', $variables) .'</li><li>'.
71
+                            t('the !administer_forums permission <strong>AND <em>View</em></strong> to be able to administer forums (and change access!).', $variables) .'</li></ul>'.
72
+                            t('Furthermore note that content which is not published is treated in a different way by Drupal: it can be viewed only by its author or by users with the !administer_nodes permission. Unpublished comments and replies are accessible to users with <strong><em>Edit</em> OR <em>Delete</em></strong>, <strong>OR</strong> with the !administer_comments permission, but they are never counted on the forum page.', $variables) .'</div>',
73
+    );
74
+    }
75
+
76
+    // Load a template:
77
+    $vid = _forum_access_get_vid();
78
+    $form['forum_access']['template'] = array(
79
+        '#type' => 'fieldset',
80
+        '#title' => $tr('Template'),
81
+        '#collapsible' => TRUE,
82
+        '#collapsed' => empty($template_tid),
83
+    );
84
+    $form['forum_access']['template']['taxonomy'][$vid] = taxonomy_form($vid, array($template_tid), '');
85
+    $form['forum_access']['template']['taxonomy'][$vid]['#description'] = t("Select a forum and click !Load to retrieve that forum's settings as a starting point for this forum or container.", array('!Load' => '['. t('Load') .']'));
86
+    $form['forum_access']['template']['load_button'] = array(
87 87
     '#type' => 'button',
88 88
     '#name' => 'load_template',
89 89
     '#value' => t('Load'),
90 90
     '#submit' => FALSE,
91
-  );
92
-  $form['forum_access']['template']['template_tid'] = array(
91
+    );
92
+    $form['forum_access']['template']['template_tid'] = array(
93 93
     '#type' => 'value',
94 94
     '#value' => NULL,
95
-  );
96
-  $form['forum_access']['template']['select_by_default'] = array(
95
+    );
96
+    $form['forum_access']['template']['select_by_default'] = array(
97 97
     '#type' => 'checkbox',
98 98
     '#title' => t('Remember this selection.'),
99 99
     '#default_value' => FALSE,
100
-  );
101
-  $form['forum_access']['template']['load_for_new'] = array(
100
+    );
101
+    $form['forum_access']['template']['load_for_new'] = array(
102 102
     '#type' => 'checkbox',
103 103
     '#title' => t("Use the selected forum's settings as defaults for new forums and containers."),
104 104
     '#default_value' => FALSE,
105
-  );
106
-  $form['forum_access']['#after_build'][] = '_forum_access_forum_form_after_build';
105
+    );
106
+    $form['forum_access']['#after_build'][] = '_forum_access_forum_form_after_build';
107 107
 
108
-  // Column titles:
109
-  $form['forum_access']['headers']['view'] = array(
108
+    // Column titles:
109
+    $form['forum_access']['headers']['view'] = array(
110 110
     '#type' => 'item',
111 111
     '#prefix' => '<div class="forum-access-div">',
112 112
     '#title' => ($is_container ? t('View this container') : t('View this forum')),
113 113
     '#suffix' => '</div>',
114
-  );
115
-  $forum_vocabulary = taxonomy_vocabulary_load(_forum_access_get_vid());
116
-  $form['forum_access']['headers']['create'] = array(
114
+    );
115
+    $forum_vocabulary = taxonomy_vocabulary_load(_forum_access_get_vid());
116
+    $form['forum_access']['headers']['create'] = array(
117 117
     '#type' => 'item',
118 118
     '#prefix' => '<div class="forum-access-div" id="forum-access-div-container">',
119 119
     '#title' => t('See this container in the %Forums selection list', array('%Forums' => $forum_vocabulary->name)),
120 120
     '#suffix' => '</div>',
121
-  );
122
-  if (!$is_container) {
121
+    );
122
+    if (!$is_container) {
123 123
     $form['forum_access']['headers']['create'] = array(  // overwrite!
124
-      '#type' => 'item',
125
-      '#prefix' => '<div class="forum-access-div">',
126
-      '#title' => t('Post in this forum'),
127
-      '#suffix' => '</div>',
124
+        '#type' => 'item',
125
+        '#prefix' => '<div class="forum-access-div">',
126
+        '#title' => t('Post in this forum'),
127
+        '#suffix' => '</div>',
128 128
     );
129 129
     $form['forum_access']['headers']['comment_create'] = array(
130
-      '#type' => 'item',
131
-      '#prefix' => '<div class="forum-access-div">',
132
-      '#title' => t('Comment on posts'),
133
-      '#suffix' => '</div>',
130
+        '#type' => 'item',
131
+        '#prefix' => '<div class="forum-access-div">',
132
+        '#title' => t('Comment on posts'),
133
+        '#suffix' => '</div>',
134 134
     );
135 135
     $form['forum_access']['headers']['update'] = array(
136
-      '#type' => 'item',
137
-      '#prefix' => '<div class="forum-access-div">',
138
-      '#title' => t('Edit posts'),
139
-      '#suffix' => '</div>',
136
+        '#type' => 'item',
137
+        '#prefix' => '<div class="forum-access-div">',
138
+        '#title' => t('Edit posts'),
139
+        '#suffix' => '</div>',
140 140
     );
141 141
     $form['forum_access']['headers']['delete'] = array(
142
-      '#type' => 'item',
143
-      '#prefix' => '<div class="forum-access-div">',
144
-      '#title' => t('Delete posts'),
145
-      '#suffix' => '</div>',
146
-    );
147
-  }
148
-  $form['forum_access']['headers']['clearer'] = array(
149
-      '#value' => '<div class="forum-access-clearer"></div>',
150
-  );
142
+        '#type' => 'item',
143
+        '#prefix' => '<div class="forum-access-div">',
144
+        '#title' => t('Delete posts'),
145
+        '#suffix' => '</div>',
146
+    );
147
+    }
148
+    $form['forum_access']['headers']['clearer'] = array(
149
+        '#value' => '<div class="forum-access-clearer"></div>',
150
+    );
151 151
   
152
-  // Column content (checkboxes):
153
-  $form['forum_access']['view'] = array(
152
+    // Column content (checkboxes):
153
+    $form['forum_access']['view'] = array(
154 154
     '#type' => 'checkboxes',
155 155
     '#prefix' => '<div class="forum-access-div">',
156 156
     '#suffix' => '</div>',
157 157
     '#options' => $roles,
158 158
     '#default_value' => $settings['view'],
159 159
     '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
160
-  );
161
-  $form['forum_access']['create'] = array(
160
+    );
161
+    $form['forum_access']['create'] = array(
162 162
     '#type' => 'checkboxes',
163 163
     '#prefix' => '<div class="forum-access-div">',
164 164
     '#suffix' => '</div>',
165 165
     '#options' => $roles,
166 166
     '#default_value' => $settings['create'],
167 167
     '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
168
-  );
169
-  if (!$is_container) {
168
+    );
169
+    if (!$is_container) {
170 170
     $form['forum_access']['comment_create'] = array(
171
-      '#type' => 'checkboxes',
172
-      '#prefix' => '<div class="forum-access-div">',
173
-      '#suffix' => '</div>',
174
-      '#options' => $roles,
175
-      '#default_value' => $settings['comment_create'],
176
-      '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
171
+        '#type' => 'checkboxes',
172
+        '#prefix' => '<div class="forum-access-div">',
173
+        '#suffix' => '</div>',
174
+        '#options' => $roles,
175
+        '#default_value' => $settings['comment_create'],
176
+        '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
177 177
     );
178 178
     $form['forum_access']['update'] = array(
179
-      '#type' => 'checkboxes',
180
-      '#prefix' => '<div class="forum-access-div">',
181
-      '#suffix' => '</div>',
182
-      '#options' => $roles,
183
-      '#default_value' => $settings['update'],
184
-      '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
179
+        '#type' => 'checkboxes',
180
+        '#prefix' => '<div class="forum-access-div">',
181
+        '#suffix' => '</div>',
182
+        '#options' => $roles,
183
+        '#default_value' => $settings['update'],
184
+        '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
185 185
     );
186 186
     $form['forum_access']['delete'] = array(
187
-      '#type' => 'checkboxes',
188
-      '#prefix' => '<div class="forum-access-div">',
189
-      '#suffix' => '</div>',
190
-      '#options' => $roles,
191
-      '#default_value' => $settings['delete'],
192
-      '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
193
-    );
194
-  }
195
-  $form['forum_access']['clearer'] = array(
187
+        '#type' => 'checkboxes',
188
+        '#prefix' => '<div class="forum-access-div">',
189
+        '#suffix' => '</div>',
190
+        '#options' => $roles,
191
+        '#default_value' => $settings['delete'],
192
+        '#process' => array('expand_checkboxes', '_forum_access_forum_form_disable_checkboxes'),
193
+    );
194
+    }
195
+    $form['forum_access']['clearer'] = array(
196 196
     '#type' => 'item',
197 197
     '#prefix' => '<div class="forum-access-clearer">',
198 198
     '#suffix' => '</div>',
199 199
     '#description' => t('For explanations of special cases, hover your mouse over role names.'),
200
-  );
201
-  if ($is_container) {
200
+    );
201
+    if ($is_container) {
202 202
     $form['forum_access']['container_note'] = array(
203
-      '#type' => 'item',
204
-      '#description' => t('Users who can see any forum or container within this one should get the <strong><em>View</em></strong> grant. <br /> Users who can post to a forum within this container should get the <strong><em>See</em></strong> grant, so that this forum appears in the proper context in the selection list.', $variables),
203
+        '#type' => 'item',
204
+        '#description' => t('Users who can see any forum or container within this one should get the <strong><em>View</em></strong> grant. <br /> Users who can post to a forum within this container should get the <strong><em>See</em></strong> grant, so that this forum appears in the proper context in the selection list.', $variables),
205 205
     );
206
-  }
206
+    }
207 207
 
208
-  drupal_add_css(drupal_get_path('module', 'forum_access') .'/forum_access.css');
208
+    drupal_add_css(drupal_get_path('module', 'forum_access') .'/forum_access.css');
209 209
 
210
-  // Find our moderator ACL:
211
-  if (isset($tid)) {  // edit, not new
210
+    // Find our moderator ACL:
211
+    if (isset($tid)) {  // edit, not new
212 212
     $acl_id = acl_get_id_by_number('forum_access', $tid);
213 213
     if (!$acl_id) { // create one
214
-      $acl_id = acl_create_new_acl('forum_access', NULL, $tid);
215
-      // update every existing node in this forum to use this acl.
216
-      $result = db_query("SELECT nid FROM {term_node} WHERE tid = %d", $tid);
217
-      while ($node = db_fetch_object($result)) {
214
+        $acl_id = acl_create_new_acl('forum_access', NULL, $tid);
215
+        // update every existing node in this forum to use this acl.
216
+        $result = db_query("SELECT nid FROM {term_node} WHERE tid = %d", $tid);
217
+        while ($node = db_fetch_object($result)) {
218 218
         // all privs to this ACL.
219 219
         acl_node_add_acl($node->nid, $acl_id, 1, 1, 1);
220
-      }
220
+        }
221 221
     }
222 222
     $form['forum_access']['acl'] = acl_edit_form($acl_id, t('Moderators'));
223 223
     $form['forum_access']['acl'][] = array(
224
-      '#type' => 'markup',
225
-      '#value' => '<div>'. t('Moderators receive all grants above.') .'</div>',
226
-      '#weight' => -1,
224
+        '#type' => 'markup',
225
+        '#value' => '<div>'. t('Moderators receive all grants above.') .'</div>',
226
+        '#weight' => -1,
227 227
     );
228 228
     $form['forum_access']['acl']['note'] = array(
229
-      '#type' => 'markup',
230
-      '#value' => '<div>'. t('Note: Changes to moderators are not saved until you click [!Save] below.', array('!Save' => $tr('Save'))) .'</div>',
229
+        '#type' => 'markup',
230
+        '#value' => '<div>'. t('Note: Changes to moderators are not saved until you click [!Save] below.', array('!Save' => $tr('Save'))) .'</div>',
231 231
     );
232 232
     $form['forum_access']['acl']['#after_build'][] = '_forum_access_forum_form_after_build_acl0';
233 233
     $form['forum_access']['acl']['#after_build'] = array_reverse($form['forum_access']['acl']['#after_build']);
234 234
     $form['forum_access']['acl']['#after_build'][] = '_forum_access_forum_form_after_build_acl2';
235
-  }
235
+    }
236 236
 
237
-  foreach (module_implements('node_access_records') as $module) {
237
+    foreach (module_implements('node_access_records') as $module) {
238 238
     $na_modules[$module] = $module;
239
-  }
240
-  unset($na_modules['forum_access']);
241
-  unset($na_modules['acl']);
242
-  if (count($na_modules) && !$is_container) {
239
+    }
240
+    unset($na_modules['forum_access']);
241
+    unset($na_modules['acl']);
242
+    if (count($na_modules) && !$is_container) {
243 243
     $form['forum_access']['interference'] = array(
244
-      '#type' => 'fieldset',
245
-      '#title' => t('Module interference'),
246
-      '#collapsible' => TRUE,
244
+        '#type' => 'fieldset',
245
+        '#title' => t('Module interference'),
246
+        '#collapsible' => TRUE,
247 247
     );
248 248
     $variables = array(
249
-      '%content_type' => node_get_types('name', 'forum'),
250
-      '!Forum_Access' => 'Forum Access',
251
-      '!Content_Access' => l('Content Access', 'http://drupal.org/project/content_access'),
252
-      '@Content_Access' => 'Content Access',
253
-      '!ACL' => 'ACL',
254
-      '!module_list' => '<ul><li>'. implode($na_modules, '</li><li>') .'</li></ul>',
249
+        '%content_type' => node_get_types('name', 'forum'),
250
+        '!Forum_Access' => 'Forum Access',
251
+        '!Content_Access' => l('Content Access', 'http://drupal.org/project/content_access'),
252
+        '@Content_Access' => 'Content Access',
253
+        '!ACL' => 'ACL',
254
+        '!module_list' => '<ul><li>'. implode($na_modules, '</li><li>') .'</li></ul>',
255 255
     );
256 256
     $form['forum_access']['interference'][] = array(
257
-      '#type' => 'item',
258
-      '#value' => '<p>'. t("Besides !Forum_Access (and !ACL) you have installed the following node access module(s): !module_list   The grants of every module are combined for each node. Access can only be granted, not removed &mdash; if a certain module grants a permission, the other(s) cannot deny it.", $variables) .'</p>',
259
-      '#description' => t('Forums can contain other content types besides %content_type; !Forum_Access will contribute the grants defined above to every node in this forum, but other node access control modules may also contribute their grants, especially to nodes of types other than %content_type.', $variables),
257
+        '#type' => 'item',
258
+        '#value' => '<p>'. t("Besides !Forum_Access (and !ACL) you have installed the following node access module(s): !module_list   The grants of every module are combined for each node. Access can only be granted, not removed &mdash; if a certain module grants a permission, the other(s) cannot deny it.", $variables) .'</p>',
259
+        '#description' => t('Forums can contain other content types besides %content_type; !Forum_Access will contribute the grants defined above to every node in this forum, but other node access control modules may also contribute their grants, especially to nodes of types other than %content_type.', $variables),
260 260
     );
261 261
 
262 262
     if (module_exists('content_access')) {
263
-      $ca_settings = variable_get('content_access_settings', array());
264
-      foreach (array('view', 'update', 'delete', 'per_node') as $type) {
263
+        $ca_settings = variable_get('content_access_settings', array());
264
+        foreach (array('view', 'update', 'delete', 'per_node') as $type) {
265 265
         $value = content_access_get_settings($type, 'forum');
266 266
         if (!empty($value)) {
267
-          $ca_interferes = TRUE;
267
+            $ca_interferes = TRUE;
268
+        }
268 269
         }
269
-      }
270
-      $ca_priority = content_access_get_settings('priority', 'forum');
271
-      $is_conflict = $ca_priority >= $fa_priority && !empty($ca_interferes) || $ca_priority > $fa_priority;
272
-      $variables += array(
270
+        $ca_priority = content_access_get_settings('priority', 'forum');
271
+        $is_conflict = $ca_priority >= $fa_priority && !empty($ca_interferes) || $ca_priority > $fa_priority;
272
+        $variables += array(
273 273
         '!link' => l(t('@Content_Access configuration for the %content_type type', $variables), 'admin/content/node-type/forum/access', array('html' => TRUE)),
274 274
         '%Advanced' => $tr('Advanced'),
275
-      );
276
-      $specifically = ($ca_priority == $fa_priority ? t('Specifically, any grants given by !Content_Access cannot be taken back by !Forum_Access.', $variables) : '');
277
-      if ($is_conflict) {
275
+        );
276
+        $specifically = ($ca_priority == $fa_priority ? t('Specifically, any grants given by !Content_Access cannot be taken back by !Forum_Access.', $variables) : '');
277
+        if ($is_conflict) {
278 278
         $form['forum_access']['interference']['by_content_access'] = array(
279
-          '#type' => 'fieldset',
280
-          '#title' => 'Content Access',
281
-          '#collapsible' => FALSE,
282
-          '#attributes' => array('class' => 'error'),
279
+            '#type' => 'fieldset',
280
+            '#title' => 'Content Access',
281
+            '#collapsible' => FALSE,
282
+            '#attributes' => array('class' => 'error'),
283 283
         );
284 284
         $form['forum_access']['interference']['by_content_access'][] = array(
285
-          '#value' => '<div>'. t('You have set the !Content_Access module to control access to content of type %content_type&mdash;this can interfere with proper operation of !Forum_Access!', $variables) ." $specifically</div>",
285
+            '#value' => '<div>'. t('You have set the !Content_Access module to control access to content of type %content_type&mdash;this can interfere with proper operation of !Forum_Access!', $variables) ." $specifically</div>",
286 286
         );
287 287
         if ($ca_priority == $fa_priority) {
288
-          $form['forum_access']['interference']['by_content_access'][] = array(
288
+            $form['forum_access']['interference']['by_content_access'][] = array(
289 289
             '#value' => '<div>'. t("Unless you really know what you're doing, we recommend that you go to the !link page and clear all checkboxes. This will instruct @Content_Access to leave the %content_type nodes alone. However, if you put nodes of other content types into forums as well, then these content types will continue to have this problem.", $variables) .'</div>',
290
-          );
290
+            );
291 291
         }
292 292
         else {
293
-          $form['forum_access']['interference']['by_content_access'][] = array(
293
+            $form['forum_access']['interference']['by_content_access'][] = array(
294 294
             '#value' => '<div>'. t("The priority of @Content_Access ($ca_priority) is higher than the priority of !Forum_Access ($fa_priority), which means the latter is <strong>completely disabled</strong> for the %content_type type! Unless you really know what you're doing, we recommend that you go to the !link page, change the priority (under %Advanced) to 0, and clear all checkboxes.", $variables) .'</div>',
295
-          );
295
+            );
296 296
         }
297 297
         $form['forum_access']['interference']['by_content_access'][] = array(
298
-          '#value' => '<div>'. t("Alternatively, you can give !Forum_Access priority over @Content_Access by either raising the priority of !Forum_Access in every forum above the priority of @Content_Access, or by lowering the priority of @Content_Access for the content types in question below the priority of !Forum_Access.", $variables) .'</div>',
298
+            '#value' => '<div>'. t("Alternatively, you can give !Forum_Access priority over @Content_Access by either raising the priority of !Forum_Access in every forum above the priority of @Content_Access, or by lowering the priority of @Content_Access for the content types in question below the priority of !Forum_Access.", $variables) .'</div>',
299 299
         );
300
-      }
301
-      else {
300
+        }
301
+        else {
302 302
         $form['forum_access']['interference'][] = array(
303
-          '#value' => '<p>'. t('Note: You have installed the !Content_Access module, which has the capability to grant access to content that would otherwise be protected by !Forum_Access. Be careful when configuring @Content_Access!', $variables) .'</p>',
303
+            '#value' => '<p>'. t('Note: You have installed the !Content_Access module, which has the capability to grant access to content that would otherwise be protected by !Forum_Access. Be careful when configuring @Content_Access!', $variables) .'</p>',
304 304
         );
305
-      }
305
+        }
306 306
     }
307 307
 
308 308
     $form['forum_access']['interference']['advanced'] = array(
309
-      '#type' => 'fieldset',
310
-      '#title' => t('Advanced'),
311
-      '#collapsible' => TRUE,
312
-      '#collapsed' => !($fa_priority != 0),
309
+        '#type' => 'fieldset',
310
+        '#title' => t('Advanced'),
311
+        '#collapsible' => TRUE,
312
+        '#collapsed' => !($fa_priority != 0),
313 313
     );
314 314
     $form['forum_access']['interference']['advanced']['priority'] = array(
315
-      '#type' => 'weight',
316
-      '#title' => t('Priority of !Forum_Access node grants in this forum', $variables),
317
-      '#default_value' => $fa_priority,
318
-      '#description' => t("If you have no other node access control modules installed, you should leave this at the default 0. <br /> Otherwise you can raise or lower the priority of !Forum_Access' grants. Out of all the grants contributed to a node, only those with the highest priority are used, and all others are discarded.", $variables),
315
+        '#type' => 'weight',
316
+        '#title' => t('Priority of !Forum_Access node grants in this forum', $variables),
317
+        '#default_value' => $fa_priority,
318
+        '#description' => t("If you have no other node access control modules installed, you should leave this at the default 0. <br /> Otherwise you can raise or lower the priority of !Forum_Access' grants. Out of all the grants contributed to a node, only those with the highest priority are used, and all others are discarded.", $variables),
319 319
     );
320
-  }
320
+    }
321 321
 
322
-  if (!$is_container) {
322
+    if (!$is_container) {
323 323
     $variables = array(
324
-      '!Forum_Access'        => l('Forum Access', 'http://drupal.org/project/forum_access'),
325
-      '!ACL'                 => l('ACL', 'http://drupal.org/project/acl'),
326
-      '%Module_interference' => t('Module interference'),
327
-      '!Forum_Access-dev'    => l('Forum&nbsp;Access&nbsp;6.x-1.x-dev', 'http://drupal.org/node/96795', array('html' => TRUE)),
328
-      '!ACL-dev'             => l('ACL&nbsp;6.x-1.x-dev', 'http://drupal.org/node/96794', array('html' => TRUE)),
329
-      '%devel_node_access'   => 'devel_node_access',
330
-      '!Devel'               => l('Devel', 'http://drupal.org/project/devel'),
331
-      '!DNA'                 => 'DNA',
332
-      '!debug_mode'          => l('debug mode', 'admin/settings/devel', array('fragment' => 'edit-devel-node-access-debug-mode')),
333
-      '!dna_summary'         => l('devel/node_access/summary', 'devel/node_access/summary'),
334
-      '!Rebuild_permissions' => '['. $tr('Rebuild permissions') .']',
335
-      '!Post_settings_link'  => l('admin/content/node-settings', 'admin/content/node-settings'),
336
-      '!Forum_Access_'       => l('Forum Access', 'http://drupal.org/project/issues/forum_access'),
337
-      '!ACL_'                => l('ACL', 'http://drupal.org/project/issues/acl'),
324
+        '!Forum_Access'        => l('Forum Access', 'http://drupal.org/project/forum_access'),
325
+        '!ACL'                 => l('ACL', 'http://drupal.org/project/acl'),
326
+        '%Module_interference' => t('Module interference'),
327
+        '!Forum_Access-dev'    => l('Forum&nbsp;Access&nbsp;6.x-1.x-dev', 'http://drupal.org/node/96795', array('html' => TRUE)),
328
+        '!ACL-dev'             => l('ACL&nbsp;6.x-1.x-dev', 'http://drupal.org/node/96794', array('html' => TRUE)),
329
+        '%devel_node_access'   => 'devel_node_access',
330
+        '!Devel'               => l('Devel', 'http://drupal.org/project/devel'),
331
+        '!DNA'                 => 'DNA',
332
+        '!debug_mode'          => l('debug mode', 'admin/settings/devel', array('fragment' => 'edit-devel-node-access-debug-mode')),
333
+        '!dna_summary'         => l('devel/node_access/summary', 'devel/node_access/summary'),
334
+        '!Rebuild_permissions' => '['. $tr('Rebuild permissions') .']',
335
+        '!Post_settings_link'  => l('admin/content/node-settings', 'admin/content/node-settings'),
336
+        '!Forum_Access_'       => l('Forum Access', 'http://drupal.org/project/issues/forum_access'),
337
+        '!ACL_'                => l('ACL', 'http://drupal.org/project/issues/acl'),
338 338
     );
339 339
     $form['forum_access']['troubleshooting'] = array(
340
-      '#type' => 'fieldset',
341
-      '#title' => t('Trouble-shooting node access'),
342
-      '#collapsible' => TRUE,
343
-      '#collapsed' => TRUE,
340
+        '#type' => 'fieldset',
341
+        '#title' => t('Trouble-shooting node access'),
342
+        '#collapsible' => TRUE,
343
+        '#collapsed' => TRUE,
344 344
     );
345 345
     $form['forum_access']['troubleshooting'][] = array(
346
-      '#type' => 'item',
347
-      '#value' => '<div>'.    t("In case of problems, follow these steps until you've got it worked out:") .'<ol style="margin-top: 0"><li>'.
348
-                              t("Update to the 'recommended' !Forum_Access and !ACL releases for your version of Drupal.", $variables) .'</li><li>'.
346
+        '#type' => 'item',
347
+        '#value' => '<div>'.    t("In case of problems, follow these steps until you've got it worked out:") .'<ol style="margin-top: 0"><li>'.
348
+                                t("Update to the 'recommended' !Forum_Access and !ACL releases for your version of Drupal.", $variables) .'</li><li>'.
349 349
         (count($na_modules) ? t("Read %Module_interference above and update your other node access modules.", $variables) .'</li><li>' : '') .
350
-                              t("Check the release notes of the development snapshots for issues that might have been fixed in !Forum_Access-dev or !ACL-dev since the latest release.", $variables) .'</li><li>'.
351
-                              t("Install the %devel_node_access module (!DNA, part of the !Devel module) and enable its !debug_mode: !DNA will show you all the grants that actually control your nodes in a footer block on each node's page.", $variables) .'</li><li>'.
352
-                              t("Additional insight can be gained from !dna_summary and by enabling the second !DNA block.", $variables) .'</li><li>'.
353
-                              t("Click !Rebuild_permissions on !Post_settings_link and check DNA for changes.", $variables) .'</li><li>'.
354
-                              t("Check the issues queues of !Forum_Access_ and !ACL_ for existing reports and possible solutions.", $variables) .'</li><li>'.
355
-                              t("If all of this hasn't helped, then pick ONE node that is misbehaving, look at it using an account that can see the node (and that should NOT have access if that's your problem!), create a new issue in the issues queue, describe the problem... <ul><li> what did you do? </li><li> what did you expect? </li><li> what happened instead? </li></ul> ... and <strong>attach a screenshot of all the DNA records</strong> for that one node. <br /> Be sure to indicate paths (URLs) for every page and module that you mention.") .'</li></ol></div>',
350
+                                t("Check the release notes of the development snapshots for issues that might have been fixed in !Forum_Access-dev or !ACL-dev since the latest release.", $variables) .'</li><li>'.
351
+                                t("Install the %devel_node_access module (!DNA, part of the !Devel module) and enable its !debug_mode: !DNA will show you all the grants that actually control your nodes in a footer block on each node's page.", $variables) .'</li><li>'.
352
+                                t("Additional insight can be gained from !dna_summary and by enabling the second !DNA block.", $variables) .'</li><li>'.
353
+                                t("Click !Rebuild_permissions on !Post_settings_link and check DNA for changes.", $variables) .'</li><li>'.
354
+                                t("Check the issues queues of !Forum_Access_ and !ACL_ for existing reports and possible solutions.", $variables) .'</li><li>'.
355
+                                t("If all of this hasn't helped, then pick ONE node that is misbehaving, look at it using an account that can see the node (and that should NOT have access if that's your problem!), create a new issue in the issues queue, describe the problem... <ul><li> what did you do? </li><li> what did you expect? </li><li> what happened instead? </li></ul> ... and <strong>attach a screenshot of all the DNA records</strong> for that one node. <br /> Be sure to indicate paths (URLs) for every page and module that you mention.") .'</li></ol></div>',
356 356
     );
357 357
     $form['forum_access']['troubleshooting'][] = array(
358
-      '#type' => 'item',
359
-      '#value' => '<div>'. t("Note: You should not keep the !Devel module enabled on a production site.", $variables) .'</div>',
358
+        '#type' => 'item',
359
+        '#value' => '<div>'. t("Note: You should not keep the !Devel module enabled on a production site.", $variables) .'</div>',
360 360
     );
361
-  }
361
+    }
362 362
 
363
-  if (!$is_container && isset($tid) && !node_access_needs_rebuild()) {
363
+    if (!$is_container && isset($tid) && !node_access_needs_rebuild()) {
364 364
     $count = db_result(db_query("SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE tn.tid = %d", $tid));
365 365
     $limit = 20;   // from _node_access_rebuild_batch_operation()
366 366
     $threshold = variable_get('forum_access_batch_threshold', $limit);  // change the variable if you want
367 367
     $form['forum_access']['update_limit'] = array(
368
-      '#type' => 'value',
369
-      '#value' => $limit,
368
+        '#type' => 'value',
369
+        '#value' => $limit,
370 370
     );
371 371
     $form['forum_access']['update_choice'] = array(
372
-      '#type' => 'radios',
373
-      '#title' => 'Update the permissions',
374
-      '#description' => t('<em>If</em> you make any node access changes, then each node in this forum needs to be updated. Hover over the radiobuttons for details.'),
375
-      '#options' => NULL,
376
-      0 => array(
372
+        '#type' => 'radios',
373
+        '#title' => 'Update the permissions',
374
+        '#description' => t('<em>If</em> you make any node access changes, then each node in this forum needs to be updated. Hover over the radiobuttons for details.'),
375
+        '#options' => NULL,
376
+        0 => array(
377 377
         '#type' => 'radio',
378 378
         '#title' => t('for all %count nodes immediately', array('%count' => $count)),
379 379
         '#attributes' => array('title' => t('This option is the fastest, but with many nodes it can still take considerable time and memory. If it fails, it will leave your !node_access table in an inconsistent state.', array('!node_access' => '{node_access}'))),
380 380
         '#return_value' => 0,
381 381
         '#default_value' => ($count <= $threshold ? 0 : 1),
382 382
         '#parents' => array('forum_access', 'update_choice'),
383
-      ),
384
-      1 => array(
383
+        ),
384
+        1 => array(
385 385
         '#type' => 'radio',
386 386
         '#title' => t('in batches of !limit now', array('!limit' => $limit)),
387 387
         '#attributes' => array('title' => t('The batch option will always work reliably, but it takes longer to complete.')),
388 388
         '#return_value' => 1,
389 389
         '#default_value' => ($count <= $threshold ? 0 : 1),
390 390
         '#parents' => array('forum_access', 'update_choice'),
391
-      ),
392
-      2 => array(
391
+        ),
392
+        2 => array(
393 393
         '#type' => 'radio',
394 394
         '#title' => t('rebuild <strong>all</strong> permissions later'),
395 395
         '#attributes' => array('title' => t("This option will only set a flag to remind you to rebuild all permissions later; this is useful if you want to make multiple changes to your node access settings quickly and delay the updating until you're done.")),
396 396
         '#return_value' => 2,
397 397
         '#default_value' => ($count <= $threshold ? 0 : 1),
398 398
         '#parents' => array('forum_access', 'update_choice'),
399
-      ),
400
-      '#attributes' => array('class' => 'forum-access-flowed'),
399
+        ),
400
+        '#attributes' => array('class' => 'forum-access-flowed'),
401 401
     );
402
-  }
403
-  if (isset($tid)) {
402
+    }
403
+    if (isset($tid)) {
404 404
     $form['forum_access']['force_update'] = array(
405
-      '#type' => 'checkbox',
406
-      '#title' => t('Update even if unchanged'),
405
+        '#type' => 'checkbox',
406
+        '#title' => t('Update even if unchanged'),
407 407
     );
408
-  }
408
+    }
409 409
 
410
-  // Move some stuff down so our block goes in a nice place.
411
-  $form['submit']['#weight'] = 10;
412
-  $form['delete']['#weight'] = 10;
410
+    // Move some stuff down so our block goes in a nice place.
411
+    $form['submit']['#weight'] = 10;
412
+    $form['delete']['#weight'] = 10;
413 413
 
414
-  $form['#validate'][] = '_forum_access_form_validate';
415
-  $form['#submit'][] = '_forum_access_form_submit';
414
+    $form['#validate'][] = '_forum_access_form_validate';
415
+    $form['#submit'][] = '_forum_access_form_submit';
416 416
 }
417 417
 
418 418
 /**
@@ -420,82 +420,82 @@  discard block
 block discarded – undo
420 420
  * are the permissions of the corresponding role.
421 421
  */
422 422
 function _forum_access_get_role_permissions() {
423
-  static $permissions;
424
-  if (empty($permissions)) {
423
+    static $permissions;
424
+    if (empty($permissions)) {
425 425
     $permissions[DRUPAL_AUTHENTICATED_RID] = array();
426 426
     $result = db_query('SELECT r.rid, p.perm FROM {role} r INNER JOIN {permission} p ON r.rid = p.rid ORDER BY r.rid');
427 427
     while ($role = db_fetch_object($result)) {
428
-      $permissions[$role->rid] = ($role->rid == DRUPAL_ANONYMOUS_RID ? array() : $permissions[DRUPAL_AUTHENTICATED_RID]);
429
-      $permissions[$role->rid] += array_flip(explode(', ', $role->perm));
428
+        $permissions[$role->rid] = ($role->rid == DRUPAL_ANONYMOUS_RID ? array() : $permissions[DRUPAL_AUTHENTICATED_RID]);
429
+        $permissions[$role->rid] += array_flip(explode(', ', $role->perm));
430
+    }
430 431
     }
431
-  }
432
-  return $permissions;
432
+    return $permissions;
433 433
 }
434 434
 
435 435
 function _forum_access_forum_form_disable_checkboxes($element) {
436
-  global $user;
437
-  $tr = 't';
438
-  $moderator_rid = forum_access_query_moderator_rid();
436
+    global $user;
437
+    $tr = 't';
438
+    $moderator_rid = forum_access_query_moderator_rid();
439 439
 
440
-  $permissions = _forum_access_get_role_permissions();
441
-  $element_children = element_children($element);
442
-  foreach ($element_children as $rid) {
440
+    $permissions = _forum_access_get_role_permissions();
441
+    $element_children = element_children($element);
442
+    foreach ($element_children as $rid) {
443 443
     if ($rid == $moderator_rid) {
444
-      $element[$rid]['#prefix'] = '<span title="'. t("This is the (temporary) @Forum_Moderator role; it has the '@administer_nodes' and '@administer_comments' permissions and is only used temporarily by @Forum_Access &mdash; do NOT give this role to any user!", array('@Forum_Moderator' => t('Forum Moderator'), '@administer_nodes' => $tr('administer nodes'), '@administer_comments' => $tr('administer comments'), '@Forum_Access' => 'Forum Access')) .'" class="forum-access-temporary-moderator">';
445
-      $element[$rid]['#suffix'] = "</span>";
446
-      $element[$rid]['#default_value'] = TRUE;
447
-      $element[$rid]['#disabled'] = TRUE;
444
+        $element[$rid]['#prefix'] = '<span title="'. t("This is the (temporary) @Forum_Moderator role; it has the '@administer_nodes' and '@administer_comments' permissions and is only used temporarily by @Forum_Access &mdash; do NOT give this role to any user!", array('@Forum_Moderator' => t('Forum Moderator'), '@administer_nodes' => $tr('administer nodes'), '@administer_comments' => $tr('administer comments'), '@Forum_Access' => 'Forum Access')) .'" class="forum-access-temporary-moderator">';
445
+        $element[$rid]['#suffix'] = "</span>";
446
+        $element[$rid]['#default_value'] = TRUE;
447
+        $element[$rid]['#disabled'] = TRUE;
448 448
     }
449 449
     elseif ($element['#parents'][1] == 'create') {
450
-      // Do nothing (Post is always mutable).
450
+        // Do nothing (Post is always mutable).
451 451
     }
452 452
     elseif ($element['#parents'][1] == 'comment_create') {
453 453
     }
454 454
     elseif ($element['#parents'][1] == 'view' && isset($permissions[$rid]['administer forums'])) {
455
-      $element[$rid]['#title'] = '<em>'. $element[$rid]['#title'] .'</em>';
456
-      $element[$rid]['#prefix'] = '<span title="'. t("This role has the '@administer_forums' permission, and granting '@View' enables the role holders to change the settings on this page, including @Access_control!", array('@administer_forums' => $tr('administer forums'), '@View' => t('View'), '@Access_control' => t('Access control'))) .'">';
457
-      if (isset($permissions[$rid]['administer nodes'])) {
455
+        $element[$rid]['#title'] = '<em>'. $element[$rid]['#title'] .'</em>';
456
+        $element[$rid]['#prefix'] = '<span title="'. t("This role has the '@administer_forums' permission, and granting '@View' enables the role holders to change the settings on this page, including @Access_control!", array('@administer_forums' => $tr('administer forums'), '@View' => t('View'), '@Access_control' => t('Access control'))) .'">';
457
+        if (isset($permissions[$rid]['administer nodes'])) {
458 458
         $element[$rid]['#prefix'] = str_replace('">', ' '. t("Because the role also has the '@administer_nodes' permission, it has full access to all nodes either way.", array('@administer_nodes' => $tr('administer nodes'))) .'">', $element[$rid]['#prefix']);
459
-      }
460
-      $element[$rid]['#suffix'] = "</span>";
459
+        }
460
+        $element[$rid]['#suffix'] = "</span>";
461 461
     }
462 462
     elseif (isset($permissions[$rid]['administer nodes'])) {
463
-      $element[$rid]['#disabled'] = TRUE;
464
-      $element[$rid]['#default_value'] = TRUE;
465
-      $element[$rid]['#prefix'] = '<span title="'. ($rid != $moderator_rid
463
+        $element[$rid]['#disabled'] = TRUE;
464
+        $element[$rid]['#default_value'] = TRUE;
465
+        $element[$rid]['#prefix'] = '<span title="'. ($rid != $moderator_rid
466 466
                                                     ? t("This role has the '@administer_nodes' permission and thus full access to all nodes.", array('@administer_nodes' => $tr('administer nodes')))
467 467
                                                     : t("This is the @Forum_Moderator role; it has the '@administer_nodes' and '@administer_comments' permissions and thus full access to all nodes and comments.", array('@Forum_Moderator' => t('Forum Moderator'), '@administer_nodes' => $tr('administer nodes'), '@administer_comments' => $tr('administer comments')))) .'">';
468
-      $element[$rid]['#suffix'] = "</span>";
468
+        $element[$rid]['#suffix'] = "</span>";
469
+    }
469 470
     }
470
-  }
471
-  return $element;
471
+    return $element;
472 472
 }
473 473
 
474 474
 function _forum_access_forum_form_after_build_acl0($form, $form_state) {
475
-  if (isset($form['#post']['forum_access']['template']['taxonomy'])) {
475
+    if (isset($form['#post']['forum_access']['template']['taxonomy'])) {
476 476
     // Get ACL's user_list for the template and replace it before ACL's after_build function gets its shot at it.
477 477
     $imv = array_values($form['#post']['forum_access']['template']['taxonomy']);
478 478
     $template_tid = reset($imv);
479 479
     if ($acl_id = acl_get_id_by_number('forum_access', $template_tid)) {
480
-      $f = acl_edit_form($acl_id, 'DUMMY');
481
-      $form['user_list']['#value'] = $f['user_list']['#default_value'];
480
+        $f = acl_edit_form($acl_id, 'DUMMY');
481
+        $form['user_list']['#value'] = $f['user_list']['#default_value'];
482 482
     }
483
-  }
484
-  return $form;
483
+    }
484
+    return $form;
485 485
 }
486 486
 
487 487
 function _forum_access_forum_form_after_build_acl2($form, $form_state) {
488
-  if (!count(unserialize($form['user_list']['#default_value'])) && !count(unserialize($form['user_list']['#value']))) {
488
+    if (!count(unserialize($form['user_list']['#default_value'])) && !count(unserialize($form['user_list']['#value']))) {
489 489
     $form['#collapsed'] = TRUE;
490
-  }
491
-  if ($form['user_list']['#default_value'] != $form['user_list']['#value']) {
490
+    }
491
+    if ($form['user_list']['#default_value'] != $form['user_list']['#value']) {
492 492
     $form['note']['#value'] = preg_replace('/<div>/', '<div class="warning">', $form['note']['#value']);
493
-  }
494
-  return $form;
493
+    }
494
+    return $form;
495 495
 }
496 496
 
497 497
 function _forum_access_forum_form_after_build($form, &$form_state) {
498
-  if (isset($form_state['clicked_button']['#name']) && $form_state['clicked_button']['#name'] == $form['template']['load_button']['#name']) {
498
+    if (isset($form_state['clicked_button']['#name']) && $form_state['clicked_button']['#name'] == $form['template']['load_button']['#name']) {
499 499
     // Load a setting from a template:
500 500
     $template_tid = reset(array_values($form['#post']['forum_access']['template']['taxonomy']));
501 501
     $form_state['values']['forum_access']['template']['template_tid'] = $template_tid;
@@ -503,158 +503,158 @@  discard block
 block discarded – undo
503 503
 
504 504
     $settings = _forum_access_get_settings($template_tid);
505 505
     foreach (array('view', 'create', 'comment_create', 'update', 'delete') as $grant_type) {
506
-      if (empty($form[$grant_type])) {
506
+        if (empty($form[$grant_type])) {
507 507
         continue;
508
-      }
509
-      foreach (element_children($form[$grant_type]) as $tid) {
508
+        }
509
+        foreach (element_children($form[$grant_type]) as $tid) {
510 510
         $checked = array_search($tid, $settings[$grant_type]) !== FALSE;
511 511
         $form[$grant_type][$tid]['#value'] = ($checked ? $tid : 0);
512
-      }
512
+        }
513 513
     }
514 514
     $form['interference']['advanced']['priority']['#value'] = $settings['priority'];
515 515
     if ($settings['priority'] != 0) {
516
-      $form['interference']['advanced']['#collapsed'] = FALSE;
516
+        $form['interference']['advanced']['#collapsed'] = FALSE;
517 517
     }
518
-  }
519
-  elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) {
520
-      $imv = reset($form_state['values']['forum_access']['template']['taxonomy']);
518
+    }
519
+    elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) {
520
+        $imv = reset($form_state['values']['forum_access']['template']['taxonomy']);
521 521
     $template_tid = reset($imv);
522
-  }
523
-  if (isset($template_tid)) {
522
+    }
523
+    if (isset($template_tid)) {
524 524
     $form['template']['select_by_default']['#value'] = ($template_tid && $template_tid == variable_get('forum_access_default_template_tid', 0));
525 525
     $form['template']['load_for_new']['#value'] = ($template_tid && $template_tid == variable_get('forum_access_new_template_tid', 0));
526
-  }
527
-  return $form;
526
+    }
527
+    return $form;
528 528
 }
529 529
 
530 530
 function _forum_access_form_validate($form, &$form_state) {
531
-  global $user;
531
+    global $user;
532 532
 
533
-  if ($user->uid == 1) {
533
+    if ($user->uid == 1) {
534 534
     return;
535
-  }
536
-  $access = $form_state['values']['forum_access']; // shortcut
537
-  foreach ($access['view'] as $rid => $checked) {
535
+    }
536
+    $access = $form_state['values']['forum_access']; // shortcut
537
+    foreach ($access['view'] as $rid => $checked) {
538 538
     if ($checked && isset($user->roles[$rid])) {
539
-      return;
539
+        return;
540
+    }
540 541
     }
541
-  }
542
-  form_set_error('forum_access][view', t('You must assign %View access to a role that you hold.', array('%View' => 'View')));
542
+    form_set_error('forum_access][view', t('You must assign %View access to a role that you hold.', array('%View' => 'View')));
543 543
 }
544 544
 
545 545
 function _forum_access_form_submit($form, &$form_state) {
546
-  $access = $form_state['values']['forum_access']; // shortcut
546
+    $access = $form_state['values']['forum_access']; // shortcut
547 547
 
548
-  // Save template choice:
549
-  $template_tid = reset(array_values($access['template']['taxonomy']));
550
-  if ($access['template']['select_by_default']) {
548
+    // Save template choice:
549
+    $template_tid = reset(array_values($access['template']['taxonomy']));
550
+    if ($access['template']['select_by_default']) {
551 551
     variable_set('forum_access_default_template_tid', $template_tid);
552
-  }
553
-  elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) {
552
+    }
553
+    elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) {
554 554
     variable_del('forum_access_default_template_tid');
555
-  }
556
-  if ($access['template']['load_for_new']) {
555
+    }
556
+    if ($access['template']['load_for_new']) {
557 557
     variable_set('forum_access_new_template_tid', $template_tid);
558
-  }
559
-  elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) {
558
+    }
559
+    elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) {
560 560
     variable_del('forum_access_new_template_tid');
561
-  }
562
-  module_load_include('node.inc', 'forum_access');
563
-  $moderator_rid = _forum_access_get_moderator_rid(TRUE);  // create the moderators role if it doesn't exist
564
-
565
-  // check for changes
566
-  $is_changed = $is_new = strpos($_GET['q'], 'admin/content/forum/add/') === 0;
567
-  $is_changed = $is_changed || !empty($access['force_update']);
568
-  $form_initial_values = $form;  // avoid Coder warning
569
-  $form_initial_values = $form_initial_values['forum_access'];
570
-  foreach (array('view', 'create', 'comment_create', 'update', 'delete') as $grant_type) {
561
+    }
562
+    module_load_include('node.inc', 'forum_access');
563
+    $moderator_rid = _forum_access_get_moderator_rid(TRUE);  // create the moderators role if it doesn't exist
564
+
565
+    // check for changes
566
+    $is_changed = $is_new = strpos($_GET['q'], 'admin/content/forum/add/') === 0;
567
+    $is_changed = $is_changed || !empty($access['force_update']);
568
+    $form_initial_values = $form;  // avoid Coder warning
569
+    $form_initial_values = $form_initial_values['forum_access'];
570
+    foreach (array('view', 'create', 'comment_create', 'update', 'delete') as $grant_type) {
571 571
     if (isset($form_initial_values[$grant_type])) {
572
-      $defaults = $form_initial_values[$grant_type]['#default_value'];
573
-      $defaults = array_flip($defaults);
574
-      foreach ($access[$grant_type] as $rid => $checked) {
572
+        $defaults = $form_initial_values[$grant_type]['#default_value'];
573
+        $defaults = array_flip($defaults);
574
+        foreach ($access[$grant_type] as $rid => $checked) {
575 575
         $is_changed = $is_changed || (empty($form_initial_values[$grant_type][$rid]['#disabled']) && !empty($checked) != isset($defaults[$rid]));
576
-      }
576
+        }
577
+    }
577 578
     }
578
-  }
579
-  if (!$is_changed && $access['acl']['user_list'] == $form_initial_values['acl']['user_list']['#default_value'] && $access['interference']['advanced']['priority'] == $form_initial_values['interference']['advanced']['priority']['#default_value']) {
579
+    if (!$is_changed && $access['acl']['user_list'] == $form_initial_values['acl']['user_list']['#default_value'] && $access['interference']['advanced']['priority'] == $form_initial_values['interference']['advanced']['priority']['#default_value']) {
580 580
     drupal_set_message(t('The content access permissions are unchanged.'));
581 581
     return;
582
-  }
582
+    }
583 583
 
584
-  $tid = $form_state['values']['tid'];
585
-  db_query("DELETE FROM {forum_access} WHERE tid = %d", $tid);
584
+    $tid = $form_state['values']['tid'];
585
+    db_query("DELETE FROM {forum_access} WHERE tid = %d", $tid);
586 586
 
587
-  $fa_priority = isset($access['interference']['advanced']['priority']) ? $access['interference']['advanced']['priority'] : 0;
588
-  if (array_key_exists('acl', $access)) {
587
+    $fa_priority = isset($access['interference']['advanced']['priority']) ? $access['interference']['advanced']['priority'] : 0;
588
+    if (array_key_exists('acl', $access)) {
589 589
     $moderators = unserialize($access['acl']['user_list']);
590 590
     acl_save_form($access['acl'], $fa_priority);
591
-  }
592
-  $permissions = _forum_access_get_role_permissions();
593
-  foreach ($access['view'] as $rid => $checked) {
591
+    }
592
+    $permissions = _forum_access_get_role_permissions();
593
+    foreach ($access['view'] as $rid => $checked) {
594 594
     if ($rid == $moderator_rid) {
595
-      continue;
595
+        continue;
596 596
     }
597 597
     if (isset($permissions[$rid]['administer nodes'])) {
598
-      // We prefer not to save records for node administrators, because these have access anyway.
599
-      if (isset($permissions[$rid]['administer forums']) && $access['view'][$rid]) {
598
+        // We prefer not to save records for node administrators, because these have access anyway.
599
+        if (isset($permissions[$rid]['administer forums']) && $access['view'][$rid]) {
600 600
         // For forum administrators, View needs to be saved, ...
601
-      }
602
-      else {
601
+        }
602
+        else {
603 603
         // ... otherwise forget View.
604 604
         $access['view'][$rid] = FALSE;
605
-      }
606
-      if ($access['view'][$rid] || $access['create'][$rid] || $access['comment_create'][$rid]) {
605
+        }
606
+        if ($access['view'][$rid] || $access['create'][$rid] || $access['comment_create'][$rid]) {
607 607
         db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)",
608 608
         $tid, $rid, !empty($access['view'][$rid]), 0, 0, !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority);
609
-      }
609
+        }
610 610
     }
611 611
     else {
612
-      db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)",
613
-      $tid, $rid, (bool) $checked, !empty($access['update'][$rid]), !empty($access['delete'][$rid]), !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority);
612
+        db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)",
613
+        $tid, $rid, (bool) $checked, !empty($access['update'][$rid]), !empty($access['delete'][$rid]), !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority);
614 614
     }
615
-  }
616
-  $tr = 't';
617
-  $link = l($tr('edit'), 'admin/content/forum/edit/forum/'. $tid);
618
-  watchdog('access', 'Changed grants for %forum forum.', array('%forum' => $form_state['values']['name']), WATCHDOG_NOTICE, $link);
615
+    }
616
+    $tr = 't';
617
+    $link = l($tr('edit'), 'admin/content/forum/edit/forum/'. $tid);
618
+    watchdog('access', 'Changed grants for %forum forum.', array('%forum' => $form_state['values']['name']), WATCHDOG_NOTICE, $link);
619 619
 
620
-  if (!$is_new && $form_state['values']['form_id'] != 'forum_form_container') {
620
+    if (!$is_new && $form_state['values']['form_id'] != 'forum_form_container') {
621 621
     if (!isset($access['update_choice']) || $access['update_choice'] == 2) {
622
-      node_access_needs_rebuild(TRUE);
622
+        node_access_needs_rebuild(TRUE);
623 623
     }
624 624
     elseif ($access['update_choice'] == 0) {
625
-      // update immediately (but use the batch functions anyway
626
-      $save_redirect = $form_state['redirect'];
627
-      $form_state['redirect'] = $_GET['q'];
628
-      $context = array();
629
-      $pending_error_messages = drupal_get_messages('error', FALSE);
630
-      $our_error_message_index = (isset($pending_error_messages['error']) ? count($pending_error_messages['error']) : 0);
631
-      _forum_access_update_batch_finished(FALSE, array(), array());       // add our error message (in case we die underway)
632
-      _forum_access_update_batch_operation($tid, 999999, 1, $context);
633
-      $pending_error_messages = drupal_get_messages('error', TRUE);       // still alive, get and clear all 'error' messages
634
-      unset($pending_error_messages['error'][$our_error_message_index]);  // remove our error message
635
-      foreach ($pending_error_messages['error'] as $message) {            // replay any others
625
+        // update immediately (but use the batch functions anyway
626
+        $save_redirect = $form_state['redirect'];
627
+        $form_state['redirect'] = $_GET['q'];
628
+        $context = array();
629
+        $pending_error_messages = drupal_get_messages('error', FALSE);
630
+        $our_error_message_index = (isset($pending_error_messages['error']) ? count($pending_error_messages['error']) : 0);
631
+        _forum_access_update_batch_finished(FALSE, array(), array());       // add our error message (in case we die underway)
632
+        _forum_access_update_batch_operation($tid, 999999, 1, $context);
633
+        $pending_error_messages = drupal_get_messages('error', TRUE);       // still alive, get and clear all 'error' messages
634
+        unset($pending_error_messages['error'][$our_error_message_index]);  // remove our error message
635
+        foreach ($pending_error_messages['error'] as $message) {            // replay any others
636 636
         drupal_set_message($message, 'error');
637
-      }
638
-      _forum_access_update_batch_finished(TRUE, array(), array());
639
-      $form_state['redirect'] = $save_redirect;
637
+        }
638
+        _forum_access_update_batch_finished(TRUE, array(), array());
639
+        $form_state['redirect'] = $save_redirect;
640 640
     }
641 641
     else {
642
-      // mass update in batch mode, modeled after node.module
643
-      $limit = $access['update_limit'];
644
-      $count = db_result(db_query("SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE tn.tid = %d", $tid));
645
-      $batch = array(
642
+        // mass update in batch mode, modeled after node.module
643
+        $limit = $access['update_limit'];
644
+        $count = db_result(db_query("SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE tn.tid = %d", $tid));
645
+        $batch = array(
646 646
         'title' => t('Updating content access permissions'),
647 647
         'file' => drupal_get_path('module', 'forum_access') .'/forum_access.admin.inc',
648 648
         'operations' => array(
649
-          array('_forum_access_update_batch_operation', array($tid, $limit, $count)),
649
+            array('_forum_access_update_batch_operation', array($tid, $limit, $count)),
650 650
         ),
651 651
         'finished' => '_forum_access_update_batch_finished'
652
-      );
653
-      batch_set($batch);
652
+        );
653
+        batch_set($batch);
654
+    }
654 655
     }
655
-  }
656 656
 
657
-  variable_del('forum_access_rids');  // clear cache
657
+    variable_del('forum_access_rids');  // clear cache
658 658
 }
659 659
 
660 660
 /**
@@ -665,73 +665,73 @@  discard block
 block discarded – undo
665 665
  * feedback after 1 second execution time.
666 666
  */
667 667
 function _forum_access_update_batch_operation($tid, $limit, $count, &$context) {
668
-  if (empty($context['sandbox'])) {
668
+    if (empty($context['sandbox'])) {
669 669
     // Initiate multistep processing.
670 670
     $context['sandbox']['progress'] = 0;
671 671
     $context['sandbox']['current_node'] = 0;
672 672
     $context['sandbox']['max'] = $count;
673
-  }
673
+    }
674 674
 
675
-  // Process the next 20 nodes.
676
-  $result = db_query_range("SELECT DISTINCT n.nid FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE n.nid > %d AND tn.tid = %d ORDER BY n.nid ASC", $context['sandbox']['current_node'], $tid, 0, $limit);
677
-  while ($row = db_fetch_array($result)) {
675
+    // Process the next 20 nodes.
676
+    $result = db_query_range("SELECT DISTINCT n.nid FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE n.nid > %d AND tn.tid = %d ORDER BY n.nid ASC", $context['sandbox']['current_node'], $tid, 0, $limit);
677
+    while ($row = db_fetch_array($result)) {
678 678
     $loaded_node = node_load($row['nid'], NULL, TRUE);
679 679
     // To preserve database integrity, only aquire grants if the node
680 680
     // loads successfully.
681 681
     if (!empty($loaded_node)) {
682
-      node_access_acquire_grants($loaded_node);
682
+        node_access_acquire_grants($loaded_node);
683 683
     }
684 684
     $context['sandbox']['progress']++;
685 685
     $context['sandbox']['current_node'] = $loaded_node->nid;
686
-  }
686
+    }
687 687
 
688
-  // Multistep processing : report progress.
689
-  if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
688
+    // Multistep processing : report progress.
689
+    if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
690 690
     $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
691
-  }
691
+    }
692 692
 }
693 693
 
694 694
 /**
695 695
  * Post-processing for forum_access_form_submit().
696 696
  */
697 697
 function _forum_access_update_batch_finished($success, $results, $operations) {
698
-  if ($success) {
698
+    if ($success) {
699 699
     drupal_set_message(t('The content access permissions have been updated.'));
700 700
     cache_clear_all();
701
-  }
702
-  else {
701
+    }
702
+    else {
703 703
     drupal_set_message(t('The content access permissions have not been properly updated.'), 'error');
704
-  }
704
+    }
705 705
 }
706 706
 
707 707
 /**
708 708
  * Add our settings to the forum administration settings page.
709 709
  */
710 710
 function _forum_access_forum_admin_settings_form(&$form, &$form_state) {
711
-  $variables = array(
711
+    $variables = array(
712 712
     '!Forum_Access' => 'Forum Access',
713 713
     '%View' => 'View',
714 714
     '%Post' => 'Post',
715 715
     '%post_comments' => 'post comments',
716
-  );
717
-  $form['forum_access'] = array(
716
+    );
717
+    $form['forum_access'] = array(
718 718
     '#type' => 'fieldset',
719 719
     '#title' => 'Forum Access',
720 720
     '#attributes' => array('id' => 'edit-forum-admin-settings-forum-access'),
721
-  );
722
-  $form['forum_access']['note'] = array(
721
+    );
722
+    $form['forum_access']['note'] = array(
723 723
     '#type'          => 'item',
724 724
     '#value'         => t('Note: All other !Forum_Access controls are on the administration pages of the individual forums.', $variables),
725
-  );
726
-  $form['forum_access']['forum_access_D5_legacy_mode'] = array(
725
+    );
726
+    $form['forum_access']['forum_access_D5_legacy_mode'] = array(
727 727
     '#type'          => 'checkbox',
728 728
     '#title'         => t('Drupal 5 legacy mode', $variables),
729 729
     '#default_value' => variable_get('forum_access_D5_legacy_mode', FALSE),
730 730
     '#description'   => t('In Drupal 5, comment posting was not restricted by !Forum_Access; users with %View access (and the %post_comments permission) were always allowed to post forum comments. Starting with Drupal 6, posting comments is now restricted to users with %Post access. Turn this option on to revert to the old behavior. The default is OFF.', $variables),
731
-  );
732
-  $buttons = $form['buttons'];
733
-  unset($form['buttons']);
734
-  $form['buttons'] = $buttons;
731
+    );
732
+    $buttons = $form['buttons'];
733
+    unset($form['buttons']);
734
+    $form['buttons'] = $buttons;
735 735
 }
736 736
 
737 737
 /**
@@ -739,63 +739,63 @@  discard block
 block discarded – undo
739 739
  */
740 740
 function _forum_access_get_settings($tid = NULL) {
741 741
     $return = array('view' => array(), 'create' => array(), 'comment_create' => array(), 'update' => array(), 'delete' => array(), 'priority' => 0);
742
-  if (!isset($tid)) {
742
+    if (!isset($tid)) {
743 743
     // Default to all users can read; all logged in users can post and comment.
744 744
     $return['view'] = array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID);
745 745
     $return['create'] = array(DRUPAL_AUTHENTICATED_RID);
746 746
     $return['comment_create'] = array(DRUPAL_AUTHENTICATED_RID);
747
-  }
748
-  else {
747
+    }
748
+    else {
749 749
     $result = db_query("SELECT * FROM {forum_access} where tid = %d", $tid);
750 750
     while ($access = db_fetch_object($result)) {
751
-      if ($access->grant_view) {
751
+        if ($access->grant_view) {
752 752
         $return['view'][] = $access->rid;
753
-      }
754
-      if ($access->grant_update) {
753
+        }
754
+        if ($access->grant_update) {
755 755
         $return['update'][] = $access->rid;
756
-      }
757
-      if ($access->grant_delete) {
756
+        }
757
+        if ($access->grant_delete) {
758 758
         $return['delete'][] = $access->rid;
759
-      }
760
-      if ($access->grant_create) {
759
+        }
760
+        if ($access->grant_create) {
761 761
         $return['create'][] = $access->rid;
762
-      }
763
-      if ($access->grant_comment_create) {
762
+        }
763
+        if ($access->grant_comment_create) {
764 764
         $return['comment_create'][] = $access->rid;
765
-      }
766
-      if ($access->rid == DRUPAL_AUTHENTICATED_RID) {  // this is our reference
765
+        }
766
+        if ($access->rid == DRUPAL_AUTHENTICATED_RID) {  // this is our reference
767 767
         $return['priority'] = $access->priority;
768
-      }
768
+        }
769
+    }
769 770
     }
770
-  }
771
-  return $return;
771
+    return $return;
772 772
 }
773 773
 
774 774
 /**
775 775
  * Remove unusable 'edit' links from overview form.
776 776
  */
777 777
 function _forum_access_forum_overview(&$form, &$form_state) {
778
-  global $user;
779
-  if ($user->uid == 1) {
778
+    global $user;
779
+    if ($user->uid == 1) {
780 780
     return;
781
-  }
782
-  foreach ($form as $key => $value) {
781
+    }
782
+    foreach ($form as $key => $value) {
783 783
     if (preg_match('/^tid:(.*):0$/', $key, $matches)) {
784
-      if (!forum_access_access($matches[1], 'view', NULL, FALSE)) {
784
+        if (!forum_access_access($matches[1], 'view', NULL, FALSE)) {
785 785
         $form[$key]['edit']['#access'] = FALSE;
786 786
         if (preg_match('|<a [^>]*>([^<]*)</a>|', $form[$key]['view']['#value'], $matches)) {
787
-          $form[$key]['view']['#value'] = $matches[1];
787
+            $form[$key]['view']['#value'] = $matches[1];
788
+        }
788 789
         }
789
-      }
790 790
     }
791
-  }
791
+    }
792 792
 }
793 793
 
794 794
 /**
795 795
  * We must know when a role is deleted.
796 796
  */
797 797
 function _forum_access_user_admin_role_form(&$form, &$form_state) {
798
-  $form['#submit'][] = '_forum_access_user_admin_role_submit';
798
+    $form['#submit'][] = '_forum_access_user_admin_role_submit';
799 799
 }
800 800
 
801 801
 /**
@@ -803,14 +803,14 @@  discard block
 block discarded – undo
803 803
  * Also, we complain if the Forum Moderator role is deleted.
804 804
  */
805 805
 function _forum_access_user_admin_role_submit($form, &$form_state) {
806
-  if ($form_state['values']['op'] == $form_state['values']['delete']) {
806
+    if ($form_state['values']['op'] == $form_state['values']['delete']) {
807 807
     $rid = $form_state['values']['rid'];
808 808
     db_query("DELETE FROM {forum_access} WHERE rid = %d", $rid);
809 809
     db_query("DELETE FROM {node_access} WHERE gid = %d AND realm = 'forum_access'", $rid);
810 810
     if ($rid === forum_access_query_moderator_rid()) {
811
-      drupal_set_message(t('The role you have just deleted is required by !Forum_Access; it will be recreated automatically.', array('!Forum_Access' => 'Forum Access')), 'error');
811
+        drupal_set_message(t('The role you have just deleted is required by !Forum_Access; it will be recreated automatically.', array('!Forum_Access' => 'Forum Access')), 'error');
812
+    }
812 813
     }
813
-  }
814 814
 }
815 815
 
816 816
 /**
@@ -818,27 +818,27 @@  discard block
 block discarded – undo
818 818
  * to control the same content types as we do.
819 819
  */
820 820
 function _forum_access_content_access_admin_form() {
821
-  $tr = 't';
822
-  $variables = array(
821
+    $tr = 't';
822
+    $variables = array(
823 823
     '!Content_Access' => 'Content Access',
824 824
     '!Forum_Access' => 'Forum Access',
825 825
     '!Forum_Access_link' => l('Forum Access', 'admin/content/forum'),
826 826
     '%anonymous_user' => $tr('anonymous user'),
827 827
     '%authenticated_user' => $tr('authenticated user'),
828 828
     '%Advanced' => $tr('Advanced'),
829
-  );
830
-  if (arg(3) == 'forum') {
829
+    );
830
+    if (arg(3) == 'forum') {
831 831
     drupal_set_message(t('Note: In Drupal, access can only be granted, not taken away. Whatever access you grant here will not be reflected in the !Forum_Access_link settings, but !Forum_Access can only allow <i>more</i> access, not less.', $variables)
832
-      .'<br /><span class="error">'. t('Specifically, any rights granted to the %anonymous_user and/or the %authenticated_user will <b>override</b> the settings of !Forum_Access!', $variables) .'</span>'
833
-      .'<br />'. t('To avoid conflicts with !Forum_Access settings, you may want to lower the priority of !Content_Access (under %Advanced below) below the priority of !Forum_Access for the content types that you want to be controlled by !Forum_Access.', $variables), 'warning');
834
-  }
835
-  else {
832
+        .'<br /><span class="error">'. t('Specifically, any rights granted to the %anonymous_user and/or the %authenticated_user will <b>override</b> the settings of !Forum_Access!', $variables) .'</span>'
833
+        .'<br />'. t('To avoid conflicts with !Forum_Access settings, you may want to lower the priority of !Content_Access (under %Advanced below) below the priority of !Forum_Access for the content types that you want to be controlled by !Forum_Access.', $variables), 'warning');
834
+    }
835
+    else {
836 836
     $vid = _forum_access_get_vid();
837 837
     $vocabulary = taxonomy_vocabulary_load($vid);
838 838
     if (isset($vocabulary->nodes[arg(3)])) {
839
-      drupal_set_message(t('Note: Nodes of this content type can be put inside forums, where access to them will also be controlled by !Forum_Access.<br />In Drupal, access can only be granted, not taken away. Whatever access you grant here will not be reflected on the !Forum_Access_link settings, and vice versa, but any node access module can only allow <i>more</i> access, not less.', $variables), 'warning');
839
+        drupal_set_message(t('Note: Nodes of this content type can be put inside forums, where access to them will also be controlled by !Forum_Access.<br />In Drupal, access can only be granted, not taken away. Whatever access you grant here will not be reflected on the !Forum_Access_link settings, and vice versa, but any node access module can only allow <i>more</i> access, not less.', $variables), 'warning');
840
+    }
840 841
     }
841
-  }
842 842
 }
843 843
 
844 844
 /**
@@ -848,12 +848,12 @@  discard block
 block discarded – undo
848 848
  * admin/user/permissions.
849 849
  */
850 850
 function _forum_access_user_admin_perm_form(&$form, &$form_state) {
851
-  $moderator_rid = forum_access_query_moderator_rid();
852
-  if (isset($moderator_rid) && array_key_exists($moderator_rid, $form['role_names'])) {
851
+    $moderator_rid = forum_access_query_moderator_rid();
852
+    if (isset($moderator_rid) && array_key_exists($moderator_rid, $form['role_names'])) {
853 853
     drupal_set_message(t('The %role role is used internally by the @Forum_Access module and must not be changed!', array('%role' => $form['role_names'][$moderator_rid]['#value'], '@Forum_Access' => 'Forum Access')), 'warning', FALSE);
854 854
     $form['checkboxes'][$moderator_rid]['#disabled'] = TRUE;
855
-  }
856
-  array_unshift($form['#submit'], '_forum_access_user_admin_perm_form_submit');
855
+    }
856
+    array_unshift($form['#submit'], '_forum_access_user_admin_perm_form_submit');
857 857
 }
858 858
 
859 859
 /**
@@ -863,10 +863,10 @@  discard block
 block discarded – undo
863 863
  * before the real handler gets them.
864 864
  */
865 865
 function _forum_access_user_admin_perm_form_submit($form, &$form_state) {
866
-  $moderator_rid = forum_access_query_moderator_rid();
867
-  if (isset($moderator_rid)) {
866
+    $moderator_rid = forum_access_query_moderator_rid();
867
+    if (isset($moderator_rid)) {
868 868
     unset($form_state['values'][$moderator_rid]);
869
-  }
869
+    }
870 870
 }
871 871
 
872 872
 /**
@@ -876,10 +876,10 @@  discard block
 block discarded – undo
876 876
  * admin/user/user.
877 877
  */
878 878
 function _forum_access_user_admin_account_form(&$form, &$form_state) {
879
-  $moderator_rid = forum_access_query_moderator_rid();
880
-  if (isset($moderator_rid)) {
879
+    $moderator_rid = forum_access_query_moderator_rid();
880
+    if (isset($moderator_rid)) {
881 881
     unset($form['options']['operation']['#options'][t('Add a role to the selected users')]["add_role-$moderator_rid"]);
882
-  }
882
+    }
883 883
 }
884 884
 
885 885
 /**
@@ -888,54 +888,54 @@  discard block
 block discarded – undo
888 888
  * Disable the Forum Moderator checkbox on user/UID/edit.
889 889
  */
890 890
 function _forum_access_user_profile_form(&$form, &$form_state) {
891
-  //dpm($form, '_forum_access_user_profile_form()');
892
-  $moderator_rid = forum_access_query_moderator_rid();
893
-  if (isset($moderator_rid) && isset($form['account']['roles']['#options'][$moderator_rid])) {
891
+    //dpm($form, '_forum_access_user_profile_form()');
892
+    $moderator_rid = forum_access_query_moderator_rid();
893
+    if (isset($moderator_rid) && isset($form['account']['roles']['#options'][$moderator_rid])) {
894 894
     $form['account']['roles'][$moderator_rid] = array(
895
-      '#type' => 'checkbox',
896
-      '#title' => $form['account']['roles']['#options'][$moderator_rid] .' ('. t('reserved for internal use by the @Forum_Access module', array('@Forum_Access' => 'Forum Access')) .')',
897
-      '#default_value' => in_array($moderator_rid, $form['account']['roles']['#default_value']),
898
-      '#disabled' => TRUE,
895
+        '#type' => 'checkbox',
896
+        '#title' => $form['account']['roles']['#options'][$moderator_rid] .' ('. t('reserved for internal use by the @Forum_Access module', array('@Forum_Access' => 'Forum Access')) .')',
897
+        '#default_value' => in_array($moderator_rid, $form['account']['roles']['#default_value']),
898
+        '#disabled' => TRUE,
899 899
     );
900 900
     unset($form['account']['roles']['#options'][$moderator_rid]);
901
-  }
901
+    }
902 902
 }
903 903
 
904 904
 /**
905 905
  * Create the Forum Moderator role.
906 906
  */
907 907
 function _forum_access_create_moderator_rid($verbose = FALSE) {
908
-  $tr = 't';
909
-  $variables = array('!Forum_Access' => 'Forum Access', '%administer_comments' => $tr('administer comments'), '%administer_nodes' => $tr('administer nodes'));
910
-  $role_name = t('Forum Moderator');
911
-  $role = new stdClass();
912
-  $role->name = $role_name;
913
-  for ($i = 2; $i <= 12; ++$i) {
908
+    $tr = 't';
909
+    $variables = array('!Forum_Access' => 'Forum Access', '%administer_comments' => $tr('administer comments'), '%administer_nodes' => $tr('administer nodes'));
910
+    $role_name = t('Forum Moderator');
911
+    $role = new stdClass();
912
+    $role->name = $role_name;
913
+    for ($i = 2; $i <= 12; ++$i) {
914 914
     $variables['%role'] = $role->name;
915 915
     if (!db_result(db_query("SELECT COUNT(rid) FROM {role} WHERE name = '%s'", $role->name)) &&
916 916
         drupal_write_record('role', $role)) {
917
-      $rid = $role->rid;
918
-      variable_set('forum_access_moderator_rid', $rid);
919
-      $permission = new stdClass();
920
-      $permission->rid = $rid;
921
-      $permission->perm = 'administer comments, administer nodes, post comments, post comments without approval';
922
-      drupal_write_record('permission', $permission);
923
-      $msg = t('!Forum_Access has created a new role named %role and given it the %administer_nodes and %administer_comments permissions. This role is used internally by !Forum_Access. You can change the name of the role as you like, but you must keep it unmodified otherwise.', $variables);
924
-      if ($verbose) {
917
+        $rid = $role->rid;
918
+        variable_set('forum_access_moderator_rid', $rid);
919
+        $permission = new stdClass();
920
+        $permission->rid = $rid;
921
+        $permission->perm = 'administer comments, administer nodes, post comments, post comments without approval';
922
+        drupal_write_record('permission', $permission);
923
+        $msg = t('!Forum_Access has created a new role named %role and given it the %administer_nodes and %administer_comments permissions. This role is used internally by !Forum_Access. You can change the name of the role as you like, but you must keep it unmodified otherwise.', $variables);
924
+        if ($verbose) {
925 925
         drupal_set_message($msg, 'warning');
926
-      }
927
-      watchdog('user', $msg, NULL, WATCHDOG_NOTICE);
928
-      return $rid;
926
+        }
927
+        watchdog('user', $msg, NULL, WATCHDOG_NOTICE);
928
+        return $rid;
929 929
     }
930 930
     else {
931
-      $msg = t('!Forum_Access cannot create the %role role!', $variables);
932
-      watchdog('user', $msg, NULL, WATCHDOG_WARNING);
933
-      drupal_set_message($msg .' '. t('Is it already in use?'), 'error');
934
-      $role->name = $role_name .' '. $i;
935
-    }
936
-  }
937
-  $msg = t('!Forum_Access has given up and will not work correctly! Rename one of the roles listed above, so that !Forum_Access can use its name.', $variables);
938
-  drupal_set_message($msg, 'error');
939
-  watchdog('user', $msg, NULL, WATCHDOG_CRITICAL);
931
+        $msg = t('!Forum_Access cannot create the %role role!', $variables);
932
+        watchdog('user', $msg, NULL, WATCHDOG_WARNING);
933
+        drupal_set_message($msg .' '. t('Is it already in use?'), 'error');
934
+        $role->name = $role_name .' '. $i;
935
+    }
936
+    }
937
+    $msg = t('!Forum_Access has given up and will not work correctly! Rename one of the roles listed above, so that !Forum_Access can use its name.', $variables);
938
+    drupal_set_message($msg, 'error');
939
+    watchdog('user', $msg, NULL, WATCHDOG_CRITICAL);
940 940
 }
941 941
 
Please login to merge, or discard this patch.
Braces   +29 added lines, -41 removed lines patch added patch discarded remove patch
@@ -20,11 +20,12 @@  discard block
 block discarded – undo
20 20
   }
21 21
 
22 22
   $roles = user_roles();
23
-  if (isset($tid)) {  // edit
23
+  if (isset($tid)) {
24
+// edit
24 25
     $template_tid = variable_get('forum_access_default_template_tid', 0);
25 26
     $settings = _forum_access_get_settings($tid);
26
-  }
27
-  else {  // create
27
+  } else {
28
+// create
28 29
     $template_tid = variable_get('forum_access_new_template_tid', NULL);
29 30
     $settings = _forum_access_get_settings($template_tid);
30 31
   }
@@ -208,9 +209,11 @@  discard block
 block discarded – undo
208 209
   drupal_add_css(drupal_get_path('module', 'forum_access') .'/forum_access.css');
209 210
 
210 211
   // Find our moderator ACL:
211
-  if (isset($tid)) {  // edit, not new
212
+  if (isset($tid)) {
213
+// edit, not new
212 214
     $acl_id = acl_get_id_by_number('forum_access', $tid);
213
-    if (!$acl_id) { // create one
215
+    if (!$acl_id) {
216
+// create one
214 217
       $acl_id = acl_create_new_acl('forum_access', NULL, $tid);
215 218
       // update every existing node in this forum to use this acl.
216 219
       $result = db_query("SELECT nid FROM {term_node} WHERE tid = %d", $tid);
@@ -288,8 +291,7 @@  discard block
 block discarded – undo
288 291
           $form['forum_access']['interference']['by_content_access'][] = array(
289 292
             '#value' => '<div>'. t("Unless you really know what you're doing, we recommend that you go to the !link page and clear all checkboxes. This will instruct @Content_Access to leave the %content_type nodes alone. However, if you put nodes of other content types into forums as well, then these content types will continue to have this problem.", $variables) .'</div>',
290 293
           );
291
-        }
292
-        else {
294
+        } else {
293 295
           $form['forum_access']['interference']['by_content_access'][] = array(
294 296
             '#value' => '<div>'. t("The priority of @Content_Access ($ca_priority) is higher than the priority of !Forum_Access ($fa_priority), which means the latter is <strong>completely disabled</strong> for the %content_type type! Unless you really know what you're doing, we recommend that you go to the !link page, change the priority (under %Advanced) to 0, and clear all checkboxes.", $variables) .'</div>',
295 297
           );
@@ -297,8 +299,7 @@  discard block
 block discarded – undo
297 299
         $form['forum_access']['interference']['by_content_access'][] = array(
298 300
           '#value' => '<div>'. t("Alternatively, you can give !Forum_Access priority over @Content_Access by either raising the priority of !Forum_Access in every forum above the priority of @Content_Access, or by lowering the priority of @Content_Access for the content types in question below the priority of !Forum_Access.", $variables) .'</div>',
299 301
         );
300
-      }
301
-      else {
302
+      } else {
302 303
         $form['forum_access']['interference'][] = array(
303 304
           '#value' => '<p>'. t('Note: You have installed the !Content_Access module, which has the capability to grant access to content that would otherwise be protected by !Forum_Access. Be careful when configuring @Content_Access!', $variables) .'</p>',
304 305
         );
@@ -445,21 +446,17 @@  discard block
 block discarded – undo
445 446
       $element[$rid]['#suffix'] = "</span>";
446 447
       $element[$rid]['#default_value'] = TRUE;
447 448
       $element[$rid]['#disabled'] = TRUE;
448
-    }
449
-    elseif ($element['#parents'][1] == 'create') {
449
+    } elseif ($element['#parents'][1] == 'create') {
450 450
       // Do nothing (Post is always mutable).
451
-    }
452
-    elseif ($element['#parents'][1] == 'comment_create') {
453
-    }
454
-    elseif ($element['#parents'][1] == 'view' && isset($permissions[$rid]['administer forums'])) {
451
+    } elseif ($element['#parents'][1] == 'comment_create') {
452
+    } elseif ($element['#parents'][1] == 'view' && isset($permissions[$rid]['administer forums'])) {
455 453
       $element[$rid]['#title'] = '<em>'. $element[$rid]['#title'] .'</em>';
456 454
       $element[$rid]['#prefix'] = '<span title="'. t("This role has the '@administer_forums' permission, and granting '@View' enables the role holders to change the settings on this page, including @Access_control!", array('@administer_forums' => $tr('administer forums'), '@View' => t('View'), '@Access_control' => t('Access control'))) .'">';
457 455
       if (isset($permissions[$rid]['administer nodes'])) {
458 456
         $element[$rid]['#prefix'] = str_replace('">', ' '. t("Because the role also has the '@administer_nodes' permission, it has full access to all nodes either way.", array('@administer_nodes' => $tr('administer nodes'))) .'">', $element[$rid]['#prefix']);
459 457
       }
460 458
       $element[$rid]['#suffix'] = "</span>";
461
-    }
462
-    elseif (isset($permissions[$rid]['administer nodes'])) {
459
+    } elseif (isset($permissions[$rid]['administer nodes'])) {
463 460
       $element[$rid]['#disabled'] = TRUE;
464 461
       $element[$rid]['#default_value'] = TRUE;
465 462
       $element[$rid]['#prefix'] = '<span title="'. ($rid != $moderator_rid
@@ -515,8 +512,7 @@  discard block
 block discarded – undo
515 512
     if ($settings['priority'] != 0) {
516 513
       $form['interference']['advanced']['#collapsed'] = FALSE;
517 514
     }
518
-  }
519
-  elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) {
515
+  } elseif (is_array(reset($form_state['values']['forum_access']['template']['taxonomy']))) {
520 516
       $imv = reset($form_state['values']['forum_access']['template']['taxonomy']);
521 517
     $template_tid = reset($imv);
522 518
   }
@@ -549,14 +545,12 @@  discard block
 block discarded – undo
549 545
   $template_tid = reset(array_values($access['template']['taxonomy']));
550 546
   if ($access['template']['select_by_default']) {
551 547
     variable_set('forum_access_default_template_tid', $template_tid);
552
-  }
553
-  elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) {
548
+  } elseif (variable_get('forum_access_default_template_tid', 0) == $template_tid) {
554 549
     variable_del('forum_access_default_template_tid');
555 550
   }
556 551
   if ($access['template']['load_for_new']) {
557 552
     variable_set('forum_access_new_template_tid', $template_tid);
558
-  }
559
-  elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) {
553
+  } elseif (variable_get('forum_access_new_template_tid', 0) == $template_tid) {
560 554
     variable_del('forum_access_new_template_tid');
561 555
   }
562 556
   module_load_include('node.inc', 'forum_access');
@@ -598,8 +592,7 @@  discard block
 block discarded – undo
598 592
       // We prefer not to save records for node administrators, because these have access anyway.
599 593
       if (isset($permissions[$rid]['administer forums']) && $access['view'][$rid]) {
600 594
         // For forum administrators, View needs to be saved, ...
601
-      }
602
-      else {
595
+      } else {
603 596
         // ... otherwise forget View.
604 597
         $access['view'][$rid] = FALSE;
605 598
       }
@@ -607,8 +600,7 @@  discard block
 block discarded – undo
607 600
         db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)",
608 601
         $tid, $rid, !empty($access['view'][$rid]), 0, 0, !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority);
609 602
       }
610
-    }
611
-    else {
603
+    } else {
612 604
       db_query("INSERT INTO {forum_access} (tid, rid, grant_view, grant_update, grant_delete, grant_create, grant_comment_create, priority) VALUES (%d, %d, %d, %d, %d, %d, %d, %d)",
613 605
       $tid, $rid, (bool) $checked, !empty($access['update'][$rid]), !empty($access['delete'][$rid]), !empty($access['create'][$rid]), !empty($access['comment_create'][$rid]), $fa_priority);
614 606
     }
@@ -620,8 +612,7 @@  discard block
 block discarded – undo
620 612
   if (!$is_new && $form_state['values']['form_id'] != 'forum_form_container') {
621 613
     if (!isset($access['update_choice']) || $access['update_choice'] == 2) {
622 614
       node_access_needs_rebuild(TRUE);
623
-    }
624
-    elseif ($access['update_choice'] == 0) {
615
+    } elseif ($access['update_choice'] == 0) {
625 616
       // update immediately (but use the batch functions anyway
626 617
       $save_redirect = $form_state['redirect'];
627 618
       $form_state['redirect'] = $_GET['q'];
@@ -632,13 +623,13 @@  discard block
 block discarded – undo
632 623
       _forum_access_update_batch_operation($tid, 999999, 1, $context);
633 624
       $pending_error_messages = drupal_get_messages('error', TRUE);       // still alive, get and clear all 'error' messages
634 625
       unset($pending_error_messages['error'][$our_error_message_index]);  // remove our error message
635
-      foreach ($pending_error_messages['error'] as $message) {            // replay any others
626
+      foreach ($pending_error_messages['error'] as $message) {
627
+// replay any others
636 628
         drupal_set_message($message, 'error');
637 629
       }
638 630
       _forum_access_update_batch_finished(TRUE, array(), array());
639 631
       $form_state['redirect'] = $save_redirect;
640
-    }
641
-    else {
632
+    } else {
642 633
       // mass update in batch mode, modeled after node.module
643 634
       $limit = $access['update_limit'];
644 635
       $count = db_result(db_query("SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid WHERE tn.tid = %d", $tid));
@@ -698,8 +689,7 @@  discard block
 block discarded – undo
698 689
   if ($success) {
699 690
     drupal_set_message(t('The content access permissions have been updated.'));
700 691
     cache_clear_all();
701
-  }
702
-  else {
692
+  } else {
703 693
     drupal_set_message(t('The content access permissions have not been properly updated.'), 'error');
704 694
   }
705 695
 }
@@ -744,8 +734,7 @@  discard block
 block discarded – undo
744 734
     $return['view'] = array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID);
745 735
     $return['create'] = array(DRUPAL_AUTHENTICATED_RID);
746 736
     $return['comment_create'] = array(DRUPAL_AUTHENTICATED_RID);
747
-  }
748
-  else {
737
+  } else {
749 738
     $result = db_query("SELECT * FROM {forum_access} where tid = %d", $tid);
750 739
     while ($access = db_fetch_object($result)) {
751 740
       if ($access->grant_view) {
@@ -763,7 +752,8 @@  discard block
 block discarded – undo
763 752
       if ($access->grant_comment_create) {
764 753
         $return['comment_create'][] = $access->rid;
765 754
       }
766
-      if ($access->rid == DRUPAL_AUTHENTICATED_RID) {  // this is our reference
755
+      if ($access->rid == DRUPAL_AUTHENTICATED_RID) {
756
+// this is our reference
767 757
         $return['priority'] = $access->priority;
768 758
       }
769 759
     }
@@ -831,8 +821,7 @@  discard block
 block discarded – undo
831 821
     drupal_set_message(t('Note: In Drupal, access can only be granted, not taken away. Whatever access you grant here will not be reflected in the !Forum_Access_link settings, but !Forum_Access can only allow <i>more</i> access, not less.', $variables)
832 822
       .'<br /><span class="error">'. t('Specifically, any rights granted to the %anonymous_user and/or the %authenticated_user will <b>override</b> the settings of !Forum_Access!', $variables) .'</span>'
833 823
       .'<br />'. t('To avoid conflicts with !Forum_Access settings, you may want to lower the priority of !Content_Access (under %Advanced below) below the priority of !Forum_Access for the content types that you want to be controlled by !Forum_Access.', $variables), 'warning');
834
-  }
835
-  else {
824
+  } else {
836 825
     $vid = _forum_access_get_vid();
837 826
     $vocabulary = taxonomy_vocabulary_load($vid);
838 827
     if (isset($vocabulary->nodes[arg(3)])) {
@@ -926,8 +915,7 @@  discard block
 block discarded – undo
926 915
       }
927 916
       watchdog('user', $msg, NULL, WATCHDOG_NOTICE);
928 917
       return $rid;
929
-    }
930
-    else {
918
+    } else {
931 919
       $msg = t('!Forum_Access cannot create the %role role!', $variables);
932 920
       watchdog('user', $msg, NULL, WATCHDOG_WARNING);
933 921
       drupal_set_message($msg .' '. t('Is it already in use?'), 'error');
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/forum_access/forum_access.node.inc 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,23 +49,20 @@  discard block
 block discarded – undo
49 49
   foreach ($form['taxonomy'][$vid]['#options'] as $tid => $name) {
50 50
     if (!is_numeric($tid)) {
51 51
       $options[$tid] = $name;
52
-    }
53
-    elseif (is_object($name)) {
52
+    } elseif (is_object($name)) {
54 53
       foreach ($name->option as $sub_tid => $sub_name) {
55 54
         if (!empty($tids[$sub_tid])) {
56 55
           $options[$tid]->option[$sub_tid] = $sub_name;
57 56
         }
58 57
       }
59
-    }
60
-    elseif ($tids[$tid]) {
58
+    } elseif ($tids[$tid]) {
61 59
       $options[$tid] = $name;
62 60
     }
63 61
   }
64 62
 
65 63
   if ($options) {
66 64
     $form['taxonomy'][$vid]['#options'] = $options;
67
-  }
68
-  else {
65
+  } else {
69 66
     unset($form['taxonomy'][$vid]);
70 67
   }
71 68
 
@@ -135,8 +132,7 @@  discard block
 block discarded – undo
135 132
                 }
136 133
             break;
137 134
         }//switch arg(0)
138
-      }
139
-      else {
135
+      } else {
140 136
         if (isset($form['admin']) && !empty($user->_forum_access_moderator)) {
141 137
           foreach (element_children($form['admin']) as $key) {
142 138
             if ($key != 'status') {
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -13,64 +13,64 @@  discard block
 block discarded – undo
13 13
  * Rewrite the taxonomy item on the node form.
14 14
  */
15 15
 function _forum_access_node_form(&$form, &$form_state) {
16
-  global $user;
17
-  $vid = _forum_access_get_vid();
16
+    global $user;
17
+    $vid = _forum_access_get_vid();
18 18
 
19
-  if (!isset($form['taxonomy'][$vid]['#options'])) {
19
+    if (!isset($form['taxonomy'][$vid]['#options'])) {
20 20
     return;
21
-  }
21
+    }
22 22
 
23
-  // True node administrators are all powerful and do NOT get their forms rewritten here.
24
-  if (user_access('administer nodes') && empty($user->_forum_access_moderator)) {
23
+    // True node administrators are all powerful and do NOT get their forms rewritten here.
24
+    if (user_access('administer nodes') && empty($user->_forum_access_moderator)) {
25 25
     return;
26
-  }
26
+    }
27 27
 
28
-  $roles = array_keys($user->roles);
29
-  $result = db_query("SELECT tid FROM {forum_access} WHERE rid IN (". db_placeholders($roles) .") AND grant_create = 1", $roles);
30
-  while ($obj = db_fetch_object($result)) {
28
+    $roles = array_keys($user->roles);
29
+    $result = db_query("SELECT tid FROM {forum_access} WHERE rid IN (". db_placeholders($roles) .") AND grant_create = 1", $roles);
30
+    while ($obj = db_fetch_object($result)) {
31 31
     $tids[$obj->tid] = $obj->tid;
32
-  }
32
+    }
33 33
 
34
-  // Also get all forums they happen to be able to moderate.
35
-  $result = db_query("SELECT a.number AS tid FROM {acl} a INNER JOIN {acl_user} u ON a.acl_id = u.acl_id WHERE a.module = 'forum_access' AND u.uid = %d", $user->uid);
36
-  while ($obj = db_fetch_object($result)) {
34
+    // Also get all forums they happen to be able to moderate.
35
+    $result = db_query("SELECT a.number AS tid FROM {acl} a INNER JOIN {acl_user} u ON a.acl_id = u.acl_id WHERE a.module = 'forum_access' AND u.uid = %d", $user->uid);
36
+    while ($obj = db_fetch_object($result)) {
37 37
     $tids[$obj->tid] = $obj->tid;
38
-  }
38
+    }
39 39
 
40
-  // Ensure the forum they're trying to post to directly is allowed, otherwise
41
-  // there will be much confusion.
42
-  $forum_tid = arg(3);
43
-  if (isset($forum_tid) && is_numeric($forum_tid) && !isset($tids[$forum_tid])) {
40
+    // Ensure the forum they're trying to post to directly is allowed, otherwise
41
+    // there will be much confusion.
42
+    $forum_tid = arg(3);
43
+    if (isset($forum_tid) && is_numeric($forum_tid) && !isset($tids[$forum_tid])) {
44 44
     drupal_access_denied();
45 45
     module_invoke_all('exit');
46 46
     exit;
47
-  }
47
+    }
48 48
 
49
-  foreach ($form['taxonomy'][$vid]['#options'] as $tid => $name) {
49
+    foreach ($form['taxonomy'][$vid]['#options'] as $tid => $name) {
50 50
     if (!is_numeric($tid)) {
51
-      $options[$tid] = $name;
51
+        $options[$tid] = $name;
52 52
     }
53 53
     elseif (is_object($name)) {
54
-      foreach ($name->option as $sub_tid => $sub_name) {
54
+        foreach ($name->option as $sub_tid => $sub_name) {
55 55
         if (!empty($tids[$sub_tid])) {
56
-          $options[$tid]->option[$sub_tid] = $sub_name;
56
+            $options[$tid]->option[$sub_tid] = $sub_name;
57
+        }
57 58
         }
58
-      }
59 59
     }
60 60
     elseif ($tids[$tid]) {
61
-      $options[$tid] = $name;
61
+        $options[$tid] = $name;
62
+    }
62 63
     }
63
-  }
64 64
 
65
-  if ($options) {
65
+    if ($options) {
66 66
     $form['taxonomy'][$vid]['#options'] = $options;
67
-  }
68
-  else {
67
+    }
68
+    else {
69 69
     unset($form['taxonomy'][$vid]);
70
-  }
70
+    }
71 71
 
72
-  // Apply modifications for Moderators (by role or uid).
73
-  if (!empty($user->_forum_access_moderator)) {
72
+    // Apply modifications for Moderators (by role or uid).
73
+    if (!empty($user->_forum_access_moderator)) {
74 74
     // We gave this user the 'administer nodes' permission, which he doesn't
75 75
     // normally have. Remove controls that should be reserved to true node
76 76
     // administrators.
@@ -78,31 +78,31 @@  discard block
 block discarded – undo
78 78
     $allowed_elements = variable_get('forum_access_allowed_node_edit_elements', array('nid', 'vid', 'uid', 'created', 'type', 'changed', 'title', 'shadow', 'body_field', 'revision_information', 'form_build_id', 'form_token', 'form_id', 'comment_settings', 'taxonomy', 'attachments'));
79 79
     $allowed_options = variable_get('forum_access_allowed_node_edit_options', array('status', 'sticky', 'subscriptions_notify'));
80 80
     foreach (element_children($form) as $key) {
81
-      switch ($key) {
81
+        switch ($key) {
82 82
         case 'options':
83 83
           foreach (element_children($form[$key]) as $key2) {
84 84
             if (array_search($key2, $allowed_options) === FALSE) {
85
-              $form[$key][$key2]['#access'] = FALSE;
85
+                $form[$key][$key2]['#access'] = FALSE;
86
+            }
86 87
             }
87
-          }
88
-          break;
88
+            break;
89 89
         case 'buttons':
90 90
           $tid = $form['taxonomy'][$vid]['#default_value'][0];
91
-          if (!forum_access_access($tid, 'update')) {
91
+            if (!forum_access_access($tid, 'update')) {
92 92
             $form['buttons']['submit']['#access'] = FALSE;
93 93
             $form['buttons']['preview']['#access'] = FALSE;
94
-          }
95
-          if (!forum_access_access($tid, 'delete')) {
94
+            }
95
+            if (!forum_access_access($tid, 'delete')) {
96 96
             $form['buttons']['delete']['#access'] = FALSE;
97
-          }
98
-          break;
97
+            }
98
+            break;
99 99
         default:
100 100
           if (array_search($key, $allowed_elements) === FALSE) {
101 101
             $form[$key]['#access'] = FALSE;
102
-          }
103
-      }
102
+            }
103
+        }
104
+    }
104 105
     }
105
-  }
106 106
 }
107 107
 
108 108
 /**
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
  * and sanitize the Administration options for users with Edit grants.
115 115
  */
116 116
 function _forum_access_comment_form(&$form, &$form_state) {
117
-  global $user;
118
-  if ($user->uid != 1 && isset($form['nid']['#value'])) {
117
+    global $user;
118
+    if ($user->uid != 1 && isset($form['nid']['#value'])) {
119 119
     $node = node_load($form['nid']['#value']);
120 120
     if ($tid = _forum_access_get_tid($node)) {
121
-      if (!forum_access_access($tid, 'comment_create') and !(forum_access_access($tid, 'create') and ($node->uid==$user->uid)) ) {
121
+        if (!forum_access_access($tid, 'comment_create') and !(forum_access_access($tid, 'create') and ($node->uid==$user->uid)) ) {
122 122
         switch (arg(0)) {
123
-          case 'node':
123
+            case 'node':
124 124
               // Remove the in-line comment form, replace with text message to user.
125 125
               $form = NULL;
126
-              $form['from'] = array(
127
-                  '#type'  => 'item',
128
-                  '#value' => 'You do not have permission to post comments in this forum.',);
126
+                $form['from'] = array(
127
+                    '#type'  => 'item',
128
+                    '#value' => 'You do not have permission to post comments in this forum.',);
129 129
             break;
130 130
             case 'comment':
131 131
                 if (arg(1)=='reply') {
@@ -135,38 +135,38 @@  discard block
 block discarded – undo
135 135
                 }
136 136
             break;
137 137
         }//switch arg(0)
138
-      }
139
-      else {
138
+        }
139
+        else {
140 140
         if (isset($form['admin']) && !empty($user->_forum_access_moderator)) {
141
-          foreach (element_children($form['admin']) as $key) {
141
+            foreach (element_children($form['admin']) as $key) {
142 142
             if ($key != 'status') {
143
-              $form['admin'][$key]['#access'] = FALSE;
143
+                $form['admin'][$key]['#access'] = FALSE;
144 144
             }
145
-          }
145
+            }
146
+        }
146 147
         }
147
-      }
148 148
     }
149
-  }
149
+    }
150 150
 }
151 151
 
152 152
 /*
153 153
  * Give the user the 'administer nodes' and 'administer comments' permissions for this request.
154 154
  */
155 155
 function _forum_access_enable_moderator() {
156
-  global $user;
157
-  $rid = _forum_access_get_moderator_rid();
158
-  $user->roles[$rid] = '(forum_access temporary)';
159
-  user_access('', NULL, TRUE); // clear the permissions cache to activate the new role
156
+    global $user;
157
+    $rid = _forum_access_get_moderator_rid();
158
+    $user->roles[$rid] = '(forum_access temporary)';
159
+    user_access('', NULL, TRUE); // clear the permissions cache to activate the new role
160 160
 }
161 161
 
162 162
 /*
163 163
  * Remove the moderator permissions.
164 164
  */
165 165
 function _forum_access_disable_moderator() {
166
-  global $user;
167
-  $rid = _forum_access_get_moderator_rid();
168
-  unset($user->roles[$rid]);
169
-  user_access('', NULL, TRUE); // clear the permissions cache to revert to normal
166
+    global $user;
167
+    $rid = _forum_access_get_moderator_rid();
168
+    unset($user->roles[$rid]);
169
+    user_access('', NULL, TRUE); // clear the permissions cache to revert to normal
170 170
 }
171 171
 
172 172
 /*
@@ -174,26 +174,26 @@  discard block
 block discarded – undo
174 174
  * then create it.
175 175
  */
176 176
 function _forum_access_get_moderator_rid($verbose = FALSE) {
177
-  $rid = forum_access_query_moderator_rid();
178
-  if ($rid !== NULL) {
177
+    $rid = forum_access_query_moderator_rid();
178
+    if ($rid !== NULL) {
179 179
     if (db_result(db_query("SELECT COUNT(rid) FROM {role} WHERE rid = %d", $rid)) == 1) {
180
-      return $rid;
180
+        return $rid;
181
+    }
181 182
     }
182
-  }
183
-  module_load_include('admin.inc', 'forum_access');
184
-  return _forum_access_create_moderator_rid($verbose);
183
+    module_load_include('admin.inc', 'forum_access');
184
+    return _forum_access_create_moderator_rid($verbose);
185 185
 }
186 186
 
187 187
 /*
188 188
  * Return the roles for forum_access_node_access_explain().
189 189
  */
190 190
 function _forum_access_get_all_roles() {
191
-  $roles = user_roles();
192
-  $moderator_rid = forum_access_query_moderator_rid();
193
-  if (isset($roles[$moderator_rid])) {
191
+    $roles = user_roles();
192
+    $moderator_rid = forum_access_query_moderator_rid();
193
+    if (isset($roles[$moderator_rid])) {
194 194
     $roles[$moderator_rid] .= ' '. t('(!Forum_Access temporary role, does not need any grants.)', array('!Forum_Access' => 'Forum Access'));
195
-  }
196
-  return $roles;
195
+    }
196
+    return $roles;
197 197
 }
198 198
 
199 199
 /**
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
  * remove those that aren't accessible to the user (pre-D6.17).
202 202
  */
203 203
 function _forum_access_preprocess_comment(&$variables) {
204
-  global $user;
205
-  if (!empty($user->_forum_access_moderator)) {
204
+    global $user;
205
+    if (!empty($user->_forum_access_moderator)) {
206 206
     _forum_access_enable_moderator(); // this allows us to retrieve the comment links (without setting precedent!)
207
-  }
207
+    }
208 208
 
209
-  $tid = $variables['node']->tid;
210
-  $links = module_invoke_all('link', 'comment', $variables['comment'], 0);
211
-  if (!empty($user->_forum_access_moderator) && arg(0) == 'node' && arg(2) == NULL) {
209
+    $tid = $variables['node']->tid;
210
+    $links = module_invoke_all('link', 'comment', $variables['comment'], 0);
211
+    if (!empty($user->_forum_access_moderator) && arg(0) == 'node' && arg(2) == NULL) {
212 212
     _forum_access_disable_moderator();
213
-  }
213
+    }
214 214
 
215
-  if (isset($links['comment_reply']) && (!preg_match('#<li class="[^"]*comment_reply[^"]*".*</li>#U', $variables['links']) || !user_access('post comments') || !forum_access_access($tid, 'comment_create', NULL, FALSE))) {
215
+    if (isset($links['comment_reply']) && (!preg_match('#<li class="[^"]*comment_reply[^"]*".*</li>#U', $variables['links']) || !user_access('post comments') || !forum_access_access($tid, 'comment_create', NULL, FALSE))) {
216 216
     unset($links['comment_reply']);
217
-  }
218
-  if (isset($links['comment_edit']) && !forum_access_access($tid, 'update', NULL, FALSE) && !comment_access('edit', $variables['comment'])) {
217
+    }
218
+    if (isset($links['comment_edit']) && !forum_access_access($tid, 'update', NULL, FALSE) && !comment_access('edit', $variables['comment'])) {
219 219
     unset($links['comment_edit']);
220
-  }
221
-  if (isset($links['comment_delete']) && !forum_access_access($tid, 'delete', NULL, FALSE) && !user_access('administer comments')) {
220
+    }
221
+    if (isset($links['comment_delete']) && !forum_access_access($tid, 'delete', NULL, FALSE) && !user_access('administer comments')) {
222 222
     unset($links['comment_delete']);
223
-  }
224
-  foreach (array_keys($links) as $link) {
223
+    }
224
+    foreach (array_keys($links) as $link) {
225 225
     if (!in_array($link, array('comment_reply', 'comment_edit', 'comment_delete'))) {
226
-      $link_preg_quote = preg_quote($link, '#');
227
-      if (!preg_match('#<li class="[^"]*'. $link_preg_quote .'[^"]*"(.|\n)*</li>#U', $variables['links'])) {
226
+        $link_preg_quote = preg_quote($link, '#');
227
+        if (!preg_match('#<li class="[^"]*'. $link_preg_quote .'[^"]*"(.|\n)*</li>#U', $variables['links'])) {
228 228
         unset($links[$link]); // eliminate possible additional unknown links that came in for 'administer_comments'
229
-      }
229
+        }
230
+    }
230 231
     }
231
-  }
232 232
 
233
-  drupal_alter('link', $links, $variables['node'], $variables['comment']);
233
+    drupal_alter('link', $links, $variables['node'], $variables['comment']);
234 234
 
235
-  if (empty($links)) {
235
+    if (empty($links)) {
236 236
     $links['comment_forbidden'] = array(
237
-      'title' => theme('comment_post_forbidden', $variables['node']),
238
-      'html'  => TRUE,
237
+        'title' => theme('comment_post_forbidden', $variables['node']),
238
+        'html'  => TRUE,
239 239
     );
240
-  }
241
-  $variables['links'] = theme('links', $links);
240
+    }
241
+    $variables['links'] = theme('links', $links);
242 242
 }
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/i18nviews/includes/i18nviews.views.inc 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,47 +1,47 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 function i18nviews_views_data() {
4
-  $data['node']['content_negotiation'] = array(
4
+    $data['node']['content_negotiation'] = array(
5 5
     'group' => t('Node translation'),
6 6
     'title' => t('Content negotiation'),
7 7
     'help' => t('Removes the nodes that are not valid according to the content selection mode.'),
8 8
     'filter' => array(
9
-      'handler' => 'content_negotiation_filter_handler',
9
+        'handler' => 'content_negotiation_filter_handler',
10 10
     ),
11
-  );
12
-  return $data;
11
+    );
12
+    return $data;
13 13
 }
14 14
 
15 15
 /**
16 16
  * Implementation of hook_views_handlers
17 17
  */
18 18
 function i18nviews_views_handlers() {
19
-  return array(
19
+    return array(
20 20
     'info' => array(
21
-      'path' => drupal_get_path('module', 'i18nviews') . '/includes',
21
+        'path' => drupal_get_path('module', 'i18nviews') . '/includes',
22 22
     ),
23 23
     'handlers' => array(
24
-      'content_negotiation_filter_handler' => array(
24
+        'content_negotiation_filter_handler' => array(
25 25
         'parent' => 'views_handler_filter',
26
-      ),
26
+        ),
27 27
     ),
28
-  );
28
+    );
29 29
 }
30 30
 
31 31
 /**
32 32
  * Implementation of hook_views_plugins().
33 33
  */
34 34
 function i18nviews_views_plugins() {
35
-  $path = drupal_get_path('module', 'i18nviews') . '/includes';
36
-  return array(
35
+    $path = drupal_get_path('module', 'i18nviews') . '/includes';
36
+    return array(
37 37
     'module' => 'i18nviews',
38 38
     'localization' => array(
39
-      'i18nstrings' => array(
39
+        'i18nstrings' => array(
40 40
         'title' => t('Views translation module'),
41 41
         'help' => t("Use the locale system as implemented by the Views translation module."),
42 42
         'handler' => 'views_plugin_localization_i18nstrings',
43 43
         'path' => $path,
44
-      ),
44
+        ),
45 45
     ),
46
-  );
46
+    );
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
modules/contrib/i18nviews/includes/content_negotiation_filter_handler.inc 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class content_negotiation_filter_handler extends views_handler_filter {
4
-  function query() {
4
+    function query() {
5 5
     $this->ensure_my_table();
6 6
     $where = i18n_db_rewrite_where($this->table_alias, 'node');
7 7
     if (!empty($where)) {
8
-      $this->query->add_where($this->options['group'], $where);
8
+        $this->query->add_where($this->options['group'], $where);
9
+    }
9 10
     }
10
-  }
11 11
 
12
-  function option_definition() {
12
+    function option_definition() {
13 13
     $options = parent::option_definition();
14 14
     $options['operator']['default'] = '';
15 15
     $options['value']['default'] = '';
16 16
     return $options;
17
-  }
17
+    }
18 18
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/i18nviews/i18nviews.module 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -14,44 +14,44 @@  discard block
 block discarded – undo
14 14
  * Implementation of hook_help().
15 15
  */
16 16
 function i18nviews_help($path, $arg) {
17
-  switch ($path) {
17
+    switch ($path) {
18 18
     case 'admin/modules#description' :
19 19
       $output = '<p>'. t('Supports translation for views strings: title, header, footer...') .'</p>';
20
-      $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
21
-      return $output;
22
-  }
20
+        $output .= '<p>'. t('To search and translate strings, use the <a href="@translate-interface">translation interface</a> pages.', array('@translate-interface' => url('admin/build/translate'))) .'</p>';
21
+        return $output;
22
+    }
23 23
 }
24 24
 
25 25
 /**
26 26
  * Implementation of hook_locale().
27 27
  */
28 28
 function i18nviews_locale($op = 'groups') {
29
-  switch ($op) {
29
+    switch ($op) {
30 30
     case 'groups':
31 31
       return array('views' => t('Views'));
32 32
     case 'info':
33 33
       $info['views']['refresh callback'] = 'i18nviews_locale_refresh';
34
-      $info['views']['format'] = TRUE;
35
-      return $info;
36
-  }
34
+        $info['views']['format'] = TRUE;
35
+        return $info;
36
+    }
37 37
 }
38 38
 
39 39
 /**
40 40
  * Refresh views locales, 2.x version
41 41
  */
42 42
 function i18nviews_locale_refresh() {
43
-  $views = views_get_all_views();
44
-  foreach ($views as $view) {
43
+    $views = views_get_all_views();
44
+    foreach ($views as $view) {
45 45
     if (!$view->disabled) {
46
-      $fields = _i18nviews_display_fields();
47
-      if (!empty($view->display) && is_array($view->display)) {
46
+        $fields = _i18nviews_display_fields();
47
+        if (!empty($view->display) && is_array($view->display)) {
48 48
         foreach (array_keys($view->display) as $display_id) {
49
-          _i18nviews_localize_array($view->name, $display_id, $view->display[$display_id]->display_options, $fields, TRUE);
49
+            _i18nviews_localize_array($view->name, $display_id, $view->display[$display_id]->display_options, $fields, TRUE);
50
+        }
50 51
         }
51
-      }
52 52
     }
53
-  }
54
-  return TRUE; // Completed successfully
53
+    }
54
+    return TRUE; // Completed successfully
55 55
 }
56 56
 
57 57
 /**
@@ -60,37 +60,37 @@  discard block
 block discarded – undo
60 60
  * Remake of views_handler_field_allterms with term name translation.
61 61
  */
62 62
 function i18nviews_views_handler_field_allterms($fieldinfo, $fielddata, $value, $data) {
63
-  if ($fieldinfo['vocabulary']) {
63
+    if ($fieldinfo['vocabulary']) {
64 64
     $terms = taxonomy_node_get_terms_by_vocabulary($data->nid, $fieldinfo['vocabulary']);
65
-  }
66
-  else {
65
+    }
66
+    else {
67 67
     $terms = taxonomy_node_get_terms($data->nid);
68
-  }
69
-  // Translate all these terms.
70
-  _i18ntaxonomy_translate_terms($terms);
68
+    }
69
+    // Translate all these terms.
70
+    _i18ntaxonomy_translate_terms($terms);
71 71
 
72
-  if ($fielddata['options'] == 'nolink') {
72
+    if ($fielddata['options'] == 'nolink') {
73 73
     foreach ($terms as $term) {
74
-      $links[] = check_plain($term->name);
74
+        $links[] = check_plain($term->name);
75 75
     }
76 76
     $links = !empty($links) ? implode(' | ', $links) : '';
77
-  }
78
-  else {
77
+    }
78
+    else {
79 79
     $node = new stdClass();
80 80
     $node->taxonomy = $terms;
81 81
     $links = theme('links', taxonomy_link('taxonomy terms', $node));
82
-  }
83
-  return $links;
82
+    }
83
+    return $links;
84 84
 }
85 85
 
86 86
 /**
87 87
  * Implementation of hook_views_api().
88 88
  */
89 89
 function i18nviews_views_api() {
90
-  return array(
90
+    return array(
91 91
     'api' => '2.0',
92 92
     'path' => drupal_get_path('module', 'i18nviews') . '/includes',
93
-  );
93
+    );
94 94
 }
95 95
 
96 96
 /**
@@ -105,38 +105,38 @@  discard block
 block discarded – undo
105 105
  * This is just for views 2.x, next version (3.x) will use a different one
106 106
  */
107 107
 function i18nviews_views_pre_view(&$view, &$display_id, &$args) {
108
-  global $language;
109
-  if (views_api_version() == '2.0' && $language->language != language_default('language')) {
108
+    global $language;
109
+    if (views_api_version() == '2.0' && $language->language != language_default('language')) {
110 110
     // Also checking weird values for $display_id, see 277711
111 111
     if (!empty($view->display) && is_array($view->display) && is_string($display_id)) {
112
-      $fields = _i18nviews_display_fields();
113
-      if(!empty($view->display[$display_id])) {
112
+        $fields = _i18nviews_display_fields();
113
+        if(!empty($view->display[$display_id])) {
114 114
         $fields = _i18nviews_localize_array($view->name, $display_id, $view->display[$display_id]->handler->options, $fields);
115
-      }
116
-      if($fields && !empty($view->display['default'])) {
115
+        }
116
+        if($fields && !empty($view->display['default'])) {
117 117
         _i18nviews_localize_array($view->name, 'default', $view->display['default']->handler->options, $fields);
118
-      }      
118
+        }      
119 119
     }
120 120
     // Translate taxonomy fields.
121 121
     // @todo I don think this works at all.
122 122
     if (module_exists('i18ntaxonomy') && isset($view->field) && is_array($view->field)) {
123
-      $translate = variable_get('i18ntaxonomy_vocabularies', array());
124
-      foreach ($view->field as $index => $data) {
123
+        $translate = variable_get('i18ntaxonomy_vocabularies', array());
124
+        foreach ($view->field as $index => $data) {
125 125
         $matches = array();
126 126
         if ($data['id'] == 'term_node.name') {
127
-          // That's a full taxonomy box.
128
-          $view->field[$index]['handler'] = 'i18ntaxonomy_views_handler_field_allterms';
127
+            // That's a full taxonomy box.
128
+            $view->field[$index]['handler'] = 'i18ntaxonomy_views_handler_field_allterms';
129 129
         }
130 130
         elseif (preg_match("/term_node_(\d+)\.name/", $data['id'], $matches)) {
131
-          $vid = $matches[1];
132
-          if ($translate[$vid]) {
131
+            $vid = $matches[1];
132
+            if ($translate[$vid]) {
133 133
             // Set new handler for this field.
134 134
             $view->field[$index]['handler'] = 'i18ntaxonomy_views_handler_field_allterms';
135
-          }
135
+            }
136
+        }
136 137
         }
137
-      }
138 138
     }
139
-  }
139
+    }
140 140
 }
141 141
 
142 142
 /**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
  *   Array of field names.
147 147
  */
148 148
 function _i18nviews_display_fields() {
149
-  return array('title', 'header', 'footer', 'empty');
149
+    return array('title', 'header', 'footer', 'empty');
150 150
 }
151 151
 
152 152
 /**
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
  * We get the translated fields out of the array so they are not translated again.
156 156
  */
157 157
 function _i18nviews_localize_array($name, $group, &$data, $field_names, $update = FALSE) {
158
-  $translated = array();
159
-  foreach ($field_names as $field) {
158
+    $translated = array();
159
+    foreach ($field_names as $field) {
160 160
     if (!empty($data[$field])) {
161
-      if ($update) {
161
+        if ($update) {
162 162
         $format = isset($data[$field . '_format']) ? $data[$field . '_format'] : NULL;
163 163
         i18nstrings_update("views:$name:$group:$field", $data[$field], $format);
164
-      }
165
-      else {
164
+        }
165
+        else {
166 166
         $data[$field] = i18nstrings("views:$name:$group:$field", $data[$field]);
167 167
         $translated[] = $field;
168
-      }
168
+        }
169 169
     }
170
-  }
171
-  // Return remaining field names
172
-  return array_diff($field_names, $translated);
170
+    }
171
+    // Return remaining field names
172
+    return array_diff($field_names, $translated);
173 173
 }
174 174
 
175 175
 /**
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
  * We cannot play with object 2 array conversion because some are real typed objects.
179 179
  */
180 180
 function _i18nviews_localize_object($name, $group, &$data, &$field_names, $trim = FALSE) {
181
-  $translated = array();
182
-  foreach ($field_names as $field) {
181
+    $translated = array();
182
+    foreach ($field_names as $field) {
183 183
     if (!empty($data->$field)) {
184
-      $data->$field = i18nstrings("views:$name:$group:$field", $data->$field);
184
+        $data->$field = i18nstrings("views:$name:$group:$field", $data->$field);
185
+    }
185 186
     }
186
-  }
187
-  if ($trim && $translated) {
187
+    if ($trim && $translated) {
188 188
     $field_names = array_diff($field_names, $translated);
189
-  }
189
+    }
190 190
 }
191 191
 
192 192
 /**
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
  * Add a submit handler to the submit button on views_ui_edit_display_form.
196 196
  */
197 197
 function i18nviews_form_views_ui_edit_display_form_alter(&$form, $form_state) {
198
-  $form['buttons']['submit']['#submit'][] = 'i18nviews_views_ui_edit_display_submit';
198
+    $form['buttons']['submit']['#submit'][] = 'i18nviews_views_ui_edit_display_submit';
199 199
 }
200 200
 
201 201
 /**
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
  * Creates or updates translation source records for specified Views fields.
205 205
  */
206 206
 function i18nviews_views_ui_edit_display_submit($form, &$form_state) {
207
-  $fields = _i18nviews_display_fields();
208
-  foreach ($fields as $field) {
207
+    $fields = _i18nviews_display_fields();
208
+    foreach ($fields as $field) {
209 209
     if (isset($form_state['values'][$field])) {
210
-      $name = $form_state['view']->name;
211
-      $group = $form_state['display_id'];
212
-      $format = isset($form_state['values'][$field . '_format']) ? $form_state['values'][$field . '_format'] : NULL;
213
-      i18nstrings_update("views:$name:$group:$field", $form_state['values'][$field], $format);
210
+        $name = $form_state['view']->name;
211
+        $group = $form_state['display_id'];
212
+        $format = isset($form_state['values'][$field . '_format']) ? $form_state['values'][$field . '_format'] : NULL;
213
+        i18nstrings_update("views:$name:$group:$field", $form_state['values'][$field], $format);
214
+    }
214 215
     }
215
-  }
216 216
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@  discard block
 block discarded – undo
62 62
 function i18nviews_views_handler_field_allterms($fieldinfo, $fielddata, $value, $data) {
63 63
   if ($fieldinfo['vocabulary']) {
64 64
     $terms = taxonomy_node_get_terms_by_vocabulary($data->nid, $fieldinfo['vocabulary']);
65
-  }
66
-  else {
65
+  } else {
67 66
     $terms = taxonomy_node_get_terms($data->nid);
68 67
   }
69 68
   // Translate all these terms.
@@ -74,8 +73,7 @@  discard block
 block discarded – undo
74 73
       $links[] = check_plain($term->name);
75 74
     }
76 75
     $links = !empty($links) ? implode(' | ', $links) : '';
77
-  }
78
-  else {
76
+  } else {
79 77
     $node = new stdClass();
80 78
     $node->taxonomy = $terms;
81 79
     $links = theme('links', taxonomy_link('taxonomy terms', $node));
@@ -126,8 +124,7 @@  discard block
 block discarded – undo
126 124
         if ($data['id'] == 'term_node.name') {
127 125
           // That's a full taxonomy box.
128 126
           $view->field[$index]['handler'] = 'i18ntaxonomy_views_handler_field_allterms';
129
-        }
130
-        elseif (preg_match("/term_node_(\d+)\.name/", $data['id'], $matches)) {
127
+        } elseif (preg_match("/term_node_(\d+)\.name/", $data['id'], $matches)) {
131 128
           $vid = $matches[1];
132 129
           if ($translate[$vid]) {
133 130
             // Set new handler for this field.
@@ -161,8 +158,7 @@  discard block
 block discarded – undo
161 158
       if ($update) {
162 159
         $format = isset($data[$field . '_format']) ? $data[$field . '_format'] : NULL;
163 160
         i18nstrings_update("views:$name:$group:$field", $data[$field], $format);
164
-      }
165
-      else {
161
+      } else {
166 162
         $data[$field] = i18nstrings("views:$name:$group:$field", $data[$field]);
167 163
         $translated[] = $field;
168 164
       }
Please login to merge, or discard this patch.