mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-08 00:34:42 +03:00
Remove $knownAgents global variable
This commit is contained in:
parent
24f7bb5a66
commit
f48f50e09e
@ -78,13 +78,11 @@ function is_ajax_browser($browserid, $ver, $useragent)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$knownAgents = array("opera", "msie", "chrome", "safari", "firefox", "netscape", "mozilla");
|
|
||||||
|
|
||||||
function get_remote_level($useragent)
|
function get_remote_level($useragent)
|
||||||
{
|
{
|
||||||
global $knownAgents;
|
$known_agents = get_known_user_agents();
|
||||||
$useragent = strtolower($useragent);
|
$useragent = strtolower($useragent);
|
||||||
foreach ($knownAgents as $agent) {
|
foreach ($known_agents as $agent) {
|
||||||
if (strstr($useragent, $agent)) {
|
if (strstr($useragent, $agent)) {
|
||||||
if (preg_match("/" . $agent . "[\\s\/]?(\\d+(\\.\\d+)?)/", $useragent, $matches)) {
|
if (preg_match("/" . $agent . "[\\s\/]?(\\d+(\\.\\d+)?)/", $useragent, $matches)) {
|
||||||
$ver = $matches[1];
|
$ver = $matches[1];
|
||||||
@ -101,6 +99,23 @@ function get_remote_level($useragent)
|
|||||||
return "ajaxed";
|
return "ajaxed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of known user agents code names.
|
||||||
|
*
|
||||||
|
* @return array List of known user agents
|
||||||
|
*/
|
||||||
|
function get_known_user_agents() {
|
||||||
|
return array(
|
||||||
|
"opera",
|
||||||
|
"msie",
|
||||||
|
"chrome",
|
||||||
|
"safari",
|
||||||
|
"firefox",
|
||||||
|
"netscape",
|
||||||
|
"mozilla"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function is_agent_opera95()
|
function is_agent_opera95()
|
||||||
{
|
{
|
||||||
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||||
|
@ -20,10 +20,10 @@ use Mibew\Settings;
|
|||||||
|
|
||||||
function get_useragent_version($userAgent)
|
function get_useragent_version($userAgent)
|
||||||
{
|
{
|
||||||
global $knownAgents;
|
$known_agents = get_known_user_agents();
|
||||||
if (is_array($knownAgents)) {
|
if (is_array($known_agents)) {
|
||||||
$userAgent = strtolower($userAgent);
|
$userAgent = strtolower($userAgent);
|
||||||
foreach ($knownAgents as $agent) {
|
foreach ($known_agents as $agent) {
|
||||||
if (strstr($userAgent, $agent)) {
|
if (strstr($userAgent, $agent)) {
|
||||||
if (preg_match("/" . $agent . "[\\s\/]?(\\d+(\\.\\d+(\\.\\d+(\\.\\d+)?)?)?)/", $userAgent, $matches)) {
|
if (preg_match("/" . $agent . "[\\s\/]?(\\d+(\\.\\d+(\\.\\d+(\\.\\d+)?)?)?)/", $userAgent, $matches)) {
|
||||||
$ver = $matches[1];
|
$ver = $matches[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user