diff options
-rw-r--r-- | .htaccess | 4 | ||||
-rw-r--r-- | apps/remoteStorage/compat.php | 2 | ||||
-rw-r--r-- | core/img/filetypes/code-script.png (renamed from core/img/filetypes/script.png) | bin | 859 -> 859 bytes | |||
-rw-r--r-- | core/img/filetypes/text-x-php.png (renamed from core/img/filetypes/php.png) | bin | 538 -> 538 bytes | |||
-rw-r--r-- | files/ajax/mimeicon.php | 8 | ||||
-rw-r--r-- | files/js/filelist.js | 12 | ||||
-rw-r--r-- | files/js/files.js | 15 | ||||
-rw-r--r-- | lib/base.php | 8 | ||||
-rw-r--r-- | lib/helper.php | 6 | ||||
-rw-r--r-- | lib/setup.php | 4 | ||||
-rw-r--r-- | lib/util.php | 5 |
11 files changed, 50 insertions, 14 deletions
diff --git a/.htaccess b/.htaccess index ced9ae652d2..34d4c719c8d 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 35a133c43c7..445257320c6 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 Binary files differindex 63fe6ceff5b..63fe6ceff5b 100644 --- a/core/img/filetypes/script.png +++ b/core/img/filetypes/code-script.png diff --git a/core/img/filetypes/php.png b/core/img/filetypes/text-x-php.png Binary files differindex 7868a25945c..7868a25945c 100644 --- a/core/img/filetypes/php.png +++ b/core/img/filetypes/text-x-php.png diff --git a/files/ajax/mimeicon.php b/files/ajax/mimeicon.php new file mode 100644 index 00000000000..8724016b3a1 --- /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 84762bb561d..e6da922700d 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 9342642b4ff..079646070d4 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 0156febe231..ade4d889631 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 c2a81ba3306..5b3e394cafd 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 355d979dc65..252eaaeea18 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 4920d13914d..0f8cc08fce6 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'); |