From 42557940a198a5a75866b0fd77644e8651170955 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 5 Jul 2006 22:00:03 +0000 Subject: [PATCH] Use wp_die(). Props filosofo. fixes #2914 git-svn-id: http://svn.automattic.com/wordpress/trunk@3985 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 28 +++++++++---------- wp-admin/admin.php | 8 +++--- wp-admin/categories.php | 4 +-- wp-admin/comment.php | 22 +++++++-------- wp-admin/import/blogger.php | 12 ++++---- wp-admin/import/greymatter.php | 4 +-- wp-admin/inline-uploading.php | 8 +++--- wp-admin/install.php | 2 +- wp-admin/link-import.php | 2 +- wp-admin/link-manager.php | 2 +- wp-admin/link.php | 10 +++---- wp-admin/menu.php | 2 +- wp-admin/moderation.php | 2 +- wp-admin/page.php | 6 ++-- wp-admin/plugin-editor.php | 4 +-- wp-admin/post.php | 6 ++-- wp-admin/profile-update.php | 2 +- wp-admin/templates.php | 6 ++-- wp-admin/theme-editor.php | 6 ++-- wp-admin/update-links.php | 4 +-- wp-admin/users.php | 10 +++---- wp-blog-header.php | 2 +- wp-includes/comment.php | 4 +-- .../classes/TinyPspellShell.class.php | 2 +- wp-login.php | 6 ++-- wp-mail.php | 2 +- wp-settings.php | 8 +++--- 27 files changed, 87 insertions(+), 87 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 67da85a21..2260e9f56 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -6,10 +6,10 @@ function write_post() { if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can('edit_pages') ) - die(__('You are not allowed to create pages on this blog.')); + wp_die(__('You are not allowed to create pages on this blog.')); } else { if ( !current_user_can('edit_posts') ) - die(__('You are not allowed to create posts or drafts on this blog.')); + wp_die(__('You are not allowed to create posts or drafts on this blog.')); } // Rename. @@ -32,10 +32,10 @@ function write_post() { if ($_POST['post_author'] != $_POST['user_ID']) { if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can('edit_others_pages') ) - die(__('You cannot create pages as this user.')); + wp_die(__('You cannot create pages as this user.')); } else { if ( !current_user_can('edit_others_posts') ) - die(__('You cannot post as this user.')); + wp_die(__('You cannot post as this user.')); } } @@ -151,10 +151,10 @@ function edit_post() { if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can('edit_page', $post_ID) ) - die(__('You are not allowed to edit this page.')); + wp_die(__('You are not allowed to edit this page.')); } else { if ( !current_user_can('edit_post', $post_ID) ) - die(__('You are not allowed to edit this post.')); + wp_die(__('You are not allowed to edit this post.')); } // Rename. @@ -176,10 +176,10 @@ function edit_post() { if ($_POST['post_author'] != $_POST['user_ID']) { if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can('edit_others_pages') ) - die(__('You cannot edit pages as this user.')); + wp_die(__('You cannot edit pages as this user.')); } else { if ( !current_user_can('edit_others_posts') ) - die(__('You cannot edit posts as this user.')); + wp_die(__('You cannot edit posts as this user.')); } } @@ -251,7 +251,7 @@ function edit_comment() { $comment_post_ID = (int) $_POST['comment_post_ID']; if (!current_user_can('edit_post', $comment_post_ID)) - die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.')); + wp_die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.')); $_POST['comment_author'] = $_POST['newcomment_author']; $_POST['comment_author_email'] = $_POST['newcomment_author_email']; @@ -530,7 +530,7 @@ function add_link() { function edit_link($link_id = '') { if (!current_user_can('manage_links')) - die(__("Cheatin' uh ?")); + wp_die(__("Cheatin' uh ?")); $_POST['link_url'] = wp_specialchars($_POST['link_url']); $_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url']; @@ -1521,13 +1521,13 @@ function validate_file_to_edit($file, $allowed_files = '') { switch ($code) { case 1 : - die(__('Sorry, can’t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.')); + wp_die(__('Sorry, can’t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.')); case 2 : - die(__('Sorry, can’t call files with their real path.')); + wp_die(__('Sorry, can’t call files with their real path.')); case 3 : - die(__('Sorry, that file cannot be edited.')); + wp_die(__('Sorry, that file cannot be edited.')); } } @@ -1844,7 +1844,7 @@ function wp_handle_upload(&$file, $overrides = false) { // Move the file to the uploads dir $new_file = $uploads['path'] . "/$filename"; if ( false === @ move_uploaded_file($file['tmp_name'], $new_file) ) - die(printf(__('The uploaded file could not be moved to %s.'), $file['path'])); + wp_die(printf(__('The uploaded file could not be moved to %s.'), $file['path'])); // Set correct file permissions $stat = stat(dirname($new_file)); diff --git a/wp-admin/admin.php b/wp-admin/admin.php index b5ea5af0c..9b6de5813 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -45,11 +45,11 @@ if (isset($_GET['page'])) { do_action($page_hook); } else { if ( validate_file($plugin_page) ) { - die(__('Invalid plugin page')); + wp_die(__('Invalid plugin page')); } if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page")) - die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); + wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); if (! isset($_GET['noheader'])) require_once(ABSPATH . '/wp-admin/admin-header.php'); @@ -65,11 +65,11 @@ if (isset($_GET['page'])) { $importer = $_GET['import']; if ( validate_file($importer) ) { - die(__('Invalid importer.')); + wp_die(__('Invalid importer.')); } if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) - die(__('Cannot load importer.')); + wp_die(__('Cannot load importer.')); include(ABSPATH . "wp-admin/import/$importer.php"); diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 7fa403338..63313d875 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -31,10 +31,10 @@ case 'delete': // Don't delete the default cats. if ( $cat_ID == get_option('default_category') ) - die(sprintf(__("Can't delete the %s category: this is the default one"), $cat_name)); + wp_die(sprintf(__("Can't delete the %s category: this is the default one"), $cat_name)); if ( $cat_ID == get_option('default_link_category') ) - die(sprintf(__("Can't delete the %s category: this is the default one for bookmarks"), $cat_name)); + wp_die(sprintf(__("Can't delete the %s category: this is the default one for bookmarks"), $cat_name)); wp_delete_category($cat_ID); diff --git a/wp-admin/comment.php b/wp-admin/comment.php index cca79dc2e..e09f3c05f 100644 --- a/wp-admin/comment.php +++ b/wp-admin/comment.php @@ -19,10 +19,10 @@ case 'editcomment': $comment = (int) $_GET['comment']; if ( ! $comment = get_comment($comment) ) - die(sprintf(__('Oops, no comment with this ID. Go back!'), 'javascript:history.go(-1)')); + wp_die(sprintf(__('Oops, no comment with this ID. Go back!'), 'javascript:history.go(-1)')); if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die( __('You are not allowed to edit comments on this post.') ); + wp_die( __('You are not allowed to edit comments on this post.') ); $comment = get_comment_to_edit($comment); @@ -42,10 +42,10 @@ case 'mailapprovecomment': $nonce_action .= $comment; if ( ! $comment = get_comment($comment) ) - die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit.php')); + wp_die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit.php')); if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die( 'confirmdeletecomment' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); + wp_die( 'confirmdeletecomment' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); echo "
\n"; if ( 'spam' == $_GET['delete_type'] ) @@ -90,13 +90,13 @@ case 'deletecomment': } $postdata = get_post($p) or - die(sprintf(__('Oops, no post with this ID. Go back!'), 'edit.php')); + wp_die(sprintf(__('Oops, no post with this ID. Go back!'), 'edit.php')); if ( ! $comment = get_comment($comment) ) - die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit-comments.php')); + wp_die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit-comments.php')); if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die( __('You are not allowed to edit comments on this post.') ); + wp_die( __('You are not allowed to edit comments on this post.') ); if ( 'spam' == $_REQUEST['delete_type'] ) wp_set_comment_status($comment->comment_ID, 'spam'); @@ -123,10 +123,10 @@ case 'unapprovecomment': } if ( ! $comment = get_comment($comment) ) - die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit.php')); + wp_die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit.php')); if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); + wp_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); wp_set_comment_status($comment->comment_ID, "hold"); @@ -150,10 +150,10 @@ case 'approvecomment': } if ( ! $comment = get_comment($comment) ) - die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit.php')); + wp_die(sprintf(__('Oops, no comment with this ID. Go back!'), 'edit.php')); if ( !current_user_can('edit_post', $comment->comment_post_ID) ) - die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); + wp_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); wp_set_comment_status($comment->comment_ID, "approve"); if (get_settings("comments_notify") == true) { diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index 1e467ad4b..fa16c630e 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -241,7 +241,7 @@ class Blogger_Import { $blogsary = array(); preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)#U', $response['body'], $blogsary); if ( ! count( $blogsary[1] < 1 ) ) - die(__('No blogs found for this user.')); + wp_die(__('No blogs found for this user.')); $this->import['blogs'] = array(); $template = '


