mirror of https://github.com/BOINC/boinc.git
Stickies and new forum rules
svn path=/trunk/boinc/; revision=5902
This commit is contained in:
parent
cddce53f72
commit
a27c54cc31
|
@ -85,8 +85,7 @@ function show_forum($category, $forum, $start, $sort_style, $logged_in_user) {
|
|||
} else {
|
||||
start_forum_table(array("", "Threads", "Posts", "Author", "Views", "Last post"));
|
||||
}
|
||||
|
||||
$threads = getThreads($forum->id, $start, $threads_per_page, $sort_style);
|
||||
$threads = getThreads($forum->id, $start, $threads_per_page, $sort_style, 0, 1);
|
||||
$n = 0;
|
||||
|
||||
while ($thread = mysql_fetch_object($threads)) {
|
||||
|
@ -106,9 +105,15 @@ function show_forum($category, $forum, $start, $sort_style, $logged_in_user) {
|
|||
if ($first_post->score*$first_post->votes<$logged_in_user->low_rating_threshold) {
|
||||
echo "<img src=\"".FILTER_IMAGE."\" alt=\"Filtered thread\">";
|
||||
}
|
||||
if ($unread) {
|
||||
if ($unread && !$thread->sticky) {
|
||||
echo "<img src=\"".NEW_IMAGE."\" alt=\"Unread post(s)\">";
|
||||
}
|
||||
elseif($unread) {
|
||||
echo "<img src=\"".NEW_IMAGE_STICKY."\" alt=\"Unread post(s)\">";
|
||||
}
|
||||
elseif($thread->sticky) {
|
||||
echo "<img src=\"".STICKY_IMAGE."\" alt=\"Sticky\">";
|
||||
}
|
||||
echo "</nobr></td>";
|
||||
}
|
||||
echo "<td style=\"font-size:10pt; text-align:left\"><a href=\"forum_thread.php?id=", $thread->id, "\"><b>", cleanup_title($thread->title), "</b></a><br>";
|
||||
|
@ -144,7 +149,6 @@ function show_forum($category, $forum, $start, $sort_style, $logged_in_user) {
|
|||
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
end_forum_table();
|
||||
|
||||
if ($forum->threads > $n) {
|
||||
|
|
|
@ -17,7 +17,7 @@ if ($_POST['submit']) {
|
|||
$thread = getThread($post->thread);
|
||||
|
||||
if (time() > $post->timestamp + MAXIMUM_EDIT_TIME){
|
||||
echo "You can no longer edit this post.<br>Posts can only be edited at most ".(MAXIMUM_EDIT_TIME/60)." minutes after they have been created.";
|
||||
echo "You can no longer edit this post.<br />Posts can only be edited at most ".(MAXIMUM_EDIT_TIME/60)." minutes after they have been created.";
|
||||
exit();
|
||||
}
|
||||
if ($logged_in_user->id != $post->user) {
|
||||
|
@ -42,7 +42,7 @@ $thread = getThread($post->thread);
|
|||
$forum = getForum($thread->forum);
|
||||
$category = getCategory($forum->category);
|
||||
if (time() > $post->timestamp + MAXIMUM_EDIT_TIME){
|
||||
echo "You can no longer edit this post.<br>Posts can only be edited at most ".(MAXIMUM_EDIT_TIME/60)." minutes after they have been created.";
|
||||
echo "You can no longer edit this post.<br />Posts can only be edited at most ".(MAXIMUM_EDIT_TIME/60)." minutes after they have been created.";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,17 @@ $user = get_logged_in_user();
|
|||
$user = getForumPreferences($user);
|
||||
|
||||
if (!post_str('action')) {
|
||||
echo "You must specify an action...";
|
||||
exit();
|
||||
if (!get_str('action')){
|
||||
echo "You must specify an action...";
|
||||
exit();
|
||||
} else {
|
||||
$action = get_str('action');
|
||||
}
|
||||
} else {
|
||||
$action = post_str('action');
|
||||
}
|
||||
$thread = getThread($_GET['thread']);
|
||||
|
||||
$thread = getThread(get_int('thread'));
|
||||
if (!$thread){
|
||||
// TODO: Standard error page
|
||||
echo "Invalid thread ID.<br>";
|
||||
|
@ -30,12 +37,18 @@ if (!isSpecialUser($user,0)) {
|
|||
exit();
|
||||
}
|
||||
|
||||
if (post_str('action')=="hide"){
|
||||
if ($action=="hide"){
|
||||
$result=mysql_query("update thread set hidden = ".post_int("category")." where id=".$thread->id);
|
||||
echo mysql_error();
|
||||
} elseif ($_POST['action']=="unhide"){
|
||||
} elseif ($action=="unhide"){
|
||||
$result=mysql_query("update thread set hidden = 0 where id=".$thread->id);
|
||||
echo mysql_error();
|
||||
} elseif ($action=="sticky"){
|
||||
$result=mysql_query("update thread set sticky = 1 where id=".$thread->id);
|
||||
echo mysql_error();
|
||||
} elseif ($action=="desticky"){
|
||||
$result=mysql_query("update thread set sticky = 0 where id=".$thread->id);
|
||||
echo mysql_error();
|
||||
/*} elseif ($_POST['action']=="move"){
|
||||
if (getThread($_POST['threadid'])){
|
||||
$result=mysql_query("update post set thread = ".intval($_POST['threadid'])." where id=".$post->id);
|
||||
|
|
|
@ -14,7 +14,20 @@ $forum = getForum($forumid);
|
|||
if (!$forum) {
|
||||
error_page("no such forum");
|
||||
}
|
||||
|
||||
if ($logged_in_user->total_credit<$forum->post_min_total_credit || $logged_in_user->expavg_credit<$forum->post_min_expavg_credit){
|
||||
//If user haven't got enough credit (according to forum regulations)
|
||||
//We do not tell the (ab)user how much this is - no need to make it easy for them to break the system.
|
||||
error_page(
|
||||
"In order to create a new thread in ".$forum->title." you must have a certain amount of credit.
|
||||
This is to prevent and protect against abuse of the system.");
|
||||
}
|
||||
if (time()-$logged_in_user->last_post<$forum->post_min_interval){
|
||||
//If the user is posting faster than forum regulations allow
|
||||
//Tell the user to wait a while before creating any more posts
|
||||
error_page(
|
||||
"You cannot create any more threads right now. Please wait a while before trying again.<br />
|
||||
This delay has been enforced to protect against abuse of the system.");
|
||||
}
|
||||
$title = post_str("title", true);
|
||||
$content = post_str("content", true);
|
||||
if ($title && $content) {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
require_once('../inc/forum.inc');
|
||||
require_once('../inc/util.inc');
|
||||
require_once('../inc/credit.inc');
|
||||
|
||||
|
||||
db_init();
|
||||
|
||||
|
@ -26,9 +28,24 @@ if (!empty($_GET['post'])) {
|
|||
|
||||
$user = get_logged_in_user(true);
|
||||
$user = getForumPreferences($user);
|
||||
|
||||
// Temporary:
|
||||
// Check the user's credit average to see if it is greater than 5, if not,
|
||||
// treat them as though they have already rated the post. This should keep
|
||||
// people from creating multiple accounts just to harass forum members.
|
||||
// TODO: Use the forum table fields rate_min_total_credit and rate_min_expavg_credit
|
||||
// to determine instead of hardcoded value.
|
||||
$avg = $user->expavg_credit;
|
||||
$avg_time = $user->expavg_time;
|
||||
$now = time(0);
|
||||
update_average($now, 0, 0, $avg, $avg_time);
|
||||
|
||||
if ($avg<5){
|
||||
error_page("To rate a post you must have a certain amount of credit");
|
||||
}
|
||||
|
||||
if (getHasRated($user,$postId)) {
|
||||
echo "You have already rated this post.";
|
||||
error_page("You have already rated this post once.");
|
||||
} else {
|
||||
$result = mysql_query("SELECT * FROM post WHERE id = $postId");
|
||||
if ($result) {
|
||||
|
|
|
@ -9,6 +9,30 @@ db_init();
|
|||
$logged_in_user = get_logged_in_user(true);
|
||||
$logged_in_user = getForumPreferences($logged_in_user);
|
||||
|
||||
$thread = getThread(get_int('thread'));
|
||||
$forum = getForum($thread->forum);
|
||||
$category = getCategory($forum->category);
|
||||
$helpdesk = $category->is_helpdesk;
|
||||
|
||||
if (!$thread){
|
||||
error("No such thread found");
|
||||
}
|
||||
if ($logged_in_user->total_credit<$forum->post_min_total_credit || $logged_in_user->expavg_credit<$forum->post_min_expavg_credit){
|
||||
//If user haven't got enough credit (according to forum regulations)
|
||||
//We do not tell the (ab)user how much this is - no need to make it easy for them to break the system.
|
||||
error_page(
|
||||
"In order to reply to a post in ".$forum->title." you must have a certain amount of credit.
|
||||
This is to prevent and protect against abuse of the system.");
|
||||
}
|
||||
if (time()-$logged_in_user->last_post<$forum->post_min_interval){
|
||||
//If the user is posting faster than forum regulations allow
|
||||
//Tell the user to wait a while before creating any more posts
|
||||
error_page(
|
||||
"You cannot reply to any more posts right now. Please wait a while before trying again.<br />
|
||||
This delay has been enforced to protect against abuse of the system.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!empty($_GET['thread']) && !empty($_POST['content'])) {
|
||||
$_GET['thread'] = stripslashes($_GET['thread']);
|
||||
|
@ -41,10 +65,6 @@ if (!empty($_GET['post'])) {
|
|||
$post = getPost($_GET['post']);
|
||||
}
|
||||
|
||||
$thread = getThread($_GET['thread']);
|
||||
$forum = getForum($thread->forum);
|
||||
$category = getCategory($forum->category);
|
||||
$helpdesk = $category->is_helpdesk;
|
||||
|
||||
|
||||
// TODO: Write a function for this.
|
||||
|
|
|
@ -114,7 +114,11 @@ if ($thread->hidden) {
|
|||
}
|
||||
|
||||
if (isSpecialUser($logged_in_user,0)){ //If logged in users is moderator
|
||||
echo "<br><a href=\"forum_moderate_thread.php?action=hide&thread=$thread->id\">Delete this thread</a>";
|
||||
echo "<br /><a href=\"forum_moderate_thread.php?action=hide&thread=$thread->id\">Delete this thread</a>";
|
||||
if($thread->sticky)
|
||||
{ echo "<br /><a href=\"forum_moderate_thread_action.php?action=desticky&thread=$thread->id\">De-sticky this thread</a>"; }
|
||||
else
|
||||
{ echo "<br /><a href=\"forum_moderate_thread_action.php?action=sticky&thread=$thread->id\">Make this thread sticky</a>"; }
|
||||
}
|
||||
|
||||
echo "</td>";
|
||||
|
|
Loading…
Reference in New Issue