aboutsummaryrefslogtreecommitdiffstats
path: root/include/channel.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/channel.php')
-rw-r--r--include/channel.php45
1 files changed, 30 insertions, 15 deletions
diff --git a/include/channel.php b/include/channel.php
index 05f1bd34b..e2be4d8a8 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -341,6 +341,7 @@ function create_identity($arr) {
'hubloc_guid' => $guid,
'hubloc_guid_sig' => $zsig,
'hubloc_hash' => $zhash,
+ 'hubloc_id_url' => channel_url($ret['channel']),
'hubloc_addr' => channel_reddress($ret['channel']),
'hubloc_primary' => intval($primary),
'hubloc_url' => z_root(),
@@ -360,7 +361,7 @@ function create_identity($arr) {
'hubloc_guid' => $guid,
'hubloc_guid_sig' => $sig,
'hubloc_hash' => $hash,
- 'hubloc_id_url' => channel_url($ret['channel']),
+ 'hubloc_id_url' => channel_url($ret['channel']),
'hubloc_addr' => channel_reddress($ret['channel']),
'hubloc_primary' => intval($primary),
'hubloc_url' => z_root(),
@@ -1924,7 +1925,7 @@ function zid_init() {
call_hooks('zid_init', $arr);
if(! local_channel()) {
- $r = q("select * from hubloc where hubloc_addr = '%s' order by hubloc_connected desc",
+ $r = q("select hubloc_url, hubloc_hash, hubloc_network from hubloc where hubloc_addr = '%s' order by hubloc_connected desc",
dbesc($tmp_str)
);
if(! $r) {
@@ -1933,6 +1934,7 @@ function zid_init() {
if($r) {
$r = Libzot::zot_record_preferred($r);
}
+
if($r && remote_channel() && remote_channel() === $r['hubloc_hash'])
return;
@@ -2382,8 +2384,8 @@ function get_zcard($channel, $observer_hash = '', $args = array()) {
$cover = $r[0];
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
} else {
- $default_cover = get_config('system','default_cover_photo','pexels-94622');
- $cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ];
+ $default_cover = get_config('system','default_cover_photo','bggenerator');
+ $cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.png' ];
}
$o .= replace_macros(get_markup_template('zcard.tpl'), array(
@@ -2456,8 +2458,8 @@ function get_zcard_embed($channel, $observer_hash = '', $args = array()) {
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
}
else {
- $default_cover = get_config('system','default_cover_photo','pexels-94622');
- $cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ];
+ $default_cover = get_config('system','default_cover_photo','bggenerator');
+ $cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.png' ];
}
$o .= replace_macros(get_markup_template('zcard_embed.tpl'),array(
@@ -2714,6 +2716,9 @@ function account_remove($account_id, $local = true, $unset_session = true) {
logger('account_remove: ' . $account_id);
+ // Global removal (all clones) not currently supported
+ $local = true;
+
if(! intval($account_id)) {
logger('No account.');
return false;
@@ -2774,6 +2779,11 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
if(! $channel_id)
return;
+ // global removal (all clones) not currently supported
+ // hence this operation _may_ leave orphan data on remote servers
+
+ $local = true;
+
logger('Removing channel: ' . $channel_id);
logger('local only: ' . intval($local));
@@ -2792,6 +2802,7 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
*/
call_hooks('channel_remove', $r[0]);
+/*
if(! $local) {
if(intval($r[0]['channel_removed'])) {
@@ -2811,17 +2822,20 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
logger('deleting hublocs',LOGGER_DEBUG);
- $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s'",
- dbesc($channel['channel_hash'])
+ $r = q("UPDATE hubloc SET hubloc_deleted = 1 WHERE hubloc_hash = '%s' OR hubloc_hash = '%s'",
+ dbesc($channel['channel_hash']),
+ dbesc($channel['channel_portable_id'])
+
);
- $r = q("update xchan set xchan_deleted = 1 where xchan_hash = '%s'",
- dbesc($channel['channel_hash'])
+ $r = q("UPDATE xchan SET xchan_deleted = 1 WHERE xchan_hash = '%s' OR xchan_hash = '%s'",
+ dbesc($channel['channel_hash']),
+ dbesc($channel['channel_portable_id'])
);
Master::Summon(array('Notifier','purge_all',$channel_id));
}
-
+*/
$r = q("select iid from iconfig left join item on item.id = iconfig.iid
where item.uid = %d",
@@ -2900,8 +2914,9 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
logger('deleting hublocs',LOGGER_DEBUG);
- $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ",
+ $r = q("UPDATE hubloc SET hubloc_deleted = 1 WHERE (hubloc_hash = '%s' OR hubloc_hash = '%s') AND hubloc_url = '%s' ",
dbesc($channel['channel_hash']),
+ dbesc($channel['channel_portable_id']),
dbesc(z_root())
);
@@ -2916,14 +2931,14 @@ function channel_remove($channel_id, $local = true, $unset_session = false) {
$hublocs = count($r);
if(! $hublocs) {
- $r = q("update xchan set xchan_deleted = 1 where xchan_hash = '%s' ",
- dbesc($channel['channel_hash'])
+ $r = q("UPDATE xchan SET xchan_deleted = 1 WHERE xchan_hash = '%s' OR xchan_hash = '%s'",
+ dbesc($channel['channel_hash']),
+ dbesc($channel['channel_portable_id'])
);
}
//remove from file system
-
$f = 'store/' . $channel['channel_address'];
if(is_dir($f)) {
@rrmdir($f);