'".intval($no_of_assurances)."'"); return intval(query_get_number_of_rows($res)+1); } function get_top_assuree_position ($no_of_assurees) { $res = query_init ("SELECT count(*) AS `list` FROM `notary` WHERE `method` = 'Face to Face Meeting' and `deleted` = 0 GROUP BY `to` HAVING count(*) > '".intval($no_of_assurees)."'"); return intval(query_get_number_of_rows($res)+1); } /** * Get the list of assurances given by the user * @param int $userid - id of the assurer * @param int $log - if set to 1 also includes deleted assurances * @return resource - a MySQL result set */ function get_given_assurances($userid, $log=0) { $deleted=''; if ($log == 0) { $deleted = ' and `deleted` = 0 '; } $res = query_init("select * from `notary` where `from`='".intval($userid)."' and `from` != `to` $deleted order by `id` asc"); return $res; } /** * Get the list of assurances received by the user * @param int $userid - id of the assuree * @param int $log - if set to 1 also includes deleted assurances * @return resource - a MySQL result set */ function get_received_assurances($userid, $log=0) { $deleted=''; if ($log == 0) { $deleted = ' and `deleted` = 0 '; } $res = query_init("select * from `notary` where `to`='".intval($userid)."' and `from` != `to` $deleted order by `id` asc "); return $res; } function get_given_assurances_summary ($userid) { $res = query_init ("select count(*) as number,points,awarded,method from notary where `from`='".intval($userid)."' and `deleted` = 0 group by points,awarded,method"); return $res; } function get_received_assurances_summary ($userid) { $res = query_init ("select count(*) as number,points,awarded,method from notary where `to`='".intval($userid)."' and `deleted` = 0 group by points,awarded,method"); return $res; } function get_user ($userid) { $res = query_init ("select * from `users` where `id`='".intval($userid)."'"); return mysql_fetch_assoc($res); } function get_cats_state ($userid) { $res = query_init ("select * from `cats_passed` inner join `cats_variant` on `cats_passed`.`variant_id` = `cats_variant`.`id` and `cats_variant`.`type_id` = 1 WHERE `cats_passed`.`user_id` = '".intval($userid)."'"); return mysql_num_rows($res); } /** * Calculate awarded points (corrects some issues like out of range points * or points that were issued by means that have been deprecated) * * @param array $row - associative array containing the data from the * `notary` table * @return int - the awarded points for this assurance */ function calc_awarded($row) { // Back in the old days there was no `awarded` column => is now zero, // there the `points` column contained that data $points = max(intval($row['awarded']), intval($row['points'])); // Set negative points to zero, yes there are such things in the database $points = max($points, 0); switch ($row['method']) { // These programmes have been revoked case 'Thawte Points Transfer': // revoke all Thawte-points (as per arbitration) case 'CT Magazine - Germany': // revoke c't (only one test-entry) case 'Temporary Increase': // revoke 'temporary increase' (Current usage breaks audit aspects, needs to be reimplemented) $points = 0; break; case 'Administrative Increase': // ignore AI with 2 points or less (historical for experiance points, now other calculation) if ($points <= 2) // maybe limit to 35/50 pts in the future? $points = 0; break; // TTP assurances, limit to 35 case 'TTP-Assisted': $points = min($points, 35); break; // TTP TOPUP, limit to 30 case 'TOPUP': $points = min($points, 30); // All these should be preserved for the time being 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 '': // to be revoked in the future? limit to max 50 pts? case 'Face to Face Meeting': // normal assurances (and superassurances?), limit to 35/50 pts in the future? break; default: // should never happen ... ;-) $points = 0; } return $points; } /** * Calculate the experience points from a given Assurance * @param array $row - [inout] associative array containing the data from * the `notary` table, the keys 'experience' and 'calc_awarded' will be * added * @param int $sum_points - [inout] the sum of already counted assurance * points the assurer issued * @param int $sum_experience - [inout] the sum of already counted * experience points that were awarded to the assurer */ function calc_experience(&$row, &$sum_points, &$sum_experience) { $row['calc_awarded'] = calc_awarded($row); // Don't count revoked assurances even if we are displaying them if ($row['deleted'] !== NULL_DATETIME) { $row['experience'] = 0; return; } $experience = 0; if ($row['method'] == "Face to Face Meeting") { $experience = 2; } $sum_experience += $experience; $row['experience'] = $experience; $sum_points += $row['calc_awarded']; } /** * Calculate the points received from a received Assurance * @param array $row - [inout] associative array containing the data from * the `notary` table, the keys 'experience' and 'calc_awarded' will be * added * @param int $sum_points - [inout] the sum of already counted assurance * points the assuree received * @param int $sum_experience - [inout] the sum of already counted * experience points that were awarded to the assurer */ function calc_assurances(&$row, &$sum_points, &$sum_experience) { $row['calc_awarded'] = calc_awarded($row); $experience = 0; // High point values mean that some of them are experience points if ($row['calc_awarded'] > 100) { $experience = $row['calc_awarded'] - 100; // needs to be fixed in the future (limit 50 pts and/or no experience if pts > 100) $row['calc_awarded'] = 100; } switch ($row['method']) { case 'Thawte Points Transfer': case 'CT Magazine - Germany': case 'Temporary Increase': // Current usage of 'Temporary Increase' may break audit aspects, needs to be reimplemented $experience = 0; $row['deleted'] = THAWTE_REVOCATION_DATETIME; break; } // Don't count revoked assurances even if we are displaying them if ($row['deleted'] !== NULL_DATETIME) { $row['experience'] = 0; return; } $sum_experience += $experience; $row['experience'] = $experience; $sum_points += $row['calc_awarded']; } /** * Generate a link to the support engineer page for the user with the name * of the user as link text * @param array $user - associative array containing the data from the * `user` table * @return string */ function show_user_link($user) { $name = trim($user['fname'].' '.$user['lname']); $userid = intval($user['id']); if($name == "") { if ($userid == 0) { $name = _("System"); } else { $name = _("Deleted account"); } } else { $name = "".sanitizeHTML($name).""; } return $name; } /** * Generate a link to the support engineer page for the user with the email * address as link text * @param array $user - associative array containing the data from the * `user` table * @return string */ function show_email_link($user) { $email = trim($user['email']); if($email != "") { $email = "".sanitizeHTML($email).""; } return $email; } function get_assurer_ranking($userid,&$num_of_assurances,&$rank_of_assurer) { $num_of_assurances = get_number_of_assurances (intval($userid)); $rank_of_assurer = get_top_assurer_position($num_of_assurances); } function get_assuree_ranking($userid,&$num_of_assurees,&$rank_of_assuree) { $num_of_assurees = get_number_of_assurees (intval($userid)); $rank_of_assuree = get_top_assuree_position($num_of_assurees); } // ************* html table definitions ****************** function output_ranking($userid) { get_assurer_ranking($userid,$num_of_assurances,$rank_of_assurer); get_assuree_ranking($userid,$num_of_assurees,$rank_of_assuree); ?>

