Merge branch 'bug-1459' into release (Emergency bugfix)
[cacert-devel.git] / www / cap.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 if($_SESSION['_config']['language'] != "ja")
19 {
20 define('FPDF_FONTPATH','/usr/share/fpdf/font/');
21 require_once('/usr/share/ufpdf/fpdf.php');
22 class PDF2 extends FPDF
23 {
24 }
25 } else {
26 require('/usr/share/fpdf/japanese.php');
27 class PDF2 extends PDF_Japanese
28 {
29 }
30 }
31
32 class PDF extends PDF2
33 {
34 function Header()
35 {
36 $this->Image((array_key_exists('bw',$_REQUEST) && $_REQUEST['bw'])?'images/CAcert-logo-mono-1000.png':'images/CAcert-logo-colour-1000.png',8,8,100);
37 $this->SetFont('Arial','B',14);
38 if($_SESSION['_config']['language'] == "ja")
39 $this->SetFont('SJIS','',14);
40 $this->Cell(100);
41 $this->Cell(40,20,recode($_SESSION['_config']['recode'], _("CAcert Assurance Programme")));
42 $this->Ln(6);
43 $this->Cell(100);
44 $this->Cell(40,20,recode($_SESSION['_config']['recode'], _("Identity Verification Form")));
45 $this->Ln(10);
46
47 $this->SetY(36);
48 $this->SetFont('Arial','I',8);
49 if($_SESSION['_config']['language'] == "ja")
50 $this->SetFont('SJIS','I',8);
51 $this->Cell(0,0,'CAcert Inc. - Hangar 10 Airfield Avenue - Murwillumbah NSW 2484 - Australia - http://www.CAcert.org',0,0,'C');
52 $this->Ln(3);
53 $this->SetFont('Arial','',6);
54 if($_SESSION['_config']['language'] == "ja")
55 $this->SetFont('SJIS','',6);
56 $this->Cell(0,0, recode($_SESSION['_config']['recode'], _("CAcert's Root Certificate fingerprints"). _(" (since 2019)")),0,0,'C');
57 $this->ln(3);
58 $this->Cell(0,0, recode($_SESSION['_config']['recode'], "SHA1: root: DDFC DA54 1E75 77AD DCA8 7E88 27A9 8A50 6032 52A5 "._("and")." class3: A7C4 8FBE 6B02 6DBD 0EC1 B465 B88D D813 EE1D EFA0"),0,0,'C');
59 $this->ln(3);
60 $this->Cell(0,0, recode($_SESSION['_config']['recode'], "SHA256: root: 07ED BD82 4A49 88CF EF42 15DA 20D4 8C2B 41D7 1529 D7C9 00F5 7092 6F27 7CC2 30C5 "._("and")." class3: F687 3D70 D675 96C2 ACBA 3440 1E69 738B 5270 1DD6 AB06 B497 49BC 5515 0936 D544"),0,0,'C');
61 $this->SetLineWidth(0.05); // added 3 points to the abcissa 43 -> 46 to get second line fingerprints
62 $this->Line(1, 46, $this->w - 1, 46);
63 $this->SetLineWidth(0.2);
64 }
65
66 function Footer()
67 {
68 }
69
70 function Body($name = "", $dob = "", $email = "", $assurer = "", $date = "", $maxpoints = "", $document1 = "", $document2 = "", $location = "")
71 {
72 if($date == "now")
73 $date = date("Y-m-d");
74
75 // Show text blurb at top of page
76 $this->SetY(48); // added 3 points to the abcissa 45 -> 48 to get second line fingerprints
77 $this->SetFont('Arial','',10);
78 if($_SESSION['_config']['language'] == "ja")
79 $this->SetFont('SJIS','',10);
80 $this->Write(4,sprintf(recode($_SESSION['_config']['recode'], _("To the Assurer: The CAcert Assurance Programme (CAP) aims to verify the identities of Internet users through face-to-face witnessing of government issued identity documents. The Applicant asks you to verify to CAcert.org that you have met them and verified their identity against one or more original, trusted, government photo identity documents. If you have ANY doubts or concerns about the Applicant's identity, DO NOT COMPLETE OR SIGN this form. For more information about the CAcert Assurance Programme, including detailed guides for CAcert Assurers, please visit: %s")), "http://www.CAcert.org"));
81 $this->Ln(10);
82 $this->Write(4,recode($_SESSION['_config']['recode'], _("As the assurer, you are required to keep the signed document on file for 7 years. Should Cacert Inc. have any concerns about a meeting taking place, Cacert Inc. can request proof, in the form of this signed document, to ensure the process is being followed correctly. After 7 years if you wish to dispose of this form it's preferred that you shred and burn it. You do not need to retain copies of ID at all.")));
83 $this->Ln(10);
84 $this->Write(4,recode($_SESSION['_config']['recode'], _("It's encouraged that you tear the top of this form off and give it to the person you are assuring as a reminder to sign up, and as a side benefit the tear off section also contains a method of offline verification of our fingerprints.")));
85
86 // Assuree Section
87 $top = 120;
88 $this->Rect(11, $top, $this->w - 25, 60, "D"); //50 -> 60
89 $this->SetXY(11, $top + 5);
90 $this->SetFont("Arial", "BUI", "20");
91 if($_SESSION['_config']['language'] == "ja")
92 $this->SetFont('SJIS','BUI',20);
93 $this->Write(0, recode($_SESSION['_config']['recode'], _("Applicant's Statement")));
94 $this->Rect(13, $top + 10, $this->w - 29, 6, "D");
95 $this->Line(80, $top + 10, 80, $top + 16);
96 $this->SetXY(15, $top + 13);
97 $this->SetFont("Arial", "B", "12");
98 if($_SESSION['_config']['language'] == "ja")
99 $this->SetFont('SJIS','B',12);
100 $this->Write(0, recode($_SESSION['_config']['recode'], _("Names")).":");
101 if($name)
102 {
103 $this->SetXY(82, $top + 13);
104 $this->SetFont("Arial", '', "11");
105 if($_SESSION['_config']['language'] == "ja")
106 $this->SetFont('SJIS','',11);
107 $this->Write(0, $name);
108 }
109 $this->Rect(13, $top + 16, $this->w - 29, 6, "D");
110 $this->Line(80, $top + 16, 80, $top + 22);
111 $this->SetXY(15, $top + 19);
112 $this->SetFont("Arial", "B", "12");
113 if($_SESSION['_config']['language'] == "ja")
114 $this->SetFont('SJIS','B',12);
115 $this->Write(0, recode($_SESSION['_config']['recode'], _("Date of Birth")).": ");
116 $this->SetFont("Arial", "", "8");
117 if($_SESSION['_config']['language'] == "ja")
118 $this->SetFont('SJIS','',8);
119 $this->Write(0, "(".recode($_SESSION['_config']['recode'], _("YYYY-MM-DD")).")");
120 if($dob)
121 {
122 $this->SetXY(82, $top + 19);
123 $this->SetFont("Arial", "", "11");
124 if($_SESSION['_config']['language'] == "ja")
125 $this->SetFont('SJIS','',11);
126 $this->Write(0, $dob);
127 }
128 $this->Rect(13, $top + 22, $this->w - 29, 6, "D");
129 $this->Line(80, $top + 22, 80, $top + 28);
130 $this->SetXY(15, $top + 25);
131 $this->SetFont("Arial", "B", "12");
132 if($_SESSION['_config']['language'] == "ja")
133 $this->SetFont('SJIS','B',12);
134 $this->Write(0, recode($_SESSION['_config']['recode'], _("Email Address")).":");
135 if($email)
136 {
137 $this->SetXY(82, $top + 25);
138 $this->SetFont("Arial", "", "11");
139 if($_SESSION['_config']['language'] == "ja")
140 $this->SetFont('SJIS','',11);
141 $this->Write(0, $email);
142 }
143 $this->SetXY(13, $top + 32);
144 $this->SetFont("Arial", "", "9");
145 if($_SESSION['_config']['language'] == "ja")
146 $this->SetFont('SJIS','',9);
147 $this->MultiCell($this->w - 29, 3, recode($_SESSION['_config']['recode'], _("I hereby confirm that the information stated above is both true and correct, and request the CAcert Assurer (identified below) to verify me according to CAcert Assurance Policy.")));
148 // new da start
149 $this->SetXY(13, $top + 42);
150 $this->SetFont("Arial", "", "9");
151 if($_SESSION['_config']['language'] == "ja")
152 $this->SetFont('SJIS','',9);
153 $this->MultiCell($this->w - 29, 3, recode($_SESSION['_config']['recode'], _("I agree to the CAcert Community Agreement.")." ( http://www.cacert.org/policy/CAcertCommunityAgreement.html )"));
154 // new da end
155 $this->SetXY(13, $top + 55); //45->55
156 $this->Write(0, recode($_SESSION['_config']['recode'], _("Applicant's signature")).": __________________________________");
157 $this->SetXY(135, $top + 55);//45->55
158 $this->Write(0, recode($_SESSION['_config']['recode'], _("Date (YYYY-MM-DD)")).": ");
159 if($date == "")
160 {
161 $this->Write(0, "20___-___-___");
162 } else {
163 $this->SetFont("Arial", "U", "10");
164 if($_SESSION['_config']['language'] == "ja")
165 $this->SetFont('SJIS','U',10);
166 $this->Write(0, str_pad($date, 13, " "));
167 }
168
169 // Assurer Section
170 $top += 65; // 55->65
171 $this->Rect(11, $top, $this->w - 25, 83, "D"); //63->93
172 $this->SetXY(11, $top + 5);
173 $this->SetFont("Arial", "BUI", "20");
174 if($_SESSION['_config']['language'] == "ja")
175 $this->SetFont('SJIS','BUI',20);
176 $this->Write(0, recode($_SESSION['_config']['recode'], _("CAcert Assurer")));
177 $this->SetFont("Arial", "", "9");
178 if($_SESSION['_config']['language'] == "ja")
179 $this->SetFont('SJIS','',9);
180 $this->SetXY(13, $top + 15);
181 if($assurer)
182 {
183 $this->Write(0, recode($_SESSION['_config']['recode'], _("Assurer's Name")).": ");
184 $this->SetFont("Arial", "", "10");
185 if($_SESSION['_config']['language'] == "ja")
186 $this->SetFont('SJIS','U',10);
187 // $this->MultiCell($this->w - 70, 2, recode($_SESSION['_config']['recode'], $assurer));
188 $this->Write(0, str_pad($assurer, 50, " "));
189 } else {
190 $this->SetFont("Arial", "U", "10");
191 $this->Write(0, recode($_SESSION['_config']['recode'], _("Assurer's Name")).": ________________________________________________________________");
192 }
193 $this->SetFont("Arial", "", "9");
194 if($_SESSION['_config']['language'] == "ja")
195 $this->SetFont('SJIS','',9);
196 $this->SetXY(13, $top + 22);
197 $this->MultiCell($this->w - 34, 3, recode($_SESSION['_config']['recode'], _("Photo ID Shown: (ID types, not numbers. eg Drivers license, Passport)")));
198 $this->SetXY(13, $top + 30);
199 if($document1 == "")
200 {
201 $this->Write(0, "1. __________________________________________________________________");
202 } else {
203 $this->Write(0, "1. ");
204 $this->SetFont("Arial", "U", "10");
205 if($_SESSION['_config']['language'] == "ja")
206 $this->SetFont('SJIS','U',10);
207 $this->Write(0, str_pad($document1, 90, " "));
208 }
209 $this->SetFont("Arial", "", "9");
210 if($_SESSION['_config']['language'] == "ja")
211 $this->SetFont('SJIS','',9);
212 $this->SetXY(13, $top + 35);
213 if($document2 == "")
214 {
215 $this->Write(0, "2. __________________________________________________________________");
216 } else {
217 $this->Write(0, "2. ");
218 $this->SetFont("Arial", "U", "10");
219 if($_SESSION['_config']['language'] == "ja")
220 $this->SetFont('SJIS','U',10);
221 $this->Write(0, str_pad($document2, 90, " "));
222 }
223 $this->SetFont("Arial", "", "9");
224 if($_SESSION['_config']['language'] == "ja")
225 $this->SetFont('SJIS','',9);
226 $this->SetXY(13, $top + 45);
227 $this->Write(0, recode($_SESSION['_config']['recode'], _("Location of Face-to-face Meeting")).": ");
228 if($location == "")
229 {
230 $this->Write(0, "_____________________________________________");
231 } else {
232 $this->SetFont("Arial", "U", "10");
233 if($_SESSION['_config']['language'] == "ja")
234 $this->SetFont('SJIS','U',10);
235 $this->Write(0, str_pad($location, 70, " "));
236 }
237 $this->SetFont("Arial", "", "9");
238 if($_SESSION['_config']['language'] == "ja")
239 $this->SetFont('SJIS','',9);
240 $this->SetXY(13, $top + 50);
241 if($maxpoints > 0)
242 {
243 $this->Write(0, recode($_SESSION['_config']['recode'], _("Maximum Points")).": ".$maxpoints);
244 } else {
245 $this->Write(0, recode($_SESSION['_config']['recode'], _("Points Allocated")).": ______________");
246 }
247 $this->SetFont("Arial", "", "9");
248 if($_SESSION['_config']['language'] == "ja")
249 $this->SetFont('SJIS','',9);
250 $this->SetXY(13, $top + 54);
251 $this->MultiCell($this->w - 33, 3, recode($_SESSION['_config']['recode'], _("I, the Assurer, hereby confirm that I have verified the Member according to CAcert Assurance Policy.")));
252 $this->SetXY(13, $top + 59);
253 $this->MultiCell($this->w - 33, 3, recode($_SESSION['_config']['recode'], _("I am a CAcert Community Member, have passed the Assurance Challenge, and have been assured with at least 100 Assurance Points.")));
254
255 $this->SetFont("Arial", "", "9");
256 if($_SESSION['_config']['language'] == "ja")
257 $this->SetFont('SJIS','',9);
258 $this->SetXY(13, $top + 74); //22->67
259 $this->Write(0, recode($_SESSION['_config']['recode'], _("Assurer's signature")).": __________________________________");
260 $this->SetXY(135, $top + 74); //22->67
261 $this->Write(0, recode($_SESSION['_config']['recode'], _("Date (YYYY-MM-DD)")).": ");
262 if($date == "")
263 {
264 $this->Write(0, "20___-___-___");
265 } else {
266 $this->SetFont("Arial", "U", "10");
267 if($_SESSION['_config']['language'] == "ja")
268 $this->SetFont('SJIS','U',10);
269 $this->Write(0, str_pad($date, 13, " "));
270 }
271
272 }
273 }
274
275 $format = array_key_exists('format',$_REQUEST)?$_REQUEST['format']:"";
276 if($format != "letter")
277 $format = "A4";
278
279 $maxpoints = array_key_exists('maxpoints',$_REQUEST)?intval($_GET['maxpoints']):0;
280 if($maxpoints < 0)
281 $maxpoints = 0;
282
283 $pdf = new PDF('P', 'mm', $format);
284 if($_SESSION['_config']['language'] == "ja")
285 $pdf->AddSJISFont();
286 $pdf->Open();
287 $pdf->AddPage();
288 $pdf->Body(array_key_exists('name',$_REQUEST)?$_REQUEST['name']:"", array_key_exists('dob',$_REQUEST)?$_REQUEST['dob']:"", array_key_exists('email',$_REQUEST)?$_REQUEST['email']:"", array_key_exists('assurer',$_REQUEST)?$_REQUEST['assurer']:"", array_key_exists('date',$_REQUEST)?$_REQUEST['date']:"", $maxpoints, array_key_exists('document1',$_REQUEST)?$_REQUEST['document1']:"", array_key_exists('document2',$_REQUEST)?$_REQUEST['document2']:"", array_key_exists('location',$_REQUEST)?$_REQUEST['location']:"");
289 header("Expires: ".gmdate("D, j M Y G:i:s \G\M\T", time()+10800));
290 header("Content-Disposition: attachment; filename=cap.pdf");
291 header("Cache-Control: public, max-age=10800");
292 header("Pragma: cache");
293 $pdf->output();
294 exit;
295 ?>