// +---------------------------------------------------------------------------+
// | Geeklog SiteCalendar Block version 2.3                                    |
// | Only Supported with Geeklog 1.4.0 and new Search Class                    |
// +---------------------------------------------------------------------------+
// | main.php                                                                  |
// | Main program to view site calendar that displays GL Calendar              |
// | events and hooks into the GL search to show any site updates              |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000,2001 by the following authors:                         |
// | Geeklog Author: Tony Bibbs       - tony@tonybibbs.com                     |
// | Block Author:   Blaine Lang      - geeklog@langfamily.ca                  |
// | Block Modified: Yoshinori Tahara                                          |
// | Original PHP Calendar by Scott Richardson - srichardson@scanonline.com    |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
// Release History
/********************************************************************************
* June 12/2002: Blaine Lang                                                     *
* Modified to work with Geeklog - structured as functions                       *
* and building HTML output to be called as a phpblock and                       *
*                                                                               *
* Sept 2/02: Fixed a bug where today was not being higlighted in the next month *
* Changed all occurances of $InThisMonth to $GLOBALS['InThisMonth']             *
*                                                                               *
* Sept 15/02: Version 2.0                                                       *
* ALmost a complete re-write, code restructured                                 *
* Integrated vesion with Site Search and Events Calendar                        *
* Displayed dates are now active hyperlinks to search results for that day      *
* Added ability to view next/prev months                                        *
* Now using Template classes for fonts                                          *
* Fixed bug with extra week showing up occasionally                             *
*                                                                               *
* Sept 16/02: Fixed bug where I was not checking access to events that were     *
* displayed on the calendar - added access checks.                              *
* Note: Currently only checking system calendar for events  - not personal      *
* Nov 08/02: Gorka Olaizola <gorka@escomposlinux.org>                           *
*    Fixed dates when week starts in previous month                             *
*    Fixed dates when switching years                                           *
*    Added setlocale and strftime for printing the month in local language      *
*                                                                               *
* Dec 03/02: Replaced a couple HTML fixes that had been made since the version  *
* used by Gorka when he did his changes                                         *
*                                                                               *
* January 25/2003: Stephen Magyari                                              *
* Removed the height=100% attribute from the first and last tables in           *
* $BlockDisplay to address a display anomaly in IE 5.2 on Mac OS X, added a     *
* missing </tr> after the month header, and added class="mycallink" attribute   *
* to the 3 occurrences of $event_url                                            *
*                                                                               *
* Feb 01/2003: Blaine Lang                                                      *
* Fixed sellocale() error displayed that occured under PHP 4.3                  *
*                                                                               *
*                                                                               *
* Jul 19/2003: Blaine Lang                                                      *
* Modified for Geeklog 1.3.8 - Core GL Search completely replaced               *
* New Search Class is now being used. No longer need to modify GL Files         *
* Rename SiteCalendar - and is now self contained - no modifications requried   *
*                                                                               *
* Apr 13/2004: Niels Leenheer                                                   *
* Large rewrite to ensure the calender only uses one query to fetch all events  *
* instead of one query for each day. This reduces the number of queries by      *
* 27 or 34. Also, multiple bugs are fixed such as:                              *
* - Multiple events on the same say are now properly shown                      *
* - If there were multiple events on the same day and the first event was       *
*   off limits for the current user, the other events were not taken into       *
*   acount, and as a result that day was not marked as a day with an event      *
* - Weekday abbreviations are now displayed according to the current locale     *
* - Removed <html> and <body> tags from the output, because the output is used  *
*   in an already existing html document.                                       *
*                                                                               *
* Mar 29/2006: Blaine Lang    ( mycal version 1.5 )                             *
* Updated for Geeklog Version 1.4                                               *
*                                                                               *
* Jun 16/2006: Komma Tetsuko (for japanese)                                     *
* Oct 22/2006: mystral-kk - a minor bug fix                                     *
*********************************************************************************/

/********************************************************************************
* modified version 0.1                                                          *
* 2007.1.8 : Yoshinori Tahara as dengen                                         *
* Geeklog SiteCalendar Block "mycal" version 2.5 をベースにして開発しました。   *
* 変更点：検索結果のない日にはリンク処理をおこないません。                      *
*                                                                               *
* modified version 0.2                                                          *
* 2007.1.21 : Yoshinori Tahara as dengen                                        *
* 見逃していたmystral-kk氏の修正(Oct 22/2006)を反映させました。                 *
*                                                                               *
* modified version 0.3                                                          *
* 2007.2.14 : Yoshinori Tahara as dengen                                        *
* 先月または翌月のイベントが表示されてしまう不具合を修正しました。              *
*                                                                               *
*********************************************************************************/