:   :  

"; $emclose=""; } } } ?> > > > > > >%s",_("Revoked")) : $awarded?> > > > > >');">

$max_points) // limit to 100 points, above is experience (needs to be fixed) { $sum_experience_other = $sum_experience_other+($points-$max_points)*intval($row['number']); $points = $max_points; } $sum_points += $points*intval($row['number']); } $res = get_given_assurances_summary($userid); while($row = mysql_fetch_assoc($res)) { switch ($row['method']) { case 'Face to Face Meeting': // count Face to Face only $sum_experience += 2*intval($row['number']); break; } } if ($sum_points > $max_points) { $sum_points_countable = $max_points; $remark_points = _("Limit reached"); } else { $sum_points_countable = $sum_points; $remark_points = " "; } if ($sum_experience > $max_experience) { $sum_experience_countable = $max_experience; $remark_experience = $experience_limit_reached_txt; } else { $sum_experience_countable = $sum_experience; $remark_experience = " "; } if ($sum_experience_countable + $sum_experience_other > $max_experience) { $sum_experience_other_countable = $max_experience-$sum_experience_countable; $remark_experience_other = $experience_limit_reached_txt; } else { $sum_experience_other_countable = $sum_experience_other; $remark_experience_other = " "; } if ($sum_points_countable < $max_points) { if ($sum_experience_countable != 0) $remark_experience = _("Points on hold due to less assurance points"); $sum_experience_countable = 0; if ($sum_experience_other_countable != 0) $remark_experience_other = _("Points on hold due to less assurance points"); $sum_experience_other_countable = 0; } $issue_points = 0; $cats_test_passed = get_cats_state ($userid); if ($cats_test_passed == 0) { $issue_points_txt = ""._("You have to pass the CAcert Assurer Challenge (CATS-Test) to be an Assurer").""; if ($sum_points_countable < $max_points) { $issue_points_txt = ""; $issue_points_txt .= sprintf(_("You need %s assurance points and the passed CATS-Test to be an Assurer"), intval($max_points)); $issue_points_txt .= ""; } } else { $experience_total = $sum_experience_countable+$sum_experience_other_countable; $issue_points_txt = ""; if ($sum_points_countable == $max_points) $issue_points = 10; if ($experience_total >= 10) $issue_points = 15; if ($experience_total >= 20) $issue_points = 20; if ($experience_total >= 30) $issue_points = 25; if ($experience_total >= 40) $issue_points = 30; if ($experience_total >= 50) $issue_points = 35; if ($issue_points != 0) $issue_points_txt = sprintf(_("You may issue up to %s points"),$issue_points); } if ($display_output) { output_summary_row (_("Assurance Points you received"),$sum_points,$sum_points_countable,$remark_points); output_summary_row (_("Total Experience Points by Assurance"),$sum_experience,$sum_experience_countable,$remark_experience); output_summary_row (_("Total Experience Points (other ways)"),$sum_experience_other,$sum_experience_other_countable,$remark_experience_other); output_summary_row (_("Total Points")," ",$sum_points_countable + $sum_experience_countable + $sum_experience_other_countable,$issue_points_txt); } return $issue_points; } /** * Render assurances given by the user * @param int $userid * @param int $support - set to 1 if the output is for the support interface * @param string $ticketno - the ticket number set in the support interface * @param int $log - if set to 1 also includes deleted assurances */ function output_given_assurances($userid, $support=0, $ticketno='', $log=0) { output_assurances_header( _("Assurance Points You Issued"), $support, $log); output_given_assurances_content( $userid, $sum_points, $sum_experience, $support, $ticketno, $log); output_assurances_footer( _("Total Points Issued"), $sum_points, _("Total Experience Points"), $sum_experience, $support, $log); } /** * Render assurances received by the user * @param int $userid * @param int $support - set to 1 if the output is for the support interface * @param string $ticketno - the ticket number set in the support interface * @param int $log - if set to 1 also includes deleted assurances */ function output_received_assurances($userid, $support=0, $ticketno='', $log=0) { output_assurances_header( _("Assurance Points You Received"), $support, $log); output_received_assurances_content( $userid, $sum_points, $sum_experience, $support, $ticketno, $log); output_assurances_footer( _("Total Points Received"), $sum_points, _("Total Experience Points"), $sum_experience, $support, $log); } function output_summary($userid) { output_summary_header(); output_summary_content($userid,1); output_summary_footer(); } function output_end_of_page() { ?>

