Exemple #1
0
function traiter_form_commentaire($commentaire, $admin)
{
    $msg_param_to_trim = isset($_GET['msg']) ? '&msg=' . $_GET['msg'] : '';
    $query_string = str_replace($msg_param_to_trim, '', $_SERVER['QUERY_STRING']);
    // add new comment (admin + public)
    if (isset($_POST['enregistrer']) and empty($_POST['is_it_edit'])) {
        $result = bdd_commentaire($commentaire, 'enregistrer-nouveau');
        if ($result === TRUE) {
            send_emails($commentaire['bt_id']);
            // send emails new comment posted to people that are subscriben
            $redir = basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=confirm_comment_ajout';
        } else {
            die($result);
        }
    } elseif (isset($_POST['enregistrer']) and $admin == 'admin' and isset($_POST['is_it_edit']) and $_POST['is_it_edit'] == 'yes' and isset($commentaire['ID'])) {
        $result = bdd_commentaire($commentaire, 'editer-existant');
        $redir = basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=confirm_comment_edit';
    } elseif (isset($_POST['com_supprimer']) and $admin == 'admin') {
        $comm = array('ID' => htmlspecialchars($_POST['com_supprimer']), 'bt_article_id' => htmlspecialchars($_POST['com_article_id']));
        $result = bdd_commentaire($comm, 'supprimer-existant');
        // Ajax response
        if ($result === TRUE) {
            rafraichir_cache();
            //echo var_dump($comm);
            echo 'Success' . new_token();
        } else {
            echo 'Error' . new_token();
        }
        exit;
    } elseif (isset($_POST['com_activer']) and $admin == 'admin') {
        $comm = array('ID' => htmlspecialchars($_POST['com_activer']), 'bt_article_id' => htmlspecialchars($_POST['com_article_id']));
        $result = bdd_commentaire($comm, 'activer-existant');
        // Ajax response
        if ($result === TRUE) {
            rafraichir_cache();
            //echo var_dump($comm);
            echo 'Success' . new_token();
        } else {
            echo 'Error' . new_token();
        }
        exit;
    } else {
        redirection(basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=nothing_happend_oO');
    }
    if ($result === TRUE) {
        rafraichir_cache();
        redirection($redir);
    } else {
        die($result);
    }
}
require "settings.php";
require_lib("mail.smtp");
if (isset($_POST["key"])) {
    if ($_POST["key"] == "group") {
        $OUTPUT = get_data($_POST);
    } elseif ($_POST["key"] == "process") {
        $OUTPUT = process_data($_POST);
    } elseif ($_POST["key"] == "modify") {
        if (isset($_POST["done"])) {
            $OUTPUT = get_email($_POST);
        } else {
            $OUTPUT = process_data($_POST);
        }
    } elseif ($_POST["key"] == "send_mail") {
        $OUTPUT = send_emails($_POST);
    }
} else {
    $OUTPUT = select_group();
}
$OUTPUT .= "<p>" . mkQuickLinks(ql("email-queue-manage.php", "Send Emails In Queue"), ql("email-queue-failures.php", "Resend Failed Emails In Queue"), ql("email-groups.php", "Send Email To Group"), ql("email-group-new.php", "Add Email Group"), ql("email-group-view.php", "View Email Groups"));
require "template.php";
function select_group()
{
    db_connect();
    $groups = "";
    #get list of groups
    $get_groups = "SELECT * from egroups ORDER BY groupname";
    $run_egroups = db_exec($get_groups) or errDie("Unable to get group information.");
    if (pg_numrows($run_egroups) > 0) {
        while ($garr = pg_fetch_array($run_egroups)) {
    $mail->Subject = 'Ton invitation est arrivée !';
    $mail->Body = '<h1>Tu es invité à l\'évènement ' . $event_name . '</h1><p>C\'est l\'évènement qui a l\'id ' . $event_id . ', on verra plus tard pour qu\'il y ait un lien ici.</p>';
    $mail->AltBody = 'Tu es invité à l\'évènement ' . $event_name . '. C\'est l\'évènement qui a l\'id ' . $event_id . ', on verra plus tard pour qu\'il y ait un lien ici.';
    if (!$mail->send()) {
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
        echo 'Message has been sent';
    }
    return true;
}
if (user_is_logged()) {
    if (isset($_POST['event-id']) && isset($_POST['email-addresses'])) {
        foreach ($_POST['email-addresses'] as $person) {
            if (valid_email($person['email'])) {
                send_emails($_POST['event-id'], $_POST['event-name'], $person['email']);
            }
        }
    }
}
/*$event_url = array(
        "id" => "2"
    );

    $crypt = new token(HASHKEY);
    $encrypted = $crypt->encrypt(json_encode($event_url));

    $decrypted = $crypt->decrypt( $encrypted );

    echo "Encrypted string: $encrypted<hr>";
    echo "<hr>";
Exemple #4
0
<?php

require_once "./config.php";
$input = array();
$errors = array();
$success = array();
$input['number_ppl'] = $_POST['number_ppl'] ? $_POST['number_ppl'] : $_GET['number_ppl'];
$input['form_key'] = $_POST['form_key'] ? $_POST['form_key'] : $_GET['form_key'];
$input['rand_key'] = $_POST['rand_key'] ? $_POST['rand_key'] : $_GET['rand_key'];
$input['names'] = $_POST['names'] ? $_POST['names'] : $_GET['names'];
$input['emails'] = $_POST['emails'] ? $_POST['emails'] : $_GET['emails'];
$input['others'] = $_POST['others'] ? $_POST['others'] : $_GET['others'];
$input['gift_value'] = $_POST['gift_value'] ? $_POST['gift_value'] : $_GET['gift_value'];
try {
    if (validate_input($input, $errors) && validate_form($input, $errors) && eliminate_blank_values($input) && validate_emails($input, $errors) && count($input['names']) >= 1) {
        if (send_emails($input, $errors, $success)) {
            return_success($success);
        } else {
            return_errors($errors);
        }
    } else {
        return_errors($errors);
    }
} catch (Exception $e) {
    return_errors($errors, $input, $e);
}
function validate_input(&$input, &$errors)
{
    $return_val = true;
    //Testing Form Key
    if (!isset($input['form_key']) || empty($input['form_key']) || !is_numeric($input['form_key'])) {
Exemple #5
0
function traiter_form_commentaire($commentaire, $admin)
{
    $msg_param_to_trim = isset($_GET['msg']) ? '&msg=' . $_GET['msg'] : '';
    $query_string = str_replace($msg_param_to_trim, '', $_SERVER['QUERY_STRING']);
    // add new comment
    if (isset($_POST['enregistrer']) and empty($_POST['is_it_edit'])) {
        $result = bdd_commentaire($commentaire, 'enregistrer-nouveau');
        if ($result === TRUE) {
            rafraichir_cache();
            send_emails($commentaire['bt_id']);
            // send emails new comment posted to people that are subscriben
            $redir = $_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=confirm_comment_ajout';
            if ($admin == 'admin') {
                redirection($redir);
            }
        } else {
            die($result);
        }
    } elseif (isset($_POST['enregistrer']) and $admin == 'admin' and isset($_POST['is_it_edit']) and $_POST['is_it_edit'] == 'yes' and isset($commentaire['ID'])) {
        $result = bdd_commentaire($commentaire, 'editer-existant');
        $redir = $_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=confirm_comment_edit';
    } elseif (isset($_POST['supprimer_comm']) and isset($commentaire['ID']) and $admin == 'admin') {
        $result = bdd_commentaire($commentaire, 'supprimer-existant');
        $redir = $_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=confirm_comment_suppr';
    } else {
        redirection($_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=nothing_happend_oO');
    }
    if ($result === TRUE) {
        rafraichir_cache();
        redirection($redir);
    } else {
        die($result);
    }
}