Skip to content

Commit

Permalink
Fixed issue #11054: Template editor crashing. When an admin copies a …
Browse files Browse the repository at this point in the history
…template and deletes logo.png the template editor is crashing and the template cannot be opened anymore.
  • Loading branch information
LouisGac committed Apr 27, 2016
1 parent 8462f95 commit 08bbbc7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion application/helpers/replacements_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,16 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
$_endtext = $thissurvey['surveyls_endtext'];
}

$sitelogo = (!empty($oTemplate->siteLogo))?'<img class="img-responsive" src="'.App()->getAssetManager()->publish( $oTemplate->path.'/'.$oTemplate->siteLogo).'"/>':'';
//$sitelogo = (!empty($oTemplate->siteLogo))?'<img class="img-responsive" src="'.App()->getAssetManager()->publish( $oTemplate->path.'/'.$oTemplate->siteLogo).'"/>':'';
$sitelogo = '';

if(!empty($oTemplate->siteLogo))
{
if (file_exists ($oTemplate->path.'/'.$oTemplate->siteLogo ))
{
$sitelogo= '<img class="img-responsive" src="'.App()->getAssetManager()->publish( $oTemplate->path.'/'.$oTemplate->siteLogo).'"/>';
}
}

// Set the array of replacement variables here - don't include curly braces
$coreReplacements = array();
Expand Down

4 comments on commit 08bbbc7

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question : did it not Template::model roles to control file existence etc ?

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

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

yep you're right

@Shnoulle
Copy link
Collaborator

@Shnoulle Shnoulle commented on 08bbbc7 Apr 28, 2016

Choose a reason for hiding this comment

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

OK, just to be sure :)

But here : right : config.xml and files existence contradiction ....

@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, the xml config file is supposed to become basic settings to fill a table in the database, and then provide user controls to it.

So the filed "files" should give the possibility to replace those files directly from the template configuration page. So, in the configuration page of the template, we'll have something like : "logo: ", and an input to change it.

I'm not reinventing the wheel, everything is inspired by the joomla templating system.

Please sign in to comment.