Merge commit 'origin/master' into hruid
[platal.git] / plugins / function.test_email.php
index d9e68ff..932c998 100644 (file)
  ***************************************************************************/
 
 function smarty_function_test_email($params, &$smarty) {
-    $label = isset($params['title']) ? $params['title'] : 'Envoyer un mail de test';
-    $forlife = isset($params['forlife']) ? "'" . $params['forlife'] . "'" : '';
+    $label = isset($params['title']) ? $params['title'] : 'Envoyer un email de test';
+    $token = "'" . S::v('xsrf_token') . (isset($params['hruid']) ? "', " : "'");
+    $hruid = isset($params['hruid']) ? "'" . $params['hruid'] . "'" : '';
     return '<div class="center">'
          . '  <div id="mail_sent" style="position: absolute;"></div><br />'
-         . '  <form action="emails/test" method="get" onsubmit="return sendTestEmail(' . $forlife . ')">'
+         . '  <form action="emails/test" method="get" onsubmit="return sendTestEmail(' . $token . $hruid . ')">'
+         . '    <input type="hidden" name="token" value="' . S::v('xsrf_token') . '" />'
          . '    <div><input type="submit" name="send" value="' . $label . '" /></div>'
          . '  </form>'
          . '</div>';