[PLUGINS] ~maj globale
[lhc/web/www.git] / www / plugins / notifications2 / notifications / instituerarticle.php
1 <?php
2 /*
3 * Plugin Notifications
4 * (c) 2009-2012 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 ($options['statut'] == 'refuse' AND in_array($options['statut_ancien'],array('prop','publie'))) {
36 $modele = "notifications/article_refuse";
37 }
38
39 if ($modele){
40 $destinataires = array();
41 if ($GLOBALS['meta']["suivi_edito"] == "oui")
42 $destinataires = explode(',',$GLOBALS['meta']["adresse_suivi"]);
43
44
45 $destinataires = pipeline('notifications_destinataires',
46 array(
47 'args'=>array('quoi'=>$quoi,'id'=>$id_article,'options'=>$options)
48 ,
49 'data'=>$destinataires)
50 );
51
52 $texte = email_notification_objet($id_article, "article", $modele);
53 notifications_envoyer_mails($destinataires, $texte);
54 }
55 }
56
57 ?>