Changeset 118109 in spip-zone


Ignore:
Timestamp:
Oct 10, 2019, 3:21:10 PM (12 months ago)
Author:
cedric@…
Message:

Quand on cherche les infos d'un subscriber mais qu'il y a doublon en base, nettoyer la base en mettant l'obfusque a la poubelle et en reportant les subscriptions sur le valide

Location:
_plugins_/mailsubscribers/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/mailsubscribers/trunk/formulaires/editer_email_subscription.php

    r100422 r118109  
    3434        $subscriber = charger_fonction('subscriber', 'newsletter');
    3535        $infos = $subscriber($email);
     36
    3637        if ($infos and isset($infos['subscriptions'])) {
    37                 $valeurs['_id_mailsubscriber'] = sql_getfetsel('id_mailsubscriber', 'spip_mailsubscribers',
    38                         'email=' . sql_quote($email) . " OR email=" . sql_quote(mailsubscribers_obfusquer_email($email)));
     38                $valeurs['_id_mailsubscriber'] = parametre_url($infos['url_admin'], 'id_mailsubscriber');
    3939                foreach ($infos['subscriptions'] as $sub) {
    4040                        if ($sub['status'] !== 'off') {
  • _plugins_/mailsubscribers/trunk/inc/mailsubscribers.php

    r115355 r118109  
    145145    if (!$force and defined('_MAILSUBSCRIBERS_GARDER_EMAILENCLAIR') ) {
    146146            return $email;
     147    }
     148    // on ne double pas l'obfusquation
     149    if (strpos($email, "@example.org") !== false) {
     150        return $email;
    147151    }
    148152
  • _plugins_/mailsubscribers/trunk/newsletter/subscriber.php

    r112995 r118109  
    3535
    3636        // chercher si un tel email est deja en base
    37         $infos = sql_fetsel("email,nom,'' as listes,lang,'' as status,jeton,id_mailsubscriber", 'spip_mailsubscribers',
    38                 'email=' . sql_quote($email) . " OR email=" . sql_quote(mailsubscribers_obfusquer_email($email)));
     37        // on utilise sql_allfetsel car normalement on a 0 ou 1 resultat, sauf en cas de doublon email+obfusque -> 2 resultats
     38        $infos_all = sql_allfetsel("email,nom,'' as listes,lang,'' as status,jeton,id_mailsubscriber", 'spip_mailsubscribers',
     39                'statut!=\'poubelle\' AND (email=' . sql_quote($email) . " OR email=" . sql_quote(mailsubscribers_obfusquer_email($email)).')');
     40        $infos = ($infos_all ? reset($infos_all) : false);
     41        if (count($infos_all) > 1) {
     42                $mailsubscribers_fusionner_doublons = charger_fonction('mailsubscribers_fusionner_doublons', 'action');
     43                $infos = $mailsubscribers_fusionner_doublons($email, $infos_all);
     44        }
    3945        if ($infos) {
    4046                $id_mailsubscriber = $infos['id_mailsubscriber'];
  • _plugins_/mailsubscribers/trunk/paquet.xml

    r117637 r118109  
    22        prefix="mailsubscribers"
    33        categorie="communication"
    4         version="2.12.0"
     4        version="2.12.1"
    55        etat="stable"
    66        compatibilite="[3.0.0;3.2.*]"
Note: See TracChangeset for help on using the changeset viewer.