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 arguments' => array(1),
|
||||
'type' => MENU_CALLBACK,
|
||||
'access callback' => 'diff_node_revision_access',
|
||||
'access callback' => TRUE, # 'diff_node_revision_access',
|
||||
'access arguments' => array(1),
|
||||
'file' => 'diff.pages.inc',
|
||||
);
|
||||
|
@ -114,14 +114,21 @@ function diff_block($op = 'list', $delta = 0, $edit = array()) {
|
|||
if ($op === 'list') {
|
||||
return array('inline' => array('info' => t('Inline diff')));
|
||||
}
|
||||
elseif ($op === 'view' && $delta === 'inline' && user_access('view revisions') && $node = menu_get_object()) {
|
||||
$block = array();
|
||||
$revisions = node_revision_list($node);
|
||||
if (count($revisions) > 1) {
|
||||
$block['subject'] = t('Highlight changes');
|
||||
$block['content'] = drupal_get_form('diff_inline_form', $node, $revisions);
|
||||
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();
|
||||
$revisions = node_revision_list($node);
|
||||
if (count($revisions) > 1) {
|
||||
$block['subject'] = t('Highlight changes');
|
||||
$block['content'] = drupal_get_form('diff_inline_form', $node, $revisions);
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +136,7 @@ function diff_block($op = 'list', $delta = 0, $edit = array()) {
|
|||
* Implementation of hook_nodeapi().
|
||||
*/
|
||||
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.
|
||||
if (arg(2) === 'revisions' && arg(3) === $node->vid) {
|
||||
module_load_include('inc', 'diff', 'diff.pages');
|
||||
|
|
Reference in a new issue