$T->set_var('temp_lang_return_to_editor', THM_str('return_to_editor')); $T->set_var('site_admin_url', $_CONF['site_admin_url']); $T->set_var('temp_lang_dest', THM_str('dest')); $T->set_var('temp_lang_script_disabled', THM_str('script_disabled')); $T->set_var('thm_theme', $theme); $T->set_var('thm_dir', $selected_dir); // Sets theme names $theme_names = THM_getAllowedThemes(); $themes4html = ''; foreach ($theme_names as $theme_name) { if ($theme_name == $theme) { $themes4html .= "<option value='{$theme_name}' selected='selected'>"; } else { $themes4html .= "<option value='{$theme_name}'>"; } $themes4html .= THM_esc($theme_name) . '</option>' . LB; } $T->set_var('temp_themes', $themes4html); $T->set_var('temp_lang_dir', THM_str('dir')); $allowed_dirs = array('images/', 'images/admin/', 'images/buttons/', 'images/icons/', 'images/custom/'); $temp_dirs = ''; foreach ($allowed_dirs as $allowed_dir) { if ($allowed_dir == $selected_dir) { $temp_dirs .= '<option selected="selected">'; } else { $temp_dirs .= '<option>'; } $temp_dirs .= $allowed_dir . '</option>' . LB; } $T->set_var('temp_dirs', $temp_dirs); $T->set_var('temp_lang_file', THM_str('file'));
if (isset($LANG_THM[$allowed_file])) { $text = THM_str($allowed_file); } else { $text = $allowed_file; } $files4html .= THM_esc($text) . '</option>' . LB; } $T->set_var('temp_files', $files4html); // Loads template vars & file contents if (!empty($file)) { $vars = THM_getTemplateVars($theme, $file); } if ($op === 'load') { $contents = THM_getContents($theme, $file); } $contents4html = THM_esc($contents); // In case of a template file, show a list of template vars available $vars4html = ''; if (count($vars) > 0) { $vars4html .= '<table style="border: solid 1px #7F9DB9; padding: 5px; width: 100%">' . '<caption style="text-align: center; color: white; background-color: #7F9DB9;">' . THM_str('vars_available') . '</caption>' . '<tr>' . LB; for ($i = 0, $j = 0; $i < count($vars); $i++) { $vars4html .= '<td width="150"><button type="button" title="' . THM_str("help_{$vars[$i]}") . '" onClick="insert_var(\'' . $vars[$i] . '\')"' . ' style="color: white; background-color: #333366;">' . $vars[$i] . '</button></td>'; $j++; if ($j % 4 === 0) { $vars4html .= '</tr>' . LB . '<tr>'; } } $vars4html .= '</tr>' . LB . '</table>' . LB; } $T->set_var('temp_vars', $vars4html); $T->set_var('temp_contents', $contents4html);