@ -40,17 +40,24 @@ if($clan_id == NULL){
}
}
}
}
if(isset($_GET['value1'])) {
if(isset($_GET['value1'])) {
if($what == 'Banner'){
switch($what) {
$value1 = validateURL($_GET['value1']);
case 'Banner':
} else if($what == 'Homepage' || $what == 'Info' || $what == 'Clan Passwort'){
case 'Homepage':
$value1 = validateString($_GET['value1']);
$value1 = validateURL($_GET['value1']);
} else if($what == 'Clanzeichen'){
break;
$value1 = validateString($_GET['value1']);
case 'Info':
$value2 = validateString($_GET['value2']);
$value1 = encodeNoHTMLWithBB($_GET['value1']);
} else if($what == 'Leadership') {
break;
$value1 = validateUnsignedInteger($_GET['value1'], NULL);
case 'Clanzeichen':
$value2 = validateUnsignedInteger($_GET['value2'], NULL);
$value1 = validateString($_GET['value1']);
$value2 = validateString($_GET['value2']);
break;
case 'Leadership':
$value1 = validateUnsignedInteger($_GET['value1'], NULL);
$value2 = validateUnsignedInteger($_GET['value2'], NULL);
break;
}
}
}
}
@ -100,7 +107,7 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
}
}
?>
?>
< tr >
< tr >
< th width = "20%" align = "Left" > Leader:< / th >
< th width = "20%" align = "Left" height = "25" > Leader:< / th >
<?php
<?php
if($leader == null & & $coleader == null){
if($leader == null & & $coleader == null){
if($ownclan) {
if($ownclan) {
@ -114,7 +121,7 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
?>
?>
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Co-Leader:< / th >
< th align = "Left" height = "25" > Co-Leader:< / th >
<?php
<?php
if($leader != null & & $coleader != null){
if($leader != null & & $coleader != null){
echo '< td > '.$coleader.'< / td > ';
echo '< td > '.$coleader.'< / td > ';
@ -122,11 +129,11 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
?>
?>
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Clanzeichen:< / th >
< th align = "Left" height = "25" > Clanzeichen:< / th >
< td > <?php echo $clan [ 'clanz_pre' ] . ' ' . $clan [ 'clanz_suff' ]; ?> </ td >
< td > <?php echo $clan [ 'clanz_pre' ] . ' ' . $clan [ 'clanz_suff' ]; ?> </ td >
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Member (<?php echo $count ; ?> ):</ th >
< th align = "Left" > Member (<?php echo $count . '/' . getMaximumMembers ($clan [ 'id' ]) ; ?> ):</ th >
< td > <?php echo join ( '<br>' , $member ); ?> </ td >
< td > <?php echo join ( '<br>' , $member ); ?> </ td >
< / tr >
< / tr >
<?php
<?php
@ -134,22 +141,26 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
?>
?>
< tr >
< tr >
< th align = "Left" > Eingeladen< / th >
< th align = "Left" > Eingeladen< / th >
< td > <?php echo join ( '<br ', $invited ); ?> </ td >
< td > <?php echo join ( '<br > ', $invited ); ?> </ td >
< / tr >
< / tr >
<?php
<?php
}
}
?>
?>
< tr >
< tr >
< th align = "Left" > Level:< / th >
< th align = "Left" height = "25" > Level:< / th >
< td > <?php echo $clan [ 'level' ]; ?> </ td >
< td > <?php echo $clan [ 'level' ]; ?> </ td >
< / tr >
< / tr >
< tr >
< th align = "Left" height = "25" > Erfahrung: < / th >
< td > <?php echo $clan [ 'min_exp' ] . ' / ' . getRequiredClanExp ( $clan [ 'level' ]); ?> </ td >
< / tr >
< tr >
< tr >
< th width = "96" height = "25" align = "Left" > Homepage:< / th >
< th width = "96" height = "25" align = "Left" > Homepage:< / th >
<?php
<?php
if($clan['homepage'] != 'Keine'){
if($clan['homepage'] != 'Keine'){
echo '< td width= "852" height= "25" > < a href = "'.$clan['homepage'].'" target = _blank > '.$clan['homepage'].'< / a > < / td > ';
echo '< td height= "25" > < a href = "'.$clan['homepage'].'" target = _blank > '.$clan['homepage'].'< / a > < / td > ';
} else{
} else{
echo '< td width= "852" height= "25" > Keine< / td > ';
echo '< td height= "25" > Keine< / td > ';
}
}
?>
?>
< / tr >
< / tr >
@ -186,6 +197,8 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
<?php
<?php
}
}
?>
?>
< tr > < th colspan = "2" > Debug Daten (Kein Bug, dass die naechste Zeile etwas komisch aussieht)< / th > < / tr >
< tr >< th colspan = "2" > <?php print_r ( $clan ); ?> </ th ></ tr >
< / table >
< / table >
< / div >
< / div >
@ -241,37 +254,41 @@ function displayClanProfileEditable($clan, $userid){
< / td >
< / td >
< / tr >
< / tr >
< tr >
< tr >
< th width = "25%" align = "Left" > Leader:< a
< th width = "25%" align = "Left" height = "25" > Leader:< a
href="index.php?as=clan/clan_info& action=edit& what=Leadership">(edit)< / a >
href="index.php?as=clan/clan_info& action=edit& what=Leadership">(edit)< / a >
< / th >
< / th >
< td > <?php echo $leader ; ?> </ td >
< td > <?php echo $leader ; ?> </ td >
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Co-Leader:< a
< th align = "Left" height = "25" > Co-Leader:< a
href="index.php?as=clan/clan_info& action=edit& what=Leadership">(edit)< / a >
href="index.php?as=clan/clan_info& action=edit& what=Leadership">(edit)< / a >
< / th >
< / th >
< td > <?php echo $coleader ; ?> </ td >
< td > <?php echo $coleader ; ?> </ td >
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Clanzeichen:< a
< th align = "Left" height = "25" > Clanzeichen:< a
href="index.php?as=clan/clan_info& action=edit& what=Clanzeichen">(edit)< / a >
href="index.php?as=clan/clan_info& action=edit& what=Clanzeichen">(edit)< / a >
< / th >
< / th >
< td > <?php echo $clan [ 'clanz_pre' ] . ' ' . $clan [ 'clanz_suff' ]; ?> </ td >
< td > <?php echo $clan [ 'clanz_pre' ] . ' ' . $clan [ 'clanz_suff' ]; ?> </ td >
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Member (<?php echo $count ; ?> ):</ th >
< th align = "Left" > Member (<?php echo $count . '/' . getMaximumMembers ($clan [ 'id' ]) ; ?> ):</ th >
< td > <?php echo join ( '<br>' , $member ); ?> </ td >
< td > <?php echo join ( '<br>' , $member ); ?> </ td >
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Eingeladen< / th >
< th align = "Left" > Eingeladen< / th >
< td > <?php echo join ( '<br ', $invited ); ?> </ td >
< td > <?php echo join ( '<br > ', $invited ); ?> </ td >
< / tr >
< / tr >
< tr >
< tr >
< th align = "Left" > Level:< / th >
< th align = "Left" height = "25" > Level:< / th >
< td > <?php echo $clan [ 'level' ]; ?> </ td >
< td > <?php echo $clan [ 'level' ]; ?> </ td >
< / tr >
< / tr >
< tr >
< th align = "Left" height = "25" > Erfahrung: < / th >
< td > <?php echo $clan [ 'min_exp' ] . ' / ' . getRequiredClanExp ( $clan [ 'level' ]); ?> </ td >
< / tr >
< tr >
< tr >
< th align = "Left" > Homepage:< a
< th align = "Left" height = "25" > Homepage:< a
href="index.php?as=clan/clan_info& action=edit& what=Homepage">(edit)< / a >
href="index.php?as=clan/clan_info& action=edit& what=Homepage">(edit)< / a >
< / th >
< / th >
<?php
<?php
@ -355,42 +372,58 @@ function sendClanNewsletter($user, $text){
}
}
}
}
function setProfile($what, $value1, $value2, $clanid, $root){
function setProfile($what, $value1, $value2, $clanid, $rootlvl){
if($rootlvl < 1 ) {
return 'Du hast keine Rechte um diese Aktion auszufü hren!';
}
switch($what){
switch($what){
case 'Homepage':
case 'Homepage':
mysql_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid);
mysql_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid);
return;
return NULL ;
case 'Clanzeichen':
case 'Clanzeichen':
mysql_query('UPDATE clan SET clanz_pre = \''.$value1.'\', clanz_suff = \''.$value2.'\' where id = '.$clanid);
mysql_query('UPDATE clan SET clanz_pre = \''.$value1.'\', clanz_suff = \''.$value2.'\' where id = '.$clanid);
return;
return NULL ;
case 'Banner':
case 'Banner':
mysql_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid);
mysql_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid);
return;
return NULL ;
case 'Info':
case 'Info':
mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid);
mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid);
return;
return NULL ;
case 'Leadership':
case 'Leadership':
if($value1 == 0){$value1 = 'null';}
if($value1 == 0){$value1 = 'null';}
if($value2 == 0){$value2 = 'null';}
if($value2 == 0){$value2 = 'null';}
if(!$root){
// 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) {
// 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!';
}
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;
mysql_query($sql);
mysql_query($sql);
} else{
} 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;
// echo $sql.'< br > ';
// echo $sql.'< br > ';
mysql_query($sql);
mysql_query($sql);
}
}
return;
return NULL ;
default:
default:
echo 'Error!';
return 'Error!';
return;
}
}
}
}
function displayEdit($what, $clanid, $root){
function displayEdit($what, $clanid, $rootlvl){
$clan_qry = mysql_query('Select * from clan where id = '.$clanid);
if($rootlvl < 1 ) {
$clan = mysql_fetch_assoc($clan_qry);
$content = '< tr > < td colspan = "2" > Du hast keine Rechte um diese Aktion auszufü hren!< / td > < / tr > ';
$what = 'ERROR';
}
$clan = getCLan($clanid);
$content = '';
$content = '';
switch($what){
switch($what){
@ -427,10 +460,9 @@ function displayEdit($what, $clanid, $root){
$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 > ';
break;
break;
case 'Info':
case 'Info':
$content = '< tr > < td colspan = "2" > < textarea class = "input" name = "value1" > < / textarea > < / td > < / tr > ';
$content = '< tr > < td colspan = "2" > < textarea class = "input" name = "value1" rows = "8" cols = "40" > '.debbcode($clan['info']).' < / textarea > < / td > < / tr > ';
break;
break;
case 'Clan Passwort':
case 'ERROR':
$content = '< tr > < td colspan = "2" > < input class = "input" name = "value1" / > < / td > < / tr > ';
break;
break;
default:
default:
$content = '< tr > < td colspan = "2" > Error '.$what.' unknown!< / td > < / tr > ';
$content = '< tr > < td colspan = "2" > Error '.$what.' unknown!< / td > < / tr > ';
@ -491,47 +523,26 @@ function deleteClan($user){
if($action !== NULL) { // this is done to not require to reprogramm the whole stuff!
//if($edit == 1){
$rootlvl = 0;
// $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!', '< a href = "index.php?as=clan/clan_info" > weiter< / a > ');
// $displayMore = false;
// }
//}
if($row['leader'] == $user_ida['id'] || ($row['leader'] === null & & ($row['co_leader'] === null || $row['co_leader'] = $user_ida['id']))) {
$rootlvl = 2; // leader or putsch!!
} else if($row['co_leader'] = $user_ida['id']) {
$rootlvl = 1; // co_leader
}
if($action !== NULL) { // this is done to not require to reprogramm the whole stuff!
switch ($action) {
switch ($action) {
case 'edit':
case 'edit':
$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)){
setProfile($what, $value1, $value2, $user_ida['clan'], $row['leader'] == $user_ida['id'] || $row['leader'] === nul l);
setProfile($what, $value1, $value2, $user_ida['clan'], $rootlvl);
} else{
} else{
displayEdit($what, $user_ida['clan'],$row['leader'] == $user_ida['id'] || $row['leader'] === nul l);
displayEdit($what, $user_ida['clan'], $rootlvl);
$displayMore = false;
$displayMore = false;
}
}
break;
break;