[pLog-svn] r7230 - in plog/branches/lifetype-1.2: class/dao/userdata class/data class/database/pdb/drivers class/net class/template class/xml/tree install
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Mon Jul 13 02:29:47 EDT 2020
Author: jondaley
Date: 2020-07-13 02:29:46 -0400 (Mon, 13 Jul 2020)
New Revision: 7230
Added:
plog/branches/lifetype-1.2/class/data/preg_wrapper.php
Modified:
plog/branches/lifetype-1.2/class/dao/userdata/baseuserdataprovider.class.php
plog/branches/lifetype-1.2/class/data/inputfilter.class.php
plog/branches/lifetype-1.2/class/data/kses.class.php
plog/branches/lifetype-1.2/class/data/textfilter.class.php
plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqldriver.class.php
plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqlrecordset.class.php
plog/branches/lifetype-1.2/class/net/requestgenerator.class.php
plog/branches/lifetype-1.2/class/template/template.class.php
plog/branches/lifetype-1.2/class/xml/tree/Node.php
plog/branches/lifetype-1.2/install/installation.class.php
Log:
php7 compatibility. Thanks to Alexandros C. Couloumbis for the help
Modified: plog/branches/lifetype-1.2/class/dao/userdata/baseuserdataprovider.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/userdata/baseuserdataprovider.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/dao/userdata/baseuserdataprovider.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -101,16 +101,17 @@
// check if the user is the owner of any blog
$prefix = $this->getPrefix();
$owner = "SELECT * FROM {$prefix}blogs WHERE owner_id = '".Db::qstr( $userid )."'";
- if( $status != BLOG_STATUS_ALL )
- $owner .= " AND status = '".Db::qstr( $status )."'";
+ if( $status != BLOG_STATUS_ALL )
+ $owner .= " AND status = '".Db::qstr( $status )."'";
- $result = $this->Execute( $owner );
-
- while( $row = $result->FetchRow($result)) {
+ $result = $this->Execute( $owner );
+ if($result){
+ while( $row = $result->FetchRow($result)) {
$usersBlogs[] = $blogs->mapRow( $row );
$ids[] = $row["id"];
+ }
+ $result->Close();
}
- $result->Close();
// and now check to which other blogs he or she belongs
$otherBlogs = "SELECT DISTINCT p.blog_id AS blog_id FROM {$prefix}users_permissions p, {$prefix}blogs b
@@ -123,13 +124,15 @@
$otherBlogs .= " AND b.status = '".Db::qstr( $status )."'";
$result = $this->Execute( $otherBlogs );
- // now we know to which he or she belongs, so we only have
- // to load the information about those blogs
- while( $row = $result->FetchRow($result)) {
- $id = $row["blog_id"];
+ if($result){
+ // now we know to which he or she belongs, so we only have
+ // to load the information about those blogs
+ while( $row = $result->FetchRow($result)) {
+ $id = $row["blog_id"];
$usersBlogs[] = $blogs->getBlogInfo( $id );
+ }
+ $result->Close();
}
- $result->Close();
sort($usersBlogs);
Modified: plog/branches/lifetype-1.2/class/data/inputfilter.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/inputfilter.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/data/inputfilter.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -10,6 +10,8 @@
* @email: dan at rootcube.com
* @license: GNU General Public License (GPL)
*/
+lt_include( PLOG_CLASS_PATH."class/data/preg_wrapper.php" );
+
class InputFilter {
var $tagsArray; // default = empty array
var $attrArray; // default = empty array
@@ -217,8 +219,8 @@
// strips unicode, hex, etc
$attrSubSet[1] = str_replace('&#', '', $attrSubSet[1]);
// strip normal newline within attr value
- // jondaley/lifetype: this also stripped out all whitespace, not just newlines
- $attrSubSet[1] = preg_replace('/\n\r/', '', $attrSubSet[1]);
+ // jondaley/lifetype: this also stripped out all whitespace, not just newlines
+ $attrSubSet[1] = my_preg_replace('/\n\r/', '', $attrSubSet[1]);
// strip double quotes
$attrSubSet[1] = str_replace('"', '', $attrSubSet[1]);
// [requested feature] convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value)
@@ -264,9 +266,13 @@
// post HTML source in their posts, ie. < etc.
// $source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1");
// convert decimal
- $source = preg_replace('/&#(\d+);/me',"chr(\\1)", $source); // decimal notation
+ $source = my_preg_replace('/&#(\d+);/me',"chr(\\1)", $source); // decimal notation
// convert hex
- $source = preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)", $source); // hex notation
+ $source = preg_replace_callback(
+ '/&#x([a-f0-9]+);/mi',
+ function ($m) { return chr(hexdec('0x'.$m[1])); },
+ $source
+ );
return $source;
}
}
Modified: plog/branches/lifetype-1.2/class/data/kses.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/kses.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/data/kses.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -47,6 +47,9 @@
*
* Email: View current valid email address at http://www.chaos.org/contact/
*/
+
+ lt_include( PLOG_CLASS_PATH."class/data/preg_wrapper.php" );
+
class kses
{
var $allowed_protocols = array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto', 'irc', 'mms' );
@@ -199,8 +202,8 @@
###############################################################################
function _no_null($string)
{
- $string = preg_replace('/\0+/', '', $string);
- $string = preg_replace('/(\\\\0)+/', '', $string);
+ $string = my_preg_replace('/\0+/', '', $string);
+ $string = my_preg_replace('/(\\\\0)+/', '', $string);
//
// NOTE TO SELF: this was apparently messing up utf-8 texts!!! Removed for now...
//
@@ -214,7 +217,7 @@
###############################################################################
function _js_entities($string)
{
- return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
+ return my_preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
} # function _js_entities
@@ -229,18 +232,22 @@
# Change back the allowed entities in our entity white list
- $string = preg_replace('/&([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
- $string = preg_replace('/�*([0-9]{1,5});/e', '\$this->_normalize_entities2("\\1")', $string);
- $string = preg_replace('/&#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);
+ $string = my_preg_replace('/&([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
+ $string = preg_replace_callback(
+ '/�*([0-9]{1,5});/',
+ function($m) { return $this->_normalize_entities2($m[1]); },
+ $string
+ );
+ $string = my_preg_replace('/&#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);
if( $this->xhtmlConverterOnly && $this->aggressiveMode ) {
// take care of the '>' and '<' that don't belong to any tag
- $string = preg_replace("/(\s+)(<)(\s+)/", "\\1<\\3", $string );
- $string = preg_replace("/(\[^A-Za-z]+)(<)([^A-Za-z]+)/", "\\1<\\3", $string );
- $string = preg_replace("/(\s+)(>)(\s+)/", "\\1>\\3", $string );
+ $string = my_preg_replace("/(\s+)(<)(\s+)/", "\\1<\\3", $string );
+ $string = my_preg_replace("/(\[^A-Za-z]+)(<)([^A-Za-z]+)/", "\\1<\\3", $string );
+ $string = my_preg_replace("/(\s+)(>)(\s+)/", "\\1>\\3", $string );
// also, normalize whatever is within <code>...</code> tags but only in the "xhtml converter" mode
- $string = preg_replace("/(.*<code>)(.*)(<\/code>.*)/e", '"\\1".$this->_tmp("\\2")."\\3"', $string );
+ $string = my_preg_replace("/(.*<code>)(.*)(<\/code>.*)/e", '"\\1".$this->_tmp("\\2")."\\3"', $string );
}
return $string;
@@ -249,9 +256,13 @@
function _tmp($string)
{
$string = htmlspecialchars($string);
- $string = preg_replace('/&([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
- $string = preg_replace('/�*([0-9]{1,5});/e', '\$this->_normalize_entities2("\\1")', $string);
- $string = preg_replace('/&#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);
+ $string = my_preg_replace('/&([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
+ $string = preg_replace_callback(
+ '/�*([0-9]{1,5});/',
+ function($m) { return $this->_normalize_entities2($m[1]); },
+ $string
+ );
+ $string = my_preg_replace('/&#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);
return $string;
}
@@ -301,12 +312,12 @@
###############################################################################
function _split($string)
{
- return preg_replace(
+ return preg_replace_callback(
'%(<'. # EITHER: <
'[^>]*'. # things that aren't >
- '>'. # must >
- '|>)%e', # OR: just a >
- "\$this->_split2('\\1')",
+ '>'. # must >
+ '|>)%', # OR: just a >
+ function($m) { return $this->_split2($m[1]); },
$string);
} # function _split
@@ -420,7 +431,7 @@
} # foreach
# Remove any "<" or ">" characters
- $attr2 = preg_replace('/[<>]/', '', $attr2);
+ $attr2 = my_preg_replace('/[<>]/', '', $attr2);
return "<$element$attr2$xhtml_slash>";
} # function _attr
@@ -451,7 +462,7 @@
{
$attrname = strtolower($match[1]);
$working = $mode = 1;
- $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr);
+ $attr = my_preg_replace('/^[-a-zA-Z]+/', '', $attr);
}
break;
case 1: # equals sign or valueless ("selected")
@@ -459,7 +470,7 @@
{
$working = 1;
$mode = 2;
- $attr = preg_replace('/^\s*=\s*/', '', $attr);
+ $attr = my_preg_replace('/^\s*=\s*/', '', $attr);
break;
}
if (preg_match('/^\s+/', $attr)) # valueless
@@ -472,7 +483,7 @@
'whole' => $attrname,
'vless' => 'y'
);
- $attr = preg_replace('/^\s+/', '', $attr);
+ $attr = my_preg_replace('/^\s+/', '', $attr);
}
break;
case 2: # attribute value, a URL after href= for instance
@@ -487,7 +498,7 @@
);
$working = 1;
$mode = 0;
- $attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
+ $attr = my_preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
break;
}
if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) # 'value'
@@ -501,7 +512,7 @@
);
$working = 1;
$mode = 0;
- $attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
+ $attr = my_preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
break;
}
if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) # value
@@ -516,7 +527,7 @@
# We add quotes to conform to W3C's HTML spec.
$working = 1;
$mode = 0;
- $attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
+ $attr = my_preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
}
if( $this->xhtmlConverterOnly ) {
if (preg_match("%^([^\s\"']+)(\s+|\"$)%", $attr, $match)) # value"
@@ -531,7 +542,7 @@
# We add quotes to conform to W3C's HTML spec.
$working = 1;
$mode = 0;
- $attr = preg_replace("%^[^\s\"']+(\s+|\"$)%", '', $attr);
+ $attr = my_preg_replace("%^[^\s\"']+(\s+|\"$)%", '', $attr);
}
if (preg_match("%^\"(.*)$%", $attr, $match)) # "value
{
@@ -545,7 +556,7 @@
# We add quotes to conform to W3C's HTML spec.
$working = 1;
$mode = 0;
- $attr = preg_replace("%^\"(.*)$%", '', $attr);
+ $attr = my_preg_replace("%^\"(.*)$%", '', $attr);
}
}
@@ -599,7 +610,7 @@
###############################################################################
function _bad_protocol_once($string)
{
- return preg_replace(
+ return my_preg_replace(
'/^((&[^;]*;|[\sA-Za-z0-9])*)'.
'(:|:|&#[Xx]3[Aa];)(\/|/|&#[Xx]2[Ff];)(\/|/|&#[Xx]2[Ff];)\s*/e',
'\$this->_bad_protocol_once2("\\1")',
@@ -615,7 +626,7 @@
function _bad_protocol_once2($string)
{
$string2 = $this->_decode_entities($string);
- $string2 = preg_replace('/\s/', '', $string2);
+ $string2 = my_preg_replace('/\s/', '', $string2);
$string2 = $this->_no_null($string2);
$string2 = strtolower($string2);
@@ -721,7 +732,7 @@
###############################################################################
function _stripslashes($string)
{
- return preg_replace('%\\\\"%', '"', $string);
+ return my_preg_replace('%\\\\"%', '"', $string);
} # function _stripslashes
###############################################################################
@@ -731,7 +742,7 @@
###############################################################################
function _html_error($string)
{
- $result = preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);
+ $result = my_preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);
return $result;
} # function _html_error
@@ -742,8 +753,8 @@
###############################################################################
function _decode_entities($string)
{
- $string = preg_replace('/&#([0-9]+);/e', 'chr("\\1")', $string);
- $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))', $string);
+ $string = my_preg_replace('/&#([0-9]+);/e', 'chr("\\1")', $string);
+ $string = my_preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))', $string);
return $string;
} # function _decode_entities
@@ -755,4 +766,4 @@
return '0.0.2 (OOP fork of kses 0.2.1)';
} # function _version
}
-?>
\ No newline at end of file
+?>
Added: plog/branches/lifetype-1.2/class/data/preg_wrapper.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/preg_wrapper.php (rev 0)
+++ plog/branches/lifetype-1.2/class/data/preg_wrapper.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -0,0 +1,83 @@
+<?php
+
+if (!function_exists('preg_replace_callback_array')) {
+
+ function preg_replace_callback_array (array $patterns_and_callbacks, $subject, $limit=-1, &$count=NULL) {
+ $count = 0;
+ foreach ($patterns_and_callbacks as $pattern => &$callback) {
+ $subject = preg_replace_callback($pattern, $callback, $subject, $limit, $partial_count);
+ $count += $partial_count;
+ }
+ return preg_last_error() == PREG_NO_ERROR ? $subject : NULL;
+ }
+}
+
+
+function is_evaled_preg($str)
+{
+ if (!preg_match('~([a-z]+)$~i', $str, $ext))
+ return false;
+ $matched = $ext[1];
+ if (strpos($matched, "e") === false)
+ return false;
+ $str = substr($str, 0, strlen($str) - strlen($matched));
+ $matched = str_replace('e', '', $matched);
+ return $str . $matched;
+}
+
+$lwb_compiled_regexes = array();
+
+function my_compile_regex($replacement)
+{
+ global $lwb_compiled_regexes;
+ $replacement = preg_replace_callback('~[\\$\\\\](\d+)~', function ($m)
+ {
+ return '$m[' . $m[1] . ']';
+ }, $replacement);
+ $replacement = str_replace('\\\\', '\\', $replacement);
+ $replacement="return $replacement;";
+ $ret = create_function('$m', $replacement);
+ $lwb_compiled_regexes[$replacement] = $ret;
+ return $ret;
+}
+
+function my_preg_replace_internal($pattern, $replacement, $subject)
+{
+ global $lwb_compiled_regexes;
+ $func = isset($lwb_compiled_regexes[$replacement]) ? $lwb_compiled_regexes[$replacement] : my_compile_regex($replacement);
+ return preg_replace_callback($pattern, $func, $subject);
+}
+
+function my_preg_replace($pattern, $replacement, $subject)
+{
+ if (!is_array($pattern))
+ {
+ $pattern = (array) $pattern;
+ $replacement = (array) $replacement;
+ }
+
+ $pattern_out = array(
+ 0 => array(),
+ 1 => array()
+ );
+
+ $replacement_out = array(
+ 0 => array(),
+ 1 => array()
+ );
+
+ foreach ($pattern as $k => $p)
+ {
+ $is = is_evaled_preg($p);
+ $ind = (int) (bool) $is;
+ $pattern_out[$ind][] = $is ?: $p;
+ $replacement_out[$ind][] = $replacement[$k];
+ }
+ if (count($pattern_out[0]))
+ $subject = preg_replace($pattern_out[0], $replacement_out[0], $subject);
+
+ foreach ($pattern_out[1] as $k => $p)
+ $subject = my_preg_replace_internal($pattern_out[1][$k], $replacement_out[1][$k], $subject);
+
+ return $subject;
+}
Modified: plog/branches/lifetype-1.2/class/data/textfilter.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/data/textfilter.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/data/textfilter.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -9,6 +9,7 @@
lt_include( PLOG_CLASS_PATH."class/data/stringutils.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/preg_wrapper.php" );
/**
* default character used as the word separator, instead of blank spaces
@@ -67,11 +68,11 @@
}
// WP bug fix for LOVE <3 (and other situations with '<' before a number)
- $string = preg_replace('/<([0-9]+)/', '<$1', $string);
+ $string = my_preg_replace('/<([0-9]+)/', '<$1', $string);
// some nice people might like to use "< >" without meaning to do HTML?
- $string = preg_replace('/<( *)>/', '<$1>', $string);
+ $string = my_preg_replace('/<( *)>/', '<$1>', $string);
-// $string = preg_replace('/<.*>/', '<', $string);
+// $string = my_preg_replace('/<.*>/', '<', $string);
$string = strip_tags( $string, $htmlAllowedTags );
$string = TextFilter::balanceTags($string);
@@ -105,7 +106,8 @@
*/
function filterHTMLEntities( $string )
{
- return htmlentities( $string );
+// return htmlentities( $string );
+ return htmlspecialchars( $string );
}
/**
@@ -155,23 +157,23 @@
$curl = str_replace("...", '…', $curl);
$curl = str_replace('``', '“', $curl);
- $curl = preg_replace("/'s/", "’s", $curl);
- $curl = preg_replace("/'(\d\d(?:’|')?s)/", "’$1", $curl);
- $curl = preg_replace('/(\s|\A|")\'/', '$1‘', $curl);
- $curl = preg_replace("/(\d+)\"/", "$1″", $curl);
- $curl = preg_replace("/(\d+)'/", "$1′", $curl);
- $curl = preg_replace("/(\S)'([^'\s])/", "$1’$2", $curl);
- $curl = preg_replace('/"([\s.]|\Z)/', '”$1', $curl);
- $curl = preg_replace('/(\s|\A)"/', '$1“', $curl);
- $curl = preg_replace("/'([\s.]|\Z)/", '’$1', $curl);
- $curl = preg_replace("/\(tm\)/i", '™', $curl);
- $curl = preg_replace("/\(c\)/i", '©', $curl);
- $curl = preg_replace("/\(r\)/i", '®', $curl);
+ $curl = my_preg_replace("/'s/", "’s", $curl);
+ $curl = my_preg_replace("/'(\d\d(?:’|')?s)/", "’$1", $curl);
+ $curl = my_preg_replace('/(\s|\A|")\'/', '$1‘', $curl);
+ $curl = my_preg_replace("/(\d+)\"/", "$1″", $curl);
+ $curl = my_preg_replace("/(\d+)'/", "$1′", $curl);
+ $curl = my_preg_replace("/(\S)'([^'\s])/", "$1’$2", $curl);
+ $curl = my_preg_replace('/"([\s.]|\Z)/', '”$1', $curl);
+ $curl = my_preg_replace('/(\s|\A)"/', '$1“', $curl);
+ $curl = my_preg_replace("/'([\s.]|\Z)/", '’$1', $curl);
+ $curl = my_preg_replace("/\(tm\)/i", '™', $curl);
+ $curl = my_preg_replace("/\(c\)/i", '©', $curl);
+ $curl = my_preg_replace("/\(r\)/i", '®', $curl);
$curl = str_replace("''", '”', $curl);
- $curl = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $curl);
+ $curl = my_preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $curl);
- $curl = preg_replace('/(d+)x(\d+)/', "$1×$2", $curl);
+ $curl = my_preg_replace('/(d+)x(\d+)/', "$1×$2", $curl);
} elseif (strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) {
// strstr is fast
$next = false;
@@ -195,13 +197,13 @@
*/
function autoP($pee, $br=1)
{
- $pee = preg_replace("/(\r\n|\n|\r)/", "\n", $pee); // cross-platform newline
- $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
- $pee = preg_replace('/\n?(.+?)(\n\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
- $pee = preg_replace('/<p>(<(?:table|[ou]l|pre|select|form|blockquote)>)/', "$1", $pee);
- $pee = preg_replace('!(</?(?:table|[ou]l|pre|select|form|blockquote)>)</p>!', "$1", $pee);
- if ($br) $pee = preg_replace('|(?<!</p>)\s*\n|', "<br />\n", $pee); // optionally make line breaks
- $pee = preg_replace('!(</(?:table|[ou]l|pre|select|form|blockquote)>)<br />!', "$1", $pee);
+ $pee = my_preg_replace("/(\r\n|\n|\r)/", "\n", $pee); // cross-platform newline
+ $pee = my_preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
+ $pee = my_preg_replace('/\n?(.+?)(\n\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
+ $pee = my_preg_replace('/<p>(<(?:table|[ou]l|pre|select|form|blockquote)>)/', "$1", $pee);
+ $pee = my_preg_replace('!(</?(?:table|[ou]l|pre|select|form|blockquote)>)</p>!', "$1", $pee);
+ if ($br) $pee = my_preg_replace('|(?<!</p>)\s*\n|', "<br />\n", $pee); // optionally make line breaks
+ $pee = my_preg_replace('!(</(?:table|[ou]l|pre|select|form|blockquote)>)<br />!', "$1", $pee);
$pee = str_replace('<p><p>', '<p>', $pee);
$pee = str_replace('</p></p>', '</p>', $pee);
@@ -223,8 +225,8 @@
function htmlDecode( $htmlString, $quote_style = ENT_QUOTES )
{
// replace numeric entities
- $htmlString = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $htmlString);
- $htmlString = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $htmlString);
+ $htmlString = my_preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $htmlString);
+ $htmlString = my_preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $htmlString);
// get the entity translation table from PHP (current encoding is ISO-8859-1)
$trans_table = get_html_translation_table( HTML_ENTITIES, $quote_style );
// when we want to decode the input string to normalized string, there are two factors
@@ -275,9 +277,9 @@
// put all the html entities back to what they should be
$result = TextFilter::htmlDecode( $result );
// and remove everything which is not letters or numbers
- $result = preg_replace( "/[^A-Za-z0-9_]/", " ", $result );
+ $result = my_preg_replace( "/[^A-Za-z0-9_]/", " ", $result );
// finally, remove the unnecessary spaces
- $result = preg_replace( "/ +/", " ", $result );
+ $result = my_preg_replace( "/ +/", " ", $result );
return $result;
}
@@ -312,7 +314,7 @@
$nestable_tags = array('blockquote', 'div', 'span');
// WP bug fix for LOVE <3 (and other situations with '<' before a number)
- $text = preg_replace('#<([0-9]{1})#', '<$1', $text);
+ $text = my_preg_replace('#<([0-9]{1})#', '<$1', $text);
while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {
$newtext .= $tagqueue;
@@ -417,7 +419,7 @@
$separator = $config->getValue( "urlize_word_separator", URLIZE_WORD_SEPARATOR_DEFAULT );
// remove unnecessary spaces and make everything lower case
- $string = preg_replace( "/ +/", " ", strtolower($string) );
+ $string = my_preg_replace( "/ +/", " ", strtolower($string) );
// removing a set of reserved characters (rfc2396: ; / ? : @ & = + $ ,)
$string = str_replace(array(';','/','?',':','@','&','=','+','$',','),
@@ -441,15 +443,15 @@
// and everything that is still left that hasn't been
// replaced/encoded, throw it away
- // NOTE: need double backslash to pass the escape to preg_replace
+ // NOTE: need double backslash to pass the escape to my_preg_replace
$good_characters = "a-z0-9.\\".$separator;
if(!$domainize){
$good_characters .= "_\\-";
}
- $string = preg_replace( '/[^'.$good_characters.']/', '', $string );
+ $string = my_preg_replace( '/[^'.$good_characters.']/', '', $string );
// remove doubled separators
- $string = preg_replace("/[".$separator."]+/", $separator, $string);
+ $string = my_preg_replace("/[".$separator."]+/", $separator, $string);
// remove starting and trailing separator chars
$string = trim($string, $separator);
if($domainize){
@@ -534,9 +536,9 @@
$validChars = "_0-9a-zA-Z.-";
}
// remove "bad" characters
- $string = preg_replace("/[^".$validChars."]/", $separator, strip_tags(Textfilter::htmlDecode($string)));
+ $string = my_preg_replace("/[^".$validChars."]/", $separator, strip_tags(Textfilter::htmlDecode($string)));
// remove doubled separators
- $string = preg_replace("/[".$separator."]+/", $separator, $string);
+ $string = my_preg_replace("/[".$separator."]+/", $separator, $string);
// remove starting and trailing separator chars
$string = trim($string, $separator);
// and convert to lowercase
Modified: plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqldriver.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqldriver.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqldriver.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -49,12 +49,12 @@
// connection parameters, we either need to select the database *everytime* we want to make
// a query or use slightly different connection paramters. I am not sure if this has any
// performance hit, though.
- mysql_select_db( $this->_dbname, $this->_res );
+ mysqli_select_db( $this->_res, $this->_dbname );
// increment the number of queries executed so far, regardless of what they were
$__pdb_num_queries++;
- $result = mysql_query( $query, $this->_res );
+ $result = mysqli_query( $this->_res, $query );
if( !$result ) {
if( $this->_debug ) {
print("<hr/>ERROR MESSAGE: ".$this->ErrorMsg()."<br/>");
@@ -75,19 +75,19 @@
PDbDriverBase::Connect( $host, $username, $password, $dbname );
// try to connect and quit if unsuccessful
- $this->_res = mysql_connect( $host, $username, $password );
+ $this->_res = mysqli_connect( $host, $username, $password, $dbname );
if( !$this->_res )
return false;
// set the right character encoding for mysql 4.1+ client, connection and collation
if( !empty( $dbcharset ) && $dbcharset != "default" ) {
- mysql_query( "SET NAMES ".$dbcharset, $this->_res );
+ mysqli_query( $this->_res, "SET NAMES ".$dbcharset );
$this->_charset = $dbcharset;
}
// continue otherwise and try to select our db
if( $dbname )
- return( mysql_select_db( $dbname, $this->_res ));
+ return( mysqli_select_db( $this->_res, $dbname ));
else
return( true );
}
@@ -97,24 +97,7 @@
*/
function PConnect( $host, $username, $password, $dbname = null, $dbcharset = null )
{
- PDbDriverBase::Connect( $host, $username, $password, $dbname );
-
- // try to connect and quit if unsuccessful
- $this->_res = mysql_pconnect( $host, $username, $password );
- if( !$this->_res )
- return false;
-
- // set the right character encoding for mysql 4.1+ client, connection and collation
- if( !empty( $dbcharset ) && $dbcharset != "default" ) {
- mysql_query( "SET NAMES ".$dbcharset, $this->_res );
- $this->_charset = $dbcharset;
- }
-
- // continue otherwise and try to select our db
- if( $dbname )
- return( mysql_select_db( $dbname, $this->_res ));
- else
- return( true );
+ return $this->Connect( $host, $username, $password, $dbname, $dbcharset );
}
/**
@@ -122,7 +105,7 @@
*/
function Close()
{
- return( mysql_close( $this->_res ));
+ return( mysqli_close( $this->_res ));
}
/**
@@ -130,7 +113,7 @@
*/
function ErrorMsg()
{
- return( mysql_error( $this->_res ));
+ return( mysqli_error( $this->_res ));
}
/**
@@ -138,7 +121,7 @@
*/
function Insert_ID()
{
- return( mysql_insert_id( $this->_res ));
+ return( mysqli_insert_id( $this->_res ));
}
/**
@@ -146,7 +129,7 @@
*/
function Affected_Rows()
{
- return( mysql_affected_rows( $this->_res ));
+ return( mysqli_affected_rows( $this->_res ));
}
/**
@@ -162,7 +145,7 @@
* configured in the database configuration file, config/config.properties.php:
*
* <pre>
- * $config['db_options'] = Array( "enable_mysql_fulltext_search" => false );
+ * $config['db_options'] = Array( "enable_mysqli_fulltext_search" => false );
* </pre>
*
* @return true if FULLTEXT is supported
@@ -169,7 +152,7 @@
*/
function isFullTextSupported()
{
- isset( $this->_opts["enable_mysql_fulltext_search"] ) ? $enableFullText = $this->_opts["enable_mysql_fulltext_search"] : $enableFullText = false;
+ isset( $this->_opts["enable_mysqli_fulltext_search"] ) ? $enableFullText = $this->_opts["enable_mysqli_fulltext_search"] : $enableFullText = false;
return( $enableFullText );
}
@@ -184,4 +167,3 @@
return( $this->_charset );
}
}
-?>
\ No newline at end of file
Modified: plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqlrecordset.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqlrecordset.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/database/pdb/drivers/pdbmysqlrecordset.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -25,7 +25,7 @@
*/
function FetchRow()
{
- return( mysql_fetch_assoc( $this->_dbRes ));
+ return( mysqli_fetch_assoc( $this->_dbRes ));
}
/**
@@ -33,7 +33,7 @@
*/
function RecordCount()
{
- return( mysql_num_rows( $this->_dbRes ));
+ return( mysqli_num_rows( $this->_dbRes ));
}
/**
@@ -41,7 +41,7 @@
*/
function Close()
{
- return( mysql_free_result( $this->_dbRes ));
+ return( mysqli_free_result( $this->_dbRes ));
}
}
-?>
\ No newline at end of file
+?>
Modified: plog/branches/lifetype-1.2/class/net/requestgenerator.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/net/requestgenerator.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/net/requestgenerator.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -60,7 +60,7 @@
*/
class RequestGenerator
{
- var $_mode;
+ public $_mode;
function getRequestGenerator( $blogInfo = null, $mode = CHECK_CONFIG_REQUEST_MODE )
{
@@ -70,18 +70,18 @@
$mode = $config->getValue( "request_format_mode" );
}
- $this->_mode = $mode;
+ $_mode = $mode;
// load the correct generator, while doing some nice dynamic loading...
- if( $this->_mode == SEARCH_ENGINE_FRIENDLY_MODE ) {
+ if( $_mode == SEARCH_ENGINE_FRIENDLY_MODE ) {
lt_include( PLOG_CLASS_PATH."class/net/prettyrequestgenerator.class.php" );
$rg = new PrettyRequestGenerator( $blogInfo );
}
- elseif( $this->_mode == MODREWRITE_MODE ) {
+ elseif( $_mode == MODREWRITE_MODE ) {
lt_include( PLOG_CLASS_PATH."class/net/modrewriterequestgenerator.class.php" );
$rg = new ModRewriteRequestGenerator( $blogInfo );
}
- elseif( $this->_mode == CUSTOM_REQUEST_MODE ) {
+ elseif( $_mode == CUSTOM_REQUEST_MODE ) {
lt_include( PLOG_CLASS_PATH."class/net/customrequestgenerator.class.php" );
$rg = new CustomRequestGenerator( $blogInfo );
}
Modified: plog/branches/lifetype-1.2/class/template/template.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/template.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/template/template.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -74,7 +74,7 @@
function Template( $templateFile )
{
// create the Smarty object and set the security values
- $this->Smarty();
+ $this->__construct();
$this->caching = false;
//$this->cache_lifetime = $cacheLifetime;
$config =& Config::getConfig();
Modified: plog/branches/lifetype-1.2/class/xml/tree/Node.php
===================================================================
--- plog/branches/lifetype-1.2/class/xml/tree/Node.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/class/xml/tree/Node.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -21,6 +21,9 @@
// $Id: Node.php,v 1.22 2004/05/26 15:03:25 davey Exp $
//
+lt_include(PLOG_CLASS_PATH."class/data/preg_wrapper.php");
+
+
/**
* \ingroup XML
*
@@ -550,18 +553,21 @@
$xml
);
- $xml = preg_replace(array("/\&([a-z\d\#]+)\;/i",
- "/\&/",
- "/\#\|\|([a-z\d\#]+)\|\|\#/i",
- "/([^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_])/e"
- ),
- array("#||\\1||#",
- "&",
- "&\\1;",
- "'&#'.ord('\\1').';'"
- ),
- $xml
- );
+ $xml = preg_replace_callback_array(
+ array(
+ "/\&([a-z\d\#]+)\;/i" => function($matches) {
+ return '#||'.$matches[1].'||#';
+ },
+ "/\&/" => function($matches) {
+ return "&";
+ },
+ "/\#\|\|([a-z\d\#]+)\|\|\#/i" => function($matches) {
+ return '&'.$matches[1].';';
+ },
+ "/([^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_])/" => function($matches) {
+ return '&#'.ord($matches[1]).';';
+ }
+ ), $xml);
return $xml;
}
Modified: plog/branches/lifetype-1.2/install/installation.class.php
===================================================================
--- plog/branches/lifetype-1.2/install/installation.class.php 2020-07-13 05:09:17 UTC (rev 7229)
+++ plog/branches/lifetype-1.2/install/installation.class.php 2020-07-13 06:29:46 UTC (rev 7230)
@@ -9,10 +9,9 @@
// If those parameters are empty
echo 'LifeType has not been installed yet, you\'ll have to <font color="red"><b><a href="wizard.php" title="Install LifeType">Install LifeType</a></b></font> first!';
} else {
- echo 'The <font color="red"><b>wizard.php</b></font> has to be removed after the installation process. Please remove it first to <font color="green"><b><a href="'.$_SERVER['PHP_SELF'].'" title="'.end( split( "/", $_SERVER['PHP_SELF'] ) ).'">continue</a></b></font>.';
+ echo 'The <font color="red"><b>wizard.php</b></font> has to be removed after the installation process. Please remove it first to <font color="green"><b><a href="'.$_SERVER['PHP_SELF'].'" title="'.end( explode( "/", $_SERVER['PHP_SELF'] ) ).'">continue</a></b></font>.';
}
die();
}
}
-?>
\ No newline at end of file
More information about the pLog-svn
mailing list