summaryrefslogtreecommitdiff
path: root/includes/notary.inc.php
diff options
context:
space:
mode:
authorINOPIAE <inopiae@cacert.org>2014-01-26 08:53:34 +0100
committerINOPIAE <inopiae@cacert.org>2014-01-26 08:53:34 +0100
commitcff05bf168fda96ba3809c6102c225743ccd306e (patch)
treedb383e383bc1cc57779cc2aeea193c3eeaa2c6f0 /includes/notary.inc.php
parent39b0b604e6099464f3103e698e81e9a5628af9b1 (diff)
downloadcacert-devel-cff05bf168fda96ba3809c6102c225743ccd306e.tar.gz
cacert-devel-cff05bf168fda96ba3809c6102c225743ccd306e.tar.xz
cacert-devel-cff05bf168fda96ba3809c6102c225743ccd306e.zip
bug 550: moved orgclientcertificate sql statement to notary.inc.php
Diffstat (limited to 'includes/notary.inc.php')
-rw-r--r--includes/notary.inc.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index a928c78..20e01db 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -1274,3 +1274,47 @@ function output_oa_domain($orgid)
output_log_oa_summary_content($orgid,'Org domain');
output_summary_footer();
}
+
+function output_orgclientcerts_data($orgadminid = 0, $orgfilterid = 0, $sorting, $status){
+ $query = "select UNIX_TIMESTAMP(`oemail`.`created`) as `created`,
+ UNIX_TIMESTAMP(`oemail`.`expire`) - UNIX_TIMESTAMP() as `timeleft`,
+ UNIX_TIMESTAMP(`oemail`.`expire`) as `expired`,
+ `oemail`.`expire` as `expires`, `oemail`.`revoked` as `revoke`,
+ UNIX_TIMESTAMP(`oemail`.`revoked`) as `revoked`,
+ `oemail`.`CN`, `oemail`.`serial`, `oemail`.`id`,
+ `oemail`.`description`, `oemail`.`ou`, `orginfo`.`O`,
+ `cu`.`fname` as cfname, `cu`.`lname` as clname ,
+ `ru`.`fname` as rfname, `ru`.`lname` as rlname
+ from `org`, `orginfo`, `orgemailcerts` as `oemail`
+ left join users as `cu` on `oemail`.`orgadminid` = `cu`.`id`
+ left join users as `ru` on `oemail`.`revokeorgadminid` = `ru`.`id`
+ where `org`.`orgid`=`oemail`.`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 `oemail`.`renewed`=0 ";
+ $query .= "HAVING `timeleft` > 0 AND `revoked`=0 ";
+ }
+ switch ($sorting){
+ case 0:
+ $query .= "ORDER BY `orginfo`.`O`, `oemail`.`expire` desc";
+ break;
+ case 1:
+ $query .= "ORDER BY `orginfo`.`O`, `oemail`.`ou`, `oemail`.`expire` desc";
+ break;
+ case 2:
+ $query .= "ORDER BY `orginfo`.`O`, `oemail`.`CN`, `oemail`.`expire` desc";
+ break;
+ }
+ return mysql_query($query);
+}