Completed
Pull Request — master (#2135)
by Christian
14:18 queued 04:05
created
drupal/sites/default/boinc/modules/contrib/forum_access/forum_access.module 5 patches
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  * roles as ACLs, so rids translate directly to gids.
16 16
  */
17 17
 function forum_access_node_grants($user, $op) {
18
-  $grants['forum_access'] = array_keys($user->roles);
19
-  return $grants;
18
+    $grants['forum_access'] = array_keys($user->roles);
19
+    return $grants;
20 20
 }
21 21
 
22 22
 /**
@@ -26,51 +26,51 @@  discard block
 block discarded – undo
26 26
  * Checks to see if maybe we're being disabled.
27 27
  */
28 28
 function forum_access_node_access_records($node) {
29
-  if (!forum_access_enabled()) {
29
+    if (!forum_access_enabled()) {
30 30
     return;
31
-  }
31
+    }
32 32
 
33
-  static $grants = array();
34
-  static $node_admins;
35
-  $tid = _forum_access_get_tid($node);
33
+    static $grants = array();
34
+    static $node_admins;
35
+    $tid = _forum_access_get_tid($node);
36 36
 
37
-  // Set proper grants for nodecomment comment nodes.
38
-  if (isset($node->comment_target_nid)) {
37
+    // Set proper grants for nodecomment comment nodes.
38
+    if (isset($node->comment_target_nid)) {
39 39
     if ($changed_tid = _forum_access_changed_tid()) {
40
-      $tid = $changed_tid; // the topic node hasn't been saved yet!
40
+        $tid = $changed_tid; // the topic node hasn't been saved yet!
41 41
     }
42 42
     else {
43
-      $node = node_load($node->comment_target_nid);
44
-      $tid = _forum_access_get_tid($node);
43
+        $node = node_load($node->comment_target_nid);
44
+        $tid = _forum_access_get_tid($node);
45
+    }
45 46
     }
46
-  }
47 47
 
48
-  if ($tid) {
48
+    if ($tid) {
49 49
     if (!isset($grants[$tid])) {
50
-      if (!isset($node_admins)) {
50
+        if (!isset($node_admins)) {
51 51
         $node_admins = user_roles(FALSE, 'administer nodes');
52
-      }
53
-      $result = db_query('SELECT * FROM {forum_access} WHERE tid = %d', $tid);
54
-      while ($grant = db_fetch_object($result)) {
52
+        }
53
+        $result = db_query('SELECT * FROM {forum_access} WHERE tid = %d', $tid);
54
+        while ($grant = db_fetch_object($result)) {
55 55
         if (isset($node_admins[$grant->rid])) {
56
-          continue; // Don't provide any useless grants!
56
+            continue; // Don't provide any useless grants!
57 57
         }
58 58
         $grants[$tid][] = array(
59
-          'realm' => 'forum_access',
60
-          'gid' => $grant->rid,
61
-          'grant_view' => $grant->grant_view,
62
-          'grant_update' => $grant->grant_update,
63
-          'grant_delete' => $grant->grant_delete,
64
-          'grant_comment_create' => $grant->grant_comment_create,
65
-          'priority' => $grant->priority,
59
+            'realm' => 'forum_access',
60
+            'gid' => $grant->rid,
61
+            'grant_view' => $grant->grant_view,
62
+            'grant_update' => $grant->grant_update,
63
+            'grant_delete' => $grant->grant_delete,
64
+            'grant_comment_create' => $grant->grant_comment_create,
65
+            'priority' => $grant->priority,
66 66
         );
67
-      }
68
-      //drupal_set_message("forum_access_node_access_records($node->nid) (tid=$tid) returns ". var_export($grants[$tid], TRUE), 'status');
67
+        }
68
+        //drupal_set_message("forum_access_node_access_records($node->nid) (tid=$tid) returns ". var_export($grants[$tid], TRUE), 'status');
69 69
     }
70 70
     if (isset($grants[$tid])) {
71
-      return $grants[$tid];
71
+        return $grants[$tid];
72
+    }
72 73
     }
73
-  }
74 74
 }
75 75
 
76 76
 /**
@@ -80,60 +80,60 @@  discard block
 block discarded – undo
80 80
  * and comment/delete/% where needed.
81 81
  */
82 82
 function forum_access_init() {
83
-  global $user;
84
-  if ($user->uid == 1) {
83
+    global $user;
84
+    if ($user->uid == 1) {
85 85
     return;
86
-  }
86
+    }
87 87
 
88
-  switch (arg(0)) {
88
+    switch (arg(0)) {
89 89
     case 'comment':
90 90
       if (variable_get('forum_access_D5_legacy_mode', FALSE)) {
91 91
         return; // disable comment access control
92
-      }
93
-      if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) {
92
+        }
93
+        if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) {
94 94
         if (is_numeric($cid = arg(2))) { // comment/edit/%, comment/delete/%
95
-          $access[] = (arg(1) == 'edit' ? 'update' : 'delete');
96
-          $comment = _comment_load($cid);
97
-          $nid = $comment->nid;
98
-          // If the node turns out to be in a forum where we have update/delete
99
-          // access, then we need Moderator permissions now, so we can moderate
100
-          // this comment.
101
-          // We won't provide full Administrator access, though: we'll remove
102
-          // author and timestamp, for example.
103
-          $grant_normal_access = TRUE;
104
-        }
105
-      }
106
-      break;
95
+            $access[] = (arg(1) == 'edit' ? 'update' : 'delete');
96
+            $comment = _comment_load($cid);
97
+            $nid = $comment->nid;
98
+            // If the node turns out to be in a forum where we have update/delete
99
+            // access, then we need Moderator permissions now, so we can moderate
100
+            // this comment.
101
+            // We won't provide full Administrator access, though: we'll remove
102
+            // author and timestamp, for example.
103
+            $grant_normal_access = TRUE;
104
+        }
105
+        }
106
+        break;
107 107
 
108 108
     case 'node':
109 109
       if (is_numeric(arg(1))) {
110 110
         if (arg(2) == 'edit' && !user_access('administer nodes')) { // node/%/edit
111
-          $access[] = 'update';
112
-          $nid = arg(1);
113
-          // If the node turns out to be in a forum where we have update/delete
114
-          // access, then we already get limited edit capabilities from NA, but
115
-          // we need some more, e.g. publish/unpublish and comment status.
116
-          // In order to get these controls on the form, we need Moderator
117
-          // permissions now.
118
-          // We won't provide full Administrator access, though: we'll remove
119
-          // author and timestamp, for example.
111
+            $access[] = 'update';
112
+            $nid = arg(1);
113
+            // If the node turns out to be in a forum where we have update/delete
114
+            // access, then we already get limited edit capabilities from NA, but
115
+            // we need some more, e.g. publish/unpublish and comment status.
116
+            // In order to get these controls on the form, we need Moderator
117
+            // permissions now.
118
+            // We won't provide full Administrator access, though: we'll remove
119
+            // author and timestamp, for example.
120 120
         }
121 121
         if (arg(2) == 'delete' && !user_access('administer nodes')) { // node/%/delete
122
-          $access = array();
123
-          $nid = arg(1);
124
-          // This is the delete confirmation page. We don't need any
125
-          // additional permissions, but we'll assert 'view' access below.
122
+            $access = array();
123
+            $nid = arg(1);
124
+            // This is the delete confirmation page. We don't need any
125
+            // additional permissions, but we'll assert 'view' access below.
126 126
         }
127 127
         if (arg(2) == NULL && !user_access('administer comments')) { // node/%
128
-          $access[] = 'update';
129
-          $nid = arg(1);
130
-          // If the node turns out to be in a forum where we have update/delete
131
-          // access, then we'll get the 'Edit' link automatically from NA, but
132
-          // we'll need Moderator permissions, so that we can add the edit/delete
133
-          // comment links (*after* we've identified the other comment links).
128
+            $access[] = 'update';
129
+            $nid = arg(1);
130
+            // If the node turns out to be in a forum where we have update/delete
131
+            // access, then we'll get the 'Edit' link automatically from NA, but
132
+            // we'll need Moderator permissions, so that we can add the edit/delete
133
+            // comment links (*after* we've identified the other comment links).
134 134
         }
135
-      }
136
-      break;
135
+        }
136
+        break;
137 137
 
138 138
     case 'community':
139 139
         if (arg(1)=='forum') {
@@ -155,30 +155,30 @@  discard block
 block discarded – undo
155 155
             }// is_numeric(arg(2))
156 156
         }// arg(1)==forum
157 157
     break;
158
-  }// switch
159
-  if (isset($nid)) {
158
+    }// switch
159
+    if (isset($nid)) {
160 160
     $node = node_load($nid);
161 161
     if ($tid = _forum_access_get_tid($node)) {
162
-      if (!forum_access_access($tid, 'view')) {
162
+        if (!forum_access_access($tid, 'view')) {
163 163
         drupal_access_denied();
164 164
         module_invoke_all('exit');
165 165
         exit;
166
-      }
167
-      foreach ($access as $a) {
166
+        }
167
+        foreach ($access as $a) {
168 168
         $faa = forum_access_access($tid, $a);
169 169
         $grant_moderator_access = $faa > 1;
170 170
         $grant_normal_access = !empty($grant_normal_access) && $faa > 0;
171 171
         if ($grant_normal_access || $grant_moderator_access) {
172
-          $user->_forum_access_moderator = $grant_moderator_access;
173
-          if (arg(0) == 'comment' || arg(0) == 'node' && arg(2) == 'edit') {
172
+            $user->_forum_access_moderator = $grant_moderator_access;
173
+            if (arg(0) == 'comment' || arg(0) == 'node' && arg(2) == 'edit') {
174 174
             module_load_include('node.inc', 'forum_access');
175 175
             _forum_access_enable_moderator();
176 176
             break;
177
-          }
177
+            }
178 178
         }
179
-      }
179
+        }
180
+    }
180 181
     }
181
-  }
182 182
 }
183 183
 
184 184
 /**
@@ -187,50 +187,50 @@  discard block
 block discarded – undo
187 187
  * Alter the node/comment create/edit forms and various admin forms.
188 188
  */
189 189
 function forum_access_form_alter(&$form, &$form_state, $form_id) {
190
-  if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) {
190
+    if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) {
191 191
     module_load_include('node.inc', 'forum_access');
192 192
     _forum_access_node_form($form, $form_state);
193
-  }
194
-  elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', FALSE)) {
193
+    }
194
+    elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', FALSE)) {
195 195
     module_load_include('node.inc', 'forum_access');
196 196
     _forum_access_comment_form($form, $form_state);
197
-  }
198
-  elseif ($form_id == 'forum_overview') {
197
+    }
198
+    elseif ($form_id == 'forum_overview') {
199 199
     module_load_include('admin.inc', 'forum_access');
200 200
     _forum_access_forum_overview($form, $form_state);
201
-  }
202
-  elseif ($form_id == 'forum_form_container') {
201
+    }
202
+    elseif ($form_id == 'forum_form_container') {
203 203
     module_load_include('admin.inc', 'forum_access');
204 204
     _forum_access_forum_form($form, $form_state, TRUE);
205
-  }
206
-  elseif ($form_id == 'forum_form_forum') {
205
+    }
206
+    elseif ($form_id == 'forum_form_forum') {
207 207
     module_load_include('admin.inc', 'forum_access');
208 208
     _forum_access_forum_form($form, $form_state, FALSE);
209
-  }
210
-  elseif ($form_id == 'forum_admin_settings') {
209
+    }
210
+    elseif ($form_id == 'forum_admin_settings') {
211 211
     module_load_include('admin.inc', 'forum_access');
212 212
     _forum_access_forum_admin_settings_form($form, $form_state);
213
-  }
214
-  elseif ($form_id == 'user_admin_role') {
213
+    }
214
+    elseif ($form_id == 'user_admin_role') {
215 215
     module_load_include('admin.inc', 'forum_access');
216 216
     _forum_access_user_admin_role_form($form, $form_state);
217
-  }
218
-  elseif ($form_id == 'content_access_admin_settings' && empty($_POST)) {
217
+    }
218
+    elseif ($form_id == 'content_access_admin_settings' && empty($_POST)) {
219 219
     module_load_include('admin.inc', 'forum_access');
220 220
     _forum_access_content_access_admin_form();
221
-  }
222
-  elseif ($form_id == 'user_admin_perm') {
221
+    }
222
+    elseif ($form_id == 'user_admin_perm') {
223 223
     module_load_include('admin.inc', 'forum_access');
224 224
     _forum_access_user_admin_perm_form($form, $form_state);
225
-  }
226
-  elseif ($form_id == 'user_admin_account') {
225
+    }
226
+    elseif ($form_id == 'user_admin_account') {
227 227
     module_load_include('admin.inc', 'forum_access');
228 228
     _forum_access_user_admin_account_form($form, $form_state);
229
-  }
230
-  elseif ($form_id == 'user_profile_form') {
229
+    }
230
+    elseif ($form_id == 'user_profile_form') {
231 231
     module_load_include('admin.inc', 'forum_access');
232 232
     _forum_access_user_profile_form($form, $form_state);
233
-  }
233
+    }
234 234
 }
235 235
 
236 236
 /**
@@ -241,41 +241,41 @@  discard block
 block discarded – undo
241 241
  * taxonomy. There should be.
242 242
  */
243 243
 function forum_access_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
244
-  global $user;
245
-  $sql = NULL;
246
-  switch ($primary_field) {
244
+    global $user;
245
+    $sql = NULL;
246
+    switch ($primary_field) {
247 247
     case 'tid':
248 248
       if ($user->uid == 1
249 249
         || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === FALSE
250 250
         || user_access('administer forums') && $_GET['q'] == 'admin/content/forum') {
251 251
         break;
252
-      }
253
-      if (strpos($_GET['q'], 'node/add/forum') !== FALSE) {
252
+        }
253
+        if (strpos($_GET['q'], 'node/add/forum') !== FALSE) {
254 254
         $required_access = 'create';
255
-      }
256
-      else {
255
+        }
256
+        else {
257 257
         $required_access = 'view';
258
-      }
259
-      $roles = implode(', ', array_keys($user->roles));
260
-      $sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid
258
+        }
259
+        $roles = implode(', ', array_keys($user->roles));
260
+        $sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid
261 261
                       LEFT JOIN {acl} acl_fa ON acl_fa.number = $primary_table.tid AND acl_fa.module = 'forum_access'
262 262
                       LEFT JOIN {acl_user} aclu_fa ON aclu_fa.acl_id = acl_fa.acl_id AND aclu_fa.uid = $user->uid";
263
-      $sql['where'] = "(fa.grant_$required_access >= 1 AND fa.rid IN ($roles)) OR fa.tid IS NULL OR aclu_fa.uid = $user->uid";
264
-      $sql['distinct'] = 1;
265
-      break;
263
+        $sql['where'] = "(fa.grant_$required_access >= 1 AND fa.rid IN ($roles)) OR fa.tid IS NULL OR aclu_fa.uid = $user->uid";
264
+        $sql['distinct'] = 1;
265
+        break;
266 266
 
267 267
     case 'rid':
268 268
       if (strpos($query, 'FROM {role}') === FALSE
269 269
         || strpos($_GET['q'] .'/', 'admin/content/forum/') === 0) {
270 270
         break;
271
-      }
272
-      $moderator_rid = forum_access_query_moderator_rid();
273
-      if (!empty($moderator_rid)) {
271
+        }
272
+        $moderator_rid = forum_access_query_moderator_rid();
273
+        if (!empty($moderator_rid)) {
274 274
         $sql['where'] = "$primary_table.rid <> $moderator_rid";
275
-      }
276
-      break;
277
-  }
278
-  return $sql;
275
+        }
276
+        break;
277
+    }
278
+    return $sql;
279 279
 }
280 280
 
281 281
 /**
@@ -284,43 +284,43 @@  discard block
 block discarded – undo
284 284
  * Add ACL data to fresh forum posts.
285 285
  */
286 286
 function forum_access_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
287
-  static $old_tid = NULL;
288
-  // This is modeled after forum_nodeapi():
289
-  $vid = _forum_access_get_vid();
290
-  $vocabulary = taxonomy_vocabulary_load($vid);
291
-  if (empty($vocabulary) || !in_array($node->type, $vocabulary->nodes)) {
287
+    static $old_tid = NULL;
288
+    // This is modeled after forum_nodeapi():
289
+    $vid = _forum_access_get_vid();
290
+    $vocabulary = taxonomy_vocabulary_load($vid);
291
+    if (empty($vocabulary) || !in_array($node->type, $vocabulary->nodes)) {
292 292
     if ($op == 'insert' && isset($node->comment_target_nid)) {
293
-      // Set moderator on nodecomment.
294
-      $topic_node = node_load($node->comment_target_nid);
295
-      if ($topic_tid = _forum_access_get_tid($topic_node)) {
293
+        // Set moderator on nodecomment.
294
+        $topic_node = node_load($node->comment_target_nid);
295
+        if ($topic_tid = _forum_access_get_tid($topic_node)) {
296 296
         $acl_id = acl_get_id_by_number('forum_access', $topic_tid);
297 297
         acl_node_add_acl($node->nid, $acl_id, 1, 1, 1);
298
-      }
298
+        }
299 299
     }
300 300
     return;
301
-  }
301
+    }
302 302
 
303
-  switch ($op) {
303
+    switch ($op) {
304 304
     case 'presave':
305 305
       $old_tid = db_result(db_query('SELECT tid FROM {forum} WHERE nid = %d', $node->nid));
306
-      break;
306
+        break;
307 307
 
308 308
     case 'update':
309 309
       if (!empty($old_tid)) {
310 310
         if (!empty($node->tid) && $node->tid == $old_tid) {
311
-          return;
311
+            return;
312 312
         }
313 313
         acl_node_clear_acls($node->nid, 'forum_access');
314 314
 
315 315
         if (module_exists('nodecomment')) {
316
-          _forum_access_changed_tid($node->tid);
317
-          $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
318
-          while ($row = db_fetch_object($result)) {
316
+            _forum_access_changed_tid($node->tid);
317
+            $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
318
+            while ($row = db_fetch_object($result)) {
319 319
             acl_node_clear_acls($row->cid, 'forum_access');
320
-          }
320
+            }
321
+        }
321 322
         }
322
-      }
323
-      // Deliberate no break -- for changed and for previously unassigned terms we need an insert.
323
+        // Deliberate no break -- for changed and for previously unassigned terms we need an insert.
324 324
 
325 325
     case 'insert':
326 326
       if (!empty($node->tid)) {
@@ -328,27 +328,27 @@  discard block
 block discarded – undo
328 328
         acl_node_add_acl($node->nid, $acl_id, 1, 1, 1);
329 329
 
330 330
         if (isset($old_tid) && module_exists('nodecomment')) {
331
-          $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
332
-          while ($row = db_fetch_object($result)) {
331
+            $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
332
+            while ($row = db_fetch_object($result)) {
333 333
             acl_node_add_acl($row->cid, $acl_id, 1, 1, 1);
334 334
             node_access_acquire_grants(node_load($row->cid));
335
-          }
335
+            }
336 336
         }
337
-      }
338
-      $old_tid = NULL;
339
-      break;
340
-  }
337
+        }
338
+        $old_tid = NULL;
339
+        break;
340
+    }
341 341
 }
342 342
 
343 343
 /**
344 344
  * Get an array of moderator UIDs or NULL.
345 345
  */
346 346
 function forum_access_get_moderator_uids($tid) {
347
-  if ($acl_id = acl_get_id_by_number('forum_access', $tid)) {
347
+    if ($acl_id = acl_get_id_by_number('forum_access', $tid)) {
348 348
     if ($uids = acl_get_uids($acl_id)) {
349
-      return $uids;
349
+        return $uids;
350
+    }
350 351
     }
351
-  }
352 352
 }
