]> git.mxchange.org Git - mailer.git/commitdiff
Some improvements:
authorRoland Häder <roland@mxchange.org>
Sun, 25 Nov 2012 12:39:58 +0000 (12:39 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 25 Nov 2012 12:39:58 +0000 (12:39 +0000)
- Used empty() instead of checking strlen() is zero or larger zero
- Used str_pad() instead of other code

inc/extensions/ext-bonus.php
inc/functions.php
inc/modules/admin/what-list_beg.php
inc/modules/admin/what-list_bonus.php
inc/modules/member/what-mydata.php
inc/xml-functions.php
mailid_top.php
templates/de/html/mailid/mailid_timer.tpl

index 140b809cc91fa2bc4b7e7cc36ba699ef7769ab82..26e1520bf786e4b46b272168a91f6482afc63def 100644 (file)
@@ -365,8 +365,7 @@ INDEX `userid` (`userid`)",
 
                        case '0.5.6': // SQL queries for v0.5.6
                                // Get current month
-                               $curr = getMonth();
-                               if (strlen($curr) == 1) $curr = '0' . $curr;
+                               $curr = str_pad(getMonth(), 2, '0', STR_PAD_LEFT);
                                if ($curr == '00') $curr = '12';
 
                                // Generate timemark...
index ab8907f080b92d09385757972d00a1a802c260ed..4ff81b5d8d5438be596a373f85e29f0965b47cbe 100644 (file)
@@ -648,7 +648,7 @@ function createFancyTime ($stamp) {
        } // END - foreach
 
        // Is something there?
-       if (strlen($ret) > 0) {
+       if (!empty($ret)) {
                // Remove leading commata and space
                $ret = substr($ret, 2);
        } else {
@@ -799,7 +799,9 @@ function scrambleString ($str) {
        }
 
        // Compare both lengths and abort if different
-       if (strlen($str) != count($scrambleNums)) return $str;
+       if (strlen($str) != count($scrambleNums)) {
+               return $str;
+       } // END - if
 
        // Scramble string here
        //* DEBUG: */ debugOutput('***Original=' . $str.'***<br />');
@@ -904,7 +906,7 @@ function encodeHashForCookie ($passHash) {
 
                        $mod = substr($mod, 0, 2);
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'idx=' . $idx . ',part1=' . $part1 . '/part2=' . $part2 . '/mod=' . $mod . '(' . strlen($mod) . ')');
-                       $mod = str_repeat('0', (2 - strlen($mod))) . $mod;
+                       $mod = str_pad($mod, 2, '0', STR_PAD_LEFT);
                        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'mod(' . ($idx * 2) . ')=' . $mod . '*');
                        $start += 2;
                        $newHash .= $mod;
index ad47803a44c7e7c983ea984420b41724fc042cb0..1eb7c9ca105531a29e9b3294e1b964e52f497f03 100644 (file)
@@ -47,8 +47,7 @@ if (isBegRallyeEnabled()) {
        // Shall I withdraw now?
        if (isPostRequestElementSet('withdraw')) {
                // Okay, let's prepare...
-               $curr = getMonth() - 1;
-               if (strlen($curr) == 1) $curr = '0' . $curr;
+               $curr = str_pad((getMonth() - 1), 2, '0', STR_PAD_LEFT);
                updateConfiguration('last_month', $curr);
                displayMessage('{--ADMIN_BEG_WITHDRAW_PREPARED--}');
        } // END - if
index 70c57a3a5ee013a6ef08964847ce81a6dfce0e66..78e687de933eaf28bfd8377e78973a6f52c3217a 100644 (file)
@@ -47,8 +47,7 @@ if (isBonusRallyeActive()) {
        // Shall I withdraw now?
        if (isPostRequestElementSet('withdraw')) {
                // Okay, let's prepare...
-               $curr = getMonth() - 1;
-               if (strlen($curr) == 1) $curr = '0' . $curr;
+               $curr = str_pad((getMonth() - 1), 2, '0', STR_PAD_LEFT);
                updateConfiguration('last_month', $curr);
                displayMessage('{--ADMIN_BONUS_WITHDRAW_PREPARED--}');
        } // END - if
index 92371167dba9ac9a2a4302480adfc7a9553c2b67..168fcacc7f40176a60b9b22a48789d00a3929620 100644 (file)
@@ -79,8 +79,8 @@ switch ($mode) {
                        $content['change'] = loadTemplate('member_mydata_button', TRUE);
                }
 
-               if (strlen($content['birth_day'])   == 1) $content['birth_day']   = '0' . $content['birth_day'];
-               if (strlen($content['birth_month']) == 1) $content['birth_month'] = '0' . $content['birth_month'];
+               $content['birth_day']   = str_pad($content['birth_day']  , 2, '0', STR_PAD_LEFT);
+               $content['birth_month'] = str_pad($content['birth_month'], 2, '0', STR_PAD_LEFT);
 
                switch (getLanguage()) {
                        case 'de': $content['dob'] = $content['birth_day']   . '.' . $content['birth_month'] . '.' . $content['birth_year']; break;
index ff62e48d5d128204f01abb83df4a700338e9fc99..e180a49fe9fdd69b9db9de59117d45cb569ca71a 100644 (file)
@@ -232,7 +232,7 @@ function xmlCharacterHandler ($resource, $characters) {
        $characters = trim($characters);
 
        // Are there some to handle?
-       if (strlen($characters) == 0) {
+       if (empty($characters)) {
                // Nothing to handle
                return;
        } // END - if
index 214a1252183d504e195d463052e1bdb90110b3ef..87db810c76bdfd6e5de4bab753de7581d9a067cc 100644 (file)
@@ -371,7 +371,6 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr
                                                                        $content['userid'] = $userId;
                                                                        $content['type']   = $type;
                                                                        $content['data']   = $urlId;
-                                                                       $content['rand']   = getRandomTan();
                                                                        $content['banner'] = loadTemplate('mailid_banner', TRUE);
 
                                                                        // Load template
index 51417150e235295911f0089900872c92a8971818..7a8558a1759d7006214be31c666bcc6f5dcdfb51 100644 (file)
@@ -15,7 +15,7 @@ function startCounter() {
        document.confirm.counter.value = timer;
        if (timer == 0) {
                clearInterval(Counter);
-               document.location.href = '{%url,js=mailid_top.php?userid=$content[userid]&$content[type]=$content[data]&do=confirm&code=$content[rand]%}';
+               document.location.href = '{%url,js=mailid_top.php?userid=$content[userid]&$content[type]=$content[data]&do=confirm&code={%pipe,getRandomTan%}%}';
        }
 }
 //-->