* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: newsletter_pattecassee.php,v 1.5 2004-09-02 23:33:56 x2000bedo Exp $
+ $Id: newsletter_pattecassee.php,v 1.6 2004-11-22 07:40:16 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
}
-require("tpl.mailer.inc.php");
+require("xorg.mailer.inc.php");
if (array_key_exists('email', $_GET) && array_key_exists('action', $_GET)) {
$email = valide_email($_GET['email']);
INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type='a_vie')
WHERE e.email='$email'");
- $mailer = new TplMailer('templates/mails/pattecasser.nl.tpl');
+ $mailer = new XOrgMailer('templates/mails/pattecasser.nl.tpl');
$mailer->assign('email', $email);
if (list($dest) = mysql_fetch_row($sel)) {
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: step3.php,v 1.4 2004-11-21 23:35:31 x2000habouzit Exp $
+ $Id: step3.php,v 1.5 2004-11-22 07:40:16 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
if(isset($_REQUEST['envoidirect']))
$globals->db->query("UPDATE envoidirect SET date_succes=NOW() WHERE uid='{$_REQUEST['envoidirect']}'");
-require("tpl.mailer.inc.php");
-$mymail = new TplMailer('inscrire.mail.tpl');
+require("xorg.mailer.inc.php");
+$mymail = new XOrgMailer('inscrire.mail.tpl');
$mymail->assign('forlife',$forlife);
$mymail->assign('lemail',$_REQUEST['email']);
$mymail->assign('pass_clair',$pass_clair);
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: step4.php,v 1.16 2004-11-21 23:35:31 x2000habouzit Exp $
+ $Id: step4.php,v 1.17 2004-11-22 07:40:16 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
new_skinned_page('inscription/step4.tpl', AUTH_PUBLIC);
require("user.func.inc.php");
-require('tpl.mailer.inc.php');
+require('xorg.mailer.inc.php');
define("ERROR_REF", 1);
define("ERROR_ALREADY_SUBSCRIBED", 2);
INNER JOIN aliases AS a ON ( a.id = e.sender AND a.type='a_vie' )
WHERE e.matricule = '$matricule'");
while (list($sender_usern, $sender_date) = mysql_fetch_row($res)) {
- $mymail = new TplMailer('marketing.thanks.tpl');
+ $mymail = new XOrgMailer('marketing.thanks.tpl');
$mymail->assign('to', $sender_usern);
$mymail->assign('prenom', $prenom);
$mymail->assign('nom',$nom);
$globals->db->query("insert into user_changes ($uid)");
// envoi du mail à l'inscrit
- $mymail = new TplMailer('inscription.reussie.tpl');
+ $mymail = new XOrgMailer('inscription.reussie.tpl');
$mymail->assign('forlife', $forlife);
$mymail->assign('prenom', $prenom);
$mymail->send();
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: relance.php,v 1.5 2004-11-21 23:35:32 x2000habouzit Exp $
+ $Id: relance.php,v 1.6 2004-11-22 07:40:17 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
/* une relance a été demandée - on envoit les mails correspondants */
if (isset($_POST["relancer"]) && isset($_POST["relancer"]) != "") {
- require("tpl.mailer.inc.php");
+ require("xorg.mailer.inc.php");
$res=$globals->db->query("SELECT COUNT(*) FROM auth_user_md5");
$lpass = md5($nveau_pass);
$fdate = substr($ldate, 8, 2)."/".substr($ldate, 5, 2)."/".substr($ldate, 0, 4);
- $mymail = new TplMailer('marketing.relance.tpl');
+ $mymail = new XOrgMailer('marketing.relance.tpl');
$mymail->assign('nbdix',$nbdix);
$mymail->assign('fdate',$fdate);
$mymail->assign('lusername',$lusername);
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: utilisateurs_marketing.php,v 1.11 2004-11-21 23:35:32 x2000habouzit Exp $
+ $Id: utilisateurs_marketing.php,v 1.12 2004-11-22 07:40:17 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
// pas d'erreur pour l'insert
// envoi du mail à l'utilisateur
- require('tpl.mailer.inc.php');
- $mymail = new TplMailer('marketing.utilisateur.tpl');
+ require('xorg.mailer.inc.php');
+ $mymail = new XOrgMailer('marketing.utilisateur.tpl');
$mymail->assign('from', $_REQUEST["from"]);
$mymail->assign('to', stripslashes($_REQUEST["mail"]));
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: user.func.inc.php,v 1.4 2004-11-18 17:39:10 x2000habouzit Exp $
+ $Id: user.func.inc.php,v 1.5 2004-11-22 07:40:17 x2000habouzit Exp $
***************************************************************************/
-
+// {{{ function user_clear_all_subs()
/** kills the inscription of a user.
* we still keep his birthdate, adresses, and personnal stuff
* kills the entreprises, mentor, emails and lists subscription stuff
*/
-function user_clear_all_subs($user_id, $really_del=true) {
+function user_clear_all_subs($user_id, $really_del=true)
+{
// keep datas in : aliases, adresses, applis_ins, binets_ins, contacts, groupesx_ins, homonymes, identification_ax, photo
// delete in : auth_user_md5, auth_user_quick, competences_ins, emails, entreprises, langues_ins, mentor,
// mentor_pays, mentor_secteurs, newsletter_ins, perte_pass, requests, user_changes, virtual_redirect, watch_sub
list($alias) = mysql_fetch_row($res);
mysql_free_result($res);
- if($really_del) {
+ if ($really_del) {
$globals->db->query("delete from emails where uid=$uid");
$globals->db->query("delete from newsletter_ins where user_id=$uid");
}
$client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
$client->kill($alias, $really_del);
}
-
+
+// }}}
+// {{{ function inscription_forum_promo()
+
/** inscrit l'uid donnée au forum promo
* @param $uid UID
* @param $promo promo
* @return la reponse MySQL
* @see step4.php
*/
-function inscription_forum_promo($uid,$promo) {
+function inscription_forum_promo($uid,$promo)
+{
global $globals;
// récupération de l'id du forum promo
$result=$globals->db->query("SELECT fid FROM forums.list WHERE nom='xorg.promo.x$promo'");
$req_id=$globals->db->query("SELECT count(*) FROM auth_user_md5 WHERE promo='$promo'");
list($effid) = mysql_fetch_row($req_id);
if (5*$effau>$effid) { // + de 20% d'inscrits
- require_once("tpl.mailer.inc.php");
- $mymail = new TplMailer('forums.promo.tpl');
+ require_once("xorg.mailer.inc.php");
+ $mymail = new XOrgMailer('forums.promo.tpl');
$mymail->assign('promo', $promo);
$mymail->send();
}
return $res;
}
+// }}}
+// {{{ function inscription_forums()
+
/** inscrit UID aux forums par défaut
* @param $uid UID
* @return la reponse MySQL globale
* @see step4.php
*/
-function inscription_forums($uid) {
+function inscription_forums($uid)
+{
global $globals;
$res = true;
$cible = array('xorg.general','xorg.pa.emploi','xorg.pa.divers','xorg.pa.logements');
return $res;
}
+// }}}
+// {{{ function inscription_listes_base()
/** inscrit l'uid donnée à la promo
* @param $uid UID
* @see admin/RegisterNewUser.php
* @see step4.php
*/
-function inscription_listes_base($uid,$pass,$promo) {
+function inscription_listes_base($uid,$pass,$promo)
+{
require_once('xml-rpc-client.inc.php');
require_once('newsletter.inc.php');
global $globals;
subscribe_nl();
}
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: aliases.inc.php,v 1.1 2004-11-22 07:24:56 x2000habouzit Exp $
+ $Id: aliases.inc.php,v 1.2 2004-11-22 07:40:18 x2000habouzit Exp $
***************************************************************************/
// {{{ class AliasReq
return false;
}
- require_once("tpl.mailer.inc.php");
- $mymail = new TplMailer('valid.alias.tpl');
+ require_once("xorg.mailer.inc.php");
+ $mymail = new XOrgMailer('valid.alias.tpl');
$mymail->assign('alias', $this->alias);
$mymail->assign('bestalias', $this->bestalias);
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: epouses.inc.php,v 1.1 2004-11-22 07:24:56 x2000habouzit Exp $
+ $Id: epouses.inc.php,v 1.2 2004-11-22 07:40:18 x2000habouzit Exp $
***************************************************************************/
// {{{ class EpouseReq
return false;
}
- require_once("tpl.mailer.inc.php");
- $mymail = new TplMailer('valid.epouses.tpl');
+ require_once("xorg.mailer.inc.php");
+ $mymail = new XOrgMailer('valid.epouses.tpl');
$mymail->assign('forlife', $this->forlife);
if ($_REQUEST['submit']=="Accepter") {
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: evts.inc.php,v 1.1 2004-11-22 07:24:56 x2000habouzit Exp $
+ $Id: evts.inc.php,v 1.2 2004-11-22 07:40:18 x2000habouzit Exp $
***************************************************************************/
// {{{ class EvtReq
{
global $globals;
if (isset($_POST['action'])) {
- require("tpl.mailer.inc.php");
- $mymail = new TplMailer('valid.evts.tpl');
+ require("xorg.mailer.inc.php");
+ $mymail = new XOrgMailer('valid.evts.tpl');
$mymail->assign('bestalias',$this->bestalias);
$mymail->assign('titre',$this->titre);
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: listes.inc.php,v 1.1 2004-11-22 07:24:56 x2000habouzit Exp $
+ $Id: listes.inc.php,v 1.2 2004-11-22 07:40:18 x2000habouzit Exp $
***************************************************************************/
// {{{ class ListeReq
return false;
}
- require_once("tpl.mailer.inc.php");
- $mymail = new TplMailer('valid.liste.tpl');
+ require_once("xorg.mailer.inc.php");
+ $mymail = new XOrgMailer('valid.liste.tpl');
$mymail->assign('alias', $this->liste);
$mymail->assign('bestalias', $this->bestalias);
$mymail->assign('motif', stripslashes($_REQUEST['motif']));
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: photos.inc.php,v 1.1 2004-11-22 07:24:56 x2000habouzit Exp $
+ $Id: photos.inc.php,v 1.2 2004-11-22 07:40:18 x2000habouzit Exp $
***************************************************************************/
// {{{ class PhotoReq
return false;
}
- require_once("tpl.mailer.inc.php");
- $mymail = new TplMailer('valid.photos.tpl');
+ require_once("xorg.mailer.inc.php");
+ $mymail = new XOrgMailer('valid.photos.tpl');
$mymail->assign('bestalias', $this->bestalias);
if ($_REQUEST['submit']=="Accepter") {
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: tpl.mailer.inc.php,v 1.5 2004-11-16 20:59:06 x2000habouzit Exp $
+ $Id: xorg.mailer.inc.php,v 1.1 2004-11-22 07:40:17 x2000habouzit Exp $
***************************************************************************/
require_once("diogenes.hermes.inc.php");
require_once("Smarty.class.php");
+// {{{ class XOrgMailer
+
/** Classe de mail avec corps en templates.
*/
-class TplMailer extends Smarty {
+class XOrgMailer extends Smarty
+{
+ // {{{ properties
+
/** Directory used to store mails_templates.
* Smarty::template_dir subdir used to sotre the mails templates.
* The body of the message is taken from a tsmarty template
var $_bcc = Array();
/** stores the subject of the mail */
var $_subject;
+
+ // }}}
+ // {{{ constructor
- function TplMailer($tpl) {
+ function TplMailer($tpl)
+ {
global $globals;
$this->_tpl = $tpl;
$this->caching=false;
$this->register_function('subject', 'set_subject');
}
- function send() {
+ // }}}
+ // {{{ function send()
+
+ function send()
+ {
// do not try to optimize, in the templates, some function can modify our object, then we
// have to fetch in the first time, and only then send the mail.
$body = $this->fetch($this->mail_dir."/".$this->_tpl);
$mailer->setFrom($this->_from);
$mailer->addTo(implode(',',$this->_to));
$mailer->setSubject($this->_subject);
- if (!empty($this->_cc)) $mailer->addCc(implode(',',$this->_cc));
- if (!empty($this->_bcc)) $mailer->addBcc(implode(',',$this->_bcc));
+ if (!empty($this->_cc)) {
+ $mailer->addCc(implode(',',$this->_cc));
+ }
+ if (!empty($this->_bcc)) {
+ $mailer->addBcc(implode(',',$this->_bcc));
+ }
$mailer->setTxtBody($body);
$mailer->send();
}
+
+ // }}}
}
+// }}}
+// {{{ function mail_format()
+
/** used to remove the empty lines due to {from ...}, {to ...} ... functions */
-function mail_format($output, &$smarty) {
+function mail_format($output, &$smarty)
+{
return wordwrap("\n".trim($output)."\n",75);
}
-function format_addr(&$params) {
- if(isset($params['full']))
+// }}}
+// {{{ function format_addr()
+
+function format_addr(&$params)
+{
+ if (isset($params['full'])) {
return $params['full'];
- if(empty($params['text']))
+ } elseif (empty($params['text'])) {
return $params['addr'];
- else
+ } else {
return $params['text'].' <'.$params['addr'].'>';
+ }
}
+// }}}
+// {{{ function set_from()
+
/** template function : from.
* {from full=...} for an already formatted address
* {from addr=... [text=...]} else
*/
-function set_from($params, &$smarty) { $smarty->_from = format_addr($params); }
+function set_from($params, &$smarty)
+{ $smarty->_from = format_addr($params); }
+
+// }}}
+// {{{ function set_to()
+
/** template function : to.
* {to full=...} for an already formatted address
* {to addr=... [text=...]} else
*/
-function set_to($params, &$smarty) { $smarty->_to[] = format_addr($params); }
+function set_to($params, &$smarty)
+{ $smarty->_to[] = format_addr($params); }
+
+// }}}
+// {{{ function set_cc()
+
/** template function : cc.
* {cc full=...} for an already formatted address
* {cc addr=... [text=...]} else
*/
-function set_cc($params, &$smarty) { $smarty->_cc[] = format_addr($params); }
+function set_cc($params, &$smarty)
+{ $smarty->_cc[] = format_addr($params); }
+
+// }}}
+// {{{ function set_bcc()
+
/** template function : bcc.
* {bcc full=...} for an already formatted address
* {bcc addr=... [text=...]} else
*/
-function set_bcc($params, &$smarty) { $smarty->_bcc[] = format_addr($params); }
+function set_bcc($params, &$smarty)
+{ $smarty->_bcc[] = format_addr($params); }
+
+// }}}
+// {{{ function set_subject()
+
/** template function : subject.
* {subject text=...}
*/
-function set_subject($params, &$smarty) {
+function set_subject($params, &$smarty)
+{
$smarty->_subject = $params['text'];
}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
?>