From e292219db0fcee35f4a2352091b0c65fbe7295b0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 4 Jun 2019 17:53:21 -0700 Subject: [PATCH] misc photo issues --- Zotlabs/Daemon/Notifier.php | 2 +- Zotlabs/Module/Cover_photo.php | 11 +++++------ Zotlabs/Module/Profile_photo.php | 6 +++--- Zotlabs/Module/Removeaccount.php | 6 +++++- Zotlabs/Zot6/Zot6Handler.php | 11 +++++------ include/channel.php | 2 +- include/connections.php | 4 ++++ include/photos.php | 6 +++--- 8 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index e8bf654fa..6346d8212 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -230,7 +230,7 @@ class Notifier { self::$packet_type = 'refresh'; } elseif($cmd === 'purge') { - $xchan = argv(3); + $xchan = $argv[3]; logger('notifier: purge: ' . $item_id . ' => ' . $xchan); if (! $xchan) { return; diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 4f7a5ad92..d15df1417 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -179,18 +179,17 @@ logger('gis: ' . print_r($gis,true)); $p['imgscale'] = 7; $p['photo_usage'] = PHOTO_COVER; - $r1 = $im->save($p); - + $r1 = $im->storeThumbnail($p, PHOTO_RES_COVER_1200); + $im->doScaleImage(850,310); $p['imgscale'] = 8; - - $r2 = $im->save($p); - + + $r2 = $im->storeThumbnail($p, PHOTO_RES_COVER_850); $im->doScaleImage(425,160); $p['imgscale'] = 9; - $r3 = $im->save($p); + $r3 = $im->storeThumbnail($p, PHOTO_RES_COVER_425); if($r1 === false || $r2 === false || $r3 === false) { // if one failed, delete them all so we can start over. diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index db75dfd42..ef2052c60 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -126,17 +126,17 @@ class Profile_photo extends Controller { $p['imgscale'] = PHOTO_RES_PROFILE_300; $p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL); - $r1 = $im->save($p); + $r1 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_300); $im->scaleImage(80); $p['imgscale'] = PHOTO_RES_PROFILE_80; - $r2 = $im->save($p); + $r2 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_80); $im->scaleImage(48); $p['imgscale'] = PHOTO_RES_PROFILE_48; - $r3 = $im->save($p); + $r3 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_48); if($r1 === false || $r2 === false || $r3 === false) { // if one failed, delete them all so we can start over. diff --git a/Zotlabs/Module/Removeaccount.php b/Zotlabs/Module/Removeaccount.php index 9d2bbd0de..80ecf78ae 100644 --- a/Zotlabs/Module/Removeaccount.php +++ b/Zotlabs/Module/Removeaccount.php @@ -24,7 +24,11 @@ class Removeaccount extends \Zotlabs\Web\Controller { $account = \App::get_account(); $account_id = get_account_id(); - + + if (! $account_id) { + return; + } + $x = account_verify_password($account['account_email'],$_POST['qxz_password']); if(! ($x && $x['account'])) return; diff --git a/Zotlabs/Zot6/Zot6Handler.php b/Zotlabs/Zot6/Zot6Handler.php index 9c9775a3c..c9dd6a143 100644 --- a/Zotlabs/Zot6/Zot6Handler.php +++ b/Zotlabs/Zot6/Zot6Handler.php @@ -76,8 +76,8 @@ class Zot6Handler implements IHandler { } } else { - // system wide refresh + // system wide refresh $x = Libzot::refresh( [ 'hubloc_id_url' => $hub['hubloc_id_url'] ], null, (($msgtype === 'force_refresh') ? true : false)); } @@ -153,6 +153,10 @@ class Zot6Handler implements IHandler { $ret = array('success' => false); + if (! $sender) { + return $ret; + } + if ($recipients) { // basically this means "unfriend" foreach ($recipients as $recip) { @@ -185,9 +189,4 @@ class Zot6Handler implements IHandler { return $ret; } - - - - - } diff --git a/include/channel.php b/include/channel.php index ba06a37a8..958189194 100644 --- a/include/channel.php +++ b/include/channel.php @@ -2145,7 +2145,7 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { dbesc($channel['channel_hash']) ); - Master::Summon(array('Notifier','purge_all',$channel_id)); + Master::Summon( [ 'Notifier', 'purge_all', $channel_id ] ); } diff --git a/include/connections.php b/include/connections.php index 1422d3582..b610f2aaa 100644 --- a/include/connections.php +++ b/include/connections.php @@ -277,6 +277,10 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) { } else { + if (! $xchan) { + return; + } + $dirmode = intval(get_config('system','directory_mode')); diff --git a/include/photos.php b/include/photos.php index d926b61f1..e6017f41e 100644 --- a/include/photos.php +++ b/include/photos.php @@ -290,7 +290,7 @@ function photo_upload($channel, $observer, $args) { $ph->scaleImage(1024); $p['imgscale'] = 1; - $r1 = $ph->save($p); + $r1 = $ph->storeThumbnail($p, PHOTO_RES_1024); $url[1] = [ 'type' => 'Link', 'mediaType' => $type, @@ -305,7 +305,7 @@ function photo_upload($channel, $observer, $args) { $ph->scaleImage(640); $p['imgscale'] = 2; - $r2 = $ph->save($p); + $r2 = $ph->storeThumbnail($p, PHOTO_RES_640); $url[2] = [ 'type' => 'Link', 'mediaType' => $type, @@ -320,7 +320,7 @@ function photo_upload($channel, $observer, $args) { $ph->scaleImage(320); $p['imgscale'] = 3; - $r3 = $ph->save($p); + $r3 = $ph->storeThumbnail($p, PHOTO_RES_320); $url[3] = [ 'type' => 'Link', 'mediaType' => $type,