aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Needham <needham.thomas@gmail.com>2011-10-14 22:07:30 +0100
committerTom Needham <needham.thomas@gmail.com>2011-10-14 22:07:30 +0100
commit3fee961a0a4f33aa4c62964714b1fa5a31cef44b (patch)
treefbbe1f876daa41ba38012d05dd56e3e4c71310b8
parent42f289d994020e3e8ce8b35ce78128625679b4a6 (diff)
parentf29dc0c0fbc7dd360066e5f47ec3b87927381c1b (diff)
downloadnextcloud-server-3fee961a0a4f33aa4c62964714b1fa5a31cef44b.tar.gz
nextcloud-server-3fee961a0a4f33aa4c62964714b1fa5a31cef44b.zip
Merge branch 'master' of gitorious.org:owncloud/owncloud into ace-editor
-rw-r--r--.htaccess4
-rw-r--r--apps/bookmarks/bookmarksHelper.php51
-rw-r--r--apps/calendar/export.php4
-rw-r--r--apps/calendar/js/calendar.js1
-rw-r--r--apps/calendar/lib/connector_sabre.php1
-rw-r--r--apps/contacts/css/styles.css1
-rw-r--r--apps/contacts/js/interface.js7
-rw-r--r--apps/contacts/templates/index.php2
-rw-r--r--apps/contacts/templates/part.details.php2
-rw-r--r--apps/remoteStorage/compat.php4
-rw-r--r--apps/user_webfinger/activate.php11
-rw-r--r--apps/user_webfinger/appinfo/install.php6
-rw-r--r--core/css/styles.css1
-rw-r--r--core/img/filetypes/code-script.png (renamed from core/img/filetypes/script.png)bin859 -> 859 bytes
-rw-r--r--core/img/filetypes/text-x-php.png (renamed from core/img/filetypes/php.png)bin538 -> 538 bytes
-rw-r--r--core/templates/installation.php2
-rw-r--r--files/ajax/mimeicon.php8
-rw-r--r--files/js/filelist.js12
-rw-r--r--files/js/files.js15
-rw-r--r--index.php20
-rw-r--r--lib/base.php8
-rw-r--r--lib/helper.php6
-rw-r--r--lib/setup.php4
-rw-r--r--lib/util.php9
-rw-r--r--settings/languageCodes.php2
25 files changed, 134 insertions, 47 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/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php
index f66d98a8ccb..44d4235b9b3 100644
--- a/apps/bookmarks/bookmarksHelper.php
+++ b/apps/bookmarks/bookmarksHelper.php
@@ -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;
} \ No newline at end of file
diff --git a/apps/calendar/export.php b/apps/calendar/export.php
index b3e5ecd6834..3e93a1ad618 100644
--- a/apps/calendar/export.php
+++ b/apps/calendar/export.php
@@ -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()){
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index 87954b7aac6..efddac40426 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -200,6 +200,7 @@ Calendar={
});
}
});
+ window.setTimeout("Calendar.UI.loadEvents(" + year + ")", 120000);
},
getEventsForDate:function(date){
var day = date.getDate();
diff --git a/apps/calendar/lib/connector_sabre.php b/apps/calendar/lib/connector_sabre.php
index 13a542fccad..263fb7ffde5 100644
--- a/apps/calendar/lib/connector_sabre.php
+++ b/apps/calendar/lib/connector_sabre.php
@@ -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',
diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css
index 1f95fdb2ad4..c1abd0efb62 100644
--- a/apps/contacts/css/styles.css
+++ b/apps/contacts/css/styles.css
@@ -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;}
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index 0fcfdeaab5d..2f4a736f553 100644
--- a/apps/contacts/js/interface.js
+++ b/apps/contacts/js/interface.js
@@ -1,12 +1,5 @@
$(document).ready(function(){
/*-------------------------------------------------------------------------
- * Actions for startup
- *-----------------------------------------------------------------------*/
- if( $('#leftcontent li').length > 0 ){
- $('#leftcontent li').first().addClass('active');
- }
-
- /*-------------------------------------------------------------------------
* Event handlers
*-----------------------------------------------------------------------*/
$('#leftcontent li').live('click',function(){
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index 6d67584b29e..98ebc1b0b36 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -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>
diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php
index 26a33739acb..438f84d45d4 100644
--- a/apps/contacts/templates/part.details.php
+++ b/apps/contacts/templates/part.details.php
@@ -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; ?>
diff --git a/apps/remoteStorage/compat.php b/apps/remoteStorage/compat.php
index d383e879510..445257320c6 100644
--- a/apps/remoteStorage/compat.php
+++ b/apps/remoteStorage/compat.php
@@ -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://";
diff --git a/apps/user_webfinger/activate.php b/apps/user_webfinger/activate.php
deleted file mode 100644
index 50257232ae4..00000000000
--- a/apps/user_webfinger/activate.php
+++ /dev/null
@@ -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";
-}
diff --git a/apps/user_webfinger/appinfo/install.php b/apps/user_webfinger/appinfo/install.php
new file mode 100644
index 00000000000..079043cd102
--- /dev/null
+++ b/apps/user_webfinger/appinfo/install.php
@@ -0,0 +1,6 @@
+<?php
+$appInfoDir = __DIR__;
+$thisAppDir = dirname($appInfoDir);
+$appsDir = dirname($thisAppDir);
+$ownCloudDir = dirname($appsDir);
+symlink($thisAppDir, $ownCloudDir.'/.well-known');
diff --git a/core/css/styles.css b/core/css/styles.css
index 46b340be961..539ae580aa0 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -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; } \ No newline at end of file
diff --git a/core/img/filetypes/script.png b/core/img/filetypes/code-script.png
index 63fe6ceff5b..63fe6ceff5b 100644
--- a/core/img/filetypes/script.png
+++ b/core/img/filetypes/code-script.png
Binary files differ
diff --git a/core/img/filetypes/php.png b/core/img/filetypes/text-x-php.png
index 7868a25945c..7868a25945c 100644
--- a/core/img/filetypes/php.png
+++ b/core/img/filetypes/text-x-php.png
Binary files differ
diff --git a/core/templates/installation.php b/core/templates/installation.php
index 70a545d66cf..f1cde6b3904 100644
--- a/core/templates/installation.php
+++ b/core/templates/installation.php
@@ -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']): ?>
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/index.php b/index.php
index 2e55827a62a..924e7394f7b 100644
--- a/index.php
+++ b/index.php
@@ -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']:'' ));
}
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','&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));
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 f8748e868c1..0f8cc08fce6 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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');
diff --git a/settings/languageCodes.php b/settings/languageCodes.php
index 3e2cea50acc..81177e0a258 100644
--- a/settings/languageCodes.php
+++ b/settings/languageCodes.php
@@ -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ă',