示例#1
0
function show_user_wap($user)
{
    wap_begin();
    if (!$user) {
        echo "<br/>User not found!<br/>";
        wap_end();
        return;
    }
    // keep a 'running tab' in wapstr in case exceeds 1K WAP limit
    $wapstr = PROJECT . "<br/>Account Data<br/>for {$user->name}<br/>Time: " . wap_timestamp();
    $wapstr .= show_credit_wap($user);
    if ($user->teamid) {
        $team = BoincTeam::lookup_id($user->teamid);
        $wapstr .= "<br/>Team: {$team->name}<br/>";
        $wapstr .= "Team TotCred: " . format_credit($team->total_credit) . "<br/>";
        $wapstr .= "Team AvgCred: " . format_credit($team->expavg_credit) . "<br/>";
    } else {
        $wapstr .= "<br/>Team: None<br/>";
    }
    // don't want to send more than 1KB probably?
    if (strlen($wapstr) > 1024) {
        echo substr($wapstr, 0, 1024);
    } else {
        echo $wapstr;
    }
    wap_end();
}
示例#2
0
文件: userw.php 项目: CalvinZhu/boinc
function show_user_wap($userid)
{
    wap_begin();
    $user = BoincUser::lookup_id($userid);
    if (!$user) {
        echo "<br/>" . tra("User not found!") . "<br/>";
        wap_end();
        return;
    }
    if ($user->teamid) {
        $team = BoincTeam::lookup_id($user->teamid);
    }
    $wapstr = PROJECT . "<br/>" . tra("Account Data<br/>for %1<br/>Time:", $user->name) . " " . wap_timestamp();
    $wapstr .= show_credit_wap($user);
    if ($user->teamid && $team) {
        $wapstr .= "<br/>" . tra("Team:") . " " . $team->name . "<br/>";
        $wapstr .= tra("Team TotCred:") . " " . format_credit($team->total_credit) . "<br/>";
        $wapstr .= tra("Team AvgCred:") . " " . format_credit($team->expavg_credit) . "<br/>";
    } else {
        $wapstr .= "<br/>" . tra("Team: None") . "<br/>";
    }
    // don't want to send more than 1KB (WAP limit)
    //
    if (strlen($wapstr) > 1024) {
        $wapstr = substr($wapstr, 0, 1024);
    }
    echo $wapstr;
    wap_end();
}
示例#3
0
function show_row($x, $y, $mode, $i)
{
    $class = $i % 2 ? "row0" : "row1";
    echo "<tr class={$class}><td>";
    switch ($mode) {
        case 'host':
            echo "<a href=show_host_detail.php?hostid={$x}>{$x}</a>";
            break;
        case 'user':
            $user = BoincUser::lookup_id($x);
            echo "<a href=show_user.php?userid={$x}>{$user->name}</a>";
            break;
        case 'team':
            $team = BoincTeam::lookup_id($x);
            if ($team) {
                echo "<a href=team_display.php?teamid={$x}>{$team->name}</a>";
            } else {
                echo "(no team)";
            }
            break;
        case 'model':
            echo $x;
            break;
        case 'day':
            echo $x;
            break;
    }
    echo "</td><td align=right>" . format_credit_large($y->credit), "</td><td align=right>{$y->nresults}</td></tr>\n";
}
示例#4
0
function show_user($user)
{
    echo "\n        <tr class=row1>\n        <td>", user_links($user), " (ID {$user->id})</td>\n    ";
    if ($user->teamid) {
        $team = BoincTeam::lookup_id($user->teamid);
        echo "\n            <td> <a href=team_display.php?teamid={$team->id}>{$team->name}</a> </td>\n        ";
    } else {
        echo "<td><br></td>";
    }
    echo "\n        <td align=right>", format_credit($user->expavg_credit), "</td>\n        <td align=right>", format_credit_large($user->total_credit), "</td>\n        <td>", $user->country, "</td>\n        <td>", time_str($user->create_time), "</td>\n        </tr>\n    ";
}
示例#5
0
function show_forum_summary($forum, $i)
{
    switch ($forum->parent_type) {
        case 0:
            $t = $forum->title;
            $d = $forum->description;
            break;
        case 1:
            $team = BoincTeam::lookup_id($forum->category);
            $t = $forum->title;
            if (!strlen($t)) {
                $t = $team->name;
            }
            $d = $forum->description;
            if (!strlen($d)) {
                $d = tra("Discussion among members of %1", $team->name);
            }
            break;
    }
    $j = $i % 2;
    echo "\n        <tr class=\"row{$j}\">\n        <td>\n            <a href=\"forum_forum.php?id={$forum->id}\">{$t}</a>\n            <br><span class=\"smalltext\">{$d}</span>\n        </td>\n        <td class=\"numbers\">{$forum->threads}</td>\n        <td class=\"numbers\">{$forum->posts}</td>\n        <td class=\"lastpost\">" . time_diff_str($forum->timestamp, time()) . "</td>\n    </tr>";
}
示例#6
0
function show_row($item, $apps, $is_team, $i)
{
    $j = $i % 2;
    if ($is_team) {
        $team = BoincTeam::lookup_id($item->teamid);
        if (!$team) {
            return;
        }
        $x = "<td>" . team_links($team) . "</td>\n";
    } else {
        $user = BoincUser::lookup_id($item->userid);
        if (!$user) {
            return;
        }
        $x = "<td>" . user_links($user, BADGE_HEIGHT_MEDIUM) . "</td>\n";
    }
    echo "<tr class=row{$j}>";
    echo "<td>{$i}</td>\n";
    echo $x;
    foreach ($apps as $app) {
        if ($app->id == $item->appid) {
            $c = $item;
        } else {
            if ($is_team) {
                $c = BoincCreditTeam::lookup("teamid={$item->teamid} and appid={$app->id}");
            } else {
                $c = BoincCreditUser::lookup("userid={$item->userid} and appid={$app->id}");
            }
            if (!$c) {
                $c = new StdClass();
                $c->expavg = 0;
                $c->total = 0;
            }
        }
        echo "<td align=right>" . format_credit($c->expavg) . "</td><td align=right>" . format_credit_large($c->total) . "</td>\n";
    }
    echo "</tr>\n";
}
示例#7
0
// 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/>.
require_once "../inc/cache.inc";
require_once "../inc/util.inc";
require_once "../inc/boinc_db.inc";
require_once "../inc/team.inc";
check_get_args(array("teamid"));
$teamid = get_int("teamid");
$team = BoincTeam::lookup_id($teamid);
$get_from_db = false;
$user = get_logged_in_user(false);
// always show fresh copy to admins; they might be editing info
//
if (is_team_admin($user, $team)) {
    $get_from_db = true;
}
if ($user->id == $team->ping_user) {
    $get_from_db = true;
}
// Cache the team record, its forum record, its new members,
// its admins, and its member counts
$cache_args = "teamid={$teamid}";
if (!$get_from_db) {
    $cached_data = get_cached_data(TEAM_PAGE_TTL, $cache_args);
示例#8
0
// 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/>.
require_once "../inc/util.inc";
require_once "../inc/cert.inc";
check_get_args(array("border"));
$user = get_logged_in_user();
$team = BoincTeam::lookup_id($user->teamid);
if (!$team) {
    error_page("no team");
}
$join = gmdate('j F Y', $team->create_time);
$today = gmdate('j F Y', time(0));
credit_to_ops($team->total_credit, $ops, $unit);
$border = get_str("border", true);
if ($border == "no") {
    $border = 0;
} else {
    $border = 8;
}
$credit = credit_string($team->total_credit, false);
$title_font = "\"Optima,ZapfChancery\"";
$font = "\"Optima,Lucida Bright,Times New Roman\"";
示例#9
0
    case 0:
        $category = BoincCategory::lookup_id($forum->category);
        if ($category->is_helpdesk) {
            page_head(tra("Questions and Answers") . ' : ' . $forum->title);
            ?>
<link href="forum_help_desk.php" rel="up" title="Forum Index"><?php 
        } else {
            page_head(tra("Message boards") . ' : ' . $forum->title);
            ?>
<link href="forum_index.php" rel="up" title="Forum Index"><?php 
        }
        show_forum_header($user);
        show_forum_title($category, $forum, NULL);
        break;
    case 1:
        $team = BoincTeam::lookup_id($forum->category);
        page_head('Team message board for <a href="team_display.php?teamid=$team->id">$team->name</a>');
        show_forum_header($user);
        show_team_forum_title($forum);
        break;
}
?>
<form action="forum_forum.php" method="get">
<?php 
echo start_table("noborder");
?>
<table width="100%">
	<tr valign="top">
	<td colspan="2">
		<?php 
