Merge gitorious.org:owncloud/owncloud into vcategories
This commit is contained in:
commit
adec09b075
|
@ -85,7 +85,14 @@ function addOrEditBookmark(event) {
|
||||||
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
|
$('.bookmarks_add').children('p').children('.bookmarks_input').val('');
|
||||||
$('.bookmarks_list').prepend(
|
$('.bookmarks_list').prepend(
|
||||||
'<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
|
'<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
|
||||||
'<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span> <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> ' +
|
||||||
|
'<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_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' +
|
||||||
'<p class="bookmark_tags">' + tagshtml + '</p>' +
|
'<p class="bookmark_tags">' + tagshtml + '</p>' +
|
||||||
'<p class="bookmark_url">' + url + '</p>' +
|
'<p class="bookmark_url">' + url + '</p>' +
|
||||||
|
@ -154,8 +161,17 @@ function updateBookmarksList(bookmark) {
|
||||||
}
|
}
|
||||||
$('.bookmarks_list').append(
|
$('.bookmarks_list').append(
|
||||||
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
|
'<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
|
||||||
'<p class="bookmark_actions"><span class="bookmark_delete"><img src="img/delete.png" title="Delete"></span> <span class="bookmark_edit"><img src="img/edit.png" title="Edit"></span></p>' +
|
'<p class="bookmark_actions">' +
|
||||||
'<p class="bookmark_title"><a href="' + encodeEntities(bookmark.url) + '" target="_blank" class="bookmark_link">' + encodeEntities(bookmark.title) + '</a></p>' +
|
'<span class="bookmark_delete">' +
|
||||||
|
'<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
|
||||||
|
'</span> ' +
|
||||||
|
'<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>' +
|
'<p class="bookmark_url">' + encodeEntities(bookmark.url) + '</p>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
?>
|
?>
|
||||||
<form id="bookmarks">
|
<form id="bookmarks">
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
<span class="bold"><?php echo $l->t('Bookmarklet:');?></span> <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> <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 />
|
<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>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -243,6 +243,16 @@ if($repeat['repeat'] != 'doesnotrepeat'){
|
||||||
$tmpl->assign('repeat_bymonth', $repeat['bymonth']);
|
$tmpl->assign('repeat_bymonth', $repeat['bymonth']);
|
||||||
$tmpl->assign('repeat_byweekno', $repeat['byweekno']);
|
$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();
|
$tmpl->printpage();
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -9,7 +9,8 @@
|
||||||
require_once ('../../../lib/base.php');
|
require_once ('../../../lib/base.php');
|
||||||
require_once('../../../3rdparty/when/When.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['id'] = (int)$event['id'];
|
||||||
$return_event['title'] = htmlspecialchars($event['summary']);
|
$return_event['title'] = htmlspecialchars($event['summary']);
|
||||||
$return_event['description'] = isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):'';
|
$return_event['description'] = isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):'';
|
||||||
|
@ -29,15 +30,21 @@ OC_JSON::checkAppEnabled('calendar');
|
||||||
$start = DateTime::createFromFormat('U', $_GET['start']);
|
$start = DateTime::createFromFormat('U', $_GET['start']);
|
||||||
$end = DateTime::createFromFormat('U', $_GET['end']);
|
$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);
|
$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end);
|
||||||
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||||
$return = array();
|
$return = array();
|
||||||
foreach($events as $event){
|
foreach($events as $event){
|
||||||
$object = OC_VObject::parse($event['calendardata']);
|
$object = OC_VObject::parse($event['calendardata']);
|
||||||
$vevent = $object->VEVENT;
|
$vevent = $object->VEVENT;
|
||||||
|
|
||||||
|
$return_event = create_return_event($event, $vevent);
|
||||||
|
|
||||||
$dtstart = $vevent->DTSTART;
|
$dtstart = $vevent->DTSTART;
|
||||||
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
||||||
$return_event = array();
|
|
||||||
$start_dt = $dtstart->getDateTime();
|
$start_dt = $dtstart->getDateTime();
|
||||||
$end_dt = $dtend->getDateTime();
|
$end_dt = $dtend->getDateTime();
|
||||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
|
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
|
||||||
|
@ -47,13 +54,17 @@ foreach($events as $event){
|
||||||
$start_dt->setTimezone(new DateTimeZone($user_timezone));
|
$start_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||||
$end_dt->setTimezone(new DateTimeZone($user_timezone));
|
$end_dt->setTimezone(new DateTimeZone($user_timezone));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Repeating Events
|
//Repeating Events
|
||||||
if($event['repeating'] == 1){
|
if($event['repeating'] == 1){
|
||||||
$duration = (double) $end_dt->format('U') - (double) $start_dt->format('U');
|
$duration = (double) $end_dt->format('U') - (double) $start_dt->format('U');
|
||||||
$r = new When();
|
$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()){
|
while($result = $r->next()){
|
||||||
if($result->format('U') > $_GET['end']){
|
if($result < $start){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if($result > $end){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if($return_event['allDay'] == true){
|
if($return_event['allDay'] == true){
|
||||||
|
@ -63,21 +74,18 @@ foreach($events as $event){
|
||||||
$return_event['start'] = $result->format('Y-m-d H:i:s');
|
$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_event['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration);
|
||||||
}
|
}
|
||||||
$return[] = addoutput($event, $vevent, $return_event);
|
$return[] = $return_event;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$return_event = array();
|
if($return_event['allDay'] == true){
|
||||||
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
|
|
||||||
$return_event['allDay'] = true;
|
|
||||||
$return_event['start'] = $start_dt->format('Y-m-d');
|
$return_event['start'] = $start_dt->format('Y-m-d');
|
||||||
$end_dt->modify('-1 sec');
|
$end_dt->modify('-1 sec');
|
||||||
$return_event['end'] = $end_dt->format('Y-m-d');
|
$return_event['end'] = $end_dt->format('Y-m-d');
|
||||||
}else{
|
}else{
|
||||||
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
|
$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['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);
|
OC_JSON::encodedPrint($return);
|
||||||
|
|
|
@ -689,7 +689,10 @@ $(document).ready(function(){
|
||||||
allDayText: allDayText,
|
allDayText: allDayText,
|
||||||
viewDisplay: function(view) {
|
viewDisplay: function(view) {
|
||||||
$('#datecontrol_date').html(view.title);
|
$('#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);
|
Calendar.UI.setViewActive(view.name);
|
||||||
if (view.name == 'agendaWeek') {
|
if (view.name == 'agendaWeek') {
|
||||||
$('#calendar_holder').fullCalendar('option', 'aspectRatio', 0.1);
|
$('#calendar_holder').fullCalendar('option', 'aspectRatio', 0.1);
|
||||||
|
|
|
@ -246,6 +246,7 @@ class OC_Calendar_Calendar{
|
||||||
'backgroundColor' => '#'.$calendar['calendarcolor'],
|
'backgroundColor' => '#'.$calendar['calendarcolor'],
|
||||||
'borderColor' => '#888',
|
'borderColor' => '#888',
|
||||||
'textColor' => 'black',
|
'textColor' => 'black',
|
||||||
|
'cache' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
|
||||||
}else{
|
}else{
|
||||||
$info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i');
|
$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
|
$results[]=new OC_Search_Result($object['summary'],$info, $link,$l->t('Cal.'));//$name,$text,$link,$type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
var missing_field_totime = '<?php echo addslashes($l->t('To Time')) ?>';
|
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_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 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() {
|
$(document).ready(function() {
|
||||||
<?php
|
<?php
|
||||||
if(array_key_exists('showevent', $_)){
|
if(array_key_exists('showevent', $_)){
|
||||||
|
|
|
@ -40,6 +40,6 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php echo $l->t('Calendar CalDAV syncing address:');?>
|
<?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>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -10,6 +10,8 @@ require_once('../../lib/base.php');
|
||||||
|
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
OC_Util::checkLoggedIn();
|
OC_Util::checkLoggedIn();
|
||||||
|
OC_Util::checkAppEnabled('contacts');
|
||||||
|
|
||||||
// Get active address books. This creates a default one if none exists.
|
// Get active address books. This creates a default one if none exists.
|
||||||
$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
|
$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser());
|
||||||
$contacts = OC_Contacts_VCard::all($ids);
|
$contacts = OC_Contacts_VCard::all($ids);
|
||||||
|
|
|
@ -53,7 +53,7 @@ class OC_Contacts_App {
|
||||||
OC_Log::write('contacts', 'Addressbook not found: '. $id, OC_Log::ERROR);
|
OC_Log::write('contacts', 'Addressbook not found: '. $id, OC_Log::ERROR);
|
||||||
}
|
}
|
||||||
else {
|
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?
|
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();
|
exit();
|
||||||
|
|
|
@ -18,7 +18,7 @@ class OC_Search_Provider_Contacts extends OC_Search_Provider{
|
||||||
$vcards = OC_Contacts_VCard::all($addressbook['id']);
|
$vcards = OC_Contacts_VCard::all($addressbook['id']);
|
||||||
foreach($vcards as $vcard){
|
foreach($vcards as $vcard){
|
||||||
if(substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0){
|
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
|
$results[]=new OC_Search_Result($vcard['fullname'],'', $link,$l->t('Contact'));//$name,$text,$link,$type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script type='text/javascript'>
|
<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>
|
</script>
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<form>
|
<form>
|
||||||
|
|
|
@ -3,7 +3,7 @@ $id = $_['id'];
|
||||||
$wattr = isset($_['width'])?'width="'.$_['width'].'"':'';
|
$wattr = isset($_['width'])?'width="'.$_['width'].'"':'';
|
||||||
$hattr = isset($_['height'])?'height="'.$_['height'].'"':'';
|
$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; ?>&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; ?>&refresh=<?php echo rand(); ?>" />
|
||||||
<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
|
<progress id="contacts_details_photo_progress" style="display:none;" value="0" max="100">0 %</progress>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,13 +38,13 @@ OC_Log::write('contacts','templates/part.cropphoto.php: tmp_path: '.$tmp_path.',
|
||||||
return true;
|
return true;
|
||||||
});*/
|
});*/
|
||||||
</script>
|
</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"
|
<form id="cropform"
|
||||||
class="coords"
|
class="coords"
|
||||||
method="post"
|
method="post"
|
||||||
enctype="multipart/form-data"
|
enctype="multipart/form-data"
|
||||||
target="crop_target"
|
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="id" name="id" value="<?php echo $id; ?>" />
|
||||||
<input type="hidden" id="tmp_path" name="tmp_path" value="<?php echo $tmp_path; ?>" />
|
<input type="hidden" id="tmp_path" name="tmp_path" value="<?php echo $tmp_path; ?>" />
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
<strong><?php echo $l->t('Contacts'); ?></strong><br />
|
<strong><?php echo $l->t('Contacts'); ?></strong><br />
|
||||||
<?php echo $l->t('CardDAV syncing address:'); ?>
|
<?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>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -8,6 +8,7 @@ require_once('../lib_share.php');
|
||||||
$userDirectory = "/".OC_User::getUser()."/files";
|
$userDirectory = "/".OC_User::getUser()."/files";
|
||||||
$source = $userDirectory.$_GET['source'];
|
$source = $userDirectory.$_GET['source'];
|
||||||
$path = $source;
|
$path = $source;
|
||||||
|
$users = array();
|
||||||
if ($users = OC_Share::getMySharedItem($source)) {
|
if ($users = OC_Share::getMySharedItem($source)) {
|
||||||
for ($i = 0; $i < count($users); $i++) {
|
for ($i = 0; $i < count($users); $i++) {
|
||||||
if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
|
if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
|
||||||
|
@ -19,7 +20,6 @@ $source = dirname($source);
|
||||||
while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) {
|
while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) {
|
||||||
if ($values = OC_Share::getMySharedItem($source)) {
|
if ($values = OC_Share::getMySharedItem($source)) {
|
||||||
$values = array_values($values);
|
$values = array_values($values);
|
||||||
$users = array();
|
|
||||||
$parentUsers = array();
|
$parentUsers = array();
|
||||||
for ($i = 0; $i < count($values); $i++) {
|
for ($i = 0; $i < count($values); $i++) {
|
||||||
if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
|
if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
|
||||||
|
|
|
@ -88,12 +88,15 @@ class OC_Share {
|
||||||
$uid = $uid."@".$gid;
|
$uid = $uid."@".$gid;
|
||||||
}
|
}
|
||||||
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
|
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
|
||||||
// Clear the folder size cache for the 'Shared' folder
|
// Add file to filesystem cache
|
||||||
// $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?");
|
$userDirectory = "/".OC_User::getUser()."/files";
|
||||||
// $clearFolderSize->execute(array($sharedFolder));
|
$data = OC_Filecache::get(substr($source, strlen($userDirectory)));
|
||||||
// Emit post_create and post_write hooks to notify of a new file in the user's filesystem
|
$parentQuery = OC_DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?');
|
||||||
OC_Hook::emit("OC_Filesystem", "post_create", array('path' => $target));
|
$parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow();
|
||||||
OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target));
|
$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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ OC_App::addNavigationEntry( array(
|
||||||
$result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
|
$result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
|
||||||
$results=array();
|
$results=array();
|
||||||
while($row=$result->fetchRow()){
|
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;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ class OC_MEDIA_AMPACHE{
|
||||||
echo("\t\t<title>$name</title>\n");
|
echo("\t\t<title>$name</title>\n");
|
||||||
echo("\t\t<artist id='$artist'>$artistName</artist>\n");
|
echo("\t\t<artist id='$artist'>$artistName</artist>\n");
|
||||||
echo("\t\t<album id='$album'>$albumName</album>\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);
|
$url=self::fixXmlString($url);
|
||||||
echo("\t\t<url>$url</url>\n");
|
echo("\t\t<url>$url</url>\n");
|
||||||
echo("\t\t<time>{$song['song_length']}</time>\n");
|
echo("\t\t<time>{$song['song_length']}</time>\n");
|
||||||
|
|
|
@ -89,18 +89,18 @@ class OC_MediaSearchProvider extends OC_Search_Provider{
|
||||||
$songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query);
|
$songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query);
|
||||||
$results=array();
|
$results=array();
|
||||||
foreach($artists as $artist){
|
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){
|
foreach($albums as $album){
|
||||||
$artist=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
|
$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){
|
foreach($songs as $song){
|
||||||
$minutes=floor($song['song_length']/60);
|
$minutes=floor($song['song_length']/60);
|
||||||
$secconds=$song['song_length']%60;
|
$secconds=$song['song_length']%60;
|
||||||
$artist=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
|
$artist=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
|
||||||
$album=OC_MEDIA_COLLECTION::getalbumName($song['song_album']);
|
$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;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
<fieldset class="personalblock">
|
<fieldset class="personalblock">
|
||||||
<strong>Media</strong><br />
|
<strong>Media</strong><br />
|
||||||
Ampache address:
|
Ampache address:
|
||||||
<?php echo OC_Helper::linkTo('apps/media', '', null, true); ?><br />
|
<?php echo OC_Helper::linkToAbsolute('media', ''); ?><br />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -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.server', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$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.delegate', 'href'=>OC_Helper::linkToAbsolute( "user_openid", "user.php" ).'/'.$userName));
|
||||||
|
|
||||||
OC_APP::registerPersonal('user_openid','settings');
|
OC_APP::registerPersonal('user_openid','settings');
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ if(!OC_User::userExists($USERNAME)){
|
||||||
OC_Log::write('user_openid',$USERNAME.' doesn\'t exist',OC_Log::WARN);
|
OC_Log::write('user_openid',$USERNAME.' doesn\'t exist',OC_Log::WARN);
|
||||||
$USERNAME='';
|
$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';
|
require_once 'phpmyid.php';
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ if (isset($_POST['user'])) {
|
||||||
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
|
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
|
||||||
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
|
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
|
||||||
if (!empty($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 = new OC_Template('core/lostpassword', 'email');
|
||||||
$tmpl->assign('link', $link);
|
$tmpl->assign('link', $link);
|
||||||
$msg = $tmpl->fetchPage();
|
$msg = $tmpl->fetchPage();
|
||||||
|
|
|
@ -76,11 +76,11 @@ foreach( explode( "/", $dir ) as $i ){
|
||||||
// make breadcrumb und filelist markup
|
// make breadcrumb und filelist markup
|
||||||
$list = new OC_Template( "files", "part.list", "" );
|
$list = new OC_Template( "files", "part.list", "" );
|
||||||
$list->assign( "files", $files );
|
$list->assign( "files", $files );
|
||||||
$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir="));
|
$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php")."?dir=");
|
||||||
$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php?file="));
|
$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php")."?file=");
|
||||||
$breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
|
$breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" );
|
||||||
$breadcrumbNav->assign( "breadcrumb", $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'));
|
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
|
||||||
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
|
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
|
||||||
|
|
|
@ -44,7 +44,7 @@ if($not_installed) {
|
||||||
|
|
||||||
// Handle WebDAV
|
// Handle WebDAV
|
||||||
if($_SERVER['REQUEST_METHOD']=='PROPFIND'){
|
if($_SERVER['REQUEST_METHOD']=='PROPFIND'){
|
||||||
header('location: '.OC_Helper::linkTo('files','webdav.php'));
|
header('location: '.OC_Helper::linkToAbsolute('files','webdav.php'));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ class OC_App{
|
||||||
// admin users menu
|
// 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" ));
|
$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
|
// 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
|
// 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" ));
|
$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" ));
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,13 @@ class OC{
|
||||||
echo 'Error while upgrading the database';
|
echo 'Error while upgrading the database';
|
||||||
die();
|
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()));
|
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ class OC_Config{
|
||||||
$result=@file_put_contents( OC::$SERVERROOT."/config/config.php", $content );
|
$result=@file_put_contents( OC::$SERVERROOT."/config/config.php", $content );
|
||||||
if(!$result) {
|
if(!$result) {
|
||||||
$tmpl = new OC_Template( '', 'error', 'guest' );
|
$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();
|
$tmpl->printPage();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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){}
|
||||||
|
}
|
|
@ -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)
|
if($redirect_url)
|
||||||
return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]);
|
return $urlLinkTo.'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]);
|
||||||
else
|
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
|
* @brief Creates path to an image
|
||||||
* @param $app app
|
* @param $app app
|
||||||
|
|
|
@ -12,6 +12,13 @@ class OC_Response {
|
||||||
const STATUS_TEMPORARY_REDIRECT = 307;
|
const STATUS_TEMPORARY_REDIRECT = 307;
|
||||||
const STATUS_NOT_FOUND = 404;
|
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) {
|
static public function enableCaching($cache_time = null) {
|
||||||
if (is_numeric($cache_time)) {
|
if (is_numeric($cache_time)) {
|
||||||
header('Pragma: public');// enable caching in IE
|
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() {
|
static public function disableCaching() {
|
||||||
self::enableCaching(0);
|
self::enableCaching(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set response status
|
||||||
|
* @param $status a HTTP status code, see also the STATUS constants
|
||||||
|
*/
|
||||||
static public function setStatus($status) {
|
static public function setStatus($status) {
|
||||||
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
||||||
switch($status) {
|
switch($status) {
|
||||||
|
@ -58,11 +74,21 @@ class OC_Response {
|
||||||
header($protocol.' '.$status);
|
header($protocol.' '.$status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Send redirect response
|
||||||
|
* @param $location to redirect to
|
||||||
|
*/
|
||||||
static public function redirect($location) {
|
static public function redirect($location) {
|
||||||
self::setStatus(self::STATUS_TEMPORARY_REDIRECT);
|
self::setStatus(self::STATUS_TEMPORARY_REDIRECT);
|
||||||
header('Location: '.$location);
|
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) {
|
static public function setExpiresHeader($expires) {
|
||||||
if (is_string($expires) && $expires[0] == 'P') {
|
if (is_string($expires) && $expires[0] == 'P') {
|
||||||
$interval = $expires;
|
$interval = $expires;
|
||||||
|
@ -76,6 +102,11 @@ class OC_Response {
|
||||||
header('Expires: '.$expires);
|
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) {
|
static public function setETagHeader($etag) {
|
||||||
if (empty($etag)) {
|
if (empty($etag)) {
|
||||||
return;
|
return;
|
||||||
|
@ -88,6 +119,11 @@ class OC_Response {
|
||||||
header('ETag: "'.$etag.'"');
|
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) {
|
static public function setLastModifiedHeader($lastModified) {
|
||||||
if (empty($lastModified)) {
|
if (empty($lastModified)) {
|
||||||
return;
|
return;
|
||||||
|
@ -106,7 +142,11 @@ class OC_Response {
|
||||||
header('Last-Modified: '.$lastModified);
|
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');
|
$fp = fopen($filepath, 'rb');
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
self::setLastModifiedHeader(filemtime($filepath));
|
self::setLastModifiedHeader(filemtime($filepath));
|
||||||
|
|
|
@ -7,7 +7,7 @@ class OC_Search_Provider_File extends OC_Search_Provider{
|
||||||
foreach($files as $fileData){
|
foreach($files as $fileData){
|
||||||
$file=$fileData['path'];
|
$file=$fileData['path'];
|
||||||
if($fileData['mime']=='httpd/unix-directory'){
|
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{
|
}else{
|
||||||
$mime=$fileData['mime'];
|
$mime=$fileData['mime'];
|
||||||
$mimeBase=$fileData['mimepart'];
|
$mimeBase=$fileData['mimepart'];
|
||||||
|
@ -15,16 +15,16 @@ class OC_Search_Provider_File extends OC_Search_Provider{
|
||||||
case 'audio':
|
case 'audio':
|
||||||
break;
|
break;
|
||||||
case 'text':
|
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;
|
break;
|
||||||
case 'image':
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
if($mime=='application/xml'){
|
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{
|
}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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,6 @@ class OC_Setup {
|
||||||
OC_Config::setValue('datadirectory', $datadir);
|
OC_Config::setValue('datadirectory', $datadir);
|
||||||
OC_Config::setValue('dbtype', $dbtype);
|
OC_Config::setValue('dbtype', $dbtype);
|
||||||
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
||||||
OC_Config::setValue('installedat',microtime(true));
|
|
||||||
OC_Config::setValue('lastupdatedat',microtime(true));
|
|
||||||
if($dbtype == 'mysql') {
|
if($dbtype == 'mysql') {
|
||||||
$dbuser = $options['dbuser'];
|
$dbuser = $options['dbuser'];
|
||||||
$dbpass = $options['dbpass'];
|
$dbpass = $options['dbpass'];
|
||||||
|
@ -224,6 +222,9 @@ class OC_Setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($error) == 0) {
|
if(count($error) == 0) {
|
||||||
|
OC_Appconfig::setValue('core', 'installedat',microtime(true));
|
||||||
|
OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true));
|
||||||
|
|
||||||
//create the user and group
|
//create the user and group
|
||||||
OC_User::createUser($username, $password);
|
OC_User::createUser($username, $password);
|
||||||
OC_Group::createGroup('admin');
|
OC_Group::createGroup('admin');
|
||||||
|
|
|
@ -29,12 +29,12 @@ class OC_Updater{
|
||||||
* Check if a new version is available
|
* Check if a new version is available
|
||||||
*/
|
*/
|
||||||
public static function check(){
|
public static function check(){
|
||||||
OC_Config::setValue('lastupdatedat',microtime(true));
|
OC_Appconfig::setValue('core', 'lastupdatedat',microtime(true));
|
||||||
|
|
||||||
$updaterurl='http://apps.owncloud.com/updater.php';
|
$updaterurl='http://apps.owncloud.com/updater.php';
|
||||||
$version=OC_Util::getVersion();
|
$version=OC_Util::getVersion();
|
||||||
$version['installed']=OC_Config::getValue( "installedat");
|
$version['installed']=OC_Config::getValue('installedat');
|
||||||
$version['updated']=OC_Config::getValue( "lastupdatedat");
|
$version['updated']=OC_Appconfig::getValue('core', 'lastupdatedat', OC_Config::getValue( 'lastupdatedat'));
|
||||||
$version['updatechannel']='stable';
|
$version['updatechannel']='stable';
|
||||||
$versionstring=implode('x',$version);
|
$versionstring=implode('x',$version);
|
||||||
|
|
||||||
|
|
10
lib/util.php
10
lib/util.php
|
@ -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.');
|
$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;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +244,7 @@ class OC_Util {
|
||||||
*/
|
*/
|
||||||
public static function checkAppEnabled($app){
|
public static function checkAppEnabled($app){
|
||||||
if( !OC_App::isEnabled($app)){
|
if( !OC_App::isEnabled($app)){
|
||||||
header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
|
header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +255,7 @@ class OC_Util {
|
||||||
public static function checkLoggedIn(){
|
public static function checkLoggedIn(){
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
if( !OC_User::isLoggedIn()){
|
if( !OC_User::isLoggedIn()){
|
||||||
header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
|
header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +267,7 @@ class OC_Util {
|
||||||
// Check if we are a user
|
// Check if we are a user
|
||||||
self::checkLoggedIn();
|
self::checkLoggedIn();
|
||||||
if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
|
if( !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
|
||||||
header( 'Location: '.OC_Helper::linkTo( '', 'index.php' , true));
|
header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
<p class="personalblock">
|
<p class="personalblock">
|
||||||
<strong>WebDAV</strong>
|
<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>
|
<em><?php echo $l->t('use this address to connect to your ownCloud in your file manager');?></em>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue