Ported some changes from the independent branch to the ag 1.0 trunk. This basicly implies all the clan invitation stuff. Additionally the user controll is cleaned up a bit. This checkin requires the user_clan_invitations table and some changes in the clan table (replacement clanzeichen,pw to clanz_pre, clanz_suff). See the database file for more information.
parent
defc2c73f1
commit
9813e7c62f
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 07.03.2009
|
||||
*
|
||||
* @copyright (c) 2009 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.inc.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
|
||||
|
||||
$charm = $_GET['charm'];
|
||||
|
||||
if(!$charm) {
|
||||
displayErrorMessage(NULL,'Clan wirklich löschen?', '<a href="index.php?as=clan/del&charm=1">Ja</a> | '.displayHistoryBackLink());
|
||||
}
|
||||
if($charm == 1) {
|
||||
$dl = mysql_fetch_array(mysql_query("SELECT id FROM clan WHERE id='$user_ida[clan]' AND leader='$user_ida[id]' LIMIT 1"));
|
||||
if($dl['id']) {
|
||||
mysql_query("DELETE FROM clan WHERE id='$user_ida[clan]' AND leader='$user_ida[id]' LIMIT 1");
|
||||
mysql_query("DELETE FROM clan_ware WHERE clan='$dl[id]'");
|
||||
|
||||
mysql_query("UPDATE user SET clan=NULL WHERE clan='$user_ida[clan]' LIMIT 1");
|
||||
displayErrorMessage(NULL,'Clan erfolgreich gelöscht', '<a href="index.php?as=char_index">weiter...</a>');
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @copyright (c) 2009 animegame.eu
|
||||
* @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/char.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/parse.inc.php');
|
||||
// GET-Section
|
||||
// Kritisch (SQL-Injections)
|
||||
$user_id = validateUnsignedInteger($_GET['user_id'], null);
|
||||
|
||||
// Unkritisch
|
||||
$charm = $_GET['charm'];
|
||||
|
||||
if ($charm) {
|
||||
$clan = mysql_fetch_array(mysql_Query("SELECT leader FROM clan WHERE id='$user_ida[clan]'"));
|
||||
$kick_u = mysql_fetch_array(mysql_Query("SELECT clan, nickname FROM user WHERE id='$user_id'"));
|
||||
|
||||
if (($clan['leader'] == $user_ida['id']) OR ($user_id == $user_ida['id']) AND $clan['leader'] != $user_id AND $kick_u['clan'] == $user_ida['clan']) {
|
||||
mysql_query("UPDATE user SET clan=NULL WHERE id='$user_id'");
|
||||
mysql_query('Update chars set clan_train = 0 where besitzer = '.$user_id);
|
||||
displayErrorMessage(NULL, 'User erfolgreich aus den Clan gekickt!', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<table cellpadding="0" cellspacing="0" width="100%" height="69">
|
||||
<!-- MSTableType="layout" -->
|
||||
<tr>
|
||||
<td height="18" valign="top" width="603" colspan="2">
|
||||
<p align="center"><b>Clan Mitglieder</b></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$clan = mysql_fetch_array(mysql_Query("SELECT clanzeichen, leader FROM clan where id='$user_ida[clan]' LIMIT 1"));
|
||||
if ($clan[leader] == $user_ida[id]) {
|
||||
$kick = "ja";
|
||||
}
|
||||
$clan1 = explode(",", $clan[clanzeichen]);
|
||||
if ($user_ida['clan'] != 0) {
|
||||
$user = mysql_query("SELECT id, nickname FROM user WHERE clan='$user_ida[clan]' LIMIT 50");
|
||||
while ($row = mysql_fetch_array($user)) {
|
||||
?>
|
||||
<tr>
|
||||
<td height="25" valign="top" width="161">
|
||||
<p align="center"><b>Nickname</b></td>
|
||||
<td height="25" valign="top" width="442"> <?php echo displayUserLink($row['id'],$row['nickname'],$clan1[0],$clan1[1]); if(($kick == "ja" OR $user_ida[id] == $row[id]) AND ($clan[leader] != $row[id])) { echo " | <b><a href='index.php?as=clan/index&charm=1&user_id=$row[id]'>kicken</a></b>"; } ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
|
||||
$chars = getCharsOfUser($row['id']);
|
||||
foreach ($chars as $row2) {
|
||||
?>
|
||||
<tr>
|
||||
<td height="25" width="161" valign="top">
|
||||
<p align="center"><b>Charakter</b></td>
|
||||
<td height="25" width="442" valign="top"> <?php echo displayCharLink($row2['id'],$row2['name'],NULL,$clan1[0],$clan1[1]); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td height="25" width="161" valign="top">
|
||||
<p align="center"><b></b></td>
|
||||
<td height="25" width="442" valign="top"></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($clan[leader] == $user_ida[id]) {
|
||||
?>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</table>
|
@ -1,220 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @copyright (c) 2009 animegame.eu
|
||||
* @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/designfunctions.inc.php');
|
||||
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/fehlerausgabe.inc.php');
|
||||
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php');
|
||||
// GET-Section
|
||||
// Kritisch (SQL-Injections)
|
||||
$new_leader = validateUnsignedInteger($_GET['new_leader'], null);
|
||||
$co_leader = validateUnsignedInteger($_GET['co_leader'], null);
|
||||
$clan_pw = validateString($_GET['clan_pw']);
|
||||
$clan_name = validateName($_GET['clan_name']);
|
||||
$clan_banner = validateURL($_GET['clan_banner']);
|
||||
$clan_b = validateString($_GET['clan_b']);
|
||||
$clan_page = validateString($_GET['clan_page']);
|
||||
$clan_v = validateString($_GET['clan_v']);
|
||||
$clan_info = validateString($_GET['clan_info']);
|
||||
|
||||
// Unkritisch
|
||||
$charm = $_GET['charm'];
|
||||
$clan = mysql_fetch_assoc(mysql_query('SELECT * FROM clan WHERE id=' . $user_ida['clan'] . ' LIMIT 1'));
|
||||
$clan1 = mysql_query('SELECT nickname, id FROM user WHERE clan=' . $user_ida['clan']);
|
||||
$clan2 = mysql_query('SELECT nickname, id FROM user WHERE clan=' . $user_ida['clan']);
|
||||
$clan_8 = explode(',', $clan['clanzeichen']);
|
||||
|
||||
if ($charm == 1) {
|
||||
$clan_upps = mysql_fetch_assoc(mysql_query("SELECT id, (Select 10 - 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 clanname='$clan_name' OR clanzeichen='$clan_v,$clan_b' AND id!='$user_ida[clan]'"));
|
||||
$cuu = mysql_fetch_assoc(mysql_query('SELECT clan FROM user WHERE id=' . $new_leader));
|
||||
|
||||
if ($cuu['clan'] != $user_ida['clan']) {
|
||||
displayErrorMessage(NULL, 'Fehler User ist nicht im Clan.', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($clan_upps['id'] AND $clan_upps['id'] != $user_ida['clan']) {
|
||||
displayErrorMessage(NULL, 'Clanname oder Clan Zeichen gibt es schon.', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$clan_pw) {
|
||||
displayErrorMessage(NULL, 'Clanpasswort eingeben!', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$clan_v AND !$clan_b) {
|
||||
displayErrorMessage(NULL, 'Sie müssen ein Clanzeichen haben.', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$clan_name) {
|
||||
displayErrorMessage(NULL, 'Sie müssen einen Clanname haben.', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($clan['leader'] != $user_ida['id'] AND $clan['co_leader'] != $user_ida['id']) {
|
||||
displayErrorMessage(NULL, 'Sie sind weder Leader noch Co-Leader!', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check new conditions (10 Members + 1 Co + 1 Leader Slot available)
|
||||
if($clan['leader'] != $clan['co_leader'] && $new_leader == $co_leader && $clan_upps['freeslots'] <= 0){
|
||||
// Failure
|
||||
displayErrorMessage(NULL, 'Alleinherrschaft ist leider nicht möglich, da sich zuviele User im Clan befinden!', displayHistoryBackLink());
|
||||
exit;
|
||||
}
|
||||
|
||||
mysql_query("UPDATE clan SET clanname='$clan_name', clanzeichen='$clan_v,$clan_b', pw='$clan_pw', info='$clan_info', leader='$new_leader', co_leader='$co_leader', homepage='$clan_page', banner='$clan_banner' WHERE id='$user_ida[clan]'");
|
||||
|
||||
displayErrorMessage(NULL, 'Clan erfolgreich geändert.', '<a href="index.php?as=clan/profil">weiter...</a>');
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<body>
|
||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
|
||||
<input type="hidden" name="as" value="clan/profil">
|
||||
<input type="hidden" name="charm" value="1">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" height="51">
|
||||
|
||||
<tr>
|
||||
<td valign="top" colspan="2" height="32">
|
||||
<p align="center"><b>Ihr Profil</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Level</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<?php echo "$clan[level]"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Exp</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<?php echo "$clan[min_exp] / $clan[max_exp]"; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Clanname</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<input id="input" name="clan_name" value="<?php echo $clan[clanname]; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Passwort</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<input id="input" name="clan_pw" value="<?php echo $clan[pw]; ?>" size='20'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Homepage</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<input id="input" name='clan_page' value="<?php echo $clan['homepage']; ?>" size='20'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Banner (468 x 60)</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<input id="input" name='clan_banner' value="<?php echo $clan['banner']; ?>" size='20'></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Clanzeichen vorn</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<input id="input" name='clan_v' size='20' maxlength=10 value="<?php echo $clan_8[0]; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Clanzeichen hinten</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<input id="input" name='clan_b' size='20' maxlength=10 value="<?php echo $clan_8[1]; ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Leader</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<select id="input" name="new_leader">
|
||||
<option value=""></option>
|
||||
<?php
|
||||
|
||||
$x = 0;
|
||||
while ($row = mysql_fetch_array($clan1)) {
|
||||
if ($row[id] == $clan[leader]) {
|
||||
$selected[$x] = "selected";
|
||||
}
|
||||
echo "<option value=$row[id] $selected[$x]>$row[nickname]";
|
||||
$x++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b>Co. Leader</b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<select id="input" name="co_leader">
|
||||
<option value=""></option>
|
||||
<?php
|
||||
|
||||
$y = 0;
|
||||
while ($row = mysql_fetch_array($clan2)) {
|
||||
if ($row[id] == $clan[co_leader]) {
|
||||
$selecteds[$y] = "selected";
|
||||
}
|
||||
echo "<option value=$row[id] $selecteds[$y]>$row[nickname]";
|
||||
$y++;
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td height="25" width="162" valign="top">
|
||||
<p align="center"><b>Clan Info</b></td>
|
||||
<td height="25" width="395" valign="top"> <textarea id="input" rows="5" cols="30" name="clan_info"><?php echo $clan[info]; ?></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"><b></b></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<input id="input" type=submit value='speichern'>
|
||||
</td></tr>
|
||||
</table>
|
||||
<?php
|
||||
if ($clan['leader'] == $user_ida['id']) {
|
||||
?>
|
||||
<hr style="width:500px; color:#333333; border-style:solid;">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
<p align="left">
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign="top" height="25" width="195">
|
||||
<p align="center"></td>
|
||||
<td valign="top" height="25" width="191">
|
||||
|
||||
<p align="left"><a href="index.php?as=clan/del">Clan löschen<p></a>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @copyright (c) 2011 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
function revokeInvitation($user, $userid, $clan = NULL){
|
||||
if($user['clan'] === NULL) {
|
||||
return 'Du bist in keinem Clan!';
|
||||
}
|
||||
|
||||
if($clan === NULL) {
|
||||
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
|
||||
$clan = mysql_fetch_assoc($qry);
|
||||
}
|
||||
|
||||
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
|
||||
return 'Nur der Leader, bzw. der Co-Leader kann Einladungen zurückziehen!!';
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM user_clan_invitations WHERE clanid = '.$clan['id'].' AND userid = '.$userid;
|
||||
// echo $sql . '<br>';
|
||||
mysql_query($sql);
|
||||
if(mysql_affected_rows() > 0){
|
||||
return NULL;
|
||||
} else{
|
||||
return 'Einladung konnte nicht zurückgezogen werden!';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param array $user the user that wants to invite
|
||||
* @param int $userid the id of the user that should be invited
|
||||
* @param array $clan the optional clan array (if available)
|
||||
*/
|
||||
function inviteUser(array $user, $userid, array $clan = NULL){
|
||||
if($user['clan'] === NULL) {
|
||||
return 'Du bist in keinem Clan!';
|
||||
}
|
||||
|
||||
if($clan === NULL) {
|
||||
$qry = mysql_query('Select * from clan where id = ' . $user['clan']);
|
||||
$clan = mysql_fetch_assoc($qry);
|
||||
}
|
||||
|
||||
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
|
||||
return 'Nur der Leader, bzw. der Co-Leader kann neue Member einladen!';
|
||||
}
|
||||
|
||||
$row = mysql_fetch_assoc(mysql_query('SELECT * FROM user where id = \''. $userid.'\''));
|
||||
if(!row) {
|
||||
return 'Fehler! Nutzer exisitiert nicht!!';
|
||||
}
|
||||
if($row['clan'] == $user['clan']){
|
||||
return 'Fehler! Nutzer ist schon in deinem Clan!';
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO user_clan_invitations(userid, clanid, valid) values('.$userid.','.$user['clan'].',TIMESTAMPADD(DAY, 5, now()))';
|
||||
// echo $sql.'<br>';
|
||||
mysql_query($sql);
|
||||
if(mysql_affected_rows() <= 0){ // Fehler?
|
||||
$sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan'];
|
||||
// echo $sql.'<br>';
|
||||
mysql_query($sql);
|
||||
if(mysql_affected_rows() <= 0){ // Fehler?
|
||||
return 'Fehler! Konnte Nutzer nicht einladen!';
|
||||
} else{
|
||||
sendMessage($user['id'], $userid, 'Einladung in Clan', 'Die Einladung des Clans '.$clan['clanname'].' wurde aufgefrischt! Klicke auf "Clan beitreten" um die Einladung anzunehmen!');
|
||||
return NULL;
|
||||
}
|
||||
} else{
|
||||
sendMessage($user['id'], $userid, 'Einladung in Clan', 'Du wurdest eingeladen dich dem Clan '.$clan['clanname'].' anzuschliessen! Klicke auf "Clan beitreten" um die Einladung anzunehmen!');
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in new issue