diff --git a/.htaccess b/.htaccess index ced9ae652d2c345152619b3ef29cbdbbf0ed873e..34d4c719c8de71d80aed44f2723b4e85035e4c58 100644 --- a/.htaccess +++ b/.htaccess @@ -4,4 +4,8 @@ php_value upload_max_filesize 512M php_value post_max_size 512M SetEnv htaccessWorking true </IfModule> +<IfModule !mod_php5.c> +RewriteEngine on +RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] +</IfModule> Options -Indexes diff --git a/apps/remoteStorage/compat.php b/apps/remoteStorage/compat.php index 35a133c43c705e7bfb777444895d4d3dbf5b6bf1..445257320c631b79b4bed2b22e50768e9d5aebe8 100644 --- a/apps/remoteStorage/compat.php +++ b/apps/remoteStorage/compat.php @@ -101,7 +101,7 @@ if(count($pathParts) >= 8 && $pathParts[0] == '' && $pathParts[2] == 'remoteStor $token=OC_remoteStorage::createDataScope($appUrl, $userAddress, $dataScope); header('Location: '.$_GET['redirect_uri'].'#access_token='.$token.'&token_type=remoteStorage'); } else { - if($_SERVER['HTTPS']){ + if((isset($_SERVER['HTTPS'])) && ($_SERVER['HTTPS'])) { $url = "https://"; } else { $url = "http://"; diff --git a/core/img/filetypes/script.png b/core/img/filetypes/code-script.png similarity index 100% rename from core/img/filetypes/script.png rename to core/img/filetypes/code-script.png diff --git a/core/img/filetypes/php.png b/core/img/filetypes/text-x-php.png similarity index 100% rename from core/img/filetypes/php.png rename to core/img/filetypes/text-x-php.png diff --git a/files/ajax/mimeicon.php b/files/ajax/mimeicon.php new file mode 100644 index 0000000000000000000000000000000000000000..8724016b3a190b25e2010dcd78fbebe05cfdad18 --- /dev/null +++ b/files/ajax/mimeicon.php @@ -0,0 +1,8 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +print OC_Helper::mimetypeIcon($_GET['mime']); + +?> diff --git a/files/js/filelist.js b/files/js/filelist.js index 84762bb561d4f2ba4c45a9ac5b54b0e6c1fae7bf..e6da922700d720d209ec8efe051e1eb5f18956b0 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -101,10 +101,14 @@ FileList={ $('.file_upload_filename').removeClass('highlight'); }, loadingDone:function(name){ - $('tr[data-file="'+name+'"]').data('loading',false); - var mime=$('tr[data-file="'+name+'"]').data('mime'); - $('tr[data-file="'+name+'"] td.filename').attr('style','background-image:url('+getMimeIcon(mime)+')'); - $('tr[data-file="'+name+'"] td.filename').draggable(dragOptions); + var tr=$('tr[data-file="'+name+'"]'); + tr.data('loading',false); + var mime=tr.data('mime'); + tr.attr('data-mime',mime); + getMimeIcon(mime,function(path){ + tr.find('td.filename').attr('style','background-image:url('+path+')'); + }); + tr.find('td.filename').draggable(dragOptions); }, isLoading:function(name){ return $('tr[data-file="'+name+'"]').data('loading'); diff --git a/files/js/files.js b/files/js/files.js index 9342642b4ff536d14632baed76b6219cb96abe4d..079646070d4b0db195ed2e9284b34db1f6a353bf 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -473,11 +473,14 @@ function relative_modified_date(timestamp) { else { return diffyears+' '+t('files','years ago'); } } -function getMimeIcon(mime){ - mime=mime.substr(0,mime.indexOf('/')); - var knownMimes=['image','audio']; - if(knownMimes.indexOf(mime)==-1){ - mime='file'; +function getMimeIcon(mime, ready){ + if(getMimeIcon.cache[mime]){ + ready(getMimeIcon.cache[mime]); + }else{ + $.get( OC.filePath('files','ajax','mimeicon.php')+'?mime='+mime, function(path){ + getMimeIcon.cache[mime]=path; + ready(getMimeIcon.cache[mime]); + }); } - return OC.imagePath('core','filetypes/'+mime); } +getMimeIcon.cache={}; diff --git a/lib/base.php b/lib/base.php index 0156febe2311fd37494337c30b57f5252c8ae605..ade4d889631dbbdca1eec35e000774ae0bceab32 100644 --- a/lib/base.php +++ b/lib/base.php @@ -81,6 +81,14 @@ class OC{ date_default_timezone_set('Europe/Berlin'); ini_set('arg_separator.output','&'); + //set http auth headers for apache+php-cgi work around + if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) + { + list($name, $password) = explode(':', base64_decode($matches[1])); + $_SERVER['PHP_AUTH_USER'] = strip_tags($name); + $_SERVER['PHP_AUTH_PW'] = strip_tags($password); + } + // calculate the documentroot OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13)); diff --git a/lib/helper.php b/lib/helper.php index c2a81ba3306f2df604b368506d7e3d54561ce3b0..5b3e394cafd3821195c5cd3ead775c045978827e 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -96,6 +96,12 @@ class OC_Helper { * Returns the path to the image of this file type. */ public static function mimetypeIcon( $mimetype ){ + $alias=array('application/xml'=>'code/xml'); +// echo $mimetype; + if(isset($alias[$mimetype])){ + $mimetype=$alias[$mimetype]; +// echo $mimetype; + } // Replace slash with a minus $mimetype = str_replace( "/", "-", $mimetype ); diff --git a/lib/setup.php b/lib/setup.php index 355d979dc65c81b7121a57d81b3ac46c37214348..252eaaeea18eb35c70ce179fd1f052c5d15d74a3 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -273,6 +273,10 @@ class OC_Setup { $content.= "php_value post_max_size 512M\n"; $content.= "SetEnv htaccessWorking true\n"; $content.= "</IfModule>\n"; + $content.= "<IfModule !mod_php5.c>\n"; + $content.= "RewriteEngine on\n"; + $content.= "RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]\n"; + $content.= "</IfModule>\n"; $content.= "Options -Indexes\n"; @file_put_contents(OC::$SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it diff --git a/lib/util.php b/lib/util.php index 4920d13914dd07935dc99c17c9bb790c82579fd6..0f8cc08fce68193a78f50d6407f687b410e9f34d 100644 --- a/lib/util.php +++ b/lib/util.php @@ -271,9 +271,8 @@ class OC_Util { * Try to get the username the httpd server runs on, used in hints */ public static function checkWebserverUser(){ - $stat=stat($_SERVER['DOCUMENT_ROOT']); - if(is_callable('posix_getpwuid')){ - $serverUser=posix_getpwuid($stat['uid']); + if(is_callable('posix_getuid')){ + $serverUser=posix_getpwuid(posix_getuid()); $serverUser='\''.$serverUser['name'].'\''; }elseif(exec('whoami')){ $serverUser=exec('whoami');