Passed
Push — master ( 068fe9...0fc7d4 )
by
unknown
05:57 queued 02:39
created
lib/utils/g_RFC822.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -550,22 +550,22 @@
 block discarded – undo
550 550
 
551 551
         for (; $i < $iMax; ++$i) {
552 552
             switch ($string[$i]) {
553
-            case '\\':
554
-                ++$slashes;
553
+                case '\\':
554
+                    ++$slashes;
555 555
 
556
-                break;
556
+                    break;
557 557
 
558
-            case '"':
559
-                if (0 == $slashes % 2) {
560
-                    $in_quote = !$in_quote;
561
-                }
562
-                // Fall through to default action below.
558
+                case '"':
559
+                    if (0 == $slashes % 2) {
560
+                        $in_quote = !$in_quote;
561
+                    }
562
+                    // Fall through to default action below.
563 563
 
564
-                // no break
565
-            default:
566
-                $slashes = 0;
564
+                    // no break
565
+                default:
566
+                    $slashes = 0;
567 567
 
568
-                break;
568
+                    break;
569 569
             }
570 570
         }
571 571
 
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
@@ -1711,186 +1711,186 @@
 block discarded – undo
1711 1711
                 // Loop through the entire recurrence range of dates, and check for each occurrence whether it is in the view range.
1712 1712
 
1713 1713
                 switch ($this->recur['type']) {
1714
-                case 10:
1715
-                    // Daily
1716
-                    if ($this->recur['everyn'] <= 0) {
1717
-                        $this->recur['everyn'] = 1440;
1718
-                    }
1719
-
1720
-                    if (0 == $this->recur['subtype']) {
1721
-                        // Every Nth day
1722
-                        for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * $this->recur['everyn']) {
1723
-                            $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1714
+                    case 10:
1715
+                        // Daily
1716
+                        if ($this->recur['everyn'] <= 0) {
1717
+                            $this->recur['everyn'] = 1440;
1724 1718
                         }
1725
-                    } else {
1726
-                        // Every workday
1727
-                        for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * 1440) {
1728
-                            $nowtime = $this->gmtime($now);
1729
-                            if ($nowtime['tm_wday'] > 0 && $nowtime['tm_wday'] < 6) { // only add items in the given timespace
1719
+
1720
+                        if (0 == $this->recur['subtype']) {
1721
+                            // Every Nth day
1722
+                            for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * $this->recur['everyn']) {
1730 1723
                                 $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1731 1724
                             }
1725
+                        } else {
1726
+                            // Every workday
1727
+                            for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += 60 * 1440) {
1728
+                                $nowtime = $this->gmtime($now);
1729
+                                if ($nowtime['tm_wday'] > 0 && $nowtime['tm_wday'] < 6) { // only add items in the given timespace
1730
+                                    $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1731
+                                }
1732
+                            }
1732 1733
                         }
1733
-                    }
1734 1734
 
1735
-                    break;
1736
-
1737
-                case 11:
1738
-                    // Weekly
1739
-                    if ($this->recur['everyn'] <= 0) {
1740
-                        $this->recur['everyn'] = 1;
1741
-                    }
1735
+                        break;
1742 1736
 
1743
-                    // If sliding flag is set then move to 'n' weeks
1744
-                    if ($this->recur['regen']) {
1745
-                        $daystart += (60 * 60 * 24 * 7 * $this->recur['everyn']);
1746
-                    }
1737
+                    case 11:
1738
+                        // Weekly
1739
+                        if ($this->recur['everyn'] <= 0) {
1740
+                            $this->recur['everyn'] = 1;
1741
+                        }
1747 1742
 
