diff options
author | Georg Ehrke <dev@georgswebsite.de> | 2012-04-20 22:41:39 +0200 |
---|---|---|
committer | Georg Ehrke <dev@georgswebsite.de> | 2012-04-20 22:41:39 +0200 |
commit | 711aa229b882d3fc5e2fa8c22e6db2ec05642984 (patch) | |
tree | 5098a6dacf65a3d557977ff39b52ac527a0eb777 /lib/helper.php | |
parent | 12ef2f5054ebae12853f51d067993b825e4b4286 (diff) | |
parent | 0f5864d864f63a7142064d142661c46644b2d0db (diff) | |
download | nextcloud-server-711aa229b882d3fc5e2fa8c22e6db2ec05642984.tar.gz nextcloud-server-711aa229b882d3fc5e2fa8c22e6db2ec05642984.zip |
Merge branch 'master' into movable_apps
Diffstat (limited to 'lib/helper.php')
-rwxr-xr-x | lib/helper.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/helper.php b/lib/helper.php index 77b56051419..34f8faad4a5 100755 --- a/lib/helper.php +++ b/lib/helper.php @@ -358,6 +358,26 @@ class OC_Helper { } /** + * get the mimetype form a data string + * @param string data + * @return string + */ + static function getStringMimeType($data){ + if(function_exists('finfo_open') and function_exists('finfo_file')){ + $finfo=finfo_open(FILEINFO_MIME); + return finfo_buffer($finfo, $data); + }else{ + $tmpFile=OC_Helper::tmpFile(); + $fh=fopen($tmpFile,'wb'); + fwrite($fh,$data,8024); + fclose($fh); + $mime=self::getMimeType($tmpFile); + unset($tmpFile); + return $mime; + } + } + + /** * @brief Checks $_REQUEST contains a var for the $s key. If so, returns the html-escaped value of this var; otherwise returns the default value provided by $d. * @param $s name of the var to escape, if set. * @param $d default value. |