News:

Wondering if this will always be free?  See why free is better.

Main Menu

SMF4iPhone Mod

Started by Fabius85, May 14, 2010, 01:58:13 AM

Previous topic - Next topic

dugbug

So how do you install a mod?  I assume its a "package" and tried to use the admin browse package feature, but it requires I select an individual file... so do I choose install.xml or something?

I tried copying the mod contents to the packages folder, so now the admin browse packages shows it but its not installed, nor is there an option to click on install.  How does one activate it?

thanks for any help

dugbug

Ok nevermind... I have RC5 and it checks a compatibility list prior to offering an install button.  For experimentation, I added RC5 to the list and it let me attempt to install it, however the installation complains that a mod must be made to the SMF4iPhone theme.

In particular, Profile.template.php.  It wants to find some code and then append a few lines.  The problem is the code it is attempting to locate does not exist in the file.

I have the latest versions of both the mod and theme.

any ideas?

DEEPSNUYB

This where you should manually edit your files. Its good practice amyways instead of using the package manager.

The mod doesn't works anyways with RC4.

z_dane

i also using RC5. before this no problem with RC4.
i get error log state "SMF4iPhone Mod failed to connect to DetectFree"

any idea?

Commander Keen

I'm using RC4 with this Mod. The Theme itself works but I also get the error telling me that there's no connection to DetectFree.
At least I now know why it's not working ;-).
But why is there no connection?

butchs

Fabius85 is working hard trying to find out what changes detect free made that are preventing the mod from working.
I have been truly inspired by the SUGGESTIONS as I sit on my throne and contemplate the wisdom imposed upon me.

mkress

#186
it's unnecessary to request a webservice for every user

I have downloaded following file and added to Sources-dir:
http://detectmobilebrowsers.mobi/

Then I replaced this in DetectFree.php:

//No data in SMF cache about this IP or session and no cookie. Time to check the Detectfree db
        $headers = "";
        if (function_exists("getAllHeaders")) {
                foreach (getAllHeaders() as $key => $value) {
                        $key_lower = strtolower($key);
                        if ($key_lower == "connection") continue;
                        if ($key_lower == "content-length") continue;
                        if ($key_lower == "content-type") continue;
                        if ($key_lower == "host") continue;
                        if ($key_lower == "keep-alive") continue;
                        $headers .= "$key: $value\r\n";
                }
        } else {
                foreach ($_SERVER as $key => $value) {
                        if (substr($key, 0, 5) == "HTTP_") {
                                $key = str_replace("_", " ", substr($key, 5));
                                $key = str_replace(" ", "-", ucwords(strtolower($key)));
                                $key_lower = strtolower($key);
                                if ($key_lower == "connection") continue;
                                if ($key_lower == "content-length") continue;
                                if ($key_lower == "content-type") continue;
                                if ($key_lower == "host") continue;
                                if ($key_lower == "keep-alive") continue;
                                $headers .= "$key: $value\r\n";
                        }
                }
        }
       
        $url = "http://detectfree.moviladetection.com/";
$contents  = iphone_fetch_web_data($url, $headers);

$is_mobile = "undef";

if (!$contents) {
loadLanguage('Errors');
log_error($txt['iphDNS'], 'user'); // could not connect
        } else {
                $lines = explode("\r?\n", $contents);
               
                foreach ($lines as $line) {
                        $pos = strpos($line, ":");
                        if ($pos && strlen($line) > $pos + 1) {
                                $key = substr($line, 0, $pos);
                                $value = substr($line, $pos + 1);
                                if ($key == "is_mobile")
                                        $is_mobile = $value;
                        }
                }
        }

if ($is_mobile != "true")
$detectfree_check = "false"; // iphone_lookup
else
$detectfree_check = "true"; // iphone_lookup



with this:

require_once($sourcedir . '/mobile_device_detect.php');
$mobileCheck = mobile_device_detect(true,true,true,true,true,true,true,false,false);
$detectfree_check = $mobileCheck[0];


so the function iphone_fetch_web_data is unnecessary and no external request is needed

