[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] STG-Mobile Device Browser Style

Postby Amylittlehands » 07 Jun 2011, 17:27

Sniper_E wrote:Yes Amy, the chat page is already built into your mobile style. Go to chat.php on your iPhone.
You can edit the overall_header and add a link to the chat if you want.
Edit the stylesheet.css and change all of the colors to match your default theme.
I know nothing about the Ultimate Points System or if it would work on a mobile. Maybe.?.

You're good Loosie, we run it on 3.0.8 right now.

For some reason it won't show up (Chat)
We have mChat installed

http://www.mouldingminefield.com/mchat.php

Is that the correct URL?
Forum Information:
PHPBB - 3.0.10
URL - http://www.mouldingminefield.com
Theme - Commun [Modified]
Template - Prosilver
User avatar
Amylittlehands    
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 180
Joined: 06 Aug 2008, 20:16
Location: Cardiff, UK
Gender: Female
phpBB Knowledge: 4


Re: [DEV] STG-Mobile Device Browser Style

Postby Sniper_E » 07 Jun 2011, 19:58

Oh, the mChat... that template may need to be edited for the mobile style.

From the mChat download,
Copy: mchat\root\styles\subsilver2\template\mchat_body.html To: styles/phpBBmobile/template/mchat_body.html

Refresh your mobile style templates in the ACP and then navigate to mchat.php with your iPhone.
Have some other moblie device users see if it works for them also.
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: 6985
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 Amylittlehands » 12 Jun 2011, 11:26

Hey Ed,

Any chance you could tell me how to uninstall this MOD? I reverted the code back within the PHP's and removed files I needed to upload, also refreshed but it comes up with 'Could not get style data' so I must've missed something.
Forum Information:
PHPBB - 3.0.10
URL - http://www.mouldingminefield.com
Theme - Commun [Modified]
Template - Prosilver
User avatar
Amylittlehands    
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 180
Joined: 06 Aug 2008, 20:16
Location: Cardiff, UK
Gender: Female
phpBB Knowledge: 4

Re: [DEV] phpBBmobile Device Browser Style

Postby Sniper_E » 12 Jun 2011, 12:46

Sure. What do you want to uninstall? The phpBBmobile style?
In the ACP / Styles / Delete the style. Delete the templates, theme and imageset.
When deleting the style have it replaced by your default style.

As far as the mobile detection script, just put the codes back to the original codes.
Remove the added codes you put in the includes/session.php and the posting.php files.
Then Purge your cache in the ACP. Refresh your browser.

I just looked at your site.
It looks like you have already removed the mobile style. It's not style 12 anymore.
You don't have the mobile style installed anymore.
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: 6985
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 Amylittlehands » 12 Jun 2011, 13:58

Sniper_E wrote:Sure. What do you want to uninstall? The phpBBmobile style?
In the ACP / Styles / Delete the style. Delete the templates, theme and imageset.
When deleting the style have it replaced by your default style.

As far as the mobile detection script, just put the codes back to the original codes.
Remove the added codes you put in the includes/session.php and the posting.php files.
Then Purge your cache in the ACP. Refresh your browser.

I just looked at your site.
It looks like you have already removed the mobile style. It's not style 12 anymore.
You don't have the mobile style installed anymore.

This is odd, I'm pretty sure I removed all trace of the style in ACP, just had a look and it's not there. I also removed the mobile detection script. I cleared my cache on my iPhone but it's still coming up with Can not get style data.

I'll have a look again though

Edit: My bad, I forgot to copy over the new session.php Thanks for the help Ed ^^
Forum Information:
PHPBB - 3.0.10
URL - http://www.mouldingminefield.com
Theme - Commun [Modified]
Template - Prosilver
User avatar
Amylittlehands    
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 180
Joined: 06 Aug 2008, 20:16
Location: Cardiff, UK
Gender: Female
phpBB Knowledge: 4

Re: [DEV] phpBBmobile Device Browser Style

Postby Sniper_E » 12 Jun 2011, 14:22

Even though you deleted the style in the ACP, Go to Styles / Templates / Delete if that style is still listed.
Do the same with the Theme and Imageset.

I sounds like it is still directing to the mobile style. The edit in the includes/session.php is what does that.
Without that code present it should take you to your default style.
You didn't have the mobile style set as your default did you?
If you did not ever make it active you should not of had that choice.

You'll figure it out. Halla if you can't.
It might even that short circuit between your chair and your keyboard. :P

Edit: OK, glad you got it!
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: 6985
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 ianl » 17 Jun 2011, 03:38

Hello,

Thanks for the great mobile mod!

When I setup the mod on our site I wanted to exclude iPad because the normal these looks ok on the big screen. I noticed that the browser detection script is non-commercial licensed junk. They want $50/year for 10 lines of highly resource intensive preg_match statements. Come on! That is totally incomparable with the GPL license in the install.xml file too...

Here's a new public domain replacement that I wrote in 10 minutes, hope it will help any other commercial boards trying to use this MOD. It is much more efficient, and totally free. It is almost a drop-in replacement, but it lacks device reporting (you won't get the 'from my android phone' and image) and isn't 100% for old devices.

I think it is *way* more efficient in two ways:
1. We don't use pregmatch for simple matches ($50/year for this - really man?)
2. We get the common easy mobiles first, THEN we try to kick out any known desktops before doing more intensive mobile searching.

It will probably take some tweaking to get it right. If you test it and it isn't working for your mobile device please let me know.

Code: Select all
<?php

//License: Creative Commons 0 (public domain)
//Example code should be free, droid face!
//http://dangerousprototypes.com

//goal: get out of here as fast as possible, this code runs every time!
//Dont: use regular expressions. They're super slow!
//Dont: try to identify the phone, who cares?
//Do: use strpos - fastest php search method
//Do: try to identify desktops first! They are most of the hits!

//references
// mobile headers http://www.zytrax.com/tech/web/mobile_ids.html
// code inspiration: http://notnotmobile.appspot.com/
// code inspiration: http://www.russellbeattie.com/blog/mobile-browser-detection-in-php

//same as old phpBBmobile function for drop-in compatibility
function mobile_device_detect(){

   //store the user agent, all lower case for fast matching without stri
   $a=strtolower($_SERVER['HTTP_USER_AGENT']);
   
   //reject any mobile that shouldn't get mobile app (ipad for us)
   if( (strpos($a, 'ipad') !== false) //exclude iPad from mobile
   ){
      return false;
   }

   //don't get this header until we know we need it
   $accept=strtolower($_SERVER['HTTP_ACCEPT']);
   
   //get anything that will mess up the desktop detection.
   //also most obvious stuff
   if( (strpos($a, 'android') !== false) //most popular OS as of 2011, also seen as desktop because of Linux in UA, filter it here
      || (strpos($a, 'phone') !== false) //obvious mobile device, also gets iphone 2nd most popular in 2011
      || (strpos($a, 'mobile') !== false) //obvious "I'm a mobile" in the user agent
      || (strpos($a, 'windows ce') !== false) //look for windows CE now, will mess with windows desktop detection
      || (strpos($a, 'palm') !== false) //some palms have Windows 98/etc agent strings, will mess with windows desktop detection
      || (isset($_SERVER['HTTP_X_OPERAMINI_PHONE'])) //look for stupid opera HTTP_X header
      || (strpos($accept, 'application/vnd.wap.xhtml+xml') !== false) //obvious "I'm a mobile app"
      || (strpos($accept, 'text/vnd.wap.wml') !== false) //obvious "I'm a mobile app"
     ){
      return true;
   }

   //eleminate majority of desktop users first before doing more extensive search
   if( (strpos($a, 'windows') !== false)
      //|| (strpos($a, 'linux') !== false) //disabled because so many phones report Linux in UA, needs deeper check
      || (strpos($a, 'solaris') !== false)
      || (strpos($a, 'bsd') !== false)
      //|| (strpos($a, 'os/') !== false) //can't really do this with mac as far as I can tell
   ){
      return false;
   }

   //now the big list of potential browser strings
   //hopefully we never get here 99% of the time
   //should be ordered from most common to least common
   if( (strpos($a, ' mobi') !== false)
      //|| (strpos($a, 'iphone') !== false) //generic phone check takes care of this
      //|| (strpos($a, 'ipad') !== false) //dont want to use mobile on ipad, generic mobile check takes care of this too
      || (strpos($a, 'wireless') !== false)
      || (strpos($a, 'blackberry') !== false)    
      || (strpos($a, 'opera mini') !== false)
      || (strpos($a, 'symbian') !== false)
      || (strpos($a, 'nokia') !== false)
      || (strpos($a, 'samsung') !== false)
      || (strpos($a, 'ericsson,') !== false)    
      || (strpos($a, 'vodafone/') !== false)
      || (strpos($a, 'kindle') !== false)
      || (strpos($a, 'ipod') !== false)
      || (strpos($a, 'wap1.') !== false)
      || (strpos($a, 'wap2.') !== false)
      || (strpos($a, 'sony') !== false)
      || (strpos($a, 'sanyo') !== false)
      || (strpos($a, 'sharp') !== false)
      || (strpos($a, 'panasonic') !== false)
      || (strpos($a, 'philips') !== false)
      || (strpos($a, 'pocketpc') !== false)
      || (strpos($a, 'avantgo') !== false) //are these people still around? Really? I had that on my palm III
      || (strpos($a, 'blazer') !== false)         
      || (strpos($a, 'ipaq') !== false)   
      || isset($_SERVER['HTTP_X_WAP_PROFILE']) //older headers
      || isset($_SERVER['HTTP_PROFILE']) //older headers
   ){
      return true;
   }

   //nothing matched, assume desktop and not mobile
   return false;
}
?>


Just put this in mobile_device_detect.php and FTP to /includes/mods/

Notes:
1. It gives iPad desktop theme. Delete the first check at the top to stop that.
2. It is the same function name and true/false as the original, it will work as a drop-in replacement.
3. However, it does not return the phone ID, so the 'posted from my ___ phone' won't show a phone type. I removed this entirely to protect our user's privacy by removing the mod to posting.php (this also reduces load).
4. It is not nearly as complete as the old detect for old and strange mobile devices. It will hopefully get most new and modern devices though. It would be great to allow the user the option to switch themes easily...
5. Tested on Firefox Windows, Android (2.3.4/Nexus S), iPad, iPod.

You can check it out at http://dangerousprototypes.com/forum

Please let me know if it doesn't work for you, or if you have any suggestions.
ianl
Crewman
Crewman
 
Posts: 2
Joined: 17 Jun 2011, 03:14
Gender: Male
phpBB Knowledge: 8

Re: [DEV] phpBBmobile Device Browser Style

Postby ianl » 17 Jun 2011, 03:51

I also put a copy in SVN. You can download the latest version from google's web interface:
http://code.google.com/p/dangerous-prot ... hpBBmobile
ianl
Crewman
Crewman
 
Posts: 2
Joined: 17 Jun 2011, 03:14
Gender: Male
phpBB Knowledge: 8

Re: [DEV] phpBBmobile Device Browser Style

Postby love24u » 18 Jun 2011, 06:19

I using 3 styles: Prosilver ( i only want for interner explore) , NovaSupe ( i want for firefox, opera, ...) and 1 for mobile. I very like this mod but it only for 2 styles. can you help me?
love24u    
Crewman
Crewman
 
Posts: 7
Joined: 17 Jun 2011, 20:44
Gender: Male
phpBB Knowledge: 1

Re: [DEV] phpBBmobile Device Browser Style

Postby Sniper_E » 18 Jun 2011, 09:42

There are edits in the includes/session.php for the mobile detect script. Maybe you can make your NovaSup style your default style and just under the codes for the mobile detect script in the session.php, you could add a detect for IE that will direct you to $style = 1;

I wouldn't know how to write that.
Maybe something like:
Code: Select all
$this->data['is_ie'] = false;

if ($this->data['is_ie'] == true;
{
$style = 1;
$this->data['is_ie'] = true;
}


[ Post made via Android] Image
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: 6985
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: Charie_M and 17 guests