aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2006-02-15 15:41:24 +0000
committerJim Hu <jimhu@users.sourceforge.net>2006-02-15 15:41:24 +0000
commitb2bd2ded12454ce187f4c015a8ac743680d8ce01 (patch)
tree7b07029d4225cf3ba15fcfaafa93e85b7f4aa207
parent46c9454ec6fa7e48be65ef35ff96045ee30d5857 (diff)
downloadphpicalendar-b2bd2ded12454ce187f4c015a8ac743680d8ce01.tar.gz
phpicalendar-b2bd2ded12454ce187f4c015a8ac743680d8ce01.tar.bz2
phpicalendar-b2bd2ded12454ce187f4c015a8ac743680d8ce01.zip
fix date calculation problems (I hope)
-rw-r--r--functions/init.inc.php5
-rw-r--r--rss/rss.php10
2 files changed, 6 insertions, 9 deletions
diff --git a/functions/init.inc.php b/functions/init.inc.php
index 1af0c07..ba82b88 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -56,9 +56,8 @@ if ($cookie_uri == '') {
if ($bleed_time == '') $bleed_time = -1;
// Grab the action (login or logout).
-if (isset($_GET['action'])) $action = $_GET['action'];
-else if (isset($_POST['action'])) $action = $_POST['action'];
-else $action = '';
+$action = '';
+if (isset($_REQUEST['action'])) $action = $_GET['action'];
// Login and/or logout.
list($username, $password, $invalid_login) = user_login();
diff --git a/rss/rss.php b/rss/rss.php
index 059ab92..ef19eae 100644
--- a/rss/rss.php
+++ b/rss/rss.php
@@ -26,7 +26,7 @@ if (isset($_GET['getdate']) && $_GET['getdate'] !=''){
}else{
$getdate = date("Ymd");
}
-
+# for all views, $fromdate is the first day to be shown and $todate should be the last day.
switch ($rssview){
case 'day':
$fromdate = $getdate;
@@ -48,22 +48,20 @@ switch ($rssview){
if(isset($_GET['year'])){
$theyear = $_GET['year'];
}else{
- $theyear = date('Y');
+ $theyear = substr($getdate,0,4);
}
$fromdate = ($theyear*10000)+101;
- $todate = date("Ymd", strtotime($fromdate) + 365*60*60*24);
+ $todate = date("Ymd", strtotime($theyear*10000+1231));
$theview = $theyear;
break;
case 'daysfrom':
$fromdate = $getdate;
$todate = date("Ymd", strtotime($getdate) + $_GET['days']*60*60*24);
- #print "from:$fromdate to: $todate<br>";
$theview = $_GET['days']." days from ".date('n/d/Y',strtotime($fromdate));
break;
case 'daysto':
$todate = $getdate;
$fromdate = date("Ymd", strtotime($getdate) - $_GET['days']*60*60*24);
- #print "from:$fromdate to: $todate<br>";
$theview = $_GET['days']." days before ".date('n/d/Y',strtotime($todate));
break;
case 'range':
@@ -145,7 +143,7 @@ $rss .= '<language>'.$language.'</language>'."\n";
$rss .= '<copyright>Copyright '.date('Y').', '.htmlspecialchars ("$default_path").'</copyright>'."\n";
//generate the items
-$numdays = round((strtotime($todate) - strtotime($fromdate))/(60*60*24)+1);
+$numdays = round((strtotime($todate) - strtotime($fromdate))/(60*60*24))+1;
$thisdate = $fromdate; # start at beginning of date range,
# note that usage of $thisdate is different from distribution
# I use it as a date, dist uses it as a time

© 2014-2024 Faster IT GmbH | imprint | privacy policy