/** * Deletes a template * @return */ function DeleteTemplate() { // Check the token if (!Kit::CheckToken()) { trigger_error('Token does not match', E_USER_ERROR); } $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $templateId = Kit::GetParam('templateid', _POST, _INT); if ($templateId == 0) { trigger_error(__('No template selected'), E_USER_ERROR); } // Is this user allowed to delete this template? $auth = $this->user->TemplateAuth($templateId, true); if (!$auth->del) { trigger_error(__('Access denied'), E_USER_ERROR); } // Use the data class Kit::ClassLoader('template'); $template = new Template($db); // Delete the template if (!$template->Delete($templateId)) { trigger_error($template->GetErrorMessage(), E_USER_ERROR); } $response->SetFormSubmitResponse(__('The Template has been Deleted')); $response->Respond(); }