diff options
author | Michael Tänzer <neo@nhng.de> | 2012-02-01 02:35:38 +0100 |
---|---|---|
committer | Michael Tänzer <neo@nhng.de> | 2012-02-01 02:35:38 +0100 |
commit | d0e45860ee347a0a8390b71e40a932d85ba0e52d (patch) | |
tree | 2a1a9b4d35b8a1e0fe5ea625f971f0cbb2e77792 | |
parent | 7dcfa351436fa8dc6717416a8a37473a04ad7b54 (diff) | |
download | cacert-devel-bug-859.tar.gz cacert-devel-bug-859.tar.xz cacert-devel-bug-859.zip |
bug 859: Show the interval since when the account was last accessed insteadbug-859
of things like "within this month"
E.g. if it's the first of february and the account was accessed in the mid of
January, show "within the last month".
Signed-off-by: Michael Tänzer <neo@nhng.de>
-rw-r--r-- | pages/account/43.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/pages/account/43.php b/pages/account/43.php index 118bdf6..8934487 100644 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -357,9 +357,13 @@ if ($showactivity) { $dres = mysql_query($query); $drow = mysql_fetch_assoc($dres); $created = $drow['created']; - $modified = $drow['modified']; - $today = date("Y-m-d"); + $modified = getdate(strtotime($drow['modified'])); + $now = getdate(); + // only a rough approximation + $days = ($now['year'] - $modified['year']) * 360; + $days += ($now['mon'] - $modified['mon']) * 30; + $days += $now['mday'] - $modified['mday']; ?> <tr> <td class="DataTD"><?=_("Account created")?>:</td> @@ -369,18 +373,16 @@ if ($showactivity) { <tr> <td class="DataTD"><?=_("Last activity")?>:</td> <td class="DataTD"><? - if (substr($modified,0,7) == substr($today,0,7)) { - echo _("this month"); - } elseif (substr($modified,0,4) == substr($today,0,4)) { - echo _("this year"); - } elseif (substr($modified,0,7) < - (intval(substr($today,0,4))-2)."-".substr($today,5,2) ) { + if ($days >= 2 * 360) { echo _("before 2 years"); - } elseif (substr($modified,0,7) < - (intval(substr($today,0,4))-1)."-".substr($today,5,2)) { + } elseif ($days >= 360) { echo _("before 1 year"); - } else { + } elseif ($days >= 6 * 30) { echo _("within last 12 months"); + } elseif ($days >= 30) { + echo _("within last 6 months"); + } else { + echo _("within the last month"); } ?></td> </tr> <?php } ?> |