X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_sponsor.php;h=22f892f7c25f525504dadd5d71678ec6ae9d2cdc;hb=eb301334eb0960dd060cc0d59e6021260a41f835;hp=56710771282dc4c6e60c80525928b11d791a1247;hpb=b73c135350d7ed266c0cac680105707139bd892d;p=mailer.git
diff --git a/inc/modules/admin/what-list_sponsor.php b/inc/modules/admin/what-list_sponsor.php
index 5671077128..22f892f7c2 100644
--- a/inc/modules/admin/what-list_sponsor.php
+++ b/inc/modules/admin/what-list_sponsor.php
@@ -10,14 +10,20 @@
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Alle Sponsoren und deren Details auflisten *
* -------------------------------------------------------------------- *
- * *
+ * $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 *
+ * 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. *
+ * 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 *
@@ -31,98 +37,86 @@
************************************************************************/
// Some security stuff...
-if ((!defined('__SECURITY')) || (!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['id'])) {
+if (isGetRequestElementSet('id')) {
// Show detailed informations to a sponsor
$result = SQL_QUERY_ESC("SELECT company, position, gender, surname, family, street_nr1, street_nr2, zip, city, country, phone, fax, cell, email, url, tax_ident, status, sponsor_created, last_online, last_change, receive_warnings, points_amount, points_used, remote_addr, warning_interval, refid, ref_count
-FROM "._MYSQL_PREFIX."_sponsor_data
-WHERE id='%s' LIMIT 1",
- array(bigintval($_GET['id'])), __FILE__, __LINE__);
+FROM `{?_MYSQL_PREFIX?}_sponsor_data`
+WHERE `id`='%s' LIMIT 1",
+ array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load sponsor details
- $DATA = SQL_FETCHARRAY($result);
+ $content = SQL_FETCHARRAY($result);
SQL_FREERESULT($result);
// Check if an entry is empty
- foreach ($DATA as $k => $v) {
- if (empty($v)) $DATA[$k] = "---";
+ foreach ($content as $k => $v) {
+ if (empty($v)) $content[$k] = '---';
}
// Check for sponsor's orders (only count)
- $result_orders = SQL_QUERY_ESC("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_sponsor_orders WHERE sponsorid='%s'",
- array(bigintval($_GET['id'])), __FILE__, __LINE__);
+ $result_orders = SQL_QUERY_ESC("SELECT COUNT(id) FROM `{?_MYSQL_PREFIX?}_sponsor_orders` WHERE sponsorid='%s'",
+ array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
list($orders) = SQL_FETCHROW($result_orders);
SQL_FREERESULT($result_orders);
if (empty($orders)) $orders = 0;
// Prepare all data for the template
// Sponsor's ID
- define('__SPONSOR_ID' , $_GET['id']);
- // Company's data
- define('__SPONSOR_COMPANY' , $DATA['company']);
- define('__SPONSOR_POSITION' , $DATA['position']);
- define('__SPONSOR_TAX_IDENT' , $DATA['tax_ident']);
+ $content['id'] = getRequestElement('id');
// Personal data
- define('__SPONSOR_GENDER' , TRANSLATE_GENDER($DATA['gender']));
- define('__SPONSOR_SURNAME' , $DATA['surname']);
- define('__SPONSOR_FAMILY' , $DATA['family']);
- define('__SPONSOR_STREET1' , $DATA['street_nr1']);
- define('__SPONSOR_STREET2' , $DATA['street_nr2']);
- define('__SPONSOR_ZIP' , $DATA['zip']);
- define('__SPONSOR_CITY' , $DATA['city']);
- define('__SPONSOR_COUNTRY' , $DATA['country']);
+ $content['gender'] = translateGender($content['gender']);
// Contact data
- define('__SPONSOR_PHONE' , $DATA['phone']);
- define('__SPONSOR_FAX' , $DATA['fax']);
- define('__SPONSOR_CELL' , $DATA['cell']);
- define('__SPONSOR_EMAIL' , "mailto:".$DATA['email']);
- define('__SPONSOR_EMAIL_VALUE', $DATA['email']);
- define('__SPONSOR_URL' , DEREFERER($DATA['url']));
+ $content['email_link'] = generateEmailLink($content['email'], 'sponsor_data');
+ $content['url'] = generateDerefererUrl($content['url']);
// Timestamps
- define('__SPONSOR_CREATED' , MAKE_DATETIME($DATA['sponsor_created'], "2"));
- define('__SPONSOR_LAST_ONLINE', MAKE_DATETIME($DATA['last_online'], "2"));
- define('__SPONSOR_LAST_CHANGE', MAKE_DATETIME($DATA['last_change'], "2"));
+ $content['created'] = generateDateTime($content['sponsor_created'], '2');
+ $content['last_online'] = generateDateTime($content['last_online'], '2');
+ $content['last_change'] = generateDateTime($content['last_change'], '2');
// Sponsor points
- define('__SPONSOR_AMOUNT' , TRANSLATE_COMMA($DATA['points_amount']));
- define('__SPONSOR_USED' , TRANSLATE_COMMA($DATA['points_used']));
+ $content['points_amount'] = translateComma($content['points_amount']);
+ $content['points_used'] = translateComma($content['points_used']);
// Warning because low points
- define('__SPONSOR_REC_WARNING', TRANSLATE_YESNO($DATA['receive_warnings']));
- define('__SPONSOR_INTERVAL' , CREATE_FANCY_TIME($DATA['warning_interval']));
+ $content['receive_warnings'] = translateYesNo($content['receive_warnings']);
+ $content['warning_interval'] = createFancyTime($content['warning_interval']);
// Orders total
- define('__SPONSOR_ORDERS' , $orders);
+ $content['orders'] = $orders;
// Other data
- define('__SPONSOR_STATUS' , SPONSOR_TRANSLATE_STATUS($DATA['status']));
- define('__SPONSOR_REFID' , $DATA['refid']);
- define('__SPONSOR_REMOTE_ADR' , $DATA['remote_addr']);
- define('__SPONSOR_REFS' , $DATA['ref_count']);
+ $content['status'] = sponsorTranslateUserStatus($content['status']);
// Load template
- LOAD_TEMPLATE("admin_list_sponsor_details");
+ loadTemplate('admin_list_sponsor_details', false, $content);
} else {
// Sponsor not found
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SPONSOR_404_1.$_GET['id'].ADMIN_SPONSOR_404_2);
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_404'), getRequestElement('id')));
}
-} elseif (!empty($_GET['rid'])) {
+} elseif (isGetRequestElementSet('rid')) {
// Search for sponsor
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_sponsor_data WHERE id='%s' LIMIT 1",
- array(bigintval($_GET['rid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `id`='%s' LIMIT 1",
+ array(bigintval(getRequestElement('rid'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Free memory
SQL_FREERESULT($result);
- // Sponsor found so let's list all his referrals
- $result = SQL_QUERY_ESC("SELECT id, gender, surname, family, email, status, sponsor_created, last_online, points_amount, points_used, remote_addr, ref_count
-FROM "._MYSQL_PREFIX."_sponsor_data
-WHERE refid='%s' ORDER BY id",
- array(bigintval($_GET['rid'])), __FILE__, __LINE__);
+ // Sponsor found so let's list all his referals
+ $result = SQL_QUERY_ESC("SELECT
+ `id`, `gender`, `surname`, `family`, `email`, `status`,
+ `sponsor_created`, `last_online`, `points_amount`, `points_used`,
+ `remote_addr`, `ref_count`
+FROM
+ `{?_MYSQL_PREFIX?}_sponsor_data`
+WHERE
+ `refid`='%s'
+ORDER BY
+ `id` ASC",
+ array(bigintval(getRequestElement('rid'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// List refs now
@@ -130,51 +124,57 @@ WHERE refid='%s' ORDER BY id",
SQL_FREERESULT($result);
} else {
// No refs made so far
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SPONSOR_REFS_404_1."".bigintval($_GET['rid'])."".ADMIN_SPONSOR_REFS_404_2);
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_REFS_404'), "".bigintval(getRequestElement('rid')).""));
}
} else {
// Sponsor not found
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SPONSOR_404_1.bigintval($_GET['rid']).ADMIN_SPONSOR_404_2);
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_404'), bigintval(getRequestElement('rid'))));
}
} else {
// List all sponsors
- $result_main = SQL_QUERY("SELECT id, gender, surname, family, email, status, sponsor_created, last_online, points_amount, points_used, remote_addr
-FROM "._MYSQL_PREFIX."_sponsor_data ORDER BY id", __FILE__, __LINE__);
+ $result_main = SQL_QUERY("SELECT
+ `id`, `gender`, `surname`, `family`, `email`, `status`,
+ `sponsor_created`, `last_online`, `points_amount`, `points_used`, `remote_addr`
+FROM
+ `{?_MYSQL_PREFIX?}_sponsor_data`
+ORDER BY
+ `id` ASC", __FILE__, __LINE__);
+
if (SQL_NUMROWS($result_main) > 0) {
// At least one sponsor found!
- $OUT = ""; $SW = 2;
- while(list($id, $gender, $sname, $fname, $email, $status, $created, $last, $amount, $used, $ip) = SQL_FETCHROW($result_main)) {
+ $OUT = ''; $SW = 2;
+ while ($content = SQL_FETCHARRAY($result_main)) {
// Transfer data to array
+ // @TODO Rewritings: surname->surname,family->family,ip->remote_addr in template
$content = array(
- 'id' => $id,
+ 'id' => $content['id'],
'sw' => $SW,
- 'gender' => TRANSLATE_GENDER($gender),
- 'sname' => $sname,
- 'fname' => $fname,
- 'email' => "mailto:".$email,
- 'status' => SPONSOR_TRANSLATE_STATUS($status),
- 'created' => MAKE_DATETIME($created, "2"),
- 'last' => MAKE_DATETIME($last, "2"),
- 'points' => TRANSLATE_COMMA($amount - $used),
- 'ip' => $ip,
+ 'gender' => translateGender($content['gender']),
+ 'surname' => $content['surname'],
+ 'family' => $content['family'],
+ 'email' => generateEmailLink($content['email'], 'sponsor_data'),
+ 'status' => sponsorTranslateUserStatus($content['status']),
+ 'created' => generateDateTime($content['sponsor_created'], '2'),
+ 'last_online' => generateDateTime($content['last_online'], '2'),
+ 'points' => translateComma($content['points_amount'] - $content['points_used']),
+ 'ip' => $content['remote_addr'],
);
// Load row template
- $OUT .= LOAD_TEMPLATE("admin_list_sponsor_row", true, $content);
+ $OUT .= loadTemplate('admin_list_sponsor_row', true, $content);
$SW = 3 - $SW;
}
// Free memory
SQL_FREERESULT($result_main);
- define('__SPONSOR_ROWS', $OUT);
// Load final template
- LOAD_TEMPLATE("admin_list_sponsor");
+ loadTemplate('admin_list_sponsor', false, $OUT);
} else {
// No sponsors registered so far
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_SPONSOR_NONE_REGISTERED);
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_SPONSOR_NONE_REGISTERED'));
}
}
-//
+// [EOF]
?>