mirror of
https://github.com/nextcloud/server.git
synced 2026-04-25 08:08:33 -04:00
Merge branch 'master' into sabredav_1.6
This commit is contained in:
commit
536a3ecb42
16 changed files with 143 additions and 55 deletions
|
|
@ -1,3 +1,4 @@
|
|||
ErrorDocument 403 /core/templates/403.php
|
||||
ErrorDocument 404 /core/templates/404.php
|
||||
<IfModule mod_php5.c>
|
||||
php_value upload_max_filesize 512M
|
||||
|
|
|
|||
7
AUTHORS
7
AUTHORS
|
|
@ -5,6 +5,13 @@ ownCloud is written by:
|
|||
Jan-Christoph Borchardt
|
||||
Michael Gapczynski
|
||||
Arthur Schiwon
|
||||
Bart Visscher
|
||||
Georg Ehrke
|
||||
Brice Maron
|
||||
Tom Needham
|
||||
Marvin Thomas Rabe
|
||||
Florian Pritz
|
||||
Bartek Przybylski
|
||||
…
|
||||
|
||||
With help from many libraries and frameworks including:
|
||||
|
|
|
|||
|
|
@ -122,13 +122,4 @@ if(!OC_Contacts_VCard::edit($id,$vcard)) {
|
|||
exit();
|
||||
}
|
||||
|
||||
$adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
|
||||
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
|
||||
|
||||
$tmpl = new OC_Template('contacts','part.property');
|
||||
$tmpl->assign('adr_types',$adr_types);
|
||||
$tmpl->assign('phone_types',$phone_types);
|
||||
$tmpl->assign('property',OC_Contacts_VCard::structureProperty($property,$line));
|
||||
$page = $tmpl->fetchPage();
|
||||
|
||||
OC_JSON::success(array('data' => array( 'checksum' => $checksum, 'page' => $page )));
|
||||
OC_JSON::success(array('data' => array( 'checksum' => $checksum )));
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ function bailOut($msg) {
|
|||
function debug($msg) {
|
||||
OC_Log::write('contacts','ajax/saveproperty.php: '.$msg, OC_Log::DEBUG);
|
||||
}
|
||||
foreach ($_POST as $key=>$element) {
|
||||
debug('_POST: '.$key.'=>'.print_r($element, true));
|
||||
}
|
||||
// foreach ($_POST as $key=>$element) {
|
||||
// debug('_POST: '.$key.'=>'.print_r($element, true));
|
||||
// }
|
||||
|
||||
$id = isset($_POST['id'])?$_POST['id']:null;
|
||||
$name = isset($_POST['name'])?$_POST['name']:null;
|
||||
|
|
@ -83,16 +83,38 @@ if($element != $name) {
|
|||
bailOut(OC_Contacts_App::$l10n->t('Something went FUBAR. ').$name.' != '.$element);
|
||||
}
|
||||
|
||||
/* preprocessing value */
|
||||
switch($element) {
|
||||
case 'BDAY':
|
||||
$date = New DateTime($value);
|
||||
//$vcard->setDateTime('BDAY', $date, Sabre_VObject_Element_DateTime::DATE);
|
||||
$value = $date->format(DateTime::ATOM);
|
||||
break;
|
||||
case 'FN':
|
||||
if(!$value) {
|
||||
// create a method thats returns an alternative for FN.
|
||||
//$value = getOtherValue();
|
||||
}
|
||||
break;
|
||||
case 'CATEGORIES':
|
||||
/* multi autocomplete triggers an save with empty value */
|
||||
if (!$value) {
|
||||
$value = $vcard->getAsString('CATEGORIES');
|
||||
}
|
||||
break;
|
||||
case 'EMAIL':
|
||||
$value = strtolower($value);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!$value) {
|
||||
bailOut(OC_Contacts_App::$l10n->t('Cannot save empty value.'));
|
||||
}
|
||||
|
||||
/* setting value */
|
||||
switch($element) {
|
||||
case 'BDAY':
|
||||
case 'FN':
|
||||
case 'N':
|
||||
case 'ORG':
|
||||
case 'NOTE':
|
||||
|
|
@ -102,7 +124,6 @@ switch($element) {
|
|||
$vcard->setString($name, $value);
|
||||
break;
|
||||
case 'EMAIL':
|
||||
$value = strtolower($value);
|
||||
case 'TEL':
|
||||
case 'ADR': // should I delete the property if empty or throw an error?
|
||||
debug('Setting element: (EMAIL/TEL/ADR)'.$element);
|
||||
|
|
|
|||
|
|
@ -613,10 +613,12 @@ Contacts={
|
|||
this.loadPhoto(true);
|
||||
$('#file_upload_form').show();
|
||||
$('#contacts_propertymenu a[data-type="'+type+'"]').parent().hide();
|
||||
$('#file_upload_start').trigger('click');
|
||||
break;
|
||||
case 'NOTE':
|
||||
$('#note').show();
|
||||
$('#contacts_propertymenu a[data-type="'+type+'"]').parent().hide();
|
||||
$('#note').find('textarea').focus();
|
||||
break;
|
||||
case 'EMAIL':
|
||||
if($('#emaillist>li').length == 1) {
|
||||
|
|
@ -644,6 +646,7 @@ Contacts={
|
|||
case 'BDAY':
|
||||
case 'CATEGORIES':
|
||||
$('dl dt[data-element="'+type+'"],dd[data-element="'+type+'"]').show();
|
||||
$('dd[data-element="'+type+'"]').find('input').focus();
|
||||
$('#contacts_propertymenu a[data-type="'+type+'"]').parent().hide();
|
||||
break;
|
||||
}
|
||||
|
|
@ -667,9 +670,16 @@ Contacts={
|
|||
console.log('NOTE or PHOTO');
|
||||
Contacts.UI.propertyContainerFor(obj).hide();
|
||||
Contacts.UI.propertyContainerFor(obj).data('checksum', '');
|
||||
if(proptype == 'PHOTO') {
|
||||
console.log('Delete PHOTO');
|
||||
Contacts.UI.Contacts.refreshThumbnail(Contacts.UI.Card.id);
|
||||
} else if(proptype == 'NOTE') {
|
||||
$('#note').find('textarea').val('');
|
||||
}
|
||||
} else {
|
||||
$('dl dt[data-element="'+proptype+'"],dd[data-element="'+proptype+'"]').hide();
|
||||
$('dl dd[data-element="'+proptype+'"]').data('checksum', '');
|
||||
$('dl dd[data-element="'+proptype+'"]').find('input').val('');
|
||||
}
|
||||
$('#contacts_propertymenu a[data-type="'+proptype+'"]').parent().show();
|
||||
Contacts.UI.loading(obj, false);
|
||||
|
|
@ -990,7 +1000,7 @@ Contacts={
|
|||
OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
|
||||
}
|
||||
});
|
||||
$('#contacts [data-id="'+this.id+'"]').find('a').css('background','url(thumbnail.php?id='+this.id+'&refresh=1'+Math.random()+') no-repeat');
|
||||
Contacts.UI.Contacts.refreshThumbnail(this.id);
|
||||
},
|
||||
addMail:function() {
|
||||
//alert('addMail');
|
||||
|
|
@ -1192,6 +1202,9 @@ Contacts={
|
|||
$(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat');
|
||||
}
|
||||
});
|
||||
},
|
||||
refreshThumbnail:function(id){
|
||||
$('#contacts [data-id="'+id+'"]').find('a').css('background','url(thumbnail.php?id='+id+'&refresh=1'+Math.random()+') no-repeat');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,25 @@
|
|||
(function( $ ) {
|
||||
$.widget('ui.multiple_autocomplete', {
|
||||
_create: function() {
|
||||
var self = this;
|
||||
function split( val ) {
|
||||
return val.split( /,\s*/ );
|
||||
}
|
||||
function extractLast( term ) {
|
||||
return split( term ).pop();
|
||||
}
|
||||
function showOptions() {
|
||||
if(!self.element.autocomplete('widget').is(':visible') && self.element.val().trim() == '') {
|
||||
self.element.autocomplete('search', '');
|
||||
}
|
||||
}
|
||||
//console.log('_create: ' + this.options['id']);
|
||||
var self = this;
|
||||
this.element.bind('click', function( event ) {
|
||||
showOptions();
|
||||
});
|
||||
this.element.bind('input', function( event ) {
|
||||
showOptions();
|
||||
});
|
||||
this.element.bind('blur', function( event ) {
|
||||
var tmp = self.element.val().trim();
|
||||
if(tmp[tmp.length-1] == ',') {
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ class OC_Contacts_VCard{
|
|||
* @param string $uri the uri of the card, default based on the UID
|
||||
* @return insertid on success or null if no card.
|
||||
*/
|
||||
public static function add($aid, $card, $uri=null){
|
||||
public static function add($aid, OC_VObject $card, $uri=null){
|
||||
if(is_null($card)){
|
||||
OC_Log::write('contacts','OC_Contacts_VCard::add. No vCard supplied', OC_Log::ERROR);
|
||||
return null;
|
||||
|
|
@ -267,7 +267,7 @@ class OC_Contacts_VCard{
|
|||
*/
|
||||
public static function addFromDAVData($id,$uri,$data){
|
||||
$card = OC_VObject::parse($data);
|
||||
return self::add($id, $data, $uri);
|
||||
return self::add($id, $card, $uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
</select><a id="edit_name" class="action edit" title="<?php echo $l->t('Edit name details'); ?>"></a>
|
||||
</dd>
|
||||
<dt style="display:none;" id="org_label" data-element="ORG"><label for="org"><?php echo $l->t('Organization'); ?></label></dt>
|
||||
<dd style="display:none;" class="propertycontainer" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dd style="display:none;" class="propertycontainer" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dt style="display:none;" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt>
|
||||
<dd style="display:none;" class="propertycontainer" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dd style="display:none;" class="propertycontainer" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dt style="display:none;" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt>
|
||||
<dd style="display:none;" class="propertycontainer" id="bday_value" data-element="BDAY"><input id="bday" required="required" name="value" type="text" class="contacts_property" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dd style="display:none;" class="propertycontainer" id="bday_value" data-element="BDAY"><input id="bday" required="required" name="value" type="text" class="contacts_property" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<!-- dt id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Categories'); ?></label></dt>
|
||||
<dd class="propertycontainer" id="categories_value" data-element="CATEGORIES">
|
||||
<select class="contacts_property" multiple="multiple" id="categories" name="value[]">
|
||||
|
|
@ -64,11 +64,11 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a>
|
||||
</dd -->
|
||||
<dt style="display:none;" id="categories_label" data-element="CATEGORIES"><label for="categories"><?php echo $l->t('Categories'); ?></label></dt>
|
||||
<dd style="display:none;" class="propertycontainer" id="categories_value" data-element="CATEGORIES"><input id="categories" required="required" name="value[CATEGORIES]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Categories'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a><a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a></dd>
|
||||
<dd style="display:none;" class="propertycontainer" id="categories_value" data-element="CATEGORIES"><input id="categories" required="required" name="value[CATEGORIES]" type="text" class="contacts_property" style="width:16em;" name="value" value="" placeholder="<?php echo $l->t('Categories'); ?>" /><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a><a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"></a></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset id="note" class="formfloat propertycontainer contactpart" style="display:none;" data-element="NOTE">
|
||||
<legend><?php echo $l->t('Note'); ?><a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></legend>
|
||||
<legend><?php echo $l->t('Note'); ?><a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'single');" title="<?php echo $l->t('Delete'); ?>"></a></legend>
|
||||
<textarea class="contacts_property note" name="value" cols="60" rows="10"></textarea>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -84,8 +84,8 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<ul id="emaillist" class="propertylist">
|
||||
<li class="template" style="white-space: nowrap; display: none;" data-element="EMAIL">
|
||||
<input type="checkbox" class="contacts_property" name="parameters[TYPE][]" value="PREF" title="<?php echo $l->t('Preferred'); ?>" />
|
||||
<input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
|
||||
<input type="email" required="required" class="nonempty contacts_property" style="width:15em;" name="value" value="" x-moz-errormessage="<?php echo $l->t('Please specify a valid email address.'); ?>" placeholder="<?php echo $l->t('Enter email address'); ?>" /><span class="listactions"><a onclick="Contacts.UI.mailTo(this)" class="action mail" title="<?php echo $l->t('Mail to address'); ?>"></a>
|
||||
<a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete email address'); ?>"></a></span></li>
|
||||
</ul><!-- a id="add_email" class="add" title="<?php echo $l->t('Add email address'); ?>"></a -->
|
||||
</div> <!-- email addresses-->
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<select multiple="multiple" name="parameters[TYPE][]">
|
||||
<?php echo html_select_options($_['phone_types'], array()) ?>
|
||||
</select>
|
||||
<a class="delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
|
||||
<a class="action delete" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="<?php echo $l->t('Delete phone number'); ?>"></a></li>
|
||||
</ul><!-- a id="add_phone" class="add" title="<?php echo $l->t('Add phone number'); ?>"></a -->
|
||||
</div> <!-- Phone numbers -->
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<dl class="addresscard template" style="display: none;" data-element="ADR"><dt>
|
||||
<input class="adr contacts_property" name="value" type="hidden" value="" />
|
||||
<input type="hidden" class="adr_type contacts_property" name="parameters[TYPE][]" value="" />
|
||||
<span class="adr_type_label"></span><a class="globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
|
||||
<span class="adr_type_label"></span><a class="action globe" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.searchOSM(this);" title="<?php echo $l->t('View on map'); ?>"></a><a class="action edit" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.editAddress(this, false);" title="<?php echo $l->t('Edit address details'); ?>"></a><a class="action delete" style="float:right;" onclick="$(this).tipsy('hide');Contacts.UI.Card.deleteProperty(this, 'list');" title="Delete address"></a>
|
||||
</dt><dd><ul class="addresslist"></ul></dd></dl>
|
||||
|
||||
</fieldset>
|
||||
|
|
|
|||
|
|
@ -66,12 +66,15 @@ class OC_Gallery_Photo {
|
|||
$stmt->execute(array($newpath, $newAlbumId, $oldAlbumId, $oldpath));
|
||||
}
|
||||
|
||||
public static function getThumbnail($image_name, $owner = null) {
|
||||
if (!$owner) $owner = OC_User::getUser();
|
||||
$save_dir = OC_Config::getValue("datadirectory").'/'. $owner .'/gallery/';
|
||||
public static function getThumbnail($image_name, $owner = null) {
|
||||
if (!$owner) $owner = OC_User::getUser();
|
||||
$save_dir = OC_Config::getValue("datadirectory").'/'. $owner .'/gallery/';
|
||||
$save_dir .= dirname($image_name). '/';
|
||||
$image_path = $image_name;
|
||||
$thumb_file = $save_dir . basename($image_name);
|
||||
if (!is_dir($save_dir)) {
|
||||
mkdir($save_dir, 0777, true);
|
||||
}
|
||||
if (file_exists($thumb_file)) {
|
||||
$image = new OC_Image($thumb_file);
|
||||
} else {
|
||||
|
|
@ -81,17 +84,15 @@ class OC_Gallery_Photo {
|
|||
}
|
||||
$image = new OC_Image($image_path);
|
||||
if ($image->valid()) {
|
||||
$image->centerCrop();
|
||||
$image->resize(200);
|
||||
$image->centerCrop(200);
|
||||
$image->fixOrientation();
|
||||
if (!is_dir($save_dir)) {
|
||||
mkdir($save_dir, 0777, true);
|
||||
}
|
||||
$image->save($thumb_file);
|
||||
}
|
||||
}
|
||||
if ($image->valid()) {
|
||||
return $image;
|
||||
}else{
|
||||
$image->destroy();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,9 +78,11 @@ class OC_Gallery_Scanner {
|
|||
$image = OC_Gallery_Photo::getThumbnail($files[$i]);
|
||||
if ($image && $image->valid()) {
|
||||
imagecopyresampled($thumbnail, $image->resource(), $i*200, 0, 0, 0, 200, 200, 200, 200);
|
||||
$image->destroy();
|
||||
}
|
||||
}
|
||||
imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/' . $albumName.'.png');
|
||||
imagedestroy($thumbnail);
|
||||
}
|
||||
|
||||
public static function createIntermediateAlbums() {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Set the app specific values in your javascript file. This is what I've used for
|
|||
OCCategories.app = 'contacts';
|
||||
OCCategories.changed = Contacts.UI.Card.categoriesChanged;
|
||||
|
||||
If OCCategories.changed point is set that function will be called each time the categories have been changed
|
||||
If OCCategories.changed is set that function will be called each time the categories have been changed
|
||||
in the editor (add/delete/rescan) to allow the app to update the UI accordingly. The only argument to the function
|
||||
is an array of the updated categories e.g.:
|
||||
|
||||
|
|
@ -25,4 +25,9 @@ OCCategories.changed = function(categories) {
|
|||
for(var category in categories) {
|
||||
console.log(categories[category]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
To show the categories editor call:
|
||||
|
||||
OCCategories.edit()
|
||||
|
||||
|
|
|
|||
15
core/templates/403.php
Normal file
15
core/templates/403.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
if(!isset($_)){//also provide standalone error page
|
||||
require_once '../../lib/base.php';
|
||||
|
||||
$tmpl = new OC_Template( '', '403', 'guest' );
|
||||
$tmpl->printPage();
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<ul>
|
||||
<li class='error'>
|
||||
<?php echo $l->t( 'Access forbidden' ); ?><br/>
|
||||
<p class='hint'><?php if(isset($_['file'])) echo $_['file']?></p>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -63,8 +63,8 @@ class OC_Files {
|
|||
$executionTime = intval(ini_get('max_execution_time'));
|
||||
set_time_limit(0);
|
||||
$zip = new ZipArchive();
|
||||
$filename = get_temp_dir()."/ownCloud.zip";
|
||||
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
|
||||
$filename = get_temp_dir().'/ownCloud_'.mt_rand(10000,99999).'.zip';
|
||||
if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) {
|
||||
exit("cannot open <$filename>\n");
|
||||
}
|
||||
foreach($files as $file){
|
||||
|
|
@ -84,8 +84,8 @@ class OC_Files {
|
|||
$executionTime = intval(ini_get('max_execution_time'));
|
||||
set_time_limit(0);
|
||||
$zip = new ZipArchive();
|
||||
$filename = get_temp_dir()."/ownCloud.zip";
|
||||
if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
|
||||
$filename = get_temp_dir().'/ownCloud_'.mt_rand(10000,99999).'.zip';
|
||||
if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)!==TRUE) {
|
||||
exit("cannot open <$filename>\n");
|
||||
}
|
||||
$file=$dir.'/'.$files;
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@
|
|||
|
||||
class OC_FilesystemView {
|
||||
private $fakeRoot='';
|
||||
|
||||
|
||||
public function __construct($root){
|
||||
$this->fakeRoot=$root;
|
||||
}
|
||||
|
||||
|
||||
public function getAbsolutePath($path){
|
||||
if(!$path){
|
||||
$path='/';
|
||||
|
|
@ -141,7 +141,7 @@ class OC_FilesystemView {
|
|||
while (!feof($handle)) {
|
||||
echo fread($handle, $chunkSize);
|
||||
@ob_flush();
|
||||
flush();
|
||||
flush();
|
||||
}
|
||||
return $this->filesize($path);
|
||||
}
|
||||
|
|
@ -282,7 +282,8 @@ class OC_FilesystemView {
|
|||
if($source){
|
||||
$extention=substr($path,strrpos($path,'.'));
|
||||
$tmpFile=OC_Helper::tmpFile($extention);
|
||||
return file_put_contents($tmpFile,$source);
|
||||
file_put_contents($tmpFile,$source);
|
||||
return $tmpFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class OC_Image {
|
|||
OC_Log::write('core','OC_Image->fixOrientation() No readable file path set.', OC_Log::DEBUG);
|
||||
return false;
|
||||
}
|
||||
$exif = @exif_read_data($this->filepath, 'IFD0');
|
||||
$exif = @exif_read_data($this->filepath, 'IFD0');
|
||||
if(!$exif) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -267,6 +267,7 @@ class OC_Image {
|
|||
if($res) {
|
||||
if(imagealphablending($res, true)) {
|
||||
if(imagesavealpha($res, true)) {
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $res;
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -317,10 +318,7 @@ class OC_Image {
|
|||
*/
|
||||
public function loadFromFileHandle($handle) {
|
||||
OC_Log::write('core',__METHOD__.'(): Trying', OC_Log::DEBUG);
|
||||
$contents = '';
|
||||
while (!feof($handle)) {
|
||||
$contents .= fread($handle, 8192);
|
||||
}
|
||||
$contents = stream_get_contents($handle);
|
||||
if($this->loadFromData($contents)) {
|
||||
return $this->resource;
|
||||
}
|
||||
|
|
@ -486,22 +484,24 @@ class OC_Image {
|
|||
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.
|
||||
* @param int maximum size for the result (optional)
|
||||
* @returns bool for success or failure
|
||||
*/
|
||||
public function centerCrop() {
|
||||
public function centerCrop($size=0) {
|
||||
if(!$this->valid()) {
|
||||
OC_Log::write('core','OC_Image->centerCrop, No image loaded', OC_Log::ERROR);
|
||||
return false;
|
||||
}
|
||||
$width_orig=imageSX($this->resource);
|
||||
$height_orig=imageSY($this->resource);
|
||||
if($width_orig === $height_orig) {
|
||||
if($width_orig === $height_orig and $size==0) {
|
||||
return true;
|
||||
}
|
||||
$ratio_orig = $width_orig/$height_orig;
|
||||
|
|
@ -514,18 +514,26 @@ class OC_Image {
|
|||
$y = ($height_orig/2) - ($height/2);
|
||||
$x = 0;
|
||||
}
|
||||
$process = imagecreatetruecolor($width, $height);
|
||||
if($size>0){
|
||||
$targetWidth=$size;
|
||||
$targetHeight=$size;
|
||||
}else{
|
||||
$targetWidth=$width;
|
||||
$targetHeight=$height;
|
||||
}
|
||||
$process = imagecreatetruecolor($targetWidth, $targetHeight);
|
||||
if ($process == false) {
|
||||
OC_Log::write('core','OC_Image->centerCrop. Error creating true color image',OC_Log::ERROR);
|
||||
imagedestroy($process);
|
||||
return false;
|
||||
}
|
||||
imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $width, $height, $width, $height);
|
||||
imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
|
||||
if ($process == false) {
|
||||
OC_Log::write('core','OC_Image->centerCrop. Error resampling process image '.$width.'x'.$height,OC_Log::ERROR);
|
||||
imagedestroy($process);
|
||||
return false;
|
||||
}
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $process;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -558,7 +566,19 @@ class OC_Image {
|
|||
imagedestroy($process);
|
||||
return false;
|
||||
}
|
||||
imagedestroy($this->resource);
|
||||
$this->resource = $process;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function destroy(){
|
||||
if($this->valid()){
|
||||
imagedestroy($this->resource);
|
||||
}
|
||||
$this->resource=null;
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
$this->destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ OC.Log={
|
|||
row.append(messageTd);
|
||||
|
||||
var timeTd=$('<td/>');
|
||||
timeTd.text(formatDate(entry.time));
|
||||
timeTd.text(formatDate(entry.time*1000));
|
||||
row.append(timeTd);
|
||||
$('#log').append(row);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue