]> git.pld-linux.org Git - packages/dokuwiki-plugin-icalevents.git/commitdiff
- allow $from to take any param that strtotime supports auto/th/dokuwiki-plugin-icalevents-20100501-1
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 6 Dec 2010 12:14:00 +0000 (12:14 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dokuwiki-plugin-icalevents.spec -> 1.5
    relative-dates.patch -> 1.1

dokuwiki-plugin-icalevents.spec
relative-dates.patch [new file with mode: 0644]

index 65be76c76a6f24ef721204b90f22ca9fa59c7b43..f7676c2b2f6353a97f6269c7ced15791a2f85021 100644 (file)
@@ -13,6 +13,7 @@ URL:          http://www.dokuwiki.org/plugin:icalevents
 Patch0:                dformat.patch
 Patch1:                reset-error.patch
 Patch2:                allow-params.patch
+Patch3:                relative-dates.patch
 BuildRequires: rpm-php-pearprov >= 4.4.2-11
 BuildRequires: rpmbuild(macros) >= 1.553
 Requires:      dokuwiki >= 20080505
@@ -39,6 +40,7 @@ mv iCalEvents/* .
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 version=$(awk -F"'" '/date/&&/=>/{print $4}' syntax.php)
 if [ "$(echo "$version" | tr -d -)" != %{version} ]; then
diff --git a/relative-dates.patch b/relative-dates.patch
new file mode 100644 (file)
index 0000000..6c11411
--- /dev/null
@@ -0,0 +1,40 @@
+--- dokuwiki-plugin-icalevents-20100501/syntax.php     2010-12-06 14:11:46.422763640 +0200
++++ iCalEvents/syntax.php      2010-12-06 14:12:11.466106772 +0200
+@@ -59,16 +59,19 @@
+       $match = substr($match, 13, -2); // strip {{iCalEvents> from start and }} from end
+       list($icsURL, $flagStr) = explode('#', $match);
+       parse_str($flagStr, $params);
+-            
+-      if ($params['from'] == 'today') {
+-        $from = time();
+-      } else if (preg_match('#(\d\d)/(\d\d)/(\d\d\d\d)#', $params['from'], $fromDate)) {
+-          # must be MM/dd/yyyy
+-        $from = mktime(0, 0, 0, $fromDate[1], $fromDate[2], $fromDate[3]);
+-      } else if (preg_match('/\d+/', $params['from'])) {
+-          $from = $params['from']; 
++
++      $from = null;
++      if (!empty($params['from'])) {
++          // unix timestamp: handle specially for backward compatability
++          if (preg_match('/^\d+$/', $params['from'])) {
++            $from = (int )$params['from'];
++          } else {
++            // anything that strtotime can parse: 'today', '1 week ago', etc
++            $from = strtotime($params['from']);
++          }
+         }
+-      if ($params['previewDays']) {
++
++      if (!empty($params['previewDays'])) {
+         $previewSec = $params['previewDays']*24*3600;
+       } else {
+         $previewSec = 60*24*3600;  # two month
+@@ -86,7 +89,7 @@
+       $showEndDates = !empty($params['showEndDates']);
+       
+-      #echo "url=$icsURL from = $from    previewSec = $previewSec<br>";
++      #echo "url=$icsURL flags=$flagStr; from = $from;    previewSec = $previewSec; dateFormat=$dateFormat;<br/>";
+       
+       return array($icsURL, $from, $previewSec, $dateFormat, $showEndDates); 
+     }
This page took 0.070418 seconds and 4 git commands to generate.