bug-1208: prepare Name and DoB for highlighting
[cacert-devel.git] / www / ttp.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 } else {
24 require('/usr/share/fpdf/japanese.php');
25 class PDF2 extends PDF_Japanese { }
26 }
27
28 class PDF extends PDF2
29 {
30 function MultiCellBlt($w,$h,$blt,$txt,$border=0,$align='J',$fill=0)
31 {
32 $blt_width = $this->GetStringWidth($blt)+$this->cMargin*2;
33 $bak_x = $this->x;
34 $this->Cell($blt_width,$h,$blt,0,'',$fill);
35 $this->MultiCell($w-$blt_width,$h,$txt,$border,$align,$fill);
36 $this->x = $bak_x;
37 }
38
39 function Header()
40 {
41 $this->Image($_REQUEST['bw']?'images/CAcert-logo-mono-1000.png':'images/CAcert-logo-colour-1000.png',8,8,100);
42 $this->SetFont('Arial','B',14);
43 if($_SESSION['_config']['language'] == "ja")
44 $this->SetFont('SJIS','B',14);
45 $this->Cell(100);
46 $this->Cell(40,20,recode($_SESSION['_config']['recode'], _("Trusted Third Party")));
47 $this->Ln(6);
48 $this->Cell(100);
49 $this->Cell(40,20,recode($_SESSION['_config']['recode'], _("Identity Verification Form")));
50 $this->Ln(10);
51 }
52
53 function Footer()
54 {
55 $this->SetY(-10);
56 $this->SetFont('Arial','I',8);
57 if($_SESSION['_config']['language'] == "ja")
58 $this->SetFont('SJIS','I',8);
59 $this->Cell(0,0,'CAcert Inc. - P.O. Box 4107 - Denistone East NSW 2112 - Australia - http://www.CAcert.org',0,0,'C');
60 $this->SetY(-7);
61 $this->SetFont('Arial','',6);
62 if($_SESSION['_config']['language'] == "ja")
63 $this->SetFont('SJIS','',6);
64 $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');
65 }
66
67 function Body($name = "", $dob = "", $email = "", $date = "")
68 {
69 if($date == "now")
70 $date = date("Y-m-d");
71
72 // Show text blurb at top of page
73 $this->SetY(40);
74 $this->SetFont('Arial','',10);
75 if($_SESSION['_config']['language'] == "ja")
76 $this->SetFont('SJIS','',10);
77 $this->Write(4, recode($_SESSION['_config']['recode'], _("The CAcert Trusted Third Party (TTP) Programme is designed to assure Internet user identities through personal verification of government issued identity documents.")));
78 $this->Ln(7);
79 $this->Write(4, recode($_SESSION['_config']['recode'], _("The Applicant asks you to certify to CAcert that you have met with the Applicant and verified the Full Name, Date of Birth, and ID Numbers of the Applicant against two separate original government issued photo-identity documents. Once the photocopies of the photo IDs have been verified by the TTP they must be signed by the TTP with the statement 'I certify that this copy is a true copy of the original document'. The verified and signed photocopies of IDs are then to be included with the completed TTP forms and returned to CAcert Inc.")));
80 $this->Ln(7);
81 $this->Write(4, recode($_SESSION['_config']['recode'], _("Please complete and sign this form, and sign the photocopies of the IDs, to acknowledge that").":"));
82 $this->Ln(7);
83 $this->MultiCellBlt($this->w - 25, 5, "1", recode($_SESSION['_config']['recode'], _("You have viewed two of the Applicant's photo identity documents and you are convinced of their authenticity, and are convinced that the photos indeed depict the Applicant (allowed documents are government-issued documents with photos such as driver's license, passport, or others that are normally accepted as legal identification in your country; expired documents are allowed).")));
84 $this->Ln(2);
85 $this->MultiCellBlt($this->w - 25, 5, "2", recode($_SESSION['_config']['recode'], _("You have verified that the Full Name, Date of Birth, and ID Numbers on the identity documents matches those filled in the Applicant section below and in the photocopies provided.")));
86 $this->Ln(4);
87 $this->Write(4, sprintf(recode($_SESSION['_config']['recode'], _("If you have ANY doubts or concerns about the identity of the Applicant then please DO NOT COMPLETE AND SIGN this form. For more information about the Web of Trust, including detailed guides for Trusted Third Parties, please see: %s")), "http://www.CAcert.org"));
88 $this->Ln(8);
89 $this->Write(4, recode($_SESSION['_config']['recode'], _("PLEASE NOTE: You must get 2 fully completed TTP forms before sending anything to CAcert. Failure to do so will only cause your application to be delayed until all forms have been received by CAcert!")));
90
91 // TTP Section
92 $top = 160;
93 $this->Rect(11, $top, $this->w - 25, 45, "D");
94 $this->Line(11, $top + 6, $this->w - 14, $top + 6);
95 $this->Line(11, $top + 12, 120, $top + 12);
96 $this->Line(11, $top + 18, 120, $top + 18);
97 $this->Line(11, $top + 24, 120, $top + 24);
98 $this->Line(11, $top + 30, 120, $top + 30);
99 $this->Line(11, $top + 36, $this->w - 14, $top + 36);
100 $this->Line(120, $top + 6, 120, $top + 36);
101 $this->SetXY(11, $top + 3);
102 $this->SetFont("Arial", "BUI", "12");
103 if($_SESSION['_config']['language'] == "ja")
104 $this->SetFont('SJIS','BUI',12);
105 $this->Write(0, recode($_SESSION['_config']['recode'],_("Person Verifying Applicant's Identity")));
106 $this->SetXY(11, $top + 9);
107 $this->SetFont("Arial", "B", "8");
108 if($_SESSION['_config']['language'] == "ja")
109 $this->SetFont('SJIS','B',8);
110 $this->Write(0, recode($_SESSION['_config']['recode'],_("Names").":"));
111 $this->SetXY(120, $top + 9);
112 $this->Write(0, recode($_SESSION['_config']['recode'],_("Office Street Address").":"));
113 $this->SetFont("Arial", "B", "6");
114 if($_SESSION['_config']['language'] == "ja")
115 $this->SetFont('SJIS','B',6);
116 $this->SetXY(11, $top + 14);
117 $this->Write(0, recode($_SESSION['_config']['recode'],_("Profession (Please circle one)")).":");
118 $this->SetXY(11, $top + 16);
119 $this->Write(0, recode($_SESSION['_config']['recode'],_("Justice of the Peace, Public Notary, Lawyer, Accountant, or Bank Manager")));
120 $this->SetXY(11, $top + 20);
121 $this->Write(0, recode($_SESSION['_config']['recode'],_("Bar Association, CPA Number or Bank Name and Branch, JP/Notary Number")).":");
122 $this->SetXY(11, $top + 22);
123 $this->Write(0, recode($_SESSION['_config']['recode'], "("._("as applicable")."):"));
124 $this->SetFont("Arial", "B", "8");
125 if($_SESSION['_config']['language'] == "ja")
126 $this->SetFont('SJIS','B',8);
127 $this->SetXY(11, $top + 27);
128 $this->Write(0, recode($_SESSION['_config']['recode'],_("Office Phone")).":");
129 $this->SetXY(11, $top + 33);
130 $this->Write(0, recode($_SESSION['_config']['recode'],_("Email (if applicable)")).":");
131 $this->SetXY(11, $top + 39);
132 $this->Write(0, recode($_SESSION['_config']['recode'],_("Signature")).":");
133 $this->SetXY(120, $top + 39);
134 $this->Write(0, recode($_SESSION['_config']['recode'],_("Date")).": ");
135 if($date)
136 $this->Write(0, $date);
137
138 // TTP Section
139 $top += 50;
140 $this->Rect(11, $top, $this->w - 25, 45, "D");
141 $this->Line(11, $top + 6, $this->w - 14, $top + 6);
142 $this->Line(11, $top + 12, $this->w - 14, $top + 12);
143 $this->Line(11, $top + 18, $this->w - 14, $top + 18);
144 $this->Line(11, $top + 24, $this->w - 14, $top + 24);
145 $this->Line(11, $top + 30, $this->w - 14, $top + 30);
146 $this->Line(11, $top + 36, $this->w - 14, $top + 36);
147 $this->Line(120, $top + 6, 120, $top + 36);
148 $this->SetXY(11, $top + 3);
149 $this->SetFont("Arial", "BUI", "12");
150 if($_SESSION['_config']['language'] == "ja")
151 $this->SetFont('SJIS','BUI',12);
152 $this->Write(0, recode($_SESSION['_config']['recode'],_("Applicant Information")));
153 $this->SetXY(11, $top + 9);
154 $this->SetFont("Arial", "B", "8");
155 if($_SESSION['_config']['language'] == "ja")
156 $this->SetFont('SJIS','B',8);
157 $this->Write(0, recode($_SESSION['_config']['recode'],_("Full Name (as shown on ID)").":"));
158 if($name)
159 {
160 $this->SetXY(120, $top + 9);
161 $this->Write(0, $name);
162 }
163 $this->SetXY(11, $top + 15);
164 $this->Write(0, recode($_SESSION['_config']['recode'],_("Main email (so we can find you)")).":");
165 if($email)
166 {
167 $this->SetXY(120, $top + 15);
168 $this->Write(0, $email);
169 }
170 $this->SetXY(11, $top + 21);
171 $this->Write(0, recode($_SESSION['_config']['recode'],_("Date of Birth")).": ");
172 $this->SetFont("Arial", "B", "6");
173 if($_SESSION['_config']['language'] == "ja")
174 $this->SetFont('SJIS','B',6);
175 $this->Write(0, "(".recode($_SESSION['_config']['recode'], _("YYYY-MM-DD")).")");
176 $this->SetFont("Arial", "B", "8");
177 if($_SESSION['_config']['language'] == "ja")
178 $this->SetFont('SJIS','B',8);
179 if($dob)
180 {
181 $this->SetXY(120, $top + 21);
182 $this->Write(0, $dob);
183 }
184 $this->SetXY(11, $top + 27);
185 $this->Write(0, recode($_SESSION['_config']['recode'],_("First ID Number (driver's license, passport etc)")).":");
186 $this->SetXY(11, $top + 33);
187 $this->Write(0, recode($_SESSION['_config']['recode'],_("Second ID Number (driver's license, passport etc)")).":");
188 $this->SetXY(11, $top + 39);
189 $this->Write(0, recode($_SESSION['_config']['recode'],_("Signature")).":");
190 $this->SetXY(120, $top + 39);
191 $this->Write(0, recode($_SESSION['_config']['recode'],_("Date")).": ");
192 if($date)
193 $this->Write(0, $date);
194 }
195 }
196
197 $format = $_GET['format'];
198 if($format != "letter")
199 $format = "A4";
200
201 $pdf = new PDF('P', 'mm', $format);
202 if($_SESSION['_config']['language'] == "ja")
203 $pdf->AddSJISFont();
204 $pdf->Open();
205 $pdf->AddPage();
206 $pdf->Body($_GET['name'], $_GET['dob'], $_GET['email'], $_GET['date']);
207 header("Expires: ".gmdate("D, j M Y G:i:s \G\M\T", time()+10800));
208 header("Content-Disposition: attachment; filename=ttp.pdf");
209 header("Cache-Control: public, max-age=10800");
210 header("Pragma: cache");
211 $pdf->output();
212 exit;
213 ?>