Exemple #1
0
 function check($action, $email)
 {
     global $db, $nl_config, $lang;
     //
     // Vérification syntaxique de l'email
     //
     if (!Mailer::validate_email($email)) {
         return array('error' => true, 'message' => $lang['Message']['Invalid_email']);
     }
     //
     // Vérification de la liste des masques de bannissements
     //
     if ($action == 'inscription') {
         $sql = "SELECT ban_email\n\t\t\t\tFROM " . BANLIST_TABLE . "\n\t\t\t\tWHERE liste_id = " . $this->listdata['liste_id'];
         if ($result = $db->query($sql)) {
             while ($ban_email = $result->column('ban_email')) {
                 if (preg_match('/\\b' . str_replace('*', '.*?', $ban_email) . '\\b/i', $email)) {
                     return array('error' => true, 'message' => $lang['Message']['Email_banned']);
                 }
             }
         }
     }
     $sql = "SELECT a.abo_id, a.abo_pseudo, a.abo_pwd, a.abo_email, a.abo_lang,\n\t\t\t\ta.abo_status, al.format, al.register_key, al.register_date, al.confirmed\n\t\t\tFROM " . ABONNES_TABLE . " AS a\n\t\t\t\tLEFT JOIN " . ABO_LISTE_TABLE . " AS al ON al.abo_id = a.abo_id\n\t\t\t\t\tAND al.liste_id = {$this->listdata['liste_id']}\n\t\t\tWHERE LOWER(a.abo_email) = '" . $db->escape(strtolower($email)) . "'";
     if (!($result = $db->query($sql))) {
         return array('error' => true, 'message' => 'Impossible de tester les tables d\'inscriptions');
     }
     if ($abodata = $result->fetch()) {
         if (!is_null($abodata['confirmed'])) {
             if ($action == 'inscription' && $abodata['confirmed'] == SUBSCRIBE_CONFIRMED) {
                 return array('error' => true, 'message' => $lang['Message']['Allready_reg']);
             } else {
                 if ($action == 'desinscription' && $abodata['confirmed'] == SUBSCRIBE_NOT_CONFIRMED) {
                     return array('error' => true, 'message' => $lang['Message']['Unknown_email']);
                 }
             }
         } else {
             if ($action != 'inscription') {
                 return array('error' => true, 'message' => $lang['Message']['Unknown_email']);
             }
         }
     } else {
         if ($action != 'inscription') {
             return array('error' => true, 'message' => $lang['Message']['Unknown_email']);
         }
     }
     if ($nl_config['check_email_mx'] && $abodata == false) {
         //
         // Vérification de l'existence d'un Mail eXchanger sur le domaine de l'email,
         // et vérification de l'existence du compte associé (La vérification de l'existence du
         // compte n'est toutefois pas infaillible, les serveurs smtp refusant parfois le relaying,
         // c'est à dire de traiter les demandes émanant d'un entité extérieure à leur réseau, et
         // pour une adresse email extérieure à ce réseau)
         //
         if (!$this->mailer->validate_email_mx($email, $response)) {
             return array('error' => true, 'message' => sprintf($lang['Message']['Unrecognized_email'], $response));
         }
     }
     if (is_array($abodata)) {
         $this->hasAccount = true;
         $this->isRegistered = !is_null($abodata['confirmed']);
         $this->account['abo_id'] = $abodata['abo_id'];
         $this->account['email'] = $abodata['abo_email'];
         $this->account['pseudo'] = $abodata['abo_pseudo'];
         $this->account['status'] = $abodata['abo_status'];
     } else {
         $this->hasAccount = false;
         $this->account['abo_id'] = 0;
         $this->account['email'] = $email;
         $this->account['pseudo'] = !empty($_REQUEST['pseudo']) ? $_REQUEST['pseudo'] : '';
         $this->account['status'] = $this->listdata['confirm_subscribe'] == CONFIRM_NONE ? ABO_ACTIF : ABO_INACTIF;
     }
     if ($this->isRegistered) {
         $this->account['code'] = $abodata['register_key'];
         $this->account['date'] = $abodata['register_date'];
         $this->account['format'] = $abodata['format'];
     } else {
         $this->account['code'] = generate_key(20);
         $this->account['date'] = time();
         $this->account['format'] = $this->format;
     }
     return array('error' => false, 'abodata' => $abodata);
 }
Exemple #2
0
     $msg_error[] = $lang['Invalid_liste_name'];
 }
 if (!in_array($liste_format, array(FORMAT_TEXTE, FORMAT_HTML, FORMAT_MULTIPLE))) {
     $error = TRUE;
     $msg_error[] = $lang['Unknown_format'];
 }
 require WAMAILER_DIR . '/class.mailer.php';
 if (Mailer::validate_email($sender_email) == false) {
     $error = TRUE;
     $msg_error[] = $lang['Message']['Invalid_email'];
 }
 if (!empty($return_email) && Mailer::validate_email($return_email) == false) {
     $error = TRUE;
     $msg_error[] = $lang['Message']['Invalid_email'];
 }
 if (!empty($liste_alias) && Mailer::validate_email($liste_alias) == false) {
     $error = TRUE;
     $msg_error[] = $lang['Message']['Invalid_email'];
 }
 if (empty($pop_pass) && $action == 'edit') {
     $pop_pass = $listdata['pop_pass'];
 }
 if ($use_cron && function_exists('fsockopen')) {
     require WAMAILER_DIR . '/class.pop.php';
     $pop = new Pop();
     $result = $pop->connect($pop_host, $pop_port, $pop_user, $pop_pass);
     if (!$result) {
         $error = TRUE;
         $msg_error[] = sprintf(nl2br($lang['Message']['bad_pop_param']), htmlspecialchars($pop->msg_error));
     } else {
         $pop->quit();
Exemple #3
0
     $msg_error[] = $lang['Message']['Error_login'];
 }
 $set_password = FALSE;
 if ($admin_id != $admindata['admin_id'] && $new_pass != '' || $current_pass != '') {
     if (!validate_pass($new_pass)) {
         $error = TRUE;
         $msg_error[] = $lang['Message']['Alphanum_pass'];
     } else {
         if ($new_pass != $confirm_pass) {
             $error = TRUE;
             $msg_error[] = $lang['Message']['Bad_confirm_pass'];
         }
     }
     $set_password = TRUE;
 }
 if (Mailer::validate_email($email) == false) {
     $error = TRUE;
     $msg_error[] = $lang['Message']['Invalid_email'];
 }
 if (!$error) {
     $sql_data = array('admin_email' => $email, 'admin_dateformat' => $dateformat, 'admin_lang' => $language, 'email_new_subscribe' => $email_new_subscribe, 'email_unsubscribe' => $email_unsubscribe);
     if ($set_password) {
         $sql_data['admin_pwd'] = md5($new_pass);
     }
     if ($admindata['admin_level'] == ADMIN && $admin_id != $admindata['admin_id'] && !empty($_POST['admin_level'])) {
         $sql_data['admin_level'] = $_POST['admin_level'] == ADMIN ? ADMIN : USER;
     }
     if (!$db->build(SQL_UPDATE, ADMIN_TABLE, $sql_data, array('admin_id' => $admin_id))) {
         trigger_error('Impossible de mettre le profil à jour', ERROR);
     }
     if ($admindata['admin_level'] == ADMIN) {