Merge branch 'bug-28' into release
[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. - PO Box 66 - Oatley NSW 2223 - 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")).": A6:1B:37:5E:39:0D:9C:36:54:EE:BD:20:31:46:1F:6B "._("and")." 135C EC36 F49C B8E9 3B1A B270 CD80 8846 76CE 8F33",0,0,'C');
57 $this->SetLineWidth(0.05);
58 $this->Line(1, 43, $this->w - 1, 43);
59 $this->SetLineWidth(0.2);
60 }
61
62 function Footer()
63 {
64 }
65
66 function Body($name = "", $dob = "", $email = "", $assurer = "", $date = "", $maxpoints = "", $document1 = "", $document2 = "", $location = "")
67 {
68 if($date == "now")
69 $date = date("Y-m-d");
70
71 // Show text blurb at top of page
72 $this->SetY(45);
73 $this->SetFont('Arial','',10);
74 if($_SESSION['_config']['language'] == "ja")
75 $this->SetFont('SJIS','',10);
76 $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"));
77 $this->Ln(10);
78 $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.")));
79 $this->Ln(10);
80 $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.")));
81
82 // Assuree Section
83 $top = 120;
84 $this->Rect(11, $top, $this->w - 25, 60, "D"); //50 -> 60
85 $this->SetXY(11, $top + 5);
86 $this->SetFont("Arial", "BUI", "20");
87 if($_SESSION['_config']['language'] == "ja")
88 $this->SetFont('SJIS','BUI',20);
89 $this->Write(0, recode($_SESSION['_config']['recode'], _("Applicant's Statement")));
90 $this->Rect(13, $top + 10, $this->w - 29, 6, "D");
91 $this->Line(80, $top + 10, 80, $top + 16);
92 $this->SetXY(15, $top + 13);
93 $this->SetFont("Arial", "B", "12");
94 if($_SESSION['_config']['language'] == "ja")
95 $this->SetFont('SJIS','B',12);
96 $this->Write(0, recode($_SESSION['_config']['recode'], _("Names")).":");
97 if($name)
98 {
99 $this->SetXY(82, $top + 13);
100 $this->SetFont("Arial", '', "11");
101 if($_SESSION['_config']['language'] == "ja")
102 $this->SetFont('SJIS','',11);
103 $this->Write(0, $name);
104 }
105 $this->Rect(13, $top + 16, $this->w - 29, 6, "D");
106 $this->Line(80, $top + 16, 80, $top + 22);
107 $this->SetXY(15, $top + 19);
108 $this->SetFont("Arial", "B", "12");
109 if($_SESSION['_config']['language'] == "ja")
110 $this->SetFont('SJIS','B',12);
111 $this->Write(0, recode($_SESSION['_config']['recode'], _("Date of Birth")).": ");
112 $this->SetFont("Arial", "", "8");
113 if($_SESSION['_config']['language'] == "ja")
114 $this->SetFont('SJIS','',8);
115 $this->Write(0, "(".recode($_SESSION['_config']['recode'], _("YYYY-MM-DD")).")");
116 if($dob)
117 {
118 $this->SetXY(82, $top + 19);
119 $this->SetFont("Arial", "", "11");
120 if($_SESSION['_config']['language'] == "ja")
121 $this->SetFont('SJIS','',11);
122 $this->Write(0, $dob);
123 }
124 $this->Rect(13, $top + 22, $this->w - 29, 6, "D");
125 $this->Line(80, $top + 22, 80, $top + 28);
126 $this->SetXY(15, $top + 25);
127 $this->SetFont("Arial", "B", "12");
128 if($_SESSION['_config']['language'] == "ja")
129 $this->SetFont('SJIS','B',12);
130 $this->Write(0, recode($_SESSION['_config']['recode'], _("Email Address")).":");
131 if($email)
132 {
133 $this->SetXY(82, $top + 25);
134 $this->SetFont("Arial", "", "11");
135 if($_SESSION['_config']['language'] == "ja")
136 $this->SetFont('SJIS','',11);
137 $this->Write(0, $email);
138 }
139 $this->SetXY(13, $top + 32);
140 $this->SetFont("Arial", "", "9");
141 if($_SESSION['_config']['language'] == "ja")
142 $this->SetFont('SJIS','',9);
143 $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.")));
144 // new da start
145 $this->SetXY(13, $top + 42);
146 $this->SetFont("Arial", "", "9");
147 if($_SESSION['_config']['language'] == "ja")
148 $this->SetFont('SJIS','',9);
149 $this->MultiCell($this->w - 29, 3, recode($_SESSION['_config']['recode'], _("I agree to the CAcert Community Agreement.")." ( http://www.cacert.org/policy/CAcertCommunityAgreement.php )"));
150 // new da end
151 $this->SetXY(13, $top + 55); //45->55
152 $this->Write(0, recode($_SESSION['_config']['recode'], _("Applicant's signature")).": __________________________________");
153 $this->SetXY(135, $top + 55);//45->55
154 $this->Write(0, recode($_SESSION['_config']['recode'], _("Date (YYYY-MM-DD)")).": ");
155 if($date == "")
156 {
157 $this->Write(0, "20___-___-___");
158 } else {
159 $this->SetFont("Arial", "U", "10");
160 if($_SESSION['_config']['language'] == "ja")
161 $this->SetFont('SJIS','U',10);
162 $this->Write(0, str_pad($date, 13, " "));
163 }
164
165 // Assurer Section
166 $top += 65; // 55->65
167 $this->Rect(11, $top, $this->w - 25, 83, "D"); //63->93
168 $this->SetXY(11, $top + 5);
169 $this->SetFont("Arial", "BUI", "20");
170 if($_SESSION['_config']['language'] == "ja")
171 $this->SetFont('SJIS','BUI',20);
172 $this->Write(0, recode($_SESSION['_config']['recode'], _("CAcert Assurer")));
173 $this->SetFont("Arial", "", "9");
174 if($_SESSION['_config']['language'] == "ja")
175 $this->SetFont('SJIS','',9);
176 $this->SetXY(13, $top + 15);
177 if($assurer)
178 {
179 $this->Write(0, recode($_SESSION['_config']['recode'], _("Assurer's Name")).": ");
180 $this->SetFont("Arial", "", "10");
181 if($_SESSION['_config']['language'] == "ja")
182 $this->SetFont('SJIS','U',10);
183 // $this->MultiCell($this->w - 70, 2, recode($_SESSION['_config']['recode'], $assurer));
184 $this->Write(0, str_pad($assurer, 50, " "));
185 } else {
186 $this->SetFont("Arial", "U", "10");
187 $this->Write(0, recode($_SESSION['_config']['recode'], _("Assurer's Name")).": ________________________________________________________________");
188 }
189 $this->SetFont("Arial", "", "9");
190 if($_SESSION['_config']['language'] == "ja")
191 $this->SetFont('SJIS','',9);
192 $this->SetXY(13, $top + 22);
193 $this->MultiCell($this->w - 34, 3, recode($_SESSION['_config']['recode'], _("Photo ID Shown: (ID types, not numbers. eg Drivers license, Passport)")));
194 $this->SetXY(13, $top + 30);
195 if($document1 == "")
196 {
197 $this->Write(0, "1. __________________________________________________________________");
198 } else {
199 $this->Write(0, "1. ");
200 $this->SetFont("Arial", "U", "10");
201 if($_SESSION['_config']['language'] == "ja")
202 $this->SetFont('SJIS','U',10);
203 $this->Write(0, str_pad($document1, 90, " "));
204 }
205 $this->SetFont("Arial", "", "9");
206 if($_SESSION['_config']['language'] == "ja")
207 $this->SetFont('SJIS','',9);
208 $this->SetXY(13, $top + 35);
209 if($document2 == "")
210 {
211 $this->Write(0, "2. __________________________________________________________________");
212 } else {
213 $this->Write(0, "2. ");
214 $this->SetFont("Arial", "U", "10");
215 if($_SESSION['_config']['language'] == "ja")
216 $this->SetFont('SJIS','U',10);
217 $this->Write(0, str_pad($document2, 90, " "));
218 }
219 $this->SetFont("Arial", "", "9");
220 if($_SESSION['_config']['language'] == "ja")
221 $this->SetFont('SJIS','',9);
222 $this->SetXY(13, $top + 45);
223 $this->Write(0, recode($_SESSION['_config']['recode'], _("Location of Face-to-face Meeting")).": ");
224 if($location == "")
225 {
226 $this->Write(0, "_____________________________________________");
227 } else {
228 $this->SetFont("Arial", "U", "10");
229 if($_SESSION['_config']['language'] == "ja")
230 $this->SetFont('SJIS','U',10);
231 $this->Write(0, str_pad($location, 70, " "));
232 }
233 $this->SetFont("Arial", "", "9");
234 if($_SESSION['_config']['language'] == "ja")
235 $this->SetFont('SJIS','',9);
236 $this->SetXY(13, $top + 50);
237 if($maxpoints > 0)
238 {
239 $this->Write(0, recode($_SESSION['_config']['recode'], _("Maximum Points")).": ".$maxpoints);
240 } else {
241 $this->Write(0, recode($_SESSION['_config']['recode'], _("Points Allocated")).": ______________");
242 }
243 $this->SetFont("Arial", "", "9");
244 if($_SESSION['_config']['language'] == "ja")
245 $this->SetFont('SJIS','',9);
246 $this->SetXY(13, $top + 54);
247 $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.")));
248 $this->SetXY(13, $top + 59);
249 $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.")));
250
251 $this->SetFont("Arial", "", "9");
252 if($_SESSION['_config']['language'] == "ja")
253 $this->SetFont('SJIS','',9);
254 $this->SetXY(13, $top + 74); //22->67
255 $this->Write(0, recode($_SESSION['_config']['recode'], _("Assurer's signature")).": __________________________________");
256 $this->SetXY(135, $top + 74); //22->67
257 $this->Write(0, recode($_SESSION['_config']['recode'], _("Date (YYYY-MM-DD)")).": ");
258 if($date == "")
259 {
260 $this->Write(0, "20___-___-___");
261 } else {
262 $this->SetFont("Arial", "U", "10");
263 if($_SESSION['_config']['language'] == "ja")
264 $this->SetFont('SJIS','U',10);
265 $this->Write(0, str_pad($date, 13, " "));
266 }
267
268 }
269 }
270
271 $format = array_key_exists('format',$_REQUEST)?$_REQUEST['format']:"";
272 if($format != "letter")
273 $format = "A4";
274
275 $maxpoints = array_key_exists('maxpoints',$_REQUEST)?intval($_GET['maxpoints']):0;
276 if($maxpoints < 0)
277 $maxpoints = 0;
278
279 $pdf = new PDF('P', 'mm', $format);
280 if($_SESSION['_config']['language'] == "ja")
281 $pdf->AddSJISFont();
282 $pdf->Open();
283 $pdf->AddPage();
284 $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']:"");
285 header("Expires: ".gmdate("D, j M Y G:i:s \G\M\T", time()+10800));
286 header("Content-Disposition: attachment; filename=cap.pdf");
287 header("Cache-Control: public, max-age=10800");
288 header("Pragma: cache");
289 $pdf->output();
290 exit;
291 ?>