 |
 |
 |
 |
#229473 - 12/18/02 03:44 PM
Calendar - 6.2
|
Addict
Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
|
[:"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.[/] <br /> <br /> 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. <br /> <br />----------------------------- <br /> <br />Notes: <br /> <br />1) This was based on the version of the Calendar hack in this post: http://www.threadsdev.com/threads/php/showthreaded.php?Cat=&Board=beta&Number=53193 <br /> <br />2) I didn't know what version this should be. Until someone else decides this, I temporarily numbered it "Dave_L.0.0". <br /> <br />3) As an experiment, I provided most of the change-instructions using BeyondCompare file-difference-report files. <br /> <br />----------------------------- <br /> <br />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.
Attachments
62190-calendar-Dave_L-0-1.zip (160 downloads)
Edited by Dave_L (01/15/03 12:34 PM)
_________________________
UBB.threads beta tester / threadsdev.com moderator Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229492 - 01/07/03 02:42 PM
Re: Calendar - 6.2
[Re: joeuser]
|
Member
Registered: 09/08/01
Posts: 157
Loc: Kent, UK.
|
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 ?<br /><br />I cant find this bit for instance:<br />// ------------------------------------------------------------- <br />// If HTML is off then we need to get rid of < and > in the body <br /> if ( ($convert != "html") && ($convert !="both") ) { <br /> $PrintBody = str_replace("<","<",$PrintBody); <br /> $PrintBody = str_replace(">",">",$PrintBody); <br /> } <br /> $html -> send_header($ubbt_lang['PREV_POST'],$Cat,0,$user,$Extra,$ReadPerm); <br /><br /> <br /> $FormSubject = $html -> form_encode($FormSubject); <br /> $FormBody = $html -> form_encode($FormBody); <br /> $FormSubject = str_replace("&","&",$FormSubject); <br /> $FormBody = str_replace("&","&",$FormBody); <br /> $formLocation = $html -> form_encode($formLocation); <br /> $formLocation = str_replace("&","&",$formLocation); <br />
_________________________
Regards Clint
Running on WIN2003 Web Server.
Paranoid people get followed too!
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229498 - 01/11/03 09:48 AM
Re: Calendar - 6.2
[Re: joeuser]
|
Addict
Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
|
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: <br /> <br />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. <br /> <br />2) Get rid of the E_Time column. This is unnecessary, since the E_Date column contains both the date and time. <br /> <br />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. <br /> <br />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. <br /> <br />5) Add support for editing the date/time of an event. <br /> <br />6) Add changes to showflat.php for displaying the event date/time. <br /> <br />7) Add dimopoulos's changes that use the Profile Birthdays modification to populate the birthdays automatically. <br /> <br />Any feedback on these changes? <br /> <br />------- <br />Update: <br /> <br />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. <br /> <br />------- <br />Update: <br /> <br />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. <img src="/forum/images/graemlins/frown.gif" alt="" />
Edited by Dave_L (01/28/03 05:57 PM)
_________________________
UBB.threads beta tester / threadsdev.com moderator Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229504 - 01/13/03 09:08 AM
Re: Calendar - 6.2
[Re: Daine]
|
Kahuna
Registered: 08/18/02
Posts: 1271
Loc: Vienna, Austria
|
Josh and Mike <br /> <br />Below the update for the Calendar 6.2 modification which uses the Profile Birthdays modification to populate the birthdays automatically. <br /> <br /> Files altered: postlist_event.php <br /> <br />1. Find <br /> <br /> if ($resp > 0) <br /> { <br /> if ($tm == '0') <br /> { <br /> [:"blue"]$Evnt = "<a href=\"$config[phpurl]/$mode.php? <br /> Cat=$Cat&amp;Board=$Board&amp;Number=$Number&amp;view=$view <br /> &amp;sb=$sb&amp;o=$o&amp;mon=$mon&amp;year=$year&amp;cs=$cs\"> <br /> $Location:<br />$Subject</a>, ($resp responses)";[/] <br /> } <br /> else <br /> { <br /> $tm = strtotime($html -> convert_time($tm, $user['U_TimeOffset'])); <br /> $h = strtolower(strftime ("%I", $tm)); <br /> $m = strtolower(strftime ("%M", $tm)); <br /> $mer = strtolower(strftime ("%p", $tm)); <br /> [:"blue"]$Evnt = "<a href=\"$config[phpurl]/$mode.php?Cat=$Cat&amp; <br /> Board=$Board&amp;Number=$Number&amp;view=$view&amp;sb=$sb&amp; <br /> o=$o&amp;mon=$mon&amp;year=$year&amp;cs=$cs\"> <br /> $Location, $h:$m $mer:<br /> $Subject</a>, ($resp responses)";[/] <br /> } <br /> } <br /> else <br /> { <br /> if ($tm == '0') <br /> { <br /> [:"blue"]$Evnt = "<a href=\"$config[phpurl]/$mode.php?Cat=$Cat&amp;Board=$Board <br /> &amp;Number=$Number&amp;view=$view&amp;sb=$sb&amp;o=$o&amp;mon=$mon <br /> &amp;year=$year&amp;cs=$cs\">$Location:<br />$Subject</a>";[/][/] <br /> } <br /> <br />Change it to <br /> <br /> if ($resp > 0) <br /> { <br /> if ($tm == '0') <br /> { <br /> [:"blue"]$Evnt = "<a href=\"$config[phpurl]/$mode.php?Cat=$Cat&amp;Board=$Board <br /> &amp;Number=$Number&amp;view=$view&amp;sb=$sb&amp;o=$o&amp;mon=$mon <br /> &amp;year=$year&amp;cs=$cs\">$Location:<br />$Subject</a>, ($resp responses)";[/] <br /> } <br /> else <br /> { <br /> $tm = strtotime($html -> convert_time($tm, $user['U_TimeOffset'])); <br /> $h = strtolower(strftime ("%I", $tm)); <br /> $m = strtolower(strftime ("%M", $tm)); <br /> $mer = strtolower(strftime ("%p", $tm)); <br /> [:"blue"]$Evnt = "<a href=\"$config[phpurl]/$mode.php?Cat=$Cat&amp;Board=$Board <br /> &amp;Number=$Number&amp;view=$view&amp;sb=$sb&amp;o=$o&amp;mon=$mon <br /> &amp;year=$year&amp;cs=$cs\">$Location, $h:$m $mer: <br /> <br /> $Subject</a>, ($resp responses)";[/] <br /> } <br /> } <br /> else <br /> { <br /> if ($tm == '0') <br /> { <br />// 20030113 - Birthday Update New Start <br /> if ( $Location == "Birthday" ) <br /> { <br /> $Evnt = $Subject; <br /> } <br /> else <br /> { <br />// 20030113 - Birthday Update New End <br /> [:"blue"]$Evnt = "<a href=\"$config[phpurl]/$mode.php?Cat=$Cat&amp; <br /> Board=$Board&amp;Number=$Number&amp;view=$view&amp;sb=$sb&amp; <br /> o=$o&amp;mon=$mon&amp;year=$year&amp;cs=$cs\"> <br /> $Location:<br />$Subject</a>";[/] <br />// 20030113 - Birthday Update New Start <br /> } <br />// 20030113 - Birthday Update New End <br /> } <br /> <br /> <br />2. Find <br /> <br /> // draw horizontal bar before each event except the first <br /> if ( !$first_event_for_day ) <br /> { <br /> $events .= "<hr width=95% align=\"center\" />"; <br /> } <br /> <br /> $events .= "<font color=\"red\"><b>&rsaquo;&rsaquo;&rsaquo;</b></font> $Evnt<br />"; <br /> <br />and CHANGE it to <br /> <br /> // draw horizontal bar before each event except the first <br />// 20030113 - Birthday Update Old Start <br />// if ( !$first_event_for_day ) <br />// 20030113 - Birthday Update Old End <br />// 20030113 - Birthday Update New Start <br /> if ( (!$first_event_for_day) and ($Location <> "Birthday") ) <br />// 20030113 - Birthday Update New End <br /> { <br /> $events .= "<hr width=95% align=\"center\" />"; <br /> } <br /> <br />// 20030113 - Birthday Update New Start <br /> if ( $Location == "Birthday" ) <br /> { <br /> $events .= "<font color=\"blue\"><b>&rsaquo;</b></font> $Evnt<br />"; <br /> } <br /> else <br /> { <br />// 20030113 - Birthday Update New End <br /> $events .= "<font color=\"red\"><b>&rsaquo;</b></font> $Evnt<br />"; <br />// 20030113 - Birthday Update New Start <br /> } <br />// 20030113 - Birthday Update New End <br /> <br /> <br />3. Find (function get_events_for_month($month, $year)) <br /> <br /> <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 /> <br />and CHANGE it to <br /> <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&amp;User=$bNumber&amp;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 /> <br /> <br />4. Find this: <br /> <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 /> <br />and CHANGE it to this <br /> <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 /> <br /> <br /> NOTE: The code in [:"blue"]BLUE[/] is in ONE line only and has been split for aesthetic purposes only! <br /> <br />That should do the trick <img src="/forum/images/graemlins/wink.gif" alt="" /> <br /> <br />Warm regards <br /> <br />Nikos <br /> <br />PS: Sorry that it took me so long to get this thing but I have been awfully busy lately <img src="/forum/images/graemlins/tongue.gif" alt="" /> <br /> <br />[b]Edit:[b] <br />Fixed small bug with Age calculation when the Age was not set. <br />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 <br />2002-02-03 - Change to show the correct birthdays for users with time offset <br />
Edited by dimopoulos (02/03/03 04:00 AM)
_________________________
Nikos
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229563 - 02/11/03 09:47 AM
Re: Calendar - 6.2
[Re: sjsaunders]
|
Addict
Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
|
I had implemented most of the changes I had talked about, including getting rid of the extra time column, and replacing it with a flag indicating whether the time-of-day should be displayed, or only the date. <br /> <br />One problem with these changes is that they would not be downward-compatible with the current version of this hack, so an "altertable" would be needed. <br /> <br />I had started to add editing capability. It involved changes to a bunch of files (several scripts and several templates). Keeping all of these files up to date when doing version upgrades would have been a big headache. <br /> <br />And then there was the birthdate modification to this hack. <br /> <br />These problems, combined with the fact that I was getting behind on other work, are why I had to abandon work on this hack. <br /> <br />Nikko, if you want, I could give you the changed files, although the changes are incomplete, and they're not fully tested or documented. <br /> <br />I'm wondering if it would be better to make the calendar a separate add-on, rather than a hacked forum.
_________________________
UBB.threads beta tester / threadsdev.com moderator Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#229571 - 03/24/03 04:37 AM
Re: Calendar - 6.2
[Re: edr]
|
Member
Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
|
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|