summaryrefslogtreecommitdiff
path: root/includes/temp_functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/temp_functions.php')
-rw-r--r--includes/temp_functions.php76
1 files changed, 19 insertions, 57 deletions
diff --git a/includes/temp_functions.php b/includes/temp_functions.php
index f42b1a1..fce8515 100644
--- a/includes/temp_functions.php
+++ b/includes/temp_functions.php
@@ -160,13 +160,7 @@ function check_email_exists($email){
$query = "select * from `email` where `email`='$email' and `deleted`=0";
$res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- return true;
- }else{
- return false;
- }
-
+ return mysql_num_rows($res) > 0;
}
function check_gpg_cert_running($uid,$cca=0){
@@ -178,79 +172,47 @@ function check_gpg_cert_running($uid,$cca=0){
$query = "select * from `gpg` where `memid`='$uid' and `expire`>NOW()+90*86400";
}
$res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- return true;
- }else{
- return false;
- }
-
+ 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 != "")
if (0==$cca) {
- $query = "select from `domiancerts` where `memid`='$uid' and `expire`>NOW()";
- $query1 = "select from `domiancerts` where `memid`='$uid' and `revoked`>NOW()";
- }else{
- $query = "select from `emailcerts` where `memid`='$uid' and `expire`>NOW()+90*86400";
- $query1 = "select from `emailcerts` where `memid`='$uid' and `revoked`>NOW()+90*86400";
- }
- $res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- $r1=true;
+ $query1 = "select from `domiancerts` where `memid`='$uid' and `expire`>NOW()";
+ $query2 = "select from `domiancerts` where `memid`='$uid' and `revoked`>NOW()";
}else{
- $r1=false;
+ $query1 = "select from `emailcerts` where `memid`='$uid' and `expire`>NOW()+90*86400";
+ $query2 = "select from `emailcerts` where `memid`='$uid' and `revoked`>NOW()+90*86400";
}
$res = mysql_query($query1);
- if(mysql_num_rows($res) > 0)
- {
- $r2=true;
- }else{
- $r2=false;
- }
- return !!($a || $b);
+ return $r1 = mysql_num_rows($res)>0;
+ $res = mysql_query($query2);
+ return $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 != "")
if (0==$cca) {
- $query = "select from `domiancerts` where `memid`='$uid' and `expire`>NOW()";
- $query1 = "select from `domiancerts` where `memid`='$uid' and `revoked`>NOW()";
- }else{
- $query = "select from `domiancerts` where `memid`='$uid' and `expire`>NOW()+90*86400";
- $query1 = "select from `domiancerts` where `memid`='$uid' and `revoked`>NOW()+90*86400";
- }
- $res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- $r1=true;
+ $query1 = "select from `domiancerts` where `memid`='$uid' and `expire`>NOW()";
+ $query2 = "select from `domiancerts` where `memid`='$uid' and `revoked`>NOW()";
}else{
- $r1=true;
+ $query1 = "select from `domiancerts` where `memid`='$uid' and `expire`>NOW()+90*86400";
+ $query2 = "select from `domiancerts` where `memid`='$uid' and `revoked`>NOW()+90*86400";
}
$res = mysql_query($query1);
- if(mysql_num_rows($res) > 0)
- {
- $r2=true;
- }else{
- $r2=false;
- }
- if(true==$r1 || true==$r2)
- return !!($a || $b);
+ return $r1 = mysql_num_rows($res)>0;
+ $res = mysql_query($query2);
+ return $r2 = mysql_num_rows($res)>0;
+ return !!($r1 || $r2);
}
function check_is_orgadmin($uid){
// called from includes/account.php if($oldid == 50 && $process != "")
$query = "select * from `org` where `memid`='$uid' and `deleted`=0";
$res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- return true;
- }else{
- return false;
- }
+ return mysql_num_rows($res) > 0;
}