From 9d3c7badb5fd1b9319b35be74e3757702b499d9b Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Tue, 11 Oct 2011 21:26:35 +0200 Subject: Fixed a bug in checkWebserverUser checkWebserverUser would return the owner of the document root instead of the owner of the web server process. Signed-off-by: Florian Pritz --- lib/util.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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'); -- cgit v1.2.3 From 8da00e2d9aef5b77832a8d05a87c6b7cfbc5940a Mon Sep 17 00:00:00 2001 From: "Michiel@unhosted" Date: Thu, 13 Oct 2011 15:49:53 +0200 Subject: avoiding notice if ['HTTPS'] is not set --- apps/remoteStorage/compat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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://"; -- cgit v1.2.3 From d7fa2a0f7770acb36c49ea60348bb583e53b04e7 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 8 Oct 2011 21:18:47 +0200 Subject: mimetype icon improvements --- core/img/filetypes/code-script.png | Bin 0 -> 859 bytes core/img/filetypes/php.png | Bin 538 -> 0 bytes core/img/filetypes/script.png | Bin 859 -> 0 bytes core/img/filetypes/text-x-php.png | Bin 0 -> 538 bytes files/ajax/mimeicon.php | 8 ++++++++ files/js/filelist.js | 12 ++++++++---- files/js/files.js | 15 +++++++++------ lib/helper.php | 6 ++++++ 8 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 core/img/filetypes/code-script.png delete mode 100644 core/img/filetypes/php.png delete mode 100644 core/img/filetypes/script.png create mode 100644 core/img/filetypes/text-x-php.png create mode 100644 files/ajax/mimeicon.php diff --git a/core/img/filetypes/code-script.png b/core/img/filetypes/code-script.png new file mode 100644 index 00000000000..63fe6ceff5b Binary files /dev/null and b/core/img/filetypes/code-script.png differ diff --git a/core/img/filetypes/php.png b/core/img/filetypes/php.png deleted file mode 100644 index 7868a25945c..00000000000 Binary files a/core/img/filetypes/php.png and /dev/null differ diff --git a/core/img/filetypes/script.png b/core/img/filetypes/script.png deleted file mode 100644 index 63fe6ceff5b..00000000000 Binary files a/core/img/filetypes/script.png and /dev/null differ diff --git a/core/img/filetypes/text-x-php.png b/core/img/filetypes/text-x-php.png new file mode 100644 index 00000000000..7868a25945c Binary files /dev/null and b/core/img/filetypes/text-x-php.png differ 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 @@ + 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/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 ); -- cgit v1.2.3 From f1fd374a6f078031e231c89c9fb8ca4b33feba20 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 13 Oct 2011 16:31:01 +0200 Subject: webdav workaround for apache+php-cgi --- .htaccess | 4 ++++ lib/base.php | 8 ++++++++ lib/setup.php | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/.htaccess b/.htaccess index 8763a8bcde5..dd49442e371 100644 --- a/.htaccess +++ b/.htaccess @@ -5,4 +5,8 @@ php_value post_max_size 512M php_value memory_limit 128M SetEnv htaccessWorking true + +RewriteEngine on +RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] + Options -Indexes diff --git a/lib/base.php b/lib/base.php index 0156febe231..57a3ae8669b 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 (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/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.= "\n"; + $content.= "\n"; + $content.= "RewriteEngine on\n"; + $content.= "RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]\n"; + $content.= "\n"; $content.= "Options -Indexes\n"; @file_put_contents(OC::$SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it -- cgit v1.2.3 From db2fb38746bb9d89b402c3a768a247945d813989 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 13 Oct 2011 21:55:02 +0200 Subject: prevent error involving webdav workaround --- lib/base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base.php b/lib/base.php index 57a3ae8669b..ade4d889631 100644 --- a/lib/base.php +++ b/lib/base.php @@ -82,7 +82,7 @@ class OC{ ini_set('arg_separator.output','&'); //set http auth headers for apache+php-cgi work around - if (preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches)) + 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); -- cgit v1.2.3