neue methoden in die clan.inc.php gebracht. Z.b. werden gibt es eine getClan funktion die cached. Ansonsten ist es nun moeglich bbcode in der claninfo zu nutzen. A propos bbcode. Die decodebb methode unterstuetzt nun auch das erstellen des albhed tags.

main
hecht 13 years ago
parent c7853f8678
commit 344645c29f

@ -9,6 +9,7 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/config.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/fehlerausgabe.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/fehlerausgabe.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/designfunctions.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/designfunctions.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/clan.inc.php');
// GET-Section // GET-Section
// Kritisch (SQL-Injections) // Kritisch (SQL-Injections)
@ -26,10 +27,11 @@ function joinClan($user, $clanid){
$clan_user = mysql_fetch_assoc(mysql_query($sql)); $clan_user = mysql_fetch_assoc(mysql_query($sql));
if($clan_user){ if($clan_user){
$sql = 'Select *, (Select member - count(*) from user u where clan = c.id and ((c.leader is null || c.leader != u.id) and (c.co_leader is null || c.co_leader != u.id))) as freeslots from clan c where id = '.$clanid; $clan = getClan($clanid);
// echo $sql . '<br>'; $members = getClanMembersCount($clanid);
$clan = mysql_fetch_assoc(mysql_query($sql)); $members_max = getMaximumMembers($clan['id']);
if($clan['freeslots'] <= 0){
if($members >= $members_max){
displayErrorMessage(NULL,'Konnte die Einladung des Clans nicht annehmen (Clan voll)!',displayHistoryBackLink()); displayErrorMessage(NULL,'Konnte die Einladung des Clans nicht annehmen (Clan voll)!',displayHistoryBackLink());
return; return;
} else{ } else{

@ -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&uuml;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&uuml;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&uuml;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'] === null); setProfile($what, $value1, $value2, $user_ida['clan'], $rootlvl);
} else{ } else{
displayEdit($what, $user_ida['clan'],$row['leader'] == $user_ida['id'] || $row['leader'] === null); displayEdit($what, $user_ida['clan'], $rootlvl);
$displayMore = false; $displayMore = false;
} }
break; break;
@ -570,4 +581,4 @@ if($action !== NULL) { // this is done to not require to reprogramm the whole st
if($displayMore){ if($displayMore){
displayClanProfile($clan_id, $user_ida); displayClanProfile($clan_id, $user_ida);
} }
?> ?>

@ -1,285 +1,285 @@
<?php <?php
/* /*
* *
* @copyright (c) 2009 animegame.eu * @copyright (c) 2009 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
* *
*/ */
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php');
// GET-Section // GET-Section
// Kritisch (SQL-Injections) // Kritisch (SQL-Injections)
$clan_geld=validateUnsignedInteger($_GET['clan_geld'], null); $clan_geld=validateUnsignedInteger($_GET['clan_geld'], null);
// Unkritisch // Unkritisch
$charm=$_GET['charm']; $charm=$_GET['charm'];
$mindestchar = 12; $mindestchar = 12;
$clan = mysql_fetch_array(mysql_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1")); $clan = mysql_fetch_array(mysql_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1"));
$user = mysql_fetch_array(mysql_Query("SELECT nickname, clan_geld, geld FROM user WHERE id='$user_ida[id]' LIMIT 1")); $user = mysql_fetch_array(mysql_Query("SELECT nickname, clan_geld, geld FROM user WHERE id='$user_ida[id]' LIMIT 1"));
if ($charm == 1) { if ($charm == 1) {
if($clan_geld <= 0) { if($clan_geld <= 0) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())"); mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())");
displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; exit;
} }
displayErrorMessage(NULL,'<p>Willst du wirklich "<strong>'.$clan_geld.'</strong> &#165;" an deinen Clan spenden ?</p><p><a href="index.php?as=clan/spende&charm=2&clan_geld='.$clan_geld.'">Ja</a>&nbsp;|&nbsp;<a href="index.php?as=clan/spende">Nein</a></p>',''); displayErrorMessage(NULL,'<p>Willst du wirklich "<strong>'.$clan_geld.'</strong> &#165;" an deinen Clan spenden ?</p><p><a href="index.php?as=clan/spende&charm=2&clan_geld='.$clan_geld.'">Ja</a>&nbsp;|&nbsp;<a href="index.php?as=clan/spende">Nein</a></p>','');
exit; exit;
} elseif($charm == 2) { } elseif($charm == 2) {
// Um Pufferueberlaeufe zu vermeiden, einfach die Laenge der Zeichenkette abfragen, ab der 8ten stelle also uerbe 99 Mio geht nicht aufeinmal! // Um Pufferueberlaeufe zu vermeiden, einfach die Laenge der Zeichenkette abfragen, ab der 8ten stelle also uerbe 99 Mio geht nicht aufeinmal!
if(strlen($clan_geld)>8) { if(strlen($clan_geld)>8) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr als 99.999.999 aufeinmal zu Spenden! (Eingabe:".$clan_geld.")',now())"); mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr als 99.999.999 aufeinmal zu Spenden! (Eingabe:".$clan_geld.")',now())");
displayErrorMessage(NULL,'Es kann nicht mehr als 99.999.999 aufeinmal gespendet werden!', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'Es kann nicht mehr als 99.999.999 aufeinmal gespendet werden!', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; exit;
} }
if($clan_geld <= 0) { if($clan_geld <= 0) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())"); mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())");
displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; exit;
} }
// Damit das minus nicht ausgenutzt wird!! // Damit das minus nicht ausgenutzt wird!!
$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida[id].' GROUP BY bieter')); $auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida[id].' GROUP BY bieter'));
$auktionensumme = $auktionensumme['summe']; $auktionensumme = $auktionensumme['summe'];
if($clan_geld+$auktionensumme>$user['geld']) { if($clan_geld+$auktionensumme>$user['geld']) {
displayErrorMessage(NULL,'Sie haben nicht genug Geld.', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'Sie haben nicht genug Geld.', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; exit;
}
mysql_query("UPDATE clan SET geld=geld+'$clan_geld' WHERE id='$user_ida[clan]'");
mysql_query('Update user SET geld=geld-'.$clan_geld.' WHERE id='.$user_ida['id']);
mysql_query('UPDATE user_clan SET spende = spende + '.$clan_geld.' WHERE clanid = '.$user_ida['clan'].' and userid = '.$user_ida['id']);
if(mysql_affected_rows() == 0){
mysql_query('INSERT INTO user_clan(spende,clanid,userid) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].')');
}
//mysql_query("UPDATE user SET geld=geld-'$_GET[clan_geld]', clan_geld=clan_geld+'$_GET[clan_geld]' WHERE id='$user_ida[id]'");
displayErrorMessage(NULL,'An Clan Erfolgreich Gespendet', '<a href="index.php?as=clan/spende">weiter...</a>');
exit;
}
?>
<head>
<script type="text/javascript">
<!--
function show_me () {
summe = (parseInt(document.forms[0].elements["clan_geld"].value));
}
var aktiv;
function button_plus(feld,schritt)
{
nummer=parseInt(document.forms[0].elements[feld].value)+schritt;
document.forms[0].elements[feld].value=nummer;
document.forms[0].elements["ges_lern"].value = parseInt(document.forms[0].elements["clan_geld"].value);
}
function button_minus(feld,min,schritt)
{
if(document.forms[0].elements[feld].value>min)
{
nummer=parseInt(document.forms[0].elements[feld].value)-schritt;
document.forms[0].elements[feld].value=nummer;
document.forms[0].elements["ges_lern"].value = parseInt(document.forms[0].elements["clan_geld"].value);
}
}
function start_plus(feld,schritt)
{
aktiv = setInterval("button_plus('"+feld+"',"+schritt+")",50);
}
function start_minus(feld,min,schritt)
{
aktiv = setInterval("button_minus('"+feld+"',"+min+","+schritt+")",50);
} }
mysql_query("UPDATE clan SET geld=geld+'$clan_geld' WHERE id='$user_ida[clan]'"); function stopp()
mysql_query('Update user SET geld=geld-'.$clan_geld.' WHERE id='.$user_ida['id']); {
mysql_query('UPDATE user_clan SET spende = spende + '.$clan_geld.' WHERE clanid = '.$user_ida['clan'].' and userid = '.$user_ida['id']); clearInterval(aktiv);
}
if(mysql_affected_rows() == 0){ -->
mysql_query('INSERT INTO user_clan(spende,clanid,userid) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].')'); </script>
} </head>
//mysql_query("UPDATE user SET geld=geld-'$_GET[clan_geld]', clan_geld=clan_geld+'$_GET[clan_geld]' WHERE id='$user_ida[id]'");
<?php
displayErrorMessage(NULL,'An Clan Erfolgreich Gespendet', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; //$sql = 'select u.id, item_id, count(c.id) from clan_ware cw inner join user u on cw.clan = u.clan inner join chars c on u.id = c.besitzer where u.clan = '.$user_ida['clan'].' group by u.id, item_id';
} //$sql = 'SELECT miete as mietkosten, item_id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' group by clan';
?> $sql ='SELECT miete, item_id, name, clan_ware.id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' order by item_id asc';
<head> //echo $sql.'<br>';
<script type="text/javascript"> $qry = mysql_query($sql);
$clanraum = array();
<!-- $clanraum_a = array();
while($row = mysql_fetch_assoc($qry)){
function show_me () { $clanraum[$row['id']] = $row;
summe = (parseInt(document.forms[0].elements["clan_geld"].value)); // print_r($row);
} $clanraum_a[] = $row;
}
$raumanzahl = count($clanraum_a);
var aktiv; //echo 'Raumanzahl = '.$raumanzahl.'<br>';
$sql = 'SELECT chars.clan_train, count(chars.id) as anzahl from chars inner join user on chars.besitzer = user.id where user.clan = '.$user_ida['clan'].' and chars.clan_train != 0 group by chars.clan_train';
function button_plus(feld,schritt) //echo $sql.'<br>';
{ $qry = mysql_query($sql);
$clanrauminfo = array();
while($row = mysql_fetch_assoc($qry)){
nummer=parseInt(document.forms[0].elements[feld].value)+schritt; $clanrauminfo[$row['clan_train']] = $row;
document.forms[0].elements[feld].value=nummer; }
document.forms[0].elements["ges_lern"].value = parseInt(document.forms[0].elements["clan_geld"].value);
} //print_r($clanrauminfo);
function button_minus(feld,min,schritt) $sql = 'select clan_ware.id as clan_warenid, user.id as userid, count(chars.id) as anzahl, clan.id as clanid from clan inner join clan_ware on clan.id = clan_ware.clan inner join clan_item on clan_item.id = clan_ware.item_id inner join user on clan.id = user.clan left join chars on user.id = chars.besitzer and clan_ware.id = chars.clan_train where clan.id = '.$user_ida['clan'].' group by userid, clan_warenid order by userid, clan_warenid';
{ //echo $sql.'<br>';
if(document.forms[0].elements[feld].value>min) $qry = mysql_query($sql);
{
$user_raum = array();
// Anzahl der Chars pro Raum pro User
nummer=parseInt(document.forms[0].elements[feld].value)-schritt; while($row = mysql_fetch_assoc($qry)){
document.forms[0].elements[feld].value=nummer; $user_raum[$row['userid']][$row['clan_warenid']] = $row;
}
document.forms[0].elements["ges_lern"].value = parseInt(document.forms[0].elements["clan_geld"].value);
} //print_r($user_raum);
}
$clans_spend = mysql_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC');
function start_plus(feld,schritt) $member = mysql_num_rows($clans_spend);
{
aktiv = setInterval("button_plus('"+feld+"',"+schritt+")",50); $sql = 'select besitzer, round(sum(1/(1+exp(3-level/12)) * nutzung)) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan = '.$user_ida['clan'].' group by besitzer order by besitzer';
} //echo $sql.'<br>';
$qry = mysql_query($sql);
function start_minus(feld,min,schritt)
{ $user_nutz = array();
aktiv = setInterval("button_minus('"+feld+"',"+min+","+schritt+")",50); while($row = mysql_fetch_assoc($qry)){
} $user_nutz[$row['besitzer']] = $row;
}
function stopp()
{ //print_r($user_nutz);
clearInterval(aktiv);
} $clan_kosten = 0;
--> $clan_untersch = 0;
</script>
</head> for($i=0;$i<$raumanzahl;$i++){
$clan_kosten += $clanraum_a[$i]['miete']*max($mindestchar, $clanrauminfo[$clanraum_a[$i]['id']]['anzahl']);
<?php if($clanrauminfo[$clanraum_a[$i]['id']]['anzahl'] < $mindestchar){
$clan_untersch += ($mindestchar - $clanrauminfo[$clanraum_a[$i]['id']]['anzahl']) * $clanraum_a[$i]['miete'];
//$sql = 'select u.id, item_id, count(c.id) from clan_ware cw inner join user u on cw.clan = u.clan inner join chars c on u.id = c.besitzer where u.clan = '.$user_ida['clan'].' group by u.id, item_id'; }
//$sql = 'SELECT miete as mietkosten, item_id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' group by clan'; }
$sql ='SELECT miete, item_id, name, clan_ware.id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' order by item_id asc';
//echo $sql.'<br>'; //echo 'Unterschuss: '.$clan_untersch.'<br>';
$qry = mysql_query($sql); $cols = 4;
$clanraum = array();
$clanraum_a = array(); ?>
while($row = mysql_fetch_assoc($qry)){
$clanraum[$row['id']] = $row;
// print_r($row); <table width="100%" border="0">
$clanraum_a[] = $row; <tr>
} <th colspan="<?php echo $cols+$raumanzahl; ?>" align="center">Spender Liste</th>
$raumanzahl = count($clanraum_a); </tr>
//echo 'Raumanzahl = '.$raumanzahl.'<br>'; <tr>
$sql = 'SELECT chars.clan_train, count(chars.id) as anzahl from chars inner join user on chars.besitzer = user.id where user.clan = '.$user_ida['clan'].' and chars.clan_train != 0 group by chars.clan_train'; <th>Member</th>
//echo $sql.'<br>'; <th>Spenden</th>
$qry = mysql_query($sql); <?php
for($i=0;$i<$raumanzahl;$i++){
$clanrauminfo = array(); echo '<th>'.$clanraum_a[$i]['name'].'</th>';
while($row = mysql_fetch_assoc($qry)){ }
$clanrauminfo[$row['clan_train']] = $row; ?>
} <th>Mietgeb&uuml;hren</th>
<th>Nutzungsgeb&uuml;hren</th>
//print_r($clanrauminfo); </tr>
<tr>
$sql = 'select clan_ware.id as clan_warenid, user.id as userid, count(chars.id) as anzahl, clan.id as clanid from clan inner join clan_ware on clan.id = clan_ware.clan inner join clan_item on clan_item.id = clan_ware.item_id inner join user on clan.id = user.clan left join chars on user.id = chars.besitzer and clan_ware.id = chars.clan_train where clan.id = '.$user_ida['clan'].' group by userid, clan_warenid order by userid, clan_warenid'; <th colspan="<?php echo $cols+$raumanzahl; ?>"><hr></th>
//echo $sql.'<br>'; </tr>
$qry = mysql_query($sql); <?php
$summe = 0;
$user_raum = array(); while($row = mysql_fetch_assoc($clans_spend)) {
// Anzahl der Chars pro Raum pro User ?>
while($row = mysql_fetch_assoc($qry)){ <tr>
$user_raum[$row['userid']][$row['clan_warenid']] = $row; <th align="center"><?php echo $row['nickname']; ?></th>
} <td align="center"><?php echo displayMoney($row['spende']); ?></td>
<?php
//print_r($user_raum); $summe += $row['spende'];
$costs = 0;
$clans_spend = mysql_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC'); for($i=0;$i<$raumanzahl;$i++){
$member = mysql_num_rows($clans_spend); echo '<td align="center">'.$user_raum[$row['userid']][$clanraum_a[$i]['id']]['anzahl'].'</td>';
$costs += $user_raum[$row['userid']][$clanraum_a[$i]['id']]['anzahl']*$clanraum_a[$i]['miete'];
$sql = 'select besitzer, round(sum(1/(1+exp(3-level/12)) * nutzung)) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan = '.$user_ida['clan'].' group by besitzer order by besitzer'; }
//echo $sql.'<br>'; if($clan_untersch != 0){
$qry = mysql_query($sql); echo '<td align="center">'.displayMoney($costs + ($clan_untersch/$member)).' (incl. '.displayMoney($clan_untersch/$member).')</td>';
} else{
$user_nutz = array(); echo '<td align="center">'.displayMoney($costs).'</td>';
while($row = mysql_fetch_assoc($qry)){ }
$user_nutz[$row['besitzer']] = $row; // $checksumme += $costs + ($clan_untersch/$member);
} ?>
<td align="center"><?php echo displayMoney($user_nutz[$row['userid']]['nutzkosten']); ?></td>
//print_r($user_nutz); </tr>
<?php
$clan_kosten = 0; }
$clan_untersch = 0;
?>
for($i=0;$i<$raumanzahl;$i++){ <tr>
$clan_kosten += $clanraum_a[$i]['miete']*max($mindestchar, $clanrauminfo[$clanraum_a[$i]['id']]['anzahl']); <th colspan="<?php echo $cols+$raumanzahl; ?>"><hr></th>
if($clanrauminfo[$clanraum_a[$i]['id']]['anzahl'] < $mindestchar){ </tr>
$clan_untersch += ($mindestchar - $clanrauminfo[$clanraum_a[$i]['id']]['anzahl']) * $clanraum_a[$i]['miete']; <tr>
} <th><?php echo $member; ?> Member</th>
} <th><?php
$sql = 'SELECT sum(spende) as summe FROM user_clan WHERE clanid ='.$user_ida['clan'];
//echo 'Unterschuss: '.$clan_untersch.'<br>'; $qry = mysql_query($sql);
$cols = 4; $row_s = mysql_fetch_assoc($qry);
echo displayMoney($row_s['summe']);
?> ?></th>
<?php
for($i=0;$i<$raumanzahl;$i++){
<table width="100%" border="0"> if($clanrauminfo[$clanraum_a[$i]['id']]['anzahl'] < $mindestchar){
<tr> echo '<th>'.$mindestchar.' ('.$clanrauminfo[$clanraum_a[$i]['id']]['anzahl'].')</th>';
<th colspan="<?php echo $cols+$raumanzahl; ?>" align="center">Spender Liste</th> }else{
</tr> echo '<th>'.$clanrauminfo[$clanraum_a[$i]['id']]['anzahl'].'</th>';
<tr> }
<th>Member</th> }
<th>Spenden</th> ?>
<?php <th><?php echo displayMoney($clan_kosten); ?> </th>
for($i=0;$i<$raumanzahl;$i++){ </tr>
echo '<th>'.$clanraum_a[$i]['name'].'</th>'; </table>
} <br><br>
?>
<th>Mietgeb&uuml;hren</th> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<th>Nutzungsgeb&uuml;hren</th> <input type="hidden" name="as" value="clan/spende">
</tr> <input type="hidden" name="charm" value="1">
<tr> <table width="75%" border="0" align="center">
<th colspan="<?php echo $cols+$raumanzahl; ?>"><hr></th> <tr>
</tr> <td colspan="2" align="center">Clan Geld Spenden (<?php echo displayMoney($clan['geld']); ?>)</td>
<?php </tr>
$summe = 0; <tr>
while($row = mysql_fetch_assoc($clans_spend)) { <td align="center">Dein Geld -</td>
?> <td align="center"><input id="input" name="ges_lern" type="text" value="0" size="15" readonly></td>
<tr> </tr>
<th align="center"><?php echo $row['nickname']; ?></th> <tr>
<td align="center"><?php echo displayMoney($row['spende']); ?></td> <td align="center">Clan Geld +</td>
<?php <td align="center">
$summe += $row['spende']; <input id="input" name="clan_geld" type="text" value="0" size="7">
$costs = 0; <input id="input" type="button" name="+2" value=" + " onMouseDown="start_plus('clan_geld',100);" onMouseUp="stopp();">
for($i=0;$i<$raumanzahl;$i++){ <input id="input" type="button" name="-2" value="-" onMouseDown="start_minus('clan_geld','0',100);" onMouseUp="stopp();">
echo '<td align="center">'.$user_raum[$row['userid']][$clanraum_a[$i]['id']]['anzahl'].'</td>'; </td>
$costs += $user_raum[$row['userid']][$clanraum_a[$i]['id']]['anzahl']*$clanraum_a[$i]['miete']; </tr>
} <tr>
if($clan_untersch != 0){ <td>&nbsp;</td>
echo '<td align="center">'.displayMoney($costs + ($clan_untersch/$member)).' (incl. '.displayMoney($clan_untersch/$member).')</td>'; <td align="center"><input id="input" type=submit value="Geld Spenden"></form></td>
} else{ </tr>
echo '<td align="center">'.displayMoney($costs).'</td>'; </table>
}
// $checksumme += $costs + ($clan_untersch/$member);
?>
<td align="center"><?php echo displayMoney($user_nutz[$row['userid']]['nutzkosten']); ?></td>
</tr>
<?php
}
?>
<tr>
<th colspan="<?php echo $cols+$raumanzahl; ?>"><hr></th>
</tr>
<tr>
<th><?php echo $member; ?> Member</th>
<th><?php
$sql = 'SELECT sum(spende) as summe FROM user_clan WHERE clanid ='.$user_ida['clan'];
$qry = mysql_query($sql);
$row_s = mysql_fetch_assoc($qry);
echo displayMoney($row_s['summe']);
?></th>
<?php
for($i=0;$i<$raumanzahl;$i++){
if($clanrauminfo[$clanraum_a[$i]['id']]['anzahl'] < $mindestchar){
echo '<th>'.$mindestchar.' ('.$clanrauminfo[$clanraum_a[$i]['id']]['anzahl'].')</th>';
}else{
echo '<th>'.$clanrauminfo[$clanraum_a[$i]['id']]['anzahl'].'</th>';
}
}
?>
<th><?php echo displayMoney($clan_kosten); ?> </th>
</tr>
</table>
<br><br>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<input type="hidden" name="as" value="clan/spende">
<input type="hidden" name="charm" value="1">
<table width="75%" border="0" align="center">
<tr>
<td colspan="2" align="center">Clan Geld Spenden (<?php echo displayMoney($clan['geld']); ?>)</td>
</tr>
<tr>
<td align="center">Dein Geld -</td>
<td align="center"><input id="input" name="ges_lern" type="text" value="0" size="15" readonly></td>
</tr>
<tr>
<td align="center">Clan Geld +</td>
<td align="center">
<input id="input" name="clan_geld" type="text" value="0" size="7">
<input id="input" type="button" name="+2" value=" + " onMouseDown="start_plus('clan_geld',100);" onMouseUp="stopp();">
<input id="input" type="button" name="-2" value="-" onMouseDown="start_minus('clan_geld','0',100);" onMouseUp="stopp();">
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center"><input id="input" type=submit value="Geld Spenden"></form></td>
</tr>
</table>

