summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2010-11-30 21:40:53 +0100
committerMichael Tänzer <neo@nhng.de>2010-11-30 21:40:53 +0100
commitb4f0fda3e0d389a1ea8bb5f8b90fb3f49b5ef54e (patch)
treed45ad0c9c52265e227159e1f6229bdfacec5f2bd
parent4145a1e31cf13340b417299f8a1fc87a90978d9d (diff)
downloadcacert-devel-bug-837.tar.gz
cacert-devel-bug-837.tar.xz
cacert-devel-bug-837.zip
add patch based on https://bugs.cacert.org/view.php?id=837 to test systembug-837
(cherry picked from commit dfc1cd7da14294904b6782f9fe92541a29322773) Conflicts: pages/wot/10.php
-rw-r--r--pages/wot/10.php31
1 files changed, 11 insertions, 20 deletions
diff --git a/pages/wot/10.php b/pages/wot/10.php
index 51ed019..746dbb9 100644
--- a/pages/wot/10.php
+++ b/pages/wot/10.php
@@ -23,20 +23,13 @@
</tr>
<tr>
<?
- $query = "SELECT `users`. *, count(*) AS `list` FROM `users`, `notary`
- WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to`
- AND `from`='".intval($_SESSION['profile']['id'])."' GROUP BY `notary`.`from`";
+ $query = "SELECT COUNT(1) as `assurances` FROM `notary` WHERE `from`=".intval($_SESSION['profile']['id'])." AND `from` != `to`";
+
$res = mysql_query($query);
$row = mysql_fetch_assoc($res);
- $rc = intval($row['list']);
-/*
- $query = "SELECT `users`. *, count(*) AS `list` FROM `users`, `notary`
- WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to`
- GROUP BY `notary`.`from` HAVING count(*) > '$rc' ORDER BY `notary`.`when` DESC";
-*/
- $query = "SELECT count(*) AS `list` FROM `users`
- inner join `notary` on `users`.`id` = `notary`.`from`
- GROUP BY `notary`.`from` HAVING count(*) > '$rc'";
+ $rc = intval($row['assurances']);
+
+ $query = "SELECT COUNT(1) FROM `notary` GROUP BY `from` HAVING COUNT(1) > {$rc}";
$rank = mysql_num_rows(mysql_query($query)) + 1;
?>
@@ -57,16 +50,15 @@
<td class="DataTD"><b><?=_("Method")?></b></td>
</tr>
<?
- $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."'";
+ $query = "SELECT n.`id`, n.`date`, n.`points`, n.`from` as `from_id`, u.`fname` AS `from_fname`, u.`lname` AS `from_lname`, n.`location`, n.`method` FROM `notary` n LEFT JOIN `users` u ON n.`from`=u.`id` WHERE n.`to`=".intval($_SESSION['profile']['id'])." ORDER BY n.`when` ASC, n.`id` ASC";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
- $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'"));
?>
<tr>
<td class="DataTD"><?=$row['id']?></td>
<td class="DataTD"><?=$row['date']?></td>
- <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['from'])?>"><?=$fromuser['fname']." ".$fromuser['lname']?></td>
+ <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['from_id'])?>"><?=$row['from_fname']." ".$row['from_lname']?></td>
<td class="DataTD"><?=$row['points']?></td>
<td class="DataTD"><?=$row['location']?></td>
<td class="DataTD"><?=_(sprintf("%s", $row['method']))?></td>
@@ -93,17 +85,16 @@
</tr>
<?
$points = 0;
- $query = "select * from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `to`!='".intval($_SESSION['profile']['id'])."'";
+ $query = "SELECT n.`id`, n.`date`, n.`points`, n.`location`, n.`method`, n.`to` AS `to_id`, u.`fname` AS `to_fname`, u.`lname` AS `to_lname` FROM `notary` n LEFT JOIN `users` u ON n.`to`=u.`id` WHERE n.`from`=".intval($_SESSION['profile']['id'])." AND n.`to`!=".intval($_SESSION['profile']['id'])." ORDER BY n.`when` ASC, n.`id` ASC";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
- $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['to'])."'"));
$points += $row['points'];
- $name = trim($fromuser['fname']." ".$fromuser['lname']);
+ $name = trim($row['to_fname']." ".$row['to_lname']);
if($name == "")
- $name = _("Deleted before Verification");
+ $name = '<i>'._("Deleted before Verification").'</i>';
else
- $name = "<a href='wot.php?id=9&amp;userid=".intval($row['to'])."'>$name</a>";
+ $name = "<a href='wot.php?id=9&amp;userid=".intval($row['to_id'])."'>$name</a>";
?>
<tr>
<td class="DataTD"><?=intval($row['id'])?></td>