@ -41,7 +41,7 @@ if($clan_id == NULL){
}
if(isset($_GET['value1'])) {
if(isset($_GET['value1']) || isset($_GET['value2']) ) {
switch($what) {
case 'Banner':
case 'Homepage':
@ -373,6 +373,7 @@ function sendClanNewsletter($user, $text){
}
function setProfile($what, $value1, $value2, $clanid, $rootlvl){
echo 'setProfile< br > ';
if($rootlvl < 1 ) {
return 'Du hast keine Rechte um diese Aktion auszufü hren!';
}
@ -390,7 +391,11 @@ function setProfile($what, $value1, $value2, $clanid, $rootlvl){
mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid);
return NULL;
case 'Leadership':
if($value1 == 0){$value1 = 'null';}
echo 'setLeadership!< br > ';
$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
@ -398,14 +403,15 @@ 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) {
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&o ouml;glich den co_leader zu feu ern, da der clan die maximale Anzahl Member besitzt!';
return 'Es ist nicht m&o uml;glich den Co-Leader zu ä nd ern, 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.'< br > ';
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;
@ -454,7 +460,7 @@ function displayEdit($what, $clanid, $rootlvl){
}
}
if($root){
if($rootlvl == 2 ){
$content = '< tr > < td > Leader:< / td > < td > < select class = "input" name = "value1" / > '.join('',$member).'< / select > < / td > < / tr > ';
}
$content .= '< tr > < td > Co-Leader:< / td > < td > < select class = "input" name = "value2" / > '.join('',$member2).'< / select > < / td > < / tr > ';
@ -526,25 +532,32 @@ function deleteClan($user){
if($action !== NULL) { // this is done to not require to reprogramm the whole stuff!
$rootlvl = 0;
$clan = getClan($user_ida['clan']);
if($row['leader'] == $user_ida['id'] || ($row['leader'] === null & & ($row['co_leader'] === null || $row['co_leader'] = $user_ida['id']))) {
if($clan['leader'] == $user_ida['id'] || ($clan['leader'] === null & & ($clan['co_leader'] === null || $clan['co_leader'] = $user_ida['id']))) {
$rootlvl = 2; // leader or putsch!!
} else if($row ['co_leader'] = $user_ida['id']) {
} else if($clan ['co_leader'] = $user_ida['id']) {
$rootlvl = 1; // co_leader
}
echo 'Rootlvl = ' . $rootlvl . '< br > ';;
switch ($action) {
case 'edit':
$errorMsg = NULL;
$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 if(isset($value1) || isset($value2) ){
$errorMsg = setProfile($what, $value1, $value2, $user_ida['clan'], $rootlvl);
} else{
displayEdit($what, $user_ida['clan'], $rootlvl);
$errorMsg = displayEdit($what, $user_ida['clan'], $rootlvl);
$displayMore = false;
}
if($errorMsg !== NULL) {
echo displayErrorMessage(NULL, $errorMsg, displayHistoryBackLink());
$displayMore = false;
}
break;
case 'fire':
fireMember($user_ida, $member);