[ABD] phpBB Calendar 0.1.1 (alightner)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
jcpren
Registered User
Posts: 18
Joined: Mon Apr 17, 2006 3:11 pm

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by jcpren » Mon Mar 22, 2010 3:26 pm

keith10456 wrote:
novanilla wrote:The more I see people struggle with Automod, the deeper I dig my feet in and swear I'll never use it, LOL.

That stuff scares me. :shock:
It's useful for beginners... But once you get some experience with mods or have a heavily modded board, file edits by hand is probably the way to go.
I can code in PHP and feel comfortable with the concept of making changes. But, in my experience, the probability of AutoMod making a mistake is still less than the probability of me making a mistake... hence I use AutoMod! ;)

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by MartectX » Tue Mar 23, 2010 8:11 pm

Martin Day wrote:I have tried applying the fixes that MartectX suggested but as he points out they were originally crafted when Automatic DST was still at v1.0.6 and Calendar was at v0.8.0 and indeed they have thrown up errors:
  • [phpBB Debug] PHP Notice: in file /includes/functions.php on line 4254: Cannot modify header information - headers already sent by (output started at /includes/functions_calendar.php:1)
    [phpBB Debug] PHP Notice: in file /includes/functions.php on line 4256: Cannot modify header information - headers already sent by (output started at /includes/functions_calendar.php:1)
    [phpBB Debug] PHP Notice: in file /includes/functions.php on line 4257: Cannot modify header information - headers already sent by (output started at /includes/functions_calendar.php:1)
    [phpBB Debug] PHP Notice: in file /includes/functions.php on line 4258: Cannot modify header information - headers already sent by (output started at /includes/functions_calendar.php:1)

and the original symptoms persist.
That error is typical for accidental characters (or any free space) before <?php in a file (in your example functions_calendar.php).

I installed Automatic DST and Calendar and applied this and this and dates are working like a charm. There's still a problem with editing events (hours are off in edit mode) but that's as far as I'll go today. Maybe I'll have another look at the weekend.

EDIT: After having applied these changes to calendarpost.php edits work neatly again.

WuTang
Registered User
Posts: 10
Joined: Sat Oct 25, 2008 11:32 pm

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by WuTang » Tue Mar 23, 2010 9:52 pm

alightner, I've got a feature request for the next version. Could you please add the ability to show the rsvp counts as a column on the "forum index event overview"? :)

User avatar
Martin Day
Registered User
Posts: 59
Joined: Fri Nov 28, 2008 8:39 pm
Location: Woking, UK
Contact:

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by Martin Day » Tue Mar 23, 2010 10:13 pm

MartectX wrote:That error is typical for accidental characters (or any free space) before <?php in a file (in your example functions_calendar.php).

I installed Automatic DST and Calendar and applied this and this and dates are working like a charm. There's still a problem with editing events (hours are off in edit mode) but that's as far as I'll go today. Maybe I'll have another look at the weekend.

EDIT: After having applied these changes to calendarpost.php edits work neatly again.
Top work MartectX,

- But first I should apologise for leaning on the space bar whilst editing functions_calendar.php (a real gaff, I realise :oops: )

I have applied your suggested changes (for note some are duplicated in the separate instruction sets) and I can't see the error that you mentioned: "with editing events (hours are off in edit mode)" for single events. I have noticed that the problem still exists in recurring events. All those occurring before DST are fine but those that occur after DST are an hour ahead. However the edit time and display time of these individual occurrences are now consistent. So it's looking very close, now.

Thanks for all your efforts.
Martin

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by MartectX » Wed Mar 24, 2010 7:51 am

Martin Day wrote:I have noticed that the problem still exists in recurring events. All those occurring before DST are fine but those that occur after DST are an hour ahead. However the edit time and display time of these individual occurrences are now consistent. So it's looking very close, now.
I have an idea for these recurring events: In the calendar_recurring_events table there are two fields we can use: One is first_occ_time and one is poster_dst.
  • first_occ_time = first time this recurring event occurs (timestamp)
  • poster_dst = is this "first time" during a period where the creating user experiences DST? (true/false)
