Last active
January 20, 2018 10:06
-
-
Save hgati/f773f94bbeb1e5d6c32edc46b4076c24 to your computer and use it in GitHub Desktop.
Support PHP v7.0.22 On Magento 1.7.0.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -61,8 +61,8 @@ | |
$links[(int)$linkedProductId] = array(); | |
foreach ($collection->getLinkModel()->getAttributes() as $attribute) { | |
- if (isset($data->$attribute['code'])) { | |
- $links[(int)$linkedProductId][$attribute['code']] = $data->$attribute['code']; | |
+ if (isset(($data->{$attribute)['code']})) { | |
+ $links[(int)$linkedProductId][$attribute['code']] = $data->{$attribute['code']}; | |
} | |
} | |
@@ -118,8 +118,8 @@ | |
} | |
foreach ($collection->getLinkModel()->getAttributes() as $attribute) { | |
- if (isset($data->$attribute['code'])) { | |
- $links[(int)$linkedProductId][$attribute['code']] = $data->$attribute['code']; | |
+ if (isset($data->{$attribute['code']})) { | |
+ $links[(int)$linkedProductId][$attribute['code']] = $data->{$attribute['code']}; | |
} | |
} | |
Index: app/code/core/Mage/Core/Helper/Abstract.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/code/core/Mage/Core/Helper/Abstract.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ app/code/core/Mage/Core/Helper/Abstract.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -235,7 +235,7 @@ | |
*/ | |
public function removeTags($html) | |
{ | |
- $html = preg_replace("# <(?![/a-z]) | (?<=\s)>(?![a-z]) #exi", "htmlentities('$0')", $html); | |
+ $html = preg_replace("# <(?![/a-z]) | (?<=\s)>(?![a-z]) #xi", function($m){ return htmlentities($m[0]); }, $html); | |
$html = strip_tags($html); | |
return htmlspecialchars_decode($html); | |
} | |
Index: app/code/core/Mage/Core/Model/Layout.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/code/core/Mage/Core/Model/Layout.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ app/code/core/Mage/Core/Model/Layout.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -552,7 +552,7 @@ | |
$out = ''; | |
if (!empty($this->_output)) { | |
foreach ($this->_output as $callback) { | |
- $out .= $this->getBlock($callback[0])->$callback[1](); | |
+ $out .= $this->getBlock($callback[0])->{$callback[1]}(); | |
} | |
} | |
Index: app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -35,8 +35,7 @@ | |
public function process() | |
{ | |
// Retrieve the XML sent in the HTTP POST request to the ResponseHandler | |
- $xmlResponse = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? | |
- $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input"); | |
+ $xmlResponse = file_get_contents("php://input"); | |
if (get_magic_quotes_gpc()) { | |
$xmlResponse = stripslashes($xmlResponse); | |
} | |
Index: app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -247,7 +247,7 @@ | |
$data = $this->_attributeOverrides[$attribute->getAttributeCode()]; | |
if (isset($data['options_method']) && method_exists($this, $data['options_method'])) { | |
- $data['filter_options'] = $this->$data['options_method'](); | |
+ $data['filter_options'] = $this->{$data['options_method']}(); | |
} | |
$attribute->addData($data); | |
} | |
Index: app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -96,7 +96,7 @@ | |
$data = $this->_attributeOverrides[$attribute->getAttributeCode()]; | |
if (isset($data['options_method']) && method_exists($this, $data['options_method'])) { | |
- $data['filter_options'] = $this->$data['options_method'](); | |
+ $data['filter_options'] = $this->{$data['options_method']}(); | |
} | |
$attribute->addData($data); | |
Index: app/code/core/Mage/ImportExport/Model/Import/Uploader.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- app/code/core/Mage/ImportExport/Model/Import/Uploader.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ app/code/core/Mage/ImportExport/Model/Import/Uploader.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -132,7 +132,7 @@ | |
//run validate callbacks | |
foreach ($this->_validateCallbacks as $params) { | |
if (is_object($params['object']) && method_exists($params['object'], $params['method'])) { | |
- $params['object']->$params['method']($filePath); | |
+ $params['object']->{$params['method']}($filePath); | |
} | |
} | |
} | |
Index: downloader/lib/Mage/Connect/Packager.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- downloader/lib/Mage/Connect/Packager.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ downloader/lib/Mage/Connect/Packager.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -849,13 +849,13 @@ | |
$names = array("pMin","pMax","hasMin","hasMax"); | |
for ($i=0, $c=count($names); $i<$c; $i++) { | |
- if(!isset($$names[$i])) { | |
+ if(!isset(${$names[$i]})) { | |
continue; | |
} | |
- if(false !== $$names[$i]) { | |
+ if(false !== ${$names[$i]}) { | |
continue; | |
} | |
- $$names[$i] = $i % 2 == 0 ? "0" : "999999999"; | |
+ ${$names[$i]} = $i % 2 == 0 ? "0" : "999999999"; | |
} | |
if(!$cache->hasVersionRangeIntersect($pMin,$pMax, $hasMin, $hasMax)) { | |
Index: errors/processor.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- errors/processor.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ errors/processor.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -558,7 +558,7 @@ | |
*/ | |
protected function _validate() | |
{ | |
- $email = eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $this->postData['email']); | |
+ $email = preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $this->postData['email']); | |
return ($this->postData['firstName'] && $this->postData['lastName'] && $email); | |
} | |
Index: lib/Mage/Connect/Packager.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/Mage/Connect/Packager.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/Mage/Connect/Packager.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -564,13 +564,13 @@ | |
$names = array("pMin","pMax","hasMin","hasMax"); | |
for($i=0, $c=count($names); $i<$c; $i++) { | |
- if(!isset($$names[$i])) { | |
+ if(!isset(${$names[$i]})) { | |
continue; | |
} | |
- if(false !== $$names[$i]) { | |
+ if(false !== ${$names[$i]}) { | |
continue; | |
} | |
- $$names[$i] = $i % 2 == 0 ? "0" : "999999999"; | |
+ ${$names[$i]} = $i % 2 == 0 ? "0" : "999999999"; | |
} | |
if(!$cache->hasVersionRangeIntersect($pMin,$pMax, $hasMin, $hasMax)) { | |
Index: lib/PEAR/HTTP/Request.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/HTTP/Request.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/HTTP/Request.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -309,59 +309,64 @@ | |
* </ul> | |
* @access public | |
*/ | |
- function HTTP_Request($url = '', $params = array()) | |
- { | |
- $this->_method = HTTP_REQUEST_METHOD_GET; | |
- $this->_http = HTTP_REQUEST_HTTP_VER_1_1; | |
- $this->_requestHeaders = array(); | |
- $this->_postData = array(); | |
- $this->_body = null; | |
+ public function __construct($url = '', $params = array()) | |
+ { | |
+ $this->_method = HTTP_REQUEST_METHOD_GET; | |
+ $this->_http = HTTP_REQUEST_HTTP_VER_1_1; | |
+ $this->_requestHeaders = array(); | |
+ $this->_postData = array(); | |
+ $this->_body = null; | |
- $this->_user = null; | |
- $this->_pass = null; | |
+ $this->_user = null; | |
+ $this->_pass = null; | |
- $this->_proxy_host = null; | |
- $this->_proxy_port = null; | |
- $this->_proxy_user = null; | |
- $this->_proxy_pass = null; | |
+ $this->_proxy_host = null; | |
+ $this->_proxy_port = null; | |
+ $this->_proxy_user = null; | |
+ $this->_proxy_pass = null; | |
- $this->_allowRedirects = false; | |
- $this->_maxRedirects = 3; | |
- $this->_redirects = 0; | |
+ $this->_allowRedirects = false; | |
+ $this->_maxRedirects = 3; | |
+ $this->_redirects = 0; | |
- $this->_timeout = null; | |
- $this->_response = null; | |
+ $this->_timeout = null; | |
+ $this->_response = null; | |
- foreach ($params as $key => $value) { | |
- $this->{'_' . $key} = $value; | |
- } | |
+ foreach ($params as $key => $value) { | |
+ $this->{'_' . $key} = $value; | |
+ } | |
- if (!empty($url)) { | |
- $this->setURL($url); | |
- } | |
+ if (!empty($url)) { | |
+ $this->setURL($url); | |
+ } | |
- // Default useragent | |
- $this->addHeader('User-Agent', 'PEAR HTTP_Request class ( http://pear.php.net/ )'); | |
+ // Default useragent | |
+ $this->addHeader('User-Agent', 'PEAR HTTP_Request class ( http://pear.php.net/ )'); | |
- // We don't do keep-alives by default | |
- $this->addHeader('Connection', 'close'); | |
+ // We don't do keep-alives by default | |
+ $this->addHeader('Connection', 'close'); | |
- // Basic authentication | |
- if (!empty($this->_user)) { | |
- $this->addHeader('Authorization', 'Basic ' . base64_encode($this->_user . ':' . $this->_pass)); | |
- } | |
+ // Basic authentication | |
+ if (!empty($this->_user)) { | |
+ $this->addHeader('Authorization', 'Basic ' . base64_encode($this->_user . ':' . $this->_pass)); | |
+ } | |
- // Proxy authentication (see bug #5913) | |
- if (!empty($this->_proxy_user)) { | |
- $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($this->_proxy_user . ':' . $this->_proxy_pass)); | |
- } | |
+ // Proxy authentication (see bug #5913) | |
+ if (!empty($this->_proxy_user)) { | |
+ $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($this->_proxy_user . ':' . $this->_proxy_pass)); | |
+ } | |
- // Use gzip encoding if possible | |
- if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib')) { | |
- $this->addHeader('Accept-Encoding', 'gzip'); | |
- } | |
- } | |
+ // Use gzip encoding if possible | |
+ if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib')) { | |
+ $this->addHeader('Accept-Encoding', 'gzip'); | |
+ } | |
+ } | |
+ public function HTTP_Request($url = '', $params = array()) | |
+ { | |
+ self::__construct($url, $params); | |
+ } | |
+ | |
/** | |
* Generates a Host header for HTTP/1.1 requests | |
* | |
@@ -1195,12 +1200,17 @@ | |
* @param Net_Socket socket to read the response from | |
* @param array listeners attached to request | |
*/ | |
- function HTTP_Response(&$sock, &$listeners) | |
- { | |
- $this->_sock =& $sock; | |
- $this->_listeners =& $listeners; | |
- } | |
+ public function __construct(&$sock, &$listeners) | |
+ { | |
+ $this->_sock =& $sock; | |
+ $this->_listeners =& $listeners; | |
+ } | |
+ public function HTTP_Response(&$sock, &$listeners) | |
+ { | |
+ self::__construct(&$sock, &$listeners); | |
+ } | |
+ | |
/** | |
* Processes a HTTP response | |
Index: lib/PEAR/HTTP/Request/Listener.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/HTTP/Request/Listener.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/HTTP/Request/Listener.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -67,11 +67,16 @@ | |
* | |
* @access public | |
*/ | |
- function HTTP_Request_Listener() | |
- { | |
- $this->_id = md5(uniqid('http_request_', 1)); | |
- } | |
+ public function __construct() | |
+ { | |
+ $this->_id = md5(uniqid('http_request_', 1)); | |
+ } | |
+ public function HTTP_Request_Listener() | |
+ { | |
+ self::__construct(); | |
+ } | |
+ | |
/** | |
* Returns the listener's identifier | |
Index: lib/PEAR/Mail/mime.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/Mail/mime.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/Mail/mime.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -176,20 +176,25 @@ | |
* | |
* @access public | |
*/ | |
- function Mail_mime($crlf = "\r\n") | |
- { | |
- $this->_setEOL($crlf); | |
- $this->_build_params = array( | |
- 'head_encoding' => 'quoted-printable', | |
- 'text_encoding' => '7bit', | |
- 'html_encoding' => 'quoted-printable', | |
- '7bit_wrap' => 998, | |
- 'html_charset' => 'ISO-8859-1', | |
- 'text_charset' => 'ISO-8859-1', | |
- 'head_charset' => 'ISO-8859-1' | |
- ); | |
- } | |
+ public function __construct($crlf = "\r\n") | |
+ { | |
+ $this->_setEOL($crlf); | |
+ $this->_build_params = array( | |
+ 'head_encoding' => 'quoted-printable', | |
+ 'text_encoding' => '7bit', | |
+ 'html_encoding' => 'quoted-printable', | |
+ '7bit_wrap' => 998, | |
+ 'html_charset' => 'ISO-8859-1', | |
+ 'text_charset' => 'ISO-8859-1', | |
+ 'head_charset' => 'ISO-8859-1' | |
+ ); | |
+ } | |
+ public function Mail_mime($crlf = "\r\n") | |
+ { | |
+ self::__construct($crlf); | |
+ } | |
+ | |
/** | |
* wakeup function called by unserialize. It re-sets the EOL constant | |
* | |
@@ -1015,8 +1020,8 @@ | |
//Replace all extended characters (\x80-xFF) with their | |
//ASCII values. | |
- $hdr_value = preg_replace('#([\x80-\xFF])#e', | |
- '"=" . strtoupper(dechex(ord("\1")))', | |
+ $hdr_value = preg_replace_callback('#([\x80-\xFF])#', | |
+ function($m){ return "=".strtoupper(dechex(ord($m[1]))); }, | |
$hdr_value); | |
//This regexp will break QP-encoded text at every $maxLength | |
Index: lib/PEAR/Mail/mimeDecode.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/Mail/mimeDecode.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/Mail/mimeDecode.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -156,17 +156,22 @@ | |
* @param string The input to decode | |
* @access public | |
*/ | |
- function Mail_mimeDecode($input) | |
- { | |
- list($header, $body) = $this->_splitBodyHeader($input); | |
+ public function __construct($input) | |
+ { | |
+ list($header, $body) = $this->_splitBodyHeader($input); | |
- $this->_input = $input; | |
- $this->_header = $header; | |
- $this->_body = $body; | |
- $this->_decode_bodies = false; | |
- $this->_include_bodies = true; | |
- } | |
+ $this->_input = $input; | |
+ $this->_header = $header; | |
+ $this->_body = $body; | |
+ $this->_decode_bodies = false; | |
+ $this->_include_bodies = true; | |
+ } | |
+ public function Mail_mimeDecode($input) | |
+ { | |
+ self::__construct($input); | |
+ } | |
+ | |
/** | |
* Begins the decoding process. If called statically | |
* it will create an object and call the decode() method | |
@@ -605,7 +610,7 @@ | |
$input = preg_replace("/=\r?\n/", '', $input); | |
// Replace encoded characters | |
- $input = preg_replace('/=([a-f0-9]{2})/ie', "chr(hexdec('\\1'))", $input); | |
+ $input = preg_replace_callback('/=([a-f0-9]{2})/i', function($m){ return chr(hexdec($m[1])); }, $input); | |
return $input; | |
} | |
Index: lib/PEAR/Mail/mimePart.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/Mail/mimePart.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/Mail/mimePart.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -129,101 +129,106 @@ | |
* charset - Character set to use | |
* @access public | |
*/ | |
- function Mail_mimePart($body = '', $params = array()) | |
- { | |
- if (!defined('MAIL_MIMEPART_CRLF')) { | |
- define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", TRUE); | |
- } | |
+ public function __construct($body = '', $params = array()) | |
+ { | |
+ if (!defined('MAIL_MIMEPART_CRLF')) { | |
+ define('MAIL_MIMEPART_CRLF', defined('MAIL_MIME_CRLF') ? MAIL_MIME_CRLF : "\r\n", TRUE); | |
+ } | |
- $contentType = array(); | |
- $contentDisp = array(); | |
- foreach ($params as $key => $value) { | |
- switch ($key) { | |
- case 'content_type': | |
- $contentType['type'] = $value; | |
- //$headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : ''); | |
- break; | |
+ $contentType = array(); | |
+ $contentDisp = array(); | |
+ foreach ($params as $key => $value) { | |
+ switch ($key) { | |
+ case 'content_type': | |
+ $contentType['type'] = $value; | |
+ //$headers['Content-Type'] = $value . (isset($charset) ? '; charset="' . $charset . '"' : ''); | |
+ break; | |
- case 'encoding': | |
- $this->_encoding = $value; | |
- $headers['Content-Transfer-Encoding'] = $value; | |
- break; | |
+ case 'encoding': | |
+ $this->_encoding = $value; | |
+ $headers['Content-Transfer-Encoding'] = $value; | |
+ break; | |
- case 'cid': | |
- $headers['Content-ID'] = '<' . $value . '>'; | |
- break; | |
+ case 'cid': | |
+ $headers['Content-ID'] = '<' . $value . '>'; | |
+ break; | |
- case 'disposition': | |
- $contentDisp['disp'] = $value; | |
- break; | |
+ case 'disposition': | |
+ $contentDisp['disp'] = $value; | |
+ break; | |
- case 'dfilename': | |
- $contentDisp['filename'] = $value; | |
- $contentType['name'] = $value; | |
- break; | |
+ case 'dfilename': | |
+ $contentDisp['filename'] = $value; | |
+ $contentType['name'] = $value; | |
+ break; | |
- case 'description': | |
- $headers['Content-Description'] = $value; | |
- break; | |
+ case 'description': | |
+ $headers['Content-Description'] = $value; | |
+ break; | |
- case 'charset': | |
- $contentType['charset'] = $value; | |
- $contentDisp['charset'] = $value; | |
- break; | |
+ case 'charset': | |
+ $contentType['charset'] = $value; | |
+ $contentDisp['charset'] = $value; | |
+ break; | |
- case 'language': | |
- $contentType['language'] = $value; | |
- $contentDisp['language'] = $value; | |
- break; | |
+ case 'language': | |
+ $contentType['language'] = $value; | |
+ $contentDisp['language'] = $value; | |
+ break; | |
- case 'location': | |
- $headers['Content-Location'] = $value; | |
- break; | |
+ case 'location': | |
+ $headers['Content-Location'] = $value; | |
+ break; | |
- } | |
- } | |
- if (isset($contentType['type'])) { | |
- $headers['Content-Type'] = $contentType['type']; | |
- if (isset($contentType['name'])) { | |
- $headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF; | |
- $headers['Content-Type'] .= $this->_buildHeaderParam('name', $contentType['name'], | |
- isset($contentType['charset']) ? $contentType['charset'] : 'US-ASCII', | |
- isset($contentType['language']) ? $contentType['language'] : NULL); | |
- } elseif (isset($contentType['charset'])) { | |
- $headers['Content-Type'] .= "; charset=\"{$contentType['charset']}\""; | |
- } | |
- } | |
+ } | |
+ } | |
+ if (isset($contentType['type'])) { | |
+ $headers['Content-Type'] = $contentType['type']; | |
+ if (isset($contentType['name'])) { | |
+ $headers['Content-Type'] .= ';' . MAIL_MIMEPART_CRLF; | |
+ $headers['Content-Type'] .= $this->_buildHeaderParam('name', $contentType['name'], | |
+ isset($contentType['charset']) ? $contentType['charset'] : 'US-ASCII', | |
+ isset($contentType['language']) ? $contentType['language'] : NULL); | |
+ } elseif (isset($contentType['charset'])) { | |
+ $headers['Content-Type'] .= "; charset=\"{$contentType['charset']}\""; | |
+ } | |
+ } | |
- if (isset($contentDisp['disp'])) { | |
- $headers['Content-Disposition'] = $contentDisp['disp']; | |
- if (isset($contentDisp['filename'])) { | |
- $headers['Content-Disposition'] .= ';' . MAIL_MIMEPART_CRLF; | |
- $headers['Content-Disposition'] .= $this->_buildHeaderParam('filename', $contentDisp['filename'], | |
- isset($contentDisp['charset']) ? $contentDisp['charset'] : 'US-ASCII', | |
- isset($contentDisp['language']) ? $contentDisp['language'] : NULL); | |
- } | |
- } | |
- | |
- | |
- | |
- | |
- // Default content-type | |
- if (!isset($headers['Content-Type'])) { | |
- $headers['Content-Type'] = 'text/plain'; | |
- } | |
+ if (isset($contentDisp['disp'])) { | |
+ $headers['Content-Disposition'] = $contentDisp['disp']; | |
+ if (isset($contentDisp['filename'])) { | |
+ $headers['Content-Disposition'] .= ';' . MAIL_MIMEPART_CRLF; | |
+ $headers['Content-Disposition'] .= $this->_buildHeaderParam('filename', $contentDisp['filename'], | |
+ isset($contentDisp['charset']) ? $contentDisp['charset'] : 'US-ASCII', | |
+ isset($contentDisp['language']) ? $contentDisp['language'] : NULL); | |
+ } | |
+ } | |
+ | |
+ | |
+ | |
+ | |
+ // Default content-type | |
+ if (!isset($headers['Content-Type'])) { | |
+ $headers['Content-Type'] = 'text/plain'; | |
+ } | |
- //Default encoding | |
- if (!isset($this->_encoding)) { | |
- $this->_encoding = '7bit'; | |
- } | |
+ //Default encoding | |
+ if (!isset($this->_encoding)) { | |
+ $this->_encoding = '7bit'; | |
+ } | |
- // Assign stuff to member variables | |
- $this->_encoded = array(); | |
- $this->_headers = $headers; | |
- $this->_body = $body; | |
- } | |
+ // Assign stuff to member variables | |
+ $this->_encoded = array(); | |
+ $this->_headers = $headers; | |
+ $this->_body = $body; | |
+ } | |
+ public function Mail_mimePart($body = '', $params = array()) | |
+ { | |
+ self::__construct($body, $params); | |
+ } | |
+ | |
/** | |
* encode() | |
* | |
@@ -405,7 +410,7 @@ | |
$search = array('%', ' ', "\t"); | |
$replace = array('%25', '%20', '%09'); | |
$encValue = str_replace($search, $replace, $value); | |
- $encValue = preg_replace('#([\x80-\xFF])#e', '"%" . strtoupper(dechex(ord("\1")))', $encValue); | |
+ $encValue = preg_replace_callback('#([\x80-\xFF])#', function($m){ return "%".strtoupper(dechex(ord($m[1]))); }, $encValue); | |
$value = "$charset'$language'$encValue"; | |
$secondAsterisk = '*'; | |
} | |
Index: lib/PEAR/PEAR.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/PEAR.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/PEAR.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -167,31 +167,36 @@ | |
* @access public | |
* @return void | |
*/ | |
- function PEAR($error_class = null) | |
- { | |
- $classname = strtolower(get_class($this)); | |
- if ($this->_debug) { | |
- print "PEAR constructor called, class=$classname\n"; | |
- } | |
- if ($error_class !== null) { | |
- $this->_error_class = $error_class; | |
- } | |
- while ($classname && strcasecmp($classname, "pear")) { | |
- $destructor = "_$classname"; | |
- if (method_exists($this, $destructor)) { | |
- global $_PEAR_destructor_object_list; | |
- $_PEAR_destructor_object_list[] = &$this; | |
- if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { | |
- register_shutdown_function("_PEAR_call_destructors"); | |
- $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; | |
- } | |
- break; | |
- } else { | |
- $classname = get_parent_class($classname); | |
- } | |
- } | |
- } | |
+ public function __construct($error_class = null) | |
+ { | |
+ $classname = strtolower(get_class($this)); | |
+ if ($this->_debug) { | |
+ print "PEAR constructor called, class=$classname\n"; | |
+ } | |
+ if ($error_class !== null) { | |
+ $this->_error_class = $error_class; | |
+ } | |
+ while ($classname && strcasecmp($classname, "pear")) { | |
+ $destructor = "_$classname"; | |
+ if (method_exists($this, $destructor)) { | |
+ global $_PEAR_destructor_object_list; | |
+ $_PEAR_destructor_object_list[] = &$this; | |
+ if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { | |
+ register_shutdown_function("_PEAR_call_destructors"); | |
+ $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; | |
+ } | |
+ break; | |
+ } else { | |
+ $classname = get_parent_class($classname); | |
+ } | |
+ } | |
+ } | |
+ public function PEAR($error_class = null) | |
+ { | |
+ self::__construct($error_class); | |
+ } | |
+ | |
// }}} | |
// {{{ destructor | |
@@ -858,66 +863,72 @@ | |
* @access public | |
* | |
*/ | |
- function PEAR_Error($message = 'unknown error', $code = null, | |
- $mode = null, $options = null, $userinfo = null) | |
- { | |
- if ($mode === null) { | |
- $mode = PEAR_ERROR_RETURN; | |
- } | |
- $this->message = $message; | |
- $this->code = $code; | |
- $this->mode = $mode; | |
- $this->userinfo = $userinfo; | |
- if (!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { | |
- $this->backtrace = debug_backtrace(); | |
- if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) { | |
- unset($this->backtrace[0]['object']); | |
- } | |
- } | |
- if ($mode & PEAR_ERROR_CALLBACK) { | |
- $this->level = E_USER_NOTICE; | |
- $this->callback = $options; | |
- } else { | |
- if ($options === null) { | |
- $options = E_USER_NOTICE; | |
- } | |
- $this->level = $options; | |
- $this->callback = null; | |
- } | |
- if ($this->mode & PEAR_ERROR_PRINT) { | |
- if (is_null($options) || is_int($options)) { | |
- $format = "%s"; | |
- } else { | |
- $format = $options; | |
- } | |
- printf($format, $this->getMessage()); | |
- } | |
- if ($this->mode & PEAR_ERROR_TRIGGER) { | |
- trigger_error($this->getMessage(), $this->level); | |
- } | |
- if ($this->mode & PEAR_ERROR_DIE) { | |
- $msg = $this->getMessage(); | |
- if (is_null($options) || is_int($options)) { | |
- $format = "%s"; | |
- if (substr($msg, -1) != "\n") { | |
- $msg .= "\n"; | |
- } | |
- } else { | |
- $format = $options; | |
- } | |
- die(sprintf($format, $msg)); | |
- } | |
- if ($this->mode & PEAR_ERROR_CALLBACK) { | |
- if (is_callable($this->callback)) { | |
- call_user_func($this->callback, $this); | |
- } | |
- } | |
- if ($this->mode & PEAR_ERROR_EXCEPTION) { | |
- trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); | |
- eval('$e = new Exception($this->message, $this->code);throw($e);'); | |
- } | |
- } | |
+ public function __construct($message = 'unknown error', $code = null, | |
+ $mode = null, $options = null, $userinfo = null) | |
+ { | |
+ if ($mode === null) { | |
+ $mode = PEAR_ERROR_RETURN; | |
+ } | |
+ $this->message = $message; | |
+ $this->code = $code; | |
+ $this->mode = $mode; | |
+ $this->userinfo = $userinfo; | |
+ if (!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { | |
+ $this->backtrace = debug_backtrace(); | |
+ if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) { | |
+ unset($this->backtrace[0]['object']); | |
+ } | |
+ } | |
+ if ($mode & PEAR_ERROR_CALLBACK) { | |
+ $this->level = E_USER_NOTICE; | |
+ $this->callback = $options; | |
+ } else { | |
+ if ($options === null) { | |
+ $options = E_USER_NOTICE; | |
+ } | |
+ $this->level = $options; | |
+ $this->callback = null; | |
+ } | |
+ if ($this->mode & PEAR_ERROR_PRINT) { | |
+ if (is_null($options) || is_int($options)) { | |
+ $format = "%s"; | |
+ } else { | |
+ $format = $options; | |
+ } | |
+ printf($format, $this->getMessage()); | |
+ } | |
+ if ($this->mode & PEAR_ERROR_TRIGGER) { | |
+ trigger_error($this->getMessage(), $this->level); | |
+ } | |
+ if ($this->mode & PEAR_ERROR_DIE) { | |
+ $msg = $this->getMessage(); | |
+ if (is_null($options) || is_int($options)) { | |
+ $format = "%s"; | |
+ if (substr($msg, -1) != "\n") { | |
+ $msg .= "\n"; | |
+ } | |
+ } else { | |
+ $format = $options; | |
+ } | |
+ die(sprintf($format, $msg)); | |
+ } | |
+ if ($this->mode & PEAR_ERROR_CALLBACK) { | |
+ if (is_callable($this->callback)) { | |
+ call_user_func($this->callback, $this); | |
+ } | |
+ } | |
+ if ($this->mode & PEAR_ERROR_EXCEPTION) { | |
+ trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); | |
+ eval('$e = new Exception($this->message, $this->code);throw($e);'); | |
+ } | |
+ } | |
+ public function PEAR_Error($message = 'unknown error', $code = null, | |
+ $mode = null, $options = null, $userinfo = null) | |
+ { | |
+ self::__construct($message, $code, $mode, $options, $userinfo); | |
+ } | |
+ | |
// }}} | |
// {{{ getMode() | |
Index: lib/PEAR/PEAR/PEAR.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/PEAR/PEAR.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/PEAR/PEAR.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -167,31 +167,36 @@ | |
* @access public | |
* @return void | |
*/ | |
- function PEAR($error_class = null) | |
- { | |
- $classname = strtolower(get_class($this)); | |
- if ($this->_debug) { | |
- print "PEAR constructor called, class=$classname\n"; | |
- } | |
- if ($error_class !== null) { | |
- $this->_error_class = $error_class; | |
- } | |
- while ($classname && strcasecmp($classname, "pear")) { | |
- $destructor = "_$classname"; | |
- if (method_exists($this, $destructor)) { | |
- global $_PEAR_destructor_object_list; | |
- $_PEAR_destructor_object_list[] = &$this; | |
- if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { | |
- register_shutdown_function("_PEAR_call_destructors"); | |
- $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; | |
- } | |
- break; | |
- } else { | |
- $classname = get_parent_class($classname); | |
- } | |
- } | |
- } | |
+ public function __construct($error_class = null) | |
+ { | |
+ $classname = strtolower(get_class($this)); | |
+ if ($this->_debug) { | |
+ print "PEAR constructor called, class=$classname\n"; | |
+ } | |
+ if ($error_class !== null) { | |
+ $this->_error_class = $error_class; | |
+ } | |
+ while ($classname && strcasecmp($classname, "pear")) { | |
+ $destructor = "_$classname"; | |
+ if (method_exists($this, $destructor)) { | |
+ global $_PEAR_destructor_object_list; | |
+ $_PEAR_destructor_object_list[] = &$this; | |
+ if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { | |
+ register_shutdown_function("_PEAR_call_destructors"); | |
+ $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; | |
+ } | |
+ break; | |
+ } else { | |
+ $classname = get_parent_class($classname); | |
+ } | |
+ } | |
+ } | |
+ public function PEAR($error_class = null) | |
+ { | |
+ self::__construct($error_class); | |
+ } | |
+ | |
// }}} | |
// {{{ destructor | |
@@ -858,66 +863,72 @@ | |
* @access public | |
* | |
*/ | |
- function PEAR_Error($message = 'unknown error', $code = null, | |
- $mode = null, $options = null, $userinfo = null) | |
- { | |
- if ($mode === null) { | |
- $mode = PEAR_ERROR_RETURN; | |
- } | |
- $this->message = $message; | |
- $this->code = $code; | |
- $this->mode = $mode; | |
- $this->userinfo = $userinfo; | |
- if (!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { | |
- $this->backtrace = debug_backtrace(); | |
- if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) { | |
- unset($this->backtrace[0]['object']); | |
- } | |
- } | |
- if ($mode & PEAR_ERROR_CALLBACK) { | |
- $this->level = E_USER_NOTICE; | |
- $this->callback = $options; | |
- } else { | |
- if ($options === null) { | |
- $options = E_USER_NOTICE; | |
- } | |
- $this->level = $options; | |
- $this->callback = null; | |
- } | |
- if ($this->mode & PEAR_ERROR_PRINT) { | |
- if (is_null($options) || is_int($options)) { | |
- $format = "%s"; | |
- } else { | |
- $format = $options; | |
- } | |
- printf($format, $this->getMessage()); | |
- } | |
- if ($this->mode & PEAR_ERROR_TRIGGER) { | |
- trigger_error($this->getMessage(), $this->level); | |
- } | |
- if ($this->mode & PEAR_ERROR_DIE) { | |
- $msg = $this->getMessage(); | |
- if (is_null($options) || is_int($options)) { | |
- $format = "%s"; | |
- if (substr($msg, -1) != "\n") { | |
- $msg .= "\n"; | |
- } | |
- } else { | |
- $format = $options; | |
- } | |
- die(sprintf($format, $msg)); | |
- } | |
- if ($this->mode & PEAR_ERROR_CALLBACK) { | |
- if (is_callable($this->callback)) { | |
- call_user_func($this->callback, $this); | |
- } | |
- } | |
- if ($this->mode & PEAR_ERROR_EXCEPTION) { | |
- trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); | |
- eval('$e = new Exception($this->message, $this->code);throw($e);'); | |
- } | |
- } | |
+ public function __construct($message = 'unknown error', $code = null, | |
+ $mode = null, $options = null, $userinfo = null) | |
+ { | |
+ if ($mode === null) { | |
+ $mode = PEAR_ERROR_RETURN; | |
+ } | |
+ $this->message = $message; | |
+ $this->code = $code; | |
+ $this->mode = $mode; | |
+ $this->userinfo = $userinfo; | |
+ if (!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { | |
+ $this->backtrace = debug_backtrace(); | |
+ if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) { | |
+ unset($this->backtrace[0]['object']); | |
+ } | |
+ } | |
+ if ($mode & PEAR_ERROR_CALLBACK) { | |
+ $this->level = E_USER_NOTICE; | |
+ $this->callback = $options; | |
+ } else { | |
+ if ($options === null) { | |
+ $options = E_USER_NOTICE; | |
+ } | |
+ $this->level = $options; | |
+ $this->callback = null; | |
+ } | |
+ if ($this->mode & PEAR_ERROR_PRINT) { | |
+ if (is_null($options) || is_int($options)) { | |
+ $format = "%s"; | |
+ } else { | |
+ $format = $options; | |
+ } | |
+ printf($format, $this->getMessage()); | |
+ } | |
+ if ($this->mode & PEAR_ERROR_TRIGGER) { | |
+ trigger_error($this->getMessage(), $this->level); | |
+ } | |
+ if ($this->mode & PEAR_ERROR_DIE) { | |
+ $msg = $this->getMessage(); | |
+ if (is_null($options) || is_int($options)) { | |
+ $format = "%s"; | |
+ if (substr($msg, -1) != "\n") { | |
+ $msg .= "\n"; | |
+ } | |
+ } else { | |
+ $format = $options; | |
+ } | |
+ die(sprintf($format, $msg)); | |
+ } | |
+ if ($this->mode & PEAR_ERROR_CALLBACK) { | |
+ if (is_callable($this->callback)) { | |
+ call_user_func($this->callback, $this); | |
+ } | |
+ } | |
+ if ($this->mode & PEAR_ERROR_EXCEPTION) { | |
+ trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING); | |
+ eval('$e = new Exception($this->message, $this->code);throw($e);'); | |
+ } | |
+ } | |
+ public function PEAR_Error($message = 'unknown error', $code = null, | |
+ $mode = null, $options = null, $userinfo = null) | |
+ { | |
+ self::__construct($message, $code, $mode, $options, $userinfo); | |
+ } | |
+ | |
// }}} | |
// {{{ getMode() | |
Index: lib/PEAR/SOAP/Base.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/SOAP/Base.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/SOAP/Base.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -94,12 +94,17 @@ | |
* | |
* @param string $faultcode Error code. | |
*/ | |
- function SOAP_Base_Object($faultcode = 'Client') | |
- { | |
- $this->_myfaultcode = $faultcode; | |
- parent::PEAR('SOAP_Fault'); | |
- } | |
+ public function __construct($faultcode = 'Client') | |
+ { | |
+ $this->_myfaultcode = $faultcode; | |
+ parent::PEAR('SOAP_Fault'); | |
+ } | |
+ public function SOAP_Base_Object($faultcode = 'Client') | |
+ { | |
+ self::__construct($faultcode); | |
+ } | |
+ | |
/** | |
* Raises a SOAP error. | |
* | |
@@ -280,12 +285,17 @@ | |
* | |
* @param string $faultcode Error code. | |
*/ | |
- function SOAP_Base($faultcode = 'Client') | |
- { | |
- parent::SOAP_Base_Object($faultcode); | |
- $this->_resetNamespaces(); | |
- } | |
+ public function __construct($faultcode = 'Client') | |
+ { | |
+ parent::SOAP_Base_Object($faultcode); | |
+ $this->_resetNamespaces(); | |
+ } | |
+ public function SOAP_Base($faultcode = 'Client') | |
+ { | |
+ self::__construct($faultcode); | |
+ } | |
+ | |
/** | |
* Sets the SOAP-ENV prefix and returns the current value. | |
* | |
@@ -1101,34 +1111,39 @@ | |
var $ns = ''; | |
var $namespace = ''; | |
- function QName($name, $namespace = '') | |
- { | |
- if ($name && $name[0] == '{') { | |
- preg_match('/\{(.*?)\}(.*)/', $name, $m); | |
- $this->name = $m[2]; | |
- $this->namespace = $m[1]; | |
- } elseif (substr_count($name, ':') == 1) { | |
- $s = explode(':', $name); | |
- $s = array_reverse($s); | |
- $this->name = $s[0]; | |
- $this->ns = $s[1]; | |
- $this->namespace = $namespace; | |
- } else { | |
- $this->name = $name; | |
- $this->namespace = $namespace; | |
- } | |
+ public function __construct($name, $namespace = '') | |
+ { | |
+ if ($name && $name[0] == '{') { | |
+ preg_match('/\{(.*?)\}(.*)/', $name, $m); | |
+ $this->name = $m[2]; | |
+ $this->namespace = $m[1]; | |
+ } elseif (substr_count($name, ':') == 1) { | |
+ $s = explode(':', $name); | |
+ $s = array_reverse($s); | |
+ $this->name = $s[0]; | |
+ $this->ns = $s[1]; | |
+ $this->namespace = $namespace; | |
+ } else { | |
+ $this->name = $name; | |
+ $this->namespace = $namespace; | |
+ } | |
- // A little more magic than should be in a qname. | |
- $p = strpos($this->name, '['); | |
- if ($p) { | |
- // TODO: Need to re-examine this logic later. | |
- // Chop off []. | |
- $this->arraySize = explode(',', substr($this->name, $p + 1, -$p - 2)); | |
- $this->arrayInfo = substr($this->name, $p); | |
- $this->name = substr($this->name, 0, $p); | |
- } | |
- } | |
+ // A little more magic than should be in a qname. | |
+ $p = strpos($this->name, '['); | |
+ if ($p) { | |
+ // TODO: Need to re-examine this logic later. | |
+ // Chop off []. | |
+ $this->arraySize = explode(',', substr($this->name, $p + 1, -$p - 2)); | |
+ $this->arrayInfo = substr($this->name, $p); | |
+ $this->name = substr($this->name, 0, $p); | |
+ } | |
+ } | |
+ public function QName($name, $namespace = '') | |
+ { | |
+ self::__construct($name, $namespace); | |
+ } | |
+ | |
function fqn() | |
{ | |
if ($this->namespace) { | |
Index: lib/PEAR/SOAP/Client.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/SOAP/Client.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/SOAP/Client.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -202,34 +202,40 @@ | |
* @param boolean|string $cache Use WSDL caching? The cache directory if | |
* a string. | |
*/ | |
- function SOAP_Client($endpoint, $wsdl = false, $portName = false, | |
- $proxy_params = array(), $cache = false) | |
- { | |
- parent::SOAP_Base('Client'); | |
+ public function __construct($endpoint, $wsdl = false, $portName = false, | |
+ $proxy_params = array(), $cache = false) | |
+ { | |
+ parent::SOAP_Base('Client'); | |
- $this->_endpoint = $endpoint; | |
- $this->_portName = $portName; | |
- $this->_proxy_params = $proxy_params; | |
+ $this->_endpoint = $endpoint; | |
+ $this->_portName = $portName; | |
+ $this->_proxy_params = $proxy_params; | |
- // This hack should perhaps be removed as it might cause unexpected | |
- // behaviour. | |
- $wsdl = $wsdl | |
- ? $wsdl | |
- : strtolower(substr($endpoint, -4)) == 'wsdl'; | |
+ // This hack should perhaps be removed as it might cause unexpected | |
+ // behaviour. | |
+ $wsdl = $wsdl | |
+ ? $wsdl | |
+ : strtolower(substr($endpoint, -4)) == 'wsdl'; | |
- // make values | |
- if ($wsdl) { | |
- $this->_endpointType = 'wsdl'; | |
- // instantiate wsdl class | |
- $this->_wsdl = new SOAP_WSDL($this->_endpoint, | |
- $this->_proxy_params, | |
- $cache); | |
- if ($this->_wsdl->fault) { | |
- $this->_raiseSoapFault($this->_wsdl->fault); | |
- } | |
- } | |
- } | |
+ // make values | |
+ if ($wsdl) { | |
+ $this->_endpointType = 'wsdl'; | |
+ // instantiate wsdl class | |
+ $this->_wsdl = new SOAP_WSDL($this->_endpoint, | |
+ $this->_proxy_params, | |
+ $cache); | |
+ if ($this->_wsdl->fault) { | |
+ $this->_raiseSoapFault($this->_wsdl->fault); | |
+ } | |
+ } | |
+ } | |
+ public function SOAP_Client($endpoint, $wsdl = false, $portName = false, | |
+ $proxy_params = array(), $cache = false) | |
+ { | |
+ self::__construct($endpoint, $wsdl, $portName, $proxy_params, $cache); | |
+ } | |
+ | |
function _reset() | |
{ | |
$this->xml = null; | |
Index: lib/PEAR/SOAP/Fault.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/SOAP/Fault.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/SOAP/Fault.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -57,16 +57,23 @@ | |
* @param array $mode @see PEAR_Error | |
* @param array $options @see PEAR_Error | |
*/ | |
- function SOAP_Fault($faultstring = 'unknown error', $faultcode = 'Client', | |
- $faultactor = null, $detail = null, $mode = null, | |
- $options = null) | |
- { | |
- parent::PEAR_Error($faultstring, $faultcode, $mode, $options, $detail); | |
- if ($faultactor) { | |
- $this->error_message_prefix = $faultactor; | |
- } | |
- } | |
+ public function __construct($faultstring = 'unknown error', $faultcode = 'Client', | |
+ $faultactor = null, $detail = null, $mode = null, | |
+ $options = null) | |
+ { | |
+ parent::PEAR_Error($faultstring, $faultcode, $mode, $options, $detail); | |
+ if ($faultactor) { | |
+ $this->error_message_prefix = $faultactor; | |
+ } | |
+ } | |
+ public function SOAP_Fault($faultstring = 'unknown error', $faultcode = 'Client', | |
+ $faultactor = null, $detail = null, $mode = null, | |
+ $options = null) | |
+ { | |
+ self::__construct($faultstring, $faultcode, $faultactor, $detail, $mode, $options); | |
+ } | |
+ | |
/** | |
* Returns a SOAP XML message that can be sent as a server response. | |
* | |
Index: lib/PEAR/SOAP/Parser.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/SOAP/Parser.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/SOAP/Parser.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -69,48 +69,54 @@ | |
* @param string $encoding Character set encoding, defaults to 'UTF-8'. | |
* @param array $attachments List of attachments. | |
*/ | |
- function SOAP_Parser($xml, $encoding = SOAP_DEFAULT_ENCODING, | |
- $attachments = null) | |
- { | |
- parent::SOAP_Base('Parser'); | |
- $this->_setSchemaVersion(SOAP_XML_SCHEMA_VERSION); | |
+ public function __construct($xml, $encoding = SOAP_DEFAULT_ENCODING, | |
+ $attachments = null) | |
+ { | |
+ parent::SOAP_Base('Parser'); | |
+ $this->_setSchemaVersion(SOAP_XML_SCHEMA_VERSION); | |
- $this->attachments = $attachments; | |
+ $this->attachments = $attachments; | |
- // Check the XML tag for encoding. | |
- if (preg_match('/<\?xml[^>]+encoding\s*?=\s*?(\'([^\']*)\'|"([^"]*)")[^>]*?[\?]>/', $xml, $m)) { | |
- $encoding = strtoupper($m[2] ? $m[2] : $m[3]); | |
- } | |
+ // Check the XML tag for encoding. | |
+ if (preg_match('/<\?xml[^>]+encoding\s*?=\s*?(\'([^\']*)\'|"([^"]*)")[^>]*?[\?]>/', $xml, $m)) { | |
+ $encoding = strtoupper($m[2] ? $m[2] : $m[3]); | |
+ } | |
- // Determine where in the message we are (envelope, header, body, | |
- // method). Check whether content has been read. | |
- if (!empty($xml)) { | |
- // Prepare the XML parser. | |
- $parser = xml_parser_create($encoding); | |
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); | |
- xml_set_object($parser, $this); | |
- xml_set_element_handler($parser, '_startElement', '_endElement'); | |
- xml_set_character_data_handler($parser, '_characterData'); | |
+ // Determine where in the message we are (envelope, header, body, | |
+ // method). Check whether content has been read. | |
+ if (!empty($xml)) { | |
+ // Prepare the XML parser. | |
+ $parser = xml_parser_create($encoding); | |
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); | |
+ xml_set_object($parser, $this); | |
+ xml_set_element_handler($parser, '_startElement', '_endElement'); | |
+ xml_set_character_data_handler($parser, '_characterData'); | |
- // Some lame SOAP implementations add nul bytes at the end of the | |
- // SOAP stream, and expat chokes on that. | |
- if ($xml[strlen($xml) - 1] == 0) { | |
- $xml = trim($xml); | |
- } | |
+ // Some lame SOAP implementations add nul bytes at the end of the | |
+ // SOAP stream, and expat chokes on that. | |
+ if ($xml[strlen($xml) - 1] == 0) { | |
+ $xml = trim($xml); | |
+ } | |
- // Parse the XML file. | |
- if (!xml_parse($parser, $xml, true)) { | |
- $err = sprintf('XML error on line %d col %d byte %d %s', | |
- xml_get_current_line_number($parser), | |
- xml_get_current_column_number($parser), | |
- xml_get_current_byte_index($parser), | |
- xml_error_string(xml_get_error_code($parser))); | |
- $this->_raiseSoapFault($err, htmlspecialchars($xml)); | |
- } | |
- xml_parser_free($parser); | |
- } | |
- } | |
+ // Parse the XML file. | |
+ if (!xml_parse($parser, $xml, true)) { | |
+ $err = sprintf('XML error on line %d col %d byte %d %s', | |
+ xml_get_current_line_number($parser), | |
+ xml_get_current_column_number($parser), | |
+ xml_get_current_byte_index($parser), | |
+ xml_error_string(xml_get_error_code($parser))); | |
+ $this->_raiseSoapFault($err, htmlspecialchars($xml)); | |
+ } | |
+ xml_parser_free($parser); | |
+ } | |
+ } | |
+ public function SOAP_Parser($xml, $encoding = SOAP_DEFAULT_ENCODING, | |
+ $attachments = null) | |
+ { | |
+ self::__construct($xml, $encoding, $attachments); | |
+ } | |
+ | |
/** | |
* Returns an array of responses. | |
* | |
Index: lib/PEAR/SOAP/Transport/HTTP.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/SOAP/Transport/HTTP.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/SOAP/Transport/HTTP.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -80,14 +80,19 @@ | |
* @param string $url HTTP url to SOAP endpoint. | |
* @param string $encoding Encoding to use. | |
*/ | |
- function SOAP_Transport_HTTP($url, $encoding = SOAP_DEFAULT_ENCODING) | |
- { | |
- parent::SOAP_Base('HTTP'); | |
- $this->urlparts = @parse_url($url); | |
- $this->url = $url; | |
- $this->encoding = $encoding; | |
- } | |
+ public function __construct($url, $encoding = SOAP_DEFAULT_ENCODING) | |
+ { | |
+ parent::SOAP_Base('HTTP'); | |
+ $this->urlparts = @parse_url($url); | |
+ $this->url = $url; | |
+ $this->encoding = $encoding; | |
+ } | |
+ public function SOAP_Transport_HTTP($url, $encoding = SOAP_DEFAULT_ENCODING) | |
+ { | |
+ self::__construct($url, $encoding); | |
+ } | |
+ | |
/** | |
* Sends and receives SOAP data. | |
* | |
Index: lib/PEAR/SOAP/Value.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/SOAP/Value.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/SOAP/Value.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -132,22 +132,28 @@ | |
* - 'no_type_prefix': supress adding of the | |
* namespace prefix | |
*/ | |
- function SOAP_Value($name = '', $type = false, $value = null, | |
- $attributes = array(), $options = array()) | |
- { | |
- $this->nqn = new QName($name); | |
- $this->name = $this->nqn->name; | |
- $this->namespace = $this->nqn->namespace; | |
- if ($type) { | |
- $this->tqn = new QName($type); | |
- $this->type = $this->tqn->name; | |
- $this->type_namespace = $this->tqn->namespace; | |
- } | |
- $this->value = $value; | |
- $this->attributes = $attributes; | |
- $this->options = $options; | |
- } | |
+ public function __construct($name = '', $type = false, $value = null, | |
+ $attributes = array(), $options = array()) | |
+ { | |
+ $this->nqn = new QName($name); | |
+ $this->name = $this->nqn->name; | |
+ $this->namespace = $this->nqn->namespace; | |
+ if ($type) { | |
+ $this->tqn = new QName($type); | |
+ $this->type = $this->tqn->name; | |
+ $this->type_namespace = $this->tqn->namespace; | |
+ } | |
+ $this->value = $value; | |
+ $this->attributes = $attributes; | |
+ $this->options = $options; | |
+ } | |
+ public function SOAP_Value($name = '', $type = false, $value = null, | |
+ $attributes = array(), $options = array()) | |
+ { | |
+ self::__construct($name, $type,$value, $attributes, $options); | |
+ } | |
+ | |
/** | |
* Serializes this value. | |
* | |
@@ -193,24 +199,30 @@ | |
* @param integer $mustunderstand Zero or one. | |
* @param mixed $attributes Attributes. | |
*/ | |
- function SOAP_Header($name = '', $type, $value, $mustunderstand = 0, | |
- $attributes = array()) | |
- { | |
- if (!is_array($attributes)) { | |
- $actor = $attributes; | |
- $attributes = array(); | |
- } | |
+ public function __construct($name = '', $type, $value, $mustunderstand = 0, | |
+ $attributes = array()) | |
+ { | |
+ if (!is_array($attributes)) { | |
+ $actor = $attributes; | |
+ $attributes = array(); | |
+ } | |
- parent::SOAP_Value($name, $type, $value, $attributes); | |
+ parent::SOAP_Value($name, $type, $value, $attributes); | |
- if (isset($actor)) { | |
- $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = $actor; | |
- } elseif (!isset($this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'])) { | |
- $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = 'http://schemas.xmlsoap.org/soap/actor/next'; | |
- } | |
- $this->attributes[SOAP_BASE::SOAPENVPrefix().':mustUnderstand'] = (int)$mustunderstand; | |
- } | |
+ if (isset($actor)) { | |
+ $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = $actor; | |
+ } elseif (!isset($this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'])) { | |
+ $this->attributes[SOAP_BASE::SOAPENVPrefix().':actor'] = 'http://schemas.xmlsoap.org/soap/actor/next'; | |
+ } | |
+ $this->attributes[SOAP_BASE::SOAPENVPrefix().':mustUnderstand'] = (int)$mustunderstand; | |
+ } | |
+ public function SOAP_Header($name = '', $type, $value, $mustunderstand = 0, | |
+ $attributes = array()) | |
+ { | |
+ self::__construct($name, $type, $value, $mustunderstand, $attributes); | |
+ } | |
+ | |
} | |
/** | |
@@ -233,30 +245,36 @@ | |
* @param string $file The attachment data. | |
* @param array $attributes Attributes. | |
*/ | |
- function SOAP_Attachment($name = '', $type = 'application/octet-stream', | |
- $filename, $file = null, $attributes = null) | |
- { | |
- parent::SOAP_Value($name, null, null); | |
+ public function __construct($name = '', $type = 'application/octet-stream', | |
+ $filename, $file = null, $attributes = null) | |
+ { | |
+ parent::SOAP_Value($name, null, null); | |
- $filedata = $file === null ? $this->_file2str($filename) : $file; | |
- $filename = basename($filename); | |
- if (PEAR::isError($filedata)) { | |
- $this->options['attachment'] = $filedata; | |
- return; | |
- } | |
+ $filedata = $file === null ? $this->_file2str($filename) : $file; | |
+ $filename = basename($filename); | |
+ if (PEAR::isError($filedata)) { | |
+ $this->options['attachment'] = $filedata; | |
+ return; | |
+ } | |
- $cid = md5(uniqid(time())); | |
+ $cid = md5(uniqid(time())); | |
- $this->attributes = $attributes; | |
- $this->attributes['href'] = 'cid:' . $cid; | |
+ $this->attributes = $attributes; | |
+ $this->attributes['href'] = 'cid:' . $cid; | |
- $this->options['attachment'] = array('body' => $filedata, | |
- 'disposition' => $filename, | |
- 'content_type' => $type, | |
- 'encoding' => 'base64', | |
- 'cid' => $cid); | |
- } | |
+ $this->options['attachment'] = array('body' => $filedata, | |
+ 'disposition' => $filename, | |
+ 'content_type' => $type, | |
+ 'encoding' => 'base64', | |
+ 'cid' => $cid); | |
+ } | |
+ public function SOAP_Attachment($name = '', $type = 'application/octet-stream', | |
+ $filename, $file = null, $attributes = null) | |
+ { | |
+ self::__construct($name, $type, $filename, $file, $attributes); | |
+ } | |
+ | |
/** | |
* Returns the contents of the given file name as string. | |
* | |
Index: lib/PEAR/SOAP/WSDL.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/SOAP/WSDL.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/SOAP/WSDL.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -160,30 +160,39 @@ | |
* | |
* @access public | |
*/ | |
- function SOAP_WSDL($wsdl_uri = false, | |
- $proxy = array(), | |
- $cacheUse = false, | |
- $cacheMaxAge = WSDL_CACHE_MAX_AGE, | |
- $docs = false) | |
- { | |
- parent::SOAP_Base('WSDL'); | |
- $this->uri = $wsdl_uri; | |
- $this->proxy = $proxy; | |
- $this->cacheUse = !empty($cacheUse); | |
- $this->cacheMaxAge = $cacheMaxAge; | |
- $this->docs = $docs; | |
- if (is_string($cacheUse)) { | |
- $this->cacheDir = $cacheUse; | |
- } | |
+ public function __construct($wsdl_uri = false, | |
+ $proxy = array(), | |
+ $cacheUse = false, | |
+ $cacheMaxAge = WSDL_CACHE_MAX_AGE, | |
+ $docs = false) | |
+ { | |
+ parent::SOAP_Base('WSDL'); | |
+ $this->uri = $wsdl_uri; | |
+ $this->proxy = $proxy; | |
+ $this->cacheUse = !empty($cacheUse); | |
+ $this->cacheMaxAge = $cacheMaxAge; | |
+ $this->docs = $docs; | |
+ if (is_string($cacheUse)) { | |
+ $this->cacheDir = $cacheUse; | |
+ } | |
- if ($wsdl_uri) { | |
- if (!PEAR::isError($this->parseURL($wsdl_uri))) { | |
- reset($this->services); | |
- $this->service = key($this->services); | |
- } | |
- } | |
- } | |
+ if ($wsdl_uri) { | |
+ if (!PEAR::isError($this->parseURL($wsdl_uri))) { | |
+ reset($this->services); | |
+ $this->service = key($this->services); | |
+ } | |
+ } | |
+ } | |
+ public function SOAP_WSDL($wsdl_uri = false, | |
+ $proxy = array(), | |
+ $cacheUse = false, | |
+ $cacheMaxAge = WSDL_CACHE_MAX_AGE, | |
+ $docs = false) | |
+ { | |
+ self::__construct($wsdl_uri, $proxy, $cacheUse, $cacheMaxAge, $docs); | |
+ } | |
+ | |
/** | |
* @deprecated Use setService(). | |
*/ | |
@@ -938,7 +947,7 @@ | |
{ | |
static $trail = array(); | |
- $arrayType = ereg_replace('\[\]$', '', $arrayType); | |
+ $arrayType = preg_replace('/\[\]$/', '', $arrayType); | |
// Protect against circular references XXX We really need to remove | |
// trail from this altogether (it's very inefficient and in the wrong | |
@@ -990,16 +999,23 @@ | |
* @param boolean $cashUse Use caching? | |
* @param integer $cacheMaxAge Cache maximum lifetime (in seconds) | |
*/ | |
- function SOAP_WSDL_Cache($cacheUse = false, | |
- $cacheMaxAge = WSDL_CACHE_MAX_AGE, | |
- $cacheDir = null) | |
- { | |
- parent::SOAP_Base('WSDLCACHE'); | |
- $this->_cacheUse = $cacheUse; | |
- $this->_cacheDir = $cacheDir; | |
- $this->_cacheMaxAge = $cacheMaxAge; | |
- } | |
+ public function __construct($cacheUse = false, | |
+ $cacheMaxAge = WSDL_CACHE_MAX_AGE, | |
+ $cacheDir = null) | |
+ { | |
+ parent::SOAP_Base('WSDLCACHE'); | |
+ $this->_cacheUse = $cacheUse; | |
+ $this->_cacheDir = $cacheDir; | |
+ $this->_cacheMaxAge = $cacheMaxAge; | |
+ } | |
+ public function SOAP_WSDL_Cache($cacheUse = false, | |
+ $cacheMaxAge = WSDL_CACHE_MAX_AGE, | |
+ $cacheDir = null) | |
+ { | |
+ self::__construct($cacheUse, $cacheMaxAge, $cacheDir); | |
+ } | |
+ | |
/** | |
* Returns the path to the cache and creates it, if it doesn't exist. | |
* | |
@@ -1153,18 +1169,23 @@ | |
/** | |
* Constructor. | |
*/ | |
- function SOAP_WSDL_Parser($uri, &$wsdl, $docs = false) | |
- { | |
- parent::SOAP_Base('WSDLPARSER'); | |
- $this->cache = new SOAP_WSDL_Cache($wsdl->cacheUse, | |
- $wsdl->cacheMaxAge, | |
- $wsdl->cacheDir); | |
- $this->uri = $uri; | |
- $this->wsdl = &$wsdl; | |
- $this->docs = $docs; | |
- $this->parse($uri); | |
- } | |
+ public function __construct($uri, &$wsdl, $docs = false) | |
+ { | |
+ parent::SOAP_Base('WSDLPARSER'); | |
+ $this->cache = new SOAP_WSDL_Cache($wsdl->cacheUse, | |
+ $wsdl->cacheMaxAge, | |
+ $wsdl->cacheDir); | |
+ $this->uri = $uri; | |
+ $this->wsdl = &$wsdl; | |
+ $this->docs = $docs; | |
+ $this->parse($uri); | |
+ } | |
+ public function SOAP_WSDL_Parser($uri, &$wsdl, $docs = false) | |
+ { | |
+ self::__construct($uri, &$wsdl, $docs); | |
+ } | |
+ | |
function parse($uri) | |
{ | |
// Check whether content has been read. | |
@@ -1984,36 +2005,42 @@ | |
* @param string $service_desc Optional description of the WSDL | |
* <service>. | |
*/ | |
- function SOAP_WSDL_ObjectParser($objects, &$wsdl, $targetNamespace, | |
- $service_name, $service_desc = '') | |
- { | |
- parent::SOAP_Base('WSDLOBJECTPARSER'); | |
+ public function __construct($objects, &$wsdl, $targetNamespace, | |
+ $service_name, $service_desc = '') | |
+ { | |
+ parent::SOAP_Base('WSDLOBJECTPARSER'); | |
- $this->wsdl = &$wsdl; | |
+ $this->wsdl = &$wsdl; | |
- // Set up the SOAP_WSDL object | |
- $this->_initialise($service_name); | |
+ // Set up the SOAP_WSDL object | |
+ $this->_initialise($service_name); | |
- // Parse each web service object | |
- $wsdl_ref = is_array($objects) ? $objects : array($objects); | |
+ // Parse each web service object | |
+ $wsdl_ref = is_array($objects) ? $objects : array($objects); | |
- foreach ($wsdl_ref as $ref_item) { | |
- if (!is_object($ref_item)) { | |
- $this->_raiseSoapFault('Invalid web service object passed to object parser'); | |
- continue; | |
- } | |
+ foreach ($wsdl_ref as $ref_item) { | |
+ if (!is_object($ref_item)) { | |
+ $this->_raiseSoapFault('Invalid web service object passed to object parser'); | |
+ continue; | |
+ } | |
- if (!$this->_parse($ref_item, $targetNamespace, $service_name)) { | |
- break; | |
- } | |
- } | |
+ if (!$this->_parse($ref_item, $targetNamespace, $service_name)) { | |
+ break; | |
+ } | |
+ } | |
- // Build bindings from abstract data. | |
- if ($this->fault == null) { | |
- $this->_generateBindingsAndServices($targetNamespace, $service_name, $service_desc); | |
- } | |
- } | |
+ // Build bindings from abstract data. | |
+ if ($this->fault == null) { | |
+ $this->_generateBindingsAndServices($targetNamespace, $service_name, $service_desc); | |
+ } | |
+ } | |
+ public function SOAP_WSDL_ObjectParser($objects, &$wsdl, $targetNamespace, | |
+ $service_name, $service_desc = '') | |
+ { | |
+ self::__construct($objects, &$wsdl, $targetNamespace, $service_name, $service_desc); | |
+ } | |
+ | |
/** | |
* Initialise the SOAP_WSDL tree (destructive). | |
* | |
Index: lib/PEAR/XML/Parser.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/XML/Parser.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/XML/Parser.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -417,7 +417,7 @@ | |
/** | |
* check, if file is a remote file | |
*/ | |
- if (eregi('^(http|ftp)://', substr($file, 0, 10))) { | |
+ if (preg_match('/^(http|ftp):\/\//i', substr($file, 0, 10))) { | |
if (!ini_get('allow_url_fopen')) { | |
return $this-> | |
raiseError('Remote files cannot be parsed, as safe mode is enabled.', | |
@@ -474,7 +474,7 @@ | |
if (is_resource($fp)) { | |
$this->fp = $fp; | |
return true; | |
- } elseif (eregi('^[a-z]+://', substr($fp, 0, 10))) { | |
+ } elseif (preg_match('/^[a-z]+:\/\//i', substr($fp, 0, 10))) { | |
// see if it's an absolute URL (has a scheme at the beginning) | |
return $this->setInputFile($fp); | |
} elseif (file_exists($fp)) { | |
@@ -752,16 +752,21 @@ | |
* @access public | |
* @todo PEAR CS - can't meet 85char line limit without arg refactoring | |
*/ | |
- function XML_Parser_Error($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) | |
- { | |
- if (is_resource($msgorparser)) { | |
- $code = xml_get_error_code($msgorparser); | |
- $msgorparser = sprintf('%s at XML input line %d:%d', | |
- xml_error_string($code), | |
- xml_get_current_line_number($msgorparser), | |
- xml_get_current_column_number($msgorparser)); | |
- } | |
- $this->PEAR_Error($msgorparser, $code, $mode, $level); | |
+ public function __construct($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) | |
+ { | |
+ if (is_resource($msgorparser)) { | |
+ $code = xml_get_error_code($msgorparser); | |
+ $msgorparser = sprintf('%s at XML input line %d:%d', | |
+ xml_error_string($code), | |
+ xml_get_current_line_number($msgorparser), | |
+ xml_get_current_column_number($msgorparser)); | |
+ } | |
+ $this->PEAR_Error($msgorparser, $code, $mode, $level); | |
+ } | |
+ | |
+ public function XML_Parser_Error($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE) | |
+ { | |
+ self::__construct($msgorparser, $code, $mode, $level); | |
} | |
// }}} | |
} | |
Index: lib/PEAR/XML/Parser/Simple.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/XML/Parser/Simple.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/XML/Parser/Simple.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -145,11 +145,16 @@ | |
* named after elements (handleElement_$name()) | |
* @param string $tgtenc a valid target encoding | |
*/ | |
- function XML_Parser_Simple($srcenc = null, $mode = 'event', $tgtenc = null) | |
- { | |
- $this->XML_Parser($srcenc, $mode, $tgtenc); | |
- } | |
+ public function __construct($srcenc = null, $mode = 'event', $tgtenc = null) | |
+ { | |
+ $this->XML_Parser($srcenc, $mode, $tgtenc); | |
+ } | |
+ public function XML_Parser_Simple($srcenc = null, $mode = 'event', $tgtenc = null) | |
+ { | |
+ self::__construct($srcenc, $mode, $tgtenc); | |
+ } | |
+ | |
/** | |
* inits the handlers | |
* | |
Index: lib/PEAR/XML/Serializer.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/XML/Serializer.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/XML/Serializer.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -585,16 +585,21 @@ | |
* @return void | |
* @access public | |
*/ | |
- function XML_Serializer( $options = null ) | |
- { | |
- $this->PEAR(); | |
- if (is_array($options)) { | |
- $this->options = array_merge($this->_defaultOptions, $options); | |
- } else { | |
- $this->options = $this->_defaultOptions; | |
- } | |
- } | |
+ public function __construct($options = null) | |
+ { | |
+ $this->PEAR(); | |
+ if (is_array($options)) { | |
+ $this->options = array_merge($this->_defaultOptions, $options); | |
+ } else { | |
+ $this->options = $this->_defaultOptions; | |
+ } | |
+ } | |
+ public function XML_Serializer( $options = null ) | |
+ { | |
+ self::__construct($options); | |
+ } | |
+ | |
/** | |
* return API version | |
* | |
Index: lib/PEAR/XML/Unserializer.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/PEAR/XML/Unserializer.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/PEAR/XML/Unserializer.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -432,15 +432,20 @@ | |
* | |
* @access public | |
*/ | |
- function XML_Unserializer($options = null) | |
- { | |
- if (is_array($options)) { | |
- $this->options = array_merge($this->_defaultOptions, $options); | |
- } else { | |
- $this->options = $this->_defaultOptions; | |
- } | |
- } | |
+ public function __construct($options = null) | |
+ { | |
+ if (is_array($options)) { | |
+ $this->options = array_merge($this->_defaultOptions, $options); | |
+ } else { | |
+ $this->options = $this->_defaultOptions; | |
+ } | |
+ } | |
+ public function XML_Unserializer($options = null) | |
+ { | |
+ self::__construct($options); | |
+ } | |
+ | |
/** | |
* return API version | |
* | |
Index: lib/Varien/File/Uploader.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/Varien/File/Uploader.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/Varien/File/Uploader.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -256,7 +256,7 @@ | |
//run validate callbacks | |
foreach ($this->_validateCallbacks as $params) { | |
if (is_object($params['object']) && method_exists($params['object'], $params['method'])) { | |
- $params['object']->$params['method']($this->_file['tmp_name']); | |
+ $params['object']->{$params['method']}($this->_file['tmp_name']); | |
} | |
} | |
} | |
Index: lib/Varien/Pear/Registry.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/Varien/Pear/Registry.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/Varien/Pear/Registry.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -46,7 +46,7 @@ | |
} else { | |
$file = '.pearrc'; | |
} | |
- $this->_config = &new PEAR_Config($this->statedir . DIRECTORY_SEPARATOR . | |
+ $this->_config =& new PEAR_Config($this->statedir . DIRECTORY_SEPARATOR . | |
$file, '-'); // NO SYSTEM INI FILE | |
$this->_config->setRegistry($this); | |
$this->_config->set('php_dir', $this->install_dir); | |
Index: lib/Zend/Feed/Pubsubhubbub/CallbackAbstract.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/Zend/Feed/Pubsubhubbub/CallbackAbstract.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/Zend/Feed/Pubsubhubbub/CallbackAbstract.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -297,9 +297,6 @@ | |
protected function _getRawBody() | |
{ | |
$body = file_get_contents('php://input'); | |
- if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { | |
- $body = $GLOBALS['HTTP_RAW_POST_DATA']; | |
- } | |
if (strlen(trim($body)) > 0) { | |
return $body; | |
} | |
Index: lib/Zend/Ldap/Converter.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/Zend/Ldap/Converter.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/Zend/Ldap/Converter.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -69,7 +69,7 @@ | |
*/ | |
public static function hex32ToAsc($string) | |
{ | |
- $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string); | |
+ $string = preg_replace_callback("/\\\([0-9A-Fa-f]{2})/", function($m){ return chr(hexdec($m[1])); }, $string); | |
return $string; | |
} | |
Index: lib/phpseclib/Crypt/AES.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Crypt/AES.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Crypt/AES.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -149,59 +149,64 @@ | |
* @return Crypt_AES | |
* @access public | |
*/ | |
- function Crypt_AES($mode = CRYPT_AES_MODE_CBC) | |
- { | |
- if ( !defined('CRYPT_AES_MODE') ) { | |
- switch (true) { | |
- case extension_loaded('mcrypt'): | |
- // i'd check to see if aes was supported, by doing in_array('des', mcrypt_list_algorithms('')), | |
- // but since that can be changed after the object has been created, there doesn't seem to be | |
- // a lot of point... | |
- define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT); | |
- break; | |
- default: | |
- define('CRYPT_AES_MODE', CRYPT_AES_MODE_INTERNAL); | |
- } | |
- } | |
+ public function __construct($mode = CRYPT_AES_MODE_CBC) | |
+ { | |
+ if ( !defined('CRYPT_AES_MODE') ) { | |
+ switch (true) { | |
+ case extension_loaded('mcrypt'): | |
+ // i'd check to see if aes was supported, by doing in_array('des', mcrypt_list_algorithms('')), | |
+ // but since that can be changed after the object has been created, there doesn't seem to be | |
+ // a lot of point... | |
+ define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT); | |
+ break; | |
+ default: | |
+ define('CRYPT_AES_MODE', CRYPT_AES_MODE_INTERNAL); | |
+ } | |
+ } | |
- switch ( CRYPT_AES_MODE ) { | |
- case CRYPT_AES_MODE_MCRYPT: | |
- switch ($mode) { | |
- case CRYPT_AES_MODE_ECB: | |
- $this->mode = MCRYPT_MODE_ECB; | |
- break; | |
- case CRYPT_AES_MODE_CTR: | |
- // ctr doesn't have a constant associated with it even though it appears to be fairly widely | |
- // supported. in lieu of knowing just how widely supported it is, i've, for now, opted not to | |
- // include a compatibility layer. the layer has been implemented but, for now, is commented out. | |
- $this->mode = 'ctr'; | |
- //$this->mode = in_array('ctr', mcrypt_list_modes()) ? 'ctr' : CRYPT_AES_MODE_CTR; | |
- break; | |
- case CRYPT_AES_MODE_CBC: | |
- default: | |
- $this->mode = MCRYPT_MODE_CBC; | |
- } | |
+ switch ( CRYPT_AES_MODE ) { | |
+ case CRYPT_AES_MODE_MCRYPT: | |
+ switch ($mode) { | |
+ case CRYPT_AES_MODE_ECB: | |
+ $this->mode = MCRYPT_MODE_ECB; | |
+ break; | |
+ case CRYPT_AES_MODE_CTR: | |
+ // ctr doesn't have a constant associated with it even though it appears to be fairly widely | |
+ // supported. in lieu of knowing just how widely supported it is, i've, for now, opted not to | |
+ // include a compatibility layer. the layer has been implemented but, for now, is commented out. | |
+ $this->mode = 'ctr'; | |
+ //$this->mode = in_array('ctr', mcrypt_list_modes()) ? 'ctr' : CRYPT_AES_MODE_CTR; | |
+ break; | |
+ case CRYPT_AES_MODE_CBC: | |
+ default: | |
+ $this->mode = MCRYPT_MODE_CBC; | |
+ } | |
- break; | |
- default: | |
- switch ($mode) { | |
- case CRYPT_AES_MODE_ECB: | |
- $this->mode = CRYPT_RIJNDAEL_MODE_ECB; | |
- break; | |
- case CRYPT_AES_MODE_CTR: | |
- $this->mode = CRYPT_RIJNDAEL_MODE_CTR; | |
- break; | |
- case CRYPT_AES_MODE_CBC: | |
- default: | |
- $this->mode = CRYPT_RIJNDAEL_MODE_CBC; | |
- } | |
- } | |
+ break; | |
+ default: | |
+ switch ($mode) { | |
+ case CRYPT_AES_MODE_ECB: | |
+ $this->mode = CRYPT_RIJNDAEL_MODE_ECB; | |
+ break; | |
+ case CRYPT_AES_MODE_CTR: | |
+ $this->mode = CRYPT_RIJNDAEL_MODE_CTR; | |
+ break; | |
+ case CRYPT_AES_MODE_CBC: | |
+ default: | |
+ $this->mode = CRYPT_RIJNDAEL_MODE_CBC; | |
+ } | |
+ } | |
- if (CRYPT_AES_MODE == CRYPT_AES_MODE_INTERNAL) { | |
- parent::Crypt_Rijndael($this->mode); | |
- } | |
- } | |
+ if (CRYPT_AES_MODE == CRYPT_AES_MODE_INTERNAL) { | |
+ parent::Crypt_Rijndael($this->mode); | |
+ } | |
+ } | |
+ public function Crypt_AES($mode = CRYPT_AES_MODE_CBC) | |
+ { | |
+ self::__construct($mode); | |
+ } | |
+ | |
/** | |
* Dummy function | |
* | |
Index: lib/phpseclib/Crypt/DES.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Crypt/DES.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Crypt/DES.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -229,50 +229,55 @@ | |
* @return Crypt_DES | |
* @access public | |
*/ | |
- function Crypt_DES($mode = CRYPT_MODE_DES_CBC) | |
- { | |
- if ( !defined('CRYPT_DES_MODE') ) { | |
- switch (true) { | |
- case extension_loaded('mcrypt'): | |
- // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), | |
- // but since that can be changed after the object has been created, there doesn't seem to be | |
- // a lot of point... | |
- define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); | |
- break; | |
- default: | |
- define('CRYPT_DES_MODE', CRYPT_DES_MODE_INTERNAL); | |
- } | |
- } | |
+ public function __construct($mode = CRYPT_MODE_DES_CBC) | |
+ { | |
+ if ( !defined('CRYPT_DES_MODE') ) { | |
+ switch (true) { | |
+ case extension_loaded('mcrypt'): | |
+ // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), | |
+ // but since that can be changed after the object has been created, there doesn't seem to be | |
+ // a lot of point... | |
+ define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); | |
+ break; | |
+ default: | |
+ define('CRYPT_DES_MODE', CRYPT_DES_MODE_INTERNAL); | |
+ } | |
+ } | |
- switch ( CRYPT_DES_MODE ) { | |
- case CRYPT_DES_MODE_MCRYPT: | |
- switch ($mode) { | |
- case CRYPT_DES_MODE_ECB: | |
- $this->mode = MCRYPT_MODE_ECB; | |
- break; | |
- case CRYPT_DES_MODE_CTR: | |
- $this->mode = 'ctr'; | |
- //$this->mode = in_array('ctr', mcrypt_list_modes()) ? 'ctr' : CRYPT_DES_MODE_CTR; | |
- break; | |
- case CRYPT_DES_MODE_CBC: | |
- default: | |
- $this->mode = MCRYPT_MODE_CBC; | |
- } | |
+ switch ( CRYPT_DES_MODE ) { | |
+ case CRYPT_DES_MODE_MCRYPT: | |
+ switch ($mode) { | |
+ case CRYPT_DES_MODE_ECB: | |
+ $this->mode = MCRYPT_MODE_ECB; | |
+ break; | |
+ case CRYPT_DES_MODE_CTR: | |
+ $this->mode = 'ctr'; | |
+ //$this->mode = in_array('ctr', mcrypt_list_modes()) ? 'ctr' : CRYPT_DES_MODE_CTR; | |
+ break; | |
+ case CRYPT_DES_MODE_CBC: | |
+ default: | |
+ $this->mode = MCRYPT_MODE_CBC; | |
+ } | |
- break; | |
- default: | |
- switch ($mode) { | |
- case CRYPT_DES_MODE_ECB: | |
- case CRYPT_DES_MODE_CTR: | |
- case CRYPT_DES_MODE_CBC: | |
- $this->mode = $mode; | |
- break; | |
- default: | |
- $this->mode = CRYPT_DES_MODE_CBC; | |
- } | |
- } | |
- } | |
+ break; | |
+ default: | |
+ switch ($mode) { | |
+ case CRYPT_DES_MODE_ECB: | |
+ case CRYPT_DES_MODE_CTR: | |
+ case CRYPT_DES_MODE_CBC: | |
+ $this->mode = $mode; | |
+ break; | |
+ default: | |
+ $this->mode = CRYPT_DES_MODE_CBC; | |
+ } | |
+ } | |
+ } | |
+ public function Crypt_DES($mode = CRYPT_MODE_DES_CBC) | |
+ { | |
+ self::__construct($mode); | |
+ } | |
+ | |
/** | |
* Sets the key. | |
* | |
Index: lib/phpseclib/Crypt/Hash.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Crypt/Hash.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Crypt/Hash.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -134,6 +134,7 @@ | |
*/ | |
var $ipad; | |
+ | |
/** | |
* Default Constructor. | |
* | |
@@ -141,24 +142,29 @@ | |
* @return Crypt_Hash | |
* @access public | |
*/ | |
- function Crypt_Hash($hash = 'sha1') | |
- { | |
- if ( !defined('CRYPT_HASH_MODE') ) { | |
- switch (true) { | |
- case extension_loaded('hash'): | |
- define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH); | |
- break; | |
- case extension_loaded('mhash'): | |
- define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_MHASH); | |
- break; | |
- default: | |
- define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_INTERNAL); | |
- } | |
- } | |
+ public function __construct($hash = 'sha1') | |
+ { | |
+ if ( !defined('CRYPT_HASH_MODE') ) { | |
+ switch (true) { | |
+ case extension_loaded('hash'): | |
+ define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH); | |
+ break; | |
+ case extension_loaded('mhash'): | |
+ define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_MHASH); | |
+ break; | |
+ default: | |
+ define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_INTERNAL); | |
+ } | |
+ } | |
- $this->setHash($hash); | |
- } | |
+ $this->setHash($hash); | |
+ } | |
+ public function Crypt_Hash($hash = 'sha1') | |
+ { | |
+ self::__construct($hash); | |
+ } | |
+ | |
/** | |
* Sets the key for HMACs | |
* | |
Index: lib/phpseclib/Crypt/RC4.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Crypt/RC4.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Crypt/RC4.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -168,33 +168,38 @@ | |
* @return Crypt_RC4 | |
* @access public | |
*/ | |
- function Crypt_RC4() | |
- { | |
- if ( !defined('CRYPT_RC4_MODE') ) { | |
- switch (true) { | |
- case extension_loaded('mcrypt') && (defined('MCRYPT_ARCFOUR') || defined('MCRYPT_RC4')): | |
- // i'd check to see if rc4 was supported, by doing in_array('arcfour', mcrypt_list_algorithms('')), | |
- // but since that can be changed after the object has been created, there doesn't seem to be | |
- // a lot of point... | |
- define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_MCRYPT); | |
- break; | |
- default: | |
- define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_INTERNAL); | |
- } | |
- } | |
+ public function __construct() | |
+ { | |
+ if ( !defined('CRYPT_RC4_MODE') ) { | |
+ switch (true) { | |
+ case extension_loaded('mcrypt') && (defined('MCRYPT_ARCFOUR') || defined('MCRYPT_RC4')): | |
+ // i'd check to see if rc4 was supported, by doing in_array('arcfour', mcrypt_list_algorithms('')), | |
+ // but since that can be changed after the object has been created, there doesn't seem to be | |
+ // a lot of point... | |
+ define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_MCRYPT); | |
+ break; | |
+ default: | |
+ define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_INTERNAL); | |
+ } | |
+ } | |
- switch ( CRYPT_RC4_MODE ) { | |
- case CRYPT_RC4_MODE_MCRYPT: | |
- switch (true) { | |
- case defined('MCRYPT_ARCFOUR'): | |
- $this->mode = MCRYPT_ARCFOUR; | |
- break; | |
- case defined('MCRYPT_RC4'); | |
- $this->mode = MCRYPT_RC4; | |
- } | |
- } | |
- } | |
+ switch ( CRYPT_RC4_MODE ) { | |
+ case CRYPT_RC4_MODE_MCRYPT: | |
+ switch (true) { | |
+ case defined('MCRYPT_ARCFOUR'): | |
+ $this->mode = MCRYPT_ARCFOUR; | |
+ break; | |
+ case defined('MCRYPT_RC4'); | |
+ $this->mode = MCRYPT_RC4; | |
+ } | |
+ } | |
+ } | |
+ public function Crypt_RC4() | |
+ { | |
+ self::__construct(); | |
+ } | |
+ | |
/** | |
* Sets the key. | |
* | |
Index: lib/phpseclib/Crypt/RSA.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Crypt/RSA.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Crypt/RSA.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -212,198 +212,203 @@ | |
* @package Crypt_RSA | |
*/ | |
class Crypt_RSA { | |
- /** | |
- * Precomputed Zero | |
- * | |
- * @var Array | |
- * @access private | |
- */ | |
- var $zero; | |
+ /** | |
+ * Precomputed Zero | |
+ * | |
+ * @var Array | |
+ * @access private | |
+ */ | |
+ var $zero; | |
- /** | |
- * Precomputed One | |
- * | |
- * @var Array | |
- * @access private | |
- */ | |
- var $one; | |
+ /** | |
+ * Precomputed One | |
+ * | |
+ * @var Array | |
+ * @access private | |
+ */ | |
+ var $one; | |
- /** | |
- * Private Key Format | |
- * | |
- * @var Integer | |
- * @access private | |
- */ | |
- var $privateKeyFormat = CRYPT_RSA_PRIVATE_FORMAT_PKCS1; | |
+ /** | |
+ * Private Key Format | |
+ * | |
+ * @var Integer | |
+ * @access private | |
+ */ | |
+ var $privateKeyFormat = CRYPT_RSA_PRIVATE_FORMAT_PKCS1; | |
- /** | |
- * Public Key Format | |
- * | |
- * @var Integer | |
- * @access public | |
- */ | |
- var $publicKeyFormat = CRYPT_RSA_PUBLIC_FORMAT_PKCS1; | |
+ /** | |
+ * Public Key Format | |
+ * | |
+ * @var Integer | |
+ * @access public | |
+ */ | |
+ var $publicKeyFormat = CRYPT_RSA_PUBLIC_FORMAT_PKCS1; | |
- /** | |
- * Modulus (ie. n) | |
- * | |
- * @var Math_BigInteger | |
- * @access private | |
- */ | |
- var $modulus; | |
+ /** | |
+ * Modulus (ie. n) | |
+ * | |
+ * @var Math_BigInteger | |
+ * @access private | |
+ */ | |
+ var $modulus; | |
- /** | |
- * Modulus length | |
- * | |
- * @var Math_BigInteger | |
- * @access private | |
- */ | |
- var $k; | |
+ /** | |
+ * Modulus length | |
+ * | |
+ * @var Math_BigInteger | |
+ * @access private | |
+ */ | |
+ var $k; | |
- /** | |
- * Exponent (ie. e or d) | |
- * | |
- * @var Math_BigInteger | |
- * @access private | |
- */ | |
- var $exponent; | |
+ /** | |
+ * Exponent (ie. e or d) | |
+ * | |
+ * @var Math_BigInteger | |
+ * @access private | |
+ */ | |
+ var $exponent; | |
- /** | |
- * Primes for Chinese Remainder Theorem (ie. p and q) | |
- * | |
- * @var Array | |
- * @access private | |
- */ | |
- var $primes; | |
+ /** | |
+ * Primes for Chinese Remainder Theorem (ie. p and q) | |
+ * | |
+ * @var Array | |
+ * @access private | |
+ */ | |
+ var $primes; | |
- /** | |
- * Exponents for Chinese Remainder Theorem (ie. dP and dQ) | |
- * | |
- * @var Array | |
- * @access private | |
- */ | |
- var $exponents; | |
+ /** | |
+ * Exponents for Chinese Remainder Theorem (ie. dP and dQ) | |
+ * | |
+ * @var Array | |
+ * @access private | |
+ */ | |
+ var $exponents; | |
- /** | |
- * Coefficients for Chinese Remainder Theorem (ie. qInv) | |
- * | |
- * @var Array | |
- * @access private | |
- */ | |
- var $coefficients; | |
+ /** | |
+ * Coefficients for Chinese Remainder Theorem (ie. qInv) | |
+ * | |
+ * @var Array | |
+ * @access private | |
+ */ | |
+ var $coefficients; | |
- /** | |
- * Hash name | |
- * | |
- * @var String | |
- * @access private | |
- */ | |
- var $hashName; | |
+ /** | |
+ * Hash name | |
+ * | |
+ * @var String | |
+ * @access private | |
+ */ | |
+ var $hashName; | |
- /** | |
- * Hash function | |
- * | |
- * @var Crypt_Hash | |
- * @access private | |
- */ | |
- var $hash; | |
+ /** | |
+ * Hash function | |
+ * | |
+ * @var Crypt_Hash | |
+ * @access private | |
+ */ | |
+ var $hash; | |
- /** | |
- * Length of hash function output | |
- * | |
- * @var Integer | |
- * @access private | |
- */ | |
- var $hLen; | |
+ /** | |
+ * Length of hash function output | |
+ * | |
+ * @var Integer | |
+ * @access private | |
+ */ | |
+ var $hLen; | |
- /** | |
- * Length of salt | |
- * | |
- * @var Integer | |
- * @access private | |
- */ | |
- var $sLen; | |
+ /** | |
+ * Length of salt | |
+ * | |
+ * @var Integer | |
+ * @access private | |
+ */ | |
+ var $sLen; | |
- /** | |
- * Hash function for the Mask Generation Function | |
- * | |
- * @var Crypt_Hash | |
- * @access private | |
- */ | |
- var $mgfHash; | |
+ /** | |
+ * Hash function for the Mask Generation Function | |
+ * | |
+ * @var Crypt_Hash | |
+ * @access private | |
+ */ | |
+ var $mgfHash; | |
- /** | |
- * Length of MGF hash function output | |
- * | |
- * @var Integer | |
- * @access private | |
- */ | |
- var $mgfHLen; | |
+ /** | |
+ * Length of MGF hash function output | |
+ * | |
+ * @var Integer | |
+ * @access private | |
+ */ | |
+ var $mgfHLen; | |
- /** | |
- * Encryption mode | |
- * | |
- * @var Integer | |
- * @access private | |
- */ | |
- var $encryptionMode = CRYPT_RSA_ENCRYPTION_OAEP; | |
+ /** | |
+ * Encryption mode | |
+ * | |
+ * @var Integer | |
+ * @access private | |
+ */ | |
+ var $encryptionMode = CRYPT_RSA_ENCRYPTION_OAEP; | |
- /** | |
- * Signature mode | |
- * | |
- * @var Integer | |
- * @access private | |
- */ | |
- var $signatureMode = CRYPT_RSA_SIGNATURE_PSS; | |
+ /** | |
+ * Signature mode | |
+ * | |
+ * @var Integer | |
+ * @access private | |
+ */ | |
+ var $signatureMode = CRYPT_RSA_SIGNATURE_PSS; | |
- /** | |
- * Public Exponent | |
- * | |
- * @var Mixed | |
- * @access private | |
- */ | |
- var $publicExponent = false; | |
+ /** | |
+ * Public Exponent | |
+ * | |
+ * @var Mixed | |
+ * @access private | |
+ */ | |
+ var $publicExponent = false; | |
- /** | |
- * Password | |
- * | |
- * @var String | |
- * @access private | |
- */ | |
- var $password = ''; | |
+ /** | |
+ * Password | |
+ * | |
+ * @var String | |
+ * @access private | |
+ */ | |
+ var $password = ''; | |
- /** | |
- * The constructor | |
- * | |
- * If you want to make use of the openssl extension, you'll need to set the mode manually, yourself. The reason | |
- * Crypt_RSA doesn't do it is because OpenSSL doesn't fail gracefully. openssl_pkey_new(), in particular, requires | |
- * openssl.cnf be present somewhere and, unfortunately, the only real way to find out is too late. | |
- * | |
- * @return Crypt_RSA | |
- * @access public | |
- */ | |
- function Crypt_RSA() | |
- { | |
- if ( !defined('CRYPT_RSA_MODE') ) { | |
- switch (true) { | |
- //case extension_loaded('openssl') && version_compare(PHP_VERSION, '4.2.0', '>='): | |
- // define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_OPENSSL); | |
- // break; | |
- default: | |
- define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL); | |
- } | |
- } | |
+ /** | |
+ * The constructor | |
+ * | |
+ * If you want to make use of the openssl extension, you'll need to set the mode manually, yourself. The reason | |
+ * Crypt_RSA doesn't do it is because OpenSSL doesn't fail gracefully. openssl_pkey_new(), in particular, requires | |
+ * openssl.cnf be present somewhere and, unfortunately, the only real way to find out is too late. | |
+ * | |
+ * @return Crypt_RSA | |
+ * @access public | |
+ */ | |
+ public function __construct() | |
+ { | |
+ if ( !defined('CRYPT_RSA_MODE') ) { | |
+ switch (true) { | |
+ //case extension_loaded('openssl') && version_compare(PHP_VERSION, '4.2.0', '>='): | |
+ // define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_OPENSSL); | |
+ // break; | |
+ default: | |
+ define('CRYPT_RSA_MODE', CRYPT_RSA_MODE_INTERNAL); | |
+ } | |
+ } | |
- $this->zero = new Math_BigInteger(); | |
- $this->one = new Math_BigInteger(1); | |
+ $this->zero = new Math_BigInteger(); | |
+ $this->one = new Math_BigInteger(1); | |
- $this->hash = new Crypt_Hash('sha1'); | |
- $this->hLen = $this->hash->getLength(); | |
- $this->hashName = 'sha1'; | |
- $this->mgfHash = new Crypt_Hash('sha1'); | |
- $this->mgfHLen = $this->mgfHash->getLength(); | |
- } | |
+ $this->hash = new Crypt_Hash('sha1'); | |
+ $this->hLen = $this->hash->getLength(); | |
+ $this->hashName = 'sha1'; | |
+ $this->mgfHash = new Crypt_Hash('sha1'); | |
+ $this->mgfHLen = $this->mgfHash->getLength(); | |
+ } | |
+ public function Crypt_RSA() | |
+ { | |
+ self::__construct(); | |
+ } | |
+ | |
/** | |
* Create public / private key pair | |
* | |
Index: lib/phpseclib/Crypt/Rijndael.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Crypt/Rijndael.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Crypt/Rijndael.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -366,112 +366,117 @@ | |
* @return Crypt_Rijndael | |
* @access public | |
*/ | |
- function Crypt_Rijndael($mode = CRYPT_RIJNDAEL_MODE_CBC) | |
- { | |
- switch ($mode) { | |
- case CRYPT_RIJNDAEL_MODE_ECB: | |
- case CRYPT_RIJNDAEL_MODE_CBC: | |
- case CRYPT_RIJNDAEL_MODE_CTR: | |
- $this->mode = $mode; | |
- break; | |
- default: | |
- $this->mode = CRYPT_RIJNDAEL_MODE_CBC; | |
- } | |
+ public function __construct($mode = CRYPT_RIJNDAEL_MODE_CBC) | |
+ { | |
+ switch ($mode) { | |
+ case CRYPT_RIJNDAEL_MODE_ECB: | |
+ case CRYPT_RIJNDAEL_MODE_CBC: | |
+ case CRYPT_RIJNDAEL_MODE_CTR: | |
+ $this->mode = $mode; | |
+ break; | |
+ default: | |
+ $this->mode = CRYPT_RIJNDAEL_MODE_CBC; | |
+ } | |
- $t3 = &$this->t3; | |
- $t2 = &$this->t2; | |
- $t1 = &$this->t1; | |
- $t0 = &$this->t0; | |
+ $t3 = &$this->t3; | |
+ $t2 = &$this->t2; | |
+ $t1 = &$this->t1; | |
+ $t0 = &$this->t0; | |
- $dt3 = &$this->dt3; | |
- $dt2 = &$this->dt2; | |
- $dt1 = &$this->dt1; | |
- $dt0 = &$this->dt0; | |
+ $dt3 = &$this->dt3; | |
+ $dt2 = &$this->dt2; | |
+ $dt1 = &$this->dt1; | |
+ $dt0 = &$this->dt0; | |
- // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1), | |
- // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so | |
- // those are the names we'll use. | |
- $t3 = array( | |
- 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491, | |
- 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC, | |
- 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB, | |
- 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B, | |
- 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83, | |
- 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A, | |
- 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F, | |
- 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA, | |
- 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B, | |
- 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713, | |
- 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6, | |
- 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85, | |
- 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411, | |
- 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B, | |
- 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1, | |
- 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF, | |
- 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E, | |
- 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6, | |
- 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B, | |
- 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD, | |
- 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8, | |
- 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2, | |
- 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049, | |
- 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810, | |
- 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197, | |
- 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F, | |
- 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C, | |
- 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927, | |
- 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, | |
- 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, | |
- 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, | |
- 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C | |
- ); | |
+ // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1), | |
+ // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so | |
+ // those are the names we'll use. | |
+ $t3 = array( | |
+ 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491, | |
+ 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC, | |
+ 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB, | |
+ 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B, | |
+ 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83, | |
+ 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A, | |
+ 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F, | |
+ 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA, | |
+ 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B, | |
+ 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713, | |
+ 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6, | |
+ 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85, | |
+ 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411, | |
+ 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B, | |
+ 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1, | |
+ 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF, | |
+ 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E, | |
+ 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6, | |
+ 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B, | |
+ 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD, | |
+ 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8, | |
+ 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2, | |
+ 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049, | |
+ 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810, | |
+ 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197, | |
+ 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F, | |
+ 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C, | |
+ 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927, | |
+ 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, | |
+ 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, | |
+ 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, | |
+ 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C | |
+ ); | |
- $dt3 = array( | |
- 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B, | |
- 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5, | |
- 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B, | |
- 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E, | |
- 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D, | |
- 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9, | |
- 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66, | |
- 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED, | |
- 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4, | |
- 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD, | |
- 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60, | |
- 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79, | |
- 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C, | |
- 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24, | |
- 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C, | |
- 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814, | |
- 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B, | |
- 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084, | |
- 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077, | |
- 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22, | |
- 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F, | |
- 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582, | |
- 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB, | |
- 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF, | |
- 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035, | |
- 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17, | |
- 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46, | |
- 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D, | |
- 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, | |
- 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, | |
- 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, | |
- 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 | |
- ); | |
+ $dt3 = array( | |
+ 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B, | |
+ 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5, | |
+ 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B, | |
+ 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E, | |
+ 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D, | |
+ 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9, | |
+ 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66, | |
+ 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED, | |
+ 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4, | |
+ 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD, | |
+ 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60, | |
+ 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79, | |
+ 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C, | |
+ 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24, | |
+ 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C, | |
+ 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814, | |
+ 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B, | |
+ 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084, | |
+ 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077, | |
+ 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22, | |
+ 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F, | |
+ 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582, | |
+ 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB, | |
+ 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF, | |
+ 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035, | |
+ 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17, | |
+ 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46, | |
+ 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D, | |
+ 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, | |
+ 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, | |
+ 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, | |
+ 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 | |
+ ); | |
- for ($i = 0; $i < 256; $i++) { | |
- $t2[$i << 8] = (($t3[$i] << 8) & 0xFFFFFF00) | (($t3[$i] >> 24) & 0x000000FF); | |
- $t1[$i << 16] = (($t3[$i] << 16) & 0xFFFF0000) | (($t3[$i] >> 16) & 0x0000FFFF); | |
- $t0[$i << 24] = (($t3[$i] << 24) & 0xFF000000) | (($t3[$i] >> 8) & 0x00FFFFFF); | |
+ for ($i = 0; $i < 256; $i++) { | |
+ $t2[$i << 8] = (($t3[$i] << 8) & 0xFFFFFF00) | (($t3[$i] >> 24) & 0x000000FF); | |
+ $t1[$i << 16] = (($t3[$i] << 16) & 0xFFFF0000) | (($t3[$i] >> 16) & 0x0000FFFF); | |
+ $t0[$i << 24] = (($t3[$i] << 24) & 0xFF000000) | (($t3[$i] >> 8) & 0x00FFFFFF); | |
- $dt2[$i << 8] = (($this->dt3[$i] << 8) & 0xFFFFFF00) | (($dt3[$i] >> 24) & 0x000000FF); | |
- $dt1[$i << 16] = (($this->dt3[$i] << 16) & 0xFFFF0000) | (($dt3[$i] >> 16) & 0x0000FFFF); | |
- $dt0[$i << 24] = (($this->dt3[$i] << 24) & 0xFF000000) | (($dt3[$i] >> 8) & 0x00FFFFFF); | |
- } | |
- } | |
+ $dt2[$i << 8] = (($this->dt3[$i] << 8) & 0xFFFFFF00) | (($dt3[$i] >> 24) & 0x000000FF); | |
+ $dt1[$i << 16] = (($this->dt3[$i] << 16) & 0xFFFF0000) | (($dt3[$i] >> 16) & 0x0000FFFF); | |
+ $dt0[$i << 24] = (($this->dt3[$i] << 24) & 0xFF000000) | (($dt3[$i] >> 8) & 0x00FFFFFF); | |
+ } | |
+ } | |
+ public function Crypt_Rijndael($mode = CRYPT_RIJNDAEL_MODE_CBC) | |
+ { | |
+ self::__construct($mode); | |
+ } | |
+ | |
/** | |
* Sets the key. | |
* | |
Index: lib/phpseclib/Crypt/TripleDES.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Crypt/TripleDES.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Crypt/TripleDES.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -194,76 +194,81 @@ | |
* @return Crypt_TripleDES | |
* @access public | |
*/ | |
- function Crypt_TripleDES($mode = CRYPT_DES_MODE_CBC) | |
- { | |
- if ( !defined('CRYPT_DES_MODE') ) { | |
- switch (true) { | |
- case extension_loaded('mcrypt'): | |
- // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), | |
- // but since that can be changed after the object has been created, there doesn't seem to be | |
- // a lot of point... | |
- define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); | |
- break; | |
- default: | |
- define('CRYPT_DES_MODE', CRYPT_DES_MODE_INTERNAL); | |
- } | |
- } | |
+ public function __construct($mode = CRYPT_DES_MODE_CBC) | |
+ { | |
+ if ( !defined('CRYPT_DES_MODE') ) { | |
+ switch (true) { | |
+ case extension_loaded('mcrypt'): | |
+ // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), | |
+ // but since that can be changed after the object has been created, there doesn't seem to be | |
+ // a lot of point... | |
+ define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); | |
+ break; | |
+ default: | |
+ define('CRYPT_DES_MODE', CRYPT_DES_MODE_INTERNAL); | |
+ } | |
+ } | |
- if ( $mode == CRYPT_DES_MODE_3CBC ) { | |
- $this->mode = CRYPT_DES_MODE_3CBC; | |
- $this->des = array( | |
- new Crypt_DES(CRYPT_DES_MODE_CBC), | |
- new Crypt_DES(CRYPT_DES_MODE_CBC), | |
- new Crypt_DES(CRYPT_DES_MODE_CBC) | |
- ); | |
+ if ( $mode == CRYPT_DES_MODE_3CBC ) { | |
+ $this->mode = CRYPT_DES_MODE_3CBC; | |
+ $this->des = array( | |
+ new Crypt_DES(CRYPT_DES_MODE_CBC), | |
+ new Crypt_DES(CRYPT_DES_MODE_CBC), | |
+ new Crypt_DES(CRYPT_DES_MODE_CBC) | |
+ ); | |
- // we're going to be doing the padding, ourselves, so disable it in the Crypt_DES objects | |
- $this->des[0]->disablePadding(); | |
- $this->des[1]->disablePadding(); | |
- $this->des[2]->disablePadding(); | |
+ // we're going to be doing the padding, ourselves, so disable it in the Crypt_DES objects | |
+ $this->des[0]->disablePadding(); | |
+ $this->des[1]->disablePadding(); | |
+ $this->des[2]->disablePadding(); | |
- return; | |
- } | |
+ return; | |
+ } | |
- switch ( CRYPT_DES_MODE ) { | |
- case CRYPT_DES_MODE_MCRYPT: | |
- switch ($mode) { | |
- case CRYPT_DES_MODE_ECB: | |
- $this->mode = MCRYPT_MODE_ECB; | |
- break; | |
- case CRYPT_DES_MODE_CTR: | |
- $this->mode = 'ctr'; | |
- break; | |
- case CRYPT_DES_MODE_CBC: | |
- default: | |
- $this->mode = MCRYPT_MODE_CBC; | |
- } | |
+ switch ( CRYPT_DES_MODE ) { | |
+ case CRYPT_DES_MODE_MCRYPT: | |
+ switch ($mode) { | |
+ case CRYPT_DES_MODE_ECB: | |
+ $this->mode = MCRYPT_MODE_ECB; | |
+ break; | |
+ case CRYPT_DES_MODE_CTR: | |
+ $this->mode = 'ctr'; | |
+ break; | |
+ case CRYPT_DES_MODE_CBC: | |
+ default: | |
+ $this->mode = MCRYPT_MODE_CBC; | |
+ } | |
- break; | |
- default: | |
- $this->des = array( | |
- new Crypt_DES(CRYPT_DES_MODE_ECB), | |
- new Crypt_DES(CRYPT_DES_MODE_ECB), | |
- new Crypt_DES(CRYPT_DES_MODE_ECB) | |
- ); | |
- | |
- // we're going to be doing the padding, ourselves, so disable it in the Crypt_DES objects | |
- $this->des[0]->disablePadding(); | |
- $this->des[1]->disablePadding(); | |
- $this->des[2]->disablePadding(); | |
+ break; | |
+ default: | |
+ $this->des = array( | |
+ new Crypt_DES(CRYPT_DES_MODE_ECB), | |
+ new Crypt_DES(CRYPT_DES_MODE_ECB), | |
+ new Crypt_DES(CRYPT_DES_MODE_ECB) | |
+ ); | |
+ | |
+ // we're going to be doing the padding, ourselves, so disable it in the Crypt_DES objects | |
+ $this->des[0]->disablePadding(); | |
+ $this->des[1]->disablePadding(); | |
+ $this->des[2]->disablePadding(); | |
- switch ($mode) { | |
- case CRYPT_DES_MODE_ECB: | |
- case CRYPT_DES_MODE_CTR: | |
- case CRYPT_DES_MODE_CBC: | |
- $this->mode = $mode; | |
- break; | |
- default: | |
- $this->mode = CRYPT_DES_MODE_CBC; | |
- } | |
- } | |
- } | |
+ switch ($mode) { | |
+ case CRYPT_DES_MODE_ECB: | |
+ case CRYPT_DES_MODE_CTR: | |
+ case CRYPT_DES_MODE_CBC: | |
+ $this->mode = $mode; | |
+ break; | |
+ default: | |
+ $this->mode = CRYPT_DES_MODE_CBC; | |
+ } | |
+ } | |
+ } | |
+ public function Crypt_TripleDES($mode = CRYPT_DES_MODE_CBC) | |
+ { | |
+ self::__construct($mode); | |
+ } | |
+ | |
/** | |
* Sets the key. | |
* | |
Index: lib/phpseclib/Math/BigInteger.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Math/BigInteger.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Math/BigInteger.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -264,188 +264,193 @@ | |
* @return Math_BigInteger | |
* @access public | |
*/ | |
- function Math_BigInteger($x = 0, $base = 10) | |
- { | |
- if ( !defined('MATH_BIGINTEGER_MODE') ) { | |
- switch (true) { | |
- case extension_loaded('gmp'): | |
- define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP); | |
- break; | |
- case extension_loaded('bcmath'): | |
- define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH); | |
- break; | |
- default: | |
- define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL); | |
- } | |
- } | |
+ public function __construct($x = 0, $base = 10) | |
+ { | |
+ if ( !defined('MATH_BIGINTEGER_MODE') ) { | |
+ switch (true) { | |
+ case extension_loaded('gmp'): | |
+ define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP); | |
+ break; | |
+ case extension_loaded('bcmath'): | |
+ define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH); | |
+ break; | |
+ default: | |
+ define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL); | |
+ } | |
+ } | |
- switch ( MATH_BIGINTEGER_MODE ) { | |
- case MATH_BIGINTEGER_MODE_GMP: | |
- if (is_resource($x) && get_resource_type($x) == 'GMP integer') { | |
- $this->value = $x; | |
- return; | |
- } | |
- $this->value = gmp_init(0); | |
- break; | |
- case MATH_BIGINTEGER_MODE_BCMATH: | |
- $this->value = '0'; | |
- break; | |
- default: | |
- $this->value = array(); | |
- } | |
+ switch ( MATH_BIGINTEGER_MODE ) { | |
+ case MATH_BIGINTEGER_MODE_GMP: | |
+ if (is_resource($x) && get_resource_type($x) == 'GMP integer') { | |
+ $this->value = $x; | |
+ return; | |
+ } | |
+ $this->value = gmp_init(0); | |
+ break; | |
+ case MATH_BIGINTEGER_MODE_BCMATH: | |
+ $this->value = '0'; | |
+ break; | |
+ default: | |
+ $this->value = array(); | |
+ } | |
- if (empty($x)) { | |
- return; | |
- } | |
+ if (empty($x)) { | |
+ return; | |
+ } | |
- switch ($base) { | |
- case -256: | |
- if (ord($x[0]) & 0x80) { | |
- $x = ~$x; | |
- $this->is_negative = true; | |
- } | |
- case 256: | |
- switch ( MATH_BIGINTEGER_MODE ) { | |
- case MATH_BIGINTEGER_MODE_GMP: | |
- $sign = $this->is_negative ? '-' : ''; | |
- $this->value = gmp_init($sign . '0x' . bin2hex($x)); | |
- break; | |
- case MATH_BIGINTEGER_MODE_BCMATH: | |
- // round $len to the nearest 4 (thanks, DavidMJ!) | |
- $len = (strlen($x) + 3) & 0xFFFFFFFC; | |
+ switch ($base) { | |
+ case -256: | |
+ if (ord($x[0]) & 0x80) { | |
+ $x = ~$x; | |
+ $this->is_negative = true; | |
+ } | |
+ case 256: | |
+ switch ( MATH_BIGINTEGER_MODE ) { | |
+ case MATH_BIGINTEGER_MODE_GMP: | |
+ $sign = $this->is_negative ? '-' : ''; | |
+ $this->value = gmp_init($sign . '0x' . bin2hex($x)); | |
+ break; | |
+ case MATH_BIGINTEGER_MODE_BCMATH: | |
+ // round $len to the nearest 4 (thanks, DavidMJ!) | |
+ $len = (strlen($x) + 3) & 0xFFFFFFFC; | |
- $x = str_pad($x, $len, chr(0), STR_PAD_LEFT); | |
+ $x = str_pad($x, $len, chr(0), STR_PAD_LEFT); | |
- for ($i = 0; $i < $len; $i+= 4) { | |
- $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32 | |
- $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0); | |
- } | |
+ for ($i = 0; $i < $len; $i+= 4) { | |
+ $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32 | |
+ $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0); | |
+ } | |
- if ($this->is_negative) { | |
- $this->value = '-' . $this->value; | |
- } | |
+ if ($this->is_negative) { | |
+ $this->value = '-' . $this->value; | |
+ } | |
- break; | |
- // converts a base-2**8 (big endian / msb) number to base-2**26 (little endian / lsb) | |
- default: | |
- while (strlen($x)) { | |
- $this->value[] = $this->_bytes2int($this->_base256_rshift($x, 26)); | |
- } | |
- } | |
+ break; | |
+ // converts a base-2**8 (big endian / msb) number to base-2**26 (little endian / lsb) | |
+ default: | |
+ while (strlen($x)) { | |
+ $this->value[] = $this->_bytes2int($this->_base256_rshift($x, 26)); | |
+ } | |
+ } | |
- if ($this->is_negative) { | |
- if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) { | |
- $this->is_negative = false; | |
- } | |
- $temp = $this->add(new Math_BigInteger('-1')); | |
- $this->value = $temp->value; | |
- } | |
- break; | |
- case 16: | |
- case -16: | |
- if ($base > 0 && $x[0] == '-') { | |
- $this->is_negative = true; | |
- $x = substr($x, 1); | |
- } | |
+ if ($this->is_negative) { | |
+ if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) { | |
+ $this->is_negative = false; | |
+ } | |
+ $temp = $this->add(new Math_BigInteger('-1')); | |
+ $this->value = $temp->value; | |
+ } | |
+ break; | |
+ case 16: | |
+ case -16: | |
+ if ($base > 0 && $x[0] == '-') { | |
+ $this->is_negative = true; | |
+ $x = substr($x, 1); | |
+ } | |
- $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x); | |
+ $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x); | |
- $is_negative = false; | |
- if ($base < 0 && hexdec($x[0]) >= 8) { | |
- $this->is_negative = $is_negative = true; | |
- $x = bin2hex(~pack('H*', $x)); | |
- } | |
+ $is_negative = false; | |
+ if ($base < 0 && hexdec($x[0]) >= 8) { | |
+ $this->is_negative = $is_negative = true; | |
+ $x = bin2hex(~pack('H*', $x)); | |
+ } | |
- switch ( MATH_BIGINTEGER_MODE ) { | |
- case MATH_BIGINTEGER_MODE_GMP: | |
- $temp = $this->is_negative ? '-0x' . $x : '0x' . $x; | |
- $this->value = gmp_init($temp); | |
- $this->is_negative = false; | |
- break; | |
- case MATH_BIGINTEGER_MODE_BCMATH: | |
- $x = ( strlen($x) & 1 ) ? '0' . $x : $x; | |
- $temp = new Math_BigInteger(pack('H*', $x), 256); | |
- $this->value = $this->is_negative ? '-' . $temp->value : $temp->value; | |
- $this->is_negative = false; | |
- break; | |
- default: | |
- $x = ( strlen($x) & 1 ) ? '0' . $x : $x; | |
- $temp = new Math_BigInteger(pack('H*', $x), 256); | |
- $this->value = $temp->value; | |
- } | |
+ switch ( MATH_BIGINTEGER_MODE ) { | |
+ case MATH_BIGINTEGER_MODE_GMP: | |
+ $temp = $this->is_negative ? '-0x' . $x : '0x' . $x; | |
+ $this->value = gmp_init($temp); | |
+ $this->is_negative = false; | |
+ break; | |
+ case MATH_BIGINTEGER_MODE_BCMATH: | |
+ $x = ( strlen($x) & 1 ) ? '0' . $x : $x; | |
+ $temp = new Math_BigInteger(pack('H*', $x), 256); | |
+ $this->value = $this->is_negative ? '-' . $temp->value : $temp->value; | |
+ $this->is_negative = false; | |
+ break; | |
+ default: | |
+ $x = ( strlen($x) & 1 ) ? '0' . $x : $x; | |
+ $temp = new Math_BigInteger(pack('H*', $x), 256); | |
+ $this->value = $temp->value; | |
+ } | |
- if ($is_negative) { | |
- $temp = $this->add(new Math_BigInteger('-1')); | |
- $this->value = $temp->value; | |
- } | |
- break; | |
- case 10: | |
- case -10: | |
- $x = preg_replace('#^(-?[0-9]*).*#', '$1', $x); | |
+ if ($is_negative) { | |
+ $temp = $this->add(new Math_BigInteger('-1')); | |
+ $this->value = $temp->value; | |
+ } | |
+ break; | |
+ case 10: | |
+ case -10: | |
+ $x = preg_replace('#^(-?[0-9]*).*#', '$1', $x); | |
- switch ( MATH_BIGINTEGER_MODE ) { | |
- case MATH_BIGINTEGER_MODE_GMP: | |
- $this->value = gmp_init($x); | |
- break; | |
- case MATH_BIGINTEGER_MODE_BCMATH: | |
- // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different | |
- // results then doing it on '-1' does (modInverse does $x[0]) | |
- $this->value = (string) $x; | |
- break; | |
- default: | |
- $temp = new Math_BigInteger(); | |
+ switch ( MATH_BIGINTEGER_MODE ) { | |
+ case MATH_BIGINTEGER_MODE_GMP: | |
+ $this->value = gmp_init($x); | |
+ break; | |
+ case MATH_BIGINTEGER_MODE_BCMATH: | |
+ // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different | |
+ // results then doing it on '-1' does (modInverse does $x[0]) | |
+ $this->value = (string) $x; | |
+ break; | |
+ default: | |
+ $temp = new Math_BigInteger(); | |
- // array(10000000) is 10**7 in base-2**26. 10**7 is the closest to 2**26 we can get without passing it. | |
- $multiplier = new Math_BigInteger(); | |
- $multiplier->value = array(10000000); | |
+ // array(10000000) is 10**7 in base-2**26. 10**7 is the closest to 2**26 we can get without passing it. | |
+ $multiplier = new Math_BigInteger(); | |
+ $multiplier->value = array(10000000); | |
- if ($x[0] == '-') { | |
- $this->is_negative = true; | |
- $x = substr($x, 1); | |
- } | |
+ if ($x[0] == '-') { | |
+ $this->is_negative = true; | |
+ $x = substr($x, 1); | |
+ } | |
- $x = str_pad($x, strlen($x) + (6 * strlen($x)) % 7, 0, STR_PAD_LEFT); | |
+ $x = str_pad($x, strlen($x) + (6 * strlen($x)) % 7, 0, STR_PAD_LEFT); | |
- while (strlen($x)) { | |
- $temp = $temp->multiply($multiplier); | |
- $temp = $temp->add(new Math_BigInteger($this->_int2bytes(substr($x, 0, 7)), 256)); | |
- $x = substr($x, 7); | |
- } | |
+ while (strlen($x)) { | |
+ $temp = $temp->multiply($multiplier); | |
+ $temp = $temp->add(new Math_BigInteger($this->_int2bytes(substr($x, 0, 7)), 256)); | |
+ $x = substr($x, 7); | |
+ } | |
- $this->value = $temp->value; | |
- } | |
- break; | |
- case 2: // base-2 support originally implemented by Lluis Pamies - thanks! | |
- case -2: | |
- if ($base > 0 && $x[0] == '-') { | |
- $this->is_negative = true; | |
- $x = substr($x, 1); | |
- } | |
+ $this->value = $temp->value; | |
+ } | |
+ break; | |
+ case 2: // base-2 support originally implemented by Lluis Pamies - thanks! | |
+ case -2: | |
+ if ($base > 0 && $x[0] == '-') { | |
+ $this->is_negative = true; | |
+ $x = substr($x, 1); | |
+ } | |
- $x = preg_replace('#^([01]*).*#', '$1', $x); | |
- $x = str_pad($x, strlen($x) + (3 * strlen($x)) % 4, 0, STR_PAD_LEFT); | |
+ $x = preg_replace('#^([01]*).*#', '$1', $x); | |
+ $x = str_pad($x, strlen($x) + (3 * strlen($x)) % 4, 0, STR_PAD_LEFT); | |
- $str = '0x'; | |
- while (strlen($x)) { | |
- $part = substr($x, 0, 4); | |
- $str.= dechex(bindec($part)); | |
- $x = substr($x, 4); | |
- } | |
+ $str = '0x'; | |
+ while (strlen($x)) { | |
+ $part = substr($x, 0, 4); | |
+ $str.= dechex(bindec($part)); | |
+ $x = substr($x, 4); | |
+ } | |
- if ($this->is_negative) { | |
- $str = '-' . $str; | |
- } | |
+ if ($this->is_negative) { | |
+ $str = '-' . $str; | |
+ } | |
- $temp = new Math_BigInteger($str, 8 * $base); // ie. either -16 or +16 | |
- $this->value = $temp->value; | |
- $this->is_negative = $temp->is_negative; | |
+ $temp = new Math_BigInteger($str, 8 * $base); // ie. either -16 or +16 | |
+ $this->value = $temp->value; | |
+ $this->is_negative = $temp->is_negative; | |
- break; | |
- default: | |
- // base not supported, so we'll let $this == 0 | |
- } | |
- } | |
+ break; | |
+ default: | |
+ // base not supported, so we'll let $this == 0 | |
+ } | |
+ } | |
+ public function Math_BigInteger($x = 0, $base = 10) | |
+ { | |
+ self::__construct($x, $base); | |
+ } | |
+ | |
/** | |
* Converts a BigInteger to a byte string (eg. base-256). | |
* | |
Index: lib/phpseclib/Net/SFTP.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Net/SFTP.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Net/SFTP.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -223,81 +223,86 @@ | |
* @return Net_SFTP | |
* @access public | |
*/ | |
- function Net_SFTP($host, $port = 22, $timeout = 10) | |
- { | |
- parent::Net_SSH2($host, $port, $timeout); | |
- $this->packet_types = array( | |
- 1 => 'NET_SFTP_INIT', | |
- 2 => 'NET_SFTP_VERSION', | |
- /* the format of SSH_FXP_OPEN changed between SFTPv4 and SFTPv5+: | |
- SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.1 | |
- pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 */ | |
- 3 => 'NET_SFTP_OPEN', | |
- 4 => 'NET_SFTP_CLOSE', | |
- 5 => 'NET_SFTP_READ', | |
- 6 => 'NET_SFTP_WRITE', | |
- 8 => 'NET_SFTP_FSTAT', | |
- 9 => 'NET_SFTP_SETSTAT', | |
- 11 => 'NET_SFTP_OPENDIR', | |
- 12 => 'NET_SFTP_READDIR', | |
- 13 => 'NET_SFTP_REMOVE', | |
- 14 => 'NET_SFTP_MKDIR', | |
- 15 => 'NET_SFTP_RMDIR', | |
- 16 => 'NET_SFTP_REALPATH', | |
- 17 => 'NET_SFTP_STAT', | |
- /* the format of SSH_FXP_RENAME changed between SFTPv4 and SFTPv5+: | |
- SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 | |
- pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.5 */ | |
- 18 => 'NET_SFTP_RENAME', | |
+ public function __construct($host, $port = 22, $timeout = 10) | |
+ { | |
+ parent::Net_SSH2($host, $port, $timeout); | |
+ $this->packet_types = array( | |
+ 1 => 'NET_SFTP_INIT', | |
+ 2 => 'NET_SFTP_VERSION', | |
+ /* the format of SSH_FXP_OPEN changed between SFTPv4 and SFTPv5+: | |
+ SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.1 | |
+ pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 */ | |
+ 3 => 'NET_SFTP_OPEN', | |
+ 4 => 'NET_SFTP_CLOSE', | |
+ 5 => 'NET_SFTP_READ', | |
+ 6 => 'NET_SFTP_WRITE', | |
+ 8 => 'NET_SFTP_FSTAT', | |
+ 9 => 'NET_SFTP_SETSTAT', | |
+ 11 => 'NET_SFTP_OPENDIR', | |
+ 12 => 'NET_SFTP_READDIR', | |
+ 13 => 'NET_SFTP_REMOVE', | |
+ 14 => 'NET_SFTP_MKDIR', | |
+ 15 => 'NET_SFTP_RMDIR', | |
+ 16 => 'NET_SFTP_REALPATH', | |
+ 17 => 'NET_SFTP_STAT', | |
+ /* the format of SSH_FXP_RENAME changed between SFTPv4 and SFTPv5+: | |
+ SFTPv5+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 | |
+ pre-SFTPv5 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.5 */ | |
+ 18 => 'NET_SFTP_RENAME', | |
- 101=> 'NET_SFTP_STATUS', | |
- 102=> 'NET_SFTP_HANDLE', | |
- /* the format of SSH_FXP_NAME changed between SFTPv3 and SFTPv4+: | |
- SFTPv4+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.4 | |
- pre-SFTPv4 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-7 */ | |
- 103=> 'NET_SFTP_DATA', | |
- 104=> 'NET_SFTP_NAME', | |
- 105=> 'NET_SFTP_ATTRS', | |
+ 101=> 'NET_SFTP_STATUS', | |
+ 102=> 'NET_SFTP_HANDLE', | |
+ /* the format of SSH_FXP_NAME changed between SFTPv3 and SFTPv4+: | |
+ SFTPv4+: http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.4 | |
+ pre-SFTPv4 : http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-7 */ | |
+ 103=> 'NET_SFTP_DATA', | |
+ 104=> 'NET_SFTP_NAME', | |
+ 105=> 'NET_SFTP_ATTRS', | |
- 200=> 'NET_SFTP_EXTENDED' | |
- ); | |
- $this->status_codes = array( | |
- 0 => 'NET_SFTP_STATUS_OK', | |
- 1 => 'NET_SFTP_STATUS_EOF', | |
- 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE', | |
- 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED', | |
- 4 => 'NET_SFTP_STATUS_FAILURE', | |
- 5 => 'NET_SFTP_STATUS_BAD_MESSAGE', | |
- 6 => 'NET_SFTP_STATUS_NO_CONNECTION', | |
- 7 => 'NET_SFTP_STATUS_CONNECTION_LOST', | |
- 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED' | |
- ); | |
- // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1 | |
- // the order, in this case, matters quite a lot - see Net_SFTP::_parseAttributes() to understand why | |
- $this->attributes = array( | |
- 0x00000001 => 'NET_SFTP_ATTR_SIZE', | |
- 0x00000002 => 'NET_SFTP_ATTR_UIDGID', // defined in SFTPv3, removed in SFTPv4+ | |
- 0x00000004 => 'NET_SFTP_ATTR_PERMISSIONS', | |
- 0x00000008 => 'NET_SFTP_ATTR_ACCESSTIME', | |
- -1 => 'NET_SFTP_ATTR_EXTENDED' // unpack('N', "\xFF\xFF\xFF\xFF") == array(1 => int(-1)) | |
- ); | |
- // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 | |
- // the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name | |
- // the array for that $this->open5_flags and similarily alter the constant names. | |
- $this->open_flags = array( | |
- 0x00000001 => 'NET_SFTP_OPEN_READ', | |
- 0x00000002 => 'NET_SFTP_OPEN_WRITE', | |
- 0x00000008 => 'NET_SFTP_OPEN_CREATE', | |
- 0x00000010 => 'NET_SFTP_OPEN_TRUNCATE' | |
- ); | |
- $this->_define_array( | |
- $this->packet_types, | |
- $this->status_codes, | |
- $this->attributes, | |
- $this->open_flags | |
- ); | |
- } | |
+ 200=> 'NET_SFTP_EXTENDED' | |
+ ); | |
+ $this->status_codes = array( | |
+ 0 => 'NET_SFTP_STATUS_OK', | |
+ 1 => 'NET_SFTP_STATUS_EOF', | |
+ 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE', | |
+ 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED', | |
+ 4 => 'NET_SFTP_STATUS_FAILURE', | |
+ 5 => 'NET_SFTP_STATUS_BAD_MESSAGE', | |
+ 6 => 'NET_SFTP_STATUS_NO_CONNECTION', | |
+ 7 => 'NET_SFTP_STATUS_CONNECTION_LOST', | |
+ 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED' | |
+ ); | |
+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1 | |
+ // the order, in this case, matters quite a lot - see Net_SFTP::_parseAttributes() to understand why | |
+ $this->attributes = array( | |
+ 0x00000001 => 'NET_SFTP_ATTR_SIZE', | |
+ 0x00000002 => 'NET_SFTP_ATTR_UIDGID', // defined in SFTPv3, removed in SFTPv4+ | |
+ 0x00000004 => 'NET_SFTP_ATTR_PERMISSIONS', | |
+ 0x00000008 => 'NET_SFTP_ATTR_ACCESSTIME', | |
+ -1 => 'NET_SFTP_ATTR_EXTENDED' // unpack('N', "\xFF\xFF\xFF\xFF") == array(1 => int(-1)) | |
+ ); | |
+ // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 | |
+ // the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name | |
+ // the array for that $this->open5_flags and similarily alter the constant names. | |
+ $this->open_flags = array( | |
+ 0x00000001 => 'NET_SFTP_OPEN_READ', | |
+ 0x00000002 => 'NET_SFTP_OPEN_WRITE', | |
+ 0x00000008 => 'NET_SFTP_OPEN_CREATE', | |
+ 0x00000010 => 'NET_SFTP_OPEN_TRUNCATE' | |
+ ); | |
+ $this->_define_array( | |
+ $this->packet_types, | |
+ $this->status_codes, | |
+ $this->attributes, | |
+ $this->open_flags | |
+ ); | |
+ } | |
+ public function Net_SFTP($host, $port = 22, $timeout = 10) | |
+ { | |
+ self::__construct($host, $port, $timeout); | |
+ } | |
+ | |
/** | |
* Login | |
* | |
Index: lib/phpseclib/Net/SSH1.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Net/SSH1.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Net/SSH1.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -389,153 +389,158 @@ | |
* @return Net_SSH1 | |
* @access public | |
*/ | |
- function Net_SSH1($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES) | |
- { | |
- $this->fsock = @fsockopen($host, $port, $errno, $errstr, $timeout); | |
- if (!$this->fsock) { | |
- user_error(rtrim("Cannot connect to $host. Error $errno. $errstr"), E_USER_NOTICE); | |
- return; | |
- } | |
+ public function __construct($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES) | |
+ { | |
+ $this->fsock = @fsockopen($host, $port, $errno, $errstr, $timeout); | |
+ if (!$this->fsock) { | |
+ user_error(rtrim("Cannot connect to $host. Error $errno. $errstr"), E_USER_NOTICE); | |
+ return; | |
+ } | |
- $this->server_identification = $init_line = fgets($this->fsock, 255); | |
- if (!preg_match('#SSH-([0-9\.]+)-(.+)#', $init_line, $parts)) { | |
- user_error('Can only connect to SSH servers', E_USER_NOTICE); | |
- return; | |
- } | |
- if ($parts[1][0] != 1) { | |
- user_error("Cannot connect to SSH $parts[1] servers", E_USER_NOTICE); | |
- return; | |
- } | |
+ $this->server_identification = $init_line = fgets($this->fsock, 255); | |
+ if (!preg_match('#SSH-([0-9\.]+)-(.+)#', $init_line, $parts)) { | |
+ user_error('Can only connect to SSH servers', E_USER_NOTICE); | |
+ return; | |
+ } | |
+ if ($parts[1][0] != 1) { | |
+ user_error("Cannot connect to SSH $parts[1] servers", E_USER_NOTICE); | |
+ return; | |
+ } | |
- fputs($this->fsock, $this->identifier."\r\n"); | |
+ fputs($this->fsock, $this->identifier."\r\n"); | |
- $response = $this->_get_binary_packet(); | |
- if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_PUBLIC_KEY) { | |
- user_error('Expected SSH_SMSG_PUBLIC_KEY', E_USER_NOTICE); | |
- return; | |
- } | |
+ $response = $this->_get_binary_packet(); | |
+ if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_PUBLIC_KEY) { | |
+ user_error('Expected SSH_SMSG_PUBLIC_KEY', E_USER_NOTICE); | |
+ return; | |
+ } | |
- $anti_spoofing_cookie = $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 8); | |
+ $anti_spoofing_cookie = $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 8); | |
- $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); | |
+ $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); | |
- $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
- $server_key_public_exponent = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
- $this->server_key_public_exponent = $server_key_public_exponent; | |
+ $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
+ $server_key_public_exponent = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
+ $this->server_key_public_exponent = $server_key_public_exponent; | |
- $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
- $server_key_public_modulus = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
- $this->server_key_public_modulus = $server_key_public_modulus; | |
+ $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
+ $server_key_public_modulus = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
+ $this->server_key_public_modulus = $server_key_public_modulus; | |
- $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); | |
+ $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); | |
- $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
- $host_key_public_exponent = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
- $this->host_key_public_exponent = $host_key_public_exponent; | |
+ $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
+ $host_key_public_exponent = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
+ $this->host_key_public_exponent = $host_key_public_exponent; | |
- $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
- $host_key_public_modulus = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
- $this->host_key_public_modulus = $host_key_public_modulus; | |
+ $temp = unpack('nlen', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 2)); | |
+ $host_key_public_modulus = new Math_BigInteger($this->_string_shift($response[NET_SSH1_RESPONSE_DATA], ceil($temp['len'] / 8)), 256); | |
+ $this->host_key_public_modulus = $host_key_public_modulus; | |
- $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); | |
+ $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4); | |
- // get a list of the supported ciphers | |
- extract(unpack('Nsupported_ciphers_mask', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4))); | |
- foreach ($this->supported_ciphers as $mask=>$name) { | |
- if (($supported_ciphers_mask & (1 << $mask)) == 0) { | |
- unset($this->supported_ciphers[$mask]); | |
- } | |
- } | |
+ // get a list of the supported ciphers | |
+ extract(unpack('Nsupported_ciphers_mask', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4))); | |
+ foreach ($this->supported_ciphers as $mask=>$name) { | |
+ if (($supported_ciphers_mask & (1 << $mask)) == 0) { | |
+ unset($this->supported_ciphers[$mask]); | |
+ } | |
+ } | |
- // get a list of the supported authentications | |
- extract(unpack('Nsupported_authentications_mask', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4))); | |
- foreach ($this->supported_authentications as $mask=>$name) { | |
- if (($supported_authentications_mask & (1 << $mask)) == 0) { | |
- unset($this->supported_authentications[$mask]); | |
- } | |
- } | |
+ // get a list of the supported authentications | |
+ extract(unpack('Nsupported_authentications_mask', $this->_string_shift($response[NET_SSH1_RESPONSE_DATA], 4))); | |
+ foreach ($this->supported_authentications as $mask=>$name) { | |
+ if (($supported_authentications_mask & (1 << $mask)) == 0) { | |
+ unset($this->supported_authentications[$mask]); | |
+ } | |
+ } | |
- $session_id = pack('H*', md5($host_key_public_modulus->toBytes() . $server_key_public_modulus->toBytes() . $anti_spoofing_cookie)); | |
+ $session_id = pack('H*', md5($host_key_public_modulus->toBytes() . $server_key_public_modulus->toBytes() . $anti_spoofing_cookie)); | |
- $session_key = ''; | |
- for ($i = 0; $i < 32; $i++) { | |
- $session_key.= chr(crypt_random(0, 255)); | |
- } | |
- $double_encrypted_session_key = $session_key ^ str_pad($session_id, 32, chr(0)); | |
+ $session_key = ''; | |
+ for ($i = 0; $i < 32; $i++) { | |
+ $session_key.= chr(crypt_random(0, 255)); | |
+ } | |
+ $double_encrypted_session_key = $session_key ^ str_pad($session_id, 32, chr(0)); | |
- if ($server_key_public_modulus->compare($host_key_public_modulus) < 0) { | |
- $double_encrypted_session_key = $this->_rsa_crypt( | |
- $double_encrypted_session_key, | |
- array( | |
- $server_key_public_exponent, | |
- $server_key_public_modulus | |
- ) | |
- ); | |
- $double_encrypted_session_key = $this->_rsa_crypt( | |
- $double_encrypted_session_key, | |
- array( | |
- $host_key_public_exponent, | |
- $host_key_public_modulus | |
- ) | |
- ); | |
- } else { | |
- $double_encrypted_session_key = $this->_rsa_crypt( | |
- $double_encrypted_session_key, | |
- array( | |
- $host_key_public_exponent, | |
- $host_key_public_modulus | |
- ) | |
- ); | |
- $double_encrypted_session_key = $this->_rsa_crypt( | |
- $double_encrypted_session_key, | |
- array( | |
- $server_key_public_exponent, | |
- $server_key_public_modulus | |
- ) | |
- ); | |
- } | |
+ if ($server_key_public_modulus->compare($host_key_public_modulus) < 0) { | |
+ $double_encrypted_session_key = $this->_rsa_crypt( | |
+ $double_encrypted_session_key, | |
+ array( | |
+ $server_key_public_exponent, | |
+ $server_key_public_modulus | |
+ ) | |
+ ); | |
+ $double_encrypted_session_key = $this->_rsa_crypt( | |
+ $double_encrypted_session_key, | |
+ array( | |
+ $host_key_public_exponent, | |
+ $host_key_public_modulus | |
+ ) | |
+ ); | |
+ } else { | |
+ $double_encrypted_session_key = $this->_rsa_crypt( | |
+ $double_encrypted_session_key, | |
+ array( | |
+ $host_key_public_exponent, | |
+ $host_key_public_modulus | |
+ ) | |
+ ); | |
+ $double_encrypted_session_key = $this->_rsa_crypt( | |
+ $double_encrypted_session_key, | |
+ array( | |
+ $server_key_public_exponent, | |
+ $server_key_public_modulus | |
+ ) | |
+ ); | |
+ } | |
- $cipher = isset($this->supported_ciphers[$cipher]) ? $cipher : NET_SSH1_CIPHER_3DES; | |
- $data = pack('C2a*na*N', NET_SSH1_CMSG_SESSION_KEY, $cipher, $anti_spoofing_cookie, 8 * strlen($double_encrypted_session_key), $double_encrypted_session_key, 0); | |
+ $cipher = isset($this->supported_ciphers[$cipher]) ? $cipher : NET_SSH1_CIPHER_3DES; | |
+ $data = pack('C2a*na*N', NET_SSH1_CMSG_SESSION_KEY, $cipher, $anti_spoofing_cookie, 8 * strlen($double_encrypted_session_key), $double_encrypted_session_key, 0); | |
- if (!$this->_send_binary_packet($data)) { | |
- user_error('Error sending SSH_CMSG_SESSION_KEY', E_USER_NOTICE); | |
- return; | |
- } | |
+ if (!$this->_send_binary_packet($data)) { | |
+ user_error('Error sending SSH_CMSG_SESSION_KEY', E_USER_NOTICE); | |
+ return; | |
+ } | |
- switch ($cipher) { | |
- //case NET_SSH1_CIPHER_NONE: | |
- // $this->crypto = new Crypt_Null(); | |
- // break; | |
- case NET_SSH1_CIPHER_DES: | |
- $this->crypto = new Crypt_DES(); | |
- $this->crypto->disablePadding(); | |
- $this->crypto->enableContinuousBuffer(); | |
- $this->crypto->setKey(substr($session_key, 0, 8)); | |
- break; | |
- case NET_SSH1_CIPHER_3DES: | |
- $this->crypto = new Crypt_TripleDES(CRYPT_DES_MODE_3CBC); | |
- $this->crypto->disablePadding(); | |
- $this->crypto->enableContinuousBuffer(); | |
- $this->crypto->setKey(substr($session_key, 0, 24)); | |
- break; | |
- //case NET_SSH1_CIPHER_RC4: | |
- // $this->crypto = new Crypt_RC4(); | |
- // $this->crypto->enableContinuousBuffer(); | |
- // $this->crypto->setKey(substr($session_key, 0, 16)); | |
- // break; | |
- } | |
+ switch ($cipher) { | |
+ //case NET_SSH1_CIPHER_NONE: | |
+ // $this->crypto = new Crypt_Null(); | |
+ // break; | |
+ case NET_SSH1_CIPHER_DES: | |
+ $this->crypto = new Crypt_DES(); | |
+ $this->crypto->disablePadding(); | |
+ $this->crypto->enableContinuousBuffer(); | |
+ $this->crypto->setKey(substr($session_key, 0, 8)); | |
+ break; | |
+ case NET_SSH1_CIPHER_3DES: | |
+ $this->crypto = new Crypt_TripleDES(CRYPT_DES_MODE_3CBC); | |
+ $this->crypto->disablePadding(); | |
+ $this->crypto->enableContinuousBuffer(); | |
+ $this->crypto->setKey(substr($session_key, 0, 24)); | |
+ break; | |
+ //case NET_SSH1_CIPHER_RC4: | |
+ // $this->crypto = new Crypt_RC4(); | |
+ // $this->crypto->enableContinuousBuffer(); | |
+ // $this->crypto->setKey(substr($session_key, 0, 16)); | |
+ // break; | |
+ } | |
- $response = $this->_get_binary_packet(); | |
+ $response = $this->_get_binary_packet(); | |
- if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) { | |
- user_error('Expected SSH_SMSG_SUCCESS', E_USER_NOTICE); | |
- return; | |
- } | |
+ if ($response[NET_SSH1_RESPONSE_TYPE] != NET_SSH1_SMSG_SUCCESS) { | |
+ user_error('Expected SSH_SMSG_SUCCESS', E_USER_NOTICE); | |
+ return; | |
+ } | |
- $this->bitmap = NET_SSH1_MASK_CONSTRUCTOR; | |
- } | |
+ $this->bitmap = NET_SSH1_MASK_CONSTRUCTOR; | |
+ } | |
+ public function Net_SSH1($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES) | |
+ { | |
+ self::__construct($host, $port, $timeout, $cipher); | |
+ } | |
+ | |
/** | |
* Login | |
* | |
Index: lib/phpseclib/Net/SSH2.php | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- lib/phpseclib/Net/SSH2.php (revision 6ea22c9abff24da3f3f2aaed59c527ff803c02eb) | |
+++ lib/phpseclib/Net/SSH2.php (revision 07375d7d2c92ab2b07657e0d40f816c4ace33612) | |
@@ -574,153 +574,158 @@ | |
* @return Net_SSH2 | |
* @access public | |
*/ | |
- function Net_SSH2($host, $port = 22, $timeout = 10) | |
- { | |
- $this->message_numbers = array( | |
- 1 => 'NET_SSH2_MSG_DISCONNECT', | |
- 2 => 'NET_SSH2_MSG_IGNORE', | |
- 3 => 'NET_SSH2_MSG_UNIMPLEMENTED', | |
- 4 => 'NET_SSH2_MSG_DEBUG', | |
- 5 => 'NET_SSH2_MSG_SERVICE_REQUEST', | |
- 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT', | |
- 20 => 'NET_SSH2_MSG_KEXINIT', | |
- 21 => 'NET_SSH2_MSG_NEWKEYS', | |
- 30 => 'NET_SSH2_MSG_KEXDH_INIT', | |
- 31 => 'NET_SSH2_MSG_KEXDH_REPLY', | |
- 50 => 'NET_SSH2_MSG_USERAUTH_REQUEST', | |
- 51 => 'NET_SSH2_MSG_USERAUTH_FAILURE', | |
- 52 => 'NET_SSH2_MSG_USERAUTH_SUCCESS', | |
- 53 => 'NET_SSH2_MSG_USERAUTH_BANNER', | |
+ public function __construct($host, $port = 22, $timeout = 10) | |
+ { | |
+ $this->message_numbers = array( | |
+ 1 => 'NET_SSH2_MSG_DISCONNECT', | |
+ 2 => 'NET_SSH2_MSG_IGNORE', | |
+ 3 => 'NET_SSH2_MSG_UNIMPLEMENTED', | |
+ 4 => 'NET_SSH2_MSG_DEBUG', | |
+ 5 => 'NET_SSH2_MSG_SERVICE_REQUEST', | |
+ 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT', | |
+ 20 => 'NET_SSH2_MSG_KEXINIT', | |
+ 21 => 'NET_SSH2_MSG_NEWKEYS', | |
+ 30 => 'NET_SSH2_MSG_KEXDH_INIT', | |
+ 31 => 'NET_SSH2_MSG_KEXDH_REPLY', | |
+ 50 => 'NET_SSH2_MSG_USERAUTH_REQUEST', | |
+ 51 => 'NET_SSH2_MSG_USERAUTH_FAILURE', | |
+ 52 => 'NET_SSH2_MSG_USERAUTH_SUCCESS', | |
+ 53 => 'NET_SSH2_MSG_USERAUTH_BANNER', | |
- 80 => 'NET_SSH2_MSG_GLOBAL_REQUEST', | |
- 81 => 'NET_SSH2_MSG_REQUEST_SUCCESS', | |
- 82 => 'NET_SSH2_MSG_REQUEST_FAILURE', | |
- 90 => 'NET_SSH2_MSG_CHANNEL_OPEN', | |
- 91 => 'NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION', | |
- 92 => 'NET_SSH2_MSG_CHANNEL_OPEN_FAILURE', | |
- 93 => 'NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST', | |
- 94 => 'NET_SSH2_MSG_CHANNEL_DATA', | |
- 95 => 'NET_SSH2_MSG_CHANNEL_EXTENDED_DATA', | |
- 96 => 'NET_SSH2_MSG_CHANNEL_EOF', | |
- 97 => 'NET_SSH2_MSG_CHANNEL_CLOSE', | |
- 98 => 'NET_SSH2_MSG_CHANNEL_REQUEST', | |
- 99 => 'NET_SSH2_MSG_CHANNEL_SUCCESS', | |
- 100 => 'NET_SSH2_MSG_CHANNEL_FAILURE' | |
- ); | |
- $this->disconnect_reasons = array( | |
- 1 => 'NET_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT', | |
- 2 => 'NET_SSH2_DISCONNECT_PROTOCOL_ERROR', | |
- 3 => 'NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED', | |
- 4 => 'NET_SSH2_DISCONNECT_RESERVED', | |
- 5 => 'NET_SSH2_DISCONNECT_MAC_ERROR', | |
- 6 => 'NET_SSH2_DISCONNECT_COMPRESSION_ERROR', | |
- 7 => 'NET_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE', | |
- 8 => 'NET_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED', | |
- 9 => 'NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE', | |
- 10 => 'NET_SSH2_DISCONNECT_CONNECTION_LOST', | |
- 11 => 'NET_SSH2_DISCONNECT_BY_APPLICATION', | |
- 12 => 'NET_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS', | |
- 13 => 'NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER', | |
- 14 => 'NET_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE', | |
- 15 => 'NET_SSH2_DISCONNECT_ILLEGAL_USER_NAME' | |
- ); | |
- $this->channel_open_failure_reasons = array( | |
- 1 => 'NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED' | |
- ); | |
- $this->terminal_modes = array( | |
- 0 => 'NET_SSH2_TTY_OP_END' | |
- ); | |
- $this->channel_extended_data_type_codes = array( | |
- 1 => 'NET_SSH2_EXTENDED_DATA_STDERR' | |
- ); | |
+ 80 => 'NET_SSH2_MSG_GLOBAL_REQUEST', | |
+ 81 => 'NET_SSH2_MSG_REQUEST_SUCCESS', | |
+ 82 => 'NET_SSH2_MSG_REQUEST_FAILURE', | |
+ 90 => 'NET_SSH2_MSG_CHANNEL_OPEN', | |
+ 91 => 'NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION', | |
+ 92 => 'NET_SSH2_MSG_CHANNEL_OPEN_FAILURE', | |
+ 93 => 'NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST', | |
+ 94 => 'NET_SSH2_MSG_CHANNEL_DATA', | |
+ 95 => 'NET_SSH2_MSG_CHANNEL_EXTENDED_DATA', | |
+ 96 => 'NET_SSH2_MSG_CHANNEL_EOF', | |
+ 97 => 'NET_SSH2_MSG_CHANNEL_CLOSE', | |
+ 98 => 'NET_SSH2_MSG_CHANNEL_REQUEST', | |
+ 99 => 'NET_SSH2_MSG_CHANNEL_SUCCESS', | |
+ 100 => 'NET_SSH2_MSG_CHANNEL_FAILURE' | |
+ ); | |
+ $this->disconnect_reasons = array( | |
+ 1 => 'NET_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT', | |
+ 2 => 'NET_SSH2_DISCONNECT_PROTOCOL_ERROR', | |
+ 3 => 'NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED', | |
+ 4 => 'NET_SSH2_DISCONNECT_RESERVED', | |
+ 5 => 'NET_SSH2_DISCONNECT_MAC_ERROR', | |
+ 6 => 'NET_SSH2_DISCONNECT_COMPRESSION_ERROR', | |
+ 7 => 'NET_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE', | |
+ 8 => 'NET_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED', | |
+ 9 => 'NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE', | |
+ 10 => 'NET_SSH2_DISCONNECT_CONNECTION_LOST', | |
+ 11 => 'NET_SSH2_DISCONNECT_BY_APPLICATION', | |
+ 12 => 'NET_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS', | |
+ 13 => 'NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER', | |
+ 14 => 'NET_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE', | |
+ 15 => 'NET_SSH2_DISCONNECT_ILLEGAL_USER_NAME' | |
+ ); | |
+ $this->channel_open_failure_reasons = array( | |
+ 1 => 'NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED' | |
+ ); | |
+ $this->terminal_modes = array( | |
+ 0 => 'NET_SSH2_TTY_OP_END' | |
+ ); | |
+ $this->channel_extended_data_type_codes = array( | |
+ 1 => 'NET_SSH2_EXTENDED_DATA_STDERR' | |
+ ); | |
- $this->_define_array( | |
- $this->message_numbers, | |
- $this->disconnect_reasons, | |
- $this->channel_open_failure_reasons, | |
- $this->terminal_modes, | |
- $this->channel_extended_data_type_codes, | |
- array(60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'), | |
- array(60 => 'NET_SSH2_MSG_USERAUTH_PK_OK') | |
- ); | |
+ $this->_define_array( | |
+ $this->message_numbers, | |
+ $this->disconnect_reasons, | |
+ $this->channel_open_failure_reasons, | |
+ $this->terminal_modes, | |
+ $this->channel_extended_data_type_codes, | |
+ array(60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'), | |
+ array(60 => 'NET_SSH2_MSG_USERAUTH_PK_OK') | |
+ ); | |
- $this->fsock = @fsockopen($host, $port, $errno, $errstr, $timeout); | |
- if (!$this->fsock) { | |
- user_error(rtrim("Cannot connect to $host. Error $errno. $errstr"), E_USER_NOTICE); | |
- return; | |
- } | |
+ $this->fsock = @fsockopen($host, $port, $errno, $errstr, $timeout); | |
+ if (!$this->fsock) { | |
+ user_error(rtrim("Cannot connect to $host. Error $errno. $errstr"), E_USER_NOTICE); | |
+ return; | |
+ } | |
- /* According to the SSH2 specs, | |
+ /* According to the SSH2 specs, | |
- "The server MAY send other lines of data before sending the version | |
- string. Each line SHOULD be terminated by a Carriage Return and Line | |
- Feed. Such lines MUST NOT begin with "SSH-", and SHOULD be encoded | |
- in ISO-10646 UTF-8 [RFC3629] (language is not specified). Clients | |
- MUST be able to process such lines." */ | |
- $temp = ''; | |
- $extra = ''; | |
- while (!feof($this->fsock) && !preg_match('#^SSH-(\d\.\d+)#', $temp, $matches)) { | |
- if (substr($temp, -2) == "\r\n") { | |
- $extra.= $temp; | |
- $temp = ''; | |
- } | |
- $temp.= fgets($this->fsock, 255); | |
- } | |
+ "The server MAY send other lines of data before sending the version | |
+ string. Each line SHOULD be terminated by a Carriage Return and Line | |
+ Feed. Such lines MUST NOT begin with "SSH-", and SHOULD be encoded | |
+ in ISO-10646 UTF-8 [RFC3629] (language is not specified). Clients | |
+ MUST be able to process such lines." */ | |
+ $temp = ''; | |
+ $extra = ''; | |
+ while (!feof($this->fsock) && !preg_match('#^SSH-(\d\.\d+)#', $temp, $matches)) { | |
+ if (substr($temp, -2) == "\r\n") { | |
+ $extra.= $temp; | |
+ $temp = ''; | |
+ } | |
+ $temp.= fgets($this->fsock, 255); | |
+ } | |
- $ext = array(); | |
- if (extension_loaded('mcrypt')) { | |
- $ext[] = 'mcrypt'; | |
- } | |
- if (extension_loaded('gmp')) { | |
- $ext[] = 'gmp'; | |
- } else if (extension_loaded('bcmath')) { | |
- $ext[] = 'bcmath'; | |
- } | |
+ $ext = array(); | |
+ if (extension_loaded('mcrypt')) { | |
+ $ext[] = 'mcrypt'; | |
+ } | |
+ if (extension_loaded('gmp')) { | |
+ $ext[] = 'gmp'; | |
+ } else if (extension_loaded('bcmath')) { | |
+ $ext[] = 'bcmath'; | |
+ } | |
- if (!empty($ext)) { | |
- $this->identifier.= ' (' . implode(', ', $ext) . ')'; | |
- } | |
+ if (!empty($ext)) { | |
+ $this->identifier.= ' (' . implode(', ', $ext) . ')'; | |
+ } | |
- if (defined('NET_SSH2_LOGGING')) { | |
- $this->message_number_log[] = '<-'; | |
- $this->message_number_log[] = '->'; | |
+ if (defined('NET_SSH2_LOGGING')) { | |
+ $this->message_number_log[] = '<-'; | |
+ $this->message_number_log[] = '->'; | |
- if (NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX) { | |
- $this->message_log[] = $temp; | |
- $this->message_log[] = $this->identifier . "\r\n"; | |
- } | |
- } | |
+ if (NET_SSH2_LOGGING == NET_SSH2_LOG_COMPLEX) { | |
+ $this->message_log[] = $temp; | |
+ $this->message_log[] = $this->identifier . "\r\n"; | |
+ } | |
+ } | |
- $this->server_identifier = trim($temp, "\r\n"); | |
- if (!empty($extra)) { | |
- $this->errors[] = utf8_decode($extra); | |
- } | |
+ $this->server_identifier = trim($temp, "\r\n"); | |
+ if (!empty($extra)) { | |
+ $this->errors[] = utf8_decode($extra); | |
+ } | |
- if ($matches[1] != '1.99' && $matches[1] != '2.0') { | |
- user_error("Cannot connect to SSH $matches[1] servers", E_USER_NOTICE); | |
- return; | |
- } | |
+ if ($matches[1] != '1.99' && $matches[1] != '2.0') { | |
+ user_error("Cannot connect to SSH $matches[1] servers", E_USER_NOTICE); | |
+ return; | |
+ } | |
- fputs($this->fsock, $this->identifier . "\r\n"); | |
+ fputs($this->fsock, $this->identifier . "\r\n"); | |
- $response = $this->_get_binary_packet(); | |
- if ($response === false) { | |
- user_error('Connection closed by server', E_USER_NOTICE); | |
- return; | |
- } | |
+ $response = $this->_get_binary_packet(); | |
+ if ($response === false) { | |
+ user_error('Connection closed by server', E_USER_NOTICE); | |
+ return; | |
+ } | |
- if (ord($response[0]) != NET_SSH2_MSG_KEXINIT) { | |
- user_error('Expected SSH_MSG_KEXINIT', E_USER_NOTICE); | |
- return; | |
- } | |
+ if (ord($response[0]) != NET_SSH2_MSG_KEXINIT) { | |
+ user_error('Expected SSH_MSG_KEXINIT', E_USER_NOTICE); | |
+ return; | |
+ } | |
- if (!$this->_key_exchange($response)) { | |
- return; | |
- } | |
+ if (!$this->_key_exchange($response)) { | |
+ return; | |
+ } | |
- $this->bitmap = NET_SSH2_MASK_CONSTRUCTOR; | |
- } | |
+ $this->bitmap = NET_SSH2_MASK_CONSTRUCTOR; | |
+ } | |
+ public function Net_SSH2($host, $port = 22, $timeout = 10) | |
+ { | |
+ self::__construct($host, $port, $timeout); | |
+ } | |
+ | |
/** | |
* Key Exchange | |
* | |
@@ -2015,9 +2020,10 @@ | |
} | |
$fragment = $this->_string_shift($current_log, $short_width); | |
$hex = substr( | |
- preg_replace( | |
- '#(.)#es', | |
- '"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', | |
+ preg_replace_callback( | |
+ '#(.)#s', | |
+ function($m) use($boundary){ return "$boundary" . str_pad(dechex(ord(substr($m[1], -1))), 2, "0", STR_PAD_LEFT); }, | |
+ //'"' . $boundary . '" . str_pad(dechex(ord(substr("\\1", -1))), 2, "0", STR_PAD_LEFT)', | |
$fragment), | |
strlen($boundary) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment