<?php
/*
This file is part of Thomas Bley's moregroupware webmail2/calendar2/admin2 module. (tb-mgw)

More information:
-----------------

Simple Groupware Solutions Thomas Bley
Fichtenstr. 23
Germany, 85640 Putzbrunn

Contact:
--------

info@simple-groupware.de

http://www.simple-groupware.de


Copyright 2002-2003 Thomas Bley
tb-mgw is distributed under the terms of the GNU General Public License 

tb-mgw 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.

tb-mgw 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 tb-mgw; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

  if (!defined('ROOTPATH')) die;

  include_once(ROOTPATH . "/modules/" . $myEnv["module"] . "/inc/smenu.php");
  include_once(ROOTPATH . "/modules/" . $myEnv["module"] . "/inc/timezones.php");
  
  $rights = array();
  include_once(ROOTPATH."/modules/calendar2/inc/rights.inc.php");
  if (count($rights)>0) set_default_rights_admin("root_modules_calendar2_",$rights);

  set_default_rights("root_modules_settings_",array("accessmodule" => 0));


  echo "Adding holidays ...<br>";

  $handle=opendir("holidays/");
  while ($file = readdir($handle)) {
    $ext = strtolower(substr($file,-strpos(strrev($file),'.')));
	if ($ext=="ics") {
	  
	  $import_cal_name = str_replace(".ics","",$file);

	  create_holiday_calendar($import_cal_name,$calendar_rights);
	  pump_into_sql("holidays/".$file,"#".$import_cal_name);
    }
  }
  closedir($handle);

?>