Wenn man aus dem Clan austritt und man ist der letzte User, dann wird der Clan geloescht. Ansonsten 2 dateien von dos2unix linebreaks umgewandelt. Noch weitere kleinere Bugfixes.

main
hecht 13 years ago
parent 60c43a6d29
commit 241298a40d

@ -10,6 +10,9 @@ include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/clan.inc.php');
// GET-Section
// Kritisch (SQL-Injections)
$item_id = validateUnsignedInteger($_GET['item_id'], null);
@ -19,14 +22,20 @@ $charm = $_GET['charm'];
if($charm == 3)
{
$item_info = mysql_fetch_array(mysql_query("SELECT id, preis, name, anzahl FROM clan_item WHERE id='$item_id' LIMIT 1"));
$user = mysql_Fetch_array(mysql_query("SELECT leader, co_leader, geld, id FROM clan WHERE id='$user_ida[clan]'"));
$item_info = mysql_fetch_assoc(mysql_query("SELECT * FROM clan_item WHERE id='$item_id' LIMIT 1"));
$user = getClan($user_ida['clan']); // mysql_Fetch_array(mysql_query("SELECT leader, co_leader, geld, id FROM clan WHERE id='$user_ida[clan]'"));
if($user['leader'] != $user_ida['id'] AND $user['co_leader'] != $user_ida['id']) {
displayErrorMessage(NULL,'Nur der Leader und der Co-Leader kann Clanitems kaufen!', displayHistoryBackLink());
exit;
}
if($user['level'] >= $item_info['req_level']) {
$fehler_m = 'Euer Clan hat nicht das nötige Level';
displayErrorMessage(NULL,$fehler_m, displayHistoryBackLink());
exit;
}
if($user['geld'] < $item_info['preis'])
{
@ -34,6 +43,7 @@ if($charm == 3)
displayErrorMessage(NULL,$fehler_m, displayHistoryBackLink());
exit;
}
$new_geld = $user[geld] - $item_info[preis];
mysql_query("UPDATE clan_item SET anzahl=anzahl-1 WHERE id=".$item_info[id]." LIMIT 1");
@ -94,6 +104,8 @@ if(!$charm)
$c_item[$row['item_id']] = 1;
}
$clan = getClan($user_ida['clan']);
while($row = mysql_fetch_array($item_name))
{
$info = '';
@ -111,8 +123,10 @@ if(!$charm)
<td align="center"><?php echo displayCount($row['tp']); ?></td>
<td align="center"><?php echo $info; ?></td>
<?php
if($c_item[$row['id']] === 1){
if($c_item[$row['id']] >= 1){
echo '<td align="center"><a href="javascript:if(confirm(\''.$row['name'].' Wirklich abreissen?\')==true) window.location.href=\'index.php?as=clan/c_markt&charm=5&item_id='.$row['id'].'\'"><img border=0 src="design/bilder/buttons/abreissen.gif" width="42" height="19"></a></td>';
} else if($clan['level'] < $row['req_level']){
echo '<td align="center"><img border=0 src="design/bilder/buttons/lvlup.png" width="42" height="19"></td>';
} else {
echo '<td align="center"><a href="javascript:if(confirm(\''.$row['name'].' Wirklich kaufen?\')==true) window.location.href=\'index.php?as=clan/c_markt&charm=3&item_id='.$row['id'].'\'"><img border=0 src="design/bilder/buttons/kaufen.gif" width="42" height="19"></a></td>';
}

@ -152,7 +152,11 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
</tr>
<tr>
<th align="Left" height="25">Erfahrung: </th>
<td><?php echo $clan['min_exp'].' / '.getRequiredClanExp($clan['level']); ?></td>
<td><?php echo $clan['exp'].' / '.getRequiredClanExp($clan['level']); ?></td>
</tr>
<tr>
<th align="Left" height="25">ELO-Wertung: </th>
<td><?php echo $clan['elo']; ?></td>
</tr>
<tr>
<th width="96" height="25" align="Left">Homepage:</th>
@ -285,7 +289,11 @@ function displayClanProfileEditable($clan, $userid){
</tr>
<tr>
<th align="Left" height="25">Erfahrung: </th>
<td><?php echo $clan['min_exp'].' / '.getRequiredClanExp($clan['level']); ?></td>
<td><?php echo $clan['exp'].' / '.getRequiredClanExp($clan['level']); ?></td>
</tr>
<tr>
<th align="Left" height="25">ELO-Wertung: </th>
<td><?php echo $clan['elo']; ?></td>
</tr>
<tr>
<th align="Left" height="25">Homepage:<a
@ -401,7 +409,7 @@ function setProfile($what, $value1, $value2, $clanid, $rootlvl){
$members = getClanMembersCount($clanid);
$members_max = getMaximumMembers($clan['id']);
if($members_max == $members && $clan['leader'] != $clan['co_leader'] && $value1 == $value2 || $value2 == 'null') {
if($members_max == $members && $clan['leader'] != $clan['co_leader'] && ($value1 == $value2 || $value2 == 'null')) {
// Okay, actually there are the max amount of users in the clan
// it is now not possible to change to a leader only clan!!
return 'Es ist nicht m&ouml;glich den Co-Leader zu &auml;ndern, da der clan die maximale Anzahl Member besitzt!';
@ -504,6 +512,8 @@ function fireMember($user, $member){
mysql_query($sql);
if($user['id'] != $member) {
sendMessage($user['nickname'], $member, 'Clan rauswurf!', 'Du wurdest von '.$user['nickname'].' aus deinem Clan geworfen. Du wirst dir wohl einen neuen suchen m&uuml;ssen!');
} else if(getClanMembersCount($user['clan']) == 0) {
mysql_query('DELETE FROM clan WHERE id =' .$user['clan']);
}
}
} else{

@ -160,33 +160,149 @@ function inviteUser(array $user, $userid, array $clan = NULL){
}
}
define("DAVY_BACK_FIGHT", 1);
define("SURVIVAL", 2);
function challengeClan(array $user, array $charids, $clanid, $validTime = 24) {
if($clan === NULL) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
/**
*
* Challenge an other clan (Davy Back Fight)
* @param array $user the user array
* @param int $clanid the id of the clan to challenge
* @param int $validTime the amount of hours that the challenge is valid
*/
function challengeClan(array $user, $clanid, $type = DAVY_BACK_FIGHT, $anzahl, $validTime = 24) {
$qry = mysql_query('SELECT * FROM clan WHERE id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
$oclan = mysql_fetch_assoc(mysql_query('SELECT * FROM clan WHERE id = ' . $clanid));
if(!$clan || !$oclan) {
return 'Entweder bist du nicht in einem Clan oder der andere Clan existiert nicht mehr!!';
}
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
return 'Nur der Leader, bzw. der Co-Leader kann andere Clans herausfordern!!';
}
// TODO: Further implementation
// Fordere heraus!
mysql_query('INSERT INTO clan_challenge(clan_requester, clan_challenged, type, anzahl, valid, accepted) VALUES('.$user['clan'].', '.$clanid.','.$type.' , TIMESTAMPADD(HOUR, CURRENT_TIMESTAMP, 4), '.$anzahl.', false)');
if(mysql_affected_rows() > 0) {
if(is_numeric($oclan['leader'])) {
sendMessage($user['nickname'], $oclan['leader'], 'Davy Back Fight Herausforderung', 'Der Clan '.$oclan['clanname'].' hat euch zu einem Davy Back Fight herausgefordert! Über "Mein Clan" könnt ihr die Herausforderung annehmen!');
}
if(is_numeric($oclan['co_leader']) && $oclan['leader'] != $oclan['co_leader']) {
sendMessage($user['nickname'], $oclan['co_leader'], 'Davy Back Fight Herausforderung', 'Der Clan '.$oclan['clanname'].' hat euch zu einem Davy Back Fight herausgefordert! Über "Mein Clan" könnt ihr die Herausforderung annehmen!');
}
} else {
return 'Konnte den anderen Clan nicht herausfordern!!';
}
return NULL;
}
function acceptChallenge(array $user, array $charids) {
if($clan === NULL) {
function acceptChallenge($challengeid, array $user) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
if(!$clan) {
return 'Du bist in keinem Clan!!';
}
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
return 'Nur der Leader, bzw. der Co-Leader kann herausforderungen anderer Clans annehmen!!';
}
// TODO: Further implementation
$clan_challenge = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_challenge WHERE clan_challenge_id = ' .$challengeid));
if($user['clan'] != $clan_challenge['clan_challenged']) {
return 'Du kannst die Herausforderung nicht annehmen, da du nicht im herausgeforderten Clan bist!';
}
// The user must be in the challanged clan
$oclan = mysql_fetch_assoc('SELECT * FROM clan WHERE id = '.$clan_challenge['clan_requester']);
mysql_query('UPDATE clan_challenge SET accepted = TRUE WHERE clan_challenge_id = ' .$challengeid);
if(mysql_affected_rows() > 0) {
if(is_numeric($oclan['leader'])) {
sendMessage($user['nickname'], $oclan['leader'], 'Davy Back Fight', 'Der Clan '.$oclan['clanname'].' hat eure Herausforderungen zu einem Davy Back Fight angenommen! Über "Mein Clan" könnt ihr nun Chars anmelden!');
}
if(is_numeric($oclan['co_leader']) && $oclan['leader'] != $oclan['co_leader']) {
sendMessage($user['nickname'], $oclan['co_leader'], 'Davy Back Fight', 'Der Clan '.$oclan['clanname'].' hat eure Herausforderungen zu einem Davy Back Fight angenommen! Über "Mein Clan" könnt ihr nun Chars anmelden!');
}
} else {
return 'Du kannst die Herausforderungen nicht annehmen. Wurde die Herausforderung schon angenommen?';
}
return NULL;
}
function getOpenChallengesByUser(array $user) {
$qry = mysql_query('SELECT * FROM clan_challenge WHERE accepted = FALSE AND clan_requester = '.$user['clan'].' OR clan_challenged = '.$user['clan']);
$array = array();
while($row = mysql_fetch_assoc($qry)) {
$array[] = $row;
}
return $array;
}
function getOpenChallengesByClanId($clanid) {
$qry = mysql_query('SELECT * FROM clan_challenge WHERE accepted = FALSE AND clan_requester = '.$clanid.' OR clan_challenged = '.$clanid);
$array = array();
while($row = mysql_fetch_assoc($qry)) {
$array[] = $row;
}
return $array;
}
/**
* This function lets a user take part in the clan fight! The clan fight will be calculated if all chars have been registered.
* A challenge can only be joined if there is no other char of the same user joined. If the given slot is free and the challangeid is valid.
* @param int $challengeid the id of the challenge
* @param array $user the user array
* @param int $charid the id of the char that should join
*/
function joinChallenge($challengeid, array $user, $charid, $slot ) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry);
if(!$clan) {
return 'Du bist in keinem Clan!!';
}
$clan_challenge = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_challenge WHERE clan_challenge_id = ' .$challengeid));
if($user['clan'] != $clan_challenge['clan_challenged'] && $user['clan'] != $clan_challenge['clan_requester'] ) {
return 'Du kannst an der Herausforderung nicht teilnehmen, da du nicht in einem teilnehmenden Clan bist!';
}
$char = getChar($charid);
if($user['id'] != $char['besitzer']) {
return 'Du kannst den Char nicht an der Herausforderung teilnehmen lassen, da er dir nicht gehört!';
}
// query all clan_challange_participants to see if the user already has a char in competition!
}
/**
* This function does the calculation of the clan fight.
* @param int $challengeid the id of the challenge
*/
function calculateChallenge($challengeid) {
}
?>

Loading…
Cancel
Save