Beispiel #1
0
 static function envoyerMail($from, $to, $subject, $body, array $options = array())
 {
     require_once dirname(__FILE__) . '/AFUP_Configuration.php';
     $configuration = new AFUP_Configuration(dirname(__FILE__) . '/../../configs/application/config.php');
     $optionsDefault = array('html' => FALSE, 'bcc' => array(), 'file' => array());
     // chaque item doit contenir : (pathFichier, nom fichier)
     $options = array_merge($optionsDefault, $options);
     require_once dirname(__FILE__) . '/../../dependencies/phpmailer/class.phpmailer.php';
     require_once dirname(__FILE__) . '/../../dependencies/phpmailer/class.smtp.php';
     $mail = new PHPMailer();
     $mail->CharSet = "utf-8";
     $mail->IsHTML($options['html']);
     if ($configuration->obtenir('mails|serveur_smtp')) {
         $mail->IsSMTP();
         $mail->Host = $configuration->obtenir('mails|serveur_smtp');
         $mail->SMTPAuth = false;
     }
     if ($configuration->obtenir('mails|tls') == true) {
         $mail->SMTPAuth = $configuration->obtenir('mails|tls');
         $mail->SMTPSecure = 'tls';
     }
     if ($configuration->obtenir('mails|username')) {
         $mail->Username = $configuration->obtenir('mails|username');
     }
     if ($configuration->obtenir('mails|password')) {
         $mail->Password = $configuration->obtenir('mails|password');
     }
     if ($configuration->obtenir('mails|port')) {
         $mail->Port = $configuration->obtenir('mails|port');
     }
     if ($configuration->obtenir('mails|force_destinataire')) {
         $to = $configuration->obtenir('mails|force_destinataire');
     }
     $bcc = $configuration->obtenir('mails|bcc');
     if ($bcc) {
         $mail->AddBCC($bcc);
     }
     foreach ($options['bcc'] as $valeurBcc) {
         $mail->AddBCC($valeurBcc);
     }
     foreach ($options['file'] as $filePath) {
         $mail->AddAttachment($filePath[0], $filePath[1]);
         // TODO : deboguer la méthode
     }
     $from_email = is_array($from) ? $from[0] : $from;
     $from_name = (is_array($from) and isset($from[1])) ? $from[1] : '';
     $to_email = is_array($to) ? $to[0] : $to;
     $to_name = (is_array($to) and isset($to[1])) ? $to[1] : '';
     $mail->AddAddress($to_email, $to_name);
     $mail->From = $from_email;
     $mail->FromName = $from_name;
     $mail->Subject = $subject;
     $mail->Body = str_replace('$EMAIL$', $to_email, $body);
     return $mail->Send();
 }
