- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
<?php
        define('PATH_LEN', 32);
        define('ALPH_SIZE', 66);
        
        class Security
        {
                public static $rus_alphabet = array('А', 'а', 'Б', 'б', 'В', 'в', 'Г', 'г', 'Д', 'д', 'Е', 'е', 'Ё', 'ё',   'Ж', 'ж',   'З', 'з', 'И', 'и', 'Й', 'й',   'К', 'к', 'Л', 'л', 'М', 'м', 'Н', 'н', 'О', 'о', 'П', 'п', 'Р', 'р', 'С', 'с', 'Т', 'т', 'У', 'у', 'Ф', 'ф', 'Х', 'х', 'Ц', 'ц', 'Ч', 'ч',   'Ш', 'ш',   'Щ', 'щ',   'Ъ', 'ъ', 'Ы', 'ы', 'Ь', 'ь',     'Э', 'э', 'Ю', 'ю',     'Я', 'я');
                public static $eng_alphabet = array('A', 'a', 'B', 'b', 'V', 'v', 'G', 'g', 'D', 'd', 'E', 'e', 'Yo', 'yo', 'Zh', 'zh', 'Z', 'z', 'I', 'i', 'Ji', 'ji', 'K', 'k', 'L', 'l', 'M', 'm', 'N', 'n', 'O', 'o', 'P', 'p', 'R', 'r', 'S', 's', 'T', 't', 'Y', 'y', 'F', 'f', 'H', 'h', 'C', 'c', 'Ch', 'ch', 'Sh', 'sh', 'Ch', 'ch', '_', '_', '_', '_', '_', '_', '_', '_', 'U', 'u', 'Ya', 'ya');
                
                static public function Transform($string)
                {
                        $string = htmlspecialchars($string);
                        $string = strip_tags($string);
                        
                        return $string;
                }
                
                static public function TransformName($string)
                {
                        $temp = '';
                        
                        for($i = 0; $i < strlen($string); $i++)
                        {
                                if($string[$i] === ' ')
                                        {
                                                $temp += '_';
                                                continue;
                                        }
                                
                                for($j = 0; $j < ALPH_SIZE; $j++)
                                        if(Security::$rus_alphabet[$j] === Security::$string[$i])
                                                {
                                                        $temp += Security::$eng_alphabet[$j];
                                                        continue 2;                                                     
                                                }
                                $temp += $string[$i];                   
                        }
                        
                        return $temp;
                }
                
        }
?>