Esempio n. 1
0
         $message .= '<br/><br/>';
         $message .= Utils::htmlEscape($_SESSION['form']->admin_name) . ' ' . __('Mail', 'hast just created a poll called') . ' : "' . Utils::htmlEscape($_SESSION['form']->title) . '".<br/>';
         $message .= __('Mail', 'Thanks for filling the poll at the link above') . ' :<br/><br/><a href="%1$s">%1$s</a>';
         $message_admin = __('Mail', "This message should NOT be sent to the polled people. It is private for the poll's creator.\n\nYou can now modify it at the link above");
         $message_admin .= ' :<br/><br/><a href="%1$s">%1$s</a>';
         $message = sprintf($message, Utils::getUrlSondage($poll_id));
         $message_admin = sprintf($message_admin, Utils::getUrlSondage($admin_poll_id, true));
         if ($mailService->isValidEmail($_SESSION['form']->admin_mail)) {
             $mailService->send($_SESSION['form']->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'Author\'s message') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($_SESSION['form']->title), $message_admin);
             $mailService->send($_SESSION['form']->admin_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'For sending to the polled users') . '] ' . __('Generic', 'Poll') . ': ' . Utils::htmlEscape($_SESSION['form']->title), $message);
         }
     }
     // Clean Form data in $_SESSION
     unset($_SESSION['form']);
     // Delete old polls
     $purgeService->purgeOldPolls();
     // Redirect to poll administration
     header('Location:' . Utils::getUrlSondage($admin_poll_id, true));
     exit;
 } else {
     if (isset($_POST['fin_sondage_autre'])) {
         Utils::print_header(__('Step 3', 'Removal date and confirmation (3 on 3)'));
         bandeau_titre(__('Step 3', 'Removal date and confirmation (3 on 3)'));
         // Store choices in $_SESSION
         if (isset($_POST['choices'])) {
             $_SESSION['form']->clearChoices();
             foreach ($_POST['choices'] as $c) {
                 if (!empty($c)) {
                     $c = strip_tags($c);
                     $choice = new Choice($c);
                     $_SESSION['form']->addChoice($choice);
Esempio n. 2
0
 * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
 */
use Framadate\Services\InputService;
use Framadate\Services\LogService;
use Framadate\Services\PurgeService;
use Framadate\Services\SecurityService;
include_once __DIR__ . '/../app/inc/init.php';
include_once __DIR__ . '/../bandeaux.php';
/* Variables */
/* --------- */
$message = null;
/* Services */
/*----------*/
$logService = new LogService();
$purgeService = new PurgeService($connect, $logService);
$securityService = new SecurityService();
$inputService = new InputService();
/* POST */
/*-----*/
$action = $inputService->filterName(isset($_POST['action']) ? $_POST['action'] : null);
/* PAGE */
/* ---- */
if ($action === 'purge' && $securityService->checkCsrf('admin', $_POST['csrf'])) {
    $count = $purgeService->purgeOldPolls();
    $message = __('Admin', 'Purged:') . ' ' . $count;
}
// Assign data to template
$smarty->assign('message', $message);
$smarty->assign('crsf', $securityService->getToken('admin'));
$smarty->assign('title', __('Admin', 'Purge'));
$smarty->display('admin/purge.tpl');