]> git.mxchange.org Git - mailer.git/commitdiff
Since Wernis API 0.6-BETA SHA256 is the default now
authorRoland Häder <roland@mxchange.org>
Sat, 4 May 2013 01:14:19 +0000 (01:14 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 4 May 2013 01:14:19 +0000 (01:14 +0000)
inc/extensions/ext-wernis.php
inc/functions.php
inc/modules/admin/what-config_wernis.php
inc/modules/member/what-wernis.php

index 82065ebefc7dbd50ba5f74375526498cc82a6464..19a01bceeb493c9c6b0620e2b349999adc91487b 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version of this extension
-setThisExtensionVersion('0.0.5');
+setThisExtensionVersion('0.0.6');
 
 // Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6'));
 
 switch (getExtensionMode()) {
        case 'setup': // Do stuff when installation is running
@@ -152,6 +152,13 @@ INDEX (`userid`)",
                                // Update notes
                                setExtensionUpdateNotes("IN/OUT ersetzt mit WITHDRAW/PAYOUT.");
                                break;
+
+                       case '0.0.6': // SQL queries for v0.0.6
+                               addExtensionChangeTableColumnSql('config', 'wernis_pass_md5', 'wernis_pass_md5', " VARCHAR(255) NOT NULL DEFAULT ''");
+
+                               // Update notes
+                               setExtensionUpdateNotes("Es wird seit API-Version 0.6-BETA SHA256 (hexadezimal kodiert) verwendet.");
+                               break;
                } // END - switch
                break;
 
index 9060a90193d3f85512b0599ca1a7a87efe22a99b..ba5c096e122e93d30b21b811b8de722a7a9db186 100644 (file)
@@ -2694,6 +2694,22 @@ function convertCharsetToUtf8 ($str, $charset) {
        return $str;
 }
 
+// Hash string with SHA256 and encode it to hex
+function hashSha256 ($str) {
+       /// Hash string
+       $hash = mhash(MHASH_SHA256, $str);
+
+       // Encode it to hexadecimal
+       $hex = '';
+       for ($i = 0; $i < strlen($hash); $i++) {
+               // Encode char to decimal, pad it with zero, add it
+               $hex .= padLeftZero(dechex(ord(substr($hash, $i, 1))));
+       } // END - if
+
+       // Return it
+       return $hex;
+}
+
 // ----------------------------------------------------------------------------
 //              "Translatation" functions for points_data table
 // ----------------------------------------------------------------------------
index 5651735376e4d3c1d8697068d0531f8e861573ff..74770402dc4b7b16bc3ddcebafa981a62558597b 100644 (file)
@@ -55,7 +55,7 @@ if (isFormSent('save_config')) {
                } // END - if
 
                // Hash the password and remove clear-text
-               setPostRequestElement('wernis_pass_md5', md5(postRequestElement('wernis_pass')));
+               setPostRequestElement('wernis_pass_md5', hashSha256(postRequestElement('wernis_pass')));
                unsetPostRequestElement('wernis_pass');
 
                // Save settings
index 401e8585719384041449050d0939665ecb9553a3..eec5f133092647c14faaa5d42d33ab7ec0ee4fbb 100644 (file)
@@ -172,7 +172,7 @@ if ((isFormSent()) && (isGetRequestElementSet('do'))) {
                                        displayMessage('{--MEMBER_WERNIS_WITHDRAW_AMOUNT_SMALLER_MIN--}');
                                } else {
                                        // All is fine here so do the withdraw
-                                       $success = WERNIS_EXECUTE_WITHDRAW(postRequestElement('wernis_userid'), md5(postRequestElement('wds66_password')), postRequestElement('amount'));
+                                       $success = WERNIS_EXECUTE_WITHDRAW(postRequestElement('wernis_userid'), hashSha256(postRequestElement('wds66_password')), postRequestElement('amount'));
                                        if ($success === TRUE) {
                                                // Add it to this amount
                                                initReferralSystem();