2005-01-18 13:00:38 +00:00
< ? php
2008-08-05 22:43:14 +00:00
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// 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/>.
2007-11-12 20:57:15 +00:00
// The form where a moderator decides what he is going to do to a post.
// Submits informaiton to forum_moderate_post_action.php for actual action
// to be done.
2005-01-18 13:00:38 +00:00
require_once ( '../inc/forum.inc' );
2011-02-11 18:32:47 +00:00
check_get_args ( array ( " id " , " action " , " userid " , " tnow " , " ttok " ));
2011-02-09 22:11:34 +00:00
2007-11-12 20:57:15 +00:00
$logged_in_user = get_logged_in_user ();
2011-02-11 18:32:47 +00:00
check_tokens ( $logged_in_user -> authenticator );
2007-11-12 20:57:15 +00:00
BoincForumPrefs :: lookup ( $logged_in_user );
2007-11-15 22:51:05 +00:00
$postid = get_int ( 'id' );
$post = BoincPost :: lookup_id ( $postid );
$thread = BoincThread :: lookup_id ( $post -> thread );
$forum = BoincForum :: lookup_id ( $thread -> forum );
2005-01-18 13:00:38 +00:00
2006-06-16 23:53:56 +00:00
if ( ! get_str ( 'action' )) {
2007-11-15 22:51:05 +00:00
error_page ( " No action specified " );
2005-01-18 13:00:38 +00:00
}
2007-11-15 22:51:05 +00:00
if ( ! is_moderator ( $logged_in_user , $forum )) {
2006-06-16 23:53:56 +00:00
error_page ( " You are not authorized to moderate this post. " );
}
2011-08-25 22:12:48 +00:00
page_head ( tra ( " Moderate post " ));
2005-01-18 13:00:38 +00:00
2007-11-12 20:57:15 +00:00
echo " <form action= \" forum_moderate_post_action.php?id= " . $post -> id . " \" method= \" POST \" > \n " ;
echo form_tokens ( $logged_in_user -> authenticator );
2005-01-18 13:00:38 +00:00
start_table ();
2005-02-17 11:43:49 +00:00
if ( get_str ( 'action' ) == " hide " ) {
2005-01-18 13:00:38 +00:00
//display input that selects reason
echo " <input type=hidden name=action value=hide> " ;
2011-08-25 22:12:48 +00:00
row1 ( tra ( " Hide post " ));
row2 ( tra ( " Reason " ),
2005-01-18 13:00:38 +00:00
" <select name= \" category \" >
2011-08-25 22:12:48 +00:00
< option value = \ " 1 \" > " . tra ( " Obscene " ) . " </option>
< option value = \ " 2 \" > " . tra ( " Flame/Hate mail " ) . " </option>
< option value = \ " 3 \" > " . tra ( " Commercial spam " ) . " </option>
< option value = \ " 4 \" > " . tra ( " Doublepost " ) . " </option>
< option value = \ " 5 \" > " . tra ( " User Request " ) . " </option>
< option value = \ " 6 \" > " . tra ( " Other " ) . " </option>
2005-01-18 13:00:38 +00:00
</ select > " );
2005-02-17 11:43:49 +00:00
} elseif ( get_str ( 'action' ) == " move " ) {
2011-08-25 22:12:48 +00:00
row1 ( tra ( " Move post " ));
2005-01-18 13:00:38 +00:00
echo " <input type=hidden name=action value=move> " ;
2011-08-25 22:12:48 +00:00
row2 ( tra ( " Destination thread ID: " ), " <input name= \" threadid \" > " );
// TODO: display where to move the post as a dropdown instead of having to get ID
2006-08-08 20:32:37 +00:00
} elseif ( get_str ( 'action' ) == " banish_user " ) {
$userid = get_int ( 'userid' );
2007-11-12 20:57:15 +00:00
$user = BoincUser :: lookup_id ( $userid );
BoincForumPrefs :: lookup ( $user );
2006-08-08 20:32:37 +00:00
if ( ! $user ) {
2011-08-25 22:12:48 +00:00
error_page ( " no user found " );
2006-08-08 20:32:37 +00:00
}
2007-11-12 20:57:15 +00:00
$x = $user -> prefs -> banished_until ;
2006-08-08 20:32:37 +00:00
if ( $x > time ()) {
2011-08-25 22:12:48 +00:00
error_page ( tra ( " User is already banished " ));
2006-08-08 20:32:37 +00:00
}
2011-08-25 22:12:48 +00:00
row1 ( tra ( " Banish user " ));
row1 ( tra ( " Are you sure you want to banish %1?<br/>This will prevent %1 from posting for chosen time period.<br/>It should be done only if %1 has consistently exhibited trollish behavior. " , $user -> name ));
row2 ( tra ( " Ban duration " ), " <select name= \" duration \" >
< option value = \ " 14400 \" > " . tra ( " 4 hours " ) . " </option>
< option value = \ " 86400 \" > " . tra ( " 1 day " ) . " </option>
< option value = \ " 604800 \" > " . tra ( " 1 week " ) . " </option>
< option value = \ " 1209600 \" selected= \" selected \" > " . tra ( " 2 weeks " ) . " </option>
< option value = \ " 2592000 \" > " . tra ( " 1 month " ) . " </option>
< option value = \ " -1 \" > " . tra ( " Forever " ) . " </option>
2007-03-24 14:57:30 +00:00
</ select > " );
echo " <input type= \" hidden \" name= \" action \" value= \" banish_user \" > \n " ;
echo " <input type= \" hidden \" name= \" id \" value= \" " . $postid . " \" > \n " ;
echo " <input type= \" hidden \" name= \" userid \" value= \" " . $userid . " \" > \n " ;
echo " <input type= \" hidden \" name= \" confirmed \" value= \" yes \" > \n " ;
2005-01-18 13:00:38 +00:00
} else {
2011-08-25 22:12:48 +00:00
error_page ( " Unknown action " );
2005-01-18 13:00:38 +00:00
}
2011-08-25 22:12:48 +00:00
row2 ( tra ( " Optional explanation %1 This is included in email to user.%2 " , " <br><span class=note> " , " </span> " ),
2007-03-24 14:57:30 +00:00
" <textarea name= \" reason \" rows= \" 10 \" cols= \" 80 \" ></textarea> " );
2005-01-18 13:00:38 +00:00
row2 (
" " ,
2011-08-25 22:12:48 +00:00
" <input type= \" submit \" name= \" submit \" value= \" " . tra ( " OK " ) . " \" > "
2005-01-18 13:00:38 +00:00
);
end_table ();
echo " </form> " ;
page_tail ();
?>