From decd0dc035cce0918519bef77742ff87db23e3f3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 12 Jun 2019 11:27:39 +0200 Subject: more work on event item deletion --- include/items.php | 12 +++++++++++- include/zot.php | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 95b696034..b6d8eb652 100755 --- a/include/items.php +++ b/include/items.php @@ -3740,6 +3740,13 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal if($ok_to_delete) { + if ($item['resource_type'] === 'event') { + $x = q("delete from event where event_hash = '%s' and uid = %d", + dbesc($item['resource_id']), + intval($item['uid']) + ); + } + // set the deleted flag immediately on this item just in case the // hook calls a remote process which loops. We'll delete it properly in a second. @@ -3816,7 +3823,10 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal */ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) { - $linked_item = (($item['resource_id']) ? true : false); + //$linked_item = (($item['resource_id']) ? true : false); + + $linked_resource_types = [ 'photo' ]; + $linked_item = (($item['resource_id'] && $item['resource_type'] && in_array($item['resource_type'], $linked_resource_types)) ? true : false); logger('item: ' . $item['id'] . ' stage: ' . $stage . ' force: ' . $force, LOGGER_DATA); diff --git a/include/zot.php b/include/zot.php index a37b7cdb5..9dd9aceff 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2278,6 +2278,25 @@ function delete_imported_item($sender, $item, $uid, $relay) { return false; } + if ($item['obj_type'] == ACTIVITY_OBJ_EVENT) { + $i = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", + dbesc($item['uuid']), + intval($uid) + ); + if ($i) { + if ($i[0]['event_xchan'] === $sender['hash']) { + q("delete from event where event_hash = '%s' and uid = %d", + dbesc($item['uuid']), + intval($uid) + ); + } + else { + logger('delete linked event: not owner'); + return; + } + } + } + require_once('include/items.php'); if($item_found) { -- cgit v1.2.3 From bc34167c8490c2dad5fcd6553b27b5df54449c39 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 12 Jun 2019 12:46:29 +0200 Subject: port delete fixes from zap --- include/zot.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/zot.php b/include/zot.php index 9dd9aceff..5fd900765 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2241,7 +2241,7 @@ function delete_imported_item($sender, $item, $uid, $relay) { $item_found = false; $post_id = 0; - $r = q("select id, author_xchan, owner_xchan, source_xchan, item_deleted from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' ) + $r = q("select * from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' ) and mid = '%s' and uid = %d limit 1", dbesc($sender['hash']), dbesc($sender['hash']), @@ -2251,10 +2251,13 @@ function delete_imported_item($sender, $item, $uid, $relay) { ); if($r) { - if($r[0]['author_xchan'] === $sender['hash'] || $r[0]['owner_xchan'] === $sender['hash'] || $r[0]['source_xchan'] === $sender['hash']) + + $stored = $r[0]; + + if($stored['author_xchan'] === $sender['hash'] || $stored['owner_xchan'] === $sender['hash'] || $stored['source_xchan'] === $sender['hash']) $ownership_valid = true; - $post_id = $r[0]['id']; + $post_id = $stored['id']; $item_found = true; } else { @@ -2278,15 +2281,15 @@ function delete_imported_item($sender, $item, $uid, $relay) { return false; } - if ($item['obj_type'] == ACTIVITY_OBJ_EVENT) { + if ($stored['resource_type'] === 'event') { $i = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", - dbesc($item['uuid']), + dbesc($stored['resource_id']), intval($uid) ); if ($i) { if ($i[0]['event_xchan'] === $sender['hash']) { q("delete from event where event_hash = '%s' and uid = %d", - dbesc($item['uuid']), + dbesc($stored['resource_id']), intval($uid) ); } @@ -2300,7 +2303,7 @@ function delete_imported_item($sender, $item, $uid, $relay) { require_once('include/items.php'); if($item_found) { - if(intval($r[0]['item_deleted'])) { + if(intval($stored['item_deleted'])) { logger('delete_imported_item: item was already deleted'); if(! $relay) return false; @@ -2312,10 +2315,10 @@ function delete_imported_item($sender, $item, $uid, $relay) { // back, and we aren't going to (or shouldn't at any rate) delete it again in the future - so losing // this information from the metadata should have no other discernible impact. - if (($r[0]['id'] != $r[0]['parent']) && intval($r[0]['item_origin'])) { + if (($stored['id'] != $stored['parent']) && intval($stored['item_origin'])) { q("update item set item_origin = 0 where id = %d and uid = %d", - intval($r[0]['id']), - intval($r[0]['uid']) + intval($stored['id']), + intval($stored['uid']) ); } } -- cgit v1.2.3 From 801ab611ede45921d1d6869fa65fc3fbf941d666 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 13 Jun 2019 13:34:04 +0200 Subject: more work on linked item/resource deletion for photos and events, deprecate the force flag in drop_item() and comment out goaway() in drop_item(). --- include/attach.php | 7 +++- include/items.php | 115 ++++++++++++++++++++++------------------------------- 2 files changed, 53 insertions(+), 69 deletions(-) (limited to 'include') diff --git a/include/attach.php b/include/attach.php index f169e0669..80efe0838 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1514,12 +1514,15 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { function attach_drop_photo($channel_id,$resource) { - $x = q("select id, item_hidden from item where resource_id = '%s' and resource_type = 'photo' and uid = %d", + $x = q("select id, item_hidden from item where resource_id = '%s' and resource_type = 'photo' and uid = %d and item_deleted = 0", dbesc($resource), intval($channel_id) ); + if($x) { - drop_item($x[0]['id'],false,(($x[0]['item_hidden']) ? DROPITEM_NORMAL : DROPITEM_PHASE1),true); + $stage = (($x[0]['item_hidden']) ? DROPITEM_NORMAL : DROPITEM_PHASE1); + $interactive = (($x[0]['item_hidden']) ? false : true); + drop_item($x[0]['id'], $interactive, $stage); } $r = q("SELECT content FROM photo WHERE resource_id = '%s' AND uid = %d AND os_storage = 1", diff --git a/include/items.php b/include/items.php index b6d8eb652..35a5a6124 100755 --- a/include/items.php +++ b/include/items.php @@ -3663,7 +3663,7 @@ function retain_item($id) { ); } -function drop_items($items,$interactive = false,$stage = DROPITEM_NORMAL,$force = false) { +function drop_items($items,$interactive = false,$stage = DROPITEM_NORMAL) { $uid = 0; if(! local_channel() && ! remote_channel()) @@ -3671,7 +3671,7 @@ function drop_items($items,$interactive = false,$stage = DROPITEM_NORMAL,$force if(count($items)) { foreach($items as $item) { - $owner = drop_item($item,$interactive,$stage,$force); + $owner = drop_item($item,$interactive,$stage); if($owner && ! $uid) $uid = $owner; } @@ -3694,12 +3694,7 @@ function drop_items($items,$interactive = false,$stage = DROPITEM_NORMAL,$force // $stage = 1 => set deleted flag on the item and perform intial notifications // $stage = 2 => perform low level delete at a later stage -function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = false) { - - // These resource types have linked items that should only be removed at the same time - // as the linked resource; if we encounter one set it to item_hidden rather than item_deleted. - - $linked_resource_types = [ 'photo' ]; +function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) { // locate item to be deleted @@ -3711,13 +3706,11 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal if(! $interactive) return 0; notice( t('Item not found.') . EOL); - goaway(z_root() . '/' . $_SESSION['return_url']); + //goaway(z_root() . '/' . $_SESSION['return_url']); } $item = $r[0]; - $linked_item = (($item['resource_id'] && $item['resource_type'] && in_array($item['resource_type'], $linked_resource_types)) ? true : false); - $ok_to_delete = false; // system deletion @@ -3740,26 +3733,12 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal if($ok_to_delete) { - if ($item['resource_type'] === 'event') { - $x = q("delete from event where event_hash = '%s' and uid = %d", - dbesc($item['resource_id']), - intval($item['uid']) - ); - } - // set the deleted flag immediately on this item just in case the // hook calls a remote process which loops. We'll delete it properly in a second. - if(($linked_item) && (! $force)) { - $r = q("UPDATE item SET item_hidden = 1 WHERE id = %d", - intval($item['id']) - ); - } - else { - $r = q("UPDATE item SET item_deleted = 1 WHERE id = %d", - intval($item['id']) - ); - } + $r = q("UPDATE item SET item_deleted = 1 WHERE id = %d", + intval($item['id']) + ); $arr = [ 'item' => $item, @@ -3799,14 +3778,13 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal if((intval($item['item_wall']) && ($stage != DROPITEM_PHASE2)) || ($stage == DROPITEM_PHASE1)) { Master::Summon([ 'Notifier','drop',$notify_id ]); } - - goaway(z_root() . '/' . $_SESSION['return_url']); + //goaway(z_root() . '/' . $_SESSION['return_url']); } else { if(! $interactive) return 0; notice( t('Permission denied.') . EOL); - goaway(z_root() . '/' . $_SESSION['return_url']); + //goaway(z_root() . '/' . $_SESSION['return_url']); } } @@ -3821,14 +3799,9 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal * @param boolean $force * @return boolean */ -function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) { - - //$linked_item = (($item['resource_id']) ? true : false); - - $linked_resource_types = [ 'photo' ]; - $linked_item = (($item['resource_id'] && $item['resource_type'] && in_array($item['resource_type'], $linked_resource_types)) ? true : false); +function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL) { - logger('item: ' . $item['id'] . ' stage: ' . $stage . ' force: ' . $force, LOGGER_DATA); + logger('item: ' . $item['id'] . ' stage: ' . $stage, LOGGER_DATA); switch($stage) { case DROPITEM_PHASE2: @@ -3841,42 +3814,50 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) { break; case DROPITEM_PHASE1: - if($linked_item && ! $force) { - $r = q("UPDATE item SET item_hidden = 1, - changed = '%s', edited = '%s' WHERE id = %d", - dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval($item['id']) - ); - } - else { - $r = q("UPDATE item set item_deleted = 1, changed = '%s', edited = '%s' where id = %d", - dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval($item['id']) - ); - } - + $r = q("UPDATE item set item_deleted = 1, changed = '%s', edited = '%s' where id = %d", + dbesc(datetime_convert()), + dbesc(datetime_convert()), + intval($item['id']) + ); break; case DROPITEM_NORMAL: default: - if($linked_item && ! $force) { - $r = q("UPDATE item SET item_hidden = 1, - changed = '%s', edited = '%s' WHERE id = %d", - dbesc(datetime_convert()), - dbesc(datetime_convert()), - intval($item['id']) - ); - } - else { - $r = q("DELETE FROM item WHERE id = %d", - intval($item['id']) - ); - } + $r = q("DELETE FROM item WHERE id = %d", + intval($item['id']) + ); break; } + // immediately remove local linked resources + + if($item['resource_type'] === 'event') { + $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", + dbesc($item['resource_id']), + intval($item['uid']) + ); + + $sync_data = $r[0]; + + $x = q("delete from event where event_hash = '%s' and uid = %d", + dbesc($item['resource_id']), + intval($item['uid']) + ); + + if($x) { + $sync_data['event_deleted'] = 1; + build_sync_packet($item['uid'], ['event' => [$syncsync_data]]); + } + } + + if($item['resource_type'] === 'photo') { + attach_delete($item['uid'], $item['resource_id'], true ); + $channel = channelx_by_n($item['uid']); + $sync_data = attach_export_data($channel, $item['resource_id'], true); + if($sync_data) + build_sync_packet($item['uid'], ['file' => [$sync_data]]); + } + // immediately remove any undesired profile likes. q("delete from likes where iid = %d and channel_id = %d", -- cgit v1.2.3 From 48604041e8b2f42c88b741dedae480029db72fdd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 14 Jun 2019 09:12:47 +0200 Subject: fix typo --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 35a5a6124..9ceb91519 100755 --- a/include/items.php +++ b/include/items.php @@ -3846,7 +3846,7 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL) { if($x) { $sync_data['event_deleted'] = 1; - build_sync_packet($item['uid'], ['event' => [$syncsync_data]]); + build_sync_packet($item['uid'], ['event' => [$sync_data]]); } } -- cgit v1.2.3 From abeb924554cc4a91ed5e420a9f426ced3e2a085a Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 14 Jun 2019 20:53:43 +0200 Subject: Add signatures processing for private messages --- include/message.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/message.php b/include/message.php index 2486beb83..7d05b9ab7 100644 --- a/include/message.php +++ b/include/message.php @@ -19,7 +19,7 @@ function mail_prepare_binary($item) { // send a private message -function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false) { +function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $replyto = '', $expires = NULL_DATE, $mimetype = 'text/bbcode', $raw = false, $sig = '') { $ret = array('success' => false); $is_reply = false; @@ -175,8 +175,7 @@ function send_message($uid = 0, $recipient = '', $body = '', $subject = '', $rep $subject = str_rot47(base64url_encode($subject)); if(($body )&& (! $raw)) $body = str_rot47(base64url_encode($body)); - - $sig = ''; // placeholder + $mimetype = ''; //placeholder $r = q("INSERT INTO mail ( account_id, conv_guid, mail_obscured, channel_id, from_xchan, to_xchan, mail_mimetype, title, body, sig, attach, mid, parent_mid, created, expires, mail_isreply, mail_raw ) -- cgit v1.2.3 From 86f4a8d33afbdda7f5f2ace003ad237bde387819 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 14 Jun 2019 20:54:42 +0200 Subject: Add signatures processing for private messages --- include/items.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index 9ceb91519..ed5572233 100755 --- a/include/items.php +++ b/include/items.php @@ -1457,6 +1457,7 @@ function encode_mail($item,$extended = false) { $x['to'] = encode_item_xchan($item['to']); $x['raw'] = $item['mail_raw']; $x['mimetype'] = $item['mail_mimetype']; + $x['sig'] = $item['sig']; if($item['attach']) $x['attach'] = json_decode($item['attach'],true); @@ -1516,6 +1517,9 @@ function get_mail_elements($x) { $arr['expires'] = datetime_convert('UTC','UTC',$x['expires']); $arr['mail_flags'] = 0; + + if(array_key_exists('sig',$x)) + $arr['sig'] = $x['sig']; if($x['flags'] && is_array($x['flags'])) { if(in_array('recalled',$x['flags'])) { -- cgit v1.2.3 From 134dfb8804429ba68c613bb98900d468fdfdba49 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 14 Jun 2019 20:56:00 +0200 Subject: Formatting --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index ed5572233..0af119cc9 100755 --- a/include/items.php +++ b/include/items.php @@ -1457,7 +1457,7 @@ function encode_mail($item,$extended = false) { $x['to'] = encode_item_xchan($item['to']); $x['raw'] = $item['mail_raw']; $x['mimetype'] = $item['mail_mimetype']; - $x['sig'] = $item['sig']; + $x['sig'] = $item['sig']; if($item['attach']) $x['attach'] = json_decode($item['attach'],true); -- cgit v1.2.3 From 8535eb7bf5a3836502a4e5ded93c453abf723370 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 17 Jun 2019 10:10:44 +0200 Subject: update feature set --- include/features.php | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'include') diff --git a/include/features.php b/include/features.php index 9528d3418..87df0c50d 100644 --- a/include/features.php +++ b/include/features.php @@ -280,20 +280,6 @@ function get_features($filtered = true, $level = (-1)) { ], - 'events' => [ - - t('Events'), - - [ - 'events_cal_first_day', - t('Start calendar week on Monday'), - t('Default is Sunday'), - false, - get_config('feature_lock','events_cal_first_day') - ] - - ], - 'manage' => [ t('Manage'), -- cgit v1.2.3 From 983d6d3b4228bdfe7ac0c08fcbdaf2ca687f53a2 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Tue, 18 Jun 2019 22:17:50 +0200 Subject: Include Zot6 hubs in the Grid scope --- include/zid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/zid.php b/include/zid.php index ed79de76a..564ec740c 100644 --- a/include/zid.php +++ b/include/zid.php @@ -13,7 +13,7 @@ function is_matrix_url($url) { if(array_key_exists($m['host'],$remembered)) return $remembered[$m['host']]; - $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network = 'zot' limit 1", + $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network LIKE 'zot%' limit 1", dbesc($m['host']) ); if($r) { -- cgit v1.2.3 From 75746d714a2e7c7ae67fc03d24ddea6a61a2e5e1 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Wed, 19 Jun 2019 09:39:56 +0200 Subject: Update zid.php --- include/zid.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/zid.php b/include/zid.php index 564ec740c..27ef0cefa 100644 --- a/include/zid.php +++ b/include/zid.php @@ -13,7 +13,7 @@ function is_matrix_url($url) { if(array_key_exists($m['host'],$remembered)) return $remembered[$m['host']]; - $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network LIKE 'zot%' limit 1", + $r = q("select hubloc_url from hubloc where hubloc_host = '%s' and hubloc_network in ('zot', 'zot6') limit 1", dbesc($m['host']) ); if($r) { -- cgit v1.2.3 From 3dd6499ac4bfbb7ef52ba3a224ec7a35ff481a48 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 21 Jun 2019 10:37:09 +0200 Subject: fix mid not dbesc'd. the comment was no longer true. this fixes an issue with mid's that contain single quotes --- include/items.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index d2dba9677..4fc659926 100755 --- a/include/items.php +++ b/include/items.php @@ -2012,7 +2012,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) { // find the item we just created $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d and revision = %d ORDER BY id ASC ", - $arr['mid'], // already dbesc'd + dbesc($arr['mid']), intval($arr['uid']), intval($arr['revision']) ); @@ -2033,7 +2033,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) { if(count($r) > 1) { logger('item_store: duplicated post occurred. Removing duplicates.'); q("DELETE FROM item WHERE mid = '%s' AND uid = %d AND id != %d ", - $arr['mid'], + dbesc($arr['mid']), intval($arr['uid']), intval($current_post) ); -- cgit v1.2.3 From 82478eef0960facad62d93c9bd8fcadd56ad4ead Mon Sep 17 00:00:00 2001 From: "DM42.Net (Matt Dent)" Date: Fri, 21 Jun 2019 14:23:16 -0400 Subject: export all items except photos --- include/channel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/channel.php b/include/channel.php index e4b6df47b..0280cd1cd 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1161,7 +1161,7 @@ function channel_export_items_date($channel_id, $start, $finish) { $ret['relocate'] = [ 'channel_address' => $ch['channel_address'], 'url' => z_root()]; } - $r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and created >= '%s' and created <= '%s' and resource_type = '' order by created", + $r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and created >= '%s' and created <= '%s' and resource_type != 'photo' order by created", intval(ITEM_TYPE_POST), intval($channel_id), dbesc($start), @@ -1223,7 +1223,7 @@ function channel_export_items_page($channel_id, $start, $finish, $page = 0, $lim $ret['relocate'] = [ 'channel_address' => $ch['channel_address'], 'url' => z_root()]; } - $r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and resource_type = '' and created >= '%s' and created <= '%s' order by created limit %d offset %d", + $r = q("select * from item where ( item_wall = 1 or item_type != %d ) and item_deleted = 0 and uid = %d and resource_type != 'photo' and created >= '%s' and created <= '%s' order by created limit %d offset %d", intval(ITEM_TYPE_POST), intval($channel_id), dbesc($start), -- cgit v1.2.3 From e8918ca149f9eb0ea4148431772b9e5090f3ea7f Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 21 Jun 2019 22:27:27 +0200 Subject: Respect photo thumbnails storage in import --- include/photo/photo_driver.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index c11580bdc..2ca3acf7d 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -371,21 +371,19 @@ function import_channel_photo($photo, $type, $aid, $uid) { // photo size $img->scaleImageSquare(300); - $r = $img->save($p); + $r = $img->storeThumbnail($p, PHOTO_RES_PROFILE_300); if($r === false) $photo_failure = true; // thumb size $img->scaleImage(80); - $p['imgscale'] = 5; - $r = $img->save($p); + $r = $img->storeThumbnail($p, PHOTO_RES_PROFILE_80); if($r === false) $photo_failure = true; // micro size $img->scaleImage(48); - $p['imgscale'] = 6; - $r = $img->save($p); + $r = $img->storeThumbnail($p, PHOTO_RES_PROFILE_48); if($r === false) $photo_failure = true; -- cgit v1.2.3 From 8730bbac2fd93a9ddc9922f7fed3d89abad1eccc Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 21 Jun 2019 22:42:38 +0200 Subject: Revert "Respect photo thumbnails storage in import" This reverts commit e8918ca149f9eb0ea4148431772b9e5090f3ea7f --- include/photo/photo_driver.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 2ca3acf7d..c11580bdc 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -371,19 +371,21 @@ function import_channel_photo($photo, $type, $aid, $uid) { // photo size $img->scaleImageSquare(300); - $r = $img->storeThumbnail($p, PHOTO_RES_PROFILE_300); + $r = $img->save($p); if($r === false) $photo_failure = true; // thumb size $img->scaleImage(80); - $r = $img->storeThumbnail($p, PHOTO_RES_PROFILE_80); + $p['imgscale'] = 5; + $r = $img->save($p); if($r === false) $photo_failure = true; // micro size $img->scaleImage(48); - $r = $img->storeThumbnail($p, PHOTO_RES_PROFILE_48); + $p['imgscale'] = 6; + $r = $img->save($p); if($r === false) $photo_failure = true; -- cgit v1.2.3 From b1b415ec5b46f56a335a31527c9f987854be7282 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 21 Jun 2019 23:15:16 +0200 Subject: Fix thumbnails processing logic on files sync --- include/import.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/import.php b/include/import.php index 24ad1b901..caf25f5d2 100644 --- a/include/import.php +++ b/include/import.php @@ -1390,7 +1390,7 @@ function sync_files($channel, $files) { $p['content'] = (($p['content'])? base64_decode($p['content']) : ''); } - if (intval($p['imgscale']) && ((intval($p['os_storage'])) || (! $p['content']))) { + if(intval($p['imgscale'])) { $time = datetime_convert(); -- cgit v1.2.3 From 07f850ed15a0af3037b96c0849b949b0bfac791b Mon Sep 17 00:00:00 2001 From: "DM42.Net (Matt Dent)" Date: Sun, 23 Jun 2019 20:23:03 -0400 Subject: Make export_page API endpoint match ZAP --- include/api_zot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/api_zot.php b/include/api_zot.php index b332aea71..287720484 100644 --- a/include/api_zot.php +++ b/include/api_zot.php @@ -6,8 +6,8 @@ api_register_func('api/export/basic','api_export_basic', true); api_register_func('api/red/channel/export/basic','api_export_basic', true); api_register_func('api/z/1.0/channel/export/basic','api_export_basic', true); - api_register_func('api/red/item/export/page','api_item_export_page', true); - api_register_func('api/z/1.0/item/export/page','api_item_export_page', true); + api_register_func('api/red/item/export_page','api_item_export_page', true); + api_register_func('api/z/1.0/item/export_page','api_item_export_page', true); api_register_func('api/red/channel/list','api_channel_list', true); api_register_func('api/z/1.0/channel/list','api_channel_list', true); api_register_func('api/red/channel/stream','api_channel_stream', true); -- cgit v1.2.3