aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-01-18 10:09:16 +0100
committerMario Vavti <mario@mariovavti.com>2019-01-18 10:09:16 +0100
commitd355e57fa63fd57867016a276450e7799ccabf65 (patch)
tree6e835f26af27c66dcd42a6721a4f8fe131fdfa65
parentf2d7c4091a4b7b5a3fdb066194c0354612574cfe (diff)
parent52305ca91b49f8a8f0380234879ac4e5be1705fb (diff)
downloadvolse-hubzilla-d355e57fa63fd57867016a276450e7799ccabf65.tar.gz
volse-hubzilla-d355e57fa63fd57867016a276450e7799ccabf65.tar.bz2
volse-hubzilla-d355e57fa63fd57867016a276450e7799ccabf65.zip
Merge remote-tracking branch 'mike/master' into dev
-rw-r--r--Zotlabs/Lib/Libzot.php24
-rw-r--r--include/event.php17
2 files changed, 26 insertions, 15 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index e66c929bf..195591409 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -271,7 +271,7 @@ class Libzot {
// correct hubloc. If this doesn't work we may have to re-write this section to try them all.
if(array_key_exists('xchan_addr',$them) && $them['xchan_addr']) {
- $r = q("select hubloc_id_url, hubloc_primary from hubloc where hubloc_addr = '%s' order by hubloc_id desc",
+ $r = q("select hubloc_id_url, hubloc_primary from hubloc where hubloc_addr = '%s' and hubloc_network = 'zot6' order by hubloc_id desc",
dbesc($them['xchan_addr'])
);
}
@@ -356,7 +356,7 @@ class Libzot {
);
if($r) {
-logger('4');
+
// connection exists
// if the dob is the same as what we have stored (disregarding the year), keep the one
@@ -1194,7 +1194,7 @@ logger('4');
//logger($AS->debug());
- $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1",
+ $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
dbesc($AS->actor['id'])
);
@@ -1203,7 +1203,7 @@ logger('4');
}
- $s = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1",
+ $s = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
dbesc($env['sender'])
);
@@ -1513,10 +1513,12 @@ logger('4');
}
}
-logger('item: ' . print_r($arr,true), LOGGER_DATA);
+ logger('item: ' . print_r($arr,true), LOGGER_DATA);
if($arr['mid'] !== $arr['parent_mid']) {
-logger('checking source: "' . $arr['mid'] . '" != "' . $arr['parent_mid'] . '"');
+
+ logger('checking source: "' . $arr['mid'] . '" != "' . $arr['parent_mid'] . '"');
+
// check source route.
// We are only going to accept comments from this sender if the comment has the same route as the top-level-post,
// this is so that permissions mismatches between senders apply to the entire conversation
@@ -1601,7 +1603,7 @@ logger('checking source: "' . $arr['mid'] . '" != "' . $arr['parent_mid'] . '"')
$arr['route'] = $last_prior_route;
}
}
-logger('hey');
+
$ab = q("select * from abook where abook_channel = %d and abook_xchan = '%s'",
intval($channel['channel_id']),
dbesc($arr['owner_xchan'])
@@ -1779,14 +1781,14 @@ logger('hey');
logger($AS->debug());
- $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1",
+ $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
dbesc($AS->actor['id'])
);
if(! $r) {
$y = import_author_xchan([ 'url' => $AS->actor['id'] ]);
if($y) {
- $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1",
+ $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
dbesc($AS->actor['id'])
);
}
@@ -1809,7 +1811,7 @@ logger('hey');
$arr['author_xchan'] = $r[0]['hubloc_hash'];
}
- $s = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' limit 1",
+ $s = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
dbesc($a['signature']['signer'])
);
@@ -2594,7 +2596,7 @@ logger('hey');
$feed = ((x($arr,'feed')) ? intval($arr['feed']) : 0);
if($ztarget) {
- $t = q("select * from hubloc where hubloc_id_url = '%s' limit 1",
+ $t = q("select * from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
dbesc($ztarget)
);
if($t) {
diff --git a/include/event.php b/include/event.php
index a34250e7a..fdb9e1415 100644
--- a/include/event.php
+++ b/include/event.php
@@ -6,6 +6,10 @@
use Sabre\VObject;
+use Ramsey\Uuid\Uuid;
+use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
+
+
require_once('include/bbcode.php');
/**
@@ -463,8 +467,13 @@ function event_store_event($arr) {
$hash = $arr['external_id'];
elseif(array_key_exists('event_hash',$arr))
$hash = $arr['event_hash'];
- else
- $hash = random_string() . '@' . App::get_hostname();
+ else {
+ try {
+ $hash = Uuid::uuid4()->toString();
+ } catch (UnsatisfiedDependencyException $e) {
+ $hash = random_string(48);
+ }
+ }
$r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,dtstart,dtend,summary,description,location,etype,
adjust,nofinish, event_status, event_status_date, event_percent, event_repeat, event_sequence, event_priority, event_vdata, allow_cid,allow_gid,deny_cid,deny_gid)
@@ -1126,8 +1135,8 @@ function event_store_item($arr, $event) {
}
if(! $arr['mid']) {
- $arr['uuid'] = item_message_id();
- $arr['mid'] = z_root() . '/item/' . $arr['uuid'];
+ $arr['uuid'] = $event['event_hash'];
+ $arr['mid'] = z_root() . '/event/' . $event['event_hash'];
}
$item_arr['aid'] = $z[0]['channel_account_id'];