<?php
/**
* eventCreator
* ver 2.0
*
* The iCal file event php-HTML form editor
*
* copyright (c) 2007 Kjell-Inge Gustafsson kigkonsult
* www.kigkonsult.se/iCalcreator/eventCreator/index.php
* hide@address.com
* updated 20070528
*
* 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
*
* This config script is to be included in all other scripts
*
**/
defined( '_VALID_KIG' ) or die( 'Direct Access to this location is not allowed.' );
/** this configuration allows
calendar event create/edit/delete (default directory=ECCACHE)
redirect to browser in iCal/xCal/rssCal/rsscal2.0 format (rss only present event)
- no DIRECTORY_SEPARATOR suffix in any *DIR constants
- TRUE/FALSE values where appropriate, comment/uncomment elsewhere
*/
/** required */
define( 'ECURL', 'http://localhost/work/iCal/eventCreator-2.0/eventCreator.php' );
// script location url or url where eventCreator is included
define( 'ECDIR', '/home/work/iCal/eventCreator-2.0' );
// script location path
define( 'ECCACHE', ECDIR.DIRECTORY_SEPARATOR.'cache' );
// cache directory, write grants needed,
// default directory for file upload/select if not specifying upload/select directories
// default directory for all created output files if not specifying create directory
/** optional */
define( 'ECTIMEOUT', 0);
// seconds, remove old iCal/xCal/RSS files from ECCACHE folder, 0=never (defaults other timeouts)
define( 'ECUNIQUEID', 'kigkonsult.se/iCalcreator');
// site domain, other site specific id, used in iCalcreator calendar PRODID and component UID settings
// otherwise set as gethostbyname($_SERVER['SERVER_NAME'])
/** required */
$lang = ( isset( $lang )) ? $lang : 'en'; // default lang sets here (en, es, se)
define( 'ECLANG', $lang );
// language file "lang.".ECLANG.".php" must exist in languages folder
/** optional */
define( 'ECLANGCHANGE', TRUE);
// display lang. flags in form and allows changes of languages, from now, en, es, se
/** required if PHP ver >= 5.x */
define( 'ECTIMEZONE', 'Europe/Stockholm');
// timezone
if( substr( phpversion(), 0, 1) >= '5' ) {
date_default_timezone_set( ECTIMEZONE );
//only for php 5.x, date management
}
/** optional */
define( 'ECSETTIMEZONE', TRUE);
// set ECTIMEZONE in new files as X-WR-TIMEZONE
/** run mode, required */
define( 'ECSTANDALONE', TRUE );
// if script is NOT included somewhere else then HTML tags (html, head, body.. .) need to be produced
/** ECSINGLEFILE or ECFILEUPLOAD/ECFILESELECT required */
if( TRUE === @ECSTANDALONE )
define( 'ECSINGLEFILE', TRUE );
// only single calendar file to edit, NO upload and NO file select allowed
// N.B. file (+directory ) must be given within script calling parameters
if( TRUE !== @ECSINGLEFILE ) {
define( 'ECFILEUPLOAD', TRUE );
// allow or deny file upload to directory
define( 'ECFILEUPLOADDIR', ECDIR.DIRECTORY_SEPARATOR.'calendars' );
// general upload directory, write grants needed,
define( 'ECFILEUPLOADEXCLUSIVEDIR', FALSE );
// create exclusive upload directory (within ECFILEUPLOADDIR) for every uploaded file
$mfs = (string) ini_get( 'upload_max_filesize' ); // autosetting from PHP config size and adaption
$maxfilesize = 0;
for($x=0; $x < strlen($mfs); $x++ ) {
if( ctype_digit( $mfs{$x} ))
$maxfilesize .= $mfs{$x};
elseif( 'M' == $mfs{$x} ) {
$maxfilesize = ((int) $maxfilesize) * 1024 * 1024;
break;
}
elseif( 'K' == $mfs{$x} ) {
$maxfilesize = ((int) $maxfilesize) * 1024;
break;
}
}
define( 'ECFILEUPLOADMAXSIZE', $maxfilesize);
// maximal upload file size
define( 'ECFILEUPLOADDIRTIMEOUT', 0);
// seconds, remove old iCal/xCal/RSS files from ECFILEUPLOADDIR folder(-s), 0=never
define( 'ECFILESELECT', TRUE );
// allow or deny file selection from directory
define( 'ECFILESELECTDIR', ECDIR.DIRECTORY_SEPARATOR.'calendars' );
// file select directory, write grants needed,
define( 'ECFILESELECTDIRTIMEOUT', ECTIMEOUT);
// seconds, remove old iCal/xCal/RSS files from ECFILSELECTDIR folder, 0=never
define( 'ECFILECREATE', TRUE );
// new file creation allowed, in ECFILESELECTDIR, if ECFILECREATE = TRUE
define( 'ECFILECREATEDIR', ECDIR.DIRECTORY_SEPARATOR.'calendars' );
// directory to contain new files, write grants needed,
define( 'ECFILECREATEFIXFILENAME', FALSE ); // 'calendar' );
// if a fix calendar filename is desired (ics/xml-extension excluded!)
define( 'ECFILECREATEFILENAMETMPL', 'YmdHis' );
// how filename is set on new calendar files, using date function
// filename set to date( ECFILECREATEFILENAMETMPL ).'.ics/xml'
define( 'ECFILEDELETE', TRUE );
// allowes removal of existing calendar file
}
/** event mode, all optional */
if(( TRUE === @ECSTANDALONE ) && ( TRUE === @ECSINGLEFILE ))
define( 'ECSINGLEEVENT', FALSE );
// only single calendar event editing, special case of single file editing; 'popup' event edit?
// N.B. file (+directory ) must be given within script calling parameters
// N.B. if not first event, ordno/uid must be within script calling parameters
define( 'ECEVENTUPDATE', TRUE );
// existing event update allowed or only viewing existing event
if( TRUE === @ECEVENTUPDATE ) {
define( 'ECEVENTCREATE', TRUE );
// new event creation allowed (new events can't be saved without ECEVENTUPDATE)
/** event setting options, optional */
if( TRUE === @ECEVENTCREATE ) {
define( 'ECEVENTDURATION', 1 );
// default event duration in hours, i.e. fromdate-tomdate span, 0=no duration
define( 'ECEVENTORGANIZERDEFAULT', 'hide@address.com' );
// set fixed default organizer (valid email address) in all new/created events
// also default alarm email attendee, if activated (ECALLOWTRIGGEREMAIL)
/** Event alarm TRIGGER mode, both optional */
define( 'ECALLOWTRIGGERDISPLAY', TRUE );
// allow ALARM TRIGGER with action DISPLAY
define( 'ECTRIGGERDISPLAYDEFAULT', 3 * 60 );
// default ALARM DISPLAY TRIGGER in minutes; 3 * 60
define( 'ECALLOWTRIGGEREMAIL', TRUE );
// allow TRIGGER with action EMAIL
define( 'ECTRIGGEREMAILDEFAULT', 24 * 60 );
// default ALARM EMAIL TRIGGER in minutes; 24 * 60
}
define( 'ECEVENTDELETE', TRUE );
// existing event removal allowed, only if ECEVENTUPDATE=TRUE
define( 'ECENDDATE2DURATION', 1 );
// when saving event, converting enddate to duration
// if event <= ECENDDATE2DURATION days (0=no convert, max 6)
}
/** file output mode, one or more optional */
define( 'ECICALOUTPUT', TRUE );
// allow iCal redirect output, if ECSINGLEEVENT, only event in form, otherwise file
define( 'ECXCALOUTPUT', TRUE );
// allow xCal redirect output, if ECSINGLEEVENT, only event in form, otherwise file
define( 'ECRSSCALOUTPUT', TRUE );
// allow redirect rsscal (RDF) output, only event in form
define( 'ECRSS2CALOUTPUT', TRUE );
// allow redirect rss 2.0 iCal (RSS) output, only event in form
if( TRUE === @ECICALOUTPUT || TRUE === @ECXCALOUTPUT ||
TRUE === ECRSSCALOUTPUT || TRUE === ECRSS2CALOUTPUT ) {
define( 'ECOUTPUTDIR', ECCACHE );
// where to store created iCal/xCal/RSS files (redirect output), any EC*OUTPUT must be TRUE!!
define( 'ECOUTPUTDIRTIMEOUT', 3600);
// seconds, remove old iCal/xCal/RSS files from ECOUTPUTDIR directory, 0=never
define( 'ECOUTPUTFIXFILENAME', FALSE ); // 'calendar' );
// if a fix calendar filename is desired (ics/xml-extension excluded!)
define( 'ECOUTPUTFILENAMETMPL', 'YmdHis' );
// how filename is set on new calendar files, using date function
// filename set to date( ECOUTPUTFILENAMETMPL ).'.ics/xml'
}
/** optional logging */
// define( 'ECLOG', ECDIR.'../HTMLiCal/cache/log.txt');
// if defined, enable logging
// if enabled, log file is created if missing
// log file collects datetime, file type and size, user IP/domain
// define( 'ECLOG', ECCACHE.'/'.date('YW').'.txt' );
// opt. weekly log files
/** close/redirection options, optional, only one */
if(( TRUE === @ECSTANDALONE ) && ( TRUE === @ECSINGLEFILE )) {
define( 'ECCLOSEWINDOW', TRUE );
// show close-image, open option to close window, implies opened as a popup window
define( 'ECCLOSEWINDOWTEXT', 'close window' );
// redirect text to show 'onMouseOver' close-image
}
else {
define( 'ECREDIRECTONCLOSE', FALSE );
// show close-image, open option to close window and redirect
define( 'ECREDIRECTONCLOSETEXT', 'redirect' );
// redirect text to show 'onMouseOver' close-image
define( 'ECREDIRECTONCLOSEURL', 'http://localhost/work/iCal/eventCreator-2.0/redirect.php' );
$ECREDIRECTONCLOSEURLPARAMS = array( 'directory' => 'dir-url-paramname' // opt
, 'filename' => 'filename-url-paramname' // opt
, 'uid' => 'uid-url-paramname' // opt
, 'ordno' => 'ordno-url-paramname' ); // opt
}
/** required */
define( 'ECICAL_DIR', ECDIR.DIRECTORY_SEPARATOR.'includes');
// path to iCalcreator.class.php
define( 'ECJAVASCRIPTDIR', 'includes'.DIRECTORY_SEPARATOR.'js');
// path to prototype.js javascript library for Ajax functionality (if not included elsewhere)
/** optional */
if(TRUE === ECRSSCALOUTPUT || TRUE === ECRSS2CALOUTPUT )
define( 'ECRSSCAL_DIR', ECDIR.DIRECTORY_SEPARATOR.'includes');
// path to rsscalCreator.class.php (for rsscal-RDF / RSS 2.0 output)
define( 'ECHEADERTEXT', FALSE );
// show HEADERtext
define( 'ECLOWERMENU', FALSE );
// if a lower task bar is wanted
/** ECPHPHTMLDIR -OR- ECSMARTYDIR required */
define( 'ECPHPHTMLDIR', ECDIR );
// path to eventCreator.HTML.php, mark as comment if using smarty
define( 'ECSMARTYDIR', ECDIR.DIRECTORY_SEPARATOR.'includes/Smarty-2.6.16/libs' );
// path to Smarty.class.php directory, not bundled in this package
define( 'ECSMARTYCOMPILEDIR', ECDIR.DIRECTORY_SEPARATOR.'smartyCache' );
// Smarty cache directory
define( 'ECSMARTYCACHEDIR', ECDIR.DIRECTORY_SEPARATOR.'smartyCache' );
// Smarty cache directory
define( 'ECSMARTYTMPLDIR', ECDIR.DIRECTORY_SEPARATOR.'smartyTemplates' );
// Smarty template directory, path to eventCreater.tpl
/** don't change anything after this line!!! */
define( 'EVENTCREATOR_VERSION', 'eventCreator 2.0' );
/* version string, do NOT remove!! */
require_once ECICAL_DIR.DIRECTORY_SEPARATOR.'iCalcreator.class.php';
// iCalcreator incl. path
require_once ECDIR.DIRECTORY_SEPARATOR.'languages'.DIRECTORY_SEPARATOR.'lang.'.ECLANG.'.php';
// language file
require_once ECDIR.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'eventCreator.inc.php';
// common functions
?>