// '_subscript_'
MiniWiki::Markup(7, "/'_(.*?)_'/",'<sub>$1</sub>','$1');
// {+ underline +}
- MiniWiki::Markup(8, "/{+(.*?)+}/",'<ins>$1</ins>','_$1_');
+ MiniWiki::Markup(8, "/\\{\\+(.*?)\\+\\}/",'<ins>$1</ins>','_$1_');
// {- strikeout -}
- MiniWiki::Markup(9, "/{-(.*?)-}/",'<del>$1</del>','-$1-');
+ MiniWiki::Markup(9, "/\\{-(.*?)-\\}/",'<del>$1</del>','-$1-');
// [+ big +] [++ bigger ++] [+++ even bigger +++] ...
- MiniWiki::Markup(10, '/\\[(([-+])+)(.*?)\\1\\]/e',"'<span style=\'font-size:'.(round(pow(6/5,$2strlen('$1'))*100,0)).'%\'>$3</span>'", "'$3'");
+ MiniWiki::Markup(10, "/\\[(([-+])+)(.*?)\\1\\]/e","'<span style=\'font-size:'.(round(pow(6/5,$2strlen('$1'))*100,0)).'%\'>$3</span>'", "'$3'");
// ----- <hr/>
- MiniWiki::Markup(11, '/(\n|^)----+/s', '$1<hr/>', '$1----'."\n");
+ MiniWiki::Markup(11, "/(\n|^)--(--+| \n)/s", '$1<hr/>', '$1-- '."\n");
// titles
MiniWiki::Markup(12, '/(\n|^)(!+)([^\n]*)/se', "'$1<h'.strlen('$2').'>$3</h'.strlen('$2').'>'", "'$1$3'");
};
MiniWiki::init();
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
return $plmail;
}
- public function run($html)
+ public function run($version)
{
- $this->assign('html_version', $html);
+ $this->assign('mail_part', $version);
$text = $this->fetch($this->tpl);
return $text;
}
private $mail;
private $page = null;
private $charset;
+ private $wiki = null;
function __construct($tpl = null, $charset = "UTF-8")
{
$this->page->register_function($var, $callback);
}
}
+
+ public function setWikiBody($wiki)
+ {
+ $this->wiki = $wiki;
+ }
private function processPage($with_html = true)
{
$level = error_reporting(0);
if (!is_null($this->page)) {
- $this->setTxtBody($this->page->run(false));
- if ($with_html) {
- $html = trim($this->page->run(true));
- if (!empty($html)) {
- $this->setHtmlBody($html);
+ $level = error_reporting(0);
+ $this->page->run('head'); // process page headers
+ $this->wiki = trim($this->page->run('wiki')); // get wiki
+ if (!$this->wiki) {
+ $this->setTxtBody($this->page->run('text'));
+ if ($with_html) {
+ $html = trim($this->page->run('html'));
+ if (!empty($html)) {
+ $this->setHtmlBody($html);
+ }
}
}
+ error_reporting($level);
+ }
+ if ($this->wiki) {
+ $this->setTxtBody(MiniWiki::WikiToText($this->wiki, true, 0, 78));
+ if ($with_html) {
+ $this->setHtmlBody(MiniWiki::WikiToHtml($this->wiki, true));
+ }
}
- error_reporting($level);
}
public function send($with_html = true)
foreach ($files as $name=>&$upload) {
$mymail->addUploadAttachment($upload, $name);
}
- $mymail->setTxtBody(wordwrap($txt, 78, "\n"));
+ if (Env::v('nowiki')) {
+ $mymail->setTxtBody(wordwrap($txt, 78, "\n"));
+ } else {
+ $mymail->setWikiBody($txt);
+ }
if ($mymail->send()) {
$page->trig("Ton mail a bien été envoyé.");
$_REQUEST = array('bcc' => S::v('bestalias').'@'.$globals->mail->domain);
require_once dirname(__FILE__) . '/xnetgrp/mail.inc.php';
$tos = get_all_redirects($mbr, $mls, $mmlist);
$upload = PlUpload::get($_FILES['uploaded'], S::v('forlife'), 'xnet.emails', true);
- send_xnet_mails($from, $sujet, $body, $tos, Post::v('replyto'), $upload, @$_FILES['uploaded']['name']);
+ send_xnet_mails($from, $sujet, $body, Env::v('wiki'), $tos, Post::v('replyto'), $upload, @$_FILES['uploaded']['name']);
if ($upload) {
$upload->rm();
}
// }}}
// {{{ _send_xnet_mail
-function _send_xnet_mail($user, $body, $mailer, $replyto = null)
+function _send_xnet_mail($user, $body, $wiki, $mailer, $replyto = null)
{
$cher = isset($user['sexe']) ? ($user['sexe'] ? 'Chère' : 'Cher') : 'Cher(e)';
$nom = isset($user['nom']) ? $user['nom'] : "";
if ($replyto) {
$mailer->addHeader('Reply-To', $replyto);
}
- $mailer->setTxtBody(wordwrap($text, 72));
+ if ($wiki) {
+ $mailer->setWikiBody($text);
+ } else {
+ $mailer->setTxtBody(wordwrap($text, 72));
+ }
$mailer->send();
}
// }}}
// {{{ send_xnet_mails
-function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null, $upload = null, $name = null)
+function send_xnet_mails($from, $sujet, $body, $wiki, $tos, $replyto = null, $upload = null, $name = null)
{
global $globals;
$sent = array();
foreach ($tos as $user) {
if ($sent[$user['email']]) continue;
- _send_xnet_mail($user, $body, $mailer, $replyto);
+ _send_xnet_mail($user, $body, $wiki, $mailer, $replyto);
$sent[$user['email']] = true;
}
}
{* *}
{**************************************************************************}
-{if !$html_version}
{config_load file="mails.conf" section="intervention_admin"}
+{if $mail_part eq 'head'}
{from full=#from#}
{to addr=#to#}
{subject text="INTERVENTION de $user"}
+{elseif $mail_part eq 'text'}
{$query|regex_replace:"/[ \t]+/":" "}
{/if}
{* vim:set et sw=2 sts=2 sws=2: *}
{* *}
{**************************************************************************}
-{if !$html_version}
-{if $is_mail}
{config_load file="mails.conf" section="mails_ax"}
+{if $mail_part eq 'head'}
{from full=#from#}
{subject text=$am->title(true)}
{if isset(#replyto#)}{add_header name='Reply-To' value=#replyto#}{/if}
{if isset(#retpath#)}{add_header name='Return-Path' value=#retpath#}{/if}
-{else}
+{elseif $mail_part eq 'text'}
+{if !$is_mail}
<pre style="width : 72ex; margin: auto">
{/if}
====================================================================
{if !$is_mail}
</pre>
{/if}
-{else}
+{elseif $mail_part eq 'html'}
{if $is_mail}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
{* *}
{**************************************************************************}
-{if !$html_version}
{config_load file="mails.conf" section="emails_broken"}
+{if $mail_part eq 'head'}
{from full=#from#}
{subject text=#subject#}
+{elseif $mail_part eq 'text'}
Bonjour !
Nous t'écrivons car lors de l'envoi de la lettre d'information mensuelle
<fieldset>
<legend>Sujet : <input type='text' name='sujet' size='60' value="{$smarty.request.sujet}" /></legend>
- <div class="center">Ne mets que du texte dans le contenu, pas de tags HTML</div>
+ <div class="center">
+ Tu peux utiliser des marqueurs <em>wiki</em> pour formatter ton texte.<br />
+ <small><input type="checkbox" name="nowiki" value="1" {if $smarty.request.nowiki}checked="checked"{/if} />
+ coche cette case pour envoyer le mail en texte brut, sans formattage</small>
+ </div>
<textarea name='contenu' rows="30" cols="75">
{$smarty.request.contenu}
{if !$smarty.request.contenu}
{**************************************************************************}
{config_load file="mails.conf" section="forums_promo"}
-{if !$html_version}
+{if $mail_part eq 'head'}
{from full=#from#}
{to addr=#to#}
{subject text="Création du forum promo $promo"}
+{elseif $mail_part eq 'text'}
Création du forum promo {$promo} à faire !
(+ de 20% d'inscrits)
{/if}
+
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{**************************************************************************}
{config_load file="mails.conf" section="listes_promo"}
-{if !$html_version}
+{if $mail_part eq 'head'}
{from full=#from#}
{to addr=#to#}
{subject text="Création de la liste promo $promo"}
+{elseif $mail_part eq 'text'}
Création de la liste promo {$promo} à faire !
{/if}
{**************************************************************************}
{config_load file="mails.conf" section="marketing_relance"}
-{if !$html_version}
+{if $mail_part eq 'head'}
{subject text="$subj"}
{from full=#from#}
{to addr="$lemail"}
+{elseif $mail_part eq 'text'}
Bonjour,
Il y a quelques temps, le {$fdate}, tu as commencé ton inscription à Polytechnique.org ! Tu n'as toutefois pas tout à fait terminé cette inscription, aussi nous nous permettons de te renvoyer cet email pour te rappeler tes paramètres de connexion, au cas où tu souhaiterais terminer cette inscription, et accéder à l'ensemble des services que nous offrons aux {$nbdix} Polytechniciens déjà inscrits (email à vie, annuaire en ligne, etc...).
{* *}
{**************************************************************************}
-{if !$html_version}
-{if $is_mail}
{config_load file="mails.conf" section="newsletter"}
+{if $mail_part eq 'head'}
{from full=#from#}
{subject text=$nl->title(true)}
{if isset(#replyto#)}{add_header name='Reply-To' value=#replyto#}{/if}
{if isset(#retpath#)}{add_header name='Return-Path' value=#retpath#}{/if}
-{else}
+{elseif $mail_part eq 'html'}
+{if !$is_mail}
<pre style="width : 72ex; margin: auto">
{/if}
====================================================================
{if !$is_mail}
</pre>
{/if}
-{else}
+{elseif $mail_part eq 'html'}
{if $is_mail}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
{**************************************************************************}
{config_load file="mails.conf" section="inscription"}
-{if !$html_version}
+{if $mail_part eq 'head'}
{from full=#from#}
{to addr="$forlife@polytechnique.org"}
{subject text="Bienvenue parmi les X sur le web !"}
+{elseif $mail_par eq 'text'}
-{$prenom}, félicitations pour ton inscription :o))
+{$prenom}, félicitations pour ton inscription !
N'oublie pas de changer ton mot de passe sur le site. C'est très important
si tu veux garder accès au site et ton e-mail en fonction.
{**************************************************************************}
{config_load file="mails.conf" section="inscrire"}
-{if !$html_version}
+{if $mail_part eq 'head'}
{subject text="$subj"}
{from full=#from#}
{to addr="$lemail"}
+{elseif $mail_part eq 'text'}
Bonjour,
Ton inscription sur Polytechnique.org est presque terminée, un clic sur le lien ci-dessous et c'est fini.
<td><input type="text" name="sujet" value="{$smarty.request.sujet|default:"remplir le sujet ..."}" size=55 maxlength=70></td>
</tr>
<tr>
+ <td colspan="2" class="smaller">
+ <input type="checkbox" name="wiki" value="1" checked="1" />
+ activer la syntaxe wiki pour le formattage du message
+ </td>
+ </tr>
+ <tr>
<td colspan="2" class="center">
<textarea name="body" cols="72" rows="25">
{if $smarty.request.body}