Tippfehler im Profil beseitigt. Die Memberberechnung stimmt nun, der co_leader kann nicht gefeuert werden wenn die maximale anzahl der member drinne ist

main
hecht 13 years ago
parent 344645c29f
commit 9f4ae9708e

@ -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&uuml;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&oouml;glich den co_leader zu feuern, da der clan die maximale Anzahl Member besitzt!';
return 'Es ist nicht m&ouml;glich den Co-Leader zu &auml;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.'<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);

@ -43,29 +43,27 @@ function getClanMemberBonusByLevel($level) {
return 0;
case 4:
case 5:
return 1;
case 6:
return 1;
case 7:
return 2;
case 8:
return 2;
case 9:
return 3;
case 10:
return 3;
case 11:
return 4;
case 12:
return 4;
case 13:
return 5;
case 14:
return 6;
return 5;
case 15:
return 7;
case 16:
return 8;
return 6;
case 17:
return 9;
return 7;
default:
return 10;
return 8;
}
}
@ -76,7 +74,7 @@ function getMaximumMembers($clanid) {
$clan = getClan($clanid);
if($clan === NULL){ return 0; }
$base = 10;
$base = 12;
$members_by_level = getClanMemberBonusByLevel($clan['level']);
$malus = 0;
if($clan['co_leader'] == NULL || $clan['co_leader'] == $clan['leader']) {

@ -183,7 +183,7 @@ function display($user, $usergroups){
<tr>
<th align="center">Werbegrad:</th>
<td><?php
if(!isUserInGroup($usergroups, Werbung_an)) {
if(!isUserInGroup($usergroups, WERBUNG_AN)) {
$che1 = 'checked="checked"';
$che2 = '';
} else{

Loading…
Cancel
Save