コード例 #1
0
ファイル: repair_forums.php プロジェクト: Turante/boincweb
function cleanup_orphan_threads()
{
    $threads = BoincThread::enum("");
    foreach ($threads as $thread) {
        $forum = BoincForum::lookup_id($thread->forum);
        if (!$forum) {
            cleanup_thread($thread);
        }
    }
}
コード例 #2
0
ファイル: team_forum.php プロジェクト: Turante/boincweb
function create_forum($user, $team)
{
    $f = BoincForum::lookup("parent_type=1 and category={$team->id}");
    if ($f) {
        error_page("Team already has a forum");
    }
    $id = BoincForum::insert("(category, parent_type) values ({$team->id}, 1)");
    $forum = BoincForum::lookup_id($id);
    if (!$forum) {
        error_page("Couldn't create forum");
    }
    edit_form($user, $team, $forum, true);
}
コード例 #3
0
// 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/>.
$cli_only = true;
require_once "../inc/util_ops.inc";
require_once "../inc/forum_db.inc";
define('MAX_REWARD', 4096);
define('SCALAR', 0.9);
set_time_limit(0);
echo date(DATE_RFC822), ": Starting\n";
$now = time();
$threads = BoincThread::enum();
foreach ($threads as $thread) {
    $is_helpdesk = false;
    $forum = BoincForum::lookup_id($thread->forum);
    if ($forum && $forum->parent_type == 0) {
        $category = BoincCategory::lookup_id($forum->category);
        if ($category && $category->is_helpdesk) {
            $is_helpdesk = true;
        }
    }
    if ($is_helpdesk) {
        $diff = ($now - $thread->create_time) / 86400;
        $activity = ($thread->sufferers + 1) / $diff;
        echo "thread {$thread->id} helpdesk {$diff} {$activity}\n";
    } else {
        $posts = BoincPost::enum("thread={$thread->id}");
        $activity = 0;
        foreach ($posts as $post) {
            $diff = $now - $post->timestamp;
コード例 #4
0
ファイル: forum_forum.php プロジェクト: Turante/boincweb
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
//
// This file was modified by contributors of "BOINC Web Tweak" project.
// display the threads in a forum.
require_once '../inc/util.inc';
require_once '../inc/time.inc';
require_once '../inc/forum.inc';
require_once '../inc/pm.inc';
$id = get_int("id");
$sort_style = get_int("sort", true);
$start = get_int("start", true);
if (!$start) {
    $start = 0;
}
$forum = BoincForum::lookup_id($id);
$user = get_logged_in_user(false);
if (!is_forum_visible_to_user($forum, $user)) {
    error_page("Not visible");
}
BoincForumPrefs::lookup($user);
if (!$sort_style) {
    // get the sort style either from the logged in user or a cookie
    if ($user) {
        $sort_style = $user->prefs->forum_sorting;
    } else {
        if (isset($_COOKIE['sorting'])) {
            list($sort_style, $thread_style) = explode("|", $_COOKIE['sorting']);
        }
    }
} else {
コード例 #5
0
    }
    page_head("Post deleted");
    if (BoincThread::lookup_id($thread->id)) {
        echo "Post successfully deleted.\n            <p>\n            <a href=forum_thread.php?id={$thread->id}>Return to thread</a>\n        ";
    } else {
        echo "Post and thread successfully deleted.\n            <p>\n            <a href=forum_forum.php?id={$forum->id}>Return to forum</a>\n        ";
    }
    page_tail();
    exit;
} elseif ($action == "move") {
    $destid = post_int('threadid');
    $new_thread = BoincThread::lookup_id($destid);
    if (!$new_thread) {
        error_page("No such thread");
    }
    $new_forum = BoincForum::lookup_id($new_thread->forum);
    if ($forum->parent_type != $new_forum->parent_type) {
        error_page(tra("Can't move to different category type"));
    }
    if ($forum->parent_type != 0) {
        if ($forum->category != $new_forum->category) {
            error_page(tra("Can't move to different category"));
        }
    }
    $result = move_post($post, $thread, $forum, $new_thread, $new_forum);
    $explanation = "Old thread: {$thread->title}\n" . secure_url_base() . "forum_thread.php?id={$thread->id}\nNew thread: {$new_thread->title}\n" . secure_url_base() . "forum_thread.php?id={$new_thread->id}&postid={$post->id}\n";
    $explanation .= mod_comment();
    $action_name = "moved to another thread";
} elseif ($action == "banish_user") {
    $auth = false;
    if (defined("MODERATORS_CAN_BANISH") && $user->prefs->privilege(S_MODERATOR)) {
コード例 #6
0
        $action_name = "made non-sticky";
        break;
    case "lock":
        $result = $thread->update("locked=1");
        $action_name = "locked";
        break;
    case "unlock":
        $result = $thread->update("locked=0");
        $action_name = "unlocked";
        break;
    case "move":
        if ($forum->parent_type != 0) {
            error_page("No");
        }
        $fid = post_int('forumid');
        $new_forum = BoincForum::lookup_id($fid);
        $result = move_thread($thread, $forum, $new_forum);
        $action_name = "moved from {$forum->title} to {$new_forum->title}";
        break;
    case "title":
        $new_title = post_str('newtitle');
        $title = BoincDb::escape_string($new_title);
        $result = $thread->update("title='{$title}'");
        $action_name = "renamed from '{$thread->title}' to '{$new_title}'";
        break;
    default:
        error_page("Unknown action");
}
if (!$result) {
    error_page("Moderation failed");
}