]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/wernis_functions.php
Withdraw now only allowed to sponsor in wernis/primera extension. Payout (untested...
[mailer.git] / inc / libs / wernis_functions.php
index 4114845e9cdbc75227cfd28a2c180e353228fd21..6a3725ac021a8ffcffd921aa32fdbe6de882be9a 100644 (file)
@@ -212,10 +212,21 @@ function WERNIS_TEST_API () {
 // Widthdraw this amount
 function WERNIS_EXECUTE_WITHDRAW ($wdsId, $userMd5, $amount) {
        global $_CONFIG;
 // 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
        $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
        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;
 // Payout this amount
 function WERNIS_EXECUTE_PAYOUT ($wdsId, $userMd5, $amount) {
        global $_CONFIG;
+
+       // Default is failed attempt
        $result = false;
 
        // Prepare the purpose
        $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
        eval($eval);
 
        // Prepare the request data