/********************************************************************************
* mycaljp version 1.00                                                          *
* 2007.5.14 : Yoshinori Tahara as dengen                                        *
* Geeklog 1.4.1へ対応．                                                         *
* テンプレートの導入．                                                          *
* コンフィギュレーションの導入．                                                *
* 検索結果表示のカスタマイズ．（記事のイントロ表示など）                        *
* 土・日・日本の休日の色分け表示．                                              *
* 月間、年間の検索．                                                            *
* filemgmtへ対応．                                                              *
*                                                                               *
* mycaljp version 1.0.1                                                         *
* 2007.5.14 : Yoshinori Tahara as dengen                                        *
* 日付のクラス設定のバグを修正．                                                *
*                                                                               *
* mycaljp version 1.0.2                                                         *
* 2007.5.17 : Yoshinori Tahara as dengen                                        *
* 記事の日付のハイライト機能を追加．                                            *
* 小さな不具合修正                                                              *
*                                                                               *
* mycaljp version 1.0.3                                                         *
* 2007.5.20 : Yoshinori Tahara as dengen                                        *
* 数日にまたがるイベントの表示・検索に対応．                                    *
*                                                                               *
* mycaljp version 1.0.4                                                         *
* 2007.6.14 : Yoshinori Tahara as dengen                                        *
* wkyevecal に対応．                                                            *
*                                                                               *
* mycaljp version 1.0.5                                                         *
* 2007.9.4 : Yoshinori Tahara as dengen                                         *
* 日本の休日の判定ミス（春分の日、秋分の日の振替休日の判定ミス）を修正          *
*                                                                               *
* mycaljp version 1.0.6                                                         *
* 2007.10.16 : Yoshinori Tahara as dengen                                       *
* XSS脆弱性の修正．                                                             *
*                                                                               *
* mycaljp version 1.0.7                                                         *
* 2007.11.6 : Yoshinori Tahara as dengen                                        *
* スライドカレンダーの表示に対応．                                              *
*                                                                               *
* mycaljp version 1.0.8                                                         *
* 2007.11.19 : Yoshinori Tahara as dengen                                       *
* 従来型サイトカレンダーのカスタマイズ用テンプレートファイルが                  *
* 同梱されていないミスの修正．                                                  *
*********************************************************************************/

/********************************************************************************
* mycaljp plugin version 2.0.0                                                  *
* 2008.3.21 : Yoshinori Tahara as dengen                                        *
* プラグイン化．                                                                *
* マルチランゲージに対応．                                                      *
*                                                                               *
* mycaljp plugin version 2.0.1                                                  *
* 2008.7.26 : Yoshinori Tahara as dengen                                        *
* Geeklog 1.5 に対応．                                                          *
* プラグインバージョンが正常に更新されない問題を修正．                          *
*                                                                               *
* mycaljp plugin version 2.0.2                                                  *
* 2008.9.10 : Yoshinori Tahara as dengen                                        *
* CSRF対策を施した(Geeklog1.5以降でのみ有効)．                                  *
*                                                                               *
* mycaljp plugin version 2.0.3                                                  *
* 2008.9.15 : Yoshinori Tahara as dengen                                        *
* CSRF対策のミスを修正した．                                                    *
*                                                                               *
* mycaljp plugin version 2.0.4                                                  *
* 2008.9.17 : Yoshinori Tahara as dengen                                        *
* Calendarjpに対応した．                                                        *
*                                                                               *
* mycaljp plugin version 2.0.5                                                  *
* 2008.9.26 : Yoshinori Tahara as dengen                                        *
* インクルード対策を実施した．                                                  *
*                                                                               *
* mycaljp plugin version 2.0.6                                                  *
* 2009.3.28 : Yoshinori Tahara as dengen                                        *
* Auge Bangさんが制作された、「mycaljp専用Black Theme」を同梱した．             *
* (Augeさん、どうも有難うございます!)                                           *
* Geeklog1.5以降で記事のイントロ表示した際に日付が現在の日付になってしまう      *
* 問題を修正．                                                                  *
*                                                                               *
* mycaljp plugin version 2.0.7                                                  *
* 2009.8.17 : Yoshinori Tahara as dengen                                        *
* XSS脆弱性の修正．                                                             *
*                                                                               *
* mycaljp plugin version 2.1.0                                                  *
* 2009.11.3 : Yoshinori Tahara as dengen                                        *
* Geeklog1.6で動作するようにした．                                              *
* Dataproxyに対応した．                                                         *
* コンフィギュレーションとオートインストール機能に対応した．                    *
*                                                                               *
* mycaljp plugin version 2.1.1                                                  *
* 2009.11.7 : Yoshinori Tahara as dengen                                        *
* 携帯電話でのカレンダ表示を改善し、月めくり操作が問題なくできるようにした．    *
*                                                                               *
* mycaljp plugin version 2.1.2                                                  *
* 2010.3.6 : Yoshinori Tahara as dengen                                         *
* 「テーマのテンプレートを使う」機能が実際には動作していなかった問題を修正した．*
*********************************************************************************/
