Merge pull request #8767 from MrPetovan/bug/8746-smarty-vars-leak

Clear all previous template variables before replacing Macros
This commit is contained in:
Michael Vogel 2020-06-13 08:19:16 +02:00 committed by GitHub
commit e3f8a653a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 35 deletions

View file

@ -83,6 +83,8 @@ final class FriendicaSmartyEngine extends TemplateEngine
Hook::callAll('template_vars', $arr); Hook::callAll('template_vars', $arr);
$vars = $arr['vars']; $vars = $arr['vars'];
$this->smarty->clearAllAssign();
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if ($key[0] === '$') { if ($key[0] === '$') {
$key = substr($key, 1); $key = substr($key, 1);

View file

@ -6,7 +6,10 @@
<?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?> <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head> </head>
<body class="minimal"> <body class="minimal">
<section><?php if(!empty($page['content'])) echo $page['content']; ?> <section>
<div class="generic-page-wrapper">
<?php if(!empty($page['content'])) echo $page['content']; ?>
</div>
<div id="page-footer"></div> <div id="page-footer"></div>
</section> </section>
<!-- Modal --> <!-- Modal -->

View file

@ -1,45 +1,43 @@
<div class="generic-page-wrapper"> <h1>{{$header}}</h1>
<h1>{{$header}}</h1>
{{if !$myaddr}} {{if !$myaddr}}
<p id="dfrn-request-intro"> <p id="dfrn-request-intro">
{{$page_desc nofilter}} {{$page_desc nofilter}}
</p> </p>
<p> <p>
{{$invite_desc nofilter}} {{$invite_desc nofilter}}
</p> </p>
{{/if}} {{/if}}
<form action="{{$request}}" method="post"> <form action="{{$request}}" method="post">
{{if $url}} {{if $url}}
<dl> <dl>
<dt>{{$url_label}}</dt> <dt>{{$url_label}}</dt>
<dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd> <dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd>
</dl> </dl>
{{/if}} {{/if}}
{{if $keywords}} {{if $keywords}}
<dl> <dl>
<dt>{{$keywords_label}}</dt> <dt>{{$keywords_label}}</dt>
<dd>{{$keywords}}</dd> <dd>{{$keywords}}</dd>
</dl> </dl>
{{/if}} {{/if}}
<div id="dfrn-request-url-wrapper"> <div id="dfrn-request-url-wrapper">
<label id="dfrn-url-label" for="dfrn-url">{{$your_address}}</label> <label id="dfrn-url-label" for="dfrn-url">{{$your_address}}</label>
{{if $myaddr}} {{if $myaddr}}
{{$myaddr}} {{$myaddr}}
<input type="hidden" name="dfrn_url" id="dfrn-url" value="{{$myaddr}}" /> <input type="hidden" name="dfrn_url" id="dfrn-url" value="{{$myaddr}}" />
{{else}} {{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}"> <input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}">
{{/if}} {{/if}}
<input type="hidden" name="url" id="url" value="{{$url}}"> <input type="hidden" name="url" id="url" value="{{$url}}">
<div id="dfrn-request-url-end"></div> <div id="dfrn-request-url-end"></div>
</div> </div>
<div id="dfrn-request-submit-wrapper"> <div id="dfrn-request-submit-wrapper">
{{if $submit}} {{if $submit}}
<input class="btn btn-primary" type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}"> <input class="btn btn-primary" type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}">
{{/if}} {{/if}}
<input class="btn btn-default" type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}"> <input class="btn btn-default" type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}">
</div> </div>
</form> </form>
</div>