2008-04-25 12:33:36 +00:00
< ? /*
LibreSSL - CAcert web application
Copyright ( C ) 2004 - 2008 CAcert Inc .
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; version 2 of the License .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA
*/ ?>
< ?
2008-09-28 22:18:44 +00:00
if ( $_SESSION [ 'profile' ][ 'admin' ] != 1 || ! array_key_exists ( 'userid' , $_REQUEST ) || intval ( $_REQUEST [ 'userid' ]) < 1 ) {
2008-05-11 15:14:49 +00:00
$user_id = intval ( $_SESSION [ 'profile' ][ 'id' ]);
2008-04-25 12:33:36 +00:00
?>
< table align = " center " valign = " middle " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " class = " wrapper " >
< tr >
< td colspan = " 5 " class = " title " >< ? = _ ( " Your passed Tests " ) ?> </td>
</ tr >
< tr >
2009-06-08 21:11:55 +00:00
< td class = " DataTD " >< ? = _ ( " The list of tests you did pass at " ) . ' <a href="https://cats.cacert.org/">https://cats.cacert.org/</a>' ?> </td>
2008-04-25 12:33:36 +00:00
</ tr >
</ table >
2008-05-11 15:14:49 +00:00
< ?
} else {
$user_id = intval ( $_REQUEST [ 'userid' ]);
2008-09-03 17:43:31 +00:00
$query = " select * from `users` where `id`=' $user_id ' and `users`.`deleted`=0 " ;
2008-05-11 15:14:49 +00:00
$res = mysql_query ( $query );
if ( mysql_num_rows ( $res ) <= 0 )
{
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 );
}
?>
< table align = " center " valign = " middle " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " class = " wrapper " >
< tr >
2009-06-08 21:11:55 +00:00
< td colspan = " 5 " class = " title " >< ? = _ ( " Passed Tests of " ) . " " . sanitizeHTML ( $row [ 'fname' ]) . " " . sanitizeHTML ( $row [ 'mname' ]) . " " . sanitizeHTML ( $row [ 'lname' ]) ?> </td>
2008-05-11 15:14:49 +00:00
</ tr >
</ table >
< ?
}
?>
2008-04-25 12:33:36 +00:00
< br >
< table align = " center " valign = " middle " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " class = " wrapper " >
< tr >
< td class = " DataTD " >< b >< ? = _ ( " Date " ) ?> </b></td>
< td class = " DataTD " >< b >< ? = _ ( " Test " ) ?> </b></td>
< td class = " DataTD " >< b >< ? = _ ( " Variant " ) ?> </b></td>
</ tr >
< ?
$query = " SELECT `CP`.`pass_date`, `CT`.`type_text`, `CV`.`test_text` " .
" FROM `cats_passed` AS CP, `cats_variant` AS CV, `cats_type` AS CT " .
2008-05-11 15:14:49 +00:00
" WHERE `CP`.`variant_id`=`CV`.`id` AND `CV`.`type_id`=`CT`.`id` AND `CP`.`user_id` =' " . ( int ) $user_id . " ' " .
2008-04-25 12:33:36 +00:00
" ORDER BY `CP`.`pass_date` " ;
$res = mysql_query ( $query );
$HaveTest = 0 ;
while ( $row = mysql_fetch_array ( $res , MYSQL_NUM ))
{
if ( $row [ 1 ] == " Assurer Challenge " ) {
$HaveTest = 1 ;
}
?>
< tr >
< td class = " DataTD " >< ? = $row [ 0 ] ?> </td>
< td class = " DataTD " >< ? = $row [ 1 ] ?> </td>
< td class = " DataTD " >< ? = $row [ 2 ] ?> </td>
</ tr >
< ? }
?>
</ table >
< br >
< table align = " center " valign = " middle " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " class = " wrapper " >
< tr >
< ?
2008-09-28 22:18:44 +00:00
if ( $_SESSION [ 'profile' ][ 'admin' ] == 1 && array_key_exists ( 'userid' , $_REQUEST ) && intval ( $_REQUEST [ 'userid' ]) > 0 ) {
2008-05-11 15:14:49 +00:00
?>
2008-09-03 17:43:31 +00:00
< tr >< td colspan = " 3 " class = " DataTD " >< a href = " account.php?id=43&userid=<?= $user_id ?> " > back </ a ></ td ></ tr >
2008-05-11 15:14:49 +00:00
< ? } else {
2008-04-25 12:33:36 +00:00
$query = 'SELECT `u`.id, `u`.`assurer`, SUM(`points`) FROM `users` AS `u`, `notary` AS `n` ' .
' WHERE `u`.`id` = \'' . ( int ) intval ( $_SESSION [ 'profile' ][ 'id' ]) . '\' AND `n`.`to` = `u`.`id` AND `expire` < now() ' .
' GROUP BY `u`.id, `u`.`assurer`' ;
$res = mysql_query ( $query );
2008-09-28 22:18:44 +00:00
if ( ! $res ) {
2008-04-25 12:33:36 +00:00
print '<td colspan="3" class="DataTD">' . _ ( 'Internal Error' ) . '</td>' . " \n " ;
} else {
$row = mysql_fetch_array ( $res , MYSQL_NUM );
2009-04-07 17:00:46 +00:00
if ( $HaveTest && ( $row [ 2 ] >= 100 )) {
if ( ! $row [ 1 ]) {
// This should not happen...
fix_assurer_flag ( $_SESSION [ 'profile' ][ 'id' ]);
}
2008-04-25 12:33:36 +00:00
?> <td colspan="3" class="DataTD"><?=_("You have passed the Assurer Challenge and collected at least 100 Assurance Points, you are an Assurer.")?></td>
< ? } elseif (( $row [ 2 ] >= 100 ) && ! $HaveTest ) {
2009-06-14 20:10:53 +00:00
?> <td colspan="3" class="DataTD"><?=_("You have at least 100 Assurance Points, if you want to become an assurer try the ").'<a href="https://cats.cacert.org">'._("Assurer Challenge").'</a>!'?></td>
2008-04-25 12:33:36 +00:00
< ? } elseif ( $HaveTest && ( $row [ 2 ] < 100 )) {
?> <td colspan="3" class="DataTD"><?=_("You have passed the Assurer Challenge, but to become an Assurer you still have to reach 100 Assurance Points!")?></td>
< ? }
}
2008-05-11 15:14:49 +00:00
}
2009-04-07 17:00:46 +00:00
?> </tr>
2008-04-25 12:33:36 +00:00
</ table >