From af53c06a4163ed6ef67babe3736c5f96b6ccc502 Mon Sep 17 00:00:00 2001 From: vargenau Date: Thu, 15 Jul 2010 19:22:14 +0000 Subject: [PATCH] Protect set_magic_quotes_runtime with PHP version git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@7617 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/fpdf.php | 12 ++++++++---- lib/fpdf/chinese.php | 13 +++++++++---- lib/fpdf/japanese.php | 10 +++++++--- lib/nusoap/nusoap.php | 8 ++++++-- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/lib/fpdf.php b/lib/fpdf.php index fe3c0cd6f..39fc4c23e 100644 --- a/lib/fpdf.php +++ b/lib/fpdf.php @@ -1073,8 +1073,10 @@ class FPDF $this->_out('<>'); $this->_out('endobj'); } - $mqr=get_magic_quotes_runtime(); - set_magic_quotes_runtime(0); + if (!check_php_version(5,3)) { + $mqr=get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + } foreach($this->FontFiles as $file=>$info) { //Font file embedding $this->_newobj(); @@ -1096,7 +1098,9 @@ class FPDF fclose($f); $this->_out('endobj'); } - set_magic_quotes_runtime($mqr); + if (!check_php_version(5,3)) { + set_magic_quotes_runtime($mqr); + } foreach($this->fonts as $k=>$font) { //Font objects $this->fonts[$k]['n']=$this->n+1; @@ -1558,4 +1562,4 @@ if (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) and // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: -?> \ No newline at end of file +?> diff --git a/lib/fpdf/chinese.php b/lib/fpdf/chinese.php index 59720b279..ece77477f 100644 --- a/lib/fpdf/chinese.php +++ b/lib/fpdf/chinese.php @@ -322,8 +322,11 @@ class PDF_Chinese extends PDF $this->_out('<>'); $this->_out('endobj'); } - $mqr=get_magic_quotes_runtime(); - set_magic_quotes_runtime(0); + + if (!check_php_version(5,3)) { + $mqr=get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + } foreach($this->FontFiles as $file=>$info) { //Font file embedding @@ -346,7 +349,9 @@ class PDF_Chinese extends PDF fclose($f); $this->_out('endobj'); } - set_magic_quotes_runtime($mqr); + if (!check_php_version(5,3)) { + set_magic_quotes_runtime($mqr); + } foreach($this->fonts as $k=>$font) { //Font objects @@ -456,4 +461,4 @@ class PDF_Chinese extends PDF // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: -?> \ No newline at end of file +?> diff --git a/lib/fpdf/japanese.php b/lib/fpdf/japanese.php index 5490ea61a..96446bdfd 100644 --- a/lib/fpdf/japanese.php +++ b/lib/fpdf/japanese.php @@ -302,8 +302,10 @@ class PDF_Japanese extends PDF { $this->_out('<>'); $this->_out('endobj'); } - $mqr=get_magic_quotes_runtime(); - set_magic_quotes_runtime(0); + if (!check_php_version(5,3)) { + $mqr=get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + } foreach($this->FontFiles as $file=>$info) { //Font file embedding $this->_newobj(); @@ -325,7 +327,9 @@ class PDF_Japanese extends PDF { fclose($f); $this->_out('endobj'); } - set_magic_quotes_runtime($mqr); + if (!check_php_version(5,3)) { + set_magic_quotes_runtime($mqr); + } foreach($this->fonts as $k=>$font) { //Font objects $this->_newobj(); diff --git a/lib/nusoap/nusoap.php b/lib/nusoap/nusoap.php index 88b2b81ef..5fd5497ee 100644 --- a/lib/nusoap/nusoap.php +++ b/lib/nusoap/nusoap.php @@ -1390,7 +1390,9 @@ class soap_transport_http extends nusoap_base { if($this->encoding != '' && function_exists('gzdeflate')){ $this->outgoing_payload .= "Accept-Encoding: $this->encoding\r\n". "Connection: close\r\n"; - set_magic_quotes_runtime(0); + if (!check_php_version(5,3)) { + set_magic_quotes_runtime(0); + } } // set soapaction if($this->useSOAPAction){ @@ -1556,7 +1558,9 @@ class soap_transport_http extends nusoap_base { if(function_exists('gzdeflate')){ $encoding_headers = "Accept-Encoding: $this->encoding\r\n". "Connection: close\r\n"; - set_magic_quotes_runtime(0); + if (!check_php_version(5,3)) { + set_magic_quotes_runtime(0); + } } } -- 2.45.0