projects
/
mailer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f34c00b
)
Code cleanup, more usage of API functions
author
Roland Häder
<roland@mxchange.org>
Thu, 16 Sep 2010 22:38:44 +0000
(22:38 +0000)
committer
Roland Häder
<roland@mxchange.org>
Thu, 16 Sep 2010 22:38:44 +0000
(22:38 +0000)
inc/functions.php
patch
|
blob
|
history
inc/libs/online_functions.php
patch
|
blob
|
history
inc/modules/admin/what-list_sponsor.php
patch
|
blob
|
history
inc/modules/admin/what-unlock_sponsor.php
patch
|
blob
|
history
inc/template-functions.php
patch
|
blob
|
history
ref.php
patch
|
blob
|
history
sponsor_ref.php
patch
|
blob
|
history
diff --git
a/inc/functions.php
b/inc/functions.php
index 0622a21253fab406f6936504702ebf86f0019418..5f3727065a6c36b0c7a2163add3d555586000bd8 100644
(file)
--- a/
inc/functions.php
+++ b/
inc/functions.php
@@
-1950,7
+1950,7
@@
function determineReferalId () {
}
// Set cookie when default refid > 0
}
// Set cookie when default refid > 0
- if (!isSessionVariableSet('refid') || (
!empty
($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isConfigEntrySet('def_refid')) && (isValidUserId(getConfig('def_refid'))))) {
+ if (!isSessionVariableSet('refid') || (
isValidUserId
($GLOBALS['refid'])) || ((!isValidUserId(getSession('refid'))) && (isConfigEntrySet('def_refid')) && (isValidUserId(getConfig('def_refid'))))) {
// Default is not found
$found = false;
// Default is not found
$found = false;
diff --git
a/inc/libs/online_functions.php
b/inc/libs/online_functions.php
index 209e8bbe6d8814e5929db336b3f7d2dde3db21e8..a989e1f2a29be41dd08731557fc402900e5a277d 100644
(file)
--- a/
inc/libs/online_functions.php
+++ b/
inc/libs/online_functions.php
@@
-95,7
+95,7
@@
LIMIT 1",
getModule(),
$action,
getWhat(),
getModule(),
$action,
getWhat(),
-
$userid
,
+
makeDatabaseUserId($userid)
,
makeDatabaseUserId(determineReferalId()),
$isMember,
$isAdmin,
makeDatabaseUserId(determineReferalId()),
$isMember,
$isAdmin,
@@
-109,7
+109,7
@@
LIMIT 1",
getModule(),
$action,
getWhat(),
getModule(),
$action,
getWhat(),
-
$userid
,
+
makeDatabaseUserId($userid)
,
makeDatabaseUserId(determineReferalId()),
$isMember,
$isAdmin,
makeDatabaseUserId(determineReferalId()),
$isMember,
$isAdmin,
diff --git
a/inc/modules/admin/what-list_sponsor.php
b/inc/modules/admin/what-list_sponsor.php
index 89db1c6400e981f4625d30f1147e5e2fb66f6763..70ee8d05e06377e1482806ff9c32a7bb38a740ce 100644
(file)
--- a/
inc/modules/admin/what-list_sponsor.php
+++ b/
inc/modules/admin/what-list_sponsor.php
@@
-131,7
+131,9
@@
ORDER BY
`id`, `gender`, `surname`, `family`, `email`, `status`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`,
UNIX_TIMESTAMP(`last_online`) AS `last_online`,
`id`, `gender`, `surname`, `family`, `email`, `status`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`,
UNIX_TIMESTAMP(`last_online`) AS `last_online`,
- `points_amount`, `points_used`, `remote_addr`
+ `points_amount`, `points_used`,
+ (`points_amount` + `points_used`) AS `points`,
+ `remote_addr`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
ORDER BY
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
ORDER BY
@@
-145,7
+147,6
@@
ORDER BY
$content['email'] = generateEmailLink($content['email'], 'sponsor_data');
$content['sponsor_created'] = generateDateTime($content['sponsor_created'], 2);
$content['last_online'] = generateDateTime($content['last_online'], 2);
$content['email'] = generateEmailLink($content['email'], 'sponsor_data');
$content['sponsor_created'] = generateDateTime($content['sponsor_created'], 2);
$content['last_online'] = generateDateTime($content['last_online'], 2);
- $content['points'] = ($content['points_amount'] - $content['points_used']);
// Load row template
$OUT .= loadTemplate('admin_list_sponsor_row', true, $content);
// Load row template
$OUT .= loadTemplate('admin_list_sponsor_row', true, $content);
diff --git
a/inc/modules/admin/what-unlock_sponsor.php
b/inc/modules/admin/what-unlock_sponsor.php
index adb9b19b47719e6af6b9dd30c990ac42fcfcf4bd..86e4cdba73a176554459f1a444ddf475976af393 100644
(file)
--- a/
inc/modules/admin/what-unlock_sponsor.php
+++ b/
inc/modules/admin/what-unlock_sponsor.php
@@
-59,7
+59,9
@@
if (isFormSent()) {
$result_main = SQL_QUERY_ESC("SELECT
`id`, `gender`, `surname`, `family`, `email`, `remote_addr`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`,
$result_main = SQL_QUERY_ESC("SELECT
`id`, `gender`, `surname`, `family`, `email`, `remote_addr`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`,
- `points_amount`, `points_used`, `refid`
+ `points_amount`, `points_used`,
+ (`points_amount` + `points_used`) AS `points`,
+ `refid`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
WHERE
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
WHERE
@@
-73,9
+75,6
@@
LIMIT 1",
// Load data
$content = SQL_FETCHARRAY($result_main);
// Load data
$content = SQL_FETCHARRAY($result_main);
- // Add total amount
- $content['points'] = ($content['points_amount'] - $content['points_used']);
-
// Check for open payments and close them
$result = SQL_QUERY_ESC("SELECT
so.admin_id, so.pay_count,
// Check for open payments and close them
$result = SQL_QUERY_ESC("SELECT
so.admin_id, so.pay_count,
diff --git
a/inc/template-functions.php
b/inc/template-functions.php
index 8f1349c454df6a6b5093b3c363c55b87b4b2dfc0..4da8ef31b200524115d5b34bb1e23de321738988 100644
(file)
--- a/
inc/template-functions.php
+++ b/
inc/template-functions.php
@@
-276,7
+276,6
@@
function loadTemplate ($template, $return = false, $content = array()) {
// Init some data
$ret = '';
// Init some data
$ret = '';
- if (empty($GLOBALS['refid'])) $GLOBALS['refid'] = '0';
// Base directory
$basePath = sprintf("%stemplates/%s/html/", getPath(), getLanguage());
// Base directory
$basePath = sprintf("%stemplates/%s/html/", getPath(), getLanguage());
diff --git
a/ref.php
b/ref.php
index b1a99dd2f0244892617e6d83699d6eb23829c987..59fe143ffc9056c664c9083a010df4155fef4c64 100644
(file)
--- a/
ref.php
+++ b/
ref.php
@@
-51,7
+51,7
@@
setContentType('text/html');
// No refid by default
$URL = 'modules.php?module=index';
// No refid by default
$URL = 'modules.php?module=index';
-if (
determineReferalId() != 0
) {
+if (
isValidUserId(determineReferalId())
) {
// Test if nickname or numeric id
if (isExtensionActive('nickname')) {
// Nickname in URL, so load the id
// Test if nickname or numeric id
if (isExtensionActive('nickname')) {
// Nickname in URL, so load the id
@@
-80,7
+80,7
@@
if (determineReferalId() != 0) {
if (isValidUserId(determineReferalId())) {
// Update ref counter
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1",
if (isValidUserId(determineReferalId())) {
// Update ref counter
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`=%s LIMIT 1",
- array(
determineReferalId(
)), __FILE__, __LINE__);
+ array(
makeDatabaseUserId(determineReferalId()
)), __FILE__, __LINE__);
// Base URL for redirection
switch (getConfig('refid_target')) {
// Base URL for redirection
switch (getConfig('refid_target')) {
diff --git
a/sponsor_ref.php
b/sponsor_ref.php
index 75459c79a924375bb8371891f0ddc86b5fdc29f3..1171583ceeb252ce7319ea47ae949c04d9060e6e 100644
(file)
--- a/
sponsor_ref.php
+++ b/
sponsor_ref.php
@@
-53,7
+53,7
@@
setContentType('text/html');
$URL = 'modules.php?module=index&what=sponsor_reg&refid=';
// Do we have a referal id?
$URL = 'modules.php?module=index&what=sponsor_reg&refid=';
// Do we have a referal id?
-if (
!empty
($GLOBALS['refid'])) {
+if (
isValidUserId
($GLOBALS['refid'])) {
// We have an refid here. So we simply add it
$URL .= $GLOBALS['refid'];
} else {
// We have an refid here. So we simply add it
$URL .= $GLOBALS['refid'];
} else {