Merge gitorious.org:owncloud/owncloud into vcategories

This commit is contained in:
Thomas Tanghus 2012-02-19 13:11:13 +01:00
commit adec09b075
38 changed files with 228 additions and 75 deletions

View File

@ -85,7 +85,14 @@ function addOrEditBookmark(event) {
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
$('.bookmarks_list').prepend(
'<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
'<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span>&nbsp;<span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' +
'<p class="bookmark_actions">' +
'<span class="bookmark_delete">' +
'<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
'</span>&nbsp;' +
'<span class="bookmark_edit">' +
'<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' +
'</span>' +
'</p>' +
'<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' +
'<p class="bookmark_tags">' + tagshtml + '</p>' +
'<p class="bookmark_url">' + url + '</p>' +
@ -154,8 +161,17 @@ function updateBookmarksList(bookmark) {
}
$('.bookmarks_list').append(
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
'<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span>&nbsp;<span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' +
'<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' +
'<p class="bookmark_actions">' +
'<span class="bookmark_delete">' +
'<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
'</span>&nbsp;' +
'<span class="bookmark_edit">' +
'<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' +
'</span>' +
'</p>' +
'<p class="bookmark_title">'+
'<a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a>' +
'</p>' +
'<p class="bookmark_url">' + encodeEntities(bookmark.url) + '</p>' +
'</div>'
);

View File

@ -8,7 +8,7 @@
?>
<form id="bookmarks">
<fieldset class="personalblock">
<span class="bold"><?php echo $l->t('Bookmarklet:');?></span>&nbsp;<a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkTo('bookmarks', 'addBm.php', null, true); ?>?url='+url, 'owncloud-bookmarks') })()"><?php echo $l->t('Add page to ownCloud'); ?></a>
<span class="bold"><?php echo $l->t('Bookmarklet:');?></span>&nbsp;<a class="bookmarks_addBml" href="javascript:(function(){url=encodeURIComponent(location.href);window.open('<?php echo OC_Helper::linkToAbsolute('bookmarks', 'addBm.php'); ?>?url='+url, 'owncloud-bookmarks') })()"><?php echo $l->t('Add page to ownCloud'); ?></a>
<br/><em><?php echo $l->t('Drag this to your browser bookmarks and click it, when you want to bookmark a webpage.'); ?></em><br />
</fieldset>
</form>

View File

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

View File

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

View File

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

View File

@ -246,6 +246,7 @@ class OC_Calendar_Calendar{
'backgroundColor' => '#'.$calendar['calendarcolor'],
'borderColor' => '#888',
'textColor' => 'black',
'cache' => true,
);
}
}

View File

@ -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
}
}

View File

@ -18,7 +18,7 @@
var missing_field_totime = '<?php echo addslashes($l->t('To Time')) ?>';
var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>';
var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>';
var totalurl = '<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?>/calendars';
var totalurl = '<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars';
$(document).ready(function() {
<?php
if(array_key_exists('showevent', $_)){

View File

@ -40,6 +40,6 @@
</table>
<?php echo $l->t('Calendar CalDAV syncing address:');?>
<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?><br />
<?php echo OC_Helper::linkToAbsolute('calendar', 'caldav.php'); ?><br />
</fieldset>
</form>

View File

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

View File

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

View File

@ -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
}
}

View File

@ -1,5 +1,5 @@
<script type='text/javascript'>
var totalurl = '<?php echo OC_Helper::linkTo('contacts', 'carddav.php', null, true); ?>/addressbooks';
var totalurl = '<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
</script>
<div id="controls">
<form>

View File

@ -3,7 +3,7 @@ $id = $_['id'];
$wattr = isset($_['width'])?'width="'.$_['width'].'"':'';
$hattr = isset($_['height'])?'height="'.$_['height'].'"':'';
?>
<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkTo('contacts', 'photo.php', null, true); ?>?id=<?php echo $id; ?>&amp;refresh=<?php echo rand(); ?>" />
<img class="loading" id="contacts_details_photo" <?php echo $wattr; ?> <?php echo $hattr; ?> src="<?php echo OC_Helper::linkToAbsolute('contacts', 'photo.php'); ?>?id=<?php echo $id; ?>&amp;refresh=<?php echo rand(); ?>" />
<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>

View File

@ -38,13 +38,13 @@ OC_Log::write('contacts','templates/part.cropphoto.php: tmp_path: '.$tmp_path.',
return true;
});*/
</script>
<img id="cropbox" src="<?php echo OC_Helper::linkTo('contacts', 'dynphoto.php', null, true); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
<img id="cropbox" src="<?php echo OC_Helper::linkToAbsolute('contacts', 'dynphoto.php'); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
<form id="cropform"
class="coords"
method="post"
enctype="multipart/form-data"
target="crop_target"
action="<?php echo OC_Helper::linkTo('contacts', 'ajax/savecrop.php', null, true); ?>">
action="<?php echo OC_Helper::linkToAbsolute('contacts', 'ajax/savecrop.php'); ?>">
<input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
<input type="hidden" id="tmp_path" name="tmp_path" value="<?php echo $tmp_path; ?>" />

View File

@ -2,6 +2,6 @@
<fieldset class="personalblock">
<strong><?php echo $l->t('Contacts'); ?></strong><br />
<?php echo $l->t('CardDAV syncing address:'); ?>
<?php echo OC_Helper::linkTo('apps/contacts', 'carddav.php', null, true); ?><br />
<?php echo OC_Helper::linkToAbsolute('contacts', 'carddav.php'); ?><br />
</fieldset>
</form>

View File

@ -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) {

View File

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

View File

@ -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;
}

View File

@ -207,7 +207,7 @@ class OC_MEDIA_AMPACHE{
echo("\t\t<title>$name</title>\n");
echo("\t\t<artist id='$artist'>$artistName</artist>\n");
echo("\t\t<album id='$album'>$albumName</album>\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>$url</url>\n");
echo("\t\t<time>{$song['song_length']}</time>\n");

View File

@ -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;
}

View File

@ -2,6 +2,6 @@
<fieldset class="personalblock">
<strong>Media</strong><br />
Ampache address:
<?php echo OC_Helper::linkTo('apps/media', '', null, true); ?><br />
<?php echo OC_Helper::linkToAbsolute('media', ''); ?><br />
</fieldset>
</form>

View File

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

View File

@ -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';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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;
}

View File

@ -0,0 +1,55 @@
<?php
/**
* ownCloud
*
* @author Michael Gapczynski
* @copyright 2012 Michael Gapczynski mtgap@owncloud.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
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){}
}

View File

@ -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

View File

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

View File

@ -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');
}
}
}

View File

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

View File

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

View File

@ -226,10 +226,6 @@ class OC_Util {
$errors[]=array('error'=>'PHP module ctype is not installed.<br/>','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();
}
}

View File

@ -41,7 +41,7 @@
<p class="personalblock">
<strong>WebDAV</strong>
<?php echo OC_Helper::linkTo('files', 'webdav.php', null, true); ?><br />
<?php echo OC_Helper::linkToAbsolute('files', 'webdav.php'); ?><br />
<em><?php echo $l->t('use this address to connect to your ownCloud in your file manager');?></em>
</p>