'.$ds[name].'';
}
$gamesquads=safe_query("SELECT * FROM ".PREFIX."squads WHERE gamesquad='1' ORDER BY sort");
while($ds=mysql_fetch_array($gamesquads)) {
$hometeam.='';
$squadmembers=safe_query("SELECT * FROM ".PREFIX."squads_members WHERE squadID='$ds[squadID]' ORDER BY sort");
while($dm=mysql_fetch_array($squadmembers)) {
$hometeam.='';
}
$hometeam.='';
}
echo'
';
for($i=1; $i<32; $i++) {
if($i==date("d", time())) $day.='';
else $day.='';
}
for($i=1; $i<13; $i++) {
if($i==date("n", time())) $month.='';
else $month.='';
}
for($i=2000; $i<2010; $i++) {
if($i==date("Y", time())) $year.='';
else $year.='';
}
$leaguehp="http://";
$opphp="http://";
$linkpage="http://";
if($upID) {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."upcoming WHERE upID='$upID'");
$ds=mysql_fetch_array($ergebnis);
$league=$ds[league];
if($ds[leaguehp] != $leaguehp) $leaguehp=$ds[leaguehp];
$opponent=$ds[opponent];
$opptag=$ds[opptag];
if($ds[opphp] != $opphp) $opphp=$ds[opphp];
$countries=str_replace(" selected", "", $countries);
$countries=str_replace('value="'.$ds[oppcountry].'"', 'value="'.$ds[oppcountry].'" selected', $countries);
$squads=str_replace(" selected", "", $squads);
$squads=str_replace('value="'.$ds[squad].'"', 'value="'.$ds[squad].'" selected', $squads);
$day=str_replace(" selected", "", $day);
$day=str_replace('', '', $day);
$month=str_replace(" selected", "", $month);
$month=str_replace('value="'.date("n", $ds[date]).'"', 'value="'.date("n", $ds[date]).'" selected', $month);
$year=str_replace(" selected", "", $year);
$year=str_replace('value="'.date("Y", $ds[date]).'"', 'value="'.date("Y", $ds[date]).'" selected', $year);
}
$bg1=BG_1;
eval ("\$clanwar_new = \"".gettemplate("clanwar_new")."\";");
echo $clanwar_new;
}
else redirect('index.php?site=clanwars', 'no access!');
}
elseif($_GET['action']=="save") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isanyadmin($userID)) die('no access!');
$pagebg=PAGEBG;
$border=BORDER;
$bghead=BGHEAD;
$bgcat=BGCAT;
echo'
';
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$hometeam = $_POST['hometeam'];
$squad = $_POST['squad'];
$game = $_POST['game'];
$league = $_POST['league'];
$leaguehp = $_POST['leaguehp'];
$opponent = $_POST['opponent'];
$opptag = $_POST['opptag'];
$oppcountry = $_POST['oppcountry'];
$opphp = $_POST['opphp'];
$oppteam = $_POST['oppteam'];
$server = $_POST['server'];
$hltv = $_POST['hltv'];
$report = $_POST['report'];
$comments = $_POST['comments'];
$linkpage = $_POST['linkpage'];
$news=$_POST['news'];
// v1.0 -- EXTENDED CLANWAR RESULTS
$maplist = $_POST['map_name'];
$homescr = $_POST['map_result_home'];
$oppscr = $_POST['map_result_opp'];
if(!empty($maplist)) {
if(is_array($maplist)) {
$maps = array();
foreach($maplist as $map) {
$maps[]=$map;
}
$theMaps = implode("||", $maps);
} else $theMaps='';
}
if(!empty($homescr)) {
if(is_array($homescr)) {
$results = array();
foreach($homescr as $result) {
$results[]=$result;
}
$theHomeScore=implode("||", $results);
} else $theHomeScore='';
unset($results);
}
if(!empty($oppscr)) {
if(is_array($oppscr)) {
$results = array();
foreach($oppscr as $result) {
$results[]=$result;
}
$theOppScore=implode("||", $results);
} else $theOppScore='';
unset($results);
}
if(is_array($hometeam)) {
$team=array();
foreach($hometeam as $player) {
if(!in_array($player, $team)) $team[]=$player;
}
$home_string=implode("|", $team);
} else $home_string='';
$date=mktime(0,0,0,$month,$day,$year);
mysql_query("INSERT INTO ".PREFIX."clanwars ( date, squad, game, league, leaguehp, opponent, opptag, oppcountry, opphp, maps, hometeam, oppteam, server, hltv, homescore, oppscore, report, comments, linkpage)
VALUES( '$date', '$squad', '$game', '".mysql_escape_string($league)."', '$leaguehp', '".mysql_escape_string($opponent)."', '".mysql_escape_string($opptag)."', '$oppcountry', '$opphp', '".mysql_escape_string($theMaps)."', '$home_string', '$oppteam', '$server', '$hltv', '$theHomeScore', '$theOppScore', '".mysql_escape_string($report)."', '$comments', '$linkpage' ) ");
$cwID=mysql_insert_id();
$date=date("d.m.Y", $date);
// INSERT CW-NEWS
if($news) {
safe_query("INSERT INTO ".PREFIX."news (date, poster, saved, cwID) VALUES ('".time()."', '$userID', '0', '$cwID')");
$newsID=mysql_insert_id();
$newsrubrics=safe_query("SELECT rubricID, rubric FROM ".PREFIX."news_rubrics ORDER BY rubric");
while($dr=mysql_fetch_array($newsrubrics)) {
$rubrics.='';
}
$lang=safe_query("SELECT lang, language FROM ".PREFIX."news_languages ORDER BY language");
while($dl=mysql_fetch_array($lang)) {
if($dl[lang]=="de") $langs1.='';
else $langs1.='';
if($dl[lang]=="uk") $langs2.='';
else $langs2.='';
}
$squad=getsquadname($squad);
$link1=$opptag;
$url1=$opphp;
$link2=$league;
$url2=$leaguehp;
$url3="http://";
$url4="http://";
$headline1='War '.$squad.' vs. '.$opponent.' '.$result2;
if($url1!='http://' AND !(empty($url1))) $opponent='[url='.$opphp.'][b]'.$opptag.' / '.$opponent.'[/b][/url]';
else $opponent='[b]'.$opptag.' / '.$opponent.'[/b]';
if($url2!='http://' AND !(empty($url2))) $league='[url='.$leaguehp.']'.$league.'[/url]';
// v1.0 -- PREPARE CW-NEWS OUTPUT
$maps=explode("||", $theMaps);
$scoreHome=explode("||", $theHomeScore);
$scoreOpp=explode("||", $theOppScore);
$homescr=array_sum($scoreHome);
$oppscr=array_sum($scoreOpp);
if($homescr>$oppscr) {
$results='[color='.$wincolor.'][b]'.$homescr.':'.$oppscr.'[/b][/color]';
$result2='won';
}
elseif($homescr<$oppscr) {
$results='[color='.$loosecolor.'][b]'.$homescr.':'.$oppscr.'[/b][/color]';
$result2='lost';
}
else {
$results='[color='.$drawcolor.'][b]'.$homescr.':'.$oppscr.'[/b][/color]';
$result2='draw';
}
// v1.0 -- CREATE CW-NEWS EXTENDED RESULTS
if(is_array($maps)) {
$d=0;
$results_ext='[TOGGLE=Results (extended)]';
foreach($maps as $map) {
if($scoreHome[$d] > $scoreOpp[$d]) $score.='
[color='.$wincolor.'][b]'.$scoreHome[$d].'[/b][/color] : [color='.$loosecolor.'][b]'.$scoreOpp[$d].'[/b][/color] | ';
elseif($scoreHome[$d] < $scoreOpp[$d]) $score.='[color='.$loosecolor.'][b]'.$scoreHome[$d].'[/b][/color] : [color='.$wincolor.'][b]'.$scoreOpp[$d].'[/b][/color] | ';
else $score.='[color='.$drawcolor.'][b]'.$scoreHome[$d].'[/b][/color] : [color='.$drawcolor.'][b]'.$scoreOpp[$d].'[/b][/color] | ';
$d++;
eval ("\$news_cw_results = \"".gettemplate("news_cw_results")."\";");
$results_ext.=$news_cw_results;
unset($score);
}
$results_ext.='[/TOGGLE]';
}
if(!empty($report)) $more1='[TOGGLE=Report]'.$report.'[/TOGGLE]';
if(is_array($team)) {
$n=1;
foreach($team as $id) {
if(!empty($id)) {
if($n>1) $home.=', '.getnickname($id).'';
else $home=''.getnickname($id).'';
$n++;
}
}
}
$message='Clanwar against [flag]'.$oppcountry.'[/flag] '.$opponent.' on '.$date.'
League: '.$league.'
Result: '.$results.'
'.$results_ext.'
'.$myclantag.' Team: '.$home.'
'.$opptag.' Team: '.$oppteam.'
'.$more1.'
Clanwardetails';
$bg1=BG_1;
eval ("\$addbbcode = \"".gettemplate("addbbcode")."\";");
eval ("\$addflags = \"".gettemplate("flags")."\";");
eval ("\$news_post = \"".gettemplate("news_post")."\";");
echo $news_post;
}
else echo'
Clanwar has been saved.
';
}
elseif($_GET['action']=="edit") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isanyadmin($userID)) die('no access!');
$pagebg=PAGEBG;
$border=BORDER;
$bghead=BGHEAD;
$bgcat=BGCAT;
$cwID = $_GET['cwID'];
if(isclanwaradmin($userID)) {
$squads=getgamesquads();
$jumpsquads=str_replace('value="', 'value="index.php?site=clanwars&action=showonly&only=squad&id=', $squads);
$ds=mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."clanwars WHERE cwID='$cwID'"));
$gamesa=safe_query("SELECT tag, name FROM ".PREFIX."games ORDER BY name");
while($dv=mysql_fetch_array($gamesa)) {
$games.='';
}
echo'
';
for($i=1; $i<32; $i++) {
if($i==date("d", $ds[date])) $day.='';
else $day.='';
}
for($i=1; $i<13; $i++) {
if($i==date("n", $ds[date])) $month.='';
else $month.='';
}
for($i=2000; $i<2010; $i++) {
if($i==date("Y", $ds[date])) $year.='';
else $year.='';
}
$games=str_replace('value="'.$ds[game].'"', 'value="'.$ds[game].'" selected', $games);
$squads=getgamesquads();
$squads=str_replace('value="'.$ds[squadID].'"', 'value="'.$ds[squadID].'" selected', $squads);
$league=$ds[league];
$leaguehp=$ds[leaguehp];
$opponent=$ds[opponent];
$opptag=$ds[opptag];
$countries=str_replace('value="at" selected', 'value="at"', $countries);
$countries=str_replace('value="'.$ds[oppcountry].'"', 'value="'.$ds[oppcountry].'" selected', $countries);
$opphp=$ds[opphp];
$oppteam=$ds[oppteam];
$server=$ds[server];
$hltv=$ds[hltv];
$linkpage=$ds[linkpage];
$report=$ds[report];
$linkpage=$ds[linkpage];
// map-output, v1.0
$map=explode("||", $ds[maps]);
$theHomeScore=explode("||", $ds[homescore]);
$theOppScore=explode("||", $ds[oppscore]);
$i=0;
for($i=0; $i
map #'.($i+1).' |
|
|
|
delete |
';
}
$gamesquads=safe_query("SELECT * FROM ".PREFIX."squads WHERE gamesquad='1' ORDER BY sort");
while($dq=mysql_fetch_array($gamesquads)) {
$hometeam.='';
$squadmembers=safe_query("SELECT * FROM ".PREFIX."squads_members WHERE squadID='$dq[squadID]' ORDER BY sort");
while($dm=mysql_fetch_array($squadmembers)) {
$hometeam.='';
}
$hometeam.='';
}
if(!empty($ds[hometeam])) {
$array=explode("|", $ds[hometeam]);
foreach($array as $id) {
if(!empty($id)) $hometeam=str_replace('value="'.$id.'"', 'value="'.$id.'" selected', $hometeam);
}
}
$comments='';
$comments=str_replace('value="'.$ds[comments].'"', 'value="'.$ds[comments].'" selected', $comments);
$bg1=BG_1;
eval ("\$clanwar_edit = \"".gettemplate("clanwar_edit")."\";");
echo $clanwar_edit;
}
else redirect('index.php?site=clanwars', 'no access!');
}
elseif($_GET['action']=="saveedit") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isanyadmin($userID)) die('no access!');
$cwID = $_POST['cwID'];
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$hometeam = $_POST['hometeam'];
$squad = $_POST['squad'];
$game = $_POST['game'];
$league = $_POST['league'];
$leaguehp = $_POST['leaguehp'];
$opponent = $_POST['opponent'];
$opptag = $_POST['opptag'];
$oppcountry = $_POST['oppcountry'];
$opphp = $_POST['opphp'];
$oppteam = $_POST['oppteam'];
$server = $_POST['server'];
$hltv = $_POST['hltv'];
$report = $_POST['report'];
$comments = $_POST['comments'];
$linkpage = $_POST['linkpage'];
$maplist = $_POST['map_name'];
$homescr = $_POST['map_result_home'];
$oppscr = $_POST['map_result_opp'];
$delete = $_POST['delete'];
// v1.0 -- MAP-REMOVAL
foreach($maplist as $key=>$map) {
if(!$delete[$key]) {
$theMaps[]=$map;
$theHomeScore[]=$homescr[$key];
$theOppScore[]=$oppscr[$key];
}
}
$theMaps=implode("||", $theMaps);
$theHomeScore=implode("||", $theHomeScore);
$theOppScore=implode("||", $theOppScore);
echo'
';
$date=mktime(0,0,0,$month,$day,$year);
if(is_array($hometeam)) {
$team=array();
foreach($hometeam as $player) {
if(!in_array($player, $team)) $team[]=$player;
}
$home_string=implode("|", $team);
}
else $home_string='';
safe_query("UPDATE ".PREFIX."clanwars SET date='$date',
squad='$squad',
game='$game',
league='".mysql_escape_string($league)."',
leaguehp='$leaguehp',
opponent='".mysql_escape_string($opponent)."',
opptag='".mysql_escape_string($opptag)."',
oppcountry='$oppcountry',
opphp='$opphp',
maps='".mysql_escape_string($theMaps)."',
hometeam='".mysql_escape_string($home_string)."',
oppteam='".mysql_escape_string($oppteam)."',
server='$server',
hltv='$hltv',
homescore='$theHomeScore',
oppscore='$theOppScore',
report='".mysql_escape_string($report)."',
comments='$comments',
linkpage='$linkpage' WHERE cwID='$cwID'");
echo'
Clanwar has been updated.
';
}
elseif($_GET['action']=="delete") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isanyadmin($userID)) die('no access!');
$cwID = $_POST['cwID'];
if(!$cwID) $cwID = $_GET['cwID'];
$ergebnis=safe_query("SELECT screens FROM ".PREFIX."clanwars WHERE cwID='$cwID'");
$ds=mysql_fetch_array($ergebnis);
$screens=explode("|", $ds[screens]);
$filepath = "./images/clanwar-screens/";
if(is_array($screens)) {
foreach($screens as $screen) {
if(!empty($screen)) {
if(file_exists($filepath.$screen)) @unlink($filepath.$screen);
}
}
}
safe_query("DELETE FROM ".PREFIX."clanwars WHERE cwID='$cwID'");
header("Location: index.php?site=clanwars");
}
elseif($_POST['quickactiontype']=="delete") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isanyadmin($userID)) die('no access!');
$cwID = $_POST['cwID'];
foreach($cwID as $id) {
$ergebnis=safe_query("SELECT screens FROM ".PREFIX."clanwars WHERE cwID='$id'");
$ds=mysql_fetch_array($ergebnis);
$screens=explode("|", $ds[screens]);
$filepath = "./images/clanwar-screens/";
if(is_array($screens)) {
foreach($screens as $screen) {
if(!empty($screen)) {
if(file_exists($filepath.$screen)) @unlink($filepath.$screen);
}
}
}
safe_query("DELETE FROM ".PREFIX."clanwars WHERE cwID='$id'");
safe_query("DELETE FROM ".PREFIX."comments WHERE parentID='$id' AND type='cw'");
}
header("Location: index.php?site=clanwars");
}
if($_GET['action']=="stats") {
eval ("\$title_clanwars = \"".gettemplate("title_clanwars")."\";");
echo $title_clanwars;
echo'';
echo'CLAN-STATS
';
// TOTAL
$dp=safe_query("SELECT * FROM ".PREFIX."clanwars");
// clanwars gesamt
$totaltotal=mysql_num_rows($dp);
while($cwdata = mysql_fetch_array($dp)) {
// total home points
$totalhomeqry=safe_query("SELECT homescore FROM ".PREFIX."clanwars WHERE cwID='$cwdata[cwID]'");
while($theHomeData = mysql_fetch_array($totalhomeqry)) {
$totalHomeScore+=array_sum(explode("||", $theHomeData['homescore']));
$theHomeScore=array_sum(explode("||", $theHomeData['homescore']));
}
// total opponent points
$totaloppqry=safe_query("SELECT oppscore FROM ".PREFIX."clanwars WHERE cwID='$cwdata[cwID]'");
while($theOppData = mysql_fetch_array($totaloppqry)) {
$totalOppScore+=array_sum(explode("||", $theOppData['oppscore']));
$theOppScore=array_sum(explode("||", $theOppData['oppscore']));
}
//
if($allWon=='') $allWon=0;
if($allLose=='') $allLose=0;
if($allDraw=='') $allDraw=0;
//
if($theHomeScore > $theOppScore) $totalwonall++;
if($theHomeScore < $theOppScore) $totalloseall++;
if($theHomeScore == $theOppScore) $totaldrawall++;
}
$totalhome=$totalHomeScore;
$totalopp=$totalOppScore;
if(!$totalwonall) $totalwonall=0;
if(!$totalloseall) $totalloseall=0;
if(!$totaldrawall) $totaldrawall=0;
if(!$totalhome) $totalhome=0;
if(!$totalopp) $totalopp=0;
$totalwonperc=percent($totalwonall, $totaltotal, 2);
if($totalwonperc) $totalwon=$totalwonperc.'%
';
else $totalwon=0;
$totalloseperc=percent($totalloseall, $totaltotal, 2);
if($totalloseperc) $totallost=$totalloseperc.'%
';
else $totallost=0;
$totaldrawperc=percent($totaldrawall, $totaltotal, 2);
if($totaldrawperc) $totaldraw=$totaldrawperc.'%
';
else $totaldraw=0;
$squad='CLAN';
eval ("\$clanwars_stats_total = \"".gettemplate("clanwars_stats_total")."\";");
echo $clanwars_stats_total;
// SQUADS
$squads=safe_query("SELECT * FROM ".PREFIX."squads WHERE gamesquad='1' ORDER BY sort");
if(mysql_num_rows($squads)) {
while($squaddata=mysql_fetch_array($squads)) {
$squad=getsquadname($squaddata['squadID']);
echo ''.$squad.' - STATS
';
// SQUAD STATISTICS
$squadcws=safe_query("SELECT * FROM ".PREFIX."clanwars WHERE squad='".$squaddata['squadID']."'");
$total=mysql_num_rows($squadcws);
$totalperc=percent($total, $totaltotal, 2);
while($squadcwdata=mysql_fetch_array($squadcws)) {
// SQUAD CLANWAR STATISTICS
// total squad homescore
$sqHomeScoreQry=mysql_fetch_array(safe_query("SELECT homescore FROM ".PREFIX."clanwars WHERE cwID='".$squadcwdata['cwID']."' AND squad='".$squaddata['squadID']."'"));
$sqHomeScore=array_sum(explode("||", $sqHomeScoreQry['homescore']));
$totalHomeScoreSQ+=array_sum(explode("||", $sqHomeScoreQry['homescore']));
// total squad oppscore
$sqOppScoreQry=mysql_fetch_array(safe_query("SELECT oppscore FROM ".PREFIX."clanwars WHERE cwID='".$squadcwdata['cwID']."' AND squad='".$squaddata['squadID']."'"));
$sqOppScore=array_sum(explode("||", $sqOppScoreQry['oppscore']));
$totalOppScoreSQ+=array_sum(explode("||", $sqOppScoreQry['oppscore']));
//
if($sqHomeScore > $sqOppScore) $wonall++;
if($sqHomeScore < $sqOppScore) $loseall++;
if($sqHomeScore == $sqOppScore) $drawall++;
//
unset($sqHomeScore);
unset($sqOppScore);
}
// SQUAD STATISTICS - CLANWARS
// total squad clanwars - home points
$home=$totalHomeScoreSQ;
if(empty($home)) $home=0;
$homeperc=percent($home, $totalhome, 2);
// total squad clanwars - opponent points
$opp=$totalOppScoreSQ;
if(empty($opp)) $opp=0;
$oppperc=percent($opp, $totalopp, 2);
// total squad clanwars won
$wonperc=percent($wonall, $totaltotal, 2);
if($wonperc) $totalwon=$wonperc.'%
';
else $totalwon='0%';
// total squad clanwars lost
$loseperc=percent($loseall, $totaltotal, 2);
if($loseperc) $totallost=$loseperc.'%
';
else $totallost='0%';
// total squad clanwars draw
$drawperc=percent($drawall, $totaltotal, 2);
if($drawperc) $totaldraw=$drawperc.'%
';
else $totaldraw='0%';
// fill empty vars
if(empty($totalwon)) $totalwon=0;
if(empty($totallost)) $totallost=0;
if(empty($totaldraw)) $totaldraw=0;
if(empty($wonall)) $wonall=0;
if(empty($loseall)) $loseall=0;
if(empty($drawall)) $drawall=0;
// start output for squad details
eval("\$clanwars_stats = \"".gettemplate("clanwars_stats")."\";");
echo $clanwars_stats;
unset($opp); unset($home);
unset($totalwon); unset($totallost); unset($totaldraw);
unset($totalHomeScoreSQ); unset($totalOppScoreSQ);
unset($homeperc); unset($oppperc);
// PLAYER STATISTICS
// start output for squad details - players of the squad - head
eval ("\$clanwars_stats_player_head = \"".gettemplate("clanwars_stats_player_head")."\";");
echo $clanwars_stats_player_head;
// get playerlist for squad
$squadmembers=safe_query("SELECT * FROM ".PREFIX."squads_members WHERE squadID='".$squaddata['squadID']."'");
while($player=mysql_fetch_array($squadmembers)) {
$playerlist[]=$player['userID'];
}
// get roster for squad and find matches with playerlist
$playercws=safe_query("SELECT hometeam FROM ".PREFIX."clanwars WHERE squad='".$squaddata['squadID']."'");
while($roster=mysql_fetch_array($playercws)) {
$hometeam.=$roster['hometeam']."|";
}
// counts clanwars the member has taken part in
$anz=array();
if(!empty($hometeam)) {
$array=explode("|", $hometeam);
foreach($array as $id) {
if(!empty($id)) {
$anz[$id]=$anz[$id]+1;
}
}
}
// member's details and the output
if(is_array($playerlist)) {
$i=1;
foreach($playerlist as $id) {
if($i%2) {
$bg1=BG_1;
$bg2=BG_2;
}
else {
$bg1=BG_3;
$bg2=BG_4;
}
$country='[flag]'.getcountry($id).'[/flag]';
$country=flags($country);
$member=''.getnickname($id).'';
$wars=$anz[$id];
if(empty($wars)) $wars='0';
$perc=percent($wars, $total, 2);
if($perc) $percpic=' '.$perc.'%';
else $percpic=' '.$perc.'%';
eval ("\$clanwars_stats_player_content = \"".gettemplate("clanwars_stats_player_content")."\";");
echo $clanwars_stats_player_content;
$i++;
}
}
echo'';
unset($wonall);
unset($loseall);
unset($drawall);
unset($playerlist);
unset($hometeam);
unset($squadcwdata);
}
}
}
elseif($_GET['action']=="showonly") {
$cwID = $_GET['cwID'];
$id = $_GET['id'];
$only = $_GET['only'];
$sort = $_GET['sort'];
$type = $_GET['type'];
$page = $_GET['page'];
$squads=getgamesquads();
$jumpsquads=str_replace('value="', 'value="index.php?site=clanwars&action=showonly&only=squad&id=', $squads);
$jumpmenu=' ';
eval ("\$title_clanwars = \"".gettemplate("title_clanwars")."\";");
echo $title_clanwars;
$gesamt = mysql_num_rows(safe_query("SELECT cwID FROM ".PREFIX."clanwars WHERE $only='$id'"));
$pages=1;
if(!isset($page)) $page = 1;
if(!isset($sort)) $sort = "date";
if(!isset($type)) $type = "DESC";
$max=$maxclanwars;
for ($n=$max; $n<=$gesamt; $n+=$max) {
if($gesamt>$n) $pages++;
}
if($pages>1) $page_link = makepagelink("index.php?site=clanwars&action=showonly&id=$id&sort=$sort&type=$type&only=$only", $page, $pages);
if ($page == "1") {
$ergebnis = safe_query("SELECT * FROM ".PREFIX."clanwars WHERE $only='$id' ORDER BY $sort $type LIMIT 0,$max");
if($type=="DESC") $n=$gesamt;
else $n=1;
}
else {
$start=$page*$max-$max;
$ergebnis = safe_query("SELECT * FROM ".PREFIX."clanwars WHERE $only='$id' ORDER BY $sort $type LIMIT $start,$max");
if($type=="DESC") $n = ($gesamt)-$page*$max+$max;
else $n = ($gesamt+1)-$page*$max+$max;
}
if($type=="ASC")
$seiten='Sort: '.$page_link.'
';
else
$seiten='Sort: '.$page_link.'
';
if(isclanwaradmin($userID)) $admin='';
$Statistics='';
echo'';
if($gesamt) {
$headdate='Date:';
$headgame='G:';
$headsquad='Squad:';
$headcountry='Cnt:';
$headleague='League:';
eval ("\$clanwars_head = \"".gettemplate("clanwars_head")."\";");
echo $clanwars_head;
$n=1;
if(isclanwaradmin($userID)) echo'';
eval ("\$clanwars_foot = \"".gettemplate("clanwars_foot")."\";");
echo $clanwars_foot;
}
else echo'no entries';
}
elseif(empty($_GET['action'])) {
$sort = $_GET['sort'];
$type = $_GET['type'];
$page = $_GET['page'];
$squads=getgamesquads();
$jumpsquads=str_replace('value="', 'value="index.php?site=clanwars&action=showonly&only=squad&id=', $squads);
$jumpmenu=' ';
eval ("\$title_clanwars = \"".gettemplate("title_clanwars")."\";");
echo $title_clanwars;
$gesamt = mysql_num_rows(safe_query("SELECT cwID FROM ".PREFIX."clanwars"));
$pages=1;
if(!isset($page)) $page = 1;
if(!isset($sort)) $sort = "date";
if(!isset($type)) $type = "DESC";
$max=$maxclanwars;
for($n=$max; $n<=$gesamt; $n+=$max) {
if($gesamt>$n) $pages++;
}
if($pages>1) $page_link = makepagelink("index.php?site=clanwars&sort=$sort&type=$type", $page, $pages);
if($page == "1") {
$ergebnis = safe_query("SELECT * FROM ".PREFIX."clanwars ORDER BY $sort $type LIMIT 0,$max");
if($type=="DESC") $n=$gesamt;
else $n=1;
}
else {
$start=$page*$max-$max;
$ergebnis = safe_query("SELECT * FROM ".PREFIX."clanwars ORDER BY $sort $type LIMIT $start,$max");
if($type=="DESC") $n = ($gesamt)-$page*$max+$max;
else $n = ($gesamt+1)-$page*$max+$max;
}
if($type=="ASC") $seiten='Sort: '.$page_link.'
';
else $seiten='Sort: '.$page_link.'
';
if(isclanwaradmin($userID)) $admin='';
$statistics='';
echo'';
if($gesamt) {
$headdate='Date:';
$headgame='G:';
$headsquad='Squad:';
$headcountry='Cnt:';
$headleague='League:';
eval ("\$clanwars_head = \"".gettemplate("clanwars_head")."\";");
echo $clanwars_head;
$n=1;
if(isclanwaradmin($userID)) echo'';
eval ("\$clanwars_foot = \"".gettemplate("clanwars_foot")."\";");
echo $clanwars_foot;
}
else echo'no entries';
}
?>