//
// 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";
check_get_args(array());
$user = get_logged_in_user();
$name = post_str("name", true);
if (strlen($name) == 0) {
    error_page(tra("You must choose a non-blank team name"));
}
$new_team = lookup_team_name($name);
if ($new_team) {
    error_page(tra("A team named %1 already exists - try another name", htmlentities($name)));
}
$url = post_str("url", true);
$type = post_str("type", true);
$name_html = post_str("name_html", true);
$description = post_str("description", true);
$country = post_str("country", true);
if ($country == "") {
    $country = "International";
}
$new_team = make_team($user->id, $name, $url, $type, $name_html, $description, $country);
if ($new_team) {
    user_join_team($new_team, $user);
    Header("Location: team_display.php?teamid={$new_team->id}");
} else {
    error_page(tra("Could not create team - please try later."));
}
Example #2
0
function insert_case($t, $user)
{
    global $master_url;
    global $dry_run;
    if ($dry_run) {
        if (!$user) {
            echo "   making user {$t->user_email}\n";
        }
        echo "   making team {$t->name}\n";
        return;
    }
    if (!$user) {
        echo "   making user {$t->user_email}\n";
        $user = make_user(mysql_real_escape_string($t->user_email), mysql_real_escape_string($t->user_name), random_string());
        if (!$user) {
            echo "   Can't make user {$t->user_email}\n";
            echo mysql_error();
            exit;
        }
    }
    echo "   making team {$t->name}\n";
    $team = make_team($user->id, $t->name, $t->url, $t->type, $t->name_html, $t->description, $t->country);
    if (!$team) {
        echo "   Can't make team {$t->id}\n";
        echo mysql_error();
        echo "\n";
        exit;
    }
    mysql_query("update team set seti_id={$t->id} where id={$team->id}");
    mysql_query("update user set teamid={$team->id} where id={$user->id}");
    send_email($user, "Team created on " . PROJECT, "An instance of the BOINC-wide team '{$t->name}'\nhas been created on the project:\nname: " . PROJECT . "\nURL: {$master_url}\n");
}
// 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/>.
// Script to create a BOINC-wide team and corresponding account.
// Probably useful only to me.
// usage: create_boinc_wide_team.php username emailaddr teamname
require_once "../inc/user.inc";
require_once "../inc/team.inc";
if ($argc != 4) {
    die("usage: create_boinc_wide_team username email teamname\n");
}
$user_name = $argv[1];
$email_addr = $argv[2];
$team_name = $argv[3];
$passwd_hash = md5("foobar" . $email_addr);
$user = make_user($email_addr, $user_name, $passwd_hash);
if (!$user) {
    die("can't create user\n");
}
echo "created user {$user->id}\n";
$team = make_team($user->id, $team_name, "", "", "", "", "");
if (!$team) {
    die("can't create team\n");
}
echo "created team {$team->id}\n";
$retval = $user->update("email_validated=1, teamid={$team->id}");
if (!$retval) {
    die("can't update user\n");
}
echo "done\n";
Example #4
0
    jsonErr(mysqli_error($db));
}
$matches = [];
$today = @date('Y-m-d');
while ($row = $result->fetch_assoc()) {
    $network_score = [];
    for ($i = 1; array_key_exists('HeimSatz' . $i, $row); $i++) {
        $score_home = intval($row['HeimSatz' . $i]);
        $score_away = intval($row['GastSatz' . $i]);
        if ($score_home < 0 || $score_away < 0) {
            break;
        }
        array_push($network_score, [$score_home, $score_away]);
    }
    $home_team = make_team('Heim', $row, $verwaltung);
    $away_team = make_team('Gast', $row, $verwaltung);
    $is_doubles = preg_match('/HD|DD|GD/', $row['Art']);
    $player_count = $is_doubles ? 2 : 1;
    $incomplete = count($home_team['players']) !== $player_count || count($away_team['players']) !== $player_count;
    $home_team_name = $verwaltung['Heim'];
    $away_team_name = $verwaltung['Gast'];
    $match_id = 'courtspot_' . $today . '_' . $row['Art'] . '_' . $home_team_name . '-' . $away_team_name;
    $setup = ['match_name' => $row['Art'], 'teams' => [$home_team, $away_team], 'is_doubles' => $is_doubles, 'incomplete' => $incomplete, 'counting' => '5x11_15', 'courtspot_match_id' => $row['Art'], 'match_id' => $match_id];
    $m = ['setup' => $setup, 'network_score' => $network_score, 'network_team1_serving' => $row['lastPoint'] == 'heim', 'network_teams_player1_even' => [($row['linksheim'] == 'Spieler1') == ($row['oben'] == 'heim'), ($row['linksgast'] == 'Spieler1') == ($row['oben'] == 'gast')], 'network_last_update' => intval($row['last_timestamp']), 'network_match_start' => intval($row['first_timestamp']), 'courtspot' => ['heim_oben' => $row['oben'] == 'heim', 'detail' => $row['Detail'], 'ts' => $row['ts'], 'aufschlag_num' => intval($row['Aufgabe']), 'step' => intval($row['max_Spielstep'])]];
    if (array_key_exists('presses_json', $row)) {
        $m['presses_json'] = $row['presses_json'];
    }
    $matches[] = $m;
}
mysqli_free_result($result);
function _find_match($matches, $courtspot_id)