[ABD] [RC] Mobile Device

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
User avatar
Sniper_E
Registered User
Posts: 1210
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

[ABD] [RC] Mobile Device

Post by Sniper_E »

Extension Name: Mobile Device
Version: 1.0.6

Authors: Sniper_E and dmzx and martin

Extension Features:
  • Adds [ Post made via Mobile Device ]Image in a post when user is posting from a mobile device.
  • Welcome mobile user message on index page showing user's mobile device.
  • Displays logged in user's mobile image in header navbar on all other pages.
  • Displays user is online on their mobile in topic mini-profile and view profile page.
  • Popup mobile logs page to view any user on mobile who has visited your site.
  • Selections in UCP / Board preferences / Display options for user options.
  • Selections in ACP / Extensions / Mobile device / Settings for enabling features.
  • Permissions / Misc in ACP will select who can view logs and who can clear logs.
Adding Devices: The mobile list is easily editable to add as many mobile devices you need.
Instructions on adding mobile devices to the list coming next.

Screenshot:
Image

Demo URL: Visit on Mobile - Sniper_E Styles

GitHub: Github/Sniper-E/Mobile-Device

Requirements: Requires php>=5.3.3 and phpbb>=3.1.6-RC1

Mobile Device Extension Download: mobiledevice_1.0.6.zip

Enjoy! :D

Update:
  1. Navigate to ACP -> Customise -> Enabled Extensions -> Mobile Device and click Disable
  2. Copy the updated mobiledevice/ folder into server root/ext/sniper/ directory, over write files.
  3. Navigate to ACP -> Customise -> Disabled Extensions -> Mobile Device and click Enable
Install:
  1. In the root/ext/ directory of your phpBB board, create a new directory named sniper/
  2. Copy the mobiledevice/ folder into server root/ext/sniper/ directory.
  3. Navigate to ACP -> Customise -> Disabled Extensions -> Mobile Device and click Enable
Uninstall:
  1. Navigate to ACP -> Customise -> Enabled Extensions / Mobile Device and click Disable
  2. To permanently uninstall, click Delete Data and then delete the folder /ext/sniper/mobiledevice
Note: This extension is based off of the 2008 php 3.0.* phpBB_mobile_detect mod @
pbpBB Academy at StarTrek Guide with 3921 downloads it may still be an interest to some.

[ Post edited via Samsung Galaxy S5 Active ]Image
Last edited by Sniper_E on Sat Sep 22, 2018 8:43 pm, edited 42 times in total.
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
Sniper_E
Registered User
Posts: 1210
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: [DEV] Mobile Device

Post by Sniper_E »

Instructions on adding new mobile devices to the list

First you will need to find the browser a mobile device uses and the mobile device name.
I signed into my site on my mobile device (Samsung Galaxy S5 Active) and looked in the Who is Online

This is what I saw as my mobile browser in the who is online page...
Image
You want the numbers of that Samsung mobile device... SM-G870A the number before Build
You can do a Google Search using that number to find out the name of the device.

Open: ext/sniper/mobiledevice/event/listener.php

Find
Tip: This may be a partial find and not the whole line

Code: Select all

			case (preg_match('/android/i',$user_agent));
				$status = 'Android';
				$mobile_browser = $android;
				if(substr($android,0,4)=='http')
				{
					$mobileredirect = $android;
				}
			break;
Replace with
Tip: Replace the preceding lines with the following

Code: Select all

			case (preg_match('/android/i',$user_agent));
				if (preg_match('/SM-G870A/i',$user_agent))
				{
					$status = 'Samsung Galaxy S5 Active';
				}
				else
				{
					$status = 'Android';
				}
				$mobile_browser = $android;
				if(substr($android,0,4)=='http')
				{
					$mobileredirect = $android;
				}
			break;
