[DEV] phpBBmobile Device Browser Style

MOD Authors: Discuss and post updates on new MODs in development for phpBB3, Receive feedback and Feature requests for MODs in development.

To submit your MOD or style, go to the STG MOD Manager
Forum rules
go to the STG MOD Manager to post your MOD in development.
Discuss and receive feedback for any MOD in development for phpBB3.
Suggest features for MODs in development.

No Support or MOD Requests
-- exceptions for MODs only posted here as Beta or Alpha.
Support requests for a MOD should be requested in the respective MOD topic.

Re: [DEV] phpBBmobile Device Browser Style

Postby Sniper_E » 08 Feb 2012, 22:47

Hippie459MN wrote:Sniper_E, I was wondering if you have the original install directions as I have an old mobile site that I want to update to the new mobiles detection for the icons and such and it was removed from the first post. Any help would be great. :)

I just skimmed through the first 50 pages and this is all I found: viewtopic.php?p=106046#p106046
I think I remember that edit being in the includes/session.php
Man, I can't remember that far back on all that we edited for this.
Did you look at the edits needed in the phpBBmobile_detect.zip file? I don't know what to tell you.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6


Re: [DEV] phpBBmobile Device Browser Style

Postby Hippie459MN » 09 Feb 2012, 07:43

I think I found it using web archive. :D I will post it in a zip file later today just encase.

Now I am having a new issue when trying to upgrade with an error about something in the mobile_device_detect.php on line 264. I will look to see what the error is when I get home.

EDIT:
Here is the error I am getting...
Code: Select all
Fatal error: Cannot redeclare mobile_device_detect() (previously declared in /home/hippie74/public_html/hydrostreamforums/includes/mods/mobile_device_detect.php:68) in /home/hippie74/public_html/hydrostreamforums/includes/mods/mobile_device_detect.php on line 246


It worked fine with the old code but with the new mobile detect php file it throws up this error and I cant figure it out right now. lol

EDIT AGAIN: Just realized I had an old install file and used the one from the first post and it looks to be working again. :)
User avatar
Hippie459MN    
Supporter
Supporter
 
Posts: 205
Joined: 08 Feb 2008, 09:40
Location: Minnesota, USA
Favorite Team: Your moms team
Gender: Male
phpBB Knowledge: 6

Re: [DEV] phpBBmobile Device Browser Style

Postby Sniper_E » 21 Mar 2012, 23:20

Here is an updated one that we have been working on since this started. It lists a lot of devices.

includes/mods/mobile_device_detect.php
Code: Select all
<?php

/*

  This code is from http://detectmobilebrowsers.mobi/ - please do not republish it without due credit and hyperlink to http://detectmobilebrowsers.mobi/ really, i'd prefer it if it wasn't republished in full as that way it's main source is it's homepage and it's always kept up to date
 
  For help generating the function call visit http://detectmobilebrowsers.mobi/ and use the function generator. If you need serious help with this please drop me an email to andy@andymoore.info with the subject 'DETECTION CODE PAID SUPPORT REUQEST' with a detailed outline of what you need and how I can help and I will get back to you with a proposal for integration.
 
  Published by Andy Moore - .mobi certified mobile web developer - http://andymoore.info/

  This code is free to download and use on non-profit websites, if your website makes a profit or you require support using this code please upgrade.

  Please upgrade for use on commercial websites http://detectmobilebrowsers.mobi/?volume=49999

  To submit a support request please forward your PayPal receipt with your questions to the email address you sent the money to and I will endeavour to get back to you. It might take me a few days but I reply to all support issues with as much helpful info as I can provide. Though really everything is published on the site.

  The function has eight parameters that can be passed to it which define the way it handles different scenarios. These paramaters are:

    * iPhone - Set to true to treat iPhones as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect iPhones and iPods to.
    * Android - Set to true to treat Android handsets as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect Android and Google mobile users to.
    * Opera Mini - Set to true to treat Opera Mini like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Opera Mini users to.
    * Blackberry - Set to true to treat Blackberry like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Blackberry users to.
    * Palm - Set to true to treat Palm OS like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Palm OS users to.
    * Windows - Set to true to treat Windows Mobiles like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Windows Mobile users to.
    * Mobile Redirect URL - This should be full web address (including http://) of the site (or page) you want to send mobile visitors to. Leaving this blank will make the script return true when it detects a mobile.
    * Desktop Redirect URL - This should be full web address (including http://) of the site (or page) you want to send non-mobile visitors to. Leaving this blank will make the script return false when it fails to detect a mobile.

Change Log:

    * 25.11.08 - Added Amazon's Kindle to the pipe seperated array
    * 27.11.08 - Added support for Blackberry options
    * 27.01.09 - Added usage samples & help with PHP in HTML - .zip
    * 09.03.09 - Added support for Windows Mobile options
    * 09.03.09 - Removed 'ppc;'=>'ppc;', from array to reduce false positives
    * 09.03.09 - Added support for Palm OS options
    * 09.03.09 - Added sample .htaccess html.html and help.html files to download
    * 16.03.09 - Edited sample .htaccess file - now works with GoDaddy
    * 14.08.09 - Reduced false positives
    * 14.08.09 - Added Palm Pre
    * 14.08.09 - Added answer about search engine spiders
    * 14.08.09 - Added status variable to report back it's findings for debugging
    * 14.08.09 - Added Torch Mobile Iris Browser to Windows Mobile section
    * 14.08.09 - Added HTC Touch 3G to Windows Mobile section
    * 14.08.09 - Added help links to PHP header and setup PHP in HTML
    * 14.08.09 - Added six usage examples
    * 15.08.09 - Checked against the list of agents in the WURFL - 99.27% detected!
          o 11,489 mobile user agent strings checked
          o 99.27% detection rate after a number of small changes
          o Those user agent strings listed that are not detected are either robots or too generic for user agent detection
          o Any mobiles not detected by their user agent would most likely return true as they'd be detected by the headers they add.
    * 20.11.09 - Removed PDA from the piped array to stop false positives
    * 22.12.09 - Moved the site to a server hosted at Rackspace
    * 23.12.09 - Added support for Mozilla Fennec
    * 23.04.10 - Added support for the Apple iPad
          o Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10
          o Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7D11
          o Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B317 Safari/531.21.10
    * 23.04.10 - Changed all eregi function calls to preg_match
    * 23.04.10 - Added two more examples
          o Added example-7.php which allows switching between desktop and mobile versions
          o Added example-8.php which shows why the script made the decision it did
    * No longer using include, using require_once instead

bug fixes with many thanks and much credit to http://www.punchkickinteractive.com/ - thanks Ryan!

*/

function mobile_device_detect($iphone=true,$ipod=true,$ipad=true,$android=true,$opera=true,$blackberry=true,$palm=true,$windows=true,$mobileredirect=false,$desktopredirect=false)
{

   $mobile_browser   = false;
   $user_agent      = (!empty($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
   $accept         = (!empty($_SERVER['HTTP_ACCEPT'])) ? $_SERVER['HTTP_ACCEPT'] : getenv('HTTP_ACCEPT');

   switch(true)
   {

      case (preg_match('/ipod/i',$user_agent));
             $mobile_browser = $ipod;
             $status = 'iPod';
         if(substr($ipod,0,4)=='http')
            {
               $mobileredirect = $ipod;
            }
      break;

      case (preg_match('/iphone/i',$user_agent));
             $mobile_browser = $iphone;
             $status = 'iPhone';
         if(substr($iphone,0,4)=='http')
            {
               $mobileredirect = $iphone;
            }
      break;

      case (preg_match('/android/i',$user_agent));
         if (preg_match('/SPH-D700/i',$user_agent))
            {
               $status = 'Samsung Epic';
            }
         elseif (preg_match('/APA9292KT/i',$user_agent))
            {
               $status = 'HTC EVO';
            }
         elseif (preg_match('/A6277/i',$user_agent) || preg_match('/HERO200/i',$user_agent))
            {
               $status = 'HTC Hero';
            }
         elseif (preg_match('/A9192/i',$user_agent) || preg_match('/armv71/i',$user_agent))
            {
               $status = 'HTC Inspire';
            }
            elseif (preg_match('/Android 2.3.7/i',$user_agent) || preg_match('/Nexus S 4G Build/i',$user_agent))
            {
               $status = 'Nexus S';
            }            
         elseif (preg_match('/Android 4.0.3/i',$user_agent) || preg_match('/Transformer Prime TF201 Build/i',$user_agent))
            {
               $status = 'Transformer Prime';
            }            
         elseif (preg_match('/Droid/i',$user_agent))
            {
               $status = 'Motorola Droid';
            }
         else
            {
               $status = 'Android';
            }
         $mobile_browser = $android;

         if(substr($android,0,4)=='http')
            {
               $mobileredirect = $android;
            }
      break;

      case (preg_match('/lge/i',$user_agent));
         if (preg_match('/lge vx9200/i',$user_agent))
            {
               $status = 'LG enV3';
            }
         elseif (preg_match('/lge vx10000/i',$user_agent))
            {
               $status = 'LG Voyager';
            }
         else
            {
               $status = 'LGE';
            }
         $mobile_browser = $lge;

         if(substr($lge,0,4)=='http')
            {
               $mobileredirect = $lge;
            }
      break;

      case (preg_match('/opera mini/i',$user_agent));
         $mobile_browser = $opera;
         $status = 'Mobile Device';
         if(substr($opera,0,4)=='http')
            {
               $mobileredirect = $opera;
            }
      break;

      case (preg_match('/blackberry/i',$user_agent));
         if (preg_match('/BlackBerry8530/i',$user_agent))
            {
               $status = 'BlackBerry Curve';
            }
         else if (preg_match('/BlackBerry8330/i',$user_agent))
            {
               $status = 'BlackBerry Curve';
            }
         else if (preg_match('/BlackBerry8300/i',$user_agent))
            {
               $status = 'BlackBerry Curve';
            }
         else if (preg_match('/BlackBerry8320/i',$user_agent))
            {
               $status = 'BlackBerry Curve';
            }
         else if (preg_match('/BlackBerry8310/i',$user_agent))
            {
               $status = 'BlackBerry Curve';
            }
         else if (preg_match('/BlackBerry9800/i',$user_agent))
            {
               $status = 'BlackBerry Torch';
            }
         else
            {
               $status = 'BlackBerry';
            }
         $mobile_browser = $blackberry;

         if(substr($blackberry,0,4)=='http')
            {
               $mobileredirect = $blackberry;
            }
      break;
      
      case (preg_match('/(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)/i',$user_agent));
         $mobile_browser = $palm;
         $status = 'Palm';
         if(substr($palm,0,4)=='http')
            {
               $mobileredirect = $palm;
            }
      break;

      case (preg_match('/(iris|3g_t|windows ce|windows Phone|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent));
         $mobile_browser = $windows;
         $status = 'Windows Smartphone';
         if(substr($windows,0,4)=='http')
            {
               $mobileredirect = $windows;
            }
      break;
      
      case (preg_match('/(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo)/i',$user_agent));
         $mobile_browser = true;
         $status = 'Mobile Device';
      break;

      case ((strpos($accept,'text/vnd.wap.wml')>0)||(strpos($accept,'application/vnd.wap.xhtml+xml')>0));
         $mobile_browser = true;
         $status = 'Mobile Device';
      break;

      case (isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE']));
         $mobile_browser = true;
         $status = 'Mobile Device';
      break;

      case (in_array(strtolower(substr($user_agent,0,4)),array('1207'=>'1207','3gso'=>'3gso','4thp'=>'4thp','501i'=>'501i','502i'=>'502i','503i'=>'503i','504i'=>'504i','505i'=>'505i','506i'=>'506i','6310'=>'6310','6590'=>'6590','770s'=>'770s','802s'=>'802s','a wa'=>'a wa','acer'=>'acer','acs-'=>'acs-','airn'=>'airn','alav'=>'alav','asus'=>'asus','attw'=>'attw','au-m'=>'au-m','aur '=>'aur ','aus '=>'aus ','abac'=>'abac','acoo'=>'acoo','aiko'=>'aiko','alco'=>'alco','alca'=>'alca','amoi'=>'amoi','anex'=>'anex','anny'=>'anny','anyw'=>'anyw','aptu'=>'aptu','arch'=>'arch','argo'=>'argo','bell'=>'bell','bird'=>'bird','bw-n'=>'bw-n','bw-u'=>'bw-u','beck'=>'beck','benq'=>'benq','bilb'=>'bilb','blac'=>'blac','c55/'=>'c55/','cdm-'=>'cdm-','chtm'=>'chtm','capi'=>'capi','cond'=>'cond','craw'=>'craw','dall'=>'dall','dbte'=>'dbte','dc-s'=>'dc-s','dica'=>'dica','ds-d'=>'ds-d','ds12'=>'ds12','dait'=>'dait','devi'=>'devi','dmob'=>'dmob','doco'=>'doco','dopo'=>'dopo','el49'=>'el49','erk0'=>'erk0','esl8'=>'esl8','ez40'=>'ez40','ez60'=>'ez60','ez70'=>'ez70','ezos'=>'ezos','ezze'=>'ezze','elai'=>'elai','emul'=>'emul','eric'=>'eric','ezwa'=>'ezwa','fake'=>'fake','fly-'=>'fly-','fly_'=>'fly_','g-mo'=>'g-mo','g1 u'=>'g1 u','g560'=>'g560','gf-5'=>'gf-5','grun'=>'grun','gene'=>'gene','go.w'=>'go.w','good'=>'good','grad'=>'grad','hcit'=>'hcit','hd-m'=>'hd-m','hd-p'=>'hd-p','hd-t'=>'hd-t','hei-'=>'hei-','hp i'=>'hp i','hpip'=>'hpip','hs-c'=>'hs-c','htc '=>'htc ','htc-'=>'htc-','htca'=>'htca','htcg'=>'htcg','htcp'=>'htcp','htcs'=>'htcs','htct'=>'htct','htc_'=>'htc_','haie'=>'haie','hita'=>'hita','huaw'=>'huaw','hutc'=>'hutc','i-20'=>'i-20','i-go'=>'i-go','i-ma'=>'i-ma','i230'=>'i230','iac'=>'iac','iac-'=>'iac-','iac/'=>'iac/','ig01'=>'ig01','im1k'=>'im1k','inno'=>'inno','iris'=>'iris','jata'=>'jata','java'=>'java','kddi'=>'kddi','kgt'=>'kgt','kgt/'=>'kgt/','kpt '=>'kpt ','kwc-'=>'kwc-','klon'=>'klon','lexi'=>'lexi','lg g'=>'lg g','lg-a'=>'lg-a','lg-b'=>'lg-b','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-f'=>'lg-f','lg-g'=>'lg-g','lg-k'=>'lg-k','lg-l'=>'lg-l','lg-m'=>'lg-m','lg-o'=>'lg-o','lg-p'=>'lg-p','lg-s'=>'lg-s','lg-t'=>'lg-t','lg-u'=>'lg-u','lg-w'=>'lg-w','lg/k'=>'lg/k','lg/l'=>'lg/l','lg/u'=>'lg/u','lg50'=>'lg50','lg54'=>'lg54','lge-'=>'lge-','lge/'=>'lge/','lynx'=>'lynx','leno'=>'leno','m1-w'=>'m1-w','m3ga'=>'m3ga','m50/'=>'m50/','maui'=>'maui','mc01'=>'mc01','mc21'=>'mc21','mcca'=>'mcca','medi'=>'medi','meri'=>'meri','mio8'=>'mio8','mioa'=>'mioa','mo01'=>'mo01','mo02'=>'mo02','mode'=>'mode','modo'=>'modo','mot '=>'mot ','mot-'=>'mot-','mt50'=>'mt50','mtp1'=>'mtp1','mtv '=>'mtv ','mate'=>'mate','maxo'=>'maxo','merc'=>'merc','mits'=>'mits','mobi'=>'mobi','motv'=>'motv','mozz'=>'mozz','n100'=>'n100','n101'=>'n101','n102'=>'n102','n202'=>'n202','n203'=>'n203','n300'=>'n300','n302'=>'n302','n500'=>'n500','n502'=>'n502','n505'=>'n505','n700'=>'n700','n701'=>'n701','n710'=>'n710','nec-'=>'nec-','nem-'=>'nem-','newg'=>'newg','neon'=>'neon','netf'=>'netf','noki'=>'noki','nzph'=>'nzph','o2 x'=>'o2 x','o2-x'=>'o2-x','opwv'=>'opwv','owg1'=>'owg1','opti'=>'opti','oran'=>'oran','p800'=>'p800','pand'=>'pand','pg-1'=>'pg-1','pg-2'=>'pg-2','pg-3'=>'pg-3','pg-6'=>'pg-6','pg-8'=>'pg-8','pg-c'=>'pg-c','pg13'=>'pg13','phil'=>'phil','pn-2'=>'pn-2','pt-g'=>'pt-g','palm'=>'palm','pana'=>'pana','pire'=>'pire','pock'=>'pock','pose'=>'pose','psio'=>'psio','qa-a'=>'qa-a','qc-2'=>'qc-2','qc-3'=>'qc-3','qc-5'=>'qc-5','qc-7'=>'qc-7','qc07'=>'qc07','qc12'=>'qc12','qc21'=>'qc21','qc32'=>'qc32','qc60'=>'qc60','qci-'=>'qci-','qwap'=>'qwap','qtek'=>'qtek','r380'=>'r380','r600'=>'r600','raks'=>'raks','rim9'=>'rim9','rove'=>'rove','s55/'=>'s55/','sage'=>'sage','sams'=>'sams','sc01'=>'sc01','sch-'=>'sch-','scp-'=>'scp-','sdk/'=>'sdk/','se47'=>'se47','sec-'=>'sec-','sec0'=>'sec0','sec1'=>'sec1','semc'=>'semc','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','sk-0'=>'sk-0','sl45'=>'sl45','slid'=>'slid','smb3'=>'smb3','smt5'=>'smt5','sp01'=>'sp01','sph-'=>'sph-','spv '=>'spv ','spv-'=>'spv-','sy01'=>'sy01','samm'=>'samm','sany'=>'sany','sava'=>'sava','scoo'=>'scoo','send'=>'send','siem'=>'siem','smar'=>'smar','smit'=>'smit','soft'=>'soft','sony'=>'sony','t-mo'=>'t-mo','t218'=>'t218','t250'=>'t250','t600'=>'t600','t610'=>'t610','t618'=>'t618','tcl-'=>'tcl-','tdg-'=>'tdg-','telm'=>'telm','tim-'=>'tim-','ts70'=>'ts70','tsm-'=>'tsm-','tsm3'=>'tsm3','tsm5'=>'tsm5','tx-9'=>'tx-9','tagt'=>'tagt','talk'=>'talk','teli'=>'teli','topl'=>'topl','hiba'=>'hiba','up.b'=>'up.b','upg1'=>'upg1','utst'=>'utst','v400'=>'v400','v750'=>'v750','veri'=>'veri','vk-v'=>'vk-v','vk40'=>'vk40','vk50'=>'vk50','vk52'=>'vk52','vk53'=>'vk53','vm40'=>'vm40','vx98'=>'vx98','virg'=>'virg','vite'=>'vite','voda'=>'voda','vulc'=>'vulc','w3c '=>'w3c ','w3c-'=>'w3c-','wapj'=>'wapj','wapp'=>'wapp','wapu'=>'wapu','wapm'=>'wapm','wig '=>'wig ','wapi'=>'wapi','wapr'=>'wapr','wapv'=>'wapv','wapy'=>'wapy','wapa'=>'wapa','waps'=>'waps','wapt'=>'wapt','winc'=>'winc','winw'=>'winw','wonu'=>'wonu','x700'=>'x700','xda2'=>'xda2','xdag'=>'xdag','yas-'=>'yas-','your'=>'your','zte-'=>'zte-','zeto'=>'zeto','acs-'=>'acs-','alav'=>'alav','alca'=>'alca','amoi'=>'amoi','aste'=>'aste','audi'=>'audi','avan'=>'avan','benq'=>'benq','bird'=>'bird','blac'=>'blac','blaz'=>'blaz','brew'=>'brew','brvw'=>'brvw','bumb'=>'bumb','ccwa'=>'ccwa','cell'=>'cell','cldc'=>'cldc','cmd-'=>'cmd-','dang'=>'dang','doco'=>'doco','eml2'=>'eml2','eric'=>'eric','fetc'=>'fetc','hipt'=>'hipt','http'=>'http','ibro'=>'ibro','idea'=>'idea','ikom'=>'ikom','inno'=>'inno','ipaq'=>'ipaq','jbro'=>'jbro','jemu'=>'jemu','java'=>'java','jigs'=>'jigs','kddi'=>'kddi','keji'=>'keji','kyoc'=>'kyoc','kyok'=>'kyok','leno'=>'leno','lg-c'=>'lg-c','lg-d'=>'lg-d','lg-g'=>'lg-g','lge-'=>'lge-','libw'=>'libw','m-cr'=>'m-cr','maui'=>'maui','maxo'=>'maxo','midp'=>'midp','mits'=>'mits','mmef'=>'mmef','mobi'=>'mobi','mot-'=>'mot-','moto'=>'moto','mwbp'=>'mwbp','mywa'=>'mywa','nec-'=>'nec-','newt'=>'newt','nok6'=>'nok6','noki'=>'noki','o2im'=>'o2im','opwv'=>'opwv','palm'=>'palm','pana'=>'pana','pant'=>'pant','pdxg'=>'pdxg','phil'=>'phil','play'=>'play','pluc'=>'pluc','port'=>'port','prox'=>'prox','qtek'=>'qtek','qwap'=>'qwap','rozo'=>'rozo','sage'=>'sage','sama'=>'sama','sams'=>'sams','sany'=>'sany','sch-'=>'sch-','sec-'=>'sec-','send'=>'send','seri'=>'seri','sgh-'=>'sgh-','shar'=>'shar','sie-'=>'sie-','siem'=>'siem','smal'=>'smal','smar'=>'smar','sony'=>'sony','sph-'=>'sph-','symb'=>'symb','t-mo'=>'t-mo','teli'=>'teli','tim-'=>'tim-','tosh'=>'tosh','treo'=>'treo','tsm-'=>'tsm-','upg1'=>'upg1','upsi'=>'upsi','vk-v'=>'vk-v','voda'=>'voda','vx52'=>'vx52','vx53'=>'vx53','vx60'=>'vx60','vx61'=>'vx61','vx70'=>'vx70','vx80'=>'vx80','vx81'=>'vx81','vx83'=>'vx83','vx85'=>'vx85','wap-'=>'wap-','wapa'=>'wapa','wapi'=>'wapi','wapp'=>'wapp','wapr'=>'wapr','webc'=>'webc','whit'=>'whit','winw'=>'winw','wmlb'=>'wmlb','xda-'=>'xda-',)));
         $mobile_browser = true;
         $status = 'Mobile Device';
      break;

      default;
         $mobile_browser = false;
         $status = 'Desktop / full capability browser';
      break;

   }

   header('Cache-Control: no-transform');
   header('Vary: User-Agent, Accept');

         if($redirect = ($mobile_browser==true) ? $mobileredirect : $desktopredirect)
   {
      header('Location: '.$redirect);
      exit;
   }
         else
      {
         if($mobile_browser=='')
      {
         return $mobile_browser;
      }
         else
         {
            return array($mobile_browser,$status);
         }
      }

}

?>

And here are some images we use for those.
mobile_images.zip
(72.17 KiB) Downloaded 129 times


That might help expand your list from the one you downloaded.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: [DEV] phpBBmobile Device Browser Style

Postby motte » 13 May 2012, 11:47

Hi,

i use your mobile detect script in my Forum. Its fantastic. But know i have an Problem. Well i create a Forum inside my Forum with an different Style than my regular Style. When i visit my inside Forum everything works fine. But when i visit the inside Forum from an mobile device it don't change the Style. Its only shown the Forum in my mobile Style.

Please try it out on your PC and mobile Device on http://www.scenic-forum.de/scenic -> Forum Renault Z.E.
Or direct -> http://www.scenic-forum.de/scenic/viewforum.php?f=95

Well i think the Problem is, that the mobile detect script routed to the mobile Style ( style = xy ), is there any Idea how i can Change the Script ?

Thanks a lot ....
motte
Crewman
Crewman
 
Posts: 1
Joined: 31 Dec 2009, 10:26
Gender: Male

Re: [DEV] phpBBmobile Device Browser Style

Postby cisco007 » 25 Jun 2012, 19:52

hey snipe have i missed something? since i installed this my mobile_device_detect.php files has been located in the includes/ folder but in the post above you say it goes in the includes/mods/ folder unless i missed some edits in any of the five thousand other posts!

just making sure!
cisco007
Supporter
Supporter
 
Posts: 68
Joined: 19 Jul 2008, 13:59
Favorite Team: Florida Gators
Gender: Male
phpBB Knowledge: 5

Re: [DEV] phpBBmobile Device Browser Style

Postby Sniper_E » 25 Jun 2012, 21:03

No Cisco... it will work in either directory as long as you are directed to it in the includes/session.php file.
It was originally setup in the includes/ directory until COC told me the correct place for it is in the includes/mods/ directory.
I think the .zip file on the first post has it in the includes/mods/ directory... not sure, but you're fine.

@ motte, does that forum inside your forum have it's own phpBB files and database?
You do not have to setup a new forum for this...
Just add a mobile style to your first forum for it to direct to. Any mobile style.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: [DEV] phpBBmobile Device Browser Style

Postby cisco007 » 26 Jun 2012, 09:55

ok, i thought that's what the situation would be, next time i will install it in the right place, just making sure i was still ok!
cisco007
Supporter
Supporter
 
Posts: 68
Joined: 19 Jul 2008, 13:59
Favorite Team: Florida Gators
Gender: Male
phpBB Knowledge: 5

Re: [DEV] phpBBmobile Device Browser Style

Postby Kjell » 28 Jun 2012, 08:14

Hello again :hello: long time ago now, I'm alive :grin:

I run the Mobile Detection 2.0 and phpBB 3.0.10 and get a white page in ucp.php, I remove the code from session.php and get access in UCP again ...

Has been playing for a while now, but can not find a solution :cray:
Kjelle
My work - My farm - Ware I live - phpBB support Sweden
"The globe is round, think global", My rules: Be teased is okay on a funny way ;)
User avatar
Kjell    
Supporter
Supporter
 
Posts: 490
Joined: 14 Feb 2007, 13:09
Location: Nordic of Sweden
Favorite Team: NHL N-ville,Forsberg
Gender: Male
phpBB Knowledge: 8

Re: [DEV] phpBBmobile Device Browser Style

Postby Hippie459MN » 07 Jul 2012, 01:07

Anyone have the edits for resizing images in the mobile style? I know they were in the first post at one time and now they are gone. Thanks. :)
User avatar
Hippie459MN    
Supporter
Supporter
 
Posts: 205
Joined: 08 Feb 2008, 09:40
Location: Minnesota, USA
Favorite Team: Your moms team
Gender: Male
phpBB Knowledge: 6

Re: [DEV] phpBBmobile Device Browser Style

Postby Sniper_E » 07 Jul 2012, 09:11

@ Hippie, all of the addon codes that were on the first post have been incorporated into the style.
That image resize code is in the style download now, in the overall_header.html template.
Code: Select all
    window.onload = resizeimg;
    function resizeimg()
    {
       if (document.getElementsByTagName)
       {
          for (i=0; i<document.getElementsByTagName('img').length; i++)
          {
             im = document.getElementsByTagName('img')[i];
             if (im.width > 225)
             {
                im.style.width = '100%';
             }
          }
       }
    }


@ Kjell, hey my old friend. It has been awhile.
The code in the session should not effect the ucp. That sounds weird.
Do you have this in your includes/session.php file?
Code: Select all
      // phpBB_mobile_detect - Mobile Stlye Redirect MOD
         $this->data['is_mobile'] = false;
         include_once($phpbb_root_path . 'includes/mods/mobile_device_detect.' . $phpEx);
         $this->data['is_mobile'] = mobile_device_detect();

         if ($this->data['is_mobile'] == true)
         {
            $style = 3;
            $this->data['is_mobile'] = true;
         }
      // phpBB_mobile_detect End
Of course with the $style = 3; changed to your mobile style install number.

You were suppose to add that code above after the...
Code: Select all
   function setup($lang_set = false, $style = false)
   {
      global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache;

And that second edit in the session.php is needed only if you want your regular users to use index.php?style=3
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6991
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

PreviousNext

Return to MODs in Development

Who is online

Users browsing this forum: No registered users and 20 guests

cron