';
$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':
$clan = getClan($clanid);
if($value1 == 0 && $rootlvl == 2){$value1 = 'null';}
else if($rootlvl == 1) { $value1 = $clan['leader']; }
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 || $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öglich den Co-Leader zu ändern, 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;
//echo $sql.' ';
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 = '