[SPIP] +2.1.12
[velocampus/web/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 if (!defined('_ECRIRE_INC_VERSION')) return;
10
11 // Fonction appelee par divers pipelines
12 // http://doc.spip.org/@notifications_instituerarticle_dist
13 function notifications_instituerarticle_dist($quoi, $id_article, $options) {
14
15 // ne devrait jamais se produire
16 if ($options['statut'] == $options['statut_ancien']) {
17 spip_log("statut inchange",'notifications');
18 return;
19 }
20
21 include_spip('inc/texte');
22
23 $modele = "";
24 if ($options['statut'] == 'publie') {
25 if ($GLOBALS['meta']["post_dates"]=='non'
26 AND strtotime($options['date'])>time())
27 $modele = "notifications/article_valide";
28 else
29 $modele = "notifications/article_publie";
30 }
31
32 if ($options['statut'] == 'prop' AND $options['statut_ancien'] != 'publie')
33 $modele = "notifications/article_propose";
34
35 if ($modele){
36 $destinataires = array();
37 if ($GLOBALS['meta']["suivi_edito"] == "oui")
38 $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]);
39
40
41 $destinataires = pipeline('notifications_destinataires',
42 array(
43 'args'=>array('quoi'=>$quoi,'id'=>$id_article,'options'=>$options)
44 ,
45 'data'=>$destinataires)
46 );
47
48 $texte = email_notification_article($id_article, $modele);
49 notifications_envoyer_mails($destinataires, $texte);
50 }
51 }
52
53 ?>