From: Roland Häder Date: Sat, 13 Sep 2008 00:20:05 +0000 (+0000) Subject: Withdraw now only allowed to sponsor in wernis/primera extension. Payout (untested... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=50cec5fbac1b8b7427f016bf02c93cb1aa7bb9e1;p=mailer.git Withdraw now only allowed to sponsor in wernis/primera extension. Payout (untested) finished for Primera --- diff --git a/.gitattributes b/.gitattributes index 98ad788718..ab19be6dcd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1277,11 +1277,9 @@ templates/de/html/member/member_points_row.tpl -text templates/de/html/member/member_points_upgrade.tpl -text templates/de/html/member/member_primera.tpl -text templates/de/html/member/member_primera_form.tpl -text -templates/de/html/member/member_primera_mode_choose.tpl -text templates/de/html/member/member_primera_mode_list.tpl -text templates/de/html/member/member_primera_mode_list_row.tpl -text templates/de/html/member/member_primera_mode_pay.tpl -text -templates/de/html/member/member_primera_mode_withdraw.tpl -text templates/de/html/member/member_receive_table.tpl -text templates/de/html/member/member_reflinks_row.tpl -text templates/de/html/member/member_reflinks_table.tpl -text @@ -1307,11 +1305,9 @@ templates/de/html/member/member_welcome_footer.tpl -text templates/de/html/member/member_welcome_header.tpl -text templates/de/html/member/member_wernis.tpl -text templates/de/html/member/member_wernis_form.tpl -text -templates/de/html/member/member_wernis_mode_choose.tpl -text templates/de/html/member/member_wernis_mode_list.tpl -text templates/de/html/member/member_wernis_mode_list_row.tpl -text templates/de/html/member/member_wernis_mode_pay.tpl -text -templates/de/html/member/member_wernis_mode_withdraw.tpl -text templates/de/html/member/member_wernis_row.tpl -text templates/de/html/message.tpl -text templates/de/html/metadata.tpl -text diff --git a/inc/databases.php b/inc/databases.php index 06fb5fdcca..335322cff0 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "312"); +define('CURR_SVN_REVISION', "313"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/language/primera_de.php b/inc/language/primera_de.php index 716acd694a..1e2eb96365 100644 --- a/inc/language/primera_de.php +++ b/inc/language/primera_de.php @@ -43,8 +43,8 @@ define('TASK_ADMIN_LIST_PRIMERA_ALL_TITLE', "Listet alle Primera-Ein- und Auszah define('PRIMERA_ADMIN_CONFIG_TITLE', "Einstellungen zum Primus-Portal:"); define('PRIMERA_ADMIN_MIN_PAYOUT', "Minimumguthaben für Auszahlungen."); define('PRIMERA_ADMIN_MIN_WITHDRAW', "Minimumguthaben für Einzahlungen."); -define('PRIMERA_ADMIN_API_NAME', "Primus-Nickname ()"); -define('PRIMERA_ADMIN_API_MD5', "Primera-Account Passwort (Wird als MD5-Hash gespeichert)"); +define('PRIMERA_ADMIN_API_NAME', "Primus-Nickname"); +define('PRIMERA_ADMIN_API_MD5', "Primera-Passwort (Wird als MD5-Hash gespeichert)"); define('PRIMERA_ADMIN_CONFIG_NOTE', "Hier können Sie sich ein Primus-Portal-Account holen. Geben Sie immer Ihren Usernamen von Primus-Portal ein und überprüfen Sie diesen mehrmals! Er wird zum Überweisen von Primera benötigt."); define('PRIMERA_ADMIN_NO_TRANSFERS', "Derzeit keine Primera transferiert!"); define('PRIMERA_ADMIN_ACCOUNT', "Account bei Primus-Portal"); @@ -53,8 +53,6 @@ define('PRIMERA_ADMIN_TIMESTAMP', "Zeitpunkt Überweisung"); define('PRIMERA_ADMIN_TYPE', "Überweisungsrichtung"); define('PRIMERA_ADMIN_API_MESSAGE', "Nachricht von Primus-API"); define('PRIMERA_ADMIN_API_STATUS', "Status von Primus-API"); -define('MEMBER_PRIMERA_MODE_CHOOSE', "Möchten Sie Primera zu Ihrem Primus-Portal ausbezahlt bekommen oder Primera hier einzahlen?"); -define('MEMBER_PRIMERA_MODE_CHOOSE2', "Hier klicken um neue Überweisung zu starten..."); define('MEMBER_PRIMERA_MODE_WITHDRAW', "Primera einzahlen"); define('MEMBER_PRIMERA_MODE_PAYOUT', "Primera auszahlen"); define('PRIMERA_STATUS_UNKNWOWN', "Primera-Typ %s unbekannt."); @@ -76,8 +74,8 @@ define('PRIMERA_API_REQUEST_FAILED_USER', "Useraccount nicht gefunden oder Prime define('PRIMERA_API_REQUEST_FAILED_OWN', "Überweisung an eigenes Account nicht möglich."); define('PRIMERA_API_REQUEST_FAILED_AMOUNT', "Konto weist nicht genügend Deckung auf."); define('PRIMERA_API_REQUEST_FAILED_API_AMOUNT', "Primera-Account weist nicht genügend Deckung auf."); -define('PRIMERA_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!})"); -define('PRIMERA_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!})"); +define('PRIMERA_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!}), ID: %s"); +define('PRIMERA_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!}), ID: %s"); // Error messages define('PRIMERA_ERROR_STATUS', "Fehler-Status %s erhalten."); @@ -97,7 +95,7 @@ define('PRIMERA_MEMBER_PAYOUT_POINTS', "Auszahlfähiges Primera-Guthaben"); define('PRIMERA_MEMBER_PAYOUT_MIN_POINTS', "Mindestens auszuzahlendes Primera-Guthaben"); define('PRIMERA_MEMBER_PAYOUT_SUBMIT', "Auszahlung durchführen"); define('PRIMERA_MEMBER_PAYOUT_NOTE', "Ihr Primera-Passwort wird bei {!MAIN_TITLE!} nicht gespeichert. Bitte bei Primera-Betrag nur gerade Beträge eingeben! Überprüfen Sie vor dem Absenden Ihren Primus-Usernamen."); -define('PRIMERA_MEMBER_ID', "Username bei Primus-Portal: [Vergessen?]"); +define('PRIMERA_MEMBER_NICKNAME', "Username bei Primus-Portal: [Vergessen?]"); define('PRIMERA_MEMBER_PASSWORD', "Primera-Passwort (nicht Accountpasswort!): [Vergessen?]"); define('PRIMERA_MEMBER_AMOUNT', "Zu überweisenden Betrag eingeben:"); define('PRIMERA_MEMBER_MODE_INVALID', "Ungültiger Modus %s erkannt! Bitte links im Menü fortfahren."); diff --git a/inc/language/wernis_de.php b/inc/language/wernis_de.php index 8e1d60718d..7be49074c6 100644 --- a/inc/language/wernis_de.php +++ b/inc/language/wernis_de.php @@ -55,8 +55,6 @@ define('WERNIS_ADMIN_TIMESTAMP', "Zeitpunkt Überweisung"); define('WERNIS_ADMIN_TYPE', "Überweisungsrichtung"); define('WERNIS_ADMIN_API_MESSAGE', "Nachricht von WDS66-API"); define('WERNIS_ADMIN_API_STATUS', "Status von WDS66-API"); -define('MEMBER_WERNIS_MODE_CHOOSE', "Möchten Sie Wernis zu Ihrem WDS66-Hauptaccount ausbezahlt bekommen oder Wernis hier einzahlen?"); -define('MEMBER_WERNIS_MODE_CHOOSE2', "Hier klicken um neue Überweisung zu starten..."); define('MEMBER_WERNIS_MODE_WITHDRAW', "Wernis einzahlen"); define('MEMBER_WERNIS_MODE_PAYOUT', "Wernis auszahlen"); define('WERNIS_STATUS_UNKNWOWN', "Wernis-Typ %s unbekannt."); @@ -78,8 +76,8 @@ define('WERNIS_API_REQUEST_FAILED_USER', "Useraccount nicht gefunden oder Wernis define('WERNIS_API_REQUEST_FAILED_OWN', "Überweisung an eigenes Account nicht möglich."); define('WERNIS_API_REQUEST_FAILED_AMOUNT', "Konto weist nicht genügend Deckung auf."); define('WERNIS_API_REQUEST_FAILED_API_AMOUNT', "API-Konto weist nicht genügend Deckung auf."); -define('WERNIS_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!})"); -define('WERNIS_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!})"); +define('WERNIS_API_PURPOSE_WITHDRAW', "Einzahlung auf {!MAIN_TITLE!} ({!URL!}), ID: %s"); +define('WERNIS_API_PURPOSE_PAYOUT', "Auszahlung von {!MAIN_TITLE!} ({!URL!}), ID: %s"); // Error messages define('WERNIS_ERROR_STATUS', "Fehler-Status %s erhalten."); diff --git a/inc/libs/primera_functions.php b/inc/libs/primera_functions.php index c28da8cc79..e1c6fc57e2 100644 --- a/inc/libs/primera_functions.php +++ b/inc/libs/primera_functions.php @@ -1,6 +1,6 @@ payPrimera($PayReceiver, $PayAmount, $PayDescription); @@ -105,7 +105,7 @@ class PrimeraApi { /** * URL für das Interface auf dem Primusserver: */ - private $host = "www.primusportal.de"; + private $host = "http://www.primusportal.de"; private $path = "/transfer.interface.2.0.php"; private $errno = 0; @@ -118,6 +118,8 @@ class PrimeraApi { private $data = array(); + private $headers = ""; + /** * Konstruktor */ @@ -130,14 +132,24 @@ class PrimeraApi { /** * Anfrage senden und Rückgabecode in Variable speichern */ - function queryApi ( $data = array() ) { + private function queryApi ( $data = array() ) { + // Base64-encode username and password hash $data["PrimusInterface_Username"] = base64_encode($this->username); - $data["PrimusInterface_Password"] = base64_encode(md5($this->password)); + $data["PrimusInterface_Password"] = base64_encode($this->password); // Send POST request - $return = POST_URL($this->host.$this->path); + $return = POST_URL($this->host.$this->path, $data); + + // Convert the array into a full string + $returnStr = implode("\n", $return); + + // Extract the real content, strip header away + $content = explode("", $returnStr); - $content = explode("", $return); + // Store headers away for debugging + $this->headers = $content[0]; + + // Return the content return $content[1]; } @@ -163,15 +175,15 @@ class PrimeraApi { */ public function payPrimera ($Receiver, $Amount, $Description = "") { $valid = false; - $PostData = array("PrimusInterface_Action" => "Pay", + $postData = array("PrimusInterface_Action" => "Pay", "PrimusInterface_Receiver" => base64_encode($Receiver), "PrimusInterface_Amount" => base64_encode($Amount), "PrimusInterface_Description" => base64_encode($Description) ); - $PostReturn = $this->parseContent( $this->queryApi($PostData) ); + $postReturn = $this->parseContent( $this->queryApi($postData) ); - $this->data = $PostReturn; - if ($PostReturn["status"] == "200") { + $this->data = $postReturn; + if ($postReturn["status"] == "200") { $valid = true; } return $valid; @@ -183,16 +195,16 @@ class PrimeraApi { * - ist er aktiv * @param string/int $User Userid / Username */ - function CheckPrimusUser($User) { + public function CheckPrimusUser($User) { $valid = false; - $PostData = array("PrimusInterface_Action"=> "CheckPrimusUser", + $postData = array("PrimusInterface_Action"=> "CheckPrimusUser", "PrimusInterface_CheckPrimusUser" => $User); - $PostReturn = $this->parseContent( $this->queryApi($PostData) ); + $postReturn = $this->parseContent( $this->queryApi($postData) ); - $this->data = $PostReturn; + $this->data = $postReturn; - if ($PostReturn["status"] == self::PI_USER_CHECK_OK) { + if ($postReturn["status"] == self::PI_USER_CHECK_OK) { $valid = true; } return $valid; @@ -201,18 +213,70 @@ class PrimeraApi { /** * Die Funktion liefer den aktuellen Primerastand */ - function getPrimera() { + public function getPrimera() { $primera = false; - $PostData = array( "PrimusInterface_Action" => "GetPrimera" ); - $PostReturn = $this->parseContent( $this->queryApi($PostData) ); + $postData = array( "PrimusInterface_Action" => "GetPrimera" ); + $postReturn = $this->parseContent( $this->queryApi($postData) ); - $this->data = $PostReturn; - if ($PostReturn["status"] == self::PI_GET_PRIMERA_DONE) { - $primera = $PostReturn["primera"]; + $this->data = $postReturn; + if ($postReturn["status"] == self::PI_GET_PRIMERA_DONE) { + $primera = $postReturn["primera"]; } return $primera; } + /** + * Getter fuer data + */ + public function getData () { + return $this->data; + } +} + +// Function to test the Primera API by getting the amount. If the returned value +// is not false the API data is valid, else invalid +function PRIMERA_TEST_API () { + // Get new instance + $api = new PrimeraApi($_POST['primera_api_name'], $_POST['primera_api_md5']); + + // Was that fine? + return ($api->getPrimera() !== false); } +// Execute the withdraw of a sponsor only! +function PRIMERA_EXECUTE_WITHDRAW ($primusNick, $userMd5, $amount) { + global $_CONFIG; + // Is the sponsor extension installed? + if (!EXT_IS_ACTIVE("sponsor")) { + // No, abort here + return false; + } elseif (!IS_SPONSOR()) { + // No sponsor, not allowed to withdraw! + return false; + } + + // Get new instance + $api = new PrimeraApi($primusNick, $userMd5); + + // Prepare purpose + $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_WITHDRAW, $_COOKIE['sponsorid']))."\";"; + eval($eval); + + // Pay the Primera + return $api->payPrimera($primusNick, $amount, $purpose); +} +// Execute the payout +function PRIMERA_EXECUTE_PAYOUT ($primusNick, $userMd5, $amount) { + global $_CONFIG; + + // Get new instance + $api = new PrimeraApi($_CONFIG['primera_api_name'], $_CONFIG['primera_api_md5']); + + // Prepare purpose + $eval = "\$purpose = \"".COMPILE_CODE(sprintf(PRIMERA_API_PURPOSE_PAYOUT, $GLOBALS['userid']))."\";"; + eval($eval); + + // Pay the Primera + return $api->payPrimera($primusNick, $amount, $purpose); +} // [EOF] -?> \ No newline at end of file +?> diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 4114845e9c..6a3725ac02 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -212,10 +212,21 @@ function WERNIS_TEST_API () { // Widthdraw this amount function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) { global $_CONFIG; + + // Is the sponsor extension installed? + if (!EXT_IS_ACTIVE("sponsor")) { + // No, abort here + return false; + } elseif (!IS_SPONSOR()) { + // No sponsor, not allowed to withdraw! + return false; + } + + // Default is failed attempt $result = false; // Prepare the purpose - $eval = "\$purpose = \"".COMPILE_CODE(WERNIS_API_PURPOSE_WITHDRAW)."\";"; + $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_WITHDRAW, $GLOBALS['userid']))."\";"; eval($eval); // Prepare the request data @@ -253,10 +264,12 @@ function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) { // Payout this amount function WERNIS_EXECUTE_PAYOUT ($wdsId, $userMd5, $amount) { global $_CONFIG; + + // Default is failed attempt $result = false; // Prepare the purpose - $eval = "\$purpose = \"".COMPILE_CODE(WERNIS_API_PURPOSE_PAYOUT)."\";"; + $eval = "\$purpose = \"".COMPILE_CODE(sprintf(WERNIS_API_PURPOSE_PAYOUT, $GLOBALS['userid']))."\";"; eval($eval); // Prepare the request data diff --git a/inc/modules/admin/what-config_primera.php b/inc/modules/admin/what-config_primera.php index f244c6e1e8..349d7ad52b 100644 --- a/inc/modules/admin/what-config_primera.php +++ b/inc/modules/admin/what-config_primera.php @@ -64,7 +64,7 @@ if (isset($_POST['ok'])) { $content = array( 'min_payout' => bigintval($_CONFIG['primera_min_payout']), 'min_withdraw' => bigintval($_CONFIG['primera_min_withdraw']), - 'api_name' => bigintval($_CONFIG['primera_api_name']), + 'api_name' => $_CONFIG['primera_api_name'], 'api_md5' => $_CONFIG['primera_api_md5'] ); diff --git a/inc/modules/member/what-primera.php b/inc/modules/member/what-primera.php index 5035bbb89a..d17f485517 100644 --- a/inc/modules/member/what-primera.php +++ b/inc/modules/member/what-primera.php @@ -57,9 +57,9 @@ if ((empty($_CONFIG['primera_api_name'])) || (empty($_CONFIG['primera_api_md5']) // Init the content array and points $content = array(); $points = false; -// Is the mode set (withdraw or payout) -if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { - // Let the user choose what he wants to do +// Is the mode set (payout only) +if (!isset($_GET['mode'])) { + // Get referral id $content['refid'] = bigintval($_CONFIG['primera_refid']); // Get WDS66 id @@ -69,14 +69,14 @@ if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { // Are there some entries? if (SQL_NUMROWS($result) == 1) { // Fetch ID - list($content['wds66_id']) = SQL_FETCHROW($result); - } + list($content['primus_nickname']) = SQL_FETCHROW($result); + } // END - if // Free result SQL_FREERESULT($result); // Is there an ID? - if ((!empty($content['wds66_id'])) && (!isset($_GET['mode']))) { + if ((!empty($content['primus_nickname'])) && (!isset($_GET['mode']))) { // Then use an other "mode" $_GET['mode'] = "list"; @@ -105,10 +105,11 @@ if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { // Free result SQL_FREERESULT($result); } else { - // Mode chooser! ;-) - $_GET['mode'] = "choose"; + // Mode pay + $_GET['mode'] = "pay"; } -} elseif ($_GET['mode'] == "pay") { +} // END - if +if ($_GET['mode'] == "pay") { // Get total points and check if the user can request a payout $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points"); @@ -131,35 +132,14 @@ if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { $content['min_points'] = TRANSLATE_COMMA($_CONFIG['primera_min_payout']); // Get WDS66 id - $content['wds66_id'] = ""; - $result = SQL_QUERY_ESC("SELECT primera_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FILE__, __LINE__); - - // Are there some entries? - if (SQL_NUMROWS($result) == 1) { - // Fetch ID - list($content['wds66_id']) = SQL_FETCHROW($result); - } - - // Free result - SQL_FREERESULT($result); -} elseif ($_GET['mode'] == "withdraw") { - // Get total points for just displaying them - $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points"); - - // Prepare data for the template - $content['points'] = TRANSLATE_COMMA($points); - $content['min_points'] = TRANSLATE_COMMA($_CONFIG['primera_min_withdraw']); - $content['wds66_id'] = ""; - - // Get WDS66 id + $content['primus_nickname'] = ""; $result = SQL_QUERY_ESC("SELECT primera_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__); // Are there some entries? if (SQL_NUMROWS($result) == 1) { // Fetch ID - list($content['wds66_id']) = SQL_FETCHROW($result); + list($content['primus_nickname']) = SQL_FETCHROW($result); } // Free result @@ -174,66 +154,13 @@ if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { // Check input data depending on the mode and execute the requested mode switch ($_GET['mode']) { - case "withdraw": // Widthdraws WDS66 -> This exchange - // Is the user ID and password set? - if (empty($_POST['wds66_id'])) { - // Nothing entered in WDS66 user ID - LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_USERNAME); - OUTPUT_HTML("
"); - } elseif (empty($_POST['wds66_password'])) { - // Nothing entered in WDS66 password - LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_PASSWORD); - OUTPUT_HTML("
"); - } elseif (empty($_POST['amount'])) { - // Nothing entered in amount - LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_AMOUNT); - OUTPUT_HTML("
"); - } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) { - // Only numbers in account ID! - LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_USERNAME); - OUTPUT_HTML("
"); - } elseif ($_POST['amount'] != bigintval($_POST['amount'])) { - // Only numbers in amount! - LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_AMOUNT); - OUTPUT_HTML("
"); - } elseif ($_POST['amount'] < $_CONFIG['primera_min_withdraw']) { - // Not enougth entered! - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_AMOUNT_SMALLER_MIN, bigintval($_CONFIG['primera_min_withdraw']))); - OUTPUT_HTML("
"); - } else { - // All is fine here so do the withdraw - $success = PRIMERA_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']); - if ($success) { - // Add it to this amount - $DEPTH = 0; - ADD_POINTS_REFSYSTEM($GLOBALS['userid'], bigintval($_POST['amount']), false, 0, false, "direct"); - - // Update the user data as well.. - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `primera_userid`=%s WHERE userid=%s LIMIT 1", - array(bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__); - - // All done! - LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_WITHDRAW_DONE); - return; - } elseif ((GET_PRIMERA_ERROR_CODE() == "user_failed") || (GET_PRIMERA_ERROR_CODE() == "own_failed") || (GET_PRIMERA_ERROR_CODE() == "amount_failed")) { - // Wrong login data - LOAD_TEMPLATE("admin_settings_saved", false, GET_PRIMERA_ERROR_MESSAGE()); - OUTPUT_HTML("
"); - } else { - // Something went wrong - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_WITHDRAW_FAILED, GET_PRIMERA_ERROR_MESSAGE())); - OUTPUT_HTML("
"); - } - } - break; - case "pay": // Payout this exchange -> WDS66 // Is the user ID and password set? - if (empty($_POST['wds66_id'])) { + if (empty($_POST['primus_nickname'])) { // Nothing entered in WDS66 user ID LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_USERNAME); OUTPUT_HTML("
"); - } elseif (empty($_POST['wds66_password'])) { + } elseif (empty($_POST['primera_password'])) { // Nothing entered in WDS66 password LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_PASSWORD); OUTPUT_HTML("
"); @@ -241,7 +168,7 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { // Nothing entered in amount LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_EMPTY_AMOUNT); OUTPUT_HTML("
"); - } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) { + } elseif ($_POST['primus_nickname'] != bigintval($_POST['primus_nickname'])) { // Only numbers in account ID! LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_INVALID_USERNAME); OUTPUT_HTML("
"); @@ -258,8 +185,8 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_PAYOUT_POINTS_DEPLETED, bigintval($_POST['amount']), bigintval($points))); OUTPUT_HTML("
"); } else { - // All is fine here so do the withdraw - $success = PRIMERA_EXECUTE_PAYOUT($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']); + // All is fine here so do the payout + $success = PRIMERA_EXECUTE_PAYOUT($_POST['primus_nickname'], md5($_POST['primera_password']), $_POST['amount']); if ($success) { // Default is locked! $locked = true; @@ -268,11 +195,11 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { if ($_CONFIG['ref_payout'] == "0") { // Yes, "pay" it now $locked = false; - } + } // END - if // Remove the points from the account $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `used_points` = `used_points` + %s, `primera_userid`=%s WHERE userid=%s LIMIT 1", - array(bigintval($_POST['amount']), bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__); + array(bigintval($_POST['amount']), bigintval($_POST['primus_nickname']), $GLOBALS['userid']), __FILE__, __LINE__); // All done! LOAD_TEMPLATE("admin_settings_saved", false, PRIMERA_MEMBER_PAYOUT_DONE); @@ -283,7 +210,7 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { OUTPUT_HTML("
"); } else { // Something went wrong - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_WITHDRAW_FAILED, GET_PRIMERA_ERROR_MESSAGE())); + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(PRIMERA_MEMBER_PAYOUT_FAILED, GET_PRIMERA_ERROR_MESSAGE())); OUTPUT_HTML("
"); } } diff --git a/inc/modules/member/what-wernis.php b/inc/modules/member/what-wernis.php index 202c754d2c..ca832333d9 100644 --- a/inc/modules/member/what-wernis.php +++ b/inc/modules/member/what-wernis.php @@ -57,9 +57,9 @@ if ((empty($_CONFIG['wernis_api_id'])) || (empty($_CONFIG['wernis_api_md5']))) { // Init the content array and points $content = array(); $points = false; -// Is the mode set (withdraw or payout) -if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { - // Let the user choose what he wants to do +// Is the mode set (payout only!) +if (!isset($_GET['mode'])) { + // Get referal id $content['refid'] = bigintval($_CONFIG['wernis_refid']); // Get WDS66 id @@ -105,10 +105,11 @@ if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { // Free result SQL_FREERESULT($result); } else { - // Mode chooser! ;-) - $_GET['mode'] = "choose"; + // Mode pay + $_GET['mode'] = "pay"; } -} elseif ($_GET['mode'] == "pay") { +} +if ($_GET['mode'] == "pay") { // Get total points and check if the user can request a payout $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points"); @@ -141,27 +142,6 @@ if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { list($content['wds66_id']) = SQL_FETCHROW($result); } - // Free result - SQL_FREERESULT($result); -} elseif ($_GET['mode'] == "withdraw") { - // Get total points for just displaying them - $points = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points"); - - // Prepare data for the template - $content['points'] = TRANSLATE_COMMA($points); - $content['min_points'] = TRANSLATE_COMMA($_CONFIG['wernis_min_withdraw']); - $content['wds66_id'] = ""; - - // Get WDS66 id - $result = SQL_QUERY_ESC("SELECT wernis_userid FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", - array($GLOBALS['userid']), __FILE__, __LINE__); - - // Are there some entries? - if (SQL_NUMROWS($result) == 1) { - // Fetch ID - list($content['wds66_id']) = SQL_FETCHROW($result); - } - // Free result SQL_FREERESULT($result); } else { @@ -174,59 +154,6 @@ if ((!isset($_GET['mode'])) || ($_GET['mode'] == "choose")) { if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { // Check input data depending on the mode and execute the requested mode switch ($_GET['mode']) { - case "withdraw": // Widthdraws WDS66 -> This exchange - // Is the user ID and password set? - if (empty($_POST['wds66_id'])) { - // Nothing entered in WDS66 user ID - LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_USERNAME); - OUTPUT_HTML("
"); - } elseif (empty($_POST['wds66_password'])) { - // Nothing entered in WDS66 password - LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_PASSWORD); - OUTPUT_HTML("
"); - } elseif (empty($_POST['amount'])) { - // Nothing entered in amount - LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_EMPTY_AMOUNT); - OUTPUT_HTML("
"); - } elseif ($_POST['wds66_id'] != bigintval($_POST['wds66_id'])) { - // Only numbers in account ID! - LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_USERNAME); - OUTPUT_HTML("
"); - } elseif ($_POST['amount'] != bigintval($_POST['amount'])) { - // Only numbers in amount! - LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_INVALID_AMOUNT); - OUTPUT_HTML("
"); - } elseif ($_POST['amount'] < $_CONFIG['wernis_min_withdraw']) { - // Not enougth entered! - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_AMOUNT_SMALLER_MIN, bigintval($_CONFIG['wernis_min_withdraw']))); - OUTPUT_HTML("
"); - } else { - // All is fine here so do the withdraw - $success = WERNIS_EXECUTE_WITHDRAW($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']); - if ($success) { - // Add it to this amount - $DEPTH = 0; - ADD_POINTS_REFSYSTEM($GLOBALS['userid'], bigintval($_POST['amount']), false, 0, false, "direct"); - - // Update the user data as well.. - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET `wernis_userid`=%s WHERE userid=%s LIMIT 1", - array(bigintval($_POST['wds66_id']), $GLOBALS['userid']), __FILE__, __LINE__); - - // All done! - LOAD_TEMPLATE("admin_settings_saved", false, WERNIS_MEMBER_WITHDRAW_DONE); - return; - } elseif ((GET_WERNIS_ERROR_CODE() == "user_failed") || (GET_WERNIS_ERROR_CODE() == "own_failed") || (GET_WERNIS_ERROR_CODE() == "amount_failed")) { - // Wrong login data - LOAD_TEMPLATE("admin_settings_saved", false, GET_WERNIS_ERROR_MESSAGE()); - OUTPUT_HTML("
"); - } else { - // Something went wrong - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_WITHDRAW_FAILED, GET_WERNIS_ERROR_MESSAGE())); - OUTPUT_HTML("
"); - } - } - break; - case "pay": // Payout this exchange -> WDS66 // Is the user ID and password set? if (empty($_POST['wds66_id'])) { @@ -258,7 +185,7 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_PAYOUT_POINTS_DEPLETED, bigintval($_POST['amount']), bigintval($points))); OUTPUT_HTML("
"); } else { - // All is fine here so do the withdraw + // All is fine here so do the payout $success = WERNIS_EXECUTE_PAYOUT($_POST['wds66_id'], md5($_POST['wds66_password']), $_POST['amount']); if ($success) { // Default is locked! @@ -283,7 +210,7 @@ if ((isset($_POST['ok'])) && (isset($_GET['mode']))) { OUTPUT_HTML("
"); } else { // Something went wrong - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_WITHDRAW_FAILED, GET_WERNIS_ERROR_MESSAGE())); + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(WERNIS_MEMBER_PAYOUT_FAILED, GET_WERNIS_ERROR_MESSAGE())); OUTPUT_HTML("
"); } } diff --git a/templates/de/html/admin/admin_list_primera_main.tpl b/templates/de/html/admin/admin_list_primera_main.tpl index e9ab6d7e0c..3d23712fa5 100644 --- a/templates/de/html/admin/admin_list_primera_main.tpl +++ b/templates/de/html/admin/admin_list_primera_main.tpl @@ -2,7 +2,7 @@ {--ID_SELECT--} {--_UID--} - {--PRIMERA_ADMIN_WDS66_ACCOUNT--} + {--PRIMERA_ADMIN_ACCOUNT--} {--PRIMERA_ADMIN_TRANSFERED--} {--PRIMERA_ADMIN_TIMESTAMP--} {--PRIMERA_ADMIN_TYPE--} diff --git a/templates/de/html/member/member_primera_mode_choose.tpl b/templates/de/html/member/member_primera_mode_choose.tpl deleted file mode 100644 index e0ed94909a..0000000000 --- a/templates/de/html/member/member_primera_mode_choose.tpl +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - -
- {--MEMBER_PRIMERA_MODE_CHOOSE--}
-
{--MEMBER_PRIMERA_MODE_WITHDRAW--}
-
-
{--MEMBER_PRIMERA_MODE_PAYOUT--}
-
- -

