ea7a384e1d3da3fbd3b78dbbc7c6537a1e4747e0
[cacert-devel.git] / pages / wot / 9.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 require_once($_SESSION['_config']['filepath'].'/includes/lib/l10n.php');
20
21
22 $res = mysqli_query($_SESSION['mconn'], "select * from `users` where `id`='".intval($_REQUEST['userid'])."' and `listme`='1'");
23 if(mysqli_num_rows($res) <= 0)
24 {
25 echo _("Sorry, I was unable to locate that user, the person doesn't wish to be contacted, or isn't an assurer.");
26 } else {
27
28 $user = mysqli_fetch_array($res);
29 $userlang = L10n::normalise_translation($user['language']);
30 $points = mysqli_num_rows(mysqli_query($_SESSION['mconn'], "select sum(`points`) as `total` from `notary`
31 where `to`='".intval($user['id'])."' and `deleted`=0 group by `to` HAVING SUM(`points`) > 0"));
32 if($points <= 0) {
33 echo _("Sorry, I was unable to locate that user.");
34 } else {
35
36 $_SESSION['_config']['pagehash'] = md5(date("U"));
37 ?>
38 <? if($_SESSION['_config']['error'] != "") { ?><font color="#ff0000" size="+1">ERROR: <?=$_SESSION['_config']['error']?></font><? unset($_SESSION['_config']['error']); } ?>
39 <form method="post" action="wot.php">
40 <input type="hidden" name="userid" value="<?=intval($user['id'])?>">
41 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
42 <tr>
43 <td colspan="2" class="title"><?=_("Contact Assurer")?></td>
44 </tr>
45 <tr>
46 <td class="DataTD"><?=_("To")?>:</td>
47 <td class="DataTD" align="left"><?=sanitizeHTML(trim($user['fname'].' '.substr($user['lname'], 0, 1)))?></td>
48 </tr>
49 <? if($userlang != "") { ?>
50 <tr>
51 <td class="DataTD"><?=_("Language")?>:</td>
52 <td class="DataTD" align="left"><? printf(_("%s prefers to be contacted in %s"), sanitizeHTML($user['fname']), L10n::$translations[$userlang]) ?></td>
53 </tr>
54 <? } ?>
55 <?
56 $query = "select * from `addlang` where `userid`='".intval($user['id'])."'";
57 $res = mysqli_query($_SESSION['mconn'], $query);
58 while($row = mysqli_fetch_assoc($res))
59 {
60 $lang = mysqli_fetch_assoc(mysqli_query($_SESSION['mconn'], "select * from `languages` where `locale`='".mysqli_real_escape_string($_SESSION['mconn'], $row['lang'])."'"));
61 ?>
62 <tr>
63 <td class="DataTD"><?=_("Additional Language")?>:</td>
64 <td class="DataTD" align="left"><? printf(_("%s will also accept email in %s - %s"), sanitizeHTML($user['fname']), $lang['lang'], $lang['country']) ?></td>
65 </tr>
66 <? } ?>
67 <tr>
68 <td class="DataTD"><?=_("Subject")?>:</td>
69 <td class="DataTD" align="left"><input type="text" name="subject" value="<?=sanitizeHTML($_POST['subject'])?>"></td>
70 </tr>
71 <tr>
72 <td class="DataTD"><?=_("Message")?>:</td>
73 <td class="DataTD"><textarea name="message" cols="40" rows="5" wrap="virtual"><?=sanitizeHTML($_POST['message'])?></textarea></td>
74 </tr>
75 <tr>
76 <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Send")?>"></td>
77 </tr>
78 </table>
79 <input type="hidden" name="pageid" value="<?=$_SESSION['_config']['pagehash']?>">
80 <input type="hidden" name="userid" value="<?=intval($_REQUEST['userid'])?>">
81 <input type="hidden" name="oldid" value="<?=intval($id)?>">
82 </form>
83 <p>[ <a href='javascript:history.go(-1)'><?=_("Go Back")?></a> ]</p>
84 <? } } ?>