From: Roland Häder Date: Tue, 28 Jun 2011 05:25:17 +0000 (+0000) Subject: Function generateGenderSelectionBox() introduced, some cleanups: X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=544aa3fb48613160f812515673e64c46d18d2e1d Function generateGenderSelectionBox() introduced, some cleanups: - Function generateGenderSelectionBox() introduced which will generate a selection box for the gender - Some minor cleanups/improvements here and there - TODOs.txt updated --- diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 27afa7a1e4..4ac881be1c 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -161,7 +161,7 @@ ./inc/modules/guest/what-mediadata.php:181:// @TODO Rewrite all these if-blocks to filters ./inc/modules/guest/what-mediadata.php:68: // @TODO Find a better formular than this one ./inc/modules/guest/what-rallyes.php:89: // @TODO Reactivate this: $content['admin'] = '' . $login . ''; -./inc/modules/guest/what-sponsor_reg.php:295: // @TODO Maybe a default referal id? +./inc/modules/guest/what-sponsor_reg.php:287: // @TODO Maybe a default referal id? ./inc/modules/guest/what-stats.php:100: // @TODO This can be somehow rewritten ./inc/modules/guest/what-stats.php:74:// @TODO This can be rewritten in a dynamic include ./inc/modules/member/what-beg2.php:87: // @TODO points->beg_points @@ -191,12 +191,12 @@ ./inc/mysql-manager.php:368: // @TODO Try to rewrite this to one or more functions ./inc/mysql-manager.php:44:// @TODO Can we cache this? ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array' -./inc/template-functions.php:1048: // @TODO Deprecate this thing -./inc/template-functions.php:1059: // @TODO Deprecate this thing -./inc/template-functions.php:1146: // @TODO This can be easily moved out after the merge from EL branch to this is complete -./inc/template-functions.php:1179: // @TODO Add a little more infos here -./inc/template-functions.php:1490:// @TODO Lame description for this function -./inc/template-functions.php:1512: // @TODO Move this in a filter +./inc/template-functions.php:1050: // @TODO Deprecate this thing +./inc/template-functions.php:1061: // @TODO Deprecate this thing +./inc/template-functions.php:1148: // @TODO This can be easily moved out after the merge from EL branch to this is complete +./inc/template-functions.php:1181: // @TODO Add a little more infos here +./inc/template-functions.php:1492:// @TODO Lame description for this function +./inc/template-functions.php:1514: // @TODO Move this in a filter ./inc/template-functions.php:189: * @TODO On some pages this is buggy ./inc/template-functions.php:265: // @TODO Remove this sanity-check if all is fine ./inc/template-functions.php:578:// @TODO $simple/$constants are deprecated diff --git a/beg.php b/beg.php index 9967f3b436..e9e559138e 100644 --- a/beg.php +++ b/beg.php @@ -198,8 +198,10 @@ if (isGetRequestParameterSet('userid')) { $errorCode = getCode('BEG_SAME_AS_OWN'); } - // Reload to index module - if ((!empty($errorCode)) && (!empty($errorCode))) redirectToUrl('modules.php?module=index&code=' . $errorCode . '&ext=beg'); + // Reload to index module if an error happens + if (!empty($errorCode)) { + redirectToUrl('modules.php?module=index&code=' . $errorCode . '&ext=beg'); + } // END - if } else { // No userid entered redirectToUrl('modules.php?module=index'); diff --git a/inc/libs/rallye_functions.php b/inc/libs/rallye_functions.php index 56230b9022..99c029890f 100644 --- a/inc/libs/rallye_functions.php +++ b/inc/libs/rallye_functions.php @@ -577,8 +577,8 @@ LIMIT %s", ), __FUNCTION__, __LINE__); while ($content = SQL_FETCHARRAY($result)) { // Construct the message masked and add it - $ret .= sprintf("%s %s %s (%s) - %s\n", - translateGender($content['gender']), + $ret .= sprintf("{%%pipe,translateGender=%s%} %s %s (%s) - %s\n", + $content['gender'], $content['surname'], $content['family'], $content['email'], diff --git a/inc/modules/admin/overview-inc.php b/inc/modules/admin/overview-inc.php index cf309d2f1c..e88441e131 100644 --- a/inc/modules/admin/overview-inc.php +++ b/inc/modules/admin/overview-inc.php @@ -174,7 +174,7 @@ LIMIT 1", $content = getUserDataArray(); // Generate HTML list entry - $add = '
  • {--ADMIN_MEMBER_UID--}: ' . generateUserProfileLink($taskData['userid'], 'user_data') . ' (' . translateGender($content['gender']) . ' ' . $content['surname'] . ' ' . $content['family'] . ')
  • '; + $add = '
  • {--ADMIN_MEMBER_UID--}: ' . generateUserProfileLink($taskData['userid'], 'user_data') . ' ({%pipe,translateGender=' . $content['gender'] . '%} ' . $content['surname'] . ' ' . $content['family'] . ')
  • '; } else { // Invalid userid, so log and zero it logDebugMessage(__FUNCTION__, __LINE__, 'fetchUserData() failed: userid=' . $taskData['userid'] . ' not found.'); diff --git a/inc/modules/admin/what-edit_sponsor.php b/inc/modules/admin/what-edit_sponsor.php index 9df887c282..27b3978a21 100644 --- a/inc/modules/admin/what-edit_sponsor.php +++ b/inc/modules/admin/what-edit_sponsor.php @@ -60,15 +60,6 @@ LIMIT 1", // Load sponsor details $content = SQL_FETCHARRAY($result_main); - // Prepare all data for the template - // Init gender - foreach (array('m', 'f', 'c') as $gender) { - $content['gender_' . $gender] = ''; - } // END - foreach - - // Check for gender selection - $content['gender_' . strtolower($content['gender'])] = ' selected="selected"'; - // Warning because low points $content['receive_warnings'] = addSelectionBox('yn', $content['receive_warnings'], 'receive_warning'); $content['warning_interval'] = createTimeSelections($content['warning_interval'], 'warning_interval', 'MWDh'); diff --git a/inc/modules/admin/what-edit_user.php b/inc/modules/admin/what-edit_user.php index bb2904d744..b9e64937b1 100644 --- a/inc/modules/admin/what-edit_user.php +++ b/inc/modules/admin/what-edit_user.php @@ -121,14 +121,6 @@ LIMIT 1", // Load entry $content = SQL_FETCHARRAY($result_main); - // Init entries - foreach (array('gender_m','gender_f','gender_c') as $entry) { - $content[$entry] = ''; - } // END - foreach - - // Prepare selections - $content['gender_' . strtolower($content['gender'])] = ' selected="selected"'; - // Load template loadTemplate('admin_edit_user', false, $content); } diff --git a/inc/modules/admin/what-list_payouts.php b/inc/modules/admin/what-list_payouts.php index 593c030a52..12f1dd24c2 100644 --- a/inc/modules/admin/what-list_payouts.php +++ b/inc/modules/admin/what-list_payouts.php @@ -165,7 +165,7 @@ LIMIT 1", $content = array( 'task' => $taskId, 'pid' => bigintval(getRequestParameter('pid')), - 'user' => '' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '', + 'user' => '{%pipe,translateGender=' . getUserData('gender') . '%} ' . getUserData('surname') . ' ' . getUserData('family') . '', ); // Load template @@ -196,7 +196,7 @@ LIMIT 1", $content = array( 'task' => $taskId, 'pid' => bigintval(getRequestParameter('pid')), - 'user' => '' . translateGender(getUserData('gender')) . ' ' . getUserData('surname') . ' ' . getUserData('family') . '', + 'user' => '{%pipe,translateGender=' . getUserData('gender') . '%} ' . getUserData('surname') . ' ' . getUserData('family') . '', ); // Load template diff --git a/inc/modules/admin/what-list_refs.php b/inc/modules/admin/what-list_refs.php index 7bd4b1b515..0be210ce71 100644 --- a/inc/modules/admin/what-list_refs.php +++ b/inc/modules/admin/what-list_refs.php @@ -117,7 +117,9 @@ ORDER BY ); // Check if referal count is larger 0 and update link - if ($refs_cnt > 0) $content['refs_link'] = generateUserProfileLink(getUserData('userid'), $refs_cnt, 'list_refs'); + if ($refs_cnt > 0) { + $content['refs_link'] = generateUserProfileLink(getUserData('userid'), $refs_cnt, 'list_refs'); + } // END - if // Load template for level one $OUT_REFS .= loadTemplate('admin_list_refs_row', true, $content); diff --git a/inc/modules/admin/what-list_unconfirmed.php b/inc/modules/admin/what-list_unconfirmed.php index 52037dd5c9..1ca24d5824 100644 --- a/inc/modules/admin/what-list_unconfirmed.php +++ b/inc/modules/admin/what-list_unconfirmed.php @@ -162,7 +162,7 @@ LIMIT %s", 'userid' => $row['userid'], 'link' => $mailType, 'id' => $ID, - 'email' => '' . translateGender($row['gender']) . ' ' . $row['surname'] . ' ' . $row['family'] . '', + 'email' => '{%pipe,translateGender=' . $row['gender'] . '%} ' . $row['surname'] . ' ' . $row['family'] . '', 'status' => $row['status'], ); diff --git a/inc/modules/guest/what-register.php b/inc/modules/guest/what-register.php index a7eb9b6676..69a020c428 100644 --- a/inc/modules/guest/what-register.php +++ b/inc/modules/guest/what-register.php @@ -114,7 +114,7 @@ if ((isFormSent()) && (isRegistrationDataComplete())) { default: // Default is the US date format... :) $content['birthday_selection'] = addSelectionBox('month', postRequestParameter('month')).addSelectionBox('day', postRequestParameter('day')).addSelectionBox('year', postRequestParameter('year')); break; - } + } // END - switch // Adds a table for the guests with all visible categories $content['category_selection'] = registerGenerateCategoryTable('guest', true); @@ -134,20 +134,22 @@ if ((isFormSent()) && (isRegistrationDataComplete())) { // You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-) $content['header_content'] = loadTemplate('register_header', true); - // Other values - $content['surname'] = SQL_ESCAPE(postRequestParameter('surname')); - $content['family'] = SQL_ESCAPE(postRequestParameter('family')); - $content['street_nr'] = SQL_ESCAPE(postRequestParameter('street_nr')); - $content['zip'] = ''; + // ZIP codes are numerical values + $content['zip'] = ''; if (isPostRequestParameterSet('zip')) { - $content['zip'] = bigintval(postRequestParameter('zip')); + $content['zip'] = bigintval(postRequestParameter('zip')); } // END - if - $content['city'] = SQL_ESCAPE(postRequestParameter('city')); - $content['email'] = SQL_ESCAPE(postRequestParameter('email')); + + // Other values + foreach (array('gender', 'surname', 'family', 'street_nr', 'city', 'email') as $entry) { + $content[$entry] = SQL_ESCAPE(postRequestParameter($entry)); + } // END - foreach // The admin may see all $whereStatement = "WHERE `is_active`='Y'"; - if (isAdmin()) $whereStatement = ''; + if (isAdmin()) { + $whereStatement = ''; + } // END - if // Prepare country selection box $OUT = ' '; @@ -1714,6 +1716,21 @@ function displayMessage ($message, $return = false) { return loadTemplate('admin_settings_saved', $return, $message); } +// Generates a selection box for (maybe) given gender +function generateGenderSelectionBox ($selectedGender = '') { + // Start the HTML code + $out = ''; + + // Return the code + return $out; +} + //----------------------------------------------------------------------------- // Template helper functions for EL //----------------------------------------------------------------------------- diff --git a/templates/de/html/admin/admin_add_sponsor.tpl b/templates/de/html/admin/admin_add_sponsor.tpl index 8b94ed63dd..dd4690747d 100644 --- a/templates/de/html/admin/admin_add_sponsor.tpl +++ b/templates/de/html/admin/admin_add_sponsor.tpl @@ -45,11 +45,7 @@ {--GENDER--}: - + {%pipe,generateGenderSelectionBox=$content[gender]%} diff --git a/templates/de/html/admin/admin_edit_sponsor_edit.tpl b/templates/de/html/admin/admin_edit_sponsor_edit.tpl index b277e4df88..fee1ace7fc 100644 --- a/templates/de/html/admin/admin_edit_sponsor_edit.tpl +++ b/templates/de/html/admin/admin_edit_sponsor_edit.tpl @@ -45,11 +45,7 @@ {--GENDER--}: - + {%pipe,generateGenderSelectionBox=$content[gender]%} diff --git a/templates/de/html/admin/admin_edit_user.tpl b/templates/de/html/admin/admin_edit_user.tpl index 9569547236..60d0a12ae8 100644 --- a/templates/de/html/admin/admin_edit_user.tpl +++ b/templates/de/html/admin/admin_edit_user.tpl @@ -9,11 +9,7 @@ {--GENDER--}: - + {%pipe,generateGenderSelectionBox=$content[gender]%} diff --git a/templates/de/html/guest/guest_register.tpl b/templates/de/html/guest/guest_register.tpl index bb517ee40d..27c051f4de 100644 --- a/templates/de/html/guest/guest_register.tpl +++ b/templates/de/html/guest/guest_register.tpl @@ -18,12 +18,9 @@ {--GENDER--}$content[must_fillout_gender]: - + + {%pipe,generateGenderSelectionBox=$content[gender]%} + {--SURNAME--}$content[must_fillout_surname], diff --git a/templates/de/html/guest/guest_sponsor_reg.tpl b/templates/de/html/guest/guest_sponsor_reg.tpl index 6d9f21e24a..e9de926ddf 100644 --- a/templates/de/html/guest/guest_sponsor_reg.tpl +++ b/templates/de/html/guest/guest_sponsor_reg.tpl @@ -59,11 +59,7 @@ {--GENDER--}: - + {%pipe,generateGenderSelectionBox=$content[gender]%} diff --git a/templates/de/html/member/member_mydata_edit.tpl b/templates/de/html/member/member_mydata_edit.tpl index 5beeec64a1..6ca4d92483 100644 --- a/templates/de/html/member/member_mydata_edit.tpl +++ b/templates/de/html/member/member_mydata_edit.tpl @@ -9,11 +9,7 @@ {--GENDER--}: - + {%pipe,generateGenderSelectionBox=$content[gender]%} diff --git a/templates/de/html/sponsor/sponsor_account_form.tpl b/templates/de/html/sponsor/sponsor_account_form.tpl index 0bcedea964..7644cdc199 100644 --- a/templates/de/html/sponsor/sponsor_account_form.tpl +++ b/templates/de/html/sponsor/sponsor_account_form.tpl @@ -40,11 +40,7 @@ {--GENDER--}: - + {%pipe,generateGenderSelectionBox=$content[gender]%}