Ignore:
Timestamp:
12/22/10 15:39:15 (13 years ago)
Author:
eduardoalex
Message:

Ticket #1470 - Redirecionamento para o expresso mini a depender da plataforma.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/phpgwapi/inc/class.browser.inc.php

    r2 r3621  
    3333                var $data; 
    3434 
     35                const PLATFORM_WINDOWS = 'Win'; 
     36                const PLATFORM_MAC = 'Mac'; 
     37                const PLATFORM_LINUX = 'Linux'; 
     38                const PLATFORM_BEOS = 'Beos'; 
     39                const PLATFORM_IPHONE = 'iPhone'; 
     40                const PLATFORM_IPOD = 'iPod'; 
     41                const PLATFORM_IPAD = 'iPad'; 
     42                const PLATFORM_BLACKBERRY = 'BlackBerry'; 
     43                const PLATFORM_NOKIA = 'Nokia'; 
     44                const PLATFORM_ANDROID = 'Android'; 
     45                const PLATFORM_UNIX = 'Unix'; 
     46 
    3547                function browser() 
    3648                { 
     
    7688                                Determine platform 
    7789                        */ 
    78                         if(strstr($HTTP_USER_AGENT,'Win')) 
    79                         { 
    80                                 $this->BROWSER_PLATFORM='Win'; 
    81                         } 
     90                        if(strstr($HTTP_USER_AGENT,'iPad')) 
     91                        { 
     92                                $this->BROWSER_PLATFORM = self::PLATFORM_IPAD; 
     93                        } 
     94                        elseif(strstr($HTTP_USER_AGENT,'iPod')) 
     95                        { 
     96                                $this->BROWSER_PLATFORM = self::PLATFORM_IPOD; 
     97                        } 
     98                        elseif(strstr($HTTP_USER_AGENT,'iPhone')) 
     99                        { 
     100                                $this->BROWSER_PLATFORM = self::PLATFORM_IPHONE; 
     101                        } 
     102                        elseif(strstr($HTTP_USER_AGENT,'BlackBerry')) 
     103                        { 
     104                                $this->BROWSER_PLATFORM = self::PLATFORM_BLACKBERRY; 
     105                        } 
     106                        elseif(strstr($HTTP_USER_AGENT,'Android')) 
     107                        { 
     108                                $this->BROWSER_PLATFORM = self::PLATFORM_ANDROID; 
     109                        } 
     110                        elseif(strstr($HTTP_USER_AGENT,'Nokia')) 
     111                        { 
     112                                $this->BROWSER_PLATFORM = self::PLATFORM_NOKIA; 
     113                        }                        
    82114                        elseif(strstr($HTTP_USER_AGENT,'Mac')) 
    83115                        { 
    84                                 $this->BROWSER_PLATFORM='Mac'; 
    85                         } 
     116                                $this->BROWSER_PLATFORM = self::PLATFORM_MAC; 
     117                        } 
     118                        elseif(strstr($HTTP_USER_AGENT,'Win')) 
     119                        { 
     120                                $this->BROWSER_PLATFORM = self::PLATFORM_WINDOWS; 
     121                        }                        
    86122                        elseif(strstr($HTTP_USER_AGENT,'Linux')) 
    87123                        { 
    88                                 $this->BROWSER_PLATFORM='Linux'; 
     124                                $this->BROWSER_PLATFORM = self::PLATFORM_LINUX; 
    89125                        } 
    90126                        elseif(strstr($HTTP_USER_AGENT,'Unix')) 
    91127                        { 
    92                                 $this->BROWSER_PLATFORM='Unix'; 
     128                                $this->BROWSER_PLATFORM = self::PLATFORM_UNIX; 
    93129                        } 
    94130                        elseif(strstr($HTTP_USER_AGENT,'Beos')) 
    95131                        { 
    96                                 $this->BROWSER_PLATFORM='Beos'; 
     132                                $this->BROWSER_PLATFORM = self::PLATFORM_BEOS; 
    97133                        } 
    98134                        else 
     
    155191                function is_linux() 
    156192                { 
    157                         if($this->get_platform()=='Linux') 
    158                         { 
    159                                 return true; 
    160                         } 
    161                         else 
    162                         { 
    163                                 return false; 
    164                         } 
     193                        return ($this->get_platform()==self::PLATFORM_LINUX); 
    165194                } 
    166195 
    167196                function is_unix() 
    168197                { 
    169                         if($this->get_platform()=='Unix') 
    170                         { 
    171                                 return true; 
    172                         } 
    173                         else 
    174                         { 
    175                                 return false; 
    176                         } 
     198                        return ($this->get_platform()==self::PLATFORM_UNIX); 
    177199                } 
    178200 
    179201                function is_beos() 
    180202                { 
    181                         if($this->get_platform()=='Beos') 
    182                         { 
    183                                 return true; 
    184                         } 
    185                         else 
    186                         { 
    187                                 return false; 
    188                         } 
     203                        return ($this->get_platform()==self::PLATFORM_BEOS); 
    189204                } 
    190205 
    191206                function is_mac() 
    192207                { 
    193                         if($this->get_platform()=='Mac') 
    194                         { 
    195                                 return true; 
    196                         } 
    197                         else 
    198                         { 
    199                                 return false; 
    200                         } 
     208                        return ($this->get_platform()==self::PLATFORM_MAC); 
    201209                } 
    202210 
    203211                function is_windows() 
    204212                { 
    205                         if($this->get_platform()=='Win') 
    206                         { 
    207                                 return true; 
    208                         } 
    209                         else 
    210                         { 
    211                                 return false; 
    212                         } 
     213                        return ($this->get_platform()==self::PLATFORM_WINDOWS); 
     214                } 
     215                 
     216                function is_ipad() 
     217                { 
     218                        return ($this->get_platform()==self::PLATFORM_IPAD); 
     219                } 
     220                 
     221                function is_iphone() 
     222                { 
     223                        return ($this->get_platform()==self::PLATFORM_IPHONE); 
     224                } 
     225                 
     226                function is_nokia() 
     227                { 
     228                        return ($this->get_platform()==self::PLATFORM_NOKIA); 
     229                } 
     230                 
     231                function is_ipod() 
     232                { 
     233                        return ($this->get_platform()==self::PLATFORM_IPOD); 
     234                } 
     235                 
     236                function is_blackberry() 
     237                { 
     238                        return ($this->get_platform()==self::PLATFORM_BLACKBERRY); 
     239                } 
     240                 
     241                function is_android() 
     242                { 
     243                        return ($this->get_platform()==self::PLATFORM_ANDROID); 
    213244                } 
    214245 
Note: See TracChangeset for help on using the changeset viewer.