diff --git a/apps/bookmarks/js/bookmarks.js b/apps/bookmarks/js/bookmarks.js index 77f767cdb8..fadbbd5513 100644 --- a/apps/bookmarks/js/bookmarks.js +++ b/apps/bookmarks/js/bookmarks.js @@ -85,7 +85,14 @@ function addOrEditBookmark(event) { $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); $('.bookmarks_list').prepend( '
' + - '

 

' + + '

' + + '' + + '' + + ' ' + + '' + + '' + + '' + + '

' + '

' + title + '

' + '

' + tagshtml + '

' + '

' + url + '

' + @@ -154,8 +161,17 @@ function updateBookmarksList(bookmark) { } $('.bookmarks_list').append( '
' + - '

 

' + - '

' + encodeEntities(bookmark.title) + '

' + + '

' + + '' + + '' + + ' ' + + '' + + '' + + '' + + '

' + + '

'+ + '' + encodeEntities(bookmark.title) + '' + + '

' + '

' + encodeEntities(bookmark.url) + '

' + '
' ); diff --git a/apps/bookmarks/templates/settings.php b/apps/bookmarks/templates/settings.php index 97b6b256c0..a985ee9d61 100644 --- a/apps/bookmarks/templates/settings.php +++ b/apps/bookmarks/templates/settings.php @@ -8,7 +8,7 @@ ?>
- t('Bookmarklet:');?> t('Add page to ownCloud'); ?> + t('Bookmarklet:');?> t('Add page to ownCloud'); ?>
t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?>
diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index 9ae3ffa8d9..19f6a80a16 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -243,6 +243,16 @@ if($repeat['repeat'] != 'doesnotrepeat'){ $tmpl->assign('repeat_bymonth', $repeat['bymonth']); $tmpl->assign('repeat_byweekno', $repeat['byweekno']); } +else { + $tmpl->assign('repeat_month', 'monthday'); + $tmpl->assign('repeat_weekdays', array()); + $tmpl->assign('repeat_interval', 1); + $tmpl->assign('repeat_end', 'never'); + $tmpl->assign('repeat_count', '10'); + $tmpl->assign('repeat_weekofmonth', 'auto'); + $tmpl->assign('repeat_date', ''); + $tmpl->assign('repeat_year', 'bydate'); +} $tmpl->printpage(); -?> \ No newline at end of file +?> diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index dd593ddec9..7734129bd9 100755 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -9,7 +9,8 @@ require_once ('../../../lib/base.php'); require_once('../../../3rdparty/when/When.php'); -function addoutput($event, $vevent, $return_event){ +function create_return_event($event, $vevent){ + $return_event = array(); $return_event['id'] = (int)$event['id']; $return_event['title'] = htmlspecialchars($event['summary']); $return_event['description'] = isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):''; @@ -29,15 +30,21 @@ OC_JSON::checkAppEnabled('calendar'); $start = DateTime::createFromFormat('U', $_GET['start']); $end = DateTime::createFromFormat('U', $_GET['end']); +$calendar = OC_Calendar_App::getCalendar($_GET['calendar_id']); +OC_Response::enableCaching(0); +OC_Response::setETagHeader($calendar['ctag']); + $events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end); $user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $return = array(); foreach($events as $event){ $object = OC_VObject::parse($event['calendardata']); $vevent = $object->VEVENT; + + $return_event = create_return_event($event, $vevent); + $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); - $return_event = array(); $start_dt = $dtstart->getDateTime(); $end_dt = $dtend->getDateTime(); if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ @@ -47,13 +54,17 @@ foreach($events as $event){ $start_dt->setTimezone(new DateTimeZone($user_timezone)); $end_dt->setTimezone(new DateTimeZone($user_timezone)); } + //Repeating Events if($event['repeating'] == 1){ $duration = (double) $end_dt->format('U') - (double) $start_dt->format('U'); $r = new When(); - $r->recur((string) $start_dt->format('Ymd\THis'))->rrule((string) $vevent->RRULE); + $r->recur($start_dt)->rrule((string) $vevent->RRULE); while($result = $r->next()){ - if($result->format('U') > $_GET['end']){ + if($result < $start){ + continue; + } + if($result > $end){ break; } if($return_event['allDay'] == true){ @@ -63,22 +74,19 @@ foreach($events as $event){ $return_event['start'] = $result->format('Y-m-d H:i:s'); $return_event['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration); } - $return[] = addoutput($event, $vevent, $return_event); + $return[] = $return_event; } }else{ - $return_event = array(); - if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ - $return_event['allDay'] = true; + if($return_event['allDay'] == true){ $return_event['start'] = $start_dt->format('Y-m-d'); $end_dt->modify('-1 sec'); $return_event['end'] = $end_dt->format('Y-m-d'); }else{ $return_event['start'] = $start_dt->format('Y-m-d H:i:s'); $return_event['end'] = $end_dt->format('Y-m-d H:i:s'); - $return_event['allDay'] = false; } - $return[] = addoutput($event, $vevent, $return_event); + $return[] = $return_event; } } OC_JSON::encodedPrint($return); -?> \ No newline at end of file +?> diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 6f1f52eafa..517d2ce128 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -689,7 +689,10 @@ $(document).ready(function(){ allDayText: allDayText, viewDisplay: function(view) { $('#datecontrol_date').html(view.title); - $.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name); + if (view.name != defaultView) { + $.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name); + defaultView = view.name; + } Calendar.UI.setViewActive(view.name); if (view.name == 'agendaWeek') { $('#calendar_holder').fullCalendar('option', 'aspectRatio', 0.1); diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index 5e272991f2..679649582d 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -246,6 +246,7 @@ class OC_Calendar_Calendar{ 'backgroundColor' => '#'.$calendar['calendarcolor'], 'borderColor' => '#888', 'textColor' => 'black', + 'cache' => true, ); } } diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php index 425c93c733..0016751a66 100644 --- a/apps/calendar/lib/search.php +++ b/apps/calendar/lib/search.php @@ -36,7 +36,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{ }else{ $info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i'); } - $link = OC_Helper::linkTo('apps/calendar', 'index.php?showevent='.urlencode($object['id'])); + $link = OC_Helper::linkTo('calendar', 'index.php').'?showevent='.urlencode($object['id']); $results[]=new OC_Search_Result($object['summary'],$info, $link,$l->t('Cal.'));//$name,$text,$link,$type } } diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 2d5cdea4d7..eb82d0d02a 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -18,7 +18,7 @@ var missing_field_totime = 't('To Time')) ?>'; var missing_field_startsbeforeends = 't('The event ends before it starts')) ?>'; var missing_field_dberror = 't('There was a database fail')) ?>'; - var totalurl = '/calendars'; + var totalurl = '/calendars'; $(document).ready(function() { t('Calendar CalDAV syncing address:');?> -
+
diff --git a/apps/contacts/index.php b/apps/contacts/index.php index c5115d1607..0a21ddd04b 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -10,6 +10,8 @@ require_once('../../lib/base.php'); // Check if we are a user OC_Util::checkLoggedIn(); +OC_Util::checkAppEnabled('contacts'); + // Get active address books. This creates a default one if none exists. $ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser()); $contacts = OC_Contacts_VCard::all($ids); diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php index 016bd2b791..ff348403a9 100644 --- a/apps/contacts/lib/app.php +++ b/apps/contacts/lib/app.php @@ -53,7 +53,7 @@ class OC_Contacts_App { OC_Log::write('contacts', 'Addressbook not found: '. $id, OC_Log::ERROR); } else { - OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.$OC_User::getUser(), OC_Log::ERROR); + OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.OC_User::getUser(), OC_Log::ERROR); } OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved? exit(); diff --git a/apps/contacts/lib/search.php b/apps/contacts/lib/search.php index 9763882100..5aad6a25f0 100644 --- a/apps/contacts/lib/search.php +++ b/apps/contacts/lib/search.php @@ -18,7 +18,7 @@ class OC_Search_Provider_Contacts extends OC_Search_Provider{ $vcards = OC_Contacts_VCard::all($addressbook['id']); foreach($vcards as $vcard){ if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0){ - $link = OC_Helper::linkTo('apps/contacts', 'index.php?id='.urlencode($vcard['id'])); + $link = OC_Helper::linkTo('contacts', 'index.php').'?id='.urlencode($vcard['id']); $results[]=new OC_Search_Result($vcard['fullname'],'', $link,$l->t('Contact'));//$name,$text,$link,$type } } diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index 4c0dfad617..e81597f23d 100644 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,5 +1,5 @@
diff --git a/apps/contacts/templates/part.contactphoto.php b/apps/contacts/templates/part.contactphoto.php index 7d7ab23756..9e3f5876cd 100644 --- a/apps/contacts/templates/part.contactphoto.php +++ b/apps/contacts/templates/part.contactphoto.php @@ -3,7 +3,7 @@ $id = $_['id']; $wattr = isset($_['width'])?'width="'.$_['width'].'"':''; $hattr = isset($_['height'])?'height="'.$_['height'].'"':''; ?> - src="?id=&refresh=" /> + src="?id=&refresh=" /> diff --git a/apps/contacts/templates/part.cropphoto.php b/apps/contacts/templates/part.cropphoto.php index cb416f0e41..5faa4aa6ac 100644 --- a/apps/contacts/templates/part.cropphoto.php +++ b/apps/contacts/templates/part.cropphoto.php @@ -38,13 +38,13 @@ OC_Log::write('contacts','templates/part.cropphoto.php: tmp_path: '.$tmp_path.', return true; });*/ - + + action=""> diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php index c647e44c25..8673e4521d 100644 --- a/apps/contacts/templates/settings.php +++ b/apps/contacts/templates/settings.php @@ -2,6 +2,6 @@
t('Contacts'); ?>
t('CardDAV syncing address:'); ?> -
+
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index 51fda6aed4..ba01adffb9 100644 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -8,6 +8,7 @@ require_once('../lib_share.php'); $userDirectory = "/".OC_User::getUser()."/files"; $source = $userDirectory.$_GET['source']; $path = $source; +$users = array(); if ($users = OC_Share::getMySharedItem($source)) { for ($i = 0; $i < count($users); $i++) { if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { @@ -19,7 +20,6 @@ $source = dirname($source); while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) { if ($values = OC_Share::getMySharedItem($source)) { $values = array_values($values); - $users = array(); $parentUsers = array(); for ($i = 0; $i < count($values); $i++) { if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) { diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index 049a74278b..42739bdfba 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -88,12 +88,15 @@ class OC_Share { $uid = $uid."@".$gid; } $query->execute(array($uid_owner, $uid, $source, $target, $permissions)); - // Clear the folder size cache for the 'Shared' folder -// $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); -// $clearFolderSize->execute(array($sharedFolder)); - // Emit post_create and post_write hooks to notify of a new file in the user's filesystem - OC_Hook::emit("OC_Filesystem", "post_create", array('path' => $target)); - OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target)); + // Add file to filesystem cache + $userDirectory = "/".OC_User::getUser()."/files"; + $data = OC_Filecache::get(substr($source, strlen($userDirectory))); + $parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?'); + $parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow(); + $parent = $parentResult['id']; + $is_writeable = $permissions & OC_Share::WRITE; + $cacheQuery = OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)'); + $cacheQuery->execute(array($parent, basename($target), $target, $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], dirname($data['mimetype']), $uid, $is_writeable)); } } } diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php index da87227449..b8de32ea58 100644 --- a/apps/gallery/appinfo/app.php +++ b/apps/gallery/appinfo/app.php @@ -46,7 +46,7 @@ OC_App::addNavigationEntry( array( $result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%')); $results=array(); while($row=$result->fetchRow()){ - $results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('apps/gallery', 'index.php?view='.$row['album_name']),'Galleries'); + $results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo('gallery', 'index.php').'?view='.$row['album_name'],'Galleries'); } return $results; } diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php index 138b65d1fd..97c0930860 100644 --- a/apps/media/lib_ampache.php +++ b/apps/media/lib_ampache.php @@ -207,7 +207,7 @@ class OC_MEDIA_AMPACHE{ echo("\t\t$name\n"); echo("\t\t$artistName\n"); echo("\t\t$albumName\n"); - $url=OC_Helper::linkTo('media', 'server/xml.server.php', null, true)."?action=play&song=$id&auth={$_GET['auth']}"; + $url=OC_Helper::linkToAbsolute('media', 'server/xml.server.php')."?action=play&song=$id&auth={$_GET['auth']}"; $url=self::fixXmlString($url); echo("\t\t$url\n"); echo("\t\t\n"); diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php index 0ade0e593d..1bcd0f08c8 100644 --- a/apps/media/lib_media.php +++ b/apps/media/lib_media.php @@ -89,18 +89,18 @@ class OC_MediaSearchProvider extends OC_Search_Provider{ $songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query); $results=array(); foreach($artists as $artist){ - $results[]=new OC_Search_Result($artist['artist_name'],'',OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist['artist_name']) ),'Music'); + $results[]=new OC_Search_Result($artist['artist_name'],'',OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist['artist_name']),'Music'); } foreach($albums as $album){ $artist=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']); - $results[]=new OC_Search_Result($album['album_name'],'by '.$artist,OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist).'&album='.urlencode($album['album_name']) ),'Music'); + $results[]=new OC_Search_Result($album['album_name'],'by '.$artist,OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album['album_name']),'Music'); } foreach($songs as $song){ $minutes=floor($song['song_length']/60); $secconds=$song['song_length']%60; $artist=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']); $album=OC_MEDIA_COLLECTION::getalbumName($song['song_album']); - $results[]=new OC_Search_Result($song['song_name'],"by $artist, in $album $minutes:$secconds",OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist).'&album='.urlencode($album).'&song='.urlencode($song['song_name']) ),'Music'); + $results[]=new OC_Search_Result($song['song_name'],"by $artist, in $album $minutes:$secconds",OC_Helper::linkTo( 'media', 'index.php').'#artist='.urlencode($artist).'&album='.urlencode($album).'&song='.urlencode($song['song_name']),'Music'); } return $results; } diff --git a/apps/media/templates/settings.php b/apps/media/templates/settings.php index ac813c2085..2907c616cf 100644 --- a/apps/media/templates/settings.php +++ b/apps/media/templates/settings.php @@ -2,6 +2,6 @@
Media
Ampache address: -
+
diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php index 912019a970..cbcbe54422 100644 --- a/apps/user_openid/appinfo/app.php +++ b/apps/user_openid/appinfo/app.php @@ -14,8 +14,8 @@ if(strpos($_SERVER["REQUEST_URI"],'?') and !strpos($_SERVER["REQUEST_URI"],'=')) } } -OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName)); -OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$userName)); +OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName)); +OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName)); OC_APP::registerPersonal('user_openid','settings'); diff --git a/apps/user_openid/user.php b/apps/user_openid/user.php index a267e02050..8fec713aa7 100644 --- a/apps/user_openid/user.php +++ b/apps/user_openid/user.php @@ -43,7 +43,7 @@ if(!OC_User::userExists($USERNAME)){ OC_Log::write('user_openid',$USERNAME.' doesn\'t exist',OC_Log::WARN); $USERNAME=''; } -$IDENTITY=OC_Helper::linkTo( "user_openid", "user.php", null, true ).'/'.$USERNAME; +$IDENTITY=OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$USERNAME; require_once 'phpmyid.php'; diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php index ede94dab2d..30caa2d23d 100644 --- a/core/lostpassword/index.php +++ b/core/lostpassword/index.php @@ -16,7 +16,7 @@ if (isset($_POST['user'])) { OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token); $email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', ''); if (!empty($email)) { - $link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token; + $link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php').'?user='.$_POST['user'].'&token='.$token; $tmpl = new OC_Template('core/lostpassword', 'email'); $tmpl->assign('link', $link); $msg = $tmpl->fetchPage(); diff --git a/files/index.php b/files/index.php index f166790ba9..a29d3fb7e1 100644 --- a/files/index.php +++ b/files/index.php @@ -76,11 +76,11 @@ foreach( explode( "/", $dir ) as $i ){ // make breadcrumb und filelist markup $list = new OC_Template( "files", "part.list", "" ); $list->assign( "files", $files ); -$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir=")); -$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php?file=")); +$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir="); +$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php")."?file="); $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" ); $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); -$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir=")); +$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir="); $upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize')); $post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size')); diff --git a/index.php b/index.php index 9bd460be35..18ea3022bc 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ if($not_installed) { // Handle WebDAV if($_SERVER['REQUEST_METHOD']=='PROPFIND'){ - header('location: '.OC_Helper::linkTo('files','webdav.php')); + header('location: '.OC_Helper::linkToAbsolute('files','webdav.php')); exit(); } diff --git a/lib/app.php b/lib/app.php index 22d18b17ee..1879a89cee 100644 --- a/lib/app.php +++ b/lib/app.php @@ -230,7 +230,7 @@ class OC_App{ // admin users menu $settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" )); // admin apps menu - $settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php?installed" ), "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" )); + $settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" )); // admin log menu $settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "settings", "log.svg" )); diff --git a/lib/base.php b/lib/base.php index 8f169a5732..880645ff79 100644 --- a/lib/base.php +++ b/lib/base.php @@ -171,6 +171,13 @@ class OC{ echo 'Error while upgrading the database'; die(); } + if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")) { + $tmpl = new OC_Template( '', 'error', 'guest' ); + $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); + $tmpl->printPage(); + exit; + } + OC_Config::setValue('version',implode('.',OC_Util::getVersion())); } diff --git a/lib/config.php b/lib/config.php index 8d03271b3e..ad1cd18fa1 100644 --- a/lib/config.php +++ b/lib/config.php @@ -174,7 +174,7 @@ class OC_Config{ $result=@file_put_contents( OC::$SERVERROOT."/config/config.php", $content ); if(!$result) { $tmpl = new OC_Template( '', 'error', 'guest' ); - $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver use write access to the config directory in owncloud"))); + $tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud"))); $tmpl->printPage(); exit; } diff --git a/lib/filestorage/google.php b/lib/filestorage/google.php new file mode 100644 index 0000000000..fc271f4e4b --- /dev/null +++ b/lib/filestorage/google.php @@ -0,0 +1,55 @@ +. +*/ + +class OC_Filestorage_Google extends OC_Filestorage_Common { + + private $auth; + + public function __construct($parameters) { + + } + + private function connect() { + + } + public function mkdir($path){} + public function rmdir($path){} + public function opendir($path){} + public function is_dir($path){} + public function is_file($path){} + public function stat($path){} + public function filetype($path){} + public function is_readable($path){} + public function is_writable($path){} + public function file_exists($path){} + public function unlink($path){} + public function rename($path1,$path2){} + public function fopen($path,$mode){} + public function toTmpFile($path){} + public function fromTmpFile($tmpPath,$path){} + public function fromUploadedFile($tmpPath,$path){} + public function getMimeType($path){} + public function hash($type,$path,$raw){} + public function free_space($path){} + public function search($query){} + public function getLocalFile($path){} +} \ No newline at end of file diff --git a/lib/helper.php b/lib/helper.php index 6d3df6d97e..b1e6d053a1 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -54,12 +54,6 @@ class OC_Helper { } } - if($absolute){ - // Checking if the request was made through HTTPS. The last in line is for IIS - $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off'); - $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo; - } - if($redirect_url) return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]); else @@ -67,6 +61,23 @@ class OC_Helper { } + /** + * @brief Creates an absolute url + * @param $app app + * @param $file file + * @param $redirect_url redirect_url variable is appended to the URL + * @returns the url + * + * Returns a absolute url to the given app and file. + */ + public static function linkToAbsolute( $app, $file, $redirect_url=NULL ) { + $urlLinkTo = self::linkTo( $app, $file, $redirect_url ); + // Checking if the request was made through HTTPS. The last in line is for IIS + $protocol = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS']!='off'); + $urlLinkTo = ($protocol?'https':'http') . '://' . $_SERVER['HTTP_HOST'] . $urlLinkTo; + return $urlLinkTo; + } + /** * @brief Creates path to an image * @param $app app diff --git a/lib/response.php b/lib/response.php index 9431d7af1c..a75135c017 100644 --- a/lib/response.php +++ b/lib/response.php @@ -12,6 +12,13 @@ class OC_Response { const STATUS_TEMPORARY_REDIRECT = 307; const STATUS_NOT_FOUND = 404; + /** + * @brief Enable response caching by sending correct HTTP headers + * @param $cache_time time to cache the response + * >0 cache time in seconds + * 0 and <0 enable default browser caching + * null cache indefinitly + */ static public function enableCaching($cache_time = null) { if (is_numeric($cache_time)) { header('Pragma: public');// enable caching in IE @@ -30,10 +37,19 @@ class OC_Response { } } + + /** + * @brief disable browser caching + * @see enableCaching with cache_time = 0 + */ static public function disableCaching() { self::enableCaching(0); } + /** + * @brief Set response status + * @param $status a HTTP status code, see also the STATUS constants + */ static public function setStatus($status) { $protocol = $_SERVER['SERVER_PROTOCOL']; switch($status) { @@ -58,11 +74,21 @@ class OC_Response { header($protocol.' '.$status); } + /** + * @brief Send redirect response + * @param $location to redirect to + */ static public function redirect($location) { self::setStatus(self::STATUS_TEMPORARY_REDIRECT); header('Location: '.$location); } + /** + * @brief Set reponse expire time + * @param $expires date-time when the response expires + * string for DateInterval from now + * DateTime object when to expire response + */ static public function setExpiresHeader($expires) { if (is_string($expires) && $expires[0] == 'P') { $interval = $expires; @@ -76,6 +102,11 @@ class OC_Response { header('Expires: '.$expires); } + /** + * Checks and set ETag header, when the request matches sends a + * 'not modified' response + * @param $etag token to use for modification check + */ static public function setETagHeader($etag) { if (empty($etag)) { return; @@ -88,6 +119,11 @@ class OC_Response { header('ETag: "'.$etag.'"'); } + /** + * Checks and set Last-Modified header, when the request matches sends a + * 'not modified' response + * @param $lastModified time when the reponse was last modified + */ static public function setLastModifiedHeader($lastModified) { if (empty($lastModified)) { return; @@ -106,7 +142,11 @@ class OC_Response { header('Last-Modified: '.$lastModified); } - static public function sendFile($filepath=null) { + /** + * @brief Send file as response, checking and setting caching headers + * @param $filepath of file to send + */ + static public function sendFile($filepath) { $fp = fopen($filepath, 'rb'); if ($fp) { self::setLastModifiedHeader(filemtime($filepath)); diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php index c3dc2942ae..34803c75ae 100644 --- a/lib/search/provider/file.php +++ b/lib/search/provider/file.php @@ -7,7 +7,7 @@ class OC_Search_Provider_File extends OC_Search_Provider{ foreach($files as $fileData){ $file=$fileData['path']; if($fileData['mime']=='httpd/unix-directory'){ - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php?dir='.$file ),'Files'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php' ).'?dir='.$file,'Files'); }else{ $mime=$fileData['mime']; $mimeBase=$fileData['mimepart']; @@ -15,16 +15,16 @@ class OC_Search_Provider_File extends OC_Search_Provider{ case 'audio': break; case 'text': - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Text'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Text'); break; case 'image': - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Images'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Images'); break; default: if($mime=='application/xml'){ - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Text'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Text'); }else{ - $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Files'); + $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Files'); } } } diff --git a/lib/setup.php b/lib/setup.php index eb32e84713..3e46a3dcc9 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -77,8 +77,6 @@ class OC_Setup { OC_Config::setValue('datadirectory', $datadir); OC_Config::setValue('dbtype', $dbtype); OC_Config::setValue('version',implode('.',OC_Util::getVersion())); - OC_Config::setValue('installedat',microtime(true)); - OC_Config::setValue('lastupdatedat',microtime(true)); if($dbtype == 'mysql') { $dbuser = $options['dbuser']; $dbpass = $options['dbpass']; @@ -224,6 +222,9 @@ class OC_Setup { } if(count($error) == 0) { + OC_Appconfig::setValue('core', 'installedat',microtime(true)); + OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true)); + //create the user and group OC_User::createUser($username, $password); OC_Group::createGroup('admin'); diff --git a/lib/updater.php b/lib/updater.php index cc4a460253..57623797ae 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -29,12 +29,12 @@ class OC_Updater{ * Check if a new version is available */ public static function check(){ - OC_Config::setValue('lastupdatedat',microtime(true)); + OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true)); $updaterurl='http://apps.owncloud.com/updater.php'; $version=OC_Util::getVersion(); - $version['installed']=OC_Config::getValue( "installedat"); - $version['updated']=OC_Config::getValue( "lastupdatedat"); + $version['installed']=OC_Config::getValue('installedat'); + $version['updated']=OC_Appconfig::getValue('core', 'lastupdatedat', OC_Config::getValue( 'lastupdatedat')); $version['updatechannel']='stable'; $versionstring=implode('x',$version); diff --git a/lib/util.php b/lib/util.php index 43fb4413f0..ee32d31bfd 100644 --- a/lib/util.php +++ b/lib/util.php @@ -226,10 +226,6 @@ class OC_Util { $errors[]=array('error'=>'PHP module ctype is not installed.
','hint'=>'Please ask your server administrator to install the module.'); } - if(file_exists(OC::$SERVERROOT."/config/config.php") and !is_writable(OC::$SERVERROOT."/config/config.php")){ - $errors[]=array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver use write access to the config directory in owncloud"); - } - return $errors; } @@ -248,7 +244,7 @@ class OC_Util { */ public static function checkAppEnabled($app){ if( !OC_App::isEnabled($app)){ - header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true)); + header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' )); exit(); } } @@ -259,7 +255,7 @@ class OC_Util { public static function checkLoggedIn(){ // Check if we are a user if( !OC_User::isLoggedIn()){ - header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true)); + header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' )); exit(); } } @@ -271,7 +267,7 @@ class OC_Util { // Check if we are a user self::checkLoggedIn(); if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ - header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true)); + header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' )); exit(); } } diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 80d2cb0a86..57731d979d 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -41,7 +41,7 @@

WebDAV -
+
t('use this address to connect to your ownCloud in your file manager');?>