'+a.parse.displaytitle+"
"+jQuery(b).text().substring(0,200)+"...
diff --git a/.jshintignore b/.jshintignore
new file mode 100644
index 000000000..5f00d3da3
--- /dev/null
+++ b/.jshintignore
@@ -0,0 +1,9 @@
+common/js/jquery*.js
+common/js/modernizr.js
+common/js/xe.js
+common/js/x.js
+common/js/*.min.js
+common/js/unittest/*
+common/js/plugins/*
+common/js/foggyLayer.js
+common/js/html5.js
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 000000000..ae1b55f2c
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,68 @@
+{
+ "globalstrict": false,
+ "undef": false,
+ "eqeqeq": false,
+ "browser": true,
+ "devel": true,
+ "jquery": true,
+ "evil": true,
+ "globals": {
+ "window": true,
+ "current_url": true,
+ "exec_json": true,
+ "exec_xml": true,
+ "procFilter": true,
+ "xe": true,
+ "request_uri": true,
+ "xAddEventListener": false,
+ "xResizeEvent": false,
+ "xScrollEvent": false,
+ "xAppendChild": false,
+ "xClientHeight": false,
+ "xClientWidth": false,
+ "xCreateElement": false,
+ "xDef": false,
+ "xDeleteCookie": false,
+ "xDisplay": false,
+ "xEvent": false,
+ "xFirstChild": false,
+ "xGetBodyWidth": false,
+ "xGetBodyHeight": false,
+ "xGetComputedStyle": false,
+ "xGetCookie": false,
+ "xGetElementById": false,
+ "xGetElementsByAttribute": false,
+ "xGetElementsByClassName": false,
+ "xGetElementsByTagName": false,
+ "xGetURLArguments": false,
+ "xHeight": false,
+ "xHex": false,
+ "xHide": false,
+ "xInnerHtml": false,
+ "xLeft": false,
+ "xMoveTo": false,
+ "xName": false,
+ "xNextSib": false,
+ "xNum": false,
+ "xOffsetLeft": false,
+ "xOffsetTop": false,
+ "xPad": false,
+ "xPageX": false,
+ "xPageY": false,
+ "xParent": false,
+ "xPreventDefault": false,
+ "xPrevSib": false,
+ "xRemoveEventListener": false,
+ "xResizeTo": false,
+ "xScrollLeft": false,
+ "xScrollTop": false,
+ "xSetCookie": false,
+ "xShow": false,
+ "xStr": false,
+ "xTop": false,
+ "xVisibility": false,
+ "xWidth": false,
+ "xZIndex": false,
+ "xStopPropagation": false
+ }
+}
diff --git a/.travis.yml b/.travis.yml
index cb2c700cf..c2eef4e9c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
language: php
php:
- - 5.2
- 5.3
- 5.4
- 5.5
diff --git a/Gruntfile.js b/Gruntfile.js
index a8320b459..2adb308a0 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -172,15 +172,6 @@ module.exports = function(grunt) {
'modules/widget/tpl/js/*.js',
],
options : {
- globalstrict: false,
- undef : false,
- eqeqeq: false,
- browser : true,
- globals: {
- "jQuery" : true,
- "console" : true,
- "window" : true
- },
ignores : [
'**/jquery*.js',
'**/swfupload.js',
@@ -324,7 +315,7 @@ module.exports = function(grunt) {
// changed
grunt.util.spawn({
cmd: "git",
- args: ['diff', '--name-only', target]
+ args: ['diff', '--name-only', '--diff-filter' ,'ACM', target]
}, function (error, result, code) {
diff = result.stdout;
diff --git a/addons/blogapi/blogapi.addon.php b/addons/blogapi/blogapi.addon.php
index d78bf0eb7..913f3ae4c 100644
--- a/addons/blogapi/blogapi.addon.php
+++ b/addons/blogapi/blogapi.addon.php
@@ -30,8 +30,10 @@ if($_REQUEST['act'] != 'api')
// Read func file
require_once(_XE_PATH_ . 'addons/blogapi/blogapi.func.php');
+$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
+
// If HTTP_RAW_POST_DATA is NULL, Print error message
-if(!$GLOBALS['HTTP_RAW_POST_DATA'])
+if(!$xml)
{
$content = getXmlRpcFailure(1, 'Invalid Method Call');
printContent($content);
@@ -39,7 +41,14 @@ if(!$GLOBALS['HTTP_RAW_POST_DATA'])
// xmlprc parsing
// Parse the requested xmlrpc
-$xml = new SimpleXMLElement($GLOBALS['HTTP_RAW_POST_DATA']);
+if(Security::detectingXEE($xml))
+{
+ header("HTTP/1.0 400 Bad Request");
+ exit;
+}
+
+if(version_compare(PHP_VERSION, '5.2.11', '<=')) libxml_disable_entity_loader(true);
+$xml = new SimpleXMLElement($xml, LIBXML_NONET | LIBXML_NOENT);
$method_name = (string)$xml->methodName;
$params = $xml->params->param;
diff --git a/addons/captcha/captcha.min.js b/addons/captcha/captcha.min.js
index b22dc0a66..8a4aa67ef 100644
--- a/addons/captcha/captcha.min.js
+++ b/addons/captcha/captcha.min.js
@@ -1 +1,2 @@
-var calledArgs=null;!function(a){a(function(){function b(){a("form").each(function(b){var d=!1;if(!a(this).attr("onsubmit")||a(this).attr("onsubmit").indexOf("procFilter")<0)for(var e=a(this).find("input[name=act]").val(),b=0;b
"XpressEngine (XE)"은 자유 소프트웨어이며, 오픈 소스 프로젝트로 개발되고 있습니다. 자세한 내용은 아래 링크를 참조하시기 바랍니다.
"XpressEngine (XE)"은 자유 소프트웨어입니다. 소프트웨어의 피양도자는 자유 소프트웨어 재단이 공표한 GNU 약소 일반 공중 사용 허가서 2.1판 또는 그 이후 판을 임의로 선택해서, 그 규정에 따라 소프트웨어를 개작하거나 재배포할 수 있습니다.
이 소프트웨어는 유용하게 사용될 수 있으리라는 희망에서 배포되고 있지만, 특정한 목적에 맞는 적합성 여부나 판매용으로 사용할 수 있으리라는 묵시적인 보증을 포함한 어떠한 형태의 보증도 제공하지 않습니다. 보다 자세한 사항에 대해서는 GNU 약소 일반 공중 사용 허가서를 참고하시기 바랍니다.
GNU 약소 일반 공중 사용 허가서는 이 라이브러리와 함께 제공됩니다. 만약, 이 문서가 누락되어 있다면 자유 소프트웨어 재단으로 문의하시기 바랍니다. (자유 소프트웨어 재단: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA)
"XpressEngine (XE)"은 자유 소프트웨어이며, 오픈 소스 프로젝트로 개발되고 있습니다. 자세한 내용은 아래 링크를 참조하시기 바랍니다.
"XpressEngine (XE)"은 자유 소프트웨어입니다. 소프트웨어의 피양도자는 자유 소프트웨어 재단이 공표한 GNU 약소 일반 공중 사용 허가서 2.1판 또는 그 이후 판을 임의로 선택해서, 그 규정에 따라 소프트웨어를 개작하거나 재배포할 수 있습니다.
이 소프트웨어는 유용하게 사용될 수 있으리라는 희망에서 배포되고 있지만, 특정한 목적에 맞는 적합성 여부나 판매용으로 사용할 수 있으리라는 묵시적인 보증을 포함한 어떠한 형태의 보증도 제공하지 않습니다. 보다 자세한 사항에 대해서는 GNU 약소 일반 공중 사용 허가서를 참고하시기 바랍니다.
GNU 약소 일반 공중 사용 허가서는 이 라이브러리와 함께 제공됩니다. 만약, 이 문서가 누락되어 있다면 자유 소프트웨어 재단으로 문의하시기 바랍니다. (자유 소프트웨어 재단: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA)
"XpressEngine (XE)" is an opensource and being developed in the opensource project. For more information, please see the link below.
"XpressEngine (XE)" is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
]]>
+ * $req->setHeader('Foo: Bar'); // sets the value of 'Foo' header to 'Bar'
+ * $req->setHeader('FoO', 'Baz'); // sets the value of 'Foo' header to 'Baz'
+ * $req->setHeader(array('foo' => 'Quux')); // sets the value of 'Foo' header to 'Quux'
+ * $req->setHeader('FOO'); // removes 'Foo' header from request
+ *
+ *
+ * @param string|array $name header name, header string ('Header: value')
+ * or an array of headers
+ * @param string|array|null $value header value if $name is not an array,
+ * header will be removed if value is null
+ * @param bool $replace whether to replace previous header with the
+ * same name or append to its value
+ *
+ * @return HTTP_Request2
+ * @throws HTTP_Request2_LogicException
+ */
+ public function setHeader($name, $value = null, $replace = true)
+ {
+ if (is_array($name)) {
+ foreach ($name as $k => $v) {
+ if (is_string($k)) {
+ $this->setHeader($k, $v, $replace);
+ } else {
+ $this->setHeader($v, null, $replace);
+ }
+ }
+ } else {
+ if (null === $value && strpos($name, ':')) {
+ list($name, $value) = array_map('trim', explode(':', $name, 2));
+ }
+ // Header name should be a token: http://tools.ietf.org/html/rfc2616#section-4.2
+ if (preg_match(self::REGEXP_INVALID_TOKEN, $name)) {
+ throw new HTTP_Request2_LogicException(
+ "Invalid header name '{$name}'",
+ HTTP_Request2_Exception::INVALID_ARGUMENT
+ );
+ }
+ // Header names are case insensitive anyway
+ $name = strtolower($name);
+ if (null === $value) {
+ unset($this->headers[$name]);
+
+ } else {
+ if (is_array($value)) {
+ $value = implode(', ', array_map('trim', $value));
+ } elseif (is_string($value)) {
+ $value = trim($value);
+ }
+ if (!isset($this->headers[$name]) || $replace) {
+ $this->headers[$name] = $value;
+ } else {
+ $this->headers[$name] .= ', ' . $value;
+ }
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns the request headers
+ *
+ * The array is of the form ('header name' => 'header value'), header names
+ * are lowercased
+ *
+ * @return array
+ */
+ public function getHeaders()
+ {
+ return $this->headers;
+ }
+
+ /**
+ * Adds a cookie to the request
+ *
+ * If the request does not have a CookieJar object set, this method simply
+ * appends a cookie to "Cookie:" header.
+ *
+ * If a CookieJar object is available, the cookie is stored in that object.
+ * Data from request URL will be used for setting its 'domain' and 'path'
+ * parameters, 'expires' and 'secure' will be set to null and false,
+ * respectively. If you need further control, use CookieJar's methods.
+ *
+ * @param string $name cookie name
+ * @param string $value cookie value
+ *
+ * @return HTTP_Request2
+ * @throws HTTP_Request2_LogicException
+ * @see setCookieJar()
+ */
+ public function addCookie($name, $value)
+ {
+ if (!empty($this->cookieJar)) {
+ $this->cookieJar->store(
+ array('name' => $name, 'value' => $value), $this->url
+ );
+
+ } else {
+ $cookie = $name . '=' . $value;
+ if (preg_match(self::REGEXP_INVALID_COOKIE, $cookie)) {
+ throw new HTTP_Request2_LogicException(
+ "Invalid cookie: '{$cookie}'",
+ HTTP_Request2_Exception::INVALID_ARGUMENT
+ );
+ }
+ $cookies = empty($this->headers['cookie'])? '': $this->headers['cookie'] . '; ';
+ $this->setHeader('cookie', $cookies . $cookie);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Sets the request body
+ *
+ * If you provide file pointer rather than file name, it should support
+ * fstat() and rewind() operations.
+ *
+ * @param string|resource|HTTP_Request2_MultipartBody $body Either a
+ * string with the body or filename containing body or
+ * pointer to an open file or object with multipart body data
+ * @param bool $isFilename Whether
+ * first parameter is a filename
+ *
+ * @return HTTP_Request2
+ * @throws HTTP_Request2_LogicException
+ */
+ public function setBody($body, $isFilename = false)
+ {
+ if (!$isFilename && !is_resource($body)) {
+ if (!$body instanceof HTTP_Request2_MultipartBody) {
+ $this->body = (string)$body;
+ } else {
+ $this->body = $body;
+ }
+ } else {
+ $fileData = $this->fopenWrapper($body, empty($this->headers['content-type']));
+ $this->body = $fileData['fp'];
+ if (empty($this->headers['content-type'])) {
+ $this->setHeader('content-type', $fileData['type']);
+ }
+ }
+ $this->postParams = $this->uploads = array();
+
+ return $this;
+ }
+
+ /**
+ * Returns the request body
+ *
+ * @return string|resource|HTTP_Request2_MultipartBody
+ */
+ public function getBody()
+ {
+ if (self::METHOD_POST == $this->method
+ && (!empty($this->postParams) || !empty($this->uploads))
+ ) {
+ if (0 === strpos($this->headers['content-type'], 'application/x-www-form-urlencoded')) {
+ $body = http_build_query($this->postParams, '', '&');
+ if (!$this->getConfig('use_brackets')) {
+ $body = preg_replace('/%5B\d+%5D=/', '=', $body);
+ }
+ // support RFC 3986 by not encoding '~' symbol (request #15368)
+ return str_replace('%7E', '~', $body);
+
+ } elseif (0 === strpos($this->headers['content-type'], 'multipart/form-data')) {
+ require_once 'HTTP/Request2/MultipartBody.php';
+ return new HTTP_Request2_MultipartBody(
+ $this->postParams, $this->uploads, $this->getConfig('use_brackets')
+ );
+ }
+ }
+ return $this->body;
+ }
+
+ /**
+ * Adds a file to form-based file upload
+ *
+ * Used to emulate file upload via a HTML form. The method also sets
+ * Content-Type of HTTP request to 'multipart/form-data'.
+ *
+ * If you just want to send the contents of a file as the body of HTTP
+ * request you should use setBody() method.
+ *
+ * If you provide file pointers rather than file names, they should support
+ * fstat() and rewind() operations.
+ *
+ * @param string $fieldName name of file-upload field
+ * @param string|resource|array $filename full name of local file,
+ * pointer to open file or an array of files
+ * @param string $sendFilename filename to send in the request
+ * @param string $contentType content-type of file being uploaded
+ *
+ * @return HTTP_Request2
+ * @throws HTTP_Request2_LogicException
+ */
+ public function addUpload(
+ $fieldName, $filename, $sendFilename = null, $contentType = null
+ ) {
+ if (!is_array($filename)) {
+ $fileData = $this->fopenWrapper($filename, empty($contentType));
+ $this->uploads[$fieldName] = array(
+ 'fp' => $fileData['fp'],
+ 'filename' => !empty($sendFilename)? $sendFilename
+ :(is_string($filename)? basename($filename): 'anonymous.blob') ,
+ 'size' => $fileData['size'],
+ 'type' => empty($contentType)? $fileData['type']: $contentType
+ );
+ } else {
+ $fps = $names = $sizes = $types = array();
+ foreach ($filename as $f) {
+ if (!is_array($f)) {
+ $f = array($f);
+ }
+ $fileData = $this->fopenWrapper($f[0], empty($f[2]));
+ $fps[] = $fileData['fp'];
+ $names[] = !empty($f[1])? $f[1]
+ :(is_string($f[0])? basename($f[0]): 'anonymous.blob');
+ $sizes[] = $fileData['size'];
+ $types[] = empty($f[2])? $fileData['type']: $f[2];
+ }
+ $this->uploads[$fieldName] = array(
+ 'fp' => $fps, 'filename' => $names, 'size' => $sizes, 'type' => $types
+ );
+ }
+ if (empty($this->headers['content-type'])
+ || 'application/x-www-form-urlencoded' == $this->headers['content-type']
+ ) {
+ $this->setHeader('content-type', 'multipart/form-data');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Adds POST parameter(s) to the request.
+ *
+ * @param string|array $name parameter name or array ('name' => 'value')
+ * @param mixed $value parameter value (can be an array)
+ *
+ * @return HTTP_Request2
+ */
+ public function addPostParameter($name, $value = null)
+ {
+ if (!is_array($name)) {
+ $this->postParams[$name] = $value;
+ } else {
+ foreach ($name as $k => $v) {
+ $this->addPostParameter($k, $v);
+ }
+ }
+ if (empty($this->headers['content-type'])) {
+ $this->setHeader('content-type', 'application/x-www-form-urlencoded');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Attaches a new observer
+ *
+ * @param SplObserver $observer any object implementing SplObserver
+ */
+ public function attach(SplObserver $observer)
+ {
+ foreach ($this->observers as $attached) {
+ if ($attached === $observer) {
+ return;
+ }
+ }
+ $this->observers[] = $observer;
+ }
+
+ /**
+ * Detaches an existing observer
+ *
+ * @param SplObserver $observer any object implementing SplObserver
+ */
+ public function detach(SplObserver $observer)
+ {
+ foreach ($this->observers as $key => $attached) {
+ if ($attached === $observer) {
+ unset($this->observers[$key]);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Notifies all observers
+ */
+ public function notify()
+ {
+ foreach ($this->observers as $observer) {
+ $observer->update($this);
+ }
+ }
+
+ /**
+ * Sets the last event
+ *
+ * Adapters should use this method to set the current state of the request
+ * and notify the observers.
+ *
+ * @param string $name event name
+ * @param mixed $data event data
+ */
+ public function setLastEvent($name, $data = null)
+ {
+ $this->lastEvent = array(
+ 'name' => $name,
+ 'data' => $data
+ );
+ $this->notify();
+ }
+
+ /**
+ * Returns the last event
+ *
+ * Observers should use this method to access the last change in request.
+ * The following event names are possible:
+ *
+ * $request->setAdapter('curl');
+ *
+ * will work.
+ *
+ * @param string|HTTP_Request2_Adapter $adapter Adapter to use
+ *
+ * @return HTTP_Request2
+ * @throws HTTP_Request2_LogicException
+ */
+ public function setAdapter($adapter)
+ {
+ if (is_string($adapter)) {
+ if (!class_exists($adapter, false)) {
+ if (false === strpos($adapter, '_')) {
+ $adapter = 'HTTP_Request2_Adapter_' . ucfirst($adapter);
+ }
+ if (!class_exists($adapter, false)
+ && preg_match('/^HTTP_Request2_Adapter_([a-zA-Z0-9]+)$/', $adapter)
+ ) {
+ include_once str_replace('_', DIRECTORY_SEPARATOR, $adapter) . '.php';
+ }
+ if (!class_exists($adapter, false)) {
+ throw new HTTP_Request2_LogicException(
+ "Class {$adapter} not found",
+ HTTP_Request2_Exception::MISSING_VALUE
+ );
+ }
+ }
+ $adapter = new $adapter;
+ }
+ if (!$adapter instanceof HTTP_Request2_Adapter) {
+ throw new HTTP_Request2_LogicException(
+ 'Parameter is not a HTTP request adapter',
+ HTTP_Request2_Exception::INVALID_ARGUMENT
+ );
+ }
+ $this->adapter = $adapter;
+
+ return $this;
+ }
+
+ /**
+ * Sets the cookie jar
+ *
+ * A cookie jar is used to maintain cookies across HTTP requests and
+ * responses. Cookies from jar will be automatically added to the request
+ * headers based on request URL.
+ *
+ * @param HTTP_Request2_CookieJar|bool $jar Existing CookieJar object, true to
+ * create a new one, false to remove
+ *
+ * @return HTTP_Request2
+ * @throws HTTP_Request2_LogicException
+ */
+ public function setCookieJar($jar = true)
+ {
+ if (!class_exists('HTTP_Request2_CookieJar', false)) {
+ require_once 'HTTP/Request2/CookieJar.php';
+ }
+
+ if ($jar instanceof HTTP_Request2_CookieJar) {
+ $this->cookieJar = $jar;
+ } elseif (true === $jar) {
+ $this->cookieJar = new HTTP_Request2_CookieJar();
+ } elseif (!$jar) {
+ $this->cookieJar = null;
+ } else {
+ throw new HTTP_Request2_LogicException(
+ 'Invalid parameter passed to setCookieJar()',
+ HTTP_Request2_Exception::INVALID_ARGUMENT
+ );
+ }
+
+ return $this;
+ }
+
+ /**
+ * Returns current CookieJar object or null if none
+ *
+ * @return HTTP_Request2_CookieJar|null
+ */
+ public function getCookieJar()
+ {
+ return $this->cookieJar;
+ }
+
+ /**
+ * Sends the request and returns the response
+ *
+ * @throws HTTP_Request2_Exception
+ * @return HTTP_Request2_Response
+ */
+ public function send()
+ {
+ // Sanity check for URL
+ if (!$this->url instanceof Net_URL2
+ || !$this->url->isAbsolute()
+ || !in_array(strtolower($this->url->getScheme()), array('https', 'http'))
+ ) {
+ throw new HTTP_Request2_LogicException(
+ 'HTTP_Request2 needs an absolute HTTP(S) request URL, '
+ . ($this->url instanceof Net_URL2
+ ? "'" . $this->url->__toString() . "'" : 'none')
+ . ' given',
+ HTTP_Request2_Exception::INVALID_ARGUMENT
+ );
+ }
+ if (empty($this->adapter)) {
+ $this->setAdapter($this->getConfig('adapter'));
+ }
+ // magic_quotes_runtime may break file uploads and chunked response
+ // processing; see bug #4543. Don't use ini_get() here; see bug #16440.
+ if ($magicQuotes = get_magic_quotes_runtime()) {
+ set_magic_quotes_runtime(false);
+ }
+ // force using single byte encoding if mbstring extension overloads
+ // strlen() and substr(); see bug #1781, bug #10605
+ if (extension_loaded('mbstring') && (2 & ini_get('mbstring.func_overload'))) {
+ $oldEncoding = mb_internal_encoding();
+ mb_internal_encoding('8bit');
+ }
+
+ try {
+ $response = $this->adapter->sendRequest($this);
+ } catch (Exception $e) {
+ }
+ // cleanup in either case (poor man's "finally" clause)
+ if ($magicQuotes) {
+ set_magic_quotes_runtime(true);
+ }
+ if (!empty($oldEncoding)) {
+ mb_internal_encoding($oldEncoding);
+ }
+ // rethrow the exception
+ if (!empty($e)) {
+ throw $e;
+ }
+ return $response;
+ }
+
+ /**
+ * Wrapper around fopen()/fstat() used by setBody() and addUpload()
+ *
+ * @param string|resource $file file name or pointer to open file
+ * @param bool $detectType whether to try autodetecting MIME
+ * type of file, will only work if $file is a
+ * filename, not pointer
+ *
+ * @return array array('fp' => file pointer, 'size' => file size, 'type' => MIME type)
+ * @throws HTTP_Request2_LogicException
+ */
+ protected function fopenWrapper($file, $detectType = false)
+ {
+ if (!is_string($file) && !is_resource($file)) {
+ throw new HTTP_Request2_LogicException(
+ "Filename or file pointer resource expected",
+ HTTP_Request2_Exception::INVALID_ARGUMENT
+ );
+ }
+ $fileData = array(
+ 'fp' => is_string($file)? null: $file,
+ 'type' => 'application/octet-stream',
+ 'size' => 0
+ );
+ if (is_string($file)) {
+ if (!($fileData['fp'] = @fopen($file, 'rb'))) {
+ $error = error_get_last();
+ throw new HTTP_Request2_LogicException(
+ $error['message'], HTTP_Request2_Exception::READ_ERROR
+ );
+ }
+ if ($detectType) {
+ $fileData['type'] = self::detectMimeType($file);
+ }
+ }
+ if (!($stat = fstat($fileData['fp']))) {
+ throw new HTTP_Request2_LogicException(
+ "fstat() call failed", HTTP_Request2_Exception::READ_ERROR
+ );
+ }
+ $fileData['size'] = $stat['size'];
+
+ return $fileData;
+ }
+
+ /**
+ * Tries to detect MIME type of a file
+ *
+ * The method will try to use fileinfo extension if it is available,
+ * deprecated mime_content_type() function in the other case. If neither
+ * works, default 'application/octet-stream' MIME type is returned
+ *
+ * @param string $filename file name
+ *
+ * @return string file MIME type
+ */
+ protected static function detectMimeType($filename)
+ {
+ // finfo extension from PECL available
+ if (function_exists('finfo_open')) {
+ if (!isset(self::$_fileinfoDb)) {
+ self::$_fileinfoDb = @finfo_open(FILEINFO_MIME);
+ }
+ if (self::$_fileinfoDb) {
+ $info = finfo_file(self::$_fileinfoDb, $filename);
+ }
+ }
+ // (deprecated) mime_content_type function available
+ if (empty($info) && function_exists('mime_content_type')) {
+ return mime_content_type($filename);
+ }
+ return empty($info)? 'application/octet-stream': $info;
+ }
+}
+?>
diff --git a/libs/PEAR.1.9.5/HTTP/Request2/Adapter.php b/libs/PEAR.1.9.5/HTTP/Request2/Adapter.php
new file mode 100644
index 000000000..4e4b0b10a
--- /dev/null
+++ b/libs/PEAR.1.9.5/HTTP/Request2/Adapter.php
@@ -0,0 +1,137 @@
+
+ * @copyright 2008-2014 Alexey Borzov
+ * $mock = new HTTP_Request2_Adapter_Mock();
+ * $mock->addResponse("HTTP/1.1 ... ");
+ *
+ * $request = new HTTP_Request2();
+ * $request->setAdapter($mock);
+ *
+ * // This will return the response set above
+ * $response = $req->send();
+ *
+ *
+ * @category HTTP
+ * @package HTTP_Request2
+ * @author Alexey Borzov
+ * require_once 'HTTP/Request2.php';
+ * require_once 'HTTP/Request2/Observer/Log.php';
+ *
+ * $request = new HTTP_Request2('http://www.example.com');
+ * $observer = new HTTP_Request2_Observer_Log();
+ * $request->attach($observer);
+ * $request->send();
+ *
+ *
+ * A more complex example with PEAR Log:
+ *
+ * require_once 'HTTP/Request2.php';
+ * require_once 'HTTP/Request2/Observer/Log.php';
+ * require_once 'Log.php';
+ *
+ * $request = new HTTP_Request2('http://www.example.com');
+ * // we want to log with PEAR log
+ * $observer = new HTTP_Request2_Observer_Log(Log::factory('console'));
+ *
+ * // we only want to log received headers
+ * $observer->events = array('receivedHeaders');
+ *
+ * $request->attach($observer);
+ * $request->send();
+ *
+ *
+ * @category HTTP
+ * @package HTTP_Request2
+ * @author David Jean Louis
+ * $statusLine = read_status_line();
+ * $response = new HTTP_Request2_Response($statusLine);
+ * do {
+ * $headerLine = read_header_line();
+ * $response->parseHeaderLine($headerLine);
+ * } while ($headerLine != '');
+ *
+ * while ($chunk = read_body()) {
+ * $response->appendBody($chunk);
+ * }
+ *
+ * var_dump($response->getHeader(), $response->getCookies(), $response->getBody());
+ *
+ *
+ * @category HTTP
+ * @package HTTP_Request2
+ * @author Alexey Borzov
+ * require_once 'PEAR/Exception.php';
+ *
+ * class Test {
+ * function foo() {
+ * throw new PEAR_Exception('Error Message', ERROR_CODE);
+ * }
+ * }
+ *
+ * function myLogger($pear_exception) {
+ * echo $pear_exception->getMessage();
+ * }
+ * // each time a exception is thrown the 'myLogger' will be called
+ * // (its use is completely optional)
+ * PEAR_Exception::addObserver('myLogger');
+ * $test = new Test;
+ * try {
+ * $test->foo();
+ * } catch (PEAR_Exception $e) {
+ * print $e;
+ * }
+ *
+ *
+ * @category pear
+ * @package PEAR
+ * @author Tomas V.V.Cox
+ * array('name' => $name, 'context' => array(...))
+ *
+ * @return array
+ */
+ public function getErrorData()
+ {
+ return array();
+ }
+
+ /**
+ * Returns the exception that caused this exception to be thrown
+ * @access public
+ * @return Exception|array The context of the exception
+ */
+ public function getCause()
+ {
+ return $this->cause;
+ }
+
+ /**
+ * Function must be public to call on caused exceptions
+ * @param array
+ */
+ public function getCauseMessage(&$causes)
+ {
+ $trace = $this->getTraceSafe();
+ $cause = array('class' => get_class($this),
+ 'message' => $this->message,
+ 'file' => 'unknown',
+ 'line' => 'unknown');
+ if (isset($trace[0])) {
+ if (isset($trace[0]['file'])) {
+ $cause['file'] = $trace[0]['file'];
+ $cause['line'] = $trace[0]['line'];
+ }
+ }
+ $causes[] = $cause;
+ if ($this->cause instanceof PEAR_Exception) {
+ $this->cause->getCauseMessage($causes);
+ } elseif ($this->cause instanceof Exception) {
+ $causes[] = array('class' => get_class($this->cause),
+ 'message' => $this->cause->getMessage(),
+ 'file' => $this->cause->getFile(),
+ 'line' => $this->cause->getLine());
+ } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) {
+ $causes[] = array('class' => get_class($this->cause),
+ 'message' => $this->cause->getMessage(),
+ 'file' => 'unknown',
+ 'line' => 'unknown');
+ } elseif (is_array($this->cause)) {
+ foreach ($this->cause as $cause) {
+ if ($cause instanceof PEAR_Exception) {
+ $cause->getCauseMessage($causes);
+ } elseif ($cause instanceof Exception) {
+ $causes[] = array('class' => get_class($cause),
+ 'message' => $cause->getMessage(),
+ 'file' => $cause->getFile(),
+ 'line' => $cause->getLine());
+ } elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error) {
+ $causes[] = array('class' => get_class($cause),
+ 'message' => $cause->getMessage(),
+ 'file' => 'unknown',
+ 'line' => 'unknown');
+ } elseif (is_array($cause) && isset($cause['message'])) {
+ // PEAR_ErrorStack warning
+ $causes[] = array(
+ 'class' => $cause['package'],
+ 'message' => $cause['message'],
+ 'file' => isset($cause['context']['file']) ?
+ $cause['context']['file'] :
+ 'unknown',
+ 'line' => isset($cause['context']['line']) ?
+ $cause['context']['line'] :
+ 'unknown',
+ );
+ }
+ }
+ }
+ }
+
+ public function getTraceSafe()
+ {
+ if (!isset($this->_trace)) {
+ $this->_trace = $this->getTrace();
+ if (empty($this->_trace)) {
+ $backtrace = debug_backtrace();
+ $this->_trace = array($backtrace[count($backtrace)-1]);
+ }
+ }
+ return $this->_trace;
+ }
+
+ public function getErrorClass()
+ {
+ $trace = $this->getTraceSafe();
+ return $trace[0]['class'];
+ }
+
+ public function getErrorMethod()
+ {
+ $trace = $this->getTraceSafe();
+ return $trace[0]['function'];
+ }
+
+ public function __toString()
+ {
+ if (isset($_SERVER['REQUEST_URI'])) {
+ return $this->toHtml();
+ }
+ return $this->toText();
+ }
+
+ public function toHtml()
+ {
+ $trace = $this->getTraceSafe();
+ $causes = array();
+ $this->getCauseMessage($causes);
+ $html = '| ' + . str_repeat('-', $i) . ' ' . $cause['class'] . ': ' + . htmlspecialchars($cause['message']) . ' in ' . $cause['file'] . ' ' + . 'on line ' . $cause['line'] . '' + . " | ||
| Exception trace | ||
| # | ' + . 'Function | ' + . 'Location |
| ' . $k . ' | ' + . ''; + if (!empty($v['class'])) { + $html .= $v['class'] . $v['type']; + } + $html .= $v['function']; + $args = array(); + if (!empty($v['args'])) { + foreach ($v['args'] as $arg) { + if (is_null($arg)) $args[] = 'null'; + elseif (is_array($arg)) $args[] = 'Array'; + elseif (is_object($arg)) $args[] = 'Object('.get_class($arg).')'; + elseif (is_bool($arg)) $args[] = $arg ? 'true' : 'false'; + elseif (is_int($arg) || is_double($arg)) $args[] = $arg; + else { + $arg = (string)$arg; + $str = htmlspecialchars(substr($arg, 0, 16)); + if (strlen($arg) > 16) $str .= '…'; + $args[] = "'" . $str . "'"; + } + } + } + $html .= '(' . implode(', ',$args) . ')' + . ' | ' + . '' . (isset($v['file']) ? $v['file'] : 'unknown') + . ':' . (isset($v['line']) ? $v['line'] : 'unknown') + . ' |
| ' . ($k+1) . ' | ' + . '{main} | ' + . '|
{$XE_VALIDATOR_MESSAGE}
{$XE_VALIDATOR_MESSAGE}
{$XE_VALIDATOR_MESSAGE}
{$XE_VALIDATOR_MESSAGE}
{$XE_VALIDATOR_MESSAGE}