Skip to content

Commit

Permalink
Merge pull request #263 from jmechnich/check-user-agent
Browse files Browse the repository at this point in the history
Check if HTTP_USER_AGENT is set, use empty string otherwise
  • Loading branch information
faf authored Dec 3, 2021
2 parents 637758c + e676ca4 commit cd1e8ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/mibew/libs/chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,9 @@ function chat_start_for_user(
) {
// Get user info
$remote_host = get_remote_host();
$user_browser = $_SERVER['HTTP_USER_AGENT'];
$user_browser = isset($_SERVER['HTTP_USER_AGENT'])
? $_SERVER['HTTP_USER_AGENT']
: '';

// Check connection limit
if (Thread::connectionLimitReached($remote_host)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,9 @@ protected function apiProcessLeaveMessage($args)

// Create thread for left message
$remote_host = get_remote_host();
$user_browser = $_SERVER['HTTP_USER_AGENT'];
$user_browser = isset($_SERVER['HTTP_USER_AGENT'])
? $_SERVER['HTTP_USER_AGENT']
: '';
$visitor = visitor_from_request();

// Get message locale
Expand Down
4 changes: 3 additions & 1 deletion src/mibew/libs/track.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ function track_get_path($visitor)
function track_build_details()
{
$result = array(
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
'user_agent' => (isset($_SERVER['HTTP_USER_AGENT'])
? $_SERVER['HTTP_USER_AGENT']
: ''),
'remote_host' => get_remote_host(),
);

Expand Down

0 comments on commit cd1e8ad

Please sign in to comment.