Skip to content

Commit

Permalink
Dev: fixed some issues with the new template naming
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Nov 28, 2017
1 parent e31d054 commit 056359a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion application/models/Template.php
Expand Up @@ -404,7 +404,7 @@ public static function getInstance($sTemplateName = null, $iSurveyId = null, $iS
public static function getStandardTemplateList()
{

$standardTemplates = array( Yii::app()->getConfig('defaulttheme'), 'vanilla', 'material', 'no_bootstrap', 'monochrome');
$standardTemplates = array( Yii::app()->getConfig('defaulttheme'), 'vanilla', 'material', 'no_bootstrap', 'bootswatch');
return $standardTemplates;

/*
Expand Down
12 changes: 8 additions & 4 deletions application/models/TemplateManifest.php
Expand Up @@ -528,11 +528,15 @@ public static function extendsConfig($sToExtends, $sNewName)
private function readManifest()
{
$this->xmlFile = $this->path.'config.xml';
$bOldEntityLoaderState = libxml_disable_entity_loader(true); // @see: http://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html#xml-external-entity-injection
$sXMLConfigFile = file_get_contents(realpath($this->xmlFile)); // @see: Now that entity loader is disabled, we can't use simplexml_load_file; so we must read the file with file_get_contents and convert it as a string
$this->config = simplexml_load_string($sXMLConfigFile); // Using PHP >= 5.4 then no need to decode encode + need attributes : then other function if needed :https://secure.php.net/manual/en/book.simplexml.php#108688 for example

libxml_disable_entity_loader($bOldEntityLoaderState); // Put back entity loader to its original state, to avoid contagion to other applications on the server
if (file_exists(realpath($this->xmlFile))){
$bOldEntityLoaderState = libxml_disable_entity_loader(true); // @see: http://phpsecurity.readthedocs.io/en/latest/Injection-Attacks.html#xml-external-entity-injection
$sXMLConfigFile = file_get_contents(realpath($this->xmlFile)); // @see: Now that entity loader is disabled, we can't use simplexml_load_file; so we must read the file with file_get_contents and convert it as a string
$this->config = simplexml_load_string($sXMLConfigFile); // Using PHP >= 5.4 then no need to decode encode + need attributes : then other function if needed :https://secure.php.net/manual/en/book.simplexml.php#108688 for example
libxml_disable_entity_loader($bOldEntityLoaderState); // Put back entity loader to its original state, to avoid contagion to other applications on the server
}else{
throw new Exception(" Error: Can't find a manifest for $this->sTemplateName in ' $this->path ' ");
}
}

/**
Expand Down

0 comments on commit 056359a

Please sign in to comment.