[DEV] Mobile phpBB 3

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
rickey29
Registered User
Posts: 259
Joined: Tue Apr 27, 2004 11:35 am
Location: Beijing, China
Contact:

Re: [DEV] Mobile phpBB 3

Post by rickey29 »

fanmail wrote:

Code: Select all

<?php
 if ( !defined('IN_PHPBB') )
{
	exit;
}


function m_get_detection($data)
{
	$device_list = array(
		// Apple iOS
		'iPad' => array(
			'Apple iPad',
			'jQuery Mobile A-grade',
			'tablet'
		),
		'iPhone' => array(
			'Apple iPhone',
			'jQuery Mobile A-grade',
			'smartphone'
		),
		'iPod' => array(
			'Apple iPod',
			'jQuery Mobile A-grade',
			'smartphone'
		),

		// Kindle Fire
		'Kindle Fire' => array(
			'Kindle Fire',
			'jQuery Mobile A-grade',
			'tablet'
		),
		'Kindle/' => array(
			'Kindle',
			'jQuery Mobile A-grade',
			'tablet'
		),

		// Android
		'Android*Mobile' => array(
			'Android',
			'jQuery Mobile A-grade',
			'smartphone'
		),
		'Android' => array(
			'Android Honeycomb',
			'jQuery Mobile A-grade',
			'tablet'
		),

		// Chrome
		'Chrome/' => array(
			'Chrome',
			'jQuery Mobile A-grade',
			'desktop'
		),

		// Macintosh
		'Macintosh' => array(
			'Macintosh',
			'jQuery Mobile A-grade',
			'desktop'
		),

		// Firefox
		'Firefox/' => array(
			'Firefox',
			'jQuery Mobile A-grade',
			'desktop'
		),

		// Windows Phone
		'Windows Phone' => array(
			'Windows Phone',
			'jQuery Mobile A-grade',
			'smartphone'
		),

		// Windows Mobile
		'Windows CE' => array(
			'Windows Mobile',
			'jQuery Mobile C-grade',
			'feature_phone'
		),

		// Internet Explorer
		'MSIE ' => array(
			'Internet Explorer',
			'jQuery Mobile A-grade',
			'desktop'
		),

		// Opera Mobile
		'Opera Mobi*Version/' => array(
			'Opera Mobile',
			'jQuery Mobile A-grade',
			'smartphone'
		),

		// Opera Mini
		'Opera Mini/' => array(
			'Opera Mini',
			'jQuery Mobile B-grade',
			'feature_phone'
		),

		// Opera
		'Opera*Version/' => array(
			'Opera',
			'jQuery Mobile A-grade',
			'desktop'
		),

		// Palm WebOS
		'webOS/*AppleWebKit' => array(
			'Palm WebOS',
			'jQuery Mobile A-grade',
			'smartphone'
		),
		'TouchPad/' => array(
			'Palm WebOS Pad',
			'jQuery Mobile A-grade',
			'tablet'
		),

		// Meego
		'MeeGo' => array(
			'Meego',
			'jQuery Mobile A-grade',
			'smartphone'
		),

		// BlackBerry
		'BlackBerry*AppleWebKit*Version/' => array(
			'BlackBerry Smartphone',
			'jQuery Mobile A-grade',
			'smartphone'
		),
		'PlayBook*AppleWebKit' => array(
			'BlackBerry Playbook',
			'jQuery Mobile A-grade',
			'tablet'
		),
		'BlackBerry*/*MIDP' => array(
			'BlackBerry Feature Phone',
			'jQuery Mobile C-grade',
			'feature_phone'
		),

		// Safari
		'Safari' => array(
			'Safari',
			'jQuery Mobile A-grade',
			'desktop'
		),

		// Nokia Symbian
		'Symbian/' => array(
			'Nokia Symbian',
			'jQuery Mobile B-grade',
			'smartphone'
		),

		// Google
		'googlebot-mobile' => array(
			'Google Mobile Bot',
			'jQuery Mobile A-grade',
			'mobile-bot'
		),
		'googlebot' => array(
			'Google Bot',
			'',
			'bot'
		),

		// Microsoft
		'bingbot' => array(
			'Microsoft Bing',
			'',
			'bot'
		),

		// Yahoo!
		'Yahoo! Slurp' => array(
			'Yahoo! Slurp',
			'',
			'bot'
		)
	);

	// application/vnd.wap.xhtml+xml
	$accept_list = array(
		'application/vnd.wap.xhtml+xml' => array(
			'unrecognized',
			'jQuery Mobile C-grade',
			'feature-phone'
		)
	);


	if ( !empty($data['user_agent']) )
	{
		foreach ( $device_list as $key => $value )
		{
			if ( preg_match('#' . str_replace('\*', '.*?', preg_quote($key, '#')) . '#i', $data['user_agent']) )
			{
				return $value;
			}
		}
	}

	if ( !empty($data['accept']) )
	{
		foreach ( $accept_list as $key => $value )
		{
			if ( preg_match('#' . str_replace('\*', '.*?', preg_quote($key, '#')) . '#i', $data['accept']) )
			{
				return $value;
			}
		}
	}

	if ( !empty($data['profile']) )
	{
		return array('unrecognized', 'jQuery Mobile C-grade', 'feature-phone');
	}

	if ( empty($data['user_agent']) )
	{
		return array('', '', 'desktop');
	}

	return array('unrecognized', 'unrecognized', 'unrecognized');
}

