forum); $category = BoincCategory::lookup_id($forum->category); function subscribe($category, $forum, $thread, $user) { if (BoincSubscription::replace($user->id, $thread->id)) { page_head("Subscription Successful"); show_forum_title($user, $category, $forum, $thread, true); echo "
You are now subscribed to ", cleanup_title($thread->title), ". You will receive an email whenever someone posts to the thread."; } else { page_head("Subscription failed"); echo "
We are currently unable to subscribe you to this thread (", cleanup_title($thread->title), "). Please try again later.."; } echo "
"; page_tail(); } function unsubscribe($category, $forum, $thread, $user) { BoincSubscription::delete($user->id, $thread->id); if (!BoincSubscription::lookup($user->id, $thread->id)) { page_head("Unsubscription Successful"); show_forum_title($user, $category, $forum, $thread, true); echo "You are no longer subscribed to ", cleanup_title($thread->title), ". You will no longer receive notifications for this thread."; } else { page_head("Unsubscription failed"); echo "
We are currently unable to unsubscribe you to this thread (", cleanup_title($thread->title), "). Please try again later.."; } echo "
"; page_tail(); } if ($thread && $action) { $user = get_logged_in_user(); check_tokens($user->authenticator); if ($action == "subscribe") { subscribe($category, $forum, $thread, $user); exit(); } else if ($action == "unsubscribe") { unsubscribe($category, $forum, $thread, $user); exit(); } else { show_result_page(null, false, $thread); exit(); } } else { error_page("Unknown subscription action"); } ?>