353 353
 
354 354
 /**
@@ -361,21 +361,21 @@  discard block
 block discarded – undo
361 361
  * and thus it is disabled by default. Set the variable to TRUE to enable.
362 362
  */
363 363
 function forum_access_preprocess_forum_list(&$variables) {
364
-  if (variable_get('forum_access_provide_moderators_template_variable', FALSE)) {
364
+    if (variable_get('forum_access_provide_moderators_template_variable', FALSE)) {
365 365
     static $users;
366 366
     foreach ($variables['forums'] as $tid => $forum) {
367
-      $moderators = array();
368
-      if ($uids = forum_access_get_moderator_uids($tid)) {
367
+        $moderators = array();
368
+        if ($uids = forum_access_get_moderator_uids($tid)) {
369 369
         foreach ($uids as $uid) {
370
-          if (!isset($users[$uid])) {
370
+            if (!isset($users[$uid])) {
371 371
             $users[$uid] = user_load(array('uid' => $uid));
372
-          }
373
-          $moderators[$uid] = $users[$uid];
372
+            }
373
+            $moderators[$uid] = $users[$uid];
374
+        }
374 375
         }
375
-      }
376
-      $forum->forum_access_moderators = (empty($moderators) ? NULL : $moderators);
376
+        $forum->forum_access_moderators = (empty($moderators) ? NULL : $moderators);
377
+    }
377 378
     }
378
-  }
379 379
 }
380 380
 
381 381
 /**
@@ -385,17 +385,17 @@  discard block
 block discarded – undo
385 385
  * 'create' permission.
386 386
  */
387 387
 function forum_access_preprocess_forums(&$variables) {
388
-  if (!forum_access_access($variables['tid'], 'create') && !empty($variables['links'])) {
388
+    if (!forum_access_access($variables['tid'], 'create') && !empty($variables['links'])) {
389 389
     foreach ($variables['links'] as $key => $link) {
390
-      if (isset($link['href']) && substr($link['href'], 0, 9) == 'node/add/') {
390
+        if (isset($link['href']) && substr($link['href'], 0, 9) == 'node/add/') {
391 391
         unset($variables['links'][$key]);
392
-      }
392
+        }
393
+    }
393 394
     }
394
-  }
395 395
 }
396 396
 
397 397
 if (!variable_get('forum_access_D5_legacy_mode', FALSE)) {
398
-  // LEGACY-MODE disables these methods
398
+    // LEGACY-MODE disables these methods
399 399
 
400 400
 /**
401 401
  * Implementation of hook_link_alter().
@@ -404,42 +404,42 @@  discard block
 block discarded – undo
404 404
  * 'comment_create' permission; for comments, add any missing links (D6.17+).
405 405
  */
406 406
 function forum_access_link_alter(&$links, $node, $comment = NULL) {
407
-  global $user;
408
-  static $user1, $recursing = FALSE, $stored_links;
407
+    global $user;
408
+    static $user1, $recursing = FALSE, $stored_links;
409 409
 
410
-  // If we are being called recursively, store the $links and return.
411
-  if ($recursing) {
410
+    // If we are being called recursively, store the $links and return.
411
+    if ($recursing) {
412 412
     $stored_links = $links;
413 413
     return;
414
-  }
415
-  if ($user->uid == 1 || !($tid = _forum_access_get_tid($node))) {
414
+    }
415
+    if ($user->uid == 1 || !($tid = _forum_access_get_tid($node))) {
416 416
     return;
417
-  }
418
-  if (empty($comment)) {
417
+    }
418
+    if (empty($comment)) {
419 419
     // Check links for the node.
420 420
     if ($tid && isset($links['comment_add']) && !forum_access_access($tid, 'comment_create')) {
421
-      unset($links['comment_add']);
422
-      // Hack to manually remove quote link
423
-      if ( isset($links['quote']) ) {
424
-          unset($links['quote']);
425
-      }
426
-    }
427
-  }
428
-  else {
421
+        unset($links['comment_add']);
422
+        // Hack to manually remove quote link
423
+        if ( isset($links['quote']) ) {
424
+            unset($links['quote']);
425
+        }
426
+    }
427
+    }
428
+    else {
429 429
     // Check links for the comment.
430 430
     $required_keys = array(
431
-      'comment_create' => 'comment_reply',
432
-      'update' => 'comment_edit',
433
-      'delete' => 'comment_delete',
431
+        'comment_create' => 'comment_reply',
432
+        'update' => 'comment_edit',
433
+        'delete' => 'comment_delete',
434 434
     );
435 435
     foreach ($required_keys as $access => $key) {
436
-      if (!forum_access_access($tid, $access) && !($access == 'update' && comment_access('edit', $comment))) {
436
+        if (!forum_access_access($tid, $access) && !($access == 'update' && comment_access('edit', $comment))) {
437 437
         unset($links[$required_keys[$access]]);
438 438
         unset($required_keys[$access]);
439
-      }
440
-      elseif (!array_key_exists($key, $links)) {
439
+        }
440
+        elseif (!array_key_exists($key, $links)) {
441 441
         $link_is_missing = TRUE;
442
-      }
442
+        }
443 443
     }
444 444
 
445 445
     // Hack to manually remove quote link if comment_reply link is no longer set
@@ -448,48 +448,48 @@  discard block
 block discarded – undo
448 448
     }
449 449
     
450 450
     if (isset($required_keys['comment_create']) && !user_access('post comments')) {
451
-      unset($required_keys['comment_create']);
451
+        unset($required_keys['comment_create']);
452 452
     }
453 453
     if (!empty($link_is_missing)) {
454
-      // One of the $required_links should be present, because the current
455
-      // user has the corresponding permission, but it isn't.
456
-      // We temporarily switch to UID 1 to 'harvest' all comment links.
457
-      if (!isset($user1)) {
454
+        // One of the $required_links should be present, because the current
455
+        // user has the corresponding permission, but it isn't.
456
+        // We temporarily switch to UID 1 to 'harvest' all comment links.
457
+        if (!isset($user1)) {
458 458
         $user1 = user_load(1);
459
-      }
460
-      $saved_user = $user;
461
-      session_save_session(FALSE);
462
-      $user = $user1;
463
-
464
-      // With UID 1 we call hook_link(). This should give us the full set of
465
-      // links that the site admin sees.
466
-      $admin_links = module_invoke_all('link', 'comment', $comment, array_key_exists('comment_parent', $links));
467
-
468
-      $user = $saved_user;
469
-      session_save_session(TRUE);
470
-
471
-      // Remove the links from $admin_links that are not in the reduced
472
-      // set of $required_links AND not available to the current user anyway.
473
-      // Afterwards, $admin_links should have the same content as $links, plus
474
-      // one or more additional links from the original set in $required_links.
475
-      foreach ($admin_links as $key => $target) {
459
+        }
460
+        $saved_user = $user;
461
+        session_save_session(FALSE);
462
+        $user = $user1;
463
+
464
+        // With UID 1 we call hook_link(). This should give us the full set of
465
+        // links that the site admin sees.
466
+        $admin_links = module_invoke_all('link', 'comment', $comment, array_key_exists('comment_parent', $links));
467
+
468
+        $user = $saved_user;
469
+        session_save_session(TRUE);
470
+
471
+        // Remove the links from $admin_links that are not in the reduced
472
+        // set of $required_links AND not available to the current user anyway.
473
+        // Afterwards, $admin_links should have the same content as $links, plus
474
+        // one or more additional links from the original set in $required_links.
475
+        foreach ($admin_links as $key => $target) {
476 476
         if (!in_array($key, $required_keys) && !array_key_exists($key, $links)) {
477
-          unset($admin_links[$key]);
478
-        }
479
-      }
480
-
481
-      // As the real current user, call hook_link_alter on the admin links.
482
-      // First we set a static variable so that the next time this function is
483
-      // called it will store a copy of the links at their current state. Then
484
-      // we pull those links which have not been link_alter'ed by any modules
485
-      // that come after forum_access.
486
-      $recursing = TRUE;
487
-      drupal_alter('link', $admin_links, $node, $comment);
488
-      $recursing = FALSE;
489
-      // Now return the stored links.
490
-      $links = $stored_links;
491
-    }
492
-  }// if empty($comment)
477
+            unset($admin_links[$key]);
478
+        }
479
+        }
480
+
481
+        // As the real current user, call hook_link_alter on the admin links.
482
+        // First we set a static variable so that the next time this function is
483
+        // called it will store a copy of the links at their current state. Then
484
+        // we pull those links which have not been link_alter'ed by any modules
485
+        // that come after forum_access.
486
+        $recursing = TRUE;
487
+        drupal_alter('link', $admin_links, $node, $comment);
488
+        $recursing = FALSE;
489
+        // Now return the stored links.
490
+        $links = $stored_links;
491
+    }
492
+    }// if empty($comment)
493 493
 }
494 494
 
495 495
 /**
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
  * (after _forum_access_comment_form()).
500 500
  */
501 501
 function forum_access_preprocess_box(&$variables) {
502
-  $tr = 't';
503
-  if (empty($variables['content']) && ($variables['title'] == $tr('Post new comment') || $variables['title'] == $tr('Reply'))) {
502
+    $tr = 't';
503
+    if (empty($variables['content']) && ($variables['title'] == $tr('Post new comment') || $variables['title'] == $tr('Reply'))) {
504 504
     $variables['title'] = '';
505
-  }
505
+    }
506 506
 }
507 507
 
508 508
 /**
@@ -512,10 +512,10 @@  discard block
 block discarded – undo
512 512
  * remove those that aren't accessible to the user.
513 513
  */
514 514
 function forum_access_preprocess_comment(&$variables) {
515
-  if (version_compare(VERSION, '6.17', '<') && isset($variables['node']->tid)) {
515
+    if (version_compare(VERSION, '6.17', '<') && isset($variables['node']->tid)) {
516 516
     module_load_include('node.inc', 'forum_access');
517 517
     _forum_access_preprocess_comment($variables);
518
-  }
518
+    }
519 519
 }
520 520
 
521 521
 } // End of !LEGACY-MODE
@@ -524,11 +524,11 @@  discard block
 block discarded – undo
524 524
  * This is also required by ACL module.
525 525
  */
526 526
 function forum_access_enabled($set = NULL) {
527
-  static $enabled = TRUE;
528
-  if ($set !== NULL) {
527
+    static $enabled = TRUE;
528
+    if ($set !== NULL) {
529 529
     $enabled = $set;
530
-  }
531
-  return $enabled;
530
+    }
531
+    return $enabled;
532 532
 }
533 533
 
534 534
 /**
@@ -545,63 +545,63 @@  discard block
 block discarded – undo
545 545
  *   2     - access granted for forum moderator
546 546
  */
547 547
 function forum_access_access($tid, $type, $account = NULL, $administer_nodes_sees_everything = TRUE) {
548
-  static $cache = array();
549
-  if (!$account) {
548
+    static $cache = array();
549
+    if (!$account) {
550 550
     global $user;
551 551
     $account = $user;
552
-  }
552
+    }
553 553
 
554
-  if ($account->uid == 1 ||
554
+    if ($account->uid == 1 ||
555 555
       $administer_nodes_sees_everything && user_access('administer nodes', $account) && array_search($type, array('view', 'update', 'delete')) !== FALSE) {
556 556
     return 1;
557
-  }
557
+    }
558 558
 
559
-  if (!isset($cache[$account->uid][$tid][$type])) {
559
+    if (!isset($cache[$account->uid][$tid][$type])) {
560 560
     if (!user_access('access content', $account)) {
561
-      return $cache[$account->uid][$tid][$type] = FALSE;
561
+        return $cache[$account->uid][$tid][$type] = FALSE;
562 562
     }
563 563
 
564 564
     $roles = array_keys($account->roles);
565 565
     $result = db_result(db_query("SELECT tid FROM {forum_access} WHERE rid IN (". db_placeholders($roles) .") AND grant_". $type ." = 1 AND tid = %d", array_merge($roles, array($tid))));
566 566
 
567 567
     if ($result) {
568
-      $cache[$account->uid][$tid][$type] = 1;
568
+        $cache[$account->uid][$tid][$type] = 1;
569 569
     }
570 570
     else {
571
-      // check our moderators too
572
-      $acl_id = acl_get_id_by_number('forum_access', $tid);
573
-      $result = db_result(db_query("SELECT uid FROM {acl_user} WHERE acl_id = %d AND uid = %d", $acl_id, $account->uid));
574
-      if ($result) {
571
+        // check our moderators too
572
+        $acl_id = acl_get_id_by_number('forum_access', $tid);
573
+        $result = db_result(db_query("SELECT uid FROM {acl_user} WHERE acl_id = %d AND uid = %d", $acl_id, $account->uid));
574
+        if ($result) {
575 575
         $cache[$account->uid][$tid][$type] = 2;
576
-      }
577
-      else {
576
+        }
577
+        else {
578 578
         $cache[$account->uid][$tid][$type] = FALSE;
579
-      }
579
+        }
580 580
     }
581
-  }
582
-  return $cache[$account->uid][$tid][$type];
581
+    }
582
+    return $cache[$account->uid][$tid][$type];
583 583
 }
584 584
 
585 585
 /**
586 586
  * Implementation of hook_user().
587 587
  */
588 588
 function forum_access_user($op, &$edit, &$account, $category = NULL) {
589
-  switch ($op) {
589
+    switch ($op) {
590 590
     case 'validate':
591 591
       $rid = forum_access_query_moderator_rid();
592
-      if (!empty($rid)) {
592
+        if (!empty($rid)) {
593 593
         if (isset($edit['roles'][$rid]) && $edit['roles'][$rid]) {
594
-          $roles = user_roles();
595
-          $variables = array(
594
+            $roles = user_roles();
595
+            $variables = array(
596 596
             '@Forum_Access' => 'Forum Access',
597 597
             '%Role' => $roles[$rid],
598
-          );
599
-          drupal_set_message(t('The %Role role is reserved for internal use by the @Forum_Access module! It was not assigned.', $variables), 'warning');
600
-          unset($edit['roles'][$rid]);
598
+            );
599
+            drupal_set_message(t('The %Role role is reserved for internal use by the @Forum_Access module! It was not assigned.', $variables), 'warning');
600
+            unset($edit['roles'][$rid]);
601
+        }
601 602
         }
602
-      }
603
-      break;
604
-  }
603
+        break;
604
+    }
605 605
 }
606 606
 
607 607
 /**
@@ -610,15 +610,15 @@  discard block
 block discarded – undo
610 610
  * Remove the 'Forum' menu item if no forums are visible.
611 611
  */
612 612
 function forum_access_menu_alter(&$items) {
613
-  if (!empty($items['forum'])) {
613
+    if (!empty($items['forum'])) {
614 614
     //dpm($items['forum'], 'hook_menu_alter($items[\'forum\'])');
615 615
     if (!empty($items['forum']['access callback']) || $items['forum']['access arguments'][0] != 'access content') {
616
-      drupal_set_message(t('Unexpected access specification for the %forum menu path; @Forum_Access cannot control its access.', array('%forum' => 'forum', '@Forum_Access' => 'Forum Access')), 'error');
617
-      return;
616
+        drupal_set_message(t('Unexpected access specification for the %forum menu path; @Forum_Access cannot control its access.', array('%forum' => 'forum', '@Forum_Access' => 'Forum Access')), 'error');
617
+        return;
618 618
     }
619 619
     $items['forum']['access callback'] = '_forum_access_forum_access_callback';
620 620
     $items['forum']['access arguments'] = array(1);
621
-  }
621
+    }
622 622
 }
623 623
 
624 624
 /**
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
  * one role that can access at least one forum.
630 630
  */
631 631
 function _forum_access_forum_access_callback($tid = NULL) {
632
-  return (!$tid && _forum_access_access_any_forum()) || forum_access_access($tid, 'view');
632
+    return (!$tid && _forum_access_access_any_forum()) || forum_access_access($tid, 'view');
633 633
 }
634 634
 
635 635
 /**
@@ -639,37 +639,37 @@  discard block
 block discarded – undo
639 639
  * at least one forum.
640 640
  */
641 641
 function _forum_access_access_any_forum($account = NULL) {
642
-  global $user;
643
-  static $return = array();
642
+    global $user;
643
+    static $return = array();
644 644
 
645
-  if (!isset($account)) {
645
+    if (!isset($account)) {
646 646
     $account = $user;
647
-  }
647
+    }
648 648
 
649
-  if (!isset($return[$account->uid])) {
649
+    if (!isset($return[$account->uid])) {
650 650
     if ($account->uid == 1) {
651
-      return $return[$account->uid] = TRUE;
651
+        return $return[$account->uid] = TRUE;
652 652
     }
653 653
     if (!user_access('access content', $account)) {
654
-      return $return[$account->uid] = FALSE;
654
+        return $return[$account->uid] = FALSE;
655 655
     }
656 656
     $rids = variable_get('forum_access_rids', NULL);
657 657
     if (!isset($rids)) {
658
-      $rids = array();
659
-      $result = db_query("SELECT fa.rid FROM {forum_access} fa WHERE fa.grant_view > 0 GROUP BY fa.rid");
660
-      while ($role = db_fetch_object($result)) {
658
+        $rids = array();
659
+        $result = db_query("SELECT fa.rid FROM {forum_access} fa WHERE fa.grant_view > 0 GROUP BY fa.rid");
660
+        while ($role = db_fetch_object($result)) {
661 661
         $rids[] = $role->rid;
662
-      }
663
-      variable_set('forum_access_rids', $rids);
662
+        }
663
+        variable_set('forum_access_rids', $rids);
664 664
     }
665 665
     foreach ($rids as $rid) {
666
-      if (isset($account->roles[$rid])) {
666
+        if (isset($account->roles[$rid])) {
667 667
         return $return[$account->uid] = TRUE;
668
-      }
668
+        }
669 669
     }
670 670
     $return[$account->uid] = FALSE;
671
-  }
672
-  return $return[$account->uid];
671
+    }
672
+    return $return[$account->uid];
673 673
 }
674 674
 
675 675
 /**
@@ -678,18 +678,18 @@  discard block
 block discarded – undo
678 678
  * Delete {forum_access} records when forums are deleted.
679 679
  */
680 680
 function forum_access_taxonomy($op, $type, $array = NULL) {
681
-  //dpm($array, "hook_taxonomy($op, $type)");
682
-  if ($type = 'term' && $op == 'delete' && $array['vid'] == _forum_access_get_vid()) {
681
+    //dpm($array, "hook_taxonomy($op, $type)");
682
+    if ($type = 'term' && $op == 'delete' && $array['vid'] == _forum_access_get_vid()) {
683 683
     db_query("DELETE FROM {forum_access} WHERE tid = %d", $array['tid']);
684 684
     variable_del('forum_access_rids'); // clear cache
685
-  }
685
+    }
686 686
 }
687 687
 
688 688
 /**
689 689
  * Return forum.module's forum vocabulary ID.
690 690
  */
691 691
 function _forum_access_get_vid() {
692
-  return variable_get('forum_nav_vocabulary', '');
692
+    return variable_get('forum_nav_vocabulary', '');
693 693
 }
694 694
 
695 695
 /**
@@ -697,51 +697,51 @@  discard block
 block discarded – undo
697 697
  * exist.
698 698
  */
699 699
 function forum_access_query_moderator_rid() {
700
-  return variable_get('forum_access_moderator_rid', NULL);
700
+    return variable_get('forum_access_moderator_rid', NULL);
701 701
 }
702 702
 
703 703
 /**
704 704
  * Return the forum tid or FALSE.
705 705
  */
