[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!
Scam Warning
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
MedCo
Registered User
Posts: 58
Joined: Tue Jul 14, 2015 4:09 pm
Contact:

Re: [DEV] Mobile Device

Post by MedCo » Tue Sep 22, 2015 6:19 pm

Hello, unfortunately, is the mistake, even if I visit your website. (See picture above) On the website from Dmzx is not the debug error message.

User avatar
martin123456
I've Been Banned!
Posts: 726
Joined: Sat Mar 05, 2011 7:44 pm

Re: [DEV] Mobile Device

Post by martin123456 » Tue Sep 22, 2015 7:45 pm

Nice

[ Post made via Barbie Phone ] Image

Code: Select all

<!-- IF S_CODE_UNTIDY and S_MESS_ON_INDEX Good If_Not_TIDY_Then_SUBMIT -->

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

Re: [DEV] Mobile Device

Post by Sniper_E » Tue Sep 22, 2015 8:14 pm

Well MedCo I do not see that error message on my site and neither does dmzx. We both checked.
The line $status = $this->user->lang['MOBILE_DEVICE']; is defined in the language file.
Those lines are correct and those lines are the only place you will find MOBILE_DEVICE
Do you still see that error on my site or on dmzx's site? You seem to be the only one seeing this.

I'm guessing from your comment that you are still seeing that error on your site also.

Try this:
  1. Disable the extension in the ACP
  2. Delete the data from the extension in the ACP
  3. Purge your server cache - all traces of the extension should be gone
  4. Delete the files from your server in the ext/sniper/mobiledevice/ directory
  5. Upload the new files from the mobiledevice1.0.1.zip extraction
  6. Enable the extension again, clear your browser and see if all is well.
Just to be sure... in your language file that you created and edited to your language...
In your common.php language file did you leave the 'MOBILE_DEVICE' as it was?
In the line 'MOBILE_DEVICE' => 'Mobile Device', you only replace the 'Mobile Device' part.
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: 58
Joined: Tue Jul 14, 2015 4:09 pm
Contact:

Re: [DEV] Mobile Device

Post by MedCo » Tue Sep 22, 2015 10:22 pm

Hello, thank you for your patience. It was not the language file. The error came from a used mobile simulator. Step by step I have your valuable script now activated. It works. Thank you for the priceless support.

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

Re: [DEV] Mobile Device

Post by John connor » Fri Sep 25, 2015 2:07 am

Hello Sniper. I have my code again in the listener.php file, but in 3.1.6 I get a series of errors at the top of the page index. So obviously I have the code wrong or I need to add code somewhere. These are the errors:

Code: Select all

phpBB Debug] PHP Notice: in file [ROOT]/ext/sniper/mobiledevice/event/listener.php on line 516: Undefined variable: drone
[phpBB Debug] PHP Notice: in file [ROOT]/ext/sniper/mobiledevice/event/listener.php on line 517: Undefined variable: drone
[phpBB Debug] PHP Notice: in file [ROOT]/ext/sniper/mobiledevice/event/listener.php on line 516: Undefined variable: drone
[phpBB Debug] PHP Notice: in file [ROOT]/ext/sniper/mobiledevice/event/listener.php on line 517: Undefined variable: drone


This is the code I used before that worked. It starts on line 507 just after

Code: Select all

case                 $mobile_browser = true;
            break;

Code: Select all

case (preg_match('/drone/i',$user_agent));
                if (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';
                }
                else
                {
                    $status = 'Drone';
                }
                $mobile_browser = $drone;
                if(substr($drone,0,4)=='http')
                {
                    $mobileredirect = $drone;
                }
            break;
My User agent I set in my browser looks like this: Drone / Drone: Mozilla/5.0 drone 777

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

Re: [DEV] Mobile Device

Post by Sniper_E » Fri Sep 25, 2015 4:23 am

You can add your drone user agent as the first case if you want. You did fine on your case codes.

