Passed
Branch master (ff9d34)
by Mike
09:14
created
lib/utils/g_RFC822.php 1 patch
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -369,19 +369,19 @@
 block discarded – undo
369 369
 
370 370
         for (; $i < $iMax; ++$i) {
371 371
             switch ($string[$i]) {
372
-            case '\\':
373
-                ++$slashes;
374
-                break;
375
-
376
-            case '"':
377
-                if ($slashes % 2 == 0) {
378
-                    $in_quote = !$in_quote;
379
-                }
380
-                // Fall through to default action below.
381
-
382
-            default:
383
-                $slashes = 0;
384
-                break;
372
+                case '\\':
373
+                    ++$slashes;
374
+                    break;
375
+
376
+                case '"':
377
+                    if ($slashes % 2 == 0) {
378
+                        $in_quote = !$in_quote;
379
+                    }
380
+                    // Fall through to default action below.
381
+
382
+                default:
383
+                    $slashes = 0;
384
+                    break;
385 385
             }
386 386
         }
387 387
 
Please login to merge, or discard this patch.
mapi/class.baserecurrence.php 1 patch
Switch Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -1672,180 +1672,180 @@
 block discarded – undo
1672 1672
 
1673 1673
                 switch($this->recur["type"])
1674 1674
                 {
1675
-                case 10:
1676
-                    // Daily
1677
-                    if($this->recur["everyn"] <= 0)
1678
-                        $this->recur["everyn"] = 1440;
1679
-
1680
-                    if($this->recur["subtype"] == 0) {
1681
-                        // Every Nth day
1682
-                        for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * $this->recur["everyn"]) {
1683
-                            $this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1684
-                        }
1685
-                    } else {
1686
-                        // Every workday
1687
-                        for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * 1440)
1688
-                        {
1689
-                            $nowtime = $this->gmtime($now);
1690
-                            if ($nowtime["tm_wday"] > 0 && $nowtime["tm_wday"] < 6) { // only add items in the given timespace
1675
+                    case 10:
1676
+                        // Daily
1677
+                        if($this->recur["everyn"] <= 0)
1678
+                            $this->recur["everyn"] = 1440;
1679
+
1680
+                        if($this->recur["subtype"] == 0) {
1681
+                            // Every Nth day
1682
+                            for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * $this->recur["everyn"]) {
1691 1683
                                 $this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1692 1684
                             }
1685
+                        } else {
1686
+                            // Every workday
1687
+                            for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += 60 * 1440)
1688
+                            {
1689
+                                $nowtime = $this->gmtime($now);
1690
+                                if ($nowtime["tm_wday"] > 0 && $nowtime["tm_wday"] < 6) { // only add items in the given timespace
1691
+                                    $this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1692
+                                }
1693
+                            }
1693 1694
                         }
1694
-                    }
1695
-                    break;
1696
-                case 11:
1697
-                    // Weekly
1698
-                    if($this->recur["everyn"] <= 0)
1699
-                        $this->recur["everyn"] = 1;
1695
+                        break;
1696
+                    case 11:
1697
+                        // Weekly
1698
+                        if($this->recur["everyn"] <= 0)
1699
+                            $this->recur["everyn"] = 1;
1700 1700
 
1701
-                    // If sliding flag is set then move to 'n' weeks
1702
-                    if ($this->recur['regen']) $daystart += (60 * 60 * 24 * 7 * $this->recur["everyn"]);
1701
+                        // If sliding flag is set then move to 'n' weeks
1702
+                        if ($this->recur['regen']) $daystart += (60 * 60 * 24 * 7 * $this->recur["everyn"]);
1703 1703
 
