3 LibreSSL - CAcert web application
4 Copyright (C) 2004-2008 CAcert Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 // $Id: coapnew.php,v 1.4 2012-01-24 14:26:05 root Exp $
21 define('REV', '$Revision: 1.4 $');
24 ** Created from old cap.php 2003, which used the now obsoleted ftpdf package
25 ** First created: 12 July 2008
26 ** Last change: see Revision date
28 ** printed text by Ian Grigg and Teus Hagen (July 2008)
29 ** layout/design by Teus Hagen and Johan Vromans (July 2008)
30 ** coding by Teus Hagen and ...
34 ** recode_string(), zcompress() (PHP-ZLIB) only used if present
35 ** zcompress (pdf compression) gives performance loss, disable it?
36 ** PDF generation package (tcpdf/tcpdf.php):
37 ** TCPDF package + define the TCPDF_DIR install directory (GPL)
38 ** tcpdf package is patched for text subtypes see tcpdf diff file.
39 ** Add free embedding zapfdingbat font
40 ** ttf2pt1 -F zapfdinbats.ttf -> zapfdingbats.utf metrics file
41 ** php -q makefont.php zapfsdingbats.ttf zapfdingbats.utf -> .php,.ctg.z,.z
42 ** install files: zapfdingbats.{php,z,ctg.z} in tcpdf/fonts dir
43 ** UTF8 package for unicode (utf8/native/core.php):
44 ** utf8_substr() only when package is found and needs to be used
45 ** transliteration (and abbreviation):
46 ** if full name has non-ascii char(s) try to use: utf8_to_ascii()
47 ** First from transtab.php package which is Markus Kuhn compliant
48 ** transtab.php is CAcert php package.
49 ** Transtab depends on on its turn on UTF8 package.
50 ** Secondly if not found utf8ascii lib tried (artistic license)
51 ** http://sourceforge.net/projects/phputf8
52 ** .../utf8_to_ascii-0.3.tar.gz
53 ** see UTF8_ASCII definition for location requirements
54 ** Thirdly: if not found transliteration feature is disabled.
56 ** policy documents for pdf inclusion:
57 ** define CCA file (default policy)
58 ** LOGO: CAcert logo logos directory is LOGO
61 ** Test: use environment variable settings as parameters for
62 ** Organisation: name, dba's, director, sign date, trade license ID
63 ** address, country/state jurisdiction, domain(s)
64 ** o-admins: name, email, phone
65 ** Registry: name, region
66 ** Assurer: name, email, sign date
68 ** Form fields: javascript form fields with fields for printout and change
69 ** Printout: printed, and completed for final signatures
70 ** On transliteration and abbreviation of a name:
71 ** if shoes a std way show accepted conversion as pdf comment
72 ** Orientation: on landscape (dflt) print 2-up
73 ** PDF URL links are used to web, wiki, and faq for more info search
74 ** Only on non-ascii chars in a name the utf8 routines are loaded
75 ** PDF reader has wiki info url's and easy email feedback
77 ** included is the CCA generates 2 extra pages (needs work to limit vert spacing)
79 ** For other re-use of some routines:
80 ** abbreviate() abbreviate a name on std way
81 ** transliterate() provide name in translated format in std way
84 ** environment settings (FORM, FORMAT, CCA, ...) define used test data
85 ** In test modus variable path_url from tcpdf package unset warnings
86 ** Set for operation modus TEST on false (or comment code out)
89 ** digitally sign form and process it via network
91 ** unicode and UTF-8 support:
92 ** php4/5 recode() is alias of recode_string() of PHP library
93 ** If not provided: should check every string is transcoded?
94 ** recode(), recode_string(0 is said to have too many (japanese) defeats
95 ** recode_string() is only used on GET[] input (html->utf-8),
96 ** UTF-8 use routines from http://www.sourceforge.net/projects/phputf8
97 ** which replaces php recode() package.
98 ** on many places own utf-8 handling code exists and is loaded (tcpdf problem)
99 ** _() translation routine. The returned HTML string is translated to utf-8 string.
100 ** the GET() routines expects utf-8 code (see test defs) but might be changed
101 ** to use html entity conversion routine of PHP (5.2 has a problem...).
103 ** PDF compression zlib: (now disabled)
104 ** if PHP lib zcompress() is present, generated PDF is compressed
106 ** FONTS future use ? http://www.slovo.info/unifonts.htm? (not used now)
107 ** or Bitstream Cyberbit http://www.orwell.ru/download/cyberbit.zip
108 ** Latter font is no longer for free download
109 ** For now: FreeVeraSans is used now and embedded (std in TCPDF package)
110 ** Zapf Dingbats font: some Open Source readers have bad font handling or
111 ** no zapfdingbat font. So one is embedded
112 ** To be generated with tooling in util directory.
114 ** TO DO, to CHECK and KNOWN PROBLEMS:
115 ** _() translation routine returns recoded and checks UTF-8 chars?
116 ** Japanse package (maybe not needed with TCPDF?)
117 ** CCA informal should be on one page (no CCA printed yet)
118 ** form field checks, print button (Java script)
119 ** data structs in Java script and globalize property settings
121 ** timestamping, signatures and certificate usage
122 ** list of recipients, encrypt the document and send it off
123 ** On Acrobat 7.0: first form field call error (have work around)
124 ** eps problem with logo (no eps logo yet)
125 ** multi selection of ID types in form fields (value editable now)
126 ** ugly capital char use in intro to bold or italic lowercase
127 ** tables over page boundaries do not fully work yet
130 ** This PDF GENERATION package relies on the PHP PDF generation
131 ** package of TCPDF source force project:
132 ** http://sourceforge.net/projects/tcpdf/ V 4.0.007 18th July 2008
133 ** The tcpdf software supports encryption, signatures, and form fields
134 ** TCPDF is using URF-8 code (good!)
135 ** The TRANSLITERATE code tables db (utf8ascii) is not compliant (!?) with
136 ** Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> -- 2001-09-02
137 ** First is tried to use Markus his tables
138 ** For a test file with all chars see there (it is also in tcpdf package).
139 ** Both transliteration packages rely on UTF-8 code, only loaded when available and
140 ** when really needed.
141 ** PDF generation: The alternative is the one from the std PHP library.
144 ** PHP libs: packages seems to download files on the fly into local filesystem!!!
146 ** All sizes (in mm) is related to A5 base, so other page formats are scaled.
149 ** $_GET['date'] date of assurance and signature applicant organisation
150 ** $_GET['name'] full name assuree default empty for upward compatibility
151 ** $_GET['dba<1-9>'] etc. %d = 1-9 trade names
152 ** $_GET['address'] postal address department, office, street, zip, city
153 ** $_GET['state'] jurisdiction
154 ** $_GET['country'] jurisdiction address
155 ** $_GET['type'] type of organisation: e.g. foundation, partnership, Lmtd
156 ** $_GET['domain<0..n>'] domain names of organisation
157 ** $_GET['director'] can sign for the organisation
158 ** $_GET['email'] email address for organisation contact
159 ** $_GET['phone'] organisation phone number for contact
160 ** $_GET['admin'] o-admin name
161 ** $_GET['adminemail'] o-admin emailo address
162 ** $_GET['adminphone'] o-admin phone number
163 ** $_GET['admin<1-9>'] o-admin name
164 ** $_GET['admin<1-9>email'] o-admin emailo address
165 ** $_GET['admin<1-9>phone'] o-admin phone number
166 ** $_GET['identity'] trade office license Identification number
167 ** $_GET['tor'] trade office name
168 //** $_GET['tordate'] trade office extract date (depreciated)
169 ** $_GET['torregion'] trade office region (depreciated)
170 ** $_GET['assurer'] full name assurer default empty
171 ** $_GET['assureremail'] email address assurer default empty (new)
172 ** $_GET['assurerdate'] date of signature assurer (new)
173 ** $_GET['assurerphone'] contact phone number of assurer (new)
174 //** $_GET['assurancedate'] date of assurance (new) (depreciated)
175 //** $_GET['location'] location of assurance (depreciated)
176 ** $_GET['nocca'] do not print CCA on back side (dflt: false)
177 ** $_GET['policy<%d>'] to include policy document(s) in pdf file %d = 1-9 (new)
178 ** $_GET['noform'] do not print form (dflt: true) (new)
179 ** $_GET['format'] paper format required A0-A6,Letter, Folio, B0-B6 (dflt A4)
180 ** $_GET['watermark'] watermark on the page
181 ** $_GET['orientation'] paper orientation default "landscape" default 2-up (new)
182 ** $_SESSION['_config']['language'] for "ja" japanese default != ja
183 ** $_SESSION['_config']['recode'] = "format" recode() uses it: needed ?
184 ** recode() is aliased to php lib function recode_string()
185 ** $_REQUEST[bw] if exists use black/white, default use colour
187 ** Output, package generates:
188 ** PDF display screen is scaled to 100% A4 size
189 ** PDF property fields have CAcert info
190 ** on non empty _GET strings, the package generates prefilled form fields.
191 ** PDF form field variables (Java Script):
193 ** Organisation.Names[0] organisation name
194 ** Organisation.Address street address, zip, city
195 ** Organisation.Type comma separated values (csv)
196 ** type of organisation
199 ** Organisation.DBA registered trade names (csv)
200 ** Organisation.Domains organisation domain names (csv)
201 ** Organisation.Director.Name name of director with signing power
202 ** Organisation.Director.Email corporate email address
203 ** Organisation.Director.Phone corporate phone number
204 ** Organisation.Date date of signature director
205 ** Organisation.Admin[].Name 0..9 name of org. admnin
206 ** Organisation.Admin[].Email 0..9 o-admin email address
207 ** Organisation.Admin[].Phone 0..9 o-admin phone number
208 ** Trade Office Registry
209 ** tor.info comma separated values (csv):
210 ** unique trade office Identification number
211 ** name trade office registry
212 ** region trade office (depreciated)
213 ** date of trade office Extract (depreciated)
215 ** Assurer.Name full name of assurer
216 ** Assurer.Email email address assurer
217 ** Assurer.Date date signature assurer
218 //** Assurance info (depreciated)
219 //** assurance.location string may have date of meeting (depreciated)
220 //** assurance.date date of assurance (depreciated)
221 ** Form Revision string is generated from RCS revision string.
222 ** More info on PDF fields:
223 ** http://www.adobe.com/devnet/acrobat/pdfs/js_developer_guide.pdf
227 // use next define if you test this code
228 define( 'TEST', true
);
230 // INSTALLATION DIRS OF PACKAGES ==============================
231 // make sure packages are installed here
233 define('TCPDF_DIR','/usr/share/tcpdf_php4');
234 define('UTF8',RT
."/utf8/native/core.php");
235 if( file_exists(RT
.'/transtab.php') ) // wherever it is
236 define('UTF8_ASCII', RT
.'/transtab.php');
238 define('UTF8_ASCII', RT
.'/utf8_to_ascii/utf8_to_ascii.php'); // optional
239 // end operational special code defs
241 if( defined( 'TEST' ) ) {
242 // ONLY FOR TEST PURPOSES =====================================
245 $_SESSION['_config']['recode'] = "html..utf-8"; // ????
246 if( isset($_SERVER['LANG']) )
247 $_SESSION['_config']['language'] = $_SERVER['LANG'];
249 if( array_key_exists('FORMAT',$_SERVER) AND $_SERVER['FORMAT'] )
250 $_GET['format'] = $_SERVER['FORMAT'];
252 //$_GET['format'] = "A5"; // margin scale problem... does not work
253 //$_GET['format'] = "Legal"; // ok
254 //$_GET['format'] = "Folio"; // ok
255 //$_GET['format'] = "Letter"; // letter little margin problem
256 //$_GET['format'] = "A4"; // A4, default ok
258 if( array_key_exists('ORIENTATION',$_SERVER) AND $_SERVER['ORIENTATION'] )
259 $_GET['orientation'] = $_SERVER['ORIENTATION'];
261 //$_GET['orientation'] = "portrait"; // default 2 pages, or portrait
263 $_GET['nocca'] = isset($_SERVER['CCA']) ?
$_SERVER['CCA'] : "";
264 if( isset($_SERVER['FORM']) AND $_SERVER['FORM'] == "noform" )
265 $_GET['noform'] = "true";
267 if( array_key_exists('FORM',$_SERVER) AND $_SERVER['FORM'] != 'empty' ){
268 // organisation info part
269 $_GET['name'] = "Stichting Oophaga foundation";
270 $_GET['address'] = "De Burgerstraat 25, office 268, 1098 SJ, Amsterdam-Buitenveldert";
272 $_GET['country'] = "Netherlands";
273 $_GET['type'] = "foundation";
274 $_GET['dba1'] = "Oophaga"; // trade names
275 //$_GET['DBA2..9'] = "St. Oophaga";
276 // applicant signer for organisation
277 $_GET['director'] = "Gerard H. M. Sühmple"; // upwards competable
278 //$_GET['email'] = "director@oophaga.org";
279 $_GET['phone'] = "+31 773270066";
280 $_GET['date'] = "2008-08-18"; // upwards compatible
281 // trade office information
282 $_GET['identifier'] = "NL-238603-AA02";
283 $_GET['tor'] = "Kamer van Koophandel";
284 $_GET['torregion'] = "Amsterdam";
285 //$_GET['tordate'] = "2008-04-03";
287 $_GET['domain1'] = "oophaga.org, oophaga.nl";
288 $_GET['domain2'] = "oophaga.net";
289 $_GET['domain4'] = "oophaga.eu";
290 $_GET['admin'] = "Görge H. M. Sämple"; // upwards competable
291 $_GET['adminemail'] = "tesu.hagaen@thesu.xs4all.eu";
292 $_GET['adminphone'] = "+31 77 327996";
293 //$_GET['admin2..9XX'] = ""; // name, email, phone
295 $_GET['assurer'] = "My O. Assurer-Name";
296 $_GET['assurerdate'] = "now";
297 $_GET['assureremail'] = "Assurer@cacert.org";
298 $_GET['assurerphone'] = "+31737201060";
300 //$_GET['assurancedate'] = "2008-12-21"; depreciated
301 //$_GET['location'] = "Amsterdam, Holland"; depreciated
302 //$_GET['notes'] = "bla bla"; depreciated
304 $_GET['watermark'] = "just an EXAMPLE";
306 //$_GET['ALL'] = "empty";
309 //$_REQUEST['bw'] = true;
311 } // end of TEST code ===========================================================
313 /* Directory settings for installation */
314 // change next for directory settings for packages !!!!!!!!!!!!!!!!!!!!!!
315 // set to correct internal path to TCPDF pakage installation
316 // Make sure pdf generation package is not connecting internet for
317 // whatever reason and downloading files into this host!!!!
318 // UCPDF as well PHP PDF std package have unsecure code as well....
319 require_once(TCPDF_DIR
. '/config/lang/eng.php');
320 require_once(TCPDF_DIR
. '/tcpdf.php');
322 // CAcert logo path/file name is extended with eg color, mono and format type
323 define( 'LOGO','logos/CAcert-logo-');
324 // eps should give better quality, LOGO_TYPE -> .eps
325 // eps does not work with CAcert logo, set to .eps when ok
326 define( 'LOGO_DPI', '1000');
327 define( 'LOGO_TYPE','-'.LOGO_DPI
.'.png');
328 // logo colors RGB hex
329 define('BLUE', '#11568C'); // RGB 17 86 140
330 define('LBLUE', '#ADC5D7'); // RGB 112 154 186
331 define('LLBLUE','#D6E2EB'); // lighhter blue RGB 173 197 215
332 define('LIME', '#C7FF00'); // RGB 199 255 0
333 define('GREEN', '#00BE00'); // 0 190 0
335 define('POBOX','CAcert Inc. - P.O. Box 4107 - Denistone East NSW 2112 - Australia');
336 define('WEB', 'http://www.cacert.org');
337 define('WIKI','http://wiki.cacert.org/wiki');
338 define('ROOTKEYS','http://www.cacert.org/index.php?id=3');
339 define('ASSCOAP', WIKI
.'/FAQ/AssuranceByCAP');
340 define('ASSHBK', WIKI
.'/OrganisationAssuranceManual');
341 define('ASSINFO', WIKI
.'/OrganisationEntities');
342 define('ASSINTRO', WIKI
.'/FAQ/AssuranceIntroduction');
343 define('ASSORG', WIKI
."/OrganisationAssurance");
344 define('ARBIT', WIKI
."/ArbitrationForum");
345 // CAcert Community Agreement
346 define('CCA', "CAcertCommunityAgreement"); // default policy to print
347 define('POLICY','policy/'); // default polciy doc directory
348 define('EXT','.php'); // default polciy doc extention, should be html
349 /* finger print CAcert Root Key */ // should obtain this automatically
350 define('CLASS1_SHA1','135C EC36 F49C B8E9 3B1A B270 CD80 8846 76CE 8F33');
351 define('CLASS3_SHA1','AD7C 3F64 FC44 39FE F4E9 0BE8 F47C 6CFA 8AAD FDCE');
352 // next two are not used on the form
353 define('CLASS1_MD5','A6:1B:37:5E:39:0D:9C:36:54:EE:BD:20:31:46:1F:6B');
354 define('CLASS3_MD5','F7:25:12:82:4E:67:B5:D0:8D:92:B7:7C:0B:86:7A:42');
355 // if on draft provide std message
356 define('WATERMARK',"");
358 // other definitions for the form
359 define("MAX_COLS", 2); // max coulumns per page Landscape is printed with 2-up
360 // put next to 200 and it will disable printout
361 define("MINH", 107.5); // in A5 mm is current estimated left over space on one page
362 define("H", 5); // height of a name entry field
364 define("MARGIN",11.296); // 2-up will be scaled
366 define( 'F_SIZE', 7 );
368 define('DFL_FORMAT', 'html..utf-8');
370 // enviroment dependent constants
371 // Japanese is not supported?
372 if( array_key_exists('_config', $_SESSION) ) {
373 if( isset($_SESSION['_config']['language']) ) {
374 if($_SESSION['_config']['language'] == "ja")
375 define('FONT','SJIS');
376 else define( 'FONT', 'freesans');
378 else define( 'FONT', 'freesans');
381 //define( 'FONT', 'dejavusans');
382 define( 'FONT', 'freesans');
384 // generate black/white?
385 if(array_key_exists('bw',$_REQUEST))
390 // function is left in tact, but to new tcpdf code UFT-8 is fully supported now.
391 function my_recode($strg = NULL
)
393 static $format = NULL
;
394 if( $strg == NULL
OR !$strg ) return ( "" );
395 if( $format == NULL
) {
396 if( array_key_exists('_config', $_SESSION) ) {
397 if( isset( $_SESSION['_config']['recode']) )
398 $format = $_SESSION['_config']['recode'];
399 else $format = DFL_FORMAT
;
401 else $format = DFL_FORMAT
;
403 // newer tcpdf package is full UTF-8 Voided by this package?
404 if( function_exists("recode_string" ) )
405 return ( recode_string($format, $strg) );
406 else return( $strg );
409 // return TRUE if string is ascii and not device control chars specialized for
410 // personal names (no device controls)
411 function utf8_is_ascii_ctrl($str) {
412 if ( strlen($str) > 0 ) {
413 // Search for any bytes which are outside the ASCII range,
414 // or are device control codes
415 //return (preg_match('/[^\x09\x0A\x0D\x20-\x7E]/',$str) !== 1); deleted \r and \n
416 return (preg_match('/[^\x09\x20-\x7E]/',$str) !== 1);
422 // extend TCPF with custom functions
423 class COAPPDF
extends TCPDF
{
425 // do cap form version numbering automatically "$Revision: 1.4 $"
426 /*public*/ function Version() {
431 /*public*/ function myHeader( $msg = NULL
, $url = NULL
)
433 static $my_url = NULL
;
435 $this->my_header_msg
= $msg; $my_url = $url; return;
437 if( $this->my_header_msg
== NULL
) return;
438 if( $this->msg_page_nr
> 0 ) {
439 $font_fam = $this->FontFamily
;
440 $font_style = $this->FontStyle
.($this->underline ?
'U' : '').($this->linethrough ?
'D' : '');
441 $font_size = $this->getFontSize();
442 $this->SetFont(FONT
,'', F_SIZE
-1);
443 $this->setXY($this->lMargin
, MARGIN
-3);
444 $this->Cell($this->colwidth
, 3,$this->my_header_msg
, 0, 0, 'R');
445 if( !empty($font_fam ) )
446 $this->SetFont($font_fam,$font_style,$font_size);
447 if( $my_url != NULL
AND $my_url != "" )
448 $this->myLink($this->lMargin+
$this->colwidth
/2,$this->lMargin
-4,$this->colwidth
,(F_SIZE+
5)/2.9,$my_url);
450 $this->setXY($this->lMargin
, MARGIN+
3);
451 $this->y0
= $this->getY();
454 // undefine default header and footer handling
455 // default routines do not handle columns
456 function Footer() { }
457 function Header() { }
458 function Mark( $string = "" ) {
459 return array( $string, 1+
substr_count($string,'.') );
462 /*public*/ function myFooter( $msg = NULL
, $url = NULL
)
464 static $my_url = NULL
;
466 $this->my_footer_msg
= $msg; $this->msg_page_nr
= 0;
467 $my_url = $url; return;
469 if( $this->my_footer_msg
== NULL
) return;
470 $this->InFooter
= true
;
471 $this->msg_page_nr++
;
472 $font_fam = $this->FontFamily
;
473 $font_style = $this->FontStyle
.($this->underline ?
'U' : '').($this->linethrough ?
'D' : '');
474 $font_size = $this->getFontSize();
475 $this->SetFont(FONT
,'', F_SIZE
-1);
476 if( $this->msg_page_nr
> 1 ) {
477 $this->SetXY($this->lMargin
, $this->GetPageHeight()/$this->scale
*100.0-6);
478 $this->Cell($this->colwidth
, 3,
479 sprintf("%s %d", $this->unhtmlentities( _('page') ), $this->msg_page_nr
),
482 if( $this->my_footer_msg
!= "" ) {
483 $strg = "© ". date("Y"). " CAcert Inc.".", ". $this->my_footer_msg
;
484 $this->SetXY($this->lMargin+MARGIN
/2, $this->GetPageHeight()/$this->scale
*100.0-6);
485 $this->Cell($this->colwidth
, 3, $strg, 0, 0, 'R');
486 if( $my_url != NULL
AND $my_url != "" )
487 $this->myLink($this->lMargin+MARGIN
/2,$this->GetPageHeight()/$this->scale
*100.0-6,$this->colwidth
,(F_SIZE+
5)/2.9,$my_url);
489 if( $this->Watermark
!= "" ) {
490 $this->StartTransform();
491 $savex = $this->GetX(); $savey = $this->GetY();
492 $this->SetFont(FONT
,'', F_SIZE
*7);
493 $l = $this->GetStringWidth($this->Watermark
);
494 $h = $this->GetPageHeight()/$this->scale
*100.0/2;
495 $w = $this->colwidth
/2+MARGIN
;
497 $this->TranslateY($h+
(F_SIZE
*7)/2.9);
498 $this->TranslateX($w-MARGIN+
$this->lMargin
);
499 $this->Rotate(rad2deg(atan($h/$w)));
500 $this->Text(-$l/2,0,$this->Watermark
, 0.8);
501 $this->StopTransform();
502 $this->SetXY($savex,$savey);
505 if( !empty($font_fam ) )
506 $this->SetFont($font_fam,$font_style,$font_size);
507 $this->InFooter
= false
;
510 // user and print preferences
511 // NumCopies, PrintPageRange, DisplayDocTitle, HideMenuBar, HideToolBar, ...
512 /*public*/ var $ViewerPrefs = array(
513 'Duplex' => 'Simplex',
515 'DisplayDocTitle' => 'CAcert Organisation Assurance Programme (COAP) form',
516 'HideToolBar' => true
,
521 /*protected*/ var $ncols=1;
524 /*protected*/ var $colwidth=0;
526 // space between columns
527 /*protected*/ var $column_space = 0;
530 /*protected*/ var $col=0;
532 //Ordinate of column start
533 /*protected*/ var $y0;
536 /*protected*/ var $scale = 100.0;
538 // print header and footer
539 /*protected*/ var $my_footer_msg = NULL
;
540 /*protected*/ var $my_header_msg = NULL
;
541 /*protected*/ var $msg_page_nr = 0;
543 // print short watermark on the page
544 /*public*/ var $Watermark = WATERMARK
;
546 /*public*/ function SetFormat( $format = "A4" ) {
547 switch( strtolower($format) ) {
548 // there is some scale problems with margins...
551 $this->scale
*= 1.4142;
554 $this->scale
*= 1.4142;
557 $this->scale
*= 1.4142; break;
560 $this->scale
/= 1.4142; break;
562 $this->scale
*= 0.97; break;
563 default: $format = "A4";
570 $this->SetDisplayMode(intval($this->scale
), 'SinglePage', 'UseOC');
574 //Set position at a given column
575 /*private*/ function SetCol($col = -1) {
576 static $pagecolwidth = 1.0;
577 static $column_space = 1.0;
579 if( $col == -1 ) $col = $this->col+
1;
580 if( $this->colwidth
== 0 ) {
581 // only once at start; set default values
583 $this->addPage(); $col = 0; // reset to zero
584 $this->SetMargins(MARGIN
, MARGIN
, MARGIN
);
585 if( $this->CurOrientation
!= 'L' ) {
586 $this->scale
*= 1.4142;
587 $this->ScaleXY($this->scale
,0,0);
590 $this->ScaleXY($this->scale
,0,0);
592 $this->ncols
= $this->CurOrientation
== 'L'? MAX_COLS
: 1;
593 $this->colwidth
= $this->w
/ $this->scale
* 100 / $this->ncols
- MARGIN
*2;
594 $pagecolwidth = $this->w
/$this->ncols
;
595 // space between columns
596 if ($this->ncols
> 1) {
597 $column_space = round((float)($this->w
- ($this->ncols
* $pagecolwidth)) / ($this->ncols
- 1));
601 $this->y0
= $this->GetY();
604 if( $col == $this->col
) { // reset on close of this column
605 $x = MARGIN +
$this->col
*($pagecolwidth+
$column_space);
606 $this->SetLeftMargin($x);
607 //$this->SetRightMargin($this->w - $x - $this->colwidth);
609 $this->PrintTable("", -1); // if pending table close up table
610 $this->myFooter(); // print footer msg if defined
612 if( $col >= $this->ncols
) {
613 $this->addPage(); $col = 0;
614 $this->ScaleXY($this->scale
,0,0);
615 $this->y0
= 0; //no header/footer done...
616 } elseif ( $col > 0 AND $col < $this->ncols
) {
617 // print column separator
618 $x = $this->w
/$this->ncols
*($this->col+
1);
620 $this->SetLineWidth(0.1); $this->SetDrawColor(195);
621 $this->SetLineStyle(array('dash'=>'1,8') ); // gray dotted
622 $this->Line( $x, $y+
27, $x, $y+
185);
623 $this->SetLineWidth(0.2); $this->SetDrawColor(0);
624 $this->SetLineStyle(array('dash'=>'0') );
627 // X position of the current column
628 $x = MARGIN +
$col*($pagecolwidth+
$column_space);
629 $this->SetLeftMargin($x);
630 $this->SetRightMargin($this->w
- $x - $this->colwidth
);
631 $this->SetXY($x, $this->y0
);
632 $this->myHeader(); //print header msg if defined
633 $this->PrintTable("", 0); // if in table reprint title table
636 //Method accepting or not automatic page break
637 /*public*/ function AcceptPageBreak() {
642 // redefine this routine from tcpdf.php due to scaling bug
643 /*protected*/ function checkPageBreak($h) {
644 if (((($this->y +
$h)*$this->scale
/100.0) > $this->PageBreakTrigger
) ) {
645 if ( !$this->InFooter
) {
646 if ( ($this->AcceptPageBreak())) {
648 //Automatic page break
655 $this->AddPage($this->CurOrientation
);
658 $rs .= sprintf('%.3f Tw', $ws * $k);
661 $this->y
= $this->tMargin
;
668 /*private*/ function S( $value = 1.0 ) {
669 return( $value * $this->scale
/ 100.0 );
672 // put Link in user space
673 /*private*/ function myLink( $x, $y, $w, $h, $Lnk = NULL
, $Type = array('SubType'=>'Link') ) {
674 if( $Lnk == NULL
) return;
675 if( $Lnk == "" ) $Lnk = WEB
."/";
676 $this->Annotation( $this->S($x), $this->S($y), $this->S($w), $this->S($h), $Lnk, $Type);
677 //$this->Annotation( $x, $y, $w, $h, $Lnk, $Type);
681 //require_once("../utf8/native/core.php");
682 // only for to upper case //require_once("../utf8/utils/unicode.php");
684 //setlocale(LC_ALL, 'de_DE');
685 // try to abbreviate a full name, returns name if abbreviation was/is done
686 // has pointers to sur name, first name, avoids titles and extentions
687 // is based that given names and family names starts with capital
688 // all names between first given name and surname are secondary names
689 // will use utf8 routines only when needed and available
690 /*private*/ function Abbreviate( $name = "") {
691 // need to change this for utf8 uppercase detection
692 // substr and strtoupper arte dependent of setlocale...
694 $strtoupper = 'strtoupper';
696 $cnt = preg_match_all('/([^\s\.]+\.|[^\s\.]+)/', $name, $tokens, PREG_SET_ORDER
);
697 if( $cnt <= 0 ) return ( $name );
698 $fam = -1; $married = 0; $i = 0; $success = FALSE
; $first_name = -1;
699 for( $j = 0; $j < $cnt ; $j++
) {
701 $nm = $tk[0]; if( $nm == "" ) continue;
703 $ltr = $substr( $nm, 0, 1 );
704 if(preg_match('/[^\x09\x20-\x7E]/',$ltr) !== 1 AND // it is utf8
705 function_exists( 'utf8_substr') ) {
706 $substr='utf8_substr';
707 //$strtoupper = 'utf8_strtoupper'; // requires utf8/utils/unicode.php
709 if( $strtoupper($ltr) != $ltr ) continue; // lower case setlocale dependent
710 elseif( preg_match('/\./', $nm ) ) {
711 if( $first_name < 0 ) $first_name = $j;
712 if( $first_name >= 0 ) $success = TRUE
; // was abbreviated
715 if( $first_name < 0 ) $first_name = $j;
716 if( $married == 0 ) $fam = $j;
717 if( preg_match('/[-_]/', $nm ) ) {
718 // find special markers
719 if( $married == 0 ) $fam = $j;
724 for( $j = 0; $j < $cnt; $j++
){
726 if( !isset($tk[0]) ) continue;
727 $nm = $tk[0]; if( $nm == "" ) continue;
728 if( $name != "") $name .= " ";
729 $ltr = $substr( $nm, 0, 1 );
730 if( $j == $fam ) $name .= $nm;
731 elseif( $strtoupper($ltr) != $ltr ) $name .= $nm; // lower case
732 elseif( preg_match('/\./', $nm ) ) $name .= $nm;
733 elseif( $j < $fam ) { // need to abbreviate
736 if( $j == $first_name )
737 $abr = "(". $substr( $nm, 1 ) . ")";
739 $name .= $ltr . $abr; $success = TRUE
; // is abbreviated
742 $ext = -1; for( $j = $cnt-1; $j >= 0 AND $j >= $fam; $j-- ) {
743 // try to find family names and see if there is abbreviation
745 if( !isset($tk[0]) ) continue;
747 if( $ext < 0 AND preg_match('/(^[^A-Z]|\.)/', $nm ) ) continue;
748 if( $ext < 0 ) $ext = $j+
1;
749 if( preg_match('/\./', $nm ) ) { $success = TRUE
; break; }
751 return( $success?
$name : "" ); // and return abbriviated name
754 // set formfield coordinates
755 // this routine is needed due to field ordinates are not scaled and in user space
756 // to be called before form field call (or as width parameter)
757 // and just after with true argument to restore X Y ordinates.
758 /*private*/ function SetFieldXY( $x=NULL
, $y=NULL
, $w=0) {
761 static $restored = true
;
762 $restoreXY = $x == NULL ? true
: false
;
764 if( $restored == $restoreXY )
765 $this->Error("internal Form Field save/restore error\n");
767 /* save X Y ordinates */
768 $savex = $this->GetX(); $savey = $this->GetY();
769 // scale to user ordinates
770 $this->SetY( $this->S($y));
771 $this->SetX( $this->S($x));
773 /* restore X Y ordinates */
774 $this->SetY( $savey); // different from SetXY()
775 $this->SetX( $savex); // different from SetXY()
777 $restored = $restoreXY;
778 return( $this->S($w) );
781 // print Date on left or right side
782 /*private*/ function PrintDate( $x=10, $y=10, $dstrg="teus", $dvalue="1945-10-6", $field = NULL
, $RL = 'L')
784 static $TextProps = array('strokeColor' => LLBLUE
, 'value' => "", 'fillColor' => LBLUE
, 'textSize' => '11', 'charLimit'=> 10);
785 $TextProps['userName'] = $this->unhtmlentities( _("yyyy-mm-dd") );
787 $this->SetFont( FONT
, '', F_SIZE
);
788 $this->SetXY($RL == 'L'?
$x : $x-50, $y);
789 $this->Cell(50, 3, $dstrg, 0, 0, $RL);
791 $this->SetXY($RL == 'L'?
$x :$x-50, $y+
3.5);
792 $this->SetFont(FONT
, "B", F_SIZE
);
793 $this->Cell(50, 3, $dvalue, 0 , 0, $RL);
795 if( $field == NULL
) return;
796 $TextProps['value'] = $dvalue;
797 $this->TextField($field, $this->SetFieldXY(($RL == 'L'?
$x+
1 : $x-17), ($y+
3.5),17), 5, $TextProps );
801 // Add import HTML text eg from CCA
802 /*public*/ function PrintHTML( $url = NULL
) {
803 if( $url == NULL
OR $url == "" ) return;
804 $error = ""; $title = ""; $url = POLICY
.$url.EXT
;
805 if( ! file_exists($url) ) $url = WEB
."/".$url;
806 $data = file_get_contents($url);
807 if( !$data ) $error = "\nInternal Error: no ".$url." found.";
810 preg_match('/<[Tt][Ii][Tt][Ll][Ee][^>]*>/', $data, $regs);
811 if( count($regs) < 1 ) $error .= "\nInternal Error: no open tag title found on $url.";
813 $start = strpos($data, $regs[0]) +
strlen($regs[0]);
814 $data = substr($data, $start);
817 preg_match('/<\/[Tt][Ii][Tt][Ll][Ee][^>]*>/', $data, $regs);
818 if( count($regs) < 1 ) $error .= "\nInternal Error: no close title tag found on $url.";
820 $end = strpos($data, $regs[0]);
821 $title = trim(substr($data,0,$end));
822 $data = substr($data, $end+
strlen($regs[0]));
825 preg_match('/<[Bb][oO][Dd][yY][^>]*>/', $data, $regs);
826 if( count($regs) < 1 ) $error .= "\nInternal Error: no open html body tag found on $url.";
828 $start = strpos($data, $regs[0]) +
strlen($regs[0]);
829 $data = substr($data, $start);
832 preg_match('/<\/[Bb][oO][Dd][yY][^>]*>/', $data, $regs);
833 if( count($regs) < 1 ) $error .= "\nInternal Error: no closing html body tag found on $url.";
835 $end = strpos($data, $regs[0])-1;
836 $data = substr($data, 1, $end);
839 if( !$title ) $title = $url;
841 $this->setFont(FONT
, F_SIZE
);
843 $this->PrintHeader(_($title), $this->unhtmlentities( _('policy document') ), strncmp($url,WEB
,strlen(WEB
))==0?
$url : (WEB
."/".$url));
844 if( $title ) $this->Bookmark($title,0);
845 $this->writeHTMLCell($this->colwidth
,2.5,$this->lMargin+
1,$this->GetY()+
2.5,
849 $this->MultiCell($this->colwidth
, 3, $error);
852 /*private*/ function PrintCOAP($organisation = NULL
, $registry = NULL
, $assurer = NULL
, $assurance = NULL
){
854 $this->PrintHeader($this->unhtmlentities( _('CAcert Organisation Assurance Programme'), _('Organisation Information (COAP) form'), defined('ASSCOAP')?ASSCOAP
:"",defined('WEB')? WEB
.substr(__FILE__
, strrpos(__FILE__
,"/")) : "") );
855 // define slighly different footer message
856 $this->myFooter("V". substr($this->Version(), 0, strpos($this->Version(), '.')).", ". $this->unhtmlentities( _('generated')." ".date("Y-n-j") ));
857 $this->AssuranceInfo();
858 $this->InfoOrganisation($organisation, $registry);
859 $this->StatementOrganisation($organisation);
860 $this->StatementAssurer( $assurer, $assurance );
863 //Add form and/or CCA (on duplex only when more as one page is printed)
864 /*public*/ function PrintForm( $organisation = NULL
, $registry = NULL
, $assurer = NULL
, $page = NULL
) {
866 for($cnt=0 ; $cnt < $this->ncols
; $cnt++
) {
867 if( !isset( $page['form']) OR $page['form'] ) {
868 // the form is one page, use new room?
869 if ( $organisation == NULL
OR $registry == NULL
OR $assurer == NULL
)
870 $this->Error("Organisation or Assurer data records failure");
871 $this->PrintCOAP( $organisation, $registry, $assurer);
873 // print off policy documents to be included in pdf file
874 foreach( $page['policies'] as $i => $file ) {
875 $this->Watermark
= WATERMARK
; // no watermark on these pages
876 if( $file ) $this->PrintHTML( $file );
878 if( $this->col
> 0 OR $this->getPage() > 1 ) break;
880 if( $this->getPage() > 1 ) {
881 // and on duplex print back side with Community Agreement
882 if( $this->CurOrientation
== 'P' )
883 $this->ViewerPrefs
['Duplex'] = 'DuplexFlipLongEdge';
885 $this->ViewerPrefs
['Duplex'] = 'DuplexFlipShortEdge';
887 // close up this column, make sure footer is printed.
888 $this->my_header_msg
= NULL
; $this->SetCol($this->col
);
891 // Set form title (right align)
892 /*public*/ function PrintHeader($title1 = " ", $title2 = " " , $url1 = NULL
, $url2 = NULL
) {
893 // store current top margin value
894 $tSide = $this->tMargin
;
897 // eps should be better, but it does not seem to work with CAcert logo
899 $this->myFooter($title1,$url1);
900 $this->myHeader($title2,$url2);
901 if( LOGO_TYPE
== '.eps' )
902 $this->ImageEPS(BW?LOGO
.'mono'.LOGO_TYPE
:LOGO
.'colour'.LOGO_TYPE
,
903 ($this->lMargin+
$this->colwidth
)-51,$tSide-3,51);
905 // png image 1000 X 229 * 8 bits
906 $this->Image(BW?LOGO
.'mono'.LOGO_TYPE
:LOGO
.'colour'.LOGO_TYPE
,
907 ($this->lMargin+
$this->colwidth
)-51,$tSide-3,51,0,0,
908 NULL
,0,true
,intval(LOGO_DPI
));
909 $this->myLink($this->lMargin+
$this->colwidth
-51, $tSide-3,51,51/1000*229,WEB
."/");
911 $this->SetFont(FONT
,'B',F_SIZE+
5);
912 $this->SetY($tSide+
5); $this->SetX($this->lMargin
);
913 $l = $this->GetStringWidth($title1);
914 $this->Cell($this->colwidth+
1,14,$title1,0,0,'R',0,NULL
);
915 if( $url1 != NULL
AND $url1 != "" )
916 $this->myLink($this->lMargin+
$this->colwidth
-$l,$this->GetY()+
5,$l,(F_SIZE+
5)/2.9,$url1);
917 $this->Ln(5); $this->SetX($this->lMargin
);
918 $l = $this->GetStringWidth($title2);
919 $this->Cell($this->colwidth+
1,14,$title2,0,0,'R',0,NULL
);
920 if( $url2 != NULL
AND $url2 != "" )
921 $this->myLink($this->lMargin+
$this->colwidth
-$l,$this->GetY()+
5,$l,(F_SIZE+
5)/2.9,$url2);
923 // CAcert Inc. postbox address
924 $this->Ln(6); $this->SetX($this->lMargin
);
925 $this->SetFont(FONT
,'',F_SIZE
);
926 $savex = $this->GetX(); $savey = $this->GetY();
927 $strg = POBOX
." - ". WEB
;
928 $this->SetXY($this->lMargin+
$this->colwidth
-$this->GetStringWidth($strg)-1.1,$this->GetY()+
3.5); // right align
929 if( !BW
) $this->SetTextColor(17,86,140);
930 $ret = $this->Write(0, $strg, NULL
);
931 $l = $this->GetStringWidth($strg);
932 $this->myLink($this->lMargin+
$this->colwidth
-$l,$this->GetY()+
0.5,$l,F_SIZE
/2.9,WEB
);
934 if( !BW
) $this->SetTextColor(0);
935 $this->SetXY($savex,$savey);
937 // sha1 fingerprint CAcert rootkeys class 1 and class 3
938 $strg = $this->unhtmlentities( _("CAcert's Root Certificate sha1 fingerprints") ) . ", class 1: ". CLASS1_SHA1
. ", class 3: " . CLASS3_SHA1
;
939 $this->Ln(3); $this->SetX($this->lMargin
);
940 $this->SetFont(FONT
,'',F_SIZE
* $this->colwidth
/ ($this->GetStringWidth($strg) +
1));
941 $this->Cell($this->colwidth
,10, $strg,0,0,'C',0,NULL
);
942 $this->myLink($this->lMargin
, $this->GetY()+
4,$this->colwidth
,F_SIZE
/2.9,ROOTKEYS
);
943 $this->SetLineWidth(0.1);
944 if ( BW
) { $this->SetDrawColor(195);
945 } else { $this->SetDrawColor(17,86,140);
948 $this->Line($this->lMargin
, $tSide+
25, $this->lMargin+
$this->colwidth
, $tSide+
25);
949 $this->SetLineWidth(0.2); $this->SetDrawColor(0);
951 $this->SetXY($this->lMargin
, $tSide+
26); // top
954 // Set general form information
955 /*private*/ function PrintInfo( $strg = "", $url = "") {
956 // store current margin values
958 // Print text blurb paragraph at top of page
959 $this->SetFont(FONT
,'',F_SIZE+
0.5);
960 $this->SetXY($this->lMargin
, $this->GetY()-1.5);
961 $y = $this->GetY(); $x = $this->GetX();
962 $cnt=$this->MultiCell($this->colwidth+
1, 0, $strg,0,'L',0,2);
963 if ( $url != "" ) // link should be in user space
964 $this->myLink($x, $y, $this->colwidth
, $this->GetY()-$y, $url);
968 // print general CAP info
969 /*public*/ function AssuranceInfo( ) {
970 // store current margin values
972 $this->SetY($this->GetY()+
0.5);
973 $this->Bookmark($this->unhtmlentities( _('CAcert COAP form') ),0,$this->S($this->GetY()));
975 // Show text blurb at top of page
976 $strg = $this->unhtmlentities( _('The CAcert Organisation Programme (COAP) aims to verify the identity of the organisation.') );
977 $strg .= "\r\n". $this->unhtmlentities( _('The Applicant asks the Organisation Assurer to verify to CAcert Community that the information provided by the Applicant is correct, and according to the official trade office registration bodies.') );
978 $cellcnt +
= $this->PrintInfo( $strg, defined('ASSINTRO')? ASSINTRO
:"");
979 $cellcnt +
= $this->PrintInfo( $this->unhtmlentities( _('For more information about the CAcert Organisation Assurance Programme, including detailed guides to CAcert Organisation Assurers, please visit:')." ".WEB
, defined('ASSCOAP')?ASSCOAP
:"") );
980 $cellcnt +
= $this->PrintInfo( $this->unhtmlentities( _('A CAcert Arbitrator can require the Organisation Assurer to deliver the completed forms and accompanying documents in the event of a dispute.'),defined('ARBIT')?ARBIT
:"") );
981 $this->SetY($this->GetY()+
0.3);
985 // print empty table with title for statements (called twice per table)
986 /*private*/ function PrintTable( $strg = NULL
, $height = -1, $ext = 0 ) {
987 // store current margin values
990 if( $height < 0 ) { // mark table position, leave room for title
991 if( $strg != "" ) $title = $strg;
992 if( $title == "" ) return ($this->GetY()); // nothing to do
993 $tSide = $this->GetY()+
1;
996 $this->SetFillColor(195);
997 $this->SetDrawColor(195);
999 $this->SetFillColor(173,197,215);
1000 $this->SetDrawColor(173,197,215);
1002 $this->Rect($this->lMargin
-1,$tSide-1,1,9, "F");
1003 $this->Rect($this->lMargin
-1,$tSide-1,$this->colwidth
,1, "F");
1004 $this->SetFillColor(255);
1005 if ( BW
) { $this->SetFillColor(125);
1006 } else { $this->SetFillColor(17,86,140);
1008 $this->Rect($this->lMargin
,$tSide,$this->colwidth
,7, "DF");
1009 $this->SetFillColor(255); $this->SetDrawColor(0);
1011 $this->SetXY($this->lMargin+
1, $tSide+
0.6);
1012 $this->Bookmark($title,1,$this->S($tSide));
1013 $this->SetFont(FONT
, '', F_SIZE+
7);
1014 $this->SetTextColor(255);
1015 $this->Write(0, $title);
1016 $this->SetTextColor(0);
1017 $this->SetXY($this->lMargin+
1, $tSide +
7);
1018 $tSide +
= 8; // save old top
1019 if ( $height != 0 ) return($this->GetY());
1021 elseif( $tSide < 0 ) return( $this->GetY());
1022 if( $height == 0 ) { // interrupted bottum of column reached
1023 $height = $this-GetY() - $tSide; $save = $title;
1024 $this->PrintTable("", $height); // finish till bottumn page
1025 $tSide = $this->originalMargin
;
1027 return( $this->GetY());
1029 if( $strg != "" ) $title = $strg; // just to be defensive
1033 $this->SetFillColor(195);
1034 $this->SetDrawColor(195);
1036 $this->SetFillColor(173,197,215);
1037 $this->SetDrawColor(173,197,215);
1039 $this->Rect($this->lMargin
-1,$tSide,1,$height-1+
$ext, "F");
1041 $this->Rect($this->lMargin
-1,$tSide+
$height,$this->colwidth
,$ext, "F");
1042 $this->SetFillColor(255);
1043 // borders of the table left, bottumn, right
1044 $this->Line($this->lMargin
,$tSide+
$height-1, $this->lMargin
, $tSide+
$height);
1045 $this->Line($this->lMargin
,$tSide+
$height,$this->lMargin+
$this->colwidth
,$tSide+
$height);
1046 $this->Line($this->lMargin+
$this->colwidth
,$tSide-1, $this->lMargin+
$this->colwidth
, $tSide+
$height);
1047 $this->SetDrawColor(0);
1048 $this->SetY($tSide +
$height +
1); // set Y ordinate to plus 7
1049 $tSide = -1; $title = "";
1050 return($this->GetY());
1053 // a name, email address, phone number
1054 /*private*/ function PrintName( $info = "", $title = "", $field = "", $name = "", $email = NULL
, $phone = NULL
, $backgrnd = false
) {
1055 static $TextProps = array('strokeColor'=> LLBLUE
, 'value' => " ", 'fillColor'=> LBLUE
, 'doNotScrole'=> 'false', 'textSize' => 10, 'rotate'=> '0');
1057 // just once to recover from Acrobat 7.0 problem !!!!!!!!!!!!!!!!!!!!!!!!!!
1058 // make sure before the first time form field JS is called the fake is done
1059 static $AcrobatName = array('strokeColor'=> LLBLUE
, 'fillColor'=> LLBLUE
, 'readonly' => 'true');
1060 if( $AcrobatName != NULL
) {
1061 $this->TextField( 'NameNone', $this->SetFieldXY(300, $this->GetY()+
2, 0), 0, $AcrobatName);
1062 $this->SetFieldXY(); $AcrobatName = NULL
;
1064 // end of Acrobat defeat !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1065 $cellcnt = 1; $msg = "";
1066 // put assurer help for assurance in pdf file for mouse over
1067 if ( $info != "" ) $msg = $info;
1068 if ( $email != NULL
AND $email != "" AND $title != "" )
1069 $msg .= " ". $this->unhtmlentities( _('The email address, which matches the CAcert account email address, is handy for administrative and contact reasons. For organisation administrator the email address is required.') );
1071 $this->myLink($this->lMargin
-7, $this->GetY()-1, 5, 3, $msg,
1072 array('subtype'=> 'Text', 'Open' => true
,
1073 'c'=> array(173,197,215), 'name' => 'Comment',
1074 'f'=> array( 'nozoom', 'readonly', 'norotate'),
1075 't'=> $this->unhtmlentities( _('COAP form help') ))
1079 $this->SetFillColor(241);
1081 //$this->SetFillColor(173,197,215);
1082 $this->SetFillColor(234, 241, 246);
1084 $this->Rect($this->lMargin+
37.5,$this->GetY()+
0.1,
1085 $this->colwidth
-38.5,
1086 ($email != NULL
AND $email != "") ?
5.7 : 2.8,
1088 $this->Rect($this->lMargin+
1,$this->GetY()+
0.1,
1090 ($email != NULL
AND $email != "") ?
5.7 : 2.8,
1092 $this->SetFillColor(255);
1094 // assurer identity info
1095 $this->SetX($this->lMargin+
1);
1096 $savey = $this->GetY();
1097 $this->SetFont(FONT
, '', F_SIZE
);
1098 $l = $this->GetStringWidth($title);
1099 //$l = ($l<=0? 0 : ($l < 35? 35 : $l));
1100 $l = $l < 35 ?
35 : $l;
1101 $this->Write(0, $title);
1102 $this->SetXY($this->lMargin+
2+
$l, $savey);
1104 $this->SetFont(FONT
, 'B', F_SIZE
);
1105 $this->SetXY( $this->lMargin+
2 +
$l, $savey-1);
1106 $cellcnt +
= $this->MultiCell($this->colwidth
-$l-3, 3, $name, 0, 1);
1107 if( function_exists('utf8_to_ascii') AND
1108 !utf8_is_ascii_ctrl( $name) )
1109 $ascii = utf8_to_ascii($name);
1112 if( $ascii == $name ) $ascii = "";
1113 if( $email != NULL
) $abbr = $this->Abbreviate( $name ); else $abbr="";
1114 if( $ascii != "" OR $abbr != "") {
1115 $la = $this->GetStringWidth($name) +
5;
1116 $msg = $this->unhtmlentities( _('The exact name of the individual may have transliterated characters and/or some given names may be abbreviated. If present the first given name will be shown abbreviated and parentheses around the last part of the given name.') )."\r\n";
1117 if( $ascii != "" ) $msg .= '* '. $ascii . "\r\n";
1118 if( $abbr != "" ) $msg .= '* '. $abbr . "\r\n";
1119 $this->myLink($this->lMargin+
$l+
$la, $savey, 3, 2, $msg,
1120 array('subtype'=> 'Text', 'Open' => false
,
1121 'c' => array(173,197,215), 'name' => 'Comment',
1122 'f'=> array( 'nozoom', 'readonly', 'norotate'),
1123 't' => $this->unhtmlentities( _('On the full name of the Assurer') )));
1126 $TextProps['value'] = $name ?
$name : " ";
1127 $TextProps['userName'] = $this->unhtmlentities( _('Full exact name of the individual.') );
1128 $this->TextField($field.($email?
'Name' : ""), $this->SetFieldXY($this->lMargin+
2+
$l, $savey, $this->colwidth
-$l-3-($phone?
25:0)), 4.5, $TextProps );
1129 $this->SetFieldXY();
1130 if( $phone AND $phone != " " ) {
1131 $sx = $this->GetX(); $sy = $this->GetY();
1132 $this->SetFont(FONT
, "", F_SIZE
);
1133 $sw = $this->GetStringWidth($phone) +
2;
1134 $this->SetXY( $this->lMargin+
$this->colwidth
-$sw -4, $sy-4.8);
1135 $this->SetFont('zapfdingbats', "", F_SIZE+
3);
1136 $this->Write(0, "&"); // telephone symbol
1137 $this->SetXY( $this->lMargin+
$this->colwidth
-$sw-1, $sy-4.1);
1138 $this->SetFont(FONT
, "", F_SIZE
);
1139 $this->Cell($sw+
1,0,$phone);
1142 $TextProps['value'] = $phone ?
$phone : $this->unhtmlentities( _('phone nr') ) . "?";
1143 $TextProps['userName'] = $this->unhtmlentities( _('For organisation administrators and assurer: provide email address and optionally your phone number.') );
1144 $this->TextField($field.'Phone', $this->SetFieldXY($this->lMargin+
$this->colwidth
-25, $savey, 24), 4.5, $TextProps );
1145 $this->SetFieldXY();
1148 if( $email AND $email != " " ) {
1149 $this->SetXY($this->lMargin+
2+
$l, $savey); $cellcnt++
;
1150 $this->SetFont(FONT
, "", F_SIZE
);
1151 if( !BW
) $this->SetTextColor(17,86,140);
1152 $this->Write(0, $email);
1153 $this->myLink($this->lMargin+
$l, $savey,$this->GetStringWidth($email), 3, "mailto:". $email . "?subject=" . $this->unhtmlentities( _('Organisation Assurance') ));
1154 if( !BW
) $this->SetTextColor(0);
1157 $TextProps['value'] = $email ?
$email : $this->unhtmlentities( _('email') ) . "?";
1158 $TextProps['userName'] = $this->unhtmlentities( _('For organisation administrators and assurer: provide email address and optionally your phone number.') );
1159 $this->TextField($field.'Email', $this->SetFieldXY($this->lMargin+
2+
$l, $savey, $this->colwidth
-$l-28), 4.5, $TextProps);
1160 $this->SetFieldXY(); $savey +
= 3;
1163 $this->SetXY($this->lMargin+
2, $savey);
1165 //$H = 5; // height of the name cell
1168 // All information of Applicant goes in one table
1169 /*public*/ function InfoOrganisation( $organisation = NULL
, $registry = NULL
){
1170 // Applicant Identity information part
1171 $tSide = $this->PrintTable($this->unhtmlentities( _('Organisation Identity Information') ))+
1;
1173 $msg = $this->unhtmlentities( _('The organisation name, director name and signature, and applicable company law is checked by the Organisation Assurer with the official Trade Office Registration (Extract) or by other means. The organisation domain name(s) are checked of ownership against the internet domain DNS records.') );
1174 $msg .= "\r\nThe organisation administrator (a CAcert Assurer) email address must be the primary email address registered with CAcert.";
1175 // put hint on comparing names on title table
1176 $this->myLink($this->lMargin
-7, $tSide-7, 5, 5, $msg,
1177 array('subtype'=> 'Text', 'Open' => true
,
1178 'c'=> array(173,197,215), 'name' => 'Comment',
1179 'f'=> array( 'nozoom', 'readonly', 'norotate'),
1180 't'=> $this->unhtmlentities( _('On organisation identity information') )));
1182 $this->SetXY($this->lMargin+
1, $tSide);
1184 $this->unhtmlentities( _('The official full name of the organisation equal to the name of the organisation registered e.g. at the trade office registration of the state.') ),
1185 $this->unhtmlentities( _('Name of the organisation') )." ",
1186 "OrganisationNames0",
1187 $organisation['namecnt']>0?
$organisation['names'][0]:" ",
1190 $this->unhtmlentities( _('The organisation address which should be equal to the address registered with the trade office.') ),
1191 $this->unhtmlentities( _('Address (comma separated)') )." ",
1192 "OrganisationAddress",
1193 $organisation['address'],
1196 foreach( array( $organisation['type'], $organisation['state'], $organisation['country']) as $i )
1197 if( $i != "" ) $strg .= ($strg != "" ?
", ": "") . $i;
1199 $this->unhtmlentities( _('The legal organisation type: eg Ltd, EPS, society, foundation, association, etc. The state/country under which jurisdiction the organisation operates.') ),
1200 $this->unhtmlentities( _('Type, jurisdiction (state)') )." ",
1205 $strg = $organisation['namecnt'] <= 1 ?
"" : $organisation['names'][1];
1206 for( $i = 3; $i <= $organisation['namecnt']; $i++
)
1207 $strg .= ", ". $organisation['names'][$i-1];
1208 $this->PrintName( $this->unhtmlentities( _('Other registered trade names of the organisation. (comma separated)') ),
1209 $this->unhtmlentities( _('Registered Trade Names') ), 'OrganisationDBA',
1214 foreach( array( $registry['identifier'], $registry['name'], $registry['region'], $registry['date'] ) as $i )
1215 if( $i != "" ) $strg .= ($strg != "" ?
", " : "") . $i;
1217 $this->unhtmlentities( _('Trade Office Registry information, as organisation registration Identification number or license number, name of the trade office registry, trade office operating region, and optionally date of extract.') ),
1218 $this->unhtmlentities( _('Registration (id, name, region)') ),
1223 $strg = ""; foreach( $organisation['domains'] as $i )
1224 $strg .= ($strg != "" ?
", " : "") . $i;
1226 $this->unhtmlentities( _('The internet domain name(s) the organisation controls and owns. The names will be checked with WHOIS with e.g. the DNS official top domain registrar e.g. the country ccTLD .<country code> registrar.') ),
1227 $this->unhtmlentities( _('Internet Domain(s)') ),
1228 'OrganisationDomains',
1232 // all (max) three names with ID type right aligned.
1233 // contact info o-admin address assuree
1234 $cnt = $organisation['admincnt'];
1235 $space = $this->getPageHeight()/$this->scale
*100.0 -MINH
; // margin
1236 for( $i = 0; $i < $cnt; $i++
) { // names to be printed
1238 $this->unhtmlentities( _('The organisation administrator (CAcert Assurer) contact information. The administrator is appointed by the organisation director to administer the organisation domain certificates, secure the certificates and maintain them.') ),
1239 $this->unhtmlentities( _('Organisation Administrator') ),
1240 sprintf("OrganisationAdmin%d",$i),
1241 $organisation['admins'][$i]['name'],
1242 $organisation['admins'][$i]['email']?
$organisation['admins'][$i]['email']:" ",
1243 $organisation['admins'][$i]['phone']?
$organisation['admins'][$i]['phone']:" ",
1245 if( $space < $this->getY() ) break;
1247 for( $j=0 ; $j < $i+
3; $j++
) {
1248 // empty fields up to max 3 empty fields and allowed space
1249 if( $space < $this->getY() ) break;
1251 $i+
$j == 0?
$this->unhtmlentities( _('The organisation administrator (CAcert Assurer) contact information. The administrator is appointed by the organisation director to administer the organisation domain certificates, secure the certificates and maintain them.') ):"",
1252 $i+
$j > 0?
"": $this->unhtmlentities( _('Organisation Administrator') ),
1253 sprintf("OrganisationAdmin%d",$i+
$j),
1254 "", " ", " ", TRUE
);
1257 //$this->SetXY($this->lMargin+1, $this->GetY()+0.35);
1258 $next = $this->PrintTable( "", $this->GetY()-$tSide, 5);
1262 // print marked paragraph in the table
1263 /*private*/ function PrintTicked( $strg = "", $tick = true
) {
1264 // store current margin values
1265 $savey = $this->GetY();
1267 $celcnt = 0; $this->SetX($this->lMargin +
1);
1269 // use ✔ and ❑ of zapfdingbats font for OK tick
1270 $savex = $this->GetX();
1271 $this->SetXY($this->GetX(), $savey+
0.9);
1272 $this->SetFont("zapfdingbats", F_SIZE+
3);
1273 $this->Write(0,"q"); // ❑
1274 $this->SetXY($savex+
0.1, $savey+
0.1);
1276 $this->SetTextColor(80);
1278 $this->SetTextColor(17, 86, 140);
1279 //$this->SetTextColor(0,92,0); // #00BE00 lime
1280 $this->Write(0,"4 ");// ✓
1281 $this->SetTextColor(0);
1283 $this->SetXY($this->GetX(), $savey);
1284 $this->SetFont(FONT
,'',F_SIZE+
0.5);
1285 $celcnt = $this->MultiCell($this->lMargin+
$this->colwidth
-$this->GetX(), 3, $strg,0,'L');
1286 $this->SetXY($this->lMargin+
1, $this->GetY()-1.5);
1290 // assuree statement
1291 /*public*/ function StatementOrganisation( $organisation = NULL
) {
1292 // store current margin values
1295 // assuree statement section
1296 $tSide = $this->PrintTable($this->unhtmlentities( _("Organisation's Statement") )); // mark table header
1297 $msg = $this->unhtmlentities( _('The Director indicated by the Trade Office Registry Extract, has to underwrite the correctness of the information for the organisation and allowance of certificate operations by the administrators.') );
1298 $msg .= "\r\nFor formal contact with the organisation the email address of the organisation is required.";
1299 // put hint on comparing names on title table
1300 $this->myLink($this->lMargin
-7, $tSide-7, 5, 5, $msg,
1301 array('subtype'=> 'Text', 'Open' => true
,
1302 'c'=> array(173,197,215), 'name'=> 'Comment',
1303 'f'=> array( 'nozoom', 'readonly', 'norotate'),
1304 't'=> $this->unhtmlentities( _("On director's statement") )));
1306 $cellcnt +
= $this->PrintTicked( $this->unhtmlentities( _("Make sure you have read and agreed with the CAcert Community Agreement") ), false
/* no tick */);
1307 if( !BW
) $this->SetTextColor(17, 86, 140);
1308 $this->SetXY($this->lMargin+
2,$this->GetY()-0.5);
1309 $ret = $this->Write($this->lasth
, WEB
."/".POLICY
.CCA
.EXT
, NULL
);
1310 $this->myLink($this->lMargin+
1, $this->GetY()-F_SIZE
/2.9, $this->colwidth
-2, F_SIZE
*2.9/2.9, WEB
."/".POLICY
.CCA
.EXT
);
1312 if( !BW
) $this->SetTextColor(0);
1315 $this->PrintName($this->unhtmlentities( _('Name and contact details (organisation email address & optionally phone number), of the Director of the organisation as is referred to in the trade office extract.') ),
1316 $this->unhtmlentities( _('Director') ), "OrganisationDirector", $organisation['director'],
1317 $organisation['email']?
$organisation['email'] : "email:",
1318 $organisation['phone']?
$organisation['phone']:" ");
1319 $cellcnt +
= $this->PrintTicked( $this->unhtmlentities( _('I agree to the CAcert Community Agreement.') ), true
/* tick */);
1320 $cellcnt +
= $this->PrintTicked( $this->unhtmlentities( _('I hereby confirm that all information is complete and accurate and will notify CAcert of any updates or changes thereof.') ), true
/* tick */);
1321 $cellcnt +
= $this->PrintTicked( $this->unhtmlentities( _('I am duly authorised to act on behalf of the organisation, I grant operational certificate administrative privileges to the specified Organisation Administrator and, I request the Organisation Assurer to verify the organisation information according to the Assurance Policies.') ), true
/* tick */);
1324 $savey = $this->GetY();
1325 $strg = $this->unhtmlentities( _('Date') );
1326 if($organisation['date'] == "")
1327 $strg .= " (". $this->unhtmlentities( _("yyyy-mm-dd") ). ")";
1329 $this->PrintDate( $this->lMargin+
1, $savey+
1, $strg, $organisation['date'], 'OrganisationDate', 'L');
1331 $strg = $this->unhtmlentities( _('Signature and organisation stamp') );
1332 $this->SetFont(FONT
, '', F_SIZE
);
1333 $l = $this->GetStringWidth( $strg );
1334 $this->SetXY($this->lMargin+
$this->colwidth
-$l-3, $savey+
1);
1335 $this->Write(0, $strg); $this->Ln(7) ; // and leave some room
1337 // draw the table borders and header at marked ordinate
1338 $next = $this->PrintTable("", $this->GetY()-$tSide);
1343 // assurer statement
1344 /*public*/ function StatementAssurer( $assurer = NULL
) {
1345 if( $assurer == NULL
) return;
1347 // store current margin values
1348 $TextProps = array('strokeColor'=> LLBLUE
, 'value' => "", 'fillColor'=> LBLUE
, 'doNotScrole'=> 'true', 'textSize' => '14', 'rotate'=>0);
1351 $tSide = $this->PrintTable($this->unhtmlentities( _("Organisation Assurer's Statement") )); // mark table ordinate
1352 // put assurer help for assurance in pdf file for mouse over
1353 $msg = $this->unhtmlentities( _('The organisation assurer will check the trade office registry for company information (name, location, country of jurisdiction, director names, trade office Identification number, domain name ownership, and system admin reference). Any associated costs for this research will be reimborsed by the assurer from the organisation.') );
1354 $this->myLink($this->lMargin
-7, $tSide-6, 5, 5, $msg,
1355 array('subtype'=> 'Text', 'Open' => true
,
1356 'c'=> array(173,197,215), 'name'=> 'Comment',
1357 'f'=> array( 'nozoom', 'readonly', 'norotate'),
1358 't'=> $this->unhtmlentities( _('On mutual assurance') )));
1359 // assurer identity info
1362 $this->unhtmlentities( _('The Organisation Assurer contact information. This assurer will verify the organisation identity and registration information.') ),
1363 $this->unhtmlentities( _('Organisation Assurer') ) . " ","Assurer",
1365 $assurer['email']?
$assurer['email']:" ",
1366 $assurer['phone']?
$assurer['phone']:" ");
1368 // assurer statements
1369 $this->SetY($this->GetY()-0.5);
1370 $cellcnt +
= $this->PrintTicked( $this->unhtmlentities( _("I, the Assurer, hereby confirm that I have verified the official Information for the organisation, I will witness the organisation's identity in the CAcert Organisation Assurance Programme, and complete the Assurance.") ), true
/* ticked */);
1371 $cellcnt +
= $this->PrintTicked( $this->unhtmlentities( _('I am a CAcert Community Member, have passed the Organisation Assurance Challenge, and have been appointed for Organisation Assurances within the country where the organisation is registered.') ), true
/* ticked */);
1372 $this->Ln(1); $savey = $this->GetY();
1374 $strg = $this->unhtmlentities( _('Date') );
1375 if( $assurer['date'] == "" ) $strg .= " (" . $this->unhtmlentities( _("yyyy-mm-dd") ).")";
1377 $this->PrintDate( $this->lMargin+
1, $savey, $strg, $assurer['date'], 'AssurerDate', 'L');
1379 $this->SetXY($this->lMargin+
1, $savey);
1380 $this->SetFont(FONT
, "",F_SIZE
);
1381 $strg = $this->unhtmlentities( _("Organisation Assurer's signature") );
1382 $this->SetXY($this->lMargin+
$this->colwidth
-$this->GetStringWidth($strg)-3, $savey);
1383 $this->Write(0, $strg );
1384 $savey = $this->GetY()+
7; // leave room for date and signature
1385 if( $this->GetPageHeight()/$this->scale
*100.0-$savey > MARGIN+
4)
1387 $this->SetXY($this->lMargin+
1, $savey);
1388 $l = $this->GetPageHeight()/$this->scale
*100.0-$this->GetY() - MARGIN
;
1389 if($l > 3 ) $l = 3; if( $l > 0 ) $this->Ln($l); // try to come close to margin
1390 $next = $this->PrintTable("", $this->GetY()-$tSide);
1394 // End of CAPPDF TCPDF class extension
1398 // --------------------------------------------------------------------------------
1399 // import environmental data -------------------------------------------------------
1400 // get $form, $orientation, $assuree, $assurer, $assurance info
1401 // FONT and BW are set already
1405 function GET( $key = "" ) {
1407 $strg = array_key_exists( $key, $_GET) ?
$_GET[$key] : "";
1408 if(!$utf8 AND $strg != "" AND
1409 !utf8_is_ascii_ctrl($strg) AND
1410 !function_exists('utf8_to_ascii')) {
1416 // form, CCA and page format info
1417 $page['format'] = strtolower(GET('format')); // A3, A4, A5, letter, legal, etc.
1418 if( !$page['format'] ) $page['format'] = 'a4'; // default a4, portrait
1419 // on landscape orientation we do two half pages
1420 $page['orientation'] = strtolower(GET('orientation'));
1421 if( $page['orientation'] != 'l' AND $page['orientation'] != "landscape" ) {
1422 $page['orientation'] = 'p'; // default is portrait and 1 up
1424 $page['form'] = GET('noform') != "" ? false
: true
;
1425 // dft is now true it should go to true
1426 $page['policies'] = array();
1427 if( GET('nocca') == "" ) {
1428 if( defined('CCA') ) $page['policies'][] = CCA
;
1430 // set $page['form'] on 'simplex' or 'duplex' to get CCA on pdf page
1433 $assurer = array ( 'name' => my_recode(GET('assurer')) ,
1434 'email' => my_recode(GET('assureremail')),
1435 'date' => my_recode(GET('assurerdate')),
1436 'phone' => my_recode(GET('assurerphone')),
1441 $assurance = array ( 'location' => my_recode(GET('location')),
1442 'date' => my_recode(GET('assurancedate'))?my_recode(GET('assurancedate')):
1443 my_recode(GET('date')),
1444 'notes' => '' // not yet used
1448 // trade office info
1450 'identifier' => my_recode(GET('identifier')),
1451 'date' => my_recode(GET('tordate')),
1452 'region' => my_recode(GET('torregion')),
1453 'name' => my_recode(GET('tor')),
1457 $organisation = array (
1458 'names' => array( ), // [0] full name, [>0] DBA's
1460 'date' => my_recode(GET('date')) == "now" ?
date("Y-m-d") :
1461 my_recode(GET('date')),
1462 'address' => my_recode(GET('address')),
1463 'state' => my_recode(GET('state')),
1464 'country' => my_recode(GET('country')),
1465 'type' => my_recode(GET('type')),
1466 'director' => my_recode(GET('director')),
1467 'email' => my_recode(GET('email')),
1468 'phone' => my_recode(GET('phone')),
1469 'domains' => array(), // dns names for server certs
1471 'admins' => array(), // name, email, phone
1474 if( $assurer['date'] == "now" ) $assurer['date'] = date("Y-m-d");
1475 //if( $registry['date'] == "now" ) $registry['date'] = date("Y-m-d");
1477 function Dstr( $first = "", $strg = "", $cnt = 0 ) {
1478 return( $cnt>0?
sprintf("%s%d%s", $first, $cnt, $strg) : $first.$strg );
1480 // company name info and trade names
1481 $j = 0; // after two successive empty names we stop
1482 for( $i = -1; $i <= 9 AND $j < 3; $i++
) { // max 9 names we only print 4 max...
1483 $name = my_recode(GET(Dstr($i>=0?
"dba" : "name", "", $i)));
1484 if( $name ) { $j = 0;
1485 $organisation[ 'namecnt' ]++
;
1486 $organisation[ 'names' ] [] = $name;
1489 // administrator info
1490 $j = 0; // after two successive empty names we stop
1491 for( $i = 0; $i <= 9 AND $j < 2; $i++
) { // max 9 names we only print 4 max...
1492 $name = my_recode(GET(Dstr("admin", "", $i)));
1493 if( $name ) { $j = 0;
1494 $organisation[ 'admincnt' ]++
;
1495 $organisation[ 'admins' ] [] = array (
1496 'name' => $name ?
$name : "",
1497 'email' => my_recode(GET(Dstr("admin","email",$i))),
1498 'phone' => my_recode(GET(Dstr("admin","phone",$i))),
1502 // organisation domain names convert to array of lowercased names
1503 $j = 0; $domains = "";
1504 for( $i = 0; $i <= 25 AND $j < 2; $i++
) {
1505 $name = my_recode(GET(Dstr("domain", "", $i)));
1506 if( $name ) { $j = 0;
1507 if( $domains != "" ) $domains .= ",";
1508 $domains .= strtolower($name);
1512 if( $domains ) { // csv list to array and trim white spaces
1513 $domains = strtok($domains,',');
1514 for( ; $domains != ""; $i++
) {
1515 $organisation['domains'][$i] = trim($domains); $domains = strtok(',');
1517 sort( $organisation['domains'] );
1518 } else $organisation['domains'][0] = " ";
1521 // try to get policy documents names to be printed off
1522 $j = 0; // after two successive empty name we stop searching
1523 for( $i = 1; $i <= 9 AND $j<2; $i++
) {
1524 $name = GET(sprintf("policy%d", $i));
1525 if( $name != "" ) { $page['policies'][] = $name; $j = 0; }
1529 if( $utf8 ) { // have scanned arguments for non-ascii code now
1530 //require_once("../utf8/native/core.php");
1531 // only for to upper case require_once("../utf8/utils/unicode.php");
1532 require_once ( UTF8_ASCII
);
1535 unset( $i ); unset( $j); unset( $utf8 ); // unset($_GET);
1536 // end of arguments imports
1538 header("Expires: ".gmdate("D, j M Y G:i:s \G\M\T", time()+
10800));
1539 header("Content-Disposition: attachment; filename=CAcert cap.pdf");
1540 header("Cache-Control: public, max-age=10800");
1541 header("Pragma: cache");
1542 // Content-Type and Content Length is done by tcpdf package
1544 // create new PDF document =====================================================
1546 /* PDF_PAGE_ORIENTATION */ $page['orientation'],
1548 /* PDF_PAGE_FORMAT */ $page['format'],
1551 $pdf->SetFormat( $page['format'] ); // set paper size scaling
1553 // protection is encryption and this will cause 3.5 times performance loss
1554 // $pdf->SetProtection(array('print', 'annot-forms'));
1556 // set document property information
1557 $pdf->SetCreator("LibreSSL - CAcert web application");
1558 $pdf->SetAuthor("© " . date("Y") . " CAcert Inc., Australia.");
1559 $pdf->SetKeywords("X.509, Organisation Assurance Programme, COAP form, digital certificates, CAcert, Community Agreement");
1560 $pdf->SetTitle("CAcert Organisation Assurance Programme");
1561 $pdf->SetSubject("COAP form V".$pdf->Version().", generated " . date("Y-n-j H:i:s T"));
1562 if( GET('watermark') != '') $pdf->Watermark
= my_recode(GET('watermark'));
1563 // requires zlib and will decrease response time but increase bandwidth
1564 // if no zlib is found, automatically no compression is done
1565 $pdf->SetCompression(true
); // turn it off when more pperformance is needed
1567 // AddSJISFont function is not present in tcpdf package !!!!
1569 //set auto page breaks
1570 $pdf->SetAutoPageBreak(TRUE
, MARGIN
*0.707);
1572 //set image scale factor
1573 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO
);
1575 //set some language-dependent strings
1576 $pdf->setLanguageArray($l);
1578 //initialize document
1579 $pdf->AliasNbPages();
1581 // AND GENERATE THE FORM ===================================
1582 // generation properties which have been set from environment:
1583 // BW (color), FONT (free Sans Vera), orientation (portrait, 1-up), format (A4)
1584 if ( FONT
== 'SJIS') $pdf->AddSJISFont();
1585 $pdf->PrintForm($organisation, $registry, $assurer, $page);
1586 $pdf->setViewerPreferences($pdf->ViewerPrefs
);
1588 //Close and output PDF document
1589 $pdf->Output("CAcert COAP.pdf", "I");
1591 //============================================================+
1593 //============================================================+