#80 gefixt, alle exits zu returns gemacht

#81 gefixt
main
radiskull 13 years ago
parent 0a5750dc0f
commit 99064fe13d

@ -81,6 +81,7 @@ function displayHeader($top, $bottom, $challenge, $clans) {
$challenge_id = $challenge['clan_challenge_id'];
$event_id = $challenge['event_id'];
$chars = getEventChars($challenge_id, $event_id);
$number_chars = count($chars);
$left = $clans[0]['id'];
$right = $clans[1]['id'];
@ -102,7 +103,7 @@ function displayHeader($top, $bottom, $challenge, $clans) {
echo '<td><table width="100%" height="100%" cellpadding="0" cellspacing="0" border="'.$border.'"><tr>';
$width = 100 / $top;
$max = 0;
for ($i = 0; $max != $top; $i++) {
for ($i = 0; $max != $top && $i <= $number_chars; $i++) {
if($chars[$i]['clan_id'] == $left) {
echo '<td width="'.$width.'%" valign="middle" align="center">';
displayChar($chars[$i]);
@ -115,7 +116,7 @@ function displayHeader($top, $bottom, $challenge, $clans) {
echo '<td><table width="100%" height="100%" cellpadding="0" cellspacing="0" border="'.$border.'"><tr>';
$max = 0;
$i = 0;
for ($i = 0; $max != $top; $i++) {
for ($i = 0; $max != $top && $i <= $number_chars; $i++) {
if($chars[$i]['clan_id'] == $right) {
echo '<td width="'.$width.'%" valign="middle" align="center">';
displayChar($chars[$i]);
@ -134,7 +135,7 @@ function displayHeader($top, $bottom, $challenge, $clans) {
$max = 0;
$i = 0;
$width = 100 / $bottom;
for ($i = 0; $max != ($bottom+$showed); $i++) {
for ($i = 0; $max != ($bottom+$showed) && $i <= $number_chars; $i++) {
if($chars[$i]['clan_id'] == $left) {
if($max >= $showed) {
echo '<td width="'.$width.'%" valign="middle" align="center">';
@ -149,7 +150,7 @@ function displayHeader($top, $bottom, $challenge, $clans) {
echo '<td><table width="100%" height="100%" cellpadding="0" cellspacing="0" border="'.$border.'"><tr>';
$max = 0;
$i = 0;
for ($i = 0; $max != ($bottom+$showed); $i++) {
for ($i = 0; $max != ($bottom+$showed) && $i <= $number_chars; $i++) {
if($chars[$i]['clan_id'] == $right) {
if($max >= $showed) {
echo '<td width="'.$width.'%" valign="middle" align="center">';

@ -43,18 +43,18 @@ if($clan_challange_id == null) {
function displayChallengeClan($user, $clan_id) {
if($clan_id == -1 || $clan_id == NULL) {
displayErrorMessage(NULL,'Es wurde kein Clan ausgewählt!', displayHistoryBackLink());
exit;
return;
}
if($user['clan'] == $clan_id) {
displayErrorMessage(NULL,'Man kann sich nicht selbst herausfordern!', displayHistoryBackLink());
exit;
return;
}
//TODO: es sollte hier unbedingt ne Auswahl geben wieviel Leute nun kämpfen dürfen :)
$result = challengeClan($user, $clan_id, 5);
if ($result != NULL) {
displayErrorMessage(NULL, $result, displayHistoryBackLink());
exit;
return;
} else {
echo 'Clan wurde erfolgreich herausgefordert.<br><br>';
echo '<a href="index.php?as=clan/kampf_info">weiter</a>';
@ -64,7 +64,7 @@ function displayChallengeClan($user, $clan_id) {
function displayChallengeAccepted($user, $clan_id) {
if(!is_numeric($clan_id)) {
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
exit;
return;
}
acceptChallengeRequest($clan_id, $user);
echo 'Herausforderung wurde angenommen!<br><br>';
@ -106,7 +106,7 @@ function denyChallenge($type, $clan_id, $user) {
displayClanFightMenu($user_ida);
} else {
displayErrorMessage(NULL, $success, displayHistoryBackLink());
exit;
return;
}
}
@ -116,6 +116,7 @@ function displayShowChallenge($clan_challenge_id, $user) {
if(!in_array($clan_challenge_id, $open_challenge_ids)) {
displayClanFightMenu($user);
return;
}
//initialisieren von wichtigen variablen
@ -221,7 +222,7 @@ function displayJoinChallenge($user, $clan_challenge_id, $char_id, $slot) {
$success = joinChallenge($clan_challenge_id, $user, $char_id, $slot);
if($success != null) {
displayErrorMessage(NULL, $success, displayHistoryBackLink());
exit;
return;
} else {
echo 'Der Charakter wurde erfoglreich angemeldet.<br><br>';
echo '<a href="index.php?as=clan/kampf_info&action=showchallenge&challenge='.$clan_challenge_id.'">weiter</a>';
@ -234,13 +235,13 @@ function displayLeaveChallenge($user, $clan_challenge_id, $char_id) {
if(!in_array($clan_challenge_id, $open_challenge_ids)) {
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
exit;
return;
}
$success = leaveChallenge($clan_challenge_id, $user, $char_id);
if($success != null) {
displayErrorMessage(NULL, $success, displayHistoryBackLink());
exit;
return;
} else {
echo 'Der Charakter wurde erfoglreich abgemeldet.<br><br>';
echo '<a href="index.php?as=clan/kampf_info&action=showchallenge&challenge='.$clan_challenge_id.'">weiter</a>';
@ -277,7 +278,7 @@ function cancelThisChallenge($user, $clan_challange_id) {
$success = cancelChallenge($clan_challange_id, $user);
if($success != null) {
displayErrorMessage(NULL, $success, displayHistoryBackLink());
exit;
return;
} else {
displayClanFightMenu($user);
}

Loading…
Cancel
Save