Overview
Comment: | Implémentation de l'utilisation d'un SMTP externe (optionnel) pour l'envoi de mails |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA1: |
2f39cf54bf468b9f4e8b6dc85d2cc932 |
User & Date: | bohwaz on 2017-04-28 07:28:14 |
Other Links: | manifest | tags |
References
2020-12-08
| ||
23:25 | • Wiki page "Changelog/0.9" artifact: b9c916b4d1 user: bohwaz | |
Context
2017-05-08
| ||
00:12 | possibilité de créer des comptes directement à la racine d'une classe check-in: 73da92d6c9 user: bohwaz tags: trunk | |
2017-04-28
| ||
07:38 | Merge changements du trunk avec branche de dév check-in: 52c8d1e88b user: bohwaz tags: dev | |
07:28 | Implémentation de l'utilisation d'un SMTP externe (optionnel) pour l'envoi de mails check-in: 2f39cf54bf user: bohwaz tags: trunk, stable | |
2017-04-10
| ||
00:40 | Correction [a42abfebcb] Tri sur ID membre ne fonctionne pas check-in: 456b9f8b2d user: bohwaz tags: trunk, stable | |
Changes
Modified src/config.dist.php from [71b83249aa] to [c4a6b696de].
1 2 3 4 5 6 7 8 9 10 11 12 | <?php /** * Ce fichier représente un exemple des constantes de configuration * disponibles pour Garradin. */ // Nécessaire pour situer les constantes dans le bon namespace namespace Garradin; // Connexion automatique à l'administration avec l'adresse e-mail donnée #const LOCAL_LOGIN = 'president@association.net'; | > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php /** * Ce fichier représente un exemple des constantes de configuration * disponibles pour Garradin. * * NE PAS MODIFIER CE FICHIER! * * Pour configurer Garradin, copiez ce fichier en 'config.local.php' * et modifiez ce dont vous avez besoin. */ // Nécessaire pour situer les constantes dans le bon namespace namespace Garradin; // Connexion automatique à l'administration avec l'adresse e-mail donnée #const LOCAL_LOGIN = 'president@association.net'; |
︙ | ︙ | |||
75 76 77 78 79 80 81 | // Supporte les serveurs web suivants : // - Apache avec mod_xsendfile (paquet libapache2-mod-xsendfile) // - Lighttpd // N'activer que si vous êtes sûr que le module est installé et activé. // Nginx n'est PAS supporté, car X-Accel-Redirect ne peut gérer que des fichiers // qui sont *dans* le document root du vhost, ce qui n'est pas le cas ici. const ENABLE_XSENDFILE = false; | > > > > > > > > > > > > > > > > > > > > > > > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | // Supporte les serveurs web suivants : // - Apache avec mod_xsendfile (paquet libapache2-mod-xsendfile) // - Lighttpd // N'activer que si vous êtes sûr que le module est installé et activé. // Nginx n'est PAS supporté, car X-Accel-Redirect ne peut gérer que des fichiers // qui sont *dans* le document root du vhost, ce qui n'est pas le cas ici. const ENABLE_XSENDFILE = false; // Hôte du serveur SMTP, mettre à false (défaut) pour utiliser la fonction // mail() de PHP const SMTP_HOST = false; // Port du serveur SMTP // 25 = port standard pour connexion non chiffrée (465 pour Gmail) // 587 = port standard pour connexion SSL const SMTP_PORT = 587; // Login utilisateur pour le server SMTP // mettre à null pour utiliser un serveur local ou anonyme const SMTP_USER = 'garradin@monserveur.com'; // Mot de passe pour le serveur SMTP // mettre à null pour utiliser un serveur local ou anonyme const SMTP_PASSWORD = 'abcd'; // Sécurité du serveur SMTP // NONE = pas de chiffrement // SSL = connexion SSL (le plus sécurisé) // STARTTLS = utilisation de STARTTLS (moyennement sécurisé) const SMTP_SECURITY = 'STARTTLS'; |
Modified src/include/init.php from [fa76653d43] to [187ff141bb].
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | // Configuration externalisée if (file_exists(__DIR__ . '/../config.local.php')) { require __DIR__ . '/../config.local.php'; } if (!defined('Garradin\ROOT')) { define('Garradin\ROOT', dirname(__DIR__)); } if (!defined('Garradin\DATA_ROOT')) { define('Garradin\DATA_ROOT', ROOT); } | > > < < < < < < < < < < < < < < < < < < < < > | < | < | | < > | < | < | < > > > > | > > > | | < | | < < | | | | < < < < < | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | // Configuration externalisée if (file_exists(__DIR__ . '/../config.local.php')) { require __DIR__ . '/../config.local.php'; } // Configuration par défaut, si les constantes ne sont pas définies dans config.local.php // (fallback) if (!defined('Garradin\ROOT')) { define('Garradin\ROOT', dirname(__DIR__)); } if (!defined('Garradin\DATA_ROOT')) { define('Garradin\DATA_ROOT', ROOT); } if (!defined('Garradin\WWW_URI')) { // Automagic URL discover $path = str_replace(ROOT . '/www', '', getcwd()); $path = str_replace($path, '', dirname($_SERVER['SCRIPT_NAME'])); $path = (!empty($path[0]) && $path[0] != '/') ? '/' . $path : $path; $path = (substr($path, -1) != '/') ? $path . '/' : $path; define('Garradin\WWW_URI', $path); } if (!defined('Garradin\WWW_URL')) { $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'); define('Garradin\WWW_URL', 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://' . $host . WWW_URI); } static $default_config = [ 'CACHE_ROOT' => DATA_ROOT . '/cache', 'DB_FILE' => DATA_ROOT . '/association.sqlite', 'DB_SCHEMA' => ROOT . '/include/data/schema.sql', 'PLUGINS_ROOT' => DATA_ROOT . '/plugins', 'PREFER_HTTPS' => false, 'PLUGINS_SYSTEM' => '', 'SHOW_ERRORS' => true, 'MAIL_ERRORS' => false, 'USE_CRON' => false, 'ENABLE_XSENDFILE' => false, 'SMTP_HOST' => false, 'SMTP_USER' => null, 'SMTP_PASSWORD' => null, 'SMTP_PORT' => 587, 'SMTP_SECURITY' => 'STARTTLS', ]; foreach ($default_config as $const => $value) { $const = sprintf('Garradin\\%s', $const); if (!defined($const)) { define($const, $value); } } define('Garradin\WEBSITE', 'http://garradin.eu/'); define('Garradin\PLUGINS_URL', 'https://garradin.eu/plugins/list.json'); // PHP devrait être assez intelligent pour chopper la TZ système mais nan // il sait pas faire (sauf sur Debian qui a le bon patch pour ça), donc pour |
︙ | ︙ |
Modified src/include/lib/Garradin/Utils.php from [787abfba04] to [34b8cc4485].
︙ | ︙ | |||
466 467 468 469 470 471 472 | $subject = '=?UTF-8?B?'.base64_encode($subject).'?='; if (is_array($to)) { foreach ($to as $t) { | | > > > > > > > > > > > > > > > > > > > > > > | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | $subject = '=?UTF-8?B?'.base64_encode($subject).'?='; if (is_array($to)) { foreach ($to as $t) { return self::_sendMail($t, $suject, $content, $headers); } } else { return self::_sendMail($to, $subject, $content, $headers); } } static protected function _sendMail($to, $subject, $content, $headers) { if (SMTP_HOST) { $const = '\KD2\SMTP::' . strtoupper(SMTP_SECURITY); if (!defined($const)) { throw new \LogicException('Configuration: SMTP_SECURITY n\'a pas une valeur reconnue. Valeurs acceptées: STARTTLS, SSL, NONE.'); } $secure = constant($const); $smtp = new SMTP(SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, $secure); return $smtp->send($to, $subject, $content, $headers); } else { return mail($to, $subject, $content, $headers); } } |
︙ | ︙ |