b4pjoe

#187
Quote from: fca07 on February 27, 2011, 08:18:17 AM
it's unnecessary to request a webservice for every user

I have downloaded following file and added to Sources-dir:
http://detectmobilebrowsers.mobi/

Then I replaced this in DetectFree.php:

<clip>

so the function iphone_fetch_web_data is unnecessary and no external request is needed

Can you tell me what this does to iPad users? Is it detected as a mobile browser because my iPad users do not want to be switched to the mobile theme.

Nevermind. I see at that site that:

QuoteThe function has eight parameters that can be passed to it which define the way it handles different scenarios. These paramaters are:

    * iPhone - Set to true to treat iPhones as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect iPhones and iPods to.
    * iPad - Set to true to treat iPads as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect iPads to.
    * Android - Set to true to treat Android handsets as mobiles, false to treat them like full browsers or set a URL (including http://) to redirect Android and Google mobile users to.
    * Opera Mini - Set to true to treat Opera Mini like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Opera Mini users to.
    * Blackberry - Set to true to treat Blackberry like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Blackberry users to.
    * Palm - Set to true to treat Palm OS like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Palm OS users to.
    * Windows - Set to true to treat Windows Mobiles like a mobile, false to treat it like full browser or set a URL (including http://) to redirect Windows Mobile users to.
    * Mobile Redirect URL - This should be full web address (including http://) of the site (or page) you want to send mobile visitors to. Leaving this blank will make the script return true when it detects a mobile.
    * Desktop Redirect URL - This should be full web address (including http://) of the site (or page) you want to send non-mobile visitors to. Leaving this blank will make the script return false when it fails to detect a mobile.

Thanks for your post.

mkress

Hi,

simply set the second param to false:

$mobileCheck = mobile_device_detect(true,false,true,true,true,true,true,false,false);

z_dane

credit to fca07

however after try edit myself, i get blank page.

(smf 2.0 RC5 with latest mod + inferno theme & smf4iphone theme)

hopefully somebody will update this mode for rc5

dembow

hi i need a little help

i want the unread button to link to: index.php?action=unread;all;start=0 instead of how it is now pointing to: index.php?action=unread

what do i need to change?

NanoSector

Quote from: dembow on March 01, 2011, 01:40:17 PM
hi i need a little help

i want the unread button to link to: index.php?action=unread;all;start=0 instead of how it is now pointing to: index.php?action=unread

what do i need to change?
This is not the right topic. Create a new one, please.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

dembow


NanoSector

Quote from: dembow on March 01, 2011, 01:59:25 PM
oh sorry, but where?
If you have SMF 2.0 RCx into the 2.x support boards and the other one (1.x support boards) for 1.1.x.

Simple, innit? ;)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

dembow

Quote from: Yoshi2889 on March 01, 2011, 02:29:23 PM
If you have SMF 2.0 RCx into the 2.x support boards and the other one (1.x support boards) for 1.1.x.

Simple, innit? ;)

but aren't those boards for smf support only?

NanoSector

Quote from: dembow on March 01, 2011, 02:38:38 PM
Quote from: Yoshi2889 on March 01, 2011, 02:29:23 PM
If you have SMF 2.0 RCx into the 2.x support boards and the other one (1.x support boards) for 1.1.x.

Simple, innit? ;)

but aren't those boards for smf support only?
Yesssssssss......your problem is with SMF isn't it? SMF processes the links (index.php?action=actionhere in your case)... ???
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

dembow

my problem is with the SMF4iPhone mod unread topics button link



i want that button to link to: index.php?action=unread;all;start=0 instead of how it is now pointing to: index.php?action=unread

does this has to do with smf or with the SMF4iPhone mod?


dembow

scratch that, just figured it out

Leemy

Is there a resolution for the frequent "SMF4iPhone Mod failed to connect to DetectFree" errors? I dont think any users are being properly redirected.

Robin1989

will this be updated to rc5 and does the mod and theme work on a forum with simpleportal installed as that makes index.php goto the portal and index.php?action=forum goto the forum

Advertisement: