HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/admin/thumb.php
<?php

error_reporting(0);

include(dirname(dirname(__FILE__)) . '/lib/common.paths.php');

include(AL_BASE_PATH . '/lib/general.php');


$TemplateName = AlphaNumExtendedOnly($_GET['tpl']);
$TemplateColor = AlphaNumExtendedOnly($_GET['color']); // (colors have an underscore)
$TemplateImageFile = AL_BASE_PATH . '/templates/'.$TemplateName . '/Previews/'.$TemplateColor;
$CacheTemplateImageFile = AL_BASE_PATH . '/tmp/tplthumbs/'.$TemplateName.'_'.$TemplateColor;
$maxwidth = '200';
$maxheight = '200';

// check cache first
if(file_exists($CacheTemplateImageFile)){

	if((iwp_strtolower(substr($TemplateImageFile,-4)) == ".jpg" || iwp_strtolower(substr($TemplateImageFile,-5)) == ".jpeg")){
		// jpeg image
		header("Content-type: image/jpeg");
	}elseif(iwp_strtolower(substr($TemplateImageFile,-4)) == ".gif" ){
		// gif image
		header("Content-type: image/gif");
	}

	echo file_get_contents($CacheTemplateImageFile);
	die();
}elseif(file_exists($TemplateImageFile)) {

	if(!is_dir(AL_BASE_PATH . '/tmp/tplthumbs/')){
		@mkdir(AL_BASE_PATH . '/tmp/tplthumbs/', 0777);
		@chmod(AL_BASE_PATH . '/tmp/tplthumbs/', 0777);
	}
	if((iwp_strtolower(substr($TemplateImageFile,-4)) == ".jpg" || iwp_strtolower(substr($TemplateImageFile,-5)) == ".jpeg") && function_exists('imagejpeg') ){
		// jpeg image
		header("Content-type: image/jpeg");


	}elseif(iwp_strtolower(substr($TemplateImageFile,-4)) == ".gif" && function_exists('imagegif') ){
		// gif image
		header("Content-type: image/gif");

	}
	$image = ResizeGDImages($TemplateImageFile,$CacheTemplateImageFile,$maxheight,$maxwidth);

	if(!file_exists($CacheTemplateImageFile)){
		echo $image;
	}else{
		echo file_get_contents($CacheTemplateImageFile);
		@chmod($CacheTemplateImageFile, 0777);
	}
	die();

}else {
	OutputNoImage();
}


/**
 * This function outputs a 'no preview available' image.
 *
 * @return void Doesn't return anything, outputs an image
 */
function OutputNoImage(){
	header("Content-type: image/gif");
	echo file_get_contents(AL_ADMIN_PATH.'/images/nopreview200.gif');
	die();
}