Seite 1 von 1

Birthday in Calender Mod

Verfasst: 09.12.2002 13:48
von Simpson
Ich habe mir überlegt ob ich die Frage stelle oder ob ich es sein laße, weil es wahrscheinlich ein wenig kompliziert ist...

Es geht um den Mod der den Geburtstags Mod (Birthday 1.3.3 neuste Version) im Kalender (Calendar Lite 1.2.2m neuste Version) anzeigen soll.

Das Problem bei dem Mod ist, er wurde nicht für diese aktuellsten Versionen von Calender und Birthday Mod geschrieben und daher funktioniert er auch nicht vollständig.

Das funktioniert: Der Mod zeigt im Kalender die User an die Geburtstag haben :)

Das funktioniert nicht:
- Das Alter eines Users wird im Kalender nicht angezeigt (was aber eigentlich gehen soll) :(
- Die Sprungfunktion zu einem x-bliebigen Monat im x-beliebigen Jahr funktioniert, aber es wird nicht verhindert das man zum Beispiel das Jahr 75 oder 200 beispielsweise eingeben kann (das soll eigentlich im Code verhindert werden) :(

Download der Mods:

- Calendar Lite 1.2.2m (dafür muß man registriert und eingelogt sein)
http://www.snailsource.com/forum/minidl ... file_id=12

- Birthday Mod
http://mods.db9.dk/contrib/birthday.zip

Und so sieht der Birthday in Calender Mod aus der beides miteinander verbinden soll (der ist von http://phpbb2.de/phpBB/viewtopic.php?t=66 ):

Code: Alles auswählen

############################################################################# 
## Mod Title: Calendar/Birthday-Hack 
## Mod Version: 0.0.1 
## Author: Michael "neima" Neumann 
##         webmaster@team-doof.de 
############################################################################# 
## 
## ATTENTION: you MUST have installed Calendar-mod 
##                                and Birthday-mod 
##            otherwise it won't make much sense ;) 
## 
############################################################################# 
## Description: This mod will add the users' birthdays to the calendar. 
##   Also a "quick-jump-to-month"-box is included, this means you can 
##   choose your year and month and call it in your calendar. 
## 
## Installation Level: easy 
## Installation Time: 5-10 Minutes 
## Files To Edit: 2 
##                calendar.php 
##                lang_main.php 
############################################################################# 

----------------------------------------------------------------------------- 

############################################################################# 
##-----[ OPEN FILE ] 
cal_settings.php 


############################################################################# 
##-----[ FIND ] 
?> 

##-----[ add BEFORE ] 
$showage = 'yes'; 
############################################################################# 


############################################################################# 
##-----[ CLOSE AND SAVE FILE ] 
cal_settings.php 



############################################################################# 
##-----[ OPEN FILE ] 
calendar.php 


############################################################################# 
##-----[ FIND ] 
$cal_lang_file = "lang_calendar.php"; 


##-----[ add AFTER ] 
// START neima-MOD » added title and checks if $year is valid 
$page_title = "Kalender"; 
if ($year < 1970) { $year = 1970; } 
if ($year > 2037) { $year = 2037; } 
//END neima-MOD » 
############################################################################# 



############################################################################# 
##-----[ FIND ] 
function display() 
{ 
      global $PHP_SELF, $phpbb_root_path, $phpEx, $dbhost, $dbuser, $dbpasswd, $dbname, $mysql_tablename, $action, 
      $id, $day, $month, $year, $time, $userdata, $lang, $config_footer, $footer, $calmod, $caluser, 
      $endday, $endmonth, $endyear, $usersuggest, $board_config, $bbcode_uid; 
   $monthname = $lang['months_long'][date('n', mktime(0,0,0,$month,1,$year))-1]; 


##-----[ REPLACE with ] 
function display() 
{ 
   // neima-MOD » added $table_prefix to global 

      global $PHP_SELF, $phpbb_root_path, $phpEx, $dbhost, $dbuser, $dbpasswd, $dbname, $mysql_tablename, $action, 
      $id, $day, $month, $year, $time, $userdata, $lang, $config_footer, $footer, $calmod, $caluser, 
      $endday, $endmonth, $endyear, $usersuggest, $board_config, $bbcode_uid, $table_prefix; 
   $monthname = $lang['months_long'][date('n', mktime(0,0,0,$month,1,$year))-1]; 

// START neima-MOD » get users having birthday this day 
$birthlist = array("id"=>array(),"name"=>array()); 

$sql = "SELECT user_id, username, user_birthday FROM ".$table_prefix."users"; 
$result = mysql_query($sql); 
while($row = mysql_fetch_array($result)) { 
   if ($row[2]!=999999) { 
      $tag = realdate('d', $row[2]); 
      $monat = realdate('m', $row[2]); 
      if (($monat == $month) AND ($tag == $day)) { 
   $birthlist['id'][] = $row[0]; 
   $birthlist['name'][] = $row[1]; 
      } 
   } 
} 

$birthsize = sizeof($birthlist['name']); 
// END neima-MOD » 
############################################################################# 



############################################################################# 
##-----[ FIND ] 
$check = 0; 
echo "<table cellpadding=2 cellspacing=0 border=0 width=100%>"; 


##-----[ add AFTER ] 
// START neima-MOD » write down the birthdays for this day 
if ($birthsize > 0) { 
   echo "<tr><td class=row2 colspan=4><span class=genmed><b>" . $lang['Birthday'] . "</b></span></td></tr>\n"; 
   echo "<tr><td class=row1 colspan=4><span class=genmed>Heute "; 
   if ($birthsize > 1) { echo "haben "; } else { echo "hat "; } 
for ($ichzaehl=0; $ichzaehl<$birthsize; $ichzaehl++) { 
   echo "<a href=\"profile.php?mode=viewprofile&u="; echo $birthlist['id'][$ichzaehl]; echo "\" class=gensmall><b>"; echo $birthlist['name'][$ichzaehl]; echo "</b></a>"; 
   if (($ichzaehl == $birthsize - 2) AND ($birthsize > 1)) { echo " und "; } 
   if (($ichzaehl < $birthsize - 2) AND ($birthsize > 1)) { echo ", "; } 
} 
   echo " Geburtstag!</span></td></tr>\n"; 
   echo "<tr><td colspan=4 class=row2><hr width=100% size=1></td></tr>\n"; 
} 
// END neima-MOD » 
############################################################################# 



############################################################################# 
##-----[ FIND ] 
if($check == 0) 


##-----[ REPLACE with ] 
if(($check == 0) AND ($birthsize < 1))   // neima-MOD » added $birthsize < 1 
############################################################################# 



############################################################################# 
##-----[ FIND ] 
function defaultview() 
{ 
   global $PHP_SELF, $phpbb_root_path, $phpEx, $dbhost, $dbuser, $dbpasswd, $dbname, $mysql_tablename, $action, $subjectlen, $cal_dem, 
      $board_config, $id, $day, $month, $year, $time, $userdata, $lang, $description, $subject, $calmod, $caluser, $daycolor, 
      $endday, $endmonth, $endyear, $usersuggest; 


##-----[ REPLACE with ] 
function defaultview() 
{ 
   // neima-MOD » added $table_prefix to global 

   global $PHP_SELF, $phpbb_root_path, $phpEx, $dbhost, $dbuser, $dbpasswd, $dbname, $mysql_tablename, $action, $subjectlen, $cal_dem, 
      $board_config, $id, $day, $month, $year, $time, $userdata, $lang, $description, $subject, $calmod, $caluser, $daycolor, 
      $endday, $endmonth, $endyear, $usersuggest, $table_prefix; 
############################################################################# 



############################################################################# 
##-----[ FIND ] 
$rowrow = 1; 


##-----[ add AFTER ] 
// START neima-MOD » get users having birthday this month 
$birthlist = array("tag"=>array(),"id"=>array(),"name"=>array()); 

$sql = "SELECT user_id, username, user_birthday FROM ".$table_prefix."users"; 
$result = mysql_query($sql); 
while($row = mysql_fetch_array($result)) { 
   if ($row[2]!=999999) { 
      $tag = realdate('d', $row[2]); 
      $monat = realdate('m', $row[2]); 
      if ($monat == $month) { 
   $birthlist['tag'][] = $tag; 
   $birthlist['id'][] = $row[0]; 
   $birthlist['name'][] = $row[1]; 
   $birthlist['jahr'][] = realdate('Y', $row[2]); 
      } 
   } 
} 
// END neima-MOD » 
############################################################################# 



############################################################################# 
##-----[ FIND ] 
$query2 = mysql_query("SELECT * FROM $mysql_tablename WHERE valid = 'yes' AND eventspan >= \"$year-$month-$thisday 00:00:00\" AND stamp <= \"$year-$month-$thisday 23:59:59\" ORDER BY stamp"); 


##-----[ add BEFORE ] 
// START neima-MOD » write down usernames for this day 
for ($ichzaehl=0; $ichzaehl<sizeof($birthlist['name']); $ichzaehl++) { 
   if ($showage == 'yes') {   $age = $year - $birthlist['jahr'][$ichzaehl]; 
            $age = ' ('. $age .')'; } 
   if ($birthlist['tag'][$ichzaehl] == $thisday) {echo "<a href=\"profile.php?mode=viewprofile&u=". $birthlist['id'][$ichzaehl] ."\" class=gensmall>". $birthlist['name'][$ichzaehl] . $age ."</a><br>"; } 
} 
// END neima-MOD » 
############################################################################# 



############################################################################# 
##-----[ FIND ] 
$query3 = mysql_query("SELECT * FROM $mysql_tablename WHERE valid = 'yes' AND eventspan >= \"$year-$month-$nextday 00:00:00\" AND stamp <= \"$year-$month-$nextday 23:59:59\" ORDER BY stamp"); 


##-----[ add BEFORE ] 
// START neima-MOD » write down usernames for this day 
for ($ichzaehl=0; $ichzaehl<sizeof($birthlist['name']); $ichzaehl++) { 
   if ($showage == 'yes') {   $age = $year - $birthlist['jahr'][$ichzaehl]; 
            $age = ' ('. $age .')'; } 
   if ($birthlist['tag'][$ichzaehl] == $nextday) { echo "<a href=\"profile.php?mode=viewprofile&u=". $birthlist['id'][$ichzaehl] ."\" class=gensmall>". $birthlist['name'][$ichzaehl] . $age ."</a><br>"; } 
} 
// END neima-MOD » 
############################################################################# 



############################################################################# 
##-----[ FIND ] --- (end of display-function) 
   echo "</center></table>"; 
   return; 
} 


##-----[ REPLACE with ] 
// START neima-MOD » create a month/year-jumparoundboxthing 
   echo "<form method=post action=$PHP_SELF>"; 
   echo "<table><tr><td><select name=month class=mainoption>"; 
   for ($zaehl=1;$zaehl<13;$zaehl++) { 
      echo "<option value=$zaehl"; 
      if ($zaehl == $month) { echo " SELECTED"; } 
      echo ">"; 
      echo $lang['months_long'][$zaehl-1]; 
      echo "</option>"; 
   } 
   echo "</select></td><td><input type=text name=year value=\"$year\" size=4></td>"; 
   echo "<td><input type=submit value=\"" . $lang['Cal_goto'] . "\" class=mainoption></td>\n"; 
   echo "</tr></table></form>"; 
// END neima-MOD » 

   echo "</center></table>"; 
   return; 
} 
############################################################################# 



############################################################################# 
##-----[ CLOSE AND SAVE FILE ] 
calendar.php 



############################################################################# 
##-----[ OPEN FILE ] --- (for every language you have installed) 
language/lang_XXX/lang_main.php 

############################################################################# 
##-----[ FIND ] 
?> 

##-----[ add BOFORE ] (German version --- English: "Call Month" or whatever you like) 
$lang['Cal_goto'] = "Monat aufrufen »"; 
############################################################################# 



############################################################################# 
##-----[ CLOSE AND SAVE FILE ] 
calendar.php 



----------------------------------------------------------------------------- 

############################################################################# 
## 
## That's it... Congrats :) 
## I hope it works... 
## 
############################################################################# 
Wobei da ein Fehler drin ist, es muß bei der einen Stelle heissen (das hat der Author auch vor längerer Zeit bestätigt):

Code: Alles auswählen

###find### 

   echo "</center></table>"; 
   return; 
} 

###REPLACE with### 

      // START neima-MOD » create a month/year-jumparoundboxthing 

   echo "<form method=post action=$PHP_SELF>"; 
   echo "<table><tr><td><select name=month class=mainoption>"; 
   for ($zaehl=1;$zaehl<13;$zaehl++) { 
      echo "<option value=$zaehl"; 
      if ($zaehl+1 == $month) { echo " SELECTED"; } 
      echo ">"; 
      switch ($zaehl) { 
      case 1 : 
         $monname = "January"; 
         break; 
      case 2 : 
         $monname = "February"; 
         break; 
      case 3 : 
         $monname = "March"; 
         break; 
      case 4 : 
         $monname = "April"; 
         break; 
      case 5 : 
         $monname = "May"; 
         break; 
      case 6 : 
         $monname = "June"; 
         break; 
      case 7 : 
         $monname = "July"; 
         break; 
      case 8 : 
         $monname = "August"; 
         break; 
      case 9 : 
         $monname = "September"; 
         break; 
      case 10 : 
         $monname = "October"; 
         break; 
      case 11 : 
         $monname = "November"; 
         break; 
      case 12 : 
         $monname = "December"; 
         break; 
      } 
      echo $lang['datetime'][$monname]; 
      echo "</option>"; 
   } 
   echo "</select></td><td><input type=text name=year value=\"$year\" size=4></td>"; 
   echo "<td><input type=submit value=\"" . $lang['Cal_goto'] . "\" class=mainoption></td>\n"; 
   echo "</tr></table></form>"; 
  
   echo "</center></table>"; 
   return; 
} 
// END neima-MOD » 
Und 2 Stellen habe auch ich gefunden die 100% nicht mehr korrekt sein können. Das sind die stellen wo mit...

Code: Alles auswählen

      global $PHP_SELF, $phpbb_root_path, $phpEx, $dbhost, $dbuser, $dbpasswd, $dbname, $mysql_tablename, $action, 
      $id, $day, $month, $year, $time, $userdata, $lang, $config_footer, $footer, $calmod, $caluser, 
      $endday, $endmonth, $endyear, $usersuggest, $board_config, $bbcode_uid, $table_prefix;
...und...

Code: Alles auswählen

   global $PHP_SELF, $phpbb_root_path, $phpEx, $dbhost, $dbuser, $dbpasswd, $dbname, $mysql_tablename, $action, $subjectlen, $cal_dem, 
      $board_config, $id, $day, $month, $year, $time, $userdata, $lang, $description, $subject, $calmod, $caluser, $daycolor, 
      $endday, $endmonth, $endyear, $usersuggest, $table_prefix;
ersetzt wird.


Kann hier jemand helfen und diesen Mod so machen das er das Alter der Leute die Geburtstag haben anzeigt und das vorallem man nur zu bestimmten Jahren springen kann und nicht zum Beispiel zum Jahre 0 *g*

Wer nicht weis was ich mit dem springen meine, ich habe den Mod bei mir installiert unter http://www.debytes-community.de/phpbb2/calendar.php (nicht weiter auf die Farben achten das liegt daran das ich bei mir sämtliche Styles geändert habe) dort kann man unten ein Jahr eingeben, leider jedes x-beliebige, es gibt keine Minimal und Maximal -sperre, obwohl der Code es eigentlich vorsieht. An einer Stelle wird das eingefügt (nur gehts nicht):

Code: Alles auswählen

if ($year < 1970) { $year = 1970; } 
if ($year > 2037) { $year = 2037; } 
Unter http://www.team-doof.de/calendar.php kann man den Kalender übrigens so laufen sehen, wie er funktionieren soll - nur weis ich nicht welche Version die dort vom Birthday Mod und vom Calender Mod installiert haben, ausserdem hat der Webmaster dort nicht auf meine Emailanfrage reagiert.

Verfasst: 10.12.2002 15:27
von Simpson
no one?

Wäre mir ganz besonders wichtig

Code: Alles auswählen

if ($year < 1970) { $year = 1970; } 
if ($year > 2037) { $year = 2037; } 
an die richtige Stelle zu bringen, um das man nicht mehr jedes Jahr aufrufen kann...

Alter ist gar nicht so wichtig, wäre zwar nett, aber wenn keiner weis, dann ists nicht drastisch...

Verfasst: 10.12.2002 21:26
von //-strongfield-
will ich auch!!!!!!



bitte :lol:


sinnloser Beitrag: Link entfernt von mad-manne

Verfasst: 10.12.2002 22:13
von Simpson
Den wichtigsten Teil habe ich (einfach ausprobiert :D )! Jetzt kann man nicht mehr jedes Datum eingeben, nur das mit dem Alter aus dem Geburtstag, da habe ich echt 0 Ahnung hoffe noch immer auf jemanden dem das klar ist was man verändern muß.

So und jetzt zum Fix für den Teil mit dem x-beliebigen Monats/Jahres Sprung....

öffne calender.php

suche:

Code: Alles auswählen

if ($mode == 'modify') { modify(); }
füge darüber ein:

Code: Alles auswählen

if ($year < 1970) { $year = 1970; } 
if ($year > 2037) { $year = 2037; } 

Verfasst: 13.12.2002 17:02
von Simpson
nobody knows?

Alter im Kalender anzeigen

Verfasst: 13.02.2003 15:00
von oxpus
Also ich habe bei mit eine Möglichkeit gefunden, das Alter der User im Kalender mit anzuzeigen und dabei gleich einen Fehler im Mod gefunden:

Code: Alles auswählen

############################################################################# 
##-----[ FIND ] 
$query2 = mysql_query("SELECT * FROM $mysql_tablename WHERE valid = 'yes' AND eventspan >= \"$year-$month-$thisday 00:00:00\" AND stamp <= \"$year-$month-$thisday 23:59:59\" ORDER BY stamp"); 


##-----[ add BEFORE ] 
// START neima-MOD » write down usernames for this day 
for ($ichzaehl=0; $ichzaehl<sizeof($birthlist['name']); $ichzaehl++) { 
   if ($showage == 'yes') {   $age = $year - $birthlist['jahr'][$ichzaehl]; 
            $age = ' ('. $age .')'; } 
   if ($birthlist['tag'][$ichzaehl] == $thisday) {echo "<a href=\"profile.php?mode=viewprofile&u=". $birthlist['id'][$ichzaehl] ."\" class=gensmall>". $birthlist['name'][$ichzaehl] . $age ."</a><br>"; } 
} 
// END neima-MOD » 
#############################################################################



############################################################################# 
##-----[ FIND ] 
$query3 = mysql_query("SELECT * FROM $mysql_tablename WHERE valid = 'yes' AND eventspan >= \"$year-$month-$nextday 00:00:00\" AND stamp <= \"$year-$month-$nextday 23:59:59\" ORDER BY stamp"); 


##-----[ add BEFORE ] 
// START neima-MOD » write down usernames for this day 
for ($ichzaehl=0; $ichzaehl<sizeof($birthlist['name']); $ichzaehl++) { 
   if ($showage == 'yes') {   $age = $year - $birthlist['jahr'][$ichzaehl]; 
            $age = ' ('. $age .')'; } 
   if ($birthlist['tag'][$ichzaehl] == $nextday) { echo "<a href=\"profile.php?mode=viewprofile&u=". $birthlist['id'][$ichzaehl] ."\" class=gensmall>". $birthlist['name'][$ichzaehl] . $age ."</a><br>"; } 
} 
// END neima-MOD » 
############################################################################# 
Hier ist bei

if ($showage == 'yes') {...

das doppelte == durch ein einfaches = zu ersetzen. Dann klappt auch die Einstellung mit $showage, d.h. das Alter wird im Kalender (je nach Einstellung) angezeigt.

Verfasst: 05.09.2006 21:28
von bazo
Hallo
Seh ich das richtig, oder trägt dieser Mod die bereits von den Usern eingetragenen Geburtstage (vom Geburtstagsmod, der auch im Profil angezeigt wird) in den Calender Lite Mod ein ?
Wenn es nicht das ist was ich suche...wo finde ich sowas?

bazo

Verfasst: 05.09.2006 22:17
von oxpus
Öh, wie ich sehe, hast Du die Suche benutzt, aber dieses Topic betrifft MOD-Versionen, die mehr als Steinzeit sind.
In der MOD-Datenbank hier findest Du aber auch die aktuelle Version des Kalender-Add-Ons.