Merge branch 'bug-1394' into testserver-stable
[cacert-devel.git] / pages / wot / 16.php
1 <?php
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
19 //******************* TTP Console ************
20
21 if ($_SESSION['profile']['ttpadmin'] < 1) {
22 echo _("You are not allowed to view this page.");
23 exit;
24 }
25
26 //Check for test or productive environment, in case of test the user data for the print out is extended by 'test system'
27 $testserver='';
28 if ($_SESSION['_config']['normalhostname']=='cacert1.it-sls.de') {
29 $testserver=' test system';
30 }
31
32 $row = $_SESSION['_config']['notarise'];
33 $fname = $row['fname'];
34 $mname = $row['mname'];
35 $lname = $row['lname'];
36 $suffix = $row['suffix'];
37 $fullname = $fname." ".$mname." ".$lname." ".$suffix;
38 $email = $row['email'];
39 $dob = date_format(new DateTime($row['dob']), 'Y-m-d');
40 $userid = $row['id'];
41
42 //List TTP Assurances and TotalPoints
43 //changed get_received_assurances ($userid, $support)
44
45 //include_once($_SESSION['_config']['filepath']."/includes/wot.inc.php");
46 include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php");
47
48 output_received_assurances(intval($userid),2); //support==2 => TTP
49
50
51 $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($userid)."'";
52 $dres = mysql_query($query);
53 $drow = mysql_fetch_assoc($dres);
54
55 $points=$drow['points'];
56 if ($points<1) {
57 $points=0;
58 }
59
60 $res = get_received_assurances(intval($userid), 2);
61 $ttp_assurances_count=$num_rows = mysql_num_rows($res);
62
63 //Form
64 ?>
65 <table align="center" class="wrapper">
66 <tr>
67 <td class="title"><?=sprintf(_('Total assurance points for %s'),$fullname)?></td>
68 </tr>
69 <tr>
70 <td><?=sprintf(_('%s points'), $points)?></td>
71 </tr>
72 </table>
73 <br/>
74 <form action="https://pdf.cacert.eu/cacertpdf.php" method="get" accept-charset="UTF-8">
75 <table align="center" class="wrapper">
76 <tr>
77 <td colspan="2" class="title"><?= _('TTP CAP form creation')?></td>
78 </tr>
79 <tr>
80 <td colspan="2" class="title"><?= _('User information')?></td>
81 </tr>
82 <tr>
83 <td><?=_('Fullname')?><input type="hidden" name="fullname" value="<?=$fullname.$testserver?>"/></td>
84 <td><?=$fullname?></td>
85 </tr>
86 <tr>
87 <td><?=_('Date of Birth')?><input type="hidden" name="dob" value="<?=$dob.$testserver?>"/></td>
88 <td><?=$dob?></td>
89 </tr>
90 <tr>
91 <td><?=_('Email')?><input type="hidden" name="email" value="<?=$email.$testserver?>"/></td>
92 <td><?=$email?></td>
93 </tr>
94 <tr></tr>
95 <tr>
96 <td><?=_('Country where the TTP will be visited')?></td>
97 <td>
98 <?
99 $ttpcountries=get_array_from_ini('../config/ttp.ini');
100 echo create_selectbox_HTML('type',$ttpcountries, '',TRUE);
101 ?>
102 </td>
103 </tr>
104 <tr>
105 <td colspan="2" class="title"><?=_('TTP Admin postal address, including name, street, country etc.')?></td>
106 </tr>
107 <tr>
108 <td><?=_('Line').' 1'?></td>
109 <td><input type="text" name="adress" /></td>
110 </tr>
111 <tr>
112 <td><?=_('Line').' 2'?></td>
113 <td><input type="text" name="adress1" /></td>
114 </tr>
115 <tr>
116 <td><?=_('Line').' 3'?></td>
117 <td><input type="text" name="adress2" /></td>
118 </tr>
119 <tr>
120 <td><?=_('Line').' 4'?></td>
121 <td><input type="text" name="adress3" /></td>
122 </tr>
123 <tr>
124 <td><?=_('Line').' 5'?></td>
125 <td><input type="text" name="adress4" /></td>
126 </tr>
127 <tr>
128 <td colspan="2" class="title">
129 <?
130 if ($points>=100 || $ttp_assurances_count>=2) {
131 echo _('No TTP assurance allowed');
132 }else{
133 ?><input type="submit" value="<?=_('Create TTP CAP pdf file')?>"/><?
134 }?>
135 </td>
136 </tr>
137 </table>
138 <input type="hidden" name="lang" value="en"/>
139 </form>
140
141 <div class="blockcenter">
142 <a href="wot.php?id=6&amp;userid=<?=$userid ?>"><?=_("Back")?></a>
143 </div>