]> git.mxchange.org Git - mailer.git/commitdiff
New wrapper introduced, more usage of EL:
authorRoland Häder <roland@mxchange.org>
Tue, 24 Aug 2010 17:23:03 +0000 (17:23 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 24 Aug 2010 17:23:03 +0000 (17:23 +0000)
- New wrapper function 'generateWrappedUserEmailLink() introduced
- Adding/subtracting of user points now uses more EL, some minor rewrites
- Double surename was printed in admin_lock_user.tpl

inc/libs/user_functions.php
inc/modules/admin/what-add_points.php
inc/modules/admin/what-sub_points.php
inc/wrapper-functions.php
templates/de/emails/add-points.tpl
templates/de/emails/sub-points.tpl
templates/de/html/admin/admin_add_points.tpl
templates/de/html/admin/admin_lock_user.tpl
templates/de/html/admin/admin_sub_points.tpl

index 62daf7d8b29527d1d3650b31bc68bda80bf72158..eb6c96c344a88ebf4d5fa5dd47bf3922759ff829 100644 (file)
@@ -200,7 +200,7 @@ function addPageNavigation ($numPages, $offset, $showForm, $colspan, $return=fal
 }
 
 // Create email link to user's account
-function generateUserEmailLink($email, $mod = 'admin') {
+function generateUserEmailLink ($email, $mod = 'admin') {
        // Show contact link only if user is confirmed by default
        $locked = " AND `status`='CONFIRMED'";
 
index 003f955a47681d9ba7d221f58cd31a36e59d79a8..67821bb35bb05f61298d3db2d14e959bf6a5adff 100644 (file)
@@ -57,9 +57,6 @@ if (getRequestParameter('userid') == 'all') {
 
                // Process all entries
                while ($row = SQL_FETCHARRAY($result_main)) {
-                       // Merge both arrays
-                       $content = merge_array($content, $row);
-
                        // Remove depth to prevent booking errors. This is a bad coding
                        // practice, thats also why we need to write this project from
                        // scratch...
@@ -69,8 +66,10 @@ if (getRequestParameter('userid') == 'all') {
                        addPointsDirectly('admin_all', $content['userid'], bigintval(postRequestParameter('points')));
 
                        // Prepare content
-                       $content['text']   = SQL_ESCAPE(postRequestParameter('reason'));
-                       $content['points'] = bigintval(postRequestParameter('points'));
+                       $content = array(
+                               'reason' => SQL_ESCAPE(postRequestParameter('reason')),
+                               'points' => bigintval(postRequestParameter('points'))
+                       );
 
                        // Load email template and send email away
                        $message = loadEmailTemplate('add-points', $content, bigintval($content['userid']));
@@ -98,7 +97,7 @@ if (getRequestParameter('userid') == 'all') {
 
                        // Prepare content
                        $content = array(
-                               'text'   => SQL_ESCAPE(postRequestParameter('reason')),
+                               'reason' => SQL_ESCAPE(postRequestParameter('reason')),
                                'points' => bigintval(postRequestParameter('points'))
                        );
 
@@ -109,7 +108,6 @@ if (getRequestParameter('userid') == 'all') {
                        loadTemplate('admin_settings_saved', false, '{--ADMIN_POINTS_ADDED--}');
                } else {
                        // Prepare content
-                       $content['user']   = '<a href="' . generateEmailLink($content['email'], 'user_data') . '">' . $content['surname'] . ' ' . $content['family'] . '</a>';
                        $content['userid'] = bigintval(getRequestParameter('userid'));
 
                        // Output template
index 970de4c9a21d931fde2481f876eb67398f37a889..b7c6c86e88cc67a09da74412c1c5d7671d6ad2ad 100644 (file)
@@ -40,7 +40,7 @@
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
 addMenuDescription('admin', __FILE__);
@@ -61,9 +61,11 @@ if (getRequestParameter('userid') == 'all') {
                        // Ok, add points to used points and send an email to him...
                        subtractPoints('admin_all', $content['userid'], postRequestParameter('points'));
 
-                       // Add more content
-                       $content['text']   = SQL_ESCAPE(postRequestParameter('reason'));
-                       $content['points'] = bigintval(postRequestParameter('points'));
+                       // Prepare content
+                       $content = array(
+                               'reason' => SQL_ESCAPE(postRequestParameter('reason')),
+                               'points' => bigintval(postRequestParameter('points'))
+                       );
 
                        // Load message and send it away
                        $message = loadEmailTemplate('sub-points', $content, bigintval($content['userid']));
@@ -89,9 +91,11 @@ if (getRequestParameter('userid') == 'all') {
                        // Ok, add to used points and send an email to him...
                        subtractPoints('admin_single', bigintval(getRequestParameter('userid')), postRequestParameter('points'));
 
-                       // Add more content
-                       $content['text']   = SQL_ESCAPE(postRequestParameter('reason'));
-                       $content['points'] = bigintval(postRequestParameter('points'));
+                       // Prepare content
+                       $content = array(
+                               'reason' => SQL_ESCAPE(postRequestParameter('reason')),
+                               'points' => bigintval(postRequestParameter('points'))
+                       );
 
                        // Load email and send it away
                        $message = loadEmailTemplate('sub-points', $content, bigintval(getRequestParameter('userid')));
@@ -101,7 +105,6 @@ if (getRequestParameter('userid') == 'all') {
                        loadTemplate('admin_settings_saved', false, '{--ADMIN_POINTS_SUBTRACTED--}');
                } else {
                        // Prepare content
-                       $content['user']   = '<a href="' . generateEmailLink($content['email'], 'user_data') . '">' . translateGender($content['gender']) . ' ' . $content['surname'] . ' ' . $content['family'] . '</a>';
                        $content['userid'] = bigintval(getRequestParameter('userid'));
 
                        // Load form
index 918ad0a93a039bb7686851c30d9cfb01d4951b89..7480bb4cf9aaf48f43df58e007bb23f72690243a 100644 (file)
@@ -1944,5 +1944,11 @@ function isRawOutputMode () {
        return (getScriptOutputMode() == -1);
 }
 
+// Wrapper to generate a user email link
+function generateWrappedUserEmailLink ($email) {
+       // Just call the inner function
+       return generateEmailLink($email, 'user_data');
+}
+
 // [EOF]
 ?>
index f3a83da89a7927ba72bb4ef790ab684748974994..af5f3717499e45cefba31e72fc2b3e3e5b3876cc 100644 (file)
@@ -4,7 +4,7 @@ Einer unserer Administratoren hat Ihnen soeben {%pipe,translateComma=$content[po
 
 Grund dazu war folgender:
 ------------------------------
-$content[text]
+$content[reason]
 ------------------------------
 
 Mit freundlichen Gr&uuml;&szlig;en,
index 91ac7f449ab02d771d9cf6e04951381cea5e9f24..073d934c1113890dc7a34037a20664771a1bc8bb 100644 (file)
@@ -4,7 +4,7 @@ Einer unserer Administratoren hat Ihnen soeben {%pipe,translateComma=$content[po
 
 Grund dazu war folgender:
 ----------------
-$content[text]
+$content[reason]
 ----------------
 
 Mit freundlichen Gr&uuml;&szlig;en,
index 3cf7609c92200c3b656f25f8dbdaeb1ee807b5b3..76211559633499e8814833c33180b1e44c128c43 100644 (file)
@@ -4,7 +4,7 @@
        <tr>
                <td class="admin_title bottom" colspan="2" align="center">
                        {--ADMIN_ADD_POINTS_TO_USER--}:<br />
-                       <strong>$content[user]</strong>
+                       [<a href="{%user,email,generateWrappedUserEmailLink=$content[userid]%}">{%user,gender,translateGender=$content[userid]%} {%user,surname=$content[userid]%} {%user,family=$content[userid]%}</a>]
                </td>
        </tr>
        <tr>
index afa48b4d438c13b28475a531117ec01b622cf086..2c095109a17242acf9fb5aed7bdcd1e85a224830 100644 (file)
@@ -11,7 +11,7 @@
        </tr>
        <tr>
                <td align="center">
-                       [&nbsp;<a href="{%user,email,generateEmailLink=$content[userid]%}">{%user,surname=$content[userid]%} {%user,surname=$content[userid]%} ({%user,status,translateUserStatus=$content[userid]%})</a>&nbsp;]
+                       [&nbsp;<a href="{%user,email,generateWrappedUserEmailLink=$content[userid]%}">{%user,surname=$content[userid]%} {%user,family=$content[userid]%} ({%user,status,translateUserStatus=$content[userid]%})</a>&nbsp;]
                </td>
        </tr>
        <tr>
index 2179098a6e5259528554c89b7e75e946e040b278..b1c28e030eef19d76703b647cbdc03bc952797b8 100644 (file)
@@ -4,7 +4,7 @@
        <tr>
                <td class="admin_title bottom" colspan="2" align="center">
                        {--ADMIN_SUB_POINTS_FROM_USER--}:<br />
-                       <strong>$content[user]</strong>
+                       [<a href="{%user,email,generateWrappedUserEmailLink=$content[userid]%}">{%user,gender,translateGender=$content[userid]%} {%user,surname=$content[userid]%} {%user,family=$content[userid]%}</a>]
                </td>
        </tr>
        <tr>