[ ]

mixed) - an associative array containing * 'document', 'date', 'method', 'comment', 'active' */ function get_first_user_agreement($memid, $type=null, $active=null){ $filter = ''; if (!is_null($type)) { $filter .= " AND u.`document` = '".mysql_real_escape_string($type)."'"; } if (!is_null($active)) { $filter .= " AND u.`active` = ".intval($active); } $query="SELECT u.`document`, u.`date`, u.`method`, u.`comment`, u.`active` FROM `user_agreements` AS u WHERE u.`memid`=".intval($memid)." $filter ORDER BY u.`date` LIMIT 1"; $res = mysql_query($query); if(mysql_num_rows($res) >0){ $rec = mysql_fetch_assoc($res); }else{ $rec=array(); } return $rec; } /** * Get the last user_agreement entry of the requested type * @param int $memid * @param string $type - the type of user agreement, by default all * agreements are listed * @param int $active - whether to get active or passive agreements: * 0 := passive, * 1 := active, * null := both * @return array(string=>mixed) - an associative array containing * 'document', 'date', 'method', 'comment', 'active' */ function get_last_user_agreement($memid, $type=null, $active=null){ $filter = ''; if (!is_null($type)) { $filter .= " AND u.`document` = '".mysql_real_escape_string($type)."'"; } if (!is_null($active)) { $filter .= " AND u.`active` = ".intval($active); } $query="SELECT u.`document`, u.`date`, u.`method`, u.`comment`, u.`active` FROM `user_agreements` AS u WHERE u.`memid`=".intval($memid)." $filter ORDER BY u.`date` DESC LIMIT 1"; $res = mysql_query($query); if(mysql_num_rows($res) >0){ $rec = mysql_fetch_assoc($res); }else{ $rec=array(); } return $rec; } /** * Get the all user_agreement entries of the requested type * @param int $memid * @param string $type - the type of user agreement, by default all * agreements are listed * @param int $active - whether to get an active or passive agreements: * 0 := passive, * 1 := active, * null := both * @return resource - a mysql result set containing all agreements */ function get_user_agreements($memid, $type=null, $active=null){ $filter = ''; if (!is_null($type)) { $filter .= " AND u.`document` = '".mysql_real_escape_string($type)."'"; } if (!is_null($active)) { $filter .= " AND u.`active` = ".intval($active); } $query="SELECT u.`document`, u.`date`, u.`method`, u.`comment`, u.`active` FROM `user_agreements` AS u WHERE u.`memid`=".intval($memid)." $filter ORDER BY u.`date`"; return mysql_query($query); } /** * delete_user_agreement() * deletes all entries for a given type from user_agreement of a given user, if type is not given all * @param mixed $memid * @param string $type * @return */ function delete_user_agreement($memid, $type=false){ if ($type === false) { $filter = ''; } else { $filter = " and `document` = '" . mysql_real_escape_string($type) . "'"; } mysql_query("delete from `user_agreements` where `memid`=" . intval($memid) . $filter ); } // functions for 6.php (assure somebody) function AssureHead($confirmation,$checkname) { ?>
>

