Revert "bug-1280: Handle more different types of "languages":"
[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`='".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 <?
53 $parts = explode("_", $userlang ,2);
54 $printlang = strtolower($parts[0]);
55 ?>
56 <td class="DataTD" align="left"><? printf(_("%s prefers to be contacted in %s"), sanitizeHTML($user['fname']), L10n::$translations[$printlang]) ?></td>
57 </tr>
58 <? } ?>
59 <?
60 $query = "select * from `addlang` where `userid`='".intval($user['id'])."'";
61 $res = mysql_query($query);
62 while($row = mysql_fetch_assoc($res))
63 {
64 $lang = mysql_fetch_assoc(mysql_query("select * from `languages` where `locale`='".mysql_real_escape_string($row['lang'])."'"));
65 ?>
66 <tr>
67 <td class="DataTD"><?=_("Additional Language")?>:</td>
68 <td class="DataTD" align="left"><? printf(_("%s will also accept email in %s - %s"), sanitizeHTML($user['fname']), sanitizeHTML($lang['lang']), sanitizeHTML($lang['country'])) ?></td>
69 </tr>
70 <? } ?>
71 <tr>
72 <td class="DataTD"><?=_("Subject")?>:</td>
73 <td class="DataTD" align="left"><input type="text" name="subject" value="<?=sanitizeHTML($_POST['subject'])?>"></td>
74 </tr>
75 <tr>
76 <td class="DataTD"><?=_("Message")?>:</td>
77 <td class="DataTD"><textarea name="message" cols="40" rows="5" wrap="virtual"><?=sanitizeHTML($_POST['message'])?></textarea></td>
78 </tr>
79 <tr>
80 <td class="DataTD" colspan="2"><input type="submit" name="process" value="<?=_("Send")?>"></td>
81 </tr>
82 </table>
83 <input type="hidden" name="pageid" value="<?=$_SESSION['_config']['pagehash']?>">
84 <input type="hidden" name="userid" value="<?=intval($_REQUEST['userid'])?>">
85 <input type="hidden" name="oldid" value="<?=intval($id)?>">
86 </form>
87 <p>[ <a href='javascript:history.go(-1)'><?=_("Go Back")?></a> ]</p>
88 <? } } ?>