706 706
 function _forum_access_get_tid($node) {
707
-  return (isset($node->forum_tid) ? $node->forum_tid : (isset($node->tid) ? $node->tid : FALSE));
707
+    return (isset($node->forum_tid) ? $node->forum_tid : (isset($node->tid) ? $node->tid : FALSE));
708 708
 }
709 709
 
710 710
 /**
711 711
  * Save and return the $tid.
712 712
  */
713 713
 function _forum_access_changed_tid($tid = NULL) {
714
-  static $saved_tid = NULL;
715
-  if (!empty($tid)) {
714
+    static $saved_tid = NULL;
715
+    if (!empty($tid)) {
716 716
     $saved_tid = $tid;
717
-  }
718
-  return $saved_tid;
717
+    }
718
+    return $saved_tid;
719 719
 }
720 720
 
721 721
 /**
722 722
  * Implementation of hook_node_access_explain().
723 723
  */
724 724
 function forum_access_node_access_explain($row) {
725
-  static $roles = NULL;
726
-  if ($row->realm == 'forum_access') {
725
+    static $roles = NULL;
726
+    if ($row->realm == 'forum_access') {
727 727
     if (!isset($roles)) {
728
-      module_load_include('node.inc', 'forum_access');
729
-      $roles = _forum_access_get_all_roles();
728
+        module_load_include('node.inc', 'forum_access');
729
+        $roles = _forum_access_get_all_roles();
730 730
     }
731 731
     if (isset($roles[$row->gid])) {
732
-      return array($roles[$row->gid]);
732
+        return array($roles[$row->gid]);
733 733
     }
734 734
     return array('(unknown gid)');
735
-  }
735
+    }
736 736
 }
737 737
 
738 738
 /**
739 739
  * Implementation of hook_acl_explain().
740 740
  */
741 741
 function forum_access_acl_explain($acl_id, $name, $number, $users = NULL) {
742
-  if (empty($users)) {
742
+    if (empty($users)) {
743 743
     return "ACL (id=$acl_id) would grant access to nodes in forum/$number.";
744
-  }
745
-  return "ACL (id=$acl_id) grants access to nodes in forum/$number to the listed user(s).";
744
+    }
745
+    return "ACL (id=$acl_id) grants access to nodes in forum/$number to the listed user(s).";
746 746
 }
747 747
 
Please login to merge, or discard this patch.
Switch Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -86,75 +86,75 @@  discard block
 block discarded – undo
86 86
   }
87 87
 
88 88
   switch (arg(0)) {
89
-    case 'comment':
90
-      if (variable_get('forum_access_D5_legacy_mode', FALSE)) {
91
-        return; // disable comment access control
92
-      }
93
-      if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) {
94
-        if (is_numeric($cid = arg(2))) { // comment/edit/%, comment/delete/%
95
-          $access[] = (arg(1) == 'edit' ? 'update' : 'delete');
96
-          $comment = _comment_load($cid);
97
-          $nid = $comment->nid;
98
-          // If the node turns out to be in a forum where we have update/delete
99
-          // access, then we need Moderator permissions now, so we can moderate
100
-          // this comment.
101
-          // We won't provide full Administrator access, though: we'll remove
102
-          // author and timestamp, for example.
103
-          $grant_normal_access = TRUE;
104
-        }
89
+  case 'comment':
90
+    if (variable_get('forum_access_D5_legacy_mode', FALSE)) {
91
+      return; // disable comment access control
92
+    }
93
+    if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) {
94
+      if (is_numeric($cid = arg(2))) { // comment/edit/%, comment/delete/%
95
+        $access[] = (arg(1) == 'edit' ? 'update' : 'delete');
96
+        $comment = _comment_load($cid);
97
+        $nid = $comment->nid;
98
+        // If the node turns out to be in a forum where we have update/delete
99
+        // access, then we need Moderator permissions now, so we can moderate
100
+        // this comment.
101
+        // We won't provide full Administrator access, though: we'll remove
102
+        // author and timestamp, for example.
103
+        $grant_normal_access = TRUE;
105 104
       }
106
-      break;
105
+    }
106
+    break;
107 107
 
108
-    case 'node':
109
-      if (is_numeric(arg(1))) {
110
-        if (arg(2) == 'edit' && !user_access('administer nodes')) { // node/%/edit
111
-          $access[] = 'update';
112
-          $nid = arg(1);
113
-          // If the node turns out to be in a forum where we have update/delete
114
-          // access, then we already get limited edit capabilities from NA, but
115
-          // we need some more, e.g. publish/unpublish and comment status.
116
-          // In order to get these controls on the form, we need Moderator
117
-          // permissions now.
118
-          // We won't provide full Administrator access, though: we'll remove
119
-          // author and timestamp, for example.
120
-        }
121
-        if (arg(2) == 'delete' && !user_access('administer nodes')) { // node/%/delete
122
-          $access = array();
123
-          $nid = arg(1);
124
-          // This is the delete confirmation page. We don't need any
125
-          // additional permissions, but we'll assert 'view' access below.
126
-        }
127
-        if (arg(2) == NULL && !user_access('administer comments')) { // node/%
128
-          $access[] = 'update';
129
-          $nid = arg(1);
130
-          // If the node turns out to be in a forum where we have update/delete
131
-          // access, then we'll get the 'Edit' link automatically from NA, but
132
-          // we'll need Moderator permissions, so that we can add the edit/delete
133
-          // comment links (*after* we've identified the other comment links).
134
-        }
108
+  case 'node':
109
+    if (is_numeric(arg(1))) {
110
+      if (arg(2) == 'edit' && !user_access('administer nodes')) { // node/%/edit
111
+        $access[] = 'update';
112
+        $nid = arg(1);
113
+        // If the node turns out to be in a forum where we have update/delete
114
+        // access, then we already get limited edit capabilities from NA, but
115
+        // we need some more, e.g. publish/unpublish and comment status.
116
+        // In order to get these controls on the form, we need Moderator
117
+        // permissions now.
118
+        // We won't provide full Administrator access, though: we'll remove
119
+        // author and timestamp, for example.
135 120
       }
136
-      break;
137
-
138
-    case 'community':
139
-        if (arg(1)=='forum') {
140
-            if (is_numeric(arg(2))) {
141
-                $tid=arg(2);
142
-                // Obtain the tid from a URL path containing
143
-                // community/forum/%tid, this will prevent users from
144
-                // loading forums they are not allowed to access.
145
-                // However, only tid>1 are terms we care about. (This
146
-                // allows forum_tweaks mark-read functionality to
147
-                // work.)
148
-                if (isset($tid) and ($tid>1)) {
149
-                    if (!forum_access_access($tid, 'view')) {
150
-                        drupal_access_denied();
151
-                        module_invoke_all('exit');
152
-                        exit;
153
-                    }
154
-                }// isset($tid)
155
-            }// is_numeric(arg(2))
156
-        }// arg(1)==forum
121
+      if (arg(2) == 'delete' && !user_access('administer nodes')) { // node/%/delete
122
+        $access = array();
123
+        $nid = arg(1);
124
+        // This is the delete confirmation page. We don't need any
125
+        // additional permissions, but we'll assert 'view' access below.
126
+      }
127
+      if (arg(2) == NULL && !user_access('administer comments')) { // node/%
128
+        $access[] = 'update';
129
+        $nid = arg(1);
130
+        // If the node turns out to be in a forum where we have update/delete
131
+        // access, then we'll get the 'Edit' link automatically from NA, but
132
+        // we'll need Moderator permissions, so that we can add the edit/delete
133
+        // comment links (*after* we've identified the other comment links).
134
+      }
135
+    }
157 136
     break;
137
+
138
+  case 'community':
139
+      if (arg(1)=='forum') {
140
+          if (is_numeric(arg(2))) {
141
+              $tid=arg(2);
142
+              // Obtain the tid from a URL path containing
143
+              // community/forum/%tid, this will prevent users from
144
+              // loading forums they are not allowed to access.
145
+              // However, only tid>1 are terms we care about. (This
146
+              // allows forum_tweaks mark-read functionality to
147
+              // work.)
148
+              if (isset($tid) and ($tid>1)) {
149
+                  if (!forum_access_access($tid, 'view')) {
150
+                      drupal_access_denied();
151
+                      module_invoke_all('exit');
152
+                      exit;
153
+                  }
154
+              }// isset($tid)
155
+          }// is_numeric(arg(2))
156
+      }// arg(1)==forum
157
+  break;
158 158
   }// switch
159 159
   if (isset($nid)) {
160 160
     $node = node_load($nid);
@@ -244,36 +244,36 @@  discard block
 block discarded – undo
244 244
   global $user;
245 245
   $sql = NULL;
246 246
   switch ($primary_field) {
247
-    case 'tid':
248
-      if ($user->uid == 1
249
-        || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === FALSE
250
-        || user_access('administer forums') && $_GET['q'] == 'admin/content/forum') {
251
-        break;
252
-      }
253
-      if (strpos($_GET['q'], 'node/add/forum') !== FALSE) {
254
-        $required_access = 'create';
255
-      }
256
-      else {
257
-        $required_access = 'view';
258
-      }
259
-      $roles = implode(', ', array_keys($user->roles));
260
-      $sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid
247
+  case 'tid':
248
+    if ($user->uid == 1
249
+      || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === FALSE
250
+      || user_access('administer forums') && $_GET['q'] == 'admin/content/forum') {
251
+      break;
252
+    }
253
+    if (strpos($_GET['q'], 'node/add/forum') !== FALSE) {
254
+      $required_access = 'create';
255
+    }
256
+    else {
257
+      $required_access = 'view';
258
+    }
259
+    $roles = implode(', ', array_keys($user->roles));
260
+    $sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid
261 261
                       LEFT JOIN {acl} acl_fa ON acl_fa.number = $primary_table.tid AND acl_fa.module = 'forum_access'
262 262
                       LEFT JOIN {acl_user} aclu_fa ON aclu_fa.acl_id = acl_fa.acl_id AND aclu_fa.uid = $user->uid";
263
-      $sql['where'] = "(fa.grant_$required_access >= 1 AND fa.rid IN ($roles)) OR fa.tid IS NULL OR aclu_fa.uid = $user->uid";
264
-      $sql['distinct'] = 1;
265
-      break;
263
+    $sql['where'] = "(fa.grant_$required_access >= 1 AND fa.rid IN ($roles)) OR fa.tid IS NULL OR aclu_fa.uid = $user->uid";
264
+    $sql['distinct'] = 1;
265
+    break;
266 266
 
267
-    case 'rid':
268
-      if (strpos($query, 'FROM {role}') === FALSE
269
-        || strpos($_GET['q'] .'/', 'admin/content/forum/') === 0) {
270
-        break;
271
-      }
272
-      $moderator_rid = forum_access_query_moderator_rid();
273
-      if (!empty($moderator_rid)) {
274
-        $sql['where'] = "$primary_table.rid <> $moderator_rid";
275
-      }
267
+  case 'rid':
268
+    if (strpos($query, 'FROM {role}') === FALSE
269
+      || strpos($_GET['q'] .'/', 'admin/content/forum/') === 0) {
276 270
       break;
271
+    }
272
+    $moderator_rid = forum_access_query_moderator_rid();
273
+    if (!empty($moderator_rid)) {
274
+      $sql['where'] = "$primary_table.rid <> $moderator_rid";
275
+    }
276
+    break;
277 277
   }
278 278
   return $sql;
279 279
 }
@@ -301,42 +301,42 @@  discard block
 block discarded – undo
301 301
   }
302 302
 
