Some notice fixes from Nazgul. fixes #3155

git-svn-id: http://svn.automattic.com/wordpress/trunk@6711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-02 18:42:09 +00:00
parent c95f0e57c7
commit 8263948a96
12 changed files with 31 additions and 28 deletions

View File

@ -1,5 +1,5 @@
<?php // Do not delete these lines <?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!'); die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password if (!empty($post->post_password)) { // if there's a password

View File

@ -14,7 +14,7 @@
<?php <?php
// Checks to see whether it needs a sidebar or not // Checks to see whether it needs a sidebar or not
if ( !$withcomments && !is_single() ) { if ( !empty($withcomments) && !is_single() ) {
?> ?>
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; } #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; }
<?php } else { // No sidebar ?> <?php } else { // No sidebar ?>

View File

@ -353,7 +353,9 @@ class WP_Object_Cache {
$data = ''; $data = '';
$this->cache[$group][$id] = $data; $this->cache[$group][$id] = $data;
unset ($this->non_existant_objects[$group][$id]);
if(isset($this->non_existant_objects[$group][$id]))
unset ($this->non_existant_objects[$group][$id]);
return true; return true;
} }

View File

@ -185,14 +185,14 @@ class WP {
@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
} else { } else {
// We're showing a feed, so WP is indeed the only thing that last changed // We're showing a feed, so WP is indeed the only thing that last changed
if ( $this->query_vars['withcomments'] if ( !empty($this->query_vars['withcomments'])
|| ( !$this->query_vars['withoutcomments'] || ( empty($this->query_vars['withoutcomments'])
&& ( $this->query_vars['p'] && ( !empty($this->query_vars['p'])
|| $this->query_vars['name'] || !empty($this->query_vars['name'])
|| $this->query_vars['page_id'] || !empty($this->query_vars['page_id'])
|| $this->query_vars['pagename'] || !empty($this->query_vars['pagename'])
|| $this->query_vars['attachment'] || !empty($this->query_vars['attachment'])
|| $this->query_vars['attachment_id'] || !empty($this->query_vars['attachment_id'])
) )
) )
) )
@ -208,7 +208,7 @@ class WP {
$client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
else $client_etag = false; else $client_etag = false;
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']); $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
// If string is empty, return 0. If not, attempt to parse into a timestamp // If string is empty, return 0. If not, attempt to parse into a timestamp
$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0; $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;

View File

@ -729,7 +729,7 @@ function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more =
} }
if ( !empty($post->post_password) ) { // if there's a password if ( !empty($post->post_password) ) { // if there's a password
if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) || $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie
echo __('Enter your password to view comments'); echo __('Enter your password to view comments');
return; return;
} }

View File

