[mythtv] Re: MythWeb is broken

Jerome Rannikko jerome.rannikko at tut.fi
Tue May 17 08:16:57 UTC 2005


Anduin Withers wrote
> isMobileUser() is using === for comparing the result of getScreenSize(),
> which could simply be array() (making === fail). Simply changing the check
> to == is one fix.

This fix will cause isMobileUser() to not work as intended. The same goes
with the current fix in the CVS.

getScreenSize() returns false only when the user agent is not known to be
a mobile device. The function returns an empty array when the UA is known
to be a mobile device but the screen size is not known. It returns a
non-empty array when the UA is a mobile device and the screen size is
known.

This code
return (getScreenSize() === false) ? false : true;
return false only when the return value of getScreenSize() is exactly
false. If the the return value of getScreenSize() is an empty or non-empty
array it returns true.

The current fix: return empty(getScreenSize()); doesn't work right because
it returns true when getScreenSize() returns false and it return false
when getScreenSize returns a non-empty array.

To fix the problem, find the line
if (browserAcceptsMediaType(array('VND', 'WAP', 'WML'))) {
in the mobile.php and remove 'VND'.

I copied the part "'VND', 'WAP', 'WML'" from the earlier version of the
file without giving it much thought. I now did some research and found out
that 'vnd' marks the vendor tree of mime types. It is not a mime type on
its own. I checked the HTTP_ACCEPT of IE and it was like this
"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint,
application/msword,
application/x-shockwave-flash, */*"
Those excel and powerpoint mime types caused it to be falsely treated as a
mobile phone because of the mistake in the mobile.php code.

I believe that fixing that one line in mobile.php and restoring the
isMobileUser() function to its original state should make things work. I'm
sorry my code was brokes - my only excuse is that I don't have IE on my
computer.

//jerome



More information about the mythtv-dev mailing list