removeme sort of works for a single channel - lots of loose ends to deal with but it's a start
This commit is contained in:
parent
061b438f97
commit
b26989bb65
6
boot.php
6
boot.php
@ -1632,8 +1632,10 @@ function profile_load(&$a, $nickname, $profile = '') {
|
|||||||
if(! $r) {
|
if(! $r) {
|
||||||
$r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
|
$r = q("SELECT profile.uid AS profile_uid, profile.*, channel.* FROM profile
|
||||||
LEFT JOIN channel ON profile.uid = channel.channel_id
|
LEFT JOIN channel ON profile.uid = channel.channel_id
|
||||||
WHERE channel.channel_address = '%s' AND profile.is_default = 1 LIMIT 1",
|
WHERE channel.channel_address = '%s' and not ( channel_pageflags & %d )
|
||||||
dbesc($nickname)
|
AND profile.is_default = 1 LIMIT 1",
|
||||||
|
dbesc($nickname),
|
||||||
|
intval(PAGE_REMOVED)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +199,7 @@ function channel_remove($channel_id, $local = true) {
|
|||||||
return;
|
return;
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
logger('Removing channel: ' . $channel_id);
|
logger('Removing channel: ' . $channel_id);
|
||||||
|
logger('channel_remove: local only: ' . intval($local));
|
||||||
|
|
||||||
$r = q("select * from channel where channel_id = %d limit 1", intval($channel_id));
|
$r = q("select * from channel where channel_id = %d limit 1", intval($channel_id));
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
@ -209,12 +210,8 @@ function channel_remove($channel_id, $local = true) {
|
|||||||
$channel = $r[0];
|
$channel = $r[0];
|
||||||
|
|
||||||
call_hooks('channel_remove',$r[0]);
|
call_hooks('channel_remove',$r[0]);
|
||||||
|
|
||||||
if(! $local) {
|
|
||||||
|
|
||||||
// FIXME notify the directory
|
|
||||||
|
|
||||||
// FIXME notify all contacts
|
if(! $local) {
|
||||||
|
|
||||||
$r = q("update channel set channel_deleted = '%s', channel_pageflags = (channel_pageflags | %d), channel_r_stream = 0, channel_r_profile = 0,
|
$r = q("update channel set channel_deleted = '%s', channel_pageflags = (channel_pageflags | %d), channel_r_stream = 0, channel_r_profile = 0,
|
||||||
channel_r_photos = 0, channel_r_abook = 0, channel_w_stream = 0, channel_w_wall = 0, channel_w_tagwall = 0,
|
channel_r_photos = 0, channel_r_abook = 0, channel_w_stream = 0, channel_w_wall = 0, channel_w_tagwall = 0,
|
||||||
@ -254,6 +251,12 @@ function channel_remove($channel_id, $local = true) {
|
|||||||
q("DELETE FROM `pconfig` WHERE `uid` = %d", intval($channel_id));
|
q("DELETE FROM `pconfig` WHERE `uid` = %d", intval($channel_id));
|
||||||
q("DELETE FROM `spam` WHERE `uid` = %d", intval($channel_id));
|
q("DELETE FROM `spam` WHERE `uid` = %d", intval($channel_id));
|
||||||
|
|
||||||
|
|
||||||
|
q("delete from abook where abook_xchan = '%s' and abook_flags & %d limit 1",
|
||||||
|
dbesc($channel['channel_hash']),
|
||||||
|
dbesc(ABOOK_FLAG_SELF)
|
||||||
|
);
|
||||||
|
|
||||||
$r = q("update channel set channel_deleted = '%s', channel_pageflags = (channel_pageflags | %d) where channel_id = %d limit 1",
|
$r = q("update channel set channel_deleted = '%s', channel_pageflags = (channel_pageflags | %d) where channel_id = %d limit 1",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval(PAGE_REMOVED),
|
intval(PAGE_REMOVED),
|
||||||
@ -291,10 +294,8 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// this is somewhat destructive
|
$dirmode = intval(get_config('system','directory_mode'));
|
||||||
// FIXME
|
|
||||||
// We don't want to be quite as destructive on directories, which will need to mirror the action
|
|
||||||
// and we also don't want to completely destroy an xchan that has moved to a new primary location
|
|
||||||
|
|
||||||
$r = q("delete from photo where xchan = '%s'",
|
$r = q("delete from photo where xchan = '%s'",
|
||||||
dbesc($xchan)
|
dbesc($xchan)
|
||||||
@ -323,22 +324,35 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
|
|||||||
dbesc($xchan)
|
dbesc($xchan)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$r = q("delete from abook where abook_xchan = '%s'",
|
||||||
|
dbesc($xchan)
|
||||||
|
);
|
||||||
|
|
||||||
// This could get sticky with directories
|
|
||||||
|
|
||||||
// $r = q("delete from xchan where xchan_hash = '%s' limit 1",
|
if($dirmode === false || $dirmode == DIRECTORY_MODE_NORMAL) {
|
||||||
// dbesc($xchan)
|
|
||||||
// );
|
|
||||||
// $r = q("delete from hubloc where hubloc_hash = '%s'",
|
|
||||||
// dbesc($xchan)
|
|
||||||
// );
|
|
||||||
// $r = q("delete from abook where abook_xchan = '%s'",
|
|
||||||
// dbesc($xchan)
|
|
||||||
// );
|
|
||||||
// $r = q("delete from xtag where xtag_hash = '%s'",
|
|
||||||
// dbesc($xchan)
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
$r = q("delete from xchan where xchan_hash = '%s' limit 1",
|
||||||
|
dbesc($xchan)
|
||||||
|
);
|
||||||
|
$r = q("delete from hubloc where hubloc_hash = '%s'",
|
||||||
|
dbesc($xchan)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// directory servers need to keep the record around for sync purposes - mark it deleted
|
||||||
|
|
||||||
|
$r = q("update hubloc set hubloc_flags = hubloc_flags | %d where hubloc_hash = '%s'",
|
||||||
|
intval(HUBLOC_FLAGS_DELETED),
|
||||||
|
dbesc($xchan)
|
||||||
|
);
|
||||||
|
|
||||||
|
$r = q("update xchan set xchan_flags = xchan_flags | %d where xchan_hash = '%s'",
|
||||||
|
intval(XCHAN_FLAGS_DELETED),
|
||||||
|
dbesc($xchan)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,9 +121,10 @@ function dirsearch_content(&$a) {
|
|||||||
else {
|
else {
|
||||||
$qlimit = " LIMIT " . intval($startrec) . " , " . intval($perpage);
|
$qlimit = " LIMIT " . intval($startrec) . " , " . intval($perpage);
|
||||||
if($return_total) {
|
if($return_total) {
|
||||||
$r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d) and not ( xchan_flags & %d ) $safesql ",
|
$r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d) and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $safesql ",
|
||||||
intval(XCHAN_FLAGS_HIDDEN),
|
intval(XCHAN_FLAGS_HIDDEN),
|
||||||
intval(XCHAN_FLAGS_ORPHAN)
|
intval(XCHAN_FLAGS_ORPHAN),
|
||||||
|
intval(XCHAN_FLAGS_DELETED)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$ret['total_items'] = $r[0]['total'];
|
$ret['total_items'] = $r[0]['total'];
|
||||||
@ -161,9 +162,10 @@ function dirsearch_content(&$a) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $safesql $order $qlimit ",
|
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $safesql $order $qlimit ",
|
||||||
intval(XCHAN_FLAGS_HIDDEN),
|
intval(XCHAN_FLAGS_HIDDEN),
|
||||||
intval(XCHAN_FLAGS_ORPHAN)
|
intval(XCHAN_FLAGS_ORPHAN),
|
||||||
|
intval(XCHAN_FLAGS_DELETED)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,9 @@ function manage_content(&$a) {
|
|||||||
$channels = null;
|
$channels = null;
|
||||||
|
|
||||||
if(local_user()) {
|
if(local_user()) {
|
||||||
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d order by channel_name ",
|
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and not ( channel_pageflags & %d ) order by channel_name ",
|
||||||
intval(get_account_id())
|
intval(get_account_id()),
|
||||||
|
intval(PAGE_REMOVED)
|
||||||
);
|
);
|
||||||
|
|
||||||
$selected_channel = null;
|
$selected_channel = null;
|
||||||
|
@ -17,13 +17,17 @@ function removeme_post(&$a) {
|
|||||||
if($_POST['verify'] !== $_SESSION['remove_account_verify'])
|
if($_POST['verify'] !== $_SESSION['remove_account_verify'])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$encrypted = hash('whirlpool',trim($_POST['qxz_password']));
|
|
||||||
|
|
||||||
if((strlen($a->user['password'])) && ($encrypted === $a->user['password'])) {
|
$account = $a->get_account();
|
||||||
require_once('include/Contact.php');
|
|
||||||
user_remove($a->user['uid']);
|
if(! account_verify_password($account['account_email'],$_POST['qxz_password']))
|
||||||
// NOTREACHED
|
return;
|
||||||
}
|
|
||||||
|
require_once('include/Contact.php');
|
||||||
|
|
||||||
|
$global_remove = intval($_POST['global']);
|
||||||
|
|
||||||
|
channel_remove(local_user(),1 - $global_remove);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +46,10 @@ function removeme_content(&$a) {
|
|||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$basedir' => $a->get_baseurl(),
|
'$basedir' => $a->get_baseurl(),
|
||||||
'$hash' => $hash,
|
'$hash' => $hash,
|
||||||
'$title' => t('Remove My Account'),
|
'$title' => t('Remove This Channel'),
|
||||||
'$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'),
|
'$desc' => t('This will completely remove this channel from the network. Once this has been done it is not recoverable.'),
|
||||||
'$passwd' => t('Please enter your password for verification:'),
|
'$passwd' => t('Please enter your password for verification:'),
|
||||||
|
'$global' => array('global', t('Remove this channel and all its clones from the network'), false, t('By default only the instance of the channel located on this hub will be removed from the network')),
|
||||||
'$submit' => t('Remove My Account')
|
'$submit' => t('Remove My Account')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="remove-account-pass-end"></div>
|
<div id="remove-account-pass-end"></div>
|
||||||
|
|
||||||
|
{{include file="field_checkbox.tpl" field=$global}}
|
||||||
|
|
||||||
<input type="submit" name="submit" value="{{$submit}}" />
|
<input type="submit" name="submit" value="{{$submit}}" />
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user