diff options
-rw-r--r-- | includes/notary.inc.php | 124 | ||||
-rw-r--r-- | pages/account/18.php | 4 | ||||
-rw-r--r-- | pages/account/22.php | 71 |
3 files changed, 172 insertions, 27 deletions
diff --git a/includes/notary.inc.php b/includes/notary.inc.php index 337d8d5..03bf92e 100644 --- a/includes/notary.inc.php +++ b/includes/notary.inc.php @@ -1342,7 +1342,7 @@ function output_orgclientcert_table_header($orgname){ <? } -function output_orgclient_table_row($verified, $row, $support = 0){ +function output_orgclientcert_table_row($verified, $row, $support = 0){ ?> <tr> <td class="DataTD"><?=$row['ou']?></td> @@ -1379,7 +1379,7 @@ function output_orgclient_table_row($verified, $row, $support = 0){ <? } -function output_orgclient_table_footer($support = 0){ +function output_orgclientcert_table_footer($support = 0){ ?> <tr> <td class="DataTD" colspan="11"> @@ -1397,3 +1397,123 @@ function output_orgclient_table_footer($support = 0){ </tr> <? } } + + +function output_orgservercerts_data($orgadminid = 0, $orgfilterid = 0, $sorting, $status){ + $query = "select UNIX_TIMESTAMP(`orgdomaincerts`.`created`) as `created`, + UNIX_TIMESTAMP(`orgdomaincerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`, + UNIX_TIMESTAMP(`orgdomaincerts`.`expire`) as `expired`, + `orgdomaincerts`.`expire` as `expires`, `revoked` as `revoke`, + UNIX_TIMESTAMP(`revoked`) as `revoked`, `CN`, + `orgdomaincerts`.`serial`, + `orgdomaincerts`.`id` as `id`, + `orgdomaincerts`.`description`, `orginfo`.`O`, + `cu`.`fname` as cfname, `cu`.`lname` as clname , + `ru`.`fname` as rfname, `ru`.`lname` as rlname + from `org`, `orginfo`, `orgdomaincerts` + left join users as `cu` on `orgdomaincerts`.`orgadminid` = `cu`.`id` + left join users as `ru` on `orgdomaincerts`.`revokeorgadminid` = `ru`.`id` + where `org`.`orgid`=`orgdomaincerts`.`orgid` and `orginfo`.`id` = `org`.`orgid` "; + + if($orgadminid > 0) + { + $query .= "AND `org`.`memid` = $orgadminid "; + } + + if($orgfilterid > 0) + { + $query .= "AND `org`.`orgid` = $orgfilterid "; + } + + if(0 == $status) + { + $query .= "AND `oemail`.`revoked`=0 AND `orgdomaincerts`.`renewed`=0 "; + $query .= "HAVING `timeleft` > 0 AND `revoked`=0 "; + } + switch ($sorting){ + case 0: + $query .= "ORDER BY `orginfo`.`O`, `orgdomaincerts`.`expire` desc"; + break; + case 1: + $query .= "ORDER BY `orginfo`.`O`, `orgdomaincerts`.`CN`, `orgdomaincerts`.`expire` desc"; + break; + } + return mysql_query($query); +} + +function output_orgservercert_table_header($orgname){ + ?> + <tr> + <td colspan="10" class="title"></td> + </tr> + <tr> + <td colspan="10" class="title"><? printf(_("Certificates for %s"), $orgname)?> </td> + </tr> + <tr> + <td class="DataTD"><?=_("Renew/Revoke/Delete")?></td> + <td class="DataTD"><?=_("Status")?></td> + <td class="DataTD"><?=_("CommonName")?></td> + <td class="DataTD"><?=_("SerialNumber")?></td> + <td class="DataTD"><?=_("Created by")?></td> + <td class="DataTD"><?=_("Revoked")?></td> + <td class="DataTD"><?=_("Revoked by")?></td> + <td class="DataTD"><?=_("Expires")?></td> + <td colspan="2" class="DataTD"><?=_("Comment *")?></td> + </tr> + <? +} + +function output_orgservercert_table_row($verified, $row, $support = 0){ + ?> + <tr> + <? if($verified == _("Valid") || $verified == _("Expired")) { ?> + <td class="DataTD"><input type="checkbox" name="revokeid[]" value="<?=$row['id']?>"></td> + <td class="DataTD"><?=$verified?></td> + <td class="DataTD"><a href="account.php?id=23&cert=<?=$row['id']?>"><?=$row['CN']?></a></td> + <? } elseif($support == 1) { ?> + <td class="DataTD"> </td> + <td class="DataTD"><?=$verified?></td> + <td class="DataTD"><?=$row['CN']?></td> + <? } else if($verified == _("Pending")) { ?> + <td class="DataTD"><input type="checkbox" name="delid[]" value="<?=$row['id']?>"></td> + <td class="DataTD"><?=$verified?></td> + <td class="DataTD"><?=$row['CN']?></td> + <? } else { ?> + <td class="DataTD"> </td> + <td class="DataTD"><?=$verified?></td> + <td class="DataTD"><a href="account.php?id=23&cert=<?=$row['id']?>"><?=$row['CN']?></a></td> + <? } ?> + <td class="DataTD"><?=$row['serial']?></td> + <td class="DataTD"><?=$row['cfname'] . ' ' . $row['clname']?></td> + <td class="DataTD"><?=$row['revoke']?></td> + <td class="DataTD"><?=$row['rfname'] . ' ' . $row['rlname']?></td> + <td class="DataTD"><?=$row['expires']?></td> + <? if($support == 1) { ?> + <td class="DataTD"><?=htmlspecialchars($row['description'])?></td> + <td class="DataTD"> </td> + <? } else { ?> + <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td> + <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td> + <? } ?> + </tr> + <? +} + +function output_orgservercert_table_footer($support = 0){ + ?> + <tr> + <td class="DataTD" colspan="10"> + <?=_('* Comment is NOT included in the certificate as it is intended for your personal reference only. To change the comment tick the checkbox and hit "Change Settings".')?> + </td> + </tr> + <? if ($support == 0) { ?> + <tr> + <td class="DataTD" colspan="7"><input type="submit" name="renew" value="<?=_("Renew")?>">     + <input type="submit" name="revoke" value="<?=_("Revoke/Delete")?>"></td> + <td class="DataTD" colspan="3"><input type="submit" name="change" value="<?=_("Change settings")?>"> </td> + </tr> + <tr> + <td class="DataTD" colspan="10"><?=_("From here you can delete pending requests, or revoke valid certificates.")?></td> + </tr> + <? } +} diff --git a/pages/account/18.php b/pages/account/18.php index 445f25b..123eca1 100644 --- a/pages/account/18.php +++ b/pages/account/18.php @@ -188,7 +188,7 @@ $status = array_key_exists('status',$_SESSION['_config']) ? intval($_SESSION['_c <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td> </tr> <? } ?> */ - output_orgclient_table_row($verified, $row, 0); + output_orgclientcert_table_row($verified, $row, 0); } /*?> <tr> @@ -205,7 +205,7 @@ $status = array_key_exists('status',$_SESSION['_config']) ? intval($_SESSION['_c <td class="DataTD" colspan="9"><?=_("From here you can delete pending requests, or revoke valid certificates.")?></td> </tr> <? } ?>*/ - output_orgclient_table_footer(0); + output_orgclientcert_table_footer(0); } ?> diff --git a/pages/account/22.php b/pages/account/22.php index 0413da0..c909394 100644 --- a/pages/account/22.php +++ b/pages/account/22.php @@ -23,14 +23,14 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ <form method="post" action="account.php"> <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper"> <tr> - <td colspan="8" class="title"><?=_("Organisation Server Certificates")?> </td> + <td colspan="10" class="title"><?=_("Organisation Server Certificates")?> </td> </tr> <tr> - <td colspan="8" class="title"><?=_("Filter/Sorting")?></td> + <td colspan="10" class="title"><?=_("Filter/Sorting")?></td> </tr> <tr> <td class="DataTD"><?=_("Organisation")?></td> - <td colspan="7" class="DataTD" > + <td colspan="9" class="DataTD" > <select name="dorgfilterid"> <?=sprintf('<option value="%d"%s>%s</option>',0, 0 == $orgfilterid ? " selected" : "" ,_("All")) ?> <? $query = "select `orginfo`.`O`, `orginfo`.`id` @@ -48,7 +48,7 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ </tr> <tr> <td class="DataTD"><?=_("Sorting")?></td> - <td colspan="7" class="DataTD" > + <td colspan="9" class="DataTD" > <select name="dsorting"> <?=sprintf('<option value="%d"%s>%s</option>',0, 0 == $sorting ? " selected" : "" ,_("expire date (desc)")) ?> <?=sprintf('<option value="%d"%s>%s</option>',1, 1 == $sorting ? " selected" : "" ,_("Common name, expire date (desc)")) ?> @@ -57,7 +57,7 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ </tr> <tr> <td class="DataTD"><?=_("Certificate status")?></td> - <td colspan="7" class="DataTD" > + <td colspan="9" class="DataTD" > <select name="dstatus"> <?=sprintf('<option value="%d"%s>%s</option>',0, 0 == $status ? " selected" : "" ,_("Current/Active")) ?> <?=sprintf('<option value="%d"%s>%s</option>',1, 1 == $status ? " selected" : "" ,_("All")) ?> @@ -69,11 +69,12 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ <input type="submit" name="filter" value="<?=_("Apply filter/sort")?>" /></td> </tr> <tr> - <td colspan="9" class="DataTD"> </td> + <td colspan="10" class="DataTD"> </td> </tr> <? +/* $query = "select UNIX_TIMESTAMP(`orgdomaincerts`.`created`) as `created`, UNIX_TIMESTAMP(`orgdomaincerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`, UNIX_TIMESTAMP(`orgdomaincerts`.`expire`) as `expired`, @@ -108,6 +109,8 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ //echo $query."<br>\n"; $res = mysql_query($query); +*/ + $res = output_orgservercerts_data(intval($_SESSION['profile']['id']), $orgfilterid, $sorting, $status); if(mysql_num_rows($res) <= 0) { ?> @@ -116,10 +119,12 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ </tr> <? } else { $orgname=''; - while($row = mysql_fetch_assoc($res)) - { - if ($row['O']<>$orgname) { - $orgname=$row['O'];?> + while($row = mysql_fetch_assoc($res)) + { + if ($row['O']<>$orgname) { + $orgname=$row['O']; +/* + ?> <tr> <td colspan="9" class="title"></td> </tr> @@ -136,17 +141,29 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ <td colspan="2" class="DataTD"><?=_("Comment *")?></td> </tr> <? - } - if($row['timeleft'] > 0) - $verified = _("Valid"); - if($row['timeleft'] < 0) - $verified = _("Expired"); - if($row['expired'] == 0) - $verified = _("Pending"); - if($row['revoked'] > 0) - $verified = _("Revoked"); - if($row['revoked'] == 0) - $row['revoke'] = _("Not Revoked"); +*/ + output_orgservercert_table_header($orgname); + } + + if($row['timeleft'] > 0) + $verified = _("Valid"); + if($row['timeleft'] < 0) + $verified = _("Expired"); + if($row['expired'] == 0) + $verified = _("Pending"); + if($row['revoked'] > 0) + $verified = _("Revoked"); + if($row['revoked'] == 0) + $row['revoke'] = _("Not revoked"); + if(!$row['cfname'] && !$row['clname']){ + $row['cfname'] = _("Not recorded"); + $row['clname'] = ''; + } + if($row['revoked'] > 0 && (!$row['rfname'] && !$row['rlname'])){ + $row['rfname'] = _("Not recorded"); + $row['rlname'] = ''; + } +/* ?> <tr> <? if($verified == _("Valid") || $verified == _("Expired")) { ?> @@ -164,7 +181,12 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td> <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td> </tr> -<? } ?> +<? +*/ + output_orgservercert_table_row($verified, $row, 0); + } +/* +?> <tr> <td class="DataTD" colspan="8"> <?=_('* Comment is NOT included in the certificate as it is intended for your personal reference only. To change the comment tick the checkbox and hit "Change Settings".')?> @@ -178,7 +200,10 @@ $status = array_key_exists('dstatus',$_SESSION['_config']) ? intval($_SESSION['_ <tr> <td class="DataTD" colspan="9"><?=_("From here you can delete pending requests, or revoke valid certificates.")?></td> </tr> -<? } ?> +<? +*/ + output_orgservercert_table_footer(0); +} ?> </table> <input type="hidden" name="oldid" value="<?=$id?>" /> <input type="hidden" name="csrf" value="<?=make_csrf('orgsrvcerchange')?>" /> |