Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

expanded the =bday syntax to have =bday+,=bday-,=bday=m/d

  • Loading branch information...
commit b13a7b728a45a6b69522c337d4ae72d04148d72c 1 parent 5f2b0c1
@dtompkins authored
Showing with 28 additions and 6 deletions.
  1. +28 −6 fbcmd.php
View
34 fbcmd.php
@@ -53,7 +53,7 @@
// //
////////////////////////////////////////////////////////////////////////////////
- $fbcmdVersion = '1.0-beta3-dev14';
+ $fbcmdVersion = '1.0-beta3-dev15';
////////////////////////////////////////////////////////////////////////////////
@@ -2598,10 +2598,32 @@ function GetFlistIds($flistString, $allowPages = false, $allowMultipleMatches =
}
continue;
}
- if ($itemUC == '=BDAY') {
- $curDate = date('m/d',time());
+ if (substr($itemUC,0,5) == '=BDAY') {
+ $matchTime = time();
+ if(preg_match("/=BDAY\+(\d+)?$/",$itemUC,$matches)) {
+ if(isset($matches[1])) {
+ $matchTime += 24*60*60 * $matches[1];
+ } else {
+ $matchTime += 24*60*60;
+ }
+ }
+ if(preg_match("/=BDAY-(\d+)?$/",$itemUC,$matches)) {
+ if(isset($matches[1])) {
+ $matchTime -= 24*60*60 * $matches[1];
+ } else {
+ $matchTime -= 24*60*60;
+ }
+ }
+ if(preg_match("/=BDAY=(.+)$/",$itemUC,$matches)) {
+ $matchTime = strtotime($matches[1]);
+ if (!$matchTime) {
+ FbcmdWarning("Bad BDAY Syntax: [{$item}] using today");
+ $matchTime = time();
+ }
+ }
+ $matchDate = date('m/d',$matchTime);
foreach ($dataFriendBaseInfo as $fbi) {
- if (substr($fbi['birthday_date'],0,5) == $curDate) {
+ if (substr($fbi['birthday_date'],0,5) == $matchDate) {
array_push_unique($flistMatchArray,$fbi['uid']);
}
}
@@ -2715,8 +2737,8 @@ function GetFlistIds($flistString, $allowPages = false, $allowMultipleMatches =
}
if (count($flistMatchArray) == 0) {
if ($failOnEmpty) {
- if (strtoupper($flistString) == '=BDAY') {
- print "No Friends With Birthdays Today\n";
+ if (substr(strtoupper($flistString),0,5) == '=BDAY') {
+ print "No Friends With Birthday Matches\n";
exit;
} else {
FbcmdFatalError("Empty flist: {$flistString}");
Please sign in to comment.
Something went wrong with that request. Please try again.