Do you see where I replaced the $status = 'Android'; line with another
preg_match('/SM-G870A/i',$user_agent line for my phone?

Then below after listing the information on the numbers from my browser and my device name...
I added the else statement with the original $status = 'Android'; line.

Adding a second mobile devices to that list

OK now lets add another device in there. I will use a different mobile device this time to demonstrate.
I signed into my site on my tablet (Samsung Galaxy2 Tablet) and looked in the Who is Online

This is what I saw as my mobile browser in the who is online page...
Image
You want the numbers of that Samsung tablet... SGH-I497

Open: ext/sniper/mobiledevice/event/listener.php

Replace with
Tip: Replace the preceding lines with the following

Code: Select all

			case (preg_match('/android/i',$user_agent));
				if (preg_match('/SM-G870A/i',$user_agent))
				{
					$status = 'Samsung Galaxy S5 Active';
				}
				elseif (preg_match('/SGH-I497/i',$user_agent))
				{
					$status = 'Samsung Galaxy2 Tablet';
				}
				else
				{
					$status = 'Android';
				}
				$mobile_browser = $android;
				if(substr($android,0,4)=='http')
				{
					$mobileredirect = $android;
				}
			break;
You can see the elseif line for the next device. Repeat that elseif for all other devices you add.
You can see the devices we added while testing this extension in the mobiledevice/event/listener.php file.

Adding Mobile Images

Then all you need to do is search online for an image for the mobile device you are adding and place
the image in the images/ directory. All images are max 32px in height and as wide as you need the images to have 8px transparent space on the sides. You will have to create the mobile image with
a transparent background and save as device_name.png image. If you need help with that just halla.

Adding multiple mobile devices with the same device name

There's a BlackBerry named Blackberry Curve it's model number in browser is BlackBerry8530
Another BlackBerry named Blackberry Curve it's model number in browser is BlackBerry8330
And another BlackBerry named Blackberry Curve it's model number in it's browser is BlackBerry8300

When listing multiple mobile devices with the same name they should be added in the same line...

Open: ext/sniper/mobiledevice/event/listener.php

Replace with
Tip: Replace the preceding lines with the following

Code: Select all

			case (preg_match('/blackberry/i',$user_agent));
				if (preg_match('/BlackBerry8530|BlackBerry8330|BlackBerry8300/i',$user_agent))
				{
					$status = 'BlackBerry Curve';
				}
				else
				{
					$status = 'BlackBerry';
				}
				$mobile_browser = $blackberry;
				if(substr($blackberry,0,4)=='http')
				{
					$mobileredirect = $blackberry;
				}
			break;
Enjoy!
[ Post made via Samsung Galaxy S5 Active ] Image
Last edited by Sniper_E on Tue Oct 09, 2018 10:50 pm, edited 9 times in total.
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
Mess
Registered User
Posts: 985
Joined: Wed Jul 01, 2009 6:37 am
Name: Kim

Re: [DEV] Mobile Device

Post by Mess »

Cool, thanks for sharing. :)
User avatar
lopoto
Registered User
Posts: 111
Joined: Thu Feb 12, 2015 3:13 pm

Re: [DEV] Mobile Device

Post by lopoto »

thanks :ugeek:
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: [DEV] Mobile Device

Post by david63 »

Just a thought and I don't know how feasible it would be - but rather than hard coding the mobile devices could you not use an online database and look up there. That way both you and the users will avoid the need to constantly have to update the extension.
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
John45
Registered User
Posts: 199
Joined: Sat Jun 08, 2013 2:54 am

Re: [DEV] Mobile Device

Post by John45 »

Sounds cool, but your website is down, so the demo url and screenshot don't work at all.
User avatar
dmzx
Registered User
Posts: 865
Joined: Fri Sep 05, 2014 6:48 am
Location: The Netherlands

Re: [DEV] Mobile Device

Post by dmzx »

Image
Contact me on dmzx-web.net
User avatar
Sniper_E
Registered User
Posts: 1210
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: [DEV] Mobile Device

Post by Sniper_E »

John45 wrote:Sounds cool, but your website is down, so the demo url and screenshot don't work at all.
Yes John, sorry about that.
The internet went down for a few hours where my test server is located but it's back up now.
david63 wrote:Just a thought and I don't know how feasible it would be - but rather than hard coding the mobile devices could you not use an online database and look up there. That way both you and the users will avoid the need to constantly have to update the extension.
I agree David, but in searching all I ever found were scripts that returned if you were on a mobile device and quite a few redirects if you were. None of them would return the mobile name.

Of couse with phpBB being mobile friendly the redirects are not needed. Actually this mobile script being used use to redirect you to another style (your mobile style) in the phpBB_mobile_detect 3.0.* mod we used. I'm sure most users used that phpBB_mobile_detect script to redirect them to Arty's mobile style.

Note: This script could be used and never upadted or added to if you did not mind it simply saying...

[ Post made via Android ] Image -- [ Post made via BlackBerry ] Image -- [ Post made via Mobile Device ] Image

But if you wanted to personalize it to define a particular device with it's name then you have to add it.

[ Post made via Samsung Galaxy2 Tablet ] Image
Last edited by Sniper_E on Wed Sep 02, 2015 9:41 pm, edited 2 times in total.
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
tahoebuff
Registered User
Posts: 1429
Joined: Tue Jul 20, 2004 12:33 am
Location: Nevada
Name: Michael

Re: [DEV] Mobile Device

Post by tahoebuff »

Great job. I've been wanting this for some time :D
Rimesia
Registered User
Posts: 25
Joined: Sat Jul 12, 2014 4:31 pm

Re: [DEV] Mobile Device

Post by Rimesia »

Excellent job. I have been using this on my 3.0.x board since when It's first released.
User avatar
MedCo
Registered User
Posts: 111
Joined: Tue Jul 14, 2015 4:09 pm

Re: [DEV] Mobile Device

Post by MedCo »

Successful expansion. How can I change "Mobile Device" in a different language? In the language file, I find only "Post made via".
Thank you
User avatar
Sniper_E
Registered User
Posts: 1210
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey

Re: [DEV] Mobile Device

Post by Sniper_E »

MedCo wrote:Successful expansion. How can I change "Mobile Device" in a different language? In the language file, I find only "Post made via".
Thank you
You can change 'Post made via' in your language file which would be located in your language directory.
But you already know that. I know that is not what you are asking.

We will add more language files on the next release.
Share with me what you change them to. And what language you use.
We will add Mobile Device to the language file also.

You will have to open the event/listener.php for now to change the device names and find these lines...

Code: Select all

				$status = 'Mobile Device';
Line 158, 203, 208, 213 and 218
There are 5 of them in that file. Change any name you need to in the $status = ' '; lines.
Image . -.. / .... ..- -- .--. .... .-. . -.--
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!

:!: Sniper_E Styles | phpbbmodders :!:
User avatar
MedCo
Registered User
Posts: 111
Joined: Tue Jul 14, 2015 4:09 pm

Re: [DEV] Mobile Device

Post by MedCo »

Thank you for the quick support.
User avatar
Hippie459MN
Registered User
Posts: 966
Joined: Mon Oct 15, 2007 10:13 pm
Location: Minnesota, USA

Re: [DEV] Mobile Device

Post by Hippie459MN »

Sniper_e Thanks for this. Going to be installing it for sure. As always, great work. :)
User avatar
2600
I've Been Banned!
Posts: 2567
Joined: Fri Nov 14, 2014 5:14 pm
Location: Area-51

Re: [DEV] Mobile Device

Post by 2600 »

I think it would be easier to have an option in the ACP/Extensions where you can add a user agent rather than messing with code.

Scroll to the bottom for a basic list of mobile UAs. http://www.useragentstring.com/pages/us ... string.php

Here's a bigger list: https://udger.com/resources/ua-list#Mobile%20Browser

[offtopic]Do you have a business Comcast account? How did Comcast allow port 80?

You need an image for the shoe phone! :lol:[/offtopic]
Morpheus: Unfortunately, no one can be told what The Matrix is. You'll have to see it for yourself.
Hack me.
Consider a canary token.
The nature of my chosen username
:ugeek:

Return to “Abandoned Extensions”