+// Capitalizes a string with underscores, e.g.: some_foo_string will become SomeFooString
+// Note: This function is cached
+function capitalizeUnderscoreString ($str) {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][$str])) {
+ // Init target string
+ $capitalized = '';
+
+ // Explode it with the underscore, but rewrite dashes to underscore before
+ $strArray = explode('_', str_replace('-', '_', $str));
+
+ // "Walk" through all elements and make them lower-case but first upper-case
+ foreach ($strArray as $part) {
+ // Capitalize the string part
+ $capitalized .= firstCharUpperCase($part);
+ } // END - foreach
+
+ // Store the converted string in cache array
+ $GLOBALS[__FUNCTION__][$str] = $capitalized;
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$str];
+}
+
+// Generate admin links for mail order
+// mailType can be: 'mid' or 'bid'
+function generateAdminMailLinks ($mailType, $mailId) {
+ // Init variables
+ $OUT = '';
+ $table = '';
+
+ // Default column for mail status is 'data_type'
+ // @TODO Rename column data_type to e.g. mail_status
+ $statusColumn = 'data_type';
+
+ // Which mail do we have?
+ switch ($mailType) {
+ case 'bid': // Bonus mail
+ $table = 'bonus';
+ break;
+
+ case 'mid': // Member mail
+ $table = 'pool';
+ break;
+
+ default: // Handle unsupported types
+ logDebugMessage(__FUNCTION__, __LINE__, 'Unsupported mail type ' . $mailType . ' for mailId=' . $mailId . ' detected.');
+ $OUT = '<div align="center">{%message,ADMIN_UNSUPPORTED_MAIL_TYPE_DETECTED=' . $mailType . '%}</div>';
+ break;
+ } // END - switch
+
+ // Is the mail type supported?
+ if (!empty($table)) {
+ // Query for the mail
+ $result = SQL_QUERY_ESC("SELECT `id`, `%s` AS `mail_status` FROM `{?_MYSQL_PREFIX?}_%s` WHERE `id`=%s LIMIT 1",
+ array($statusColumn, $table, bigintval($mailId)), __FILE__, __LINE__);
+
+ // Do we have one entry there?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load the entry
+ $content = SQL_FETCHARRAY($result);
+ die('<pre>'.print_r($content, true).'</pre>');
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ } // END - if
+
+ // Return generated HTML code
+ return $OUT;
+}
+
+//-----------------------------------------------------------------------------
+// Automatically re-created functions, all taken from user comments on www.php.net
+//-----------------------------------------------------------------------------