diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-03-28 18:34:09 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-03-28 18:34:09 +0000 |
commit | e6ed42ed4dde41812b88b47c6e5bb5c41402f14c (patch) | |
tree | 32fecd81f8e70946643bbf618148637c098a11de | |
parent | 45b22fd31f52fbdc884217efc573ccd13bdde92a (diff) | |
download | forums-e6ed42ed4dde41812b88b47c6e5bb5c41402f14c.tar forums-e6ed42ed4dde41812b88b47c6e5bb5c41402f14c.tar.gz forums-e6ed42ed4dde41812b88b47c6e5bb5c41402f14c.tar.bz2 forums-e6ed42ed4dde41812b88b47c6e5bb5c41402f14c.tar.xz forums-e6ed42ed4dde41812b88b47c6e5bb5c41402f14c.zip |
- Add indicator to be used in code if session was created (user visits the site for the first time)
- Correctly count topic views for guests visiting the website the first time by entering the topic directly (Bug #43445)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9411 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 2 | ||||
-rw-r--r-- | phpBB/includes/session.php | 9 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5dc6838801..b1a2d244cd 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -129,6 +129,8 @@ <li>[Fix] Fix duplicate creation of acl options in acl_add_options() under certain conditions. (Bug #38385, #40225)</li> <li>[Fix] Cancel when replying to global announcement redirects to first forum - not to the current forum (Bug #41225 - Patch by TerraFrost)</li> <li>[Fix] Cursor Jumps on New Topic in IE (Bug #42455 - Patch by TerraFrost)</li> + <li>[Fix] Add indicator to be used in code if session was created (user visits the site for the first time).</li> + <li>[Fix] Correctly count topic views for guests visiting the website the first time by entering the topic directly (Bug #43445)</li> <li>[Change] Allow download of conflicting file for later reference in automatic updater</li> <li>[Change] Default difference view is now 'inline' instead of 'side by side'</li> <li>[Change] Added new option for merging differences to conflicting files in automatic updater</li> diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index b01d0b2281..9cf19e4302 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -726,6 +726,15 @@ class session // Commented out because it will not allow forums to update correctly // $db->sql_return_on_error(false); + // Something quite important: session_page always holds the *last* page visited, except for the *first* visit. + // We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case. + // If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later. + if (empty($this->data['session_id'])) + { + // This is a temporary variable, only set for the very first visit + $this->data['session_created'] = true; + } + $this->session_id = $this->data['session_id'] = md5(unique_id()); $sql_ary['session_id'] = (string) $this->session_id; diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 02bb502075..495a536932 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1514,7 +1514,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) unset($rowset, $user_cache); // Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view' -if (isset($user->data['session_page']) && !$user->data['is_bot'] && strpos($user->data['session_page'], '&t=' . $topic_id) === false) +if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($user->data['session_page'], '&t=' . $topic_id) === false || isset($user->data['session_created']))) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . " |