OS & Browser Detection (version 1.5 is out) [20. 09. 2010.]

Started by Branko., December 06, 2008, 05:23:42 AM

Previous topic - Next topic

Arantor


Sandmansa


Sandmansa

Made a small adjustment to the IE 11 detection.  My initial code was generating offset 1 error in the logs.  Here is the fix.


    // MSIE 11
    if(preg_match('/Trident\/7.0/', $user_agent, $tmp_array) && !$client_data['browser'])
      {
      $client_data['browser'] = "MS Internet Explorer 11.0";
      $client_data['browser_icon'] = 'msie';
      }


Branko.

Strong people don't put others down, they lift them up.
A clever person solves a problem. A wise person avoids it.

cieplutki

#464
Ok

Quote* version 1.7 (12. 01. 2013.)
- Windows 8 support included (thanks to lukaszuk1995)
- Windows Phone support included
- Blackberry support included
- Linux Mint support included (thanks to Freñçh)
- Internet Explorer 11 support included (thanks to Sandmansa)

need help with the new version of Opera 18
QuoteMozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 OPR/18.0.1284.68 (Edition Campaign 21)




.

Sandmansa

cieplutki.  Quick question.  Your changelog suggests version 1.7 but your attachment says v1.6.  Is that a typo?

TheListener


SD-X

Quote from: cieplutki on January 12, 2014, 08:36:44 AM
Ok

Quote* version 1.7 (12. 01. 2013.)
- Windows 8 support included (thanks to lukaszuk1995)
- Windows Phone support included
- Blackberry support included
- Linux Mint support included (thanks to Freñçh)
- Internet Explorer 11 support included (thanks to Sandmansa)

need help with the new version of Opera 18
QuoteMozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 OPR/18.0.1284.68 (Edition Campaign 21)
It looks like you're missing a couple detections:
http://www.simplemachines.org/community/index.php?topic=278770.msg3652278#msg3652278
:D
(Windows 8.1 is also on that list!)

Overall, nice work! Can't wait to update! :)

cieplutki

Hi,

Windows 8.1  is on pack, 1.7 is only info, source was update.

best




.


cieplutki

How to added new opera like 20

Quote// Opera
    if((preg_match('/mozilla.*opera ([0-9a-z\+\-\.]+).*/si', $user_agent, $tmp_array) || preg_match('/^opera\/([0-9a-z\+\-\.]+).*/si', $user_agent, $tmp_array)) && !$client_data['browser'])
      {
      $client_data['browser'] = "Opera" . ($tmp_array[1] ? " ".$tmp_array[1] : "");
      $client_data['browser_icon'] = 'opera';
      if(preg_match('/opera mini/si', $user_agent))
        {
        preg_match('/opera mini\/([0-9a-z\+\-\.]+).*/si', $user_agent, $tmp_array);
        $client_data['browser'] .= " (Opera Mini" . ($tmp_array[1] ? " ".$tmp_array[1] : "") . ")";
        }
      if(preg_match('/Version\/([0-9]+\.[0-9]+)/', $user_agent, $tmp_array))
        {
        $client_data['browser'] = "Opera " . $tmp_array[1];
        }
    }

this code show like google chrome but not opera

QuoteMozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.91




.

cieplutki

Ok,
did not give me peace ... how to add opera 20.*

find:
// Opera
    if((preg_match('/mozilla.*opera ([0-9a-z\+\-\.]+).*/si', $user_agent, $tmp_array) || preg_match('/^opera\/([0-9a-z\+\-\.]+).*/si', $user_agent, $tmp_array)) && !$client_data['browser'])
      {
      $client_data['browser'] = "Opera" . ($tmp_array[1] ? " ".$tmp_array[1] : "");
      $client_data['browser_icon'] = 'opera';
      if(preg_match('/opera mini/si', $user_agent))
        {
        preg_match('/opera mini\/([0-9a-z\+\-\.]+).*/si', $user_agent, $tmp_array);
        $client_data['browser'] .= " (Opera Mini" . ($tmp_array[1] ? " ".$tmp_array[1] : "") . ")";
        }
      if(preg_match('/Version\/([0-9]+\.[0-9]+)/', $user_agent, $tmp_array))
        {
        $client_data['browser'] = "Opera " . $tmp_array[1];
        }
    }


add before
    // OPERA 20
    if(preg_match('/OPR\/([0-9a-z\+\-\.]+).*/', $user_agent, $tmp_array) && !$client_data['browser'])
      {
      $client_data['browser'] = "Opera" . ($tmp_array[1] ? " ".$tmp_array[1] : "");
      $client_data['browser_icon'] = 'opera';
      if(preg_match('/Version\/([0-9]+\.[0-9]+)/', $user_agent, $tmp_array))
        {
        $client_data['browser'] = "Opera " . $tmp_array[1];
        }
    }






.

cieplutki

Update ubuntu version:

        // Try to detect version
        if(preg_match('/utopic/si', $user_agent))
          {
          $client_data['system'] .= " 14.10 Utopic Unicorn)";
          }
        elseif(preg_match('/trusty/si', $user_agent))
          {
          $client_data['system'] .= " 14.04 LTS Trusty Tahr)";
          }
        elseif(preg_match('/saucy/si', $user_agent))
          {
          $client_data['system'] .= " 13.10 Saucy Salamander)";
          }
        elseif(preg_match('/raring /si', $user_agent))
          {
          $client_data['system'] .= " 13.04 Raring Ringtail)";
          }
        elseif(preg_match('/quantal/si', $user_agent))
          {
          $client_data['system'] .= " 12.10 Quantal Quetzal)";
          }
        elseif(preg_match('/precise/si', $user_agent))
          {
          $client_data['system'] .= " 12.04 Precise Pangolin)";
          }
        elseif(preg_match('/oneiric/si', $user_agent))
          {
          $client_data['system'] .= " 11.10 Oneiric Ocelot)";
          }
        elseif(preg_match('/natty/si', $user_agent))
          {
          $client_data['system'] .= " 11.04 Natty Narwhal)";
          }
        elseif(preg_match('/maverick/si', $user_agent))
          {
          $client_data['system'] .= " 10.10 Maverick Meerkat)";
          }
        elseif(preg_match('/lucid/si', $user_agent))
          {
          $client_data['system'] .= " 10.04 LTS Lucid Lynx)";
          }
  elseif(preg_match('/karmic/si', $user_agent))
          {
          $client_data['system'] .= " 9.10 Karmic Koala)";
          }
        elseif(preg_match('/jaunty/si', $user_agent))
          {
          $client_data['system'] .= " 9.04 Jaunty Jackalope)";
          }
        elseif(preg_match('/intrepid/si', $user_agent))
          {
          $client_data['system'] .= " 8.10 Intrepid Ibex)";
          }
        elseif(preg_match('/hardy/si', $user_agent))
          {
          $client_data['system'] .= " 8.04 LTS Hardy Heron)";
          }
        elseif(preg_match('/gutsy/si', $user_agent))
          {
          $client_data['system'] .= " 7.10 Gutsy Gibbon)";
          }
        elseif(preg_match('/ubuntu.feist/si', $user_agent))
          {
          $client_data['system'] .= " 7.04 Feisty Fawn)";
          }
        elseif(preg_match('/ubuntu.edgy/si', $user_agent))
          {
          $client_data['system'] .= " 6.10 Edgy Eft)";
          }
        elseif(preg_match('/ubuntu.dapper/si', $user_agent))
          {
          $client_data['system'] .= " 6.06 LTS Dapper Drake)";
          }
        elseif(preg_match('/ubuntu.breezy/si', $user_agent))
          {
          $client_data['system'] .= " 5.10 Breezy Badger)";
          }
        else
  {
          $client_data['system'] .= ")";




.

MESWEB


Sandmansa

Quote from: cieplutki on January 01, 2014, 05:40:42 AM
hello,

who can test the BlackBerry OS

find:
// SonyEricsson & Ericsson
add before:
//Blackberry
if(preg_match('/blackberry/si', $user_agent))
      {
      $client_data['system'] = "BlackBerry OS";
      $client_data['system_icon'] = "blackberry";
      if(preg_match('/blackberry ([0-9.]+).*/si', $user_agent, $tmp_array))
        {
        $client_data['system'] = "BlackBerry OS" . ($tmp_array[1] ? " ".$tmp_array[1] : "");
        }


currently no icon.

This code cause a Parse error: parse error, unexpected '}'

Here is the fix.

//Blackberry
if(preg_match('/blackberry/si', $user_agent))
      {
      $client_data['system'] = "BlackBerry OS";
      $client_data['system_icon'] = "blackberry";
      if(preg_match('/blackberry ([0-9.]+).*/si', $user_agent, $tmp_array))
        {
        $client_data['system'] = "BlackBerry OS" . ($tmp_array[1] ? " ".$tmp_array[1] : "");
        }
      }

deloon


lukaszuk1995

#476
OS & Browser Detection Mod - for SMF 2.1.
This is is my repack, it works fine on SFM 2.1 Beta 1. You can install it as a normal package, it includes the neawest edist by me and users of this forum  (thx).

Attachment removed on author's request.

Arantor

(And before anyone from the team objects; this mod has been stated as being under a suitable licence for this)

Sandmansa

You know, I tried to do this before.  And even though the author never returned my emails, it still got rejected because of licensing issues.

Arantor

Yes, but these days, the author *has* since indicated such.

Advertisement: