Changeset 609

Show
Ignore:
Timestamp:
09/28/2007 06:19:02 PM (13 months ago)
Author:
Shadowhand
Message:

Updates URI and Router. Use Router::$query_string() to fetch the query string. This is only available after the controller has been initialized.

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/application/config/user_agents.php

    r608 r609  
    1010| 
    1111*/ 
    12  
    13 $config['platforms'] = array ( 
    14                                         'windows nt 6.0'        => 'Windows Longhorn', 
    15                                         'windows nt 5.2'        => 'Windows 2003', 
    16                                         'windows nt 5.0'        => 'Windows 2000', 
    17                                         'windows nt 5.1'        => 'Windows XP', 
    18                                         'windows nt 4.0'        => 'Windows NT 4.0', 
    19                                         'winnt4.0'                      => 'Windows NT 4.0', 
    20                                         'winnt 4.0'                     => 'Windows NT', 
    21                                         'winnt'                         => 'Windows NT', 
    22                                         'windows 98'            => 'Windows 98', 
    23                                         'win98'                         => 'Windows 98', 
    24                                         'windows 95'            => 'Windows 95', 
    25                                         'win95'                         => 'Windows 95', 
    26                                         'windows'                       => 'Unknown Windows OS', 
    27                                         'os x'                          => 'Mac OS X', 
    28                                         'ppc mac'                       => 'Power PC Mac', 
    29                                         'freebsd'                       => 'FreeBSD', 
    30                                         'ppc'                           => 'Macintosh', 
    31                                         'linux'                         => 'Linux', 
    32                                         'debian'                        => 'Debian', 
    33                                         'sunos'                         => 'Sun Solaris', 
    34                                         'beos'                          => 'BeOS', 
    35                                         'apachebench'           => 'ApacheBench', 
    36                                         'aix'                           => 'AIX', 
    37                                         'irix'                          => 'Irix', 
    38                                         'osf'                           => 'DEC OSF', 
    39                                         'hp-ux'                         => 'HP-UX', 
    40                                         'netbsd'                        => 'NetBSD', 
    41                                         'bsdi'                          => 'BSDi', 
    42                                         'openbsd'                       => 'OpenBSD', 
    43                                         'gnu'                           => 'GNU/Linux', 
    44                                         'unix'                          => 'Unknown Unix OS' 
    45                                 ); 
     12$config['platforms'] = array 
     13( 
     14        'windows nt 6.0' =>> 'Windows Longhorn', 
     15        'windows nt 5.2' =>> 'Windows 2003', 
     16        'windows nt 5.0' =>> 'Windows 2000', 
     17        'windows nt 5.1' =>> 'Windows XP', 
     18        'windows nt 4.0' =>> 'Windows NT 4.0', 
     19        'winnt4.0'       =>> 'Windows NT 4.0', 
     20        'winnt 4.0'      =>> 'Windows NT', 
     21        'winnt'          =>> 'Windows NT', 
     22        'windows 98'     =>> 'Windows 98', 
     23        'win98'          =>> 'Windows 98', 
     24        'windows 95'     =>> 'Windows 95', 
     25        'win95'          =>> 'Windows 95', 
     26        'windows'        =>> 'Unknown Windows OS', 
     27        'os x'           =>> 'Mac OS X', 
     28        'ppc mac'        =>> 'Power PC Mac', 
     29        'freebsd'        =>> 'FreeBSD', 
     30        'ppc'            =>> 'Macintosh', 
     31        'linux'          =>> 'Linux', 
     32        'debian'         =>> 'Debian', 
     33        'sunos'          =>> 'Sun Solaris', 
     34        'beos'           =>> 'BeOS', 
     35        'apachebench'    =>> 'ApacheBench', 
     36        'aix'            =>> 'AIX', 
     37        'irix'           =>> 'Irix', 
     38        'osf'            =>> 'DEC OSF', 
     39        'hp-ux'          =>> 'HP-UX', 
     40        'netbsd'         =>> 'NetBSD', 
     41        'bsdi'           =>> 'BSDi', 
     42        'openbsd'        =>> 'OpenBSD', 
     43        'gnu'            =>> 'GNU/Linux', 
     44        'unix'           =>> 'Unknown Unix OS' 
     45); 
    4646 
    4747 
    4848// The order of this array should NOT be changed. Many browsers return 
    4949// multiple browser types so we want to identify the sub-type first. 
    50 $config['browsers'] = array( 
    51                                         'Opera'                         => 'Opera', 
    52                                         'MSIE'                          => 'Internet Explorer', 
    53                                         'Internet Explorer'     => 'Internet Explorer', 
    54                                         'Shiira'                        => 'Shiira', 
    55                                         'Firefox'                       => 'Firefox', 
    56                                         'Chimera'                       => 'Chimera', 
    57                                         'Phoenix'                       => 'Phoenix', 
    58                                         'Firebird'                      => 'Firebird', 
    59                                         'Camino'                        => 'Camino', 
    60                                         'Netscape'                      => 'Netscape', 
    61                                         'OmniWeb'                       => 'OmniWeb', 
    62                                         'Mozilla'                       => 'Mozilla', 
    63                                         'Safari'                        => 'Safari', 
    64                                         'Konqueror'                     => 'Konqueror', 
    65                                         'icab'                          => 'iCab', 
    66                                         'Lynx'                          => 'Lynx', 
    67                                         'Links'                         => 'Links', 
    68                                         'hotjava'                       => 'HotJava', 
    69                                         'amaya'                         => 'Amaya', 
    70                                         'IBrowse'                       => 'IBrowse' 
    71                                 ); 
     50$config['browsers'] = array 
     51( 
     52'Opera'             => 'Opera', 
     53'MSIE'              => 'Internet Explorer', 
     54'Internet Explorer' => 'Internet Explorer', 
     55'Shiira'            => 'Shiira', 
     56'Firefox'           => 'Firefox', 
     57'Chimera'           => 'Chimera', 
     58'Phoenix'           => 'Phoenix', 
     59'Firebird'          => 'Firebird', 
     60'Camino'            => 'Camino', 
     61'Netscape'          => 'Netscape', 
     62'OmniWeb'           => 'OmniWeb', 
     63'Mozilla'           => 'Mozilla', 
     64'Safari'            => 'Safari', 
     65'Konqueror'         => 'Konqueror', 
     66'icab'              => 'iCab', 
     67'Lynx'              => 'Lynx', 
     68'Links'             => 'Links', 
     69'hotjava'           => 'HotJava', 
     70'amaya'             => 'Amaya', 
     71'IBrowse'           => 'IBrowse' 
     72); 
    7273 
    73 $config['mobiles'] = array( 
    74                                         'mobileexplorer'        => 'Mobile Explorer', 
    75                                         'openwave'                      => 'Open Wave', 
    76                                         'opera mini'            => 'Opera Mini', 
    77                                         'operamini'                     => 'Opera Mini', 
    78                                         'elaine'                        => 'Palm', 
    79                                         'palmsource'            => 'Palm', 
    80                                         'digital paths'         => 'Palm', 
    81                                         'avantgo'                       => 'Avantgo', 
    82                                         'xiino'                         => 'Xiino', 
    83                                         'palmscape'                     => 'Palmscape', 
    84                                         'nokia'                         => 'Nokia', 
    85                                         'ericsson'                      => 'Ericsson', 
    86                                         'blackBerry'            => 'BlackBerry', 
    87                                         'motorola'                      => 'Motorola' 
    88                                 );       
     74$config['mobiles'] = array 
     75( 
     76        'mobileexplorer' => 'Mobile Explorer', 
     77        'openwave'       => 'Open Wave', 
     78        'opera mini'     => 'Opera Mini', 
     79        'operamini'      => 'Opera Mini', 
     80        'elaine'         => 'Palm', 
     81        'palmsource'     => 'Palm', 
     82        'digital paths'  => 'Palm', 
     83        'avantgo'        => 'Avantgo', 
     84        'xiino'          => 'Xiino', 
     85        'palmscape'      => 'Palmscape', 
     86        'nokia'          => 'Nokia', 
     87        'ericsson'       => 'Ericsson', 
     88        'blackBerry'     => 'BlackBerry', 
     89        'motorola'       => 'Motorola' 
     90); 
    8991 
    9092// There are hundreds of bots but these are the most common. 
    91 $config['robots'] = array( 
    92                                         'googlebot'                     => 'Googlebot', 
    93                                         'msnbot'                        => 'MSNBot', 
    94                                         'slurp'                         => 'Inktomi Slurp', 
    95                                         'yahoo'                         => 'Yahoo', 
    96                                         'askjeeves'                     => 'AskJeeves', 
    97                                         'fastcrawler'           => 'FastCrawler', 
    98                                         'infoseek'                      => 'InfoSeek Robot 1.0', 
    99                                         'lycos'                         => 'Lycos' 
    100                                 );       
    101  
    102  
    103 ?> 
     93$config['robots'] = array 
     94( 
     95        'googlebot'   => 'Googlebot', 
     96        'msnbot'      => 'MSNBot', 
     97        'slurp'       => 'Inktomi Slurp', 
     98        'yahoo'       => 'Yahoo', 
     99        'askjeeves'   => 'AskJeeves', 
     100        'fastcrawler' => 'FastCrawler', 
     101        'infoseek'    => 'InfoSeek Robot 1.0', 
     102        'lycos'       => 'Lycos' 
     103); 
  • trunk/system/libraries/Router.php

    r600 r609  
    99        public static $segments    = array(); 
    1010        public static $rsegments   = array(); 
     11 
     12        public static $query_string = ''; 
    1113 
    1214        public static $directory  = FALSE; 
     
    5759                                self::$segments = substr(self::$segments, 0, -(strlen($suffix))); 
    5860                        } 
     61 
     62                        // Destroy GET 
     63                        $_GET = array(); 
    5964                } 
    6065                elseif (isset($_SERVER['PATH_INFO']) AND $_SERVER['PATH_INFO']) 
     
    228233                } 
    229234 
    230                 if (self::$controller != TRUE) 
     235                if (empty(self::$controller)) 
    231236                { 
    232237                        Kohana::show_404(); 
  • trunk/system/libraries/URI.php

    r581 r609  
    22 
    33class URI_Core extends Router { 
     4 
     5        public function __construct() 
     6        { 
     7                if ( ! empty($_GET)) 
     8                { 
     9                        self::$query_string = '?'; 
     10                        foreach($_GET as $key => $val) 
     11                        { 
     12                                self::$query_string .= $key.'='.rawurlencode($val); 
     13                        } 
     14                } 
     15        } 
    416 
    517        /**