Index: akismet.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/akismet/akismet.module,v retrieving revision 1.28 diff -u -p -r1.28 akismet.module --- akismet.module 13 Jul 2008 07:48:00 -0000 1.28 +++ akismet.module 27 Mar 2009 11:40:14 -0000 @@ -270,20 +270,17 @@ function akismet_menu() { ); } } - else { - $item = array( - 'title' => 'switch content status', - 'page callback' => 'akismet_page', - 'page arguments' => array(0, 1, 2, 3), - 'load arguments' => array('%map', '%index'), - 'access callback' => 'akismet_access_callback', - 'access argument' => array(0, 1, 2, 3), - ); - foreach (array('publish', 'unpublish', 'submit-spam', 'submit-ham') as $op) { - $items['akismet/%akismet/%/'. $op] = $item; - } + $item = array( + 'title' => 'switch content status', + 'page callback' => 'akismet_page', + 'page arguments' => array(0, 1, 2, 3), + 'load arguments' => array('%map', '%index'), + 'access callback' => 'akismet_access_callback', + 'access arguments' => array(0, 1, 2, 3), + ); + foreach (array('publish', 'unpublish', 'submit-spam', 'submit-ham') as $op) { + $items['akismet/%akismet/%/' . $op] = $item; } - return $items; } @@ -303,20 +300,22 @@ function akismet_load($arg, &$map, $inde return FALSE; } } - $op == $map[3]; + $op = $map[3]; if ($op == 'publish' || $op == 'unpublish') { $map[0] = 'akismet_callback_set_published_status'; } else if ($op == 'submit-spam' || $op == 'submit-ham') { $map[0] = 'akismet_callback_set_spam_status'; } + return $map[$index]; } function akismet_access_callback($callback, $content_type, $object, $op) { - if ($content_type == 'node' && !node_access($map[2])) { + if ($content_type == 'node' && !node_access('update', $object)) { return FALSE; } + if (function_exists($callback && !akismet_is_spam_moderator(akismet_content_get_moderator_type($content_type, $object)))) { return FALSE; } @@ -418,10 +417,15 @@ function akismet_callback_set_published_ * @param string Operation; it can be 'submit-spam' or 'submit-ham'. */ function akismet_callback_set_spam_status($content_type, $object, $op) { - $is_spam = akismet_content_is_spam($content_type, $object); - // Load the content (existence has been checked in hook_menu). - $content = akismet_content_load($content_type, $object); + if ($content_type == 'node') { + $is_spam = akismet_content_is_spam($content_type, $object->nid); + $content = akismet_content_load($content_type, $object->nid); + } + else { + $is_spam = akismet_content_is_spam($content_type, $object->cid); + $content = akismet_content_load($content_type, $object->cid); + } if ($content_type == 'node') { $is_published = ($content->status ? TRUE : FALSE);