Example #1
0
function send_robot_homonym(PlUser $user, $email)
{
    $cc = "validation+homonyme@" . Platal::globals()->mail->domain;
    $from = "\"Support Polytechnique.org\" <{$cc}>";
    $body = Post::has('mailbody') ? Post::t('mailbody') : get_robot_mail_text($user, $email);
    $user = User::getSilentWithUID($user->id());
    $mymail = new PlMailer();
    $mymail->setFrom($from);
    $mymail->setSubject("Mise en place du robot {$email}@" . $user->mainEmailDomain());
    $mymail->addCc($cc);
    $mymail->setTxtBody($body);
    $mymail->sendTo($user);
}
Example #2
0
 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
 ***************************************************************************/
require_once 'connect.db.inc.php';
require_once 'plmailer.php';
require_once 'notifs.inc.php';
ini_set('memory_limit', '128M');
$uids = XDB::query('SELECT  uid
                      FROM  watch
                     WHERE  FIND_IN_SET(\'mail\', flags)
                  ORDER BY  uid');
$iterator = User::iterOverUIDs($uids->fetchColumn());
while ($user = $iterator->next()) {
    $watch = new Watch($user);
    if ($watch->count() > 0) {
        $notifs = $watch->events();
        $mailer = new PlMailer('carnet/notif.mail.tpl');
        $mailer->assign('sex', $user->isFemale());
        $mailer->assign('yourself', $user->display_name);
        $mailer->assign('week', date('W - Y'));
        $mailer->assign('notifs', $notifs);
        $mailer->sendTo($user);
        unset($mailer);
        unset($notifs);
    }
    unset($watch);
    unset($user);
}
XDB::execute("UPDATE  watch_profile\n                 SET  ts = NOW()\n               WHERE  field = 'broken'");
XDB::execute('DELETE FROM  watch_profile
                    WHERE  ts < DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY)');
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
Example #3
0
 function handler_broken($page, $warn = null, $email = null)
 {
     require_once 'emails.inc.php';
     $wp = new PlWikiPage('Xorg.PatteCassée');
     $wp->buildCache();
     global $globals;
     $page->changeTpl('emails/broken.tpl');
     if ($warn == 'warn' && $email) {
         S::assert_xsrf_token();
         // Usual verifications.
         $email = valide_email($email);
         $uid = XDB::fetchOneCell('SELECT  uid
                                     FROM  email_redirect_account
                                    WHERE  redirect = {?}', $email);
         if ($uid) {
             $dest = User::getWithUID($uid);
             $active = XDB::fetchOneCell('SELECT flags
                                            FROM email_redirect_account
                                           WHERE redirect = {?} AND uid = {?}', $email, $uid) == 'active';
             $mail = new PlMailer('emails/broken-web.mail.tpl');
             $mail->assign('email', $email);
             $mail->assign('request', S::user());
             $mail->sendTo($dest);
             $page->trigSuccess('Email envoyé&nbsp;!');
         }
     } elseif (Post::has('email')) {
         S::assert_xsrf_token();
         $email = Post::t('email');
         if (!User::isForeignEmailAddress($email)) {
             $page->assign('neuneu', true);
         } else {
             $user = mark_broken_email($email);
             $page->assign('user', $user);
             $page->assign('email', $email);
         }
     }
 }
Example #4
0
 function handler_paypal_return($page, $uid = null)
 {
     $page->changeTpl('payment/retour_paypal.tpl');
     /* reference banque (numero de transaction) */
     $no_transaction = Env::s('tx');
     /* token a renvoyer pour avoir plus d'information */
     $clef = Env::s('sig');
     /* code retour */
     $status = Env::s('st');
     /* raison */
     $reason = $status == 'Pending' ? Env::s('pending_reason') : Env::s('reason_code');
     /* reference complete de la commande */
     $fullref = str_replace('%2d', '-', Env::s('cm'));
     /* montant de la transaction */
     $montant = Env::s('amt');
     /* devise */
     if (Env::s('cc') != 'EUR') {
         cb_erreur("monnaie autre que l'euro");
     }
     /* on extrait le code de retour */
     if ($status != "Completed") {
         if ($status) {
             paypal_erreur("erreur lors du paiement : {$status} - {$reason}");
         } else {
             paypal_erreur("Paiement annulé", false);
         }
     }
     /* on extrait les informations sur l'utilisateur */
     $user = User::get($uid);
     if (!$user) {
         paypal_erreur("uid invalide");
     }
     /* on extrait la reference de la commande */
     if (!preg_match('/-xorg-([0-9]+)$/', $fullref, $matches)) {
         paypal_erreur("référence de commande invalide");
     }
     $ref = $matches[1];
     $res = XDB::query('SELECT  mail, text, confirmation
                          FROM  payments
                         WHERE  id = {?}', $ref);
     if (!(list($conf_mail, $conf_title, $conf_text) = $res->fetchOneRow())) {
         paypal_erreur('référence de commande inconnue');
     }
     /* on fait l'insertion en base de donnees */
     XDB::execute("INSERT INTO  payment_transactions (id, method_id, uid, ref, fullref, ts_confirmed, amount, pkey, comment, status, display)\n                           VALUES  ({?}, 1, {?}, {?}, {?}, NOW(), {?}, {?}, {?}, 'confirmed', {?})", $no_transaction, $user->id(), $ref, $fullref, $montant, $clef, Env::v('comment'), Get::i('display'));
     // We check if it is an Xnet payment and then update the related ML.
     $res = XDB::query('SELECT  eid, asso_id
                          FROM  group_events
                         WHERE  paiement_id = {?}', $ref);
     if ($res->numRows() == 1) {
         list($eid, $asso_id) = $res->fetchOneRow();
         require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
         $evt = get_event_detail($eid, false, $asso_id);
         subscribe_lists_event($user->id(), $evt['short_name'], 1, $montant, true);
     }
     /* on genere le mail de confirmation */
     $conf_text = str_replace(array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>', '<comment>'), array($user->firstName(), $user->lastName(), $user->promo(), $montant, $user->isFemale() ? 'Chère' : 'Cher', $user->isFemale() ? 'Chère' : 'Cher', Env::v('comment')), $conf_text);
     global $globals;
     $mymail = new PlMailer();
     $mymail->setFrom($conf_mail);
     $mymail->addCc($conf_mail);
     $mymail->setSubject($conf_title);
     $mymail->setWikiBody($conf_text);
     $mymail->sendTo($user);
     /* on envoie les details de la transaction à telepaiement@ */
     $mymail = new PlMailer();
     $mymail->setFrom("webmaster@" . $globals->mail->domain);
     $mymail->addTo($globals->money->email);
     $mymail->setSubject($conf_title);
     $msg = 'utilisateur : ' . $user->login() . ' (' . $user->id() . ')' . "\n" . 'mail : ' . $user->forlifeEmail() . "\n\n" . "paiement : {$conf_title} ({$conf_mail})\n" . "reference : {$champ200}\n" . "montant : {$montant}\n\n" . "dump de REQUEST:\n" . var_export($_REQUEST, true);
     $mymail->setTxtBody($msg);
     $mymail->send();
     $page->assign('texte', $conf_text);
     $page->assign('erreur', $erreur);
 }