<?
define('ADMIN',true);
define('AJAX',true);
define('ROOT','../../..');
header('Content-Type: text/html; charset=utf-8');
require_once(ROOT.'/.config.php');
require_once(LIBS_PATH.'/system/sys_start.php');
require_once(LIBS_PATH.'/system/load_libs.php');
///////////////////////////
$X->STR->post_filter();


if($_GET['jcrop_in_temp']==1) {
	$base='/cache/uploadify/'.session_id().'/'.$_GET['jcrop_temp_form'].'/';
	@mkdir(ROOT_PATH.$base,0755,true);
	file_put_contents(ROOT_PATH.$base.'.htaccess', 'Allow From All');
	$real_src = $base.$_GET['jcrop_field_name'].'/'.$_GET['src'].'_tmp';
} else {
	$_GET['src']=str_replace('/userfiles','',$_GET['src']);
	$real_src = '/userfiles'.$_GET['src'];
}


echo '
	<div id="image_editor_bar">
		<div class="back">'.$X->FORM->powrot_OC('Zamknij', 'imageEditorClose()').'</div>

		<div class="image_crop">
			<form method="get" onsubmit="processImageCrop(this); return false;">
				<input name="jcrop_w" id="jcrop_w" class="input disabled" type="text" disabled="disabled" readonly="readonly" style="width:40px; text-align:center;" value="" />
				&nbsp;x&nbsp;
				<input name="jcrop_h" id="jcrop_h" class="input disabled" type="text" disabled="disabled" readonly="readonly" style="width:40px; text-align:center;" value="" />

				&nbsp;&nbsp;'.$X->FORM->submit_link('<span class="ico w_yes"></span><span>Przytnij</span>',false,'button button_gfx submit').'
				'.$X->FORM->hidden('jcrop_x',0).'
				'.$X->FORM->hidden('jcrop_y',0).'
				'.$X->FORM->hidden('jcrop_x2',0).'
				'.$X->FORM->hidden('jcrop_y2',0).'
			</form>
		</div>

		<div class="image_resize">
			<form method="get" onsubmit="processImageResize(this); return false;">
				<input name="resize_w" id="resize_w" class="input" type="text" style="width:40px; text-align:center;" value="" autocomplete="off" maxlength="4" onkeyup="calcImgResize(\'w\',this);" />
				&nbsp;x&nbsp;
				<input name="resize_h" id="resize_h" class="input" type="text" style="width:40px; text-align:center;" value="" autocomplete="off" maxlength="4" onkeyup="calcImgResize(\'h\',this);" />

				&nbsp;&nbsp;'.$X->FORM->submit_link('<span class="ico w_yes"></span><span>Zmien rozmiar</span>',false,'button button_gfx submit').'
				'.$X->FORM->hidden('resize_w_base',0).'
				'.$X->FORM->hidden('resize_h_base',0).'
			</form>
		</div>

		<div id="image_save_as" class="save" style="display:none;">
			<form method="get" onsubmit="image_save(this); return false;">
				'.$X->FORM->submit_link('<span class="ico w_yes"></span><span>Zapisz</span>',false,'button button_gfx submit').'
			</form>
		</div>
	</div>

	<div id="image_editor_loading"></div>
	<div id="image_editor_area">
		<img src="'.$real_src.'?'.microtime(true).'" alt="" />
	</div>
';
?>