$cur_lang = $preferences->pref_lang; $cur_ref = Texts::DEFAULT_REF; $texts = new Texts($texts_fields, $preferences); //set the language if (isset($_POST['sel_lang'])) { $cur_lang = $_POST['sel_lang']; } //set the text entry if (isset($_POST['sel_ref'])) { $cur_ref = $_POST['sel_ref']; } if (isset($_POST['valid']) && $_POST['valid'] == '1') { //form was send normally, we try to store new values //load actual text for further reference $mtxt = $texts->getTexts($cur_ref, $cur_lang); $res = $texts->setTexts($cur_ref, $cur_lang, $_POST['text_subject'], $_POST['text_body']); if (!$res) { $error_detected[] = preg_replace('(%s)', $mtxt->tcomment, _T("Email: '%s' has not been modified!")); } else { $success_detected[] = preg_replace('(%s)', $mtxt->tcomment, _T("Email: '%s' has been successfully modified.")); } } $tpl->assign('page_title', _T("Automatic emails texts edition")); $mtxt = $texts->getTexts($cur_ref, $cur_lang); $tpl->assign('reflist', $texts->getRefs($cur_lang)); $tpl->assign('langlist', $i18n->getList()); $tpl->assign('cur_lang', $cur_lang); $tpl->assign('cur_ref', $cur_ref); $tpl->assign('mtxt', $mtxt); $tpl->assign('require_dialog', true); $tpl->assign('error_detected', $error_detected);