bug 1138: Whitespace changes and code formatting
[cacert-devel.git] / pages / account / 52.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
19 if($_SESSION['profile']['tverify'] <= 0) {
20 echo _("You don't have access to this area.");
21 } else {
22 $uid = intval($_GET['uid']);
23 $query = "select * from `tverify` where `id`='".intval($uid)."' and `modified`=0";
24 $res = mysql_query($query);
25 if(mysql_num_rows($res) > 0) {
26 $row = mysql_fetch_assoc($res);
27 $memid = intval($row['memid']);
28
29 $query2 = "select * from `tverify-vote` where `tverify`='".intval($uid)."' and `memid`='".intval($_SESSION['profile']['id'])."'";
30 $rc2 = mysql_num_rows(mysql_query($query2));
31 if($rc2 > 0) {
32 showheader(_("My CAcert.org Account!"));
33 echo _("You have already voted on this request.");
34 showfooter();
35 exit;
36 }
37
38 $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($memid)."' and `deleted` = 0";
39 $notary = mysql_fetch_assoc(mysql_query($query));
40 $query = "select * from `users` where `id`='".intval($memid)."'";
41 $user = mysql_fetch_assoc(mysql_query($query));
42 $tobe = 50 - $notary['points'];
43 if($row['URL'] != '' && $row['photoid'] != '') {
44 $tobe = 150 - $notary['points'];
45 } else if($row['URL'] != '') {
46 $tobe = 90 - $notary['points'];
47 }
48 if(intval($tobe) <= 0) {
49 $tobe = 0;
50 }
51 ?>
52 <?=_("Request Details")?>:<br>
53 <?=_("Name on file")?>: <?=sanitizeHTML($user['fname']." ".$user['mname']." ".$user['lname']." ".$user['suffix'])?><br>
54 <?=_("Primary email address")?>: <?=sanitizeHTML($user['email'])." (".intval($user['id']).")"?><br>
55 <?=_("Certificate Subject")?>: <?=sanitizeHTML($row['CN'])?><br>
56 <? if($row['URL'] != '') { ?>
57 <?=_("Notary URL")?>: <a href="<?=$row['URL']?>"><?=$row['URL']?></a><br>
58 <? } ?>
59 <? if($row['photoid'] != '') { ?>
60 <?=_("Photo ID URL")?>: <a href="/account.php?id=51&amp;photoid=<?=intval($row['id'])?>"><?=_("Here")?></a><br>
61 <? } ?>
62 <?=_("Current Points")?>: <?=intval($notary['points'])?><br>
63 <?=_("Potential Points")?>: <?=intval($tobe)?><br>
64 <?=_("Date of Birth")?>: <?=$user['dob']?> (YYYY-MM-DD)<br>
65
66 <br>
67 <form method="post" action="account.php">
68 <?=_("Comment")?>: <input type="text" name="comment"><br>
69 <input type="submit" name="agree" value="<?=_("I agree with this Application")?>">
70 <input type="submit" name="disagree" value="<?=_("I don't agree with this Application")?>">
71 <input type="hidden" name="oldid" value="<?=intval($_GET['id'])?>">
72 <input type="hidden" name="uid" value="<?=intval($uid)?>">
73 </form>
74 <?
75 } else {
76 $query = "select * from `tverify` where `id`='".intval($uid)."' and `modified`=1";
77 $res = mysql_query($query);
78 if(mysql_num_rows($res) > 0) {
79 echo _("This UID has already been voted on.")."<br/>";
80 } else {
81 if($uid) echo _("Unable to locate a valid request for that UID.")."<br/>";
82 }
83
84 // Search for open requests:
85 $query = "select * from `tverify` where `modified`=0";
86 $res = mysql_query($query);
87 if(mysql_num_rows($res) > 0) {
88 echo "<br/>"._("The following requests are still open:")."<br/><ul>";
89 while($row = mysql_fetch_assoc($res)) {
90 $uid=intval($row['id']);
91 $query3 = "select * from `tverify-vote` where `tverify`='".intval($uid)."' and `memid`='".intval($_SESSION['profile']['id'])."'";
92 $rc3 = mysql_num_rows(mysql_query($query3));
93 if($rc3 <= 0)
94 {
95 echo "<li><a href='account.php?id=52&amp;uid=".intval($row['id'])."'>".intval($row['id'])."</a></li>\n";
96 }
97 }
98 echo "</ul>\n<br>\n";
99 } else {
100 echo "<br/>"._("There are no pending requests where you haven't voted yet.");
101 }
102 }
103 }
104
105 ?>