Fix the restricted execution in combination with view_revisions_by_content_type module
This commit is contained in:
parent
99c4640f36
commit
a4887c6502
1 changed files with 16 additions and 9 deletions
|
@ -76,7 +76,7 @@ function diff_menu() {
|
||||||
'page callback' => 'diff_inline_ahah',
|
'page callback' => 'diff_inline_ahah',
|
||||||
'page arguments' => array(1),
|
'page arguments' => array(1),
|
||||||
'type' => MENU_CALLBACK,
|
'type' => MENU_CALLBACK,
|
||||||
'access callback' => 'diff_node_revision_access',
|
'access callback' => TRUE, # 'diff_node_revision_access',
|
||||||
'access arguments' => array(1),
|
'access arguments' => array(1),
|
||||||
'file' => 'diff.pages.inc',
|
'file' => 'diff.pages.inc',
|
||||||
);
|
);
|
||||||
|
@ -114,7 +114,12 @@ function diff_block($op = 'list', $delta = 0, $edit = array()) {
|
||||||
if ($op === 'list') {
|
if ($op === 'list') {
|
||||||
return array('inline' => array('info' => t('Inline diff')));
|
return array('inline' => array('info' => t('Inline diff')));
|
||||||
}
|
}
|
||||||
elseif ($op === 'view' && $delta === 'inline' && user_access('view revisions') && $node = menu_get_object()) {
|
elseif ($op === 'view' && $delta === 'inline') { # && $node = menu_get_object()) {
|
||||||
|
# $parsed_path = explode("/", db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s'", substr(request_uri(), 1))));
|
||||||
|
$parsed_path = explode("/", drupal_lookup_path('source', substr(request_uri(), strlen(base_path()))));
|
||||||
|
if (array_search('node', $parsed_path) !== FALSE) {
|
||||||
|
$key = (array_search('node', $parsed_path) + 1);
|
||||||
|
if ($node = node_load($parsed_path[$key])) {
|
||||||
$block = array();
|
$block = array();
|
||||||
$revisions = node_revision_list($node);
|
$revisions = node_revision_list($node);
|
||||||
if (count($revisions) > 1) {
|
if (count($revisions) > 1) {
|
||||||
|
@ -123,13 +128,15 @@ function diff_block($op = 'list', $delta = 0, $edit = array()) {
|
||||||
}
|
}
|
||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_nodeapi().
|
* Implementation of hook_nodeapi().
|
||||||
*/
|
*/
|
||||||
function diff_nodeapi(&$node, $op, $teaser, $page) {
|
function diff_nodeapi(&$node, $op, $teaser, $page) {
|
||||||
if ($page && $op == 'view' && user_access('view revisions') && variable_get('show_diff_inline_'. $node->type, FALSE)) {
|
if ($page && $op == 'view' && variable_get('show_diff_inline_'. $node->type, FALSE)) {
|
||||||
// Ugly but cheap way to check that we are viewing a node's revision page.
|
// Ugly but cheap way to check that we are viewing a node's revision page.
|
||||||
if (arg(2) === 'revisions' && arg(3) === $node->vid) {
|
if (arg(2) === 'revisions' && arg(3) === $node->vid) {
|
||||||
module_load_include('inc', 'diff', 'diff.pages');
|
module_load_include('inc', 'diff', 'diff.pages');
|
||||||
|
|
Reference in a new issue