News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Wap2 version for smf 2.0.2

Started by Kevin1, February 23, 2012, 09:27:49 AM

Previous topic - Next topic

NanoSector

Quote from: distante on March 01, 2012, 11:48:56 AM
When you use an android with Opera browser, that script will be able to recognize it?

I don't have an android, but I have and old E65 with opera-mini, and the wap or imode form never get showed
That would require use of the $context['browser']['is_opera'] parameter, and I dunno if both [is_android'] and ['is_opera'] get set when Opera Mini is used.

Though the script doesn't work yet, it doesn't do what is expected.
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."

pkrack

I think the reason that opera isnt served by wap version is that opera min is detected as opera (web browser). I am sorry i dont have android as my father told me that he will buy me a smart phone when i pass the entry test of medical college. So i will inform you new year :-)

NanoSector

Quote from: pkrack on March 01, 2012, 02:17:25 PM
I think the reason that opera isnt served by wap version is that opera min is detected as opera (web browser). I am sorry i dont have android as my father told me that he will buy me a smart phone when i pass the entry test of medical college. So i will inform you new year :-)
http://www.useragentstring.com/pages/Opera%20Mini/

That page tells me that Opera Mini can't be identified by OS, only by "Opera".
I have an iPod touch with Opera Mini installed, I'll check it in a moment.
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."

Kevin1

Bro i want to redirect ucweb browser to wap2 mode..
Get free Gprs tricks for all telecom operators here.
http://teknotech.in

pkrack

Oh sorry, your problem got covered in our discussion. So have you changed wap to wap2 i.e not deleting them but changing them . Another idea which sprang up in my mind is that you can edit wireless.template.php and in section declared as wap1 , change the css file path to wap2 css . I think it will work if both css have classes with same name and if a single css file is called by both versions then then it wouldnt work.

Kevin1

Please tell me the complete procedure...
Get free Gprs tricks for all telecom operators here.
http://teknotech.in

Kevin1

Get free Gprs tricks for all telecom operators here.
http://teknotech.in

pkrack

So here is the wap code in index.php // Determine if this is
using WAP, WAP2, or
imode. Technically, we
should check that wap
comes before
application/xhtml or
text/html, but this
doesn't work in practice
as much as it should.
if (isset($_REQUEST
['wap']) || isset
($_REQUEST['wap2']) ||
isset($_REQUEST
['imode']))
unset($_SESSION
['nowap']);
elseif (isset($_REQUEST
['nowap']))
$_SESSION['nowap'] =
true;
elseif (!isset($_SESSION
['nowap']))
{
if (isset($_SERVER
['HTTP_ACCEPT']) &&
strpos($_SERVER
['HTTP_ACCEPT'],
'application/
vnd.wap.xhtml+xml') !==
false)
$_REQUEST['wap2'] = 1;
elseif (isset($_SERVER
['HTTP_ACCEPT']) &&
strpos($_SERVER
['HTTP_ACCEPT'], 'text/
vnd.wap.wml') !==
false)
{
if (strpos($_SERVER
['HTTP_USER_AGENT'],
'DoCoMo/') !== false ||
strpos($_SERVER
['HTTP_USER_AGENT'],
'portalmmm/') !==
false)
$_REQUEST['imode'] = 1;
else
$_REQUEST['wap'] = 1;
}
}
if (!defined('WIRELESS'))
define('WIRELESS', isset
($_REQUEST['wap']) ||
isset($_REQUEST
['wap2']) || isset
($_REQUEST['imode']));

     i copied it so that if some buddy dont know about the code but still is an expert , can help you. I dont think its related with $_request[wap] in first kind as it works when some body use wap in url, i think all the work is done by if (strpos($_SERVER
['HTTP_USER_AGENT'],
'DoCoMo/') !== false ||
strpos($_SERVER
['HTTP_USER_AGENT'],
'portalmmm/') !==
false)
$_REQUEST['imode'] = 1;
else
$_REQUEST['wap'] = 1;
so if we change $_REQUEST['wap'] to $_REQUEST['wap2'] in the second code then it might work.
          One thing you should do is to create a copy of index.php with some other name and do all experiments there, as no body is perfect and some time a very simple code can cause huge problems for you. So if some thing gets wrong , your site will still be safe 

Kevin1

Ok problem solved..
I have replaced
Quoteif (isset($_REQUEST['nowap']))
   $_SESSION['nowap'] = true;
elseif (!isset($_SESSION['nowap']))
{
   if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false)
      $_REQUEST['wap2'] = 1;
   elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)
   {
      if (strpos($_SERVER['HTTP_USER_AGENT'], 'DoCoMo/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'portalmmm/') !== false)
         $_REQUEST['imode'] = 1;
      else
         $_REQUEST['wap'] = 1;
   }

}

with

Quote
if (isset($_REQUEST['nowap']))
   $_SESSION['nowap'] = true;
elseif (!isset($_SESSION['nowap']))
{
   if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false)
      $_REQUEST['wap2'] = 1;
   elseif (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false)
   {
      if (strpos($_SERVER['HTTP_USER_AGENT'], 'DoCoMo/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'portalmmm/') !== false)
         $_REQUEST['imode'] = 1;
      else
         $_REQUEST['wap'] = 1;
   }
   elseif(preg_match('/Opera Mini/i',$_SERVER['HTTP_USER_AGENT']))
                               $_REQUEST['wap2'] = 1;
}

Now ucweb is automatically detecting wap2 mode..

thanks all
Get free Gprs tricks for all telecom operators here.
http://teknotech.in

pkrack

Thanks God. Your simple but yet complicated problem got solved

Advertisement: