View Single Post
  #84  
Old 08-14-2010, 12:35 AM
Michlerish's Avatar
Michlerish Michlerish is offline
 
Join Date: May 2010
Location: Ontario
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dartho View Post
That would detect as a mobile, but not as an iPhone type device. I would have thought people would want the iPad as an exception so it gets the full style? - but to be treated like iphones etc, you should change the following in the plugin.

from
Code:
      $ipodbrowsers = array(
          "iPod",
          "iPhone"
          );
to

Code:
      $ipodbrowsers = array(
          "iPod",
          "iPad",
          "iPhone"
          );
I have this installed as is, no changes. But my users with ipads are still being detected as mobile browsers. I checked the code and ipad is not listed there anywhere. Here is my code (unchanged from download):

Code:
if ($vbulletin->options['mob_detect_enabled'] == 1)
  {
  $mobile=0;
  $pda=0;
  $ipod=0;
  $except_browser=0;
  $custom1=0;

  if ($vbulletin->options['brows_exceptions_enabled'] == 1)
  {
  $exceptbrowsers = explode(",",$vbulletin->options['brows_exceptions']);
  if(preg_match('/('.implode('|', $exceptbrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
    {
        $except_browser=1;
    }
  }



  if ($except_browser==0)
  {
    if ($vbulletin->options['custom1_skin_enabled'] == 1)
    {
    $custom1agents = explode(",",$vbulletin->options['custom1_skin_agent']);
    if(preg_match('/('.implode('|', $custom1agents).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
      {
          $custom1=1;
      }
    }

    if ($vbulletin->options['pda_skin_enabled'] == 1 && $custom1==0) 
    {
      $pdabrowsers = array(
          "Windows CE"
          );
    if(preg_match('/('.implode('|', $pdabrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
      {
        $pda=1;
      }
      else if (isset($_SERVER['HTTP_UA_OS']))
      {
      if (strstr($_SERVER['HTTP_UA_OS'],"POCKET PC") !== false)
        {
	  $pda=1;
        }
      }
    }

    if ($vbulletin->options['ipod_skin_enabled'] == 1 && $custom1==0) 
    {
      $ipodbrowsers = array(
          "iPod",
          "iPhone"
          );
      if(preg_match('/('.implode('|', $ipodbrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
      {
        $ipod=1;
      }
    }


    if ($pda == 0 && $ipod ==0 && $custom1==0)
    {
      if ($vbulletin->options['mobile_skin_enabled'] == 1) 
      {
      $mobilebrowsers = array(
        "WebTV",
        "AvantGo",
        "Blazer",
        "PalmOS",
        "lynx",
        "Go.Web",
        "Elaine",
        "ProxiNet",
        "ChaiFarer",
        "Digital Paths",
        "UP.Browser",
        "Mazingo",
        "iPhone",
        "iPod",
        "Mobile",
        "T68",
        "Syncalot",
        "Danger",
        "Symbian",
        "Symbian OS",
        "SymbianOS",
        "Maemo",
        "Nokia",
        "Xiino",
        "AU-MIC",
        "EPOC",
        "Wireless",
        "Handheld",
        "Smartphone",
        "SAMSUNG",
        "J2ME",
        "MIDP",
        "MIDP-2.0",
        "320x240",
        "240x320",
        "Blackberry8700",
        "Opera Mini",
        "NetFront",
        "BlackBerry",
        "PSP"
        );
 
        if(preg_match('/('.implode('|', $mobilebrowsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match))
        {
          $mobile=1;
        }
        elseif (strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml'))
        {
          $mobile=1;
        }
        elseif (strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml'))
        {
          $mobile=1;
        }
      }
    }
  }

  if ($mobile==1)
  {
    //      echo "<!-- Mobile Device -->";
    $styleid=$vbulletin->options['mobile_skin'];
  }
  else if ($pda==1)
  {
    //      echo "<!-- PDA Device -->";
    $styleid=$vbulletin->options['pda_skin'];
  }
  else if ($ipod==1)
  {
    //      echo "<!-- IPOD Device -->";
    $styleid=$vbulletin->options['ipod_skin'];
  }
  else if ($custom1==1)
  {
    //      echo "<!-- CUSTOM1 Device -->";
    $styleid=$vbulletin->options['custom1_skin'];
  }
  else if ($except_browser==1)
  {
    //      echo "<!-- Excepted Device -->";
  }
  else
  {
    //      echo "<!-- No Mobile Device-->";
  }
}
Any idea why ipads are being treated as mobile?

edit: if it matters, I'm on 4.0.6
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01239 seconds
  • Memory Usage 1,800KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete