]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Some language strings fixed, renamed. Copyright notice updated
[mailer.git] / inc / functions.php
index bbedbfac613af442e27d49845ebcbc167b16ede8..c00fee3cde06c00bfe9c3d4a095f32a2eaecaf25 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -2333,7 +2333,10 @@ function isSpider () {
        $userAgent = trim(strtolower(detectUserAgent(true)));
 
        // It should not be empty, if so it is better a spider/bot
-       if (empty($userAgent)) return true;
+       if (empty($userAgent)) {
+               // It is a spider/bot
+               return true;
+       } // END - if
 
        // Is it a spider?
        return ((strpos($userAgent, 'spider') !== false) || (strpos($userAgent, 'slurp') !== false) || (strpos($userAgent, 'bot') !== false) || (strpos($userAgent, 'archiver') !== false));
@@ -2427,7 +2430,7 @@ function capitalizeUnderscoreString ($str) {
                // "Walk" through all elements and make them lower-case but first upper-case
                foreach ($strArray as $part) {
                        // Capitalize the string part
-                       $capitalized .= ucfirst(strtolower($part));
+                       $capitalized .= firstCharUpperCase($part);
                } // END - foreach
 
                // Store the converted string in cache array
@@ -2438,6 +2441,54 @@ function capitalizeUnderscoreString ($str) {
        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
 //-----------------------------------------------------------------------------