Skip to content

Commit

Permalink
Fixed issue #11135: Renaming default user template can broke
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed May 11, 2016
1 parent 66a88cb commit 057e7e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions application/models/TemplateConfiguration.php
Expand Up @@ -86,6 +86,18 @@ public function setTemplateConfiguration($sTemplateName='', $iSurveyId='')
}


// If the template directory doesn't exist, it can be that:
// - user deleted a custom theme
// In any case, we just set Default as the template to use
if (!is_dir($this->path))
{
$this->sTemplateName = 'default';
$this->isStandard = true;
$this->path = Yii::app()->getConfig("standardtemplaterootdir").DIRECTORY_SEPARATOR.$this->sTemplateName;
setGlobalSetting('defaulttemplate', 'Sea_Green');

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle May 11, 2016

Collaborator

? Sea_Green : admin or user ?

This comment has been minimized.

Copy link
@LouisGac

LouisGac May 11, 2016

Contributor

woo...

}


// If the template don't have a config file (maybe it has been deleted, or whatever),
// then, we load the default template
$this->hasConfigFile = is_file($this->path.DIRECTORY_SEPARATOR.'config.xml');
Expand Down

3 comments on commit 057e7e5

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why not, directly :
$sTemplateName=Template::templateNameFilter($sTemplateName)

If template don't exist : better to use the default set from user. No ?

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, that was to fix the bug of deletion of default user template ;-)

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, right.
But setTemplateConfiguration can be used in another patch by another dev , no ?

Please sign in to comment.