1704
-                    for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur["everyn"]))
1705
-                    {
1706
-                        if ($this->recur['regen']) {
1707
-                            $this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1708
-                        } else {
1709
-                            // Loop through the whole following week to the first occurrence of the week, add each day that is specified
1710
-                            for($wday = 0; $wday < 7; $wday++)
1711
-                            {
1712
-                                $daynow = $now + $wday * 60 * 60 * 24;
1713
-                                //checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1714
-                                if ($daynow <= $dayend){
1715
-                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1716
-                                    if(($this->recur["weekdays"] &(1 << $nowtime["tm_wday"]))) { // Selected ?
1717
-                                        $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1704
+                        for($now = $daystart; $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur["everyn"]))
1705
+                        {
1706
+                            if ($this->recur['regen']) {
1707
+                                $this->processOccurrenceItem($items, $start, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1708
+                            } else {
1709
+                                // Loop through the whole following week to the first occurrence of the week, add each day that is specified
1710
+                                for($wday = 0; $wday < 7; $wday++)
1711
+                                {
1712
+                                    $daynow = $now + $wday * 60 * 60 * 24;
1713
+                                    //checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1714
+                                    if ($daynow <= $dayend){
1715
+                                        $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1716
+                                        if(($this->recur["weekdays"] &(1 << $nowtime["tm_wday"]))) { // Selected ?
1717
+                                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1718
+                                        }
1718 1719
                                     }
1719 1720
                                 }
1720 1721
                             }
1721 1722
                         }
1722
-                    }
1723
-                    break;
1724
-                case 12:
1725
-                    // Monthly
1726
-                    if($this->recur["everyn"] <= 0)
1727
-                        $this->recur["everyn"] = 1;
1723
+                        break;
1724
+                    case 12:
1725
+                        // Monthly
1726
+                        if($this->recur["everyn"] <= 0)
1727
+                            $this->recur["everyn"] = 1;
1728 1728
 
1729
-                    // Loop through all months from start to end of occurrence, starting at beginning of first month
1730
-                    for($now = $this->monthStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60 )
1731
-                    {
1732
-                        if(isset($this->recur["monthday"]) &&($this->recur['monthday'] != "undefined") && !$this->recur['regen']) { // Day M of every N months
1733
-                            $difference = 1;
1734
-                            if ($this->daysInMonth($now, $this->recur["everyn"]) < $this->recur["monthday"]) {
1735
-                                $difference = $this->recur["monthday"] - $this->daysInMonth($now, $this->recur["everyn"]) + 1;
1736
-                            }
1737
-                            $daynow = $now + (($this->recur["monthday"] - $difference) * 24 * 60 * 60);
1738
-                            //checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1739
-                            if ($daynow <= $dayend){
1740
-                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1729
+                        // Loop through all months from start to end of occurrence, starting at beginning of first month
1730
+                        for($now = $this->monthStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60 )
1731
+                        {
1732
+                            if(isset($this->recur["monthday"]) &&($this->recur['monthday'] != "undefined") && !$this->recur['regen']) { // Day M of every N months
1733
+                                $difference = 1;
1734
+                                if ($this->daysInMonth($now, $this->recur["everyn"]) < $this->recur["monthday"]) {
1735
+                                    $difference = $this->recur["monthday"] - $this->daysInMonth($now, $this->recur["everyn"]) + 1;
1736
+                                }
1737
+                                $daynow = $now + (($this->recur["monthday"] - $difference) * 24 * 60 * 60);
1738
+                                //checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1739
+                                if ($daynow <= $dayend){
1740
+                                    $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1741
+                                }
1741 1742
                             }
1742
-                        }
1743
-                        else if(isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1744
-                            // Sanitize input
1745
-                            if($this->recur["weekdays"] == 0)
1746
-                                $this->recur["weekdays"] = 1;
1747
-
1748
-                            // If nday is not set to the last day in the month
1749
-                            if ($this->recur["nday"] < 5) {
1750
-                                // keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1751
-                                $ndaycounter = 0;
1752
-                                // Find matching weekday in this month
1753
-                                for($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; $day++)
1754
-                                {
1755
-                                    $daynow = $now + $day * 60 * 60 * 24;
1756
-                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1743
+                            else if(isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] of every N months
1744
+                                // Sanitize input
1745
+                                if($this->recur["weekdays"] == 0)
1746
+                                    $this->recur["weekdays"] = 1;
1747
+
1748
+                                // If nday is not set to the last day in the month
1749
+                                if ($this->recur["nday"] < 5) {
1750
+                                    // keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1751
+                                    $ndaycounter = 0;
1752
+                                    // Find matching weekday in this month
1753
+                                    for($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; $day++)
1754
+                                    {
1755
+                                        $daynow = $now + $day * 60 * 60 * 24;
1756
+                                        $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1757 1757
 
1758
-                                    if($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1759
-                                        $ndaycounter ++;
1760
-                                    }
1761
-                                    // check the selected pattern is same as asked Nth weekday,If so set the firstday
1762
-                                    if($this->recur["nday"] == $ndaycounter){
1763
-                                        $firstday = $day;
1764
-                                        break;
1758
+                                        if($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1759
+                                            $ndaycounter ++;
1760
+                                        }
1761
+                                        // check the selected pattern is same as asked Nth weekday,If so set the firstday
1762
+                                        if($this->recur["nday"] == $ndaycounter){
1763
+                                            $firstday = $day;
1764
+                                            break;
1765
+                                        }
1765 1766
                                     }
1766
-                                }
1767
-                                // $firstday is the day of the month on which the asked pattern of nth weekday matches
1768
-                                $daynow = $now + $firstday * 60 * 60 * 24;
1769
-                            }else{
1770
-                                // Find last day in the month ($now is the firstday of the month)
1771
-                                $NumDaysInMonth =  $this->daysInMonth($now, 1);
1772
-                                $daynow = $now + (($NumDaysInMonth-1) * 24*60*60);
1773
-
1774
-                                $nowtime = $this->gmtime($daynow);
1775
-                                while (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"]))==0){
1776
-                                    $daynow -= 86400;
1767
+                                    // $firstday is the day of the month on which the asked pattern of nth weekday matches
1768
+                                    $daynow = $now + $firstday * 60 * 60 * 24;
1769
+                                }else{
1770
+                                    // Find last day in the month ($now is the firstday of the month)
1771
+                                    $NumDaysInMonth =  $this->daysInMonth($now, 1);
1772
+                                    $daynow = $now + (($NumDaysInMonth-1) * 24*60*60);
1773
+
1777 1774
                                     $nowtime = $this->gmtime($daynow);
1775
+                                    while (($this->recur["weekdays"] & (1 << $nowtime["tm_wday"]))==0){
1776
+                                        $daynow -= 86400;
1777
+                                        $nowtime = $this->gmtime($daynow);
1778
+                                    }
1778 1779
                                 }
1779
-                            }
1780 1780
 
1781
-                            /**
1781
+                                /**
1782 1782
                              * checks weather the next coming day in recurrence pattern is less than or equal to end day of the            * recurring item.Also check weather the coming day in recurrence pattern is greater than or equal to start * of recurring pattern, so that appointment that fall under the recurrence range are only displayed.
1783 1783
                              */
1784
-                            if ($daynow <= $dayend && $daynow >= $daystart){
1785
-                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz , $remindersonly);
1786
-                            }
1787
-                        } else if ($this->recur['regen']) {
1788
-                            $next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1789
-                            $now = $daystart +($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1784
+                                if ($daynow <= $dayend && $daynow >= $daystart){
1785
+                                    $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz , $remindersonly);
1786
+                                }
1787
+                            } else if ($this->recur['regen']) {
1788
+                                $next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1789
+                                $now = $daystart +($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1790 1790
 
1791
-                            if ($now <= $dayend) {
1792
-                                $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1791
+                                if ($now <= $dayend) {
1792
+                                    $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1793
+                                }
1793 1794
                             }
1794 1795
                         }
1795
-                    }
1796
-                    break;
1797
-                case 13:
1798
-                    // Yearly
1799
-                    if($this->recur["everyn"] <= 0)
1800
-                        $this->recur["everyn"] = 12;
1796
+                        break;
1797
+                    case 13:
1798
+                        // Yearly
1799
+                        if($this->recur["everyn"] <= 0)
1800
+                            $this->recur["everyn"] = 12;
1801 1801
 
1802
-                    for($now = $this->yearStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60 )
1803
-                    {
1804
-                        if(isset($this->recur["monthday"]) && !$this->recur['regen']) { // same as monthly, but in a specific month
1805
-                            // recur["month"] is in minutes since the beginning of the year
1806
-                            $month = $this->monthOfYear($this->recur["month"]); // $month is now month of year [0..11]
1807
-                            $monthday = $this->recur["monthday"]; // $monthday is day of the month [1..31]
1808
-                            $monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1809
-                            if($monthday > $this->daysInMonth($monthstart, 1))
1810
-                                $monthday = $this->daysInMonth($monthstart, 1);    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1811
-                            $daynow = $monthstart + ($monthday-1) * 24 * 60 * 60;
1812
-                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1813
-                        }
1814
-                        else if(isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1802
+                        for($now = $this->yearStartOf($daystart); $now <= $dayend && ($limit == 0 || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur["everyn"]) * 24 * 60 * 60 )
1803
+                        {
1804
+                            if(isset($this->recur["monthday"]) && !$this->recur['regen']) { // same as monthly, but in a specific month
1805
+                                // recur["month"] is in minutes since the beginning of the year
1806
+                                $month = $this->monthOfYear($this->recur["month"]); // $month is now month of year [0..11]
1807
+                                $monthday = $this->recur["monthday"]; // $monthday is day of the month [1..31]
1808
+                                $monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1809
+                                if($monthday > $this->daysInMonth($monthstart, 1))
1810
+                                    $monthday = $this->daysInMonth($monthstart, 1);    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1811
+                                $daynow = $monthstart + ($monthday-1) * 24 * 60 * 60;
1812
+                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1813
+                            }
1814
+                            else if(isset($this->recur["nday"], $this->recur["weekdays"])) { // Nth [weekday] in month X of every N years
1815 1815
 
1816
-                            // Go the correct month
1817
-                            $monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur["month"])) * 24 * 60 * 60;
1816
+                                // Go the correct month
1817
+                                $monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur["month"])) * 24 * 60 * 60;
1818 1818
 
1819
-                            // Find first matching weekday in this month
1820
-                            for($wday = 0; $wday < 7; $wday++)
1821
-                            {
1822
-                                $daynow = $monthnow + $wday * 60 * 60 * 24;
1823
-                                $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1819
+                                // Find first matching weekday in this month
1820
+                                for($wday = 0; $wday < 7; $wday++)
1821
+                                {
1822
+                                    $daynow = $monthnow + $wday * 60 * 60 * 24;
1823
+                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1824 1824
 
1825
-                                if($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1826
-                                    $firstday = $wday;
1827
-                                    break;
1825
+                                    if($this->recur["weekdays"] & (1 << $nowtime["tm_wday"])) { // Selected ?
1826
+                                        $firstday = $wday;
1827
+                                        break;
1828
+                                    }
1828 1829
                                 }
1829
-                            }
1830 1830
 
1831
-                            // Same as above (monthly)
1832
-                            $daynow = $monthnow + ($firstday + ($this->recur["nday"]-1)*7) * 60 * 60 * 24;
1831
+                                // Same as above (monthly)
1832
+                                $daynow = $monthnow + ($firstday + ($this->recur["nday"]-1)*7) * 60 * 60 * 24;
1833 1833
 
1834
-                            while($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1835
-                                $daynow -= 7 * 60 * 60 * 24;
1836
-                            }
1834
+                                while($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1835
+                                    $daynow -= 7 * 60 * 60 * 24;
1836
+                                }
1837 1837
 
1838
-                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1839
-                        } else if ($this->recur['regen']) {
1840
-                            $year_starttime = $this->gmtime($now);
1841
-                            $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1842
-                            $now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /*year in seconds*/);
1838
+                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1839
+                            } else if ($this->recur['regen']) {
1840
+                                $year_starttime = $this->gmtime($now);
1841
+                                $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1842
+                                $now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /*year in seconds*/);
1843 1843
 
1844
-                            if ($now <= $dayend) {
1845
-                                $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1844
+                                if ($now <= $dayend) {
1845
+                                    $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur["startocc"], $this->recur["endocc"], $this->tz, $remindersonly);
1846
+                                }
1846 1847
                             }
1847 1848
                         }
1848
-                    }
1849 1849
                 }
1850 1850
                 //to get all exception items
1851 1851
                 if (!empty($this->recur['changed_occurences']))
Please login to merge, or discard this patch.