303 303
   switch ($op) {
304
-    case 'presave':
305
-      $old_tid = db_result(db_query('SELECT tid FROM {forum} WHERE nid = %d', $node->nid));
306
-      break;
304
+  case 'presave':
305
+    $old_tid = db_result(db_query('SELECT tid FROM {forum} WHERE nid = %d', $node->nid));
306
+    break;
307 307
 
308
-    case 'update':
309
-      if (!empty($old_tid)) {
310
-        if (!empty($node->tid) && $node->tid == $old_tid) {
311
-          return;
312
-        }
313
-        acl_node_clear_acls($node->nid, 'forum_access');
308
+  case 'update':
309
+    if (!empty($old_tid)) {
310
+      if (!empty($node->tid) && $node->tid == $old_tid) {
311
+        return;
312
+      }
313
+      acl_node_clear_acls($node->nid, 'forum_access');
314 314
 
315
-        if (module_exists('nodecomment')) {
316
-          _forum_access_changed_tid($node->tid);
317
-          $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
318
-          while ($row = db_fetch_object($result)) {
319
-            acl_node_clear_acls($row->cid, 'forum_access');
320
-          }
315
+      if (module_exists('nodecomment')) {
316
+        _forum_access_changed_tid($node->tid);
317
+        $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
318
+        while ($row = db_fetch_object($result)) {
319
+          acl_node_clear_acls($row->cid, 'forum_access');
321 320
         }
322 321
       }
323
-      // Deliberate no break -- for changed and for previously unassigned terms we need an insert.
324
-
325
-    case 'insert':
326
-      if (!empty($node->tid)) {
327
-        $acl_id = acl_get_id_by_number('forum_access', $node->tid);
328
-        acl_node_add_acl($node->nid, $acl_id, 1, 1, 1);
329
-
330
-        if (isset($old_tid) && module_exists('nodecomment')) {
331
-          $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
332
-          while ($row = db_fetch_object($result)) {
333
-            acl_node_add_acl($row->cid, $acl_id, 1, 1, 1);
334
-            node_access_acquire_grants(node_load($row->cid));
335
-          }
322
+    }
323
+    // Deliberate no break -- for changed and for previously unassigned terms we need an insert.
324
+
325
+  case 'insert':
326
+    if (!empty($node->tid)) {
327
+      $acl_id = acl_get_id_by_number('forum_access', $node->tid);
328
+      acl_node_add_acl($node->nid, $acl_id, 1, 1, 1);
329
+
330
+      if (isset($old_tid) && module_exists('nodecomment')) {
331
+        $result = db_query('SELECT cid FROM {node_comments} WHERE nid = %d', $node->nid);
332
+        while ($row = db_fetch_object($result)) {
333
+          acl_node_add_acl($row->cid, $acl_id, 1, 1, 1);
334
+          node_access_acquire_grants(node_load($row->cid));
336 335
         }
337 336
       }
338
-      $old_tid = NULL;
339
-      break;
337
+    }
338
+    $old_tid = NULL;
339
+    break;
340 340
   }
341 341
 }
342 342
 
@@ -587,20 +587,20 @@  discard block
 block discarded – undo
587 587
  */
588 588
 function forum_access_user($op, &$edit, &$account, $category = NULL) {
589 589
   switch ($op) {
590
-    case 'validate':
591
-      $rid = forum_access_query_moderator_rid();
592
-      if (!empty($rid)) {
593
-        if (isset($edit['roles'][$rid]) && $edit['roles'][$rid]) {
594
-          $roles = user_roles();
595
-          $variables = array(
596
-            '@Forum_Access' => 'Forum Access',
597
-            '%Role' => $roles[$rid],
598
-          );
599
-          drupal_set_message(t('The %Role role is reserved for internal use by the @Forum_Access module! It was not assigned.', $variables), 'warning');
600
-          unset($edit['roles'][$rid]);
601
-        }
590
+  case 'validate':
591
+    $rid = forum_access_query_moderator_rid();
592
+    if (!empty($rid)) {
593
+      if (isset($edit['roles'][$rid]) && $edit['roles'][$rid]) {
594
+        $roles = user_roles();
595
+        $variables = array(
596
+          '@Forum_Access' => 'Forum Access',
597
+          '%Role' => $roles[$rid],
598
+        );
599
+        drupal_set_message(t('The %Role role is reserved for internal use by the @Forum_Access module! It was not assigned.', $variables), 'warning');
600
+        unset($edit['roles'][$rid]);
602 601
       }
603
-      break;
602
+    }
603
+    break;
604 604
   }
605 605
 }
606 606
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
       break;
137 137
 
138 138
     case 'community':
139
-        if (arg(1)=='forum') {
139
+        if (arg(1) == 'forum') {
140 140
             if (is_numeric(arg(2))) {
141
-                $tid=arg(2);
141
+                $tid = arg(2);
142 142
                 // Obtain the tid from a URL path containing
143 143
                 // community/forum/%tid, this will prevent users from
144 144
                 // loading forums they are not allowed to access.
145 145
                 // However, only tid>1 are terms we care about. (This
146 146
                 // allows forum_tweaks mark-read functionality to
147 147
                 // work.)
148
-                if (isset($tid) and ($tid>1)) {
148
+                if (isset($tid) and ($tid > 1)) {
149 149
                     if (!forum_access_access($tid, 'view')) {
150 150
                         drupal_access_denied();
151 151
                         module_invoke_all('exit');
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
  * Alter the node/comment create/edit forms and various admin forms.
188 188
  */
189 189
 function forum_access_form_alter(&$form, &$form_state, $form_id) {
190
-  if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) {
190
+  if (isset($form['type']['#value']) && $form['type']['#value'].'_node_form' == $form_id) {
191 191
     module_load_include('node.inc', 'forum_access');
192 192
     _forum_access_node_form($form, $form_state);
193 193
   }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
     case 'rid':
268 268
       if (strpos($query, 'FROM {role}') === FALSE
269
-        || strpos($_GET['q'] .'/', 'admin/content/forum/') === 0) {
269
+        || strpos($_GET['q'].'/', 'admin/content/forum/') === 0) {
270 270
         break;
271 271
       }
272 272
       $moderator_rid = forum_access_query_moderator_rid();
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     if ($tid && isset($links['comment_add']) && !forum_access_access($tid, 'comment_create')) {
421 421
       unset($links['comment_add']);
422 422
       // Hack to manually remove quote link
423
-      if ( isset($links['quote']) ) {
423
+      if (isset($links['quote'])) {
424 424
           unset($links['quote']);
425 425
       }
426 426
     }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     }
444 444
 
445 445
     // Hack to manually remove quote link if comment_reply link is no longer set
446
-    if ( (!(isset($links['comment_reply']))) AND isset($links['quote']) ) {
446
+    if ((!(isset($links['comment_reply']))) AND isset($links['quote'])) {
447 447
         unset($links['quote']);
448 448
     }
449 449
     
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     }
563 563
 
564 564
     $roles = array_keys($account->roles);
565
-    $result = db_result(db_query("SELECT tid FROM {forum_access} WHERE rid IN (". db_placeholders($roles) .") AND grant_". $type ." = 1 AND tid = %d", array_merge($roles, array($tid))));
565
+    $result = db_result(db_query("SELECT tid FROM {forum_access} WHERE rid IN (".db_placeholders($roles).") AND grant_".$type." = 1 AND tid = %d", array_merge($roles, array($tid))));
566 566
 
567 567
     if ($result) {
568 568
       $cache[$account->uid][$tid][$type] = 1;
Please login to merge, or discard this patch.
Braces   +24 added lines, -36 removed lines patch added patch discarded remove patch
@@ -38,8 +38,7 @@  discard block
 block discarded – undo
38 38
   if (isset($node->comment_target_nid)) {
39 39
     if ($changed_tid = _forum_access_changed_tid()) {
40 40
       $tid = $changed_tid; // the topic node hasn't been saved yet!
41
-    }
42
-    else {
41
+    } else {
43 42
       $node = node_load($node->comment_target_nid);
44 43
       $tid = _forum_access_get_tid($node);
45 44
     }
@@ -91,7 +90,8 @@  discard block
 block discarded – undo
91 90
         return; // disable comment access control
92 91
       }
93 92
       if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) {
94
-        if (is_numeric($cid = arg(2))) { // comment/edit/%, comment/delete/%
93
+        if (is_numeric($cid = arg(2))) {
94
+// comment/edit/%, comment/delete/%
95 95
           $access[] = (arg(1) == 'edit' ? 'update' : 'delete');
96 96
           $comment = _comment_load($cid);
97 97
           $nid = $comment->nid;
@@ -107,7 +107,8 @@  discard block
 block discarded – undo
107 107
 
108 108
     case 'node':
109 109
       if (is_numeric(arg(1))) {
110
-        if (arg(2) == 'edit' && !user_access('administer nodes')) { // node/%/edit
110
+        if (arg(2) == 'edit' && !user_access('administer nodes')) {
111
+// node/%/edit
111 112
           $access[] = 'update';
112 113
           $nid = arg(1);
113 114
           // If the node turns out to be in a forum where we have update/delete
@@ -118,13 +119,15 @@  discard block
 block discarded – undo
118 119
           // We won't provide full Administrator access, though: we'll remove
119 120
           // author and timestamp, for example.
120 121
         }
121
-        if (arg(2) == 'delete' && !user_access('administer nodes')) { // node/%/delete
122
+        if (arg(2) == 'delete' && !user_access('administer nodes')) {
123
+// node/%/delete
122 124
           $access = array();
123 125
           $nid = arg(1);
124 126
           // This is the delete confirmation page. We don't need any
125 127
           // additional permissions, but we'll assert 'view' access below.
126 128
         }
127
-        if (arg(2) == NULL && !user_access('administer comments')) { // node/%
129
+        if (arg(2) == NULL && !user_access('administer comments')) {
130
+// node/%
128 131
           $access[] = 'update';
129 132
           $nid = arg(1);
130 133
           // If the node turns out to be in a forum where we have update/delete
@@ -190,44 +193,34 @@  discard block
 block discarded – undo
190 193
   if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) {
191 194
     module_load_include('node.inc', 'forum_access');
192 195
     _forum_access_node_form($form, $form_state);
193
-  }
194
-  elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', FALSE)) {
196
+  } elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', FALSE)) {
195 197
     module_load_include('node.inc', 'forum_access');
196 198
     _forum_access_comment_form($form, $form_state);
197
-  }
198
-  elseif ($form_id == 'forum_overview') {
199
+  } elseif ($form_id == 'forum_overview') {
199 200
     module_load_include('admin.inc', 'forum_access');
200 201
     _forum_access_forum_overview($form, $form_state);
201
-  }
202
-  elseif ($form_id == 'forum_form_container') {
202
+  } elseif ($form_id == 'forum_form_container') {
203 203
     module_load_include('admin.inc', 'forum_access');
204 204
     _forum_access_forum_form($form, $form_state, TRUE);
205
-  }
206
-  elseif ($form_id == 'forum_form_forum') {
205
+  } elseif ($form_id == 'forum_form_forum') {
207 206
     module_load_include('admin.inc', 'forum_access');
208 207
     _forum_access_forum_form($form, $form_state, FALSE);
209
-  }
210
-  elseif ($form_id == 'forum_admin_settings') {
208
+  } elseif ($form_id == 'forum_admin_settings') {
211 209
     module_load_include('admin.inc', 'forum_access');
212 210
     _forum_access_forum_admin_settings_form($form, $form_state);
213
-  }
214
-  elseif ($form_id == 'user_admin_role') {
211
+  } elseif ($form_id == 'user_admin_role') {
215 212
     module_load_include('admin.inc', 'forum_access');
216 213
     _forum_access_user_admin_role_form($form, $form_state);
217
-  }
218
-  elseif ($form_id == 'content_access_admin_settings' && empty($_POST)) {
214
+  } elseif ($form_id == 'content_access_admin_settings' && empty($_POST)) {
219 215
     module_load_include('admin.inc', 'forum_access');
220 216
     _forum_access_content_access_admin_form();
221
-  }
222
-  elseif ($form_id == 'user_admin_perm') {
217
+  } elseif ($form_id == 'user_admin_perm') {
223 218
     module_load_include('admin.inc', 'forum_access');
224 219
     _forum_access_user_admin_perm_form($form, $form_state);
225
-  }
226
-  elseif ($form_id == 'user_admin_account') {
220
+  } elseif ($form_id == 'user_admin_account') {
227 221
     module_load_include('admin.inc', 'forum_access');
228 222
     _forum_access_user_admin_account_form($form, $form_state);
229
-  }
230
-  elseif ($form_id == 'user_profile_form') {
223
+  } elseif ($form_id == 'user_profile_form') {
231 224
     module_load_include('admin.inc', 'forum_access');
232 225
     _forum_access_user_profile_form($form, $form_state);
233 226
   }
@@ -252,8 +245,7 @@  discard block
 block discarded – undo
252 245
       }
253 246
       if (strpos($_GET['q'], 'node/add/forum') !== FALSE) {
254 247
         $required_access = 'create';
255
-      }
256
-      else {
248
+      } else {
257 249
         $required_access = 'view';
258 250
       }
259 251
       $roles = implode(', ', array_keys($user->roles));
@@ -424,8 +416,7 @@  discard block
 block discarded – undo
424 416
           unset($links['quote']);
425 417
       }
426 418
     }
427
-  }
428
-  else {
419
+  } else {
429 420
     // Check links for the comment.
430 421
     $required_keys = array(
431 422
       'comment_create' => 'comment_reply',
@@ -436,8 +427,7 @@  discard block
 block discarded – undo
436 427
       if (!forum_access_access($tid, $access) && !($access == 'update' && comment_access('edit', $comment))) {
437 428
         unset($links[$required_keys[$access]]);
438 429
         unset($required_keys[$access]);
439
-      }
440
-      elseif (!array_key_exists($key, $links)) {
430
+      } elseif (!array_key_exists($key, $links)) {
441 431
         $link_is_missing = TRUE;
442 432
       }
443 433
     }
@@ -566,15 +556,13 @@  discard block
 block discarded – undo
566 556
 
567 557
     if ($result) {
568 558
       $cache[$account->uid][$tid][$type] = 1;
569
-    }
570
-    else {
559
+    } else {
571 560
       // check our moderators too
572 561
       $acl_id = acl_get_id_by_number('forum_access', $tid);
573 562
       $result = db_result(db_query("SELECT uid FROM {acl_user} WHERE acl_id = %d AND uid = %d", $acl_id, $account->uid));
574 563
       if ($result) {
575 564
         $cache[$account->uid][$tid][$type] = 2;
576
-      }
577
-      else {
565
+      } else {
578 566
         $cache[$account->uid][$tid][$type] = FALSE;
579 567
       }
580 568
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
   if ($tid) {
49 49
     if (!isset($grants[$tid])) {
50 50
       if (!isset($node_admins)) {
51
-        $node_admins = user_roles(FALSE, 'administer nodes');
51
+        $node_admins = user_roles(false, 'administer nodes');
52 52
       }
53 53
       $result = db_query('SELECT * FROM {forum_access} WHERE tid = %d', $tid);
54 54
       while ($grant = db_fetch_object($result)) {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
   switch (arg(0)) {
89 89
     case 'comment':
90
-      if (variable_get('forum_access_D5_legacy_mode', FALSE)) {
90
+      if (variable_get('forum_access_D5_legacy_mode', false)) {
91 91
         return; // disable comment access control
92 92
       }
93 93
       if ((arg(1) == 'edit' || arg(1) == 'delete') && !user_access('administer comments')) {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
           // this comment.
101 101
           // We won't provide full Administrator access, though: we'll remove
102 102
           // author and timestamp, for example.
103
-          $grant_normal_access = TRUE;
103
+          $grant_normal_access = true;
104 104
         }
105 105
       }
106 106
       break;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
           // This is the delete confirmation page. We don't need any
125 125
           // additional permissions, but we'll assert 'view' access below.
126 126
         }
127
-        if (arg(2) == NULL && !user_access('administer comments')) { // node/%
127
+        if (arg(2) == null && !user_access('administer comments')) { // node/%
128 128
           $access[] = 'update';
129 129
           $nid = arg(1);
130 130
           // If the node turns out to be in a forum where we have update/delete
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     module_load_include('node.inc', 'forum_access');
192 192
     _forum_access_node_form($form, $form_state);
193 193
   }
194
-  elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', FALSE)) {
194
+  elseif ($form_id == 'comment_form' && !variable_get('forum_access_D5_legacy_mode', false)) {
195 195
     module_load_include('node.inc', 'forum_access');
196 196
     _forum_access_comment_form($form, $form_state);
197 197
   }
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
   }
202 202
   elseif ($form_id == 'forum_form_container') {
203 203
     module_load_include('admin.inc', 'forum_access');
204
-    _forum_access_forum_form($form, $form_state, TRUE);
204
+    _forum_access_forum_form($form, $form_state, true);
205 205
   }
206 206
   elseif ($form_id == 'forum_form_forum') {
207 207
     module_load_include('admin.inc', 'forum_access');
208
-    _forum_access_forum_form($form, $form_state, FALSE);
208
+    _forum_access_forum_form($form, $form_state, false);
209 209
   }
210 210
   elseif ($form_id == 'forum_admin_settings') {
211 211
     module_load_include('admin.inc', 'forum_access');
@@ -242,15 +242,15 @@  discard block
 block discarded – undo
242 242
  */
243 243
 function forum_access_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
244 244
   global $user;
245
-  $sql = NULL;
245
+  $sql = null;
246 246
   switch ($primary_field) {
247 247
     case 'tid':
248 248
       if ($user->uid == 1
249
-        || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === FALSE
249
+        || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === false
250 250
         || user_access('administer forums') && $_GET['q'] == 'admin/content/forum') {
251 251
         break;
252 252
       }
253
-      if (strpos($_GET['q'], 'node/add/forum') !== FALSE) {
253
+      if (strpos($_GET['q'], 'node/add/forum') !== false) {
254 254
         $required_access = 'create';
255 255
       }
256 256
       else {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
       break;
266 266
 
267 267
     case 'rid':
268
-      if (strpos($query, 'FROM {role}') === FALSE
268
+      if (strpos($query, 'FROM {role}') === false
269 269
         || strpos($_GET['q'] .'/', 'admin/content/forum/') === 0) {
270 270
         break;
271 271
       }
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
  *
284 284
  * Add ACL data to fresh forum posts.
285 285
  */
286
-function forum_access_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
287
-  static $old_tid = NULL;
286
+function forum_access_nodeapi(&$node, $op, $teaser = null, $page = null) {
287
+  static $old_tid = null;
288 288
   // This is modeled after forum_nodeapi():
289 289
   $vid = _forum_access_get_vid();
290 290
   $vocabulary = taxonomy_vocabulary_load($vid);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
           }
336 336
         }
337 337
       }
338
-      $old_tid = NULL;
338
+      $old_tid = null;
339 339
       break;
340 340
   }
341 341
 }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
  * and thus it is disabled by default. Set the variable to TRUE to enable.
362 362
  */
363 363
 function forum_access_preprocess_forum_list(&$variables) {
364
-  if (variable_get('forum_access_provide_moderators_template_variable', FALSE)) {
364
+  if (variable_get('forum_access_provide_moderators_template_variable', false)) {
365 365
     static $users;
366 366
     foreach ($variables['forums'] as $tid => $forum) {
367 367
       $moderators = array();
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
           $moderators[$uid] = $users[$uid];
374 374
         }
375 375
       }
376
-      $forum->forum_access_moderators = (empty($moderators) ? NULL : $moderators);
376
+      $forum->forum_access_moderators = (empty($moderators) ? null : $moderators);
377 377
     }
378 378
   }
379 379
 }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
   }
395 395
 }
396 396
 
397
-if (!variable_get('forum_access_D5_legacy_mode', FALSE)) {
397
+if (!variable_get('forum_access_D5_legacy_mode', false)) {
398 398
   // LEGACY-MODE disables these methods
399 399
 
400 400
 /**
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
  * For nodes, remove the 'Add new comment' link, if the user does not have the
404 404
  * 'comment_create' permission; for comments, add any missing links (D6.17+).
405 405
  */
406
-function forum_access_link_alter(&$links, $node, $comment = NULL) {
406
+function forum_access_link_alter(&$links, $node, $comment = null) {
407 407
   global $user;
408
-  static $user1, $recursing = FALSE, $stored_links;
408
+  static $user1, $recursing = false, $stored_links;
409 409
 
410 410
   // If we are being called recursively, store the $links and return.
411 411
   if ($recursing) {
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
         unset($required_keys[$access]);
439 439
       }
440 440
       elseif (!array_key_exists($key, $links)) {
441
-        $link_is_missing = TRUE;
441
+        $link_is_missing = true;
442 442
       }
443 443
     }
444 444
 
445 445
     // Hack to manually remove quote link if comment_reply link is no longer set
446
-    if ( (!(isset($links['comment_reply']))) AND isset($links['quote']) ) {
446
+    if ( (!(isset($links['comment_reply']))) and isset($links['quote']) ) {
447 447
         unset($links['quote']);
448 448
     }
449 449
     
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         $user1 = user_load(1);
459 459
       }
460 460
       $saved_user = $user;
461
-      session_save_session(FALSE);
461
+      session_save_session(false);
462 462
       $user = $user1;
463 463
 
464 464
       // With UID 1 we call hook_link(). This should give us the full set of
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
       $admin_links = module_invoke_all('link', 'comment', $comment, array_key_exists('comment_parent', $links));
467 467
 
468 468
       $user = $saved_user;
469
-      session_save_session(TRUE);
469
+      session_save_session(true);
470 470
 
471 471
       // Remove the links from $admin_links that are not in the reduced
472 472
       // set of $required_links AND not available to the current user anyway.
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
       // called it will store a copy of the links at their current state. Then
484 484
       // we pull those links which have not been link_alter'ed by any modules
485 485
       // that come after forum_access.
486
-      $recursing = TRUE;
486
+      $recursing = true;
487 487
       drupal_alter('link', $admin_links, $node, $comment);
488
-      $recursing = FALSE;
488
+      $recursing = false;
489 489
       // Now return the stored links.
490 490
       $links = $stored_links;
491 491
     }
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
 /**
524 524
  * This is also required by ACL module.
525 525
  */
526
-function forum_access_enabled($set = NULL) {
527
-  static $enabled = TRUE;
528
-  if ($set !== NULL) {
526
+function forum_access_enabled($set = null) {
527
+  static $enabled = true;
528
+  if ($set !== null) {
529 529
     $enabled = $set;
530 530
   }
531 531
   return $enabled;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
  *   1     - access granted
545 545
  *   2     - access granted for forum moderator
546 546
  */
547
-function forum_access_access($tid, $type, $account = NULL, $administer_nodes_sees_everything = TRUE) {
547
+function forum_access_access($tid, $type, $account = null, $administer_nodes_sees_everything = true) {
548 548
   static $cache = array();
549 549
   if (!$account) {
550 550
     global $user;
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
   }
553 553
 
554 554
   if ($account->uid == 1 ||
555
-      $administer_nodes_sees_everything && user_access('administer nodes', $account) && array_search($type, array('view', 'update', 'delete')) !== FALSE) {
555
+      $administer_nodes_sees_everything && user_access('administer nodes', $account) && array_search($type, array('view', 'update', 'delete')) !== false) {
556 556
     return 1;
557 557
   }
558 558
 
559 559
   if (!isset($cache[$account->uid][$tid][$type])) {
560 560
     if (!user_access('access content', $account)) {
561
-      return $cache[$account->uid][$tid][$type] = FALSE;
561
+      return $cache[$account->uid][$tid][$type] = false;
562 562
     }
563 563
 
564 564
     $roles = array_keys($account->roles);
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
         $cache[$account->uid][$tid][$type] = 2;
576 576
       }
577 577
       else {
578
-        $cache[$account->uid][$tid][$type] = FALSE;
578
+        $cache[$account->uid][$tid][$type] = false;
579 579
       }
580 580
     }
581 581
   }
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 /**
586 586
  * Implementation of hook_user().
587 587
  */
588
-function forum_access_user($op, &$edit, &$account, $category = NULL) {
588
+function forum_access_user($op, &$edit, &$account, $category = null) {
589 589
   switch ($op) {
590 590
     case 'validate':
591 591
       $rid = forum_access_query_moderator_rid();
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
  * no forum or container is specified will return TRUE if the user has at least
629 629
  * one role that can access at least one forum.
630 630
  */
631
-function _forum_access_forum_access_callback($tid = NULL) {
631
+function _forum_access_forum_access_callback($tid = null) {
632 632
   return (!$tid && _forum_access_access_any_forum()) || forum_access_access($tid, 'view');
633 633
 }
634 634
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
  * Returns TRUE if the user has at least one role that can access
639 639
  * at least one forum.
640 640
  */
641
-function _forum_access_access_any_forum($account = NULL) {
641
+function _forum_access_access_any_forum($account = null) {
642 642
   global $user;
643 643
   static $return = array();
644 644
 
@@ -648,12 +648,12 @@  discard block
 block discarded – undo
648 648
 
649 649
   if (!isset($return[$account->uid])) {
650 650
     if ($account->uid == 1) {
651
-      return $return[$account->uid] = TRUE;
651
+      return $return[$account->uid] = true;
652 652
     }
653 653
     if (!user_access('access content', $account)) {
654
-      return $return[$account->uid] = FALSE;
654
+      return $return[$account->uid] = false;
655 655
     }
656
-    $rids = variable_get('forum_access_rids', NULL);
656
+    $rids = variable_get('forum_access_rids', null);
657 657
     if (!isset($rids)) {
658 658
       $rids = array();
659 659
       $result = db_query("SELECT fa.rid FROM {forum_access} fa WHERE fa.grant_view > 0 GROUP BY fa.rid");
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
     }
665 665
     foreach ($rids as $rid) {
666 666
       if (isset($account->roles[$rid])) {
667
-        return $return[$account->uid] = TRUE;
667
+        return $return[$account->uid] = true;
668 668
       }
669 669
     }
670
-    $return[$account->uid] = FALSE;
670
+    $return[$account->uid] = false;
671 671
   }
672 672
   return $return[$account->uid];
673 673
 }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
  *
678 678
  * Delete {forum_access} records when forums are deleted.
679 679
  */
680
-function forum_access_taxonomy($op, $type, $array = NULL) {
680
+function forum_access_taxonomy($op, $type, $array = null) {
681 681
   //dpm($array, "hook_taxonomy($op, $type)");
682 682
   if ($type = 'term' && $op == 'delete' && $array['vid'] == _forum_access_get_vid()) {
683 683
     db_query("DELETE FROM {forum_access} WHERE tid = %d", $array['tid']);
@@ -697,21 +697,21 @@  discard block
 block discarded – undo
697 697
  * exist.
698 698
  */
699 699
 function forum_access_query_moderator_rid() {
700
-  return variable_get('forum_access_moderator_rid', NULL);
700
+  return variable_get('forum_access_moderator_rid', null);
701 701
 }
702 702
 
703 703
 /**
704 704
  * Return the forum tid or FALSE.
705 705
  */
706 706
 function _forum_access_get_tid($node) {
707
-  return (isset($node->forum_tid) ? $node->forum_tid : (isset($node->tid) ? $node->tid : FALSE));
707
+  return (isset($node->forum_tid) ? $node->forum_tid : (isset($node->tid) ? $node->tid : false));
708 708
 }
709 709
 
710 710
 /**
711 711
  * Save and return the $tid.
712 712
  */
713
-function _forum_access_changed_tid($tid = NULL) {
714
-  static $saved_tid = NULL;
713
+function _forum_access_changed_tid($tid = null) {
714
+  static $saved_tid = null;
715 715
   if (!empty($tid)) {
716 716
     $saved_tid = $tid;
717 717
   }
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
  * Implementation of hook_node_access_explain().
723 723
  */
724 724
 function forum_access_node_access_explain($row) {
725
-  static $roles = NULL;
725
+  static $roles = null;
726 726
   if ($row->realm == 'forum_access') {
727 727
     if (!isset($roles)) {
728 728
       module_load_include('node.inc', 'forum_access');
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 /**
739 739
  * Implementation of hook_acl_explain().
740 740
  */
741
-function forum_access_acl_explain($acl_id, $name, $number, $users = NULL) {
741
+function forum_access_acl_explain($acl_id, $name, $number, $users = null) {
742 742
   if (empty($users)) {
743 743
     return "ACL (id=$acl_id) would grant access to nodes in forum/$number.";
744 744
   }
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/i18nviews/includes/i18nviews.views.inc 2 patches
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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 function i18nviews_views_handlers() {
19 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 24
       'content_negotiation_filter_handler' => array(
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  * Implementation of hook_views_plugins().
33 33
  */
34 34
 function i18nviews_views_plugins() {
35
-  $path = drupal_get_path('module', 'i18nviews') . '/includes';
35
+  $path = drupal_get_path('module', 'i18nviews').'/includes';
36 36
   return array(
37 37
     'module' => 'i18nviews',
38 38
     'localization' => array(
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/wysiwyg/wysiwyg.admin.inc 4 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
  * Form builder for Wysiwyg profile form.
10 10
  */
11 11
 function wysiwyg_profile_form($form_state, $profile) {
12
-  // Merge in defaults.
13
-  $profile = (array) $profile;
14
-  $profile += array(
12
+    // Merge in defaults.
13
+    $profile = (array) $profile;
14
+    $profile += array(
15 15
     'format' => 0,
16 16
     'editor' => '',
17
-  );
18
-  if (empty($profile['settings'])) {
17
+    );
18
+    if (empty($profile['settings'])) {
19 19
     $profile['settings'] = array();
20
-  }
21
-  $profile['settings'] += array(
20
+    }
21
+    $profile['settings'] += array(
22 22
     'default' => TRUE,
23 23
     'user_choose' => FALSE,
24 24
     'show_toggle' => TRUE,
@@ -42,264 +42,264 @@  discard block
 block discarded – undo
42 42
     'css_setting' => 'theme',
43 43
     'css_path' => NULL,
44 44
     'css_classes' => NULL,
45
-  );
46
-  $profile = (object) $profile;
45
+    );
46
+    $profile = (object) $profile;
47 47
 
48
-  $formats = filter_formats();
49
-  $editor = wysiwyg_get_editor($profile->editor);
50
-  drupal_set_title(t('%editor profile for %format', array('%editor' => $editor['title'], '%format' => $formats[$profile->format]->name)));
48
+    $formats = filter_formats();
49
+    $editor = wysiwyg_get_editor($profile->editor);
50
+    drupal_set_title(t('%editor profile for %format', array('%editor' => $editor['title'], '%format' => $formats[$profile->format]->name)));
51 51
 
52
-  $form['format'] = array('#type' => 'value', '#value' => $profile->format);
53
-  $form['input_format'] = array('#type' => 'value', '#value' => $formats[$profile->format]->name);
54
-  $form['editor'] = array('#type' => 'value', '#value' => $profile->editor);
52
+    $form['format'] = array('#type' => 'value', '#value' => $profile->format);
53
+    $form['input_format'] = array('#type' => 'value', '#value' => $formats[$profile->format]->name);
54
+    $form['editor'] = array('#type' => 'value', '#value' => $profile->editor);
55 55
 
56
-  $form['basic'] = array(
56
+    $form['basic'] = array(
57 57
     '#type' => 'fieldset',
58 58
     '#title' => t('Basic setup'),
59 59
     '#collapsible' => TRUE,
60 60
     '#collapsed' => TRUE,
61
-  );
61
+    );
62 62
 
63
-  $form['basic']['default'] = array(
63
+    $form['basic']['default'] = array(
64 64
     '#type' => 'checkbox',
65 65
     '#title' => t('Enabled by default'),
66 66
     '#default_value' => $profile->settings['default'],
67 67
     '#return_value' => 1,
68 68
     '#description' => t('The default editor state for users having access to this profile. Users are able to override this state if the next option is enabled.'),
69
-  );
69
+    );
70 70
 
71
-  $form['basic']['user_choose'] = array(
71
+    $form['basic']['user_choose'] = array(
72 72
     '#type' => 'checkbox',
73 73
     '#title' => t('Allow users to choose default'),
74 74
     '#default_value' => $profile->settings['user_choose'],
75 75
     '#return_value' => 1,
76 76
     '#description' => t('If allowed, users will be able to choose their own editor default state in their user account settings.'),
77
-  );
77
+    );
78 78
 
79
-  $form['basic']['show_toggle'] = array(
79
+    $form['basic']['show_toggle'] = array(
80 80
     '#type' => 'checkbox',
81 81
     '#title' => t('Show <em>enable/disable rich text</em> toggle link'),
82 82
     '#default_value' => $profile->settings['show_toggle'],
83 83
     '#return_value' => 1,
84 84
     '#description' => t('Whether or not to show the <em>enable/disable rich text</em> toggle link below a textarea. If disabled, the user setting or global default is used (see above).'),
85
-  );
85
+    );
86 86
 
87
-  $form['basic']['theme'] = array(
87
+    $form['basic']['theme'] = array(
88 88
     '#type' => 'hidden',
89 89
     '#value' => $profile->settings['theme'],
90
-  );
90
+    );
91 91
 
92
-  $form['basic']['language'] = array(
92
+    $form['basic']['language'] = array(
93 93
     '#type' => 'select',
94 94
     '#title' => t('Interface language'),
95 95
     '#default_value' => $profile->settings['language'],
96
-  );
97
-  // @see _locale_prepare_predefined_list()
98
-  require_once './includes/locale.inc';
99
-  $predefined = _locale_get_predefined_list();
100
-  foreach ($predefined as $key => $value) {
96
+    );
97
+    // @see _locale_prepare_predefined_list()
98
+    require_once './includes/locale.inc';
99
+    $predefined = _locale_get_predefined_list();
100
+    foreach ($predefined as $key => $value) {
101 101
     // Include native name in output, if possible
102 102
     if (count($value) > 1) {
103
-      $tname = t($value[0]);
104
-      $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])";
103
+        $tname = t($value[0]);
104
+        $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])";
105 105
     }
106 106
     else {
107
-      $predefined[$key] = t($value[0]);
107
+        $predefined[$key] = t($value[0]);
108
+    }
108 109
     }
109
-  }
110
-  asort($predefined);
111
-  $form['basic']['language']['#options'] = $predefined;
110
+    asort($predefined);
111
+    $form['basic']['language']['#options'] = $predefined;
112 112
 
113
-  $form['buttons'] = array(
113
+    $form['buttons'] = array(
114 114
     '#type' => 'fieldset',
115 115
     '#title' => t('Buttons and plugins'),
116 116
     '#collapsible' => TRUE,
117 117
     '#collapsed' => TRUE,
118 118
     '#tree' => TRUE,
119 119
     '#theme' => 'wysiwyg_admin_button_table',
120
-  );
120
+    );
121 121
 
122
-  $plugins = wysiwyg_get_plugins($profile->editor);
123
-  // Generate the button list.
124
-  foreach ($plugins as $name => $meta) {
122
+    $plugins = wysiwyg_get_plugins($profile->editor);
123
+    // Generate the button list.
124
+    foreach ($plugins as $name => $meta) {
125 125
     if (isset($meta['buttons']) && is_array($meta['buttons'])) {
126
-      foreach ($meta['buttons'] as $button => $title) {
126
+        foreach ($meta['buttons'] as $button => $title) {
127 127
         $icon = '';
128 128
         if (!empty($meta['path'])) {
129
-          // @todo Button icon locations are different in editors, editor versions,
130
-          //   and contrib/custom plugins (like Image Assist, f.e.).
131
-          $img_src = $meta['path'] . "/images/$name.gif";
132
-          // Handle plugins that have more than one button.
133
-          if (!file_exists($img_src)) {
129
+            // @todo Button icon locations are different in editors, editor versions,
130
+            //   and contrib/custom plugins (like Image Assist, f.e.).
131
+            $img_src = $meta['path'] . "/images/$name.gif";
132
+            // Handle plugins that have more than one button.
133
+            if (!file_exists($img_src)) {
134 134
             $img_src = $meta['path'] . "/images/$button.gif";
135
-          }
136
-          $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : '';
135
+            }
136
+            $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : '';
137 137
         }
138 138
         $title = (isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title);
139 139
         $title = (!empty($icon) ? $icon . ' ' . $title : $title);
140 140
         $form['buttons'][$name][$button] = array(
141
-          '#type' => 'checkbox',
142
-          '#title' => $title,
143
-          '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE,
141
+            '#type' => 'checkbox',
142
+            '#title' => $title,
143
+            '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE,
144 144
         );
145
-      }
145
+        }
146 146
     }
147 147
     else if (isset($meta['extensions']) && is_array($meta['extensions'])) {
148
-      foreach ($meta['extensions'] as $extension => $title) {
148
+        foreach ($meta['extensions'] as $extension => $title) {
149 149
         $form['buttons'][$name][$extension] = array(
150
-          '#type' => 'checkbox',
151
-          '#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title,
152
-          '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE,
150
+            '#type' => 'checkbox',
151
+            '#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title,
152
+            '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE,
153 153
         );
154
-      }
154
+        }
155
+    }
155 156
     }
156
-  }
157 157
 
158
-  $form['appearance'] = array(
158
+    $form['appearance'] = array(
159 159
     '#type' => 'fieldset',
160 160
     '#title' => t('Editor appearance'),
161 161
     '#collapsible' => TRUE,
162 162
     '#collapsed' => TRUE,
163
-  );
163
+    );
164 164
 
165
-  $form['appearance']['toolbar_loc'] = array(
165
+    $form['appearance']['toolbar_loc'] = array(
166 166
     '#type' => 'select',
167 167
     '#title' => t('Toolbar location'),
168 168
     '#default_value' => $profile->settings['toolbar_loc'],
169 169
     '#options' => array('bottom' => t('Bottom'), 'top' => t('Top')),
170 170
     '#description' => t('This option controls whether the editor toolbar is displayed above or below the editing area.'),
171
-  );
171
+    );
172 172
 
173
-  $form['appearance']['toolbar_align'] = array(
173
+    $form['appearance']['toolbar_align'] = array(
174 174
     '#type' => 'select',
175 175
     '#title' => t('Button alignment'),
176 176
     '#default_value' => $profile->settings['toolbar_align'],
177 177
     '#options' => array('center' => t('Center'), 'left' => t('Left'), 'right' => t('Right')),
178 178
     '#description' => t('This option controls the alignment of icons in the editor toolbar.'),
179
-  );
179
+    );
180 180
 
181
-  $form['appearance']['path_loc'] = array(
181
+    $form['appearance']['path_loc'] = array(
182 182
     '#type' => 'select',
183 183
     '#title' => t('Path location'),
184 184
     '#default_value' => $profile->settings['path_loc'],
185 185
     '#options' => array('none' => t('Hide'), 'top' => t('Top'), 'bottom' => t('Bottom')),
186 186
     '#description' => t('Where to display the path to HTML elements (i.e. <code>body > table > tr > td</code>).'),
187
-  );
187
+    );
188 188
 
189
-  $form['appearance']['resizing'] = array(
189
+    $form['appearance']['resizing'] = array(
190 190
     '#type' => 'checkbox',
191 191
     '#title' => t('Enable resizing button'),
192 192
     '#default_value' => $profile->settings['resizing'],
193 193
     '#return_value' => 1,
194 194
     '#description' => t('This option gives you the ability to enable/disable the resizing button. If enabled, the Path location toolbar must be set to "Top" or "Bottom" in order to display the resize icon.'),
195
-  );
195
+    );
196 196
 
197
-  $form['output'] = array(
197
+    $form['output'] = array(
198 198
     '#type' => 'fieldset',
199 199
     '#title' => t('Cleanup and output'),
200 200
     '#collapsible' => TRUE,
201 201
     '#collapsed' => TRUE,
202
-  );
202
+    );
203 203
 
204
-  $form['output']['verify_html'] = array(
204
+    $form['output']['verify_html'] = array(
205 205
     '#type' => 'checkbox',
206 206
     '#title' => t('Verify HTML'),
207 207
     '#default_value' => $profile->settings['verify_html'],
208 208
     '#return_value' => 1,
209 209
     '#description' => t('If enabled, potentially malicious code like <code>&lt;HEAD&gt;</code> tags will be removed from HTML contents.'),
210
-  );
210
+    );
211 211
 
212
-  $form['output']['preformatted'] = array(
212
+    $form['output']['preformatted'] = array(
213 213
     '#type' => 'checkbox',
214 214
     '#title' => t('Preformatted'),
215 215
     '#default_value' => $profile->settings['preformatted'],
216 216
     '#return_value' => 1,
217 217
     '#description' => t('If enabled, the editor will insert TAB characters on tab and preserve other whitespace characters just like a PRE element in HTML does.'),
218
-  );
218
+    );
219 219
 
220
-  $form['output']['convert_fonts_to_spans'] = array(
220
+    $form['output']['convert_fonts_to_spans'] = array(
221 221
     '#type' => 'checkbox',
222 222
     '#title' => t('Convert &lt;font&gt; tags to styles'),
223 223
     '#default_value' => $profile->settings['convert_fonts_to_spans'],
224 224
     '#return_value' => 1,
225 225
     '#description' => t('If enabled, HTML tags declaring the font size, font family, font color and font background color will be replaced by inline CSS styles.'),
226
-  );
226
+    );
227 227
 
228
-  $form['output']['remove_linebreaks'] = array(
228
+    $form['output']['remove_linebreaks'] = array(
229 229
     '#type' => 'checkbox',
230 230
     '#title' => t('Remove linebreaks'),
231 231
     '#default_value' => $profile->settings['remove_linebreaks'],
232 232
     '#return_value' => 1,
233 233
     '#description' => t('If enabled, the editor will remove most linebreaks from contents. Disabling this option could avoid conflicts with other input filters.'),
234
-  );
234
+    );
235 235
 
236
-  $form['output']['apply_source_formatting'] = array(
236
+    $form['output']['apply_source_formatting'] = array(
237 237
     '#type' => 'checkbox',
238 238
     '#title' => t('Apply source formatting'),
239 239
     '#default_value' => $profile->settings['apply_source_formatting'],
240 240
     '#return_value' => 1,
241 241
     '#description' => t('If enabled, the editor will re-format the HTML source code. Disabling this option could avoid conflicts with other input filters.'),
242
-  );
242
+    );
243 243
 
244
-  $form['output']['paste_auto_cleanup_on_paste'] = array(
244
+    $form['output']['paste_auto_cleanup_on_paste'] = array(
245 245
     '#type' => 'checkbox',
246 246
     '#title' => t('Force cleanup on standard paste'),
247 247
     '#default_value' => $profile->settings['paste_auto_cleanup_on_paste'],
248 248
     '#return_value' => 1,
249 249
     '#description' => t('If enabled, the default paste function (CTRL-V or SHIFT-INS) behaves like the "paste from word" plugin function.'),
250
-  );
250
+    );
251 251
 
252
-  $form['css'] = array(
252
+    $form['css'] = array(
253 253
     '#type' => 'fieldset',
254 254
     '#title' => t('CSS'),
255 255
     '#collapsible' => TRUE,
256 256
     '#collapsed' => TRUE,
257
-  );
257
+    );
258 258
 
259
-  $form['css']['block_formats'] = array(
259
+    $form['css']['block_formats'] = array(
260 260
     '#type' => 'textfield',
261 261
     '#title' => t('Block formats'),
262 262
     '#default_value' => $profile->settings['block_formats'],
263 263
     '#size' => 40,
264 264
     '#maxlength' => 250,
265 265
     '#description' => t('Comma separated list of HTML block formats. Possible values: <code>@format-list</code>.', array('@format-list' => 'p,h1,h2,h3,h4,h5,h6,div,blockquote,address,pre,code,dt,dd')),
266
-  );
266
+    );
267 267
 
268
-  $form['css']['css_setting'] = array(
268
+    $form['css']['css_setting'] = array(
269 269
     '#type' => 'select',
270 270
     '#title' => t('Editor CSS'),
271 271
     '#default_value' => $profile->settings['css_setting'],
272 272
     '#options' => array('theme' => t('Use theme CSS'), 'self' => t('Define CSS'), 'none' => t('Editor default CSS')),
273 273
     '#description' => t('Defines the CSS to be used in the editor area.<br />Use theme CSS - loads stylesheets from current site theme.<br/>Define CSS - enter path for stylesheet files below.<br />Editor default CSS - uses default stylesheets from editor.'),
274
-  );
274
+    );
275 275
 
276
-  $form['css']['css_path'] = array(
276
+    $form['css']['css_path'] = array(
277 277
     '#type' => 'textfield',
278 278
     '#title' => t('CSS path'),
279 279
     '#default_value' => $profile->settings['css_path'],
280 280
     '#size' => 40,
281 281
     '#maxlength' => 255,
282 282
     '#description' => t('If "Define CSS" was selected above, enter path to a CSS file or a list of CSS files separated by a comma.') . '<br />' . t('Available tokens: <code>%b</code> (base path, eg: <code>/</code>), <code>%t</code> (path to theme, eg: <code>themes/garland</code>)') . '<br />' . t('Example:') . ' css/editor.css,/themes/garland/style.css,%b%t/style.css,http://example.com/external.css',
283
-  );
283
+    );
284 284
 
285
-  $form['css']['css_classes'] = array(
285
+    $form['css']['css_classes'] = array(
286 286
     '#type' => 'textarea',
287 287
     '#title' => t('CSS classes'),
288 288
     '#default_value' => $profile->settings['css_classes'],
289 289
     '#description' => t('Optionally define CSS classes for the "Font style" dropdown list.<br />Enter one class on each line in the format: !format. Example: !example<br />If left blank, CSS classes are automatically imported from all loaded stylesheet(s).', array('!format' => '<code>[title]=[class]</code>', '!example' => 'My heading=header1')),
290
-  );
290
+    );
291 291
 
292
-  $form['submit'] = array(
292
+    $form['submit'] = array(
293 293
     '#type' => 'submit',
294 294
     '#value' => t('Save'),
295 295
     '#weight' => 100,
296
-  );
297
-  $form['cancel'] = array(
296
+    );
297
+    $form['cancel'] = array(
298 298
     '#value' => l(t('Cancel'), 'admin/settings/wysiwyg'),
299 299
     '#weight' => 110,
300
-  );
300
+    );
301 301
 
302
-  return $form;
302
+    return $form;
303 303
 }
304 304
 
305 305
 /**
@@ -308,258 +308,258 @@  discard block
 block discarded – undo
308 308
  * @see wysiwyg_profile_form()
309 309
  */
310 310
 function wysiwyg_profile_form_submit($form, &$form_state) {
311
-  $values = $form_state['values'];
312
-  if (isset($values['buttons'])) {
311
+    $values = $form_state['values'];
312
+    if (isset($values['buttons'])) {
313 313
     // Store only enabled buttons for each plugin.
314 314
     foreach ($values['buttons'] as $plugin => $buttons) {
315
-      $values['buttons'][$plugin] = array_filter($values['buttons'][$plugin]);
315
+        $values['buttons'][$plugin] = array_filter($values['buttons'][$plugin]);
316 316
     }
317 317
     // Store only enabled plugins.
318 318
     $values['buttons'] = array_filter($values['buttons']);
319
-  }
320
-  // Remove any white-space from 'block_formats' setting, since editor
321
-  // implementations rely on a comma-separated list to explode().
322
-  $values['block_formats'] = preg_replace('@\s+@', '', $values['block_formats']);
323
-
324
-  // Remove input format name.
325
-  $format = $values['format'];
326
-  $input_format = $values['input_format'];
327
-  $editor = $values['editor'];
328
-  unset($values['format'], $values['input_format'], $values['editor']);
329
-
330
-  // Remove FAPI values.
331
-  // @see system_settings_form_submit()
332
-  unset($values['submit'], $values['form_id'], $values['op'], $values['form_token'], $values['form_build_id']);
333
-
334
-  // Determine if this is an update.
335
-  if (!db_result(db_query("SELECT 1 FROM {wysiwyg} WHERE format = %d", $format))) {
319
+    }
320
+    // Remove any white-space from 'block_formats' setting, since editor
321
+    // implementations rely on a comma-separated list to explode().
322
+    $values['block_formats'] = preg_replace('@\s+@', '', $values['block_formats']);
323
+
324
+    // Remove input format name.
325
+    $format = $values['format'];
326
+    $input_format = $values['input_format'];
327
+    $editor = $values['editor'];
328
+    unset($values['format'], $values['input_format'], $values['editor']);
329
+
330
+    // Remove FAPI values.
331
+    // @see system_settings_form_submit()
332
+    unset($values['submit'], $values['form_id'], $values['op'], $values['form_token'], $values['form_build_id']);
333
+
334
+    // Determine if this is an update.
335
+    if (!db_result(db_query("SELECT 1 FROM {wysiwyg} WHERE format = %d", $format))) {
336 336
     $update = array();
337
-  }
338
-  else {
337
+    }
338
+    else {
339 339
     $update = array('format');
340
-  }
341
-  $wysiwyg = new stdClass();
342
-  $wysiwyg->format = $format;
343
-  $wysiwyg->editor = $editor;
344
-  $wysiwyg->settings = $values;
340
+    }
341
+    $wysiwyg = new stdClass();
342
+    $wysiwyg->format = $format;
343
+    $wysiwyg->editor = $editor;
344
+    $wysiwyg->settings = $values;
345 345
 
346
-  // Insert new profile data.
347
-  drupal_write_record('wysiwyg', $wysiwyg, $update);
346
+    // Insert new profile data.
347
+    drupal_write_record('wysiwyg', $wysiwyg, $update);
348 348
 
349
-  drupal_set_message(t('Wysiwyg profile for %format has been saved.', array('%format' => $input_format)));
349
+    drupal_set_message(t('Wysiwyg profile for %format has been saved.', array('%format' => $input_format)));
350 350
 
351
-  $form_state['redirect'] = 'admin/settings/wysiwyg';
351
+    $form_state['redirect'] = 'admin/settings/wysiwyg';
352 352
 }
353 353
 
354 354
 /**
355 355
  * Layout for the buttons in the Wysiwyg Editor profile form.
356 356
  */
357 357
 function theme_wysiwyg_admin_button_table($form) {
358
-  $buttons = array();
358
+    $buttons = array();
359 359
 
360
-  // Flatten forms array.
361
-  foreach (element_children($form) as $name) {
360
+    // Flatten forms array.
361
+    foreach (element_children($form) as $name) {
362 362
     foreach (element_children($form[$name]) as $button) {
363
-      $buttons[] = drupal_render($form[$name][$button]);
363
+        $buttons[] = drupal_render($form[$name][$button]);
364
+    }
364 365
     }
365
-  }
366 366
 
367
-  // Split checkboxes into rows with 3 columns.
368
-  $total = count($buttons);
369
-  $rows = array();
370
-  for ($i = 0; $i < $total; $i++) {
367
+    // Split checkboxes into rows with 3 columns.
368
+    $total = count($buttons);
369
+    $rows = array();
370
+    for ($i = 0; $i < $total; $i++) {
371 371
     $row = array();
372 372
     $row[] = array('data' => $buttons[$i]);
373 373
     if (isset($buttons[++$i])) {
374
-      $row[] = array('data' => $buttons[$i]);
374
+        $row[] = array('data' => $buttons[$i]);
375 375
     }
376 376
     if (isset($buttons[++$i])) {
377
-      $row[] = array('data' => $buttons[$i]);
377
+        $row[] = array('data' => $buttons[$i]);
378 378
     }
379 379
     $rows[] = $row;
380
-  }
380
+    }
381 381
 
382
-  $output = theme('table', array(), $rows, array('width' => '100%'));
382
+    $output = theme('table', array(), $rows, array('width' => '100%'));
383 383
 
384
-  return $output;
384
+    return $output;
385 385
 }
386 386
 
387 387
 /**
388 388
  * Display overview of setup Wysiwyg Editor profiles; menu callback.
389 389
  */
390 390
 function wysiwyg_profile_overview() {
391
-  include_once './includes/install.inc';
391
+    include_once './includes/install.inc';
392 392
 
393
-  // Check which wysiwyg editors are installed.
394
-  $editors = wysiwyg_get_all_editors();
395
-  $count = count($editors);
396
-  $status = array();
397
-  $options = array('' => t('No editor'));
393
+    // Check which wysiwyg editors are installed.
394
+    $editors = wysiwyg_get_all_editors();
395
+    $count = count($editors);
396
+    $status = array();
397
+    $options = array('' => t('No editor'));
398 398
 
399
-  foreach ($editors as $name => $editor) {
399
+    foreach ($editors as $name => $editor) {
400 400
     $status[$name] = array(
401
-      'severity' => (isset($editor['error']) ? REQUIREMENT_ERROR : ($editor['installed'] ? REQUIREMENT_OK : REQUIREMENT_INFO)),
402
-      'title' => t('<a href="!vendor-url">@editor</a> (<a href="!download-url">Download</a>)', array('!vendor-url' => $editor['vendor url'], '@editor' => $editor['title'], '!download-url' => $editor['download url'])),
403
-      'value' => (isset($editor['installed version']) ? $editor['installed version'] : t('Not installed.')),
404
-      'description' => (isset($editor['error']) ? $editor['error'] : ''),
401
+        'severity' => (isset($editor['error']) ? REQUIREMENT_ERROR : ($editor['installed'] ? REQUIREMENT_OK : REQUIREMENT_INFO)),
402
+        'title' => t('<a href="!vendor-url">@editor</a> (<a href="!download-url">Download</a>)', array('!vendor-url' => $editor['vendor url'], '@editor' => $editor['title'], '!download-url' => $editor['download url'])),
403
+        'value' => (isset($editor['installed version']) ? $editor['installed version'] : t('Not installed.')),
404
+        'description' => (isset($editor['error']) ? $editor['error'] : ''),
405 405
     );
406 406
     if ($editor['installed']) {
407
-      $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : '');
407
+        $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : '');
408 408
     }
409 409
     else {
410
-      // Build on-site installation instructions.
411
-      // @todo Setup $library in wysiwyg_load_editor() already.
412
-      $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries']));
413
-      $targs = array(
410
+        // Build on-site installation instructions.
411
+        // @todo Setup $library in wysiwyg_load_editor() already.
412
+        $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries']));
413
+        $targs = array(
414 414
         '@editor-path' => $editor['editor path'],
415 415
         '@library-filepath' => $editor['library path'] . '/' . (isset($editor['libraries'][$library]['files'][0]) ? $editor['libraries'][$library]['files'][0] : key($editor['libraries'][$library]['files'])),
416
-      );
417
-      $instructions = '<p>' . t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs) . '</p>';
418
-      $instructions .= '<p>' . t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs) . '</p>';
416
+        );
417
+        $instructions = '<p>' . t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs) . '</p>';
418
+        $instructions .= '<p>' . t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs) . '</p>';
419 419
 
420
-      $status[$name]['description'] .= $instructions;
421
-      $count--;
420
+        $status[$name]['description'] .= $instructions;
421
+        $count--;
422 422
     }
423 423
     // In case there is an error, always show installation instructions.
424 424
     if (isset($editor['error'])) {
425
-      $show_instructions = TRUE;
425
+        $show_instructions = TRUE;
426
+    }
426 427
     }
427
-  }
428
-  if (!$count) {
428
+    if (!$count) {
429 429
     $show_instructions = TRUE;
430
-  }
431
-  $form['status'] = array(
430
+    }
431
+    $form['status'] = array(
432 432
     '#type' => 'fieldset',
433 433
     '#title' => t('Installation instructions'),
434 434
     '#collapsible' => TRUE,
435 435
     '#collapsed' => !isset($show_instructions),
436 436
     '#description' => (!$count ? t('There are no editor libraries installed currently. The following list contains a list of currently supported editors:') : ''),
437 437
     '#weight' => 10,
438
-  );
439
-  $form['status']['report'] = array('#value' => theme('status_report', $status));
438
+    );
439
+    $form['status']['report'] = array('#value' => theme('status_report', $status));
440 440
 
441
-  if (!$count) {
441
+    if (!$count) {
442 442
     return $form;
443
-  }
443
+    }
444 444
 
445
-  $formats = filter_formats();
446
-  // Reset Wysiwyg cache
447
-  $profiles = wysiwyg_profile_load_all(TRUE);
448
-  $form['formats'] = array(
445
+    $formats = filter_formats();
446
+    // Reset Wysiwyg cache
447
+    $profiles = wysiwyg_profile_load_all(TRUE);
448
+    $form['formats'] = array(
449 449
     '#type' => 'item',
450 450
     '#description' => t('To assign a different editor to a text format, click "delete" to remove the existing first.'),
451 451
     '#tree' => TRUE,
452
-  );
452
+    );
453 453
 
454
-  $enable_save = FALSE;
455
-  $in_code_only = FALSE;
456
-  foreach ($formats as $id => $format) {
454
+    $enable_save = FALSE;
455
+    $in_code_only = FALSE;
456
+    foreach ($formats as $id => $format) {
457 457
     $form['formats'][$id]['name'] = array(
458
-      '#value' => check_plain($format->name),
458
+        '#value' => check_plain($format->name),
459 459
     );
460 460
     // Only display editor selection for associated input formats to avoid
461 461
     // confusion about disabled selection.
462 462
     if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) {
463
-      $in_code_only = !empty($profiles[$id]->in_code_only);
464
-      $form['formats'][$id]['editor'] = array(
463
+        $in_code_only = !empty($profiles[$id]->in_code_only);
464
+        $form['formats'][$id]['editor'] = array(
465 465
         '#value' => $options[$profiles[$id]->editor],
466
-      );
467
-      if ($in_code_only) {
466
+        );
467
+        if ($in_code_only) {
468 468
         $form['formats'][$id]['name']['#value'] .= ' <em>(' . t('From: !module module', array('!module' => $profiles[$id]->export_module)) . ')</em>';
469
-      }
469
+        }
470 470
     }
471 471
     else {
472
-      $form['formats'][$id]['editor'] = array(
472
+        $form['formats'][$id]['editor'] = array(
473 473
         '#type' => 'select',
474 474
         '#default_value' => '',
475 475
         '#options' => $options,
476
-      );
477
-      $enable_save = TRUE;
476
+        );
477
+        $enable_save = TRUE;
478 478
     }
479 479
     if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) {
480
-      $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit');
481
-      $form['formats'][$id]['edit'] = array(
480
+        $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit');
481
+        $form['formats'][$id]['edit'] = array(
482 482
         '#value' => l($edit, "admin/settings/wysiwyg/profile/$id/edit"),
483
-      );
484
-      // Only display delete/revert links for wysiwyg loaded from the database
485
-      if (!$in_code_only) {
483
+        );
484
+        // Only display delete/revert links for wysiwyg loaded from the database
485
+        if (!$in_code_only) {
486 486
         $delete = (empty($profiles[$id]->type) || $profiles[$id]->type == t('Normal'))?t('Delete'):t('Revert');
487 487
         $form['formats'][$id]['delete'] = array(
488
-          '#value' => l($delete, "admin/settings/wysiwyg/profile/$id/delete"),
488
+            '#value' => l($delete, "admin/settings/wysiwyg/profile/$id/delete"),
489 489
         );
490
-      }
490
+        }
491
+    }
491 492
     }
492
-  }
493 493
 
494
-  // Submitting the form when no editors can be selected causes errors.
495
-  if ($enable_save) {
494
+    // Submitting the form when no editors can be selected causes errors.
495
+    if ($enable_save) {
496 496
     $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
497
-  }
498
-  return $form;
497
+    }
498
+    return $form;
499 499
 }
500 500
 
501 501
 /**
502 502
  * Return HTML for the Wysiwyg profile overview form.
503 503
  */
504 504
 function theme_wysiwyg_profile_overview($form) {
505
-  if (!isset($form['formats'])) {
505
+    if (!isset($form['formats'])) {
506 506
     return;
507
-  }
508
-  $output = '';
509
-  $header = array(t('Input format'), t('Editor'), array('data' => t('Operations'), 'colspan' => 3));
510
-  $rows = array();
511
-  foreach (element_children($form['formats']) as $item) {
507
+    }
508
+    $output = '';
509
+    $header = array(t('Input format'), t('Editor'), array('data' => t('Operations'), 'colspan' => 3));
510
+    $rows = array();
511
+    foreach (element_children($form['formats']) as $item) {
512 512
     $format = &$form['formats'][$item];
513 513
     $rows[] = array(
514
-      drupal_render($format['name']),
515
-      drupal_render($format['editor']),
516
-      isset($format['edit']) ? drupal_render($format['edit']) : '',
517
-      isset($format['export']) ? drupal_render($format['export']) : '',
518
-      isset($format['delete']) ? drupal_render($format['delete']) : '',
519
-    );
520
-  }
521
-  $form['formats']['table']['#value'] = theme('table', $header, $rows);
522
-  $output .= drupal_render($form);
523
-  return $output;
514
+        drupal_render($format['name']),
515
+        drupal_render($format['editor']),
516
+        isset($format['edit']) ? drupal_render($format['edit']) : '',
517
+        isset($format['export']) ? drupal_render($format['export']) : '',
518
+        isset($format['delete']) ? drupal_render($format['delete']) : '',
519
+    );
520
+    }
521
+    $form['formats']['table']['#value'] = theme('table', $header, $rows);
522
+    $output .= drupal_render($form);
523
+    return $output;
524 524
 }
525 525
 
526 526
 /**
527 527
  * Submit callback for Wysiwyg profile overview form.
528 528
  */
529 529
 function wysiwyg_profile_overview_submit($form, &$form_state) {
530
-  foreach ($form_state['values']['formats'] as $format => $values) {
530
+    foreach ($form_state['values']['formats'] as $format => $values) {
531 531
     db_query("UPDATE {wysiwyg} SET editor = '%s' WHERE format = %d", $values['editor'], $format);
532 532
     if (!db_affected_rows()) {
533
-      db_query("INSERT INTO {wysiwyg} (format, editor) VALUES (%d, '%s')", $format, $values['editor']);
533
+        db_query("INSERT INTO {wysiwyg} (format, editor) VALUES (%d, '%s')", $format, $values['editor']);
534
+    }
534 535
     }
535
-  }
536 536
 }
537 537
 
538 538
 /**
539 539
  * Delete editor profile confirmation form.
540 540
  */
541 541
 function wysiwyg_profile_delete_confirm(&$form_state, $profile) {
542
-  $formats = filter_formats();
543
-  $format = $formats[$profile->format];
544
-  $form['format'] = array('#type' => 'value', '#value' => $format);
545
-  if (isset($profile->type) && $profile->type == t('Overridden')) {
542
+    $formats = filter_formats();
543
+    $format = $formats[$profile->format];
544
+    $form['format'] = array('#type' => 'value', '#value' => $format);
545
+    if (isset($profile->type) && $profile->type == t('Overridden')) {
546 546
     $form['revert'] = array(
547
-      '#type' => 'value',
548
-      '#value' => TRUE,
547
+        '#type' => 'value',
548
+        '#value' => TRUE,
549 549
     );
550 550
     return confirm_form(
551
-      $form,
552
-      t('Are you sure you want to revert the profile settings for %name?', array('%name' => $format->name)),
553
-      'admin/settings/wysiwyg',
554
-      t('This action cannot be undone.'), t('Revert'), t('Cancel')
551
+        $form,
552
+        t('Are you sure you want to revert the profile settings for %name?', array('%name' => $format->name)),
553
+        'admin/settings/wysiwyg',
554
+        t('This action cannot be undone.'), t('Revert'), t('Cancel')
555 555
     );
556
-  }
557
-  return confirm_form(
556
+    }
557
+    return confirm_form(
558 558
     $form,
559 559
     t('Are you sure you want to remove the profile for %name?', array('%name' => $format->name)),
560 560
     'admin/settings/wysiwyg',
561 561
     t('This action cannot be undone.'), t('Remove'), t('Cancel')
562
-  );
562
+    );
563 563
 }
564 564
 
565 565
 /**
@@ -568,16 +568,16 @@  discard block
 block discarded – undo
568 568
  * @see wysiwyg_profile_delete_confirm()
569 569
  */
570 570
 function wysiwyg_profile_delete_confirm_submit($form, &$form_state) {
571
-  $format = $form_state['values']['format'];
572
-  $wysiwyg = new stdClass();
573
-  $wysiwyg->format = $format->format;
574
-  wysiwyg_profile_delete($wysiwyg);
575
-  if (!empty($form_state['values']['revert'])) {
571
+    $format = $form_state['values']['format'];
572
+    $wysiwyg = new stdClass();
573
+    $wysiwyg->format = $format->format;
574
+    wysiwyg_profile_delete($wysiwyg);
575
+    if (!empty($form_state['values']['revert'])) {
576 576
     drupal_set_message(t('Wysiwyg profile settings for %name has been reverted.', array('%name' => $format->name)));
577
-  }
578
-  else {
577
+    }
578
+    else {
579 579
     drupal_set_message(t('Wysiwyg profile for %name has been deleted.', array('%name' => $format->name)));
580
-  }
581
-  $form_state['redirect'] = 'admin/settings/wysiwyg';
580
+    }
581
+    $form_state['redirect'] = 'admin/settings/wysiwyg';
582 582
 }
583 583
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
     if (count($value) > 1) {
103 103
       $tname = t($value[0]);
104 104
       $predefined[$key] = ($tname == $value[1]) ? $tname : "$tname ($value[1])";
105
-    }
106
-    else {
105
+    } else {
107 106
       $predefined[$key] = t($value[0]);
108 107
     }
109 108
   }
@@ -143,8 +142,7 @@  discard block
 block discarded – undo
143 142
           '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE,
144 143
         );
145 144
       }
146
-    }
147
-    else if (isset($meta['extensions']) && is_array($meta['extensions'])) {
145
+    } else if (isset($meta['extensions']) && is_array($meta['extensions'])) {
148 146
       foreach ($meta['extensions'] as $extension => $title) {
149 147
         $form['buttons'][$name][$extension] = array(
150 148
           '#type' => 'checkbox',
@@ -334,8 +332,7 @@  discard block
 block discarded – undo
334 332
   // Determine if this is an update.
335 333
   if (!db_result(db_query("SELECT 1 FROM {wysiwyg} WHERE format = %d", $format))) {
336 334
     $update = array();
337
-  }
338
-  else {
335
+  } else {
339 336
     $update = array('format');
340 337
   }
341 338
   $wysiwyg = new stdClass();
@@ -405,8 +402,7 @@  discard block
 block discarded – undo
405 402
     );
406 403
     if ($editor['installed']) {
407 404
       $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : '');
408
-    }
409
-    else {
405
+    } else {
410 406
       // Build on-site installation instructions.
411 407
       // @todo Setup $library in wysiwyg_load_editor() already.
412 408
       $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries']));
@@ -467,8 +463,7 @@  discard block
 block discarded – undo
467 463
       if ($in_code_only) {
468 464
         $form['formats'][$id]['name']['#value'] .= ' <em>(' . t('From: !module module', array('!module' => $profiles[$id]->export_module)) . ')</em>';
469 465
       }
470
-    }
471
-    else {
466
+    } else {
472 467
       $form['formats'][$id]['editor'] = array(
473 468
         '#type' => 'select',
474 469
         '#default_value' => '',
@@ -574,8 +569,7 @@  discard block
 block discarded – undo
574 569
   wysiwyg_profile_delete($wysiwyg);
575 570
   if (!empty($form_state['values']['revert'])) {
576 571
     drupal_set_message(t('Wysiwyg profile settings for %name has been reverted.', array('%name' => $format->name)));
577
-  }
578
-  else {
572
+  } else {
579 573
     drupal_set_message(t('Wysiwyg profile for %name has been deleted.', array('%name' => $format->name)));
580 574
   }
581 575
   $form_state['redirect'] = 'admin/settings/wysiwyg';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
     $profile['settings'] = array();
20 20
   }
21 21
   $profile['settings'] += array(
22
-    'default' => TRUE,
23
-    'user_choose' => FALSE,
24
-    'show_toggle' => TRUE,
22
+    'default' => true,
23
+    'user_choose' => false,
24
+    'show_toggle' => true,
25 25
     'theme' => 'advanced',
26 26
     'language' => 'en',
27 27
     'access' => 1,
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
     'toolbar_loc' => 'top',
31 31
     'toolbar_align' => 'left',
32 32
     'path_loc' => 'bottom',
33
-    'resizing' => TRUE,
33
+    'resizing' => true,
34 34
     // Also available, but buggy in TinyMCE 2.x: blockquote,code,dt,dd,samp.
35 35
     'block_formats' => 'p,address,pre,h2,h3,h4,h5,h6,div',
36
-    'verify_html' => TRUE,
37
-    'preformatted' => FALSE,
38
-    'convert_fonts_to_spans' => TRUE,
39
-    'remove_linebreaks' => TRUE,
40
-    'apply_source_formatting' => FALSE,
41
-    'paste_auto_cleanup_on_paste' => FALSE,
36
+    'verify_html' => true,
37
+    'preformatted' => false,
38
+    'convert_fonts_to_spans' => true,
39
+    'remove_linebreaks' => true,
40
+    'apply_source_formatting' => false,
41
+    'paste_auto_cleanup_on_paste' => false,
42 42
     'css_setting' => 'theme',
43
-    'css_path' => NULL,
44
-    'css_classes' => NULL,
43
+    'css_path' => null,
44
+    'css_classes' => null,
45 45
   );
46 46
   $profile = (object) $profile;
47 47
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
   $form['basic'] = array(
57 57
     '#type' => 'fieldset',
58 58
     '#title' => t('Basic setup'),
59
-    '#collapsible' => TRUE,
60
-    '#collapsed' => TRUE,
59
+    '#collapsible' => true,
60
+    '#collapsed' => true,
61 61
   );
62 62
 
63 63
   $form['basic']['default'] = array(
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
   $form['buttons'] = array(
114 114
     '#type' => 'fieldset',
115 115
     '#title' => t('Buttons and plugins'),
116
-    '#collapsible' => TRUE,
117
-    '#collapsed' => TRUE,
118
-    '#tree' => TRUE,
116
+    '#collapsible' => true,
117
+    '#collapsed' => true,
118
+    '#tree' => true,
119 119
     '#theme' => 'wysiwyg_admin_button_table',
120 120
   );
121 121
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         $form['buttons'][$name][$button] = array(
141 141
           '#type' => 'checkbox',
142 142
           '#title' => $title,
143
-          '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : FALSE,
143
+          '#default_value' => !empty($profile->settings['buttons'][$name][$button]) ? $profile->settings['buttons'][$name][$button] : false,
144 144
         );
145 145
       }
146 146
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         $form['buttons'][$name][$extension] = array(
150 150
           '#type' => 'checkbox',
151 151
           '#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title,
152
-          '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE,
152
+          '#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : false,
153 153
         );
154 154
       }
155 155
     }
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
   $form['appearance'] = array(
159 159
     '#type' => 'fieldset',
160 160
     '#title' => t('Editor appearance'),
161
-    '#collapsible' => TRUE,
162
-    '#collapsed' => TRUE,
161
+    '#collapsible' => true,
162
+    '#collapsed' => true,
163 163
   );
164 164
 
165 165
   $form['appearance']['toolbar_loc'] = array(
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
   $form['output'] = array(
198 198
     '#type' => 'fieldset',
199 199
     '#title' => t('Cleanup and output'),
200
-    '#collapsible' => TRUE,
201
-    '#collapsed' => TRUE,
200
+    '#collapsible' => true,
201
+    '#collapsed' => true,
202 202
   );
203 203
 
204 204
   $form['output']['verify_html'] = array(
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
   $form['css'] = array(
253 253
     '#type' => 'fieldset',
254 254
     '#title' => t('CSS'),
255
-    '#collapsible' => TRUE,
256
-    '#collapsed' => TRUE,
255
+    '#collapsible' => true,
256
+    '#collapsed' => true,
257 257
   );
258 258
 
259 259
   $form['css']['block_formats'] = array(
@@ -422,16 +422,16 @@  discard block
 block discarded – undo
422 422
     }
423 423
     // In case there is an error, always show installation instructions.
424 424
     if (isset($editor['error'])) {
425
-      $show_instructions = TRUE;
425
+      $show_instructions = true;
426 426
     }
427 427
   }
428 428
   if (!$count) {
429
-    $show_instructions = TRUE;
429
+    $show_instructions = true;
430 430
   }
431 431
   $form['status'] = array(
432 432
     '#type' => 'fieldset',
433 433
     '#title' => t('Installation instructions'),
434
-    '#collapsible' => TRUE,
434
+    '#collapsible' => true,
435 435
     '#collapsed' => !isset($show_instructions),
436 436
     '#description' => (!$count ? t('There are no editor libraries installed currently. The following list contains a list of currently supported editors:') : ''),
437 437
     '#weight' => 10,
@@ -444,15 +444,15 @@  discard block
 block discarded – undo
444 444
 
445 445
   $formats = filter_formats();
446 446
   // Reset Wysiwyg cache
447
-  $profiles = wysiwyg_profile_load_all(TRUE);
447
+  $profiles = wysiwyg_profile_load_all(true);
448 448
   $form['formats'] = array(
449 449
     '#type' => 'item',
450 450
     '#description' => t('To assign a different editor to a text format, click "delete" to remove the existing first.'),
451
-    '#tree' => TRUE,
451
+    '#tree' => true,
452 452
   );
453 453
 
454
-  $enable_save = FALSE;
455
-  $in_code_only = FALSE;
454
+  $enable_save = false;
455
+  $in_code_only = false;
456 456
   foreach ($formats as $id => $format) {
457 457
     $form['formats'][$id]['name'] = array(
458 458
       '#value' => check_plain($format->name),
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
         '#default_value' => '',
475 475
         '#options' => $options,
476 476
       );
477
-      $enable_save = TRUE;
477
+      $enable_save = true;
478 478
     }
479 479
     if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) {
480 480
       $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit');
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
   if (isset($profile->type) && $profile->type == t('Overridden')) {
546 546
     $form['revert'] = array(
547 547
       '#type' => 'value',
548
-      '#value' => TRUE,
548
+      '#value' => true,
549 549
     );
550 550
     return confirm_form(
551 551
       $form,
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 function wysiwyg_profile_form($form_state, $profile) {
12 12
   // Merge in defaults.
13
-  $profile = (array) $profile;
13
+  $profile = (array)$profile;
14 14
   $profile += array(
15 15
     'format' => 0,
16 16
     'editor' => '',
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     'css_path' => NULL,
44 44
     'css_classes' => NULL,
45 45
   );
46
-  $profile = (object) $profile;
46
+  $profile = (object)$profile;
47 47
 
48 48
   $formats = filter_formats();
49 49
   $editor = wysiwyg_get_editor($profile->editor);
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
         if (!empty($meta['path'])) {
129 129
           // @todo Button icon locations are different in editors, editor versions,
130 130
           //   and contrib/custom plugins (like Image Assist, f.e.).
131
-          $img_src = $meta['path'] . "/images/$name.gif";
131
+          $img_src = $meta['path']."/images/$name.gif";
132 132
           // Handle plugins that have more than one button.
133 133
           if (!file_exists($img_src)) {
134
-            $img_src = $meta['path'] . "/images/$button.gif";
134
+            $img_src = $meta['path']."/images/$button.gif";
135 135
           }
136
-          $icon = file_exists($img_src) ? '<img src="' . base_path() . $img_src . '" title="' . $button . '" style="border: 1px solid grey; vertical-align: middle;" />' : '';
136
+          $icon = file_exists($img_src) ? '<img src="'.base_path().$img_src.'" title="'.$button.'" style="border: 1px solid grey; vertical-align: middle;" />' : '';
137 137
         }
138 138
         $title = (isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title);
139
-        $title = (!empty($icon) ? $icon . ' ' . $title : $title);
139
+        $title = (!empty($icon) ? $icon.' '.$title : $title);
140 140
         $form['buttons'][$name][$button] = array(
141 141
           '#type' => 'checkbox',
142 142
           '#title' => $title,
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     '#default_value' => $profile->settings['css_path'],
280 280
     '#size' => 40,
281 281
     '#maxlength' => 255,
282
-    '#description' => t('If "Define CSS" was selected above, enter path to a CSS file or a list of CSS files separated by a comma.') . '<br />' . t('Available tokens: <code>%b</code> (base path, eg: <code>/</code>), <code>%t</code> (path to theme, eg: <code>themes/garland</code>)') . '<br />' . t('Example:') . ' css/editor.css,/themes/garland/style.css,%b%t/style.css,http://example.com/external.css',
282
+    '#description' => t('If "Define CSS" was selected above, enter path to a CSS file or a list of CSS files separated by a comma.').'<br />'.t('Available tokens: <code>%b</code> (base path, eg: <code>/</code>), <code>%t</code> (path to theme, eg: <code>themes/garland</code>)').'<br />'.t('Example:').' css/editor.css,/themes/garland/style.css,%b%t/style.css,http://example.com/external.css',
283 283
   );
284 284
 
285 285
   $form['css']['css_classes'] = array(
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
       'description' => (isset($editor['error']) ? $editor['error'] : ''),
405 405
     );
406 406
     if ($editor['installed']) {
407
-      $options[$name] = $editor['title'] . (isset($editor['installed version']) ? ' ' . $editor['installed version'] : '');
407
+      $options[$name] = $editor['title'].(isset($editor['installed version']) ? ' '.$editor['installed version'] : '');
408 408
     }
409 409
     else {
410 410
       // Build on-site installation instructions.
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
       $library = (isset($editor['library']) ? $editor['library'] : key($editor['libraries']));
413 413
       $targs = array(
414 414
         '@editor-path' => $editor['editor path'],
415
-        '@library-filepath' => $editor['library path'] . '/' . (isset($editor['libraries'][$library]['files'][0]) ? $editor['libraries'][$library]['files'][0] : key($editor['libraries'][$library]['files'])),
415
+        '@library-filepath' => $editor['library path'].'/'.(isset($editor['libraries'][$library]['files'][0]) ? $editor['libraries'][$library]['files'][0] : key($editor['libraries'][$library]['files'])),
416 416
       );
417
-      $instructions = '<p>' . t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs) . '</p>';
418
-      $instructions .= '<p>' . t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs) . '</p>';
417
+      $instructions = '<p>'.t('Extract the archive and copy its contents into a new folder in the following location:<br /><code>@editor-path</code>', $targs).'</p>';
418
+      $instructions .= '<p>'.t('So the actual library can be found at:<br /><code>@library-filepath</code>', $targs).'</p>';
419 419
 
420 420
       $status[$name]['description'] .= $instructions;
421 421
       $count--;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
         '#value' => $options[$profiles[$id]->editor],
466 466
       );
467 467
       if ($in_code_only) {
468
-        $form['formats'][$id]['name']['#value'] .= ' <em>(' . t('From: !module module', array('!module' => $profiles[$id]->export_module)) . ')</em>';
468
+        $form['formats'][$id]['name']['#value'] .= ' <em>('.t('From: !module module', array('!module' => $profiles[$id]->export_module)).')</em>';
469 469
       }
470 470
     }
471 471
     else {
@@ -477,13 +477,13 @@  discard block
 block discarded – undo
477 477
       $enable_save = TRUE;
478 478
     }
479 479
     if (isset($profiles[$id]) && !empty($profiles[$id]->editor)) {
480
-      $edit = !empty($profiles[$id]->in_code_only)?t('Override'):t('Edit');
480
+      $edit = !empty($profiles[$id]->in_code_only) ?t('Override') : t('Edit');
481 481
       $form['formats'][$id]['edit'] = array(
482 482
         '#value' => l($edit, "admin/settings/wysiwyg/profile/$id/edit"),
483 483
       );
484 484
       // Only display delete/revert links for wysiwyg loaded from the database
485 485
       if (!$in_code_only) {
486
-        $delete = (empty($profiles[$id]->type) || $profiles[$id]->type == t('Normal'))?t('Delete'):t('Revert');
486
+        $delete = (empty($profiles[$id]->type) || $profiles[$id]->type == t('Normal')) ?t('Delete') : t('Revert');
487 487
         $form['formats'][$id]['delete'] = array(
488 488
           '#value' => l($delete, "admin/settings/wysiwyg/profile/$id/delete"),
489 489
         );
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/wysiwyg/plugins/break.inc 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@
 block discarded – undo
9 9
  * Implementation of hook_wysiwyg_plugin().
10 10
  */
11 11
 function wysiwyg_break_plugin() {
12
-  $plugins['break'] = array(
12
+    $plugins['break'] = array(
13 13
     'title' => t('Teaser break'),
14 14
     'vendor url' => 'http://drupal.org/project/wysiwyg',
15 15
     'icon file' => 'break.gif',
16 16
     'icon title' => t('Separate the teaser and body of this content'),
17 17
     'settings' => array(),
18
-  );
19
-  return $plugins;
18
+    );
19
+    return $plugins;
20 20
 }
21 21
 
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/wysiwyg/wysiwyg.dialog.inc 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
  * Menu callback; Output a wysiwyg plugin dialog page.
10 10
  */
11 11
 function wysiwyg_dialog($plugin, $instance) {
12
-  $plugins = wysiwyg_get_all_plugins();
13
-  if (!isset($plugins[$plugin])) {
12
+    $plugins = wysiwyg_get_all_plugins();
13
+    if (!isset($plugins[$plugin])) {
14 14
     return drupal_access_denied();
15
-  }
16
-  $callback = $plugin . '_wysiwyg_dialog';
17
-  if (!function_exists($callback)) {
15
+    }
16
+    $callback = $plugin . '_wysiwyg_dialog';
17
+    if (!function_exists($callback)) {
18 18
     return drupal_not_found();
19
-  }
19
+    }
20 20
 
21
-  // Suppress admin menu.
22
-  module_invoke('admin_menu', 'suppress');
23
-  // Add editor instance id to Drupal.settings.
24
-  $settings = array(
21
+    // Suppress admin menu.
22
+    module_invoke('admin_menu', 'suppress');
23
+    // Add editor instance id to Drupal.settings.
24
+    $settings = array(
25 25
     'plugin' => $plugin,
26 26
     'instance' => $instance,
27
-  );
28
-  drupal_add_js(array('wysiwyg' => $settings), 'setting');
27
+    );
28
+    drupal_add_js(array('wysiwyg' => $settings), 'setting');
29 29
 
30
-  echo theme('wysiwyg_dialog_page', $callback($instance));
30
+    echo theme('wysiwyg_dialog_page', $callback($instance));
31 31
 }
32 32
 
33 33
 /**
@@ -38,26 +38,26 @@  discard block
 block discarded – undo
38 38
  * @see template_preprocess()
39 39
  */
40 40
 function template_preprocess_wysiwyg_dialog_page(&$variables) {
41
-  // Construct page title
42
-  $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
41
+    // Construct page title
42
+    $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal'));
43 43
 
44
-  $variables['head_title']        = implode(' | ', $head_title);
45
-  $variables['base_path']         = base_path();
46
-  $variables['front_page']        = url();
47
-  // @todo Would a breadcrumb make sense / possible at all?
48
-  // $variables['breadcrumb']        = theme('breadcrumb', drupal_get_breadcrumb());
49
-  $variables['head']              = drupal_get_html_head();
50
-  $variables['help']              = theme('help');
51
-  $variables['language']          = $GLOBALS['language'];
52
-  $variables['language']->dir     = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
53
-  $variables['messages']          = $variables['show_messages'] ? theme('status_messages') : '';
54
-  $variables['site_name']         = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
55
-  $variables['css']               = drupal_add_css();
56
-  $variables['styles']            = drupal_get_css();
57
-  $variables['scripts']           = drupal_get_js();
58
-  $variables['tabs']              = theme('menu_local_tasks');
59
-  $variables['title']             = drupal_get_title();
60
-  // Closure should be filled last.
61
-  $variables['closure']           = theme('closure');
44
+    $variables['head_title']        = implode(' | ', $head_title);
45
+    $variables['base_path']         = base_path();
46
+    $variables['front_page']        = url();
47
+    // @todo Would a breadcrumb make sense / possible at all?
48
+    // $variables['breadcrumb']        = theme('breadcrumb', drupal_get_breadcrumb());
49
+    $variables['head']              = drupal_get_html_head();
50
+    $variables['help']              = theme('help');
51
+    $variables['language']          = $GLOBALS['language'];
52
+    $variables['language']->dir     = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
53
+    $variables['messages']          = $variables['show_messages'] ? theme('status_messages') : '';
54
+    $variables['site_name']         = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
55
+    $variables['css']               = drupal_add_css();
56
+    $variables['styles']            = drupal_get_css();
57
+    $variables['scripts']           = drupal_get_js();
58
+    $variables['tabs']              = theme('menu_local_tasks');
59
+    $variables['title']             = drupal_get_title();
60
+    // Closure should be filled last.
61
+    $variables['closure']           = theme('closure');
62 62
 }
63 63
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
   if (!isset($plugins[$plugin])) {
14 14
     return drupal_access_denied();
15 15
   }
16
-  $callback = $plugin . '_wysiwyg_dialog';
16
+  $callback = $plugin.'_wysiwyg_dialog';
17 17
   if (!function_exists($callback)) {
18 18
     return drupal_not_found();
19 19
   }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/wysiwyg/wysiwyg.api.php 4 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
  *   plugin meta-information as values.
37 37
  */
38 38
 function hook_wysiwyg_plugin($editor, $version) {
39
-  switch ($editor) {
39
+    switch ($editor) {
40 40
     case 'tinymce':
41 41
       if ($version > 3) {
42 42
         return array(
43
-          'myplugin' => array(
43
+            'myplugin' => array(
44 44
             // A URL to the plugin's homepage.
45 45
             'url' => 'http://drupal.org/project/img_assist',
46 46
             // The full path to the native editor plugin, no trailing slash.
@@ -54,19 +54,19 @@  discard block
 block discarded – undo
54 54
             // match the corresponding JavaScript implementation. The value is
55 55
             // is displayed on the editor configuration form only.
56 56
             'buttons' => array(
57
-              'img_assist' => t('Image Assist'),
57
+                'img_assist' => t('Image Assist'),
58 58
             ),
59 59
             // A list of editor extensions provided by this native plugin.
60 60
             // Extensions are not displayed as buttons and touch the editor's
61 61
             // internals, so you should know what you are doing.
62 62
             'extensions' => array(
63
-              'imce' => t('IMCE'),
63
+                'imce' => t('IMCE'),
64 64
             ),
65 65
             // A list of global, native editor configuration settings to
66 66
             // override. To be used rarely and only when required.
67 67
             'options' => array(
68
-              'file_browser_callback' => 'imceImageBrowser',
69
-              'inline_styles' => TRUE,
68
+                'file_browser_callback' => 'imceImageBrowser',
69
+                'inline_styles' => TRUE,
70 70
             ),
71 71
             // Boolean whether the editor needs to load this plugin. When TRUE,
72 72
             // the editor will automatically load the plugin based on the 'path'
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
             'internal' => TRUE,
82 82
             // TinyMCE-specific: Additional HTML elements to allow in the markup.
83 83
             'extended_valid_elements' => array(
84
-              'img[class|src|border=0|alt|title|width|height|align|name|style]',
84
+                'img[class|src|border=0|alt|title|width|height|align|name|style]',
85
+            ),
85 86
             ),
86
-          ),
87 87
         );
88
-      }
89
-      break;
90
-  }
88
+        }
89
+        break;
90
+    }
91 91
 }
92 92
 
93 93
 /**
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
  *   Wysiwyg module.
102 102
  */
103 103
 function hook_wysiwyg_include_directory($type) {
104
-  switch ($type) {
104
+    switch ($type) {
105 105
     case 'plugins':
106 106
       // You can just return $type, if you place your Wysiwyg plugins into a
107 107
       // sub-directory named 'plugins'.
108 108
       return $type;
109
-  }
109
+    }
110 110
 }
111 111
 
112 112
 /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
  *   Meta information about the buttons provided by this plugin.
137 137
  */
138 138
 function hook_INCLUDE_plugin() {
139
-  $plugins['awesome'] = array(
139
+    $plugins['awesome'] = array(
140 140
     // The plugin's title; defaulting to its internal name ('awesome').
141 141
     'title' => t('Awesome plugin'),
142 142
     // The (vendor) homepage of this plugin; defaults to ''.
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
     ),
166 166
     // TinyMCE-specific: Additional HTML elements to allow in the markup.
167 167
     'extended_valid_elements' => array(
168
-      'tag1[attribute1|attribute2]',
169
-      'tag2[attribute3|attribute4]',
168
+        'tag1[attribute1|attribute2]',
169
+        'tag2[attribute3|attribute4]',
170 170
     ),
171
-  );
172
-  return $plugins;
171
+    );
172
+    return $plugins;
173 173
 }
174 174
 
175 175
 /**
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
  *   - theme: The name of the editor theme/skin.
197 197
  */
198 198
 function hook_wysiwyg_editor_settings_alter(&$settings, $context) {
199
-  // Each editor has its own collection of native settings that may be extended
200
-  // or overridden. Please consult the respective official vendor documentation
201
-  // for details.
202
-  if ($context['profile']->editor == 'tinymce') {
199
+    // Each editor has its own collection of native settings that may be extended
200
+    // or overridden. Please consult the respective official vendor documentation
201
+    // for details.
202
+    if ($context['profile']->editor == 'tinymce') {
203 203
     // Supported values to JSON data types.
204 204
     $settings['cleanup_on_startup'] = TRUE;
205
-  }
205
+    }
206 206
 }
Please login to merge, or discard this patch.
Switch Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -37,56 +37,56 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function hook_wysiwyg_plugin($editor, $version) {
39 39
   switch ($editor) {
40
-    case 'tinymce':
41
-      if ($version > 3) {
42
-        return array(
43
-          'myplugin' => array(
44
-            // A URL to the plugin's homepage.
45
-            'url' => 'http://drupal.org/project/img_assist',
46
-            // The full path to the native editor plugin, no trailing slash.
47
-            // Ignored when 'internal' is set to TRUE below.
48
-            'path' => drupal_get_path('module', 'img_assist') . '/drupalimage',
49
-            // The name of the plugin's main JavaScript file.
50
-            // Ignored when 'internal' is set to TRUE below.
51
-            // Default value depends on which editor the plugin is for.
52
-            'filename' => 'editor_plugin.js',
53
-            // A list of buttons provided by this native plugin. The key has to
54
-            // match the corresponding JavaScript implementation. The value is
55
-            // is displayed on the editor configuration form only.
56
-            'buttons' => array(
57
-              'img_assist' => t('Image Assist'),
58
-            ),
59
-            // A list of editor extensions provided by this native plugin.
60
-            // Extensions are not displayed as buttons and touch the editor's
61
-            // internals, so you should know what you are doing.
62
-            'extensions' => array(
63
-              'imce' => t('IMCE'),
64
-            ),
65
-            // A list of global, native editor configuration settings to
66
-            // override. To be used rarely and only when required.
67
-            'options' => array(
68
-              'file_browser_callback' => 'imceImageBrowser',
69
-              'inline_styles' => TRUE,
70
-            ),
71
-            // Boolean whether the editor needs to load this plugin. When TRUE,
72
-            // the editor will automatically load the plugin based on the 'path'
73
-            // variable provided. If FALSE, the plugin either does not need to
74
-            // be loaded or is already loaded by something else on the page.
75
-            // Most plugins should define TRUE here.
76
-            'load' => TRUE,
77
-            // Boolean whether this plugin is a native plugin, i.e. shipped with
78
-            // the editor. Definition must be ommitted for plugins provided by
79
-            // other modules. TRUE means 'path' and 'filename' above are ignored
80
-            // and the plugin is instead loaded from the editor's plugin folder.
81
-            'internal' => TRUE,
82
-            // TinyMCE-specific: Additional HTML elements to allow in the markup.
83
-            'extended_valid_elements' => array(
84
-              'img[class|src|border=0|alt|title|width|height|align|name|style]',
85
-            ),
40
+  case 'tinymce':
41
+    if ($version > 3) {
42
+      return array(
43
+        'myplugin' => array(
44
+          // A URL to the plugin's homepage.
45
+          'url' => 'http://drupal.org/project/img_assist',
46
+          // The full path to the native editor plugin, no trailing slash.
47
+          // Ignored when 'internal' is set to TRUE below.
48
+          'path' => drupal_get_path('module', 'img_assist') . '/drupalimage',
49
+          // The name of the plugin's main JavaScript file.
50
+          // Ignored when 'internal' is set to TRUE below.
51
+          // Default value depends on which editor the plugin is for.
52
+          'filename' => 'editor_plugin.js',
53
+          // A list of buttons provided by this native plugin. The key has to
54
+          // match the corresponding JavaScript implementation. The value is
55
+          // is displayed on the editor configuration form only.
56
+          'buttons' => array(
57
+            'img_assist' => t('Image Assist'),
86 58
           ),
87
-        );
88
-      }
89
-      break;
59
+          // A list of editor extensions provided by this native plugin.
60
+          // Extensions are not displayed as buttons and touch the editor's
61
+          // internals, so you should know what you are doing.
62
+          'extensions' => array(
63
+            'imce' => t('IMCE'),
64
+          ),
65
+          // A list of global, native editor configuration settings to
66
+          // override. To be used rarely and only when required.
67
+          'options' => array(
68
+            'file_browser_callback' => 'imceImageBrowser',
69
+            'inline_styles' => TRUE,
70
+          ),
71
+          // Boolean whether the editor needs to load this plugin. When TRUE,
72
+          // the editor will automatically load the plugin based on the 'path'
73
+          // variable provided. If FALSE, the plugin either does not need to
74
+          // be loaded or is already loaded by something else on the page.
75
+          // Most plugins should define TRUE here.
76
+          'load' => TRUE,
77
+          // Boolean whether this plugin is a native plugin, i.e. shipped with
78
+          // the editor. Definition must be ommitted for plugins provided by
79
+          // other modules. TRUE means 'path' and 'filename' above are ignored
80
+          // and the plugin is instead loaded from the editor's plugin folder.
81
+          'internal' => TRUE,
82
+          // TinyMCE-specific: Additional HTML elements to allow in the markup.
83
+          'extended_valid_elements' => array(
84
+            'img[class|src|border=0|alt|title|width|height|align|name|style]',
85
+          ),
86
+        ),
87
+      );
88
+    }
89
+    break;
90 90
   }
91 91
 }
92 92
 
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
  */
103 103
 function hook_wysiwyg_include_directory($type) {
104 104
   switch ($type) {
105
-    case 'plugins':
106
-      // You can just return $type, if you place your Wysiwyg plugins into a
107
-      // sub-directory named 'plugins'.
108
-      return $type;
105
+  case 'plugins':
106
+    // You can just return $type, if you place your Wysiwyg plugins into a
107
+    // sub-directory named 'plugins'.
108
+    return $type;
109 109
   }
110 110
 }
111 111
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             'url' => 'http://drupal.org/project/img_assist',
46 46
             // The full path to the native editor plugin, no trailing slash.
47 47
             // Ignored when 'internal' is set to TRUE below.
48
-            'path' => drupal_get_path('module', 'img_assist') . '/drupalimage',
48
+            'path' => drupal_get_path('module', 'img_assist').'/drupalimage',
49 49
             // The name of the plugin's main JavaScript file.
50 50
             // Ignored when 'internal' is set to TRUE below.
51 51
             // Default value depends on which editor the plugin is for.
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
     'icon title' => t('Do something'),
151 151
     // An alternative path to the integration JavaScript; defaults to
152 152
     // '[path-to-module]/[plugins-directory]/[plugin-name]'.
153
-    'js path' => drupal_get_path('module', 'mymodule') . '/awesomeness',
153
+    'js path' => drupal_get_path('module', 'mymodule').'/awesomeness',
154 154
     // An alternative filename of the integration JavaScript; defaults to
155 155
     // '[plugin-name].js'.
156 156
     'js file' => 'awesome.js',
157 157
     // An alternative path to the integration stylesheet; defaults to
158 158
     // '[path-to-module]/[plugins-directory]/[plugin-name]'.
159
-    'css path' => drupal_get_path('module', 'mymodule') . '/awesomeness',
159
+    'css path' => drupal_get_path('module', 'mymodule').'/awesomeness',
160 160
     // An alternative filename of the integration stylesheet; defaults to
161 161
     // '[plugin-name].css'.
162 162
     'css file' => 'awesome.css',
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,19 +66,19 @@  discard block
 block discarded – undo
66 66
             // override. To be used rarely and only when required.
67 67
             'options' => array(
68 68
               'file_browser_callback' => 'imceImageBrowser',
69
-              'inline_styles' => TRUE,
69
+              'inline_styles' => true,
70 70
             ),
71 71
             // Boolean whether the editor needs to load this plugin. When TRUE,
72 72
             // the editor will automatically load the plugin based on the 'path'
73 73
             // variable provided. If FALSE, the plugin either does not need to
74 74
             // be loaded or is already loaded by something else on the page.
75 75
             // Most plugins should define TRUE here.
76
-            'load' => TRUE,
76
+            'load' => true,
77 77
             // Boolean whether this plugin is a native plugin, i.e. shipped with
78 78
             // the editor. Definition must be ommitted for plugins provided by
79 79
             // other modules. TRUE means 'path' and 'filename' above are ignored
80 80
             // and the plugin is instead loaded from the editor's plugin folder.
81
-            'internal' => TRUE,
81
+            'internal' => true,
82 82
             // TinyMCE-specific: Additional HTML elements to allow in the markup.
83 83
             'extended_valid_elements' => array(
84 84
               'img[class|src|border=0|alt|title|width|height|align|name|style]',
@@ -201,6 +201,6 @@  discard block
 block discarded – undo
201 201
   // for details.
202 202
   if ($context['profile']->editor == 'tinymce') {
203 203
     // Supported values to JSON data types.
204
-    $settings['cleanup_on_startup'] = TRUE;
204
+    $settings['cleanup_on_startup'] = true;
205 205
   }
206 206
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/forum_tweaks/forum_tweaks.module 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
  * Implementation of hook_menu().
18 18
  */
19 19
 function forum_tweaks_menu() {
20
-  // Note that this comes straight out of the Advanced Forum module. As such,
21
-  // it should be removed should said module be added at a future point in time
22
-  $items['community/forum/%/read'] = array(
20
+    // Note that this comes straight out of the Advanced Forum module. As such,
21
+    // it should be removed should said module be added at a future point in time
22
+    $items['community/forum/%/read'] = array(
23 23
     'access callback' => 'forum_tweaks_markasread_access',
24 24
     'page arguments' => array(2),
25 25
     'page callback' => 'forum_tweaks_markasread',
26 26
     'type' => MENU_CALLBACK,
27 27
     'file' => 'includes/mark-read.inc',
28
-  );
29
-  return $items;
28
+    );
29
+    return $items;
30 30
 }
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/forum_tweaks/includes/mark-read.inc 4 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -13,31 +13,31 @@  discard block
 block discarded – undo
13 13
  * Either fill a $links array or return a string version of the link to mark read.
14 14
  */
15 15
 function forum_tweaks_get_mark_read_link($tid = 0, &$links = array()) {
16
-  if (forum_tweaks_markasread_access() && !in_array($tid, variable_get('forum_containers', array()))) {
16
+    if (forum_tweaks_markasread_access() && !in_array($tid, variable_get('forum_containers', array()))) {
17 17
     if ($tid) {
18
-      $links['mark-read']['title'] = t('Mark all topics read');
19
-      $links['mark-read']['href'] = "community/forum/{$tid}/read";
18
+        $links['mark-read']['title'] = t('Mark all topics read');
19
+        $links['mark-read']['href'] = "community/forum/{$tid}/read";
20 20
 
21
-      return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE));
21
+        return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE));
22 22
     }
23 23
     else {
24
-      $links['mark-read']['title'] = t('Mark all forums read');
25
-      $links['mark-read']['href'] = "community/forum/0/read";
24
+        $links['mark-read']['title'] = t('Mark all forums read');
25
+        $links['mark-read']['href'] = "community/forum/0/read";
26 26
 
27
-      return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE));
27
+        return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE));
28
+    }
28 29
     }
29
-  }
30 30
 }
31 31
 
32 32
 /**
33 33
  * Marks all posts in forums or in a given forum as read by the current user.
34 34
  */
35 35
 function forum_tweaks_markasread($current_forum_id = 0) {
36
-  global $user;
36
+    global $user;
37 37
 
38
-  // See if we're on a forum or on the forum overview
39
-  // Path will be /forum/markasread or /forum/markasread/tid
40
-  if ($current_forum_id) {
38
+    // See if we're on a forum or on the forum overview
39
+    // Path will be /forum/markasread or /forum/markasread/tid
40
+    if ($current_forum_id) {
41 41
     // Delete the current history entries so already visited nodes get updated.
42 42
     $sql = "DELETE h
43 43
             FROM {history} AS h
@@ -58,26 +58,26 @@  discard block
 block discarded – undo
58 58
 
59 59
     // Readpath integration
60 60
     if (module_exists('readpath')) {
61
-      readpath_clear_readpath();
61
+        readpath_clear_readpath();
62 62
     }
63 63
 
64 64
     drupal_set_message(t('All content in this forum has been marked as read'));
65 65
     drupal_goto('community/forum/' . $current_forum_id);
66
-  }
66
+    }
67 67
 
68
-  // We are on the forum overview, requesting all forums be marked read
69
-  $forum_vocabulary_id = variable_get('forum_nav_vocabulary', '');
68
+    // We are on the forum overview, requesting all forums be marked read
69
+    $forum_vocabulary_id = variable_get('forum_nav_vocabulary', '');
70 70
 
71
-  // Delete the current history entries so already visited nodes get updated.
72
-  $sql = "DELETE h
71
+    // Delete the current history entries so already visited nodes get updated.
72
+    $sql = "DELETE h
73 73
           FROM {history} AS h
74 74
             INNER JOIN {term_node} AS tn ON (h.nid = tn.nid)
75 75
             INNER JOIN {term_data} AS td ON (td.tid = tn.tid)
76 76
           WHERE h.uid = %d AND td.vid = %d";
77
-  db_query($sql, $user->uid, $forum_vocabulary_id);
77
+    db_query($sql, $user->uid, $forum_vocabulary_id);
78 78
 
79
-  // Update the history table with all forum nodes newer than the cutoff.
80
-  $sql = "INSERT INTO {history} (uid, nid, timestamp)
79
+    // Update the history table with all forum nodes newer than the cutoff.
80
+    $sql = "INSERT INTO {history} (uid, nid, timestamp)
81 81
           SELECT DISTINCT %d, n.nid, %d
82 82
           FROM {node} AS n
83 83
             INNER JOIN {term_node} AS tn ON n.nid=tn.nid
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
             INNER JOIN {term_data} AS td ON tn.tid = td.tid
86 86
           WHERE (n.changed > %d OR ncs.last_comment_timestamp > %d) AND td.vid = %d";
87 87
 
88
-  $args = array($user->uid, time(), NODE_NEW_LIMIT, NODE_NEW_LIMIT, $forum_vocabulary_id);
88
+    $args = array($user->uid, time(), NODE_NEW_LIMIT, NODE_NEW_LIMIT, $forum_vocabulary_id);
89 89
 
90
-  db_query($sql, $args);
90
+    db_query($sql, $args);
91 91
 
92
-  drupal_set_message(t('All forum content has been marked as read'));
93
-  drupal_goto('community/forum');
92
+    drupal_set_message(t('All forum content has been marked as read'));
93
+    drupal_goto('community/forum');
94 94
 }
95 95
 
96 96
 /**
@@ -101,6 +101,6 @@  discard block
 block discarded – undo
101 101
  * cached and re-used for other users.
102 102
  */
103 103
 function forum_tweaks_markasread_access() {
104
-  global $user;
105
-  return user_access('access content') && $user->uid;
104
+    global $user;
105
+    return user_access('access content') && $user->uid;
106 106
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
       $links['mark-read']['title'] = t('Mark all topics read');
19 19
       $links['mark-read']['href'] = "community/forum/{$tid}/read";
20 20
 
21
-      return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE));
21
+      return l(t('Mark all topics read').'<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE));
22 22
     }
23 23
     else {
24 24
       $links['mark-read']['title'] = t('Mark all forums read');
25 25
       $links['mark-read']['href'] = "community/forum/0/read";
26 26
 
27
-      return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE));
27
+      return l(t('Mark all forums read').'<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE));
28 28
     }
29 29
   }
30 30
 }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     }
63 63
 
64 64
     drupal_set_message(t('All content in this forum has been marked as read'));
65
-    drupal_goto('community/forum/' . $current_forum_id);
65
+    drupal_goto('community/forum/'.$current_forum_id);
66 66
   }
67 67
 
68 68
   // We are on the forum overview, requesting all forums be marked read
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
       $links['mark-read']['href'] = "community/forum/{$tid}/read";
20 20
 
21 21
       return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE));
22
-    }
23
-    else {
22
+    } else {
24 23
       $links['mark-read']['title'] = t('Mark all forums read');
25 24
       $links['mark-read']['href'] = "community/forum/0/read";
26 25
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@
 block discarded – undo
18 18
       $links['mark-read']['title'] = t('Mark all topics read');
19 19
       $links['mark-read']['href'] = "community/forum/{$tid}/read";
20 20
 
21
-      return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => TRUE));
21
+      return l(t('Mark all topics read') . '<span class="image-replace"></span>', "forum/markasread/$tid", array('html' => true));
22 22
     }
23 23
     else {
24 24
       $links['mark-read']['title'] = t('Mark all forums read');
25 25
       $links['mark-read']['href'] = "community/forum/0/read";
26 26
 
27
-      return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => TRUE));
27
+      return l(t('Mark all forums read') . '<span class="image-replace"></span>', "forum/markasread", array('html' => true));
28 28
     }
29 29
   }
30 30
 }
Please login to merge, or discard this patch.