Index: branches/liquidthreads/extensions/LqtExtension.php |
— | — | @@ -673,8 +673,9 @@ |
674 | 674 | } |
675 | 675 | $e = $r->getVal('lqt_archive_end'); |
676 | 676 | if ($e && ctype_digit($e) && strlen($e) == 6 && !$ignore_dates) { |
677 | | - $this->end = "{$e}31235959"; |
678 | | - $where[] = 'thread_touched <= ' . $this->end; |
| 677 | + $this->end = "{$e}00000000"; |
| 678 | + $e += 1; // TODO addition on dates crossing years |
| 679 | + $where[] = 'thread_touched < ' . "{$e}00000000"; |
679 | 680 | } |
680 | 681 | if ( isset($this->start) && isset($this->end) ) { |
681 | 682 | $annotations[] = "from $start to $end"; |
— | — | @@ -745,24 +746,30 @@ |
746 | 747 | $these_dates_check = $use_dates ? 'checked="1"' : ''; |
747 | 748 | |
748 | 749 | // bcsub() and bcadd() do arithmetic on strings. |
749 | | - // wouldn't want to overflow any puny 32-bit machines with these |
| 750 | + // Wouldn't want to overflow any puny 32-bit machines with these |
750 | 751 | // giants numbers that reperesent dates. |
751 | 752 | |
| 753 | + $one_month = '100000000'; |
752 | 754 | if( isset($this->start, $this->end) ) { |
753 | 755 | var_dump($this->start, $this->end); |
754 | | - $delta = bcsub($this->end, $this->start); |
755 | | - $older_start = bcsub($this->start, $delta); |
756 | | - $newer_start = bcadd($this->start, $delta); |
757 | | - $older_end = bcsub($this->end, $delta); |
758 | | - $newer_end = bcadd($this->end, $delta); |
| 756 | + |
| 757 | + $older_end = bcsub($this->start,$one_month); |
| 758 | + $older_start = bcsub($older_end, bcsub($this->end, $this->start)); |
| 759 | + |
| 760 | + $newer_start = bcadd($this->end, $one_month); |
| 761 | + $newer_end = bcadd($newer_start, bcsub( $this->end, $this->start )); |
| 762 | + |
| 763 | + var_dump($newer_start, $newer_end); |
759 | 764 | } |
760 | 765 | |
761 | | - var_dump($older_start, $older_end); |
762 | | - |
763 | 766 | $older = $this->queryReplace(array('lqt_archive_filter_by_date'=>'1', |
764 | 767 | 'lqt_archive_start' => substr($older_start, 0, 6), |
765 | 768 | 'lqt_archive_end' => substr($older_end, 0, 6) )); |
| 769 | + $newer = $this->queryReplace(array('lqt_archive_filter_by_date'=>'1', |
| 770 | + 'lqt_archive_start' => substr($newer_start, 0, 6), |
| 771 | + 'lqt_archive_end' => substr($newer_end, 0, 6) )); |
766 | 772 | |
| 773 | + |
767 | 774 | $this->output->addHTML(<<<HTML |
768 | 775 | <form id="lqt_archive_search_form" action="{$this->title->getLocalURL()}"> |
769 | 776 | <input type="hidden" name="lqt_show_archive" value="1"> |
— | — | @@ -774,9 +781,9 @@ |
775 | 782 | name="lqt_archive_filter_by_date" value="1" {$these_dates_check}> |
776 | 783 | <label for="lqt_archive_filter_by_date_yes">Only these dates:</label> <br> |
777 | 784 | |
778 | | - <label for="lqt_archive_start">Start</label> |
| 785 | + <label for="lqt_archive_start">From</label> |
779 | 786 | {$this->monthSelect($months, 'lqt_archive_start')} <br> |
780 | | - <label for="lqt_archive_end">End</label> |
| 787 | + <label for="lqt_archive_end">To</label> |
781 | 788 | {$this->monthSelect($months, 'lqt_archive_end')} |
782 | 789 | <input type="submit"> |
783 | 790 | |