From 8c702e67919146c1a2e61b25d3609c4c32d987e0 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Tue, 19 Nov 2013 22:53:49 +0100 Subject: bug 1221: changed delete assurance to update "deleted = NOW()", added `deleted` = 0 to all queries on notary --- includes/notary.inc.php | 18 +++++++++--------- pages/account/43.php | 10 +++++----- pages/wot/10.php | 14 +++++++------- pages/wot/15.php | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/includes/notary.inc.php b/includes/notary.inc.php index 1f0ec92..8868d62 100644 --- a/includes/notary.inc.php +++ b/includes/notary.inc.php @@ -35,7 +35,7 @@ function get_number_of_assurances ($userid) { $res = query_init ("SELECT count(*) AS `list` FROM `notary` - WHERE `method` = 'Face to Face Meeting' AND `from`='".intval($userid)."' "); + WHERE `method` = 'Face to Face Meeting' AND `from`='".intval($userid)."' and `deleted` = 0"); $row = query_getnextrow($res); return intval($row['list']); @@ -44,7 +44,7 @@ function get_number_of_ttpassurances ($userid) { $res = query_init ("SELECT count(*) AS `list` FROM `notary` - WHERE (`method`='Trusted Third Parties' or `method`='TTP-Assisted') AND `to`='".intval($userid)."' "); + WHERE (`method`='Trusted Third Parties' or `method`='TTP-Assisted') AND `to`='".intval($userid)."' and `deleted` = 0"); $row = query_getnextrow($res); return intval($row['list']); @@ -53,7 +53,7 @@ function get_number_of_assurees ($userid) { $res = query_init ("SELECT count(*) AS `list` FROM `notary` - WHERE `method` = 'Face to Face Meeting' AND `to`='".intval($userid)."' "); + WHERE `method` = 'Face to Face Meeting' AND `to`='".intval($userid)."' and `deleted` = 0"); $row = query_getnextrow($res); return intval($row['list']); @@ -62,7 +62,7 @@ function get_top_assurer_position ($no_of_assurances) { $res = query_init ("SELECT count(*) AS `list` FROM `notary` - WHERE `method` = 'Face to Face Meeting' + WHERE `method` = 'Face to Face Meeting' and `deleted` = 0 GROUP BY `from` HAVING count(*) > '".intval($no_of_assurances)."'"); return intval(query_get_number_of_rows($res)+1); } @@ -70,32 +70,32 @@ function get_top_assuree_position ($no_of_assurees) { $res = query_init ("SELECT count(*) AS `list` FROM `notary` - WHERE `method` = 'Face to Face Meeting' + WHERE `method` = 'Face to Face Meeting' and `deleted` = 0 GROUP BY `to` HAVING count(*) > '".intval($no_of_assurees)."'"); return intval(query_get_number_of_rows($res)+1); } function get_given_assurances ($userid) { - $res = query_init ("select * from `notary` where `from`='".intval($userid)."' and `from` != `to` order by `id` asc"); + $res = query_init ("select * from `notary` where `from`='".intval($userid)."' and `from` != `to` and `deleted` = 0 order by `id` asc"); return $res; } function get_received_assurances ($userid) { - $res = query_init ("select * from `notary` where `to`='".intval($userid)."' and `from` != `to` order by `id` asc "); + $res = query_init ("select * from `notary` where `to`='".intval($userid)."' and `from` != `to` and `deleted` = 0 order by `id` asc "); return $res; } function get_given_assurances_summary ($userid) { - $res = query_init ("select count(*) as number,points,awarded,method from notary where `from`='".intval($userid)."' group by points,awarded,method"); + $res = query_init ("select count(*) as number,points,awarded,method from notary where `from`='".intval($userid)."' and `deleted` = 0 group by points,awarded,method"); return $res; } function get_received_assurances_summary ($userid) { - $res = query_init ("select count(*) as number,points,awarded,method from notary where `to`='".intval($userid)."' group by points,awarded,method"); + $res = query_init ("select count(*) as number,points,awarded,method from notary where `to`='".intval($userid)."' and `deleted` = 0 group by points,awarded,method"); return $res; } diff --git a/pages/account/43.php b/pages/account/43.php index 53b24d3..a81d9a3 100644 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -23,11 +23,11 @@ include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php"); { $assurance = mysql_escape_string(intval($_REQUEST['assurance'])); $row = 0; - $res = mysql_query("select `to` from `notary` where `id`='$assurance'"); + $res = mysql_query("select `to` from `notary` where `id`='$assurance' and `deleted` = 0"); if ($res) { $row = mysql_fetch_assoc($res); } - mysql_query("delete from `notary` where `id`='$assurance'"); + mysql_query("update `notary` set `deleted`=NOW() where `id`='$assurance'"); if ($row) { fix_assurer_flag($row['to']); } @@ -108,7 +108,7 @@ include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php"); echo _("I'm sorry, the user you were looking for seems to have disappeared! Bad things are a foot!"); } else { $row = mysql_fetch_assoc($res); - $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($row['id'])."'"; + $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($row['id'])."' and `deleted` = 0"; $dres = mysql_query($query); $drow = mysql_fetch_assoc($dres); $alerts = mysql_fetch_assoc(mysql_query("select * from `alerts` where `memid`='".intval($row['id'])."'")); @@ -828,7 +828,7 @@ function showassuredto() - '$rc' ORDER BY `notary`.`when` DESC"; */ - $query = "SELECT count(*) AS `list` FROM `users` - inner join `notary` on `users`.`id` = `notary`.`from` + $query = "SELECT count(*) AS `list` FROM `users` + inner join `notary` on `users`.`id` = `notary`.`from` GROUP BY `notary`.`from` HAVING count(*) > '$rc'"; $rank = mysql_num_rows(mysql_query($query)) + 1; @@ -64,11 +64,11 @@ @@ -114,11 +114,11 @@ if ($thawte)