- {--PRIMERA_MEMBER_NO_ACCOUNT--} -

diff --git a/templates/de/html/member/member_primera_mode_pay.tpl b/templates/de/html/member/member_primera_mode_pay.tpl index de1b2647cd..760b35ff2d 100644 --- a/templates/de/html/member/member_primera_mode_pay.tpl +++ b/templates/de/html/member/member_primera_mode_pay.tpl @@ -18,17 +18,17 @@   - {--PRIMERA_MEMBER_WDS66_ID--} + {--PRIMERA_MEMBER_NICKNAME--}   - + - {--PRIMERA_MEMBER_WDS66_PASSWORD--} + {--PRIMERA_MEMBER_PASSWORD--}   - + - {--PRIMERA_MEMBER_WDS66_AMOUNT--} + {--PRIMERA_MEMBER_AMOUNT--}   diff --git a/templates/de/html/member/member_primera_mode_withdraw.tpl b/templates/de/html/member/member_primera_mode_withdraw.tpl deleted file mode 100644 index e7f5dc0c56..0000000000 --- a/templates/de/html/member/member_primera_mode_withdraw.tpl +++ /dev/null @@ -1,47 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{--PRIMERA_MEMBER_WITHDRAW_TITLE--}
{--PRIMERA_MEMBER_WITHDRAW_POINTS_ACCOUNT--} $content[points] Primera
{--PRIMERA_MEMBER_WITHDRAW_MIN_POINTS--} $content[min_points] Primera
 
