PluginProbe
Welcart e-Commerce / 1.3.4
Welcart e-Commerce v1.3.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
usc-e-shop / classes / fpdf / decoders / ASCII85Decode.php

ASCII85Decode.php in Welcart e-Commerce 1.3.4, at classes/fpdf/decoders/ASCII85Decode.php

97 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 //
3 // FPDI - Version 1.2
4 //
5 // Copyright 2004-2007 Setasign - Jan Slabon
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 if (!defined("ORD_z"))
21 define("ORD_z",ord('z'));
22 if (!defined("ORD_exclmark"))
23 define("ORD_exclmark", ord('!'));
24 if (!defined("ORD_u"))
25 define("ORD_u", ord("u"));
26 if (!defined("ORD_tilde"))
27 define("ORD_tilde", ord('~'));
28
29 class ASCII85Decode {
30
31 function ASCII85Decode(&$fpdi) {
32 $this->fpdi =& $fpdi;
33 }
34
35
36 function decode($in) {
37 $out = "";
38 $state = 0;
39 $chn = null;
40
41 $l = strlen($in);
42
43 for ($k = 0; $k < $l; ++$k) {
44 $ch = ord($in[$k]) & 0xff;
45
46 if ($ch == ORD_tilde) {
47 break;
48 }
49 if (preg_match("/^\s$/",chr($ch))) {
50 continue;
51 }
52 if ($ch == ORD_z && $state == 0) {
53 $out .= chr(0).chr(0).chr(0).chr(0);
54 continue;
55 }
56 if ($ch < ORD_exclmark || $ch > ORD_u) {
57 $this->fpdi->error("Illegal character in ASCII85Decode.");
58 }
59
60 $chn[$state++] = $ch - ORD_exclmark;
61
62 if ($state == 5) {
63 $state = 0;
64 $r = 0;
65 for ($j = 0; $j < 5; ++$j)
66 $r = $r * 85 + $chn[$j];
67 $out .= chr($r >> 24);
68 $out .= chr($r >> 16);
69 $out .= chr($r >> 8);
70 $out .= chr($r);
71 }
72 }
73 $r = 0;
74
75 if ($state == 1)
76 $this->fpdi->error("Illegal length in ASCII85Decode.");
77 if ($state == 2) {
78 $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85;
79 $out .= chr($r >> 24);
80 }
81 else if ($state == 3) {
82 $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85;
83 $out .= chr($r >> 24);
84 $out .= chr($r >> 16);
85 }
86 else if ($state == 4) {
87 $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ;
88 $out .= chr($r >> 24);
89 $out .= chr($r >> 16);
90 $out .= chr($r >> 8);
91 }
92
93 return $out;
94 }
95 }
96
97 ?>