本文整理汇总了PHP中BoincTeam::lookup_name方法的典型用法代码示例。如果您正苦于以下问题:PHP BoincTeam::lookup_name方法的具体用法?PHP BoincTeam::lookup_name怎么用?PHP BoincTeam::lookup_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoincTeam
的用法示例。
在下文中一共展示了BoincTeam::lookup_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error_page
//
// 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();
$name = post_str("name", true);
if (strlen($name) == 0) {
error_page(tra("You must choose a non-blank team name"));
}
$new_team = BoincTeam::lookup_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}");
示例2: handle_team
function handle_team($f)
{
$t = parse_team($f);
if (!$t) {
echo "Failed to parse team\n";
return;
}
//print_r($t);
//return;
if (!valid_team($t)) {
echo "Invalid team\n";
return;
}
echo "Processing {$t->name} {$t->user_email}\n";
$user = BoincUser::lookup_email_addr($t->user_email);
$team = BoincTeam::lookup_name($t->name);
if ($team) {
if (!$user) {
echo " team exists but user {$t->user_email} doesn't\n";
return;
}
if ($user->id != $team->userid) {
echo " team exists but is owned by a different user\n";
return;
}
if ($team->seti_id) {
if ($team->seti_id == $t->id) {
echo " case 1\n";
update_team($t, $team, $user);
// update1 case
} else {
echo " team exists but has wrong seti_id\n";
}
} else {
$team2 = lookup_team_seti_id($t->id);
if ($team2) {
// update1 case
echo " case 2\n";
update_team($t, $team2, $user);
} else {
// update2 case
echo " case 3\n";
update_team($t, $team, $user);
}
}
} else {
$team = lookup_team_seti_id($t->id);
if ($team) {
echo " A team with same ID but different name exists;\n";
echo " Please report this to {$t->user_email};\n";
} else {
echo " Adding team\n";
insert_case($t, $user);
}
}
}