Scheduled Maintenance: 10-11-2025 Electricity company maintenance between 09:00 and 15:00.

3.2 & 3.3 Extensions Database 3.1 / 3.2Mobile Device

<span class="qte-attr qte_31_32-qte">3.1.x &amp; 3.2.x</span>
User avatar

Topic Author
Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Mobile Device

Post by Sniper_E »

sc4t wrote: 03 Nov 2017, 11:12 Hello!

How to add Windows Mobile Phones?
Exemple: Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 640 XL LTE Dual SIM) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10586
There is a section in the event/listener.php file for the Windows phone. Down past line 500.

Code: Select all

			case (preg_match('/(iris|3g_t|windows ce|windows Phone|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent));
				$status = $this->user->lang['WSP'];
				$mobile_browser = $windows;
			break;
None of these pick up your windows phone?
(iris|3g_t|windows ce|windows Phone|opera mobi|windows ce; smartphone;|windows ce; iemobile)

Change that section to this...

Code: Select all

			case (preg_match('/(iris|3g_t|windows ce|windows Phone|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent));
				if (preg_match('/Lumia 640 XL/i',$user_agent))
				{
					$status = $this->user->lang['L640XL'];
				}
				else
				{
					$status = $this->user->lang['WSP'];
				}
				$mobile_browser = $windows;
			break;
Open the language/en/common.php and FIND

Code: Select all

	'WSP'			=> 'Windows Smartphone',
After ADD on a new line

Code: Select all

	'L640XL'		=> 'Lumia 640 XL',
Then add this image to the images/ directory with the other images. Image

I have you added at my place. :thumbup:
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!™

User avatar

sc4t
Users
Users
Posts: 7
Joined: 20 Aug 2015, 10:01
    Windows 10 Chrome

Re: Mobile Device

Post by sc4t »

Thank you very much for your help Sniper :thumbup:

the line was not found

Code: Select all

<?php
/**
* @package Mobile Device Extension
* @copyright (c) 2015 Sniper_E - http://sniper-e.com
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*/

/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
    exit;
}

if (empty($lang) || !is_array($lang))
{
    $lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
//
// Some characters you may want to copy&paste:
// ’ » “ ” …
//

$lang = array_merge($lang, array(
    'POST_MADE_VIA'         => 'Publier depuis un(e)',
    'MOBILE_DEVICE'         => 'Appareil mobile',
    'MOBILE_DEVICE_LOGIN'   => 'Connecté depuis un(e)',
    'MOBILE_POST'           => 'Bienvenue',
    'MOBILE_POST_AFT1'      => 'Nous avons détecté votre',
    'MOBILE_POST_AFT2'      => 'Détecté',
	
    //UCP
    'MOBILE_DEVICE_USER'           => 'Bienvenue aux utilisateurs mobiles',
    'MOBILE_DEVICE_USER_EXPLAIN'   => 'Affiche le message de bienvenue des utilisateur mobile avec une image.',
    'MOBILE_DEVICE_HEADER'         => 'Image de l\'appareil mobile en-tête',
    'MOBILE_DEVICE_HEADER_EXPLAIN' => 'Affiche l\'image mobile de l\'utilisateur dans le fil d\'Ariane.',
));

User avatar

Topic Author
Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Mobile Device

Post by Sniper_E »

That language file looks like an old one. We are working on version 1.0.5 right now. The latest release was version 1.0.4
Sorry the instructions I gave you were for version 1.0.5 which is not out yet.

In the listener.php file FIND

Code: Select all

			case (preg_match('/(iris|3g_t|windows ce|windows Phone|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent));
				$status = 'Windows Smartphone';
				$mobile_browser = $windows;
			break;
REPLACE with:

Code: Select all

			case (preg_match('/(iris|3g_t|windows ce|windows Phone|opera mobi|windows ce; smartphone;|windows ce; iemobile)/i',$user_agent));
				if (preg_match('/Lumia 640 XL/i',$user_agent))
				{
					$status = 'Lumia 640 XL';
				}
				else
				{
					$status = 'Windows Smartphone';
				}
				$mobile_browser = $windows;
			break;
This is the only edit you need in version 1.0.4, we moved the device names from the listener to the lang files in version 1.0.5

We might be able to get a 1.0.5 version out here for dm's members only. I'll get back to you on that, it's a mess right now.

User avatar

Topic Author
Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Mobile Device

Post by Sniper_E »

Update: Mobile Device
Version: 1.0.5

See first post for download: Mobile Device

User avatar

kaspir
Users
Users
Posts: 112
Joined: 25 Aug 2016, 12:50
    Windows 7 Firefox

Re: Mobile Device

Post by kaspir »

Image

In lang/common.php, line#102 this must be changed as it's a phpbb var:

Code: Select all

	'ON'            => 'Orange Nura',
Nice work mate.
Image
World of Phaos RPG online is making it's come back! Play free now!
Check out phpBB contributions & extension downloads. :P

User avatar

Topic Author
Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Mobile Device

Post by Sniper_E »

kaspir wrote: 01 Dec 2017, 11:55Image

In lang/common.php, line#102 this must be changed as it's a phpbb var:
:thumbup: thanks!

lang/common.php line#102

Code: Select all

'ORN'           => 'Orange Nura',
event/listener.php line#446

Code: Select all

$status = $this->user->lang['ORN'];

User avatar

Topic Author
Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Mobile Device

Post by Sniper_E »

First post updated to Mobile Device version 1.0.6

Added test device with desktop in settings and enhanced some other features.
Please give it a test run and report any issues. Thank you!

User avatar

Mommike
Users
Users
Posts: 12
Joined: 24 Mar 2017, 16:05
    Windows 10 Chrome

Re: Mobile Device

Post by Mommike »

Hey! From version 1.0.5 this plugin is not working on my site anymore. Any idea, what to do to fix it?

Code: Select all

SQL ERROR [ mysqli ]

Data too long for column 'log_ip' at row 1 [1406]

SQL

INSERT INTO phpbb_mobile_logs (user_agent, log_ip, user_name, device_name, log_time) VALUES ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36', '2001:7d0:87cb:7680:8c28:8537:ede3:61c9', 'Marmes', 'Desktop', '1512982860')

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 999
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/ext/sniper/mobiledevice/event/listener.php
LINE: 285
CALL: phpbb\db\driver\factory->sql_query()

FILE: (not given by php)
LINE: (not given by php)
CALL: sniper\mobiledevice\event\listener->page_header()

FILE: [ROOT]/vendor/symfony/event-dispatcher/EventDispatcher.php
LINE: 184
CALL: call_user_func()

FILE: [ROOT]/vendor/symfony/event-dispatcher/EventDispatcher.php
LINE: 46
CALL: Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()

FILE: [ROOT]/phpbb/event/dispatcher.php
LINE: 60
CALL: Symfony\Component\EventDispatcher\EventDispatcher->dispatch()

FILE: [ROOT]/phpbb/event/dispatcher.php
LINE: 46
CALL: phpbb\event\dispatcher->dispatch()

FILE: [ROOT]/includes/functions.php
LINE: 4163
CALL: phpbb\event\dispatcher->trigger_event()

FILE: [ROOT]/index.php
LINE: 238
CALL: page_header()

User avatar

martin
Admin
Admin
Posts: 5106
Joined: 06 Apr 2014, 16:12
    Ubuntu Chrome

Re: Mobile Device

Post by martin »

Install 1.0.5 files and unistall and delete data as you must have updated wrong.
Image

User avatar

Mommike
Users
Users
Posts: 12
Joined: 24 Mar 2017, 16:05
    Windows 10 Chrome

Re: Mobile Device

Post by Mommike »

martin wrote: 11 Dec 2017, 10:33 install 1.0.5 files and unistall and delete data as you must have updated wrong.
No help, still the same. Disabled ext, deleted all data, deleted extension files. Then installed once again. still the same error with both versions (1.0.5 and 1.0.6)

User avatar

Topic Author
Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Mobile Device

Post by Sniper_E »

Thanks for the report Mommike .

Let's try this. Place this listener.php file in the mobiledevice/event/ directory and try to install again.
mobiledevice_listener.zip


martin and dm this is the edit I made to the codes

Code: Select all

			$user_agent = $this->request->server('HTTP_USER_AGENT');
			$user_ip = $this->user->data['user_ip'];
			$user_name = $this->user->data['username'];
			$device_name = $this->request->variable('device_name', $status[1]);
			
			if ($mobilelogs_counter == 0 && $device_name != '')
			{
				$sql_ary = array(
					'user_agent'  => (string) $user_agent,
					'log_ip'      => (string) $user_ip,
					'user_name'   => (string) $user_name,
					'device_name' => (string) $device_name,
					'log_time'    => (string) time(),
I defined $user_ip and replaced the (string) for 'log_ip'
You do not have the required permissions to view the files attached to this post! Maybe your post count is too low.

User avatar

Mommike
Users
Users
Posts: 12
Joined: 24 Mar 2017, 16:05
    Windows 10 Chrome

Re: Mobile Device

Post by Mommike »

Sniper_E wrote: 11 Dec 2017, 17:12 Thanks for the report Mommike .

Let's try this. Place this listener.php file in the mobiledevice/event/ directory and try to install again.
mobiledevice_listener.zip



martin and dm this is the edit I made to the codes

Code: Select all

			$user_agent = $this->request->server('HTTP_USER_AGENT');
			$user_ip = $this->user->data['user_ip'];
			$user_name = $this->user->data['username'];
			$device_name = $this->request->variable('device_name', $status[1]);
			
			if ($mobilelogs_counter == 0 && $device_name != '')
			{
				$sql_ary = array(
					'user_agent'  => (string) $user_agent,
					'log_ip'      => (string) $user_ip,
					'user_name'   => (string) $user_name,
					'device_name' => (string) $device_name,
					'log_time'    => (string) time(),
I defined $user_ip and replaced the (string) for 'log_ip'
Thanks! It's working again!

User avatar

german-german
Users
Users
Posts: 2
Joined: 12 Dec 2017, 20:36
    Android Opera

Re: Mobile Device

Post by german-german »

Download link broken (?
You do not have the required permissions to view the files attached to this post! Maybe your post count is too low.

User avatar

Topic Author
Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Mobile Device

Post by Sniper_E »

Fixed...

User avatar

Webmaster Chuck
Users
Users
Posts: 5
Joined: 09 May 2017, 07:23
    Windows 10 Firefox

Re: Mobile Device

Post by Webmaster Chuck »

Awesome Extension. Worked like a champ on 3.2.1 right out of the box!

What is the best place you folks have found to get the images of the phones?

:question:

Post Reply Previous topicNext topic