From c76b715b7067dfea0f29d08503edf3b1da2ddcfd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 24 Aug 2010 17:23:03 +0000 Subject: [PATCH] New wrapper introduced, more usage of EL: - 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 | 2 +- inc/modules/admin/what-add_points.php | 12 +++++------- inc/modules/admin/what-sub_points.php | 19 +++++++++++-------- inc/wrapper-functions.php | 6 ++++++ templates/de/emails/add-points.tpl | 2 +- templates/de/emails/sub-points.tpl | 2 +- templates/de/html/admin/admin_add_points.tpl | 2 +- templates/de/html/admin/admin_lock_user.tpl | 2 +- templates/de/html/admin/admin_sub_points.tpl | 2 +- 9 files changed, 28 insertions(+), 21 deletions(-) diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 62daf7d8b2..eb6c96c344 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -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'"; diff --git a/inc/modules/admin/what-add_points.php b/inc/modules/admin/what-add_points.php index 003f955a47..67821bb35b 100644 --- a/inc/modules/admin/what-add_points.php +++ b/inc/modules/admin/what-add_points.php @@ -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'] = '' . $content['surname'] . ' ' . $content['family'] . ''; $content['userid'] = bigintval(getRequestParameter('userid')); // Output template diff --git a/inc/modules/admin/what-sub_points.php b/inc/modules/admin/what-sub_points.php index 970de4c9a2..b7c6c86e88 100644 --- a/inc/modules/admin/what-sub_points.php +++ b/inc/modules/admin/what-sub_points.php @@ -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'] = '' . translateGender($content['gender']) . ' ' . $content['surname'] . ' ' . $content['family'] . ''; $content['userid'] = bigintval(getRequestParameter('userid')); // Load form diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 918ad0a93a..7480bb4cf9 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -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] ?> diff --git a/templates/de/emails/add-points.tpl b/templates/de/emails/add-points.tpl index f3a83da89a..af5f371749 100644 --- a/templates/de/emails/add-points.tpl +++ b/templates/de/emails/add-points.tpl @@ -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üßen, diff --git a/templates/de/emails/sub-points.tpl b/templates/de/emails/sub-points.tpl index 91ac7f449a..073d934c11 100644 --- a/templates/de/emails/sub-points.tpl +++ b/templates/de/emails/sub-points.tpl @@ -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üßen, diff --git a/templates/de/html/admin/admin_add_points.tpl b/templates/de/html/admin/admin_add_points.tpl index 3cf7609c92..7621155963 100644 --- a/templates/de/html/admin/admin_add_points.tpl +++ b/templates/de/html/admin/admin_add_points.tpl @@ -4,7 +4,7 @@ {--ADMIN_ADD_POINTS_TO_USER--}:
- $content[user] + [{%user,gender,translateGender=$content[userid]%} {%user,surname=$content[userid]%} {%user,family=$content[userid]%}] diff --git a/templates/de/html/admin/admin_lock_user.tpl b/templates/de/html/admin/admin_lock_user.tpl index afa48b4d43..2c095109a1 100644 --- a/templates/de/html/admin/admin_lock_user.tpl +++ b/templates/de/html/admin/admin_lock_user.tpl @@ -11,7 +11,7 @@ - [ {%user,surname=$content[userid]%} {%user,surname=$content[userid]%} ({%user,status,translateUserStatus=$content[userid]%}) ] + [ {%user,surname=$content[userid]%} {%user,family=$content[userid]%} ({%user,status,translateUserStatus=$content[userid]%}) ] diff --git a/templates/de/html/admin/admin_sub_points.tpl b/templates/de/html/admin/admin_sub_points.tpl index 2179098a6e..b1c28e030e 100644 --- a/templates/de/html/admin/admin_sub_points.tpl +++ b/templates/de/html/admin/admin_sub_points.tpl @@ -4,7 +4,7 @@ {--ADMIN_SUB_POINTS_FROM_USER--}:
- $content[user] + [{%user,gender,translateGender=$content[userid]%} {%user,surname=$content[userid]%} {%user,family=$content[userid]%}] -- 2.39.5