From bb3448dff42d948cc9752f81047ada54d69e80bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 11 Jul 2010 20:46:19 +0000 Subject: [PATCH] Naming convention applied, new wrapper introduced: - Naming convention only allows foo_yes/foo_no (was: foo_y/foo_n) - New wrapper isRefbackEnabled () introduced - TODOs.txt updated --- DOCS/TODOs.txt | 6 ++--- inc/libs/refback_functions.php | 12 ++++++++++ inc/libs/register_functions.php | 14 ++++------- inc/libs/surfbar_functions.php | 12 +++++----- inc/modules/admin/what-config_refback.php | 23 +++++++++---------- inc/modules/guest/what-sponsor_reg.php | 8 +++---- inc/modules/member/what-refback.php | 2 +- templates/de/html/guest/guest_cat_row.tpl | 4 ++-- templates/de/html/guest/guest_sponsor_reg.tpl | 4 ++-- .../member_surfbar_edit_action_form.tpl | 4 ++-- 10 files changed, 48 insertions(+), 41 deletions(-) diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 36eae95c8b..3d9799b40f 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -70,9 +70,9 @@ ./inc/libs/rallye_functions.php:854:// @TODO Please document this function ./inc/libs/rallye_functions.php:910: // Load count @TODO Can't we rewrite this to our API? ./inc/libs/refback_functions.php:61: // @TODO Try to rewrite the following unset() -./inc/libs/register_functions.php:296: // @TODO Rewrite these all to a single filter -./inc/libs/register_functions.php:375: // @TODO Rewrite this to a filter -./inc/libs/register_functions.php:382: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable +./inc/libs/register_functions.php:292: // @TODO Rewrite these all to a single filter +./inc/libs/register_functions.php:371: // @TODO Rewrite this to a filter +./inc/libs/register_functions.php:378: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable ./inc/libs/surfbar_functions.php:1540: // @TODO This can be somehow rewritten ./inc/libs/surfbar_functions.php:712:// @TODO Can't we use our new expression language instead of this ugly code? ./inc/libs/surfbar_functions.php:953: // @TODO Invalid salt should be refused diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 844bc83f10..f3277f2d3e 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -417,5 +417,17 @@ function updateMemberRefbackPercents ($id, $percents) { return $status; } +// Checks wether refback is enabled +function isRefbackEnabled () { + // Do we have cache? + if (!isset($GLOBALS['is_refback_enabled'])) { + // Determine it + $GLOBALS['is_refback_enabled'] = (getConfig('refback_enabled') == 'Y'); + } // END - if + + // Return cache + return $GLOBALS['is_refback_enabled']; +} + // [EOF] ?> diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index cfbca85c3f..cae47656e6 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -92,18 +92,14 @@ function registerGenerateCategoryTable ($mode, $return=false) { $OUT .= ''; while ($content = SQL_FETCHARRAY($result)) { // Prepare array for the template - $content = array( - 'cat' => $content['cat'], - 'def_y' => '', - 'def_n' => '', - 'id' => $content['id'], - ); + $content['default_yes'] = ''; + $content['default_no'] = ''; // Mark categories if ((postRequestParameter('cat', $content['id']) == 'Y') || ((getConfig('register_default') == 'Y') && (!isPostRequestParameterSet('cat', $content['id'])))) { - $content['def_y'] = ' checked="checked"'; + $content['default_yes'] = ' checked="checked"'; } else { - $content['def_n'] = ' checked="checked"'; + $content['default_no'] = ' checked="checked"'; } // Load template and switch color @@ -149,7 +145,7 @@ function FILTER_REGISTER_MUST_FILLOUT ($content) { if ($row['field_required'] == 'Y') $value = '(*)'; // Add it - $content['must_fillout_'.strtolower($row['field_name']).''] = $value; + $content['must_fillout_' . strtolower($row['field_name']) . ''] = $value; } // END - while // Free memory diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 490d6725ca..8a4d323619 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -369,16 +369,16 @@ function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) { // Include fields only for action 'edit' if ($action == 'edit') { // Default is not limited - $urlData['limited_y'] = ''; - $urlData['limited_n'] = ' checked="checked"'; - $urlData['limited'] = 'false'; + $urlData['limited_yes'] = ''; + $urlData['limited_no'] = ' checked="checked"'; + $urlData['limited'] = 'false'; // Is this URL limited? if (SURFBAR_GET_VIEWS_MAX() > 0) { // Then rewrite form data - $urlData['limited_y'] = ' checked="checked"'; - $urlData['limited_n'] = ''; - $urlData['limited'] = 'true'; + $urlData['limited_yes'] = ' checked="checked"'; + $urlData['limited_no'] = ''; + $urlData['limited'] = 'true'; } // END - if } // END - if diff --git a/inc/modules/admin/what-config_refback.php b/inc/modules/admin/what-config_refback.php index 1f9d023072..4eddb53063 100644 --- a/inc/modules/admin/what-config_refback.php +++ b/inc/modules/admin/what-config_refback.php @@ -54,20 +54,19 @@ if (isFormSent()) { adminSaveSettingsFromPostData(); } else { // Prepare content - $content = array(); + $content = array( + 'refback_enabled_n' => '', + 'refback_enabled_y' => '' + ); // Translate Y/N switches - switch (getConfig('refback_enabled')) { - case 'Y': // Refback enabled - $content['refback_enabled_y'] = ' checked="checked"'; - $content['refback_enabled_n'] = ''; - break; - - case 'N': // Refback disabled - $content['refback_enabled_y'] = ''; - $content['refback_enabled_n'] = ' checked="checked"'; - break; - } // END - switch + if (isRefbackEnabled()) { + // Enabled + $content['refback_enabled_y'] = ' checked="checked"'; + } else { + // Disabled + $content['refback_enabled_n'] = ' checked="checked"'; + } // Load template loadTemplate('admin_config_refback', false, $content); diff --git a/inc/modules/guest/what-sponsor_reg.php b/inc/modules/guest/what-sponsor_reg.php index a689431833..ed92a13936 100644 --- a/inc/modules/guest/what-sponsor_reg.php +++ b/inc/modules/guest/what-sponsor_reg.php @@ -302,7 +302,7 @@ ORDER BY $content['payment_list'] = $OUT; // Init a lot array elements - foreach (array('company','position','tax_ident','gender_m','gender_f','gender_c','surname','family','street_nr1','street_nr2','country','zip','city','phone','fix','cell','email','url','rec_y','rec_n','form_errors','refid') as $entry) { + foreach (array('company','position','tax_ident','gender_m','gender_f','gender_c','surname','family','street_nr1','street_nr2','country','zip','city','phone','fix','cell','email','url','receive_warnings_y','receive_warnings_n','form_errors','refid') as $entry) { $content[$entry] = ''; } // END - foreach @@ -322,11 +322,11 @@ ORDER BY $content['gender_' . strtolower(postRequestParameter('gender'))] = ' selected="selected"'; // Init receive selection - $content['rec_y'] = ''; - $content['rec_n'] = ''; + $content['receive_warnings_y'] = ''; + $content['receive_warnings_n'] = ''; // Check for receive_warnings - $content['rec_' . strtolower(postRequestParameter('receive_warnings'))] = ' selected="selected"'; + $content['receive_warnings_' . strtolower(postRequestParameter('receive_warnings'))] = ' selected="selected"'; $OUT = ''; // Errors found? diff --git a/inc/modules/member/what-refback.php b/inc/modules/member/what-refback.php index b69124c94c..0900fcb3de 100644 --- a/inc/modules/member/what-refback.php +++ b/inc/modules/member/what-refback.php @@ -43,7 +43,7 @@ if (!defined('__SECURITY')) { } elseif (!isMember()) { // User is not logged in redirectToIndexMemberOnlyModule(); -} elseif (getConfig('refback_enabled') != 'Y') { +} elseif (!isRefbackEnabled()) { // Output message loadTemplate('admin_settings_saved', false, '{--MEMBER_REFBACK_DISABLED--}'); diff --git a/templates/de/html/guest/guest_cat_row.tpl b/templates/de/html/guest/guest_cat_row.tpl index a3c1cf8b4f..39d0bcaa7f 100644 --- a/templates/de/html/guest/guest_cat_row.tpl +++ b/templates/de/html/guest/guest_cat_row.tpl @@ -2,10 +2,10 @@ diff --git a/templates/de/html/guest/guest_sponsor_reg.tpl b/templates/de/html/guest/guest_sponsor_reg.tpl index c6b133e5da..7d47336944 100644 --- a/templates/de/html/guest/guest_sponsor_reg.tpl +++ b/templates/de/html/guest/guest_sponsor_reg.tpl @@ -188,8 +188,8 @@ diff --git a/templates/de/html/member/member_surfbar_edit_action_form.tpl b/templates/de/html/member/member_surfbar_edit_action_form.tpl index ab0056dd7b..c05251e184 100644 --- a/templates/de/html/member/member_surfbar_edit_action_form.tpl +++ b/templates/de/html/member/member_surfbar_edit_action_form.tpl @@ -11,8 +11,8 @@
Soll die Anzahl Aufrufe begrenzt werden?
- {--NO--} - {--YES--} + {--NO--} + {--YES--}
-- 2.30.2
$content[cat] {--YES--} - + {--NO--} - +