1805 |
clement.si |
1 |
<?php
|
|
|
2 |
function init_encoder()
|
|
|
3 |
{
|
|
|
4 |
$k = array(
|
|
|
5 |
|
|
|
6 |
"~@"=>"", "~A"=>"", "~B"=>"", "~C"=>"", "~D"=>"", "~E"=>"
",
|
|
|
7 |
"~F"=>"", "~G"=>"", "~H"=>"", "~I"=>"", "~J"=>"", "~K"=>"",
|
|
|
8 |
"~L"=>"", "~M"=>"", "~N"=>"", "~O"=>"", "~P"=>"", "~Q"=>"",
|
|
|
9 |
"~R"=>"", "~S"=>"", "~T"=>"", "~U"=>"", "~V"=>"", "~W"=>"",
|
|
|
10 |
"~^"=>"", "~_"=>"", "| "=>" ", ""=>"ʽ", ""=>"ʼ", ""=>"£",
|
|
|
11 |
""=>"�", ""=>"�", ""=>"¦", ""=>"§", ""=>"¨", ""=>"©",
|
|
|
12 |
""=>"�", ""=>"«", ""=>"¬", ""=>"", ""=>"�", ""=>"―",
|
|
|
13 |
""=>"°", ""=>"±", ""=>"²", ""=>"³", ""=>"΄", ""=>"΅",
|
|
|
14 |
""=>"Ά", ""=>"·", ""=>"Έ", ""=>"Ή", ""=>"Ί", ""=>"»",
|
|
|
15 |
""=>"Ό", ""=>"½", ""=>"Ύ", ""=>"Ώ", ""=>"ΐ", ""=>"Α",
|
|
|
16 |
""=>"Β", ""=>"Γ", ""=>"Δ", ""=>"Ε", ""=>"Ζ", ""=>"Η",
|
|
|
17 |
""=>"Θ", ""=>"Ι", ""=>"Κ", ""=>"Λ", ""=>"Μ", ""=>"Ν",
|
|
|
18 |
""=>"Ξ", ""=>"Ο", ""=>"Π", ""=>"Ρ", ""=>"�", ""=>"Σ",
|
|
|
19 |
""=>"Τ", ""=>"Υ", ""=>"Φ", ""=>"Χ", ""=>"Ψ", ""=>"Ω",
|
|
|
20 |
""=>"Ϊ", ""=>"Ϋ", ""=>"ά", ""=>"έ", ""=>"ή", ""=>"ί",
|
|
|
21 |
""=>"ΰ", ""=>"α", ""=>"β", ""=>"γ", ""=>"δ", ""=>"ε",
|
|
|
22 |
""=>"ζ", ""=>"η", ""=>"θ", ""=>"ι", ""=>"κ", ""=>"λ",
|
|
|
23 |
""=>"μ", ""=>"ν", ""=>"ξ", ""=>"ο", ""=>"π", ""=>"ρ",
|
|
|
24 |
""=>"ς", ""=>"σ", ""=>"τ", ""=>"υ", ""=>"φ", ""=>"χ",
|
|
|
25 |
""=>"ψ", ""=>"ω", ""=>"ϊ", ""=>"ϋ", ""=>"ό", ""=>"ύ",
|
|
|
26 |
""=>"ώ", "~X"=>"", "~Y"=>"", "~Z"=>"", "~["=>"", "~]"=>""
|
|
|
27 |
);
|
|
|
28 |
|
|
|
29 |
return $k;
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
function init_decoder()
|
|
|
33 |
{
|
|
|
34 |
$k = array(
|
|
|
35 |
""=>"~@", ""=>"~A", ""=>"~B", ""=>"~C", ""=>"~D", "
"=>"~E",
|
|
|
36 |
""=>"~F", ""=>"~G", ""=>"~H", ""=>"~I", ""=>"~J", ""=>"~K",
|
|
|
37 |
""=>"~L", ""=>"~M", ""=>"~N", ""=>"~O", ""=>"~P", ""=>"~Q",
|
|
|
38 |
""=>"~R", ""=>"~S", ""=>"~T", ""=>"~U", ""=>"~V", ""=>"~W",
|
|
|
39 |
""=>"~^", ""=>"~_", " "=>"| ", "ʽ"=>"", "ʼ"=>"", "£"=>"",
|
|
|
40 |
"�"=>"", "�"=>"", "¦"=>"", "§"=>"", "¨"=>"", "©"=>"",
|
|
|
41 |
"�"=>"", "«"=>"", "¬"=>"", ""=>"", "�"=>"", "―"=>"",
|
|
|
42 |
"°"=>"", "±"=>"", "²"=>"", "³"=>"", "΄"=>"", "΅"=>"",
|
|
|
43 |
"Ά"=>"", "·"=>"", "Έ"=>"", "Ή"=>"", "Ί"=>"", "»"=>"",
|
|
|
44 |
"Ό"=>"", "½"=>"", "Ύ"=>"", "Ώ"=>"", "ΐ"=>"", "Α"=>"",
|
|
|
45 |
"Β"=>"", "Γ"=>"", "Δ"=>"", "Ε"=>"", "Ζ"=>"", "Η"=>"",
|
|
|
46 |
"Θ"=>"", "Ι"=>"", "Κ"=>"", "Λ"=>"", "Μ"=>"", "Ν"=>"",
|
|
|
47 |
"Ξ"=>"", "Ο"=>"", "Π"=>"", "Ρ"=>"", "�"=>"", "Σ"=>"",
|
|
|
48 |
"Τ"=>"", "Υ"=>"", "Φ"=>"", "Χ"=>"", "Ψ"=>"", "Ω"=>"",
|
|
|
49 |
"Ϊ"=>"", "Ϋ"=>"", "ά"=>"", "έ"=>"", "ή"=>"", "ί"=>"",
|
|
|
50 |
"ΰ"=>"", "α"=>"", "β"=>"", "γ"=>"", "δ"=>"", "ε"=>"",
|
|
|
51 |
"ζ"=>"", "η"=>"", "θ"=>"", "ι"=>"", "κ"=>"", "λ"=>"",
|
|
|
52 |
"μ"=>"", "ν"=>"", "ξ"=>"", "ο"=>"", "π"=>"", "ρ"=>"",
|
|
|
53 |
"ς"=>"", "σ"=>"", "τ"=>"", "υ"=>"", "φ"=>"", "χ"=>"",
|
|
|
54 |
"ψ"=>"", "ω"=>"", "ϊ"=>"", "ϋ"=>"", "ό"=>"", "ύ"=>"",
|
|
|
55 |
"ώ"=>"", ""=>"~X", ""=>"~Y", ""=>"~Z", ""=>"~[", ""=>"~]"
|
|
|
56 |
);
|
|
|
57 |
|
|
|
58 |
return $k;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
function encode_string($line,$k)
|
|
|
62 |
{
|
|
|
63 |
for($i=0;$i<strlen($line);$i++){
|
|
|
64 |
$c = $line{$i};
|
|
|
65 |
$val = $k["$c"];
|
|
|
66 |
$c = ($val != "") ? "$val" : "$c";
|
|
|
67 |
$new_line .= $c;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
return $new_line;
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
function decode_string($line,$k)
|
|
|
74 |
{
|
|
|
75 |
$line = preg_replace("/&/","&&",$line);
|
|
|
76 |
$line = preg_replace("/([,+0-9.\/() -])/", "%\\1", $line);
|
|
|
77 |
$mline = chunk_split($line, 2, " ");
|
|
|
78 |
$chars = explode(" ", $mline);
|
|
|
79 |
foreach ($chars as $c){
|
|
|
80 |
$val = $k["$c"];
|
|
|
81 |
$c = ($val != "") ? "$val" : "$c";
|
|
|
82 |
$new_line .= $c;
|
|
|
83 |
}
|
|
|
84 |
$new_line = preg_replace("/%%/", " ", $new_line);
|
|
|
85 |
$new_line = preg_replace("/%([,+0-9.\/() -])/", "\\1", $new_line);
|
|
|
86 |
$new_line = preg_replace("/%/", " ",$new_line);
|
|
|
87 |
$new_line = preg_replace("/&&/","&",$new_line);
|
|
|
88 |
|
|
|
89 |
return $new_line;
|
|
|
90 |
}
|
|
|
91 |
?>
|