Beispiel #2
0
 /**
  * Overrides the parent Footer method
  *
  * Creates the PDF footer with RIB and IBAN informations
  *
  * @access public
  *
  * @see FPDF::Footer()
  */
 function Footer()
 {
     $address = sprintf('%s - %u %s - %s - %s', $this->configuration->obtenir('afup|adresse'), $this->configuration->obtenir('afup|code_postal'), $this->configuration->obtenir('afup|ville'), $this->configuration->obtenir('afup|email'), 'http://www.afup.org');
     $this->SetY(-30);
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(0, 3, utf8_decode('AFUP, Association Française des Utilisateurs de PHP'), 0, 0, 'C');
     $this->Ln();
     $this->SetFont('Arial', '', 6);
     $this->Cell(0, 3, utf8_decode($address), 0, 0, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(170, 3, utf8_decode('N°') . ' SIRET', 0, 0, 'C');
     $this->SetFont('Arial', null, 6);
     $this->Cell(-140, 3, $this->configuration->obtenir('afup|siret'), 0, 0, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(130, 3, 'Identification RIB : Banque', 0, 0, 'C');
     $this->SetFont('Arial', null, 6);
     $this->Cell(-95, 3, $this->configuration->obtenir('rib|etablissement'), 0, 0, 'C');
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(112, 3, 'Guichet', 0, 0, 'C');
     $this->SetFont('Arial', null, 6);
     $this->Cell(-95, 3, $this->configuration->obtenir('rib|guichet'), 0, 0, 'C');
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(111, 3, utf8_decode('N° Cpte'), 0, 0, 'C');
     $this->SetFont('Arial', null, 6);
     $this->Cell(-88, 3, $this->configuration->obtenir('rib|compte'), 0, 0, 'C');
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(107, 3, utf8_decode('Clé'), 0, 0, 'C');
     $this->SetFont('Arial', null, 6);
     $this->Cell(-99, 3, $this->configuration->obtenir('rib|cle'), 0, 0, 'C');
     $this->Ln();
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(120, 3, 'Identification IBAN', 0, 0, 'C');
     $this->SetFont('Arial', null, 6);
     $this->Cell(-62, 3, $this->configuration->obtenir('rib|iban'), 0, 0, 'C');
     $this->SetFont('Arial', 'B', 6);
     $this->Cell(110, 3, 'BIC', 0, 0, 'C');
     $this->SetFont('Arial', null, 6);
     $this->Cell(-90, 3, $this->configuration->obtenir('rib|bic'), 0, 0, 'C');
     $this->Ln();
 }
Beispiel #3
0
<?php

// Initialisation
ob_start();
session_start();
require_once dirname(__FILE__) . '/../../sources/Afup/fonctions.php';
// Configuration
require_once dirname(__FILE__) . '/../../sources/Afup/AFUP_Configuration.php';
$conf = new AFUP_Configuration(dirname(__FILE__) . '/../../configs/application/config.php');
$GLOBALS['AFUP_CONF'] = $conf;
error_reporting($conf->obtenir('divers|niveau_erreur'));
ini_set('display_errors', $conf->obtenir('divers|afficher_erreurs'));
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname(__FILE__) . '/../../dependencies/PEAR/' . PATH_SEPARATOR . dirname(__FILE__) . '/../../dependencies/');
header('Content-type: text/html; charset=UTF-8');
// On détermine sur quel sous-site on est
$serveur = "";
$url = $_SERVER['REQUEST_URI'];
if (strrpos($url, '?') !== false) {
    $position = strrpos($url, '?');
    $url = substr($url, 0, $position);
}
$position = strrpos($url, '/');
$url = substr($_SERVER['REQUEST_URI'], 0, $position);
$parties = explode('/', $url);
$sous_site = array_pop($parties);
if (empty($sous_site) and strpos($_SERVER['HTTP_HOST'], "planete") !== false) {
    $sous_site = "planete";
    $serveur = "http://afup.org";
}
// Initialisation de Smarty
require_once dirname(__FILE__) . '/../../dependencies/smarty/Smarty.class.php';
 /**
  * Envoi un email de confirmation au conférencier et mets en copie le bureau
  */
 public function envoyerEmail($session_id)
 {
     require_once dirname(__FILE__) . '/AFUP_Configuration.php';
     $configuration = new AFUP_Configuration(dirname(__FILE__) . '/../../configs/application/config.php');
     $requete = 'select prenom, nom, email, af.titre
                 from afup_conferenciers ac
                 inner join afup_conferenciers_sessions acs
                     on ac.conferencier_id = acs.conferencier_id
                 inner join afup_sessions a_s
                     on a_s.session_id = acs.session_id
                 inner join afup_forum af
                     on af.id = a_s.id_forum
                 where
                     acs.session_id=' . $this->_bdd->echapper($session_id);
     $conferenciers = $this->_bdd->obtenirTous($requete);
     $corps = "Bonjour, \n\n";
     $corps .= "Nous avons bien enregistré votre soumission pour le " . current($conferenciers)['titre'] . " .\n";
     $corps .= "Vous recevrez une réponse prochainement.\n\n";
     $corps .= "Le bureau\n\n";
     $corps .= $configuration->obtenir('afup|raison_sociale') . "\n";
     $corps .= $configuration->obtenir('afup|adresse') . "\n";
     $corps .= $configuration->obtenir('afup|code_postal') . " " . $configuration->obtenir('afup|ville') . "\n";
     foreach ($conferenciers as $personne) {
         $ok = AFUP_Mailing::envoyerMail($configuration->obtenir('mails|email_expediteur'), array($personne['email'], $personne['nom'] . ' ' . $personne['prenom']), "Soumission de proposition au " . $personne['titre'] . "\n", $corps);
     }
     return $ok;
 }
Beispiel #5
0
 * @copyright 2010 Association Française des Utilisateurs de PHP
 *
 * @category AFUP
 * @package  AFUP
 * @group    Bootstraps
 */
// racine de l'application (pas du document root !)
$root = realpath(dirname(__FILE__) . '/../../..');
// définitions des constantes
define('AFUP_CHEMIN_RACINE', $root . '/htdocs/');
date_default_timezone_set('Europe/Paris');
/**
 * Ajout des répertoires contenant les différentes classes et script à inclure
 * dans l'include path pour éviter de les inclure avec chemin absolu
 * et pouvoir bénéficier prochainement du mécanisme d'autoloading de classe
 *
 * @author Olivier Hoareau <*****@*****.**>
 */
set_include_path($root . '/dependencies' . PATH_SEPARATOR . $root . '/sources');
// préparation de la requête / session
require_once 'Afup/fonctions.php';
// chargement de la configuration
require_once 'Afup/AFUP_Configuration.php';
$conf = new AFUP_Configuration($root . '/configs/application/config.php');
// mets la configuration dans une 'clé de registre' accessible à tout moment
$GLOBALS['AFUP_CONF'] = $conf;
// initialisation de la couche d'abstraction de la base de données
require_once 'Afup/AFUP_Base_De_Donnees.php';
$bdd = new AFUP_Base_De_Donnees($conf->obtenir('bdd|hote'), $conf->obtenir('bdd|base'), $conf->obtenir('bdd|utilisateur'), $conf->obtenir('bdd|mot_de_passe'));
// mets la connexion db dans une 'clé de registre' accessible à tout moment
$GLOBALS['AFUP_DB'] = $bdd;