Here is some pseudo-code for saving a recurring event (I did not check the actual code, mind you, so this may be what's already in there):

Code: Select all

$first_occ_time = gmmktime(<first_time_here>);
$poster_dst = date('I', $first_occ_time);
And here is some code for displaying events:

Code: Select all

switch ($event['poster_dst'])
{
case '0':
  if (date('I', <recurring_date_to_be_displayed>))
  {
    -1 hour
  }
  break;

case '1':
  if (!date('I', <recurring_date_to_be_displayed>))
  {
    +1 hour
  }
}
TO DO: date('I', <recurring_date_to_be_displayed>) has to be checked for the creating user's time zone (which is saved in the calendar_recurring_events table as poster_timezone* luckily for us!). This can be done with PHP > 5.2.0 only - so there's a problem.


*This would then need to be changed to (when saving an event):

Code: Select all

$poster_timezone = AUTOMATIC_DST_TIMEZONE;

WuTang
Registered User
Posts: 10
Joined: Sat Oct 25, 2008 11:32 pm

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by WuTang » Wed Mar 24, 2010 5:27 pm

I also found a little bug, thanks to Google Bot indexing the next 1000 years of my forums calendar ;)

Starting with 20. January 2038 the calendar begins to show up some all-day events from the past. Take a look yourself: http://www.aachener-lair.de/forum/calen ... &calY=2038

GeorgeI
Registered User
Posts: 1
Joined: Thu Mar 25, 2010 12:49 pm

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by GeorgeI » Thu Mar 25, 2010 12:56 pm

Forgive me if this has been answered before.
First of all thanks for a great mod. It looks like it is just what I need.

I've installed this and all seems to be working OK apart from one thing. In the ucp, the options for changing the "How many days into the future do you want to display? " values do not appear to be working. Although the values change when you click the Submit button, when you return to the same page the default value of 7 is restored.
The demo board seems to do the same thing as well.
I've looked for the code that updates the database with these values but I can't find it anywere in the mods. In fact which values in the database should be changed by these?
Am I missing something?

Edit:
Yes I think I am. I don't think these two values in the ucp are supposed to be "saved". They just change the parameters for the list that is displayed below.

alightner
Registered User
Posts: 1118
Joined: Fri Mar 23, 2007 12:42 pm

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by alightner » Thu Mar 25, 2010 1:49 pm

WuTang wrote:I also found a little bug, thanks to Google Bot indexing the next 1000 years of my forums calendar ;)

Starting with 20. January 2038 the calendar begins to show up some all-day events from the past. Take a look yourself: http://www.aachener-lair.de/forum/calen ... &calY=2038
You must have a manual edit somewhere in your installation that I don't have with the OOTB version of the calendar... I can't reproduce it on the demo forum. Rest assured there are many all day events in the demo forum, so it would be obvious if that happened in the demo, and I even added a new all day event to double check. In your forum on January 20, 2038 the same all day events show up on every day into the future... if you click on the month view for february 2038, each day has those old all day events displayed, same in february 2040, and march 2040, june 2040, january 2050... it goes on for every day into infinity.

Now look at the demo calendar: jan 2038 - nothing, feb 2045 still nothing.

I'm not sure what's different on your forum, but if I can't reproduce it, I can't debug it... double check the code in function calendar_display_month() in includes/functions_calendar.php and look for the following section:

