Skip to content

Commit

Permalink
Replace some superglobals
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Feb 22, 2024
1 parent e155c68 commit a0a06dd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
17 changes: 10 additions & 7 deletions lib/org/openpsa/mail/exec/test-html.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php
use Symfony\Component\HttpFoundation\Request;

midcom::get()->auth->require_admin_user();
$post = Request::createFromGlobals()->request;

if ( empty($_POST['to'])
|| empty($_POST['from'])) {
if ( !$post->get('to')
|| !$post->get('from')) {
?>
<h2>Send test email</h2>
<form method="post">
Expand Down Expand Up @@ -40,11 +43,11 @@
<?php

} else {
$mail = new org_openpsa_mail($_POST['backend']);
$mail->to = $_POST['to'];
$mail->from = $_POST['from'];
$mail->subject = $_POST['subject'];
$mail->html_body = $_POST['html_body'];
$mail = new org_openpsa_mail($post->get('backend'));
$mail->to = $post->get('to');
$mail->from = $post->get('from');
$mail->subject = $post->get('subject');
$mail->html_body = $post->get('html_body');
$mail->embed_images();
$ret = $mail->send();
echo "<p>mail->send returned {$ret}<br>\n";
Expand Down
17 changes: 10 additions & 7 deletions lib/org/openpsa/mail/exec/test.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php
use Symfony\Component\HttpFoundation\Request;

midcom::get()->auth->require_admin_user();
$post = Request::createFromGlobals()->request;

if ( empty($_POST['to'])
|| empty($_POST['from'])) {
if ( !$post->get('to')
|| !$post->get('from')) {
?>
<h2>Send test email</h2>
<form method="post">
Expand All @@ -25,12 +28,12 @@
<?php

} else {
$mail = new org_openpsa_mail($_POST['backend']);
$mail = new org_openpsa_mail($post->get('backend'));

$mail->subject = $_POST['subject'];
$mail->body = $_POST['body'];
$mail->to = $_POST['to'];
$mail->from = $_POST['from'];
$mail->subject = $post->get('subject');
$mail->body = $post->get('body');
$mail->to = $post->get('to');
$mail->from = $post->get('from');

$ret = $mail->send();
echo "<p>mail->send returned {$ret}<br>\n";
Expand Down

0 comments on commit a0a06dd

Please sign in to comment.