Welcome, Guest
Username Password: Remember me

Conflict with unrecognised user agent strings
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: Conflict with unrecognised user agent strings

Re: Conflict with unrecognised user agent strings 12 years, 3 months ago #10910

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
It's in plugins/mobile/amdd/amdd/amdd.php (function findByLevenshtein).
Now we test following patch:
$best = min(12, intval($ua_size/2));

(to prevent change of more than a half of characters), hope it will be sufficient.

Re: Conflict with unrecognised user agent strings 12 years, 3 months ago #10991

  • openglobal
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 0
I made this change and it hasn't fixed the problem:

 
//$best = 12; // maximum number of changes in UA string^M
$best = min(12, intval($ua_size/2));
 


OpenGlobal

Re: Conflict with unrecognised user agent strings 12 years, 3 months ago #10993

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
Clear jos_mj_amdd_cache database table, most likely result was cached.
Last Edit: 12 years, 3 months ago by dryabov.

Re: Conflict with unrecognised user agent strings 12 years, 3 months ago #11007

  • openglobal
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 0
It's already empty.

OpenGlobal

Re: Conflict with unrecognised user agent strings 12 years, 3 months ago #11008

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
And did you clear cookies (though, unlikely your script saves them)?
Last Edit: 12 years, 3 months ago by dryabov.

Re: Conflict with unrecognised user agent strings 12 years, 3 months ago #11009

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
I've tested modified file locally, and it correctly detects "OpenGlobal" as desktop browser

Re: Conflict with unrecognised user agent strings 12 years, 3 months ago #11017

  • openglobal
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 0
My perl script (and I assume the W3C validator) doesn't store cookies.

Is this how the function should look?

 
private static function findByLevenshtein($ua, $devices)
{
$ua_size = strlen($ua);
 
$data = null;
 
//$best = 12; // maximum number of changes in UA string
$best = min(12, intval($ua_size/2));
foreach($devices as $device)
{
if(abs(strlen($device->ua) - $ua_size) > $best)
continue;
 
$current = levenshtein($ua, $device->ua);
if($current <= $best)
{
$best = $current;
$data = $device->data;
}
}
 
return $data;
}
 


OpenGlobal
  • Page:
  • 1
  • 2
Time to create page: 0.14 seconds

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.