浏览代码

webdav workaround for apache+php-cgi

tags/v3.0
Robin Appelman 12 年前
父节点
当前提交
f1fd374a6f
共有 3 个文件被更改,包括 16 次插入0 次删除
  1. 4
    0
      .htaccess
  2. 8
    0
      lib/base.php
  3. 4
    0
      lib/setup.php

+ 4
- 0
.htaccess 查看文件

@@ -5,4 +5,8 @@ php_value post_max_size 512M
php_value memory_limit 128M
SetEnv htaccessWorking true
</IfModule>
<IfModule !mod_php5.c>
RewriteEngine on
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]
</IfModule>
Options -Indexes

+ 8
- 0
lib/base.php 查看文件

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

+ 4
- 0
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


正在加载...
取消
保存