'.__('Are you looking for %title%? It is temporarily out of service. Please try again in a few minutes. Meanwhile, discover a better blogging tool.').'

<$BlogArchiveName$>
<$BlogItemDateTime$>|W|P|<$BlogItemAuthorNickname$>|W|P|<$BlogItemBody$>|W|P|<$BlogItemNumber$>|W|P|<$BlogItemTitle$>|W|P|<$BlogItemAuthorEmail$><$BlogCommentDateTime$>|W|P|<$BlogCommentAuthor$>|W|P|<$BlogCommentBody$>'; foreach ( $blogsary[1] as $key => $id ) { @@ -306,7 +306,7 @@ class Blogger_Import { if ( $_POST['publishMode'] > 0 ) { $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode=0", $headers); if ( $response['code'] >= 400 ) - die('

'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'

' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '
'); + wp_die('

'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'

' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '
'); $this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $optary['modify']['subdomain'] . '.blogspot.com/'; sleep(2); } else { @@ -321,7 +321,7 @@ class Blogger_Import { } $response = $this->post_blogger($posturl, $headers, $paramary); if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') ) - die('

'.__('Error on form submission. Retry or reset the importer.').'

' . addslashes(print_r($response, 1))); + wp_die('

'.__('Error on form submission. Retry or reset the importer.').'

' . addslashes(print_r($response, 1))); } $output .= "

$blog_opt

\n"; } elseif ( is_array($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup']) ) { @@ -364,7 +364,7 @@ class Blogger_Import { function get_archive_urls() { $bloghtml = $this->get_blogger($this->import['blogs'][$_GET['blog']]['url']); if (! strstr($bloghtml['body'], 'import['blogs'][$_GET['blog']]['archives'][$archive] = false; @@ -546,7 +546,7 @@ class Blogger_Import { $response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers); sleep(2); if ( $response['code'] >= 400 ) - die('

Error restoring publishMode.

Please tell the devs.

' . addslashes(print_r($response, 1)) ); + wp_die('

Error restoring publishMode.

Please tell the devs.

' . addslashes(print_r($response, 1)) ); } } if ( $optary['backup'] != $optary['modify'] ) { @@ -615,7 +615,7 @@ class Blogger_Import { $step = 0; } //echo "Step $step."; -//die('
'.print_r($this->import,1).''.print_r($this->import,1).'do_login();
diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php
index f2b4e2de9..8f7b34a4f 100644
--- a/wp-admin/import/greymatter.php
+++ b/wp-admin/import/greymatter.php
@@ -87,10 +87,10 @@ class GM_Import {
 		}
 
 		if (!chdir($archivespath))
-			die("Wrong path, $archivespath\ndoesn't exist\non the server");
+			wp_die("Wrong path, $archivespath\ndoesn't exist\non the server");
 
 		if (!chdir($gmpath))
-			die("Wrong path, $gmpath\ndoesn't exist\non the server");
+			wp_die("Wrong path, $gmpath\ndoesn't exist\non the server");
 			
 		$this->header();
 ?>
diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php
index 6dc75068f..320948204 100644
--- a/wp-admin/inline-uploading.php
+++ b/wp-admin/inline-uploading.php
@@ -5,7 +5,7 @@ require_once('admin.php');
 header('Content-Type: text/html; charset=' . get_option('blog_charset'));
 
 if (!current_user_can('upload_files'))
-	die(__('You do not have permission to upload files.'));
+	wp_die(__('You do not have permission to upload files.'));
 
 wp_reset_vars(array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment'));
 
@@ -22,7 +22,7 @@ case 'delete':
 check_admin_referer('inlineuploading');
 
 if ( !current_user_can('edit_post', (int) $attachment) )
-	die(__('You are not allowed to delete this attachment.').' ".__('Go back').'');
+	wp_die(__('You are not allowed to delete this attachment.').' ".__('Go back').'');
 
 wp_delete_attachment($attachment);
 
@@ -38,7 +38,7 @@ $overrides = array('action'=>'save');
 $file = wp_handle_upload($_FILES['image'], $overrides);
 
 if ( isset($file['error']) )
-	die($file['error'] . '
'.__('Back to Image Uploading').''); + wp_die($file['error'] . '
'.__('Back to Image Uploading').''); $url = $file['url']; $type = $file['type']; @@ -276,7 +276,7 @@ $images_width = $uwidth_sum + ( count($images) * 6 ) + 35; break; default: -die(__('This script was not meant to be called directly.')); +wp_die(__('This script was not meant to be called directly.')); } ?> diff --git a/wp-admin/install.php b/wp-admin/install.php index 9c2ade499..58a7bec18 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -74,7 +74,7 @@ header( 'Content-Type: text/html; charset=utf-8' );

WordPress

'.__('Already Installed').'

'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'

'); +if ( is_blog_installed() ) wp_die('

'.__('Already Installed').'

'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'

'); switch($step) { diff --git a/wp-admin/link-import.php b/wp-admin/link-import.php index 352b6e7c9..98bdc87b1 100644 --- a/wp-admin/link-import.php +++ b/wp-admin/link-import.php @@ -89,7 +89,7 @@ foreach ($categories as $category) { $file = wp_handle_upload($_FILES['userfile'], $overrides); if ( isset($file['error']) ) - die($file['error']); + wp_die($file['error']); $url = $file['url']; $opml_url = $file['file']; diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index 4ece3e683..57cabaf7e 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -22,7 +22,7 @@ $title = __('Manage Bookmarks'); include_once ("./admin-header.php"); if (!current_user_can('manage_links')) - die(__("You do not have sufficient permissions to edit the bookmarks for this blog.")); + wp_die(__("You do not have sufficient permissions to edit the bookmarks for this blog.")); switch ($order_by) { case 'order_id' : diff --git a/wp-admin/link.php b/wp-admin/link.php index a62c01c67..00a281b4c 100644 --- a/wp-admin/link.php +++ b/wp-admin/link.php @@ -18,7 +18,7 @@ switch ($action) { // check the current user's level first. if (!current_user_can('manage_links')) - die(__("Cheatin' uh ?")); + wp_die(__("Cheatin' uh ?")); //for each link id (in $linkcheck[]) change category to selected value if (count($linkcheck) == 0) { @@ -42,7 +42,7 @@ switch ($action) { // check the current user's level first. if (!current_user_can('manage_links')) - die(__("Cheatin' uh ?")); + wp_die(__("Cheatin' uh ?")); //for each link id (in $linkcheck[]) change category to selected value if (count($linkcheck) == 0) { @@ -79,7 +79,7 @@ switch ($action) { check_admin_referer('delete-bookmark_' . $link_id); if (!current_user_can('manage_links')) - die(__("Cheatin' uh ?")); + wp_die(__("Cheatin' uh ?")); wp_delete_link($link_id); @@ -95,12 +95,12 @@ switch ($action) { $title = __('Edit Bookmark'); include_once ('admin-header.php'); if (!current_user_can('manage_links')) - die(__('You do not have sufficient permissions to edit the bookmarks for this blog.')); + wp_die(__('You do not have sufficient permissions to edit the bookmarks for this blog.')); $link_id = (int) $_GET['link_id']; if (!$link = get_link_to_edit($link_id)) - die(__('Link not found.')); + wp_die(__('Link not found.')); include ('edit-link-form.php'); break; diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 514d485bd..4067478ef 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -118,7 +118,7 @@ foreach ( $menu as $id => $data ) { ksort($menu); // make it all pretty if (! user_can_access_admin_page()) { - die( __('You do not have sufficient permissions to access this page.') ); + wp_die( __('You do not have sufficient permissions to access this page.') ); } ?> diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php index ecac278a9..2a32435ff 100644 --- a/wp-admin/moderation.php +++ b/wp-admin/moderation.php @@ -21,7 +21,7 @@ case 'update': check_admin_referer('moderate-comments'); if ( ! current_user_can('moderate_comments') ) - die('

'.__('Your level is not high enough to moderate comments.').'

'); + wp_die('

'.__('Your level is not high enough to moderate comments.').'

'); $item_ignored = 0; $item_deleted = 0; diff --git a/wp-admin/page.php b/wp-admin/page.php index 371b992e4..4dbe2cf9e 100644 --- a/wp-admin/page.php +++ b/wp-admin/page.php @@ -110,14 +110,14 @@ case 'delete': $page = & get_post($page_id); if ( !current_user_can('delete_page', $page_id) ) - die( __('You are not allowed to delete this page.') ); + wp_die( __('You are not allowed to delete this page.') ); if ( $page->post_type == 'attachment' ) { if ( ! wp_delete_attachment($page_id) ) - die( __('Error in deleting...') ); + wp_die( __('Error in deleting...') ); } else { if ( !wp_delete_post($page_id) ) - die( __('Error in deleting...') ); + wp_die( __('Error in deleting...') ); } $sendback = wp_get_referer(); diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php index 56be4021b..840b53bfc 100644 --- a/wp-admin/plugin-editor.php +++ b/wp-admin/plugin-editor.php @@ -23,7 +23,7 @@ case 'update': check_admin_referer('edit-plugin_' . $file); if ( !current_user_can('edit_plugins') ) - die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); + wp_die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); $newcontent = stripslashes($_POST['newcontent']); if (is_writeable($real_file)) { @@ -43,7 +43,7 @@ default: require_once('admin-header.php'); if ( !current_user_can('edit_plugins') ) - die('

'.__('You do not have sufficient permissions to edit plugins for this blog.').'

'); + wp_die('

'.__('You do not have sufficient permissions to edit plugins for this blog.').'

'); update_recently_edited("wp-content/plugins/$file"); diff --git a/wp-admin/post.php b/wp-admin/post.php index 93b5681e3..4e95cc377 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -117,14 +117,14 @@ case 'delete': $post = & get_post($post_id); if ( !current_user_can('delete_post', $post_id) ) - die( __('You are not allowed to delete this post.') ); + wp_die( __('You are not allowed to delete this post.') ); if ( $post->post_type == 'attachment' ) { if ( ! wp_delete_attachment($post_id) ) - die( __('Error in deleting...') ); + wp_die( __('Error in deleting...') ); } else { if ( !wp_delete_post($post_id) ) - die( __('Error in deleting...') ); + wp_die( __('Error in deleting...') ); } $sendback = wp_get_referer(); diff --git a/wp-admin/profile-update.php b/wp-admin/profile-update.php index 4d6595b68..2c6028f55 100644 --- a/wp-admin/profile-update.php +++ b/wp-admin/profile-update.php @@ -7,7 +7,7 @@ require_once('admin.php'); check_admin_referer('update-profile_' . $user_ID); if ( !$_POST ) - die( __('No post?') ); + wp_die( __('No post?') ); $errors = edit_user($user_ID); diff --git a/wp-admin/templates.php b/wp-admin/templates.php index de3c7e30e..ebf93336e 100644 --- a/wp-admin/templates.php +++ b/wp-admin/templates.php @@ -25,7 +25,7 @@ case 'update': check_admin_referer('edit-file_' . $file); if ( ! current_user_can('edit_files') ) - die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); + wp_die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); $newcontent = stripslashes($_POST['newcontent']); if (is_writeable($real_file)) { @@ -50,10 +50,10 @@ default: require_once('./admin-header.php'); if ( ! current_user_can('edit_files') ) - die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); + wp_die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); if ( strstr( $file, 'wp-config.php' ) ) - die('

'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'

'); + wp_die('

'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'

'); update_recently_edited($file); diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index 6bbc9dbbe..cda435ab5 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -16,7 +16,7 @@ if (empty($theme)) { if ( ! isset($themes[$theme]) ) - die(__('The requested theme does not exist.')); + wp_die(__('The requested theme does not exist.')); $allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']); @@ -36,7 +36,7 @@ case 'update': check_admin_referer('edit-theme_' . $file . $theme); if ( !current_user_can('edit_themes') ) - die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); + wp_die('

'.__('You do not have sufficient permissions to edit templates for this blog.').'

'); $newcontent = stripslashes($_POST['newcontent']); $theme = urlencode($theme); @@ -57,7 +57,7 @@ default: require_once('admin-header.php'); if ( !current_user_can('edit_themes') ) - die('

'.__('You do not have sufficient permissions to edit themes for this blog.').'

'); + wp_die('

'.__('You do not have sufficient permissions to edit themes for this blog.').'

'); update_recently_edited($file); diff --git a/wp-admin/update-links.php b/wp-admin/update-links.php index eff00db09..e2aa540d8 100644 --- a/wp-admin/update-links.php +++ b/wp-admin/update-links.php @@ -3,12 +3,12 @@ require_once( dirname( dirname(__FILE__) ) . '/wp-config.php'); require_once( ABSPATH . 'wp-includes/class-snoopy.php'); if ( !get_option('use_linksupdate') ) - die(__('Feature disabled.')); + wp_die(__('Feature disabled.')); $link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links"); if ( !$link_uris ) - die('No links'); + wp_die('No links'); $link_uris = urlencode( join( $link_uris, "\n" ) ); diff --git a/wp-admin/users.php b/wp-admin/users.php index c647ac071..1e1157a15 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -128,13 +128,13 @@ case 'promote': } if ( !current_user_can('edit_users') ) - die(__('You can’t edit users.')); + wp_die(__('You can’t edit users.')); $userids = $_POST['users']; $update = 'promote'; foreach($userids as $id) { if ( ! current_user_can('edit_user', $id) ) - die(__('You can’t edit that user.')); + wp_die(__('You can’t edit that user.')); // The new role of the current user must also have edit_users caps if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) { $update = 'err_admin_role'; @@ -158,7 +158,7 @@ case 'dodelete': } if ( !current_user_can('delete_users') ) - die(__('You can’t delete users.')); + wp_die(__('You can’t delete users.')); $userids = $_POST['users']; $update = 'del'; @@ -166,7 +166,7 @@ case 'dodelete': foreach ( (array) $userids as $id) { if ( ! current_user_can('delete_user', $id) ) - die(__('You can’t delete that user.')); + wp_die(__('You can’t delete that user.')); if($id == $current_user->id) { $update = 'err_admin_del'; @@ -252,7 +252,7 @@ case 'adduser': check_admin_referer('add-user'); if ( ! current_user_can('create_users') ) - die(__('You can’t create users.')); + wp_die(__('You can’t create users.')); $user_id = add_user(); $update = 'add'; diff --git a/wp-blog-header.php b/wp-blog-header.php index c087324fc..bf5ea9f69 100644 --- a/wp-blog-header.php +++ b/wp-blog-header.php @@ -18,4 +18,4 @@ require_once(ABSPATH . WPINC . '/template-loader.php'); endif; -?> \ No newline at end of file +?> diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 404a8f938..170f45500 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -181,7 +181,7 @@ function wp_allow_comment($commentdata) { $dupe .= "OR comment_author_email = '$comment_author_email' "; $dupe .= ") AND comment_content = '$comment_content' LIMIT 1"; if ( $wpdb->get_var($dupe) ) - die( __('Duplicate comment detected; it looks as though you\'ve already said that!') ); + wp_die( __('Duplicate comment detected; it looks as though you\'ve already said that!') ); // Simple flood-protection if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$comment_author_IP' OR comment_author_email = '$comment_author_email' ORDER BY comment_date DESC LIMIT 1") ) { @@ -189,7 +189,7 @@ function wp_allow_comment($commentdata) { $time_newcomment = mysql2date('U', $comment_date_gmt); if ( ($time_newcomment - $time_lastcomment) < 15 ) { do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment); - die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') ); + wp_die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') ); } } diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php index 41c0948b0..81e3f152e 100755 --- a/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php +++ b/wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php @@ -71,7 +71,7 @@ class TinyPspellShell { fwrite($fh, "^$word\n"); fclose($fh); } else - die("Error opening tmp file."); + wp_die("Error opening tmp file."); $data = shell_exec($this->cmd); @unlink($this->tmpfile); diff --git a/wp-login.php b/wp-login.php index eae66b1c1..7585d7df5 100644 --- a/wp-login.php +++ b/wp-login.php @@ -98,7 +98,7 @@ case 'retrievepassword': $user_email = $user_data->user_email; if (!$user_email || $user_email != $_POST['email']) - die(sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? Try again.'), 'wp-login.php?action=lostpassword')); + wp_die(sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? Try again.'), 'wp-login.php?action=lostpassword')); do_action('retreive_password', $user_login); // Misspelled and deprecated. do_action('retrieve_password', $user_login); @@ -132,10 +132,10 @@ case 'rp' : // Generate something random for a password... md5'ing current time with a rand salt $key = preg_replace('/a-z0-9/i', '', $_GET['key']); if ( empty($key) ) - die( __('Sorry, that key does not appear to be valid.') ); + wp_die( __('Sorry, that key does not appear to be valid.') ); $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'"); if ( !$user ) - die( __('Sorry, that key does not appear to be valid.') ); + wp_die( __('Sorry, that key does not appear to be valid.') ); do_action('password_reset'); diff --git a/wp-mail.php b/wp-mail.php index 114ea1110..91c448e05 100644 --- a/wp-mail.php +++ b/wp-mail.php @@ -17,7 +17,7 @@ if (!$pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_por endif; $count = $pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass')); -if (0 == $count) die(__('There doesn’t seem to be any new mail.')); +if (0 == $count) wp_die(__('There doesn’t seem to be any new mail.')); for ($i=1; $i <= $count; $i++) : diff --git a/wp-settings.php b/wp-settings.php index 1716c5e40..584bfa4c6 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -5,7 +5,7 @@ function unregister_GLOBALS() { return; if ( isset($_REQUEST['GLOBALS']) ) - die('GLOBALS overwrite attempt detected'); + wp_die('GLOBALS overwrite attempt detected'); // Variables that shouldn't be unset $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); @@ -47,10 +47,10 @@ if ( empty($PHP_SELF) ) $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); if ( !(phpversion() >= '4.1') ) - die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' ); + wp_die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' ); if ( !extension_loaded('mysql') ) - die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' ); + wp_die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' ); function timer_start() { global $timestart; @@ -111,7 +111,7 @@ if ( !is_blog_installed() && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !d $link = 'install.php'; else $link = 'wp-admin/install.php'; - die(sprintf(__("It doesn't look like you've installed WP yet. Try running install.php."), $link)); + wp_die(sprintf(__("It doesn't look like you've installed WP yet. Try running install.php."), $link)); } require (ABSPATH . WPINC . '/formatting.php');