<?php
function
convert_time(
$value
){
$output
= sprintf(
'%02d'
,
intval
(
$value
/60000)) .
':'
;
$value
=
$value
%60000;
$output
.= sprintf(
'%02d'
,
intval
(
$value
/1000));
return
$output
;
}
function
createFromTemplate(
$t_tempfile
,
$row
,
$delete
){
global
$langu
;
global
$reps_folder
,
$replaypath
,
$colored_accounts
,
$reveal_winner
,
$user_vote
,
$use_login
,
$login_to_rate
,
$user_loggedin
,
$user_may_delete
,
$CFG_APMDIAG_X
,
$CFG_APMDIAG_Y
;
include
(
$reps_folder
.
'costs.php'
);
for
(
$j
=0;
$j
<12;
$j
++){
$playerdetails
[
$j
] = unserialize(
stripslashes
(
$row
[
'Slot'
.(
$j
+1).
'Details'
]));
if
(isset(
$row
[
'Slot'
.(
$j
+1).
'AdvancedDetails'
]))
$playerdetails
[
$j
] = @
array_merge
(
$playerdetails
[
$j
], unserialize(gzuncompress(
$row
[
'Slot'
.(
$j
+1).
'AdvancedDetails'
])));
}
$t_file
=
$t_tempfile
;
if
(
$delete
== 1){
$t_file
=
str_replace
(
"##LÖSCHNUMMER#"
,
'[Nr.'
.
$row
[
'ID'
].
']'
,
$t_file
);
}
else
{
$t_file
=
str_replace
(
"##LÖSCHNUMMER#"
,
""
,
$t_file
);
}
$t_file
=
str_replace
(
"##DATUM#"
,
date
(
"d.m.Y"
,
strtotime
(
$row
[
'Datum'
])),
$t_file
);
$t_file
=
str_replace
(
"##UHRZEIT#"
,
date
(
"H:i:s"
,
strtotime
(
$row
[
'Datum'
])),
$t_file
);
$t_file
=
str_replace
(
"##REPLAYPOSTER#"
,
$row
[
'PostName'
],
$t_file
);
$t_file
=
str_replace
(
"##SPIELMODUS#"
,
$row
[
'SpielModus'
],
$t_file
);
$t_file
=
str_replace
(
"##POSTED_BY#"
,
$langu
[
'posted_by'
],
$t_file
);
$t_file
=
str_replace
(
"##UPLOAD_DATE#"
,
$langu
[
'upload_date'
],
$t_file
);
$t_file
=
str_replace
(
"##GAMETYPE#"
,
$langu
[
'gametype'
],
$t_file
);
$t_file
=
str_replace
(
"##LENGTH#"
,
$langu
[
'length'
],
$t_file
);
$t_file
=
str_replace
(
"##DESCRIPTION#"
,
$langu
[
'description'
],
$t_file
);
for
(
$slotCnt
= 1;
$slotCnt
< 13;
$slotCnt
++){
$row
[
'Slot'
.
$slotCnt
.
'GatewayName'
] =
$row
[
'Slot'
.
$slotCnt
.
'Name'
];
if
(
$row
[
'Gateway'
]){
$starttag
=
'<a '
;
if
(isset(
$playerdetails
[
$slotCnt
-1][
'color_html'
]))
{
if
( (
$playerdetails
[
$slotCnt
-1][
'color_html'
]) AND (
$_GET
[
'file'
]==
'details_comments'
OR
$colored_accounts
) ){
$starttag
.=
'class="'
.
$playerdetails
[
$slotCnt
-1][
'color'
].
'" '
;
}
}
$starttag
.=
"-player-profile.aspx?Gateway="
.
$row
[
"Gateway"
].
"&PlayerName="
;
if
(!
empty
(
$row
[
'Slot'
.
$slotCnt
.
'Name'
]))
$row
[
'Slot'
.
$slotCnt
.
'GatewayName'
] =
$starttag
.
$row
[
'Slot'
.
$slotCnt
.
'Name'
].
'">'
.
$row
[
'Slot'
.
$slotCnt
.
'Name'
].
'</a>'
;
}
else
{
if
(!
empty
(
$row
[
'Slot'
.
$slotCnt
.
'Name'
]))
if
( (
$playerdetails
[
$slotCnt
-1][
'color_html'
]) AND (
$_GET
[
'file'
]==
'details_comments'
OR
$colored_accounts
) ){
$row
[
'Slot'
.
$slotCnt
.
'GatewayName'
] =
'<span style="color:'
.
$playerdetails
[
$slotCnt
-1][
'color_html'
].
'">'
.
$row
[
'Slot'
.
$slotCnt
.
'GatewayName'
].
'</span>'
;
}
}
}
if
(
$row
[
'w3type'
] ==
'WAR3'
){
$icons
[
'O'
] =
'<img src="'
.
$reps_folder
.
'images/icons/icon_orc.gif" ALT="Orc">'
;
$icons
[
'H'
] =
'<img src="'
.
$reps_folder
.
'images/icons/icon_hu.gif" ALT="Human">'
;
$icons
[
'N'
] =
'<img src="'
.
$reps_folder
.
'images/icons/icon_ne.gif" ALT="Night Elf">'
;
$icons
[
'U'
] =
'<img src="'
.
$reps_folder
.
'images/icons/icon_ud.gif" ALT="Undead">'
;
}
else
{
$icons
[
'O'
] =
'<img src="'
.
$reps_folder
.
'images/icons/tft_orc.gif" ALT="Orc">'
;
$icons
[
'H'
] =
'<img src="'
.
$reps_folder
.
'images/icons/tft_hu.gif" ALT="Human">'
;
$icons
[
'N'
] =
'<img src="'
.
$reps_folder
.
'images/icons/tft_ne.gif" ALT="Night Elf">'
;
$icons
[
'U'
] =
'<img src="'
.
$reps_folder
.
'images/icons/tft_ud.gif" ALT="Undead">'
;
$icons
[
'R'
] =
'<img src="'
.
$reps_folder
.
'images/icons/tft_rdm.gif" ALT="Random">'
;
$icons
[
'RO'
] =
'<img src="'
.
$reps_folder
.
'images/icons/rnd_tft_orc.gif" ALT="Orc">'
;
$icons
[
'RH'
] =
'<img src="'
.
$reps_folder
.
'images/icons/rnd_tft_hu.gif" ALT="Human">'
;
$icons
[
'RN'
] =
'<img src="'
.
$reps_folder
.
'images/icons/rnd_tft_ne.gif" ALT="Night Elf">'
;
$icons
[
'RU'
] =
'<img src="'
.
$reps_folder
.
'images/icons/rnd_tft_ud.gif" ALT="Undead">'
;
}
if
(
strpos
(
$t_file
,
"##TEAMS_MAX1SPIELERPROZEILE#"
) != 0){
$t_spielerarray
=
''
;
$tnow
=
$k
=
$tabout
= 0;
$tlast
= -1;
while
((
$k
<12) && (!
empty
(
$row
[
'Slot'
.(
$k
+ 1).
'Name'
]))){
$tnow
=
$playerdetails
[
$k
][
'team'
];
if
((
$tlast
!= -1) && (
$tnow
!=
$tlast
)){
if
(
$k
> 1 &&
$row
[
'SpielModus'
]!=
'TeamFFA'
&&
$row
[
'SpielModus'
]!=
'FFA'
){
$t_spielerarray
.=
'<table border="0" cellpadding="0" cellspacing="0" width="50"><tr><td width="20"></td><td><b>vs</b></td></tr></table>'
;
$tabout
++;
}
else
$t_spielerarray
.=
'<b>vs</b>'
;
}
if
(
$tlast
!= -1 &&
$tabout
== 0) {
$t_spielerarray
.=
'<br>'
; }
$tabout
=0;
$t_spielerarray
.=
$icons
[
$row
[
'Slot'
.(
$k
+ 1).
'Rasse'
]];
$t_spielerarray
.=
'<b>'
.
$row
[
'Slot'
.(
$k
+1).
'GatewayName'
].
'</b>'
;
$t_spielerarray
.=
' <span class="iZismall">('
.
round
(
$playerdetails
[
$k
][
'apm'
]).
')</span> '
;
$tlast
=
$tnow
;
$k
++;
}
$t_file
=
str_replace
(
"##TEAMS_MAX1SPIELERPROZEILE#"
,
$t_spielerarray
,
$t_file
);
}
if
(
strpos
(
$t_file
,
"##TEAMS_MAX2SPIELERPROZEILE#"
) != 0){
$t_spielerarray
=
''
;
$tnow
=
$k
=
$leer
= 0;
$tlast
= -1;
while
((
$k
<12) && (!
empty
(
$row
[
'Slot'
.(
$k
+ 1).
'Name'
]))){
$tnow
=
$playerdetails
[
$k
][
'team'
];
if
((
$tlast
!= -1) && (
$tnow
!=
$tlast
))
{
$t_spielerarray
.=
'<b>vs</b><br> '
;
$leer
= -1; }
$leer
++;
if
(
$leer
== 3) {
$t_spielerarray
.=
'<br>'
;
$leer
= 0; }
$t_spielerarray
.=
$icons
[
$row
[
'Slot'
.(
$k
+ 1).
'Rasse'
]];
$t_spielerarray
.=
'<b>'
.
$row
[
'Slot'
.(
$k
+1).
'GatewayName'
].
'</b> '
;
$t_spielerarray
.=
'<span class="iZismall">('
.
round
(
$playerdetails
[
$k
][
'apm'
]).
')</span> '
;
$tlast
=
$tnow
;
$k
++;
}
$t_file
=
str_replace
(
"##TEAMS_MAX2SPIELERPROZEILE#"
,
$t_spielerarray
,
$t_file
);
}
if
(
strpos
(
$t_file
,
"##TEAMS_SPALTEN#"
) != 0){
$t_spielerarray
=
'<table border="0" cellpadding="0" cellspacing="0"><tr><td>'
;
$tnow
=
$k
=
$leer
= 0;
$tlast
= -1;
$spaltencount
=0;
while
((
$k
<12) && (!
empty
(
$row
[
'Slot'
.(
$k
+ 1).
'Name'
]))){
$t_class
= (
$class
==
'Cnorm'
?
'Greym'
:
'Cnorm'
);
$tnow
=
$playerdetails
[
$k
][
'team'
];
if
((
$tlast
!= -1) && (
$tnow
!=
$tlast
)){
$spaltencount
++;
if
(
$spaltencount
== 2){
$t_spielerarray
.=
'</td><td><b> vs. </b></td></tr><tr><td>'
;
$spaltencount
= 0;
}
else
{
$t_spielerarray
.=
'</td><td><b> vs. </b></td><td>'
;
}
$not_first
= false;
}
if
(
$not_first
){
$t_spielerarray
.=
'<br>'
;
}
else
{
$not_first
= true;
}
$t_spielerarray
.=
$icons
[
$row
[
'Slot'
.(
$k
+ 1).
'Rasse'
]];
$t_spielerarray
.=
'<b>'
.
$row
[
'Slot'
.(
$k
+1).
'GatewayName'
].
'</b> '
;
$t_spielerarray
.=
'<span class="iZismall">('
.
round
(
$playerdetails
[
$k
][
'apm'
]).
')</span>'
;
$tlast
=
$tnow
;
$k
++;
}
$t_spielerarray
.=
'</td></tr></table>'
;
$t_file
=
str_replace
(
"##TEAMS_SPALTEN#"
,
$t_spielerarray
,
$t_file
);
}
$t_details
=
''
;
if
(
strpos
(
$t_file
,
"##TEAMSDETAILLIERT#"
) != 0){
$observers
= unserialize(
stripslashes
(
$row
[
'Observers'
]));
$lastid
= -1;
for
(
$i
=0;
$i
<12;
$i
++){
$player
=
$playerdetails
[
$i
];
if
(isset(
$playerdetails
[
$i
][
'team'
]))
$team
=
$playerdetails
[
$i
][
'team'
];
else
$team
=
''
;
$player
[
'name'
] =
$row
[
'Slot'
.(
$i
+ 1).
'Name'
];
$player
[
'gatewayname'
] =
$row
[
'Slot'
.(
$i
+ 1).
'GatewayName'
];
$player
[
'race'
] =
$row
[
'Slot'
.(
$i
+ 1).
'Rasse'
];
if
(!
empty
(
$row
[
'Slot'
.(
$i
+ 1).
'Name'
])){
if
(
$lastid
!=
$team
){
$t_details
.=
'<b>Team '
.(
$team
+1).
'</b>'
;
if
(
$team
==
$row
[
'winner_team'
]){
if
(
$reveal_winner
){
$t_details
.=
' <img src="'
.
$reps_folder
.
'images/icons/king.gif"> (Winner)'
;
}
}
$t_details
.=
'<br>'
;
}
$lastid
=
$team
;
$t_details
.= (
'<div class="section">'
);
$t_details
.=
$icons
[
$row
[
'Slot'
.(
$i
+ 1).
'Rasse'
]].
' '
;
$t_details
.=
'<b>'
.
$player
[
'gatewayname'
].
'</b> ('
;
$t_details
.=
round
(
$player
[
'apm'
]).
' APM | '
;
$t_details
.=
$player
[
'actions'
].
' '
.
$langu
[
'actions'
].
')'
;
$t_details
.='<br>
<div
class
=
"details"
>';
if
(isset(
$player
[
'heroes'
])){
foreach
(
$player
[
'heroes'
]
as
$name
=>
$info
){
if
(
$name
!=
'order'
&& isset(
$info
[
'level'
])){
$hero_file
=
strtolower
(
str_replace
(
' '
,
''
,
$name
));
$t_details
.=
'<img style="width: 14px; height: 14px;" src="'
.
$reps_folder
.
'images/heroes/'
.
$hero_file
.
'.gif" alt="Hero icon" /> <b>'
.
$info
[
'level'
].
'</b> <a href="javascript:display_add_hero(\''
.
$player
[
'name'
].
'\',\''
.
$hero_file
.
'\');" title="Helden-Fähigkeiten">'
.
$name
.
'</a>'
;
}
}
foreach
(
$player
[
'heroes'
]
as
$name
=>
$info
){
if
(
$name
!=
'order'
&& isset(
$info
[
'level'
])){
$hero_file
=
strtolower
(
str_replace
(
' '
,
''
,
$name
));
$t_details
.=
'<div id="'
.
$player
[
'name'
].
$hero_file
.
'" class="additional">'
;
foreach
(
$info
[
'abilities'
]
as
$ability
=>
$info
){
if
(
$ability
!=
'order'
){
$ability_file
=
strtolower
(
str_replace
(
' '
,
''
,
$ability
));
$t_details
.=
'<img style="width: 14px; height: 14px;" src="'
.
$reps_folder
.
'images/skills/'
.
$ability_file
.
'.gif" /> <b>'
.
$info
.
'</b> '
.
$ability
.
'<br />'
;
}
}
$t_details
.=
'</div>'
;
}
}
}
$player
[
'name'
] =
str_replace
(
'.'
,
''
,
$player
[
'name'
]);
if
(!isset(
$player
[
'name'
]))
$player
[
'name'
] =
'unbekannt'
;
$t_details
.='<div>
<a href=
"javascript:display_add(\''.$player['name'].'\',\'actions\');"
>» '.
$langu
[
'actions'
].' </a>
<a href=
"javascript:display_add(\''.$player['name'].'\',\'units\');"
>» '.
$langu
[
'units'
].
' </a>'
;
if
(
$player
[
'upgrades'
])
$t_details
.=
'<a href="javascript:display_add(\''
.
$player
[
'name'
].
'\',\'upgrades\');">» '
.
$langu
[
'upgrades'
].
' </a>'
;
$t_details
.=
'<a href="javascript:display_add(\''
.
$player
[
'name'
].
'\',\'buildings\');">» '
.
$langu
[
'buildings'
].
' </a>'
;
if
(
$player
[
'items'
])
$t_details
.=
'<a href="javascript:display_add(\''
.
$player
[
'name'
].
'\',\'items\');">» '
.
$langu
[
'items'
].
'</a>'
;
$t_details
.=
'<div id="'
.
$player
[
'name'
].'actions"
class
=
"additional"
>
<table cellspacing=
"0"
cellpadding=
"1"
>';
if
(isset(
$player
[
'actions_details'
])){
arsort(
$player
[
'actions_details'
]);
foreach
(
$player
[
'actions_details'
]
as
$name
=>
$info
){
$t_details
.=
'<tr><td style="text-align: right;">'
.
$name
.
'</td><td style="text-align: right;"><b>'
.
$info
.
'</b></td><td><div class="graph" style="width: '
.
round
(
$info
/10).
'px;"></div></td></tr>'
;
}
}
$t_details
.='<tr><td colspan=
"3"
height=
"3px"
></td></tr>
<tr
class
=
"details_sum"
><td align=
"right"
colspan=
"2"
>Total <b>
'.$player['
actions
'].'
</b></td><td></td></table></div>';
$t_details
.=
'<div id="'
.
$player
[
'name'
].'units"
class
=
"additional"
>
<table cellspacing=
"0"
cellpadding=
"1"
>';
$ii
= 0;
$gold_units
=0;
$wood_units
=0;
if
(isset(
$player
[
'units'
])){
foreach
(
$player
[
'units'
]
as
$name
=>
$info
){
if
(
$name
!=
'order'
&&
$info
){
$unit_file
=
strtolower
(
str_replace
(
' '
,
''
,
$name
));
$gold
=
$cost
[
$unit_file
][0]*
$info
;
$wood
=
$cost
[
$unit_file
][1]*
$info
;
if
(
$wood
)
$wood_str
=
'<IMG SRC="'
.
$reps_folder
.
'images/icons/lumber-sm.gif"> '
.
$wood
;
else
$wood_str
=
''
;;
$gold_units
+=
$gold
;
$wood_units
+=
$wood
;
$t_details
.=
'<tr><td style="text-align: right;">'
.
$name
.
' <img style="width: 14px; height: 14px;" src="'
.
$reps_folder
.
'images/units/'
.
$unit_file
.
'.gif" /></td><td style="text-align: right;"><b>'
.
$info
.
'</b></td><td><div class="graph" style="width: '
.(
$info
*5).'px;"></div></td>
<td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold.'
</td><td>
'.$wood_str.'
</td></tr>';
$ii
+=
$info
;
}
}
}
$t_details
.=
'<tr><td colspan="5" height="3px"></td></tr><tr class="details_sum"><td align="right" colspan="2">Total <b>'
.
$ii
.'</b></td><td></td>
<td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold_units.'
</td><td><IMG SRC=
"'.$reps_folder.'images/icons/lumber-sm.gif"
>
'.$wood_units.'
</td></tr></table></div>';
if
(isset(
$player
[
'upgrades'
])){
if
(
$player
[
'upgrades'
]){
$t_details
.=
'<div id="'
.
$player
[
'name'
].'upgrades"
class
=
"additional"
>
<table cellspacing=
"0"
cellpadding=
"1"
>';
$ii
= 0;
$gold_upgrades
=0;
$wood_upgrades
=0;
foreach
(
$player
[
'upgrades'
]
as
$name
=>
$info
){
if
(
$name
!=
'order'
){
$upgrade_file
=
strtolower
(
str_replace
(
' '
,
''
,
$name
));
while
(!
$cost
[
$upgrade_file
][
$info
] AND
$info
>1){
$info
--; }
$gold
=
$cost
[
$upgrade_file
][
$info
][0];
$wood
=
$cost
[
$upgrade_file
][
$info
][1];
if
(
$wood
)
$wood_str
=
'<IMG SRC="'
.
$reps_folder
.
'images/icons/lumber-sm.gif"> '
.
$wood
;
else
$wood_str
=
''
;;
$gold_upgrades
+=
$gold
;
$wood_upgrades
+=
$wood
;
$t_details
.=
'<tr><td style="text-align: right;">'
.
$name
.
' <img style="width: 14px; height: 14px;" src="'
.
$reps_folder
.
'images/upgrades/'
.
$upgrade_file
.
'.gif" /></td><td style="text-align: right;"><b>'
.
$info
.
'</b></td><td><div class="graph" style="width: '
.(
$info
*20).'px;"></div></td>
<td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold.'
</td><td>
'.$wood_str.'
</td></tr>';
$ii
+=
$info
;
}
}
$t_details
.=
'<tr><td colspan="5" height="3px"></td></tr><tr class="details_sum"><td align="right" colspan="2">Total <b>'
.
$ii
.'</b></td><td></td>
<td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold_upgrades.'
</td><td><IMG SRC=
"'.$reps_folder.'images/icons/lumber-sm.gif"
>
'.$wood_upgrades.'
</td></tr></table></div>';
}
}
$t_details
.=
'<div id="'
.
$player
[
'name'
].'buildings"
class
=
"additional"
>
<table cellpadding=
"5"
width=
"100%"
><tr>';
$t_details
.=
'<td valign="top"><table cellspacing="0" cellpadding="1">'
;
$ii
= 0;
$gold_buildings
=0;
$wood_buildings
=0;
if
(isset(
$player
[
'buildings'
])){
arsort(
$player
[
'buildings'
]);
foreach
(
$player
[
'buildings'
]
as
$name
=>
$info
){
if
(
$name
!=
'order'
){
$building_file
=
strtolower
(
str_replace
(
' '
,
''
,
$name
));
$gold
=
$cost
[
$building_file
][0]*
$info
;
$wood
=
$cost
[
$building_file
][1]*
$info
;
if
(
$wood
)
$wood_str
=
'<IMG SRC="'
.
$reps_folder
.
'images/icons/lumber-sm.gif"> '
.
$wood
;
else
$wood_str
=
''
;;
$gold_buildings
+=
$gold
;
$wood_buildings
+=
$wood
;
(
$info
>15)?
$infox
=15 :
$infox
=
$info
;
$t_details
.=
'<tr><td style="text-align: right;">'
.
$name
.
' <img style="width: 14px; height: 14px;" src="'
.
$reps_folder
.
'images/buildings/'
.
$building_file
.'.gif
" /></td><td style="
text-align: right;">
<b>
'.$info.'
</b></td><td><div
class
=
"graph"
style=
"width: '.($infox*10).'px;"
></div></td>
<td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold.'
</td><td>
'.$wood_str.'
</td></tr>';
$ii
+=
$info
;
}
}
}
$t_details
.=
'<tr><td colspan="5" height="3px"></td></tr><tr class="details_sum"><td align="right" colspan="2">Total <b>'
.
$ii
.'</b></td><td></td>
<td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold_buildings.'
</td><td><IMG SRC=
"'.$reps_folder.'images/icons/lumber-sm.gif"
>
'.$wood_buildings.'
</td></tr></table></div>';
if
(isset(
$player
[
'buildings'
][
'order'
])){
$t_details
.=
'<td style="line-height:11px; font-size:10px;">'
;
foreach
(
$player
[
'buildings'
][
'order'
]
as
$time
=>
$name
){
$building_file
=
strtolower
(
str_replace
(
' '
,
''
,
$name
));
$t_details
.=convert_time(
$time
).
' <img style="width: 11px; height: 11px;" src="'
.
$reps_folder
.
'images/buildings/'
.
$building_file
.
'.gif" /> '
.
$name
.
'<br>'
;
}
$t_details
.=
'</td>'
;
}
$t_details
.=
'</tr></table></div>'
;
if
(isset(
$player
[
'items'
])){
if
(
$player
[
'items'
]){
$t_details
.=
'<div id="'
.
$player
[
'name'
].
'items" class="additional"><table cellspacing="0" cellpadding="1">'
;
$ii
= 0;
arsort(
$player
[
'items'
]);
$gold_items
= 0;
$wood_items
= 0;
foreach
(
$player
[
'items'
]
as
$name
=>
$info
){
if
(
$name
!=
'order'
){
$item_file
=
strtolower
(
str_replace
(
' '
,
''
,
$name
));
$gold
=
$cost
[
$item_file
][0]*
$info
;
$wood
=
$cost
[
$item_file
][1]*
$info
;
if
(
$wood
)
$wood_str
=
'<IMG SRC="'
.
$reps_folder
.
'images/icons/lumber-sm.gif"> '
.
$wood
;
else
$wood_str
=
''
;;
$gold_items
+=
$gold
;
$wood_items
+=
$wood
;
$t_details
.=
'<tr><td style="text-align: right;">'
.
$name
.
' <img style="width: 14px; height: 14px;" src="'
.
$reps_folder
.
'images/items/'
.
$item_file
.
'.gif" /></td><td style="text-align: right;"><b>'
.
$info
.
'</b></td><td><div class="graph" style="width: '
.(
$info
*20).'px;"></div></td>
<td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold.'
</td><td>
'.$wood_str.'
</td></tr>';
$ii
+=
$info
;
}
}
$t_details
.=
'<tr><td colspan="5" height="3px"></td></tr><tr class="details_sum"><td align="right" colspan="2">Total <b>'
.
$ii
.'</b></td>
<td></td><td><IMG SRC=
"'.$reps_folder.'images/icons/gold-sm.gif"
>
'.$gold_items.'
</td><td><IMG SRC=
"'.$reps_folder.'images/icons/lumber-sm.gif"
>
'.$wood_items.'
</td></tr></table></div>';
}
}
}
$t_details
.=
'</div></div></div>'
;
}
$t_file
=
str_replace
(
"##TEAMSDETAILLIERT#"
,
$t_details
,
$t_file
);
}
if
(
strpos
(
$t_file
,
"##OBSERVER#"
) != 0)
{
$t_observer
=
''
;
$observers
= unserialize(
stripslashes
(
$row
[
'Observers'
]));
if
(isset(
$observers
))
{
foreach
(
$observers
as
$observer
)
{
$t_observer
.=(
$observer
.
'<br>'
);
}
$t_file
=
str_replace
(
"##OBSERVER#"
,
$t_observer
,
$t_file
);
}
else
$t_file
=
str_replace
(
"##OBSERVER#"
,
'keine'
,
$t_file
);
}
if
(
$row
[
'gametype'
]==
'Ladder'
)
$t_spieltyp
=
'<IMG SRC="'
.
$reps_folder
.
'images/icons/ladder.gif" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Ladder Game"> Ladder-Game'
;
else
$t_spieltyp
=
'<IMG SRC="'
.
$reps_folder
.
'images/icons/custom.gif" WIDTH="16" HEIGHT="16" BORDER="0" ALT="Custom Game"> Custom-Game'
;
$t_file
=
str_replace
(
"##SPIELTYPICON#"
,
$t_spieltyp
,
$t_file
);
if
(
$row
[
'gametype'
]==
'Ladder'
)
$t_spieltyp
=
"Ladder"
;
else
$t_spieltyp
=
"Custom"
;
$t_file
=
str_replace
(
"##SPIELTYP#"
,
$t_spieltyp
,
$t_file
);
if
(
$row
[
'Verstecken'
] == 1)
$t_verstecken
=
'<IMG SRC="'
.
$reps_folder
.
'images/icons/spy.gif" WIDTH="17" HEIGHT="16" BORDER="0" ALT="Replay versteckt">'
;
else
$t_verstecken
=
""
;
$t_file
=
str_replace
(
"##VERSTECKSYMBOL#"
,
$t_verstecken
,
$t_file
);
if
(
date
(
'H'
,
mktime
(0, 0,
$row
[
'length'
]))!=
'00'
)
$length
=
date
(
'H:i:s'
,
mktime
(0, 0,
$row
[
'length'
])).
' h'
;
else
$length
=
date
(
'i:s'
,
mktime
(0, 0,
$row
[
'length'
])).
' min'
;
$t_file
=
str_replace
(
"##MAPNAME#"
,
$row
[
"MapName"
],
$t_file
);
$t_file
=
str_replace
(
"##MAPGRAFIK#"
,
$reps_folder
.
'images/maps/'
.
strtolower
(
substr
(
strstr
(
$row
[
"MapName"
],
')'
), 1,-4)).'.jpg"
alt=
"'.substr(strstr($row["
MapName"], '('),0,-4),
$t_file
);
$t_file
=
str_replace
(
"##VERSION#"
,
$row
[
"version"
],
$t_file
);
$t_file
=
str_replace
(
"##DAUER#"
,
$length
,
$t_file
);
$t_file
=
str_replace
(
"##BESCHREIBUNG#"
,
$row
[
'Beschreibung'
],
$t_file
);
$t_file
=
str_replace
(
"##DOWNLOADURL#"
,
$reps_folder
.
'download.php?id='
.
$row
[
'ID'
],
$t_file
);
$t_file
=
str_replace
(
"##REPLAYGROESSE#"
,
$row
[
"Filesize"
],
$t_file
);
$t_file
=
str_replace
(
"##ANZAHLDOWNLOADS#"
,
$row
[
'Downloads'
],
$t_file
);
$t_file
=
str_replace
(
"##KOMMENTARURL#"
,
$replaypath
.
'file=details_comments&id='
.
$row
[
'ID'
],
$t_file
);
$t_file
=
str_replace
(
"##ANZAHLKOMMENTARE#"
,
$row
[
'Kommentaranzahl'
],
$t_file
);
$t_file
=
str_replace
(
"##SHOW_DETAILS#"
,
$langu
[
'show_details'
],
$t_file
);
$t_file
=
str_replace
(
"##COMMENTS#"
,
$langu
[
'comments'
],
$t_file
);
$t_file
=
str_replace
(
"##STR_DAUER#"
,
$langu
[
'length'
],
$t_file
);
if
(
strpos
(
$t_file
,
"##CHATLOG#"
) != 0)
{
$chatlog
= unserialize(gzuncompress(
$row
[
'ChatLog'
]));
$t_chatlog
=
''
;
$colornr
= 0;
$t_chatlog
.=
'<div id="chatlog" class="additional">'
;
if
(isset(
$chatlog
))
{
foreach
(
$chatlog
as
$time
=>
$data
)
{
$prev_time
=
$time
;
$t_chatlog
.=
'<b>('
.convert_time(
$time
).
') '
;
for
(
$k
=0;
$k
<12;
$k
++)
{
if
(
strcmp
(
$row
[
'Slot'
.(
$k
+1).
'Name'
],
$data
[
'player_name'
]) == 0)
$colornr
=
$k
;
}
if
(
$data
[
'mode'
] !=
'Observers'
)
$t_chatlog
.=
'('
.
$data
[
'mode'
].
') <font color="'
.
$playerdetails
[
$colornr
][
'color_html'
].
'">'
.
$data
[
'player_name'
].
'</font></b>: '
.utf8_decode(
$data
[
'text'
]).
'<br>'
;
else
$t_chatlog
.=
'('
.
$data
[
'mode'
].
') <font color="#777777">'
.
$data
[
'player_name'
].
'</font></b>: '
.utf8_decode(
$data
[
'text'
]).
'<br>'
;
}
}
$t_chatlog
.=
'</div>'
;
$t_file
=
str_replace
(
"##CHATLOG#"
,
$t_chatlog
,
$t_file
);
}
if
(
is_file
(
$reps_folder
.
'files/'
.
$row
[
'ID'
].
'.png'
))
$t_file
=
str_replace
(
"##APMDIAGRAMM#"
,
'<img width="'
.
$CFG_APMDIAG_X
.
'" height="'
.
$CFG_APMDIAG_Y
.
'" src='
.
$reps_folder
.
'files/'
.
$row
[
'ID'
].
'.png><br>'
,
$t_file
);
else
$t_file
=
str_replace
(
"##APMDIAGRAMM#"
,
''
,
$t_file
);
$t_file
=
str_replace
(
"##STR_RATING#"
,
$langu
[
'rating'
],
$t_file
);
if
(
strpos
(
$t_file
,
"##RATING#"
) != 0){
if
(
$row
[
'votes'
]==0){
$t_rating
=
$langu
[
'no_votes_yet'
];
}
else
{
$rating
=
round
(
$row
[
'rating'
],1);
$hexred
=
str_pad
(
dechex
((10-
$row
[
'rating'
])/10*255), 2,
"0"
, STR_PAD_LEFT);
$hexgreen
=
str_pad
(
dechex
(
$row
[
'rating'
]/10*255), 2,
"0"
, STR_PAD_LEFT);
$ratingcolor
=
$hexred
.
$hexgreen
.
'00'
;
$ratingpercent
=
$row
[
'rating'
]*10;
$childid
=
'rankingChild'
;
if
(
$row
[
'rating'
]>7){
$childid
.=
'2'
;
}
$t_rating
= '
<table><tr>
<td width=
"70px"
>
<div id =
"rankingParent"
><div id =
"'.$childid.'"
>
'.$rating.'
</div></div>
<table cellpadding =
"0"
cellspacing =
"0"
border =
"0"
width =
"100%"
class
=
"expOutline"
>
<tr>
<td
class
=
"expOutline"
bgcolor =
"#'.$ratingcolor.'"
width =
"'.$ratingpercent.'%"
><img src=
"/images/pixel.gif"
width=
"1"
height=
"14"
></td>
<td width =
"100%"
></td>
</tr>
</table>
</td>
<td>(
'.$row['
votes
'].'
)</td>
</tr></table>';
}
$t_file
=
str_replace
(
"##RATING#"
,
$t_rating
,
$t_file
);
}
if
(
strpos
(
$t_file
,
"##RATE_REPLAY#"
) != 0){
if
(
$use_login
AND
$login_to_rate
AND !
$user_loggedin
){
$t_rate
=
'<center>'
.
$langu
[
'login_to_vote'
].
'</center>'
;
}
else
{
if
(
$user_vote
==
'voted'
){
$t_rate
=
$langu
[
'already_voted'
];
}
elseif
(
$user_vote
){
$t_rate
=
$langu
[
'your_vote_was'
].
$user_vote
;
}
else
{
$t_rate
=
'<form action="" method="post">'
;
$t_rate
.=
'<select class="iZi" style="width:150px" name="rating">'
;
$t_rate
.=
'<option value="0"> 0 Total Crap</option>'
;
$t_rate
.=
'<option value="1"> 1 Better dont watch</option>'
;
$t_rate
.=
'<option value="2"> 2 The Rep sucks</option>'
;
$t_rate
.=
'<option value="3"> 3 Not so good</option>'
;
$t_rate
.=
'<option value="4"> 4 I could do better</option>'
;
$t_rate
.=
'<option value="5" selected> 5 Absolutely Average</option>'
;
$t_rate
.=
'<option value="6"> 6 Good game</option>'
;
$t_rate
.=
'<option value="7"> 7 Really nice</option>'
;
$t_rate
.=
'<option value="8"> 8 Great game </option>'
;
$t_rate
.=
'<option value="9"> 9 Gosu!</option>'
;
$t_rate
.=
'<option value="10">10 Best Replay ever!</option></select> '
;
$t_rate
.=
'<input class="iZi" type="submit" name="rate_replay" value="Rate!">'
;
}
}
$t_file
=
str_replace
(
"##RATE_REPLAY#"
,
$t_rate
,
$t_file
);
}
if
(
$use_login
&&
$user_may_delete
)
$t_file
=
str_replace
(
"##SMARTDELETE#"
,
'<a href="'
.
$replaypath
.
'file=delete_replay&ReplayNr='
.
$row
["ID
"].'"
onclick=
"return confirmLink(this, \'Replay Nr. '.$row['ID'].' wirklich löschen?\')"
>
<IMG SRC=
"'.$reps_folder.'images/icons/delete.gif"
WIDTH=
"17"
HEIGHT=
"17"
BORDER=
"0"
ALT=
""
></a>',
$t_file
);
else
$t_file
=
str_replace
(
"##SMARTDELETE#"
,
''
,
$t_file
);
return
$t_file
;
}
?>