]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-primera.php
Removed already no longer used last parameter from addMaxReceiveList(), so more EL...
[mailer.git] / inc / modules / member / what-primera.php
index 794689bdb5fedaf9401e2a2d41219c1052eb2512..f551ef47b7591c74e7b59193e56a1fa6505a87ab 100644 (file)
@@ -1,198 +1,3 @@
 <?php
-/************************************************************************
- * Mailer v0.2.1-FINAL                                Start: 09/09/2008 *
- * ===================                          Last change: 09/09/2008 *
- *                                                                      *
- * -------------------------------------------------------------------- *
- * File              : what-primera.php                                 *
- * -------------------------------------------------------------------- *
- * Short description : Wernis requests                                  *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Auszahlungsanfragen                              *
- * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
- *                                                                      *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or    *
- * (at your option) any later version.                                  *
- *                                                                      *
- * This program is distributed in the hope that it will be useful,      *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
- * GNU General Public License for more details.                         *
- *                                                                      *
- * You should have received a copy of the GNU General Public License    *
- * along with this program; if not, write to the Free Software          *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
- * MA  02110-1301  USA                                                  *
- ************************************************************************/
-
-// Some security stuff...
-if (!defined('__SECURITY')) {
-       die();
-} elseif (!isMember()) {
-       // User is not logged in
-       redirectToIndexMemberOnlyModule();
-}
-
-// Add description as navigation point
-addMenuDescription('member', __FILE__);
-
-if ((!isExtensionActive('primera')) && (!isAdmin())) {
-       // Extension 'primera' is not activated
-       loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('primera'));
-       return;
-} // END - if
-
-// Check if the admin has entered the data
-if ((getConfig('primera_api_name') == '') || (getConfig('primera_api_md5') == '')) {
-       // Something important is missing...
-       loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_API_DATA_MISSING--}');
-       return;
-} // END - if
-
-// Init the content array and points
-$content = array();
-$points = false;
-
-// Is the mode set (payout only)
-if (!isGetRequestParameterSet('mode')) {
-       // Get referal id
-       $content['refid'] = getConfig(('primera_refid'));
-
-       // Is there an id?
-       if ((!empty($content['primera_nickname'])) && (!isGetRequestParameterSet('mode'))) {
-               // Then use an other "mode"
-               setGetRequestParameter('mode', 'list');
-
-               // And load all rows!
-               $result = SQL_QUERY_ESC("SELECT `id`,`primera_account`,`primera_amount`,`primera_timestamp`,`primera_type` FROM `{?_MYSQL_PREFIX?}_user_primera` WHERE `userid`=%s ORDER BY `primera_timestamp` DESC",
-                       array(getMemberId()), __FILE__, __LINE__);
-
-               // Load all rows
-               $content['rows'] = ''; $SW = 2;
-               while ($data = SQL_FETCHARRAY($result)) {
-                       // Prepare data for output
-                       $rowContent['primera_timestamp'] = generateDateTime($data['primera_timestamp'], 2);
-
-                       // Load row template
-                       $content['rows'] .= loadTemplate('member_primera_mode_list_row', true, $rowContent);
-                       $SW = 3 - $SW;
-               }
-
-               // Free result
-               SQL_FREERESULT($result);
-       } else {
-               // Mode pay
-               setGetRequestParameter('mode', 'pay');
-       }
-} // END - if
-
-if (getRequestParameter('mode') == 'pay') {
-       // Get total points and check if the user can request a payout
-       $points = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');
-
-       // No dots here...
-       $points = explode('.', $points);
-       $points = bigintval($points[0]);
-
-       // Remove the registration fee
-       $points = $points - getConfig('points_register');
-
-       // Is this enougth for a payout?
-       if ($points < getConfig('primera_min_payout')) {
-               // No, then abort here
-               loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_MIN_PAYOUT_PAYOUT--}');
-               return;
-       }
-
-       // Add points to content array
-       $content['points'] = $points;
-} else {
-       // Invalid mode!
-       loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_PRIMERA_MODE_INVALID', getRequestParameter('mode')));
-       return;
-}
-
-// Is the formular sent?
-if ((isFormSent()) && (isGetRequestParameterSet('mode'))) {
-       // Check input data depending on the mode and execute the requested mode
-       switch (getRequestParameter('mode')) {
-               case 'pay': // Payout this exchange -> Primus
-                       // Is the user id and password set?
-                       if (!isPostRequestParameterSet(('primera_nickname'))) {
-                               // Nothing entered in Primus nickname
-                               loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_EMPTY_USERNAME--}');
-                       } elseif (!isPostRequestParameterSet(('primera_password'))) {
-                               // Nothing entered in Primera password
-                               loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_EMPTY_PASSWORD--}');
-                       } elseif (!isPostRequestParameterSet(('amount'))) {
-                               // Nothing entered in amount
-                               loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_EMPTY_AMOUNT--}');
-                       } elseif (postRequestParameter('amount') != bigintval(postRequestParameter('amount'))) {
-                               // Only numbers in amount!
-                               loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_INVALID_AMOUNT--}');
-                       } elseif (postRequestParameter('amount') < getConfig('primera_min_payout')) {
-                               // Not enougth entered!
-                               loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_AMOUNT_SMALLER_MIN--}');
-                       } elseif (postRequestParameter('amount') > $points) {
-                               // Not enougth points left!
-                               loadTemplate('admin_settings_saved', false, sprintf(getMessage('MEMBER_PRIMERA_PAYOUT_POINTS_DEPLETED'), bigintval(postRequestParameter('amount')), bigintval($points)));
-                       } else {
-                               // All is fine here so do the payout
-                               $success = executePrimeraPayout(postRequestParameter('primera_nickname'), md5(postRequestParameter('primera_password')), postRequestParameter('amount'));
-                               if ($success) {
-                                       // Default is locked!
-                                       $locked = true;
-
-                                       // Shall I 'pay' the referal points imidiately?
-                                       if (getConfig('ref_payout') == '0') {
-                                               // Yes, 'pay' it now
-                                               $locked = false;
-                                       } // END - if
-
-                                       // Remove points from account
-                                       subtractPoints('primera_payout', getMemberId(), postRequestParameter('amount'));
-
-                                       // Update primera nickname
-                                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `primera_nickname`=%s WHERE `userid`=%s LIMIT 1",
-                                               array(postRequestParameter('primera_nickname'), getMemberId()), __FILE__, __LINE__);
-
-                                       // All done!
-                                       loadTemplate('admin_settings_saved', false, '{--MEMBER_PRIMERA_PAYOUT_DONE--}');
-                                       return;
-                               } elseif ((GET_PRIMERA_ERROR_CODE() == 'user_failed') || (GET_PRIMERA_ERROR_CODE() == 'own_failed') || (GET_PRIMERA_ERROR_CODE() == 'amount_failed') || (GET_PRIMERA_ERROR_CODE() == 'api_amount_failed')) {
-                                       // Wrong login data
-                                       loadTemplate('admin_settings_saved', false, GET_PRIMERA_ERROR_MESSAGE());
-                               } else {
-                                       // Something went wrong
-                                       loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_PRIMERA_PAYOUT_FAILED', GET_PRIMERA_ERROR_MESSAGE()));
-                               }
-                       }
-                       break;
-
-               default: // Invalid mode!
-                       logDebugMessage(__FILE__, __LINE__, sprintf("Invalid mode %s detected.", getRequestParameter('mode')));
-                       loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_PRIMERA_MODE_INVALID', getRequestParameter('mode')));
-                       return;
-       }
-} // END - if
-
-// Prepare mode for template name
-$mode = sprintf("member_primera_mode_%s", getRequestParameter('mode'));
-
-// Load the template
-loadTemplate($mode, false, $content);
-
-//
+// @DEPRECATED
 ?>