Commit 6a4e6df3 authored by Dries's avatar Dries

- Patch #17592 by killes: improved access denied messages.

parent 22a98528
......@@ -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.
*/
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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.');
}
}
......
......@@ -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.');
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment