function delete_user($user) { global $test; $age = (time() - $user->create_time) / 86400; echo "----------------\ndeleting user {$user->id} email {$user->email_addr} name {$user->name} age {$age} days\n"; if ($test) { return; } delete_profile($user); forum_delete_user($user); BoincPrivateMessage::delete_aux("userid={$user->id} or senderid={$user->id}"); BoincNotify::delete_aux("userid={$user->id}"); $q = "delete from user where id={$user->id}"; _mysql_query($q); }
function do_inbox($logged_in_user) { page_head(tra("Private messages") . ": " . tra("Inbox")); make_script(); if (get_int("sent", true) == 1) { echo "<div class=\"notice\">" . tra("Your message has been sent.") . "</div>\n"; } $options = get_output_options($logged_in_user); BoincNotify::delete_aux("userid={$logged_in_user->id} and type=" . NOTIFY_PM); $msgs = BoincPrivateMessage::enum("userid={$logged_in_user->id} ORDER BY date DESC"); if (count($msgs) == 0) { echo tra("You have no private messages."); } else { echo "<form name=msg_list action=pm.php method=post>\n <input type=hidden name=action value=delete_selected>\n "; echo form_tokens($logged_in_user->authenticator); start_table(); echo "<tr><th>" . tra("Subject") . "</th><th>" . tra("Sender and date") . "</th><th>" . tra("Message") . "</th></tr>\n"; $i = 0; foreach ($msgs as $msg) { $sender = BoincUser::lookup_id($msg->senderid); if (!$sender) { $msg->delete(); continue; } $i++; $class = $i % 2 ? "row0" : "row1"; echo "<tr class={$class}>\n"; $checkbox = "<input type=checkbox name=pm_select_{$msg->id}>"; if (!$msg->opened) { $msg->update("opened=1"); } echo "<td valign=top> {$checkbox} {$msg->subject} </td>\n"; echo "<td valign=top>" . user_links($sender, BADGE_HEIGHT_SMALL); show_block_link($msg->senderid); echo "<br>" . time_str($msg->date) . "</td>\n"; echo "<td valign=top>" . output_transform($msg->content, $options) . "<p>"; $tokens = url_tokens($logged_in_user->authenticator); show_button("pm.php?action=new&replyto={$msg->id}", tra("Reply"), tra("Reply to this message")); show_button("pm.php?action=delete&id={$msg->id}&{$tokens}", tra("Delete"), tra("Delete this message")); echo "</ul></td></tr>\n"; } echo "\n <tr><td>\n <a href=\"javascript:set_all(1)\">" . tra("Select all") . "</a>\n |\n <a href=\"javascript:set_all(0)\">" . tra("Unselect all") . "</a>\n </td>\n <td colspan=2>\n <input class=\"btn btn-danger\" type=submit value=\"" . tra("Delete selected messages") . "\">\n </td></tr>\n "; end_table(); echo "</form>\n"; } page_tail(); }
} } } } echo "\n <p>\n <form action=\"forum_thread.php\">\n <table width=\"100%\" cellspacing=0 cellpadding=0>\n <tr class=\"forum_toplinks\">\n <td>\n"; $reply_url = ""; if (!$logged_in_user) { echo "To post messages, you must <a href=login_form.php>log in</a>."; } else { if (can_reply($thread, $forum, $logged_in_user)) { $reply_url = "forum_reply.php?thread=" . $thread->id . "#input"; show_button($reply_url, tra("Post to thread"), tra("Add a new message to this thread")); } if ($is_subscribed) { $type = NOTIFY_SUBSCRIBED_POST; BoincNotify::delete_aux("userid={$logged_in_user->id} and type={$type} and opaque={$thread->id}"); $url = "forum_subscribe.php?action=unsubscribe&thread=" . $thread->id . "{$tokens}"; show_button($url, tra("Unsubscribe"), tra("You are subscribed to this thread. Click here to unsubscribe.")); } else { $url = "forum_subscribe.php?action=subscribe&thread=" . $thread->id . "{$tokens}"; show_button($url, tra("Subscribe"), tra("Click to get email when there are new posts in this thread")); } // If logged in user is moderator, enable some extra features // if (is_moderator($logged_in_user, $forum)) { if ($thread->hidden) { show_button("forum_moderate_thread_action.php?action=unhide&thread=" . $thread->id . "{$tokens}", tra("Unhide"), tra("Unhide this thread")); } else { show_button("forum_moderate_thread.php?action=hide&thread=" . $thread->id, tra("Hide"), tra("Hide this thread")); } if ($thread->sticky) {
function delete_old_notifies() { $t = time() - 90 * 86400; BoincNotify::delete_aux("create_time < {$t}"); }