diff options
author | David Rothstein <drothstein@gmail.com> | 2013-12-29 15:32:28 -0500 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2013-12-29 15:32:28 -0500 |
commit | 257fac8454924bb2f09aaee6a112f9f86f7520f1 (patch) | |
tree | 7c0bc3b7730b203fba3c1ef0ce491cf5b2525315 | |
parent | 987892b79edcb3b2325fe551f261cd627c1f0e99 (diff) | |
download | brdo-257fac8454924bb2f09aaee6a112f9f86f7520f1.tar.gz brdo-257fac8454924bb2f09aaee6a112f9f86f7520f1.tar.bz2 |
Issue #1426122 by deletedaccount, Alan D., andypost, maximpodorov: Some callbacks return junk when calling drupal_not_found(); replace with return MENU_NOT_FOUND instead.
-rw-r--r-- | CHANGELOG.txt | 4 | ||||
-rw-r--r-- | modules/comment/comment.module | 2 | ||||
-rw-r--r-- | modules/image/image.module | 2 | ||||
-rw-r--r-- | modules/locale/locale.admin.inc | 4 | ||||
-rw-r--r-- | modules/menu/menu.admin.inc | 6 | ||||
-rw-r--r-- | modules/profile/profile.pages.inc | 11 | ||||
-rw-r--r-- | modules/shortcut/shortcut.admin.inc | 2 | ||||
-rw-r--r-- | modules/statistics/statistics.admin.inc | 4 | ||||
-rw-r--r-- | modules/statistics/statistics.pages.inc | 8 | ||||
-rw-r--r-- | modules/system/system.admin.inc | 6 | ||||
-rw-r--r-- | modules/user/user.pages.inc | 3 |
11 files changed, 22 insertions, 30 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b9a8daa56..082efb254 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,10 @@ Drupal 7.25, xxxx-xx-xx (development version) ----------------------- +- Standardized menu callback functions throughout Drupal core to return + MENU_NOT_FOUND and MENU_ACCESS_DENIED rather than printing their own "page + not found" or "access denied" pages (minor API change in the return value of + these functions under some circumstances). - Fixed a bug in which caches were not properly cleared when a node was deleted via the administrative interface. - Changed the Bartik theme to render content contained in <pre>, <code> and diff --git a/modules/comment/comment.module b/modules/comment/comment.module index a83069f63..6f6c04b08 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -490,7 +490,7 @@ function comment_permalink($cid) { // Return the node view, this will show the correct comment in context. return menu_execute_active_handler('node/' . $node->nid, FALSE); } - drupal_not_found(); + return MENU_NOT_FOUND; } /** diff --git a/modules/image/image.module b/modules/image/image.module index 445e8d0ea..c6a23f25a 100644 --- a/modules/image/image.module +++ b/modules/image/image.module @@ -835,7 +835,7 @@ function image_style_deliver($style, $scheme) { else { $headers = module_invoke_all('file_download', $image_uri); if (in_array(-1, $headers) || empty($headers)) { - return drupal_access_denied(); + return MENU_ACCESS_DENIED; } if (count($headers)) { foreach ($headers as $name => $value) { diff --git a/modules/locale/locale.admin.inc b/modules/locale/locale.admin.inc index f1a71ddfe..b736f79b7 100644 --- a/modules/locale/locale.admin.inc +++ b/modules/locale/locale.admin.inc @@ -1242,9 +1242,7 @@ function locale_translate_delete_page($lid) { if ($source = db_query('SELECT lid, source FROM {locales_source} WHERE lid = :lid', array(':lid' => $lid))->fetchObject()) { return drupal_get_form('locale_translate_delete_form', $source); } - else { - return drupal_not_found(); - } + return MENU_NOT_FOUND; } /** diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index 68d8e12dc..66bd6f3b5 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -512,8 +512,7 @@ function menu_delete_menu_page($menu) { // System-defined menus may not be deleted. $system_menus = menu_list_system_menus(); if (isset($system_menus[$menu['menu_name']])) { - drupal_access_denied(); - return; + return MENU_ACCESS_DENIED; } return drupal_get_form('menu_delete_menu_confirm', $menu); } @@ -622,8 +621,7 @@ function menu_item_delete_page($item) { // Links defined via hook_menu may not be deleted. Updated items are an // exception, as they can be broken. if ($item['module'] == 'system' && !$item['updated']) { - drupal_access_denied(); - return; + return MENU_ACCESS_DENIED; } return drupal_get_form('menu_item_delete_form', $item); } diff --git a/modules/profile/profile.pages.inc b/modules/profile/profile.pages.inc index db65e9ac7..056015a31 100644 --- a/modules/profile/profile.pages.inc +++ b/modules/profile/profile.pages.inc @@ -17,13 +17,11 @@ function profile_browse() { if ($name && $field->fid) { // Only allow browsing of fields that have a page title set. if (empty($field->page)) { - drupal_not_found(); - return; + return MENU_NOT_FOUND; } // Do not allow browsing of private and hidden fields by non-admins. if (!user_access('administer users') && ($field->visibility == PROFILE_PRIVATE || $field->visibility == PROFILE_HIDDEN)) { - drupal_access_denied(); - return; + return MENU_ACCESS_DENIED; } // Compile a list of fields to show. @@ -54,8 +52,7 @@ function profile_browse() { $query->condition('v.value', '%' . db_like($value) . '%', 'LIKE'); break; default: - drupal_not_found(); - return; + return MENU_NOT_FOUND; } $uids = $query @@ -85,7 +82,7 @@ function profile_browse() { return $output; } elseif ($name && !$field->fid) { - drupal_not_found(); + return MENU_NOT_FOUND; } else { // Compile a list of fields to show. diff --git a/modules/shortcut/shortcut.admin.inc b/modules/shortcut/shortcut.admin.inc index c592a3185..2e8ddb43d 100644 --- a/modules/shortcut/shortcut.admin.inc +++ b/modules/shortcut/shortcut.admin.inc @@ -784,5 +784,5 @@ function shortcut_link_add_inline($shortcut_set) { drupal_goto(); } - return drupal_access_denied(); + return MENU_ACCESS_DENIED; } diff --git a/modules/statistics/statistics.admin.inc b/modules/statistics/statistics.admin.inc index 0740dd1ab..71e64aa50 100644 --- a/modules/statistics/statistics.admin.inc +++ b/modules/statistics/statistics.admin.inc @@ -263,9 +263,7 @@ function statistics_access_log($aid) { ); return $build; } - else { - drupal_not_found(); - } + return MENU_NOT_FOUND; } /** diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc index 8bd9712f6..dd50aae3d 100644 --- a/modules/statistics/statistics.pages.inc +++ b/modules/statistics/statistics.pages.inc @@ -54,9 +54,7 @@ function statistics_node_tracker() { $build['statistics_pager'] = array('#theme' => 'pager'); return $build; } - else { - drupal_not_found(); - } + return MENU_NOT_FOUND; } /** @@ -99,7 +97,5 @@ function statistics_user_tracker() { $build['statistics_pager'] = array('#theme' => 'pager'); return $build; } - else { - drupal_not_found(); - } + return MENU_NOT_FOUND; } diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index b5b19e85f..465fd9f4d 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -309,7 +309,7 @@ function system_theme_enable() { } drupal_goto('admin/appearance'); } - return drupal_access_denied(); + return MENU_ACCESS_DENIED; } /** @@ -337,7 +337,7 @@ function system_theme_disable() { } drupal_goto('admin/appearance'); } - return drupal_access_denied(); + return MENU_ACCESS_DENIED; } /** @@ -383,7 +383,7 @@ function system_theme_default() { } drupal_goto('admin/appearance'); } - return drupal_access_denied(); + return MENU_ACCESS_DENIED; } /** diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc index d72cecc26..7d40663e7 100644 --- a/modules/user/user.pages.inc +++ b/modules/user/user.pages.inc @@ -159,6 +159,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a // Deny access, no more clues. // Everything will be in the watchdog's URL for the administrator to check. drupal_access_denied(); + drupal_exit(); } } } @@ -534,7 +535,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') { drupal_goto("user/$account->uid/cancel"); } } - drupal_access_denied(); + return MENU_ACCESS_DENIED; } /** |