| | 13 | |
|---|
| | 14 | |
|---|
| | 15 | /* functions */ |
|---|
| | 16 | |
|---|
| | 17 | /* deleting */ |
|---|
| | 18 | |
|---|
| | 19 | function delete_links_for_user( $u, $confirm_true ) { |
|---|
| | 20 | if( !$u ) |
|---|
| | 21 | return; |
|---|
| | 22 | $q = run_query( getQuery( "links_for_user", $u )); |
|---|
| | 23 | $c = mysql_num_rows($q); |
|---|
| | 24 | $count = 0; |
|---|
| | 25 | echo "for-each link:\n"; |
|---|
| | 26 | while( $row = mysql_fetch_assoc( $q ) ) { |
|---|
| | 27 | $ID = urldecode( $row["ID"] ); |
|---|
| | 28 | deleteCategorizationForLink( $ID ); |
|---|
| | 29 | deleteLink( $ID, $u ); |
|---|
| | 30 | $count++; |
|---|
| | 31 | } |
|---|
| | 32 | return $count; |
|---|
| | 33 | } |
|---|
| | 34 | |
|---|
| | 35 | function delete_tags_for_user( $u, $confirm_true ) { |
|---|
| | 36 | if( !$u ) |
|---|
| | 37 | return; |
|---|
| | 38 | echo "for-each tag\n"; |
|---|
| | 39 | |
|---|
| | 40 | $q = run_query( getQuery( "tags_for_user", $u )); |
|---|
| | 41 | $c = mysql_num_rows($q); |
|---|
| | 42 | $count = 0; |
|---|
| | 43 | echo "for-each tag:\n"; |
|---|
| | 44 | while( $row = mysql_fetch_assoc( $q ) ) { |
|---|
| | 45 | $ID = urldecode( $row["ID"] ); |
|---|
| | 46 | delete_tag( $u, $ID ); |
|---|
| | 47 | $count++; |
|---|
| | 48 | } |
|---|
| | 49 | return $count; |
|---|
| | 50 | } |
|---|
| | 51 | |
|---|
| | 52 | function delete_tag( $u, $t ) { |
|---|
| | 53 | if( !$u || !$t ) |
|---|
| | 54 | return; |
|---|
| | 55 | echo " FIXME: delete the tag\n"; |
|---|
| | 56 | $qs = getQuery( "delete_tag", $u, $t ); |
|---|
| | 57 | $q = run_query( $qs ); |
|---|
| | 58 | echo $q; |
|---|
| | 59 | } |
|---|
| | 60 | |
|---|
| | 61 | function delete_user( $u, $confirm_true ) { |
|---|
| | 62 | if( !$u ) |
|---|
| | 63 | return; |
|---|
| | 64 | echo "deleted " . delete_links_for_user( $u, $confirm_true ) . " links.\n"; |
|---|
| | 65 | echo "deleted " . delete_tags_for_user( $u, $confirm_true ) . " tags.\n"; |
|---|
| | 66 | echo "FIXME: delete the comments\n"; # FIXME: not implemented |
|---|
| | 67 | } |
|---|