mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
39cad1d235
3 changed files with 27 additions and 2 deletions
|
@ -1663,7 +1663,7 @@ class session
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not update the session page for ajax requests, so the view online still works as intended
|
// Do not update the session page for ajax requests, so the view online still works as intended
|
||||||
$page_changed = $this->update_session_page && (!isset($this->data['session_page']) || $this->data['session_page'] != $this->page['page']) && !$request->is_ajax();
|
$page_changed = $this->update_session_page && (!isset($this->data['session_page']) || $this->data['session_page'] != $this->page['page'] || $this->data['session_forum_id'] != $this->page['forum']) && !$request->is_ajax();
|
||||||
|
|
||||||
// Only update session DB a minute or so after last update or if page changes
|
// Only update session DB a minute or so after last update or if page changes
|
||||||
if ($this->time_now - (isset($this->data['session_time']) ? $this->data['session_time'] : 0) > 60 || $page_changed)
|
if ($this->time_now - (isset($this->data['session_time']) ? $this->data['session_time'] : 0) > 60 || $page_changed)
|
||||||
|
|
|
@ -104,8 +104,17 @@ switch ($mode)
|
||||||
trigger_error('NO_POST');
|
trigger_error('NO_POST');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need to update session forum_id to valid value for proper viewonline information
|
||||||
|
if (!$forum_id)
|
||||||
|
{
|
||||||
|
$user->page['forum'] = (int) $topic_forum['forum_id'];
|
||||||
|
$user->update_session_page = true;
|
||||||
|
$user->update_session_infos();
|
||||||
|
}
|
||||||
|
|
||||||
$topic_id = (int) $topic_forum['topic_id'];
|
$topic_id = (int) $topic_forum['topic_id'];
|
||||||
$forum_id = (int) $topic_forum['forum_id'];
|
$forum_id = (int) $topic_forum['forum_id'];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,22 @@ class phpbb_functional_viewonline_test extends phpbb_functional_test_case
|
||||||
$this->assertStringContainsString('viewonline-test-user1', $crawler->text());
|
$this->assertStringContainsString('viewonline-test-user1', $crawler->text());
|
||||||
$this->assertStringContainsString($this->lang('POSTING_MESSAGE', $this->get_forum_name_by_forum_id(2)), $crawler->text());
|
$this->assertStringContainsString($this->lang('POSTING_MESSAGE', $this->get_forum_name_by_forum_id(2)), $crawler->text());
|
||||||
|
|
||||||
|
// Log in as test user
|
||||||
|
self::$client->restart();
|
||||||
|
$this->login('viewonline-test-user1');
|
||||||
|
$test_post_data = $this->create_post(2, 1, 'Viewonline test post #1', 'Viewonline test post message');
|
||||||
|
$crawler = self::request('GET', 'posting.php?mode=edit&p=' . $test_post_data['post_id'] . '&sid=' . $this->sid);
|
||||||
|
$this->assertContainsLang('EDIT_POST', $crawler->text());
|
||||||
|
// Log in as another user
|
||||||
|
self::$client->restart();
|
||||||
|
$this->login();
|
||||||
|
// PHP goes faster than DBMS, make sure session data got written to the database
|
||||||
|
sleep(1);
|
||||||
|
$crawler = self::request('GET', 'viewonline.php?sid=' . $this->sid);
|
||||||
|
// Make sure posting message page is in the list
|
||||||
|
$this->assertStringContainsString('viewonline-test-user1', $crawler->text());
|
||||||
|
$this->assertStringContainsString($this->lang('POSTING_MESSAGE', $this->get_forum_name_by_forum_id(2)), $crawler->text());
|
||||||
|
|
||||||
// Log in as test user
|
// Log in as test user
|
||||||
self::$client->restart();
|
self::$client->restart();
|
||||||
$this->login('viewonline-test-user1');
|
$this->login('viewonline-test-user1');
|
||||||
|
|
Loading…
Add table
Reference in a new issue