summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Fröhlich <bernhard@cacert.org>2011-05-09 23:35:03 +0200
committerBernhard Fröhlich <bernhard@cacert.org>2011-05-09 23:35:03 +0200
commit70333fec47ea19a5c994a03675fd69f7e74853dc (patch)
tree2bac5a1ac006feb2cdf80713417bbd874081d26b
parenta3d7949c04a06539a8a0982968f711b7832d8672 (diff)
downloadcacert-devel-70333fec47ea19a5c994a03675fd69f7e74853dc.tar.gz
cacert-devel-70333fec47ea19a5c994a03675fd69f7e74853dc.tar.xz
cacert-devel-70333fec47ea19a5c994a03675fd69f7e74853dc.zip
Fix for bug 942, untested. Compare the changes to function fix_assurer_flag in general.php
-rw-r--r--scripts/assurer.php2
-rw-r--r--www/cats/cats_import.php5
2 files changed, 5 insertions, 2 deletions
diff --git a/scripts/assurer.php b/scripts/assurer.php
index c649fbf..d85a2a6 100644
--- a/scripts/assurer.php
+++ b/scripts/assurer.php
@@ -30,7 +30,7 @@
$query = "
select u.email, fname, lname, sum(n.points) from users u, notary n
where n.to=u.id
- and not exists(select 1 from cats_passed cp where cp.user_id=u.id)
+ and not EXISTS(SELECT 1 FROM `cats_passed` AS `tp`, `cats_variant` AS `cv` WHERE `tp`.`variant_id` = `cv`.`id` AND `cv`.`type_id` = 1 AND `tp`.`user_id` = `u`.`id`)
and exists(select 1 from notary n2 where n2.from=u.id and year(n2.`when`)>2007)
and (select count(*) from notary n3 where n3.from=u.id) > 1
group by email, fname, lname
diff --git a/www/cats/cats_import.php b/www/cats/cats_import.php
index 6d77a75..7662fce 100644
--- a/www/cats/cats_import.php
+++ b/www/cats/cats_import.php
@@ -154,7 +154,10 @@ if (!$query) {
}
// Update Assurer-Flag on users table if 100 points. Should the number of points be SUM(points) or SUM(awarded)?
-$query = mysql_query('UPDATE `users` AS `u` SET `assurer` = 1 WHERE `u`.`id` = \''.(int)intval($userID).'\' AND EXISTS(SELECT 1 FROM `cats_passed` AS `tp` WHERE `tp`.`user_id` = `u`.`id`) AND (SELECT SUM(`points`) FROM `notary` AS `n` WHERE `n`.`to` = `u`.`id` AND `expire` < now()) >= 100;'); // Challenge has been passed and non-expired points >= 100
+$query = mysql_query('UPDATE `users` AS `u` SET `assurer` = 1 '.
+ 'WHERE `u`.`id` = \''.(int)intval($userID).'\' '.
+ 'AND EXISTS(SELECT 1 FROM `cats_passed` AS `tp`, `cats_variant` AS `cv` WHERE `tp`.`variant_id` = `cv`.`id` AND `cv`.`type_id` = 1 AND `tp`.`user_id` = `u`.`id`) '.
+ 'AND (SELECT SUM(`points`) FROM `notary` AS `n` WHERE `n`.`to` = `u`.`id` AND `expire` < now()) >= 100;'); // Challenge has been passed and non-expired points >= 100
if (!$query) {
echo 'Invalid query'."\r\n";
trigger_error('Invalid query', E_USER_ERROR);