]> git.mxchange.org Git - mailer.git/commitdiff
Naming convention applied, new wrapper introduced:
authorRoland Häder <roland@mxchange.org>
Sun, 11 Jul 2010 20:46:19 +0000 (20:46 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 11 Jul 2010 20:46:19 +0000 (20:46 +0000)
- Naming convention only allows foo_yes/foo_no (was: foo_y/foo_n)
- New wrapper isRefbackEnabled () introduced
- TODOs.txt updated

DOCS/TODOs.txt
inc/libs/refback_functions.php
inc/libs/register_functions.php
inc/libs/surfbar_functions.php
inc/modules/admin/what-config_refback.php
inc/modules/guest/what-sponsor_reg.php
inc/modules/member/what-refback.php
templates/de/html/guest/guest_cat_row.tpl
templates/de/html/guest/guest_sponsor_reg.tpl
templates/de/html/member/member_surfbar_edit_action_form.tpl

index 36eae95c8b1a201dd0f9e8c147cc14a0ee3b6b06..3d9799b40f0f3c1d51f66dae17de0096d8ef4bcf 100644 (file)
@@ -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
index 844bc83f102e9d7a362bf07d96c2cad3b6b4186f..f3277f2d3e07f9999cc3d3e636e5fd5607eec26c 100644 (file)
@@ -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]
 ?>
index cfbca85c3f9c03b8379451e5063ee89e4136526e..cae47656e679cfbb7fb20b4719725843afbdfe95 100644 (file)
@@ -92,18 +92,14 @@ function registerGenerateCategoryTable ($mode, $return=false) {
                $OUT .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
                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 = '<span class="guest_failed">(*)</span>';
 
                // Add it
-               $content['must_fillout_'.strtolower($row['field_name']).''] = $value;
+               $content['must_fillout_' . strtolower($row['field_name']) . ''] = $value;
        } // END - while
 
        // Free memory
index 490d6725ca189121c81237cdfa8bde99152aeb1b..8a4d3236196f09f0c3dbd99d3ef7c07125c6a18d 100644 (file)
@@ -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
 
index 1f9d0230725b085996ec0166ce965bb0f7e910e4..4eddb530632a17f02bf7ea4341d383eac9c144e2 100644 (file)
@@ -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);
index a68943183351ed5e91f607ea616454a8351b0bb1..ed92a13936e9c45d3fa64a3ef3553f3a85c48d6a 100644 (file)
@@ -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?
index b69124c94ccff2c4742255905acc1e4fdedbab75..0900fcb3deed790044fe08a261afeee7ddc9117f 100644 (file)
@@ -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--}');
 
index a3c1cf8b4f9e58a7e66d5af8a40c3e7b65fe526f..39d0bcaa7ff9447cb8222779f9a9b00d881b8348 100644 (file)
@@ -2,10 +2,10 @@
        <td class="register_right {%template,ColorSwitch%}">$content[cat]</td>
        <td width="20" class="guest_normal {%template,ColorSwitch%}">
                {--YES--}
-               <input type="radio" class="guest_normal" name="cat[$content[id]]" value="Y"$content[def_y] />
+               <input type="radio" class="guest_normal" name="cat[$content[id]]" value="Y"$content[default_yes] />
        </td>
        <td width="20" class="guest_normal {%template,ColorSwitch%}">
                {--NO--}
-               <input type="radio" class="guest_normal" name="cat[$content[id]]" value="N"$content[def_n] />
+               <input type="radio" class="guest_normal" name="cat[$content[id]]" value="N"$content[default_no] />
        </td>
 </tr>
index c6b133e5daf209a4f09a77e22e09409a8025b9a0..7d473369444a4806cac45f3680b75424811c337d 100644 (file)
   </td>
   <td>
     <select name="receive_warnings" class="guest_select" size="1">
-      <option value="Y"$content[rec_y]>{--YES--}</option>
-      <option value="N"$content[rec_n]>{--NO--}</option>
+      <option value="Y"$content[receive_warnings_y]>{--YES--}</option>
+      <option value="N"$content[receive_warnings_n]>{--NO--}</option>
     </select>
   </td>
 </tr>
index ab0056dd7b6657f13f0d14c910f6877804ff8a6e..c05251e1847b19daf452fa12135dcd753b07d81a 100644 (file)
@@ -11,8 +11,8 @@
 
        <div class="member_input" style="padding-top:5px;padding-bottom:5px">
                Soll die Anzahl Aufrufe begrenzt werden?<br />
-               <input type="radio" id="limited_no" onfocus="return FocusLimitedNo()" name="limited" value="N"$content[limited_n] /> {--NO--}
-               <input type="radio" id="limited_yes" onfocus="return FocusLimitedYes()" name="limited" value="Y"$content[limited_y] /> {--YES--}
+               <input type="radio" id="limited_no" onfocus="return FocusLimitedNo()" name="limited" value="N"$content[limited_no] /> {--NO--}
+               <input type="radio" id="limited_yes" onfocus="return FocusLimitedYes()" name="limited" value="Y"$content[limited_yes] /> {--YES--}
        </div>
 
        <div class="member_input bottom" style="padding-top:5px;padding-bottom:5px">