[SPIP] +spip v3.0.17
[lhc/web/clavette_www.git] / www / ecrire / notifications / instituerarticle.php
1 <?php
2 /*
3 * Plugin Notifications
4 * (c) 2009 SPIP
5 * Distribue sous licence GPL
6 *
7 */
8
9
10 if (!defined('_ECRIRE_INC_VERSION')) return;
11
12 // Fonction appelee par divers pipelines
13 // http://doc.spip.org/@notifications_instituerarticle_dist
14 function notifications_instituerarticle_dist($quoi, $id_article, $options) {
15
16 // ne devrait jamais se produire
17 if ($options['statut'] == $options['statut_ancien']) {
18 spip_log("statut inchange",'notifications');
19 return;
20 }
21
22 include_spip('inc/texte');
23
24 $modele = "";
25 if ($options['statut'] == 'publie') {
26 if ($GLOBALS['meta']["post_dates"]=='non'
27 AND strtotime($options['date'])>time())
28 $modele = "notifications/article_valide";
29 else
30 $modele = "notifications/article_publie";
31 }
32
33 if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie')
34 $modele = "notifications/article_propose";
35
36 if ($modele){
37 $destinataires = array();
38 if ($GLOBALS['meta']["suivi_edito"] == "oui")
39 $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]);
40
41
42 $destinataires = pipeline('notifications_destinataires',
43 array(
44 'args'=>array('quoi'=>$quoi,'id'=>$id_article,'options'=>$options)
45 ,
46 'data'=>$destinataires)
47 );
48
49 $texte = email_notification_article($id_article, $modele);
50 notifications_envoyer_mails($destinataires, $texte);
51 }
52 }
53
54 ?>