<?php if (session_id() == '') { session_start(); } ob_start(); require_once dirname(__FILE__) . '/_autoload.php'; $user_id = isset($_SESSION['adminId']) && intval($_SESSION['adminId']) > 0 ? intval($_SESSION['adminId']) : 0; if ($user_id < 1) { header('Location: login.php'); exit; } $subMenus = Tracetec_Debt_Manager::getSubMenus(); include "include/head.php"; $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0; $template = Model_Message_Template::find_by_id($id); $error = ''; $success = ''; if (is_null($template)) { $error = 'Cannot find the selected template.'; $template = new Model_Message_Template(array('id' => 0)); } elseif (isset($_POST['submit'])) { $template->template = trim($_POST['template']); if (trim($template->template) == '') { $error = 'Please provide some text for the contect of this template.'; } elseif ($template->save()) { $success = 'Successfully updated your template.'; } else { $error = 'There was an error in updating this template.'; } }