You are here

function diff_diffs in Diff 5.2

Same name and namespace in other branches
  1. 5 diff.module \diff_diffs()

Menu callback for diff related activities.

1 string reference to 'diff_diffs'
diff_menu in ./diff.module
Implementation of hook_menu() The menu path 'node/$nid/revisions' is overriden with 'diff_diffs'.

File

./diff.module, line 91

Code

function diff_diffs() {
  if (is_numeric(arg(1)) && arg(2) == 'revisions') {
    $op = arg(3) ? arg(3) : 'overview';
    switch ($op) {
      case 'overview':
        $node = node_load(arg(1));
        if ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node)) {
          return diff_diffs_overview($node);
        }
        drupal_access_denied();
        return;
      case 'view':
        if (is_numeric(arg(4)) && is_numeric(arg(5))) {
          $node = node_load(arg(1));
          if ($node->nid) {
            if ((user_access('view revisions') || user_access('administer nodes')) && node_access('view', $node)) {
              drupal_set_title(t('Diff for %title', array(
                '%title' => $node->title,
              )));
              return diff_diffs_show($node, arg(4), arg(5));
            }
            drupal_access_denied();
            return;
          }
        }
        break;
      default:

        // A view, revert or delete operation from the orignial node module,
        // so call the original node module to handle this.
        return node_revisions();
        break;
    }
  }
  drupal_not_found();
}