[imp] Latest horde/imp not working on iPhone/iPod touch

Chuck Hagenbuch chuck at horde.org
Fri Aug 29 03:43:43 UTC 2008


Quoting Eric Jon Rostetter <eric.rostetter at physics.utexas.edu>:

> RCS file: /repository/framework/Browser/Browser.php,v
> retrieving revision 1.153.2.64
> diff -u -r1.153.2.64 Browser.php
> --- Browser.php 9 Jun 2008 17:33:03 -0000       1.153.2.64
> +++ Browser.php 28 Aug 2008 17:41:10 -0000
> @@ -540,6 +540,14 @@
>                  $this->_mobile = true;
>              }
>
> +/* EJR: Make the iPhone not default to mobile */
> +           if ( strpos($agent, 'iPhone' ) !== false &&
> +                strpos($agent, 'Safari' ) !== false &&
> +                strpos($agent, 'Mobile' ) !== false ) {
> +                $this->_mobile = false;
> +           }
> +/* EJR */
> +
>              $this->_majorVersion = $version[1];
>              if (isset($version[2])) {
>                  $this->_minorVersion = $version[2];
>
>
>> And only in imp but also Kronolith and turba.
>
> It affects all of Horde, since it is Horde (framework) that does the
> browser detection.

So, I took a look around and found this bug:
http://bugs.horde.org/ticket/6332

.. and the select box is there, but it wasn't working for me. So I  
made the two attached patches, which let me go directly to the view I  
choose on the IMP login screen (IMP, DIMP, or MIMP) whether I'm using  
a desktop browser or a mobile device. How does this look to folks?

-chuck
-------------- next part --------------
Index: imp/redirect.php
===================================================================
RCS file: /repository/imp/redirect.php,v
retrieving revision 1.160
diff -u -r1.160 redirect.php
--- imp/redirect.php	5 Aug 2008 19:22:13 -0000	1.160
+++ imp/redirect.php	29 Aug 2008 02:12:58 -0000
@@ -24,9 +24,12 @@
     $url = '';
     $addActionID = true;
 
+    $apps = $GLOBALS['registry']->listApps(null, true);
+    $default_view = ($GLOBALS['browser']->isMobile() && isset($apps['mimp'])) ? 'mimp' : 'imp';
+
     if ($GLOBALS['url_in']) {
         $url = Horde::url(Util::removeParameter($GLOBALS['url_in'], session_name()), true);
-    } elseif (in_array($view, array('dimp', 'mimp'))) {
+    } elseif ($view != $default_view || $view != 'imp') {
         $GLOBALS['noframeset'] = true;
         return Horde::url($GLOBALS['registry']->get('webroot', $view) . '/', true);
     } elseif (Auth::getProvider() == 'imp') {
-------------- next part --------------
Index: index.php
===================================================================
RCS file: /repository/horde/index.php,v
retrieving revision 2.118
diff -u -r2.118 index.php
--- index.php	2 Jan 2008 11:06:36 -0000	2.118
+++ index.php	29 Aug 2008 02:12:16 -0000
@@ -29,11 +29,6 @@
 
 require_once HORDE_BASE . '/lib/base.php';
 
-if ($browser->isMobile()) {
-    require HORDE_BASE . '/services/portal/mobile.php';
-    exit;
-}
-
 $main_page = Util::getFormData('url');
 
 // Break up the requested URL in $main_page and run some sanity checks
@@ -62,6 +57,15 @@
     }
 }
 
+if ($browser->isMobile()) {
+    if ($main_page) {
+        header('Location: ' . $main_page);
+    } else {
+        require HORDE_BASE . '/services/portal/mobile.php';
+    }
+    exit;
+}
+
 if (!$main_page) {
     $initial_app = $prefs->getValue('initial_application');
     if (!empty($initial_app) && $registry->hasPermission($initial_app)) {


More information about the imp mailing list