Exemple #1
0
/* --------- */
const UPDATE_POLL = 1;
const DELETED_POLL = 2;
/* Variables */
/* --------- */
$admin_poll_id = null;
$poll_id = null;
$poll = null;
$message = null;
$editingVoteId = 0;
/* Services */
/*----------*/
$logService = new LogService();
$pollService = new PollService($connect, $logService);
$adminPollService = new AdminPollService($connect, $pollService, $logService);
$inputService = new InputService();
$mailService = new MailService($config['use_smtp']);
/* Functions */
/*-----------*/
/**
 * Send a notification to the poll admin to notify him about an update.
 *
 * @param stdClass $poll The poll
 * @param MailService $mailService The mail service
 * @param int $type cf: Constants on the top of this page
 */
function sendUpdateNotification($poll, $mailService, $type)
{
    if (!isset($_SESSION['mail_sent'])) {
        $_SESSION['mail_sent'] = [];
    }
Exemple #2
0
/* --------- */
const UPDATE_VOTE = 1;
const ADD_VOTE = 2;
const ADD_COMMENT = 3;
/* Variables */
/* --------- */
$poll_id = null;
$poll = null;
$message = null;
$editingVoteId = 0;
$editedVoteUniqueId = null;
/* Services */
/*----------*/
$logService = new LogService();
$pollService = new PollService($connect, $logService);
$inputService = new InputService();
$mailService = new MailService($config['use_smtp']);
/* Functions */
/*-----------*/
/**
 * Send a notification to the poll admin to notify him about an update.
 *
 * @param $poll stdClass The poll
 * @param $mailService MailService The mail service
 * @param $name string The name user who triggered the notification
 * @param $type int cf: Constants on the top of this page
 */
function sendUpdateNotification($poll, $mailService, $name, $type)
{
    if (!isset($_SESSION['mail_sent'])) {
        $_SESSION['mail_sent'] = [];
Exemple #3
0
 *
 * Ce logiciel est r�gi par la licence CeCILL-B. Si une copie de cette licence
 * ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
 *
 * Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Rapha�l DROZ
 * Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
 */
use Framadate\Form;
use Framadate\Services\InputService;
use Framadate\Utils;
include_once __DIR__ . '/app/inc/init.php';
const GO_TO_STEP_2 = 'gotostep2';
/* Services */
/*----------*/
$inputService = new InputService();
/* PAGE */
/* ---- */
if (!isset($_SESSION['form'])) {
    $_SESSION['form'] = new Form();
}
// Type de sondage
if (isset($_GET['type']) && $_GET['type'] == 'date' || isset($_POST['type']) && $_POST['type'] == 'date') {
    $poll_type = 'date';
    $_SESSION['form']->choix_sondage = $poll_type;
} else {
    $poll_type = 'classic';
    $_SESSION['form']->choix_sondage = $poll_type;
}
// We clean the data
$goToStep2 = filter_input(INPUT_POST, GO_TO_STEP_2, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^(date|classic)$/']]);
 */
use Framadate\Services\InputService;
use Framadate\Services\LogService;
use Framadate\Services\PollService;
use Framadate\Services\MailService;
use Framadate\Services\PurgeService;
use Framadate\Utils;
use Framadate\Choice;
include_once __DIR__ . '/app/inc/init.php';
/* Service */
/*---------*/
$logService = new LogService();
$pollService = new PollService($connect, $logService);
$mailService = new MailService($config['use_smtp']);
$purgeService = new PurgeService($connect, $logService);
$inputService = new InputService();
if (is_readable('bandeaux_local.php')) {
    include_once 'bandeaux_local.php';
} else {
    include_once 'bandeaux.php';
}
// Step 1/4 : error if $_SESSION from info_sondage are not valid
if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || $config['use_smtp'] && !isset($_SESSION['form']->admin_mail)) {
    $smarty->assign('title', __('Error', 'Error!'));
    $smarty->assign('error', __('Error', 'You haven\'t filled the first section of the poll creation.'));
    $smarty->display('error.tpl');
} else {
    // Min/Max archive date
    $min_expiry_time = $pollService->minExpiryDate();
    $max_expiry_time = $pollService->maxExpiryDate();
    // The poll format is DATE
Exemple #5
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');