Also had to fix this to make 'month, numeric' selection working
authorRoland Häder <roland@mxchange.org>
Thu, 17 Jan 2013 01:46:54 +0000 (01:46 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 17 Jan 2013 01:46:54 +0000 (01:46 +0000)
inc/functions.php

index 2d1db00eaec4fdbc81942671c27c0254883e1133..431a5bccb0cd10eb6c1b2bf24ed27a102683da84 100644 (file)
@@ -627,7 +627,8 @@ function createEpocheTimeFromSelections ($prefix, $postData) {
        $M1   = getMonth();
 
        // If so and if current time is before 02/29 and estimated time is after 02/29 then add 86400 seconds (one day)
-       if ((floor($TEST) == $TEST) && ($M1 == '02') && ($postData[$prefix . '_mo'] > '02'))  {
+       // 01     2     2         1    1           1    123     4                          43    3                                 32    233    4                          43    3                                 3210
+       if ((floor($TEST) == $TEST) && ($M1 == '02') && (((isset($postData[$prefix . '_mo'])) && ($postData[$prefix . '_mo'] > '02')) || ((isset($postData[$prefix . '_mn'])) && ($postData[$prefix . '_mn'] > '02')))) {
                $SWITCH = getOneDay();
        } // END - if
 
@@ -635,7 +636,11 @@ function createEpocheTimeFromSelections ($prefix, $postData) {
        $ret += $postData[$prefix . '_ye'] * (31536000 + $SWITCH);
 
        // Next months...
-       $ret += $postData[$prefix . '_mo'] * 2628000;
+       if (isset($postData[$prefix . '_mo'])) {
+               $ret += $postData[$prefix . '_mo'] * 2628000;
+       } elseif (isset($postData[$prefix . '_mn'])) {
+               $ret += $postData[$prefix . '_mn'] * 2628000;
+       }
 
        // Next weeks
        $ret += $postData[$prefix . '_we'] * 604800;
@@ -1449,17 +1454,17 @@ function convertSelectionsToEpocheTime (array &$postData, array &$content, &$id,
        $test = substr($id, -3);
 
        // Improved way of checking! :-)
-       if (in_array($test, array('_ye', '_mo', '_we', '_da', '_ho', '_mi', '_se'))) {
+       if (in_array($test, array('_ye', '_mo', '_mn', '_we', '_da', '_ho', '_mi', '_se'))) {
                // Found a multi-selection for timings?
                $test = substr($id, 0, -3);
-               if ((isset($postData[$test . '_ye'])) && (isset($postData[$test . '_mo'])) && (isset($postData[$test . '_we'])) && (isset($postData[$test . '_da'])) && (isset($postData[$test . '_ho'])) && (isset($postData[$test . '_mi'])) && (isset($postData[$test . '_se'])) && ($test != $test2)) {
+               if ((isset($postData[$test . '_ye'])) && ((isset($postData[$test . '_mo'])) || (isset($postData[$test . '_mn']))) && (isset($postData[$test . '_we'])) && (isset($postData[$test . '_da'])) && (isset($postData[$test . '_ho'])) && (isset($postData[$test . '_mi'])) && (isset($postData[$test . '_se'])) && ($test != $test2)) {
                        // Generate timestamp
                        $postData[$test] = createEpocheTimeFromSelections($test, $postData);
                        array_push($content, sprintf("`%s`='%s'", $test, $postData[$test]));
                        $GLOBALS['skip_config'][$test] = TRUE;
 
                        // Remove data from array
-                       foreach (array('ye', 'mo', 'we', 'da', 'ho', 'mi', 'se') as $rem) {
+                       foreach (array('ye', 'mo', 'mn', 'we', 'da', 'ho', 'mi', 'se') as $rem) {
                                unset($postData[$test . '_' . $rem]);
                        } // END - foreach