X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_payouts.php;h=ec39c96dd5c8cbf6ad6bc73f5ea10109685cc1c7;hb=eb301334eb0960dd060cc0d59e6021260a41f835;hp=f9b7e02e47e9b762098221e7997a749356b508d1;hpb=fff3e2abc8ffb5a086fbf0f3a7d6b9f2ff5ddaed;p=mailer.git
diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php
index f9b7e02e47..ec39c96dd5 100644
--- a/inc/modules/admin/what-list_payouts.php
+++ b/inc/modules/admin/what-list_payouts.php
@@ -10,9 +10,14 @@
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Auflistung der 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 - 2008 by Roland Haeder *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -32,296 +37,258 @@
************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
-{
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
}
+
// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+addMenuDescription('admin', __FILE__);
-if (!empty($_GET['pid']))
-{
+if (isGetRequestElementSet(('pid'))) {
// First let's get the member's ID
- $result = SQL_QUERY_ESC("SELECT userid, target_account, payout_total, payout_timestamp, password FROM "._MYSQL_PREFIX."_user_payouts WHERE id=%d LIMIT 1",
- array($_GET['pid']), __FILE__, __LINE__);
- list($uid, $tuid, $points, $tstamp, $tpass) = SQL_FETCHROW($result);
+ $result = SQL_QUERY_ESC("SELECT userid, target_account, payout_total, payout_timestamp, password FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1",
+ array(getRequestElement('pid')), __FILE__, __LINE__);
+ list($userid, $tuserid, $points, $tstamp, $tpass) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
// Obtain some data
- if (empty($_GET['task']) && (!empty($uid)) && ($uid > 0))
- {
+ if (!isGetRequestElementSet(('task')) && (!empty($userid)) && ($userid > 0)) {
// Get task ID from database
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_task_system WHERE userid=%d AND task_type='PAYOUT_REQUEST' AND task_created='".$tstamp."' LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `userid`=%s AND `task_type`='PAYOUT_REQUEST' AND task_created='".$tstamp."' LIMIT 1",
+ array(bigintval($userid)), __FILE__, __LINE__);
list($task) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if (empty($task)) $task = "0";
-
- }
- elseif ((empty($uid)) || ($uid == "0"))
- {
+ if (empty($task)) $task = 0;
+ } elseif ((empty($userid)) || ($userid == '0')) {
// Cannot obtain member ID!
- LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_FAILED_OBTAIN_USERID);
- }
- else
- {
+ loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_FAILED_OBTAIN_USERID'));
+ } else {
// Get task ID from URL
- $task = $_GET['task'];
+ $task = getRequestElement('task');
}
- if ((!empty($task)) && (!empty($uid)) && ($uid > 0))
- {
+
+ if ((!empty($task)) && (!empty($userid)) && ($userid > 0)) {
// Load user's data
- $result = SQL_QUERY_ESC("SELECT email, sex, surname, family FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
- list($email, $sex, $surname, $family) = SQL_FETCHROW($result);
+ $result = SQL_QUERY_ESC("SELECT `email`, `gender`, `surname`, `family` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
+ array(bigintval($userid)), __FILE__, __LINE__);
+ list($email, $gender, $surname, $family) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- // Konstante bauen
- define('PAYOUT_USERDATA_VALUE', "".TRANSLATE_SEX($sex)." ".$surname." ".$family."");
-
- if (($_GET['do'] == "accept") && (!empty($email)))
- {
+ if ((getRequestElement('do') == 'accept') && (!empty($email))) {
// Ok, now we can output the form or execute accepting
- if (isset($_POST['ok']))
- {
+ if (isFormSent()) {
// Obtain payout type and other data
- $result = SQL_QUERY_ESC("SELECT payout_id FROM "._MYSQL_PREFIX."_user_payouts WHERE id=%d LIMIT 1",
- array(bigintval($_GET['pid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `payout_id` FROM `{?_MYSQL_PREFIX?}_user_payouts` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('pid'))), __FILE__, __LINE__);
list($ptype) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if (!empty($ptype))
- {
+ if (!empty($ptype)) {
// Obtain data from payout type
- $result = SQL_QUERY_ESC("SELECT from_account, from_pass, engine_url, engine_ret_ok, engine_ret_failed, pass_enc, allow_url FROM "._MYSQL_PREFIX."_payout_types WHERE id=%d LIMIT 1",
- array(bigintval($ptype)), __FILE__, __LINE__);
- list($fuid, $fpass, $eurl, $eok, $failed, $eenc, $allow) = SQL_FETCHROW($result);
+ $result = SQL_QUERY_ESC("SELECT `from_account`, `from_pass`, `engine_url`, `engine_ret_ok`, `engine_ret_failed`, `pass_enc`, `allow_url`
+FROM
+ `{?_MYSQL_PREFIX?}_payout_types`
+WHERE
+ `id`=%s
+LIMIT 1",
+ array(bigintval($ptype)), __FILE__, __LINE__);
+ list($fuserid, $fpass, $eurl, $eok, $failed, $eenc, $allow) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- if (!empty($eurl))
- {
+ if (!empty($eurl)) {
// Ok, run URL...
- $eurl = COMPILE_CODE($eurl);
- switch ($eenc)
- {
- case "md5":
- $fpass = md5($fpass);
- $tpass = md5($tpass);
- break;
-
- case "base64":
- $fpass = base64_encode($fpass);
- $tpass = base64_encode($tpass);
- break;
+ $eurl = compileCode($eurl);
+ switch ($eenc) {
+ case 'md5':
+ $fpass = md5($fpass);
+ $tpass = md5($tpass);
+ break;
+
+ case 'base64':
+ $fpass = base64_encode($fpass);
+ $tpass = base64_encode($tpass);
+ break;
}
// Transfer variables...
$eval = "\$URL = \"".$eurl."\";";
- $reason = urlencode(base64_encode(PAYOUT_REASON_PAYOUT));
+ $reason = encodeString(getMessage('PAYOUT_REASON_PAYOUT'), false);
// Run code...
+ // @TODO Do we need this time-consuming eval() here?
eval($eval);
// Execute transfer
- $ret = @file($URL);
- }
- else
- {
+ $ret = sendGetRequest($URL);
+ } else {
// No URL to run
$ret[0] = $eok;
}
- if ($ret[0] == $eok)
- {
+
+ if ($ret[0] == $eok) {
// Clear task
- if ($task > 0)
- {
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_task_system SET status='SOLVED' WHERE id=%d LIMIT 1",
- array(bigintval($task)),__FILE__, __LINE__);
+ if ($task > 0) {
+ runFilterChain('solve_task', $task);
}
// Clear payout request
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_payouts SET status='ACCEPTED' WHERE id=%d LIMIT 1",
- array(bigintval($_GET['pid'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_payouts` SET `status`='ACCEPTED' WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('pid'))), __FILE__, __LINE__);
// Send out mail
- $msg = LOAD_EMAIL_TEMPLATE("member_payout_accepted", $_POST['text'], $uid);
+ $message = loadEmailTemplate('member_payout_accepted', postRequestElement('text'), $userid);
// Output message
- if ($allow == 'Y')
- {
+ if ($allow == 'Y') {
// Banner / Textlink request
- LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_BANNER_ACCEPTED_NOTIFIED);
- }
- else
- {
+ loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_BANNER_ACCEPTED_NOTIFIED'));
+ } else {
// Normal request
- LOAD_TEMPLATE("admin_settings_saved", false, PAYOUT_ACCEPTED_NOTIFIED);
+ loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_ACCEPTED_NOTIFIED'));
}
// Finally send mail
- SEND_EMAIL($email, PAYOUT_ACCEPTED_SUBJECT, $msg);
- }
- else
- {
+ sendEmail($email, getMessage('PAYOUT_ACCEPTED_SUBJECT'), $message);
+ } else {
// Something goes wrong... :-(
- $content = implode("
", $ret);
- LOAD_TEMPLATE("admin_payout_failed_transfer", false, $content);
+ $content = implode("
", $ret);
+ loadTemplate('admin_payout_failed_transfer', false, $content);
}
- }
- else
- {
+ } else {
// Cannot load payout id
- OUTPUT_HTML ("".PAYOUT_FAILED_OBTAIN_PAYOUT_ID."");
+ loadTemplate('admin_settings_saved', false, "