diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.php | 2 | ||||
-rw-r--r-- | lib/base.php | 1 | ||||
-rw-r--r-- | lib/eventsource.php | 73 | ||||
-rw-r--r-- | lib/filestorage/local.php | 2 | ||||
-rw-r--r-- | lib/filesystem.php | 11 | ||||
-rw-r--r-- | lib/helper.php | 2 | ||||
-rw-r--r-- | lib/image.php | 8 | ||||
-rw-r--r-- | lib/installer.php | 4 | ||||
-rw-r--r-- | lib/util.php | 4 |
9 files changed, 97 insertions, 10 deletions
diff --git a/lib/app.php b/lib/app.php index de7d82ce959..37a99823e3d 100644 --- a/lib/app.php +++ b/lib/app.php @@ -100,7 +100,7 @@ class OC_App{ }else{ $download=OC_OCSClient::getApplicationDownload($app,1); if(isset($download['downloadlink']) and $download['downloadlink']<>'') { - OC_Installer::installApp(array('source'=>'http','href'=>$download['downloadlink'])); + $app=OC_Installer::installApp(array('source'=>'http','href'=>$download['downloadlink'])); } } } diff --git a/lib/base.php b/lib/base.php index ca07eef590c..5b8eeb746b1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -187,6 +187,7 @@ class OC{ OC_Util::addScript( "jquery.infieldlabel.min" ); OC_Util::addScript( "jquery-tipsy" ); OC_Util::addScript( "js" ); + OC_Util::addScript( "eventsource" ); //OC_Util::addScript( "multiselect" ); OC_Util::addScript('search','result'); OC_Util::addStyle( "styles" ); diff --git a/lib/eventsource.php b/lib/eventsource.php new file mode 100644 index 00000000000..c123eb4b837 --- /dev/null +++ b/lib/eventsource.php @@ -0,0 +1,73 @@ +<?php + +/** +* ownCloud +* +* @author Robin Appelman +* @copyright 2012 Robin Appelman icewind1991@gmail.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/** + * wrapper for server side events (http://en.wikipedia.org/wiki/Server-sent_events) + * includes a fallback for older browsers and IE + * + * use server side events with causion, to many open requests can hang the server + */ +class OC_EventSource{ + private $fallback; + private $fallBackId=0; + + public function __construct(){ + ob_end_clean(); + header('Cache-Control: no-cache'); + $this->fallback=isset($_GET['fallback']) and $_GET['fallback']=='true'; + if($this->fallback){ + $fallBackId=$_GET['fallback_id']; + header("Content-Type: text/html"); + echo str_repeat('<span></span>'.PHP_EOL,10); //dummy data to keep IE happy + }else{ + header("Content-Type: text/event-stream"); + } + flush(); + + } + + /** + * send a message to the client + * @param string type + * @param object data + * + * if only one paramater is given, a typeless message will be send with that paramater as data + */ + public function send($type,$data=null){ + if(is_null($data)){ + $data=$type; + $type=null; + } + if($this->fallback){ + $response='<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack('.$this->fallBackId.',"'.$type.'","'.json_encode($data).'")</script>'.PHP_EOL; + echo $response; + }else{ + if($type){ + echo 'event: '.$type.PHP_EOL; + } + echo 'data: '.json_encode($data).PHP_EOL; + } + echo PHP_EOL; + flush(); + } +}
\ No newline at end of file diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index dcffce6e867..61343652f61 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -36,7 +36,7 @@ class OC_Filestorage_Local extends OC_Filestorage{ public function filetype($path){ $filetype=filetype($this->datadir.$path); if($filetype=='link'){ - $filetype=filetype(readlink($this->datadir.$path)); + $filetype=filetype(realpath($this->datadir.$path)); } return $filetype; } diff --git a/lib/filesystem.php b/lib/filesystem.php index f17213cd389..60d3f56a24c 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -254,6 +254,17 @@ class OC_Filesystem{ } self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments); } + + /** + * create all storage backends mounted in the filesystem + */ + static private function mountAll(){ + foreach(self::$mounts as $mountPoint=>$mount){ + if(!isset(self::$storages[$mountPoint])){ + self::$storages[$mountPoint]=self::createStorage($mount['type'],$mount['arguments']); + } + } + } /** * return the path to a local version of the file diff --git a/lib/helper.php b/lib/helper.php index 24d436225b7..4d1219d78d4 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -56,7 +56,7 @@ class OC_Helper { if($absolute){ // Checking if the request was made through HTTPS. The last in line is for IIS - $protocol = isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off'); + $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off'); $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo; } diff --git a/lib/image.php b/lib/image.php index 70ad3f5969e..6de3ed9104d 100644 --- a/lib/image.php +++ b/lib/image.php @@ -21,8 +21,7 @@ * */ -/** From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php - * Don't know if it can come in handy? +//From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php if ( ! function_exists( 'exif_imagetype' ) ) { function exif_imagetype ( $filename ) { if ( ( list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) { @@ -31,7 +30,6 @@ if ( ! function_exists( 'exif_imagetype' ) ) { return false; } } -*/ function ellipsis($str, $maxlen) { if (strlen($str) > $maxlen) { @@ -205,6 +203,10 @@ class OC_Image { * @returns bool. */ public function fixOrientation() { + if(!is_callable('exif_read_data')){ + OC_Log::write('core','OC_Image::fixOrientation() Exif module not enabled.', OC_Log::DEBUG); + return false; + } if(!is_resource(self::$resource)) { OC_Log::write('core','OC_Image::fixOrientation() No image loaded.', OC_Log::DEBUG); return false; diff --git a/lib/installer.php b/lib/installer.php index 9248f68e011..b2f817e702f 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -152,14 +152,14 @@ class OC_Installer{ } //run appinfo/install.php - if(!isset($data['noinstall']) or $data['noinstall']==false and is_file($basedir.'/appinfo/install.php')){ + if((!isset($data['noinstall']) or $data['noinstall']==false) and file_exists($basedir.'/appinfo/install.php')){ include($basedir.'/appinfo/install.php'); } //set the installed version OC_Appconfig::setValue($info['id'],'installed_version',$info['version']); OC_Appconfig::setValue($info['id'],'enabled','no'); - return true; + return $info['id']; } /** diff --git a/lib/util.php b/lib/util.php index 454f5d04457..6c19c5416a2 100644 --- a/lib/util.php +++ b/lib/util.php @@ -62,7 +62,7 @@ class OC_Util { * @return array */ public static function getVersion(){ - return array(2,90,1); + return array(3,00,1); } /** @@ -70,7 +70,7 @@ class OC_Util { * @return string */ public static function getVersionString(){ - return '3 alpha 1'; + return '3'; } /** |