function txEmailTemplateSave() { global $DB, $C; VerifyAdministrator(); CheckAccessList(); $_REQUEST['plain'] = trim($_REQUEST['plain']); $_REQUEST['html'] = trim($_REQUEST['html']); $ini_data = IniWrite(null, $_REQUEST, array('subject', 'plain', 'html')); $compiled_code = ''; $compiler = new Compiler(); if ($compiler->compile($ini_data, $compiled_code)) { $template_file = SafeFilename("{$GLOBALS['BASE_DIR']}/templates/{$_REQUEST['loaded_template']}"); FileWrite($template_file, $ini_data); $GLOBALS['message'] = 'Template has been successully saved'; } else { $GLOBALS['errstr'] = "Template could not be saved:<br />" . nl2br($compiler->get_error_string()); } txShEmailTemplates(); }
function lxEditRejection() { global $DB, $C; VerifyAdministrator(); $validator = new Validator(); $validator->Register($_REQUEST['identifier'], V_EMPTY, 'The Identifier field must be filled in'); $validator->Register($_REQUEST['subject'], V_EMPTY, 'The Subject field must be filled in'); if (!$validator->Validate()) { $GLOBALS['errstr'] = join('<br />', $validator->GetErrors()); lxEditRejection(); return; } $_REQUEST['plain'] = trim($_REQUEST['plain']); $_REQUEST['html'] = trim($_REQUEST['html']); $ini_data = IniWrite(null, $_REQUEST, array('subject', 'plain', 'html')); $compiled_code = ''; $compiler = new Compiler(); if ($compiler->compile($ini_data, $compiled_code)) { $DB->Update('UPDATE lx_rejections SET ' . 'identifier=?, ' . 'plain=?, ' . 'compiled=? ' . 'WHERE email_id=?', array($_REQUEST['identifier'], $ini_data, $compiled_code, $_REQUEST['email_id'])); $GLOBALS['message'] = 'Rejection e-mail has been successfully updated'; $GLOBALS['added'] = true; } else { $GLOBALS['errstr'] = "Rejection e-mail could not be saved:<br />" . nl2br($compiler->get_error_string()); } lxShEditRejection(); }
function tlxRejectionTemplateEdit() { global $DB, $C; VerifyAdministrator(); $v = new Validator(); $v->Register($_REQUEST['identifier'], V_EMPTY, 'The Identifier field must be filled in'); $v->Register($_REQUEST['subject'], V_EMPTY, 'The Subject field must be filled in'); if (!$v->Validate()) { return $v->ValidationError('tlxShRejectionTemplateEdit'); } $_REQUEST['plain'] = trim($_REQUEST['plain']); $_REQUEST['html'] = trim($_REQUEST['html']); $ini_data = IniWrite(null, $_REQUEST, array('subject', 'plain', 'html')); $compiled_code = ''; $compiler = new Compiler(); if ($compiler->compile($ini_data, $compiled_code)) { $DB->Update('UPDATE `tlx_rejections` SET ' . '`identifier`=?, ' . '`plain`=?, ' . '`compiled`=? ' . 'WHERE `email_id`=?', array($_REQUEST['identifier'], $ini_data, $compiled_code, $_REQUEST['email_id'])); $GLOBALS['message'] = 'Rejection e-mail has been successfully updated'; $GLOBALS['added'] = true; } else { $GLOBALS['errstr'] = "Rejection e-mail could not be saved:<br />" . nl2br($compiler->get_error_string()); } tlxShRejectionTemplateEdit(); }