| 1 |
<?php |
<?php |
| 2 |
// $Id: forum_access.node.inc,v 1.4 2009/03/22 17:52:17 salvis Exp $ |
// $Id: forum_access.node.inc,v 1.5 2009/04/30 22:31:21 salvis Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file forum_access.node.inc |
* @file forum_access.node.inc |
| 75 |
// We gave this user the 'administer nodes' permission, which he doesn't |
// We gave this user the 'administer nodes' permission, which he doesn't |
| 76 |
// normally have. Remove controls that should be reserved to true node |
// normally have. Remove controls that should be reserved to true node |
| 77 |
// administrators. |
// administrators. |
| 78 |
|
_forum_access_disable_moderator(); // not needed anymore |
| 79 |
$allowed_elements = variable_get('forum_access_allowed_node_edit_elements', array('nid', 'vid', 'uid', 'created', 'type', 'changed', 'title', 'shadow', 'body_field', 'revision_information', 'form_build_id', 'form_token', 'form_id', 'comment_settings', 'taxonomy')); |
$allowed_elements = variable_get('forum_access_allowed_node_edit_elements', array('nid', 'vid', 'uid', 'created', 'type', 'changed', 'title', 'shadow', 'body_field', 'revision_information', 'form_build_id', 'form_token', 'form_id', 'comment_settings', 'taxonomy')); |
| 80 |
$allowed_options = variable_get('forum_access_allowed_node_edit_options', array('status', 'sticky', 'subscriptions_notify')); |
$allowed_options = variable_get('forum_access_allowed_node_edit_options', array('status', 'sticky', 'subscriptions_notify')); |
| 81 |
foreach (element_children($form) as $key) { |
foreach (element_children($form) as $key) { |
| 103 |
} |
} |
| 104 |
} |
} |
| 105 |
} |
} |
| 106 |
|
if ($user->_forum_access_moderator == 1) { |
| 107 |
|
$form['options']['#access'] = FALSE; |
| 108 |
|
$form['comment_settings']['#access'] = FALSE; |
| 109 |
|
} |
| 110 |
} |
} |
| 111 |
} |
} |
| 112 |
|
|
| 137 |
} |
} |
| 138 |
else { |
else { |
| 139 |
if (isset($form['admin']) && !empty($user->_forum_access_moderator)) { |
if (isset($form['admin']) && !empty($user->_forum_access_moderator)) { |
| 140 |
foreach (element_children($form['admin']) as $key) { |
switch ($user->_forum_access_moderator) { |
| 141 |
if ($key != 'status') { |
case 2: |
| 142 |
$form['admin'][$key]['#access'] = FALSE; |
foreach (element_children($form['admin']) as $key) { |
| 143 |
} |
if ($key != 'status') { |
| 144 |
|
$form['admin'][$key]['#access'] = FALSE; |
| 145 |
|
} |
| 146 |
|
} |
| 147 |
|
break; |
| 148 |
|
case 1: |
| 149 |
|
$form['admin']['#access'] = FALSE; |
| 150 |
} |
} |
| 151 |
} |
} |
| 152 |
} |
} |
| 214 |
|
|
| 215 |
$tid = $variables['node']->tid; |
$tid = $variables['node']->tid; |
| 216 |
$links = module_invoke_all('link', 'comment', $variables['comment'], 0); |
$links = module_invoke_all('link', 'comment', $variables['comment'], 0); |
| 217 |
|
|
| 218 |
|
if (!empty($user->_forum_access_moderator) && arg(0) == 'node' && arg(2) == NULL) { |
| 219 |
|
_forum_access_disable_moderator(); |
| 220 |
|
} |
| 221 |
|
|
| 222 |
if (isset($links['comment_reply']) && (!preg_match('#<li class="[^"]*comment_reply[^"]*".*</li>#U', $variables['links']) || !forum_access_access($tid, 'create'))) { |
if (isset($links['comment_reply']) && (!preg_match('#<li class="[^"]*comment_reply[^"]*".*</li>#U', $variables['links']) || !forum_access_access($tid, 'create'))) { |
| 223 |
unset($links['comment_reply']); |
unset($links['comment_reply']); |
| 224 |
} |
} |
| 240 |
); |
); |
| 241 |
} |
} |
| 242 |
$variables['links'] = theme('links', $links); |
$variables['links'] = theme('links', $links); |
|
|
|
|
if (!empty($user->_forum_access_moderator) && arg(0) == 'node' && arg(2) == NULL) { |
|
|
// Remove the permissions again to avoid confusing devel_node_access.module. |
|
|
_forum_access_disable_moderator(); |
|
|
} |
|
| 243 |
} |
} |