diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/channel.php | 2 | ||||
-rw-r--r-- | include/security.php | 9 | ||||
-rw-r--r-- | include/zot.php | 11 |
3 files changed, 21 insertions, 1 deletions
diff --git a/include/channel.php b/include/channel.php index 5f87e587c..4bf490bf0 100644 --- a/include/channel.php +++ b/include/channel.php @@ -2563,7 +2563,7 @@ function channel_remove($channel_id, $local = true, $unset_session = false) { q("DELETE FROM photo WHERE uid = %d", intval($channel_id)); q("DELETE FROM attach WHERE uid = %d", intval($channel_id)); q("DELETE FROM profile WHERE uid = %d", intval($channel_id)); - q("DELETE FROM src WHERE src_channel_id = %d", intval($channel_id)); + q("DELETE FROM source WHERE src_channel_id = %d", intval($channel_id)); $r = q("select hash FROM attach WHERE uid = %d", intval($channel_id)); if($r) { diff --git a/include/security.php b/include/security.php index 8b7e7d076..19278d5cb 100644 --- a/include/security.php +++ b/include/security.php @@ -266,6 +266,15 @@ function change_channel($change_channel) { $_SESSION['mobile_theme'] = get_pconfig(local_channel(),'system', 'mobile_theme'); $_SESSION['cloud_tiles'] = get_pconfig(local_channel(),'system', 'cloud_tiles'); date_default_timezone_set($r[0]['channel_timezone']); + + // Update the active timestamp at most once a day + + if(substr($r[0]['channel_active'],0,10) !== substr(datetime_convert(),0,10)) { + $z = q("UPDATE channel SET channel_active = '%s' WHERE channel_id = %d", + dbesc(datetime_convert()), + intval($r[0]['channel_id']) + ); + } $ret = $r[0]; } $x = q("select * from xchan where xchan_hash = '%s' limit 1", diff --git a/include/zot.php b/include/zot.php index 2ad43f0e5..c2b622277 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3208,6 +3208,9 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) { $channel = $r[0]; + // don't provide these in the export + + unset($channel['channel_active']); unset($channel['channel_password']); unset($channel['channel_salt']); @@ -3474,6 +3477,14 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { continue; } + // if the clone is active, so are we + + if(substr($channel['channel_active'],0,10) !== substr(datetime_convert(),0,10)) { + q("UPDATE channel set channel_active = '%s' where channel_id = %d", + dbesc(datetime_convert()), + intval($channel['channel_id']) + ); + } if(array_key_exists('config',$arr) && is_array($arr['config']) && count($arr['config'])) { foreach($arr['config'] as $cat => $k) { |