@ -41,7 +41,7 @@ if($clan_id == NULL){
}
}
if(isset($_GET['value1'])) {
if(isset($_GET['value1']) || isset($_GET['value2']) ) {
switch($what) {
switch($what) {
case 'Banner':
case 'Banner':
case 'Homepage':
case 'Homepage':
@ -373,6 +373,7 @@ function sendClanNewsletter($user, $text){
}
}
function setProfile($what, $value1, $value2, $clanid, $rootlvl){
function setProfile($what, $value1, $value2, $clanid, $rootlvl){
echo 'setProfile< br > ';
if($rootlvl < 1 ) {
if($rootlvl < 1 ) {
return 'Du hast keine Rechte um diese Aktion auszufü hren!';
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);
mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid);
return NULL;
return NULL;
case 'Leadership':
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';}
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
// 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 = getClanMembersCount($clanid);
$members_max = getMaximumMembers($clan['id']);
$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
// Okay, actually there are the max amount of users in the clan
// it is now not possible to change to a leader only 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
if($rootlvl == 1){ // the co leader may only set the co leader XD
$sql = 'UPDATE clan SET co_leader = '.$value2.' where id = '.$clanid;
$sql = 'UPDATE clan SET co_leader = '.$value2.' where id = '.$clanid;
echo $sql.'< br > ';
mysql_query($sql);
mysql_query($sql);
} else if($rootlvl == 2) { // the leader may set the leader and the co leader
} 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;
$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 > 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 > ';
$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!
if($action !== NULL) { // this is done to not require to reprogramm the whole stuff!
$rootlvl = 0;
$rootlvl = 0;
$clan = getClan($user_ida['clan']);
if($clan['leader'] == $user_ida['id'] || ($clan['leader'] === null & & ($clan['co_leader'] === null || $clan['co_leader'] = $user_ida['id']))) {
if($row['leader'] == $user_ida['id'] || ($row['leader'] === null & & ($row['co_leader'] === null || $row['co_leader'] = $user_ida['id']))) {
$rootlvl = 2; // leader or putsch!!
$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
$rootlvl = 1; // co_leader
}
}
echo 'Rootlvl = ' . $rootlvl . '< br > ';;
switch ($action) {
switch ($action) {
case 'edit':
case 'edit':
$errorMsg = NULL;
$row = mysql_fetch_assoc(mysql_query('SELECT leader, co_leader from clan where id = '.$user_ida['clan']));
$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']){
if($row['leader'] != $user_ida['id'] & & $row['co_leader'] != $user_ida['id']){
displayErrorMessage(NULL, 'Du bist weder Leader noch Co-Leader des Clans!', displayHistoryBackLink());
displayErrorMessage(NULL, 'Du bist weder Leader noch Co-Leader des Clans!', displayHistoryBackLink());
} else if(isset($value1)){
} else if(isset($value1) || isset($value2) ){
setProfile($what, $value1, $value2, $user_ida['clan'], $rootlvl);
$errorMsg = setProfile($what, $value1, $value2, $user_ida['clan'], $rootlvl);
} else{
} 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;
$displayMore = false;
}
}
break;
break;
case 'fire':
case 'fire':
fireMember($user_ida, $member);
fireMember($user_ida, $member);