// but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. // // This file was modified by contributors of "BOINC Web Tweak" project. // Use this file you can post a reply to a thread. // Both input (form) and action take place here. require_once '../inc/forum_email.inc'; require_once '../inc/forum.inc'; require_once '../inc/akismet.inc'; $logged_in_user = get_logged_in_user(true); BoincForumPrefs::lookup($logged_in_user); check_banished($logged_in_user); $thread = BoincThread::lookup_id(get_int('thread')); $forum = BoincForum::lookup_id($thread->forum); $sort_style = get_str('sort', true); $filter = get_str('filter', true); $content = post_str('content', true); $preview = post_str("preview", true); $parent_post_id = get_int('post', true); $parent_post = null; if ($parent_post_id) { $parent_post = BoincPost::lookup_id($parent_post_id); if ($parent_post->thread != $thread->id) { error_page("wrong thread"); } } else { $parent_post_id = 0;
function do_send($logged_in_user) { global $replyto, $userid; check_banished($logged_in_user); check_tokens($logged_in_user->authenticator); $to = sanitize_tags(post_str("to", true)); $subject = post_str("subject", true); $content = post_str("content", true); if (post_str("preview", true) == tra("Preview")) { pm_form($replyto, $userid); } if ($to == null || $subject == null || $content == null) { pm_form($replyto, $userid, tra("You need to fill all fields to send a private message")); } else { if (!akismet_check($logged_in_user, $content)) { pm_form($replyto, $userid, tra("Your message was flagged as spam\n by the Akismet anti-spam system.\n Please modify your text and try again.")); } $to = str_replace(", ", ",", $to); // Filter out spaces after separator $users = explode(",", $to); $userlist = array(); $userids = array(); // To prevent from spamming a single user by adding it multiple times foreach ($users as $username) { $user = explode(" ", $username); if (is_numeric($user[0])) { // user ID is gived $userid = $user[0]; $user = BoincUser::lookup_id($userid); if ($user == null) { pm_form($replyto, $userid, tra("Could not find user with id %1", $userid)); } } else { $user = BoincUser::lookup_name($username); if ($user == null) { pm_form($replyto, $userid, tra("Could not find user with username %1", $username)); } elseif ($user == -1) { // Non-unique username pm_form($replyto, $userid, tra("%1 is not a unique username; you will have to use user ID", $username)); } } BoincForumPrefs::lookup($user); if (is_ignoring($user, $logged_in_user)) { pm_form($replyto, $userid, tra("User %1 (ID: %2) is not accepting private messages from you.", $user->name, $user->id)); } if (!isset($userids[$user->id])) { $userlist[] = $user; $userids[$user->id] = true; } } foreach ($userlist as $user) { if (!is_moderator($logged_in_user, null)) { check_pm_count($logged_in_user->id); } pm_send_msg($logged_in_user, $user, $subject, $content, true); } Header("Location: pm.php?action=inbox&sent=1"); } }
// For this file to work the project must have defined who // should receive such reports (in the configuration file) require_once '../inc/util.inc'; require_once '../inc/forum.inc'; require_once '../inc/forum_email.inc'; if (DISABLE_FORUMS) { error_page("Forums are disabled"); } check_get_args(array("post", "submit", "reason", "tnow", "ttok")); $postId = get_int('post'); $post = BoincPost::lookup_id($postId); $thread = BoincThread::lookup_id($post->thread); $forum = BoincForum::lookup_id($thread->forum); $user = get_logged_in_user(); BoincForumPrefs::lookup($user); check_banished($user); // Make sure the user has the forum's minimum amount of RAC and total credit // before allowing them to report a post. // Using the same rules as for rating (at least for now) // if ($user->total_credit < $forum->rate_min_total_credit || $user->expavg_credit < $forum->rate_min_expavg_credit) { error_page(tra("You need more average or total credit to report a post.")); } //__-------------- Action part $success_page = 0; if (get_str("submit", true)) { check_tokens($user->authenticator); $reason = get_str("reason"); if (send_report_post_email($user, $forum, $thread, $post, $reason)) { $success_page = 1; } else {