示例#1
0
    $text .= '</tbody></table>';
    $text .= EB_GAME_L18 . '<br />';
    $text .= '<div>';
    $gamefactionslist[0] = "";
    $handle = opendir(e_PLUGIN . "ebattles/images/games_factions/");
    while ($file = readdir($handle)) {
        if ($file != "." && $file != ".." && $file != "index.html" && $file != ".svn" && $game_shortname != "" && preg_match("/" . $game_shortname . "-/", $file)) {
            $gamefactionslist[] = $file;
        }
    }
    closedir($handle);
    for ($c = 1; $c <= count($gamefactionslist) - 1; $c++) {
        $FactionIcon = $gamefactionslist[$c];
        $FactionName = preg_replace("/{$game_shortname}-/", "", $FactionIcon);
        $FactionName = preg_replace("/\\..*\$/", "", $FactionName);
        $text .= '<a href="javascript:changeTextGameFaction(\'' . $FactionIcon . '\', \'' . $FactionName . '\')"><img ' . getFactionIconResize($FactionIcon) . ' title="' . $FactionIcon . '"/></a> ';
    }
    $text .= '
	</div>
	';
    $text .= '</div>';
    // Games Factions tab-page
    $text .= '<div id="tabs-3">';
    //<!-- Game Maps -->
    // List of all Maps
    $q_Maps = "SELECT " . TBL_MAPS . ".*" . " FROM " . TBL_MAPS . " WHERE (" . TBL_MAPS . ".Game = '{$game_id}')";
    $result_Maps = $sql->db_Query($q_Maps);
    $numMaps = mysql_numrows($result_Maps);
    //dbg: echo "numMaps $numMaps<br>";
    $text .= '<table class="fborder" style="width:95%"><tbody>';
    $text .= '<form id="gamemapsform" action="' . e_PLUGIN . 'ebattles/gameprocess.php?gameid=' . $game_id . '" method="post">';
