From b26989bb65615f7827047f87b3c4490f45b1f3e1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 12 Nov 2013 18:27:36 -0800 Subject: removeme sort of works for a single channel - lots of loose ends to deal with but it's a start --- mod/dirsearch.php | 10 ++++++---- mod/manage.php | 5 +++-- mod/removeme.php | 21 +++++++++++++-------- 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index dcacef651..3e385a6d1 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -121,9 +121,10 @@ function dirsearch_content(&$a) { else { $qlimit = " LIMIT " . intval($startrec) . " , " . intval($perpage); 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_ORPHAN) + intval(XCHAN_FLAGS_ORPHAN), + intval(XCHAN_FLAGS_DELETED) ); if($r) { $ret['total_items'] = $r[0]['total']; @@ -161,9 +162,10 @@ function dirsearch_content(&$a) { } 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_ORPHAN) + intval(XCHAN_FLAGS_ORPHAN), + intval(XCHAN_FLAGS_DELETED) ); } diff --git a/mod/manage.php b/mod/manage.php index 27e45aa47..a2f65b271 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -36,8 +36,9 @@ function manage_content(&$a) { $channels = null; 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 ", - intval(get_account_id()) + $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(PAGE_REMOVED) ); $selected_channel = null; diff --git a/mod/removeme.php b/mod/removeme.php index ee88bd76a..7af4719bd 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -17,13 +17,17 @@ function removeme_post(&$a) { if($_POST['verify'] !== $_SESSION['remove_account_verify']) return; - $encrypted = hash('whirlpool',trim($_POST['qxz_password'])); - if((strlen($a->user['password'])) && ($encrypted === $a->user['password'])) { - require_once('include/Contact.php'); - user_remove($a->user['uid']); - // NOTREACHED - } + $account = $a->get_account(); + + if(! account_verify_password($account['account_email'],$_POST['qxz_password'])) + 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( '$basedir' => $a->get_baseurl(), '$hash' => $hash, - '$title' => t('Remove My Account'), - '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'), + '$title' => t('Remove This Channel'), + '$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:'), + '$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') )); -- cgit v1.2.3