aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-31 20:30:36 +0000
committerMario <mario@mariovavti.com>2020-10-31 20:30:36 +0000
commitb55c7f794b06d45f3b9cdb2f8a4ce7d99aaf8902 (patch)
tree95ed2e76d040e856a7ec72abf0c1079542661107 /Zotlabs
parent5580fc1954a63f861644e2de3773fbb3adfa8f2c (diff)
parent205279f7f877c10abf80715c55db83d2c2852eab (diff)
downloadvolse-hubzilla-b55c7f794b06d45f3b9cdb2f8a4ce7d99aaf8902.tar.gz
volse-hubzilla-b55c7f794b06d45f3b9cdb2f8a4ce7d99aaf8902.tar.bz2
volse-hubzilla-b55c7f794b06d45f3b9cdb2f8a4ce7d99aaf8902.zip
Merge branch 'dev' into 5.0RC
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Directory.php19
-rw-r--r--Zotlabs/Lib/Libzotdir.php26
-rw-r--r--Zotlabs/Module/Photo.php26
-rw-r--r--Zotlabs/Module/Photos.php2
4 files changed, 41 insertions, 32 deletions
diff --git a/Zotlabs/Daemon/Directory.php b/Zotlabs/Daemon/Directory.php
index c8cdafdf5..c698995c2 100644
--- a/Zotlabs/Daemon/Directory.php
+++ b/Zotlabs/Daemon/Directory.php
@@ -2,10 +2,9 @@
namespace Zotlabs\Daemon;
-require_once('include/zot.php');
-require_once('include/dir_fns.php');
-require_once('include/queue_fn.php');
-
+use Zotlabs\Lib\Libzot;
+use Zotlabs\Lib\Libzotdir;
+use Zotlabs\Lib\Queue;
class Directory {
@@ -42,7 +41,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 +57,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 +77,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'],
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)
);
}
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) {
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)));