2007-10-19 20:01:36 +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
2011-02-09 22:11:34 +00:00
require_once ( '../inc/util.inc' );
2007-11-12 20:57:15 +00:00
require_once ( '../inc/forum_db.inc' );
2007-10-19 20:01:36 +00:00
require_once ( '../inc/forum_banishment_vote.inc' );
2014-04-18 22:54:28 +00:00
if ( DISABLE_FORUMS ) error_page ( " Forums are disabled " );
2011-02-09 22:11:34 +00:00
check_get_args ( array ( " action " , " userid " ));
2007-10-19 20:01:36 +00:00
$config = get_config ();
2007-11-12 20:57:15 +00:00
$logged_in_user = get_logged_in_user ();
BoincForumPrefs :: lookup ( $logged_in_user );
2007-10-19 20:01:36 +00:00
if ( ! get_str ( 'action' )) {
error_page ( " You must specify an action... " );
}
2007-11-12 20:57:15 +00:00
if ( ! $logged_in_user -> prefs -> privilege ( S_MODERATOR )) {
2007-10-19 20:01:36 +00:00
// Can't moderate without being moderator
2011-08-25 22:12:48 +00:00
error_page ( tra ( " You are not authorized to banish users. " ));
2007-10-19 20:01:36 +00:00
}
$userid = get_int ( 'userid' );
2007-11-12 20:57:15 +00:00
$user = BoincUser :: lookup_id ( $userid );
2007-10-19 20:01:36 +00:00
2011-08-25 22:12:48 +00:00
page_head ( tra ( " Banishment Vote " ));
2007-10-19 20:01:36 +00:00
echo " <form action= \" forum_banishment_vote_action.php?userid= " . $userid . " \" method= \" POST \" > \n " ;
2007-11-12 20:57:15 +00:00
echo form_tokens ( $logged_in_user -> authenticator );
2007-10-19 20:01:36 +00:00
start_table ();
2011-08-25 22:12:48 +00:00
row1 ( tra ( " Banishment Vote " ));
2007-10-19 20:01:36 +00:00
if ( get_str ( 'action' ) == " start " ) {
if ( ! $user ) {
2011-08-25 22:12:48 +00:00
error_page ( tra ( " No user with this ID found. " ));
2007-10-19 20:01:36 +00:00
}
2015-01-19 01:19:15 +00:00
BoincForumPrefs :: lookup ( $user );
$x = $user -> prefs -> banished_until ;
2007-10-19 20:01:36 +00:00
if ( $x > time ()) {
2011-08-25 22:12:48 +00:00
error_page ( tra ( " User is already banished " ));
2007-10-19 20:01:36 +00:00
}
//display input that selects reason
echo " <input type=hidden name=action value=start> " ;
echo " <input type= \" hidden \" name= \" userid \" value= \" " . $userid . " \" > \n " ;
2011-08-25 22:12:48 +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 ));
2007-10-19 20:01:36 +00:00
row2 ( " " ,
2011-08-25 22:12:48 +00:00
tra ( " Select the reason category, optionally write a longer description of why the user should be banished. " ));
row2 ( tra ( " Category " ),
2007-10-19 20:01:36 +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 ( " User Request " ) . " </option>
< option value = \ " 4 \" > " . tra ( " Other " ) . " </option>
2007-10-19 20:01:36 +00:00
</ select > " );
2011-08-25 22:12:48 +00:00
row2 ( tra ( " Reason " ) . " <br> " . tra ( " Mailed if nonempty " ),
2007-10-19 20:01:36 +00:00
" <textarea name= \" reason \" rows= \" 10 \" cols= \" 80 \" ></textarea> " );
row2 (
" " ,
2014-10-02 19:15:54 +00:00
" <input class= \" btn btn-default \" type= \" submit \" name= \" submit \" value= \" " . tra ( " Proceed with vote " ) . " \" > "
2007-10-19 20:01:36 +00:00
);
} elseif ( get_str ( 'action' ) == " yes " ) {
vote_yes ( $config , $logged_in_user , $user );
} elseif ( get_str ( 'action' ) == " no " ) {
vote_no ( $config , $logged_in_user , $user );
} else {
2011-08-25 22:12:48 +00:00
error_page ( " Unknown action " );
2007-10-19 20:01:36 +00:00
}
end_table ();
echo " </form> " ;
page_tail ();
?>