Merge branch 'master' into calendar_export
This commit is contained in:
commit
1d93a8fcfe
|
@ -13,7 +13,7 @@ switch($idtype){
|
||||||
case 'event':
|
case 'event':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OCP\JSON::error(array('message'=>'unexspected parameter'));
|
OCP\JSON::error(array('message'=>'unexpected parameter'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if($idtype == 'calendar' && !OC_Calendar_App::getCalendar($id)){
|
if($idtype == 'calendar' && !OC_Calendar_App::getCalendar($id)){
|
||||||
|
@ -32,7 +32,7 @@ switch($sharetype){
|
||||||
case 'public':
|
case 'public':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OCP\JSON::error(array('message'=>'unexspected parameter'));
|
OCP\JSON::error(array('message'=>'unexpected parameter'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if($sharetype == 'user' && !OCP\User::userExists($sharewith)){
|
if($sharetype == 'user' && !OCP\User::userExists($sharewith)){
|
||||||
|
@ -44,7 +44,7 @@ if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if($sharetype == 'user' && OCP\USER::getUser() == $sharewith){
|
if($sharetype == 'user' && OCP\USER::getUser() == $sharewith){
|
||||||
OCP\JSON::error(array('meesage'=>'you can not share with yourself'));
|
OCP\JSON::error(array('message'=>'you can not share with yourself'));
|
||||||
}
|
}
|
||||||
$success = OC_Calendar_Share::share(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
|
$success = OC_Calendar_Share::share(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
|
||||||
if($success){
|
if($success){
|
||||||
|
|
|
@ -46,7 +46,12 @@
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php echo $l->t('Calendar CalDAV syncing address:');?>
|
<?php echo $l->t('Calendar CalDAV syncing addresses'); ?> (<a href="http://owncloud.org/synchronisation/" target="_blank"><?php echo $l->t('more info'); ?></a>)
|
||||||
<code><?php echo OCP\Util::linkToRemote('caldav'); ?></code><br />
|
<dl>
|
||||||
|
<dt><?php echo $l->t('Primary address (Kontact et al)'); ?></dt>
|
||||||
|
<dd><code><?php echo OCP\Util::linkToRemote('caldav'); ?></code></dd>
|
||||||
|
<dt><?php echo $l->t('iOS/OS X'); ?></dt>
|
||||||
|
<dd><code><?php echo OCP\Util::linkToRemote('caldav'); ?>principals/<?php echo OCP\USER::getUser(); ?></code>/</dd>
|
||||||
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -33,7 +33,7 @@ $vcard = OC_Contacts_App::getContactVCard($id);
|
||||||
|
|
||||||
if(!is_array($value)){
|
if(!is_array($value)){
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'NICKNAME', 'NOTE'))) {
|
if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'URL', 'NICKNAME', 'NOTE'))) {
|
||||||
OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add empty property.'))));
|
OCP\JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add empty property.'))));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,15 +98,6 @@ if(!$value) {
|
||||||
} else {
|
} else {
|
||||||
/* setting value */
|
/* setting value */
|
||||||
switch($element) {
|
switch($element) {
|
||||||
case 'BDAY':
|
|
||||||
case 'FN':
|
|
||||||
case 'N':
|
|
||||||
case 'ORG':
|
|
||||||
case 'NOTE':
|
|
||||||
case 'NICKNAME':
|
|
||||||
debug('Setting string:'.$name.' '.$value);
|
|
||||||
$vcard->setString($name, $value);
|
|
||||||
break;
|
|
||||||
case 'CATEGORIES':
|
case 'CATEGORIES':
|
||||||
debug('Setting string:'.$name.' '.$value);
|
debug('Setting string:'.$name.' '.$value);
|
||||||
$vcard->children[$line]->setValue($value);
|
$vcard->children[$line]->setValue($value);
|
||||||
|
@ -128,6 +119,10 @@ if(!$value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
debug('Setting string:'.$name.' '.$value);
|
||||||
|
$vcard->setString($name, $value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// Do checksum and be happy
|
// Do checksum and be happy
|
||||||
$checksum = md5($vcard->children[$line]->serialize());
|
$checksum = md5($vcard->children[$line]->serialize());
|
||||||
|
|
|
@ -31,8 +31,9 @@ dl.form { width: 100%; float: left; clear: right; margin: 0; padding: 0; }
|
||||||
.form dt { display: table-cell; clear: left; float: left; width: 7em; margin: 0; padding: 0.8em 0.5em 0 0; text-align:right; text-overflow:ellipsis; o-text-overflow: ellipsis; vertical-align: text-bottom; color: #bbb;/* white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap;*/ }
|
.form dt { display: table-cell; clear: left; float: left; width: 7em; margin: 0; padding: 0.8em 0.5em 0 0; text-align:right; text-overflow:ellipsis; o-text-overflow: ellipsis; vertical-align: text-bottom; color: #bbb;/* white-space: pre-wrap; white-space: -moz-pre-wrap !important; white-space: -pre-wrap; white-space: -o-pre-wrap;*/ }
|
||||||
.form dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0px; white-space: nowrap; vertical-align: text-bottom; }
|
.form dd { display: table-cell; clear: right; float: left; margin: 0; padding: 0px; white-space: nowrap; vertical-align: text-bottom; }
|
||||||
label:hover, dt:hover { color: #333; }
|
label:hover, dt:hover { color: #333; }
|
||||||
#address.form dt { min-width: 5em; }
|
/*::-webkit-input-placeholder { color: #bbb; }
|
||||||
#address.form dl { min-width: 10em; }
|
:-moz-placeholder { color: #bbb; }
|
||||||
|
:-ms-input-placeholder { color: #bbb; }*/
|
||||||
.droptarget { margin: 0.5em; padding: 0.5em; border: thin solid #ccc; -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; }
|
.droptarget { margin: 0.5em; padding: 0.5em; border: thin solid #ccc; -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; }
|
||||||
.droppable { margin: 0.5em; padding: 0.5em; border: thin dashed #333; -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; }
|
.droppable { margin: 0.5em; padding: 0.5em; border: thin dashed #333; -moz-border-radius:.3em; -webkit-border-radius:.3em; border-radius:.3em; }
|
||||||
.loading { background: url('%webroot%/core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; }
|
.loading { background: url('%webroot%/core/img/loading.gif') no-repeat center !important; /*cursor: progress; */ cursor: wait; }
|
||||||
|
@ -79,10 +80,17 @@ label:hover, dt:hover { color: #333; }
|
||||||
#addressdisplay { padding: 0.5em; }
|
#addressdisplay { padding: 0.5em; }
|
||||||
dl.addresscard { background-color: #fff; float: left; width: auto; margin: 0 0.3em 0.3em 0.3em; padding: 0; border: 0; }
|
dl.addresscard { background-color: #fff; float: left; width: auto; margin: 0 0.3em 0.3em 0.3em; padding: 0; border: 0; }
|
||||||
dl.addresscard dd {}
|
dl.addresscard dd {}
|
||||||
dl.addresscard dt { padding: 0.3em; font-weight: bold; clear: both; color: #bbb;}
|
dl.addresscard dt { padding: 0.3em; font-weight: bold; clear: both; color: #aaa; }
|
||||||
dl.addresscard dt:hover { color:#777; }
|
dl.addresscard dt:hover { color:#777; }
|
||||||
dl.addresscard dd > ul { margin: 0.3em; padding: 0.3em; }
|
dl.addresscard dd > ul { margin: 0.3em; padding: 0.3em; }
|
||||||
dl.addresscard .action { float: right; }
|
dl.addresscard .action { float: right; }
|
||||||
|
#address dt { width: 30%; white-space:nowrap; }
|
||||||
|
#address dd { width: 66%; }
|
||||||
|
#address input { width: 12em; padding: 0.6em 0.5em 0.4em; }
|
||||||
|
#address input:-moz-placeholder { color: #aaa; }
|
||||||
|
#address input::-webkit-input-placeholder { color: #aaa; }
|
||||||
|
#address input:-ms-input-placeholder { color: #aaa; }
|
||||||
|
#address input:placeholder { color: #aaa; }
|
||||||
#adr_type {} /* Select */
|
#adr_type {} /* Select */
|
||||||
#adr_pobox {}
|
#adr_pobox {}
|
||||||
#adr_extended {}
|
#adr_extended {}
|
||||||
|
|
|
@ -23,7 +23,7 @@ if(isset($bookid)){
|
||||||
}
|
}
|
||||||
}elseif(isset($contactid)){
|
}elseif(isset($contactid)){
|
||||||
$data = OC_Contacts_App::getContactObject($contactid);
|
$data = OC_Contacts_App::getContactObject($contactid);
|
||||||
header('Content-Type: text/directory');
|
header('Content-Type: text/vcard');
|
||||||
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
|
header('Content-Disposition: inline; filename=' . str_replace(' ', '_', $data['fullname']) . '.vcf');
|
||||||
echo $data['carddata'];
|
echo $data['carddata'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,10 +110,21 @@ Contacts={
|
||||||
obj.tipsy('hide');
|
obj.tipsy('hide');
|
||||||
Contacts.UI.Card.deleteProperty(obj, 'single');
|
Contacts.UI.Card.deleteProperty(obj, 'single');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var goToUrl = function(obj) {
|
||||||
|
var url = Contacts.UI.propertyContainerFor(obj).find('#url').val();
|
||||||
|
if(url != '') {
|
||||||
|
var newWindow = window.open(url,'_blank');
|
||||||
|
newWindow.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#identityprops a.delete').click( function() { deleteItem($(this)) });
|
$('#identityprops a.delete').click( function() { deleteItem($(this)) });
|
||||||
$('#identityprops a.delete').keydown( function() { deleteItem($(this)) });
|
$('#identityprops a.delete').keydown( function() { deleteItem($(this)) });
|
||||||
$('#categories_value a.edit').click( function() { $(this).tipsy('hide');OCCategories.edit(); } );
|
$('#categories_value a.edit').click( function() { $(this).tipsy('hide');OCCategories.edit(); } );
|
||||||
$('#categories_value a.edit').keydown( function() { $(this).tipsy('hide');OCCategories.edit(); } );
|
$('#categories_value a.edit').keydown( function() { $(this).tipsy('hide');OCCategories.edit(); } );
|
||||||
|
$('#url_value a.globe').click( function() { $(this).tipsy('hide');goToUrl($(this)); } );
|
||||||
|
$('#url_value a.globe').keydown( function() { $(this).tipsy('hide');goToUrl($(this)); } );
|
||||||
$('#fn_select').combobox({
|
$('#fn_select').combobox({
|
||||||
'id': 'fn',
|
'id': 'fn',
|
||||||
'name': 'value',
|
'name': 'value',
|
||||||
|
@ -427,7 +438,7 @@ Contacts={
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadSingleProperties:function() {
|
loadSingleProperties:function() {
|
||||||
var props = ['BDAY', 'NICKNAME', 'ORG', 'CATEGORIES'];
|
var props = ['BDAY', 'NICKNAME', 'ORG', 'URL', 'CATEGORIES'];
|
||||||
// Clear all elements
|
// Clear all elements
|
||||||
$('#ident .propertycontainer').each(function(){
|
$('#ident .propertycontainer').each(function(){
|
||||||
if(props.indexOf($(this).data('element')) > -1) {
|
if(props.indexOf($(this).data('element')) > -1) {
|
||||||
|
@ -438,40 +449,22 @@ Contacts={
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for(var prop in props) {
|
for(var prop in props) {
|
||||||
if(this.data[props[prop]] != undefined) {
|
var propname = props[prop];
|
||||||
$('#contacts_propertymenu_dropdown a[data-type="'+props[prop]+'"]').parent().hide();
|
if(this.data[propname] != undefined) {
|
||||||
var property = this.data[props[prop]][0];
|
$('#contacts_propertymenu_dropdown a[data-type="'+propname+'"]').parent().hide();
|
||||||
|
var property = this.data[propname][0];
|
||||||
var value = property['value'], checksum = property['checksum'];
|
var value = property['value'], checksum = property['checksum'];
|
||||||
switch(props[prop]) {
|
|
||||||
case 'BDAY':
|
if(propname == 'BDAY') {
|
||||||
var val = $.datepicker.parseDate('yy-mm-dd', value.substring(0, 10));
|
var val = $.datepicker.parseDate('yy-mm-dd', value.substring(0, 10));
|
||||||
value = $.datepicker.formatDate('dd-mm-yy', val);
|
value = $.datepicker.formatDate('dd-mm-yy', val);
|
||||||
$('#contact_identity').find('#bday').val(value);
|
|
||||||
$('#contact_identity').find('#bday_value').data('checksum', checksum);
|
|
||||||
$('#contact_identity').find('#bday_label').show();
|
|
||||||
$('#contact_identity').find('#bday_value').show();
|
|
||||||
break;
|
|
||||||
case 'NICKNAME':
|
|
||||||
$('#contact_identity').find('#nickname').val(value);
|
|
||||||
$('#contact_identity').find('#nickname_value').data('checksum', checksum);
|
|
||||||
$('#contact_identity').find('#nickname_label').show();
|
|
||||||
$('#contact_identity').find('#nickname_value').show();
|
|
||||||
break;
|
|
||||||
case 'ORG':
|
|
||||||
$('#contact_identity').find('#org').val(value);
|
|
||||||
$('#contact_identity').find('#org_value').data('checksum', checksum);
|
|
||||||
$('#contact_identity').find('#org_label').show();
|
|
||||||
$('#contact_identity').find('#org_value').show();
|
|
||||||
break;
|
|
||||||
case 'CATEGORIES':
|
|
||||||
$('#contact_identity').find('#categories').val(value);
|
|
||||||
$('#contact_identity').find('#categories_value').data('checksum', checksum);
|
|
||||||
$('#contact_identity').find('#categories_label').show();
|
|
||||||
$('#contact_identity').find('#categories_value').show();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
$('#contact_identity').find('#'+propname.toLowerCase()).val(value);
|
||||||
|
$('#contact_identity').find('#'+propname.toLowerCase()+'_value').data('checksum', checksum);
|
||||||
|
$('#contact_identity').find('#'+propname.toLowerCase()+'_label').show();
|
||||||
|
$('#contact_identity').find('#'+propname.toLowerCase()+'_value').show();
|
||||||
} else {
|
} else {
|
||||||
$('#contacts_propertymenu_dropdown a[data-type="'+props[prop]+'"]').parent().show();
|
$('#contacts_propertymenu_dropdown a[data-type="'+propname+'"]').parent().show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -700,6 +693,7 @@ Contacts={
|
||||||
Contacts.UI.Card.editAddress('new', true);
|
Contacts.UI.Card.editAddress('new', true);
|
||||||
break;
|
break;
|
||||||
case 'NICKNAME':
|
case 'NICKNAME':
|
||||||
|
case 'URL':
|
||||||
case 'ORG':
|
case 'ORG':
|
||||||
case 'BDAY':
|
case 'BDAY':
|
||||||
case 'CATEGORIES':
|
case 'CATEGORIES':
|
||||||
|
@ -1287,7 +1281,7 @@ Contacts={
|
||||||
},
|
},
|
||||||
Addressbooks:{
|
Addressbooks:{
|
||||||
droptarget:undefined,
|
droptarget:undefined,
|
||||||
droptext:t('contacts', 'Drop a VCF file to import contacts.'),
|
droptext:t('contacts', 'Drop a VCF file<br />to import contacts.'),
|
||||||
overview:function(){
|
overview:function(){
|
||||||
if($('#chooseaddressbook_dialog').dialog('isOpen') == true){
|
if($('#chooseaddressbook_dialog').dialog('isOpen') == true){
|
||||||
$('#chooseaddressbook_dialog').dialog('moveToTop');
|
$('#chooseaddressbook_dialog').dialog('moveToTop');
|
||||||
|
@ -1296,7 +1290,7 @@ Contacts={
|
||||||
$.getJSON(OC.filePath('contacts', 'ajax', 'chooseaddressbook.php'), function(jsondata){
|
$.getJSON(OC.filePath('contacts', 'ajax', 'chooseaddressbook.php'), function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
if(jsondata.status == 'success'){
|
||||||
$('#addressbook_dialog').html(jsondata.data.page).find('#chooseaddressbook_dialog').dialog({
|
$('#addressbook_dialog').html(jsondata.data.page).find('#chooseaddressbook_dialog').dialog({
|
||||||
width : 600,
|
minWidth : 600,
|
||||||
close : function(event, ui) {
|
close : function(event, ui) {
|
||||||
$(this).dialog('destroy').remove();
|
$(this).dialog('destroy').remove();
|
||||||
$('#addressbook_dialog').remove();
|
$('#addressbook_dialog').remove();
|
||||||
|
|
|
@ -23,16 +23,16 @@
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
|
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
|
||||||
response( select.children( "option" ).map(function() {
|
response( select.children('option').map(function() {
|
||||||
var text = $( this ).text();
|
var text = $( this ).text();
|
||||||
if ( this.value && ( !request.term || matcher.test(text) ) )
|
if ( this.value && ( !request.term || matcher.test(text) ) )
|
||||||
return {
|
return {
|
||||||
label: text.replace(
|
label: text.replace(
|
||||||
new RegExp(
|
new RegExp(
|
||||||
"(?![^&;]+;)(?!<[^<>]*)(" +
|
'(?![^&;]+;)(?!<[^<>]*)(' +
|
||||||
$.ui.autocomplete.escapeRegex(request.term) +
|
$.ui.autocomplete.escapeRegex(request.term) +
|
||||||
")(?![^<>]*>)(?![^&;]+;)", "gi"
|
')(?![^<>]*>)(?![^&;]+;)', 'gi'
|
||||||
), "<strong>$1</strong>" ),
|
), '<strong>$1</strong>'),
|
||||||
value: text,
|
value: text,
|
||||||
option: this
|
option: this
|
||||||
};
|
};
|
||||||
|
@ -42,17 +42,17 @@
|
||||||
self.input.val($(ui.item.option).text());
|
self.input.val($(ui.item.option).text());
|
||||||
self.input.trigger('change');
|
self.input.trigger('change');
|
||||||
ui.item.option.selected = true;
|
ui.item.option.selected = true;
|
||||||
self._trigger( "selected", event, {
|
self._trigger('selected', event, {
|
||||||
item: ui.item.option
|
item: ui.item.option
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
change: function( event, ui ) {
|
change: function( event, ui ) {
|
||||||
if ( !ui.item ) {
|
if ( !ui.item ) {
|
||||||
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
|
var matcher = new RegExp( '^' + $.ui.autocomplete.escapeRegex( $(this).val() ) + '$', 'i' ),
|
||||||
valid = false;
|
valid = false;
|
||||||
self.input.val($(this).val());
|
self.input.val($(this).val());
|
||||||
//self.input.trigger('change');
|
//self.input.trigger('change');
|
||||||
select.children( "option" ).each(function() {
|
select.children('option').each(function() {
|
||||||
if ( $( this ).text().match( matcher ) ) {
|
if ( $( this ).text().match( matcher ) ) {
|
||||||
this.selected = valid = true;
|
this.selected = valid = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -62,36 +62,41 @@
|
||||||
// remove invalid value, as it didn't match anything
|
// remove invalid value, as it didn't match anything
|
||||||
$( this ).val( "" );
|
$( this ).val( "" );
|
||||||
select.val( "" );
|
select.val( "" );
|
||||||
input.data( "autocomplete" ).term = "";
|
input.data('autocomplete').term = '';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.addClass( "ui-widget ui-widget-content ui-corner-left" );
|
.addClass('ui-widget ui-widget-content ui-corner-left');
|
||||||
|
|
||||||
input.data( "autocomplete" )._renderItem = function( ul, item ) {
|
input.data('autocomplete')._renderItem = function( ul, item ) {
|
||||||
return $( "<li></li>" )
|
return $('<li></li>')
|
||||||
.data( "item.autocomplete", item )
|
.data('item.autocomplete', item )
|
||||||
.append( "<a>" + item.label + "</a>" )
|
.append('<a>' + item.label + '</a>')
|
||||||
.appendTo( ul );
|
.appendTo( ul );
|
||||||
};
|
};
|
||||||
$.each(this.options, function(key, value) {
|
$.each(this.options, function(key, value) {
|
||||||
self._setOption(key, value);
|
self._setOption(key, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
input.dblclick(function() {
|
||||||
|
// pass empty string as value to search for, displaying all results
|
||||||
|
input.autocomplete('search', '');
|
||||||
|
});
|
||||||
|
|
||||||
if(this.options['showButton']) {
|
if(this.options['showButton']) {
|
||||||
this.button = $( "<button type='button'> </button>" )
|
this.button = $('<button type="button"> </button>')
|
||||||
.attr( "tabIndex", -1 )
|
.attr('tabIndex', -1 )
|
||||||
.attr( "title", "Show All Items" )
|
.attr('title', 'Show All Items')
|
||||||
.insertAfter( input )
|
.insertAfter( input )
|
||||||
.addClass('svg')
|
.addClass('svg')
|
||||||
.addClass('action')
|
.addClass('action')
|
||||||
.addClass('combo-button')
|
.addClass('combo-button')
|
||||||
.click(function() {
|
.click(function() {
|
||||||
// close if already visible
|
// close if already visible
|
||||||
if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
|
if ( input.autocomplete('widget').is(':visible') ) {
|
||||||
input.autocomplete( "close" );
|
input.autocomplete('close');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +104,7 @@
|
||||||
$( this ).blur();
|
$( this ).blur();
|
||||||
|
|
||||||
// pass empty string as value to search for, displaying all results
|
// pass empty string as value to search for, displaying all results
|
||||||
input.autocomplete( "search", "" );
|
input.autocomplete('search', '');
|
||||||
input.focus();
|
input.focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ $id = isset($_['id']) ? $_['id'] : '';
|
||||||
<dd class="propertycontainer hidden" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
<dd class="propertycontainer hidden" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||||
<dt class="hidden" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt>
|
<dt class="hidden" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt>
|
||||||
<dd class="propertycontainer hidden" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
<dd class="propertycontainer hidden" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||||
|
<dt class="hidden" id="url_label" data-element="URL"><label for="nickname"><?php echo $l->t('Web site'); ?></label></dt>
|
||||||
|
<dd class="propertycontainer hidden" id="url_value" data-element="URL"><input id="url" required="required" name="value[URL]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('http://www.somesite.com'); ?>" /><a role="button" class="action globe" title="<?php echo $l->t('Go to web site'); ?>"><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||||
<dt class="hidden" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt>
|
<dt class="hidden" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt>
|
||||||
<dd class="propertycontainer hidden" id="bday_value" data-element="BDAY"><input id="bday" required="required" name="value" type="text" class="contacts_property big" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
<dd class="propertycontainer hidden" id="bday_value" data-element="BDAY"><input id="bday" required="required" name="value" type="text" class="contacts_property big" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||||
<dt class="hidden" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Groups'); ?></label></dt>
|
<dt class="hidden" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Groups'); ?></label></dt>
|
||||||
|
@ -108,6 +110,7 @@ $id = isset($_['id']) ? $_['id'] : '';
|
||||||
<li><a role="menuitem" data-type="EMAIL"><?php echo $l->t('Email'); ?></a></li>
|
<li><a role="menuitem" data-type="EMAIL"><?php echo $l->t('Email'); ?></a></li>
|
||||||
<li><a role="menuitem" data-type="ADR"><?php echo $l->t('Address'); ?></a></li>
|
<li><a role="menuitem" data-type="ADR"><?php echo $l->t('Address'); ?></a></li>
|
||||||
<li><a role="menuitem" data-type="NOTE"><?php echo $l->t('Note'); ?></a></li>
|
<li><a role="menuitem" data-type="NOTE"><?php echo $l->t('Note'); ?></a></li>
|
||||||
|
<li><a role="menuitem" data-type="URL"><?php echo $l->t('Web site'); ?></a></li>
|
||||||
<li><a role="menuitem" data-type="CATEGORIES"><?php echo $l->t('Groups'); ?></a></li>
|
<li><a role="menuitem" data-type="CATEGORIES"><?php echo $l->t('Groups'); ?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,18 +24,17 @@ foreach(isset($adr['parameters']['TYPE'])?array($adr['parameters']['TYPE']):arra
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" id="adr_pobox" name="value[ADR][0]" placeholder="<?php echo $l->t('PO Box'); ?>" value="<?php echo isset($adr['value'][0])?$adr['value'][0]:''; ?>">
|
<input type="text" id="adr_pobox" name="value[ADR][0]" placeholder="<?php echo $l->t('PO Box'); ?>" value="<?php echo isset($adr['value'][0])?$adr['value'][0]:''; ?>">
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<label class="label" for="adr_street"><?php echo $l->t('Street address'); ?></label>
|
||||||
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
<input type="text" id="adr_street" name="value[ADR][2]" placeholder="<?php echo $l->t('Street and number'); ?>" value="<?php echo isset($adr['value'][2])?$adr['value'][2]:''; ?>">
|
||||||
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<label class="label" for="adr_extended"><?php echo $l->t('Extended'); ?></label>
|
<label class="label" for="adr_extended"><?php echo $l->t('Extended'); ?></label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" id="adr_extended" name="value[ADR][1]" placeholder="<?php echo $l->t('Extended'); ?>" value="<?php echo isset($adr['value'][1])?$adr['value'][1]:''; ?>">
|
<input type="text" id="adr_extended" name="value[ADR][1]" placeholder="<?php echo $l->t('Apartment number etc.'); ?>" value="<?php echo isset($adr['value'][1])?$adr['value'][1]:''; ?>">
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
<label class="label" for="adr_street"><?php echo $l->t('Street'); ?></label>
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
<input type="text" id="adr_street" name="value[ADR][2]" placeholder="<?php echo $l->t('Street'); ?>" value="<?php echo isset($adr['value'][2])?$adr['value'][2]:''; ?>">
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<label class="label" for="adr_city"><?php echo $l->t('City'); ?></label>
|
<label class="label" for="adr_city"><?php echo $l->t('City'); ?></label>
|
||||||
|
@ -47,13 +46,13 @@ foreach(isset($adr['parameters']['TYPE'])?array($adr['parameters']['TYPE']):arra
|
||||||
<label class="label" for="adr_region"><?php echo $l->t('Region'); ?></label>
|
<label class="label" for="adr_region"><?php echo $l->t('Region'); ?></label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" id="adr_region" name="value[ADR][4]" placeholder="<?php echo $l->t('Region'); ?>" value="<?php echo isset($adr['value'][4])?$adr['value'][4]:''; ?>">
|
<input type="text" id="adr_region" name="value[ADR][4]" placeholder="<?php echo $l->t('E.g. state or province'); ?>" value="<?php echo isset($adr['value'][4])?$adr['value'][4]:''; ?>">
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<label class="label" for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
|
<label class="label" for="adr_zipcode"><?php echo $l->t('Zipcode'); ?></label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<input type="text" id="adr_zipcode" name="value[ADR][5]" placeholder="<?php echo $l->t('Zipcode'); ?>" value="<?php echo isset($adr['value'][5])?$adr['value'][5]:''; ?>">
|
<input type="text" id="adr_zipcode" name="value[ADR][5]" placeholder="<?php echo $l->t('Postal code'); ?>" value="<?php echo isset($adr['value'][5])?$adr['value'][5]:''; ?>">
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<label class="label" for="adr_country"><?php echo $l->t('Country'); ?></label>
|
<label class="label" for="adr_country"><?php echo $l->t('Country'); ?></label>
|
||||||
|
|
|
@ -22,7 +22,7 @@ if(OCP\App::isEnabled('files_encryption')) {
|
||||||
echo OCP\html_select_options($contacts_options, $contacts_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
|
echo OCP\html_select_options($contacts_options, $contacts_options[0]['id'], array('value'=>'id', 'label'=>'displayname'));
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<span id="import_drop_target" class="droptarget float"><?php echo $l->t("Drop a VCF file to import contacts."); ?> (Max. <?php echo $_['uploadMaxHumanFilesize']; ?>)</span>
|
<span id="import_drop_target" class="droptarget float"><?php echo $l->t("Drop a VCF file<br />to import contacts."); ?> (Max. <?php echo $_['uploadMaxHumanFilesize']; ?>)</span>
|
||||||
<a class="svg upload float" title="<?php echo $l->t('Select from HD'); ?>">
|
<a class="svg upload float" title="<?php echo $l->t('Select from HD'); ?>">
|
||||||
<input class="float" id="import_upload_start" type="file" accept="text/*" name="importfile" /></a>
|
<input class="float" id="import_upload_start" type="file" accept="text/*" name="importfile" /></a>
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
|
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $_['uploadMaxFilesize'] ?>" id="max_upload">
|
||||||
|
@ -36,5 +36,7 @@ if(OCP\App::isEnabled('files_encryption')) {
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
Contacts.UI.Addressbooks.loadImportHandlers();
|
Contacts.UI.Addressbooks.loadImportHandlers();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
|
@ -13,7 +13,7 @@ if(trim($foldername) == '') {
|
||||||
OCP\JSON::error(array("data" => array( "message" => "Empty Foldername" )));
|
OCP\JSON::error(array("data" => array( "message" => "Empty Foldername" )));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
if(strpos($filename,'/')!==false){
|
if(strpos($foldername,'/')!==false){
|
||||||
OCP\JSON::error(array("data" => array( "message" => "Invalid Foldername" )));
|
OCP\JSON::error(array("data" => array( "message" => "Invalid Foldername" )));
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
|
||||||
private $user;
|
private $user;
|
||||||
private $host;
|
private $host;
|
||||||
private $root;
|
private $root;
|
||||||
|
private $share;
|
||||||
|
|
||||||
private static $tempFiles=array();
|
private static $tempFiles=array();
|
||||||
|
|
||||||
|
@ -20,17 +21,32 @@ class OC_FileStorage_SMB extends OC_FileStorage_StreamWrapper{
|
||||||
$this->host=$params['host'];
|
$this->host=$params['host'];
|
||||||
$this->user=$params['user'];
|
$this->user=$params['user'];
|
||||||
$this->password=$params['password'];
|
$this->password=$params['password'];
|
||||||
|
$this->share=$params['share'];
|
||||||
$this->root=isset($params['root'])?$params['root']:'/';
|
$this->root=isset($params['root'])?$params['root']:'/';
|
||||||
|
if(substr($this->root,-1,1)!='/'){
|
||||||
|
$this->root.='/';
|
||||||
|
}
|
||||||
|
if(substr($this->root,0,1)!='/'){
|
||||||
|
$this->root='/'.$this->root;
|
||||||
|
}
|
||||||
|
if(substr($this->share,0,1)!='/'){
|
||||||
|
$this->share='/'.$this->share;
|
||||||
|
}
|
||||||
|
if(substr($this->share,-1,1)=='/'){
|
||||||
|
$this->share=substr($this->share,0,-1);
|
||||||
|
}
|
||||||
|
|
||||||
//create the root folder if necesary
|
//create the root folder if necesary
|
||||||
|
if(!$this->is_dir('')){
|
||||||
$this->mkdir('');
|
$this->mkdir('');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function constructUrl($path){
|
public function constructUrl($path){
|
||||||
if(substr($path,-1)=='/'){
|
if(substr($path,-1)=='/'){
|
||||||
$path=substr($path,0,-1);
|
$path=substr($path,0,-1);
|
||||||
}
|
}
|
||||||
return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->root.$path;
|
return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,8 @@ return array(
|
||||||
'user'=>'test',
|
'user'=>'test',
|
||||||
'password'=>'test',
|
'password'=>'test',
|
||||||
'host'=>'localhost',
|
'host'=>'localhost',
|
||||||
'root'=>'/test',
|
'share'=>'/test',
|
||||||
|
'root'=>'/test/',
|
||||||
),
|
),
|
||||||
'amazons3'=>array(
|
'amazons3'=>array(
|
||||||
'run'=>false,
|
'run'=>false,
|
||||||
|
|
|
@ -19,7 +19,7 @@ if(!is_array($config) or !isset($config['smb']) or !$config['smb']['run']){
|
||||||
public function setUp(){
|
public function setUp(){
|
||||||
$id=uniqid();
|
$id=uniqid();
|
||||||
$this->config=include('apps/files_external/tests/config.php');
|
$this->config=include('apps/files_external/tests/config.php');
|
||||||
$this->config['smb']['root'].='/'.$id;//make sure we have an new empty folder to work in
|
$this->config['smb']['root'].=$id;//make sure we have an new empty folder to work in
|
||||||
$this->instance=new OC_Filestorage_SMB($this->config['smb']);
|
$this->instance=new OC_Filestorage_SMB($this->config['smb']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ function handleRemove($name) {
|
||||||
|
|
||||||
function handleGetThumbnails($albumname) {
|
function handleGetThumbnails($albumname) {
|
||||||
OCP\Response::enableCaching(3600 * 24); // 24 hour
|
OCP\Response::enableCaching(3600 * 24); // 24 hour
|
||||||
$view = OCP\App::getStorage('gallery');
|
$view = OCP\Files::getStorage('gallery');
|
||||||
$thumbnail = $view->fopen(urldecode($albumname).'.png', 'r');
|
$thumbnail = $view->fopen(urldecode($albumname).'.png', 'r');
|
||||||
header('Content-Type: '.OC_Image::getMimeTypeForFile($thumbnail));
|
header('Content-Type: '.OC_Image::getMimeTypeForFile($thumbnail));
|
||||||
OCP\Response::sendFile($thumbnail);
|
OCP\Response::sendFile($thumbnail);
|
||||||
|
|
|
@ -80,7 +80,7 @@ function handleGetThumbnail($token, $imgpath) {
|
||||||
function handleGetAlbumThumbnail($token, $albumname)
|
function handleGetAlbumThumbnail($token, $albumname)
|
||||||
{
|
{
|
||||||
$owner = OC_Gallery_Sharing::getTokenOwner($token);
|
$owner = OC_Gallery_Sharing::getTokenOwner($token);
|
||||||
$view = OCP\App::getStorage('gallery');
|
$view = OCP\Files::getStorage('gallery');
|
||||||
$file = $view->fopen($albumname.'.png', 'r');
|
$file = $view->fopen($albumname.'.png', 'r');
|
||||||
$image = new OC_Image($file);
|
$image = new OC_Image($file);
|
||||||
if ($image->valid()) {
|
if ($image->valid()) {
|
||||||
|
@ -94,7 +94,7 @@ function handleGetAlbumThumbnail($token, $albumname)
|
||||||
|
|
||||||
function handleGetPhoto($token, $photo) {
|
function handleGetPhoto($token, $photo) {
|
||||||
$owner = OC_Gallery_Sharing::getTokenOwner($token);
|
$owner = OC_Gallery_Sharing::getTokenOwner($token);
|
||||||
$view = OCP\App::getStorage('files');
|
$view = OCP\Files::getStorage('files');
|
||||||
$file = $view->fopen(urldecode($photo), 'r');
|
$file = $view->fopen(urldecode($photo), 'r');
|
||||||
header('Content-Type: '.OC_Image::getMimeTypeForFile($file));
|
header('Content-Type: '.OC_Image::getMimeTypeForFile($file));
|
||||||
OCP\Response::sendFile($file);
|
OCP\Response::sendFile($file);
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
OCP\JSON::checkLoggedIn();
|
OCP\JSON::checkLoggedIn();
|
||||||
OCP\JSON::checkAppEnabled('gallery');
|
OCP\JSON::checkAppEnabled('gallery');
|
||||||
|
require_once('apps/gallery/lib/managers.php');
|
||||||
|
|
||||||
$img = $_GET['img'];
|
|
||||||
|
|
||||||
$image = OC_Gallery_Photo::getThumbnail($img);
|
$img = $_GET['filepath'];
|
||||||
|
|
||||||
|
$image = \OC\Pictures\ThumbnailsManager::getInstance()->getThumbnail($img);
|
||||||
if ($image) {
|
if ($image) {
|
||||||
OCP\Response::enableCaching(3600 * 24); // 24 hour
|
OCP\Response::enableCaching(3600 * 24); // 24 hour
|
||||||
$image->show();
|
$image->show();
|
||||||
|
|
|
@ -5,16 +5,8 @@
|
||||||
<overwrite>false</overwrite>
|
<overwrite>false</overwrite>
|
||||||
<charset>latin1</charset>
|
<charset>latin1</charset>
|
||||||
<table>
|
<table>
|
||||||
<name>*dbprefix*gallery_albums</name>
|
<name>*dbprefix*pictures_images_cache</name>
|
||||||
<declaration>
|
<declaration>
|
||||||
<field>
|
|
||||||
<name>album_id</name>
|
|
||||||
<type>integer</type>
|
|
||||||
<default>0</default>
|
|
||||||
<notnull>true</notnull>
|
|
||||||
<autoincrement>1</autoincrement>
|
|
||||||
<length>4</length>
|
|
||||||
</field>
|
|
||||||
<field>
|
<field>
|
||||||
<name>uid_owner</name>
|
<name>uid_owner</name>
|
||||||
<type>text</type>
|
<type>text</type>
|
||||||
|
@ -22,48 +14,22 @@
|
||||||
<length>64</length>
|
<length>64</length>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>album_name</name>
|
<name>path</name>
|
||||||
<type>text</type>
|
|
||||||
<notnull>true</notnull>
|
|
||||||
<length>100</length>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>album_path</name>
|
|
||||||
<type>text</type>
|
<type>text</type>
|
||||||
<notnull>true</notnull>
|
<notnull>true</notnull>
|
||||||
<length>256</length>
|
<length>256</length>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>parent_path</name>
|
<name>width</name>
|
||||||
<type>text</type>
|
|
||||||
<notnull>true</notnull>
|
|
||||||
<length>256</length>
|
|
||||||
</field>
|
|
||||||
</declaration>
|
|
||||||
</table>
|
|
||||||
<table>
|
|
||||||
<name>*dbprefix*gallery_photos</name>
|
|
||||||
<declaration>
|
|
||||||
<field>
|
|
||||||
<name>photo_id</name>
|
|
||||||
<type>integer</type>
|
<type>integer</type>
|
||||||
<default>0</default>
|
|
||||||
<notnull>true</notnull>
|
|
||||||
<autoincrement>1</autoincrement>
|
|
||||||
<length>4</length>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>album_id</name>
|
|
||||||
<type>integer</type>
|
|
||||||
<default>0</default>
|
|
||||||
<notnull>true</notnull>
|
<notnull>true</notnull>
|
||||||
<length>4</length>
|
<length>4</length>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>file_path</name>
|
<name>height</name>
|
||||||
<type>text</type>
|
<type>integer</type>
|
||||||
<notnull>true</notnull>
|
<notnull>true</notnull>
|
||||||
<length>256</length>
|
<length>4</length>
|
||||||
</field>
|
</field>
|
||||||
</declaration>
|
</declaration>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$currentVersion=OC_Appconfig::getValue('gallery', 'installed_version');
|
||||||
|
if (version_compare($currentVersion, '0.5.0', '<')) {
|
||||||
|
$stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_photos');
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt = OCP\DB::prepare('DROP TABLE IF EXISTS *PREFIX*gallery_albums');
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
\OC_DB::createDbFromStructure(OC::$APPSROOT.'/apps/'.$appid.'/appinfo/database.xml');
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
0.4.3
|
0.5.0
|
||||||
|
|
|
@ -27,26 +27,6 @@ OCP\User::checkLoggedIn();
|
||||||
OCP\App::checkAppEnabled('gallery');
|
OCP\App::checkAppEnabled('gallery');
|
||||||
OCP\App::setActiveNavigationEntry( 'gallery_index' );
|
OCP\App::setActiveNavigationEntry( 'gallery_index' );
|
||||||
|
|
||||||
if (!isset($_GET['view'])) {
|
|
||||||
$result = OC_Gallery_Album::find(OCP\USER::getUser());
|
|
||||||
|
|
||||||
$r = array();
|
|
||||||
while ($row = $result->fetchRow())
|
|
||||||
$r[] = $row;
|
|
||||||
|
|
||||||
$tmpl = new OCP\Template( 'gallery', 'index', 'user' );
|
$tmpl = new OCP\Template( 'gallery', 'index', 'user' );
|
||||||
$tmpl->assign('r', $r);
|
|
||||||
$tmpl->printPage();
|
$tmpl->printPage();
|
||||||
} else {
|
|
||||||
$result = OC_Gallery_Photo::findForAlbum(OCP\USER::getUser(), $_GET['view']);
|
|
||||||
|
|
||||||
$photos = array();
|
|
||||||
while ($p = $result->fetchRow())
|
|
||||||
$photos[] = $p['file_path'];
|
|
||||||
|
|
||||||
$tmpl = new OCP\Template( 'gallery', 'view_album', 'user' );
|
|
||||||
$tmpl->assign('photos', $photos);
|
|
||||||
$tmpl->assign('albumName', $_GET['view']);
|
|
||||||
$tmpl->printPage();
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -90,7 +90,7 @@ class OC_Gallery_Album {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function changeThumbnailPath($oldname, $newname) {
|
public static function changeThumbnailPath($oldname, $newname) {
|
||||||
$view = OCP\App::getStorage('gallery');
|
$view = OCP\Files::getStorage('gallery');
|
||||||
$view->rename($oldname.'.png', $newname.'.png');
|
$view->rename($oldname.'.png', $newname.'.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OC\Pictures;
|
||||||
|
|
||||||
|
require_once('lib/base.php');
|
||||||
|
|
||||||
|
\OCP\JSON::checkLoggedIn();
|
||||||
|
\OCP\JSON::checkAppEnabled('gallery');
|
||||||
|
|
||||||
|
class DatabaseManager {
|
||||||
|
private static $instance = null;
|
||||||
|
const TAG = 'DatabaseManager';
|
||||||
|
|
||||||
|
public static function getInstance() {
|
||||||
|
if (self::$instance === null)
|
||||||
|
self::$instance = new DatabaseManager();
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFileData($path) {
|
||||||
|
$gallery_path = \OCP\Config::getSystemValue( 'datadirectory' ).'/'.\OC_User::getUser().'/gallery';
|
||||||
|
$path = $gallery_path.$path;
|
||||||
|
$stmt = \OCP\DB::prepare('SELECT * FROM *PREFIX*pictures_images_cache WHERE uid_owner LIKE ? AND path = ?');
|
||||||
|
$result = $stmt->execute(array(\OCP\USER::getUser(), $path));
|
||||||
|
if (($row = $result->fetchRow()) != false) {
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
$image = new \OC_Image();
|
||||||
|
if (!$image->loadFromFile($path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
\OCP\DB::beginTransaction();
|
||||||
|
$stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)');
|
||||||
|
$stmt->execute(array(\OCP\USER::getUser(), $path, $image->width(), $image->height()));
|
||||||
|
\OCP\DB::commit();
|
||||||
|
$ret = array('filepath' => $path, 'width' => $image->width(), 'height' => $image->height());
|
||||||
|
unset($image);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function __construct() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ThumbnailsManager {
|
||||||
|
|
||||||
|
private static $instance = null;
|
||||||
|
const TAG = 'ThumbnailManager';
|
||||||
|
|
||||||
|
public static function getInstance() {
|
||||||
|
if (self::$instance === null)
|
||||||
|
self::$instance = new ThumbnailsManager();
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getThumbnail($path) {
|
||||||
|
$gallery_path = \OCP\Config::getSystemValue( 'datadirectory' ).'/'.\OC_User::getUser().'/gallery';
|
||||||
|
if (file_exists($gallery_path.$path)) {
|
||||||
|
return new \OC_Image($gallery_path.$path);
|
||||||
|
}
|
||||||
|
if (!\OC_Filesystem::file_exists($path)) {
|
||||||
|
\OC_Log::write(self::TAG, 'File '.$path.' don\'t exists', \OC_Log::WARN);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$image = new \OC_Image();
|
||||||
|
$image->loadFromFile(\OC_Filesystem::getLocalFile($path));
|
||||||
|
if (!$image->valid()) return false;
|
||||||
|
|
||||||
|
$image->fixOrientation();
|
||||||
|
|
||||||
|
$ret = $image->preciseResize(floor((150*$image->width())/$image->height()), 150);
|
||||||
|
|
||||||
|
if (!$ret) {
|
||||||
|
\OC_Log::write(self::TAG, 'Couldn\'t resize image', \OC_Log::ERROR);
|
||||||
|
unset($image);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$image->save($gallery_path.'/'.$path);
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getThumbnailInfo($path) {
|
||||||
|
$arr = DatabaseManager::getInstance()->getFileData($path);
|
||||||
|
$ret = array('filepath' => $arr['path'],
|
||||||
|
'width' => $arr['width'],
|
||||||
|
'height' => $arr['height']);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($path) {
|
||||||
|
unlink(\OC::$CONFIG_DATADIRECTORY_ROOT.'/'.\OC_User::getUser()."/gallery".$path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function __construct() {}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
|
@ -68,7 +68,7 @@ class OC_Gallery_Photo {
|
||||||
|
|
||||||
public static function getThumbnail($image_name, $owner = null) {
|
public static function getThumbnail($image_name, $owner = null) {
|
||||||
if (!$owner) $owner = OCP\USER::getUser();
|
if (!$owner) $owner = OCP\USER::getUser();
|
||||||
$view = OCP\App::getStorage('gallery');
|
$view = OCP\Files::getStorage('gallery');
|
||||||
$save_dir = dirname($image_name);
|
$save_dir = dirname($image_name);
|
||||||
if (!$view->is_dir($save_dir)) {
|
if (!$view->is_dir($save_dir)) {
|
||||||
$view->mkdir($save_dir);
|
$view->mkdir($save_dir);
|
||||||
|
|
|
@ -81,7 +81,7 @@ class OC_Gallery_Scanner {
|
||||||
$image->destroy();
|
$image->destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$view = OCP\App::getStorage('gallery');
|
$view = OCP\Files::getStorage('gallery');
|
||||||
imagepng($thumbnail, $view->getLocalFile($albumName.'.png'));
|
imagepng($thumbnail, $view->getLocalFile($albumName.'.png'));
|
||||||
imagedestroy($thumbnail);
|
imagedestroy($thumbnail);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,178 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OC\Pictures;
|
||||||
|
|
||||||
|
require_once('lib/base.php');
|
||||||
|
require_once('managers.php');
|
||||||
|
|
||||||
|
const TAG = 'Pictures';
|
||||||
|
const IMAGE_WIDTH = 150;
|
||||||
|
|
||||||
|
class TileBase {
|
||||||
|
public function getWidth() { return false; }
|
||||||
|
|
||||||
|
public function getHeight() { return IMAGE_WIDTH; }
|
||||||
|
|
||||||
|
public function getOnHoverAction() { return false; }
|
||||||
|
|
||||||
|
public function getOnOutAction() { return false; }
|
||||||
|
|
||||||
|
public function getOnClickAction() { return false; }
|
||||||
|
|
||||||
|
public function getDisplayedLayer() { return false; }
|
||||||
|
|
||||||
|
public function getTileProportion() { return false; }
|
||||||
|
|
||||||
|
public function get() { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class TilesLine {
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->tiles_array = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAvailableSpace($space) {
|
||||||
|
$available_space = $space;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTilesCount() {
|
||||||
|
return count($this->tiles_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addTile($tile) {
|
||||||
|
array_push($this->tiles_array, $tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLeftSpace() {
|
||||||
|
$occupied_space = 0;
|
||||||
|
for ($i = 0; $i < count($this->tiles_array); $i++) {
|
||||||
|
$occupied_space += $this->tiles_array[$i]->getWidth();
|
||||||
|
}
|
||||||
|
return $this->available_space - $occupied_space;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tileWillFit($tile) {
|
||||||
|
return $this->getLeftSpace() > $tile->getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get() {
|
||||||
|
$r = '<div class="line gallery_div">';
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($this->tiles_array); $i++) {
|
||||||
|
$img_w = $this->tiles_array[$i]->getWidth();
|
||||||
|
$extra = '';
|
||||||
|
if ($img_w != IMAGE_WIDTH) $extra = ' style="width:'.$img_w.'px"';
|
||||||
|
$r .= '<div class="gallery_div" '.$extra.' onmouseover="'.$this->tiles_array[$i]->getOnHoverAction().'" onmouseout="'.$this->tiles_array[$i]->getOnOutAction().'" onclick="'.$this->tiles_array[$i]->getOnClickAction().'">'.$this->tiles_array[$i]->get().'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$r .= '</div>';
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
private $tiles_array;
|
||||||
|
private $available_space;
|
||||||
|
}
|
||||||
|
|
||||||
|
class TileSingle extends TileBase {
|
||||||
|
|
||||||
|
public function __construct($path) {
|
||||||
|
\OC_Log::write(TAG, 'Loading file from path '.$path, \OC_Log::DEBUG);
|
||||||
|
$this->file_path = $path;
|
||||||
|
/* $this->image = new \OC_Image();
|
||||||
|
if (!$this->image->loadFromFile($this->file_path)) {
|
||||||
|
\OC_Log::write(TAG, 'Loading file filed', \OC_Log::ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->image->fixOrientation();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWidth() {
|
||||||
|
$a = ThumbnailsManager::getInstance()->getThumbnailInfo($this->file_path);
|
||||||
|
return $a['width'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($extra = '') {
|
||||||
|
// !HACK! file path needs to be encoded twice because files app decode twice url, so any special chars like + or & in filename
|
||||||
|
// !HACK! will result in failing of opening them
|
||||||
|
return '<a rel="images" title="'.basename($this->getPath()).'" href="'.\OCP\Util::linkTo('files', 'download.php').'?file='.urlencode(urlencode($this->getPath())).'"><img rel="images" src="'.\OCP\Util::linkTo('gallery', 'ajax/thumbnail.php').'&filepath='.urlencode($this->getPath()).'" '.$extra.'></a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMiniatureSrc() {
|
||||||
|
return \OCP\Util::linkTo('gallery', 'ajax/thumbnail.php').'&filepath='.urlencode($this->getPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPath() {
|
||||||
|
return $this->file_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOnClickAction() {
|
||||||
|
return '';//'javascript:openFile(\''.$this->file_path.'\');';
|
||||||
|
}
|
||||||
|
|
||||||
|
private $file_path;
|
||||||
|
private $image;
|
||||||
|
}
|
||||||
|
|
||||||
|
class TileStack extends TileBase {
|
||||||
|
|
||||||
|
const STACK_REPRESENTATIVES = 3;
|
||||||
|
|
||||||
|
public function __construct($path_array, $stack_name) {
|
||||||
|
$this->tiles_array = array();
|
||||||
|
$this->stack_name = $stack_name;
|
||||||
|
for ($i = 0; $i < count($path_array) && $i < self::STACK_REPRESENTATIVES; $i++) {
|
||||||
|
$tile = new TileSingle($path_array[$i]);
|
||||||
|
array_push($this->tiles_array, $tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function forceSize($width_must_fit=false) {
|
||||||
|
for ($i = 0; $i < count($this->tiles_array); $i++)
|
||||||
|
$this->tiles_array[$i]->forceSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWidth() {
|
||||||
|
$max = 0;
|
||||||
|
for ($i = 0; $i < count($this->tiles_array); $i++) {
|
||||||
|
$max = max($max, $this->tiles_array[$i]->getWidth());
|
||||||
|
}
|
||||||
|
return min(IMAGE_WIDTH, $max);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get() {
|
||||||
|
$r = '<div class="title gallery_div">'.$this->stack_name.'</div>';
|
||||||
|
for ($i = 0; $i < count($this->tiles_array); $i++) {
|
||||||
|
$top = rand(-5, 5);
|
||||||
|
$left = rand(-5, 5);
|
||||||
|
$img_w = $this->tiles_array[$i]->getWidth();
|
||||||
|
$extra = '';
|
||||||
|
if ($img_w < IMAGE_WIDTH) {
|
||||||
|
$extra = 'width:'.$img_w.'px;';
|
||||||
|
}
|
||||||
|
$r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>';
|
||||||
|
}
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOnHoverAction() {
|
||||||
|
return 'javascript:t(this);return false;';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOnOutAction() {
|
||||||
|
return 'javascript:o(this);return false;';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCount() {
|
||||||
|
return count($this->tiles_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOnClickAction() {
|
||||||
|
return 'javascript:openNewGal(\''.$this->stack_name.'\');';
|
||||||
|
}
|
||||||
|
|
||||||
|
private $tiles_array;
|
||||||
|
private $stack_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?php
|
||||||
|
$l = OC_L10N::get('gallery');
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
div.gallery_div {position:relative; display: inline-block; height: 202px; width: 200px; margin: 5px;}
|
||||||
|
div.miniature_border {position:absolute; height: 200px; -webkit-transition-duration: .2s; background-position: 50%;}
|
||||||
|
div.line {display:inline-block; border: 0; width: auto; height: 210px}
|
||||||
|
div.gallery_div img{position:absolute; top: 1; left: 0; -webkit-transition-duration: 0.3s; height:200px; width: auto;}
|
||||||
|
div.gallery_div img.shrinker {width:80px !important;}
|
||||||
|
div.title { opacity: 0; text-align: center; vertical-align: middle; font-family: Arial; font-size: 12px; border: 0; position: absolute; text-overflow: ellipsis; bottom: 20px; left:10px; height:auto; padding: 5px; width: 170px; background-color: black; color: white; -webkit-transition: opacity 0.5s; z-index:1000; border-radius: 7px}
|
||||||
|
div.visible { opacity: 0.8;}
|
||||||
|
</style>
|
||||||
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function t(element) {
|
||||||
|
$('div', element).each(function(index, elem) {
|
||||||
|
if ($(elem).hasClass('title')) {
|
||||||
|
$(elem).addClass('visible');
|
||||||
|
} else {
|
||||||
|
$(elem).css('margin-top', Math.floor(30-(Math.random()*60)) + 'px')
|
||||||
|
.css('margin-left', Math.floor(30-(Math.random()*60))+ 'px')
|
||||||
|
.css('z-index', '999');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function o(element) {
|
||||||
|
$('div', element).each(function(index, elem) {
|
||||||
|
if ($(elem).hasClass('title')) {
|
||||||
|
$(elem).removeClass('visible');
|
||||||
|
} else {
|
||||||
|
$(elem).css('margin-top', Math.floor(5-(Math.random()*10)) + 'px')
|
||||||
|
.css('margin-left', Math.floor(5-(Math.random()*10))+ 'px')
|
||||||
|
.css('z-index', '3');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include('apps/gallery/lib/tiles.php');
|
||||||
|
$root = empty($_GET['root'])?'/':$_GET['root'];
|
||||||
|
|
||||||
|
$images = \OC_FileCache::searchByMime('image', null, '/bartek/files'.$root);
|
||||||
|
sort($images);
|
||||||
|
|
||||||
|
$arr = array();
|
||||||
|
$tl = new \OC\Pictures\TilesLine();
|
||||||
|
$ts = new \OC\Pictures\TileStack(array(), '');
|
||||||
|
$previous_element = $images[0];
|
||||||
|
for($i = 0; $i < count($images); $i++) {
|
||||||
|
error_log($images[$i]);
|
||||||
|
$prev_dir_arr = explode('/', $previous_element);
|
||||||
|
$dir_arr = explode('/', $images[$i]);
|
||||||
|
|
||||||
|
if (count($dir_arr)==1) {
|
||||||
|
$tl->addTile(new \OC\Pictures\TileSingle($images[$i]));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (strcmp($prev_dir_arr[0], $dir_arr[0])!=0) {
|
||||||
|
$tl->addTile(new \OC\Pictures\TileStack($arr, $prev_dir_arr[0]));
|
||||||
|
$arr = array();
|
||||||
|
}
|
||||||
|
$arr[] = $root.$images[$i];
|
||||||
|
$previous_element = $images[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
$dir_arr = explode('/', $previous_element);
|
||||||
|
|
||||||
|
if (count($dir_arr)==0) {
|
||||||
|
$tl->addTile(new \OC\Pictures\TileSingle($previous_element));
|
||||||
|
} else if (count($dir_arr) && $ts->getCount() == 0){
|
||||||
|
$ts = new \OC\Pictures\TileStack(array($previous_element), $dir_arr[0]);
|
||||||
|
} else {
|
||||||
|
$arr[] = $previous_element;
|
||||||
|
$ts->addTile($arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ts->getCount() != 0) {
|
||||||
|
$tl->addTile($ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $tl->get();
|
||||||
|
|
||||||
|
?>
|
|
@ -1,31 +1,105 @@
|
||||||
<?php
|
<?php
|
||||||
OCP\Util::addStyle('gallery', 'styles');
|
|
||||||
OCP\Util::addscript('gallery', 'albums');
|
|
||||||
OCP\Util::addscript('gallery', 'scanner');
|
|
||||||
OCP\Util::addscript('gallery', 'album_cover');
|
|
||||||
OCP\Util::addStyle('files', 'files');
|
|
||||||
OCP\Util::addscript('files_imageviewer', 'jquery.mousewheel-3.0.4.pack');
|
|
||||||
OCP\Util::addscript('files_imageviewer', 'jquery.fancybox-1.3.4.pack');
|
|
||||||
OCP\Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' );
|
|
||||||
$l = OC_L10N::get('gallery');
|
$l = OC_L10N::get('gallery');
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">var gallery_scanning_root='<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'order', 'ASC'); ?>';</script>
|
<style>
|
||||||
<div id="controls">
|
div.gallery_div {position:relative; display: inline-block; height: 152px; width: 150px; margin: 5px;}
|
||||||
<div id="scan">
|
div.miniature_border {position:absolute; height: 150px; -webkit-transition-duration: .2s; background-position: 50%;}
|
||||||
<div id="scanprogressbar"></div>
|
div.line {display:inline-block; border: 0; width: auto; height: 160px}
|
||||||
<input type="button" class="start" value="<?php echo $l->t('Rescan');?>" onclick="javascript:scanForAlbums();" />
|
div.gallery_div img{position:absolute; top: 1; left: 0; -webkit-transition-duration: 0.3s; height:150px; width: auto;}
|
||||||
<input type="button" class="stop" style="display:none" value="<?php echo $l->t('Stop');?>" onclick="javascript:Scanner.stop();" />
|
div.gallery_div img.shrinker {width:80px !important;}
|
||||||
<input type="button" id="g-share-button" value="<?php echo $l->t('Share'); ?>" onclick="javascript:shareGallery();" />
|
div.title { opacity: 0; text-align: center; vertical-align: middle; font-family: Arial; font-size: 12px; border: 0; position: absolute; text-overflow: ellipsis; bottom: 20px; left:5px; height:auto; padding: 5px; width: 140px; background-color: black; color: white; -webkit-transition: opacity 0.5s; z-index:1000; border-radius: 7px}
|
||||||
<input type="button" id="g-settings-button" value="<?php echo $l->t('Settings');?>" onclick="javascript:settings();"/>
|
div.visible { opacity: 0.8;}
|
||||||
</div>
|
</style>
|
||||||
<div id="g-album-navigation">
|
<script type="text/javascript">
|
||||||
<div class="crumb last" style="background-image:url('<?php echo OC::$WEBROOT;?>/core/img/breadcrumb.png')">
|
|
||||||
<a href="javascript:returnToElement(0);">main</a>
|
var root = "<?php echo !empty($_GET['root']) ? $_GET['root'] : '/'; ?>";
|
||||||
</div>
|
|
||||||
</div>
|
function t(element) {
|
||||||
<div id="g-album-loading" class="crumb" style="display:none">
|
$('div', element).each(function(index, elem) {
|
||||||
<img src="<?php echo OCP\Util::linkTo('gallery', 'img/loading.gif'); ?>">
|
if ($(elem).hasClass('title')) {
|
||||||
</div>
|
$(elem).addClass('visible');
|
||||||
</div>
|
} else {
|
||||||
<div id="gallery_list">
|
$(elem).css('margin-top', Math.floor(30-(Math.random()*60)) + 'px')
|
||||||
</div>
|
.css('margin-left', Math.floor(30-(Math.random()*60))+ 'px')
|
||||||
|
.css('z-index', '999');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function o(element) {
|
||||||
|
$('div', element).each(function(index, elem) {
|
||||||
|
if ($(elem).hasClass('title')) {
|
||||||
|
$(elem).removeClass('visible');
|
||||||
|
} else {
|
||||||
|
$(elem).css('margin-top', Math.floor(5-(Math.random()*10)) + 'px')
|
||||||
|
.css('margin-left', Math.floor(5-(Math.random()*10))+ 'px')
|
||||||
|
.css('z-index', '3');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function openNewGal(album_name) {
|
||||||
|
root = root + album_name + "/";
|
||||||
|
var url = window.location.toString().replace(window.location.search, '');
|
||||||
|
url = url + "?app=gallery&root="+encodeURIComponent(root);
|
||||||
|
|
||||||
|
window.location = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("a[rel=images]").fancybox({
|
||||||
|
'titlePosition': 'inside'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include('apps/gallery/lib/tiles.php');
|
||||||
|
$root = empty($_GET['root'])?'/':$_GET['root'];
|
||||||
|
|
||||||
|
$images = \OC_FileCache::searchByMime('image', null, '/'.\OCP\USER::getUser().'/files'.$root);
|
||||||
|
sort($images);
|
||||||
|
|
||||||
|
$arr = array();
|
||||||
|
$tl = new \OC\Pictures\TilesLine();
|
||||||
|
$ts = new \OC\Pictures\TileStack(array(), '');
|
||||||
|
$previous_element = $images[0];
|
||||||
|
for($i = 0; $i < count($images); $i++) {
|
||||||
|
$prev_dir_arr = explode('/', $previous_element);
|
||||||
|
$dir_arr = explode('/', $images[$i]);
|
||||||
|
|
||||||
|
if (count($dir_arr)==1) {
|
||||||
|
$tl->addTile(new \OC\Pictures\TileSingle($root.$images[$i]));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (strcmp($prev_dir_arr[0], $dir_arr[0])!=0) {
|
||||||
|
$tl->addTile(new \OC\Pictures\TileStack($arr, $prev_dir_arr[0]));
|
||||||
|
$arr = array();
|
||||||
|
}
|
||||||
|
$arr[] = $root.$images[$i];
|
||||||
|
$previous_element = $images[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
$dir_arr = explode('/', $previous_element);
|
||||||
|
|
||||||
|
if (count($images)>1) {
|
||||||
|
if (count($dir_arr)==0) {
|
||||||
|
$tl->addTile(new \OC\Pictures\TileSingle($previous_element));
|
||||||
|
} else if (count($dir_arr) && $ts->getCount() == 0){
|
||||||
|
$ts = new \OC\Pictures\TileStack(array($root.$previous_element), $dir_arr[0]);
|
||||||
|
} else {
|
||||||
|
$arr[] = $previous_element;
|
||||||
|
$ts->addTile($arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ts->getCount() != 0) {
|
||||||
|
$tl->addTile($ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $tl->get();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
|
@ -27,6 +27,11 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
protected $ldapGroupMemberAssocAttr;
|
protected $ldapGroupMemberAssocAttr;
|
||||||
protected $configured = false;
|
protected $configured = false;
|
||||||
|
|
||||||
|
protected $_group_user = array();
|
||||||
|
protected $_user_groups = array();
|
||||||
|
protected $_group_users = array();
|
||||||
|
protected $_groups = array();
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->ldapGroupFilter = OCP\Config::getAppValue('user_ldap', 'ldap_group_filter', '(objectClass=posixGroup)');
|
$this->ldapGroupFilter = OCP\Config::getAppValue('user_ldap', 'ldap_group_filter', '(objectClass=posixGroup)');
|
||||||
$this->ldapGroupMemberAssocAttr = OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember');
|
$this->ldapGroupMemberAssocAttr = OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember');
|
||||||
|
@ -48,6 +53,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
if(!$this->configured) {
|
if(!$this->configured) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if(isset($this->_group_user[$gid][$uid])) {
|
||||||
|
return $this->_group_user[$gid][$uid];
|
||||||
|
}
|
||||||
$dn_user = OC_LDAP::username2dn($uid);
|
$dn_user = OC_LDAP::username2dn($uid);
|
||||||
$dn_group = OC_LDAP::groupname2dn($gid);
|
$dn_group = OC_LDAP::groupname2dn($gid);
|
||||||
// just in case
|
// just in case
|
||||||
|
@ -64,8 +72,8 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
//TODO: this can be done with one LDAP query
|
//TODO: this can be done with one LDAP query
|
||||||
if(strtolower($this->ldapGroupMemberAssocAttr) == 'memberuid') {
|
if(strtolower($this->ldapGroupMemberAssocAttr) == 'memberuid') {
|
||||||
$dns = array();
|
$dns = array();
|
||||||
foreach($members as $uid) {
|
foreach($members as $mid) {
|
||||||
$filter = str_replace('%uid', $uid, OC_LDAP::conf('ldapLoginFilter'));
|
$filter = str_replace('%uid', $mid, OC_LDAP::conf('ldapLoginFilter'));
|
||||||
$ldap_users = OC_LDAP::fetchListOfUsers($filter, 'dn');
|
$ldap_users = OC_LDAP::fetchListOfUsers($filter, 'dn');
|
||||||
if(count($ldap_users) < 1) {
|
if(count($ldap_users) < 1) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -75,7 +83,8 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
$members = $dns;
|
$members = $dns;
|
||||||
}
|
}
|
||||||
|
|
||||||
return in_array($dn_user, $members);
|
$this->_group_user[$gid][$uid] = in_array($dn_user, $members);
|
||||||
|
return $this->_group_user[$gid][$uid];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,8 +99,12 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
if(!$this->configured) {
|
if(!$this->configured) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
if(isset($this->_user_groups[$uid])) {
|
||||||
|
return $this->_user_groups[$uid];
|
||||||
|
}
|
||||||
$userDN = OC_LDAP::username2dn($uid);
|
$userDN = OC_LDAP::username2dn($uid);
|
||||||
if(!$userDN) {
|
if(!$userDN) {
|
||||||
|
$this->_user_groups[$uid] = array();
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,9 +125,9 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
$this->ldapGroupMemberAssocAttr.'='.$uid
|
$this->ldapGroupMemberAssocAttr.'='.$uid
|
||||||
));
|
));
|
||||||
$groups = OC_LDAP::fetchListOfGroups($filter, array(OC_LDAP::conf('ldapGroupDisplayName'),'dn'));
|
$groups = OC_LDAP::fetchListOfGroups($filter, array(OC_LDAP::conf('ldapGroupDisplayName'),'dn'));
|
||||||
$userGroups = OC_LDAP::ownCloudGroupNames($groups);
|
$this->_user_groups[$uid] = array_unique(OC_LDAP::ownCloudGroupNames($groups), SORT_LOCALE_STRING);
|
||||||
|
|
||||||
return array_unique($userGroups, SORT_LOCALE_STRING);
|
return $this->_user_groups[$uid];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,14 +138,19 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
if(!$this->configured) {
|
if(!$this->configured) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
if(isset($this->_group_users[$gid])) {
|
||||||
|
return $this->_group_users[$gid];
|
||||||
|
}
|
||||||
|
|
||||||
$groupDN = OC_LDAP::groupname2dn($gid);
|
$groupDN = OC_LDAP::groupname2dn($gid);
|
||||||
if(!$groupDN) {
|
if(!$groupDN) {
|
||||||
|
$this->_group_users[$gid] = array();
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$members = OC_LDAP::readAttribute($groupDN, $this->ldapGroupMemberAssocAttr);
|
$members = OC_LDAP::readAttribute($groupDN, $this->ldapGroupMemberAssocAttr);
|
||||||
if(!$members) {
|
if(!$members) {
|
||||||
|
$this->_group_users[$gid] = array();
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +172,8 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
if(!$isMemberUid) {
|
if(!$isMemberUid) {
|
||||||
$result = array_intersect($result, OCP\User::getUsers());
|
$result = array_intersect($result, OCP\User::getUsers());
|
||||||
}
|
}
|
||||||
return array_unique($result, SORT_LOCALE_STRING);
|
$this->_group_users[$gid] = array_unique($result, SORT_LOCALE_STRING);
|
||||||
|
return $this->_group_users[$gid];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,10 +186,11 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
||||||
if(!$this->configured) {
|
if(!$this->configured) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
if(is_null($this->_groups)) {
|
||||||
$ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
|
$ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
|
||||||
$groups = OC_LDAP::ownCloudGroupNames($ldap_groups);
|
$this->_groups = OC_LDAP::ownCloudGroupNames($ldap_groups);
|
||||||
return $groups;
|
}
|
||||||
|
return $this->groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,6 +52,8 @@ class OC_LDAP {
|
||||||
static protected $ldapGroupDisplayName;
|
static protected $ldapGroupDisplayName;
|
||||||
static protected $ldapLoginFilter;
|
static protected $ldapLoginFilter;
|
||||||
|
|
||||||
|
static protected $__d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief initializes the LDAP backend
|
* @brief initializes the LDAP backend
|
||||||
* @param $force read the config settings no matter what
|
* @param $force read the config settings no matter what
|
||||||
|
@ -59,6 +61,9 @@ class OC_LDAP {
|
||||||
* initializes the LDAP backend
|
* initializes the LDAP backend
|
||||||
*/
|
*/
|
||||||
static public function init($force = false) {
|
static public function init($force = false) {
|
||||||
|
if(is_null(self::$__d)) {
|
||||||
|
self::$__d = new OC_LDAP_DESTRUCTOR();
|
||||||
|
}
|
||||||
self::readConfiguration($force);
|
self::readConfiguration($force);
|
||||||
self::establishConnection();
|
self::establishConnection();
|
||||||
}
|
}
|
||||||
|
@ -258,7 +263,7 @@ class OC_LDAP {
|
||||||
$key = self::recursiveArraySearch($knownObjects, $ldapObject['dn']);
|
$key = self::recursiveArraySearch($knownObjects, $ldapObject['dn']);
|
||||||
|
|
||||||
//everything is fine when we know the group
|
//everything is fine when we know the group
|
||||||
if($key) {
|
if($key !== false) {
|
||||||
$ownCloudNames[] = $knownObjects[$key]['owncloud_name'];
|
$ownCloudNames[] = $knownObjects[$key]['owncloud_name'];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -329,30 +334,6 @@ class OC_LDAP {
|
||||||
return $query->execute()->fetchAll();
|
return $query->execute()->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief inserts a new group into the mappings table
|
|
||||||
* @param $dn the record in question
|
|
||||||
* @param $ocname the name to use in ownCloud
|
|
||||||
* @returns true on success, false otherwise
|
|
||||||
*
|
|
||||||
* inserts a new group into the mappings table
|
|
||||||
*/
|
|
||||||
static private function mapGroup($dn, $ocname) {
|
|
||||||
return self::mapComponent($dn, $ocname, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief inserts a new user into the mappings table
|
|
||||||
* @param $dn the record in question
|
|
||||||
* @param $ocname the name to use in ownCloud
|
|
||||||
* @returns true on success, false otherwise
|
|
||||||
*
|
|
||||||
* inserts a new user into the mappings table
|
|
||||||
*/
|
|
||||||
static private function mapUser($dn, $ocname) {
|
|
||||||
return self::mapComponent($dn, $ocname, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief inserts a new user or group into the mappings table
|
* @brief inserts a new user or group into the mappings table
|
||||||
* @param $dn the record in question
|
* @param $dn the record in question
|
||||||
|
@ -380,12 +361,22 @@ class OC_LDAP {
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM '.$table.'
|
FROM '.$table.'
|
||||||
WHERE ldap_dn = ?
|
WHERE ldap_dn = ?
|
||||||
AND owncloud_name = ? )
|
OR owncloud_name = ? )
|
||||||
');
|
');
|
||||||
|
|
||||||
$res = $insert->execute(array($dn, $ocname, $dn, $ocname));
|
$res = $insert->execute(array($dn, $ocname, $dn, $ocname));
|
||||||
|
|
||||||
return !OCP\DB::isError($res);
|
if(OCP\DB::isError($res)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$insRows = $res->numRows();
|
||||||
|
|
||||||
|
if($insRows == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function fetchListOfUsers($filter, $attr) {
|
static public function fetchListOfUsers($filter, $attr) {
|
||||||
|
@ -530,7 +521,7 @@ class OC_LDAP {
|
||||||
|
|
||||||
static private function sanitizeDN($dn) {
|
static private function sanitizeDN($dn) {
|
||||||
//OID sometimes gives back DNs with whitespace after the comma a la "uid=foo, cn=bar, dn=..." We need to tackle this!
|
//OID sometimes gives back DNs with whitespace after the comma a la "uid=foo, cn=bar, dn=..." We need to tackle this!
|
||||||
$dn = preg_replace('/,\s+/',',',$dn);
|
$dn = preg_replace('/([^\\\]),(\s+)/','\1,',$dn);
|
||||||
|
|
||||||
//make comparisons and everything work
|
//make comparisons and everything work
|
||||||
$dn = strtolower($dn);
|
$dn = strtolower($dn);
|
||||||
|
|
|
@ -34,6 +34,9 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||||
// will be retrieved from LDAP server
|
// will be retrieved from LDAP server
|
||||||
protected $ldap_dc = false;
|
protected $ldap_dc = false;
|
||||||
|
|
||||||
|
// cache getUsers()
|
||||||
|
protected $_users = null;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->ldapUserFilter = OCP\Config::getAppValue('user_ldap', 'ldap_userlist_filter', '(objectClass=posixAccount)');
|
$this->ldapUserFilter = OCP\Config::getAppValue('user_ldap', 'ldap_userlist_filter', '(objectClass=posixAccount)');
|
||||||
$this->ldapQuotaAttribute = OCP\Config::getAppValue('user_ldap', 'ldap_quota_attr', '');
|
$this->ldapQuotaAttribute = OCP\Config::getAppValue('user_ldap', 'ldap_quota_attr', '');
|
||||||
|
@ -108,9 +111,11 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||||
* Get a list of all users.
|
* Get a list of all users.
|
||||||
*/
|
*/
|
||||||
public function getUsers(){
|
public function getUsers(){
|
||||||
|
if(is_null($this->_users)) {
|
||||||
$ldap_users = OC_LDAP::fetchListOfUsers($this->ldapUserFilter, array(OC_LDAP::conf('ldapUserDisplayName'), 'dn'));
|
$ldap_users = OC_LDAP::fetchListOfUsers($this->ldapUserFilter, array(OC_LDAP::conf('ldapUserDisplayName'), 'dn'));
|
||||||
$users = OC_LDAP::ownCloudUserNames($ldap_users);
|
$this->_users = OC_LDAP::ownCloudUserNames($ldap_users);
|
||||||
return $users;
|
}
|
||||||
|
return $this->_users;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +124,7 @@ class OC_USER_LDAP extends OC_User_Backend {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function userExists($uid){
|
public function userExists($uid){
|
||||||
return in_array($uid, self::getUsers());
|
return in_array($uid, $this->getUsers());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ $(document).ready(function(){
|
||||||
function(result){
|
function(result){
|
||||||
if(result.status == 'success'){
|
if(result.status == 'success'){
|
||||||
// Download the file
|
// Download the file
|
||||||
window.location = OC.filePath('user_migrate','ajax','export.php?operation=download') ;
|
window.location = OC.linkTo('user_migrate','ajax/export.php') + '?operation=download';
|
||||||
$('.loading').hide();
|
$('.loading').hide();
|
||||||
$('#exportbtn').val(t('user_migrate', 'Export'));
|
$('#exportbtn').val(t('user_migrate', 'Export'));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,37 +3,66 @@
|
||||||
define("DEBUG", true);
|
define("DEBUG", true);
|
||||||
|
|
||||||
$CONFIG = array(
|
$CONFIG = array(
|
||||||
|
/* Flag to indicate OwnCloud is successfully installed (true = installed) */
|
||||||
"installed" => false,
|
"installed" => false,
|
||||||
|
/* Type of database, can be sqlite, mysql or pgsql */
|
||||||
"dbtype" => "sqlite",
|
"dbtype" => "sqlite",
|
||||||
|
/* Name of the OwnCloud database */
|
||||||
"dbname" => "owncloud",
|
"dbname" => "owncloud",
|
||||||
|
/* User to access the OwnCloud database */
|
||||||
"dbuser" => "",
|
"dbuser" => "",
|
||||||
|
/* Password to access the OwnCloud database */
|
||||||
"dbpassword" => "",
|
"dbpassword" => "",
|
||||||
|
/* Host running the OwnCloud database */
|
||||||
"dbhost" => "",
|
"dbhost" => "",
|
||||||
|
/* Prefix for the OwnCloud tables in the database */
|
||||||
"dbtableprefix" => "",
|
"dbtableprefix" => "",
|
||||||
|
/* Force use of HTTPS connection (true = use HTTPS) */
|
||||||
"forcessl" => false,
|
"forcessl" => false,
|
||||||
"enablebackup" => false,
|
/* Theme to use for OwnCloud */
|
||||||
"theme" => "",
|
"theme" => "",
|
||||||
|
/* Path to the 3rdparty directory */
|
||||||
"3rdpartyroot" => "",
|
"3rdpartyroot" => "",
|
||||||
|
/* URL to the 3rdparty directory, as seen by the browser */
|
||||||
"3rdpartyurl" => "",
|
"3rdpartyurl" => "",
|
||||||
|
/* Default app to load on login */
|
||||||
"defaultapp" => "files",
|
"defaultapp" => "files",
|
||||||
|
/* Enable the help menu item in the settings */
|
||||||
"knowledgebaseenabled" => true,
|
"knowledgebaseenabled" => true,
|
||||||
"knowledgebaseurl" => "",
|
/* URL to use for the help page, server should understand OCS */
|
||||||
|
"knowledgebaseurl" => "http://api.apps.owncloud.com/v1",
|
||||||
|
/* Enable installing apps from the appstore */
|
||||||
"appstoreenabled" => true,
|
"appstoreenabled" => true,
|
||||||
"appstoreurl" => "",
|
/* URL of the appstore to use, server should understand OCS */
|
||||||
|
"appstoreurl" => "http://api.apps.owncloud.com/v1",
|
||||||
|
/* Mode to use for sending mail, can be sendmail, smtp, qmail or php, see PHPMailer docs */
|
||||||
"mail_smtpmode" => "sendmail",
|
"mail_smtpmode" => "sendmail",
|
||||||
|
/* Host to use for sending mail, depends on mail_smtpmode if this is used */
|
||||||
"mail_smtphost" => "127.0.0.1",
|
"mail_smtphost" => "127.0.0.1",
|
||||||
|
/* authentication needed to send mail, depends on mail_smtpmode if this is used
|
||||||
|
* (false = disable authentication)
|
||||||
|
*/
|
||||||
"mail_smtpauth" => false,
|
"mail_smtpauth" => false,
|
||||||
|
/* Username to use for sendmail mail, depends on mail_smtpauth if this is used */
|
||||||
"mail_smtpname" => "",
|
"mail_smtpname" => "",
|
||||||
|
/* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
|
||||||
"mail_smtppassword" => "",
|
"mail_smtppassword" => "",
|
||||||
|
/* Check 3rdparty apps for malicious code fragments */
|
||||||
"appcodechecker" => "",
|
"appcodechecker" => "",
|
||||||
"log_type" => "",
|
/* Place to log to, can be owncloud and syslog (owncloud is log menu item in admin menu) */
|
||||||
|
"log_type" => "owncloud",
|
||||||
|
/* File for the owncloud logger to log to, (default is ownloud.log in the data dir */
|
||||||
"logfile" => "",
|
"logfile" => "",
|
||||||
|
/* Loglevel to start logging at. 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default is WARN) */
|
||||||
"loglevel" => "",
|
"loglevel" => "",
|
||||||
/* Set this to false to disable the check for writable apps dir.
|
/* Set this to false to disable the check for writable apps dir.
|
||||||
* If the apps dir is not writable, you can't download&install extra apps
|
* If the apps dir is not writable, you can't download&install extra apps
|
||||||
* in the admin apps menu.
|
* in the admin apps menu.
|
||||||
*/
|
*/
|
||||||
"writable_appsdir" => true,
|
"writable_appsdir" => true,
|
||||||
|
/* The directory where the user data is stored, default to data in the owncloud
|
||||||
|
* directory. The sqlite database is also stored here, when sqlite is used.
|
||||||
|
*/
|
||||||
// "datadirectory" => ""
|
// "datadirectory" => ""
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -23,7 +23,6 @@ if (isset($_POST['user'])) {
|
||||||
$msg = $tmpl->fetchPage();
|
$msg = $tmpl->fetchPage();
|
||||||
$l = OC_L10N::get('core');
|
$l = OC_L10N::get('core');
|
||||||
$from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
|
$from = 'lostpassword-noreply@' . OCP\Util::getServerHost();
|
||||||
$r=mail($email, $l->t('Owncloud password reset'), $msg, 'From:' . $from);
|
|
||||||
OC_MAIL::send($email,$_POST['user'],$l->t('ownCloud password reset'),$msg,$from,'ownCloud');
|
OC_MAIL::send($email,$_POST['user'],$l->t('ownCloud password reset'),$msg,$from,'ownCloud');
|
||||||
echo('sent');
|
echo('sent');
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<title>ownCloud</title>
|
<title>ownCloud</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" />
|
<link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" />
|
||||||
<?php if (!defined('DEBUG') || !DEBUG): ?>
|
<?php if (!empty(OC_Util::$core_styles)): ?>
|
||||||
<link rel="stylesheet" href="<?php echo OC_Helper::linkToRemote('core.css', false) ?>" type="text/css" media="screen" />
|
<link rel="stylesheet" href="<?php echo OC_Helper::linkToRemote('core.css', false) ?>" type="text/css" media="screen" />
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php foreach($_['cssfiles'] as $cssfile): ?>
|
<?php foreach($_['cssfiles'] as $cssfile): ?>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
var oc_webroot = '<?php echo OC::$WEBROOT; ?>';
|
var oc_webroot = '<?php echo OC::$WEBROOT; ?>';
|
||||||
var oc_appswebroot = '<?php echo OC::$APPSWEBROOT; ?>';
|
var oc_appswebroot = '<?php echo OC::$APPSWEBROOT; ?>';
|
||||||
</script>
|
</script>
|
||||||
<?php if (!defined('DEBUG') || !DEBUG): ?>
|
<?php if (!empty(OC_Util::$core_scripts)): ?>
|
||||||
<script type="text/javascript" src="<?php echo OC_Helper::linkToRemote('core.js', false) ?>"></script>
|
<script type="text/javascript" src="<?php echo OC_Helper::linkToRemote('core.js', false) ?>"></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<title><?php echo isset($_['application']) && !empty($_['application'])?$_['application'].' | ':'' ?>ownCloud <?php echo OC_User::getUser()?' ('.OC_User::getUser().') ':'' ?></title>
|
<title><?php echo isset($_['application']) && !empty($_['application'])?$_['application'].' | ':'' ?>ownCloud <?php echo OC_User::getUser()?' ('.OC_User::getUser().') ':'' ?></title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" />
|
<link rel="shortcut icon" href="<?php echo image_path('', 'favicon.png'); ?>" /><link rel="apple-touch-icon-precomposed" href="<?php echo image_path('', 'favicon-touch.png'); ?>" />
|
||||||
<?php if (!defined('DEBUG') || !DEBUG): ?>
|
<?php if (!empty(OC_Util::$core_styles)): ?>
|
||||||
<link rel="stylesheet" href="<?php echo OC_Helper::linkToRemote('core.css', false) ?>" type="text/css" media="screen" />
|
<link rel="stylesheet" href="<?php echo OC_Helper::linkToRemote('core.css', false) ?>" type="text/css" media="screen" />
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php foreach($_['cssfiles'] as $cssfile): ?>
|
<?php foreach($_['cssfiles'] as $cssfile): ?>
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
var oc_appswebroot = '<?php echo OC::$APPSWEBROOT; ?>';
|
var oc_appswebroot = '<?php echo OC::$APPSWEBROOT; ?>';
|
||||||
var oc_current_user = '<?php echo OC_User::getUser() ?>';
|
var oc_current_user = '<?php echo OC_User::getUser() ?>';
|
||||||
</script>
|
</script>
|
||||||
<?php if (!defined('DEBUG') || !DEBUG): ?>
|
<?php if (!empty(OC_Util::$core_scripts)): ?>
|
||||||
<script type="text/javascript" src="<?php echo OC_Helper::linkToRemote('core.js', false) ?>"></script>
|
<script type="text/javascript" src="<?php echo OC_Helper::linkToRemote('core.js', false) ?>"></script>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
<?php foreach($_['jsfiles'] as $jsfile): ?>
|
||||||
|
|
|
@ -67,6 +67,11 @@ class OC_App{
|
||||||
OC_Util::$scripts = array();
|
OC_Util::$scripts = array();
|
||||||
OC_Util::$core_styles = OC_Util::$styles;
|
OC_Util::$core_styles = OC_Util::$styles;
|
||||||
OC_Util::$styles = array();
|
OC_Util::$styles = array();
|
||||||
|
|
||||||
|
if (!OC_AppConfig::getValue('core', 'remote_core.css', false)) {
|
||||||
|
OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
|
||||||
|
OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return
|
// return
|
||||||
|
|
|
@ -426,11 +426,6 @@ class OC{
|
||||||
//make sure temporary files are cleaned up
|
//make sure temporary files are cleaned up
|
||||||
register_shutdown_function(array('OC_Helper','cleanTmp'));
|
register_shutdown_function(array('OC_Helper','cleanTmp'));
|
||||||
|
|
||||||
if (!OC_AppConfig::getValue('core', 'remote_core.css', false)) {
|
|
||||||
OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
|
|
||||||
OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
//parse the given parameters
|
//parse the given parameters
|
||||||
self::$REQUESTEDAPP = (isset($_GET['app'])?str_replace(array('\0', '/', '\\', '..'), '', strip_tags($_GET['app'])):OC_Config::getValue('defaultapp', 'files'));
|
self::$REQUESTEDAPP = (isset($_GET['app'])?str_replace(array('\0', '/', '\\', '..'), '', strip_tags($_GET['app'])):OC_Config::getValue('defaultapp', 'files'));
|
||||||
if(substr_count(self::$REQUESTEDAPP, '?') != 0){
|
if(substr_count(self::$REQUESTEDAPP, '?') != 0){
|
||||||
|
|
|
@ -10,7 +10,17 @@ class OC_Cache {
|
||||||
static protected $cache;
|
static protected $cache;
|
||||||
|
|
||||||
static protected function init() {
|
static protected function init() {
|
||||||
|
$fast_cache = null;
|
||||||
|
if (!$fast_cache && function_exists('xcache_set')) {
|
||||||
|
$fast_cache = new OC_Cache_XCache();
|
||||||
|
}
|
||||||
|
if (!$fast_cache && function_exists('apc_store')) {
|
||||||
|
$fast_cache = new OC_Cache_APC();
|
||||||
|
}
|
||||||
self::$cache = new OC_Cache_File();
|
self::$cache = new OC_Cache_File();
|
||||||
|
if ($fast_cache) {
|
||||||
|
self::$cache = new OC_Cache_Broker($fast_cache, self::$cache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function get($key) {
|
static public function get($key) {
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class OC_Cache_Broker {
|
||||||
|
protected $fast_cache;
|
||||||
|
protected $slow_cache;
|
||||||
|
|
||||||
|
public function __construct($fast_cache, $slow_cache) {
|
||||||
|
$this->fast_cache = $fast_cache;
|
||||||
|
$this->slow_cache = $slow_cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($key) {
|
||||||
|
if ($r = $this->fast_cache->get($key)) {
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
return $this->slow_cache->get($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set($key, $value, $ttl=0) {
|
||||||
|
$set_slow = strlen($value) > 8192;
|
||||||
|
if ($set_slow) {
|
||||||
|
if ($this->fast_cache->hasKey($key)) {
|
||||||
|
$this->fast_cache->remove($key);
|
||||||
|
}
|
||||||
|
$this->slow_cache->set($key, $value, $ttl);
|
||||||
|
} else {
|
||||||
|
$this->fast_cache->set($key, $value, $ttl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasKey($key) {
|
||||||
|
if ($this->fast_cache->hasKey($key)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->slow_cache->hasKey($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function remove($key) {
|
||||||
|
if ($this->fast_cache->remove($key)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $this->slow_cache->remove($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clear(){
|
||||||
|
$this->fast_cache->clear();
|
||||||
|
$this->slow_cache->clear();
|
||||||
|
}
|
||||||
|
}
|
|
@ -136,6 +136,8 @@ class OC_Image {
|
||||||
*/
|
*/
|
||||||
private function _output($filepath=null) {
|
private function _output($filepath=null) {
|
||||||
if($filepath) {
|
if($filepath) {
|
||||||
|
if (!file_exists(dirname($filepath)))
|
||||||
|
mkdir(dirname($filepath), 0777, true);
|
||||||
if(!is_writable(dirname($filepath))) {
|
if(!is_writable(dirname($filepath))) {
|
||||||
OC_Log::write('core',__METHOD__.'(): Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR);
|
OC_Log::write('core',__METHOD__.'(): Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR);
|
||||||
return false;
|
return false;
|
||||||
|
@ -426,7 +428,7 @@ class OC_Image {
|
||||||
if(is_resource($str)) {
|
if(is_resource($str)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->resource = imagecreatefromstring($str);
|
$this->resource = @imagecreatefromstring($str);
|
||||||
if(!$this->resource) {
|
if(!$this->resource) {
|
||||||
OC_Log::write('core','OC_Image->loadFromData, couldn\'t load', OC_Log::DEBUG);
|
OC_Log::write('core','OC_Image->loadFromData, couldn\'t load', OC_Log::DEBUG);
|
||||||
return false;
|
return false;
|
||||||
|
@ -445,7 +447,7 @@ class OC_Image {
|
||||||
}
|
}
|
||||||
$data = base64_decode($str);
|
$data = base64_decode($str);
|
||||||
if($data) { // try to load from string data
|
if($data) { // try to load from string data
|
||||||
$this->resource = imagecreatefromstring($data);
|
$this->resource = @imagecreatefromstring($data);
|
||||||
if(!$this->resource) {
|
if(!$this->resource) {
|
||||||
OC_Log::write('core','OC_Image->loadFromBase64, couldn\'t load', OC_Log::DEBUG);
|
OC_Log::write('core','OC_Image->loadFromBase64, couldn\'t load', OC_Log::DEBUG);
|
||||||
return false;
|
return false;
|
||||||
|
@ -496,6 +498,32 @@ class OC_Image {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function preciseResize($width, $height) {
|
||||||
|
if (!$this->valid()) {
|
||||||
|
OC_Log::write('core',__METHOD__.'(): No image loaded', OC_Log::ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$width_orig=imageSX($this->resource);
|
||||||
|
$height_orig=imageSY($this->resource);
|
||||||
|
$process = imagecreatetruecolor($width, $height);
|
||||||
|
|
||||||
|
if ($process == false) {
|
||||||
|
OC_Log::write('core',__METHOD__.'(): Error creating true color image',OC_Log::ERROR);
|
||||||
|
imagedestroy($process);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
|
||||||
|
if ($process == false) {
|
||||||
|
OC_Log::write('core',__METHOD__.'(): Error resampling process image '.$width.'x'.$height,OC_Log::ERROR);
|
||||||
|
imagedestroy($process);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
imagedestroy($this->resource);
|
||||||
|
$this->resource = $process;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Crops the image to the middle square. If the image is already square it just returns.
|
* @brief Crops the image to the middle square. If the image is already square it just returns.
|
||||||
* @param int maximum size for the result (optional)
|
* @param int maximum size for the result (optional)
|
||||||
|
|
|
@ -77,6 +77,10 @@ class OC_L10N{
|
||||||
* language.
|
* language.
|
||||||
*/
|
*/
|
||||||
public function __construct($app, $lang = null){
|
public function __construct($app, $lang = null){
|
||||||
|
$this->init($app, $lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init($app, $lang = null){
|
||||||
// Find the right language
|
// Find the right language
|
||||||
if(is_null($lang)){
|
if(is_null($lang)){
|
||||||
$lang = self::findLanguage($app);
|
$lang = self::findLanguage($app);
|
||||||
|
|
13
lib/mail.php
13
lib/mail.php
|
@ -88,19 +88,8 @@ class OC_Mail {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sending a mail based on a template
|
* return the footer for a mail
|
||||||
*
|
*
|
||||||
* @param texttemplate $texttemplate
|
|
||||||
* @param htmltemplate $htmltemplate
|
|
||||||
* @param data $data
|
|
||||||
* @param To $toaddress
|
|
||||||
* @param ToName $toname
|
|
||||||
* @param Subject $subject
|
|
||||||
* @param From $fromaddress
|
|
||||||
* @param FromName $fromname
|
|
||||||
* @param ccaddress $ccaddress
|
|
||||||
* @param ccname $ccname
|
|
||||||
* @param bcc $bcc
|
|
||||||
*/
|
*/
|
||||||
public static function getfooter() {
|
public static function getfooter() {
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,7 @@ class OC_OCSClient{
|
||||||
* This function returns the url of the OCS AppStore server. It´s possible to set it in the config file or it will fallback to the default
|
* This function returns the url of the OCS AppStore server. It´s possible to set it in the config file or it will fallback to the default
|
||||||
*/
|
*/
|
||||||
private static function getAppStoreURL(){
|
private static function getAppStoreURL(){
|
||||||
$configurl=OC_Config::getValue('appstoreurl', '');
|
$url = OC_Config::getValue('appstoreurl', 'http://api.apps.owncloud.com/v1');
|
||||||
if($configurl<>'') {
|
|
||||||
$url=$configurl;
|
|
||||||
}else{
|
|
||||||
$url='http://api.apps.owncloud.com/v1';
|
|
||||||
}
|
|
||||||
return($url);
|
return($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,12 +45,7 @@ class OC_OCSClient{
|
||||||
* This function returns the url of the OCS knowledge base server. It´s possible to set it in the config file or it will fallback to the default
|
* This function returns the url of the OCS knowledge base server. It´s possible to set it in the config file or it will fallback to the default
|
||||||
*/
|
*/
|
||||||
private static function getKBURL(){
|
private static function getKBURL(){
|
||||||
$configurl=OC_Config::getValue('knowledgebaseurl', '');
|
$url = OC_Config::getValue('knowledgebaseurl', 'http://api.apps.owncloud.com/v1');
|
||||||
if($configurl<>'') {
|
|
||||||
$url=$configurl;
|
|
||||||
}else{
|
|
||||||
$url='http://api.apps.owncloud.com/v1';
|
|
||||||
}
|
|
||||||
return($url);
|
return($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
<?php foreach($_["kbe"] as $kb): ?>
|
<?php foreach($_["kbe"] as $kb): ?>
|
||||||
<div class="helpblock">
|
<div class="helpblock">
|
||||||
<?php if($kb["preview1"] <> "") { echo('<img class="preview" src="'.$kb["preview1"].'" />'); } ?>
|
<?php if($kb["preview1"] <> "") { echo('<img class="preview" src="'.$kb["preview1"].'" />'); } ?>
|
||||||
<?php if($kb['detailpage']<>'') echo('<p><a target="_blank" href="'.$kb['detailpage'].'"><strong>'.$kb["name"].'</strong></a></p>');?>
|
<?php if($kb['detailpage']<>'') echo('<p><a target="_blank" href="'.$kb['detailpage'].'"><strong>'.htmlentities($kb["name"]).'</strong></a></p>');?>
|
||||||
<p><?php echo $kb['description'];?></p>
|
<p><?php echo htmlentities($kb['description']);?></p>
|
||||||
<?php if($kb['answer']<>'') echo('<p><strong>'.$l->t('Answer').':</strong><p>'.$kb['answer'].'</p>');?>
|
<?php if($kb['answer']<>'') echo('<p><strong>'.$l->t('Answer').':</strong><p>'.htmlentities($kb['answer']).'</p>');?>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach;
|
<?php endforeach;
|
||||||
endif?>
|
endif?>
|
||||||
|
|
Loading…
Reference in New Issue