コード例 #1
0
function add_admin($team)
{
    $email_addr = get_str('email_addr');
    $user = BoincUser::lookup("email_addr='{$email_addr}'");
    if (!$user) {
        error_page(tra("no such user"));
    }
    if ($user->teamid != $team->id) {
        error_page(tra("User is not member of team"));
    }
    if (is_team_admin($user, $team)) {
        error_page(tra("%1 is already an admin of %2", $email_addr, $team->name));
    }
    $now = time();
    $ret = BoincTeamAdmin::insert("(teamid, userid, create_time) values ({$team->id}, {$user->id}, {$now})");
    if (!$ret) {
        error_page(tra("Couldn't add admin"));
    }
}
コード例 #2
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/>.
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);
    if ($cached_data) {
        // We found some old but non-stale data, let's use it
        $team = unserialize($cached_data);
    } else {
        $get_from_db = true;
コード例 #3
0
ファイル: forum_user_posts.php プロジェクト: CalvinZhu/boinc
$teamid = 0;
$show_team = false;
$show_team_hidden = false;
if ($logged_in_user) {
    if ($user->id == $logged_in_user->id) {
        $show_all = true;
    } else {
        if ($logged_in_user->prefs->privilege(0)) {
            $show_hidden = true;
        }
        $teamid = $logged_in_user->teamid;
        if ($teamid) {
            $team = BoincTeam::lookup_id($teamid);
            if ($team) {
                $show_team = true;
                if (is_team_admin($logged_in_user, $team)) {
                    $show_team_hidden = true;
                }
            } else {
                $teamid = 0;
            }
        }
    }
}
page_head(tra("Posts by %1", $user->name));
$posts = BoincPost::enum("user={$userid} order by id desc limit 10000");
$n = 0;
start_table();
$options = get_output_options($logged_in_user);
$show_next = false;
foreach ($posts as $post) {
コード例 #4
0
    $when = time_str($delta->timestamp);
    $what = $delta->joining ? "joined" : "quit";
    if ($xml) {
        echo "    <action>\n        <id>{$user->id}</id>\n        <name>{$user->name}</name>\n        <action>{$what}</action>\n        <total_credit>{$delta->total_credit}</total_credit>\n        <when>{$when}</when>\n    </action>\n";
    } else {
        echo "<tr>\n           <td>{$when}</td>\n           <td>", user_links($user), " (ID {$user->id})</td>\n           <td>{$what}</td>\n           <td>{$delta->total_credit}</td>\n           </tr>\n        ";
    }
}
$user = get_logged_in_user();
$teamid = get_int('teamid');
$team = BoincTeam::lookup_id($teamid);
if ($xml) {
    require_once '../inc/xml.inc';
    xml_header();
}
if (!$team || !is_team_admin($user, $team)) {
    if ($xml) {
        xml_error("-1", "Not founder or admin");
    } else {
        error_page(tra("Not founder or admin"));
    }
}
if ($xml) {
    echo "<actions>\n";
} else {
    page_head(tra("Team history for %1", $team->name));
    start_table();
    echo "<tr>\n        <th>" . tra("When") . "</th>\n        <th>" . tra("User") . "</th>\n        <th>" . tra("Action") . "</th>\n        <th>" . tra("Total credit at time of action") . "</th>\n        </tr>\n    ";
}
$deltas = BoincTeamDelta::enum("teamid={$teamid} order by timestamp");
foreach ($deltas as $delta) {
コード例 #5
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();
}