1748
-                    for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur['everyn'])) {
1743
+                        // If sliding flag is set then move to 'n' weeks
1749 1744
                         if ($this->recur['regen']) {
1750
-                            $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1751
-                        } else {
1752
-                            // Loop through the whole following week to the first occurrence of the week, add each day that is specified
1753
-                            for ($wday = 0; $wday < 7; ++$wday) {
1754
-                                $daynow = $now + $wday * 60 * 60 * 24;
1755
-                                // checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1756
-                                if ($daynow <= $dayend) {
1757
-                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1758
-                                    if (($this->recur['weekdays'] & (1 << $nowtime['tm_wday']))) { // Selected ?
1759
-                                        $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1745
+                            $daystart += (60 * 60 * 24 * 7 * $this->recur['everyn']);
1746
+                        }
1747
+
1748
+                        for ($now = $daystart; $now <= $dayend && (0 == $limit || count($items) < $limit); $now += (60 * 60 * 24 * 7 * $this->recur['everyn'])) {
1749
+                            if ($this->recur['regen']) {
1750
+                                $this->processOccurrenceItem($items, $start, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1751
+                            } else {
1752
+                                // Loop through the whole following week to the first occurrence of the week, add each day that is specified
1753
+                                for ($wday = 0; $wday < 7; ++$wday) {
1754
+                                    $daynow = $now + $wday * 60 * 60 * 24;
1755
+                                    // checks weather the next coming day in recurring pattern is less than or equal to end day of the recurring item
1756
+                                    if ($daynow <= $dayend) {
1757
+                                        $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1758
+                                        if (($this->recur['weekdays'] & (1 << $nowtime['tm_wday']))) { // Selected ?
1759
+                                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1760
+                                        }
1760 1761
                                     }
1761 1762
                                 }
1762 1763
                             }
1763 1764
                         }
1764
-                    }
1765 1765
 
1766
-                    break;
1767
-
1768
-                case 12:
1769
-                    // Monthly
1770
-                    if ($this->recur['everyn'] <= 0) {
1771
-                        $this->recur['everyn'] = 1;
1772
-                    }
1766
+                        break;
1773 1767
 
1774
-                    // Loop through all months from start to end of occurrence, starting at beginning of first month
1775
-                    for ($now = $this->monthStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1776
-                        if (isset($this->recur['monthday']) && ('undefined' != $this->recur['monthday']) && !$this->recur['regen']) { // Day M of every N months
1777
-                            $difference = 1;
1778
-                            if ($this->daysInMonth($now, $this->recur['everyn']) < $this->recur['monthday']) {
1779
-                                $difference = $this->recur['monthday'] - $this->daysInMonth($now, $this->recur['everyn']) + 1;
1780
-                            }
1781
-                            $daynow = $now + (($this->recur['monthday'] - $difference) * 24 * 60 * 60);
1782
-                            // checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1783
-                            if ($daynow <= $dayend) {
1784
-                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1785
-                            }
1786
-                        } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] of every N months
1787
-                            // Sanitize input
1788
-                            if (0 == $this->recur['weekdays']) {
1789
-                                $this->recur['weekdays'] = 1;
1790
-                            }
1768
+                    case 12:
1769
+                        // Monthly
1770
+                        if ($this->recur['everyn'] <= 0) {
1771
+                            $this->recur['everyn'] = 1;
1772
+                        }
1791 1773
 
1792
-                            // If nday is not set to the last day in the month
1793
-                            if ($this->recur['nday'] < 5) {
1794
-                                // keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1795
-                                $ndaycounter = 0;
1796
-                                // Find matching weekday in this month
1797
-                                for ($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; ++$day) {
1798
-                                    $daynow = $now + $day * 60 * 60 * 24;
1799
-                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1774
+                        // Loop through all months from start to end of occurrence, starting at beginning of first month
1775
+                        for ($now = $this->monthStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1776
+                            if (isset($this->recur['monthday']) && ('undefined' != $this->recur['monthday']) && !$this->recur['regen']) { // Day M of every N months
1777
+                                $difference = 1;
1778
+                                if ($this->daysInMonth($now, $this->recur['everyn']) < $this->recur['monthday']) {
1779
+                                    $difference = $this->recur['monthday'] - $this->daysInMonth($now, $this->recur['everyn']) + 1;
1780
+                                }
1781
+                                $daynow = $now + (($this->recur['monthday'] - $difference) * 24 * 60 * 60);
1782
+                                // checks weather the next coming day in recurrence pattern is less than or equal to end day of the recurring item
1783
+                                if ($daynow <= $dayend) {
1784
+                                    $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1785
+                                }
1786
+                            } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] of every N months
1787
+                                // Sanitize input
1788
+                                if (0 == $this->recur['weekdays']) {
1789
+                                    $this->recur['weekdays'] = 1;
1790
+                                }
1800 1791
 
1801
-                                    if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1802
-                                        ++$ndaycounter;
1803
-                                    }
1804
-                                    // check the selected pattern is same as asked Nth weekday,If so set the firstday
1805
-                                    if ($this->recur['nday'] == $ndaycounter) {
1806
-                                        $firstday = $day;
1792
+                                // If nday is not set to the last day in the month
1793
+                                if ($this->recur['nday'] < 5) {
1794
+                                    // keep the track of no. of time correct selection pattern(like 2nd weekday, 4th fiday, etc.)is matched
1795
+                                    $ndaycounter = 0;
1796
+                                    // Find matching weekday in this month
1797
+                                    for ($day = 0, $total = $this->daysInMonth($now, 1); $day < $total; ++$day) {
1798
+                                        $daynow = $now + $day * 60 * 60 * 24;
1799
+                                        $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1800
+
1801
+                                        if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1802
+                                            ++$ndaycounter;
1803
+                                        }
1804
+                                        // check the selected pattern is same as asked Nth weekday,If so set the firstday
1805
+                                        if ($this->recur['nday'] == $ndaycounter) {
1806
+                                            $firstday = $day;
1807 1807
 
1808
-                                        break;
1808
+                                            break;
1809
+                                        }
1809 1810
                                     }
1810
-                                }
1811
-                                // $firstday is the day of the month on which the asked pattern of nth weekday matches
1812
-                                $daynow = $now + $firstday * 60 * 60 * 24;
1813
-                            } else {
1814
-                                // Find last day in the month ($now is the firstday of the month)
1815
-                                $NumDaysInMonth = $this->daysInMonth($now, 1);
1816
-                                $daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
1811
+                                    // $firstday is the day of the month on which the asked pattern of nth weekday matches
1812
+                                    $daynow = $now + $firstday * 60 * 60 * 24;
1813
+                                } else {
1814
+                                    // Find last day in the month ($now is the firstday of the month)
1815
+                                    $NumDaysInMonth = $this->daysInMonth($now, 1);
1816
+                                    $daynow = $now + (($NumDaysInMonth - 1) * 24 * 60 * 60);
1817 1817
 
1818
-                                $nowtime = $this->gmtime($daynow);
1819
-                                while (($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) == 0) {
1820
-                                    $daynow -= 86400;
1821 1818
                                     $nowtime = $this->gmtime($daynow);
1819
+                                    while (($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) == 0) {
1820
+                                        $daynow -= 86400;
1821
+                                        $nowtime = $this->gmtime($daynow);
1822
+                                    }
1822 1823
                                 }
1823
-                            }
1824 1824
 
1825
-                            /*
1825
+                                /*
1826 1826
                              * 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.
1827 1827
                              */
1828
-                            if ($daynow <= $dayend && $daynow >= $daystart) {
1829
-                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1830
-                            }
1831
-                        } elseif ($this->recur['regen']) {
1832
-                            $next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1833
-                            $now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1828
+                                if ($daynow <= $dayend && $daynow >= $daystart) {
1829
+                                    $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1830
+                                }
1831
+                            } elseif ($this->recur['regen']) {
1832
+                                $next_month_start = $now + ($this->daysInMonth($now, 1) * 24 * 60 * 60);
1833
+                                $now = $daystart + ($this->daysInMonth($next_month_start, $this->recur['everyn']) * 24 * 60 * 60);
1834 1834
 
1835
-                            if ($now <= $dayend) {
1836
-                                $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1835
+                                if ($now <= $dayend) {
1836
+                                    $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1837
+                                }
1837 1838
                             }
1838 1839
                         }
1839
-                    }
1840 1840
 
1841
-                    break;
1841
+                        break;
1842 1842
 
1843
-                case 13:
1844
-                    // Yearly
1845
-                    if ($this->recur['everyn'] <= 0) {
1846
-                        $this->recur['everyn'] = 12;
1847
-                    }
1843
+                    case 13:
1844
+                        // Yearly
1845
+                        if ($this->recur['everyn'] <= 0) {
1846
+                            $this->recur['everyn'] = 12;
1847
+                        }
1848 1848
 
1849
-                    for ($now = $this->yearStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1850
-                        if (isset($this->recur['monthday']) && !$this->recur['regen']) { // same as monthly, but in a specific month
1851
-                            // recur["month"] is in minutes since the beginning of the year
1852
-                            $month = $this->monthOfYear($this->recur['month']); // $month is now month of year [0..11]
1853
-                            $monthday = $this->recur['monthday']; // $monthday is day of the month [1..31]
1854
-                            $monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1855
-                            if ($monthday > $this->daysInMonth($monthstart, 1)) {
1856
-                                $monthday = $this->daysInMonth($monthstart, 1);
1857
-                            }    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1858
-                            $daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1859
-                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1860
-                        } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] in month X of every N years
1861
-                            // Go the correct month
1862
-                            $monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur['month'])) * 24 * 60 * 60;
1863
-
1864
-                            // Find first matching weekday in this month
1865
-                            for ($wday = 0; $wday < 7; ++$wday) {
1866
-                                $daynow = $monthnow + $wday * 60 * 60 * 24;
1867
-                                $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1868
-
1869
-                                if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1870
-                                    $firstday = $wday;
1849
+                        for ($now = $this->yearStartOf($daystart); $now <= $dayend && (0 == $limit || count($items) < $limit); $now += $this->daysInMonth($now, $this->recur['everyn']) * 24 * 60 * 60) {
1850
+                            if (isset($this->recur['monthday']) && !$this->recur['regen']) { // same as monthly, but in a specific month
1851
+                                // recur["month"] is in minutes since the beginning of the year
1852
+                                $month = $this->monthOfYear($this->recur['month']); // $month is now month of year [0..11]
1853
+                                $monthday = $this->recur['monthday']; // $monthday is day of the month [1..31]
1854
+                                $monthstart = $now + $this->daysInMonth($now, $month) * 24 * 60 * 60; // $monthstart is the timestamp of the beginning of the month
1855
+                                if ($monthday > $this->daysInMonth($monthstart, 1)) {
1856
+                                    $monthday = $this->daysInMonth($monthstart, 1);
1857
+                                }    // Cap $monthday on month length (eg 28 feb instead of 29 feb)
1858
+                                $daynow = $monthstart + ($monthday - 1) * 24 * 60 * 60;
1859
+                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1860
+                            } elseif (isset($this->recur['nday'], $this->recur['weekdays'])) { // Nth [weekday] in month X of every N years
1861
+                                // Go the correct month
1862
+                                $monthnow = $now + $this->daysInMonth($now, $this->monthOfYear($this->recur['month'])) * 24 * 60 * 60;
1871 1863
 
1872
-                                    break;
1864
+                                // Find first matching weekday in this month
1865
+                                for ($wday = 0; $wday < 7; ++$wday) {
1866
+                                    $daynow = $monthnow + $wday * 60 * 60 * 24;
1867
+                                    $nowtime = $this->gmtime($daynow); // Get the weekday of the current day
1868
+
1869
+                                    if ($this->recur['weekdays'] & (1 << $nowtime['tm_wday'])) { // Selected ?
1870
+                                        $firstday = $wday;
1871
+
1872
+                                        break;
1873
+                                    }
1873 1874
                                 }
1874
-                            }
1875 1875
 
1876
-                            // Same as above (monthly)
1877
-                            $daynow = $monthnow + ($firstday + ($this->recur['nday'] - 1) * 7) * 60 * 60 * 24;
1876
+                                // Same as above (monthly)
1877
+                                $daynow = $monthnow + ($firstday + ($this->recur['nday'] - 1) * 7) * 60 * 60 * 24;
1878 1878
 
1879
-                            while ($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1880
-                                $daynow -= 7 * 60 * 60 * 24;
1881
-                            }
1879
+                                while ($this->monthStartOf($daynow) != $this->monthStartOf($monthnow)) {
1880
+                                    $daynow -= 7 * 60 * 60 * 24;
1881
+                                }
1882 1882
 
1883
-                            $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1884
-                        } elseif ($this->recur['regen']) {
1885
-                            $year_starttime = $this->gmtime($now);
1886
-                            $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1887
-                            $now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
1883
+                                $this->processOccurrenceItem($items, $start, $end, $daynow, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1884
+                            } elseif ($this->recur['regen']) {
1885
+                                $year_starttime = $this->gmtime($now);
1886
+                                $is_next_leapyear = $this->isLeapYear($year_starttime['tm_year'] + 1900 + 1);    // +1 next year
1887
+                                $now = $daystart + ($is_next_leapyear ? 31622400 /* Leap year in seconds */ : 31536000 /* year in seconds */);
1888 1888
 
1889
-                            if ($now <= $dayend) {
1890
-                                $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1889
+                                if ($now <= $dayend) {
1890
+                                    $this->processOccurrenceItem($items, $daystart, $end, $now, $this->recur['startocc'], $this->recur['endocc'], $this->tz, $remindersonly);
1891
+                                }
1891 1892
                             }
1892 1893
                         }
1893
-                    }
1894 1894
                 }
1895 1895
                 // to get all exception items
1896 1896
                 if (!empty($this->recur['changed_occurences'])) {
Please login to merge, or discard this patch.