verlassen)'; } else{ $member[] = $tmp; } if($row['id'] == $clan['leader']){ $leader = $tmp; } if($row['id'] == $clan['co_leader']){ $coleader = $tmp; } } $inv_qry = mysql_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()'); $invited = array(); while($row = mysql_fetch_assoc($inv_qry)) { $invited[] = displayUserLinkByID($row['userid']) . ' (noch ' . $row['till'] . 'h gültig)'; } ?>
Macht übernehmen'; } else { echo ''; } } else{ echo ''; } ?> '.$coleader.''; } ?> '.$clan['homepage'].''; } else{ echo ''; } ?>
Info
Leader: Keine Leader'.$leader.'
Co-Leader:
Clanzeichen:
Member (): ',$member); ?>
Eingeladen ', $invited); ?>
Level:
Erfahrung:
Homepage: Keine
Info:
 
Nachricht an alle Clanmember schicken
 
 
Debug Daten (Kein Bug, dass die naechste Zeile etwas komisch aussieht)
verlassen)'; } else if($kickable){ $member[] = $tmp.' (kicken)'; } else{ $member[] = $tmp; } } $inv_qry = mysql_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()'); $invited = array(); while($row = mysql_fetch_assoc($inv_qry)) { $invited[] = displayUserLinkByID($row['userid']) . ' (noch ' . $row['till'] . 'h gültig, zurückziehen)'; } ?> '.$clan['homepage'].''; } else{ echo ''; } ?>
Info

(edit)
Leader:(edit)
Co-Leader:(edit)
Clanzeichen:(edit)
Member (): ',$member); ?>
Eingeladen ', $invited); ?>
Level:
Erfahrung:
Homepage:(edit) Keine
Info:(edit)
Clan auflösen Clan löschen
 
