From d3d5ddfb434555373b892e127ad9faa6425af3bf Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 24 Oct 2020 21:26:46 +0000 Subject: enable btlogging to syslog (cherry picked from commit 5580fc1954a63f861644e2de3773fbb3adfa8f2c) --- Zotlabs/Lib/Webfinger.php | 2 +- Zotlabs/Lib/Zotfinger.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Webfinger.php b/Zotlabs/Lib/Webfinger.php index c2364ac4d..611c36889 100644 --- a/Zotlabs/Lib/Webfinger.php +++ b/Zotlabs/Lib/Webfinger.php @@ -106,4 +106,4 @@ class Webfinger { -} \ No newline at end of file +} diff --git a/Zotlabs/Lib/Zotfinger.php b/Zotlabs/Lib/Zotfinger.php index 2d2e6796b..722e34dfc 100644 --- a/Zotlabs/Lib/Zotfinger.php +++ b/Zotlabs/Lib/Zotfinger.php @@ -60,4 +60,4 @@ class Zotfinger { -} \ No newline at end of file +} -- cgit v1.2.3 From 81775eebe2f737c115f50d52d18c20e8442158f4 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 25 Oct 2020 07:59:49 +0000 Subject: directory fixes --- Zotlabs/Lib/Libzotdir.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php index 1cb52275c..b02516a98 100644 --- a/Zotlabs/Lib/Libzotdir.php +++ b/Zotlabs/Lib/Libzotdir.php @@ -3,6 +3,8 @@ namespace Zotlabs\Lib; use Zotlabs\Lib\Libzot; +use Zotlabs\Lib\Zotfinger; +use Zotlabs\Lib\Webfinger; require_once('include/permissions.php'); @@ -307,9 +309,9 @@ class Libzotdir { if ($ud['ud_addr'] && (! ($ud['ud_flags'] & UPDATE_FLAGS_DELETED))) { $success = false; - $href = \Zotlabs\Lib\Webfinger::zot_url(punify($ud['ud_addr'])); + $href = Webfinger::zot_url(punify($ud['ud_addr'])); if($href) { - $zf = \Zotlabs\Lib\Zotfinger::exec($href); + $zf = Zotfinger::exec($href); } if(is_array($zf) && array_path_exists('signature/signer',$zf) && $zf['signature']['signer'] === $href && intval($zf['signature']['header_valid'])) { $xc = Libzot::import_xchan($zf['data'], 0, $ud); @@ -339,7 +341,7 @@ class Libzotdir { logger('local_dir_update: uid: ' . $uid, LOGGER_DEBUG); - $p = q("select channel.channel_hash, channel_address, channel_timezone, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1", + $p = q("select channel.channel_hash, channel_address, channel_timezone, channel_portable_id, profile.* from profile left join channel on channel_id = uid where uid = %d and is_default = 1", intval($uid) ); @@ -348,6 +350,7 @@ class Libzotdir { if ($p) { $hash = $p[0]['channel_hash']; + $legacy_hash = $p[0]['channel_portable_id']; $profile['description'] = $p[0]['pdesc']; $profile['birthday'] = $p[0]['dob']; @@ -381,14 +384,15 @@ class Libzotdir { logger('hidden: ' . $hidden); - $r = q("select xchan_hidden from xchan where xchan_hash = '%s' limit 1", + $r = q("select xchan_hidden from xchan where xchan_hash = '%s'", dbesc($p[0]['channel_hash']) ); if(intval($r[0]['xchan_hidden']) != $hidden) { - $r = q("update xchan set xchan_hidden = %d where xchan_hash = '%s'", + $r = q("update xchan set xchan_hidden = %d where xchan_hash in ('%s', '%s')", intval($hidden), - dbesc($p[0]['channel_hash']) + dbesc($hash), + dbesc($legacy_hash) ); } @@ -402,11 +406,13 @@ class Libzotdir { } else { // they may have made it private - $r = q("delete from xprof where xprof_hash = '%s'", - dbesc($hash) + q("delete from xprof where xprof_hash in ('%s', '%s')", + dbesc($hash), + dbesc($legacy_hash) ); - $r = q("delete from xtag where xtag_hash = '%s'", - dbesc($hash) + q("delete from xtag where xtag_hash in ('%s', '%s')", + dbesc($hash), + dbesc($legacy_hash) ); } -- cgit v1.2.3 From 6979ea44f44dd665c05281660aefa6bbb0fab005 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 25 Oct 2020 08:26:25 +0000 Subject: more directory fixes --- Zotlabs/Daemon/Directory.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Directory.php b/Zotlabs/Daemon/Directory.php index c8cdafdf5..55d485a5b 100644 --- a/Zotlabs/Daemon/Directory.php +++ b/Zotlabs/Daemon/Directory.php @@ -2,6 +2,10 @@ namespace Zotlabs\Daemon; +use Zotlabs\Lib\Libzot; +use Zotlabs\Lib\Libzotdir; +use Zotlabs\Lib\Queue; + require_once('include/zot.php'); require_once('include/dir_fns.php'); require_once('include/queue_fn.php'); @@ -42,7 +46,7 @@ class Directory { // this is an in-memory update and we don't need to send a network packet. - local_dir_update($argv[1],$force); + Libzotdir::local_dir_update($argv[1],$force); q("update channel set channel_dirdate = '%s' where channel_id = %d", dbesc(datetime_convert()), @@ -58,13 +62,15 @@ class Directory { // otherwise send the changes upstream - $directory = find_upstream_directory($dirmode); + $directory = Libzotdir::find_upstream_directory($dirmode); $url = $directory['url'] . '/post'; // ensure the upstream directory is updated - $packet = zot_build_packet($channel,(($force) ? 'force_refresh' : 'refresh')); - $z = zot_zot($url,$packet); + + $packet = Libzot::build_packet($channel,(($force) ? 'force_refresh' : 'refresh')); + $z = Libzot::zot($url,$packet,$channel); + // re-queue if unsuccessful @@ -76,7 +82,7 @@ class Directory { $hash = random_string(); - queue_insert(array( + Queue::insert(array( 'hash' => $hash, 'account_id' => $channel['channel_account_id'], 'channel_id' => $channel['channel_id'], -- cgit v1.2.3 From cc543d1ad2823efb1cddcc1431077f5414c3e1cf Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 25 Oct 2020 10:30:12 +0000 Subject: =?UTF-8?q?remove=20redundant=20includes=C3=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zotlabs/Daemon/Directory.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Directory.php b/Zotlabs/Daemon/Directory.php index 55d485a5b..c698995c2 100644 --- a/Zotlabs/Daemon/Directory.php +++ b/Zotlabs/Daemon/Directory.php @@ -6,11 +6,6 @@ use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Libzotdir; use Zotlabs\Lib\Queue; -require_once('include/zot.php'); -require_once('include/dir_fns.php'); -require_once('include/queue_fn.php'); - - class Directory { static public function run($argc,$argv){ -- cgit v1.2.3 From 7cf9b85a97829dc6e11fef4dcafeebe746084c1f Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sun, 25 Oct 2020 11:43:35 +0100 Subject: Don't try to fetch profile photo for unknown channel --- Zotlabs/Module/Photo.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index 1cf082bdd..c88696578 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -67,18 +67,20 @@ class Photo extends \Zotlabs\Web\Controller { $data = ''; - $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1", - intval($resolution), - intval($uid), - intval(PHOTO_PROFILE) - ); - if($r) { - $modified = strtotime($r[0]['edited'] . "Z"); - $mimetype = $r[0]['mimetype']; - if(intval($r[0]['os_storage'])) - $data = file_get_contents(dbunescbin($r[0]['content'])); - else - $data = dbunescbin($r[0]['content']); + if ($uid > 0) { + $r = q("SELECT * FROM photo WHERE imgscale = %d AND uid = %d AND photo_usage = %d LIMIT 1", + intval($resolution), + intval($uid), + intval(PHOTO_PROFILE) + ); + if($r) { + $modified = strtotime($r[0]['edited'] . "Z"); + $mimetype = $r[0]['mimetype']; + if(intval($r[0]['os_storage'])) + $data = file_get_contents(dbunescbin($r[0]['content'])); + else + $data = dbunescbin($r[0]['content']); + } } if(! $data) { -- cgit v1.2.3 From e24c769f8e0f919a8e182ae072fdedcd16bb60f3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 27 Oct 2020 20:27:49 +0100 Subject: fix issue #1484 --- Zotlabs/Module/Photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 649e753ad..fa9216c97 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -210,7 +210,7 @@ class Photos extends \Zotlabs\Web\Controller { if(($m) && ($m[0]['folder'] != $_POST['move_to_album'])) { attach_move($page_owner_uid,argv(2),$_POST['move_to_album']); - $sync = attach_export_data(\App::$data['channel'],argv(2),true); + $sync = attach_export_data(\App::$data['channel'], argv(2), false); if($sync) Libsync::build_sync_packet($page_owner_uid,array('file' => array($sync))); -- cgit v1.2.3