From 708d702ca8584b2ef80996895ed89566bbed96b3 Mon Sep 17 00:00:00 2001 From: vargenau Date: Thu, 17 Jun 2010 11:34:55 +0000 Subject: [PATCH] We assume PHP >= 4.3.10 git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@7541 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/DbaDatabase.php | 3 +-- lib/HttpClient.php | 3 +-- lib/WikiDB.php | 15 --------------- lib/WikiPluginCached.php | 7 +------ lib/XMLRPC/utils.php | 23 ++--------------------- lib/XmlElement.php | 2 +- lib/plugin/SyntaxHighlighter.php | 5 +---- lib/stdlib.php | 10 +++------- lib/ziplib.php | 5 +---- 9 files changed, 11 insertions(+), 62 deletions(-) diff --git a/lib/DbaDatabase.php b/lib/DbaDatabase.php index de9661375..eb8add4f6 100644 --- a/lib/DbaDatabase.php +++ b/lib/DbaDatabase.php @@ -50,8 +50,7 @@ class DbaDatabase $mode = 'r'; } - // lock supported since 4.3.0: - if (check_php_version(4,3,0) and (strlen($mode) == 1)) { + if ((strlen($mode) == 1)) { // PHP 4.3.x Windows lock bug workaround: http://bugs.php.net/bug.php?id=23975 if (isWindows()) { $mode .= "-"; // suppress locking, or diff --git a/lib/HttpClient.php b/lib/HttpClient.php index 50b7d95f1..22c6a2b7e 100644 --- a/lib/HttpClient.php +++ b/lib/HttpClient.php @@ -121,8 +121,7 @@ class HttpClient { } return false; } - if (check_php_version(4,3,0)) - socket_set_timeout($fp, $this->timeout); + socket_set_timeout($fp, $this->timeout); if ( $this->method == 'POST' and preg_match("/\/", $this->postdata)) $request = $this->buildRequest("text/xml"); //xmlrpc else if ( $this->method == 'POST' and strstr("\r\nContent-Disposition: form-data; filename=", diff --git a/lib/WikiDB.php b/lib/WikiDB.php index d930c4ec5..3e0d8a997 100644 --- a/lib/WikiDB.php +++ b/lib/WikiDB.php @@ -275,15 +275,6 @@ class WikiDB { */ function getAllPages($include_empty=false, $sortby='', $limit='', $exclude='') { - // HACK: memory_limit=8M will fail on too large pagesets. old php on unix only! - if (USECACHE) { - $mem = ini_get("memory_limit"); - if ($mem and !$limit and !isWindows() and !check_php_version(4,3)) { - $limit = 450; - $GLOBALS['request']->setArg('limit', $limit); - $GLOBALS['request']->setArg('paging', 'auto'); - } - } $result = $this->_backend->get_all_pages($include_empty, $sortby, $limit, $exclude); return new WikiDB_PageIterator($this, $result, @@ -527,12 +518,6 @@ class WikiDB { if ($updateWikiLinks) { $lookbehind = "/(?<=[\W:])\Q"; $lookahead = "\E(?=[\W:])/"; - if (!check_php_version(4,3,3)) { - $lookbehind = "/(?<=[\W:])"; - $lookahead = "(?=[\W:])/"; - $from = preg_quote($from, "/"); - $to = preg_quote($to, "/"); - } require_once('lib/plugin/WikiAdminSearchReplace.php'); $links = $oldpage->getBackLinks(); while ($linked_page = $links->next()) { diff --git a/lib/WikiPluginCached.php b/lib/WikiPluginCached.php index 09eb1d5ab..7a02ad129 100644 --- a/lib/WikiPluginCached.php +++ b/lib/WikiPluginCached.php @@ -1119,12 +1119,7 @@ class WikiPluginCached extends WikiPlugin // run "echo $source | $commandLine" and return result function filterThroughCmd($source, $commandLine) { - if (check_php_version(4,3,0)) - return $this->newFilterThroughCmd($source, $commandLine); - elseif (strlen($source) < 255) - return $this->oldFilterThroughCmd($source, $commandLine); - else - return $this->oldFilterThroughCmd_File($source, $commandLine); + return $this->newFilterThroughCmd($source, $commandLine); } /** diff --git a/lib/XMLRPC/utils.php b/lib/XMLRPC/utils.php index 966d118c8..0243f8dfb 100644 --- a/lib/XMLRPC/utils.php +++ b/lib/XMLRPC/utils.php @@ -211,27 +211,8 @@ function xu_rpc_http_concise($params) { $response_buf = ""; if ($host && $uri && $port) { $request_xml = xmlrpc_encode_request($method, $args, $output); - if (isWindows() and !check_php_version(4,3,0)) { - include_once("lib/HttpClient.php"); - $http = new HttpClient($host, $port); - if ($timeout) - $http->timeout = $timeout; - $http->setDebug($debug); - // todo: new auth and/or session cookies - if ($user) - $http->setAuthorization($user, $pass); - if ($cookies) - $http->setCookies($cookies); - if ($http->post($uri, $request_xml)) - $response_buf = $http->content; - else { - $response_buf = $http->errormsg; - return $response_buf; - } - } else { - $response_buf = xu_query_http_post($request_xml, $host, $uri, $port, $debug, - $timeout, $user, $pass, $secure); - } + $response_buf = xu_query_http_post($request_xml, $host, $uri, $port, $debug, + $timeout, $user, $pass, $secure); $retval = find_and_decode_xml($response_buf, $debug); } return $retval; diff --git a/lib/XmlElement.php b/lib/XmlElement.php index 16cc0ceac..31958973c 100644 --- a/lib/XmlElement.php +++ b/lib/XmlElement.php @@ -536,7 +536,7 @@ class FormattedText { */ function XmlContent_quote ($string) { if (!$string) return $string; - if (check_php_version(4,1) and isset($GLOBALS['charset']) + if (isset($GLOBALS['charset']) and (!defined('IGNORE_CHARSET_NOT_SUPPORTED_WARNING') or !IGNORE_CHARSET_NOT_SUPPORTED_WARNING)) { return htmlspecialchars($string, ENT_COMPAT, $GLOBALS['charset']); diff --git a/lib/plugin/SyntaxHighlighter.php b/lib/plugin/SyntaxHighlighter.php index 64e72f3d9..ca48374c2 100644 --- a/lib/plugin/SyntaxHighlighter.php +++ b/lib/plugin/SyntaxHighlighter.php @@ -161,10 +161,7 @@ extends WikiPlugin if (!empty($color)) $args .= " --style $color --inline-css"; if (!empty($style)) $args .= " -F $style"; $commandLine = HIGHLIGHT_EXE . "$args -q -X -f -S $syntax"; - if (check_php_version(4,3,0)) - $code = $this->newFilterThroughCmd($source, $commandLine); - else - $code = $this->oldFilterThroughCmd($source, $commandLine); + $code = $this->newFilterThroughCmd($source, $commandLine); if (empty($code)) return $this->error(fmt("Couldn't start commandline '%s'",$commandLine)); $pre = HTML::pre(HTML::raw($code)); diff --git a/lib/stdlib.php b/lib/stdlib.php index 7cf6c26ac..86b70408b 100644 --- a/lib/stdlib.php +++ b/lib/stdlib.php @@ -529,8 +529,6 @@ function LinkImage($url, $alt = "") { ; elseif (! preg_match("/\.$force_img$/i", $url)) ; // only valid image extensions or scripts assumed to generate images - elseif (!check_php_version(4,3) and preg_match("/^http.+\.png$/i",$url)) - ; // it's safe to assume that this will fail. elseif (preg_match("/^http/",$url)) { // external url $size = @getimagesize($url); } else { // local file @@ -1050,11 +1048,9 @@ function ConvertOldMarkup ($text, $markup_type = "block") { global $WikiNameRegexp, $request; $bang_esc[] = "(?:" . ALLOWED_PROTOCOLS . "):[^\s<>\[\]\"'()]*[^\s<>\[\]\"'(),.?]"; // before 4.3.9 pcre had a memory release bug, which might hit us here. so be safe. - if (check_php_version(4,3,9)) { - $map = getInterwikiMap(); - if ($map_regex = $map->getRegexp()) + $map = getInterwikiMap(); + if ($map_regex = $map->getRegexp()) $bang_esc[] = $map_regex . ":[^\\s.,;?()]+"; // FIXME: is this really needed? - } $bang_esc[] = $WikiNameRegexp; $orig[] = '/!((?:' . join(')|(', $bang_esc) . '))/'; $repl[] = '~\\1'; @@ -1751,7 +1747,7 @@ function explodePageList($input, $include_empty=false, $sortby='pagename', function isa ($object, $class) { //if (check_php_version(5)) // return $object instanceof $class; - if (check_php_version(4,2) and !check_php_version(5)) + if (!check_php_version(5)) return is_a($object, $class); $lclass = check_php_version(5) ? $class : strtolower($class); diff --git a/lib/ziplib.php b/lib/ziplib.php index a554c0510..0bf9fd3c8 100644 --- a/lib/ziplib.php +++ b/lib/ziplib.php @@ -268,10 +268,7 @@ class ZipWriter function addSrcFile ($target, $src, $attrib = false) { if (empty($attrib['mtime'])) $attrib = array('mtime' => filemtime($src), 'is_ascii' => 0); - if (check_php_version(4,3)) - $this->addRegularFile($target, file_get_contents($src), $attrib); - else - $this->addRegularFile($target, join('', file($src)), $attrib); + $this->addRegularFile($target, file_get_contents($src), $attrib); } function addRegularFile ($filename, $content, $attrib = false) { -- 2.45.0