Skip to content

Commit

Permalink
Dev : Fixed issue #10266: After update to 2.5 with updated default te…
Browse files Browse the repository at this point in the history
…mplate : PHP Waring

Dev: validate template in getTemplateConfiguration
Dev: don't test validity of standard template :not needed
Dev: revert to standard/default if not 2.5 compatible
  • Loading branch information
Shnoulle committed Feb 2, 2016
1 parent 530abc1 commit 5eabd85
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions application/models/Template.php
Expand Up @@ -144,17 +144,24 @@ public static function getTemplateConfiguration($sTemplateName='', $iSurveyId=''

$oTemplate = new stdClass();
$oTemplate->isStandard = self::isStandardTemplate($sTemplateName);

// If the template doesn't exist, set to Default
if($oTemplate->isStandard)
{
$oTemplate->name = (is_dir(Yii::app()->getConfig("standardtemplaterootdir").DIRECTORY_SEPARATOR.$sTemplateName))?$sTemplateName:'Default';
$oTemplate->name = $sTemplateName;
$oTemplate->path = Yii::app()->getConfig("standardtemplaterootdir").DIRECTORY_SEPARATOR.$oTemplate->name;
}
else
{
$oTemplate->name = (is_dir(Yii::app()->getConfig("usertemplaterootdir").DIRECTORY_SEPARATOR.$sTemplateName))?$sTemplateName:'Default';
$oTemplate->path = Yii::app()->getConfig("usertemplaterootdir").DIRECTORY_SEPARATOR.$oTemplate->name;
if(is_file(Yii::app()->getConfig("usertemplaterootdir").DIRECTORY_SEPARATOR.$sTemplateName).DIRECTORY_SEPARATOR.'config.xml')
{
$oTemplate->name = $sTemplateName;
$oTemplate->path = Yii::app()->getConfig("usertemplaterootdir").DIRECTORY_SEPARATOR.$oTemplate->name;
}
else
{
$oTemplate->name = 'default';
$oTemplate->path = Yii::app()->getConfig("standardtemplaterootdir").DIRECTORY_SEPARATOR.$oTemplate->name;
}
}

// The template configuration.
Expand Down

0 comments on commit 5eabd85

Please sign in to comment.