@ -6,6 +6,90 @@
* *
*/ */
$GLOBALS['clan_buffered_instances'] = array ();
function getClan($clanid, $buffer = TRUE) {
if(!is_numeric($clanid)) { return NULL; }
if(buffer && isset($GLOBALS['clan_buffered_instances'][$clanid])) {
return $GLOBALS['clan_buffered_instances'][$clanid]; // okay, we already buffered the clan :)
}
$clan = mysql_fetch_assoc(mysql_query('SELECT * FROM clan WHERE id = '. $clanid));
// now calculate the member, max_exp fields :D
if($clan) {
$GLOBALS['clan_buffered_instances'][$clanid] = $clan;
return $clan;
} else {
return NULL;
}
}
function getClanMembersCount($clanid) {
if(!is_numeric($clanid)) { return NULL; }
$row = mysql_fetch_assoc(mysql_query('SELECT count(id) as amount FROM user WHERE clan = '. $clanid));
return $row['amount'];
}
function getClanMemberBonusByLevel($level) {
switch($level) {
case 1:
case 2:
case 3:
return 0;
case 4:
case 5:
return 1;
case 6:
case 7:
return 2;
case 8:
case 9:
return 3;
case 10:
case 11:
return 4;
case 12:
case 13:
return 5;
case 14:
return 6;
case 15:
return 7;
case 16:
return 8;
case 17:
return 9;
default:
return 10;
}
}
function getMaximumMembers($clanid) {
// okay, this is a more tricky calculation as this requires the information (are leader and co_leader the same person??)
// the second parameter is the clan level. Each 2 levels (where the maximum clan level is about 20) one more member can
// be invited :)
$clan = getClan($clanid);
if($clan === NULL){ return 0; }
$base = 10;
$members_by_level = getClanMemberBonusByLevel($clan['level']);
$malus = 0;
if($clan['co_leader'] == NULL || $clan['co_leader'] == $clan['leader']) {
$malus = 1;
}
return $base + $members_by_level - $malus;
}
function getRequiredClanExp($level) {
return pow(2, $level) * 10;
}
function revokeInvitation($user, $userid, $clan = NULL){ function revokeInvitation($user, $userid, $clan = NULL){
if($user['clan'] === NULL) { if($user['clan'] === NULL) {
return 'Du bist in keinem Clan!'; return 'Du bist in keinem Clan!';
@ -107,4 +191,4 @@ function acceptChallenge(array $user, array $charids) {
} }
?> ?>

@ -51,6 +51,7 @@ function encodeNoHTMLnoBBAlBhed($msg){
return '[text='.$msg.']'.$result.'[/text]'; return '[text='.$msg.']'.$result.'[/text]';
} }
function decodeNoHTMLNoBBAlBhed($msg){ function decodeNoHTMLNoBBAlBhed($msg){
// Al Bhed: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z // Al Bhed: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
// Deutsch: E P S T I W K N U V G C L R Y B X H M D O F Z Q A J // Deutsch: E P S T I W K N U V G C L R Y B X H M D O F Z Q A J
@ -231,7 +232,8 @@ function debbcode($messagetext){
'#\<sup\>(.*?)\</sup\>#', '#\<sup\>(.*?)\</sup\>#',
'#\<span style="color:\#?([0-9a-fA-F]{6})"\>(.*?)</span\>#', '#\<span style="color:\#?([0-9a-fA-F]{6})"\>(.*?)</span\>#',
'#\<span style="color:([a-zA-Z]+?)"\>(.*?)</span\>#', '#\<span style="color:([a-zA-Z]+?)"\>(.*?)</span\>#',
'#<br>#' '#<br>#',
'#\<span title="([^"]*?)"\>[^\<]*\</span\>#'
//'<img src="\1\2">', //'<img src="\1\2">',
//'<img src="\1\2" />' //'<img src="\1\2" />'
) ; ) ;
@ -248,7 +250,8 @@ function debbcode($messagetext){
'[sup]\1[/sup]', '[sup]\1[/sup]',
'[color=#\1]\2[/color]', '[color=#\1]\2[/color]',
'[color=\1]\2[/color]', '[color=\1]\2[/color]',
"\n" "\n",
'[albhed]\1[/albhed]'
//'#\[img]([a-z]+?://){1}(.*?)\[/img]#', //'#\[img]([a-z]+?://){1}(.*?)\[/img]#',
//'#\[img](.*?)\[/img\]#' //'#\[img](.*?)\[/img\]#'
) ; ) ;

Loading…
Cancel
Save