'.$i.'';
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.='';
}
$squads=getgamesquads();
$bg1=BG_1;
eval ("\$awards_new = \"".gettemplate("awards_new")."\";");
echo $awards_new;
}
else redirect('index.php?site=awards', 'no access!');
}
elseif($_GET['action']=="edit") {
$awardID = $_GET['awardID'];
if(isclanwaradmin($userID) || isnewsadmin($userID)) {
$ds=mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."awards WHERE awardID='$awardID'"));
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.='';
}
$squads=getgamesquads();
$squads=str_replace('value="'.$ds[squadID].'"', 'value="'.$ds[squadID].'" selected', $squads);
$award=$ds[award];
$homepage=$ds[homepage];
$rang=$ds[rang];
$info=$ds[info];
$bg1=BG_1;
eval ("\$awards_edit = \"".gettemplate("awards_edit")."\";");
echo $awards_edit;
}
else redirect('index.php?site=awards', 'no access!');
}
elseif($_GET['action']=="showsquad") {
$squadID = $_GET['squadID'];
$page = $_GET['page'];
$sort = $_GET['page'];
$type = $_GET['type'];
if(isclanwaradmin($userID) || isnewsadmin($userID)) echo'
';
$alle=safe_query("SELECT awardID FROM ".PREFIX."awards WHERE squadID='$squadID'");
$gesamt = mysql_num_rows($alle);
$pages=1;
if(!isset($page)) $page = 1;
if(!isset($sort)) $sort = "date";
if(!isset($type)) $type = "DESC";
$max=$maxawards;
for ($n=$max; $n<=$gesamt; $n+=$max) {
if($gesamt>$n) $pages++;
}
if($pages>1) $page_link = makepagelink("index.php?site=awards&action=showsquad&squadID=$squadID&sort=$sort&type=$type", $page, $pages);
if ($page == "1") {
$ergebnis = safe_query("SELECT * FROM ".PREFIX."awards WHERE squadID='$squadID' 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."awards WHERE squadID='$squadID' ORDER BY $sort $type LIMIT $start,$max");
if($type=="DESC") $n = ($gesamt)-$page*$max+$max;
else $n = ($gesamt+1)-$page*$max+$max;
}
if($gesamt) {
if($type=="ASC")
echo'Sort: ';
else
echo'Sort: ';
echo $page_link;
echo'
';
$headdate='Date:';
$headsquad='Squad:';
eval ("\$awards_head = \"".gettemplate("awards_head")."\";");
echo $awards_head;
$n=1;
while($ds=mysql_fetch_array($ergebnis)) {
if($n%2) {
$bg1=BG_1;
$bg2=BG_2;
}
else {
$bg1=BG_3;
$bg2=BG_4;
}
$date=date("d.m.Y", $ds[date]);
$squad=getsquadname($ds[squadID]);
$award=cleartext($ds[award]);
$homepage=$ds[homepage];
$rang=$ds[rang];
if(isclanwaradmin($userID) || isnewsadmin($userID))
$adminaction='
';
eval ("\$awards_content = \"".gettemplate("awards_content")."\";");
echo $awards_content;
unset($result);
$n++;
}
eval ("\$awards_foot = \"".gettemplate("awards_foot")."\";");
echo $awards_foot;
} else echo'no entries';
} elseif($_GET['action']=="details") {
$awardID = $_GET['awardID'];
$ds=mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."awards WHERE awardID='$awardID'"));
$rang=$ds[rang];
if($rang=='') $rang="-";
$award=cleartext($ds[award]);
if($award=='') $award="-";
$squad=getsquadname($ds[squadID]);
$squadID=$ds[squadID];
$date=date("d.m.Y", $ds[date]);
$info=toggle(htmloutput($ds[info]));
if($info=='') $info="-";
$homepage = ''.$ds[homepage].'';
$bg1=BG_1;
$bg2=BG_2;
$bg3=BG_3;
$bg4=BG_4;
eval ("\$awards_info = \"".gettemplate("awards_info")."\";");
echo $awards_info;
} else {
$page = $_GET['page'];
$sort = $_GET['page'];
$type = $_GET['type'];
if(isclanwaradmin($userID) || isnewsadmin($userID)) echo'
';
$alle=safe_query("SELECT awardID FROM ".PREFIX."awards");
$gesamt = mysql_num_rows($alle);
$pages=1;
if(!isset($page)) $page = 1;
if(!isset($sort)) $sort = "date";
if(!isset($type)) $type = "DESC";
$max=30;
for ($n=$max; $n<=$gesamt; $n+=$max) {
if($gesamt>$n) $pages++;
}
if($pages>1) $page_link = makepagelink("index.php?site=awards&sort=$sort&type=$type", $page, $pages);
if ($page == "1") {
$ergebnis = safe_query("SELECT * FROM ".PREFIX."awards 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."awards ORDER BY $sort $type LIMIT $start,$max");
if($type=="DESC") $n = ($gesamt)-$page*$max+$max;
else $n = ($gesamt+1)-$page*$max+$max;
}
if($gesamt) {
if($type=="ASC")
echo'Sort: ';
else
echo'Sort: ';
echo $page_link;
echo'
';
$headdate='Date:';
$headsquad='Squad:';
eval ("\$awards_head = \"".gettemplate("awards_head")."\";");
echo $awards_head;
$n=1;
while($ds=mysql_fetch_array($ergebnis)) {
if($n%2) {
$bg1=BG_1;
$bg2=BG_2;
}
else {
$bg1=BG_3;
$bg2=BG_4;
}
$date=date("d.m.Y", $ds[date]);
$squad=''.getsquadname($ds[squadID]).'';
$award=cleartext($ds[award]);
$homepage=$ds[homepage];
$rang=$ds[rang];
if(isclanwaradmin($userID) || isnewsadmin($userID))
$adminaction='
';
eval ("\$awards_content = \"".gettemplate("awards_content")."\";");
echo $awards_content;
$n++;
}
eval ("\$awards_foot = \"".gettemplate("awards_foot")."\";");
echo $awards_foot;
}
else echo'no entries';
}
?>