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
Level:
Homepage: Keine
Info:
 
Nachricht an alle Clanmember schicken
 
 
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
Level:
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, $root){ switch($what){ case 'Homepage': mysql_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid); return; case 'Clanzeichen': mysql_query('UPDATE clan SET clanz_pre = \''.$value1.'\', clanz_suff = \''.$value2.'\' where id = '.$clanid); return; case 'Banner': mysql_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid); return; case 'Info': mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid); return; case 'Leadership': if($value1 == 0){$value1 = 'null';} if($value2 == 0){$value2 = 'null';} if(!$root){ $sql = 'UPDATE clan SET co_leader = '.$value2.' where id = '.$clanid; mysql_query($sql); } else{ $sql = 'UPDATE clan SET leader = '.$value1.', co_leader = '.$value2.' where id = '.$clanid; // echo $sql.'
'; mysql_query($sql); } return; default: echo 'Error!'; return; } } function displayEdit($what, $clanid, $root){ $clan_qry = mysql_query('Select * from clan where id = '.$clanid); $clan = mysql_fetch_assoc($clan_qry); $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 'Clan Passwort': $content = ''; 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($edit == 1){ // $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'], $row['leader'] == $user_ida['id'] || $row['leader'] === null); // } else{ // displayEdit($what, $user_ida['clan'],$row['leader'] == $user_ida['id'] || $row['leader'] === null); // $displayMore = false; // } //} else if($putsch == 1){ // setMeAsLeader($user_ida); //} else if($fire == 1){ // fireMember($user_ida, $member); //} else if($kill == 1){ // deleteClan($user_ida); //} else if($reject == 1) { // $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; // } //} if($action !== NULL) { // this is done to not require to reprogramm the whole stuff! 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'], $row['leader'] == $user_ida['id'] || $row['leader'] === null); } else{ displayEdit($what, $user_ida['clan'],$row['leader'] == $user_ida['id'] || $row['leader'] === null); $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); } ?>