function m_get_redirection($data)
{
	list($device_platform, $device_grade, $device_system) = m_get_detection($data);
	if ( $device_system == 'desktop' || $device_system == 'bot' )
	{
		return array($device_platform, $device_grade, $device_system, 'desktop', '');
	}
	else if ( $device_system == 'mobile-bot' )
	{
		return array($device_platform, $device_grade, $device_system, 'mobile', '');
	}

	if ( !empty($data['redirection']) )
	{
		if ( $data['redirection'] == 'mobile' )
		{
			return array($device_platform, $device_grade, $device_system, 'mobile', 'mobile');
		}
		else if ( $data['redirection'] == 'desktop' )
		{
			return array($device_platform, $device_grade, $device_system, 'desktop', 'desktop');
		}
	}

	if ( !empty($data['cookie']) )
	{
		if ( $data['cookie'] == 'mobile' )
		{
			return array($device_platform, $device_grade, $device_system, 'mobile', 'mobile');
		}
		else if ( $data['cookie'] == 'desktop' )
		{
			return array($device_platform, $device_grade, $device_system, 'desktop', 'desktop');
		}
	}

	return array($device_platform, $device_grade, $device_system, 'mobile', '');
}
?>
Hi fanmail,

Please do following updating:

OPEN
"yoursite/mobile/lib/detection.php" (the above file)

FIND

Code: Select all

      'MSIE ' => array(
         'Internet Explorer',
         'jQuery Mobile A-grade',
         'desktop'
      ),
ADD AFTER

Code: Select all

      'Windows NT' => array(
         'Internet Explorer',
         'jQuery Mobile A-grade',
         'desktop'
      ),
So, when the User Agent is MS IE 11, my module will consider it as "desktop" (instead of "mobile" before), and will skip the mobile-friendly style.

Any question, please let me know.

Rickey
User avatar
ALX™
Registered User
Posts: 224
Joined: Thu Jun 26, 2014 4:47 pm

Re: [DEV] Mobile phpBB 3

Post by ALX™ »

Goodmorning
I have problem with that

Code: Select all

Set up a sub-domain, such as: "http://m.yoursite.com", which should redirect to "http://yoursite.com/?m-redirection=mobile".
I went in my cp (plesk) at Websites&Domains and I see:

Image

Ι chose "Add new subdomain" and I see:

Image

What should I fill there?

The subdomain in filezilla client it's created in root of my server, and not in httpdocs who have the files of my forum. Is it right?

