2015-04-08 21:52:09 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* This software is governed by the CeCILL-B license. If a copy of this license
|
|
|
|
* is not distributed with this file, you can obtain one at
|
|
|
|
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
|
|
|
|
*
|
2018-02-21 11:07:11 +01:00
|
|
|
* Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
|
2016-08-04 22:26:37 +02:00
|
|
|
* Authors of Framadate/OpenSondage: Framasoft (https://github.com/framasoft)
|
2015-04-08 21:52:09 +02:00
|
|
|
*
|
|
|
|
* =============================
|
|
|
|
*
|
2018-02-21 11:07:11 +01:00
|
|
|
* Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
|
2015-04-08 21:52:09 +02:00
|
|
|
* ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
|
|
|
|
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
|
|
|
|
*
|
2018-02-21 11:07:11 +01:00
|
|
|
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
|
2015-04-08 21:52:09 +02:00
|
|
|
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Framadate\Message;
|
2015-04-13 23:53:28 +02:00
|
|
|
use Framadate\Services\LogService;
|
|
|
|
use Framadate\Services\MailService;
|
2019-04-17 17:39:33 +02:00
|
|
|
use Framadate\Services\NotificationService;
|
2015-04-08 21:52:09 +02:00
|
|
|
use Framadate\Services\PollService;
|
|
|
|
|
|
|
|
include_once __DIR__ . '/app/inc/init.php';
|
|
|
|
|
|
|
|
/* SERVICES */
|
|
|
|
/* -------- */
|
2015-04-13 23:53:28 +02:00
|
|
|
$logService = new LogService();
|
|
|
|
$pollService = new PollService($connect, $logService);
|
2018-05-25 15:50:35 +02:00
|
|
|
$mailService = new MailService($config['use_smtp'], $config['smtp_options'], $config['use_sendmail']);
|
2019-04-17 17:39:33 +02:00
|
|
|
$notificationService = new NotificationService($mailService, $smarty);
|
2015-04-08 21:52:09 +02:00
|
|
|
|
|
|
|
/* PAGE */
|
|
|
|
/* ---- */
|
|
|
|
$message = null;
|
|
|
|
|
|
|
|
if (!empty($_POST['mail'])) {
|
|
|
|
$mail = filter_input(INPUT_POST, 'mail', FILTER_VALIDATE_EMAIL);
|
|
|
|
if ($mail) {
|
|
|
|
$polls = $pollService->findAllByAdminMail($mail);
|
|
|
|
|
|
|
|
if (count($polls) > 0) {
|
2019-04-17 17:39:33 +02:00
|
|
|
$notificationService->sendFindPollsByMailNotification($mail, $polls);
|
2015-04-08 21:52:09 +02:00
|
|
|
$message = new Message('success', __('FindPolls', 'Polls sent'));
|
|
|
|
} else {
|
|
|
|
$message = new Message('warning', __('Error', 'No polls found'));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$message = new Message('danger', __('Error', 'Something is wrong with the format'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 18:06:35 +02:00
|
|
|
$smarty->assign('title', __('Homepage', 'Where are my polls?'));
|
2015-04-08 21:52:09 +02:00
|
|
|
$smarty->assign('message', $message);
|
2018-04-06 16:01:09 +02:00
|
|
|
$smarty->assign('locale', $locale);
|
2015-04-08 21:52:09 +02:00
|
|
|
|
|
|
|
$smarty->display('find_polls.tpl');
|