mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
wp_die() improvements from Sewar. fixes #2902
git-svn-id: http://svn.automattic.com/wordpress/trunk@4006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b2d5509491
commit
4e5380a24a
@ -3,7 +3,7 @@ $mode = 'bookmarklet';
|
|||||||
require_once('admin.php');
|
require_once('admin.php');
|
||||||
|
|
||||||
if ( ! current_user_can('edit_posts') )
|
if ( ! current_user_can('edit_posts') )
|
||||||
die ("Cheatin' uh?");
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
if ('b' == $a):
|
if ('b' == $a):
|
||||||
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
@ -13,7 +13,7 @@ case 'addcat':
|
|||||||
check_admin_referer('add-category');
|
check_admin_referer('add-category');
|
||||||
|
|
||||||
if ( !current_user_can('manage_categories') )
|
if ( !current_user_can('manage_categories') )
|
||||||
die (__('Cheatin’ uh?'));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
wp_insert_category($_POST);
|
wp_insert_category($_POST);
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ case 'delete':
|
|||||||
check_admin_referer('delete-category_' . $cat_ID);
|
check_admin_referer('delete-category_' . $cat_ID);
|
||||||
|
|
||||||
if ( !current_user_can('manage_categories') )
|
if ( !current_user_can('manage_categories') )
|
||||||
die (__('Cheatin’ uh?'));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
$cat_name = get_catname($cat_ID);
|
$cat_name = get_catname($cat_ID);
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ case 'editedcat':
|
|||||||
check_admin_referer('update-category_' . $cat_ID);
|
check_admin_referer('update-category_' . $cat_ID);
|
||||||
|
|
||||||
if ( !current_user_can('manage_categories') )
|
if ( !current_user_can('manage_categories') )
|
||||||
die (__('Cheatin’ uh?'));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
wp_update_category($_POST);
|
wp_update_category($_POST);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
|
|||||||
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
||||||
<?php
|
<?php
|
||||||
// Let's check to make sure WP isn't already installed.
|
// Let's check to make sure WP isn't already installed.
|
||||||
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>');
|
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>');
|
||||||
|
|
||||||
switch($step) {
|
switch($step) {
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ switch ($step) {
|
|||||||
{
|
{
|
||||||
include_once('admin-header.php');
|
include_once('admin-header.php');
|
||||||
if ( !current_user_can('manage_links') )
|
if ( !current_user_can('manage_links') )
|
||||||
die (__("Cheatin’ uh?"));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
$opmltype = 'blogrolling'; // default.
|
$opmltype = 'blogrolling'; // default.
|
||||||
?>
|
?>
|
||||||
@ -68,7 +68,7 @@ foreach ($categories as $category) {
|
|||||||
|
|
||||||
include_once('admin-header.php');
|
include_once('admin-header.php');
|
||||||
if ( !current_user_can('manage_links') )
|
if ( !current_user_can('manage_links') )
|
||||||
die (__("Cheatin' uh ?"));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ switch ($action) {
|
|||||||
|
|
||||||
// check the current user's level first.
|
// check the current user's level first.
|
||||||
if (!current_user_can('manage_links'))
|
if (!current_user_can('manage_links'))
|
||||||
wp_die(__("Cheatin' uh ?"));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
//for each link id (in $linkcheck[]) change category to selected value
|
//for each link id (in $linkcheck[]) change category to selected value
|
||||||
if (count($linkcheck) == 0) {
|
if (count($linkcheck) == 0) {
|
||||||
@ -42,7 +42,7 @@ switch ($action) {
|
|||||||
|
|
||||||
// check the current user's level first.
|
// check the current user's level first.
|
||||||
if (!current_user_can('manage_links'))
|
if (!current_user_can('manage_links'))
|
||||||
wp_die(__("Cheatin' uh ?"));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
//for each link id (in $linkcheck[]) change category to selected value
|
//for each link id (in $linkcheck[]) change category to selected value
|
||||||
if (count($linkcheck) == 0) {
|
if (count($linkcheck) == 0) {
|
||||||
@ -79,7 +79,7 @@ switch ($action) {
|
|||||||
check_admin_referer('delete-bookmark_' . $link_id);
|
check_admin_referer('delete-bookmark_' . $link_id);
|
||||||
|
|
||||||
if (!current_user_can('manage_links'))
|
if (!current_user_can('manage_links'))
|
||||||
wp_die(__("Cheatin' uh ?"));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
wp_delete_link($link_id);
|
wp_delete_link($link_id);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ $parent_file = 'options-general.php';
|
|||||||
wp_reset_vars(array('action'));
|
wp_reset_vars(array('action'));
|
||||||
|
|
||||||
if ( !current_user_can('manage_options') )
|
if ( !current_user_can('manage_options') )
|
||||||
die ( __('Cheatin’ uh?') );
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
switch($action) {
|
switch($action) {
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ $mode = 'sidebar';
|
|||||||
require_once('admin.php');
|
require_once('admin.php');
|
||||||
|
|
||||||
if ( ! current_user_can('edit_posts') )
|
if ( ! current_user_can('edit_posts') )
|
||||||
die ("Cheatin' uh ?");
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
if ('b' == $_GET['a']) {
|
if ('b' == $_GET['a']) {
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ if ( !get_option('use_linksupdate') )
|
|||||||
$link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
|
$link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
|
||||||
|
|
||||||
if ( !$link_uris )
|
if ( !$link_uris )
|
||||||
wp_die('No links');
|
wp_die(__('No links'));
|
||||||
|
|
||||||
$link_uris = urlencode( join( $link_uris, "\n" ) );
|
$link_uris = urlencode( join( $link_uris, "\n" ) );
|
||||||
|
|
||||||
|
@ -1117,65 +1117,58 @@ function wp_nonce_ays($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function wp_die($message) {
|
function wp_die($message) {
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
if ( !$wpdb->show_errors )
|
|
||||||
return false;
|
|
||||||
header('Content-Type: text/html; charset=utf-8');
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
|
||||||
$output = <<<HEAD
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<title>WordPress › Error</title>
|
<title>WordPress › <?php _e('Error'); ?></title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<style media="screen" type="text/css">
|
<style media="screen" type="text/css">
|
||||||
<!--
|
<!--
|
||||||
html {
|
html {
|
||||||
background: #eee;
|
background: #eee;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: #000;
|
color: #000;
|
||||||
font-family: Georgia, "Times New Roman", Times, serif;
|
font-family: Georgia, "Times New Roman", Times, serif;
|
||||||
margin-left: 25%;
|
margin-left: 25%;
|
||||||
margin-right: 25%;
|
margin-right: 25%;
|
||||||
padding: .2em 2em;
|
padding: .2em 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
color: #006;
|
color: #006;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p, li, dt {
|
p, li, dt {
|
||||||
line-height: 140%;
|
line-height: 140%;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul, ol {
|
ul, ol {
|
||||||
padding: 5px 5px 5px 20px;
|
padding: 5px 5px 5px 20px;
|
||||||
}
|
}
|
||||||
#logo {
|
#logo {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
-->
|
-->
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="logo"><img alt="WordPress" src="../wp-admin/images/wordpress-logo.png" /></h1>
|
<h1 id="logo"><img alt="WordPress" src="<?php echo get_settings('siteurl'); ?>/wp-admin/images/wordpress-logo.png" /></h1>
|
||||||
<p>$message</p>
|
<p><?php echo $message; ?></p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
HEAD;
|
<?php
|
||||||
|
|
||||||
$output = apply_filters('wp_die', $output, $message);
|
|
||||||
echo $output;
|
|
||||||
|
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -303,59 +303,10 @@ class wpdb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bail($message) { // Just wraps errors in a nice header and footer
|
function bail($message) { // Just wraps errors in a nice header and footer
|
||||||
if ( !$this->show_errors )
|
if ( !$this->show_errors )
|
||||||
return false;
|
return false;
|
||||||
header( 'Content-Type: text/html; charset=utf-8');
|
|
||||||
echo <<<HEAD
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<title>WordPress › Error</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
||||||
<style media="screen" type="text/css">
|
|
||||||
<!--
|
|
||||||
html {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
background: #fff;
|
|
||||||
color: #000;
|
|
||||||
font-family: Georgia, "Times New Roman", Times, serif;
|
|
||||||
margin-left: 25%;
|
|
||||||
margin-right: 25%;
|
|
||||||
padding: .2em 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
wp_die($message);
|
||||||
color: #006;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: lighter;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
p, li, dt {
|
|
||||||
line-height: 140%;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul, ol {
|
|
||||||
padding: 5px 5px 5px 20px;
|
|
||||||
}
|
|
||||||
#logo {
|
|
||||||
margin-bottom: 2em;
|
|
||||||
}
|
|
||||||
-->
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1>
|
|
||||||
HEAD;
|
|
||||||
echo $message;
|
|
||||||
echo "</body></html>";
|
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,10 +11,8 @@ $phone_delim = '::';
|
|||||||
|
|
||||||
$pop3 = new POP3();
|
$pop3 = new POP3();
|
||||||
|
|
||||||
if (!$pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port'))) :
|
if (!$pop3->connect(get_settings('mailserver_url'), get_settings('mailserver_port')))
|
||||||
echo "Ooops $pop3->ERROR <br />\n";
|
wp_die($pop3->ERROR);
|
||||||
exit;
|
|
||||||
endif;
|
|
||||||
|
|
||||||
$count = $pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass'));
|
$count = $pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass'));
|
||||||
if (0 == $count) wp_die(__('There doesn’t seem to be any new mail.'));
|
if (0 == $count) wp_die(__('There doesn’t seem to be any new mail.'));
|
||||||
|
Loading…
Reference in New Issue
Block a user