]> git.mxchange.org Git - friendica.git/blobdiff - include/Contact.php
eradicate redundant get_uid function
[friendica.git] / include / Contact.php
index 3c41f7650803174fd86ef5ab04bf01a3f92661f7..a514a119caae9b5115b6ce40366dcc787ea172b6 100644 (file)
@@ -1,6 +1,27 @@
 <?php
 
 
+// Included here for completeness, but this is a very dangerous operation.
+// It is the caller's responsibility to confirm the requestor's intent and
+// authorisation to do this.
+
+function user_remove($uid) {
+       q("DELETE FROM `contact` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `group` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `group_member` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `intro` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `item` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `mail` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `photo` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `profile` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `profile_check` WHERE `uid` = %d", intval($uid));
+       q("DELETE FROM `user` WHERE `uid` = %d", intval($uid));
+       if($uid == local_user()) {
+               unset($_SESSION['authenticated']);
+               unset($_SESSION['uid']);
+               killme();
+       }
+}
 
 
 function contact_remove($id) {
@@ -46,7 +67,7 @@ function mark_for_death($contact) {
 if(! function_exists('unmark_for_death')) {
 function unmark_for_death($contact) {
        // It's a miracle. Our dead contact has inexplicably come back to life.
-       q("UPDATE `contact` SET `term-date = '%s' WHERE `id` = %d LIMIT 1",
+       q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d LIMIT 1",
                dbesc('0000-00-00 00:00:00'),
                intval($contact['id'])
        );