X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_refs.php;h=7a80938a64205042b4d5a2089b55139947425fe4;hb=eb301334eb0960dd060cc0d59e6021260a41f835;hp=8bfb68fe4b984454da7325f1ecb73ba0563a59f2;hpb=c9b40c60f41f98b38ec8eaa279305f6854afb8ae;p=mailer.git
diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php
index 8bfb68fe4b..7a80938a64 100644
--- a/inc/modules/admin/what-list_refs.php
+++ b/inc/modules/admin/what-list_refs.php
@@ -18,7 +18,7 @@
* Highly modified by Roland Haeder *
* *
* -------------------------------------------------------------------- *
- * 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 *
@@ -38,21 +38,20 @@
************************************************************************/
// 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', __FILE__);
+addMenuDescription('admin', __FILE__);
-if (REQUEST_ISSET_GET('uid')) {
+if (isGetRequestElementSet('userid')) {
// Secure userid
- $uid = bigintval(REQUEST_GET('uid'));
+ $userid = bigintval(getRequestElement('userid'));
// Check if the user already exists
- $result_user = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
- array($uid), __FILE__, __LINE__);
+ $result_user = SQL_QUERY_ESC("SELECT `userid` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
+ array($userid), __FILE__, __LINE__);
// Fix missing variable
$result_levels = false;
@@ -60,17 +59,17 @@ if (REQUEST_ISSET_GET('uid')) {
// User found?
if (SQL_NUMROWS($result_user) == 1) {
// Get total refs
- $menge = GET_TOTAL_DATA($uid, 'user_data', 'userid', 'refid', true);
- $menge_lck = GET_TOTAL_DATA($uid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
+ $menge = countSumTotalData($userid, 'user_data', 'userid', 'refid', true);
+ $menge_lck = countSumTotalData($userid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
// Output info message
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink(REQUEST_GET('uid')), $menge, $menge_lck));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink(getRequestElement('userid')), $menge, $menge_lck));
// Load all referal levels
$result_levels = SQL_QUERY("SELECT
`level`, `percents`
FROM
- `{!_MYSQL_PREFIX!}_refdepths`
+ `{?_MYSQL_PREFIX?}_refdepths`
WHERE
`level` > 0
ORDER BY
@@ -85,20 +84,20 @@ ORDER BY
$levels['sw'] = $SW;
// Is the refback still active? ;-)
- if (EXT_IS_ACTIVE('refback')) {
+ if (isExtensionActive('refback')) {
// Load all refs of this user
- $result_refs = SQL_QUERY_ESC("SELECT `refid` FROM `{!_MYSQL_PREFIX!}_user_refs` WHERE `userid`=%s AND `level`='%s' ORDER BY refid ASC",
- array($uid, $levels['level']), __FILE__, __LINE__);
- //* DEBUG: */ echo $uid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs)."
\n";
+ $result_refs = SQL_QUERY_ESC("SELECT `refid` FROM `{?_MYSQL_PREFIX?}_user_refs` WHERE `userid`=%s AND `level`='%s' ORDER BY refid ASC",
+ array($userid, $levels['level']), __FILE__, __LINE__);
+ //* DEBUG: */ outputHtml($userid.'/'.$levels['level'].'/'.SQL_NUMROWS($result_refs)."
");
// Do we have levels?
if (SQL_NUMROWS($result_refs) > 0) {
// Count entries
- $menge = GET_TOTAL_DATA($uid, 'user_data', 'userid', 'refid', true);
- $menge_lck = GET_TOTAL_DATA($uid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
+ $menge = countSumTotalData($userid, 'user_data', 'userid', 'refid', true);
+ $menge_lck = countSumTotalData($userid, 'user_data', 'userid', 'refid', true, " AND `status` != 'CONFIRMED'");
// Output info message
- $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($uid), $menge, $menge_lck);
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($userid), $menge, $menge_lck);
// Init variables
$OUT_REFS = ''; $SW = 2;
@@ -106,7 +105,7 @@ ORDER BY
// Load all refs
while ($content = SQL_FETCHARRAY($result_refs)) {
// Query for data
- $result_user = SQL_QUERY_ESC("SELECT `userid`, `gender`, `surname`, `family`, `email`, `status`, `joined` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
+ $result_user = SQL_QUERY_ESC("SELECT `userid`, `gender`, `surname`, `family`, `email`, `status`, `joined` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
array($content['refid']), __FILE__, __LINE__);
// Is the data there?
@@ -115,7 +114,7 @@ ORDER BY
$data = SQL_FETCHARRAY($result_user);
// Check for referals
- $refs_cnt = GET_TOTAL_DATA($data['userid'], 'refsystem', 'counter');
+ $refs_cnt = countSumTotalData($data['userid'], 'refsystem', 'counter');
// Prepare data for the template
$content = array(
@@ -134,10 +133,10 @@ ORDER BY
if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($data['userid'], $refs_cnt, "list_refs");
// Load template for level one
- $OUT_REFS .= LOAD_TEMPLATE('admin_list_refs_row', true, $content);
+ $OUT_REFS .= loadTemplate('admin_list_refs_row', true, $content);
} else {
// No refs found
- $OUT_REFS = LOAD_TEMPLATE('admin_list_refs_nodata', true, $content['refid']);
+ $OUT_REFS = loadTemplate('admin_list_refs_nodata', true, $content['refid']);
}
// Free result
@@ -151,20 +150,20 @@ ORDER BY
} // END - while
} else {
// Output info message
- $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($uid), '0', '0');
+ $levels['info'] = sprintf(getMessage('ADMIN_USER_TOTAL_REFS'), generateUserProfileLink($userid), '0', '0');
// No refs found
- $levels['rows'] = LOAD_TEMPLATE('admin_list_refs_norefs', true, array('uid' => $uid));
+ $levels['rows'] = loadTemplate('admin_list_refs_norefs', true, array('userid' => $userid));
}
// Free result
SQL_FREERESULT($result_refs);
// Load level template
- $OUT .= LOAD_TEMPLATE('admin_list_refs_level', true, $levels);
+ $OUT .= loadTemplate('admin_list_refs_level', true, $levels);
} else {
// Check for referals
- $refs_cnt = GET_TOTAL_DATA($levels['userid'], 'user_data', 'userid', 'refid', true);
+ $refs_cnt = countSumTotalData($levels['userid'], 'user_data', 'userid', 'refid', true);
// Prepare data for the template
$content = array(
@@ -183,7 +182,7 @@ ORDER BY
if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink($levels['userid'], $refs_cnt, 'list_refs');
// Load template for level one
- $OUT .= LOAD_TEMPLATE('admin_list_refs_row', true, $content);
+ $OUT .= loadTemplate('admin_list_refs_row', true, $content);
// Switch colors
$SW = 3 - $SW;
@@ -193,35 +192,35 @@ ORDER BY
// Prepare content
$content = array(
'rows' => $OUT,
- 'uid' => generateUserProfileLink(REQUEST_GET('uid'))
+ 'userid' => generateUserProfileLink(getRequestElement('userid'))
);
// Load main template
- if (EXT_IS_ACTIVE('refback')) {
- LOAD_TEMPLATE('admin_list_refs2', false, $content);
+ if (isExtensionActive('refback')) {
+ loadTemplate('admin_list_refs2', false, $content);
} else {
- LOAD_TEMPLATE('admin_list_refs', false, $content);
+ loadTemplate('admin_list_refs', false, $content);
}
- } elseif (EXT_IS_ACTIVE('refback')) {
+ } elseif (isExtensionActive('refback')) {
// No levels found, very bad!
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_REF_LEVELS'));
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_REF_LEVELS'));
} else {
// No refs made so far
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('USER_REF_404'));
+ loadTemplate('admin_settings_saved', false, getMessage('USER_REF_404'));
}
// Free result
SQL_FREERESULT($result_levels);
} else {
// User not found
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid')));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid')));
}
// Free memory
SQL_FREERESULT($result_user);
} else {
// Output selection form with all confirmed user accounts listed
- ADD_MEMBER_SELECTION_BOX();
+ addMemberSelectionBox();
}
// [EOF]