示例#2
0
 function displayMatchInfo($type = 0, $header = '')
 {
     global $time;
     global $sql;
     global $pref;
     $match_id = $this->fields['MatchID'];
     $string = '';
     // Get info about the match
     $q = "SELECT DISTINCT " . TBL_MATCHS . ".*, " . TBL_USERS . ".*, " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_USERS . ", " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_MATCHS . ".ReportedBy)" . " AND (" . TBL_MATCHS . ".Event = " . TBL_EVENTS . ".EventID)" . " AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)";
     $result = $sql->db_Query($q);
     $numMatchs = mysql_numrows($result);
     if ($numMatchs > 0) {
         $mReportedBy = mysql_result($result, 0, TBL_USERS . ".user_id");
         $mReportedByNickName = mysql_result($result, 0, TBL_USERS . ".user_name");
         $mEventgame = mysql_result($result, 0, TBL_GAMES . ".Name");
         $mEventgameicon = mysql_result($result, 0, TBL_GAMES . ".Icon");
         $mStatus = mysql_result($result, 0, TBL_MATCHS . ".Status");
         $mTime = mysql_result($result, 0, TBL_MATCHS . ".TimeReported");
         $mTime_local = $mTime + TIMEOFFSET;
         $date = date("d M Y, h:i A", $mTime_local);
         $mTimeScheduled = mysql_result($result, 0, TBL_MATCHS . ".TimeScheduled");
         $mTimeScheduled_local = $mTimeScheduled + TIMEOFFSET;
         $dateScheduled = date("d M Y, h:i A", $mTimeScheduled_local);
         $mComments = mysql_result($result, 0, TBL_MATCHS . ".Comments");
         $event_id = mysql_result($result, 0, TBL_EVENTS . ".EventID");
         $event = new Event($event_id);
         // Calculate number of players and teams for the match
         $q = "SELECT DISTINCT " . TBL_SCORES . ".Player_MatchTeam" . " FROM " . TBL_SCORES . " WHERE (" . TBL_SCORES . ".MatchID = '" . $match_id . "')";
         $result = $sql->db_Query($q);
         $nbr_teams = mysql_numrows($result);
         // Check if the match has several ranks
         $q = "SELECT DISTINCT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".Player_Rank" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)";
         $result = $sql->db_Query($q);
         $numRanks = mysql_numrows($result);
         if ($numRanks > 0) {
             //------------ permissions --------------
             $permissions = $this->get_permissions(USERID);
             $userclass = $permissions['userclass'];
             $can_approve = $permissions['can_approve'];
             $can_report = $permissions['can_report'];
             $can_schedule = $permissions['can_schedule'];
             $can_delete = $permissions['can_delete'];
             $can_edit = $permissions['can_edit'];
             $orderby_str = " ORDER BY " . TBL_SCORES . ".Player_Rank, " . TBL_SCORES . ".Player_MatchTeam";
             if ($nbr_teams == 2) {
                 $orderby_str = " ORDER BY " . TBL_SCORES . ".Player_MatchTeam";
             }
             switch ($event->getMatchPlayersType()) {
                 case 'Players':
                     $q = "SELECT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".*, " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_PLAYERS . ".PlayerID = " . TBL_SCORES . ".Player)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)" . $orderby_str;
                     break;
                 case 'Teams':
                     $q = "SELECT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".*, " . TBL_CLANS . ".*, " . TBL_TEAMS . ".*, " . TBL_DIVISIONS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_CLANS . ", " . TBL_TEAMS . ", " . TBL_DIVISIONS . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_TEAMS . ".TeamID = " . TBL_SCORES . ".Team)" . " AND (" . TBL_CLANS . ".ClanID = " . TBL_DIVISIONS . ".Clan)" . " AND (" . TBL_TEAMS . ".Division = " . TBL_DIVISIONS . ".DivisionID)" . $orderby_str;
                     break;
                 default:
             }
             $result = $sql->db_Query($q);
             $numPlayers = mysql_numrows($result);
             $pname = '';
             $string .= '<tr>';
             if ($header) {
                 $string .= '<td>' . $header . '</td>';
             }
             $scores = '';
             if (($type & eb_MATCH_NOEVENTINFO) == 0) {
                 $string .= '<td style="vertical-align:top">';
                 $string .= '<img ' . getActivityGameIconResize($mEventgameicon) . ' title="' . $mEventgame . '"/>';
                 $string .= '</td>';
             }
             $string .= '<td>';
             $matchteam = 0;
             for ($index = 0; $index < $numPlayers; $index++) {
                 switch ($event->getMatchPlayersType()) {
                     case 'Players':
                         $puid = mysql_result($result, $index, TBL_USERS . ".user_id");
                         $gamer_id = mysql_result($result, $index, TBL_PLAYERS . ".Gamer");
                         $gamer = new Gamer($gamer_id);
                         $pname = $gamer->getField('Name');
                         $pavatar = mysql_result($result, $index, TBL_USERS . ".user_image");
                         $pteam = mysql_result($result, $index, TBL_PLAYERS . ".Team");
                         break;
                     case 'Teams':
                         $pname = mysql_result($result, $index, TBL_CLANS . ".Name");
                         $pavatar = mysql_result($result, $index, TBL_CLANS . ".Image");
                         $pteam = mysql_result($result, $index, TBL_TEAMS . ".TeamID");
                         break;
                     default:
                 }
                 list($pclan, $pclantag, $pclanid) = getClanInfo($pteam);
                 $prank = mysql_result($result, $index, TBL_SCORES . ".Player_Rank");
                 $pmatchteam = mysql_result($result, $index, TBL_SCORES . ".Player_MatchTeam");
                 $pscore = mysql_result($result, $index, TBL_SCORES . ".Player_Score");
                 $pfaction = mysql_result($result, $index, TBL_SCORES . ".Faction");
                 $pfactionIcon = "";
                 //if (($pfaction!=0)&&($type!=0))
                 if ($pfaction != 0) {
                     $q_Factions = "SELECT " . TBL_FACTIONS . ".*" . " FROM " . TBL_FACTIONS . " WHERE (" . TBL_FACTIONS . ".FactionID = '{$pfaction}')";
                     $result_Factions = $sql->db_Query($q_Factions);
                     $numFactions = mysql_numrows($result_Factions);
                     if ($numFactions > 0) {
                         $fIcon = mysql_result($result_Factions, 0, TBL_FACTIONS . ".Icon");
                         $fName = mysql_result($result_Factions, 0, TBL_FACTIONS . ".Name");
                         $pfactionIcon = ' <img ' . getFactionIconResize($fIcon) . ' title="' . $fName . '"/>';
                     }
                 }
                 /* takes too long
                 			$image = '';
                 			if ($pref['eb_avatar_enable_playersstandings'] == 1)
                 			{
                 			switch($event->getMatchPlayersType())
                 			{
                 			case 'Players':
                 			if($pavatar)
                 			{
                 			$image = '<img '.getAvatarResize(avatar($pavatar)).'/>';
                 			} else if ($pref['eb_avatar_default_image'] != ''){
                 			$image = '<img '.getAvatarResize(getImagePath($pref['eb_avatar_default_image'], 'avatars')).'/>';
                 			}
                 			break;
                 			case 'Teams':
                 			if($pavatar)
                 			{
                 			$image = '<img '.getAvatarResize(getImagePath($pavatar, 'team_avatars')).'/>';
                 			} else if ($pref['eb_avatar_default_image'] != ''){
                 			$image = '<img '.getAvatarResize(getImagePath($pref['eb_avatar_default_team_image'], 'team_avatars')).'/>';
                 			}
                 			break;
                 			default:
                 			}
                 			}
                 			*/
                 if ($index > 0) {
                     $scores .= "-" . $pscore;
                     if ($pmatchteam == $matchteam) {
                         $string .= ' &amp; ';
                     } else {
                         if (($type & eb_MATCH_SCHEDULED) != 0) {
                             $str = ' vs. ';
                         } else {
                             if ($prank == $rank) {
                                 $str = ' ' . EB_MATCH_L2 . ' ';
                             } else {
                                 if ($prank > $rank) {
                                     $str = ' ' . EB_MATCH_L3 . ' ';
                                 } else {
                                     $str = ' ' . EB_MATCH_L14 . ' ';
                                 }
                             }
                         }
                         $string .= $str;
                         $matchteam = $pmatchteam;
                         $rank = $prank;
                     }
                 } else {
                     $rank = $prank;
                     $matchteam = $pmatchteam;
                     $scores .= $pscore;
                 }
                 /*
                 echo "rank: $rank, prank: $prank<br>";
                 echo "mt: $matchteam, pmt $pmatchteam<br>";
                 */
                 $string .= $pfactionIcon . ' ';
                 switch ($event->getMatchPlayersType()) {
                     case 'Players':
                         $string .= '<a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $pclantag . $pname . '</a>';
                         break;
                     case 'Teams':
                         $string .= '<a href="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $pclanid . '">' . $pclan . '</a>';
                         break;
                     default:
                 }
             }
             //score here
             if ($event->getField('AllowScore') == TRUE && ($type & eb_MATCH_SCHEDULED) == 0) {
                 $string .= ' (' . $scores . ') ';
             }
             if (($type & eb_MATCH_NOEVENTINFO) == 0) {
                 $string .= ' ' . EB_MATCH_L12 . ' <a href="' . e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $event_id . '">' . $event->getField('Name') . '</a>';
             }
             if ($can_approve == 1) {
                 $string .= ' <a href="' . e_PLUGIN . 'ebattles/matchinfo.php?matchid=' . $match_id . '"><img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/exclamation.png" alt="' . EB_MATCH_L13 . '" title="' . EB_MATCH_L13 . '"/></a>';
             } else {
                 if (($type & eb_MATCH_SCHEDULED) == 0 || $can_schedule == 1) {
                     $string .= ' <a href="' . e_PLUGIN . 'ebattles/matchinfo.php?matchid=' . $match_id . '"><img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/magnify.png" alt="' . EB_MATCH_L5 . '" title="' . EB_MATCH_L5 . '"/></a>';
                 }
             }
             if (($type & eb_MATCH_SCHEDULED) == 0) {
                 $string .= ' <div class="smalltext">';
                 $string .= EB_MATCH_L6 . ' <a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $mReportedByNickName . '</a> ';
                 if ($time - $mTime < INT_MINUTE) {
                     $string .= EB_MATCH_L7;
                 } else {
                     if ($time - $mTime < INT_DAY) {
                         $string .= get_formatted_timediff($mTime, $time) . '&nbsp;' . EB_MATCH_L8;
                     } else {
                         $string .= EB_MATCH_L9 . '&nbsp;' . $date . '.';
                     }
                 }
                 $nbr_comments = ebGetCommentTotal("ebmatches", $match_id);
                 $nbr_comments += $mComments == '' ? 0 : 1;
                 $string .= ' <a href="' . e_PLUGIN . 'ebattles/matchinfo.php?matchid=' . $match_id . '" title="' . EB_MATCH_L4 . '&nbsp;' . $match_id . '">' . $nbr_comments . '&nbsp;';
                 $string .= $nbr_comments > 1 ? EB_MATCH_L10 : EB_MATCH_L11;
                 $string .= '</a>';
                 $string .= '</div></td>';
             } else {
                 $string .= ' <div class="smalltext">';
                 $string .= EB_MATCH_L16 . '&nbsp;';
                 $string .= EB_MATCH_L17 . '&nbsp;' . $dateScheduled . '.';
                 $string .= '</div></td>';
             }
             if (($type & eb_MATCH_NO_EDIT_ICONS) == 0) {
                 if ($can_delete == 1) {
                     $delete_text = $competition_type == 'Tournament' ? EB_MATCHD_L29 : EB_MATCHD_L5;
                     $string .= '<td>';
                     $string .= '<form action="' . e_PLUGIN . 'ebattles/matchdelete.php?eventid=' . $event_id . '" method="post">';
                     $string .= '<div>';
                     $string .= '<input type="hidden" name="eventid" value="' . $event_id . '"/>';
                     $string .= '<input type="hidden" name="matchid" value="' . $match_id . '"/>';
                     $string .= '</div>';
                     $string .= ebImageTextButton('deletematch', 'cross.png', '', 'simple', $delete_text, EB_MATCHD_L4);
                     $string .= '</form>';
                     $string .= '</td>';
                 }
                 if ($can_approve == 1) {
                     $string .= '<td>';
                     $string .= '<form id="approvematch_form" action="' . e_PLUGIN . 'ebattles/matchprocess.php" method="post">';
                     $string .= '<div>';
                     $string .= '<input type="hidden" name="eventid" value="' . $event_id . '"/>';
                     $string .= '<input type="hidden" name="matchid" value="' . $match_id . '"/>';
                     $string .= '</div>';
                     $string .= ebImageTextButton('approvematch', 'accept.png', '', 'simple', '', EB_MATCHD_L17);
                     $string .= '</form>';
                     $string .= '</td>';
                 }
                 if ($can_edit == 1) {
                     if ($this->getField('Status') == 'scheduled') {
                         $string .= '<td>';
                         $string .= ebImageLink('matchschedulededit', EB_MATCHR_L46, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&amp;matchid=' . $match_id . '&amp;actionid=matchschedulededit&amp;userclass=' . $userclass, 'page_white_edit.png', '', 'matchreport_link', '', EB_MATCHD_L27);
                         $string .= '</td>';
                     } else {
                         $string .= '<td>';
                         $string .= ebImageLink('matchedit', EB_MATCHR_L46, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&amp;matchid=' . $match_id . '&amp;actionid=matchedit&amp;userclass=' . $userclass, 'page_white_edit.png', '', 'matchreport_link', '', EB_MATCHD_L27);
                         $string .= '</td>';
                     }
                 }
                 if ($can_report == 1) {
                     $string .= '<td>';
                     $string .= '<div>';
                     $string .= ebImageLink('matchscheduledreport', EB_MATCHR_L32, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&amp;matchid=' . $match_id . '&amp;actionid=matchscheduledreport&amp;userclass=' . $userclass, 'report.png', '', 'matchreport_link', '', EB_MATCHD_L30);
                     $string .= '</div>';
                     $string .= '</td>';
                 }
             }
             $string .= '</tr>';
         }
     }
     return $string;
 }
