Location: PHPKode > projects > SiteX > admin/event_edit.php
<?PHP
ob_start();
session_start();

include("../includes/globals.php.inc");
include("../includes/functions.php");
include("../lang/English.php");
if(strtolower($sxSetup['Language']) != 'english') include("../lang/".$sxSetup['Language'].".php");
include("../themes/$THEME_FOLDER/config.php.inc");
if((!userEditor())AND(!userAdmin()))  loginError($sxLang['LoginRequired']);
if((userEditor())AND(!$sxSetup['EditorRightsEventsManage']))  loginError($sxLang['LoginRequired']);

// Construct start date
// Construct start date
if (($start_date_ampm == 'pm')AND($start_date_hour != 12))
	$start_date_hour_24 = $start_date_hour + 12;
	
elseif (($start_date_hour == 12)AND($start_date_ampm == 'am'))
	$start_date_hour_24 = 0;
	
else
	$start_date_hour_24 = $start_date_hour;
	
if ($allday)
{
	$start_date_hour_24 = 0;
	$start_date_minute = 0;
}

$start_date_month 	= substr($start_date, 5, 2);
$start_date_day 	= substr($start_date, 8, 2);
$start_date_year 	= substr($start_date, 0, 4);

$start_timestamp = mktime($start_date_hour_24, $start_date_minute, 0, $start_date_month, $start_date_day, $start_date_year);

// Construct end date
if (($end_date_ampm == 'pm')AND($end_date_hour != 12))
	$end_date_hour_24 = $end_date_hour + 12;
	
elseif (($end_date_hour == 12)AND($end_date_ampm == 'am'))
	$end_date_hour_24 = 0;
	
else
	$end_date_hour_24 = $end_date_hour;

if ($allday)
{
	$end_date_hour_24 = 23;
	$end_date_minute = 59;
}

$end_date_month = substr($end_date, 5, 2);
$end_date_day 	= substr($end_date, 8, 2);
$end_date_year 	= substr($end_date, 0, 4);

$end_timestamp = mktime($end_date_hour_24, $end_date_minute, 0, $end_date_month, $end_date_day, $end_date_year);

if($Submit)
{
	$query = "UPDATE $DB_Events 
	          SET longname='$longname', 
			      shortname='$shortname', 
				  start_timestamp='$start_timestamp', 
				  end_timestamp='$end_timestamp', 
				  description='$content', 
				  allday='$allday', 
				  active='$active'
			  WHERE id='$eventid'";
	$result = mysql_query($query, $Link) or queryError("803", mysql_error());
		
	$query = "DELETE FROM $DB_Events_Private WHERE eventid='$eventid'";
	$result = mysql_query($query, $Link) or queryError("805", mysql_error());
	
	if( ($private) AND (count($user_types) > 0) )
	{
		foreach ($user_types as $k => $v)
		{
			$query = "INSERT INTO $DB_Events_Private (eventid, typeid) VALUES ('$eventid', '$k')";
			$result = mysql_query($query, $Link) or queryError("805", mysql_error());
		}
	}
	
	header("Location: ../calendar_day.php?sxTimestamp=$start_timestamp&message=".str_replace(" ","_",$sxLang['MessageEventEdited']));
	die();
}

$sxEditQuery = "SELECT * FROM $DB_Events WHERE id='$eventid' LIMIT 0,1";
$sxEditResult = mysql_query($sxEditQuery, $Link) or queryError("804", mysql_error());
$sxEditROW = mysql_fetch_object($sxEditResult);

$sxTitleAddendum = $sxLang['AdminHeading'];
include("../themes/$THEME_FOLDER/header.php");
?>

<?PHP
// ============================== TinyMCE ==============================
if($sxSetup['WYSIWYG'] == 'tinymce') { ?>
<script type="text/javascript" src="../includes/tinymce/tiny_mce.js"></script>
<script type="text/javascript">
<!--
	tinyMCE.init({
		// General options
		mode : "textareas",
		editor_selector : 'mceEditor',
		language : "<?PHP echo $sxSetupTinyMCELanguage; ?>",
		theme : "advanced",
		relative_urls : false,
		plugins : "safari,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",

		// Theme options
		theme_advanced_buttons1 : "fullscreen,|,undo,redo,|,bold,italic,underline,strikethrough,|,forecolor,backcolor,|,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,outdent,indent,blockquote,|,link,unlink,anchor,image,cleanup,help,code",
		theme_advanced_buttons3 : "tablecontrols,|,removeformat,visualaid,visualchars,|,sub,sup,|,charmap,iespell,media,advhr",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		//content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "",
			staffid : ""
		}
	});

function fileInsertTinyMCE(selObj)
{
	var fileid = selObj.options[selObj.selectedIndex].value;
	var filename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Files";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	filename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
	
	if(fileid)
	{
			tinyMCE.execCommand('mceInsertContent',false,'<a href="<?PHP echo sxPathToRoot()."/"; ?>redirect.php?fileid='+fileid+'">'+filename[fileid]+'</a>');
	}
}
	
function pageInsertTinyMCE(selObj)
{
	var pageid = selObj.options[selObj.selectedIndex].value;
	var pagename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Pages";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	pagename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
		
	if(pageid)
	{
		tinyMCE.execCommand('mceInsertContent',false,'<a href="<?PHP echo sxPathToRoot()."/"; ?>page.php?pageid='+pageid+'">'+pagename[pageid]+'</a>');
	}
}

//-->
</script>

<?PHP
} // end if(tinymce)

// ============================== F C K ==============================
if($sxSetup['WYSIWYG'] == 'fck') {
	include("../includes/fck/fckeditor.php");
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function fileInsertFCK(selObj)
{
	var fileid = selObj.options[selObj.selectedIndex].value;
	var filename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Files";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	filename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
	
	if((fileid)&&(fileid != 0))
	{
		var oEditor = FCKeditorAPI.GetInstance('content') ;
		oEditor.SetData( oEditor.GetData() +  '<A HREF="redirect.php?fileid='+fileid+'">'+filename[fileid]+'</A>') ;
	}
}

function pageInsertFCK(selObj)
{
	var pageid = selObj.options[selObj.selectedIndex].value;
	var pagename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Pages";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	pagename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
		
	if((pageid)&&(pageid != 0))
	{
		var oEditor = FCKeditorAPI.GetInstance('content') ;
		oEditor.SetData( oEditor.GetData() +  '<A HREF="page.php?pageid='+pageid+'">'+pagename[pageid]+'</A>') ;
	}
}
-->
</script>
<?PHP
} // end if(FCK)

// ============================== htmlarea ==============================
if($sxSetup['WYSIWYG'] == 'htmlarea') {
?>
<script language="JavaScript" type="text/JavaScript">
<!--
_editor_url = "../includes/htmlarea/";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
  document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
  document.write(' language="Javascript1.2"></scr' + 'ipt>'); 
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

function fileInsertHA(selObj)
{
	var fileid = selObj.options[selObj.selectedIndex].value;
	var filename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Files";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	filename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
	
	if(fileid)
	{
		if (win_ie_ver >= 5.5)
		{
			editor_insertHTML('content', '<A HREF="redirect.php?fileid='+fileid+'">'+filename[fileid]+'</A>', '', 0);
		}
		else{
			var content = window.document.sxEventAdd.content.value; 
			window.document.sxEventAdd.content.value = content + '---FILE'+fileid+'---'; 
			window.document.sxEventAdd.content.focus();
		}
	}
}

function pageInsertHA(selObj)
{
	var pageid = selObj.options[selObj.selectedIndex].value;
	var pagename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Pages";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	pagename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
		
	if(pageid)
	{
		if (win_ie_ver >= 5.5)
		{
			editor_insertHTML('content', '<A HREF="page.php?pageid='+pageid+'">'+pagename[pageid]+'</A>', '', 0);
		}
		else
		{
			var content = window.document.sxEventAdd.content.value; 
			window.document.sxEventAdd.content.value = content + '---PAGE'+pageid+'---'; 
			window.document.sxEventAdd.content.focus();
		}
	}
}
//-->
</script> 
<?PHP } // end if(htmlarea) ?>

