Changeset 647
- Timestamp:
- 10/04/2007 01:57:26 PM (14 months ago)
- Location:
- trunk
- Files:
-
- 15 modified
-
application/config/config.php (modified) (3 diffs)
-
application/config/cookie.php (modified) (2 diffs)
-
application/config/database.php (modified) (1 diff)
-
application/config/encryption.php (modified) (1 diff)
-
application/config/log.php (modified) (1 diff)
-
application/config/mimes.php (modified) (1 diff)
-
application/config/pagination.php (modified) (1 diff)
-
application/config/routes.php (modified) (1 diff)
-
application/config/session.php (modified) (1 diff)
-
application/config/upload.php (modified) (1 diff)
-
application/config/user_agents.php (modified) (4 diffs)
-
application/controllers/welcome.php (modified) (3 diffs)
-
index.php (modified) (4 diffs)
-
system/libraries/Session.php (modified) (1 diff)
-
system/libraries/User_agent.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/config/config.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 3 2 /* 4 3 | ------------------------------------------------------------------------- … … 32 31 | Typically this will be your index.php file, unless you've renamed it to 33 32 | something else. If you are using mod_rewrite to remove the page set this 34 | variable so that it is blank.33 | variable to an empty string. 35 34 | 36 35 */ 37 $config['index_page'] = ' index.php';36 $config['index_page'] = ''; 38 37 38 /* 39 | ----------------------------------------------------------------------------- 40 | URL Suffix 41 | ----------------------------------------------------------------------------- 42 | 43 | You can set an arbitrary filename extension to Kohana URLs. This extension is 44 | completely freeform, but should start with a period. 45 | 46 */ 39 47 $config['url_suffix'] = '.html'; 40 48 49 /* 50 | ----------------------------------------------------------------------------- 51 | Permitted URI Characters (EXPERT) 52 | ----------------------------------------------------------------------------- 53 | 54 | This is the list of characters that Kohana will accept in the URI. Note that 55 | the default will accept urlencoded (eg: %20) characters to pass through. ID 56 | anchors (eg: #header_id) are always allowed. 57 | 58 */ 41 59 $config['permitted_uri_chars'] = 'a-z 0-9~%.:_-'; 42 60 61 /* 62 | ----------------------------------------------------------------------------- 63 | Locale 64 | ----------------------------------------------------------------------------- 65 | 66 | Kohana supports full international locale support. Changing this option to an 67 | unavailable locale will break Kohana. 68 | 69 */ 43 70 $config['locale'] = 'en'; 44 71 72 /* 73 | ----------------------------------------------------------------------------- 74 | Include Paths 75 | ----------------------------------------------------------------------------- 76 | 77 | User Guide: http://kohanaphp.com/user_guide/en/general/configuration.html 78 | 79 */ 45 80 $config['include_paths'] = array 46 81 ( … … 48 83 ); 49 84 85 /* 86 | ----------------------------------------------------------------------------- 87 | Enable Hooks (EXPERT!) 88 | ----------------------------------------------------------------------------- 89 | 90 | User Guide: http://kohanaphp.com/user_guide/en/general/hooks.html 91 | 92 */ 50 93 $config['enable_hooks'] = FALSE; 51 94 95 /* 96 | ----------------------------------------------------------------------------- 97 | Extension Prefix 98 | ----------------------------------------------------------------------------- 99 | 100 | This prefix is used for the filename of your extended libraries, eg: 101 | MY_Controller.php, MY_Database.php, MY_Validation.php 102 | 103 */ 52 104 $config['extension_prefix'] = 'MY_'; 53 105 106 /* 107 | ----------------------------------------------------------------------------- 108 | Time Zone 109 | ----------------------------------------------------------------------------- 110 | 111 | You can set any timezone supported by PHP here. A list of avaialable timezones 112 | is located here: http://php.net/timezones 113 | 114 */ 54 115 $config['timezone'] = ''; 55 116 117 /* 118 | ----------------------------------------------------------------------------- 119 | Auto-Load 120 | ----------------------------------------------------------------------------- 121 | 122 | You can autoload libraries and models. This feature is not necessary due to 123 | Kohana's internal auto-loading methods, but you can use it to save a small 124 | amount of overhead. 125 | 126 | Set the class names in a comma separated list, eg: 127 | 128 | 'libraries' => 'Database, Validation', 129 | 'models' => 'Users, Pages' 130 | 131 */ 56 132 $config['autoload'] = array 57 133 ( -
trunk/application/config/cookie.php
r644 r647 2 2 /** 3 3 * Cookie Configuration 4 * ---------------------------------------------------------------------------- 5 * By default, cookie security is very relaxed. You are encouraged to set a 6 * domain and path to add some security to your cookies. 7 * 8 * User Guide: http://kohanaphp.com/user_guide/en/general/cookies.html 4 9 * 5 10 * @param string prefix - Prefix to avoid collisions … … 9 14 * @param boolean secure - Only allow the cookie on HTTPS 10 15 * @param boolean httponly - Only allow cookie access through the HTTP protocol 16 * 11 17 */ 12 13 // ---------------------------------------------------------------------------- 14 15 $config['prefix'] = ''; 16 $config['domain'] = ''; 17 $config['path'] = '/'; 18 $config['expire'] = 0; 19 $config['secure'] = FALSE; 20 $config['httponly'] = FALSE;18 $config = array 19 ( 20 'prefix' => '', 21 'domain' => '', 22 'path' => '/', 23 'expire' => 0, 24 'secure' => FALSE, 25 'httponly' => FALSE 26 ); -
trunk/application/config/database.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 /* 3 |Database Configuration4 |-----------------------------------------------------------------------------5 |Database connection settings, defined by group name. If no group name is used6 |when loading the database library, the group named "default" will be used.7 |All of the variables listed below are explained in detail in the User Guide.8 | 9 |User Guide: http://kohanaphp.com/user_guide/en/libraries/database.html10 | 11 | Settings: 12 | - show_errors Enable or disable database exceptions 13 | - persistent Enable or disable a persistent connection 14 | - connection DSN identifer: driver://user:password@server/database 15 | - character_set Connection character set 16 | - table_prefix Database table prefix 17 */ 18 2 /** 3 * Database Configuration 4 * ----------------------------------------------------------------------------- 5 * Database connection settings, defined by group name. If no group name is used 6 * when loading the database library, the group named "default" will be used. 7 * All of the variables listed below are explained in detail in the User Guide. 8 * 9 * User Guide: http://kohanaphp.com/user_guide/en/libraries/database.html 10 * 11 * @param boolean show_errors - Enable or disable database exceptions 12 * @param boolean persistent - Enable or disable a persistent connection 13 * @param string connection - DSN identifier: driver://user:password@server/database 14 * @param string character_set - Connection character set 15 * @param string table_prefix - Database table prefix 16 * @param boolean object - Return objects (TRUE) or arrays (FALSE) 17 * 18 */ 19 19 $config['default'] = array 20 20 ( -
trunk/application/config/encryption.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 /** 3 * Encryption Configuration 4 * ----------------------------------------------------------------------------- 5 * 6 * User Guide: http://kohanaphp.com/user_guide/en/libraries/encryption.html 7 * 8 * @param string secret - The encryption key, choose something good! 9 * 10 */ 2 11 3 $config['secret'] = 'K0H@NA+PHP'; 12 $config = array 13 ( 14 'secret' => 'K0H@NA+PHP' 15 ); -
trunk/application/config/log.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 /* 3 |-------------------------------------------------------------------------- 4 | Error Logging Threshold 5 |-------------------------------------------------------------------------- 6 | 7 | If you have enabled error logging, you can set an error threshold to 8 | determine what gets logged. Threshold options are: 9 | You can enable error logging by setting a threshold over zero. The 10 | threshold determines what gets logged. Threshold options are: 11 | 12 | 0 = Disables logging, Error logging TURNED OFF 13 | 1 = Error Messages (including PHP errors) 14 | 2 = Debug Messages 15 | 3 = Informational Messages 16 | 4 = All Messages 17 | 18 | For a live site you'll usually only enable Errors (1) to be logged otherwise 19 | your log files will fill up very fast. 20 | 21 */ 22 $config['threshold'] = 4; 23 24 /* 25 |-------------------------------------------------------------------------- 26 | Error Logging Directory Path 27 |-------------------------------------------------------------------------- 28 | 29 | Leave this BLANK unless you would like to set something other than the default 30 | application/logs/ folder. Use a full server path with trailing slash. 31 | 32 */ 33 $config['directory'] = 'logs'; 34 35 /* 36 |-------------------------------------------------------------------------- 37 | Date Format for Logs 38 |-------------------------------------------------------------------------- 39 | 40 | Each item that is logged has an associated date. You can use PHP date 41 | codes to set your own date formatting 42 | 43 */ 44 $config['format'] = 'Y-m-d H:i:s'; 2 /** 3 * Message Logging 4 * ---------------------------------------------------------------------------- 5 * If you have enabled message logging, you can set a threshold to determine 6 * what gets logged. Setting the threshold to 0 will disable logging completely. 7 * 8 * 0 = Disables logging completely 9 * 1 = Error Messages (including PHP errors) 10 * 2 = Debug Messages 11 * 3 = Informational Messages 12 * 4 = All Messages 13 * 14 * In production, you will want to disable "display_errors" in your index file, 15 * and set the threshold to enable only errors (1). 16 * 17 * @param integer threshold - Message threshold 18 * @param string directory - Log file directory, relative to application/, or absolute 19 * @param string format - PHP date format for timestamps, see: http://php.net/date 20 * 21 */ 22 $config = array 23 ( 24 'threshold' => 4, 25 'directory' => 'logs', 26 'format' => 'Y-m-d H:i:s' 27 ); -
trunk/application/config/mimes.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct access allowed.'); 2 /* 3 | ------------------------------------------------------------------- 4 | MIME TYPES 5 | ------------------------------------------------------------------- 6 | This file contains an array of mime types. It is used by the 7 | Upload class to help identify allowed file types. 8 */ 9 2 /** 3 * Mime Types 4 * ------------------------------------------------------------------- 5 * This file contains an array of mime types. Our list is generally 6 * more complete and robust than "mime.magic" 7 */ 10 8 $config = array 11 9 ( -
trunk/application/config/pagination.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct access allowed.'); 2 3 $config['style'] = 'classic'; 4 5 $config['items_per_page'] = 20; 2 /** 3 * Pagination Configuration 4 * ----------------------------------------------------------------------------- 5 * 6 * User Guide: http://kohanaphp.com/user_guide/en/libraries/pagination.html 7 * 8 * @param string style Style name 9 * @param string items_per_page Number of items in a page of results 10 * 11 */ 12 $config = array 13 ( 14 'style' => 'classic', 15 'items_per_page' => 20 16 ); -
trunk/application/config/routes.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct access allowed.'); 2 3 $config['_default'] = 'user_guide'; 2 /** 3 * Route Configuration 4 * ----------------------------------------------------------------------------- 5 * Routes can be defined as literal matches, regular expressions, and shortcuts. 6 * The "_default" route is reserved for a blank URI string, eg: home page. 7 * 8 * Supported shortcuts are: 9 * 10 * :any - matches any non-blank string 11 * :num - matches any number 12 * 13 * User Guide: http://kohanaphp.com/user_guide/en/libraries/database.html 14 * 15 */ 16 $config = array 17 ( 18 '_default' => 'user_guide' 19 ); -
trunk/application/config/session.php
r644 r647 2 2 /** 3 3 * Session Configuration 4 * ---------------------------------------------------------------------------- 5 * 6 * User Guide: http://kohanaphp.com/user_guide/en/libraries/session.html 4 7 * 5 8 * @param string driver - Session driver name 6 9 * @param string name - Default session name 7 10 * @param array validate - Session parameters to validate 8 * @param mixed encryption - Encryption key for sessions 9 * @param int expiration - Number of seconds that each session will last 10 * @param int regenerate - Number of page loads before the session is regenerated 11 * @param mixed encryption - Encryption key, set to FALSE to disable session encryption 12 * @param integer expiration - Number of seconds that each session will last 13 * @param integer regenerate - Number of page loads before the session is regenerated 14 * 11 15 */ 12 13 // ---------------------------------------------------------------------------- 14 15 $config['driver'] = 'cookie'; 16 $config['name'] = 'kohana_session'; 17 $config['validate'] = array('user_agent'); 18 $config['encryption'] = FALSE; 19 $config['expiration'] = 7200; 20 $config['regenerate'] = 3; 21 22 // DEFAULT SETTINGS ----------------------------------------------------------- 23 24 /* 25 $config['driver'] = 'cookie'; 26 $config['name'] = 'kohana_session'; 27 $config['validate'] = array('user_agent'); 28 $config['encryption'] = FALSE; 29 $config['expiration'] = 7200; 30 $config['regenerate'] = 3; 31 */ 16 $config = array 17 ( 18 'driver' = 'cookie'; 19 'name' = 'kohana_session'; 20 'validate' = array('user_agent'); 21 'encryption' = FALSE; 22 'expiration' = 7200; 23 'regenerate' = 3; 24 ); -
trunk/application/config/upload.php
r644 r647 1 1 <?php defined('SYSPATH') or die('No direct access allowed.'); 2 2 /** 3 * Session Configuration 4 * ---------------------------------------------------------------------------- 5 * 6 * User Guide: http://kohanaphp.com/user_guide/en/libraries/validation.html 7 * 8 * @param string upload_directory - Relative to your index file 9 * @param string remove_space - Remove spaces from filenames 10 * 11 */ 3 12 $config = array 4 13 ( 5 'upload_directory' => '@up ',14 'upload_directory' => '@upload', 6 15 'remove_spaces' => TRUE 7 16 ); -
trunk/application/config/user_agents.php
r644 r647 1 1 <?php if (!defined('SYSPATH')) exit('No direct script access allowed'); 2 /* 3 | ------------------------------------------------------------------- 4 | USER AGENT TYPES 5 | ------------------------------------------------------------------- 6 | This file contains four arrays of user agent data. It is used by the 7 | User Agent Class to help identify browser, platform, robot, and 8 | mobile device data. The array keys are used to identify the device 9 | and the array values are used to set the actual name of the item. 10 | 11 */ 12 $config['platforms'] = array 2 /** 3 * User Agents 4 * ------------------------------------------------------------------- 5 * This file contains four arrays of user agent data. It is used by the 6 * User Agent library to help identify browser, platform, robot, and 7 * mobile device data. The array keys are used to identify the device 8 * and the array values are used to set the actual name of the item. 9 */ 10 $config['platform'] = array 13 11 ( 14 12 'windows nt 6.0' => 'Windows Longhorn', … … 47 45 // The order of this array should NOT be changed. Many browsers return 48 46 // multiple browser types so we want to identify the sub-type first. 49 $config['browser s'] = array47 $config['browser'] = array 50 48 ( 51 49 'Opera' => 'Opera', … … 60 58 'Netscape' => 'Netscape', 61 59 'OmniWeb' => 'OmniWeb', 60 'Safari' => 'Safari', 62 61 'Mozilla' => 'Mozilla', 63 'Safari' => 'Safari',64 62 'Konqueror' => 'Konqueror', 65 63 'icab' => 'iCab', 66 ' Lynx' => 'Lynx',67 ' Links' => 'Links',64 'lynx' => 'Lynx', 65 'links' => 'Links', 68 66 'hotjava' => 'HotJava', 69 67 'amaya' => 'Amaya', … … 71 69 ); 72 70 73 $config['mobile s'] = array71 $config['mobile'] = array 74 72 ( 75 73 'mobileexplorer' => 'Mobile Explorer', -
trunk/application/controllers/welcome.php
r644 r647 5 5 function index() 6 6 { 7 $this->load->library('user_agent'); 8 7 9 foreach(get_class_methods(__CLASS__) as $method) 8 10 { … … 119 121 echo "done in {execution_time} seconds"; 120 122 } 123 121 124 function user_agent_example() 122 125 { 123 126 $this->load->library('user_agent'); 124 echo $this->user_agent; 127 128 foreach(array('agent', 'browser', 'version') as $key) 129 { 130 print $key.': '.$this->user_agent->$key.'<br/>'."\n"; 131 } 132 133 print "<br/><br/>\n"; 134 print "done in {execution_time} seconds"; 125 135 } 136 126 137 function calendar_example() 127 138 { … … 129 140 echo $this->calendar->generate(); 130 141 } 142 131 143 function image_example() 132 144 { -
trunk/index.php
r644 r647 8 8 | User Guide for more information. 9 9 | ----------------------------------------------------------------------------- 10 | User Guide: http://kohanaphp.com/user_guide/kohana/installation.html 10 | User Guide: http://kohanaphp.com/user_guide/en/kohana/installation.html 11 | ----------------------------------------------------------------------------- 12 | License: http://kohanaphp.com/user_guide/en/license.html 11 13 | ----------------------------------------------------------------------------- 12 14 */ 13 15 14 // Set the error reporting level 15 @error_reporting(E_ALL); 16 /** 17 * Set the error reporting level. E_ALL is a good default. 18 * NOTE: Kohana will always ignore E_NOTICE errors 19 */ 20 error_reporting(E_ALL); 16 21 17 // Enable or disable error reporting 18 @ini_set('display_errors', TRUE); 22 /** 23 * Enable or disable error reporting. You should always disable this in production. 24 */ 25 ini_set('display_errors', TRUE); 19 26 20 // Kohana application directory 27 /** 28 * Kohana application directory. This directory must contain a config/ directory. 29 */ 21 30 $kohana_application = 'application'; 22 31 23 // Kohana system directory 32 /** 33 * Kohana system directory. This directory must contain the core/ directory. 34 */ 24 35 $kohana_system = 'system'; 36 37 /** 38 * If you have to rename all of the .php files distributed with Kohana to a 39 * different filename, you set the new extension here. Most people will never 40 * use this option. 41 */ 42 define('EXT', '.php'); 25 43 26 44 /* … … 28 46 | PLEASE DO NOT EDIT BELOW THIS LINE, unless you understand the repercussions! 29 47 | ----------------------------------------------------------------------------- 30 | User Guide: http://kohanaphp.com/user_guide/ general/bootstrapping.html48 | User Guide: http://kohanaphp.com/user_guide/en/general/bootstrapping.html 31 49 | ----------------------------------------------------------------------------- 32 50 | $Id$ 33 51 */ 34 // Absolute path names for include purposes 35 define('APPPATH', str_replace('\\', '/', realpath($kohana_application)).'/'); unset($kohana_application); 36 define(' SYSPATH', str_replace('\\', '/', realpath($kohana_system)).'/'); unset($kohana_system);37 // Information about the front controller 38 $docroot = str_replace('\\', '/', realpath(__FILE__)); 39 define(' KOHANA', pathinfo($docroot, PATHINFO_BASENAME));40 define(' DOCROOT', pathinfo($docroot, PATHINFO_DIRNAME).'/');41 define('EXT', '.'.pathinfo($docroot, PATHINFO_EXTENSION)); 42 unset($docroot );43 // Validate APPPATH 52 $docroot = pathinfo(str_replace('\\', '/', realpath(__FILE__))); 53 54 define('KOHANA', $docroot['basename']); 55 define('DOCROOT', $docroot['dirname'].'/'); 56 57 define('APPPATH', str_replace('\\', '/', realpath($kohana_application)).'/'); 58 define('SYSPATH', str_replace('\\', '/', realpath($kohana_system)).'/'); 59 60 unset($docroot, $kohana_application, $kohana_system); 61 44 62 (is_dir(APPPATH) AND is_dir(APPPATH.'/config')) or die 45 63 ( … … 47 65 'Set a valid <code>$application_path</code> in <kbd>index.php</kbd> and refresh the page.' 48 66 ); 49 // Validate SYSPATH 67 50 68 (is_dir(SYSPATH) AND file_exists(SYSPATH.'/core/'.'Bootstrap'.EXT)) or die 51 69 ( … … 53 71 'Set a valid <code>$kohana_system</code> in <kbd>index.php</kbd> and refresh the page.' 54 72 ); 55 // Buckle those bootstraps! 73 56 74 require_once SYSPATH.'core/Bootstrap'.EXT; -
trunk/system/libraries/Session.php
r644 r647 92 92 $this->create(); 93 93 94 // Close the session just before flushing the output buffer 94 95 Event::add('system.pre_output', 'session_write_close'); 95 96 -
trunk/system/libraries/User_agent.php
r644 r647 28 28 * Identifies the platform, browser, robot, or mobile devise of the browsing agent 29 29 * 30 * @package Kohana31 * @subpackage Libraries32 * @category User Agent33 * @author Rick Ellis, Kohana Team34 * @link http://kohanaphp.com/user_guide/libraries/user_agent.html30 * @package Kohana 31 * @subpackage Libraries 32 * @category User Agent 33 * @author Rick Ellis, Kohana Team 34 * @link http://kohanaphp.com/user_guide/en/libraries/user_agent.html 35 35 */ 36 36 class User_Agent_Core { 37 37 38 p rivate $agent= NULL;38 public static $agent = NULL; 39 39 40 pr ivate $is_browser = FALSE;41 pr ivate $is_robot = FALSE;42 pr ivate $is_mobile = FALSE;40 protected static $referrer = ''; 41 protected static $languages = array(); 42 protected static $charsets = array(); 43 43 44 private $languages = array(); 45 private $charsets = array(); 46 47 private $platforms = array(); 48 private $browsers = array(); 49 private $mobiles = array(); 50 private $robots = array(); 51 52 private $platform = ''; 53 private $browser  
