Changeset 816

Show
Ignore:
Timestamp:
10/13/2007 04:45:08 PM (14 months ago)
Author:
Shadowhand
Message:

Cleaned up libraries, normalized comment headers, started Cache library, general cleanup and fixes.

Location:
trunk/system
Files:
1 added
26 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/core/Kohana.php

    r812 r816  
    916916 
    917917                        // The name of the file to search for 
    918                         $filename = Config::item('core.locale').'/'.$type; 
     918                        $filename = Config::item('core.locale').'/'.$group; 
    919919 
    920920                        // Loop through the files and include each one, so SYSPATH files 
     
    935935 
    936936                        // Cache the type 
    937                         $language[$type] = $messages; 
     937                        $language[$group] = $messages; 
    938938                } 
    939939 
     
    945945                if (is_string($line) AND func_num_args() > 1) 
    946946                { 
    947                         $line = vsprintf($line, array_slice(func_get_args(), 1)); 
     947                        $args = func_get_args(); 
     948                        $args = array_slice($args, 1); 
     949 
     950                        // Add the arguments into the line 
     951                        $line = vsprintf($line, is_array($args[0]) ? $args[0] : $args); 
    948952                } 
    949953 
  • trunk/system/i18n/en_US/database.php

    r718 r816  
    44( 
    55        'undefined_group'       => 'The %s group is not defined in your configuration.', 
    6         'error'                                 => 'There was an SQL error: %s', 
    7         'connection'                    => 'There was an error connecting to the database: %s', 
    8         'driver_not_supported'  => 'The driver is not supported: %s', 
    9         'invalid_dsn'                   => 'The DSN you supplied is not vailid: %s' 
     6        'error'                 => 'There was an SQL error: %s', 
     7        'connection'            => 'There was an error connecting to the database: %s', 
     8        'driver_not_supported'  => 'The driver is not supported: %s', 
     9        'invalid_dsn'           => 'The DSN you supplied is not vailid: %s' 
    1010); 
  • trunk/system/libraries/Calendar.php

    r700 r816  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Kohana 
     3 * Kohana: The swift, small, and secure PHP5 framework 
    44 * 
    5  * An open source application development framework for PHP 4.3.2 or newer 
     5 * @package    Kohana 
     6 * @author     Kohana Team 
     7 * @copyright  Copyright (c) 2007 Kohana Team 
     8 * @link       http://kohanaphp.com 
     9 * @license    http://kohanaphp.com/license.html 
     10 * @since      Version 2.0 
     11 * @filesource 
     12 * $Id$ 
     13 */ 
     14 
     15/** 
     16 * Calendar Class 
    617 * 
    7  * NOTE: This file has been modified from the original CodeIgniter version for 
    8  * the Kohana framework by the Kohana Development Team. 
    9  * 
    10  * @package          Kohana 
    11  * @author           Kohana Development Team 
    12  * @copyright        Copyright (c) 2007, Kohana Framework Team 
    13  * @link             http://kohanaphp.com 
    14  * @license          http://kohanaphp.com/user_guide/license.html 
    15  * @since            Version 1.0 
    16  * @orig_package     CodeIgniter 
    17  * @orig_author      Rick Ellis 
    18  * @orig_copyright   Copyright (c) 2006, EllisLab, Inc. 
    19  * @orig_license     http://www.codeigniter.com/user_guide/license.html 
    20  * @filesource 
    21  */ 
    22  
    23 // ------------------------------------------------------------------------ 
    24  
    25 /** 
    26  * Kohana Calendar Class 
    27  * 
    28  * This class enables the creation of calendars 
    29  * 
    30  * @package             Kohana 
    31  * @subpackage  Libraries 
    32  * @category    Libraries 
    33  * @author              Rick Ellis, Kohana Team 
    34  * @link                http://kohanaphp.com/user_guide/libraries/calendar.html 
     18 * @category    Libraries 
     19 * @author      Rick Ellis, Kohana Team 
     20 * @copyright   Copyright (c) 2006, EllisLab, Inc. 
     21 * @license     http://www.codeigniter.com/user_guide/license.html 
     22 * @link        http://kohanaphp.com/user_guide/en/libraries/calendar.html 
    3523 */ 
    3624class Calendar_Core { 
     
    3826        private $lang; 
    3927        private $local_time; 
    40         private $template               = ''; 
    41         private $start_day              = 'sunday'; 
    42         private $month_type     = 'long'; 
    43         private $day_type               = 'abr'; 
    44         private $show_next_prev = FALSE; 
    45         private $next_prev_url  = ''; 
     28        private $template       = ''; 
     29        private $start_day      = 'sunday'; 
     30        private $month_type     = 'long'; 
     31        private $day_type       = 'abr'; 
     32        private $show_next_prev = FALSE; 
     33        private $next_prev_url  = ''; 
    4634 
    4735        /** 
  • trunk/system/libraries/Controller.php

    r754 r816  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Kohana: The small, swift, and secure PHP5 framework 
     3 * Kohana: The swift, small, and secure PHP5 framework 
    44 * 
    55 * @package    Kohana 
     
    1616 * Controller Class 
    1717 * 
    18  * @category  Libraries 
    19  * @author    Kohana Team 
    20  * @link      http://kohanaphp.com/user_guide/en/general/controllers.html 
     18 * @category    Libraries 
     19 * @author      Kohana Team 
     20 * @link        http://kohanaphp.com/user_guide/en/general/controllers.html 
    2121 */ 
    2222class Controller_Core extends Kohana { 
    2323 
     24        /** 
     25         * Constructor 
     26         */ 
    2427        public function __construct() 
    2528        { 
     
    3740        } 
    3841 
     42        /** 
     43         * Includes a View within the controller scope 
     44         * 
     45         * @access public 
     46         * @param  string 
     47         * @param  array 
     48         * @return string 
     49         */ 
    3950        public function kohana_include_view($kohana_view_filename, $kohana_input_data) 
    4051        { 
    41                 if ($kohana_view_filename == '') return; 
     52                if ($kohana_view_filename == '') 
     53                        return; 
    4254 
    4355                // Buffering on 
  • trunk/system/libraries/Database.php

    r795 r816  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Kohana: The small, swift, and secure PHP5 framework 
     3 * Kohana: The swift, small, and secure PHP5 framework 
    44 * 
    5  * @package          Kohana 
    6  * @author           Kohana Team 
    7  * @copyright        Copyright (c) 2007 Kohana Team 
    8  * @link             http://kohanaphp.com 
    9  * @license          http://kohanaphp.com/user_guide/kohana/license.html 
    10  * @since            Version 1.0 
    11  * @orig_package     CodeIgniter 
    12  * @orig_author      Rick Ellis 
    13  * @orig_copyright   Copyright (c) 2006, EllisLab, Inc. 
    14  * @orig_license     http://www.codeigniter.com/user_guide/license.html 
     5 * @package    Kohana 
     6 * @author     Kohana Team 
     7 * @copyright  Copyright (c) 2007 Kohana Team 
     8 * @link       http://kohanaphp.com 
     9 * @license    http://kohanaphp.com/license.html 
     10 * @since      Version 2.0 
    1511 * @filesource 
     12 * $Id$ 
    1613 */ 
    17  
    18 // ------------------------------------------------------------------------ 
    1914 
    2015/** 
    2116 * Database Class 
    2217 * 
    23  * $Id$ 
    24  * 
    25  * @package     Kohana 
    26  * @subpackage  Libraries 
    27  * @category    Database 
     18 * @category    Libraries 
    2819 * @author      Rick Ellis, Kohana Team 
     20 * @copyright   Copyright (c) 2006, EllisLab, Inc. 
     21 * @license     http://www.codeigniter.com/user_guide/license.html 
     22 * @link        http://kohanaphp.com/user_guide/en/general/database.html 
    2923 */ 
    3024class Database_Core { 
  • trunk/system/libraries/Encrypt.php

    r712 r816  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Kohana: The small, swift, and secure PHP5 framework 
     3 * Kohana: The swift, small, and secure PHP5 framework 
    44 * 
    5  * @package          Kohana 
    6  * @author           Kohana Team 
    7  * @copyright        Copyright (c) 2007 Kohana Team 
    8  * @link             http://kohanaphp.com 
    9  * @license          http://kohanaphp.com/user_guide/kohana/license.html 
    10  * @since            Version 1.0 
    11  * @orig_package     CodeIgniter 
    12  * @orig_author      Rick Ellis 
    13  * @orig_copyright   Copyright (c) 2006, EllisLab, Inc. 
    14  * @orig_license     http://www.codeigniter.com/user_guide/license.html 
     5 * @package    Kohana 
     6 * @author     Kohana Team 
     7 * @copyright  Copyright (c) 2007 Kohana Team 
     8 * @link       http://kohanaphp.com 
     9 * @license    http://kohanaphp.com/license.html 
     10 * @since      Version 2.0 
    1511 * @filesource 
     12 * $Id$ 
    1613 */ 
    1714 
    18 // ------------------------------------------------------------------------ 
    19  
    2015/** 
    21  * Encryption Class 
     16 * Encrypt Class 
    2217 * 
    23  * $Id$ 
    24  * 
    25  * @package        Kohana 
    26  * @subpackage     Libraries 
    27  * @category       Encryption 
    28  * @author         Rick Ellis, Kohana Team 
    29  * @link           http://kohanaphp.com/user_guide/libraries/encryption.html 
     18 * @category    Libraries 
     19 * @author      Rick Ellis, Kohana Team 
     20 * @copyright   Copyright (c) 2006, EllisLab, Inc. 
     21 * @license     http://www.codeigniter.com/user_guide/license.html 
     22 * @link        http://kohanaphp.com/user_guide/en/libraries/encrypt.html 
    3023 */ 
    3124class Encrypt_Core { 
    3225 
    33         private $encryption_key = ''; 
    34         private $hash_type      = 'sha1'; 
    35         private $mcrypt_exists  = FALSE; 
    36         private $mcrypt_cipher  = ''; 
    37         private $mcrypt_mode    = ''; 
     26        protected $encryption_key = ''; 
     27        protected $hash_type      = 'sha1'; 
     28        protected $mcrypt_exists  = FALSE; 
     29        protected $mcrypt_cipher  = ''; 
     30        protected $mcrypt_mode    = ''; 
    3831 
    3932        /** 
     
    146139         * encoded bit-string using XOR 
    147140         * 
    148          * @access  private 
    149          * @param   string 
    150          * @param   string 
    151          * @return  string 
    152          */ 
    153         private function xor_encode($string, $key) 
     141         * @access  protected 
     142         * @param   string 
     143         * @param   string 
     144         * @return  string 
     145         */ 
     146        protected function xor_encode($string, $key) 
    154147        { 
    155148                $rand = ''; 
     
    177170         * plain-text original message 
    178171         * 
    179          * @access      private 
    180          * @param       string 
    181          * @param       string 
    182          * @return      string 
    183          */ 
    184         private function xor_decode($string, $key) 
     172         * @access  protected 
     173         * @param   string 
     174         * @param   string 
     175         * @return  string 
     176         */ 
     177        protected function xor_decode($string, $key) 
    185178        { 
    186179                $string = $this->xor_merge($string, $key); 
     
    200193         * Takes a string and key as input and computes the difference using XOR 
    201194         * 
    202          * @access  private 
    203          * @param   string 
    204          * @param   string 
    205          * @return  string 
    206          */ 
    207         private function xor_merge($string, $key) 
     195         * @access  protected 
     196         * @param   string 
     197         * @param   string 
     198         * @return  string 
     199         */ 
     200        protected function xor_merge($string, $key) 
    208201        { 
    209202                $hash = $this->hash($key); 
  • trunk/system/libraries/Ftp.php

    r712 r816  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Kohana 
     3 * Kohana: The swift, small, and secure PHP5 framework 
    44 * 
    5  * An open source application development framework for PHP 4.3.2 or newer 
    6  * 
    7  * NOTE: This file has been modified from the original CodeIgniter version for 
    8  * the Kohana framework by the Kohana Development Team. 
    9  * 
    10  * @package          Kohana 
    11  * @author           Kohana Development Team 
    12  * @copyright        Copyright (c) 2007, Kohana Framework Team 
    13  * @link             http://kohanaphp.com 
    14  * @license          http://kohanaphp.com/user_guide/license.html 
    15  * @since            Version 1.0 
    16  * @orig_package     CodeIgniter 
    17  * @orig_author      Rick Ellis 
    18  * @orig_copyright   Copyright (c) 2006, EllisLab, Inc. 
    19  * @orig_license     http://www.codeigniter.com/user_guide/license.html 
     5 * @package    Kohana 
     6 * @author     Kohana Team 
     7 * @copyright  Copyright (c) 2007 Kohana Team 
     8 * @link       http://kohanaphp.com 
     9 * @license    http://kohanaphp.com/license.html 
     10 * @since      Version 2.0 
    2011 * @filesource 
     12 * $Id$ 
    2113 */ 
    22  
    23 // ------------------------------------------------------------------------ 
    2414 
    2515/** 
    2616 * FTP Class 
    2717 * 
    28  * @package             Kohana 
    29  * @subpackage  Libraries 
    30  * @category    Libraries 
    31  * @author              Rick Ellis, Kohana Team 
    32  * @link                http://kohanaphp.com/user_guide/libraries/ftp.html 
     18 * @category    Libraries 
     19 * @author      Rick Ellis, Kohana Team 
     20 * @copyright   Copyright (c) 2006, EllisLab, Inc. 
     21 * @license     http://www.codeigniter.com/user_guide/license.html 
     22 * @link        http://kohanaphp.com/user_guide/en/libraries/ftp.html 
    3323 */ 
    3424class FTP_Core { 
  • trunk/system/libraries/Image_lib.php

    r807 r816  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Kohana 
     3 * Kohana: The swift, small, and secure PHP5 framework 
    44 * 
    5  * An open source application development framework for PHP 4.3.2 or newer 
     5 * @package    Kohana 
     6 * @author     Kohana Team 
     7 * @copyright  Copyright (c) 2007 Kohana Team 
     8 * @link       http://kohanaphp.com 
     9 * @license    http://kohanaphp.com/license.html 
     10 * @since      Version 2.0 
     11 * @filesource 
     12 * $Id$ 
     13 */ 
     14 
     15/** 
     16 * Image_lib Class 
    617 * 
    7  * NOTE: This file has been modified from the original CodeIgniter version for 
    8  * the Kohana framework by the Kohana Development Team. 
    9  * 
    10  * @package          Kohana 
    11  * @author           Kohana Development Team 
    12  * @copyright        Copyright (c) 2007, Kohana Framework Team 
    13  * @link             http://kohanaphp.com 
    14  * @license          http://kohanaphp.com/user_guide/license.html 
    15  * @since            Version 1.0 
    16  * @orig_package     CodeIgniter 
    17  * @orig_author      Rick Ellis 
    18  * @orig_copyright   Copyright (c) 2006, EllisLab, Inc. 
    19  * @orig_license     http://www.codeigniter.com/user_guide/license.html 
    20  * @filesource 
    21  */ 
    22  
    23 // ------------------------------------------------------------------------ 
    24  
    25 /** 
    26  * Image Manipulation class 
    27  * 
    28  * @package             Kohana 
    29  * @subpackage  Libraries 
    30  * @category    Image_lib 
    31  * @author              Rick Ellis 
    32  * @link                http://kohanaphp.com/user_guide/libraries/image_lib.html 
     18 * @category    Libraries 
     19 * @author      Rick Ellis, Kohana Team 
     20 * @copyright   Copyright (c) 2006, EllisLab, Inc. 
     21 * @license     http://www.codeigniter.com/user_guide/license.html 
     22 * @link        http://kohanaphp.com/user_guide/en/libraries/image_lib.html 
    3323 */ 
    3424class Image_lib_Core { 
  • trunk/system/libraries/Input.php

    r804 r816  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22/** 
    3  * Kohana 
     3 * Kohana: The swift, small, and secure PHP5 framework 
    44 * 
    5  * An open source application development framework for PHP 4.3.2 or newer 
    6  * 
    7  * NOTE: This file has been modified from the original CodeIgniter version for 
    8  * the Kohana framework by the Kohana Team. 
    9  * 
    10  * @package          Kohana 
    11  * @author           Kohana Team 
    12  * @copyright        Copyright (c) 2007 Kohana Team 
    13  * @link             http://kohanaphp.com 
    14  * @license          http://kohanaphp.com/user_guide/kohana/license.html 
    15  * @since            Version 1.0 
    16  * @orig_package     CodeIgniter 
    17  * @orig_author      Rick Ellis 
    18  * @orig_copyright   Copyright (c) 2006, EllisLab, Inc. 
    19  * @orig_license     http://www.codeigniter.com/user_guide/license.html 
     5 * @package    Kohana 
     6 * @author     Kohana Team 
     7 * @copyright  Copyright (c) 2007 Kohana Team 
     8 * @link       http://kohanaphp.com 
     9 * @license    http://kohanaphp.com/license.html 
     10 * @since      Version 2.0 
    2011 * @filesource 
    21  * 
    2212 * $Id$ 
    2313 */ 
    24  
    25 // ------------------------------------------------------------------------ 
    2614 
    2715/** 
    2816 * Input Class 
    2917 * 
    30  * Pre-processes global input data for security 
    31  * 
    32  * @package     Kohana 
    33  * @subpackage  Libraries 
    34  * @category    Input 
    35  * @author      Rick Ellis 
    36  * @link        http://kohanaphp.com/user_guide/libraries/input.html 
     18 * @category    Libraries 
     19 * @author      Rick Ellis, Kohana Team 
     20 * @copyright   Copyright (c) 2006, EllisLab, Inc. 
     21 * @license     http://www.codeigniter.com/user_guide/license.html 
     22 * @link        http://kohanaphp.com/user_guide/en/libraries/input.html 
    3723 */ 
    3824class Input_Core { 
    3925 
    40         protected $use_xss_clean   = FALSE; 
     26        protected static $instances = 0; 
     27 
     28        protected $use_xss_clean = FALSE; 
    4129 
    4230        public $ip_address = FALSE; 
     
    5442        public function __construct() 
    5543        { 
    56                 // Unset globals. This is effectively the same as register_globals = off 
    57                 foreach (array($_GET, $_POST, $_COOKIE) as $global) 
    58                 { 
    59                         if ( ! is_array($global)) 
    60                         { 
    61                                 global $global; 
    62                                 $$global = NULL; 
     44                if (self::$instances === 0) 
     45                { 
     46                        // Clean $_GET data 
     47                        if (is_array($_GET) AND count($_GET) > 0) 
     48                        { 
     49                                foreach($_GET as $key => $val) 
     50                                { 
     51                                        // Unset the global string 
     52                                        if (isset($GLOBALS[$str])) 
     53                                        { 
     54                                                global $$key; 
     55                                                $$key = NULL; 
     56                                        } 
     57 
     58                                        $_GET[$this->clean_input_keys($key)] = $this->clean_input_data($val); 
     59                                } 
    6360                        } 
    6461                        else 
    6562                        { 
    66                                 foreach ($global as $key => $val) 
     63                                $_GET = array(); 
     64                        } 
     65 
     66                        // Clean $_POST data 
     67                        if (is_array($_POST) AND count($_POST) > 0) 
     68                        { 
     69                                foreach($_POST as $key => $val) 
    6770                                { 
    68                                         global $$key; 
    69                                         $$key = NULL; 
     71                                        if (isset($GLOBALS[$str])) 
     72                                        { 
     73                                                global $$key; 
     74                                                $$key = NULL; 
     75                                        } 
     76 
     77                                        $_POST[$this->clean_input_keys($key)] = $this->clean_input_data($val); 
    7078                                } 
    7179                        } 
    72                 } 
    73  
    74                 // Clean $_GET data 
    75                 if (is_array($_GET) AND count($_GET) > 0) 
    76                 { 
    77                         foreach($_GET as $key => $val) 
    78                         { 
    79                                 $_GET[$this->clean_input_keys($key)] = $this->clean_input_data($val); 
    80                         } 
    81                 } 
    82  
    83                 // Clean $_POST data 
    84                 if (is_array($_POST) AND count($_POST) > 0) 
    85                 { 
    86                         foreach($_POST as $key => $val) 
    87                         { 
    88                                 $_POST[$this->clean_input_keys($key)] = $this->clean_input_data($val); 
    89                         } 
    90                 } 
    91  
    92                 // Clean $_COOKIE data 
    93                 if (is_array($_COOKIE) AND count($_COOKIE) > 0) 
    94                 { 
    95                         foreach($_COOKIE as $key => $val) 
    96                         { 
    97                                 $_COOKIE[$this->clean_input_keys($key)] = $this->clean_input_data($val); 
    98                         } 
    99                 } 
    100  
    101                 Log::add('debug', 'Global POST and COOKIE data sanitized'); 
     80                        else 
     81                        { 
     82                                $_POST = array(); 
     83                        } 
     84 
     85                        // Clean $_COOKIE data 
     86                        if (is_array($_COOKIE) AND count($_COOKIE) > 0) 
     87                        { 
     88                                foreach($_COOKIE as $key => $val) 
     89                                { 
     90                                        if (isset($GLOBALS[$str])) 
     91                                        { 
     92                                                global $$key; 
     93