./inc/cache/config-local.php:126:// @TODO Rewrite the following three constants, somehow...
./inc/classes/cachesystem.class.php:474: // @TODO Add support for more types which break in last else-block
./inc/config-functions.php:141: // @TODO Make this all better... :-/
-./inc/expression-functions.php:202:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
+./inc/expression-functions.php:166:// @TODO FILTER_COMPILE_CONFIG does not handle call-back functions so we handle it here again
./inc/expression-functions.php:48: // @TODO is escapeQuotes() enougth for strings with single/double quotes?
./inc/extensions/ext-html_mail.php:138: // @TODO Move these arrays into config
./inc/extensions/ext-menu.php:54: // @TODO Convert menu-Id to one coding-standard. admin(edit|_add) => admin_menu_(edit|add), mem(edit|_add) => mem_menu_(edit|add)
return $code;
}
-// Expression call-back function for fetching user data
-function doExpressionUser ($data) {
- // Use current userid by default
- $functionName = 'getMemberId()';
-
- // User-related data, so is there a userid?
- if (!empty($data['matches'][4][$data['key']])) {
- // Do we have a userid or $userid?
- if ($data['matches'][4][$data['key']] == '$userid') {
- // Use dynamic call
- $functionName = "getFetchedUserData('userid', \$userid, '" . $data['callback'] . "')";
- } elseif (!empty($data['matches'][4][$data['key']])) {
- // User data found
- $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')";
- }
- } elseif ((!empty($data['callback'])) && (isUserDataValid())) {
- // "Call-back" alias column for current logged in user's data
- $functionName = "getUserData('" . $data['callback'] . "')";
- }
-
- // Do we have another function to run (e.g. translations)
- if (!empty($data['extra_func'])) {
- // Surround the original function call with it
- $functionName = $data['extra_func'] . '(' . $functionName . ')';
- } // END - if
-
- // Generate replacer
- $replacer = '{DQUOTE} . ' . $functionName . ' . {DQUOTE}';
-
- // Now replace the code
- $code = replaceExpressionCode($data, $replacer);
-
- // Return replaced code
- return $code;
-}
-
// Expression call-back function for getting extension data
function doExpressionExt ($data) {
// Not installed is default
addAdminMenuSql('sponsor','edit_sponsor','Sponsor ändern','Sponsorenaccount ändern (Grundaten, nicht Freigabe!).', 4);
addAdminMenuSql('sponsor','lock_sponsor','Sponsor ent-/sperren','Sponsorenaccount sperren und entsperren.', 5);
addAdminMenuSql('sponsor','del_sponsor','Sponsor löschen','Sponsorenaccount löschen.', 6);
- addAdminMenuSql('sponsor','allow_sponsor_data','Datenverwaltung','Stellen Sie hier ein, welche Daten der Sponsor im Mitgliedsbereich über sicht anzeigen darf und welche nicht.', 7);
- addAdminMenuSql('sponsor','list_sponsor_pays','Bestellungen...','Bestellungen der Sponsoren auflisten / bearbeiten.', 8);
- addAdminMenuSql('sponsor','list_sponsor_menu','Sponsorenmenü','Das Sponsorenmenü kann hier geändert werden.', 9);
- addAdminMenuSql('sponsor','list_sponsor_campaigns','Kampagnen...','Management aller von Ihren Sponsoren eingerichteten Kampagnen.', 10);
- addAdminMenuSql('sponsor','list_sponsor_urls','URL-Management','Management (freischalten, sperren, löschen, testen, bearbeiten usw.) von gebuchten URLs.', 11);
- addAdminMenuSql('sponsor','list_sponsor_banner','Banner-Management','Management (freischalten, sperren, löschen, testen, bearbeiten usw.) von gebuchten Bannern.', 12);
- addAdminMenuSql('sponsor','list_sponsor_reg','Sponsor-Aktionen','Alle Sponsor-Aktionen auflisten und verwalten.', 13);
- addAdminMenuSql('sponsor','list_sponsor_pay','Buchungspakete','Die Sponsoren können sich {OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Pakete kaufen. Hier können Sie diese verwalten.', 14);
- addAdminMenuSql('sponsor','list_sponsor_conv','{OPEN_CONFIG}POINTS{CLOSE_CONFIG} umwandeln...','Mit den vom Sponsor gekauften {OPEN_CONFIG}POINTS{CLOSE_CONFIG} kann er Aktionen buchen. Hier stellen Sie die Umrechnungsrate von {OPEN_CONFIG}POINTS{CLOSE_CONFIG} nach Sponsoraktionen um. Beispiel: 1 {OPEN_CONFIG}POINTS{CLOSE_CONFIG} = 10 Mails.', 15);
- addAdminMenuSql('sponsor','config_sponsor','Einstellungen','Allgemeine Einstellungen am Sponsoring-System.', 16);
+ addAdminMenuSql('sponsor','sponsor_contct','Sponsor kontaktieren','Kontaktieren Sie Sponsoren komfortabel über dieses {?TITLE?}.', 7);
+ addAdminMenuSql('sponsor','allow_sponsor_data','Datenverwaltung','Stellen Sie hier ein, welche Daten der Sponsor im Mitgliedsbereich über sicht anzeigen darf und welche nicht.', 8);
+ addAdminMenuSql('sponsor','list_sponsor_pays','Bestellungen...','Bestellungen der Sponsoren auflisten / bearbeiten.', 9);
+ addAdminMenuSql('sponsor','list_sponsor_menu','Sponsorenmenü','Das Sponsorenmenü kann hier geändert werden.', 10);
+ addAdminMenuSql('sponsor','list_sponsor_campaigns','Kampagnen...','Management aller von Ihren Sponsoren eingerichteten Kampagnen.', 11);
+ addAdminMenuSql('sponsor','list_sponsor_urls','URL-Management','Management (freischalten, sperren, löschen, testen, bearbeiten usw.) von gebuchten URLs.', 12);
+ addAdminMenuSql('sponsor','list_sponsor_banner','Banner-Management','Management (freischalten, sperren, löschen, testen, bearbeiten usw.) von gebuchten Bannern.', 13);
+ addAdminMenuSql('sponsor','list_sponsor_reg','Sponsor-Aktionen','Alle Sponsor-Aktionen auflisten und verwalten.', 14);
+ addAdminMenuSql('sponsor','list_sponsor_pay','Buchungspakete','Die Sponsoren können sich {OPEN_CONFIG}POINTS{CLOSE_CONFIG}-Pakete kaufen. Hier können Sie diese verwalten.', 15);
+ addAdminMenuSql('sponsor','list_sponsor_conv','{OPEN_CONFIG}POINTS{CLOSE_CONFIG} umwandeln...','Mit den vom Sponsor gekauften {OPEN_CONFIG}POINTS{CLOSE_CONFIG} kann er Aktionen buchen. Hier stellen Sie die Umrechnungsrate von {OPEN_CONFIG}POINTS{CLOSE_CONFIG} nach Sponsoraktionen um. Beispiel: 1 {OPEN_CONFIG}POINTS{CLOSE_CONFIG} = 10 Mails.', 16);
+ addAdminMenuSql('sponsor','config_sponsor','Einstellungen','Allgemeine Einstellungen am Sponsoring-System.', 17);
addAdminMenuSql('repair','repr_sponsor','Sponsormenü','Gewichtung des Sponsormenüs reparieren.', 5);
//
// Menu system (still admin menu)
return $message;
}
+// Create email link to sponsor's account
+function generateSponsorEmailLink ($email, $mod = 'admin') {
+ // Show contact link only if sponsor is confirmed by default
+ $locked = " AND `status`='CONFIRMED'";
+
+ // But admins shall always see it
+ if (isAdmin()) $locked = '';
+
+ $result = SQL_QUERY_ESC("SELECT
+ `id`
+FROM
+ `{?_MYSQL_PREFIX?}_sponsor_data`
+WHERE
+ `email`='%s'" . $locked."
+LIMIT 1",
+ array($email), __FUNCTION__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
+ // Load sponsor_id
+ list($sponsor_id) = SQL_FETCHROW($result);
+
+ // Rewrite email address to contact link
+ $email = '{%url=modules.php?module=' . $mod . '&what=sponsor_contct&sponsor_id=' . bigintval($sponsor_id) . '%}';
+ } // END - if
+
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Return rewritten (?) email address
+ return $email;
+}
+
+// Processes a sponsor request and handles it
+function doProcessSponsorFormRequest ($messageArray = array()) {
+ // Default message
+ $message = '';
+
+ // Handle the request
+ $status = handleSponsorRequest(postRequestArray(), true, $messageArray, true);
+
+ // Check the status of the registration process
+ switch ($status) {
+ case 'added': // Sponsor successfully added with account status = UNCONFIRMED!
+ // Check for his id number
+ $result = SQL_QUERY_ESC("SELECT `id`, `hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `email`='%s' LIMIT 1",
+ array(postRequestParameter('email')), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
+ // id found so let's load it for the confirmation email
+ list($id, $hash) = SQL_FETCHROW($result);
+
+ // Prepare data for the email template
+ $content['id'] = $id;
+ $content['hash'] = $hash;
+ $content['email'] = secureString(postRequestParameter('email'));
+ $content['surname'] = secureString(postRequestParameter('surname'));
+ $content['family'] = secureString(postRequestParameter('family'));
+ $content['timestamp'] = generateDateTime(time(), 0);
+ $content['password'] = secureString(postRequestParameter('pass1'));
+
+ // Generate email and send it to the new sponsor
+ $message = loadEmailTemplate('sponsor_confirm', $hash);
+ sendEmail(postRequestParameter('email'), '{--SPONSOR_PLEASE_CONFIRM_SUBJECT--}', $message);
+
+ // Send mail to admin
+ sendAdminNotification('{--ADMIN_NEW_SPONSOR--}', 'admin_sponsor_reg', $hash);
+
+ // Output message: DONE
+ $message = $messageArray['added'];
+ } else {
+ // Sponsor account not found???
+ $message = getMaskedMessage('SPONSOR_EMAIL_404', postRequestParameter('email'));
+ }
+
+ // Free memory
+ SQL_FREERESULT($result);
+ break;
+
+ default:
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s detected.", $status));
+ if (!isAdmin()) {
+ // Message for testing admin
+ $message = getMaskedMessage('ADMIN_SPONSOR_UNKNOWN_STATUS', $status);
+ } else {
+ // Message for the guest
+ $message = getMaskedMessage('SPONSOR_UNKNOWN_STATUS', $status);
+ }
+ break;
+ }
+
+ // Return message
+ return $message;
+}
+
// [EOF]
?>
if ((!getTimestampFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) {
// Then insert it!
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')",
- array(bigintval($userid), $statsType, $statsData), __FUNCTION__, __LINE__);
+ array(
+ bigintval($userid),
+ $statsType,
+ $statsData
+ ), __FUNCTION__, __LINE__);
} elseif (is_array($statsData)) {
// Invalid data!
- logDebugMessage(__FUNCTION__, __LINE__, "userid={$userid},type={$statsType},data={".gettype($statsData).": Invalid statistics data type!");
+ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . $userid . ',type=' . $statsType . ',data=' . gettype($statsData) . ': Invalid statistics data type!');
}
}
+// Expression call-back function for fetching user data
+function doExpressionUser ($data) {
+ // Use current userid by default
+ $functionName = 'getMemberId()';
+
+ // User-related data, so is there a userid?
+ if (!empty($data['matches'][4][$data['key']])) {
+ // Do we have a userid or $userid?
+ if ($data['matches'][4][$data['key']] == '$userid') {
+ // Use dynamic call
+ $functionName = "getFetchedUserData('userid', \$userid, '" . $data['callback'] . "')";
+ } elseif (!empty($data['matches'][4][$data['key']])) {
+ // User data found
+ $functionName = "getFetchedUserData('userid', " . $data['matches'][4][$data['key']] . ", '" . $data['callback'] . "')";
+ }
+ } elseif ((!empty($data['callback'])) && (isUserDataValid())) {
+ // "Call-back" alias column for current logged in user's data
+ $functionName = "getUserData('" . $data['callback'] . "')";
+ }
+
+ // Do we have another function to run (e.g. translations)
+ if (!empty($data['extra_func'])) {
+ // Surround the original function call with it
+ $functionName = $data['extra_func'] . '(' . $functionName . ')';
+ } // END - if
+
+ // Generate replacer
+ $replacer = '{DQUOTE} . ' . $functionName . ' . {DQUOTE}';
+
+ // Now replace the code
+ $code = replaceExpressionCode($data, $replacer);
+
+ // Return replaced code
+ return $code;
+}
+
// [EOF]
?>
if (isFormSent()) {
// Save sponsor in database
- handleSponsorRequest(postRequestArray());
+ doProcessSponsorFormRequest();
} else {
// Output form
loadTemplate('admin_add_sponsor');
// Entries found so let's list them!
$OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
- // Transfer data to array
- $content = array(
- 'id' => $content['id'],
- 'gender' => $content['gender'],
- 'surname' => $content['surname'],
- 'family' => $content['family'],
- 'email' => generateEmailLink($content['email'], 'sponsor_data'),
- 'remote_addr' => $content['remote_addr'],
- 'sponsor_created' => generateDateTime($content['sponsor_created'], 2),
- );
+ // Translate some data
+ $content['sponsor_created'] = generateDateTime($content['sponsor_created'], 2);
// Load row template and switch colors
$OUT .= loadTemplate('admin_unlock_sponsor_row', true, $content);
postRequestParameter('last_curr' , $curr);
// Register sponsor but never ever update here!
- $STATUS = handleSponsorRequest(postRequestArray(), true, $messageArray, true);
-
- // Check the status of the registration process
- switch ($STATUS) {
- case 'added': // Sponsor successfully added with account status = UNCONFIRMED!
- // Check for his id number
- $result = SQL_QUERY_ESC("SELECT `id`, `hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `email`='%s' LIMIT 1",
- array(postRequestParameter('email')), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- // id found so let's load it for the confirmation email
- list($id, $hash) = SQL_FETCHROW($result);
-
- // Prepare data for the email template
- $content['id'] = $id;
- $content['hash'] = $hash;
- $content['email'] = secureString(postRequestParameter('email'));
- $content['surname'] = secureString(postRequestParameter('surname'));
- $content['family'] = secureString(postRequestParameter('family'));
- $content['timestamp'] = generateDateTime(time(), 0);
- $content['password'] = secureString(postRequestParameter('pass1'));
-
- // Generate email and send it to the new sponsor
- $message = loadEmailTemplate('sponsor_confirm', $hash);
- sendEmail(postRequestParameter('email'), '{--SPONSOR_PLEASE_CONFIRM_SUBJECT--}', $message);
-
- // Send mail to admin
- sendAdminNotification('{--ADMIN_NEW_SPONSOR--}', 'admin_sponsor_reg', $hash);
-
- // Output message: DONE
- $message = $messageArray['added'];
- } else {
- // Sponsor account not found???
- $message = getMaskedMessage('SPONSOR_EMAIL_404', postRequestParameter('email'));
- }
-
- // Free memory
- SQL_FREERESULT($result);
- break;
-
- default:
- logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s detected.", $STATUS));
- if (!isAdmin()) {
- // Message for testing admin
- $message = getMaskedMessage('ADMIN_SPONSOR_UNKNOWN_STATUS', $STATUS);
- } else {
- // Message for the guest
- $message = getMaskedMessage('SPONSOR_UNKNOWN_STATUS', $STATUS);
- }
- break;
- }
+ $message = doProcessSponsorFormRequest($messageArray);
// Display message
loadTemplate('admin_settings_saved', false, $message);
$EMAIL = generateAdminEmailLink($email);
} elseif ((isExtensionInstalledAndNewer('user', '0.3.3')) && ($table == 'user_data')) {
// Create email link for contacting a member within admin area (or later in other areas, too?)
- $EMAIL = generateUserEmailLink($email, 'admin');
+ $EMAIL = generateUserEmailLink($email);
} elseif ((isExtensionActive('sponsor')) && ($table == 'sponsor_data')) {
// Create email link to contact sponsor within admin area (or like the link above?)
- $EMAIL = generateSponsorEmailLink($email, 'sponsor_data');
+ $EMAIL = generateSponsorEmailLink($email);
}
// Shall I close the link when there is no admin?
<input type="checkbox" title="{--ID_SELECT--} $content[id]" name="id[$content[id]]" class="admin_normal" value="1" />
</td>
<td align="center" class="{%template,ColorSwitch%} bottom right">
- <a href="$content[email]">{%pipe,translateGender=$content[gender]%} $content[surname] $content[family]</a>
+ <a href="{%pipe,generateSponsorEmailLink=$content[email]%}">{%pipe,translateGender=$content[gender]%} $content[surname] $content[family]</a>
</td>
<td align="center" class="{%template,ColorSwitch%} bottom right">
$content[remote_addr]