blob: bc86ef5e0a038d5d6a01b9c71f886d9ed34f8394 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
Adrià Vilanova Martínez5af86512023-12-02 20:44:16 +01002/*
3 * hores
4 * Copyright (c) 2023 Adrià Vilanova Martínez
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public
17 * License along with this program.
18 * If not, see http://www.gnu.org/licenses/.
19 */
20
Copybara botbe50d492023-11-30 00:16:42 +010021require_once("core.php");
22security::checkType(security::HYPERADMIN);
23
24if (!security::checkParams("POST", [
25 ["people", security::PARAM_ISARRAY]
26])) {
27 security::go("sendbulkpasswords.php?msg=empty");
28}
29?>
30<!DOCTYPE html>
31<html>
32<head>
33 <title><?php echo $conf["appName"]; ?></title>
34 <?php visual::includeHead(); ?>
35 <link rel="stylesheet" href="css/dashboard.css">
36</head>
37<?php visual::printBodyTag(); ?>
38 <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer">
39 <?php visual::includeNav(); ?>
40
41 <main class="mdl-layout__content">
42 <div class="page-content">
43 <div class="main mdl-shadow--4dp">
44 <h2>Resultado del envío de enlaces</h2>
45
46 <?php
47 foreach ($_POST["people"] as $id) {
48 $person = people::get($id);
49 if ($person === false) continue;
50
51 $status = recovery::recover($person["id"], recovery::EMAIL_TYPE_WELCOME);
52
53 $personText = "&ldquo;".security::htmlsafe($person["name"])."&rdquo;";
54
55 if ($status) {
56 echo "<p class='mdl-color-text--green'>Enlace enviado correctamente a $personText.";
57 } elseif ($status === recovery::EMAIL_NOT_SET) {
58 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.";
59 } else {
60 echo "<p class='mdl-color-text--red'>Ha ocurrido un error generando el enlace o enviando el correo a $personText.";
61 }
62 echo "</p>";
63 }
64 ?>
65 </div>
66 </div>
67 </main>
68 </div>
69</body>
70</html>