never init Smarty in genpage without re-adding $vars

This commit is contained in:
Ian 2015-08-14 11:45:59 +02:00
parent 9a2b1ab0b3
commit 0578f8da20
2 changed files with 11 additions and 3 deletions

View file

@ -1,7 +1,13 @@
2.22:
-----
* Fix missing Smarty template vars when initiating in genpage
2.21: 2.21:
----- -----
* fix backend form lang selected entry * Fix backend form lang selected entry
2.20, 1.12: 2.20, 1.12:

View file

@ -33,7 +33,7 @@ class serendipity_event_multilingual extends serendipity_event
'php' => '4.1.0' 'php' => '4.1.0'
)); ));
$propbag->add('groups', array('FRONTEND_ENTRY_RELATED', 'BACKEND_EDITOR')); $propbag->add('groups', array('FRONTEND_ENTRY_RELATED', 'BACKEND_EDITOR'));
$propbag->add('version', '2.21'); $propbag->add('version', '2.22');
$propbag->add('configuration', array('copytext', 'placement', 'tagged_title', 'tagged_entries', 'tagged_sidebar', 'langswitch')); $propbag->add('configuration', array('copytext', 'placement', 'tagged_title', 'tagged_entries', 'tagged_sidebar', 'langswitch'));
$propbag->add('event_hooks', array( $propbag->add('event_hooks', array(
'frontend_fetchentries' => true, 'frontend_fetchentries' => true,
@ -435,7 +435,8 @@ class serendipity_event_multilingual extends serendipity_event
case 'genpage': case 'genpage':
if (!is_object($serendipity['smarty'])) { if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init(); // never init in genpage without adding previously set $vars, which is $view etc!
serendipity_smarty_init($serendipity['plugindata']['smartyvars']);
} }
if (!defined('Smarty::SMARTY_VERSION')) { if (!defined('Smarty::SMARTY_VERSION')) {
$this->tag_title(); // in Smarty 2 only $this->tag_title(); // in Smarty 2 only
@ -609,6 +610,7 @@ class serendipity_event_multilingual extends serendipity_event
unset($use_lang[$serendipity['lang']]); // Unset 'default' language. Easier handling. unset($use_lang[$serendipity['lang']]); // Unset 'default' language. Easier handling.
$langs = ''; $langs = '';
//asort($use_lang); //sorts by value ASC, but if so we should do it everywhere though
foreach($use_lang AS $code => $desc) { foreach($use_lang AS $code => $desc) {
$langs .= '<option value="' . $code . '" ' . ($lang_selected == $code ? 'selected="selected"' : '') . '>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($desc) : htmlspecialchars($desc, ENT_COMPAT, LANG_CHARSET)) . '</option>' . "\n"; $langs .= '<option value="' . $code . '" ' . ($lang_selected == $code ? 'selected="selected"' : '') . '>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($desc) : htmlspecialchars($desc, ENT_COMPAT, LANG_CHARSET)) . '</option>' . "\n";
} }