X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=report_send.php;h=e11978aa051a10ac7fdbd804bc83ddd916cf8471;hb=b0e8ffd3af439b5dc6dd5044a46a906d9833932b;hp=18e731e8ae9c8afa58e0ae2c7e352befced5dd6a;hpb=098a79f0819ebb89b7d48df4a6b154af4560f68e;p=timetracker.git diff --git a/report_send.php b/report_send.php index 18e731e8..e11978aa 100644 --- a/report_send.php +++ b/report_send.php @@ -40,7 +40,7 @@ if (!ttAccessCheck(right_view_reports)) { $sc = new ttSysConfig($user->id); -if ($request->getMethod() == 'POST') { +if ($request->isPost()) { $cl_receiver = trim($request->getParameter('receiver')); $cl_cc = trim($request->getParameter('cc')); $cl_subject = trim($request->getParameter('subject')); @@ -58,23 +58,23 @@ $form->addInput(array('type'=>'text','name'=>'subject','style'=>'width: 300px;', $form->addInput(array('type'=>'textarea','name'=>'comment','maxlength'=>'250','style'=>'width: 300px; height: 60px;')); $form->addInput(array('type'=>'submit','name'=>'btn_send','value'=>$i18n->getKey('button.send'))); -if ($request->getMethod() == 'POST') { +if ($request->isPost()) { // Validate user input. - if (!ttValidEmailList($cl_receiver)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.to')); - if (!ttValidEmailList($cl_cc, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.cc')); - if (!ttValidString($cl_subject)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.subject')); - if (!ttValidString($cl_comment, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.comment')); - - if ($errors->isEmpty()) { + if (!ttValidEmailList($cl_receiver)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.to')); + if (!ttValidEmailList($cl_cc, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.cc')); + if (!ttValidString($cl_subject)) $err->add($i18n->getKey('error.field'), $i18n->getKey('form.mail.subject')); + if (!ttValidString($cl_comment, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.comment')); + + if ($err->no()) { // Save last report emails for future use. $sc->setValue(SYSC_LAST_REPORT_EMAIL, $cl_receiver); - $sc->setValue(SYSC_LAST_REPORT_CC, $cl_cc); - - // Obtain session bean with report attributes. - $bean = new ActionForm('reportBean', new Form('reportForm')); - // Prepare report body. - $body = ttReportHelper::prepareReportBody($bean, $cl_comment); - + $sc->setValue(SYSC_LAST_REPORT_CC, $cl_cc); + + // Obtain session bean with report attributes. + $bean = new ActionForm('reportBean', new Form('reportForm')); + // Prepare report body. + $body = ttReportHelper::prepareReportBody($bean, $cl_comment); + import('mail.Mailer'); $mailer = new Mailer(); $mailer->setCharSet(CHARSET); @@ -85,9 +85,9 @@ if ($request->getMethod() == 'POST') { $mailer->setReceiverCC($cl_cc); $mailer->setSendType(MAIL_MODE); if ($mailer->send($cl_subject, $body)) - $messages->add($i18n->getKey('form.mail.report_sent')); + $msg->add($i18n->getKey('form.mail.report_sent')); else - $errors->add($i18n->getKey('error.mail_send')); + $err->add($i18n->getKey('error.mail_send')); } } @@ -96,4 +96,3 @@ $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.mailForm.'.($cl_receiver?'comment':'receiver').'.focus()"'); $smarty->assign('content_page_name', 'mail.tpl'); $smarty->display('index.tpl'); -?> \ No newline at end of file