if (!Template::IsValidPath($Path.DIR_SEP.$Name)) { camp_html_goto_page("/$ADMIN/templates/"); } $cField = Input::Get('cField', 'string', ''); $nField = str_replace("\\r", "\r", $cField); $nField = str_replace("\\n", "\n", $nField); $filename = Template::GetFullPath($Path, $Name); $Lifetime = Input::Get('Lifetime', 'integer', 0); $templateName = (!empty($Path) ? $Path."/" : "").$Name; if ($templateName[0] == '/') { $templateName = substr($templateName, 1); } $template = new Template($templateName); $template->setCacheLifetime($Lifetime); $result = false; if (file_exists($filename)) { if (is_writable($filename)) { if (@$handle = fopen($filename, 'w')) { $result = fwrite($handle, $nField); fclose($handle); } } else { camp_html_add_msg(camp_get_error_message(CAMP_ERROR_WRITE_FILE, $filename)); camp_html_goto_page("/$ADMIN/templates/edit_template.php?" ."f_path=".urlencode($Path) ."&f_name=".urlencode($Name) ."&f_content=".urlencode($cField)); }