} else { echo ui_print_error_message(__('Problem updating file'), '', true, 'h3', true); } } else { echo ui_print_error_message(__('Problem updating file ff'), '', true, 'h3', true); } fclose($fileh); } //create template if ($create) { $insert_values["name"] = get_parameter('template_name', ''); $insert_values["id_group"] = get_parameter('template_group', 0); $insert_values['template_action'] = get_parameter('template_action', ''); $template_name = $insert_values["name"]; $template_group = $insert_values["id_group"]; $data = unsafe_string(str_replace("\r\n", "\n", get_parameter("template_content", ""))); $file = "include/mailtemplates/" . $template_name . ".tpl"; $fileh = fopen($file, "w"); if (fwrite($fileh, $data)) { $template_id = process_sql_insert("temail_template", $insert_values); if ($template_id != false) { echo ui_print_success_message(__('File successfully created'), '', true, 'h3', true); } else { echo ui_print_error_message(__('Problem creating file'), '', true, 'h3', true); } } else { echo ui_print_error_message(__('Problem creating file ff'), '', true, 'h3', true); } fclose($fileh); chmod($file, 0777); }
$retval[$file] = $file; } return $retval; } $update = get_parameter("upd_button", "none"); $refresh = get_parameter("edit_button", "none"); $template = get_parameter("template", ""); $data = ""; // Load template from disk to textarea if ($refresh != "none") { $full_filename = "include/mailtemplates/" . get_parameter("template"); $data = safe_input(file_get_contents($full_filename)); } // Update configuration if ($update != "none") { $data = unsafe_string(str_replace("\r\n", "\n", $_POST["template_content"])); $file = "include/mailtemplates/" . $template; $fileh = fopen($file, "wb"); if (fwrite($fileh, $data)) { echo "<h3 class='suc'>" . lang_string(__('File successfully updated')) . "</h3>"; } else { echo "<h3 class='error'>" . lang_string(__('Problem updating file')) . " ({$file}) </h3>"; } fclose($file); } $table->width = '99%'; $table->class = 'search-table-button'; $table->colspan = array(); $table->colspan[2][0] = 2; $table->data = array(); $templatelist = get_template_files();