@@ 280-320 (lines=41) @@ | ||
277 | header("Cache-Control: post-check=0, pre-check=0", false); |
|
278 | header("Pragma: no-cache"); // HTTP/1.0 |
|
279 | ||
280 | function duration($ts) |
|
281 | { |
|
282 | global $time; |
|
283 | $years = (int)((($time - $ts)/(7*86400))/52.177457); |
|
284 | $rem = (int)(($time-$ts)-($years * 52.177457 * 7 * 86400)); |
|
285 | $weeks = (int)(($rem)/(7*86400)); |
|
286 | $days = (int)(($rem)/86400) - $weeks*7; |
|
287 | $hours = (int)(($rem)/3600) - $days*24 - $weeks*7*24; |
|
288 | $mins = (int)(($rem)/60) - $hours*60 - $days*24*60 - $weeks*7*24*60; |
|
289 | $str = ''; |
|
290 | if ($years==1) { |
|
291 | $str .= "$years year, "; |
|
292 | } |
|
293 | if ($years>1) { |
|
294 | $str .= "$years years, "; |
|
295 | } |
|
296 | if ($weeks==1) { |
|
297 | $str .= "$weeks week, "; |
|
298 | } |
|
299 | if ($weeks>1) { |
|
300 | $str .= "$weeks weeks, "; |
|
301 | } |
|
302 | if ($days==1) { |
|
303 | $str .= "$days day,"; |
|
304 | } |
|
305 | if ($days>1) { |
|
306 | $str .= "$days days,"; |
|
307 | } |
|
308 | if ($hours == 1) { |
|
309 | $str .= " $hours hour and"; |
|
310 | } |
|
311 | if ($hours>1) { |
|
312 | $str .= " $hours hours and"; |
|
313 | } |
|
314 | if ($mins == 1) { |
|
315 | $str .= " 1 minute"; |
|
316 | } else { |
|
317 | $str .= " $mins minutes"; |
|
318 | } |
|
319 | return $str; |
|
320 | } |
|
321 | ||
322 | // create graphics |
|
323 | // |
@@ 252-292 (lines=41) @@ | ||
249 | header("Cache-Control: post-check=0, pre-check=0", false); |
|
250 | header("Pragma: no-cache"); // HTTP/1.0 |
|
251 | ||
252 | function duration($ts) |
|
253 | { |
|
254 | global $time; |
|
255 | $years = (int)((($time - $ts)/(7*86400))/52.177457); |
|
256 | $rem = (int)(($time-$ts)-($years * 52.177457 * 7 * 86400)); |
|
257 | $weeks = (int)(($rem)/(7*86400)); |
|
258 | $days = (int)(($rem)/86400) - $weeks*7; |
|
259 | $hours = (int)(($rem)/3600) - $days*24 - $weeks*7*24; |
|
260 | $mins = (int)(($rem)/60) - $hours*60 - $days*24*60 - $weeks*7*24*60; |
|
261 | $str = ''; |
|
262 | if ($years==1) { |
|
263 | $str .= "$years year, "; |
|
264 | } |
|
265 | if ($years>1) { |
|
266 | $str .= "$years years, "; |
|
267 | } |
|
268 | if ($weeks==1) { |
|
269 | $str .= "$weeks week, "; |
|
270 | } |
|
271 | if ($weeks>1) { |
|
272 | $str .= "$weeks weeks, "; |
|
273 | } |
|
274 | if ($days==1) { |
|
275 | $str .= "$days day,"; |
|
276 | } |
|
277 | if ($days>1) { |
|
278 | $str .= "$days days,"; |
|
279 | } |
|
280 | if ($hours == 1) { |
|
281 | $str .= " $hours hour and"; |
|
282 | } |
|
283 | if ($hours>1) { |
|
284 | $str .= " $hours hours and"; |
|
285 | } |
|
286 | if ($mins == 1) { |
|
287 | $str .= " 1 minute"; |
|
288 | } else { |
|
289 | $str .= " $mins minutes"; |
|
290 | } |
|
291 | return $str; |
|
292 | } |
|
293 | ||
294 | // create graphics |
|
295 | // |