[RC] Mobile Device

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
Sniper_E
Registered User
Posts: 730
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: [RC] Mobile Device

Post by Sniper_E » Sat Jun 02, 2018 10:56 pm

John connor wrote:
Thu Mar 29, 2018 7:08 am
Hi. I'm using this extension in 3.2.2 and it works well, I haven't upgraded to the latest yet since I have a custom UA there and I need to modify the code again which I can't remember off hand now to do the upgrade. But my question is I get an error with using PHP 7.2.3.
I run the latest version of mobile device on 3.2.2 and I have php 7.2.3 installed with no issues at all.
Maybe you need to update to the latest copy of mobile device.

What ever you did for your custom UA would probable be in the event/listener.php file.
In the updated copy you would add that code in the core/functions.php file.

And as far as your other question, that has nothing to do with the mobile device ext. I can't help you with that.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Wed Sep 19, 2018 6:37 pm

Hi, been getting this error in error_log.


[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/ext/sniper/mobiledevice/event/listener.php on line 542
[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/ext/sniper/mobiledevice/event/listener.php on line 543
[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/ext/sniper/mobiledevice/event/listener.php on line 542
[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/ext/sniper/mobiledevice/event/listener.php on line 543
[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/includes/functions.php on line 4541
[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/includes/functions.php on line 4541
[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/includes/functions.php on line 4541
[19-Sep-2018 09:07:03 America/Denver] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/systechf/public_html/website/includes/functions.php:3291) in /home/systechf/public_html/website/phpbb/json_response.php on line 29
Using phpBB 3.2.3 and PHP 7.1

User avatar
Sniper_E
Registered User
Posts: 730
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: [RC] Mobile Device

Post by Sniper_E » Thu Sep 20, 2018 12:58 am

I'm not sure what to tell you, I'm running phpBB 3.2.3 with php 7.2.9 and mobiledevice 1.0.6 and all is smooth.

You would have to add your special text back in but you could try a fresh mobile install.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Thu Sep 20, 2018 8:06 pm

Yeah, I'm not using that latest because adding my custom UA was a PITA. But I'll goo ahead and tackle this and see how it goes with an update.

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Fri Sep 21, 2018 1:08 pm

So I tried adding my custom drone UA to the latest version without success. In fact, when I activated the extension in my test board I got a blank white page. I had to reupload a backup database to correct the problem.

My code looks like this in functions.php.



public function mobile_device_detect($iphone = true, $ipod = true, $ipad = true, $android = true, $opera = true, $blackberry = true, $palm = true, $windows = true, $lg = true $drone = true)

I see now what I did wrong there. Forgot the comma.

My other code at around line 353.

Code: Select all

break;
				case (preg_match('/777/i',$user_agent));
                $status = 'Drone using encrypted SSH, L2TP, P25, Astro, Provoice-ESK, Tetra, VSLEP, DECT 6.0, WPA2-PSK with a dash of SSL';
                $mobile_browser = true;
            break;

			default;
				$status = $this->user->lang['DESKTOP'];
				$mobile_browser = false;
			break;
			
I also went into migrations and changed this: 'device_name' => array('VCHAR:70', ''), to make sure my very long custom UA works.



Is there something I'm missing here? Did I do anything wrong other than that missing comma?


Edit-

Doing a online character count, it appears it's 110 characters for that UA. I shall change that.

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Fri Sep 21, 2018 2:16 pm

Okay, I uploaded my changed code and this time there's no blank white page, but my custom UA doesn't show up. So obviously something is wrong with my code.

User avatar
Sniper_E
Registered User
Posts: 730
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: [RC] Mobile Device

Post by Sniper_E » Fri Sep 21, 2018 6:00 pm

You can add the switch below without adding the , $drone = true in that top line.

All you need to do is add this case:

Code: Select all

		switch (true)
		{		
			case (preg_match('/777/i',$user_agent));
				$status = $this->user->lang['DRONE'];
				$mobile_browser = true;
			break;
Using $mobile_browser = true; tags it as being mobile.

Then in the common.php language file add your drone below the desktop line.

Code: Select all

	'DRONE'         => 'Drone using encrypted SSH, L2TP, P25, Astro, Provoice-ESK, Tetra, VSLEP, DECT 6.0, WPA2-PSK with a dash of SSL',
And of course edit for the 110 characters in that UA name before installing again.

Then your (Drone using encrypted SSH, L2TP, P25, Astro, Provoice-ESK, Tetra, VSLEP, DECT 6.0, WPA2-PSK with a dash of SSL.png) image.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Sat Sep 22, 2018 6:57 pm

Okay, I don't know PHP so bear with me here. I went to functions.php and at line 352 I added this:
break;

case (preg_match('/777/i',$user_agent));
$status = $this->user->lang['DRONE'];
$mobile_browser = true;
break;


Now in common.php under 'DESKTOP' => 'Desktop', I added:

'DRONE' => 'Drone using encrypted SSH, L2TP, P25, Astro, Provoice-ESK, Tetra, VSLEP, DECT 6.0, WPA2-PSK with a dash of SSL',


Despite that my drone does not show up so obviously I did something wrong. I did reinstall the ext with my new code and purged the cache. The image is there.

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Sat Sep 22, 2018 7:09 pm

I changed $mobile_browser = false; and that still doesn't work.

I swear, by the time I get this working I might just be able to code my own damn extensions. LOL

User avatar
Sniper_E
Registered User
Posts: 730
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: [RC] Mobile Device

Post by Sniper_E » Sat Sep 22, 2018 7:40 pm

Steps to get your special drone to show up in device detection...

1. Download mobiledevice_1.0.6.zip and extract it to your hard drive.

2. Edit the extracted mobiledevice/migrations/mobiledevice_schema.php FIND

Code: Select all

					'device_name'	=> array('VCHAR:30', ''),
REPLACE with

Code: Select all

					'device_name'	=> array('VCHAR:150', ''),
3. Edit the extracted mobiledevice/core/functions.php FIND

Code: Select all

			case (preg_match('/x86_64|WOW64|Win64|Iceweasel/i',$user_agent) && $this->config['mobile_test_enable']);
ADD before

Code: Select all

			case (preg_match('/777/i',$user_agent));
				$status = $this->user->lang['DRONE'];
				$mobile_browser = true;
			break;
4. Edit the extracted mobiledevice/language/en/common.php FIND

Code: Select all

	'DESKTOP'       => 'Desktop',
ADD after

Code: Select all

	'DRONE'         => 'Drone using encrypted SSH, L2TP, P25, Astro, Provoice-ESK, Tetra, VSLEP, DECT 6.0, WPA2-PSK with a dash of SSL',
5. Copy your Drone using encrypted SSH, L2TP, P25, Astro, Provoice-ESK, Tetra, VSLEP, DECT 6.0, WPA2-PSK with a dash of SSL.png
image to the extracted mobiledevice/images/ directory.

OK that should give you what you need on your server.

6. Disable mobiledevice ext in acp, delete data and then delete mobiledevice directory from your server.

7. Copy new extracted... edited files to your server and enable mobiledevice ext.

Good luck and hope that works for you.
Last edited by Sniper_E on Tue Oct 09, 2018 9:28 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
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Sun Sep 23, 2018 1:17 am

And it works! Thanks. Looks like my case was in the wrong spot.

User avatar
Sniper_E
Registered User
Posts: 730
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: [RC] Mobile Device

Post by Sniper_E » Wed Sep 26, 2018 11:23 pm

Yes indeed, if it read the case (preg_match('/x86_64|WOW64|Win64|Iceweasel/i',$user_agent)
before it reads your case (preg_match('/777/i',$user_agent)) then it would not ever read your case.

Once a case is found and gives the results of $mobile_browser = ????; then the query is over.
It will go to the end of the script and will not read any other cases.

So if you have two different cases that will be recognized then you have to put the one you want to show first.
But I'm sure you have all of that figured out by now. Glad you got it working again. You're a master with that now... :)
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Tue Oct 02, 2018 11:18 am

Looks like I have an issue now with this new updated extension I never had before. Making a post with my custom UA, I see this:



SQL ERROR [ mysqli ]

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

SQL

INSERT INTO phpbb_posts (forum_id, poster_id, icon_id, poster_ip, post_time, post_visibility, enable_bbcode, enable_smilies, enable_magic_url, enable_sig, post_username, post_subject, post_text, post_checksum, post_attachment, bbcode_bitfield, bbcode_uid, post_postcount, post_edit_locked, post_device_title, topic_id) VALUES (2, 2, 0, '1.2.3.4', 1538478331, 1, 1, 1, 1, 1, '', 'Test', '<t>Test</t>', '0cbc6611f5540bd0809a388dc95a615b', 0, '', '3bgcqyq2', 1, 0, 'Drone using encrypted SSH, L2TP, P25, Astro, Provoice-ESK, Tetra, VSLEP, DECT 6.0, WPA2-PSK with a dash of SSL', 546)

BACKTRACE

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

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 997
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]/includes/functions_posting.php
LINE: 1887
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/posting.php
LINE: 1445
CALL: submit_post()

User avatar
John connor
Registered User
Posts: 1802
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [RC] Mobile Device

Post by John connor » Wed Oct 03, 2018 10:59 am

Never mind. To make life simpler I just edited my long custom UA to simply "Drone" instead.

User avatar
Sniper_E
Registered User
Posts: 730
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: [RC] Mobile Device

Post by Sniper_E » Wed Oct 03, 2018 10:57 pm

You say you have never seen that error before?
Data too long for column 'post_device_title' at row 1 [1406]
You have reported that error 9 times in this topic.

Connect to phpmyadmin and look in the db for your site, look in the config table, scroll way over to the right and look at the value of the post_device_title column. If it is not set to 150 then you did not follow my directions to the letter. If it is not set to 150 then edit the config table and change that post_device_title value in phpmyadmin.

You have to troubleshoot that problem. I can not see your database. You find the problem and fix it or just stay with 'Drone' I have helped you all I can with that special drone of yours.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: cachete, eindgebruiker, Siava and 27 guests