Commit 2debcfb1 authored by Dries's avatar Dries

- Patch #15595 by Stefan and Djun: improved status messages.

  TODO: we should write down a couple guidelines for these document them in
        the PHPDoc code of drupal_set_message()!  .
parent 381853c6
...@@ -4,9 +4,9 @@ Drupal x.x.x, xxxx-xx-xx (Development version) ...@@ -4,9 +4,9 @@ Drupal x.x.x, xxxx-xx-xx (Development version)
- added free tagging support (folksonomies). - added free tagging support (folksonomies).
- added a site-wide contact form. - added a site-wide contact form.
- theme system: - theme system:
* removed the Xtemplate theme engine. * added the PHPTemplate theme engine and removed the Xtemplate engine.
* added the PHPTemplate theme engine.
* converted the bluemarine theme from XTemplate to PHPTemplate. * converted the bluemarine theme from XTemplate to PHPTemplate.
* converted the pushbutton theme from XTemplate to PHPTemplate.
- reworked the 'request new password' functionality. - reworked the 'request new password' functionality.
- profiles: - profiles:
* added a block to display author information along with posts. * added a block to display author information along with posts.
......
...@@ -76,7 +76,7 @@ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) { ...@@ -76,7 +76,7 @@ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
// Check if directory exists. // Check if directory exists.
if (!is_dir($directory)) { if (!is_dir($directory)) {
if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory, 0760)) { if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory, 0760)) {
drupal_set_message(t('Created directory %directory.', array('%directory' => theme('placeholder', $directory)))); drupal_set_message(t('The directory %directory has been created.', array('%directory' => theme('placeholder', $directory))));
} }
else { else {
if ($form_item) { if ($form_item) {
...@@ -89,10 +89,11 @@ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) { ...@@ -89,10 +89,11 @@ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
// Check to see if the directory is writable. // Check to see if the directory is writable.
if (!is_writable($directory)) { if (!is_writable($directory)) {
if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0760)) { if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0760)) {
drupal_set_message(t('Modified permissions on directory %directory.', array('%directory' => theme('placeholder', $directory)))); drupal_set_message(t('The permissions of directory %directory have been changed to make it writable.', array('%directory' => theme('placeholder', $directory))));
} }
else { else {
form_set_error($form_item, t('The directory %directory is not writable.', array('%directory' => theme('placeholder', $directory)))); form_set_error($form_item, t('The directory %directory is not writable', array('%directory' => theme('placeholder', $directory))));
watchdog('file system', t('The directory %directory is not writable, because it does not have the correct permissions set.', array('%directory' => theme('placeholder', $directory))), WATCHDOG_ERROR);
return false; return false;
} }
} }
...@@ -199,7 +200,8 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { ...@@ -199,7 +200,8 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
// Make sure we at least have a valid directory. // Make sure we at least have a valid directory.
if ($basename === false) { if ($basename === false) {
drupal_set_message(t('File copy failed: no directory configured, or it could not be accessed.'), 'error'); drupal_set_message(t('The selected file %file could not be uploaded, because the destination %directory is not properly configured.', array('%file' => theme('placeholder', $source), '%directory' => theme('placeholder', $dest))), 'error');
watchdog('file system', t('The selected file %file could not not be uploaded, because the destination %directory could not be found, or because its permissions do not allow the file to be written.', array('%file' => theme('placeholder', $source), '%directory' => theme('placeholder', $dest))), WATCHDOG_ERROR);
return 0; return 0;
} }
...@@ -214,11 +216,11 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { ...@@ -214,11 +216,11 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
$source = realpath($source); $source = realpath($source);
if (!file_exists($source)) { if (!file_exists($source)) {
drupal_set_message(t('File copy failed: source file does not exist.'), 'error'); drupal_set_message(t('The selected file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.', array('%file' => theme('placeholder', $source))), 'error');
return 0; return 0;
} }
// If destination file is not specified then use filename of source file. // If the destination file is not specified then use the filename of the source file.
$basename = $basename ? $basename : basename($source); $basename = $basename ? $basename : basename($source);
$dest = $directory .'/'. $basename; $dest = $directory .'/'. $basename;
...@@ -246,7 +248,7 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { ...@@ -246,7 +248,7 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
break; break;
case FILE_EXISTS_ERROR: case FILE_EXISTS_ERROR:
drupal_set_message(t('File copy failed. File already exists.'), 'error'); drupal_set_message(t('The selected file %file could not be copied, because a file by that name already exists in the destination.', array('%file' => theme('placeholder', $source))), 'error');
return 0; return 0;
case FILE_EXISTS_REPLACE: case FILE_EXISTS_REPLACE:
...@@ -255,7 +257,7 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { ...@@ -255,7 +257,7 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
} }
if (!@copy($source, $dest)) { if (!@copy($source, $dest)) {
drupal_set_message(t('File copy failed.'), 'error'); drupal_set_message(t('The selected file %file could not be copied.', array('%file' => theme('placeholder', $source))), 'error');
return 0; return 0;
} }
} }
...@@ -299,7 +301,7 @@ function file_move(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) { ...@@ -299,7 +301,7 @@ function file_move(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
if ($path_original == $path_current || file_delete($path_original)) { if ($path_original == $path_current || file_delete($path_original)) {
return 1; return 1;
} }
drupal_set_message(t('Removing original file failed.'), 'error'); drupal_set_message(t('The removal of the original file %file has failed.', array('%file' => theme('placeholder', $source))), 'error');
} }
return 0; return 0;
} }
...@@ -358,25 +360,25 @@ function file_save_upload($source, $dest = 0, $replace = FILE_EXISTS_RENAME) { ...@@ -358,25 +360,25 @@ function file_save_upload($source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
} }
if (!user_access('bypass input data check') && !valid_input_data($file)) { if (!user_access('bypass input data check') && !valid_input_data($file)) {
watchdog('security', t('Possible exploit abuse: invalid data.'), WATCHDOG_WARNING); watchdog('security', t('The file %file has not been saved, because it may contain a possible attempt to exploit or abuse this system.', array('%file' => theme('placeholder', $source))), WATCHDOG_WARNING);
drupal_set_message(t('File upload failed: invalid data.'), 'error'); drupal_set_message(t('The file %file has not been saved, because it contains invalid data.', array('%file' => theme('placeholder', $source))), 'error');
return 0; return 0;
} }
// Check for file upload errors. // Check for file upload errors.
switch ($file->error) { switch ($file->error) {
case 0: // UPLOAD_ERR_OK case 0: // UPLOAD_ERR_OK: File uploaded successfully
break; break;
case 1: // UPLOAD_ERR_INI_SIZE case 1: // UPLOAD_ERR_INI_SIZE: File size exceeded php.ini value
case 2: // UPLOAD_ERR_FORM_SIZE case 2: // UPLOAD_ERR_FORM_SIZE: File size exceeded MAX_FILE_SIZE form value
drupal_set_message(t('File upload failed: file size too big.'), 'error'); drupal_set_message(t('The file %file could not be saved, because it exceeds the maximum allowed size for uploads.', array('%file' => theme('placeholder', $source))), 'error');
return 0; return 0;
case 3: // UPLOAD_ERR_PARTIAL case 3: // UPLOAD_ERR_PARTIAL: File was only partially uploaded
case 4: // UPLOAD_ERR_NO_FILE case 4: // UPLOAD_ERR_NO_FILE: No file was uploaded
drupal_set_message(t('File upload failed: incomplete upload.'), 'error'); drupal_set_message(t('The file %file could not be saved, because the upload did not complete.', array('%file' => theme('placeholder', $source))), 'error');
return 0; return 0;
default: // Unknown error default: // Unknown error
drupal_set_message(t('File upload failed: unknown error.'), 'error'); drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => theme('placeholder', $source))),'error');
return 0; return 0;
} }
...@@ -402,15 +404,15 @@ function file_save_upload($source, $dest = 0, $replace = FILE_EXISTS_RENAME) { ...@@ -402,15 +404,15 @@ function file_save_upload($source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
*/ */
function file_save_data($data, $dest, $replace = FILE_EXISTS_RENAME) { function file_save_data($data, $dest, $replace = FILE_EXISTS_RENAME) {
if (!user_access('bypass input data check') && !valid_input_data($data)) { if (!user_access('bypass input data check') && !valid_input_data($data)) {
watchdog('security', t('Possible exploit abuse: invalid data.'), WATCHDOG_WARNING); watchdog('security', t('The file has not been saved, because it may contain a possible attempt to exploit or abuse this system.'), WATCHDOG_WARNING);
drupal_set_message(t('File upload failed: invalid data.'), 'error'); drupal_set_message(t('The file has not been saved, because it contains invalid data.'), 'error');
return 0; return 0;
} }
$temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP); $temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP);
$file = tempnam($temp, 'file'); $file = tempnam($temp, 'file');
if (!$fp = fopen($file, 'wb')) { if (!$fp = fopen($file, 'wb')) {
drupal_set_message(t('Unable to create file.'), 'error'); drupal_set_message(t('The file could not be created.'), 'error');
return 0; return 0;
} }
fwrite($fp, $data); fwrite($fp, $data);
......
This diff is collapsed.
...@@ -814,19 +814,8 @@ function theme_item_list($items = array(), $title = NULL) { ...@@ -814,19 +814,8 @@ function theme_item_list($items = array(), $title = NULL) {
} }
/** /**
* Return a themed error message. * Returns code that emits the 'more help'-link.
* REMOVE: this function is deprecated an no longer used in core.
*
* @param $message
* The error message to be themed.
*
* @return
* A string containing the error output.
*/ */
function theme_error($message) {
return '<div class="error">'. $message .'</div>';
}
function theme_more_help_link($url) { function theme_more_help_link($url) {
return '<div class="more-help-link">' . t('[<a href="%link">more help...</a>]', array('%link' => $url)) . '</div>'; return '<div class="more-help-link">' . t('[<a href="%link">more help...</a>]', array('%link' => $url)) . '</div>';
} }
......
...@@ -268,7 +268,7 @@ function aggregator_remove($feed) { ...@@ -268,7 +268,7 @@ function aggregator_remove($feed) {
} }
db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']); db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']);
db_query("UPDATE {aggregator_feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']); db_query("UPDATE {aggregator_feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']);
drupal_set_message(t('Removed news items from %site.', array('%site' => theme('placeholder', $feed['title'])))); drupal_set_message(t('The news items from %site have been removed.', array('%site' => theme('placeholder', $feed['title']))));
} }
/** /**
...@@ -348,7 +348,7 @@ function aggregator_refresh($feed) { ...@@ -348,7 +348,7 @@ function aggregator_refresh($feed) {
switch ($result->code) { switch ($result->code) {
case 304: case 304:
db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']); db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']);
drupal_set_message(t('No new syndicated content from %site.', array('%site' => theme('placeholder', $feed['title'])))); drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => theme('placeholder', $feed['title']))));
break; break;
case 301: case 301:
$feed['url'] = $result->redirect_url; $feed['url'] = $result->redirect_url;
...@@ -400,15 +400,13 @@ function aggregator_refresh($feed) { ...@@ -400,15 +400,13 @@ function aggregator_refresh($feed) {
cache_clear_all(); cache_clear_all();
$message = t('Syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))); watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
watchdog('aggregator', $message); drupal_set_message(t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
drupal_set_message($message);
} }
break; break;
default: default:
$message = t('Failed to parse RSS feed %site: %error.', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))); watchdog('aggregator', t('The RSS-feed from %site seems to be broken, due to "%error".', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))), WATCHDOG_WARNING);
watchdog('aggregator', $message, WATCHDOG_WARNING); drupal_set_message(t('The RSS-feed from %site seems to be broken, because of error "%error".', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))));
drupal_set_message($message);
} }
} }
...@@ -464,9 +462,8 @@ function aggregator_parse_feed(&$data, $feed) { ...@@ -464,9 +462,8 @@ function aggregator_parse_feed(&$data, $feed) {
xml_set_character_data_handler($xml_parser, 'aggregator_element_data'); xml_set_character_data_handler($xml_parser, 'aggregator_element_data');
if (!xml_parse($xml_parser, $data, 1)) { if (!xml_parse($xml_parser, $data, 1)) {
$message = t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))); watchdog('aggregator', t('The RSS-feed from %site seems to be broken, due to an error "%error" on line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), WATCHDOG_WARNING);
watchdog('aggregator', $message, WATCHDOG_WARNING); drupal_set_message(t('The RSS-feed from %site seems to be broken, because of error "%error" on line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), 'error');
drupal_set_message($message, 'error');
return 0; return 0;
} }
xml_parser_free($xml_parser); xml_parser_free($xml_parser);
...@@ -553,7 +550,7 @@ function aggregator_parse_feed(&$data, $feed) { ...@@ -553,7 +550,7 @@ function aggregator_parse_feed(&$data, $feed) {
} }
if (!valid_input_data($item['DESCRIPTION'])) { if (!valid_input_data($item['DESCRIPTION'])) {
drupal_set_message(t('Failed to parse entry from %site feed: suspicious input data.', array('%site' => theme('placeholder', $feed['title']))), 'error'); drupal_set_message(t('The RSS feed from %site seems to be broken, because of suspicious input data.', array('%site' => theme('placeholder', $feed['title']))), 'error');
} }
else { else {
aggregator_save_item(array('iid' => $entry->iid, 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'])); aggregator_save_item(array('iid' => $entry->iid, 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION']));
...@@ -783,7 +780,7 @@ function aggregator_admin_edit_category($category = 0) { ...@@ -783,7 +780,7 @@ function aggregator_admin_edit_category($category = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_category($edit); aggregator_save_category($edit);
drupal_set_message($edit['title'] ? t('The category has been updated.') : t('The category has been deleted.')); drupal_set_message($edit['title'] ? t('The category has been updated.') : t('The category has been removed.'));
menu_rebuild(); menu_rebuild();
drupal_goto('admin/aggregator'); drupal_goto('admin/aggregator');
break; break;
...@@ -813,7 +810,7 @@ function aggregator_admin_edit_feed($feed = 0) { ...@@ -813,7 +810,7 @@ function aggregator_admin_edit_feed($feed = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_feed($edit); aggregator_save_feed($edit);
drupal_set_message($edit['title'] ? t('The feed has been updated.') : t('The feed has been deleted.')); drupal_set_message($edit['title'] ? t('The feed has been updated.') : t('The feed has been removed.'));
menu_rebuild(); menu_rebuild();
drupal_goto('admin/aggregator'); drupal_goto('admin/aggregator');
break; break;
......
...@@ -268,7 +268,7 @@ function aggregator_remove($feed) { ...@@ -268,7 +268,7 @@ function aggregator_remove($feed) {
} }
db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']); db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']);
db_query("UPDATE {aggregator_feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']); db_query("UPDATE {aggregator_feed} SET checked = 0, etag = '', modified = 0 WHERE fid = %d", $feed['fid']);
drupal_set_message(t('Removed news items from %site.', array('%site' => theme('placeholder', $feed['title'])))); drupal_set_message(t('The news items from %site have been removed.', array('%site' => theme('placeholder', $feed['title']))));
} }
/** /**
...@@ -348,7 +348,7 @@ function aggregator_refresh($feed) { ...@@ -348,7 +348,7 @@ function aggregator_refresh($feed) {
switch ($result->code) { switch ($result->code) {
case 304: case 304:
db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']); db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', time(), $feed['fid']);
drupal_set_message(t('No new syndicated content from %site.', array('%site' => theme('placeholder', $feed['title'])))); drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => theme('placeholder', $feed['title']))));
break; break;
case 301: case 301:
$feed['url'] = $result->redirect_url; $feed['url'] = $result->redirect_url;
...@@ -400,15 +400,13 @@ function aggregator_refresh($feed) { ...@@ -400,15 +400,13 @@ function aggregator_refresh($feed) {
cache_clear_all(); cache_clear_all();
$message = t('Syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))); watchdog('aggregator', t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
watchdog('aggregator', $message); drupal_set_message(t('There is new syndicated content from %site.', array('%site' => theme('placeholder', $feed[title]))));
drupal_set_message($message);
} }
break; break;
default: default:
$message = t('Failed to parse RSS feed %site: %error.', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))); watchdog('aggregator', t('The RSS-feed from %site seems to be broken, due to "%error".', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))), WATCHDOG_WARNING);
watchdog('aggregator', $message, WATCHDOG_WARNING); drupal_set_message(t('The RSS-feed from %site seems to be broken, because of error "%error".', array('%site' => theme('placeholder', $feed['title']), '%error' => theme('placeholder', $result->code .' '. $result->error))));
drupal_set_message($message);
} }
} }
...@@ -464,9 +462,8 @@ function aggregator_parse_feed(&$data, $feed) { ...@@ -464,9 +462,8 @@ function aggregator_parse_feed(&$data, $feed) {
xml_set_character_data_handler($xml_parser, 'aggregator_element_data'); xml_set_character_data_handler($xml_parser, 'aggregator_element_data');
if (!xml_parse($xml_parser, $data, 1)) { if (!xml_parse($xml_parser, $data, 1)) {
$message = t('Failed to parse RSS feed %site: %error at line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))); watchdog('aggregator', t('The RSS-feed from %site seems to be broken, due to an error "%error" on line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), WATCHDOG_WARNING);
watchdog('aggregator', $message, WATCHDOG_WARNING); drupal_set_message(t('The RSS-feed from %site seems to be broken, because of error "%error" on line %line.', array('%site' => theme('placeholder', $feed['title']), '%error' => xml_error_string(xml_get_error_code($xml_parser)), '%line' => xml_get_current_line_number($xml_parser))), 'error');
drupal_set_message($message, 'error');
return 0; return 0;
} }
xml_parser_free($xml_parser); xml_parser_free($xml_parser);
...@@ -553,7 +550,7 @@ function aggregator_parse_feed(&$data, $feed) { ...@@ -553,7 +550,7 @@ function aggregator_parse_feed(&$data, $feed) {
} }
if (!valid_input_data($item['DESCRIPTION'])) { if (!valid_input_data($item['DESCRIPTION'])) {
drupal_set_message(t('Failed to parse entry from %site feed: suspicious input data.', array('%site' => theme('placeholder', $feed['title']))), 'error'); drupal_set_message(t('The RSS feed from %site seems to be broken, because of suspicious input data.', array('%site' => theme('placeholder', $feed['title']))), 'error');
} }
else { else {
aggregator_save_item(array('iid' => $entry->iid, 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'])); aggregator_save_item(array('iid' => $entry->iid, 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION']));
...@@ -783,7 +780,7 @@ function aggregator_admin_edit_category($category = 0) { ...@@ -783,7 +780,7 @@ function aggregator_admin_edit_category($category = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_category($edit); aggregator_save_category($edit);
drupal_set_message($edit['title'] ? t('The category has been updated.') : t('The category has been deleted.')); drupal_set_message($edit['title'] ? t('The category has been updated.') : t('The category has been removed.'));
menu_rebuild(); menu_rebuild();
drupal_goto('admin/aggregator'); drupal_goto('admin/aggregator');
break; break;
...@@ -813,7 +810,7 @@ function aggregator_admin_edit_feed($feed = 0) { ...@@ -813,7 +810,7 @@ function aggregator_admin_edit_feed($feed = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_feed($edit); aggregator_save_feed($edit);
drupal_set_message($edit['title'] ? t('The feed has been updated.') : t('The feed has been deleted.')); drupal_set_message($edit['title'] ? t('The feed has been updated.') : t('The feed has been removed.'));
menu_rebuild(); menu_rebuild();
drupal_goto('admin/aggregator'); drupal_goto('admin/aggregator');
break; break;
......
...@@ -116,8 +116,6 @@ function block_admin_save($edit) { ...@@ -116,8 +116,6 @@ function block_admin_save($edit) {
$block['region'], $block['status'], $block['weight'], $block['throttle'], $module, $delta); $block['region'], $block['status'], $block['weight'], $block['throttle'], $module, $delta);
} }
} }
return t('The block settings have been updated.');
} }
/** /**
...@@ -300,7 +298,7 @@ function block_box_add() { ...@@ -300,7 +298,7 @@ function block_box_add() {
switch ($op) { switch ($op) {
case t('Save block'): case t('Save block'):
if (block_box_save($edit)) { if (block_box_save($edit)) {
drupal_set_message(t('The new block has been added.')); drupal_set_message(t('The block has been created.'));
drupal_goto('admin/block'); drupal_goto('admin/block');
} }
// deliberate no break // deliberate no break
...@@ -323,7 +321,7 @@ function block_box_delete($bid = 0) { ...@@ -323,7 +321,7 @@ function block_box_delete($bid = 0) {
if ($_POST['edit']['confirm']) { if ($_POST['edit']['confirm']) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $bid); db_query('DELETE FROM {boxes} WHERE bid = %d', $bid);
drupal_set_message(t('The block %name has been deleted.', array('%name' => theme('placeholder', $info)))); drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $info))));
cache_clear_all(); cache_clear_all();
drupal_goto('admin/block'); drupal_goto('admin/block');
} }
...@@ -373,7 +371,8 @@ function block_admin() { ...@@ -373,7 +371,8 @@ function block_admin() {
$op = $_POST['op']; $op = $_POST['op'];
if ($op == t('Save blocks')) { if ($op == t('Save blocks')) {
drupal_set_message(block_admin_save($edit)); block_admin_save($edit);
drupal_set_message(t('The blocks have been saved.'));
cache_clear_all(); cache_clear_all();
drupal_goto($_GET['q']); drupal_goto($_GET['q']);
} }
......
...@@ -116,8 +116,6 @@ function block_admin_save($edit) { ...@@ -116,8 +116,6 @@ function block_admin_save($edit) {
$block['region'], $block['status'], $block['weight'], $block['throttle'], $module, $delta); $block['region'], $block['status'], $block['weight'], $block['throttle'], $module, $delta);
} }
} }
return t('The block settings have been updated.');
} }
/** /**
...@@ -300,7 +298,7 @@ function block_box_add() { ...@@ -300,7 +298,7 @@ function block_box_add() {
switch ($op) { switch ($op) {
case t('Save block'): case t('Save block'):
if (block_box_save($edit)) { if (block_box_save($edit)) {
drupal_set_message(t('The new block has been added.')); drupal_set_message(t('The block has been created.'));
drupal_goto('admin/block'); drupal_goto('admin/block');
} }
// deliberate no break // deliberate no break
...@@ -323,7 +321,7 @@ function block_box_delete($bid = 0) { ...@@ -323,7 +321,7 @@ function block_box_delete($bid = 0) {
if ($_POST['edit']['confirm']) { if ($_POST['edit']['confirm']) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $bid); db_query('DELETE FROM {boxes} WHERE bid = %d', $bid);
drupal_set_message(t('The block %name has been deleted.', array('%name' => theme('placeholder', $info)))); drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $info))));
cache_clear_all(); cache_clear_all();
drupal_goto('admin/block'); drupal_goto('admin/block');
} }
...@@ -373,7 +371,8 @@ function block_admin() { ...@@ -373,7 +371,8 @@ function block_admin() {
$op = $_POST['op']; $op = $_POST['op'];
if ($op == t('Save blocks')) { if ($op == t('Save blocks')) {
drupal_set_message(block_admin_save($edit)); block_admin_save($edit);
drupal_set_message(t('The blocks have been saved.'));
cache_clear_all(); cache_clear_all();
drupal_goto($_GET['q']); drupal_goto($_GET['q']);
} }
......
...@@ -248,19 +248,19 @@ function book_outline() { ...@@ -248,19 +248,19 @@ function book_outline() {
switch ($op) { switch ($op) {
case t('Add to book outline'): case t('Add to book outline'):
db_query('INSERT INTO {book} (nid, parent, weight) VALUES (%d, %d, %d)', $node->nid, $edit['parent'], $edit['weight']); db_query('INSERT INTO {book} (nid, parent, weight) VALUES (%d, %d, %d)', $node->nid, $edit['parent'], $edit['weight']);
drupal_set_message(t('Added the post to the book.')); drupal_set_message(t('The post has been added to the book.'));
drupal_goto("node/$node->nid"); drupal_goto("node/$node->nid");
break; break;
case t('Update book outline'): case t('Update book outline'):
db_query('UPDATE {book} SET parent = %d, weight = %d WHERE nid = %d', $edit['parent'], $edit['weight'], $node->nid); db_query('UPDATE {book} SET parent = %d, weight = %d WHERE nid = %d', $edit['parent'], $edit['weight'], $node->nid);
drupal_set_message(t('Updated the book outline.')); drupal_set_message(t('The book outline has been updated.'));
drupal_goto("node/$node->nid"); drupal_goto("node/$node->nid");
break; break;
case t('Remove from book outline'): case t('Remove from book outline'):
db_query('DELETE FROM {book} WHERE nid = %d', $node->nid); db_query('DELETE FROM {book} WHERE nid = %d', $node->nid);
drupal_set_message(t('Removed the post from the book.')); drupal_set_message(t('The post has been removed from the book.'));
drupal_goto("node/$node->nid"); drupal_goto("node/$node->nid");
break; break;
...@@ -424,7 +424,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) { ...@@ -424,7 +424,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) {
$book = db_fetch_array(db_query('SELECT * FROM {book} WHERE nid = %d', $node->nid)); $book = db_fetch_array(db_query('SELECT * FROM {book} WHERE nid = %d', $node->nid));
if ($book) { if ($book) {
if ($node->moderate && user_access('administer nodes')) { if ($node->moderate && user_access('administer nodes')) {
drupal_set_message(t("This update/post awaits moderation and won't be accessible until approved.")); drupal_set_message(t("The post has been submitted for moderation and won't be accessible until it has been approved."));
} }
foreach ($book as $key => $value) { foreach ($book as $key => $value) {
...@@ -666,8 +666,6 @@ function book_admin_edit_line($node, $depth = 0) { ...@@ -666,8 +666,6 @@ function book_admin_edit_line($node, $depth = 0) {
function book_admin_edit_book($nid, $depth = 1) { function book_admin_edit_book($nid, $depth = 1) {
$result = db_query(db_rewrite_sql('SELECT n.nid FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = %d ORDER BY b.weight, n.title'), $nid); $result = db_query(db_rewrite_sql('SELECT n.nid FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE b.parent = %d ORDER BY b.weight, n.title'), $nid);
$rows = array();
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$node = node_load(array('nid' => $node->nid)); $node = node_load(array('nid' => $node->nid));
$rows[] = book_admin_edit_line($node, $depth); $rows[] = book_admin_edit_line($node, $depth);
...@@ -716,7 +714,7 @@ function book_admin_save($nid, $edit = array()) { ...@@ -716,7 +714,7 @@ function book_admin_save($nid, $edit = array()) {
} }
} }
$message = t('Updated book %title.', array('%title' => theme('placeholder', $book->title))); $message = t('The book %title has been updated.', array('%title' => theme('placeholder', $book->title)));
watchdog('content', $message); watchdog('content', $message);
return $message; return $message;
......
...@@ -248,19 +248,19 @@ function book_outline() { ...@@ -248,19 +248,19 @@ function book_outline() {
switch ($op) { switch ($op) {
case t('Add to book outline'): case t('Add to book outline'):
db_query('INSERT INTO {book} (nid, parent, weight) VALUES (%d, %d, %d)', $node->nid, $edit['parent'], $edit['weight']); db_query('INSERT INTO {book} (nid, parent, weight) VALUES (%d, %d, %d)', $node->nid, $edit['parent'], $edit['weight']);
drupal_set_message(t('Added the post to the book.')); drupal_set_message(t('The post has been added to the book.'));
drupal_goto("node/$node->nid"); drupal_goto("node/$node->nid");
break; break;
case t('Update book outline'): case t('Update book outline'):
db_query('UPDATE {book} SET parent = %d, weight = %d WHERE nid = %d', $edit['parent'], $edit['weight'], $node->nid); db_query('UPDATE {book} SET parent = %d, weight = %d WHERE nid = %d', $edit['parent'], $edit['weight'], $node->nid);
drupal_set_message(t('Updated the book outline.')); drupal_set_message(t('The book outline has been updated.'));
drupal_goto("node/$node->nid"); drupal_goto("node/$node->nid");
break; break;
case t('Remove from book outline'): case t('Remove from book outline'):
db_query('DELETE FROM {book} WHERE nid = %d', $node->nid); db_query('DELETE FROM {book} WHERE nid = %d', $node->nid);