{--PRIMERA_MEMBER_WDS66_ID--} 
{--PRIMERA_MEMBER_WDS66_PASSWORD--} 
{--PRIMERA_MEMBER_WDS66_AMOUNT--} 
 
-
- {--PRIMERA_MEMBER_WITHDRAW_NOTE--} -
diff --git a/templates/de/html/member/member_wernis_mode_choose.tpl b/templates/de/html/member/member_wernis_mode_choose.tpl deleted file mode 100644 index a822250045..0000000000 --- a/templates/de/html/member/member_wernis_mode_choose.tpl +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - -
- {--MEMBER_WERNIS_MODE_CHOOSE--}
-
{--MEMBER_WERNIS_MODE_WITHDRAW--}
-
-
{--MEMBER_WERNIS_MODE_PAYOUT--}
-
- -

- {--WERNIS_MEMBER_NO_ACCOUNT--} -

diff --git a/templates/de/html/member/member_wernis_mode_withdraw.tpl b/templates/de/html/member/member_wernis_mode_withdraw.tpl deleted file mode 100644 index d088f8e6fa..0000000000 --- a/templates/de/html/member/member_wernis_mode_withdraw.tpl +++ /dev/null @@ -1,47 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{--WERNIS_MEMBER_WITHDRAW_TITLE--}
{--WERNIS_MEMBER_WITHDRAW_POINTS_ACCOUNT--} $content[points] Wernis
{--WERNIS_MEMBER_WITHDRAW_MIN_POINTS--} $content[min_points] Wernis
 
{--WERNIS_MEMBER_WDS66_ID--} 
{--WERNIS_MEMBER_WDS66_PASSWORD--} 
{--WERNIS_MEMBER_WDS66_AMOUNT--} 
 
-
- {--WERNIS_MEMBER_WITHDRAW_NOTE--} -