From 6a4e6df36fe43b45c78a160fdf58df8d78ae5f02 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Mon, 22 Aug 2005 20:39:43 +0000 Subject: [PATCH] - Patch #17592 by killes: improved access denied messages. --- includes/common.inc | 12 +----------- modules/blogapi.module | 8 ++++---- modules/blogapi/blogapi.module | 8 ++++---- modules/node.module | 2 +- modules/node/node.module | 2 +- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 33519b450c53..e5e6d0190b0f 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -301,7 +301,7 @@ function drupal_access_denied() { if (empty($return)) { drupal_set_title(t('Access denied')); - $return = message_access(); + $return = t('You are not authorized to access this page.'); } print theme('page', $return); } @@ -569,16 +569,6 @@ function object2array($object) { * Frequently used messages. */ -/** - * Return a string with an "access denied" message. - * - * Always consider whether to use drupal_access_denied() instead to return a - * proper (and customizable) 403 error. - */ -function message_access() { - return t('You are not authorized to access this page.'); -} - /** * Return a string with a "not applicable" message. */ diff --git a/modules/blogapi.module b/modules/blogapi.module index 6b35a68efea1..9dd9d511b2e3 100644 --- a/modules/blogapi.module +++ b/modules/blogapi.module @@ -215,7 +215,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte } if (!node_access('create', $node)) { - return blogapi_error(message_access()); + return blogapi_error(t('You do not have permission to create the type of post you wanted to create.')); } $nid = node_save($node); @@ -246,7 +246,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont unset($node->teaser); if (!node_access('update', $node)) { - return blogapi_error(message_access()); + return blogapi_error(t('You do not have permission to update this post.')); } $node->status = $publish; @@ -485,7 +485,7 @@ function blogap_mti_publish_post($postid, $username, $password) { $node->status = 1; if (!node_access('update', $node)) { - return blogapi_error(message_access()); + return blogapi_error(t('You do not have permission to update this post.')); } node_save($node); @@ -520,7 +520,7 @@ function blogapi_validate_user($username, $password) { return $user; } else { - return message_access(); + return t("You either tried to edit somebody else's blog or you don't have permission to edit your own blog."); } } else { diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module index 6b35a68efea1..9dd9d511b2e3 100644 --- a/modules/blogapi/blogapi.module +++ b/modules/blogapi/blogapi.module @@ -215,7 +215,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte } if (!node_access('create', $node)) { - return blogapi_error(message_access()); + return blogapi_error(t('You do not have permission to create the type of post you wanted to create.')); } $nid = node_save($node); @@ -246,7 +246,7 @@ function blogapi_blogger_edit_post($appkey, $postid, $username, $password, $cont unset($node->teaser); if (!node_access('update', $node)) { - return blogapi_error(message_access()); + return blogapi_error(t('You do not have permission to update this post.')); } $node->status = $publish; @@ -485,7 +485,7 @@ function blogap_mti_publish_post($postid, $username, $password) { $node->status = 1; if (!node_access('update', $node)) { - return blogapi_error(message_access()); + return blogapi_error(t('You do not have permission to update this post.')); } node_save($node); @@ -520,7 +520,7 @@ function blogapi_validate_user($username, $password) { return $user; } else { - return message_access(); + return t("You either tried to edit somebody else's blog or you don't have permission to edit your own blog."); } } else { diff --git a/modules/node.module b/modules/node.module index ddb76a8ce400..296664b4127a 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1420,7 +1420,7 @@ function node_add($type) { $output = t('Choose the appropriate item from the list:') .'<dl>'. implode('', $item) .'</dl>'; } else { - $output = message_access(); + $output = t('You are not allowed to create content.'); } } diff --git a/modules/node/node.module b/modules/node/node.module index ddb76a8ce400..296664b4127a 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1420,7 +1420,7 @@ function node_add($type) { $output = t('Choose the appropriate item from the list:') .'<dl>'. implode('', $item) .'</dl>'; } else { - $output = message_access(); + $output = t('You are not allowed to create content.'); } } -- GitLab