KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/owens.enteract/inc/libs/photocropper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/owens.enteract/inc/libs/photocropper/image_uploader.php
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set("display_errors", 1);
ini_set('memory_limit','128M');
set_time_limit(0); //No script timeout 

include_once('../../utils.php');
include_once('../../libs/files/FileHandler.php');

header("connection: close"); //Meant to help with Safari file uploads

$errorMsg = "";

$uploadFieldname = "img";
$posted = intval(ValidationUtils::getRequestVar("both","posted","0"));
$dim = ValidationUtils::getRequestVar("both","dim","");
$fitBoxSize = intval(ValidationUtils::getRequestVar("both","fitBoxSize","2000"));
$filename = $_FILES[$uploadFieldname]['name'];

$fileUploadSuccess = false;
$dimArray = explode("x", $dim);
$minWidth = intval($dimArray[0]);
$minHeight = intval($dimArray[1]);

$msg = "Minimum image size is ".$minWidth . "x" . $minHeight .".";

//Process the files
if ($filename != ""){
	
	$imgHandler = new FileHandler();
	$imgHandler->uploadTempFolder = "../../../" . CACHE_PATH;
	$imgHandler->uploadFolder = "../../../" . CACHE_PATH;
	
	//Upload the image
	if ($imgHandler->uploadImage($uploadFieldname)){		
		$temp_filename = $imgHandler->filename;
		$filename = "tmp_" . $temp_filename;
		//Check to make sure there was something uploaded
		if ($temp_filename != ""){
			$fullImgPath = $imgHandler->uploadFolder . $filename;
			//Attempt to fit the image
			if ($imgHandler->proportionalImageFit($imgHandler->uploadTempFolder . $temp_filename,$fullImgPath,$fitBoxSize,$fitBoxSize)){
				//Get width/height
				list($width, $height) = getimagesize($fullImgPath);
				
				if ($width < $minWidth || $height < $minHeight){
					//Minimum overall size (largest box thumb)
					$errorMsg = "Minimum image size is " . $minWidth . "x" . $minHeight . ". Your image is " . $width . "x" . $height . ".";					
				}else{	
					//Give user a nice message
					$msg = "Image uploaded successfully! ". $filename ." (".$width."x".$height.")";
					$fileUploadSuccess = true;
				}	
			}else{
				$errorMsg = $imgHandler->errorMessage();
			}
		}		
	}else{
		$errorMsg = $imgHandler->errorMessage();
	}
	$imgHandler->cleanup(); //Kills the temp file
}

//Check for unknown error (including file post max hit)
if ($posted == 1 && $fileUploadSuccess == false && $errorMsg == ""){
	$errorMsg = "Unknown file processing error. Maximum file size for image is 8MB.";
}

?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>         <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>         <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if IE 9]>         <html class="ie9" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--> <html class=" " lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<script>
		function closeParentModal(){
			parent.$.fn.colorbox.close();
		}
	</script>
<?php
	echo "<script>";
	if ($fileUploadSuccess){
		//Pass success to parent window
		echo "parent.updateImageCropTool(\"" . DYNAMIC_ASSETS_URL . "_tmp/" . $filename."\",".$width .",".$height.");";
		echo "closeParentModal();";
	}
	echo "</script>";	
?>
	<link rel="stylesheet" href="css/styles.css?v=<?=time()?>">
</head>
<body id='uploader'>
	<h1>UPLOAD PHOTO</h1>
<?php
if ($errorMsg != ""){
	echo "<div class='error'><strong>ERROR:</strong> ".$errorMsg."</div>";
}else if ($msg != ""){
	echo "<div class='notice'>".$msg."</div>";
}
?>
	<form id='form1' name='form1' method='POST' action='image_uploader.php' enctype='multipart/form-data'>
		<input type='hidden' name='dim' value='<?=$dim?>'>
		<input type='hidden' name='fitBoxSize' value='<?=$fitBoxSize?>'>
		<input type='hidden' name='posted' value='1'>
		<div class='upload-holder'><input type='file' id="img" name='img' /></div>
		<div id='upload-btns-holder'>
			<div id="upload-btns-wrap">
				<button class="btn-green" id="btn-upload">Upload</button>
				<button class="btn" onclick="closeParentModal(); return false;">Cancel</button>
			</div>
			<div id="activity-indicator" class="hidden">
				<img src='assets/img/ajax-loader.gif'>
			</div>
		</div>
	</form>	
	<script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
	<script type='text/javascript' src="js/script.js?v=<?=time()?>"></script>
</body>
</html>	

Anon7 - 2021