1
0

PHP 5.3 compatibility, upgrade Smarty to 2.6.26

This commit is contained in:
Garvin Hicking
2009-07-14 11:40:16 +00:00
parent a1388d2f15
commit 677df54625
18 changed files with 117 additions and 74 deletions

View File

@@ -237,7 +237,7 @@ class HTTP_Request {
*/ */
function HTTP_Request($url = '', $params = array()) function HTTP_Request($url = '', $params = array())
{ {
$this->_sock = &new Net_Socket(); $this->_sock = new Net_Socket();
$this->_method = HTTP_REQUEST_METHOD_GET; $this->_method = HTTP_REQUEST_METHOD_GET;
$this->_http = HTTP_REQUEST_HTTP_VER_1_1; $this->_http = HTTP_REQUEST_HTTP_VER_1_1;
$this->_requestHeaders = array(); $this->_requestHeaders = array();
@@ -334,7 +334,7 @@ class HTTP_Request {
*/ */
function setURL($url) function setURL($url)
{ {
$this->_url = &new Net_URL($url, $this->_useBrackets); $this->_url = new Net_URL($url, $this->_useBrackets);
if (!empty($this->_url->user) || !empty($this->_url->pass)) { if (!empty($this->_url->user) || !empty($this->_url->pass)) {
$this->setBasicAuth($this->_url->user, $this->_url->pass); $this->setBasicAuth($this->_url->user, $this->_url->pass);
@@ -627,7 +627,7 @@ class HTTP_Request {
$this->_notify('sentRequest'); $this->_notify('sentRequest');
// Read the response // Read the response
$this->_response = &new HTTP_Response($this->_sock, $this->_listeners); $this->_response = new HTTP_Response($this->_sock, $this->_listeners);
$err = $this->_response->process($this->_saveBody && $saveBody); $err = $this->_response->process($this->_saveBody && $saveBody);
} }
@@ -650,7 +650,7 @@ class HTTP_Request {
// Absolute URL // Absolute URL
if (preg_match('/^https?:\/\//i', $redirect)) { if (preg_match('/^https?:\/\//i', $redirect)) {
$this->_url = &new Net_URL($redirect); $this->_url = new Net_URL($redirect);
$this->addHeader('Host', $this->_generateHostHeader()); $this->addHeader('Host', $this->_generateHostHeader());
// Absolute path // Absolute path
} elseif ($redirect[0] == '/') { } elseif ($redirect[0] == '/') {

View File

@@ -91,7 +91,7 @@ class Net_DNSBL_SURBL extends Net_DNSBL {
// Cache hit // Cache hit
} else { } else {
// Cache miss // Cache miss
$http = &new HTTP_Request($this->doubleCcTldFile); $http = new HTTP_Request($this->doubleCcTldFile);
if (!PEAR::isError($http->sendRequest())) { if (!PEAR::isError($http->sendRequest())) {
$data = $http->getResponseBody(); $data = $http->getResponseBody();
} }

View File

@@ -130,7 +130,7 @@ class ONYX_RSS
require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($uri, array('allowRedirects' => true, 'maxRedirects' => 5)); $req = new HTTP_Request($uri, array('allowRedirects' => true, 'maxRedirects' => 5));
$res = $req->sendRequest(); $res = $req->sendRequest();
if (PEAR::isError($res) || $req->getResponseCode() != '200') if (PEAR::isError($res) || $req->getResponseCode() != '200')
@@ -349,7 +349,7 @@ class ONYX_RSS
{ {
require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($uri); $req = new HTTP_Request($uri);
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
serendipity_request_end(); serendipity_request_end();

View File

@@ -1,3 +1,22 @@
Version 2.6.26 (June 18th, 2009)
-------------------------------
- revert super global access changes, and instead rely on
USE_SUPER_GLOBALS for security
Version 2.6.25 (May 19th, 2009)
-------------------------------
- fix E_NOTICE when sessions are disabled (mohrt)
Version 2.6.24 (May 16th, 2009)
-------------------------------
- fix problem introduced with super global changes (mohrt)
Version 2.6.23 (May 13th, 2009)
-------------------------------
- strip backticks from {math} equations (mohrt)
- make PHP super globals read-only from template (mohrt)
- throw error when template exists but not readable (mohrt)
Version 2.6.22 (Dec 17th, 2008) Version 2.6.22 (Dec 17th, 2008)
------------------------------- -------------------------------

View File

@@ -3,7 +3,7 @@ NAME:
Smarty - the PHP compiling template engine Smarty - the PHP compiling template engine
VERSION: 2.6.22 VERSION: 2.6.26
AUTHORS: AUTHORS:

View File

@@ -22,14 +22,14 @@
* smarty-discussion-subscribe@googlegroups.com * smarty-discussion-subscribe@googlegroups.com
* *
* @link http://www.smarty.net/ * @link http://www.smarty.net/
* @version 2.6.22 * @version 2.6.26
* @copyright Copyright: 2001-2005 New Digital Group, Inc. * @copyright Copyright: 2001-2005 New Digital Group, Inc.
* @author Andrei Zmievski <andrei@php.net> * @author Andrei Zmievski <andrei@php.net>
* @access public * @access public
* @package Smarty * @package Smarty
*/ */
/* $Id: Config_File.class.php 2786 2008-09-18 21:04:38Z Uwe.Tews $ */ /* $Id: Config_File.class.php 3149 2009-05-23 20:59:25Z monte.ohrt $ */
/** /**
* Config file reading class * Config file reading class

View File

@@ -27,10 +27,10 @@
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net> * @author Andrei Zmievski <andrei@php.net>
* @package Smarty * @package Smarty
* @version 2.6.22 * @version 2.6.26
*/ */
/* $Id: Smarty.class.php 2785 2008-09-18 21:04:12Z Uwe.Tews $ */ /* $Id: Smarty.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
/** /**
* DIR_SEP isn't used anymore, but third party apps might * DIR_SEP isn't used anymore, but third party apps might
@@ -107,7 +107,7 @@ class Smarty
/** /**
* When set, smarty does uses this value as error_reporting-level. * When set, smarty does uses this value as error_reporting-level.
* *
* @var boolean * @var integer
*/ */
var $error_reporting = null; var $error_reporting = null;
@@ -236,7 +236,8 @@ class Smarty
'INCLUDE_ANY' => false, 'INCLUDE_ANY' => false,
'PHP_TAGS' => false, 'PHP_TAGS' => false,
'MODIFIER_FUNCS' => array('count'), 'MODIFIER_FUNCS' => array('count'),
'ALLOW_CONSTANTS' => false 'ALLOW_CONSTANTS' => false,
'ALLOW_SUPER_GLOBALS' => true
); );
/** /**
@@ -464,7 +465,7 @@ class Smarty
* *
* @var string * @var string
*/ */
var $_version = '2.6.22'; var $_version = '2.6.26';
/** /**
* current template inclusion depth * current template inclusion depth
@@ -1548,7 +1549,7 @@ class Smarty
$params['source_content'] = $this->_read_file($_resource_name); $params['source_content'] = $this->_read_file($_resource_name);
} }
$params['resource_timestamp'] = filemtime($_resource_name); $params['resource_timestamp'] = filemtime($_resource_name);
$_return = is_file($_resource_name); $_return = is_file($_resource_name) && is_readable($_resource_name);
break; break;
default: default:
@@ -1711,7 +1712,7 @@ class Smarty
*/ */
function _read_file($filename) function _read_file($filename)
{ {
if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) { if ( file_exists($filename) && is_readable($filename) && ($fd = @fopen($filename, 'rb')) ) {
$contents = ''; $contents = '';
while (!feof($fd)) { while (!feof($fd)) {
$contents .= fread($fd, 8192); $contents .= fread($fd, 8192);
@@ -1950,7 +1951,7 @@ class Smarty
return $function; return $function;
} }
} }
/**#@-*/ /**#@-*/
} }

View File

@@ -18,15 +18,15 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* @link http://www.smarty.net/ * @link http://smarty.php.net/
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net> * @author Andrei Zmievski <andrei@php.net>
* @version 2.6.22 * @version 2.6.26
* @copyright 2001-2005 New Digital Group, Inc. * @copyright 2001-2005 New Digital Group, Inc.
* @package Smarty * @package Smarty
*/ */
/* $Id: Smarty_Compiler.class.php 2966 2008-12-08 15:10:03Z monte.ohrt $ */ /* $Id: Smarty_Compiler.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
/** /**
* Template compiling class * Template compiling class
@@ -73,9 +73,6 @@ class Smarty_Compiler extends Smarty {
var $_strip_depth = 0; var $_strip_depth = 0;
var $_additional_newline = "\n"; var $_additional_newline = "\n";
var $_phpversion = 0;
/**#@-*/ /**#@-*/
/** /**
@@ -83,8 +80,6 @@ class Smarty_Compiler extends Smarty {
*/ */
function Smarty_Compiler() function Smarty_Compiler()
{ {
$this->_phpversion = substr(phpversion(),0,1);
// matches double quoted strings: // matches double quoted strings:
// "foobar" // "foobar"
// "foo\"bar" // "foo\"bar"
@@ -157,20 +152,16 @@ class Smarty_Compiler extends Smarty {
// $foo->bar($foo->bar) // $foo->bar($foo->bar)
// $foo->bar($foo->bar()) // $foo->bar($foo->bar())
// $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar)) // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar))
// $foo->getBar()->getFoo()
// $foo->getBar()->foo
$this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')'; $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
$this->_obj_restricted_param_regexp = '(?:' $this->_obj_restricted_param_regexp = '(?:'
. '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')' . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')'
. '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)'; . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)';
$this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
$this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
. $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)'; . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)';
$this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
$this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
. '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)'; . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)';
$this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
$this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)'; $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)';
// matches valid modifier syntax: // matches valid modifier syntax:
// |foo // |foo
@@ -1705,8 +1696,6 @@ class Smarty_Compiler extends Smarty {
} }
// replace double quoted literal string with single quotes // replace double quoted literal string with single quotes
$_return = preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return); $_return = preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return);
// escape dollar sign if not printing a var
$_return = preg_replace('~\$(\W)~',"\\\\\$\\1",$_return);
return $_return; return $_return;
} }
@@ -1720,7 +1709,6 @@ class Smarty_Compiler extends Smarty {
function _parse_var($var_expr) function _parse_var($var_expr)
{ {
$_has_math = false; $_has_math = false;
$_has_php4_method_chaining = false;
$_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE); $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE);
if(count($_math_vars) > 1) { if(count($_math_vars) > 1) {
@@ -1833,10 +1821,6 @@ class Smarty_Compiler extends Smarty {
$_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}'; $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}';
} }
} else { } else {
if ($this->_phpversion < 5) {
$_has_php4_method_chaining = true;
$_output .= "; \$_foo = \$_foo";
}
$_output .= $_index; $_output .= $_index;
} }
} elseif (substr($_index, 0, 1) == '(') { } elseif (substr($_index, 0, 1) == '(') {
@@ -1848,12 +1832,7 @@ class Smarty_Compiler extends Smarty {
} }
} }
if ($_has_php4_method_chaining) { return $_output;
$_tmp = str_replace("'","\'",'$_foo = '.$_output.'; return $_foo;');
return "eval('".$_tmp."')";
} else {
return $_output;
}
} }
/** /**
@@ -2068,27 +2047,57 @@ class Smarty_Compiler extends Smarty {
break; break;
case 'get': case 'get':
$compiled_ref = ($this->request_use_auto_globals) ? '$_GET' : "\$GLOBALS['HTTP_GET_VARS']"; if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
$this->_syntax_error("(secure mode) super global access not permitted",
E_USER_WARNING, __FILE__, __LINE__);
return;
}
$compiled_ref = "\$_GET";
break; break;
case 'post': case 'post':
$compiled_ref = ($this->request_use_auto_globals) ? '$_POST' : "\$GLOBALS['HTTP_POST_VARS']"; if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
$this->_syntax_error("(secure mode) super global access not permitted",
E_USER_WARNING, __FILE__, __LINE__);
return;
}
$compiled_ref = "\$_POST";
break; break;
case 'cookies': case 'cookies':
$compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' : "\$GLOBALS['HTTP_COOKIE_VARS']"; if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
$this->_syntax_error("(secure mode) super global access not permitted",
E_USER_WARNING, __FILE__, __LINE__);
return;
}
$compiled_ref = "\$_COOKIE";
break; break;
case 'env': case 'env':
$compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' : "\$GLOBALS['HTTP_ENV_VARS']"; if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
$this->_syntax_error("(secure mode) super global access not permitted",
E_USER_WARNING, __FILE__, __LINE__);
return;
}
$compiled_ref = "\$_ENV";
break; break;
case 'server': case 'server':
$compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' : "\$GLOBALS['HTTP_SERVER_VARS']"; if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
$this->_syntax_error("(secure mode) super global access not permitted",
E_USER_WARNING, __FILE__, __LINE__);
return;
}
$compiled_ref = "\$_SERVER";
break; break;
case 'session': case 'session':
$compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' : "\$GLOBALS['HTTP_SESSION_VARS']"; if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
$this->_syntax_error("(secure mode) super global access not permitted",
E_USER_WARNING, __FILE__, __LINE__);
return;
}
$compiled_ref = "\$_SESSION";
break; break;
/* /*
@@ -2096,8 +2105,13 @@ class Smarty_Compiler extends Smarty {
* compiler. * compiler.
*/ */
case 'request': case 'request':
if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
$this->_syntax_error("(secure mode) super global access not permitted",
E_USER_WARNING, __FILE__, __LINE__);
return;
}
if ($this->request_use_auto_globals) { if ($this->request_use_auto_globals) {
$compiled_ref = '$_REQUEST'; $compiled_ref = "\$_REQUEST";
break; break;
} else { } else {
$this->_init_smarty_vars = true; $this->_init_smarty_vars = true;

View File

@@ -27,7 +27,8 @@ function smarty_function_math($params, &$smarty)
return; return;
} }
$equation = $params['equation']; // strip out backticks, not necessary for math
$equation = str_replace('`','',$params['equation']);
// make sure parenthesis are balanced // make sure parenthesis are balanced
if (substr_count($equation,"(") != substr_count($equation,")")) { if (substr_count($equation,"(") != substr_count($equation,")")) {

View File

@@ -3,6 +3,8 @@
Version 1.5 () Version 1.5 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* Upgrade to Smarty 2.6.26
* Removed inline styles of the s9y media insertion, they will now * Removed inline styles of the s9y media insertion, they will now
properly utilize CSS classes (defined in the new file properly utilize CSS classes (defined in the new file
style_fallback.css). Also added support for entering "ALT/TITLE" style_fallback.css). Also added support for entering "ALT/TITLE"

View File

@@ -243,7 +243,7 @@ switch ($serendipity['GET']['adminAction']) {
$options = array(); $options = array();
serendipity_plugin_api::hook_event('backend_http_request', $options, 'image'); serendipity_plugin_api::hook_event('backend_http_request', $options, 'image');
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($serendipity['POST']['imageurl'], $options); $req = new HTTP_Request($serendipity['POST']['imageurl'], $options);
// Try to get the URL // Try to get the URL
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {

View File

@@ -78,7 +78,7 @@ class Serendipity_Import_Blogger extends Serendipity_Import {
'default' => $tokens['Token'])); 'default' => $tokens['Token']));
// Prepare blog list request // Prepare blog list request
$req = &new HTTP_Request('http://www.blogger.com/feeds/default/blogs'); $req = new HTTP_Request('http://www.blogger.com/feeds/default/blogs');
$req->addHeader('GData-Version', 2); $req->addHeader('GData-Version', 2);
$req->addHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"'); $req->addHeader('Authorization', 'AuthSub token="'. $tokens['Token'] .'"');
@@ -140,7 +140,7 @@ class Serendipity_Import_Blogger extends Serendipity_Import {
$this->getTransTable(); $this->getTransTable();
// Prepare export request // Prepare export request
$req = &new HTTP_Request('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive'); $req = new HTTP_Request('http://www.blogger.com/feeds/'. $this->data['bId'] .'/archive');
$req->addHeader('GData-Version', 2); $req->addHeader('GData-Version', 2);
$req->addHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"'); $req->addHeader('Authorization', 'AuthSub token="'. $this->data['bAuthToken'] .'"');

View File

@@ -138,7 +138,7 @@ class Serendipity_Import_Generic extends Serendipity_Import {
$uri = $this->data['url']; $uri = $this->data['url'];
require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($uri, array('allowRedirects' => true, 'maxRedirects' => 5)); $req = new HTTP_Request($uri, array('allowRedirects' => true, 'maxRedirects' => 5));
$res = $req->sendRequest(); $res = $req->sendRequest();
if (PEAR::isError($res) || $req->getResponseCode() != '200') { if (PEAR::isError($res) || $req->getResponseCode() != '200') {
@@ -320,7 +320,7 @@ class Serendipity_Import_Generic extends Serendipity_Import {
return $this->import_wpxrss(); return $this->import_wpxrss();
} }
$c = &new Onyx_RSS($this->data['charset']); $c = new Onyx_RSS($this->data['charset']);
$c->parse($this->data['url']); $c->parse($this->data['url']);
$this->data['encoding'] = $c->rss['encoding']; $this->data['encoding'] = $c->rss['encoding'];

View File

@@ -316,4 +316,10 @@ if (!isset($serendipity['serendipityPath'])) {
$serendipity['indexFile'] = 'index.php'; $serendipity['indexFile'] = 'index.php';
if (function_exists('date_default_timezone_get')) {
// We currently offer no Timezone setting (only offset to UTC), so we
// rely on the OS' timezone.
date_default_timezone_set(date_default_timezone_get());
}
/* vim: set sts=4 ts=4 expandtab : */ /* vim: set sts=4 ts=4 expandtab : */

View File

@@ -130,7 +130,7 @@ function _serendipity_send($loc, $data, $contenttype = null) {
serendipity_plugin_api::hook_event('backend_http_request', $options, 'trackback_send'); serendipity_plugin_api::hook_event('backend_http_request', $options, 'trackback_send');
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($uri, $options); $req = new HTTP_Request($uri, $options);
if (isset($contenttype)){ if (isset($contenttype)){
$req->addHeader('Content-Type', $contenttype); $req->addHeader('Content-Type', $contenttype);
} }
@@ -271,7 +271,7 @@ global $serendipity;
$options = array('allowRedirects' => true, 'maxRedirects' => 5, 'method' => 'GET'); $options = array('allowRedirects' => true, 'maxRedirects' => 5, 'method' => 'GET');
serendipity_plugin_api::hook_event('backend_http_request', $options, 'trackback_detect'); serendipity_plugin_api::hook_event('backend_http_request', $options, 'trackback_detect');
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($parsed_loc, $options); $req = new HTTP_Request($parsed_loc, $options);
$res = $req->sendRequest(); $res = $req->sendRequest();
if (PEAR::isError($res)) { if (PEAR::isError($res)) {
@@ -503,7 +503,7 @@ function fetchPingbackData( &$comment) {
if (function_exists('serendipity_request_start')) serendipity_request_start(); if (function_exists('serendipity_request_start')) serendipity_request_start();
// Request the page // Request the page
$req = &new HTTP_Request($url, array('allowRedirects' => true, 'maxRedirects' => 5, 'timeout' => 20, 'readTimeout' => array(5,0))); $req = new HTTP_Request($url, array('allowRedirects' => true, 'maxRedirects' => 5, 'timeout' => 20, 'readTimeout' => array(5,0)));
// code 200: OK, code 30x: REDIRECTION // code 200: OK, code 30x: REDIRECTION
$responses = "/(200 OK)|(30[0-9] Found)/"; // |(30[0-9] Moved) $responses = "/(200 OK)|(30[0-9] Found)/"; // |(30[0-9] Moved)

View File

@@ -533,7 +533,7 @@ var $filter_defaults;
} else { } else {
$this->log($this->logfile, $eventData['id'], 'AKISMET_SERVER', 'Using Akismet server at ' . $server, $addData); $this->log($this->logfile, $eventData['id'], 'AKISMET_SERVER', 'Using Akismet server at ' . $server, $addData);
} }
$req = &new HTTP_Request( $req = new HTTP_Request(
'http://' . $server . '/1.1/verify-key', 'http://' . $server . '/1.1/verify-key',
$opt $opt
); );
@@ -558,7 +558,7 @@ var $filter_defaults;
break; break;
} }
$req = &new HTTP_Request( $req = new HTTP_Request(
'http://' . $api_key . '.' . $server . '/1.1/comment-check', 'http://' . $api_key . '.' . $server . '/1.1/comment-check',
$opt $opt
); );
@@ -602,7 +602,7 @@ var $filter_defaults;
} else { } else {
$data = ''; $data = '';
$req = &new HTTP_Request('http://spam.blogg.de/blacklist.txt'); $req = new HTTP_Request('http://spam.blogg.de/blacklist.txt');
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
if (file_exists($target) && filesize($target) > 0) { if (file_exists($target) && filesize($target) > 0) {
@@ -978,7 +978,7 @@ var $filter_defaults;
require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
if (function_exists('serendipity_request_start')) serendipity_request_start(); if (function_exists('serendipity_request_start')) serendipity_request_start();
$req = &new HTTP_Request($addData['url'], array('allowRedirects' => true, 'maxRedirects' => 5, 'readTimeout' => array(5,0))); $req = new HTTP_Request($addData['url'], array('allowRedirects' => true, 'maxRedirects' => 5, 'readTimeout' => array(5,0)));
$is_valid = false; $is_valid = false;
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
$is_valid = false; $is_valid = false;

View File

@@ -397,7 +397,7 @@ class serendipity_event_spartacus extends serendipity_event
serendipity_plugin_api::hook_event('backend_http_request', $options, 'spartacus'); serendipity_plugin_api::hook_event('backend_http_request', $options, 'spartacus');
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($url, $options); $req = new HTTP_Request($url, $options);
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
$resolved_url = $url . ' (IP ' . $url_ip . ')'; $resolved_url = $url . ' (IP ' . $url_ip . ')';
@@ -441,7 +441,7 @@ class serendipity_event_spartacus extends serendipity_event
$health_options = $options; $health_options = $options;
serendipity_plugin_api::hook_event('backend_http_request', $health_options, 'spartacus_health'); serendipity_plugin_api::hook_event('backend_http_request', $health_options, 'spartacus_health');
$health_req = &new HTTP_Request($health_url, $health_options); $health_req = new HTTP_Request($health_url, $health_options);
$health_result = $health_req->sendRequest(); $health_result = $health_req->sendRequest();
if (PEAR::isError($health_result)) { if (PEAR::isError($health_result)) {
$fp = @fsockopen('www.google.com', 80, $errno, $errstr); $fp = @fsockopen('www.google.com', 80, $errno, $errstr);

View File

@@ -48,7 +48,7 @@ class s9y_remoterss_XMLTree {
function GetXMLTree($file) { function GetXMLTree($file) {
require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($file); $req = new HTTP_Request($file);
if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') { if (PEAR::isError($req->sendRequest()) || $req->getResponseCode() != '200') {
$data = file_get_contents($file); $data = file_get_contents($file);
@@ -424,7 +424,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
return true; return true;
require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
serendipity_request_start(); serendipity_request_start();
$req = &new HTTP_Request($uri); $req = new HTTP_Request($uri);
if (PEAR::isError($req->sendRequest()) || !preg_match('@^[23]..@', $req->getResponseCode())) { if (PEAR::isError($req->sendRequest()) || !preg_match('@^[23]..@', $req->getResponseCode())) {
serendipity_request_end(); serendipity_request_end();
@@ -494,7 +494,7 @@ class serendipity_plugin_remoterss extends serendipity_plugin {
// Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog. // Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog.
@touch($feedcache); @touch($feedcache);
require_once S9Y_PEAR_PATH . 'Onyx/RSS.php'; require_once S9Y_PEAR_PATH . 'Onyx/RSS.php';
$c = &new Onyx_RSS($charset); $c = new Onyx_RSS($charset);
$this->debug('Running Onyx Parser'); $this->debug('Running Onyx Parser');
$c->parse($rssuri); $c->parse($rssuri);
$this->encoding = $c->rss['encoding']; $this->encoding = $c->rss['encoding'];