Skip to content

Commit

Permalink
check version only when ua not set in conf
Browse files Browse the repository at this point in the history
  • Loading branch information
nworr committed Jan 10, 2023
1 parent 0cbfad2 commit f2c8aec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lizmap/modules/lizmap/classes/lizmapServices.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ public function __construct($readConfigPath, $globalConfig, $ldapEnabled, $varPa
$this->allowUserAccountRequests = false;
}

$appInfos = \Jelix\Core\Infos\AppInfos::load();
// set user_agent for external requests, needed for file_get_contents
$userAgent = 'Lizmap '.$appInfos->version;
if (isset($readConfigPath['services']['userAgent'])) {
// may be set to false if already set in the php.ini
$userAgent = $readConfigPath['services']['userAgent'];
} else {
$appInfos = \Jelix\Core\Infos\AppInfos::load();
$userAgent = 'Lizmap '.$appInfos->version;
}
if ($userAgent && !ini_get('user_agent')) {
ini_set('user_agent', $userAgent);
Expand Down

0 comments on commit f2c8aec

Please sign in to comment.