Results 1 to 4 of 4

Thread: Auto choose moible client?

  1. #1
    Join Date
    Feb 2008
    Location
    San Francisco
    Posts
    360
    Rep Power
    7

    Default Auto choose moible client?

    I'm accessing the zimbra web client from my cell phone, but when logging in the default is the ajax. Having done web design myself, I know you can get the login page to auto-sense what type of user is it, mobile or pc, and have it redirect to the necessary mobile web client if they are on a cell phone.

    Is there a setting I can change so that it picks up on this?
    So that when loging in it auto senses I'm on the cell, so it automatically logs me into the mobile?

    Thanks

  2. #2
    Join Date
    May 2007
    Posts
    7
    Rep Power
    8

    Default

    NoDoze -

    Don't know about auto-sensing. That would be a great feature.

    If you bookmark this url on your phone it will always take you to the mobile log-in.

    yourmailserver.com/zimbra/?loginOp=login&client=mobile

    Create an alias/redirect for say mobile.yourmailserver.com that goes to that address and save yourself from the long url.

  3. #3
    Join Date
    Feb 2008
    Location
    San Francisco
    Posts
    360
    Rep Power
    7

    Default

    Code:
    <?php
    
    function detect_mobile_device(){
      
      // check if the user agent value claims to be windows but not windows mobile
      if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
        return false;
      }
      // check if the user agent gives away any tell tale signs it's a mobile browser
      if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp',$_SERVER['HTTP_USER_AGENT'])){
        return true;
      }
      // check the http accept header to see if wap.wml or wap.xhtml support is claimed
      if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){
        return true;
      }
      // check if there are any tell tales signs it's a mobile device from the _server headers
      if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){
        return true;
      }
      // build an array with the first four characters from the most common mobile user agents
      $a = array(
                        'acs-'=>'acs-',
                        'alav'=>'alav',
                        'alca'=>'alca',
                        'amoi'=>'amoi',
                        'audi'=>'audi',
                        'aste'=>'aste',
                        'avan'=>'avan',
                        'benq'=>'benq',
                        'bird'=>'bird',
                        'blac'=>'blac',
                        'blaz'=>'blaz',
                        'brew'=>'brew',
                        'cell'=>'cell',
                        'cldc'=>'cldc',
                        'cmd-'=>'cmd-',
                        'dang'=>'dang',
                        'doco'=>'doco',
                        'eric'=>'eric',
                        'hipt'=>'hipt',
                        'inno'=>'inno',
                        'ipaq'=>'ipaq',
                        'java'=>'java',
                        'jigs'=>'jigs',
                        'kddi'=>'kddi',
                        'keji'=>'keji',
                        'leno'=>'leno',
                        'lg-c'=>'lg-c',
                        'lg-d'=>'lg-d',
                        'lg-g'=>'lg-g',
                        'lge-'=>'lge-',
                        'maui'=>'maui',
                        'maxo'=>'maxo',
                        'midp'=>'midp',
                        'mits'=>'mits',
                        'mmef'=>'mmef',
                        'mobi'=>'mobi',
                        'mot-'=>'mot-',
                        'moto'=>'moto',
                        'mwbp'=>'mwbp',
                        'nec-'=>'nec-',
                        'newt'=>'newt',
                        'noki'=>'noki',
                        'opwv'=>'opwv',
                        'palm'=>'palm',
                        'pana'=>'pana',
                        'pant'=>'pant',
                        'pdxg'=>'pdxg',
                        'phil'=>'phil',
                        'play'=>'play',
                        'pluc'=>'pluc',
                        'port'=>'port',
                        'prox'=>'prox',
                        'qtek'=>'qtek',
                        'qwap'=>'qwap',
                        'sage'=>'sage',
                        'sams'=>'sams',
                        'sany'=>'sany',
                        'sch-'=>'sch-',
                        'sec-'=>'sec-',
                        'send'=>'send',
                        'seri'=>'seri',
                        'sgh-'=>'sgh-',
                        'shar'=>'shar',
                        'sie-'=>'sie-',
                        'siem'=>'siem',
                        'smal'=>'smal',
                        'smar'=>'smar',
                        'sony'=>'sony',
                        'sph-'=>'sph-',
                        'symb'=>'symb',
                        't-mo'=>'t-mo',
                        'teli'=>'teli',
                        'tim-'=>'tim-',
                        'tosh'=>'tosh',
                        'treo'=>'treo',
                        'tsm-'=>'tsm-',
                        'upg1'=>'upg1',
                        'upsi'=>'upsi',
                        'vk-v'=>'vk-v',
                        'voda'=>'voda',
                        'wap-'=>'wap-',
                        'wapa'=>'wapa',
                        'wapi'=>'wapi',
                        'wapp'=>'wapp',
                        'wapr'=>'wapr',
                        'webc'=>'webc',
                        'winw'=>'winw',
                        'winw'=>'winw',
                        'xda-'=>'xda-'
                      );
      // check if the first four characters of the current user agent are set as a key in the array
      if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){
        return true;
      }
    }
    
    function detect_iphone(){
      if(eregi('iphone',$_SERVER['HTTP_USER_AGENT'])||eregi('ipod',$_SERVER['HTTP_USER_AGENT'])){
        return true;
      }
    }
    
    // example 1 - detect and redirect mobile browsers
    if(detect_mobile_device()){
      header('Location: http://domain.mobile/');
      exit;
    }
    
    // example 2 - detect and redirect desktop browsers
    if(!detect_mobile_device()){
      header('Location: http://domain.desktop/');
      exit;
    }
    
    function detect_iphone(){
      if(eregi('iphone',$_SERVER['HTTP_USER_AGENT'])){
        return true;
      }
    }
    
    // example 3 - send iphone to specific site
    if(detect_iphone()){
      header('Location: http://domain.iphone/');
      exit;
    }
    
    ?>
    ...care of Yahoo Answers....

    ...isn't Zimbra owned by Yahoo...?

    Why isn't this implemented?

    LOL

  4. #4
    Join Date
    May 2007
    Posts
    7
    Rep Power
    8

    Default

    That's sweet code. I like the extra bit to kick into the iPhone if needed. Thanks for posting that here.

Similar Threads

  1. Zimbra + LDAP + Posix + Samba
    By fruitlounge in forum Administrators
    Replies: 24
    Last Post: 06-30-2008, 10:55 PM
  2. can't you help me
    By iwan siahaan in forum Administrators
    Replies: 6
    Last Post: 12-17-2007, 06:53 PM
  3. Web Client Performance and Basic client features
    By fviero in forum Administrators
    Replies: 1
    Last Post: 11-23-2007, 05:34 AM
  4. Deploying Zimbra Client (zimbra.war)
    By zocs in forum Installation
    Replies: 2
    Last Post: 07-25-2007, 06:24 AM
  5. Auto Choose Mailstore Question
    By kirme3 in forum Administrators
    Replies: 2
    Last Post: 07-13-2006, 09:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •