* */ if(!defined('SACoche')) {exit('Ce fichier ne peut être appelé directement !');} if($_SESSION['SESAMATH_ID']==ID_DEMO) {exit('Action désactivée pour la démo...');} $action = (isset($_POST['f_action'])) ? Clean::texte($_POST['f_action']) : ''; $notification_id = (isset($_POST['f_id'])) ? Clean::entier($_POST['f_id']) : 0; // //////////////////////////////////////////////////////////////////////////////////////////////////// // Mémoriser qu'une notification a été consultée // //////////////////////////////////////////////////////////////////////////////////////////////////// if( ($action=='memoriser_consultation') && $notification_id ) { $is_modif = DB_STRUCTURE_NOTIFICATION::DB_modifier_statut( $notification_id , $_SESSION['USER_ID'] , 'consultée' ); // Afficher le retour if($is_modif) { exit_json( TRUE ); } else { exit_json( FALSE , 'Erreur : notification non trouvée ou pas associée à ce compte !' ); } } // //////////////////////////////////////////////////////////////////////////////////////////////////// // On ne devrait pas en arriver là ! // ////////////////////////////////////////////////////////////////////////////////////////////////////
/** * Envoyer ou rendre disponibles les notifications en attente. * * @param void * @return void */ public static function envoyer_notifications() { $DB_TAB = DB_STRUCTURE_NOTIFICATION::DB_lister_notifications_a_publier(); if (!empty($DB_TAB)) { foreach ($DB_TAB as $DB_ROW) { $notification_statut = COURRIEL_NOTIFICATION == 'oui' && $DB_ROW['jointure_mode'] == 'courriel' && $DB_ROW['user_email'] ? 'envoyée' : 'consultable'; DB_STRUCTURE_NOTIFICATION::DB_modifier_statut($DB_ROW['notification_id'], $DB_ROW['user_id'], $notification_statut); if ($notification_statut == 'envoyée') { $mail_user = $DB_ROW['user_prenom'] . ' ' . $DB_ROW['user_nom'] . ' <' . $DB_ROW['user_email'] . '>'; $mail_objet = 'Notification - ' . $DB_ROW['abonnement_objet']; $mail_contenu = $DB_ROW['notification_contenu'] . Sesamail::texte_pied_courriel(array('no_reply', 'notif_individuelle', 'signature'), $DB_ROW['user_email']); $courriel_bilan = Sesamail::mail($mail_user, $mail_objet, $mail_contenu, $mail_user); } } } }