Fixed several instances in WordPress where PHP Notices are not being handled correctly.
Fixes supplied by Aaron Jensen (aaron@visualprose.com). git-svn-id: http://svn.automattic.com/wordpress/trunk@559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3e120068f9
commit
a5ab0fc858
|
@ -293,14 +293,14 @@ function convert_gmcode($content) {
|
|||
function convert_smilies($text) {
|
||||
global $smilies_directory, $use_smilies;
|
||||
global $b2_smiliessearch, $b2_smiliesreplace;
|
||||
|
||||
$output = '';
|
||||
if ($use_smilies) {
|
||||
// HTML loop taken from texturize function, could possible be consolidated
|
||||
$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
|
||||
$stop = count($textarr);// loop stuff
|
||||
for ($i = 0; $i < $stop; $i++) {
|
||||
$content = $textarr[$i];
|
||||
if ('<' != $content{0}) { // If it's not a tag
|
||||
if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
|
||||
$content = str_replace($b2_smiliessearch, $b2_smiliesreplace, $content);
|
||||
}
|
||||
$output .= $content;
|
||||
|
@ -1628,7 +1628,10 @@ function apply_filters($tag, $string) {
|
|||
global $b2_filter;
|
||||
if (isset($b2_filter['all'])) {
|
||||
$b2_filter['all'] = (is_string($b2_filter['all'])) ? array($b2_filter['all']) : $b2_filter['all'];
|
||||
$b2_filter[$tag] = array_merge($b2_filter['all'], $b2_filter[$tag]);
|
||||
if (isset($b2_filter[$tag]))
|
||||
$b2_filter[$tag] = array_merge($b2_filter['all'], $b2_filter[$tag]);
|
||||
else
|
||||
$b2_filter[$tag] = array_merge($b2_filter['all'], array());
|
||||
$b2_filter[$tag] = array_unique($b2_filter[$tag]);
|
||||
}
|
||||
if (isset($b2_filter[$tag])) {
|
||||
|
|
|
@ -919,6 +919,7 @@ function the_excerpt_rss($cut = 0, $encode_html = 0) {
|
|||
$output = strip_tags($output);
|
||||
}
|
||||
if ($cut) {
|
||||
$excerpt = '';
|
||||
$blah = explode(' ', $output);
|
||||
if (count($blah) > $cut) {
|
||||
$k = $cut;
|
||||
|
@ -970,6 +971,7 @@ function get_the_excerpt($fakeit = false) {
|
|||
$k = count($blah);
|
||||
$use_dotdotdot = 0;
|
||||
}
|
||||
$excerpt = '';
|
||||
for ($i=0; $i<$k; $i++) {
|
||||
$excerpt .= $blah[$i].' ';
|
||||
}
|
||||
|
@ -1227,6 +1229,9 @@ function get_category_link($echo = false, $file='') {
|
|||
if ($file == '') {
|
||||
$file = "$siteurl/$blogfilename";
|
||||
}
|
||||
if ('http:' != substr($file,0,5)) {
|
||||
$file = "$siteurl/$file";
|
||||
}
|
||||
$link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID;
|
||||
if ($echo)
|
||||
echo($link);
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
$comment_author = trim($HTTP_COOKIE_VARS["comment_author_".$cookiehash]);
|
||||
$comment_author_email = trim($HTTP_COOKIE_VARS["comment_author_email_".$cookiehash]);
|
||||
$comment_author_url = trim($HTTP_COOKIE_VARS["comment_author_url_".$cookiehash]);
|
||||
$comment_author = (isset($HTTP_COOKIE_VARS['comment_author_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_'.$cookiehash]) : '';
|
||||
$comment_author_email = (isset($HTTP_COOKIE_VARS['comment_author_email_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_email_'.$cookiehash]) : '';
|
||||
$comment_author_url = (isset($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash])) ? trim($HTTP_COOKIE_VARS['comment_author_url_'.$cookiehash]) : '';
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
|
||||
++$querycount;
|
||||
|
|
|
@ -41,9 +41,9 @@ $b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search
|
|||
@header ("X-Pingback: $siteurl/xmlrpc.php");
|
||||
|
||||
/* Getting settings from db */
|
||||
if ($doing_rss == 1)
|
||||
if (isset($doing_rss) && $doing_rss == 1)
|
||||
$posts_per_page=get_settings('posts_per_rss');
|
||||
if ($posts_per_page == 0)
|
||||
if (!isset($posts_per_page) || $posts_per_page == 0)
|
||||
$posts_per_page = get_settings('posts_per_page');
|
||||
$what_to_show = get_settings('what_to_show');
|
||||
$archive_mode = get_settings('archive_mode');
|
||||
|
@ -61,7 +61,7 @@ $distinct = '';
|
|||
|
||||
if ($pagenow != 'wp-post.php') { timer_start(); }
|
||||
|
||||
if ($showposts) {
|
||||
if (isset($showposts) && $showposts) {
|
||||
$showposts = (int)$showposts;
|
||||
$posts_per_page = $showposts;
|
||||
}
|
||||
|
@ -288,7 +288,10 @@ if ($pagenow != 'wp-post.php') {
|
|||
$where .= ' AND (post_status = "publish"';
|
||||
|
||||
// Get private posts
|
||||
if ('' != intval($user_ID)) $where .= " OR post_author = $user_ID AND post_status != 'draft')"; else $where .= ')';
|
||||
if (isset($user_ID) && ('' != intval($user_ID)))
|
||||
$where .= " OR post_author = $user_ID AND post_status != 'draft')";
|
||||
else
|
||||
$where .= ')';
|
||||
$request = " SELECT $distinct * FROM $tableposts WHERE 1=1".$where." ORDER BY post_$orderby $limits";
|
||||
|
||||
|
||||
|
|
29
wp-rss.php
29
wp-rss.php
|
@ -1,25 +1,23 @@
|
|||
<?php /* These first lines are the first part of a CafeLog template.
|
||||
In every template you do, you got to copy them before the CafeLog 'loop' */
|
||||
$blog = 1; // enter your blog's ID
|
||||
$doing_rss=1;
|
||||
$doing_rss = 1;
|
||||
header('Content-type: text/xml',true);
|
||||
include('blog.header.php');
|
||||
|
||||
// Handle Conditional GET
|
||||
|
||||
// Get the time of the most recent article
|
||||
$sql = "SELECT max(post_date) FROM $tableposts";
|
||||
|
||||
$maxdate = $wpdb->get_var($sql);
|
||||
$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
|
||||
++$querycount;
|
||||
$unixtime = strtotime($maxdate);
|
||||
|
||||
// format timestamp for Last-Modified header
|
||||
$clast = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
|
||||
$cetag = md5($last);
|
||||
$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
|
||||
$cetag = (isset($last)) ? md5($last) : '';
|
||||
|
||||
$slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
||||
$setag = $_SERVER['HTTP_IF_NONE_MATCH'];
|
||||
$slast = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : '' ;
|
||||
$setag = (isset($_SERVER['HTTP_IF_NONE_MATCH'])) ? $_SERVER['HTTP_IF_NONE_MATCH'] : '';
|
||||
|
||||
// send it in a Last-Modified header
|
||||
header("Last-Modified: " . $clast, true);
|
||||
|
@ -32,10 +30,17 @@ header("Etag: " . $cetag, true);
|
|||
// but if both headers exist, they *both* must match up with the locally
|
||||
// generated values.
|
||||
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
|
||||
if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
echo "\r\n\r\n";
|
||||
exit;
|
||||
if (($slast != '') && ($setag != '')) {
|
||||
if (($slast == $clast) && ($setag == $cetag)) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
echo "\r\n\r\n";
|
||||
exit;
|
||||
} else if (($slast == $clast)
|
||||
|| ($setag == $cetag)) {
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
echo "\r\n\r\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// We should eventually migrate to either calling
|
||||
// get_settings() wherever these are needed OR
|
||||
// accessing a single global $all_settings var
|
||||
if (!$_wp_installing) {
|
||||
if (!isset($_wp_installing) || !$_wp_installing) {
|
||||
$siteurl = get_settings('siteurl');
|
||||
// "When trying to design a foolproof system,
|
||||
// never underestimate the ingenuity of the fools :)"
|
||||
|
|
Loading…
Reference in New Issue