From 0b55a7a70328f716dcf2d51c3c757b2b3f76f7a0 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 25 Oct 2011 00:32:28 -0700 Subject: [PATCH 1/8] only notify for events that are starting soon - ignore long-running events that are in progress --- boot.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 636062136c..45e02d1ed8 100644 --- a/boot.php +++ b/boot.php @@ -1046,11 +1046,10 @@ function get_events() { $bd_short = t('F d'); $r = q("SELECT `event`.* FROM `event` - WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `finish` > '%s' + WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' ORDER BY `start` DESC ", intval(local_user()), - dbesc(datetime_convert('UTC','UTC','now + 6 days')), - dbesc(datetime_convert('UTC','UTC','now')) + dbesc(datetime_convert('UTC','UTC','now + 6 days')) ); if($r && count($r)) { From 323a7e4c9c96ae2101dacf2f6c06197bd83fbecf Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 25 Oct 2011 00:36:23 -0700 Subject: [PATCH 2/8] need a lower bound for events --- boot.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 45e02d1ed8..32ed3e40a3 100644 --- a/boot.php +++ b/boot.php @@ -1046,10 +1046,11 @@ function get_events() { $bd_short = t('F d'); $r = q("SELECT `event`.* FROM `event` - WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' + WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` > '%s' ORDER BY `start` DESC ", intval(local_user()), - dbesc(datetime_convert('UTC','UTC','now + 6 days')) + dbesc(datetime_convert('UTC','UTC','now + 6 days')), + dbesc(datetime_convert('UTC','UTC','now - 1 days')) ); if($r && count($r)) { From 1d325f6e76bea72b81eb6706e59acd1f9cb7c827 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 25 Oct 2011 00:38:43 -0700 Subject: [PATCH 3/8] change event display order --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 32ed3e40a3..cb4ccb6d81 100644 --- a/boot.php +++ b/boot.php @@ -989,7 +989,7 @@ function get_birthdays() { $r = q("SELECT `event`.*, `event`.`id` AS `eid`, `contact`.* FROM `event` LEFT JOIN `contact` ON `contact`.`id` = `event`.`cid` WHERE `event`.`uid` = %d AND `type` = 'birthday' AND `start` < '%s' AND `finish` > '%s' - ORDER BY `start` DESC ", + ORDER BY `start` ASC ", intval(local_user()), dbesc(datetime_convert('UTC','UTC','now + 6 days')), dbesc(datetime_convert('UTC','UTC','now')) @@ -1047,7 +1047,7 @@ function get_events() { $r = q("SELECT `event`.* FROM `event` WHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` > '%s' - ORDER BY `start` DESC ", + ORDER BY `start` ASC ", intval(local_user()), dbesc(datetime_convert('UTC','UTC','now + 6 days')), dbesc(datetime_convert('UTC','UTC','now - 1 days')) From 52038c6b8812ea6eeac4dc3fdfc0f7315b4ecd72 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 25 Oct 2011 15:36:49 -0700 Subject: [PATCH 4/8] event notification stuff --- boot.php | 34 +++++++++++++++++++++++-------- view/theme/duepuntozero/style.css | 13 ++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/boot.php b/boot.php index cb4ccb6d81..b60411625a 100644 --- a/boot.php +++ b/boot.php @@ -9,7 +9,7 @@ require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1144' ); +define ( 'FRIENDIKA_VERSION', '2.3.1145' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1098 ); @@ -997,20 +997,23 @@ function get_birthdays() { if($r && count($r)) { $total = 0; - foreach($r as $rr) + $now = strtotime('now'); + $istoday = false; + foreach($r as $rr) { if(strlen($rr['name'])) $total ++; - + if((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) + $istoday = true; + } + $classtoday = $istoday ? ' birthday-today ' : ''; if($total) { - $o .= ''; + $o .= '
' . t('Birthday Reminders') . ' ' . '(' . $total . ')' . '
'; $o .= '