summaryrefslogtreecommitdiff
path: root/pages/wot/10.php
diff options
context:
space:
mode:
authorroot <root@cacert1.(none)>2010-04-26 10:57:00 +0200
committerMichael Tänzer <neo@nhng.de>2010-11-30 21:10:04 +0100
commit98f70ef22180480302cc4f07afa63a2675a71290 (patch)
tree6f17a694cb0ec6f8ac85b78ff5f4dc8943315984 /pages/wot/10.php
parent4145a1e31cf13340b417299f8a1fc87a90978d9d (diff)
downloadcacert-devel-98f70ef22180480302cc4f07afa63a2675a71290.tar.gz
cacert-devel-98f70ef22180480302cc4f07afa63a2675a71290.tar.xz
cacert-devel-98f70ef22180480302cc4f07afa63a2675a71290.zip
Show 'my points' in reverse order (newest points count, not oldest ones)
Needed for revoke of TTP-Assurances in November 2010 (cherry picked from commit 0bee978a0e84aedff45115e3f4e42af152cdfc4d)
Diffstat (limited to 'pages/wot/10.php')
-rw-r--r--pages/wot/10.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/pages/wot/10.php b/pages/wot/10.php
index 51ed019..4a6afac 100644
--- a/pages/wot/10.php
+++ b/pages/wot/10.php
@@ -57,17 +57,29 @@
<td class="DataTD"><b><?=_("Method")?></b></td>
</tr>
<?
- $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."'";
+ $points = 0;
+ $query = "select sum(points) as apoints from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `from`=`to` ";
+ $res = mysql_query($query);
+ $row = mysql_fetch_assoc($res);
+
+ $maxpoints=intval($_SESSION['profile']['points'])-$row['apoints'];
+
+ $points = 0;
+ $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."' order by `id` desc ";
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
+ $awarded = $row['awarded'];
+ if ($points+$awarded > $maxpoints)
+ $awarded = $maxpoints-$points;
+ $points = $points + $awarded;
$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"><?=$row['points']?></td>
+ <td class="DataTD"><?=$awarded?></td>
<td class="DataTD"><?=$row['location']?></td>
<td class="DataTD"><?=_(sprintf("%s", $row['method']))?></td>
</tr>
@@ -93,12 +105,12 @@
</tr>
<?
$points = 0;
- $query = "select * from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `to`!='".intval($_SESSION['profile']['id'])."'";
+ $query = "select * from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `to`!='".intval($_SESSION['profile']['id'])."' order by `id` desc";
$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'];
+ $points += $row['awarded'];
$name = trim($fromuser['fname']." ".$fromuser['lname']);
if($name == "")
$name = _("Deleted before Verification");
@@ -109,7 +121,7 @@
<td class="DataTD"><?=intval($row['id'])?></td>
<td class="DataTD"><?=$row['date']?></td>
<td class="DataTD"><?=$name?></td>
- <td class="DataTD"><?=intval($row['points'])?></td>
+ <td class="DataTD"><?=intval($row['awarded'])?></td>
<td class="DataTD"><?=$row['location']?></td>
<td class="DataTD"><?=$row['method']==""?"":_(sprintf("%s", $row['method']))?></td>
</tr>