summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/account.php10
-rw-r--r--includes/temp_functions.php76
2 files changed, 24 insertions, 62 deletions
diff --git a/includes/account.php b/includes/account.php
index 97125ac..26b16ba 100644
--- a/includes/account.php
+++ b/includes/account.php
@@ -2847,21 +2847,21 @@
showfooter();
exit;
}
- if (check_email_exists($_REQUEST['arbitrationno'].'@cacert.org')==true) {
+ if (check_email_exists($_REQUEST['arbitrationno'].'@cacert.org')) {
showheader(_("My CAcert.org Account!"));
printf(_("The email address '%s' is already in a different account. Can't continue."), sanitizeHTML($_REQUEST['arbitrationno'].'@cacert.org'));
showfooter();
exit;
}
- if (check_client_cert_running($_REQUEST['userid'],1)==true ||
- check_server_cert_running($_REQUEST['userid'],1)==true ||
- check_gpg_cert_running($_REQUEST['userid'],1)==true) {
+ if (check_client_cert_running($_REQUEST['userid'],1) ||
+ check_server_cert_running($_REQUEST['userid'],1) ||
+ check_gpg_cert_running($_REQUEST['userid'],1)) {
showheader(_("My CAcert.org Account!"));
printf(_("The CCA retention time for at least one certificate is not over. Can't continue."));
showfooter();
exit;
}
- if (check_is_orgadmin($_REQUEST['userid'],1)==true) {
+ if (check_is_orgadmin($_REQUEST['userid'],1)) {
showheader(_("My CAcert.org Account!"));
printf(_("The user is listed as Organisation Administrator. Can't continue."));
showfooter();
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;
}