Adding validation of the api_check_browscap() function only works if ini_get('browscap') is not empty fixes #3735

skala
Julio Montoya 14 years ago
parent 6fa115e2f6
commit 9edf65a21a
  1. 19
      main/inc/lib/main_api.lib.php

@ -4923,22 +4923,27 @@ function api_browser_support($format="") {
/**
* This function checks if exist path and file browscap.ini
* In order for this to work, your browscap configuration setting in php.ini must point to the correct location of the browscap.ini file on your system
* http://php.net/manual/en/function.get-browser.php
*
* @return bool
*
* @author Juan Carlos Raña Trabado
*/
function api_check_browscap(){
function api_check_browscap() {
$setting = ini_get('browscap');
$browser = get_browser($_SERVER['HTTP_USER_AGENT'], true);
if (strpos($setting, 'browscap.ini') && !empty($browser)){
return true;
} else {
return false;
if ($setting) {
$browser = get_browser($_SERVER['HTTP_USER_AGENT'], true);
if (strpos($setting, 'browscap.ini') && !empty($browser)) {
return true;
}
}
return false;
}
function api_get_js($file) {
return '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$file.'" type="text/javascript" language="javascript"></script>';
}

Loading…
Cancel
Save