示例#1
0
 private function ChangeTemplate()
 {
     GetLib('class.file');
     $settings = GetClass('ISC_ADMIN_SETTINGS');
     $GLOBALS['ISC_NEW_CFG']['template'] = AlphaNumOnly($_REQUEST['template']);
     $StylePath = ISC_BASE_PATH . "/templates/" . AlphaNumOnly($_REQUEST['template']) . '/Styles';
     $color = isc_strtolower(AlphaNumOnly($_REQUEST['color']));
     if (file_exists($StylePath . "/" . $color . ".css")) {
         $GLOBALS['ISC_NEW_CFG']['SiteColor'] = $color;
     }
     if (file_exists(ISC_BASE_PATH . '/templates/' . AlphaNumOnly($_REQUEST['template']) . '/config.php')) {
         include ISC_BASE_PATH . '/templates/' . AlphaNumOnly($_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();
         }
     }
     if (isset($_REQUEST['page'])) {
         $pageNumber = (int) $_REQUEST['page'];
     } else {
         $pageNumber = 1;
     }
     // 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&page=' . $pageNumber);
 }
示例#2
0
<?php

require_once dirname(__FILE__) . '/init.php';
$TemplateName = AlphaNumOnly($_GET['tpl']);
$TemplateColor = AlphaNumExtendedOnly($_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';
// 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");
    }
    echo file_get_contents($CacheTemplateImageFile);
    die;
} elseif (file_exists($TemplateImageFile)) {
    if (!is_dir(ISC_BASE_PATH . '/cache/tplthumbs/')) {
        mkdir(ISC_BASE_PATH . '/cache/tplthumbs/');
        isc_chmod(ISC_BASE_PATH . '/cache/tplthumbs/', ISC_WRITEABLE_DIR_PERM);
    }
    if ((strtolower(substr($TemplateImageFile, -4)) == ".jpg" || strtolower(substr($TemplateImageFile, -5)) == ".jpeg") && function_exists('imagejpeg')) {
        // jpeg image
        header("Content-type: image/jpeg");
    } elseif (strtolower(substr($TemplateImageFile, -4)) == ".gif" && function_exists('imagegif')) {
        // gif image