Exemplo n.º 1
0
function get_teams($clause, $active)
{
    $c2 = '';
    if ($active) {
        $c2 = "and expavg_credit>0.1";
    }
    return BoincTeam::enum("{$clause} {$c2} order by expavg_credit desc limit 20");
}
Exemplo n.º 2
0
function get_teams($clause, $active)
{
    $c2 = '';
    if ($active) {
        $c2 = "and expavg_credit>0.1";
    }
    $x = BoincTeam::enum("{$clause} {$c2} order by expavg_credit desc limit 20");
    foreach ($x as $t) {
        $t->refcnt = 0;
    }
    return $x;
}
Exemplo n.º 3
0
function main()
{
    $f = fopen("temp.xml", "w");
    $teams = BoincTeam::enum();
    fwrite($f, "<teams>\n");
    foreach ($teams as $team) {
        handle_team($team, $f);
    }
    fwrite($f, "</teams>\n");
    fclose($f);
    rename("temp.xml", "/home/boincadm/boinc/doc/boinc_teams.xml");
}
Exemplo n.º 4
0
function main()
{
    echo "------------ Starting at " . time_str(time()) . "-------\n";
    $f = fopen("temp.xml", "w");
    $teams = BoincTeam::enum(null);
    fwrite($f, "<teams>\n");
    foreach ($teams as $team) {
        handle_team($team, $f);
    }
    fwrite($f, "</teams>\n");
    fclose($f);
    if (!rename("temp.xml", "/home/boincadm/boinc/doc/boinc_teams.xml")) {
        echo "Rename failed\n";
    }
}
Exemplo n.º 5
0
function get_top_teams($offset, $sort_by, $type)
{
    global $teams_per_page;
    $db = BoincDb::get(true);
    $type_clause = null;
    if ($type) {
        $type_clause = "type={$type}";
    }
    if ($sort_by == "total_credit") {
        $sort_order = "total_credit desc";
    } else {
        $sort_order = "expavg_credit desc";
    }
    return BoincTeam::enum($type_clause, "order by {$sort_order} limit {$offset}, {$teams_per_page}");
}
Exemplo n.º 6
0
                $total++;
                if ($total == 100) {
                    break;
                }
            }
            //do not error out
        }
    }
    echo "</teams>\n";
    exit;
}
$team_name = get_str("team_name");
$name_lc = strtolower($team_name);
$name_lc = escape_pattern($name_lc);
$clause = "name like '%" . BoincDb::escape_string($name_lc) . "%' order by expavg_credit desc limit 100";
$teams = BoincTeam::enum($clause);
if ($format == 'xml') {
    echo "<teams>\n";
    $total = 0;
    foreach ($teams as $team) {
        show_team_xml($team);
        $total++;
        if ($total == 100) {
            break;
        }
    }
    echo "</teams>\n";
    exit;
}
page_head(tra("Search Results"));
if (count($teams)) {
Exemplo n.º 7
0
function delete_teams()
{
    global $days, $test;
    $query = "nusers < 2 and seti_id=0 and total_credit=0";
    if ($days) {
        $x = time() - $days * 86400;
        $query .= " and create_time > {$x}";
    }
    $teams = BoincTeam::enum($query);
    foreach ($teams as $team) {
        $n = team_count_members($team->id);
        if ($n > 1) {
            continue;
        }
        if (!has_link($team->description)) {
            continue;
        }
        $user = BoincUser::lookup_id($team->userid);
        if ($user) {
            $n = BoincPost::count("user={$user->id}");
            if ($n) {
                continue;
            }
            $n = BoincHost::count("userid={$user->id}");
            if ($n) {
                continue;
            }
        }
        if ($test) {
            echo "would delete team:\n";
            echo "   ID: {$team->id}\n";
            echo "   name: {$team->name}\n";
            echo "   description: {$team->description}\n";
        } else {
            $team->delete();
            echo "deleted team ID {$team->id} name {$team->name}\n";
            if ($user) {
                do_delete_user($user);
            }
        }
    }
}