Code: Select all

    private function mobile_device_detect($drone=true,$iphone=true,$ipod=true,$ipad=true,$android=true,$opera=true,$blackberry=true,$palm=true,$windows=true,$lg=true,$mobileredirect=false,$desktopredirect=false)
    {
        $post = $this->request->get_super_global(\phpbb\request\request::SERVER);
        $mobile_browser	= false;
        $user_agent		= (!empty($post['HTTP_USER_AGENT'])) ? $post['HTTP_USER_AGENT'] : getenv('HTTP_USER_AGENT');
        $accept			= (!empty($post['HTTP_ACCEPT'])) ? $post['HTTP_ACCEPT'] : getenv('HTTP_ACCEPT');

        switch(true)
        {
            case (preg_match('/drone/i',$user_agent));
                if (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';
                }
                else
                {
                    $status = 'Drone';
                }
                $mobile_browser = $drone;
                if(substr($drone,0,4)=='http')
                {
                    $mobileredirect = $drone;
                }
            break;
Notice the $drone=true, added in the private function mobile_device_detect line.
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: 1494
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [DEV] Mobile Device

Post by John connor » Fri Sep 25, 2015 7:34 am

That's right! I forgot about the private code line!

Edit-

Works! Thanks again!

http://imgur.com/hLHKqqa

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

Re: [DEV] Mobile Device

Post by Sniper_E » Fri Sep 25, 2015 8:01 am

Image Tip: You can have that message say, "Welcome Guest" - I never did liked Anonymous

ACP/Users and Groups tab/Manage users/check, Select anonymous user/Submit/Username: Guest
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: 1494
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [DEV] Mobile Device

Post by John connor » Fri Sep 25, 2015 10:13 am

Nice! Never knew I could do that. Thanks! :D

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

Re: [DEV] Mobile Device

Post by Sniper_E » Sun Sep 27, 2015 6:49 am

I had a user requesting ACP switch to turn off the welcome mobile user message for all users.

Maybe these new features enabled should be a admin choice for each board.
I'll add some switches in ACP on next version and maybe have these off by default.

If you want to turn off the welcome message for every user, run this sql command in your phpmyadmin

Code: Select all

// To turn off welcome message all users
UPDATE `phpbb_users` SET `user_mobile_welcome` = '0';
// To turn off header image all users
UPDATE `phpbb_users` SET `user_mobile_header` = '0';
// To turn on welcome message for only Guests
UPDATE `phpbb_users` SET `user_mobile_welcome` = '1' WHERE `phpbb_users`.`user_id` = 1;
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: 1494
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [DEV] Mobile Device

Post by John connor » Mon Sep 28, 2015 7:40 am

I would like the ACP settings and not have it off by default.

How does this EXT know that I'm using a laptop? I can only guess that it's seeing my screen resolution? This is the User agent I'm using, yet it does say laptop and in fact I'm using a laptop.

Linux / Firefox 41.0: Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0

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

Re: [DEV] Mobile Device

Post by Sniper_E » Mon Sep 28, 2015 1:44 pm

No way John... :o Did I leave that laptop code in the last release? That is not suppose to be there.

Oooops!

Code: Select all

            case (preg_match('/x86/i',$user_agent));
                $mobile_browser = $android;
                $status = 'Linux Laptop';
                    if(substr($ipad,0,4)=='http')
                    {
                        $mobileredirect = $android;
                    }
            break;
That case was suppose to be removed. Did I leave the laptop image in there also? :roll:

When testing I added a laptop and even my desktop as a case. I test everything while on my desktop. It is easier than coding, uploading and picking up my mobile phone to check out the results. My desktop is setup as a tablet on my site right now for testing purposes. Actually your laptop will read at my site also. But I promise to remove those on the next release.

I have the extra features turned off as default in the ACP right now.
I think I will have them turned on as default. The admin can turn them off easy enough.
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: 1494
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [DEV] Mobile Device

Post by John connor » Tue Sep 29, 2015 8:10 am

Yep, laptop image is there too. :lol: Thing is, it says Linux laptop, but if you look at the image it's running XP. :lol:

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

Re: [DEV] Mobile Device

Post by Sniper_E » Wed Sep 30, 2015 4:26 am

First post updated to Mobile Device version 1.0.2 for phpBB 3.1.6

Added ACP controls & again Updated mobile list with images. Mobile Detect 1.0.2

Thanks go out to all who help in testing this mobile device extension!
I could not have done it as easy without you. Thank You!
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: 1494
Joined: Fri Nov 14, 2014 5:14 pm
Location: U S Of A
Contact:

Re: [DEV] Mobile Device

Post by John connor » Wed Sep 30, 2015 4:34 am

Thanks! 8-)

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: ErnadoO, Hartenheer, jackennils, martti, Naguissa, RomaamoR and 11 guests