Ejemplo n.º 1
0
	private function ChangeTemplate()
	{
		GetLib('class.file');

		$settings = GetClass('ISC_ADMIN_SETTINGS');
		$GLOBALS['ISC_NEW_CFG']['template'] = Interspire_String::filterAlphaNumOnly($_REQUEST['template']);

		$StylePath = ISC_BASE_PATH . "/templates/" .Interspire_String::filterAlphaNumOnly($_REQUEST['template']) .'/Styles';
		$color = isc_strtolower(Interspire_String::filterAlphaNumOnly($_REQUEST['color']));
		if(file_exists($StylePath."/".$color.".css")) {
			$GLOBALS['ISC_NEW_CFG']['SiteColor'] = $color;
		}

		if(file_exists(ISC_BASE_PATH . '/templates/'. Interspire_String::filterAlphaNumOnly($_REQUEST['template'])  . '/config.php')) {
			include(ISC_BASE_PATH . '/templates/'.Interspire_String::filterAlphaNumOnly($_REQUEST['template'])  . '/config.php');
		}

		if($color != '') {
			$GLOBALS['ISC_NEW_CFG']['SiteColor'] = $color;
		}

		$settings->CommitSettings();

		// If we're currently using a logo template, then we need to rebuild it
		if(GetConfig('UsingTemplateLogo') && GetConfig('UsingLogoEditor')) {
			if(!$this->BuildLogo('[template]', GetConfig('LogoFields'))) {
				$GLOBALS['ISC_NEW_CFG'] = array(
					'UsingTemplateLogo' => 0,
					'UsingLogoEditor' => 0,
					'LogoType' => 'text'
				);
				$settings->CommitSettings();
			}
		}

		// Log this action
		$GLOBALS['ISC_CLASS_LOG']->LogAdminAction(GetConfig('template'), GetConfig('SiteColor'));

		FlashMessage(sprintf(GetLang('TemplateSelected'), ucfirst($_REQUEST['template'])), MSG_SUCCESS, 'index.php?ToDo=viewTemplates');
	}
Ejemplo n.º 2
0
<?php

require_once(dirname(__FILE__).'/init.php');

$TemplateName = Interspire_String::filterAlphaNumOnly($_GET['tpl']);
$TemplateColor = Interspire_String::filterAlphaNumExtendedOnly($_GET['color']); // (colors have an underscore)
$TemplateImageFile = ISC_BASE_PATH . '/templates/'.$TemplateName . '/Previews/'.$TemplateColor;

$CacheTemplateImageFile = ISC_BASE_PATH . '/cache/tplthumbs/'.$TemplateName.'_'.$TemplateColor;
$maxwidth = '200';
$maxheight = '200';

$expires = 86400; //60 * 60 * 24;

header("", true, 200);
header("Pragma: public");
header("Cache-control: public,maxage=" . $expires);
header("Expires: " . gmdate("r", time() + $expires));

// check cache first
if(file_exists($CacheTemplateImageFile)) {
	if((strtolower(substr($TemplateImageFile,-4)) == ".jpg" || strtolower(substr($TemplateImageFile,-5)) == ".jpeg")) {
		// jpeg image
		header("Content-type: image/jpeg");
	}elseif(strtolower(substr($TemplateImageFile,-4)) == ".gif" ) {
		// gif image
		header("Content-type: image/gif");
	}

	header("Last-Modified: " . gmdate("r", filemtime($CacheTemplateImageFile)));
	echo file_get_contents($CacheTemplateImageFile);