diff --git a/.htaccess b/.htaccess index ced9ae652d..34d4c719c8 100644 --- a/.htaccess +++ b/.htaccess @@ -4,4 +4,8 @@ php_value upload_max_filesize 512M php_value post_max_size 512M SetEnv htaccessWorking true + +RewriteEngine on +RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] + Options -Indexes diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php index f66d98a8cc..44d4235b9b 100644 --- a/apps/bookmarks/bookmarksHelper.php +++ b/apps/bookmarks/bookmarksHelper.php @@ -1,5 +1,52 @@ 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>/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 b3e5ecd683..3e93a1ad61 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 87954b7aac..efddac4042 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 13a542fcca..263fb7ffde 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 1f95fdb2ad..c1abd0efb6 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 0fcfdeaab5..2f4a736f55 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -1,11 +1,4 @@ $(document).ready(function(){ - /*------------------------------------------------------------------------- - * Actions for startup - *-----------------------------------------------------------------------*/ - if( $('#leftcontent li').length > 0 ){ - $('#leftcontent li').first().addClass('active'); - } - /*------------------------------------------------------------------------- * Event handlers *-----------------------------------------------------------------------*/ diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index 6d67584b29..98ebc1b0b3 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 26a33739ac..438f84d45d 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 d383e87951..445257320c 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 50257232ae..0000000000 --- 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 0000000000..079043cd10 --- /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 46b340be96..539ae580aa 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 similarity index 100% rename from core/img/filetypes/script.png rename to core/img/filetypes/code-script.png diff --git a/core/img/filetypes/php.png b/core/img/filetypes/text-x-php.png similarity index 100% rename from core/img/filetypes/php.png rename to core/img/filetypes/text-x-php.png diff --git a/core/templates/installation.php b/core/templates/installation.php index 70a545d66c..f1cde6b390 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 0000000000..8724016b3a --- /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 84762bb561..e6da922700 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 9342642b4f..079646070d 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 2e55827a62..924e7394f7 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 0156febe23..ade4d88963 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 (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 c2a81ba330..5b3e394caf 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 355d979dc6..252eaaeea1 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 f8748e868c..0f8cc08fce 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 3e2cea50ac..81177e0a25 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ă',