diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index 0d22e2882..9fdd64441 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -16,6 +16,7 @@ if (!function_exists('floatval')) { /***** Formatting functions *****/ function wptexturize($text) { + $output = ""; $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $stop = count($textarr); $next = true; // loop stuff for ($i = 0; $i < $stop; $i++) { @@ -24,7 +25,7 @@ function wptexturize($text) { $curl = str_replace('', '“', $curl); $curl = str_replace('', '”', $curl); } - if ('<' != $curl{0} && $next) { // If it's not a tag + if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag $curl = str_replace('---', '—', $curl); $curl = str_replace('--', '–', $curl); $curl = str_replace("...", '…', $curl); @@ -35,7 +36,6 @@ function wptexturize($text) { $cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round"); $curl = str_replace($cockney, $cockneyreplace, $curl); - $curl = preg_replace("/'s/", "’s", $curl); $curl = preg_replace("/'(\d\d(?:’|')?s)/", "’$1", $curl); $curl = preg_replace('/(\s|\A|")\'/', '$1‘', $curl); @@ -218,7 +218,7 @@ function convert_chars($content,$flag='obsolete attribute left there for backwar $content = preg_replace('/&[^#](?![a-z]*;)/ie', '"&".substr("\0",1)', $content); // converts HTML-entities to their display values in order to convert them again later - $content = preg_replace('/['.chr(127).'-'.chr(255).']/e', '"&#".ord(\0).";"', $content ); + $content = preg_replace('/['.chr(127).'-'.chr(255).']/e', '"&#".ord(\'\0\').";"', $content ); $content = strtr($content, $b2_htmltrans); // now converting: Windows CP1252 => Unicode (valid HTML) @@ -271,6 +271,7 @@ function convert_gmcode($content) { function convert_smilies($text) { global $smilies_directory, $use_smilies; global $b2_smiliessearch, $b2_smiliesreplace; + 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 @@ -282,6 +283,9 @@ function convert_smilies($text) { } $output .= $content; } + } else { + // return default text. + $output = $text; } return $output; } @@ -1280,5 +1284,4 @@ function pingGeoURL($blog_ID) { getRemoteFile($host,$path); } - ?> \ No newline at end of file diff --git a/b2calendar.php b/b2calendar.php index f9700e507..b1ce6d9a3 100644 --- a/b2calendar.php +++ b/b2calendar.php @@ -57,6 +57,9 @@ require_once($abspath.$b2inc.'/b2functions.php'); require_once($abspath.$b2inc.'/b2vars.php'); $w = $HTTP_GET_VARS['w']; +if (isset($HTTP_GET_VARS['w'])) { + $w = $HTTP_GET_VARS['w']; +} if (isset($calendar) && ($calendar != '')) { $thisyear = substr($calendar,0,4);