show_button("forum_post.php?id={$id}", "New thread", "Add a new thread to this forum");
示例#10
0
if (_mysql_num_rows($result) < 1) {
    echo "There are no new users.";
    admin_page_tail();
}
start_table();
table_header("ID", "Name", "Email", "Team", "Country", "Joined");
while ($row = _mysql_fetch_object($result)) {
    $id = $row->id;
    $name = $row->name;
    $email = $row->email_addr;
    $country = $row->country;
    $joined = time_str($row->create_time);
    $email_validated = $row->email_validated;
    $team_name = "";
    if ($row->teamid > 0) {
        $team = BoincTeam::lookup_id($row->teamid);
        $team_name = $team->name;
    }
    // Special Users:
    $roles = "";
    $user = $row;
    BoincForumPrefs::lookup($user);
    $special_bits = $user->prefs->special_user;
    if ($special_bits != "0") {
        for ($i = 0; $i < 7; $i++) {
            $bit = substr($special_bits, $i, 1);
            if ($bit == '1') {
                if (!empty($roles)) {
                    $roles .= ", ";
                }
                $roles .= $special_user_bitfield[$i];
示例#11
0
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2014 University of California
//
// 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/>.
require_once "../inc/boinc_db.inc";
require_once "../inc/util.inc";
require_once "../inc/team.inc";
if (DISABLE_TEAMS) {
    error_page("Teams are disabled");
}
check_get_args(array());
$user = get_logged_in_user();
page_head(tra("Create a team"));
if ($user->teamid && ($team = BoincTeam::lookup_id($user->teamid))) {
    echo tra("You belong to %1. You must %2quit this team%3 before creating a new one.", "<a href=\"team_display.php?teamid=" . $team->id . "\">" . $team->name . "</a>", "<a href=\"team_quit_form.php\">", "</a>");
} else {
    team_edit_form(null, tra("Create a team"), "team_create_action.php");
}
page_tail();
示例#12
0
文件: pm.php 项目: gchilders/boinc
function do_send_team($logged_in_user)
{
    check_tokens($logged_in_user->authenticator);
    $subject = post_str("subject", true);
    $content = post_str("content", true);
    $teamid = post_int("teamid");
    if (post_str("preview", true) == tra("Preview")) {
        pm_team_form($logged_in_user, $teamid);
        return;
    }
    // make sure user is authorized, i.e. is a team admin
    //
    $team = BoincTeam::lookup_id($teamid);
    if (!$team) {
        error_page("no such team");
    }
    if (!is_team_admin($logged_in_user, $team)) {
        error_page("no team admin");
    }
    if ($subject == null || $content == null) {
        pm_team_form($logged_in_user, $teamid, tra("You need to fill all fields to send a private message"));
        return;
    }
    $subject = "Message from team " . $team->name . ": " . $subject;
    // don't use tra() here because we don't know language of recipient
    // Also, we use it in pm_count() to exclude team messages from limit check
    $users = BoincUser::enum("teamid={$teamid}");
    foreach ($users as $user) {
        pm_send_msg($logged_in_user, $user, $subject, $content, true);
    }
    page_head(tra("Message sent"));
    echo tra("Your message was sent to %1 team members.", count($users));
    page_tail();
}
示例#13
0
function delete_team_id_range($id1, $id2)
{
    for ($i = $id1; $i <= $id2; $i++) {
        echo "deleting team {$i}\n";
        $team = BoincTeam::lookup_id($i);
        if ($team) {
            $team->delete();
            $user = BoincUser::lookup_id($team->userid);
            if ($user) {
                $user->delete();
            }
        }
    }
}