Code: Select all

		if ( $user_can_view_events )
		{
			//find any events on this day
			$start_temp_date = gmmktime(0,0,0,$date['month_no'], $j, $date['year'])  - $user->timezone - $user->dst;
			$end_temp_date = $start_temp_date + 86399;

			if( $disp_events_only_on_start == 0 )
			{

				$sql = 'SELECT * FROM ' . CALENDAR_EVENTS_TABLE . '
						WHERE ( (event_access_level = 2) OR
							(poster_id = '.$db->sql_escape($user->data['user_id']).' ) OR
							(event_access_level = 1 AND ('.$group_options.') ) ) '.$etype_options.' AND
						((( event_start_time >= '.$db->sql_escape($start_temp_date).' AND event_start_time <= '.$db->sql_escape($end_temp_date).' ) OR
						 ( event_end_time > '.$db->sql_escape($start_temp_date).' AND event_end_time <= '.$db->sql_escape($end_temp_date).' ) OR
						 ( event_start_time < '.$db->sql_escape($start_temp_date).' AND event_end_time > '.$db->sql_escape($end_temp_date)." )) OR
						 ((event_all_day = 1) AND (event_day LIKE '" . $db->sql_escape(sprintf('%2d-%2d-%4d', $j, $date['month_no'], $date['year'])) . "'))) ORDER BY event_start_time ASC";
			}
			else
			{

				$sql = 'SELECT * FROM ' . CALENDAR_EVENTS_TABLE . '
						WHERE ( (event_access_level = 2) OR
							(poster_id = '.$db->sql_escape($user->data['user_id']).' ) OR
							(event_access_level = 1 AND ('.$group_options.') ) ) '.$etype_options.' AND
							(( event_start_time >= '.$db->sql_escape($start_temp_date).' AND event_start_time <= '.$db->sql_escape($end_temp_date)." ) OR
							((event_all_day = 1) AND (event_day LIKE '" . $db->sql_escape(sprintf('%2d-%2d-%4d', $j, $date['month_no'], $date['year'])) . "'))) ORDER BY event_start_time ASC";

			}
Something in your installation is causing it to pick up a lot more during that sql query of the CALENDAR_EVENTS_TABLE then it should. Also you'll have to fix whatever's different in your install for all the different views - week, day, etc.
My phpbb3 mods:
Calendar
User Attachment Quota
Do not PM me with questions about my mods.
Support will only be given through the topic threads above.

blauferron
Registered User
Posts: 4
Joined: Thu Mar 25, 2010 8:59 pm
Name: Bone A Ferron

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by blauferron » Thu Mar 25, 2010 9:06 pm

Hi,

i am trying to install this very nice mod with a prosilver based style (proFormell) and i wondered if anyone would point my to the code where i can change the colors of the sunday til saturday header of the calendar?
Furthermore everything seems to work just fine with the exception of all the icons. Do i have to change them for the use with the other style?

thank you for your help :)

User avatar
Martin Day
Registered User
Posts: 59
Joined: Fri Nov 28, 2008 8:39 pm
Location: Woking, UK
Contact:

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by Martin Day » Fri Mar 26, 2010 10:38 am

MartectX wrote:Here is some pseudo-code for saving a recurring event (I did not check the actual code, mind you, so this may be what's already in there):...
MartectX, I realise you have put considerable effort into this issue already, but I don't feel equipped to take your thoughts on this further myself. Is there any chance you could turn your pseudo code into real code?

If you don't have a board with both these mods in place any more - I would be quite happy to give you access to my test board...?
Last edited by Martin Day on Wed Mar 31, 2010 3:36 pm, edited 1 time in total.
Martin

User avatar
trickoff
Registered User
Posts: 513
Joined: Mon Jan 07, 2008 12:23 am

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by trickoff » Fri Mar 26, 2010 11:57 am

Thanks for a great mod alightner!

Would it be possible to add an option for uploading an event poster/picture when creating/editing an event :roll:

That would be really sweet!

Thanks again

User avatar
MartectX
Translator
Posts: 1324
Joined: Wed Dec 19, 2007 8:05 pm
Location: Marienplatz

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by MartectX » Fri Mar 26, 2010 3:07 pm

Martin Day wrote:MartectX, I realise you have put considerable effort into this issue already, but I don't feel equipped to take your thoughts on this further myself. Is there any chance you could turn your pseudo code into real code?
I'm helping my grandparents move these days, but I think I may have some time in about a week from now. I'll let you know when I come up with something - I won't forget about this.

terryrayc
Registered User
Posts: 2
Joined: Thu Apr 01, 2010 1:54 am

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by terryrayc » Thu Apr 01, 2010 2:31 am

I've got the mod installed and it seems fine, except the colors are VERY hard to see. However when I enter the UCP to add an event all I see is the

How many days into the future do you want to display? 7 SUBMIT

line and nothing else.

WuTang
Registered User
Posts: 10
Joined: Sat Oct 25, 2008 11:32 pm

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by WuTang » Thu Apr 01, 2010 3:13 am

loki980 wrote:I apologize for the crazy code, but here's a simple page to output all your events in iCal format. It is a completely standalone page and is just a quick hack to get it working. If you want to incorporate it into the plugin, great. I know others have been looking for this feature, though, so I figured I'd post it here.

Look carefully at the portion after "BEGIN:VCALENDAR". Replace the generic content with whatever you like.

This is probably really ugly (see the if 1 statement?), and it does not have permission protection (EVERYTHING is public), but it doesn't matter for my site. *shrug*
I reworked your script so that it now uses correct time formats (DST and timezones), replaces bbcodes and links, and checks the user rights (very simple version, you have to be logged in to view the private/group events - some might not show up though, dunno why!). I still have a problem displaying umlauts when using the calendar with Google calendar, help appreciated!

Here is my version:

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: index.php 9614 2009-06-18 11:04:54Z nickvergessen $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/* Configuration */
$calendar_name = "My iCalendar"; // default name for calendar
$local_timezone = "Europe/Berlin"; // timezone, e.g. "Europe/London" or "US/Pacific"
$minus = 1; // count of years to show events in the past
$plus = 2; // count of years to show events in the future

/* Functions */
function remove_bbcode($s)
{
  $s = preg_replace('/\n/','\\n',$s);
  $s = preg_replace('/\[b\:([a-z0-9]{8})\](.*)\[\/b\:\1\]/Usi','*\\2*',$s);
  $s = preg_replace('/\[i\:([a-z0-9]{8})\](.*)\[\/i\:\1\]/Usi','_\\2_',$s);
  $s = preg_replace('/\[u\:([a-z0-9]{8})\](.*)\[\/u\:\1\]/Usi','"\\2"',$s);
  $s = preg_replace('/\[url=(.*)\:([a-z0-9]{8})\](.*)\[\/url\:\2\]/Usi','\\3 [\\1]',$s);
  $s = preg_replace('/\[url\:([a-z0-9]{8})\](.*)\[\/url\:\1\]/Usi','[\\2]',$s);
  $s = preg_replace('/\<\!\-\- m \-\-\>\<a class="postlink" href="(.*)"\>\1\<\/a\>\<\!\-\- m \-\-\>/Usi','\\1',$s);
  $s = preg_replace('/\<\!\-\- l \-\-\>\<a class="postlink-local" href="(.*)(.*)"\>\2\<\/a\>\<\!\-\- l \-\-\>/Usi','\\1\\2',$s);
  $s = preg_replace('/\[img\:([a-z0-9]{8})\](.*)\[\/img\:\1?\]/Usi','[\\2]',$s);
  $s = preg_replace('/\<\!\-\- .* \-\-\>\<img src=".*" alt="(.*)" title=".*" \/\>\<\!\-\- .* \-\-\>/Usi','\\1',$s);
  $s = preg_replace('/\[[\/]?(.*)\:[a-z0-9]{8}\]/Usi','[\\1]',$s);
	return $s;
}

/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_calendar.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

global $auth, $db, $user, $config, $template, $date, $available_etype_colors, $available_etype_images, $available_etype_display_names, $month_sel_code, $day_sel_code, $year_sel_code, $mode_sel_code;

global $phpEx, $phpbb_root_path;

$etype_url_opts = get_etype_url_opts();

// Is the user able to view ANY events?
$user_can_view_events = false;
if ( $auth->acl_get('u_calendar_view_events') )
{
   $user_can_view_events = true;
   init_calendar_data();
   $group_options = get_sql_group_options($user->data['user_id']);
   $etype_options = get_etype_filter();

   date_default_timezone_set($local_timezone);
	 $now = time();
	 $start_temp_date = $now - $minus*31536000;
	 $end_temp_date = $now + $plus*31536000;
   // find all day events that are still taking place
	 $sort_timestamp_cutoff = $start_temp_date - 86400+1;

   $sql = 'SELECT * FROM ' . CALENDAR_EVENTS_TABLE . '
         WHERE ( (event_access_level = 2) OR
            (poster_id = '.$db->sql_escape($user->data['user_id']).' ) OR
            (event_access_level = 1 AND ('.$group_options.') ) ) '.$etype_options.' AND
         ((( event_start_time >= '.$db->sql_escape($start_temp_date).' AND event_start_time <= '.$db->sql_escape($end_temp_date).' ) OR
          ( event_end_time > '.$db->sql_escape($start_temp_date).' AND event_end_time <= '.$db->sql_escape($end_temp_date).' ) OR
          ( event_start_time < '.$db->sql_escape($start_temp_date).' AND event_end_time > '.$db->sql_escape($end_temp_date)." )) OR (sort_timestamp > ".$db->sql_escape($sort_timestamp_cutoff)." AND event_all_day = 1) ) ORDER BY sort_timestamp ASC";
   $result = $db->sql_query($sql);

header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=myCal.ics");
print <<<END
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//site/product//NONSGML v1.0//EN
X-WR-CALNAME:$calendar_name
X-WR-TIMEZONE:$local_timezone
END;

  while($row = $db->sql_fetchrow($result)) {
      print "\nBEGIN:VEVENT";
      print "\nDESCRIPTION:".remove_bbcode(html_entity_decode($row['event_body']))."\\n";
      print "\\n"."RSVP: ".$row['rsvp_yes']."/".$row['rsvp_maybe']."/".$row['rsvp_no']." (y/m/n)\n";
      print "DTSTART:".gmdate("Ymd\THi00", $row['event_start_time'] - $user->dst)."Z\n";
      print "DTEND:".gmdate("Ymd\THi00", $row['event_end_time'] - $user->dst)."Z\n";
      print "SUMMARY:".$available_etype_display_names[$row['etype_id']].": ".html_entity_decode($row['event_subject'])."\n";
      print "URL:".generate_board_url()."/calendar.$phpEx?view=event&calEid=".$row['event_id']."\n";
      print "END:VEVENT\n";
   }
   $db->sql_freeresult($result);
}
?>
END:VCALENDAR
Save it as a file called ical.php (or else) and upload it to your phpbb root directory. You can now link to it from your calendar application, even abonnements are possible.

anir dendroica
Registered User
Posts: 3
Joined: Fri Mar 05, 2010 9:08 am

Re: [Beta] phpBB Calendar 0.1.0 (alightner)

Post by anir dendroica » Fri Apr 02, 2010 1:19 am

Great mod!!!

Despite the warnings against it, I have it running on a live board with no bugs noticed so far. Installation worked on the first try - lots of edits but very clear instructions, and I added a few edits of my own to display it on my portal instead of on the index page.

I'm a fan of the ability to differentiate events with different colors and to create recurring events following just about every pattern imaginable. It would be cool to be able to upload avatar-sized images that display alongside events, but I like it well enough as is.

Thanks for all of the work alightner, and I encourage the MOD database managers to validate this mod ASAP so that more folks will take advantage of it. It's been in development long enough (223 pages!!?).

Mark

Locked

Return to “[3.0.x] Abandoned MODs”

Who is online

Users browsing this forum: No registered users and 8 guests