Swapped out more HTML to templates (see ticket #68)
authorRoland Häder <roland@mxchange.org>
Wed, 28 Nov 2012 17:40:12 +0000 (17:40 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 28 Nov 2012 17:40:12 +0000 (17:40 +0000)
18 files changed:
.gitattributes
inc/email-functions.php
inc/filters.php
inc/functions.php
inc/language/de.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-config_register.php
inc/modules/admin/what-extensions.php
inc/modules/admin/what-send_coupon.php
inc/modules/guest/what-stats.php
inc/modules/guest/what-wernis_portal.php
inc/modules/member/what-order.php
inc/modules/sponsor/account.php
inc/mysql-manager.php
inc/purge/purge-inact.php
inc/template-functions.php
templates/de/html/display_email.tpl [new file with mode: 0644]
templates/de/html/guest/guest_wernis_news.tpl [new file with mode: 0644]

index 662e05498a191d121a00da795b21daeb1f93b64a..a1d804a5dce2ecb875b09b80c813b62e0c973c81 100644 (file)
@@ -1679,6 +1679,7 @@ templates/de/html/birthday/birthday_msg.tpl svneol=native#text/plain
 templates/de/html/copyright.tpl svneol=native#text/plain
 templates/de/html/copyright_backlink.tpl svneol=native#text/plain
 templates/de/html/css_inline.tpl svneol=native#text/plain
+templates/de/html/display_email.tpl svneol=native#text/plain
 templates/de/html/doubler/.htaccess svneol=native#text/plain
 templates/de/html/doubler/doubler_banner.tpl svneol=native#text/plain
 templates/de/html/doubler/doubler_footer.tpl svneol=native#text/plain
@@ -1835,6 +1836,7 @@ templates/de/html/guest/guest_top10_empty5.tpl svneol=native#text/plain
 templates/de/html/guest/guest_top10_row_earner.tpl svneol=native#text/plain
 templates/de/html/guest/guest_top10_row_login.tpl svneol=native#text/plain
 templates/de/html/guest/guest_top10_row_refs.tpl svneol=native#text/plain
+templates/de/html/guest/guest_wernis_news.tpl svneol=native#text/plain
 templates/de/html/impressum.tpl svneol=native#text/plain
 templates/de/html/index.tpl svneol=native#text/plain
 templates/de/html/index_forward.tpl svneol=native#text/plain
index 4a2fc72ba32ef0cdf93c56bed613a99d02a83fce..e477edac1b790c209be0958b073173bfb152071e 100644 (file)
@@ -82,13 +82,17 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
 
        // Debug mode enabled?
        if (isDebugModeEnabled()) {
-               // In debug mode we want to display the mail instead of sending it away so we can debug this part
-               outputHtml('<pre>
-<strong>Headers</strong> : ' . htmlentities(trim($mailHeader)) . '
-<strong>To</strong>      : ' . htmlentities($toEmail) . '
-<strong>Subject</strong> : ' . htmlentities($subject) . '
-<strong>Message(' . strlen($message) . ')</strong> : ' . htmlentities($message) . '
-</pre>');
+               // Init content array
+               $content = array(
+                       'headers' => htmlentities(trim($mailHeader)),
+                       'to'      => htmlentities($toEmail),
+                       'subject' => htmlentities($subject),
+                       'message' => htmlentities($message),
+                       'length'  => strlen($message)
+               );
+
+               // In debug mode display the mail instead of sending it away so it can be debugged
+               loadTemplate('display_email', FALSE, $content);
 
                // This is always fine
                return TRUE;
index 0c6b4980219f94f7cae42e6c628141f3aa84b50d..ce8f99fcd8c47a7ddf374c5c43218163d58a6362 100644 (file)
@@ -673,7 +673,7 @@ function FILTER_REMOVE_EXTENSION () {
 // Filter for flushing the output
 function FILTER_FLUSH_OUTPUT () {
        // Simple, he?
-       outputHtml('');
+       outputHtml();
 }
 
 // Prepares an SQL statement part for HTML mail and/or holiday dependency
index 1935e2a8ccedda9cacd01492dec25e57fe0f4df6..f5aa6344ab45c0058035f7a6b872f92b2c14aa40 100644 (file)
@@ -1209,7 +1209,7 @@ function isUrlValidSimple ($url) {
 
 // Wtites data to a config.php-style file
 // @TODO Rewrite this function to use readFromFile() and writeToFile()
-function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0) {
+function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $inserted, $seek = 0) {
        // Initialize some variables
        $done = FALSE;
        $seek++;
@@ -1237,7 +1237,7 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0
                                // Start reading
                                while (!feof($fp)) {
                                        // Read from source file
-                                       $line = fgets ($fp, 1024);
+                                       $line = fgets($fp, 1024);
 
                                        if (isInString($search, $line)) {
                                                $next = '0';
@@ -1268,18 +1268,22 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $inserted, $seek=0
                        fclose($fp);
 
                        if (($done === TRUE) && ($found === TRUE)) {
-                               // Copy back tmp file and delete tmp :-)
+                               // Copy back temporary->FQFN file and ...
                                copyFileVerified($tmp, $FQFN, 0644);
+
+                               // ... delete temporay file :-)
                                return removeFile($tmp);
                        } elseif ($found === FALSE) {
-                               outputHtml('<strong>CHANGE:</strong> 404!');
+                               // Entry not found
+                               logDebugMessage(__FUNCTION__, __LINE__, 'File ' . basename($FQFN) . ' cannot be changed: comment=' . $comment . ',prefix=' . $prefix . ',inserted=' . $inserted . ',seek=' . $seek . ' - 404!');
                        } else {
-                               outputHtml('<strong>TMP:</strong> UNDONE!');
+                               // Temporary file not fully written
+                               logDebugMessage(__FUNCTION__, __LINE__, 'File ' . basename($FQFN) . ' cannot be changed: comment=' . $comment . ',prefix=' . $prefix . ',inserted=' . $inserted . ',seek=' . $seek . ' - Temporary file unfinished!');
                        }
                }
        } else {
                // File not found, not readable or writeable
-               reportBug(__FUNCTION__, __LINE__, 'File not readable/writeable. file=' . basename($FQFN));
+               reportBug(__FUNCTION__, __LINE__, 'File not readable/writeable. file=' . basename($FQFN) . ',comment=' . $comment . ',prefix=' . $prefix . ',inserted=' . $inserted . ',seek=' . $seek);
        }
 
        // An error was detected!
index b919fecf88b117d5e5b58fe3a01840b9a6db77ce..ac297af6a6c64dfdd3aed33d179c1bf71c7a8180 100644 (file)
@@ -1397,6 +1397,12 @@ addMessages(array(
        'ADMIN_USER_AMOUNT_PERCENTS' => "Prozentualer Anteil",
        'ADMIN_TOTAL_POINTS_AMOUNT' => "Gesamtanzahl {?POINTS?}",
        'ADMIN_LIST_USER_AMOUNTS_NOTICE' => "Diese Auflistung zeigt das Gesamtguthaben aller Mitglieder einzelnt und in der Gesamtsumme an. Dabei ist der Abzug bereits mit eingerechnet.",
+
+       // Displaying email if in debug mode
+       'EMAIL_DISPLAY_HEADERS' => "Kopfzeilen:",
+       'EMAIL_DISPLAY_TO_ADDRESS' => "An:",
+       'EMAIL_DISPLAY_SUBJECT_LINE' => "Betreffzeile:",
+       'EMAIL_DISPLAY_MESSAGE_LENGTH' => "Nachricht(L&auml;nge):",
 ));
 
 // Description of all months
index 19cb263f5b3c25970ecc3a3c33dd757971ec67f7..13a66c760d6011b56398a0c8ea17d5dc856d9c3a 100644 (file)
@@ -91,7 +91,7 @@ function outputStandardOverview (&$result_tasks) {
                                } // END - if
 
                                if (isset($GLOBALS['cache_array']['always_active'][$ext_name])) {
-                                       // Maybe we want to keept the current extension active?
+                                       // Shall the current extension kept activated?
                                        if (($GLOBALS['cache_array']['always_active'][$ext_name] == 'Y') && (!isExtensionActive($ext_name))) {
                                                // Reactivate this extension!
                                                doActivateExtension($ext_name);
index eec09e7723e895ae0c34eb6c7ac6b2967ad33f91..bd94bfd0c794d0233b8f259a40ae614802e2888e 100644 (file)
@@ -43,7 +43,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-// Do we want to save changes?
+// Save changes?
 if (isFormSent('save_config')) {
        // Begin counting
        $count = 0;
@@ -52,7 +52,11 @@ if (isFormSent('save_config')) {
        foreach (postRequestElement('sel') as $id => $value) {
                // Update database
                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_must_register` SET `field_required`='%s' WHERE `id`=%s AND `field_required` != '%s' LIMIT 1",
-                       array($value, bigintval($id), $value),__FILE__, __LINE__);
+                       array(
+                               $value,
+                               bigintval($id),
+                               $value
+                       ),__FILE__, __LINE__);
 
                // Get affected rows
                $count += SQL_AFFECTEDROWS();
index 52e243e51ddc8138fdaa9356a04828cf670b9436..c787c6bb35bb8add903c9b7f38a0552b55ce7085 100644 (file)
@@ -43,7 +43,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-// Normally we want the overview of all registered extensions
+// By default generate overview of all installed extensions
 $do = 'overview';
 
 if (isGetRequestElementSet('register_ext')) {
@@ -73,7 +73,11 @@ if (isGetRequestElementSet('register_ext')) {
 
                        // Update database
                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='%s' WHERE `id`=%s AND `ext_active`='%s' LIMIT 1",
-                               array($active, bigintval($ext_id), $ext_active), __FILE__, __LINE__);
+                               array(
+                                       $active,
+                                       bigintval($ext_id),
+                                       $ext_active
+                               ), __FILE__, __LINE__);
 
                        // Run embeded SQL commands
                        doExtensionSqls($ext_id, getExtensionMode());
index 65995d8c68e80a95cec64ae15c9091f9446f46b0..5d8ec24a8254d25303bb63603161de92747f47bd 100644 (file)
@@ -99,9 +99,9 @@ ORDER BY
                                // Look for a unique id
                                while (!$isUnique) {
                                        /*
-                                        * Add a coupon for this user, first we need to create a
-                                        * table-unique "id". The function generatePassword() can do
-                                        * this job for us but we want to exclude some characters.
+                                        * Add a coupon for this user, first generate a
+                                        * "table-unique" id number. generatePassword() can do this
+                                        * but with some characters excluded.
                                         */
                                        $couponCode = generatePassword(30, array('-', '+', '_', '/', '.'));
 
index f53674e51a725517f16689d80d350e36e07e82da..b341e0ecd4e4372dc79f2237d7e62f4e32637d0b 100644 (file)
@@ -49,15 +49,16 @@ if ((!isExtensionActive('user')) && (!isAdmin())) {
        return;
 } // END - if
 
-// Determine which stats we want and set mode and title for the link below stats block
-if (!isGetRequestElementSet('do')) {
-       setGetRequestElement('do', strtolower(getConfig('guest_stats')));
-} // END - if
+// Default mode is from config
+$do = getConfig('guest_stats');
 
-// Set config temporarily
-setConfigEntry('guest_stats', strtoupper(getRequestElement('do')));
+// Determine which stats are wanted and set mode and title for the link below stats block
+if (isGetRequestElementSet('do')) {
+       // Use it from get value
+       $do = getRequestElement('do');
+} // END - if
 
-switch (getRequestElement('do')) {
+switch ($do) {
        case 'members' :
                $lmode = 'modules';
                break;
@@ -72,7 +73,7 @@ switch (getRequestElement('do')) {
 
        default:
                // Unsupported mode
-               reportBug(__FILE__, __LINE__, sprintf("Unsupported mode <span class=\"data\">%s</span> detected.", getRequestElement('do')));
+               reportBug(__FILE__, __LINE__, sprintf("Unsupported mode <span class=\"data\">%s</span> detected.", SQL_ESCAPE($do)));
                break;
 } // END - switch
 
@@ -80,7 +81,7 @@ switch (getRequestElement('do')) {
 $ltitle = '{--GUEST_STATS_' . strtoupper($lmode) . '--}';
 
 // @TODO This can be rewritten in a dynamic include
-switch (getConfig('guest_stats')) {
+switch (strtoupper($do)) {
        case 'MEMBERS': // Statistics about your members
                // Only males / females
                $male   = countSumTotalData('M', 'user_data', 'userid', 'gender', TRUE, runFilterChain('user_exclusion_sql', " AND `status`='CONFIRMED'"));
index 45558fa73c7a883839d0b1d7eb76f7062c298f1b..273dd233629dfcf5c8adf5465c683c602b18ea57 100644 (file)
@@ -51,7 +51,7 @@ if ((!isExtensionActive('wernis')) && (!isAdmin())) {
        return;
 } // END - if
 
-outputHtml('<div style="padding-left: 10px; padding-right: 10px">');
+// Init PDF/RDF parser class
 $rdf = new fase4_rdf();
 $rdf->_use_nl2br = FALSE;
 $rdf->use_dynamic_display(FALSE);
@@ -81,9 +81,8 @@ if (isProxyUsed()) {
 
 $rdf->parse_RDF('http://www.wds66.com/rss.xml');
 
-// Fix to avoid 'headers already sent' bug. Thanks to Profi-Concept
-outputHtml($rdf->finish(TRUE));
-outputHtml('</div>');
+// Load template
+loadTemplate('guest_wernis_news', FALSE, $rdf->finish(TRUE));
 
 // [EOF]
 ?>
index 0078fc0a25b3abaf731a5bcc3aac2e2ac3bd4cd6..f4799ce3be7c9ecf4db27ac19258c0f1ebda932e 100644 (file)
@@ -674,7 +674,7 @@ LIMIT 1",
                                        // Default is no ZIP code
                                        $content['zip_content'] = '';
 
-                                       // Do we want ZIP code or not?
+                                       // Is sending to ZIP code enabled? (logged-in admin can always send to it)
                                        if ((isOrderMultiPageEnabled()) || (isAdmin())) {
                                                // Yes
                                                if (postRequestElement('zip') > 0) {
index 85d03fa713fd45c122c3651d52abf587ee5bf657..9be23f33a8d56e66acb93782f83b233ca4563b6f 100644 (file)
@@ -94,7 +94,7 @@ if (SQL_NUMROWS($result) == 1) {
                                // Default is we don't want to change password!
                                $PASS_AND = ''; $PASS_DATA = '';
 
-                               // Check if we want to change password or not
+                               // Check if the sponsor wants to change his/her password
                                if ((postRequestElement('pass1') == postRequestElement('pass2')) && (isPostRequestElementSet('pass1')) && (postRequestElement('pass1') != postRequestElement('pass_old'))) {
                                        // Change current password
                                        $PASS_AND  = ",`password`='%s'";
index 69b023ff4c58576c78812acc8180bf803588c20f..b22cde7b393c6d0727c967cd6c3c4ad5bf3535a0 100644 (file)
@@ -1773,7 +1773,7 @@ function reduceRecipientReceivedMails ($column, $id, $count) {
                // Now load all userids for one big query!
                $userids = array();
                while ($data = SQL_FETCHARRAY($result)) {
-                       // By default we want to reduce and have no mails found
+                       // By default reduce and found no emails
                        $num = 0;
 
                        // We must now look if he has already confirmed this mail, so might sound double, but it may resolve problems
index da6b87a34e22b451430c3cef7defe743b38c1857..8004c7995f06b22f576d523183fa281d8a1fbe69 100644 (file)
@@ -120,8 +120,11 @@ ORDER BY
        // Free memory
        SQL_FREERESULT($result_inactive);
 
-       // Now let's have a look for inactive accounts we want to delete we newly use the same exclude list
-       // here for e.g. excluding holiday users
+       /*
+        * Now let's have a look for inactive accounts for deletion. Use the newly
+        * added exclude list here for e.g. excluding holiday users, test users et
+        * cetera.
+        */
        $result_inactive = SQL_QUERY("SELECT
        `userid`,
        `email`,
index a4c4d6f0a9f114da1630cba0dfb5805466aeea63..fe01016b23aa1d8f44fa7a7262812e5b678b7af5 100644 (file)
@@ -93,7 +93,7 @@ function getColorSwitchCode ($template) {
 }
 
 // Output HTML code directly or 'render' it. You addionally switch the new-line character off
-function outputHtml ($htmlCode, $newLine = TRUE) {
+function outputHtml ($htmlCode = NULL, $newLine = TRUE) {
        // Init output
        if (!isset($GLOBALS['__output'])) {
                $GLOBALS['__output'] = '';
@@ -101,7 +101,7 @@ function outputHtml ($htmlCode, $newLine = TRUE) {
 
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'getOutputMode()=' . getOutputMode() . ',htmlCode(length)=' . strlen($htmlCode) . ',output(length)=' . strlen($GLOBALS['__output']));
        // Is there HTML-Code here?
-       if (!empty($htmlCode)) {
+       if ((!is_null($htmlCode)) && (!empty($htmlCode))) {
                // Yes, so we handle it as you have configured
                switch (getOutputMode()) {
                        case 'render':
diff --git a/templates/de/html/display_email.tpl b/templates/de/html/display_email.tpl
new file mode 100644 (file)
index 0000000..8f54321
--- /dev/null
@@ -0,0 +1,6 @@
+<pre>
+       <strong>{--EMAIL_DISPLAY_HEADERS--}</strong> $content[headers]
+       <strong>{--EMAIL_DISPLAY_TO_ADDRESS--}</strong> $content[to]
+       <strong>{--EMAIL_DISPLAY_SUBJECT_LINE--}</strong> $content[subject]
+       <strong>{--EMAIL_DISPLAY_MESSAGE_LENGTH--}($content[length])</strong> $content[message]
+</pre>
diff --git a/templates/de/html/guest/guest_wernis_news.tpl b/templates/de/html/guest/guest_wernis_news.tpl
new file mode 100644 (file)
index 0000000..4dec46e
--- /dev/null
@@ -0,0 +1,3 @@
+<div style="padding-left: 10px; padding-right: 10px">
+$content
+</div>