示例#3
0
 $pdeltaG2_phi = mysql_result($result, $i, TBL_SCORES . ".Player_deltaG2_phi");
 $pdeltaG2_sigma = mysql_result($result, $i, TBL_SCORES . ".Player_deltaG2_sigma");
 $pscore = mysql_result($result, $i, TBL_SCORES . ".Player_Score");
 $pOppScore = mysql_result($result, $i, TBL_SCORES . ".Player_ScoreAgainst");
 $ppoints = mysql_result($result, $i, TBL_SCORES . ".Player_Points");
 $pfaction = mysql_result($result, $i, TBL_SCORES . ".Faction");
 $pforfeit = mysql_result($result, $i, TBL_SCORES . ".Player_Forfeit");
 $pfactionIcon = "";
 if ($pfaction != 0) {
     $q_Factions = "SELECT " . TBL_FACTIONS . ".*" . " FROM " . TBL_FACTIONS . " WHERE (" . TBL_FACTIONS . ".FactionID = '{$pfaction}')";
     $result_Factions = $sql->db_Query($q_Factions);
     $numFactions = mysql_numrows($result_Factions);
     if ($numFactions > 0) {
         $fIcon = mysql_result($result_Factions, 0, TBL_FACTIONS . ".Icon");
         $fName = mysql_result($result_Factions, 0, TBL_FACTIONS . ".Name");
         $pfactionIcon = ' <img ' . getFactionIconResize($fIcon) . ' title="' . $fName . '"/>';
     }
 }
 $image = "";
 if ($pref['eb_avatar_enable_playersstandings'] == 1) {
     switch ($event->getMatchPlayersType()) {
         case 'Players':
             if ($pavatar) {
                 $image = '<img ' . getAvatarResize(avatar($pavatar)) . '/>';
             } else {
                 if ($pref['eb_avatar_default_image'] != '') {
                     $image = '<img ' . getAvatarResize(getImagePath($pref['eb_avatar_default_image'], 'avatars')) . '/>';
                 }
             }
             break;
         case 'Teams':