" />
0; } function check_gpg_cert_running($uid,$cca=0){ //if $cca =0 if just expired, =1 if CCA retention +3 month should be obeyed // called from includes/account.php if($oldid == 50 && $process != "") $uid = intval($uid); if (0==$cca) { $query = "select 1 from `gpg` where `memid`='$uid' and `expire`>NOW()"; }else{ $query = "select 1 from `gpg` where `memid`='$uid' and `expire`>( SUBDATE( NOW(), 90 ))"; } $res = mysql_query($query); return mysql_num_rows($res) > 0; } function check_client_cert_running($uid,$cca=0){ //if $cca =0 if just expired, =1 if CCA retention +3 month should be obeyed // called from includes/account.php if($oldid == 50 && $process != "") $uid = intval($uid); if (0==$cca) { $query1 = "select 1 from `emailcerts` where `memid`='$uid' and `expire`>NOW() and `revoked`<`created`"; $query2 = "select 1 from `emailcerts` where `memid`='$uid' and `revoked`>NOW()"; }else{ $query1 = "select 1 from `emailcerts` where `memid`='$uid' and `expire`>( SUBDATE( NOW(), 90 )) and `revoked`<`created`"; $query2 = "select 1 from `emailcerts` where `memid`='$uid' and `revoked`>( SUBDATE( NOW(), 90 ))"; } $res = mysql_query($query1); $r1 = mysql_num_rows($res)>0; $res = mysql_query($query2); $r2 = mysql_num_rows($res)>0; return !!($r1 || $r2); } function check_server_cert_running($uid,$cca=0){ //if $cca =0 if just expired, =1 if CCA retention +3 month should be obeyed // called from includes/account.php if($oldid == 50 && $process != "") $uid = intval($uid); if (0==$cca) { $query1 = " select 1 from `domaincerts` join `domains` on `domaincerts`.`domid` = `domains`.`id` where `domains`.`memid` = '$uid' and `domaincerts`.`expire` > NOW() and `domaincerts`.`revoked` < `domaincerts`.`created`"; $query2 = " select 1 from `domaincerts` join `domains` on `domaincerts`.`domid` = `domains`.`id` where `domains`.`memid` = '$uid' and `revoked`>NOW()"; }else{ $query1 = " select 1 from `domaincerts` join `domains` on `domaincerts`.`domid` = `domains`.`id` where `domains`.`memid` = '$uid' and `expire`>( SUBDATE( NOW(), 90 )) and `revoked`<`created`"; $query2 = " select 1 from `domaincerts` join `domains` on `domaincerts`.`domid` = `domains`.`id` where `domains`.`memid` = '$uid' and `revoked`>( SUBDATE( NOW(), 90 ))"; } $res = mysql_query($query1); $r1 = mysql_num_rows($res)>0; $res = mysql_query($query2); $r2 = mysql_num_rows($res)>0; return !!($r1 || $r2); } function check_is_orgadmin($uid){ // called from includes/account.php if($oldid == 50 && $process != "") $uid = intval($uid); $query = "select 1 from `org` where `memid`='$uid' and `deleted`=0"; $res = mysql_query($query); return mysql_num_rows($res) > 0; } // revokation of certificates function revoke_all_client_cert($mailid){ //revokes all client certificates for an email address $mailid = intval($mailid); $query = "select `emailcerts`.`id` from `emaillink`,`emailcerts` where `emaillink`.`emailid`='$mailid' and `emaillink`.`emailcertsid`=`emailcerts`.`id` and `emailcerts`.`revoked`=0 group by `emailcerts`.`id`"; $dres = mysql_query($query); while($drow = mysql_fetch_assoc($dres)){ mysql_query("update `emailcerts` set `revoked`='1970-01-01 10:00:01', `disablelogin`=1 where `id`='".$drow['id']."'"); } } function revoke_all_server_cert($domainid){ //revokes all server certs for an domain $domainid = intval($domainid); $query = "select `domaincerts`.`id` from `domaincerts` where `domaincerts`.`domid` = '$domainid' union distinct select `domaincerts`.`id` from `domaincerts`, `domlink` where `domaincerts`.`id` = `domlink`.`certid` and `domlink`.`domid` = '$domainid'"; $dres = mysql_query($query); while($drow = mysql_fetch_assoc($dres)) { mysql_query( "update `domaincerts` set `revoked`='1970-01-01 10:00:01' where `id` = '".$drow['id']."' and `revoked` = 0"); } } function revoke_all_private_cert($uid){ //revokes all certificates linked to a personal accounts //gpg revokation needs to be added to a later point $uid=intval($uid); $query = "select `id` from `email` where `memid`='".$uid."'"; $res=mysql_query($query); while($row = mysql_fetch_assoc($res)){ revoke_all_client_cert($row['id']); } $query = "select `id` from `domains` where `memid`='".$uid."'"; $res=mysql_query($query); while($row = mysql_fetch_assoc($res)){ revoke_all_server_cert($row['id']); } } /** * check_date_format() * checks if the date is entered in the right date format YYYY-MM-DD and * if the date is after the 1st January of the given year * * @param mixed $date * @param integer $year * @return */ function check_date_format($date, $year=2000){ if (!strpos($date,'-')) { return FALSE; } $arr=explode('-',$date); if ((count($arr)!=3)) { return FALSE; } if (intval($arr[0])<=$year) { return FALSE; } if (intval($arr[1])>12 or intval($arr[1])<=0) { return FALSE; } if (intval($arr[2])>31 or intval($arr[2])<=0) { return FALSE; } return checkdate( intval($arr[1]), intval($arr[2]), intval($arr[0])); } /** * check_date_difference() * returns false if the date is larger then today + time diffrence * * @param mixed $date * @param integer $diff * @return */ function check_date_difference($date, $diff=1){ return (strtotime($date)<=time()+$diff*86400); } /** * Write some information to the adminlog * * @param int $uid - id of the user account * @param int $adminid - id of the admin * @param string $type - the operation that was performed on the user account * @param string $info - the ticket / arbitration number or other information * @return bool - true := success, false := error */ function write_se_log($uid, $adminid, $type, $info){ //records all support engineer actions changing a user account $uid = intval($uid); $adminid = intval($adminid); $type = mysql_real_escape_string($type); $info = mysql_real_escape_string($info); $query="insert into `adminlog` (`when`, `uid`, `adminid`,`type`,`information`) values (Now(), $uid, $adminid, '$type', '$info')"; return mysql_query($query); } /** * Check if the entered information is a valid ticket or arbitration number * @param string $ticketno * @return bool */ function valid_ticket_number($ticketno){ //a arbitration case //d dispute action //s support case //m board motion $pattern='/[adsmADSM]\d{8}\.\d+/'; if (preg_match($pattern, $ticketno)) { return true; } return false; } // function for handling account/43.php /** * Get all data of an account given by the id from the `users` table * @param int $userid - account id * @param int $deleted - states if deleted data should be visible , default = 0 - not visible * @return resource - a mysql result set */ function get_user_data($userid, $deleted=0){ $userid = intval($userid); $filter=''; if (0==$deleted) { $filter .=' and `users`.`deleted`=0'; } $query = "select * from `users` where `users`.`id`='$userid' ".$filter; return mysql_query($query); } /** * Get the alert settings for a user * @param int $userid for the requested account * @return array - associative array */ function get_alerts($userid){ return mysql_fetch_assoc(mysql_query("select * from `alerts` where `memid`='".intval($userid)."'")); } /** * Get all email addresses linked to the account * @param int $userid * @param string $exclude - if given the email address will be excluded * @param int $deleted - states if deleted data should be visible, default = 0 - not visible * @return resource - a mysql result set */ function get_email_addresses($userid, $exclude, $deleted=0){ //should be entered in account/2.php $userid = intval($userid); $filter=''; if (0==$deleted) { $filter .= ' and `deleted`=0'; } if ($exclude) { $filter .= " and `email`!='".mysql_real_escape_string($exclude)."'"; } $query = "select * from `email` where `memid`='".$userid."' and `hash`='' ".$filter." order by `created`"; return mysql_query($query); } /** * Get all domains linked to the account * @param int $userid * @param int $deleted - states if deleted data should be visible, default = 0 - not visible * @return resource - a mysql result set */ function get_domains($userid, $deleted=0){ //should be entered in account/9.php $userid = intval($userid); $filter=''; if (0==$deleted) { $filter .= ' and `deleted`=0'; } $query = "select * from `domains` where `memid`='".$userid."' and `hash`=''".$filter." order by `created`"; return mysql_query($query); } /** * Get all training results for the account * @param int $userid * @return resource - a mysql result set */ function get_training_results($userid){ //should be entered in account/55.php $userid = intval($userid); $query = "SELECT `CP`.`pass_date`, `CT`.`type_text`, `CV`.`test_text` ". " FROM `cats_passed` AS CP, `cats_variant` AS CV, `cats_type` AS CT ". " WHERE `CP`.`variant_id`=`CV`.`id` AND `CV`.`type_id`=`CT`.`id` AND `CP`.`user_id` ='".$userid."'". " ORDER BY `CP`.`pass_date`"; return mysql_query($query); } /** * Get all SE log entries for the account * @param int $userid * @return resource - a mysql result set */ function get_se_log($userid){ $userid = intval($userid); $query = "SELECT `adminlog`.`when`, `adminlog`.`type`, `adminlog`.`information`, `users`.`fname`, `users`.`lname` FROM `adminlog`, `users` WHERE `adminlog`.`adminid` = `users`.`id` and `adminlog`.`uid`=".$userid." ORDER BY `adminlog`.`when`"; return mysql_query($query); } /** * Get all client certificates linked to the account * @param int $userid * @param int $viewall - states if expired certs should be visible, default = 0 - not visible * @return resource - a mysql result set */ function get_client_certs($userid, $viewall=0){ //add to account/5.php $userid = intval($userid); $query = "select UNIX_TIMESTAMP(`emailcerts`.`created`) as `created`, UNIX_TIMESTAMP(`emailcerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`, UNIX_TIMESTAMP(`emailcerts`.`expire`) as `expired`, `emailcerts`.`expire`, `emailcerts`.`revoked` as `revoke`, UNIX_TIMESTAMP(`emailcerts`.`revoked`) as `revoked`, `emailcerts`.`id`, `emailcerts`.`CN`, `emailcerts`.`serial`, `emailcerts`.`disablelogin`, `emailcerts`.`description` from `emailcerts` where `emailcerts`.`memid`='".$userid."'"; if($viewall == 0) { $query .= " AND `emailcerts`.`revoked`=0 AND `emailcerts`.`renewed`=0"; $query .= " HAVING `timeleft` > 0"; } $query .= " ORDER BY `emailcerts`.`modified` desc"; return mysql_query($query); } /** * Get all server certs linked to the account * @param int $userid * @param int $viewall - states if expired certs should be visible, default = 0 - not visible * @return resource - a mysql result set */ function get_server_certs($userid, $viewall=0){ //add to account/12.php $userid = intval($userid); $query = "select UNIX_TIMESTAMP(`domaincerts`.`created`) as `created`, UNIX_TIMESTAMP(`domaincerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`, UNIX_TIMESTAMP(`domaincerts`.`expire`) as `expired`, `domaincerts`.`expire`, `domaincerts`.`revoked` as `revoke`, UNIX_TIMESTAMP(`revoked`) as `revoked`, `domaincerts`.`CN`, `domaincerts`.`serial`, `domaincerts`.`id`, `domaincerts`.`description` from `domaincerts`,`domains` where `domains`.`memid`='".$userid."' and `domaincerts`.`domid`=`domains`.`id`"; if($viewall == 0) { $query .= " AND `domaincerts`.`revoked`=0 AND `domaincerts`.`renewed`=0"; $query .= " HAVING `timeleft` > 0"; } $query .= " ORDER BY `domaincerts`.`modified` desc"; return mysql_query($query); } /** * Get all gpg certs linked to the account * @param int $userid * @param int $viewall - states if expired certs should be visible, default = 0 - not visible * @return resource - a mysql result set */ function get_gpg_certs($userid, $viewall=0){ //add to gpg/2.php $userid = intval($userid); $query = $query = "select UNIX_TIMESTAMP(`issued`) as `issued`, UNIX_TIMESTAMP(`expire`) - UNIX_TIMESTAMP() as `timeleft`, UNIX_TIMESTAMP(`expire`) as `expired`, `expire`, `id`, `level`, `email`, `keyid`, `description` from `gpg` where `memid`='".$userid."'"; if ($viewall == 0) { $query .= " HAVING `timeleft` > 0"; } $query .= " ORDER BY `issued` desc"; return mysql_query($query); } /** * Show the table header to the email table for the admin log */ function output_log_email_header(){ ?> 0) { $verified = _("Valid"); } else { $verified = _("Expired"); } if ($row['expired'] == 0) { $verified = _("Pending"); } if ($row['revoked'] == 0) { $row['revoke'] = _("Not Revoked"); } else { $verified = _("Revoked"); } ?>   /> 0) { $verified = _("Valid"); } else { $verified = _("Expired"); } if ($row['expired'] == 0) { $verified = _("Pending"); } if ($row['revoked'] == 0) { $row['revoke'] = _("Not Revoked"); } else { $verified = _("Revoked"); } ?>   0) { $verified = _("Valid"); } else { $verified = _("Expired"); } if ($row['expired'] == 0) { $verified = _("Pending"); } ?>