Merge branch 'master' of gitorious.org:owncloud/owncloud into ace-editor

This commit is contained in:
Tom Needham 2011-10-14 22:07:30 +01:00
commit 3fee961a0a
25 changed files with 134 additions and 47 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

@ -1,5 +1,52 @@
<?php
// Source: http://www.php.net/manual/de/function.curl-setopt.php#102121
// This works around a safe_mode/open_basedir restriction
function curl_exec_follow(/*resource*/ $ch, /*int*/ &$maxredirect = null) {
$mr = $maxredirect === null ? 5 : intval($maxredirect);
if (ini_get('open_basedir') == '' && ini_get('safe_mode' == 'Off')) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $mr > 0);
curl_setopt($ch, CURLOPT_MAXREDIRS, $mr);
} else {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
if ($mr > 0) {
$newurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
$rch = curl_copy_handle($ch);
curl_setopt($rch, CURLOPT_HEADER, true);
curl_setopt($rch, CURLOPT_NOBODY, true);
curl_setopt($rch, CURLOPT_FORBID_REUSE, false);
curl_setopt($rch, CURLOPT_RETURNTRANSFER, true);
do {
curl_setopt($rch, CURLOPT_URL, $newurl);
$header = curl_exec($rch);
if (curl_errno($rch)) {
$code = 0;
} else {
$code = curl_getinfo($rch, CURLINFO_HTTP_CODE);
if ($code == 301 || $code == 302) {
preg_match('/Location:(.*?)\n/', $header, $matches);
$newurl = trim(array_pop($matches));
} else {
$code = 0;
}
}
} while ($code && --$mr);
curl_close($rch);
if (!$mr) {
if ($maxredirect === null) {
trigger_error('Too many redirects. When following redirects, libcurl hit the maximum amount.', E_USER_WARNING);
} else {
$maxredirect = 0;
}
return false;
}
curl_setopt($ch, CURLOPT_URL, $newurl);
}
}
return curl_exec($ch);
}
function getURLMetadata($url) {
//allow only http(s) and (s)ftp
$protocols = '/^[hs]{0,1}[tf]{0,1}tp[s]{0,1}\:\/\//i';
@ -12,13 +59,11 @@ function getURLMetadata($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$page = curl_exec($ch);
$page = curl_exec_follow($ch);
curl_close($ch);
@preg_match( "/<title>(.*)<\/title>/si", $page, $match );
$metadata['title'] = htmlspecialchars_decode(@$match[1]);
$meta = get_meta_tags($url);
return $metadata;
}

View File

@ -9,8 +9,8 @@
require_once ("../../lib/base.php");
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$cal = $_GET["calid"];
$event = $_GET["eventid"];
$cal = isset($_GET["calid"]) ? $_GET["calid"] : NULL;
$event = isset($_GET["eventid"]) ? $_GET["eventid"] : NULL;
if(isset($cal)){
$calendar = OC_Calendar_Calendar::findCalendar($cal);
if($calendar["userid"] != OC_User::getUser()){

View File

@ -200,6 +200,7 @@ Calendar={
});
}
});
window.setTimeout("Calendar.UI.loadEvents(" + year + ")", 120000);
},
getEventsForDate:function(date){
var day = date.getDate();

View File

@ -10,7 +10,6 @@ class OC_Connector_Sabre_CalDAV extends Sabre_CalDAV_Backend_Abstract {
*/
public $propertyMap = array(
'{DAV:}displayname' => 'displayname',
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
'{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
'{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',

View File

@ -1,2 +1,3 @@
.contacts_details_left {text-align:right;vertical-align:top;padding:2px;}
.contacts_details_right {text-align:left;vertical-align:top;padding:2px;}
#contacts_deletecard {position:absolute;top:15px;right:0;}

View File

@ -1,11 +1,4 @@
$(document).ready(function(){
/*-------------------------------------------------------------------------
* Actions for startup
*-----------------------------------------------------------------------*/
if( $('#leftcontent li').length > 0 ){
$('#leftcontent li').first().addClass('active');
}
/*-------------------------------------------------------------------------
* Event handlers
*-----------------------------------------------------------------------*/

View File

@ -14,5 +14,5 @@ OC_Util::addStyle('contacts','styles');
</ul>
</div>
<div id="rightcontent" class="rightcontent" data-id="<?php echo $_['id']; ?>">
<?php echo $this->inc("part.details"); ?>
<?php echo $this->inc("part.addcardform"); ?>
</div>

View File

@ -28,7 +28,7 @@
<?php endforeach; ?>
</table>
<form>
<input type="button" id="contacts_deletecard" value="<?php echo $l->t('Delete');?>">
<img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
<input type="button" id="contacts_addproperty" value="<?php echo $l->t('Add Property');?>">
</form>
<?php endif; ?>

View File

@ -44,7 +44,7 @@ if(isset($_SERVER['HTTP_ORIGIN'])) {
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Max-Age: 3600');
header('Access-Control-Allow-Methods: OPTIONS, GET, PUT, DELETE, PROPFIND');
header('Access-Control-Allow-Headers: Authorization');
header('Access-Control-Allow-Headers: Authorization, Content-Type');
} else {
header('Access-Control-Allow-Origin: *');
}
@ -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

@ -1,11 +0,0 @@
<?php
$ownCloudBaseUri = substr($_SERVER['REQUEST_URI'],0, -(strlen('/apps/user_webfinger/activate.php')));
$thisAppDir = __DIR__;
$appsDir = dirname($thisAppDir);
$ownCloudDir = dirname($appsDir);
try{
symlink($thisAppDir, $ownCloudDir.'/.well-known');
echo "Webfinger should now work.\n";
} catch(Exception $e) {
echo "Please create a file called '.well-known in the ownCloud root, give the web server user permission to change it, and retry.\n";
}

View File

@ -0,0 +1,6 @@
<?php
$appInfoDir = __DIR__;
$thisAppDir = dirname($appInfoDir);
$appsDir = dirname($thisAppDir);
$ownCloudDir = dirname($appsDir);
symlink($thisAppDir, $ownCloudDir.'/.well-known');

View File

@ -122,3 +122,4 @@ div.jp-play-bar, div.jp-seek-bar { padding:0; }
.pager li { display:inline-block; }
li.error { width:640px; margin:4em auto; padding:1em 1em 1em 4em; background:#ffe .8em .8em no-repeat; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; }
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { overflow: hidden; text-overflow: ellipsis; }

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

View File

@ -37,7 +37,7 @@
</fieldset>
<fieldset id='databaseField'>
<?php if($_['hasMySQL'] or $_['hasPostgreSQL']) $hasOtherDB = true; //other than SQLite ?>
<?php if($_['hasMySQL'] or $_['hasPostgreSQL']) $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?>
<legend><?php echo $l->t( 'Configure the database' ); ?></legend>
<div id="selectDbType">
<?php if($_['hasSQLite']): ?>

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

@ -27,8 +27,16 @@ require_once('lib/base.php');
// Setup required :
$not_installed = !OC_Config::getValue('installed', false);
$install_called = (isset($_POST['install']) AND $_POST['install']=='true');
if($not_installed) {
// Check for autosetup:
$autosetup_file = OC::$SERVERROOT."/config/autoconfig.php";
if( file_exists( $autosetup_file )){
error_log("Autoconfig file found, setting up owncloud...");
include( $autosetup_file );
$_POST['install'] = 'true';
$_POST = array_merge ($_POST, $AUTOCONFIG);
unlink($autosetup_file);
}
OC_Util::addScript('setup');
require_once('setup.php');
exit();
@ -92,6 +100,14 @@ else {
$error = true;
}
}
// The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP
elseif(isset($_SERVER["PHP_AUTH_USER"]) && isset($_SERVER["PHP_AUTH_PW"])){
if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) {
OC_User::unsetMagicInCookie();
OC_Util::redirectToDefaultPage();
}else{
$error = true;
}
}
OC_Template::printGuestPage('', 'login', array('error' => $error, 'redirect' => isset($_REQUEST['redirect_url'])?$_REQUEST['redirect_url']:'' ));
}

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

@ -90,7 +90,7 @@ class OC_Util {
* @return array
*/
public static function getVersion(){
return array(1,92,0);
return array(2,90,0);
}
/**
@ -98,7 +98,7 @@ class OC_Util {
* @return string
*/
public static function getVersionString(){
return '2 beta 3';
return '3 alpha 1';
}
/**
@ -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');

View File

@ -21,7 +21,7 @@ return array(
'ms_MY'=>'Bahasa Melayu',
'nb_NO'=>'Norwegian Bokmål',
'nl'=>'Nederlands',
'pl'=>'język polski',
'pl'=>'Polski',
'pt_BR'=>'Português brasileiro',
'pt_PT'=>'Português',
'ro'=>'română',