Use wp_die(). Props filosofo. fixes #2914

git-svn-id: http://svn.automattic.com/wordpress/trunk@3985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-07-05 22:00:03 +00:00
parent 550ede8d60
commit 42557940a1
27 changed files with 87 additions and 87 deletions

View File

@ -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));

View File

@ -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");

View File

@ -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 <strong>%s</strong> category: this is the default one"), $cat_name));
wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
if ( $cat_ID == get_option('default_link_category') )
die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for bookmarks"), $cat_name));
wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for bookmarks"), $cat_name));
wp_delete_category($cat_ID);

View File

@ -19,10 +19,10 @@ case 'editcomment':
$comment = (int) $_GET['comment'];
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), '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. <a href="%s">Go back</a>!'), 'edit.php'));
wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), '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 "<div class='wrap'>\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. <a href="%s">Go back</a>!'), 'edit.php'));
wp_die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
if ( ! $comment = get_comment($comment) )
die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php'));
wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), '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. <a href="%s">Go back</a>!'), 'edit.php'));
wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), '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. <a href="%s">Go back</a>!'), 'edit.php'));
wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), '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) {

View File

@ -241,7 +241,7 @@ class Blogger_Import {
$blogsary = array();
preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)</a>#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 = '<MainPage><br /><br /><br /><p>'.__('Are you looking for %title%? It is temporarily out of service. Please try again in a few minutes. Meanwhile, discover <a href="http://wordpress.org/">a better blogging tool</a>.').'</p><BloggerArchives><a class="archive" href="<$BlogArchiveURL$>"><$BlogArchiveName$></a><br /></BloggerArchives></MainPage><ArchivePage><Blogger><wordpresspost><$BlogItemDateTime$>|W|P|<$BlogItemAuthorNickname$>|W|P|<$BlogItemBody$>|W|P|<$BlogItemNumber$>|W|P|<$BlogItemTitle$>|W|P|<$BlogItemAuthorEmail$><BlogItemCommentsEnabled><BlogItemComments><wordpresscomment><$BlogCommentDateTime$>|W|P|<$BlogCommentAuthor$>|W|P|<$BlogCommentBody$></BlogItemComments></BlogItemCommentsEnabled></Blogger></ArchivePage>';
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('<h2>'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'</h2><pre>' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '</pre>');
wp_die('<h2>'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'</h2><pre>' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '</pre>');
$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('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
wp_die('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
}
$output .= "<del><p>$blog_opt</p></del>\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'], '<a class="archive"') )
die(__('Your Blogger blog did not take the new template or did not respond.'));
wp_die(__('Your Blogger blog did not take the new template or did not respond.'));
preg_match_all('#<a class="archive" href="([^"]*)"#', $bloghtml['body'], $archives);
foreach ($archives[1] as $archive) {
$this->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('<h1>Error restoring publishMode.</h1><p>Please tell the devs.</p>' . addslashes(print_r($response, 1)) );
wp_die('<h1>Error restoring publishMode.</h1><p>Please tell the devs.</p>' . addslashes(print_r($response, 1)) );
}
}
if ( $optary['backup'] != $optary['modify'] ) {
@ -615,7 +615,7 @@ class Blogger_Import {
$step = 0;
}
//echo "Step $step.";
//die('<pre>'.print_r($this->import,1).'</pre');
//wp_die('<pre>'.print_r($this->import,1).'</pre');
switch ($step) {
case 0 :
$this->do_login();

View File

@ -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();
?>

View File

@ -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.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
wp_die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
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'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>');
wp_die($file['error'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>');
$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.'));
}
?>

View File

@ -74,7 +74,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
<?php
// Let's check to make sure WP isn't already installed.
if ( is_blog_installed() ) die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
if ( is_blog_installed() ) wp_die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
switch($step) {

View File

@ -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'];

View File

@ -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' :

View File

@ -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;

View File

@ -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.') );
}
?>

View File

@ -21,7 +21,7 @@ case 'update':
check_admin_referer('moderate-comments');
if ( ! current_user_can('moderate_comments') )
die('<p>'.__('Your level is not high enough to moderate comments.').'</p>');
wp_die('<p>'.__('Your level is not high enough to moderate comments.').'</p>');
$item_ignored = 0;
$item_deleted = 0;

View File

@ -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();

View File

@ -23,7 +23,7 @@ case 'update':
check_admin_referer('edit-plugin_' . $file);
if ( !current_user_can('edit_plugins') )
die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
$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('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
update_recently_edited("wp-content/plugins/$file");

View File

@ -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();

View File

@ -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);

View File

@ -25,7 +25,7 @@ case 'update':
check_admin_referer('edit-file_' . $file);
if ( ! current_user_can('edit_files') )
die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
$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('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
if ( strstr( $file, 'wp-config.php' ) )
die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
wp_die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
update_recently_edited($file);

View File

@ -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('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
$newcontent = stripslashes($_POST['newcontent']);
$theme = urlencode($theme);
@ -57,7 +57,7 @@ default:
require_once('admin-header.php');
if ( !current_user_can('edit_themes') )
die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
update_recently_edited($file);

View File

@ -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" ) );

View File

@ -128,13 +128,13 @@ case 'promote':
}
if ( !current_user_can('edit_users') )
die(__('You can&#8217;t edit users.'));
wp_die(__('You can&#8217;t edit users.'));
$userids = $_POST['users'];
$update = 'promote';
foreach($userids as $id) {
if ( ! current_user_can('edit_user', $id) )
die(__('You can&#8217;t edit that user.'));
wp_die(__('You can&#8217;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&#8217;t delete users.'));
wp_die(__('You can&#8217;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&#8217;t delete that user.'));
wp_die(__('You can&#8217;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&#8217;t create users.'));
wp_die(__('You can&#8217;t create users.'));
$user_id = add_user();
$update = 'add';

View File

@ -18,4 +18,4 @@ require_once(ABSPATH . WPINC . '/template-loader.php');
endif;
?>
?>

View File

@ -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.') );
}
}

View File

@ -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);

View File

@ -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? <a href="%s">Try again</a>.'), '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? <a href="%s">Try again</a>.'), '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');

View File

@ -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&#8217;t seem to be any new mail.'));
if (0 == $count) wp_die(__('There doesn&#8217;t seem to be any new mail.'));
for ($i=1; $i <= $count; $i++) :

View File

@ -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 <a href='%s'>install.php</a>."), $link));
wp_die(sprintf(__("It doesn't look like you've installed WP yet. Try running <a href='%s'>install.php</a>."), $link));
}
require (ABSPATH . WPINC . '/formatting.php');