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