]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/wernis_functions.php
Several fixes on core and wernis extension
[mailer.git] / inc / libs / wernis_functions.php
index ae8ed57e564828690e966d5b168488d99e497471..e665277234890a9f6feb7218f93b080a7049c9c1 100644 (file)
@@ -65,9 +65,6 @@ function GET_WERNIS_ERROR_CODE () {
        if (isset($WERNIS['status'])) {
                // Use raw message
                return $WERNIS['status'];
-       } elseif (isset($WERNIS['status'])) {
-               // Fall-back to status
-               return sprintf(WERNIS_ERROR_STATUS, $WERNIS['status']);
        } else {
                // Something bad happend
                return WERNIS_UNKNOWN_ERROR;
@@ -109,7 +106,7 @@ function WERNIS_SEND_REQUEST ($scriptName, $requestData =  array()) {
        if (strpos($response[0], "200") === false) {
                // Something bad happend... :(
                return array(
-                       'status'  => "request_eror",
+                       'status'  => "request_error",
                        'message' => sprintf(WERNIS_API_REQUEST_ERROR, $response[0])
                );
        }
@@ -130,9 +127,10 @@ function WERNIS_SEND_REQUEST ($scriptName, $requestData =  array()) {
        $return = array();
 
        // We use only the first two entries (which shall be fine)
-       if ($data[0] == "error") {
+       if ($data[0] === "error") {
                // The request has failed... :(
                switch ($data[1]) {
+                       case "404": // Invalid API ID
                        case "AUTH": // Authorization has failed
                                $return = array(
                                        'status'  => "auth_failed",
@@ -140,6 +138,8 @@ function WERNIS_SEND_REQUEST ($scriptName, $requestData =  array()) {
                                );
                                break;
 
+                       case "LOCKED": // User account is locked!
+                       case "PASS": // Bad passphrase entered
                        case "USER": // Missing account or invalid password
                                $return = array(
                                        'status'  => "user_failed",