blob: 724fdb82ebe9ee8ed098cbdeec2933e2498b572a [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2require_once("core.php");
3security::checkType(security::HYPERADMIN);
4
5if (!security::checkParams("POST", [
6 ["people", security::PARAM_ISARRAY]
7])) {
8 security::go("sendbulkpasswords.php?msg=empty");
9}
10?>
11<!DOCTYPE html>
12<html>
13<head>
14 <title><?php echo $conf["appName"]; ?></title>
15 <?php visual::includeHead(); ?>
16 <link rel="stylesheet" href="css/dashboard.css">
17</head>
18<?php visual::printBodyTag(); ?>
19 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer">
20 <?php visual::includeNav(); ?>
21
22 <main class="mdl-layout__content">
23 <div class="page-content">
24 <div class="main mdl-shadow--4dp">
25 <h2>Resultado del envío de enlaces</h2>
26
27 <?php
28 foreach ($_POST["people"] as $id) {
29 $person = people::get($id);
30 if ($person === false) continue;
31
32 $status = recovery::recover($person["id"], recovery::EMAIL_TYPE_WELCOME);
33
34 $personText = "&ldquo;".security::htmlsafe($person["name"])."&rdquo;";
35
36 if ($status) {
37 echo "<p class='mdl-color-text--green'>Enlace enviado correctamente a $personText.";
38 } elseif ($status === recovery::EMAIL_NOT_SET) {
39 echo "<p class='mdl-color-text--orange'>No se ha podido enviar el correo a $personText porque no tiene asociada ninguna dirección de correo electrónico.";
40 } else {
41 echo "<p class='mdl-color-text--red'>Ha ocurrido un error generando el enlace o enviando el correo a $personText.";
42 }
43 echo "</p>";
44 }
45 ?>
46 </div>
47 </div>
48 </main>
49 </div>
50</body>
51</html>