Nachricht an alle Clanmember schicken
 
 
'; $clan = mysql_fetch_assoc(mysql_query($sql)); $editable = $clan['leader'] == $user['id'] || $clan['co_leader'] == $user['id']; if(!$editable){ displayClanProfileReadOnly($clan, $user['clan'] == $clan['id'], $user['id']); } else{ displayClanProfileEditable($clan, $user['id']); } } function setMeAsLeader($user){ mysql_query('UPDATE clan set leader = '.$user['id'].' WHERE id = '.$user['clan'].' and leader is null and co_leader is null'); } function sendClanNewsletter($user, $text){ $qry = mysql_query('SELECT * FROM clan WHERE id = ' . $user['clan']); $clan = mysql_fetch_assoc($qry); $errors = FALSE; $sql = 'SELECT id FROM user WHERE clan='.$user['clan']; $clans = mysql_query($sql); while($row = mysql_fetch_assoc($clans)) { $errors |= !sendMessage($user['nickname'], $row['id'], $clan['clanname'].' Nachricht', $text); } if($errors) { displayErrorMessage(NULL,'Beim Versenden sind Fehler aufgetreten', 'weiter...'); } else { displayErrorMessage(NULL,'Nachricht erfolgreich verschickt', 'weiter...'); } } function setProfile($what, $value1, $value2, $clanid, $rootlvl){ if($rootlvl < 1) { return 'Du hast keine Rechte um diese Aktion auszuführen!'; } switch($what){ case 'Homepage': mysql_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid); return NULL; case 'Clanzeichen': mysql_query('UPDATE clan SET clanz_pre = \''.$value1.'\', clanz_suff = \''.$value2.'\' where id = '.$clanid); return NULL; case 'Banner': mysql_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid); return NULL; case 'Info': mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid); return NULL; case 'Leadership': if($value1 == 0){$value1 = 'null';} if($value2 == 0){$value2 = 'null';} // okay, are we allowed to change?? If we have max members, it is not allowed to remove the co_leader $clan = getClan($clanid); $members = getClanMembersCount($clanid); $members_max = getMaximumMembers($clan['id']); if($members_max == $members && $clan['leader'] != $clan['co_leader'] && $value1 == $value2) { // 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&oouml;glich den co_leader zu feuern, da der clan die maximale Anzahl Member besitzt!'; } if($rootlvl == 1){ // the co leader may only set the co leader XD $sql = 'UPDATE clan SET co_leader = '.$value2.' where id = '.$clanid; mysql_query($sql); } else if($rootlvl == 2) { // the leader may set the leader and the co leader $sql = 'UPDATE clan SET leader = '.$value1.', co_leader = '.$value2.' where id = '.$clanid; // echo $sql.'
'; mysql_query($sql); } return NULL; default: return 'Error!'; } } function displayEdit($what, $clanid, $rootlvl){ if($rootlvl < 1) { $content = 'Du hast keine Rechte um diese Aktion auszuführen!'; $what = 'ERROR'; } $clan = getCLan($clanid); $content = ''; switch($what){ case 'Homepage': $content = ''; break; case 'Clanzeichen': $content = 'Prefix: Suffix: '; break; case 'Banner': $content = ''; break; case 'Leadership': $member_qry = mysql_query('Select id, nickname from user where clan = '.$clanid); $member[] = ''; $member2[] = ''; while($row = mysql_fetch_assoc($member_qry)){ if($row['id'] == $clan['leader']) { $member[] = ''; } else { $member[] = ''; } if($row['id'] == $clan['co_leader']) { $member2[] = ''; } else { $member2[] = ''; } } if($root){ $content = 'Leader:'; } $content .= 'Co-Leader:'; break; case 'Info': $content = ''; break; case 'ERROR': break; default: $content = 'Error '.$what.' unknown!'; break; } ?>
Ändern
'; mysql_query($sql); if(mysql_affected_rows() > 0){ // Soll nur ausgeführt werden, wenn member wirklich gekickt wurde!! $sql = 'Update chars set clan_train = NULL where besitzer = '.$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üssen!'); } } } else{ echo displayErrorMessage(NULL, 'Du kannst den Member nicht feuern!', displayHistoryBackLink()); } } function deleteClan($user){ $row = mysql_fetch_assoc(mysql_query('SELECT leader, co_leader from clan where id = '.$user['clan'])); if($user['id'] == $row['leader']){ $qry = mysql_query('SELECT id FROM user WHERE clan = '.$user['clan']); while($member = mysql_fetch_assoc($qry)) { sendMessage($user['nickname'], $member['id'], 'Clan wurde gelöscht!', 'Dein Clan wurde von '.$user['nickname'].' gelöscht. Du wirst dir wohl einen neuen suchen müssen!'); } mysql_query('DELETE FROM clan where id = '.$user['clan']); } else{ echo displayErrorMessage(NULL, 'Du kannst den Clan nicht auflösen!', displayHistoryBackLink()); } } if($action !== NULL) { // this is done to not require to reprogramm the whole stuff! $rootlvl = 0; if($row['leader'] == $user_ida['id'] || ($row['leader'] === null && ($row['co_leader'] === null || $row['co_leader'] = $user_ida['id']))) { $rootlvl = 2; // leader or putsch!! } else if($row['co_leader'] = $user_ida['id']) { $rootlvl = 1; // co_leader } switch ($action) { case 'edit': $row = mysql_fetch_assoc(mysql_query('SELECT leader, co_leader from clan where id = '.$user_ida['clan'])); if($row['leader'] != $user_ida['id'] && $row['co_leader'] != $user_ida['id']){ displayErrorMessage(NULL, 'Du bist weder Leader noch Co-Leader des Clans!', displayHistoryBackLink()); } else if(isset($value1)){ setProfile($what, $value1, $value2, $user_ida['clan'], $rootlvl); } else{ displayEdit($what, $user_ida['clan'], $rootlvl); $displayMore = false; } break; case 'fire': fireMember($user_ida, $member); if($user_ida['id'] == $member) { $displayMore = false; } break; case 'putsch': setMeAsLeader($user_ida); break; case 'kill': deleteClan($user_ida); $displayMore = false; break; case 'reject': $errorMsg = revokeInvitation($user_ida, $member); if($errorMsg !== NULL) { echo displayErrorMessage(NULL, $errorMsg, displayHistoryBackLink()); $displayMore = false; } else { displayErrorMessage('','Du hast die Einladung erfolgreich zurückgezogen!', 'weiter'); $displayMore = false; } break; case 'newsletter': sendClanNewsletter($user_ida, $text); $displayMore = false; break; default: break; } } if($displayMore){ displayClanProfile($clan_id, $user_ida); } ?>