@ -145,7 +145,7 @@ function html_type_rss() {
function rss_enclosure() { function rss_enclosure() {
global $post; global $post;
if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) if ( !empty($post->post_password) && (!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
return; return;
foreach (get_post_custom() as $key => $val) { foreach (get_post_custom() as $key => $val) {

View File

@ -524,6 +524,7 @@ function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $pre
$current_post_date = $post->post_date; $current_post_date = $post->post_date;
$join = ''; $join = '';
$posts_in_ex_cats_sql = '';
if ( $in_same_cat || !empty($excluded_categories) ) { if ( $in_same_cat || !empty($excluded_categories) ) {
$join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id"; $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
@ -615,7 +616,7 @@ function get_pagenum_link($pagenum = 1) {
$qs_regex = '|\?.*?$|'; $qs_regex = '|\?.*?$|';
preg_match( $qs_regex, $request, $qs_match ); preg_match( $qs_regex, $request, $qs_match );
if ( $qs_match[0] ) { if ( !empty( $qs_match[0] ) ) {
$query_string = $qs_match[0]; $query_string = $qs_match[0];
$request = preg_replace( $qs_regex, '', $request ); $request = preg_replace( $qs_regex, '', $request );
} else { } else {

View File

@ -775,7 +775,7 @@ function wp_safe_redirect($location, $status = 302) {
$lp = parse_url($location); $lp = parse_url($location);
$wpp = parse_url(get_option('home')); $wpp = parse_url(get_option('home'));
$allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), $lp['host']); $allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
$location = get_option('siteurl') . '/wp-admin/'; $location = get_option('siteurl') . '/wp-admin/';

View File

@ -86,7 +86,7 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
$output = ''; $output = '';
if ( !empty($post->post_password) ) { // if there's a password if ( !empty($post->post_password) ) { // if there's a password
if ( stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) { // and it doesn't match the cookie if ( !isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) { // and it doesn't match the cookie
$output = get_the_password_form(); $output = get_the_password_form();
return $output; return $output;
} }
@ -141,7 +141,7 @@ function get_the_excerpt($deprecated = '') {
$output = ''; $output = '';
$output = $post->post_excerpt; $output = $post->post_excerpt;
if ( !empty($post->post_password) ) { // if there's a password if ( !empty($post->post_password) ) { // if there's a password
if ( $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie if ( !isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie
$output = __('There is no excerpt because this is a protected post.'); $output = __('There is no excerpt because this is a protected post.');
return $output; return $output;
} }

View File

@ -216,7 +216,7 @@ function setup_userdata($user_id = '') {
$userdata = $user->data; $userdata = $user->data;
$user_login = $user->user_login; $user_login = $user->user_login;
$user_level = (int) $user->user_level; $user_level = (int) isset($user->user_level) ? $user->user_level : 0;
$user_ID = (int) $user->ID; $user_ID = (int) $user->ID;
$user_email = $user->user_email; $user_email = $user->user_email;
$user_url = $user->user_url; $user_url = $user->user_url;

View File

@ -339,7 +339,7 @@ class wpdb {
$this->query($query); $this->query($query);
// Extract var out of cached results based x,y vals // Extract var out of cached results based x,y vals
if ( $this->last_result[$y] ) { if ( !empty( $this->last_result[$y] ) ) {
$values = array_values(get_object_vars($this->last_result[$y])); $values = array_values(get_object_vars($this->last_result[$y]));
} }

View File

@ -174,7 +174,7 @@ function register_new_user($user_login, $user_email) {
// Main // Main
// //
$action = $_REQUEST['action']; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$errors = new WP_Error(); $errors = new WP_Error();
if ( isset($_GET['key']) ) if ( isset($_GET['key']) )
@ -351,17 +351,17 @@ default:
$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress.")); $errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
// Some parts of this script use the main login form to display a message // Some parts of this script use the main login form to display a message
if ( TRUE == $_GET['loggedout'] ) $errors->add('loggedout', __('You are now logged out.')); if ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] ) $errors->add('loggedout', __('You are now logged out.'));
elseif ( 'disabled' == $_GET['registration'] ) $errors->add('registerdiabled', __('User registration is currently not allowed.')); elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $errors->add('registerdiabled', __('User registration is currently not allowed.'));
elseif ( 'confirm' == $_GET['checkemail'] ) $errors->add('confirm', __('Check your e-mail for the confirmation link.')); elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) $errors->add('confirm', __('Check your e-mail for the confirmation link.'));
elseif ( 'newpass' == $_GET['checkemail'] ) $errors->add('newpass', __('Check your e-mail for your new password.')); elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) $errors->add('newpass', __('Check your e-mail for your new password.'));
elseif ( 'registered' == $_GET['checkemail'] ) $errors->add('registered', __('Registration complete. Please check your e-mail.')); elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) $errors->add('registered', __('Registration complete. Please check your e-mail.'));
login_header(__('Login'), '', $errors); login_header(__('Login'), '', $errors);
?> ?>
<form name="loginform" id="loginform" action="wp-login.php" method="post"> <form name="loginform" id="loginform" action="wp-login.php" method="post">
<?php if ( !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?> <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
<p> <p>
<label><?php _e('Username') ?><br /> <label><?php _e('Username') ?><br />
<input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label> <input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
@ -384,7 +384,7 @@ default:
</form> </form>
<p id="nav"> <p id="nav">
<?php if ( in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?> <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
<?php elseif (get_option('users_can_register')) : ?> <?php elseif (get_option('users_can_register')) : ?>
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a> | <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register"><?php _e('Register') ?></a> |
<a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a> <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php _e('Password Lost and Found') ?>"><?php _e('Lost your password?') ?></a>