Aleksander Machniak
2015-10-03 13eb9bdc245273918bc2b96b475d7d74f01aae2b
plugins/enigma/lib/enigma_key.php
@@ -1,5 +1,6 @@
<?php
/*
/**
 +-------------------------------------------------------------------------+
 | Key class for the Enigma Plugin                                         |
 |                                                                         |
@@ -27,6 +28,9 @@
    const CAN_SIGN    = 1;
    const CAN_ENCRYPT = 2;
    const CAN_CERTIFY = 4;
    const CAN_AUTH    = 8;
    /**
     * Keys list sorting callback for usort()
@@ -98,9 +102,7 @@
            if ($user->email === $email && $user->valid && !$user->revoked) {
                foreach ($this->subkeys as $subkey) {
                    if (!$subkey->revoked && (!$subkey->expires || $subkey->expires > $now)) {
                        if (($mode == self::CAN_ENCRYPT && $subkey->can_encrypt)
                            || ($mode == self::CAN_SIGN && $subkey->has_private)
                        ) {
                        if ($subkey->usage & $mode) {
                            return $subkey;
                        }
                    }
@@ -146,5 +148,4 @@
        return $result;
    }
}