<?php
//Custom MOStlyCE code
require('../../../../../../configuration.php');
require($mosConfig_absolute_path.'mambots/editors/mostlyce/jscripts/tiny_mce/auth_check.php');
$result = externalCallCheck($mosConfig_absolute_path, $mosConfig_secret);
if (!$result) {
	die('Direct Access to this location is not allowed.');
}
require($mosConfig_absolute_path.'/mambots/editors/mostlyce/jscripts/tiny_mce/mostlyce_config.php');
//If the Image Manager is not enabled stop them here
if ($editor_plugin_img_mgr!=='true') {
	die('Direct Access to this location is not allowed.');
}
//End custom MOStlyCE code
?>
<?php

/**
 * The frame that contains the image to be edited.
 * @author $Author$
 * @version $Id$
 * @package ImageManager
 */

require_once('config.inc.php');
require_once('Classes/ImageManager.php');
require_once('Classes/ImageEditor.php');

$manager = new ImageManager($IMConfig);
$editor = new ImageEditor($manager);
$imageInfo = $editor->processImage();

?>

<html>
<head>
	<title></title>
<link href="assets/editorFrame.css" rel="stylesheet" type="text/css" />	
<script type="text/javascript" src="assets/wz_jsgraphics.js"></script>
<script type="text/javascript" src="assets/EditorContent.js"></script>
<script type="text/javascript">
//if(window.top)
//	I18N = window.top.I18N;

function i18n(str) {
//	if(I18N)
//		return (I18N[str] || str);
//	else
		return str;
};
	
	var mode = "<?php echo $editor->getAction(); ?>" //crop, scale, measure

var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>";

<?php if ($editor->isFileSaved() == 1) { ?>
	alert('File saved.');
<?php } else if ($editor->isFileSaved() == -1) { ?>
	alert('File was not saved.');
<?php } ?>

</script>
<script type="text/javascript" src="assets/editorFrame.js"></script>
</head>

<body>
<div id="status"></div>
<div id="ant" class="selection" style="visibility:hidden"><img src="img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div>
<table height="100%" width="100%">
	<tr>
		<td>
<?php if(count($imageInfo) > 0 && is_file($imageInfo['fullpath'])) { ?>
	<span id="imgCanvas" class="crop"><img src="<?php echo $imageInfo['src']; ?>" <?php echo $imageInfo['dimensions']; ?> alt="" id="theImage" name="theImage"></span>
<?php } else { ?>
	<span class="error">No Image Available(<?php echo $imageInfo['fullpath']; ?></span>
<?php } ?>
		</td>
	</tr>
</table>
</body>
</html>
