diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-05-23 23:46:55 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-05-23 23:46:55 +0000 |
commit | d2f1d9e8bc8f7584f9ad9bae133add937466343c (patch) | |
tree | 1cecc28ef5b5c8ce3e3faea35d8d1ed8f5c5d6cd /phpBB/includes | |
parent | 2a896ad2600f386b718383934bd7cd383a04ff5f (diff) | |
download | forums-d2f1d9e8bc8f7584f9ad9bae133add937466343c.tar forums-d2f1d9e8bc8f7584f9ad9bae133add937466343c.tar.gz forums-d2f1d9e8bc8f7584f9ad9bae133add937466343c.tar.bz2 forums-d2f1d9e8bc8f7584f9ad9bae133add937466343c.tar.xz forums-d2f1d9e8bc8f7584f9ad9bae133add937466343c.zip |
Wasn't stripping slashes from the cookies ... that will account for some of the erroneous mark read, nothing changes issues. Add name="" to image generation ... for "on" event handlers, etc.
git-svn-id: file:///svn/phpbb/trunk@4052 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions.php | 41 | ||||
-rw-r--r-- | phpBB/includes/session.php | 2 |
2 files changed, 26 insertions, 17 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 0ec09dba8d..552d2e8da6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -485,7 +485,8 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false) $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . " SET mark_time = $current_time WHERE user_id = " . $user->data['user_id'] . " - AND forum_id = $forum_id"; + AND forum_id = $forum_id + AND mark_time < $current_time"; if (!$db->sql_query($sql) || !$db->sql_affectedrows()) { // User is marking this forum for the first time. @@ -500,11 +501,14 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false) } else { - $tracking_forums = (isset($_COOKIE[$config['cookie_name'] . '_f'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_f']) : array(); - $tracking_forums[$forum_id] = time(); + $tracking = (isset($_COOKIE[$config['cookie_name'] . '_f'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_f'])) : array(); + if (empty($tracking[$forum_id]) || $tracking[$forum_id] < $current_time) + { + $tracking[$forum_id] = $current_time; + } - setcookie($config['cookie_name'] . '_f', serialize($tracking_forums), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']); - unset($tracking_forums); + setcookie($config['cookie_name'] . '_f', serialize($tracking), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']); + unset($tracking); } break; @@ -515,12 +519,13 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false) { $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . ' SET mark_time = ' . $current_time . ' - WHERE user_id = ' . $user->data['user_id']; + WHERE user_id = ' . $user->data['user_id'] . " + AND mark_time < $current_time"; $db->sql_query($sql); } else { - $tracking_forums = array(); + $tracking = array(); } // Select all forum_id's that are not yet in the lastread table @@ -569,9 +574,9 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false) $db->sql_query($sql); } } - else + else if (empty($tracking[$row['forum_id']]) || $tracking[$row['forum_id']] < $current_time) { - $tracking_forums[$row['forum_id']] = $current_time; + $tracking[$row['forum_id']] = $current_time; } } while ($row = $db->sql_fetchrow($result)); @@ -581,8 +586,8 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false) if (!$config['load_db_lastread']) { - setcookie($config['cookie_name'] . '_f', serialize($tracking_forums), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']); - unset($tracking_forums); + setcookie($config['cookie_name'] . '_f', serialize($tracking), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']); + unset($tracking); } } break; @@ -596,21 +601,25 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false) if ($config['load_db_lastread'] || ($config['load_db_track'] && $type == TRACK_POSTED)) { $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . " - SET mark_type = $type, mark_time = " . time() . " + SET mark_type = $type, mark_time = $current_time WHERE topic_id = $topic_id - AND user_id = " . $user->data['user_id']; + AND user_id = " . $user->data['user_id'] . " + AND mark_time < $current_time"; if (!$db->sql_query($sql) || !$db->sql_affectedrows()) { $sql = 'INSERT INTO ' . TOPICS_TRACK_TABLE . ' (user_id, topic_id, mark_type, mark_time) - VALUES (' . $user->data['user_id'] . ", $topic_id, $type, " . time() . ")"; + VALUES (' . $user->data['user_id'] . ", $topic_id, $type, $current_time)"; $db->sql_query($sql); } } if (!$config['load_db_lastread']) { - $tracking = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize($_COOKIE[$config['cookie_name'] . '_t']) : array(); - $tracking[$topic_id] = $current_time; + $tracking = (isset($_COOKIE[$config['cookie_name'] . '_t'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_t'])) : array(); + if (empty($tracking[$topic_id]) || $tracking[$topic_id] < $current_time) + { + $tracking[$topic_id] = $current_time; + } setcookie($config['cookie_name'] . '_t', serialize($tracking), time() + 31536000, $config['cookie_path'], $config['cookie_domain'], $config['cookie_secure']); unset($tracking); diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 22ed35752b..1fb3e88b70 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -498,7 +498,7 @@ class user extends session $alt = (!empty($this->lang[$alt])) ? $this->lang[$alt] : ''; $width = ($width) ? 'width="' . $width . '" ' : ''; - $imgs[$img] = '<img src=' . str_replace('{LANG}', $this->img_lang, $this->theme[$img]) . ' ' . $width . 'alt="' . $alt . '" title="' . $alt . '" />'; + $imgs[$img] = '<img src=' . str_replace('{LANG}', $this->img_lang, $this->theme[$img]) . ' ' . $width . 'alt="' . $alt . '" title="' . $alt . '" name="' . $img . '"/>'; } return $imgs[$img]; } |