| 1 |
<?php |
<?php |
| 2 |
// $Id: fasttoggle.module,v 1.8.2.5 2008/11/08 10:02:54 timcn Exp $ |
// $Id: fasttoggle.module,v 1.8.2.6 2008/11/08 11:09:20 timcn Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 191 |
|
|
| 192 |
switch ($type) { |
switch ($type) { |
| 193 |
case 'node': // $obj = node |
case 'node': // $obj = node |
| 194 |
$admin = user_access('administer nodes'); |
$allow = node_access('update', $obj); |
| 195 |
|
|
| 196 |
// Get an array with all enabled fast toggle links |
// Get an array with all enabled fast toggle links |
| 197 |
$settings = variable_get('fasttoggle_node_settings', array('status' => TRUE, 'sticky' => TRUE, 'promote' => TRUE, 'comment' => FALSE)); |
$settings = variable_get('fasttoggle_node_settings', array('status' => TRUE, 'sticky' => TRUE, 'promote' => TRUE, 'comment' => FALSE)); |
| 198 |
|
|
| 199 |
if ($settings['status'] && ($admin || user_access('moderate posts'))) { |
if ($settings['status'] && $allow && user_access('moderate posts')) { |
| 200 |
$return['status'] = _fasttoggle_get_label('node_status'); |
$return['status'] = _fasttoggle_get_label('node_status'); |
| 201 |
} |
} |
| 202 |
if ($settings['sticky'] && ($admin || user_access('make posts sticky'))) { |
if ($settings['sticky'] && $allow && user_access('make posts sticky')) { |
| 203 |
$return['sticky'] = _fasttoggle_get_label('node_sticky'); |
$return['sticky'] = _fasttoggle_get_label('node_sticky'); |
| 204 |
} |
} |
| 205 |
if ($settings['promote'] && ($admin || user_access('promote posts'))) { |
if ($settings['promote'] && $allow && user_access('promote posts')) { |
| 206 |
$return['promote'] = _fasttoggle_get_label('node_promote'); |
$return['promote'] = _fasttoggle_get_label('node_promote'); |
| 207 |
} |
} |
| 208 |
if (module_exists('comment') && $settings['comment'] && ($admin || user_access('administer comments'))) { |
if (module_exists('comment') && $settings['comment'] && $allow && user_access('administer comments')) { |
| 209 |
$return['comment'] = _fasttoggle_get_label('comment_admin'); |
$return['comment'] = _fasttoggle_get_label('comment_admin'); |
| 210 |
} |
} |
| 211 |
break; |
break; |