[:"red"]WARNING: THERE ARE SOME ERRORS IN THE DOCUMENTATION FOR THIS HACK. YOU MAY WANT TO DELAY USING THIS HACK UNTIL THE ERRORS HAVE BEEN CORRECTED.[/]
Code
NAME: Calendar <br />VERSION: Dave_L.0.1 (temporary until someone decides what number this should be) <br />DESCRIPTION: Enables one or more forums to be used as event calendars. <br />WORKING UNDER: UBB.threads 6.2br2 <br />PREREQUISITES: none <br />AUTHORS: Gamejag, Max Fisch, Allen Ayers, Dave_L <br />CREDITS: JustDave, Lunatik and others <br />DEMO: none <br />FILES ALTERED: postlist.php, showthreaded.php (optional changes) <br />DATABASE ALTERED: yes <br />NEW FILES: addevent.php, newevent.php, postlist_event.php, <br /> templates/default/addevent_preview.tmpl, templates/default/newevent.tmpl, <br /> images/red_arrow.gif, images/red_arrow_1.gif <br /> <br />HISTORY: <br /> 2002-12-18 Dave_L Dave_L.0.0 <br /> Updated for UBB.threads 6.2 <br /> Use user's time zone offset and date/time format display preferences. <br /> Moved most of the postlist.php changes to a separate file postlist_event.php. <br /> Moved events table query in postlist_event.php out of loop for efficiency. <br /> 2002-12-18 Dave_L Dave_L.0.1 <br /> Corrected description above.
2) I didn't know what version this should be. Until someone else decides this, I temporarily numbered it "Dave_L.0.0".
3) As an experiment, I provided most of the change-instructions using BeyondCompare file-difference-report files.
-----------------------------
Updated to version Dave_L.0.1 - the only change was correcting the description above. I had copied the header info from another hack, and forgot to change it.
I don't have the hack installed on a public site. You might check the older calendar thread(s) to see if someone has a demo site. The 6.2 hack is basically the same as version 3.0.
You think you can tell me how to read a beyond compare difference report? I see nowhere in beyond compare to load it? I am missing something here. I can not read this to be able to install it.
LOL I know I figured that out after beating myself over the head for asking such a stupid question. Just had me all turned around with the beyond compare thing. I was looking for some special thing until I woke up and brought them up in the browser.
I was wondering... - Does this use any kind of cache. I read in the previous version that large boards may have problems with it. I have a reasonably large baord, so I'm concerned.
For the postlist, the number of queries was reduced by fetching all the events for a month with one query. The old version did a separate query for each day of the month.
Was there a way to populate the calendar with the Birthdates automatically? I thought I saw that somewhere, but I can't find it. Maybe it was never done?
From what I could see this should be the latest and the greatest version of this mod, so I closed the other thread that was open. Please correct me if I'm wrong, I don't use the mod myself so I haven't really followed the development of it.
I based the version I posted here on the latest version I could find in the other thread, so closing the other thread probably makes sense, now that 6.2 is released.
I hereby turn over maintenance of this hack to ... everyone.
The first task is to decide on a better version number.
I think this hack developed to be one of the "must-have"s for everyone. What a pity that this calender does not support language files yet. And for international versions it is essential to be able to - exchange AM/PM against a 24hrs display - switch to a display where Monday is 1st day of the week intstead of sunday.
Of course we could try to develope a German version from it (and discuss it on the German board), embedding the neccessary changes. The problem would be only that then two separate calendar hacks would be to maintain instead of only one, a situation that imho. should be avoided....
Also I want to draw your attention again to a wonderful hack that combines Josh's phantastic BIRTHDAY hack with this cool one: it is displaying all found birthdays automatically in the calendar. This hack is burried deep inside this thread: https://ubbdev.com/threads/php/...page=&view=&sb=5&o=&vc=1 Although I don't get it working with the new calendar hack, I think it is well worth not to be forgotten
Am I missing somthing i have had the hack installed for ages, but just went to upgrade to this version and the installation was fine but the addpost.php instructions seem all wrong, is this hack ok for 6.2 RC ?
I cant find this bit for instance: // ------------------------------------------------------------- // If HTML is off then we need to get rid of < and > in the body if ( ($convert != "html") && ($convert !="both") ) { $PrintBody = str_replace("<","<",$PrintBody); $PrintBody = str_replace(">",">",$PrintBody); } $html -> send_header($ubbt_lang['PREV_POST'],$Cat,0,$user,$Extra,$ReadPerm);
I have this which is near // ------------------------------------------------------------- // If HTML is off then we need to get rid of < and > in the body if ( ($convert != "html") && ($convert !="both") ) { $PrintBody = str_replace("<","<",$PrintBody); $PrintBody = str_replace(">",">",$PrintBody); } else { // No server side includes $PrintBody = preg_replace("/<!--(.|\n)*-->/","",$PrintBody); }
well, installed it, but it's not working! i dont get no calendar appearing, also no error messages to enable me to de-bug! ideas?? i probably buggered up on the editing of the files, because they didnt tally up, so i had to give it an educated guess!
I've started using this hack on my production board, and have decided it needs several changes. If I have time, I'd like to change it as follows:
1) Get rid of the E_Location column. Many events don't really have a "location", and it would be much easier to just use the thread title instead. This would also simplify the installation of the hack, since many of the changes are only needed to support the location column.
2) Get rid of the E_Time column. This is unnecessary, since the E_Date column contains both the date and time.
3) Get rid of the other unused columns: E_Duration, E_Recurring, E_Recurtype, E_End, E_Frequency, E_Days. They could always be added back in later if support for them were needed.
4) Add a column E_AdjustTime. If 1, the event date/time is adjusted according to the viewer's time zone offset. If 0, the event date/time is not adjusted. The former setting would be appropriate for online events, the latter for "physical" events.
5) Add support for editing the date/time of an event.
6) Add changes to showflat.php for displaying the event date/time.
7) Add dimopoulos's changes that use the Profile Birthdays modification to populate the birthdays automatically.
Any feedback on these changes?
------- Update:
I've revised the hack to effect all of the above changes except for 4, 5 and 7. (7 is a new item referred to in a post below.) I'm trying to figure out if 4 is feasible, and how much effort 5 will take. I've also updated the hack for UBB.threads 6.2.1, which should be released very soon. I'll try to get all this done, including fixing the documentation, within the next few days.
------- Update:
Due to time constraints, I'm abandoning work on this hack. With the above changes, it's gotten far too complicated, is incompatible with the current version, and maintaining it will be too much of a headache.
the location part is very important to me. because i run a car website, the calendar (will be, if i ever get it working) to post up dates and locations of meets throughout the country.
<br /> [:"blue"]$lowdate = mktime(0, 0, 0, $month, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of this month, time 00:00:00 <br /> $highdate = mktime(0, 0, 0, $month+1, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of next month, time 00:00:00 <br /> $birthMonth = mktime( 0, 0, 0, $month, 1, $year );[/] <br /> $Board_q = addslashes($Board); <br />
and CHANGE it to
Code
<br /> [:"blue"]$lowdate = mktime(0, 0, 0, $month, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of this month, time 00:00:00[/] <br /> [:"blue"]$highdate = mktime(0, 0, 0, $month+1, 1, $year) - <br /> $user['U_TimeOffset'] * 3600; // first day of next month, time 00:00:00[/] <br /> <br /> $events_for_month = array(); <br />// 20030113 - Birthday Update New Start <br /> // Construct the query to check for the birthday modification <br /> $strQuery = " <br /> SHOW FIELDS <br /> FROM {$config['tbprefix']}Users <br /> "; <br /> <br /> $result = $dbh -> do_query($strQuery); <br /> <br /> $intFieldsFound = 0; <br /> <br /> // Cycle through the fields and increase the counter where appropriate <br /> while ( $arrDataLine = $dbh -> fetch_array($result) ) <br /> { <br /> if ( $arrDataLine[0] == "U_BirthYear" ) { $intFieldsFound++; }; <br /> if ( $arrDataLine[0] == "U_BirthDay" ) { $intFieldsFound++; }; <br /> if ( $arrDataLine[0] == "U_BirthMonth" ) { $intFieldsFound++; }; <br /> <br /> // Exit the loop if all three fields have been found <br /> if ( $intFieldsFound == 3 ) <br /> { <br /> break; <br /> } <br /> } <br /> <br /> $dbh -> finish_sth($result); <br /> <br /> if ( $intFieldsFound == 3 ) <br /> { <br /> $query = " <br /> SELECT U_Username, U_Birthday, U_BirthYear, U_Number <br /> FROM {$config['tbprefix']}Users <br /> WHERE U_BirthMonth = FROM_UNIXTIME($birthMonth,'%b') <br /> ORDER BY U_Username <br /> "; <br /> $result = $dbh->do_query($query); <br /> while(list($bUsername, $bBirthday, $bBirthYear, $bNumber ) = $dbh->fetch_array($result)) <br /> { <br /> <br /> if ( $bBirthYear > 0 ) <br /> { <br /> $bAge = $year - $bBirthYear; <br /> $bExtra = " ($bAge)"; <br /> } <br /> else <br /> { <br /> $bExtra = ""; <br /> } <br /> <br /> $arrData['E_ID'] = 0; <br /> $arrData['E_Date'] = mktime(0, 0, 0, $month, $bBirthday, $year) - $user['U_TimeOffset'] * 3600; // first day of this month, time 00:00:00 <br /> $arrData['E_Time'] = 0; <br /> $arrData['E_Location'] = "Birthday"; <br /> $arrData['B_Subject'] = "<a href=\"$config[phpurl]/showprofile.php?Cat=$Cat&User=$bNumber&what=\">$bUsername$bExtra</a><br />"; <br /> $arrData['B_Number'] = 0; <br /> $arrData['B_Replies'] = 0; <br /> <br /> $date = getdate($arrData['E_Date'] + $user['U_TimeOffset'] * 3600); <br /> $mday = $date['mday']; <br /> <br /> if (empty($events_for_month[$mday])) <br /> { <br /> $events_for_month[$mday] = array(); <br /> } <br /> array_push($events_for_month[$mday], $arrData); <br /> } <br /> <br /> $dbh->finish_sth($result); <br /> } <br />// 20030113 - Birthday Update New End <br /> <br /> <br /> $Board_q = addslashes($Board); <br />
4. Find this:
Code
<br />// The second parameter MYSQL_ASSOC in the call to sql::to fetch_array() anticipates a <br />// requested change to that method, which will increase efficiency. Until that change <br />// is made, the parameter has no effect, but there's harm in leaving it there. <br /> <br /> $events_for_month = array(); <br /> while($row = $dbh->fetch_array($result, MYSQL_ASSOC)) { <br />
and CHANGE it to this
Code
<br />// The second parameter MYSQL_ASSOC in the call to sql::to fetch_array() anticipates a <br />// requested change to that method, which will increase efficiency. Until that change <br />// is made, the parameter has no effect, but there's harm in leaving it there. <br /> <br /> while($row = $dbh->fetch_array($result, MYSQL_ASSOC)) { <br />
NOTE: The code in [:"blue"]BLUE[/] is in ONE line only and has been split for aesthetic purposes only!
That should do the trick
Warm regards
Nikos
PS: Sorry that it took me so long to get this thing but I have been awfully busy lately
[b]Edit:[b] Fixed small bug with Age calculation when the Age was not set. Added code to check for the Profile Birthday modification and display the birthdays automatically on the calendar. If the modification has not been installed the paricular code will not execute 2002-02-03 - Change to show the correct birthdays for users with time offset
Attached is a custombox6pal.php file which you can use as a birthday pal. If you already use the 6th custom box in your IIP, change its number to something that you don't use.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.