diff options
author | Michael Tänzer <neo@nhng.de> | 2013-02-13 00:00:20 +0100 |
---|---|---|
committer | Michael Tänzer <neo@nhng.de> | 2013-02-13 00:00:20 +0100 |
commit | f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec (patch) | |
tree | 7dc4cf61bbb5c204875910c33680fc69392ce542 /includes | |
parent | 861aaeff82307087364e397d9b9256cb74c04ca1 (diff) | |
download | cacert-f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec.tar.gz cacert-f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec.tar.xz cacert-f7484beb1ecc6d7d8cf8d31eee792bd4ba540aec.zip |
Source code taken from cacert-20130129.tar.bz2
Diffstat (limited to 'includes')
-rw-r--r-- | includes/general.php | 35 | ||||
-rw-r--r-- | includes/lib/general.php | 31 | ||||
-rw-r--r-- | includes/wot.inc.php | 2 |
3 files changed, 37 insertions, 31 deletions
diff --git a/includes/general.php b/includes/general.php index 3478dd4..d762586 100644 --- a/includes/general.php +++ b/includes/general.php @@ -15,6 +15,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + + require_once(dirname(__FILE__)."/lib/general.php"); + session_name("cacert"); session_start(); @@ -725,37 +728,7 @@ return($text); } - // 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; - } - + // returns text message to be shown to the user given the result of is_no_assurer function no_assurer_text($Status) { 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 diff --git a/includes/wot.inc.php b/includes/wot.inc.php index edc442a..6b3bcc8 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -364,6 +364,8 @@ break; case 'Unknown': // to be revoked in the future? limit to max 50 pts? case 'Trusted Third Parties': // to be revoked in the future? limit to max 35 pts? + case 'TTP-Assisted': // TTP assurances, limit to 35 + case 'TOPUP': // TOPUP to be delevoped in the future, limit to 30 case '': // to be revoked in the future? limit to max 50 pts? case 'Face to Face Meeting': // normal assurances, limit to 35/50 pts in the future? break; |