<h3onclick="explode('WoT')">+ <?=_("CAcert Web of Trust")?></h3>
<ulclass="menu"id="WoT"><li><ahref="wot.php?id=0"><?=_("About")?></a></li><li><ahref="wot.php?id=12"><?=_("Find an Assurer")?></a></li><li><ahref="wot.php?id=3"><?=_("Rules")?></a></li><li><?if($_SESSION['profile']['points']<100){?><ahref="wot.php?id=2"><?=_("Becoming an Assurer")?></a><?}else{?><ahref="wot.php?id=5"><?=_("Assure Someone")?></a><?}?></li><li><ahref="wot.php?id=4"><?=_("Trusted ThirdParties")?></a></li><?if($_SESSION['profile']['points']>=500){?><li><ahref="wot.php?id=11"><divstyle="white-space:nowrap"><?=_("Organisation Assurance")?></div></a></li><?}?><li><ahref="account.php?id=55"><?=_("Training")?></a></li></ul>
<ulclass="menu"id="WoT"><li><ahref="wot.php?id=0"><?=_("About")?></a></li><li><ahref="wot.php?id=12"><?=_("Find an Assurer")?></a></li><li><ahref="wot.php?id=3"><?=_("Rules")?></a></li><li><?if($_SESSION['profile']['assurer']!=1){?><ahref="wot.php?id=2"><?=_("Becoming an Assurer")?></a><?}else{?><ahref="wot.php?id=5"><?=_("Assure Someone")?></a><?}?></li><li><ahref="wot.php?id=4"><?=_("Trusted ThirdParties")?></a></li><?if($_SESSION['profile']['points']>=500){?><li><ahref="wot.php?id=11"><divstyle="white-space:nowrap"><?=_("Organisation Assurance")?></div></a></li><?}?><li><ahref="account.php?id=55"><?=_("Training")?></a></li></ul>
// Update Assurer-Flag on users table if 100 points. Should the number of points be SUM(points) or SUM(awarded)?
// Note: If other tests are implemented an additional restriction for cats_passed would be needed here...
$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
'\' 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
// Reset flag if requirements are not met
$query = mysql_query('UPDATE `users` AS `u` SET `assurer` = 0 WHERE `u`.`id` = \''.(int)intval($userID).
'\' AND (NOT EXISTS(SELECT 1 FROM `cats_passed` AS `tp` WHERE `tp`.`user_id` = `u`.`id`)'.
' OR (SELECT SUM(`points`) FROM `notary` AS `n` WHERE `n`.`to` = `u`.`id` AND `n`.`expire` <now())<100)');
'\' 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`)'.
' OR (SELECT SUM(`points`) FROM `notary` AS `n` WHERE `n`.`to` = `u`.`id` AND `n`.`expire` <now())<100)');
}
// returns 0 if $userID is an Assurer
@ -845,12 +844,11 @@
// Bit 1 is set if 100 Assurance Points are not reached
// Bit 2 is set if Assurer Test is missing
// Bit 3 is set if the user is not allowed to be an Assurer (assurer_blocked > 0)
function is_no_assurer($userID)
function get_assurer_status($userID)
{
$Result = 0;
// Note: If other tests are implemented an additional restriction for cats_passed would be needed here...
$query = mysql_query('SELECT * FROM `cats_passed` AS `tp` WHERE `tp`.`user_id` = \''.(int)intval($userID).'\'');
$query = mysql_query('SELECT * FROM `cats_passed` AS `tp`, `cats_variant` AS `cv` '.
' WHERE `tp`.`variant_id` = `cv`.`id` AND `cv`.`type_id` = 1 AND `tp`.`user_id` = \''.(int)intval($userID).'\'');
if(mysql_num_rows($query) <1)
{
$Result |= 5;
@ -883,13 +881,25 @@
} elseif ($Status == 7) {
$Result = _("To become an Assurer have to collect 100 Assurance Points and pass the ").'<ahref="https://cats.cacert.org/">Assurer Challenge</a>!';
} elseif ($Status & 8 > 0) {
$Result = _("Sorry, you are not allowed to be an Assurer. Please contact ").'<ahref="mailto:support@cacert.org">support@cacert.org</a>'._(" if you feel that this is not corect.");
$Result = _("Sorry, you are not allowed to be an Assurer. Please contact ").'<ahref="mailto:cacert-support@lists.cacert.org">cacert-support@lists.cacert.org</a>'._(" if you feel that this is not corect.");
} else {
$Result = _("You are not an Assurer, but the reason is not stored in the database. Please contact ").'<ahref="mailto:support@cacert.org">support@cacert.org</a>.';
$Result = _("You are not an Assurer, but the reason is not stored in the database. Please contact ").'<ahref="mailto:cacert-support@lists.cacert.org">cacert-support@lists.cacert.org</a>.';