Merge branch 'master' into calendar

This commit is contained in:
Georg Ehrke 2011-10-13 21:59:16 +02:00
commit a01d10e57d
11 changed files with 50 additions and 14 deletions

View File

@ -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

View File

@ -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://";

View File

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 859 B

View File

Before

Width:  |  Height:  |  Size: 538 B

After

Width:  |  Height:  |  Size: 538 B

8
files/ajax/mimeicon.php Normal file
View File

@ -0,0 +1,8 @@
<?php
// Init owncloud
require_once('../../lib/base.php');
print OC_Helper::mimetypeIcon($_GET['mime']);
?>

View File

@ -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');

View File

@ -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={};

View File

@ -81,6 +81,14 @@ class OC{
date_default_timezone_set('Europe/Berlin');
ini_set('arg_separator.output','&amp;');
//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));

View File

@ -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 );

View File

@ -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

View File

@ -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');