News:

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

Main Menu

Disable WAP, WAP2 and imode in SMF 2.0.2

Started by demlak, November 25, 2012, 07:04:00 PM

Previous topic - Next topic

demlak

im not able to test.. so i have to ask you:
is it correct that wap/wap2 and imode are completly disabled when i change

if (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']))
unset($_SESSION['nowap']);
elseif (isset($_REQUEST['nowap']))
$_SESSION['nowap'] = true;

to

if (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']))
$_SESSION['nowap'] = true;
elseif (isset($_REQUEST['nowap']))
$_SESSION['nowap'] = true;


and then delete "XHTML RSS WAP2" at the footer on index.template.php of my theme?

that´s enough to completly disable mobile modes?

Hj Ahmad Rasyid Hj Ismail

I think that should work fine. But I am not sure whether that will completely disable mobile modes. Just wait for some other people to come and confirm the second part.

demlak



demlak

oh.. it´s not about deleting links to the modes... but about complete disabling these modes..

Joker™

index.php (Make backup before editing)

Code (Find:) Select
if (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']))
unset($_SESSION['nowap']);
elseif (isset($_REQUEST['nowap']))
$_SESSION['nowap'] = true;



Code (Add before:) Select
if (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode'])) {
unset($_REQUEST['wap']);
unset($_REQUEST['wap2']);
unset($_REQUEST['imode']);
}
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Matthew K.

Joker, you can put multiple variables in unset();, comma separated.

Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

demlak

hmm.. now the wap2 wap and imode sends me to an empty site...
not exactly empty.. but to the portal-index with only toolbar, menubar and no content.. (im using simpleportal)..
would be nice to send people to the standard website.. instead of an empty portal-site

emanuele

Simple is simple:
Code (find) Select
if (!defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));

Code (replace with) Select
if (!defined('WIRELESS'))
define('WIRELESS', 0);


O:)


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

demlak

hmm.. this gets me the same result like discribed in my last post:
Quote
hmm.. now the wap2 wap and imode sends me to an empty site...
not exactly empty.. but to the portal-index with only toolbar, menubar and no content.. (im using simpleportal)..
would be nice to send people to the standard website.. instead of an empty portal-site

emanuele

Well, you have something else wrong then, because if I apply it to my test site everything works as expected, except of course that wap/2 and imode are rendered with the full theme.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

demlak

maybe simpleportal is responsible for this?

emanuele

Yes, apparently SP doesn't like that solution for some reason.
Unfortunately I don't have SP installed anywhere locally, but only on a remote test-site and cannot do any further testing... :(


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

demlak


emanuele

Nope, the only thing to do is debug and find out why it is not working.
By chance I found a local test forum with SP installed and I was able to narrow down the issue to that block of code:
// Still, we might not be in portal!
if (!empty($_GET) && empty($context['standalone']))
foreach ($_GET as $key => $value)
{
if (preg_match('~^news\d+)$~', $key))
continue;

if (!isset($portal_actions[$key]))
$portal = false;
elseif (is_array($portal_actions[$key]) && !in_array($value, $portal_actions[$key]))
$portal = false;
}

in Subs-Portal.php.

To make it work the way you want try changing it to:
// Still, we might not be in portal!
if (!empty($_GET) && empty($context['standalone']))
foreach ($_GET as $key => $value)
{
if (preg_match('~^(news\d+|wap|wap2|imode)$~', $key))
continue;

if (!isset($portal_actions[$key]))
$portal = false;
elseif (is_array($portal_actions[$key]) && !in_array($value, $portal_actions[$key]))
$portal = false;
}


Not sure about the consequences.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

demlak

nice... seems to be the solution.. it works =)

thx a lot!

so it´s a combination of these two things:

Quote from: emanuele on December 07, 2012, 06:47:37 PM
in index.php:
Code (find) Select
if (!defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));

Code (replace with) Select
if (!defined('WIRELESS'))
define('WIRELESS', 0);

Quote from: emanuele on December 10, 2012, 07:24:58 AM
in Subs-Portal.php:
Code (find) Select
// Still, we might not be in portal!
if (!empty($_GET) && empty($context['standalone']))
foreach ($_GET as $key => $value)
{
if (preg_match('~^news\d+)$~', $key))
continue;

if (!isset($portal_actions[$key]))
$portal = false;
elseif (is_array($portal_actions[$key]) && !in_array($value, $portal_actions[$key]))
$portal = false;
}


Code (replace with) Select
// Still, we might not be in portal!
if (!empty($_GET) && empty($context['standalone']))
foreach ($_GET as $key => $value)
{
if (preg_match('~^(news\d+|wap|wap2|imode)$~', $key))
continue;

if (!isset($portal_actions[$key]))
$portal = false;
elseif (is_array($portal_actions[$key]) && !in_array($value, $portal_actions[$key]))
$portal = false;
}


smartmouse

Quote from: demlak on December 10, 2012, 10:30:07 AM
nice... seems to be the solution.. it works =)

thx a lot!

so it´s a combination of these two things:

Quote from: emanuele on December 07, 2012, 06:47:37 PM
in index.php:
Code (find) Select
if (!defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));

Code (replace with) Select
if (!defined('WIRELESS'))
define('WIRELESS', 0);

Quote from: emanuele on December 10, 2012, 07:24:58 AM
in Subs-Portal.php:
Code (find) Select
// Still, we might not be in portal!
if (!empty($_GET) && empty($context['standalone']))
foreach ($_GET as $key => $value)
{
if (preg_match('~^news\d+)$~', $key))
continue;

if (!isset($portal_actions[$key]))
$portal = false;
elseif (is_array($portal_actions[$key]) && !in_array($value, $portal_actions[$key]))
$portal = false;
}


Code (replace with) Select
// Still, we might not be in portal!
if (!empty($_GET) && empty($context['standalone']))
foreach ($_GET as $key => $value)
{
if (preg_match('~^(news\d+|wap|wap2|imode)$~', $key))
continue;

if (!isset($portal_actions[$key]))
$portal = false;
elseif (is_array($portal_actions[$key]) && !in_array($value, $portal_actions[$key]))
$portal = false;
}


I wrapped up these modifications in a new SMF mod (my first one!) and I have installed it on my forum.
Anyway I see that it is not working, the following links are still reachable on my forum:

<my-forum>.com/index.php?wap
<my-forum>.com/index.php?wap2
<my-forum>.com/index.php?imode

Is the same for you?

I'm on SMF 2.0.15

smartmouse


Advertisement: