mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
mlanthaler: Bugfix: Fixed "FATAL ERROR: get_browser() [function.get-browser]: browscap ini directive not set" and some E_NOTICE errors.
@Quin: Maybe you should implement some fail-back function for get_browser that evaluates the HTTP user agent header (browscap.ini is often not available!). a (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42099 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0273d70259
commit
5b886f9ae1
@ -33,10 +33,11 @@ class PageView extends DataObject {
|
||||
|
||||
static $defaults = array();
|
||||
|
||||
protected $hitdata;
|
||||
protected $hitdata = null;
|
||||
|
||||
function init() {
|
||||
$this->hitdata = get_browser(null, true);
|
||||
if($hitdata = @get_browser(null, true))
|
||||
$this->hitdata = get_browser(null, true);
|
||||
}
|
||||
|
||||
function record() {
|
||||
@ -55,12 +56,16 @@ class PageView extends DataObject {
|
||||
}
|
||||
|
||||
function setBrowser() {
|
||||
$this->setField('Browser', $this->hitdata['browser']);
|
||||
$this->setField('BrowserVersion', $this->hitdata['version']);
|
||||
if(isset($this->hitdata['browser']))
|
||||
$this->setField('Browser', $this->hitdata['browser']);
|
||||
|
||||
if(isset($this->hitdata['version']))
|
||||
$this->setField('BrowserVersion', $this->hitdata['version']);
|
||||
}
|
||||
|
||||
function setOS() {
|
||||
$this->setField('OS', $this->hitdata['platform']);
|
||||
if(isset($this->hitdata['platform']))
|
||||
$this->setField('OS', $this->hitdata['platform']);
|
||||
}
|
||||
|
||||
function setUserID() {
|
||||
@ -79,7 +84,7 @@ class PageView extends DataObject {
|
||||
}
|
||||
|
||||
function setIP() {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_FOR']){
|
||||
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else {
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
Loading…
Reference in New Issue
Block a user