mirror of https://github.com/BOINC/boinc.git
Users can ignore other users in the forums
svn path=/trunk/boinc/; revision=4999
This commit is contained in:
parent
a8ed75997b
commit
a869084f87
|
@ -228,6 +228,7 @@ function getForumPreferences($user){
|
|||
$user->rated_posts=$prefs->rated_posts;
|
||||
$user->low_rating_threshold=$prefs->low_rating_threshold;
|
||||
$user->high_rating_threshold=$prefs->high_rating_threshold;
|
||||
$user->ignorelist=$prefs->ignorelist;
|
||||
$user->forum_preferences=1;
|
||||
|
||||
//Set defaults in certain cases:
|
||||
|
@ -459,8 +460,18 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS
|
|||
$data = mysql_query("SELECT userid FROM profile WHERE userid = " . $user->id); //Lookup existance of profile for user
|
||||
$user->has_profile = (mysql_numrows($data) > 0); //and store this info in the user object
|
||||
$user->has_avatar = ($user->avatar != ""); //for later access
|
||||
|
||||
//If the user that made this post is on the list of people to ignore, change thresholds to be more strict
|
||||
|
||||
if (in_array($user->id,explode("|",$logged_in_user->ignorelist))){
|
||||
$user_is_on_ignorelist=true;
|
||||
$rated_below_threshold = ($logged_in_user->high_rating_threshold>($post->score*$post->votes));
|
||||
$rated_above_threshold = ($logged_in_user->high_rating_threshold+abs($logged_in_user->low_rating_threshold)<($post->score*$post->votes));
|
||||
} else { //Use normal threshold values
|
||||
$rated_below_threshold = ($logged_in_user->low_rating_threshold>($post->score*$post->votes));
|
||||
$rated_above_threshold = ($logged_in_user->high_rating_threshold<($post->score*$post->votes));
|
||||
}
|
||||
|
||||
|
||||
$can_edit = $logged_in_user && $user->id == $logged_in_user->id;
|
||||
|
||||
|
@ -527,7 +538,8 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS
|
|||
if ($can_edit && $controls != NO_CONTROLS) echo " <a href=\"forum_edit.php?id=$post->id\">[Edit this post]</a>";
|
||||
if ($post->modified) echo "<br>Last modified: ", pretty_time_Str($post->modified);
|
||||
if ($rated_below_threshold && $filter){
|
||||
echo "<br>This post has been filtered (rating: ".($post->score * $post->votes)."), press <a href=\"?id=".$thread->id."&filter=false#".$post->id."\">here</a> to view this thread without filtering";
|
||||
if ($user_is_on_ignorelist) $andtext=" and the user is on your ignore list";
|
||||
echo "<br>This post has been filtered (rating: ".($post->score * $post->votes).")$andtext, press <a href=\"?id=".$thread->id."&filter=false#".$post->id."\">here</a> to view this thread without filtering";
|
||||
}
|
||||
|
||||
echo "\n</font></td>\n";
|
||||
|
@ -555,7 +567,7 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS
|
|||
echo "</form>";
|
||||
}
|
||||
|
||||
if (!$filter || !$rated_below_threshold){
|
||||
if (!$filter || !$rated_below_threshold){ //If either filtering is turned off of this post is not below the threshold
|
||||
$posttext=nl2br(stripslashes($post->content));
|
||||
if ($post->signature && !$logged_in_user->hide_signatures){ //If the creator of this post has a signature and
|
||||
$posttext.=nl2br("\n".stripslashes($user->signature)); //wants it to be shown for this post AND the logged in
|
||||
|
|
|
@ -5,9 +5,12 @@ require_once("../inc/user.inc");
|
|||
require_once("../inc/profile.inc");
|
||||
require_once("../inc/util.inc");
|
||||
require_once("../inc/image.inc");
|
||||
require_once("../inc/forum.inc");
|
||||
|
||||
|
||||
db_init();
|
||||
$user = get_logged_in_user();
|
||||
$user = getForumPreferences($user);
|
||||
|
||||
$avatar_url = mysql_escape_string($HTTP_POST_VARS["avatar_url"]);
|
||||
if (substr($avatar_url,0,4)!="http") $avatar_url="http://".$avatar_url;
|
||||
|
@ -51,7 +54,7 @@ $hide_signatures = ($HTTP_POST_VARS["forum_hide_signatures"]!="");
|
|||
$jump_to_unread = ($HTTP_POST_VARS["forum_jump_to_unread"]!="");
|
||||
$low_rating_threshold = intval($HTTP_POST_VARS["forum_low_rating_threshold"]);
|
||||
$high_rating_threshold = intval($HTTP_POST_VARS["forum_high_rating_threshold"]);
|
||||
|
||||
$add_user_to_filter = ($HTTP_POST_VARS["add_user_to_filter"]!="");
|
||||
|
||||
$no_signature_by_default=($HTTP_POST_VARS["signature_enable"]=="");
|
||||
$signature = sanitize_html(stripslashes($HTTP_POST_VARS["signature"]));
|
||||
|
@ -68,6 +71,24 @@ $answer_sort = $HTTP_POST_VARS["answer_sort"];
|
|||
$forum_sorting=mysql_escape_string(implode("|",array($forum_sort,$thread_sort,$faq_sort,$answer_sort)));
|
||||
$has_prefs=mysql_query("select * from forum_preferences where userid='".$user->id."'");
|
||||
|
||||
if ($add_user_to_filter){ //see if we should add any users to the ignorelist
|
||||
$user_to_add = $HTTP_POST_VARS["forum_filter_user"];
|
||||
if ($user_to_add!="" and $user_to_add==strval(intval($user_to_add))){
|
||||
$ignorelist = $user->ignorelist."|".$user_to_add;
|
||||
} else {
|
||||
$ignorelist = $user->ignorelist;
|
||||
}
|
||||
}
|
||||
$ignored_users = explode("|",$ignorelist);
|
||||
for ($i=1;$i<sizeof($ignored_users);$i++){
|
||||
if ($HTTP_POST_VARS["remove".$ignored_users[$i]]!=""){
|
||||
//this user will be removed
|
||||
} else {
|
||||
//the user should be in the new list
|
||||
$real_ignorelist.="|".$ignored_users[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$result = mysql_query(
|
||||
"update forum_preferences set
|
||||
avatar_type='".$avatar_type."',
|
||||
|
@ -81,6 +102,7 @@ $result = mysql_query(
|
|||
jump_to_unread='".$jump_to_unread."',
|
||||
hide_signatures='".$hide_signatures."',
|
||||
low_rating_threshold='".$low_rating_threshold."',
|
||||
ignorelist='".$real_ignorelist."',
|
||||
high_rating_threshold='".$high_rating_threshold."'
|
||||
where userid=$user->id"
|
||||
);
|
||||
|
|
|
@ -94,6 +94,27 @@ row2("Filtering".
|
|||
"
|
||||
);
|
||||
|
||||
$filtered_userlist=explode("|",$user->ignorelist);
|
||||
for ($i=1;$i<sizeof($filtered_userlist);$i++){
|
||||
$filtered_user = lookup_user_id($filtered_userlist[$i]);
|
||||
$forum_filtered_userlist.="<input type =\"submit\" name=\"remove".$filtered_userlist[$i]."\" value=\"Remove\"> ".$filtered_userlist[$i]." - ".user_links($filtered_user,URL_BASE)."<br>";
|
||||
}
|
||||
row2("Filtered users".
|
||||
"<br><font size=-2>Ignore specific users<br>You can define a list of users to ignore.<br>These users will have to write posts with very high<br> rating in order to not be filtered.</font>",
|
||||
"<table><tr><td>
|
||||
$forum_filtered_userlist
|
||||
</td></tr></table>
|
||||
<table width=\"380\">
|
||||
<tr><td width=\"32\"><input type=\"text\" name=\"forum_filter_user\" style=\"width: 80px;\"></td><td>Userid (For instance: 123456789)</td></tr>
|
||||
<tr><td colspan=\"2\"><input type=\"submit\" name=\"add_user_to_filter\" value=\"Add user to filter\"></td></tr>
|
||||
<tr><td colspan=2>
|
||||
Please note that you can only filter a limited number of users.
|
||||
</td></tr>
|
||||
</table>
|
||||
"
|
||||
);
|
||||
|
||||
|
||||
|
||||
if ($user->no_signature_by_default==0){$enable_signature="checked=\"checked\"";} else {$enable_signature="";}
|
||||
$signature=stripslashes($user->signature);
|
||||
|
|
Loading…
Reference in New Issue