function content_lock_is_path_protected in Content locking (anti-concurrent editing) 7.3
Same name and namespace in other branches
- 7.2 content_lock.module \content_lock_is_path_protected()
Check if an internal Drupal path should be protected with a token.
Adds requirements that certain path be accessed only through tokenized URIs which are enforced by this module. This prevents people from being CSRFed into locking nodes that they can access without meaning to lock them.
Return value
bool Returns TRUE if the path is protected or FALSE if not protected.
2 calls to content_lock_is_path_protected()
- content_lock_node_form_handler in includes/
content_lock.node.inc - Node and node revision handler.
- content_lock_preprocess_link in ./
content_lock.module - Implements hook_preprocess_link().
File
- ./
content_lock.module, line 180
Code
function content_lock_is_path_protected($path) {
$cache =& drupal_static(__FUNCTION__, array());
// Check cache.
if (isset($cache[$path])) {
return $cache[$path];
}
// Invoke hook and collect grants/denies for protected paths.
$protected = array();
foreach (module_implements('content_lock_path_protected') as $module) {
$protected = array_merge($protected, array(
$module => module_invoke($module, 'content_lock_path_protected', $path),
));
}
// Allow other modules to alter the returned grants/denies.
drupal_alter('content_lock_path_protected', $protected, $path);
// If TRUE is returned, path is protected.
$cache[$path] = in_array(TRUE, $protected);
return $cache[$path];
}