summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorChristoph Brill <egore911@egore911.de>2012-03-26 01:54:20 +0200
committerChristoph Brill <egore911@egore911.de>2012-03-26 01:54:20 +0200
commit7dd5346554a26af9c3b13f11508f5a684c30bc4c (patch)
tree651f6c0c7a28a697fec01c1b2c7a558c8dcccce6 /index.php
parent96cd0f330cb1513bff74500c7df2dfd4d7fc6f77 (diff)
Move code around
Diffstat (limited to 'index.php')
-rw-r--r--index.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/index.php b/index.php
index 27cbca9..81f3ade 100644
--- a/index.php
+++ b/index.php
@@ -22,6 +22,20 @@ if (isset($date)) {
$oneday = new DateInterval("P1D");
$prevday = date_sub(date_create_from_format("Y-m-d", $date), $oneday)->format("Y-m-d");
$nextday = date_add(date_create_from_format("Y-m-d", $date), $oneday)->format("Y-m-d");
+
+ // Set a cookie to store the reference to the last time we showed the log
+ if (isset($_COOKIE[$channel . '_last_visit'])) {
+ $last_visit = $_COOKIE[$channel . '_last_visit'];
+ if ($date == date('Y-m-d', $last_visit)) {
+ $last_visit = date('H:i', $last_visit);
+ setcookie($channel . '_last_visit', time(), time()+2592000);
+ } else {
+ unset($last_visit);
+ }
+ } else {
+ setcookie($channel . '_last_visit', time(), time()+2592000);
+ }
+
} else {
$title = 'DRI IRC log overview';
}
@@ -38,20 +52,6 @@ if (isset($_GET['highlight_names'])) {
setcookie('stored_users', $highlight_names, time()+2592000);
}
-if (isset($date) && isset($channel)) {
- if (isset($_COOKIE[$channel . '_last_visit'])) {
- $last_visit = $_COOKIE[$channel . '_last_visit'];
- if ($date == date('Y-m-d', $last_visit)) {
- $last_visit = date('H:i', $last_visit);
- setcookie($channel . '_last_visit', time(), time()+2592000);
- } else {
- unset($last_visit);
- }
- } else {
- setcookie($channel . '_last_visit', time(), time()+2592000);
- }
-}
-
$colors = array('#009900', '#CC3300', '#330099', '#FF6600', '#CC33CC', '#66CCCC', '#FF0066', '#9900FF', '#00FFCC', '#6600FF');
echo '<?xml version="1.0" encoding="UTF-8" ?>