summaryrefslogtreecommitdiff
path: root/includes/lib/general.php
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2013-01-16 05:03:11 +0100
committerBenny Baumann <BenBE@geshi.org>2013-01-16 05:03:11 +0100
commitaba34728a556c0e83658b91bf425d9e9d3d7af81 (patch)
tree9ad1fb27bd7de557343351c5adb10ae7d147925d /includes/lib/general.php
parent82dbce519b4a3abab2c2b2bd714ceb248542b941 (diff)
parent95f5aeb888e4ce1b9e66db3462fd23ad280a7e8d (diff)
downloadcacert-devel-aba34728a556c0e83658b91bf425d9e9d3d7af81.tar.gz
cacert-devel-aba34728a556c0e83658b91bf425d9e9d3d7af81.tar.xz
cacert-devel-aba34728a556c0e83658b91bf425d9e9d3d7af81.zip
Merge branch 'bug-512' into release
Diffstat (limited to 'includes/lib/general.php')
-rw-r--r--includes/lib/general.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/includes/lib/general.php b/includes/lib/general.php
index d91b24e..85b132d 100644
--- a/includes/lib/general.php
+++ b/includes/lib/general.php
@@ -130,3 +130,34 @@ function runCommand($command, $input = "", &$output = null, &$errors = true) {
}
}
+ // returns 0 if $userID is an Assurer
+ // Otherwise :
+ // Bit 0 is always set
+ // 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 get_assurer_status($userID)
+ {
+ $Result = 0;
+ $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;
+ }
+
+ $query = mysql_query('SELECT SUM(`points`) AS `points` FROM `notary` AS `n` WHERE `n`.`to` = \''.(int)intval($userID).'\' AND `n`.`expire` < now()');
+ $row = mysql_fetch_assoc($query);
+ if ($row['points'] < 100) {
+ $Result |= 3;
+ }
+
+ $query = mysql_query('SELECT `assurer_blocked` FROM `users` WHERE `id` = \''.(int)intval($userID).'\'');
+ $row = mysql_fetch_assoc($query);
+ if ($row['assurer_blocked'] > 0) {
+ $Result |= 9;
+ }
+
+ return $Result;
+ }
+ \ No newline at end of file