<script language="JavaScript" type="text/JavaScript">
<!--
function alldayChange ()
{
	if (document.sxEventAdd.allday.checked == true)

	{
		document.sxEventAdd.start_date_hour.disabled = true;
		document.sxEventAdd.start_date_minute.disabled = true;
		document.sxEventAdd.start_date_ampm.disabled = true;
		document.sxEventAdd.end_date_hour.disabled = true;
		document.sxEventAdd.end_date_minute.disabled = true;
		document.sxEventAdd.end_date_ampm.disabled = true;
	}

	else
	{
		document.sxEventAdd.start_date_hour.disabled = false;
		document.sxEventAdd.start_date_minute.disabled = false;
		document.sxEventAdd.start_date_ampm.disabled = false;
		document.sxEventAdd.end_date_hour.disabled = false;
		document.sxEventAdd.end_date_minute.disabled = false;
		document.sxEventAdd.end_date_ampm.disabled = false;
	}
}
function submitIt (myForm)
{
	var shr; var ehr;
	var start = myForm.start_date_year.value + myForm.start_date_month.value + myForm.start_date_day.value;
	var end   = myForm.end_date_year.value + myForm.end_date_month.value + myForm.end_date_day.value;
	
	if (myForm.allday.checked != true)
	{
		if ((myForm.start_date_ampm.value == 'am')&&(myForm.start_date_hour.value == '12'))
			shr = 0;
			
		else
		{
			if ((myForm.start_date_ampm.value == 'pm')&&(eval(myForm.start_date_hour.value) < 12))
			{
				shr = eval(myForm.start_date_hour.value) + 12;
			}
			else
			{
				shr = myForm.start_date_hour.value;
			}
		}
		
		if ((myForm.end_date_ampm.value == 'am')&&(myForm.end_date_hour.value == '12'))
			ehr = 0;
			
		else
		{
			if ((myForm.end_date_ampm.value == 'pm')&&(eval(myForm.end_date_hour.value) < 12))
			{
				ehr = eval(myForm.end_date_hour.value) + 12;
			}
			else
			{
				ehr = myForm.end_date_hour.value;
			}
		}
		
		start = start + shr;
		end = end + ehr;
	}
	
	if (end < start)
	{	
		alert ("<?PHP echo $sxLang['EventJSImpossibleDates']; ?>");
		return false;
	}
}
//-->
</script>

<div class="bodyWrapper">
   <h1 class="sxAdminHeading"><?PHP echo $sxLang['EventEditHeading1'].' '.getComponentName("8").' '.$sxLang['EventEditHeading2']; ?></h1>
   <div class="sxAdminBreadcrumbs"><?PHP if(userAdmin()) { ?><a href="index.php"><?PHP echo $sxLang['AdminBreadcrumb']; ?><?PHP }?><?PHP if(userEditor()) { ?><a href="editor_index.php"><?PHP echo $sxLang['EditorBreadcrumb']; ?><?PHP }?></a> > <a href="event_manager.php"><?PHP echo getComponentName("8").' '.$sxLang['GeneralHeadingManager']; ?></a> > <?PHP echo $sxLang['EventEditHeading1'].' '.getComponentName("8").' '.$sxLang['EventEditHeading2']; ?></div>   
   <?PHP echoMessage($message); ?>
	<form name="sxEventAdd" method="post" action="<?PHP echo $PHP_SELF; ?>" onSubmit="return submitIt(this)">
	<table border="0" cellspacing="0" cellpadding="5">
	  <?PHP if($Preview){ ?>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['Preview']; ?></td>
		<td><p><strong><span class="eventDate"><?PHP echo getFormattedEventDate($allday, $start_timestamp, $end_timestamp, 0); ?></span>
		<?PHP echo '<br />' . stripslashes($longname); ?></strong></p>
		<p><?PHP echo stripslashes($content); ?></p></td>
	  <tr>
		<td colspan="2"><hr size="1" noshade="noshade" /></td>
	  </tr>
	  </tr>
	  <?PHP } ?>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['EventItemLongName']; ?></td>
		<td><input type="text" style="width:500px;" maxlength="255" name="longname"<?PHP if($Preview) echo ' value="' . htmlspecialchars(stripslashes($longname)) . '"'; else echo ' value="' . htmlspecialchars(stripslashes($sxEditROW->longname)) . '"'; ?> /></td>
	  </tr>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['EventItemShortName']; ?></td>
		<td><input type="text" style="width:100px;" maxlength="15" name="shortname"<?PHP if($Preview) echo ' value="' . htmlspecialchars(stripslashes($shortname)) . '"'; else echo ' value="' . htmlspecialchars(stripslashes($sxEditROW->shortname)) . '"'; ?> /></td>
	  </tr>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['EventItemAllDay']; ?></td>
		<td><input type="checkbox" name="allday" value="1"<?PHP if(($Preview)AND($allday)) echo ' checked'; elseif($sxEditROW->allday == 1) echo ' checked'; ?> onclick="alldayChange()" /></td>
	  </tr>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['EventItemStart']; ?></td>
		<td><div id="calendarForForm"><input type="text" name="start_date" id="start_date" readonly="readonly" value="<?PHP if($Preview) echo date("Y-m-d", $start_timestamp); else echo date("Y-m-d",$sxEditROW->start_timestamp); ?>" onchange="updateEndDate()" />
			
			<script type="text/javascript" src="../includes/datepicker/dhtmlSuite-config.js"></script>
			<script type="text/javascript" src="../includes/datepicker/dhtmlSuite-common.js"></script>
			<script type="text/javascript" src="../includes/datepicker/dhtmlSuite-calendar.js"></script>
			<script type="text/javascript" src="../includes/datepicker/dhtmlSuite-dragDropSimple.js"></script>
			
			<script type="text/javascript">
			var daychange = 0;
			var hourdiff = 1;
			
			var calendarObjForFormStart = new DHTMLSuite.calendar({callbackFunctionOnDayClick:'getDateFromCalendarStart',isDragable:true}); 
			var calendarObjForFormEnd   = new DHTMLSuite.calendar({callbackFunctionOnDayClick:'getDateFromCalendarEnd',isDragable:true}); 
			
			function pickDateStart(buttonObj,inputObject)
			{
				calendarObjForFormStart.setCalendarPositionByHTMLElement(inputObject,0,inputObject.offsetHeight+2);	// Position the calendar right below the form input
				calendarObjForFormStart.setInitialDateFromInput(inputObject,'yyyy-mm-dd');
				calendarObjForFormStart.addHtmlElementReference('myDate',inputObject);								// Adding a reference to this element so that I can pick it up in the getDateFromCalendar below(myInput is a unique key)
				
				calendarObjForFormStart.addHtmlElementReference('myStartDate',document.sxEventAdd.start_date);
				calendarObjForFormStart.addHtmlElementReference('myEndDate',document.sxEventAdd.end_date);
				
				if(calendarObjForFormStart.isVisible()){
					calendarObjForFormStart.hide();
				}else{
					calendarObjForFormStart.resetViewDisplayedMonth();	// This line resets the view back to the inital display, i.e. it displays the inital month and not the month it displayed the last time it was open.
					calendarObjForFormStart.display();
				}
			}
				
			function getDateFromCalendarStart(inputArray)
			{
				var references = calendarObjForFormStart.getHtmlElementReferences();
				references.myDate.value = inputArray.year + '-' + inputArray.month + '-' + inputArray.day;
				//var endday = parseInt(inputArray.day) + daydiff;
				//if(endday < 10)
				//	endday = "0" + endday;
				//if(daychange == 0)
				//	references.myEndDate.value = inputArray.year + '-' + inputArray.month + '-' + inputArray.day;
				calendarObjForFormStart.hide();
			}
			
			function pickDateEnd(buttonObj,inputObject)
			{
				calendarObjForFormEnd.setCalendarPositionByHTMLElement(inputObject,0,inputObject.offsetHeight+2);	// Position the calendar right below the form input
				calendarObjForFormEnd.setInitialDateFromInput(inputObject,'yyyy-mm-dd');
				calendarObjForFormEnd.addHtmlElementReference('myDate',inputObject);								// Adding a reference to this element so that I can pick it up in the getDateFromCalendar below(myInput is a unique key)
				
				calendarObjForFormEnd.addHtmlElementReference('myStartDate2',document.sxEventAdd.start_date);
				calendarObjForFormEnd.addHtmlElementReference('myEndDate2',document.sxEventAdd.end_date);
				
				if(calendarObjForFormEnd.isVisible()){
					calendarObjForFormEnd.hide();
				}else{
					calendarObjForFormEnd.resetViewDisplayedMonth();	// This line resets the view back to the inital display, i.e. it displays the inital month and not the month it displayed the last time it was open.
					calendarObjForFormEnd.display();
				}
			}
				
			function getDateFromCalendarEnd(inputArray)
			{
				var references = calendarObjForFormEnd.getHtmlElementReferences();
				references.myDate.value = inputArray.year + '-' + inputArray.month + '-' + inputArray.day;
				
				//daychange = 1;
				
				calendarObjForFormEnd.hide();
			}	
	
			</script>
			<img alt="<?PHP echo $sxLang['GeneralTooltipPickDate']; ?>" title="<?PHP echo $sxLang['GeneralTooltipPickDate']; ?>" style="cursor:Pointer;cursor:hand;" src="../images/calendar.gif" onclick="pickDateStart(this,document.sxEventAdd.start_date);" align="absmiddle" />
			@ 
			<select name="start_date_hour" <?PHP if((($Preview)AND($allday))OR($sxEditROW->allday == 1)) echo 'disabled="disabled"'; ?>>
			<?PHP
			for($i = 1; $i <= 12; $i++){
				if($i < 10) $i = '0'.$i;
				if($i == date("h", $sxEditROW->start_timestamp)) $selected = ' selected';
				elseif(($Preview)AND($start_date_hour == $i)) $selected = ' selected';
				else $selected = '';
				echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
			}
			?>
			</select>:<select name="start_date_minute" <?PHP if((($Preview)AND($allday))OR($sxEditROW->allday == 1)) echo 'disabled="disabled"'; ?>>
			<?PHP
			for($i = 0; $i <= 59; $i++){
				if($i < 10) $i = '0'.$i;
				if($i == date("i",$sxEditROW->start_timestamp)) $selected = ' selected';
				elseif(($Preview)AND($start_date_minute == $i)) $selected = ' selected';
				else $selected = '';
				echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
			}
			?>
			</select> 
			<select name="start_date_ampm" <?PHP if((($Preview)AND($allday))OR($sxEditROW->allday == 1)) echo 'disabled="true"'; ?>>
			<option value="am"<?PHP if((($Preview)AND($start_date_ampm == 'am'))OR((!$Preview)AND(date("a", $sxEditROW->start_timestamp) == 'am'))) echo ' selected'; ?>>AM</option>
			<option value="pm"<?PHP if((($Preview)AND($start_date_ampm == 'pm'))OR((!$Preview)AND(date("a", $sxEditROW->start_timestamp) == 'pm'))) echo ' selected'; ?>>PM</option>
			</select><br /><span class="sxSmallText">(<?PHP echo $sxLang['DateFormatYYYYMMDD']; ?>)</span></div></td>
	  </tr>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['EventItemEnd']; ?></td>
		<td><div id="calendarForForm"><input type="text" name="end_date" id="end_date" readonly="readonly" value="<?PHP if($Preview) echo date("Y-m-d", $end_timestamp); else echo date("Y-m-d",$sxEditROW->end_timestamp); ?>" />
			<img alt="<?PHP echo $sxLang['GeneralTooltipPickDate']; ?>" title="<?PHP echo $sxLang['GeneralTooltipPickDate']; ?>" style="cursor:Pointer;cursor:hand;" src="../images/calendar.gif" onclick="pickDateEnd(this,document.sxEventAdd.end_date);" align="absmiddle" />
			@ 
			<select name="end_date_hour" <?PHP if((($Preview)AND($allday))OR($sxEditROW->allday == 1)) echo 'disabled="true"'; ?>>
			<?PHP
			for($i = 1; $i <= 12; $i++){
				if($i < 10) $i = '0'.$i;
				if($i == date("h", $sxEditROW->end_timestamp)) $selected = ' selected';
				elseif(($Preview)AND($end_date_hour == $i)) $selected = ' selected';
				else $selected = '';
				echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
			}
			?>
			</select>:<select name="end_date_minute" <?PHP if((($Preview)AND($allday))OR($sxEditROW->allday == 1)) echo 'disabled="disabled"'; ?>>
			<?PHP
			for($i = 0; $i <= 59; $i++){
				if($i < 10) $i = '0'.$i;
				if($i == date("i",$sxEditROW->end_timestamp)) $selected = ' selected';
				elseif(($Preview)AND($end_date_minute == $i)) $selected = ' selected';
				else $selected = '';
				echo '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
			}
			?>
			</select> <select name="end_date_ampm" <?PHP if((($Preview)AND($allday))OR($sxEditROW->allday == 1)) echo 'disabled="disabled"'; ?>>
			<option value="am"<?PHP if((($Preview)AND($end_date_ampm == 'am'))OR((!$Preview)AND(date("a", $sxEditROW->end_timestamp) == 'am'))) echo ' selected'; ?>>AM</option>
			<option value="pm"<?PHP if((($Preview)AND($end_date_ampm == 'pm'))OR((!$Preview)AND(date("a", $sxEditROW->end_timestamp) == 'pm'))) echo ' selected'; ?>>PM</option>
			</select><br /><span class="sxSmallText">(<?PHP echo $sxLang['DateFormatYYYYMMDD']; ?>)</span></div></td>
	  </tr>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['GeneralItemActive']; ?></td>
		<td><input type="checkbox" name="active" value="1"<?PHP if(($Preview)AND($active)) echo ' checked';  elseif($sxEditROW->active == 1) echo ' checked'; ?> /></td>
	  </tr>
	  <tr>
		<td class="sxTdItem"><?PHP echo $sxLang['GeneralItemDescription']; ?></td>
		<td>
		  <div style="text-align:center;background:#EFEFDE;padding:5px;width:500;color:#000000;">
			<strong><?PHP echo $sxLang['Autolink']; ?></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<select name="insert_file" style="width:150px;" onChange="fileInsert<?PHP
			switch($sxSetup['WYSIWYG'])
			{
				case 'fck' :
					echo 'FCK';
					break;
				case 'htmlarea' :
					echo 'HA';
					break;
				case 'tinymce' :
					echo 'TinyMCE';
					break;
			}
		  ?>(this)">
			<option><?PHP echo $sxLang['LinkFile']; ?></option>
			<?PHP
			$queryF = "SELECT * FROM $DB_Files ORDER BY filename";
			$resultF = mysql_query($queryF, $Link) or queryError("802", mysql_error());
			while($ROWF = mysql_fetch_object($resultF)){
				echo '<option value="' . $ROWF->id . '">[' . $ROWF->id . '] ' . $ROWF->name . '</option>'."\n";
			}
			?>
			</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<select name="insert_page" style="width:150px;" onChange="pageInsert<?PHP
			switch($sxSetup['WYSIWYG'])
			{
				case 'fck' :
					echo 'FCK';
					break;
				case 'htmlarea' :
					echo 'HA';
					break;
				case 'tinymce' :
					echo 'TinyMCE';
					break;
			}
		  ?>(this)">
			<option><?PHP echo $sxLang['LinkPage']; ?></option>
			<?PHP
			$queryP = "SELECT * FROM $DB_Pages ORDER BY name";
			$resultP = mysql_query($queryP, $Link) or queryError("801", mysql_error());
			while($ROWP = mysql_fetch_object($resultP)){
				echo '<option value="' . $ROWP->id . '">[' . $ROWP->id . '] ' . $ROWP->name . '</option>'."\n";
			}
			?>
			</select></div>
			<?PHP
			
  			// Run TinyMCE
  			if($sxSetup['WYSIWYG'] == 'tinymce')
			{
				echo '<textarea id="content" name="content" class="mceEditor" rows="25" cols="80" style="width: 80%">';
				
				if($Preview) 	echo stripslashes($content);
				else			echo stripslashes($sxEditROW->description);
				
				echo '</textarea>';
			}
			

			// Run FCKeditor
			if($sxSetup['WYSIWYG'] == 'fck')
			{
				$oFCKeditor = new FCKeditor('content') ;
				
				$oFCKeditor->Config['DefaultLanguage'] = $sxSetupFCKLanguage ;
				$oFCKeditor->BasePath = getURLFolder() . '/includes/fck/' ;
				$sxFCKServerPath = getURLFolder() . '/content/fck/';
				
				$sxFCKConnectorPath = $oFCKeditor->BasePath . 'editor/filemanager/browser/default/browser.html?Connector=../../connectors/php/connector.php?ServerPath=' . $sxFCKServerPath;
							
				$oFCKeditor->Config['LinkBrowserURL']  = $sxFCKConnectorPath;
				$oFCKeditor->Config['ImageBrowserURL'] = $sxFCKConnectorPath . '&Type=Image';
				$oFCKeditor->Config['FlashBrowserURL'] = $sxFCKConnectorPath . '&Type=Flash';
				
				$oFCKeditor->Width  = '500' ;
				$oFCKeditor->Height = '400' ;
				
				if($Preview) $oFCKeditor->Value = stripslashes($content);
				else		 $oFCKeditor->Value = stripslashes($sxEditROW->description);
				
				$oFCKeditor->Create() ;
			}
			
			if($sxSetup['WYSIWYG'] == 'htmlarea') {
			?>
			<textarea name="content" id="content" style="width:500px;height:400px;"><?PHP
			if($Preview) echo stripslashes($content);
			else		 echo stripslashes($sxEditROW->description);
			?></textarea>
			  <script language="javascript1.2">
				var config = new Object();    // create new config object
				
				config.width = "500px";
				config.height = "300px";
				config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
				config.debug = 0;
				
				// NOTE:  You can remove any of these blocks and use the default config!
				
				config.toolbar = [
					['fontname'],
					['fontsize'],
					['HorizontalRule','InsertTable','Createlink','InsertImage','htmlmode'],
					['linebreak'],
					['bold','italic','underline','separator'],
					['strikethrough','subscript','superscript','separator'],
					['justifyleft','justifycenter','justifyright','separator'],
					['OrderedList','UnOrderedList','Outdent','Indent','separator'],
					['forecolor','backcolor'],
				];
				
				editor_generate('content',config);
			  </script>
			  <?PHP } ?>
			</td>
	  </tr>
	  <tr> 
		  <td class="sxTdItem"><?PHP echo $sxLang['GeneralItemPrivate']; ?></td>
		  <td><input type="checkbox" name="private" value="1"<?PHP
			$query3 = "SELECT * FROM $DB_Events_Private WHERE eventid='$sxEditROW->id'";
			$result3 = mysql_query($query3, $Link) or queryError("809", mysql_error());
			if(mysql_num_rows($result3)) echo " checked";
			?> /> <?PHP echo $sxLang['GeneralMakePrivate']; ?><hr size="1" noshade="noshade" />
		  <?PHP
			$query2 = "SELECT * FROM $DB_Users_Types";
			$result2 = mysql_query($query2, $Link) or queryError("810", mysql_error());
			while($ROW2 = mysql_fetch_object($result2)){
			
				$sxChecked = "";
				$query3 = "SELECT * FROM $DB_Events_Private WHERE eventid='$sxEditROW->id'";
				$result3 = mysql_query($query3, $Link) or queryError("811", mysql_error());
				while($ROW3 = mysql_fetch_object($result3)){
					if($ROW3->typeid == $ROW2->id) $sxChecked = " checked";
				}
			
				echo '<input name="user_types[' . $ROW2->id . ']" type="checkbox" id="user_types" value="1"' . $sxChecked . ' />' . $ROW2->name . '<br />';
			}
			?></td>
	  </tr>
	  <tr>
		<td>&nbsp;</td>
		<td align="center"> 
		  <input type="hidden" name="eventid" value="<?PHP echo $eventid; ?>" />
		  <input style="width:120px;" type="submit" name="Preview" value="<?PHP echo $sxLang['EventButtonPreview']; ?>" class="sxButton" />
		  <input style="width:120px;" type="submit" name="Submit" value="<?PHP echo $sxLang['EventButtonEditEvent']; ?>" class="sxButton" />
		</td>
	  </tr>
	</table>
	</form>
  </div>
    <!-- background refresh -->
<iframe src ="../includes/session_keepalive.php?interval=<?PHP echo $sxThemeConfig['AdminKeepAlive']; ?>&bgcolor=<?PHP echo urlencode($sxThemeConfig['SiteBaseColor']); ?>" scrolling="no" height="1" marginheight="0" marginwidth="0" frameborder="0" align="right" width="1"></iframe>
<?PHP
include("../themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX