function lookUp($loc, $mask, $pdo, $SENDER_URL, $APP_INFO) { $user = getUser($mask, $pdo); $list = getMatchList($mask, $pdo); if (getUser($mask, $pdo)["friendMask"] != 'nill') { sendReply("Your friend has left the conversation.", getFMask($mask, $pdo), $SENDER_URL, $APP_INFO); sendReply(exitCoversation($mask, $pdo), $mask, $SENDER_URL, $APP_INFO); } $found = FALSE; foreach ($list as $listUser) { if (distance($listUser["lat"], $listUser["longi"], $user["lat"], $user["longi"], "K") <= 10) { updateFriend($mask, $listUser["mask"], $pdo); updateFriend($listUser["mask"], $mask, $pdo); $user = $listUser["username"]; $found = TRUE; break; } } if ($found) { return "You have been matched up with {$user}.\n Type FSTR M <message> and send it to 77100 to start the conversation."; } else { return "Sorry no match found, please try again later."; } }
// Update case 'update': $matchid = intval($_POST['matchid']); $stage = intval($_POST['stageselect']); $succe = updateMatch($matchid, -1, $stage); if ($succe) { echo "修改比赛提交成功"; return; } echo "没有提交更新的比赛数据或发生异常"; break; // Main Page // Main Page default: $currentType = intval($_POST['currentTypeSelect']); $currentStage = intval($_POST['currentStageSelect']); $matchList = getMatchList(-1, $currentType, $currentStage); $tpl->SetVar('currentType', $currentType); $tpl->SetVar('currentStage', $currentStage); $tpl->SetVar('typelist', getMatchTypeList()); $tpl->SetVar('list', $matchList); $tpl->SetVar('paging', count($matchList) / 20); echo '<h2>' . '比赛列表' . '</h2>'; echo $tpl->GetTemplate('matchlist.php'); echo '<h2>' . '添加比赛' . '</h2>'; echo $tpl->GetTemplate('addmatch.php'); break; } ?>
********************************************************************** */ ini_set('display_errors', 'On'); error_reporting(E_ALL | E_STRICT); include 'jsonHelper.php'; $user = htmlspecialchars($_POST['user']); $duoPartner = htmlspecialchars($_POST['duoPartner']); $region = $_POST['region']; define("regionUrl", "https://" . $region . ".api.pvp.net/api/lol/" . $region); $userId = getSummonerId($user); $duoPartnerId = $duoPartner != "" ? getSummonerId($duoPartner) : ""; //Processing result if ($userId != 'N/A' && $duoPartnerId != 'N/A' && authenticateRegion($region)) { echo "<br><div class='results-card card-margin'><h1 class='align-center'><b><span id='light-title'>Solo</span> " . $user . "</b></h1>"; //Gets user's match list using jsonHelper $userMatchList = getMatchList($userId); $matchCount = 50; $arrayOfMatchData = individualMatchData($matchCount, $userMatchList, $userId, $duoPartnerId); $numberOfSoloGames = $arrayOfMatchData[$matchCount - 1]["numberOfSoloGames"]; $soloWinLostArray = MatchesWon($arrayOfMatchData, $matchCount, true); $soloWins = $soloWinLostArray["gamesWon"]; $soloLosses = $soloWinLostArray["gamesLost"]; $soloWinRate = calculateWinrate($soloWins, $numberOfSoloGames); $winRateColor = winRateColor($soloWinRate); echo "<h2>Wins: <span class='won-message'>" . $soloWins . "</span> Losses: <span class='lost-message'>" . $soloLosses . "</span></h2>"; echo "<h1>Solo winrate: <span id='" . $winRateColor . "'>" . $soloWinRate . "%</span></h1></div>"; echo "<div class='results-card card-margin'>"; if ($duoPartner != "") { echo "<h1 id='align-center'><span id='light-title'>Duo with</span><b> " . $duoPartner . "</h1></b>"; } else { echo "<h1 class='align-center'><span id='light-title'>No duo partner specified</h1></b>";
function tournament() { global $wpdb, $user_identity, $user_ID; header('Content-Type: text/html; charset=' . getCharset() . ''); if (intval($_REQUEST['matchid']) > 0 && intval($_REQUEST['opt']) > 0) { echo "参数错误!"; exit; } $matchid = intval($_REQUEST['matchid']); if (!empty($user_identity)) { $username = htmlspecialchars(addslashes($user_identity)); } else { if (!empty($_COOKIE['comment_author_' . COOKIEHASH])) { $username = htmlspecialchars(addslashes($_COOKIE['comment_author_' . COOKIEHASH])); } else { echo "需要登陆"; exit; } } switch ($_REQUEST['opt']) { case 'apply': if (!getUserVerify($user_ID)) { echo "需要选手认证才可以报名"; exit; } $apply = $wpdb->query("SELECT verify1 FROM pre_common_member_verify WHERE uid = {$user_ID}"); if (count(getUserList($user_ID, $matchid, -1, -1, 1)) > 0) { echo "你已经报过名了"; exit; } updateUser($user_ID, $matchid, -1, -1, 1); if (count(getUserList($user_ID, $matchid, -1, -1, 1)) > 0) { echo "报名成功!"; exit; } echo "报名时发生错误"; exit; case 'cancelapply': updateUser($user_ID, $matchid, -1, -1, 0); echo "报名已取消"; exit; case 'follow': updateUser($user_ID, $matchid, -1, 1); if (count(getUserList($user_ID, $matchid, -1, 1)) > 0) { echo "关注成功!"; exit; } echo "关注时发生错误"; exit; case 'cancelfollow': updateUser($user_ID, $matchid, -1, 0); echo "关注已取消"; exit; case 'cancelgroup': $groupid = intval($_REQUEST['groupid']); $memberid = intval($_REQUEST['memberid']); $users = getUserList($memberid); if (empty($users)) { echo "找不到此用户ID, " . $memberid; exit; } $groups = getGroupList(-1, $groupid); if (empty($groups)) { echo "找不到此队伍ID, " . $groupid; exit; } $matchs = getMatchList($groups[0]->match_id); if (empty($matchs)) { echo "找不到此队伍的比赛ID, error code : " . $groups[0]->match_id; exit; } if ($matchs[0]->stage != 1) { echo "比赛不处于报名阶段,无法退出 . error code : " . $groups[0]->match_id; exit; } if ($groups[0]->captain_id == $user_ID || $memberid == $user_ID) { // 队员离开 updateUser($memberid, $matchid, 0, -1, -1, 0, -1, 0); echo "已退出队伍"; exit; } echo "权限不足."; exit; case 'applygroup': $users = getUserList($user_ID, $matchid); if (!empty($users)) { $groupid = $_REQUEST['groupid']; if (intval($users[0]->apply_group)) { echo "您已经申请了其他的队伍!"; exit; } $groups = getGroupList($matchid, $groupid); if (empty($groups)) { echo "比赛" . $matchid . "中找不到这个队伍!" . $groupid; exit; } $groupusers = getUserList(-1, -1, $groupid); if ($groups[0]->maxpeople - 1 < count($groupusers)) { echo "这个队伍中的人数已经满了!" . $groupid; exit; } updateUser($user_ID, $matchid, $groupid, -1, -1, 1); echo "申请成功!"; exit; } echo "你尚未参加此项比赛!"; exit; case 'passapplygroup': $memberid = intval($_REQUEST['memberid']); $users = getUserList($memberid, $matchid); if (!empty($users)) { $groupid = intval($_REQUEST['groupid']); if ($users[0]->group_id == $groupid) { updateUser($memberid, $matchid, $groupid, -1, -1, 1, -1, 1); echo "通过申请!"; exit; } echo "申请失败!" . $users[0]->group_id . ":" . $groupid; exit; } echo "此用户尚未参加此项比赛!"; exit; case 'creategroup': $users = getUserList($user_ID, $matchid); if (!intval($users[0]->apply_match)) { echo "你尚未参加此项比赛!"; exit; } if (intval($users[0]->apply_group)) { echo "您已经申请了其他的队伍!"; exit; } $groupname = trim($_REQUEST['groupname']); $success = addGroup($groupname, $user_ID, $matchid); if (intval($success)) { $groups = getGroupList($matchid, -1, $user_ID); updateUser($user_ID, $matchid, $groups[0]->id, -1, -1, 1, -1, 1); echo "申请成功!"; exit; } echo "申请发生错误error code : " . $success; exit; case 'ranksubmit': $matchId = intval($_POST['matchId']); $matchTypeId = intval($_POST['matchTypeId']); $scheduleId = intval($_POST['scheduleId']); $applyId = intval(addUserRankApply($user_ID, $matchId, $scheduleId)); if (!$applyId) { echo "申请发生错误, Code:" . $applyId; exit; } $submit = getUserRankApplyList(-1, $user_ID, $matchId, $scheduleId); $rankTypeList = getRankTypeList(-1, $matchTypeId); foreach ($rankTypeList as $rankType) { $value = intval($_POST['rank-' . $rankType->id]); if ($value && $submit[0]->id) { $result = addUserRank($user_ID, $matchTypeId, $rankType->id, $value, 0, $submit[0]->id); if (!$result) { echo "录入信息失败,Code:" . $rankType->id; exit; } } else { echo "录入信息失败,Error Code:" . $value . " AND " . $submit[0]->id; exit; } } echo "提交选手成绩完成"; exit; default: echo "无法解析此函数"; exit; } }
// Del Schedule // Del Schedule case 'delschedule': $id = intval($_REQUEST['id']); $succe = delSchedule($id); if ($succe != 1) { echo "删除队伍对阵图:" . ngid . "失败"; return; } updateMatch($matchid, -1, -1, count(getGroupList($matchid))); echo "成功删除队伍对阵图:" . $groupid; break; // Main Page // Main Page default: $matchId = 0; $matchId = intval($_GET['matchId']); $groupList = getGroupList($matchId); if ($matchId != 0) { $matchs = getMatchList($matchId); $tpl->SetVar('match', $matchs[0]); } $tpl->SetVar('groups', $groupList); $tpl->SetVar('paging', count($groupList) / 20); echo '<h2>' . '队伍列表' . '</h2>'; echo $tpl->GetTemplate('grouplist.php'); break; } ?>
/** * 创建队伍 */ function addGroup($name, $captain_id, $matchId) { global $wpdb; $_matchId = intval($matchId); if (!empty($name)) { $_captain_id = intval($captain_id); $matchs = getMatchList($_matchId); if (count($matchs) > 0) { $update = updateMatch($_matchId, -1, -1, intval($matchs[0]->groupnumber) + 1); if ($update > 0) { $result = $wpdb->insert('wp_likedome_match_group', array('captain_id' => $_captain_id, 'name' => $name, 'match_id' => $_matchId, 'maxpeople' => $matchs[0]->groupmemberlimit)); } return $result; } } return null; }
/** * 首页分类调用 */ function index_matchType_content($currentTypeId = 0, $stage = -1) { if ($currentTypeId != 0) { $matchList = getMatchList(-1, $currentTypeId, $stage, 4); } else { $matchList = getMatchList(-1, -1, $stage, 4); } if (count($matchList)) { foreach ($matchList as $match) { $args = get_match_post($match->id); query_posts($args); echo '<ul class="joinList margin-t2">'; if (have_posts()) { while (have_posts()) { the_post(); echo '<li> <a href="?p=77&matchid=' . $match->id . '" target="_blank">'; the_post_thumbnail(); echo '</a><dl>'; the_excerpt(); get_apply_match_button($current_user->ID, $match->id, $stage); echo '</dl><div class="clear"></div></li>'; } } echo '</ul>'; } } wp_reset_postdata(); }
?> <li style="width: 100%; float: left;"> <a href="?p=77&matchid=<?php echo $user->match_id; ?> "><?php the_post_thumbnail(); ?> </a> <dl> <?php the_excerpt(); ?> <dd class="join margin-t10"> <?php $matchs = getMatchList($user->match_id); get_apply_match_button($current_user->ID, $user->match_id, $matchs[0]->stage); ?> </dd> </dl> <div class="clear"></div> </li> <?php } } } wp_reset_postdata(); } else { ?> <li style="width: 100%; float: left;"> * 目前你还没有关注过任何比赛
?> </p> <p><?php echo $schedule->begin . " " . $schedule->end . " 论次:" . $schedule->round; ?> </p> <?php if (!empty($schedule->result) && strlen($schedule->result) > 0) { $userRankApplys = getUserRankApplyList(-1, $current_user->ID, $matchid, $schedule->id); if (!empty($userRankApplys) && intval($userRankApplys)) { echo "<p>本场已经提交成绩;</p>"; if ($userRankApplys[0]->verify) { echo "<p>并已经通过审核,计入总分;</p>"; } } else { $match = getMatchList($matchid); $matchTypes = getMatchTypeList(OBJECT_K); $rankTypeList = getRankTypeList(-1, $match[0]->type); echo "<form method= \"post\" action=\"wp-content/plugins/likedome/tournament.php?opt=ranksubmit&matchid=" . $matchid . "\" >"; foreach ($rankTypeList as $rankType) { echo '<p>' . $rankType->name . ' : <input name="rank-' . $rankType->id . '" type="text" id="rank-' . $rankType->id . '" class="vs-text" value="" /></p>'; } ?> <p> <input name="matchId" type="hidden" value="<?php echo $matchid; ?> " /> <input name="matchTypeId" type="hidden" value="<?php echo $match[0]->type; ?>
<select name="currentMatchTypeId" onChange= "document.matchTypeSelect.submit();"> <?php $currentTypeId = intval($_POST['currentMatchTypeId']); drawMatchTypeSelect($currentTypeId); ?> </select> </form> </div> <ul class="tab_menu fro margin-t6 padding-r6"><li class="select">全部比赛</li><li>正在进行中</li><li>报名中</li><li>比赛结束</li></ul> </div> <div class="tab_main"> <?php if ($currentTypeId != 0) { $matchList = getMatchList(-1, $currentTypeId, -1, 4); } else { $matchList = getMatchList(-1, -1, -1, 4); } $count = 0; if (count($matchList)) { foreach ($matchList as $match) { $args = get_match_post($match->id); query_posts($args); if (have_posts()) { while (have_posts()) { the_post(); if ($count == 0) { $count++; ?> <div class="margin-t10 tabimg"> <a href="?p=77&matchid=<?php echo $match->id;