diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-12-18 06:03:50 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-12-18 06:03:50 -0800 |
commit | 277ae281718febddd82846ebbdf7ec3c6380bc07 (patch) | |
tree | feebe2d043f8b264397cde727709dfdbff9ee29d /lib | |
parent | a90342b78117967388db462fec2dc7fd70edc0fa (diff) | |
parent | 335b2f40a631f7188ab921d69289acaf31908c6e (diff) | |
download | nextcloud-server-277ae281718febddd82846ebbdf7ec3c6380bc07.tar.gz nextcloud-server-277ae281718febddd82846ebbdf7ec3c6380bc07.zip |
Merge pull request #6295 from owncloud/files-fromlinkerrormessagefixes
Fixed download file from URL error messages
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/eventsource.php | 6 | ||||
-rw-r--r-- | lib/private/json.php | 9 | ||||
-rw-r--r-- | lib/public/json.php | 8 |
3 files changed, 19 insertions, 4 deletions
diff --git a/lib/private/eventsource.php b/lib/private/eventsource.php index a83084d9251..4df0bc2e7cd 100644 --- a/lib/private/eventsource.php +++ b/lib/private/eventsource.php @@ -64,13 +64,13 @@ class OC_EventSource{ } if($this->fallback) { $response='<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack(' - .$this->fallBackId.',"'.$type.'",'.json_encode($data).')</script>'.PHP_EOL; + .$this->fallBackId.',"' . $type . '",' . OCP\JSON::encode($data) . ')</script>' . PHP_EOL; echo $response; }else{ if($type) { - echo 'event: '.$type.PHP_EOL; + echo 'event: ' . $type.PHP_EOL; } - echo 'data: '.json_encode($data).PHP_EOL; + echo 'data: ' . OCP\JSON::encode($data) . PHP_EOL; } echo PHP_EOL; flush(); diff --git a/lib/private/json.php b/lib/private/json.php index 6ba0b13806b..8401f7c3a12 100644 --- a/lib/private/json.php +++ b/lib/private/json.php @@ -109,7 +109,14 @@ class OC_JSON{ if($setContentType) { self::setContentTypeHeader(); } + echo self::encode($data); + } + + /** + * Encode JSON + */ + public static function encode($data) { array_walk_recursive($data, array('OC_JSON', 'to_string')); - echo json_encode($data); + return json_encode($data); } } diff --git a/lib/public/json.php b/lib/public/json.php index 134f724b0e6..831e3ef1cf6 100644 --- a/lib/public/json.php +++ b/lib/public/json.php @@ -169,4 +169,12 @@ class JSON { public static function checkAdminUser() { return(\OC_JSON::checkAdminUser()); } + + /** + * Encode JSON + * @param array $data + */ + public static function encode($data) { + return(\OC_JSON::encode($data)); + } } |