// Wether the current user is a sponsor
function isSponsor () {
- // Failed...
+ // Failed is default
$ret = false;
- if ((isSessionVariableSet('sponsor_id')) && (isSessionVariableSet('sponsorpass'))) {
- // Check cookies against database records...
- $result = SQL_QUERY_ESC("SELECT
- `id`
-FROM
- `{?_MYSQL_PREFIX?}_sponsor_data`
-WHERE
- `id`=%s AND `password`='%s' AND `status`='CONFIRMED'
-LIMIT 1",
- array(
- bigintval(getSession('sponsor_id')),
- getSession('sponsorpass')
- ), __FUNCTION__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- // All is fine
- $ret = true;
- } // END - if
- // Free memory
- SQL_FREERESULT($result);
- } // END - if
+ // Determine it
+ $ret = (
+ (isSessionVariableSet('sponsor_id')) &&
+ (isSessionVariableSet('sponsorpass')) &&
+ (fetchSponsorData(getSession('sponsor_id')))
+ );
// Return status
return $ret;
}
// Prepare data for the main template
- $content = array(
- 'title' => $content['main_title'],
- 'menu' => $SUB
- );
+ $content['menu'] = $SUB;
// Load menu template
$OUT .= loadTemplate('sponsor_action', true, $content);
//
function addSponsorContent ($what) {
- $OUT = '';
+ // Init sponsor content
+ $GLOBALS['sponsor_output'] = '';
+
+ // Generate IFN (Include FileName)
$INC = sprintf("inc/modules/sponsor/%s.php", $what);
if (isIncludeReadable($INC)) {
- // Every sponsor action will output nothing directly. It will be written into $OUT!
+ // Every sponsor action will output nothing directly. It will be written into $GLOBALS['sponsor_output']!
loadIncludeOnce($INC);
} else {
// File not found!
- $OUT .= loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_CONTENT_404', $what));
+ $GLOBALS['sponsor_output'] .= loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_CONTENT_404', $what));
}
// Return content
- return $OUT;
+ return $GLOBALS['sponsor_output'];
}
//
// This update went fine?
$login = (SQL_AFFECTEDROWS() == 1);
- }
+ } // END - if
// Return status
return $login;
return $GLOBALS['sponsor_data'][getCurrentSponsorId()][$column];
}
+// Determines the country of the given sponsor id
+function determineSponsorCountry ($sponsor_id) {
+ // Then handle it over
+ $country = getSponsorData('country');
+
+ // Return it
+ return $country;
+}
+
// [EOF]
?>