Changeset 701

Show
Ignore:
Timestamp:
10/08/2007 10:39:27 AM (14 months ago)
Author:
Geert
Message:

View constructor didn't allow for tiff (with double f) because of $ at the end.
Also cleaning up security stuff a bit.

Location:
trunk/system
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/helpers/security.php

    r668 r701  
    88        } 
    99 
    10         public static function image_tags($str) 
     10        public static function strip_image_tags($str) 
    1111        { 
    1212                $str = preg_replace('#<img\b.*?(?:src\s*=\s*["\']?([^"\'<>\s]*)["\']?[^>]*)?>#is', '$1', $str); 
     
    1515        } 
    1616 
    17         public static function php_tags($str) 
     17        public static function encode_php_tags($str) 
    1818        { 
    1919                return str_replace(array('<?', '?>'),  array('&lt;?', '?&gt;'), $str); 
  • trunk/system/libraries/Validation.php

    r696 r701  
    126126        } 
    127127 
    128         // -------------------------------------------------------------------- 
    129  
    130128        /** 
    131129         * Set Field Information 
     
    172170        } 
    173171 
    174         // -------------------------------------------------------------------- 
    175  
    176172        /** 
    177173         * Set Error Message 
     
    198194        } 
    199195 
    200         // -------------------------------------------------------------------- 
    201  
    202196        /** 
    203197         * Error Message Format 
     
    217211                $this->error_format = $string; 
    218212        } 
    219  
    220         // -------------------------------------------------------------------- 
    221213 
    222214        public function add_error($func, $field) 
     
    365357                } 
    366358        } 
    367  
    368         // -------------------------------------------------------------------- 
    369359 
    370360        public function upload($data, $params = FLASE) 
     
    625615        } 
    626616 
    627         // -------------------------------------------------------------------- 
    628  
    629617        /** 
    630618         * Match one field to another 
     
    644632        } 
    645633 
    646         // -------------------------------------------------------------------- 
    647  
    648634        /** 
    649635         * Minimum Length 
     
    663649        } 
    664650 
    665         // -------------------------------------------------------------------- 
    666  
    667651        /** 
    668652         * Max Length 
     
    682666        } 
    683667 
    684         // -------------------------------------------------------------------- 
    685  
    686668        /** 
    687669         * Exact Length 
     
    700682                return (bool) (strlen($str) == $val); 
    701683        } 
    702  
    703         // -------------------------------------------------------------------- 
    704684 
    705685        /** 
     
    714694                return (bool) preg_match('/^(?!\.)[-+_a-z0-9.]++(?<!\.)@(?![-.])[-a-z0-9.]+(?<!\.)\.[a-z]{2,6}$/iD', $email); 
    715695        } 
    716  
    717         // -------------------------------------------------------------------- 
    718696 
    719697        /** 
     
    750728        } 
    751729 
    752         // -------------------------------------------------------------------- 
    753  
    754730        /** 
    755731         * Validate IP Address 
     
    764740        } 
    765741 
    766         // -------------------------------------------------------------------- 
    767  
    768742        /** 
    769743         * Alpha 
     
    777751                return ctype_alpha($str); 
    778752        } 
    779  
    780         // -------------------------------------------------------------------- 
    781753 
    782754        /** 
     
    792764        } 
    793765 
    794         // -------------------------------------------------------------------- 
    795  
    796766        /** 
    797767         * Alpha-numeric with underscores and dashes 
     
    805775                return (bool) preg_match('/^[-a-z0-9_]+$/iD', $str); 
    806776        } 
    807  
    808         // -------------------------------------------------------------------- 
    809777 
    810778        /** 
     
    820788        } 
    821789 
    822         // -------------------------------------------------------------------- 
    823  
    824790        /** 
    825791         * Numeric 
     
    840806        } 
    841807 
    842         // -------------------------------------------------------------------- 
    843  
    844808        /** 
    845809         * Set Select 
     
    866830        } 
    867831 
    868         // -------------------------------------------------------------------- 
    869  
    870832        /** 
    871833         * Set Radio 
     
    892854        } 
    893855 
    894         // -------------------------------------------------------------------- 
    895  
    896856        /** 
    897857         * Set Checkbox 
     
    918878        } 
    919879 
    920         // -------------------------------------------------------------------- 
    921  
    922880        /** 
    923881         * Prep data for form 
     
    940898        } 
    941899 
    942         // -------------------------------------------------------------------- 
    943  
    944900        /** 
    945901         * Prep URL 
     
    965921        } 
    966922 
    967         // -------------------------------------------------------------------- 
    968  
    969923        /** 
    970924         * Strip Image Tags 
     
    976930        public function strip_image_tags($str) 
    977931        { 
    978                 $this->data[$this->current_field] = Kohana::instance()->input->strip_image_tags($str); 
    979         } 
    980  
    981         // -------------------------------------------------------------------- 
     932                $this->data[$this->current_field] = security::strip_image_tags($str); 
     933        } 
    982934 
    983935        /** 
     
    993945        } 
    994946 
    995         // -------------------------------------------------------------------- 
    996  
    997947        /** 
    998948         * Convert PHP tags to entities 
     
    1004954        public function encode_php_tags($str) 
    1005955        { 
    1006                 $this->data[$this->current_field] = str_replace(array('<?', '?>'),  array('&lt;?php', '?&gt;'), $str); 
    1007         } 
    1008  
    1009  
     956                $this->data[$this->current_field] = security::encode_php_tags($str); 
     957        } 
    1010958 
    1011959} // End Validation Class 
  • trunk/system/libraries/View.php

    r678 r701  
    4242        public function __construct($name, $data = NULL) 
    4343        { 
    44                 if (preg_match('/\.([gt]if|jpe?g|png|js|css|swf)$/Di', $name, $type)) 
     44                if (preg_match('/\.(gif|jpe?g|png|tiff?|js|css|swf)$/Di', $name, $type)) 
    4545                { 
    4646                        $type = $type[1]; 
     
    8080                $protected = array('kohana_filename', 'kohana_renderer', 'kohana_filetype'); 
    8181 
    82                 if (in_array($name,  $protected) AND $this->$name === FALSE) 
     82                if (in_array($name, $protected) AND $this->$name === FALSE) 
    8383                { 
    8484                        $this->$name = $value;