For now, the mod it works in facebike.gr (and not m.facebike.gr) but because I have the board3 port installed as first page, the mod shown the portal confused.

So... how can setup a new subdomain, and how can send the mobile users in the index page of forum and not to portal?

Τhanks and sorry for my poor english



UPDATE


I speak with my host and made it for me. Everything looks like good but I have some issues

When I type the normal URL (facebike.gr) and chose forum ... everything seems to be right as friendly mobile version.

Image

(the url in the browser's bar don't turn to m.facebike.gr. Is it wrong?)



When I type m.facebike.gr (supposedly is mobile friendly version) and go to the forum, even though entering the mobile friendly version, I see everything tiny! Wrong for the mobile friendly version. Why is this happening?

Image

Αlso... can I change the homepage of the mobile friendly version? Be different from the desktop version? I want to be the http://www.facebike.gr/index.php and not http://www.facebike.gr/portal.php is the desktop version.

Thanks for your help!
Forgive me for my bad english :oops:
rickey29
Registered User
Posts: 259
Joined: Tue Apr 27, 2004 11:35 am
Location: Beijing, China
Contact:

Re: [DEV] Mobile phpBB 3

Post by rickey29 »

ALX™ wrote:Goodmorning
I have problem with that

Code: Select all

Set up a sub-domain, such as: "http://m.yoursite.com", which should redirect to "http://yoursite.com/?m-redirection=mobile".
I went in my cp (plesk) at Websites&Domains and I see:

Image

Ι chose "Add new subdomain" and I see:

Image

What should I fill there?

The subdomain in filezilla client it's created in root of my server, and not in httpdocs who have the files of my forum. Is it right?

For now, the mod it works in facebike.gr (and not m.facebike.gr) but because I have the board3 port installed as first page, the mod shown the portal confused.

So... how can setup a new subdomain, and how can send the mobile users in the index page of forum and not to portal?

Τhanks and sorry for my poor english



UPDATE


I speak with my host and made it for me. Everything looks like good but I have some issues

When I type the normal URL (facebike.gr) and chose forum ... everything seems to be right as friendly mobile version.

Image

(the url in the browser's bar don't turn to m.facebike.gr. Is it wrong?)



When I type m.facebike.gr (supposedly is mobile friendly version) and go to the forum, even though entering the mobile friendly version, I see everything tiny! Wrong for the mobile friendly version. Why is this happening?

Image

Αlso... can I change the homepage of the mobile friendly version? Be different from the desktop version? I want to be the http://www.facebike.gr/index.php and not http://www.facebike.gr/portal.php is the desktop version.

Thanks for your help!
Hi ALX,

I am very sorry for the later response. I did not receive any email notification for this post.

Look like you have removed my module from your web site.

Any question, please let me know, I will try to support you. You can email me directly. You can find my email address in my profile and/or my homepage.

Rickey
User avatar
ALX™
Registered User
Posts: 224
Joined: Thu Jun 26, 2014 4:47 pm

Re: [DEV] Mobile phpBB 3

Post by ALX™ »

Goodmorning. You are right... I unistall the mod because I have problems with tapatalk too.
Nice mod but many problems. I try alone some solutions but not work properly. So I unistalled
Forgive me for my bad english :oops:
rickey29
Registered User
Posts: 259
Joined: Tue Apr 27, 2004 11:35 am
Location: Beijing, China
Contact:

Re: [DEV] Mobile phpBB 3

Post by rickey29 »

ALX™ wrote:Goodmorning. You are right... I unistall the mod because I have problems with tapatalk too.
Nice mod but many problems. I try alone some solutions but not work properly. So I unistalled
I am sorry to hear that. You can setup an empty phpBB 3.1 and install my module based on it before on your real web site. That is a good way to test my module.
User avatar
ALX™
Registered User
Posts: 224
Joined: Thu Jun 26, 2014 4:47 pm

Re: [DEV] Mobile phpBB 3

Post by ALX™ »

OK... thanks
Forgive me for my bad english :oops:
Locked

Return to “[3.0.x] MODs in Development”