<?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 script manages iCal event editing in a popup window
*
**/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
<title>eventCreator testing</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="author" content="kigkonsult - Kjell-Inge Gustafsson" />
<meta name="copyright" content="2007 kigkonsult" />
<meta name="keywords" content="ical, xcal, rss, calendar, rfc2445, php, create, generate, icalender" />
<meta name="description" content="eventCreator is a PHP implementation of RFC 2445 and RSS event." />
<link rel="shortcut icon" href="images/favicon.ico"/>
<link href="eCstyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
if( isset( $_REQUEST['popupEvent']['task'] ) && ( 'popupEvent' == $_REQUEST['popupEvent']['task'] ) &&
isset( $_REQUEST['popupEvent']['submit'] )) {
/** take care of form output and fire the popup window */
define( '_VALID_KIG', 1 );
require_once 'languages'.DIRECTORY_SEPARATOR.'lang.en.php'; // language file
require_once 'includes'.DIRECTORY_SEPARATOR.'eventCreator.inc.php'; // common functions
ecremFiles( 'cache', 900, TRUE ); // secs=15min, remove older files.. .
$popupEventdirectory = 'cache'.DIRECTORY_SEPARATOR.date('YmdHis').mt_rand( 1, 9 );
$res = mkdir( $popupEventdirectory, 0700 ); // create unique subdirectory
$popupEventfilename = ecimpfile( $popupEventdirectory, 'popupEventFile', 'ics' );
if( !isset( $EClang['fileerror'][$popupEventfilename] )) { // no upload errors
?>
<div style="display:none">
<input type="hidden" id="popupEventdirectory" value="<?php echo $popupEventdirectory; ?>"/>
<input type="hidden" id="popupEventfilename" value="<?php echo $popupEventfilename; ?>"/>
<script type="text/javascript">
var url = "eventCreator.php";
var base = location.href;
var xend = base.lastIndexOf("/") + 1;
var base_url = base.substring(0, xend);
url = base_url + url;
url = url + '?d=' + document.getElementById('popupEventdirectory').value;
url = url + '&f=' + document.getElementById('popupEventfilename').value;
var caption = 'eventCreator popup test';
var specs = '';
// specs += 'channelmode=0'; // default
// channelmode=yes|no|1|0 Whether or not to display the window in theater mode. Default is no
specs += ',directories=0';
// directories=yes|no|1|0 Whether or not to add directory buttons. Default is yes
// specs += ',fullscreen=0'; // default
// fullscreen=yes|no|1|0 Whether or not to display the browser in full-screen mode.
// Default is no. A window in full-screen mode must also be in theater mod e
specs += ',height=505';
// height=pixels The height of the window. Min. value is 100
specs += ',left=0';
// left=pixels The left position of the window
specs += ',location=0';
// location=yes|no|1|0 Whether or not to display the address field. Default is yes
specs += ',menubar=0';
// menubar=yes|no|1|0 Whether or not to display the menu bar. Default is yes
// specs += ',resizable=1'; // default
// resizable=yes|no|1|0 Whether or not the window is resizable. Default is yes
specs += ',scrollbars=1';
// scrollbars=yes|no|1|0 Whether or not to display scroll bars. Default is yes
specs += ',status=0';
// status=yes|no|1|0 Whether or not to add a status bar. Default is yes
// specs += ',titlebar=1'; // default
// titlebar=yes|no|1|0 Whether or not to display the title bar.
// Ignored unless the calling application is an HTML Application or a trusted dialog box. Default is yes
specs += ',toolbar=0';
// toolbar=yes|no|1|0 Whether or not to display the browser toolbar. Default is yes
specs += ',top=0';
// top=pixels The top position of the window
specs += ',width=625';
// width=pixels The width of the window. Min. value is 100
var popup = window.open(url, caption, specs);
</script>
</div>
<?php
}
}
?>
<!-- fix upload form -->
<?php
$action = __FILE__;
$pos = strrpos( $action, DIRECTORY_SEPARATOR );
if( $pos !== FALSE )
$action = substr( $action, $pos+1 );
?>
<div style="border:black solid thin; text-align: center; width:220px;">
<form name="popupEventForm" id="popupEventForm" method="post" enctype="multipart/form-data" action="<?php echo $action; ?>">
<input type="hidden" name="popupEvent[task]" value="popupEvent"/>
<input type="hidden" name="MAX_FILE_SIZE" value="20000"/>
<p>Edit iCal event file</p>
<input name="popupEventFile" type="file" size="13"/>
<input type="submit" name="popupEvent[submit]" value="edit event file in a popup"/>
</form>
</div>
</body>
</html>