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
2014-04-18 22:54:28 +00:00
// Copyright (C) 2014 University of California
2008-08-05 22:43:14 +00:00
//
// 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.
2014-04-18 22:54:28 +00:00
// Submits information to forum_moderate_post_action.php for actual action
2007-11-12 20:57:15 +00:00
// to be done.
2005-01-18 13:00:38 +00:00
2014-04-18 22:54:28 +00:00
require_once ( '../inc/util.inc' );
2005-01-18 13:00:38 +00:00
require_once ( '../inc/forum.inc' );
2014-04-18 22:54:28 +00:00
if ( DISABLE_FORUMS ) error_page ( " Forums are disabled " );
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 ();
2014-04-17 05:54:17 +00:00
$get_reason = true ;
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 " ),
2016-11-25 02:01:41 +00:00
select_from_array ( 'category' ,
array (
" " ,
tra ( " Obscene " ),
tra ( " Flame/Hate mail " ),
tra ( " Commercial spam " ),
tra ( " Doublepost " ),
tra ( " User Request " ),
tra ( " Other " ),
)
)
);
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 " ));
2017-07-04 11:13:01 +00:00
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 ));
2016-11-22 09:20:07 +00:00
row2 ( tra ( " Ban duration " ), " <select class= \" form-control \" name= \" duration \" >
2015-08-15 17:31:14 +00:00
< option value = \ " 21600 \" > " . tra ( " 6 hours " ) . " </option>
< option value = \ " 43200 \" > " . tra ( " 12 hours " ) . " </option>
2011-08-25 22:12:48 +00:00
< 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 " ;
2014-04-17 05:54:17 +00:00
} elseif ( get_str ( 'action' ) == " delete " ) {
echo " <input type=hidden name=action value=delete> " ;
row2 (
" Are you sure want to delete this post? This cannot be undone. " ,
2014-10-02 19:15:54 +00:00
" <input class= \" btn btn-danger \" type= \" submit \" name= \" submit \" value= \" " . tra ( " OK " ) . " \" > "
2014-04-17 05:54:17 +00:00
);
$get_reason = false ;
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
}
2014-04-17 05:54:17 +00:00
if ( $get_reason ) {
2016-12-07 19:32:25 +00:00
row2 ( tra ( " Optional explanation %1 This is included in email to user.%2 " , " <br><small> " , " </small> " ),
2016-11-25 04:32:01 +00:00
'<textarea name="reason" class="form-control" rows="10"></textarea>'
2014-04-17 05:54:17 +00:00
);
row2 (
" " ,
2017-08-20 08:17:21 +00:00
" <input class= \" btn btn-success \" type= \" submit \" name= \" submit \" value= \" " . tra ( " OK " ) . " \" > "
2014-04-17 05:54:17 +00:00
);
}
2005-01-18 13:00:38 +00:00
end_table ();
echo " </form> " ;
page_tail ();
?>