+
+ Dies ist keine Zahl';
-} else {
- /* Pr�fen ob die �bergebene oder eingegebene ID in der Tabelle der Clans vorhanden ist */
- $clanvorhanden = mysql_num_rows(mysql_query('SELECT id FROM clan where id = '.$clan_id));
- /* Wenn keine Datensatz mit dieser ID vorhanden ist, ist die Variable $clanvorhanden 0 */
- if ($clanvorhanden == 0) {
- echo '
Einen Clan mit dieser ID exisitert nicht!
';
- /* Wenn es einen Datensatz mit der ID in der Tabelle gibt, werden die Claninformationen angezeigt */
+
+function displayClanProfileEditable($clan, $userid){
+ $member_qry = mysql_query('Select id from user where clan = '.$clan['id']);
+ $member = array();
+ $count = mysql_num_rows($member_qry);
+ while($row = mysql_fetch_assoc($member_qry)){
+ $tmp = displayUserLinkByID($row['id']);
+ $kickable = true;
+
+ if($row['id'] == $clan['leader']){
+ $leader = $tmp;
+ $kickable = false;
+ }
+ if($row['id'] == $clan['co_leader']){
+ $coleader = $tmp;
+ $kickable = false;
+ }
+ if($userid == $row['id'] && $kickable){
+ $member[] = $tmp.' (verlassen)';
+ } else if($kickable){
+ $member[] = $tmp.' (kicken)';
+ } else{
+ $member[] = $tmp;
+ }
+ }
+
+ $inv_qry = mysql_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()');
+ $invited = array();
+
+ while($row = mysql_fetch_assoc($inv_qry)) {
+ $invited[] = displayUserLinkByID($row['userid']) . ' (noch ' . $row['till'] . 'h gültig, zurückziehen)';
+ }
+
+
+ ?>
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/ag/clan/profil.php b/ag/clan/profil.php
deleted file mode 100644
index 6046f4a..0000000
--- a/ag/clan/profil.php
+++ /dev/null
@@ -1,220 +0,0 @@
-weiter...');
- exit;
-}
-?>
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ag/inclu/user-controll.php b/ag/inclu/user-controll.php
index 7c90c5b..9f7ceea 100644
--- a/ag/inclu/user-controll.php
+++ b/ag/inclu/user-controll.php
@@ -49,8 +49,8 @@ if ($name AND $passwort) {
Meine Wanted Kämpfe
";
$charakter_009 = "Charakter Übersicht ".$charakter_009;
-
-
+
+
$training_009 = "";
$turnier_009 = 'Wochen Turnier Anmeldung ' .
@@ -79,21 +79,22 @@ if ($name AND $passwort) {
Clan Nachricht
+ Mein Clan Clan Markt Clan Item Nutzung
- Clan Profil
- Clan Ticker
- Clan Mitglieder Geld Spenden
- Clan Kämpfe Anzeige ";
+ Clan Ticker
+ Clan Wechseln
+ ";
}
-
+
+// $clan_009 .= "Clan Kämpfe Anzeige ";
+
// Ist user der leader?
- $chiefs = mysql_fetch_assoc(mysql_query('Select co_leader, leader from clan where id = '.$user_ida['clan']));
- if($chiefs['co_leader'] == $user_ida['id'] || $chiefs['leader'] == $user_ida['id']){
- $clan_009 .= 'Clan Kämpfe ';
- }
+// $chiefs = mysql_fetch_assoc(mysql_query('Select co_leader, leader from clan where id = '.$user_ida['clan']));
+// if($chiefs['co_leader'] == $user_ida['id'] || $chiefs['leader'] == $user_ida['id']){
+// $clan_009 .= 'Clan Kämpfe ';
+// }
$info_009 = "
Alle User
@@ -117,26 +118,26 @@ if ($name AND $passwort) {
$points = mysql_Fetch_array(mysql_Query("SELECT pkt FROM user WHERE nickname='$name' LIMIT 1"));
$points2[pkt] = number_format($points[pkt], 0, "", ".");
$points3 = $points2[pkt];
-
-
+
+
if ($name == 'Pegasus') {
$status_009 .= "Status ";
}
$status_009 .= "Geld: $geldstring ";
-// $status_009 .= "IP: $points3 ";
-
+// $status_009 .= "IP: $points3 ";
+
$status_009 .= 'Profil ';
$status_009 .= 'User Ticker ';
$status_009 .= 'User Postfach ';
-
+
$status_009 .= 'Meine Items ';
$status_009 .= 'Markt ';
$status_009 .= 'Auktions Markt ';
// $status_009 .= 'Shakkys Abzockbar ';
-
+
$status_009 .= 'Logout ';
-
+
} else {
$agc_009 = "
@@ -148,9 +149,9 @@ if ($name AND $passwort) {
";
}
$active = mysql_fetch_assoc(mysql_query('select count(*) as anzahl from user where online_zeit between TIMESTAMPADD(DAY, -7, now()) and now()'));
-
+
$o_datum = preg_split('# #',$online_rekord_1_0['datum']);
- $info_019 = "
+ $info_019 = "
FAQ Anfängerguide AG Unterstützen
diff --git a/ag/include/clan.inc.php b/ag/include/clan.inc.php
new file mode 100644
index 0000000..a9052ae
--- /dev/null
+++ b/ag/include/clan.inc.php
@@ -0,0 +1,81 @@
+';
+ 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.' ';
+ 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.' ';
+ 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;
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/ag/include/config/settings_example.inc.php b/ag/include/config/settings_example.inc.php
index 1abde3a..239bac4 100644
--- a/ag/include/config/settings_example.inc.php
+++ b/ag/include/config/settings_example.inc.php
@@ -12,4 +12,12 @@
* Der Pfad muss auf eine Date zeigen, in der die Rassen (aehnlich wie bei der rassen.inc.php aufgelistet sind!)
*/
# $GLOBALS['races_location_file'] = $_SERVER['DOCUMENT_ROOT'].'ag/include/config/myraces.inc.php';
+
+
+// Farben
+$GLOBALS['COLOR_SUPPORTER'] = 'gold';
+$GLOBALS['COLOR_GM'] = 'lime';
+$GLOBALS['COLOR_DEVELOPER'] = 'blue';
+$GLOBALS['COLOR_CREATIVE'] = 'red';
+
?>
\ No newline at end of file
diff --git a/ag/include/designfunctions.inc.php b/ag/include/designfunctions.inc.php
index 7e2165e..ee7161f 100644
--- a/ag/include/designfunctions.inc.php
+++ b/ag/include/designfunctions.inc.php
@@ -7,15 +7,61 @@
*/
// Diese Funktion muss in ein Darstellungspackage hinein und muss noch verlegt werden, Gestaltung in css-Datei
-function displayUserLink($userid, $username, $clanpre = NULL, $clansu = NULL){
- if($clanpre === NULL && $clansu === NULL){
- return ''.$username.'';
+
+/**
+ * use displayUserLinkByID instead
+ * @deprecated
+ */
+function displayUserLink($userid, $username = NULL, $clanpre = NULL, $clansu = NULL){
+ // backwards compat!!
+ return displayUserLinkByID($userid);
+}
+
+function displayUserNameByID($userid, $showClanTags = TRUE){
+ if($userid === null){return '';}
+ $sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff, ads, gm from user left join clan on user.clan = clan.id where user.id = '.$userid;
+ $user_info = mysql_fetch_assoc(mysql_query($sql));
+ if($user_info['gm'] != 'nein'){
+ if($user_info['gm'] == 'ja'){
+ $color = 'style="color:'.$GLOBALS['COLOR_GM'].'"';
+ } else if($user_info['gm'] == 'et'){
+ $color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"';
+ } else if($user_info['gm'] == 'ka'){
+ $color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"';
+ }
+ } else if($user_info['ads'] == 1){
+ $color = 'style="color:'.$GLOBALS['COLOR_SUPPORTER'].'"';
} else{
- return ''.$clanpre.' '.$username.' '.$clansu.'';
+ $color = '';
+ }
+
+ $nickname = $user_info['nickname'];
+ if($user_info['clanz_pre'] !== NULL && $user_info['clanz_pre'] != '' && $showClanTags) {
+ $nickname = $user_info['clanz_pre'] . ' ' . $nickname;
+ }
+ if($user_info['clanz_suff'] !== NULL && $user_info['clanz_suff'] != '' && $showClanTags) {
+ $nickname = $nickname . ' ' . $user_info['clanz_suff'];
+ }
+
+ if($color == ''){
+ return $nickname;
+ } else{
+ return ''.$nickname.'';
}
}
-function displayClanLink($clanid, $clanname){
+// Diese Funktion muss in ein Darstellungspackage hinein und muss noch verlegt werden, Gestaltung in css-Datei
+function displayUserLinkByID($userid, $showClanTags = TRUE){
+ return ''.displayUserNameByID($userid, $showClanTags).'';
+}
+
+
+function displayClanLink($clanid, $clanname = NULL){
+ if($clanname === NULL) {
+ $qry = mysql_query('SELECT clanname FROM clan WHERE id = ' . $clanid);
+ $row = mysql_fetch_assoc($qry);
+ $clanname = $row['clanname'];
+ }
return ''.$clanname.'';
}
@@ -27,7 +73,7 @@ function displayIndexBackLink(){
return 'zurück';
}
-function displayCharLink($charid, $charname, $img = NULL, $clanpre = NULL, $clansu = NUL){
+function displayCharLink($charid, $charname, $img = NULL, $clanpre = NULL, $clansu = NULL){
if($clanpre !== NULL && $clansu !== NULL){
$charname = $clanpre.' '.$charname.' '.$clansu;
}
diff --git a/ag/include/messagefunctions.inc.php b/ag/include/messagefunctions.inc.php
index 1914c9c..8c6de92 100644
--- a/ag/include/messagefunctions.inc.php
+++ b/ag/include/messagefunctions.inc.php
@@ -30,6 +30,7 @@ function sendMessage($von, $besitzer, $betreff, $text){
$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\''.$von.'\', '.$besitzer.', \''.$betreff.'\', \''.$text.'\')';
// echo $sql.' ';
mysql_query($sql);
+ return mysql_affected_rows() != 0;
}
function colorize($text){
@@ -139,4 +140,9 @@ function insertClanTickerMessage($clanid, $message, $offset = 0){
//$test = 'Test';
//echo encodeMessage($test).' ';
+
+function sendInviteToClanMessage($leaderid, $userid) {
+
+}
+
?>
\ No newline at end of file
diff --git a/ag/info.php b/ag/info.php
index 67dbef9..f03ef85 100644
--- a/ag/info.php
+++ b/ag/info.php
@@ -8,7 +8,9 @@
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/char.inc.php');
+include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/clan.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
+include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
@@ -103,13 +105,13 @@ function display1($char_id){
}
-function display2($user_id, $userage){
+function display2($user_id, $userage, $user_ida){
if($userage != NULL){
$user_a = mysql_fetch_assoc(mysql_query('SELECT * FROM user WHERE nickname=\''.$userage.'\''));
} else{
$user_a = mysql_fetch_assoc(mysql_query('SELECT * FROM user WHERE id='.$user_id));
}
-
+
?>
@@ -129,12 +131,28 @@ function display2($user_id, $userage){
echo 'Keiner';
} else{
$clan = mysql_fetch_assoc(mysql_query('SELECT * FROM clan WHERE id = '.$user_a['clan']));
- echo displayClanLink ($clan['id'], $clan['clanname']) ;
+ echo displayClanLink ($clan['id'], $clan['clanname']) ;
}
-
+ // Now could it be that the user is in an other clan and we may invite him ;), check if current user is a leader!
+ $qry = mysql_query('Select id from clan where leader = ' . $user_ida['id'] . ' or co_leader = ' . $user_ida['id']);
+ $clan = mysql_fetch_assoc($qry);
+ // is there data available and if yes does the other user have the same clan?
+ if($clan && $clan['id'] !== $user_a['clan']) {
+ // check if we already invited him. Then renew invitation ->
+ $qry = mysql_query('Select count(*) as anzahl from user_clan_invitations where clanid = '.$clan['id'].' AND userid = ' . $user_id);
+ $row = mysql_fetch_assoc($qry);
+
+ if ($row['anzahl'] > 0) {
+ $action = 'Einladung erneuern';
+ } else {
+ $action = 'einladen';
+ }
+ // no ?? Then display the option to invite this user ;)
+ echo ' ('.$action.')';
+ }
?>
-
+
Geschlecht
@@ -152,7 +170,7 @@ function display2($user_id, $userage){
Nick-History
',$nick_history) ?>
-
-
+
@@ -214,8 +232,17 @@ if($charm == 1) {
display1($char_id);
} else if($charm == 2){
display3($group,$item_id);
-}else if($user_id != NULL || $userage != NULL){
- display2($user_id, $userage);
+} elseif ($charm == 3) {
+ $errorMsg = inviteUser($user_ida, $user_id);
+ if($errorMsg !== NULL) {
+ echo displayErrorMessage(NULL, $errorMsg, displayHistoryBackLink());
+ $displayMore = false;
+ } else {
+ displayErrorMessage('','Du hast die Einladung erfolgreich verschickt!', 'weiter');
+ $displayMore = false;
+ }
+} else if($user_id != NULL || $userage != NULL){
+ display2($user_id, $userage, $user_ida);
}
?>
\ No newline at end of file
diff --git a/db/animegame_svn.sql b/db/animegame_svn.sql
index c4a77b6..68376e7 100644
--- a/db/animegame_svn.sql
+++ b/db/animegame_svn.sql
@@ -408,12 +408,12 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `clan`;
CREATE TABLE `clan` (
`clanname` varchar(50) collate utf8_unicode_ci NOT NULL default '',
- `clanzeichen` varchar(255) collate utf8_unicode_ci NOT NULL default ',',
+ `clanz_pre` varchar(25) collate utf8_unicode_ci NOT NULL default '',
+ `clanz_suff` varchar(25) collate utf8_unicode_ci NOT NULL default '',
`geld` int(15) NOT NULL default '0',
`info` text collate utf8_unicode_ci NOT NULL,
`id` int(11) NOT NULL auto_increment,
`leader` int(11) default '0',
- `pw` varchar(50) collate utf8_unicode_ci NOT NULL default '',
`siege` int(25) NOT NULL default '0',
`niederlagen` int(25) NOT NULL default '0',
`co_leader` int(11) default NULL,
@@ -2242,6 +2242,25 @@ CREATE TABLE `turnier_preis` (
)
ENGINE = InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci;
+DROP TABLE IF EXISTS `user_clan_invitations`;
+CREATE TABLE `user_clan_invitations` (
+ `userid` INTEGER NOT NULL,
+ `clanid` INTEGER NOT NULL,
+ `valid` TIMESTAMP NOT NULL,
+ PRIMARY KEY (`userid`, `clanid`),
+ CONSTRAINT `user_clan_invitations_userid` FOREIGN KEY `user_clan_invitations_userid` (`userid`)
+ REFERENCES `user` (`id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ CONSTRAINT `user_clan_invitations_clanid` FOREIGN KEY `user_clan_invitations_clanid` (`clanid`)
+ REFERENCES `clan` (`id`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+)
+ENGINE = InnoDB
+CHARACTER SET utf8 COLLATE utf8_general_ci;
+
+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;