Ejemplo n.º 1
0
 /**
  * Setter
  *
  * @param string $name  Property name
  * @param mixed  $value Property value
  *
  * @return void
  */
 public function __set($name, $value)
 {
     $rname = '_' . $name;
     switch ($name) {
         case 'type':
             if ($value === self::IMPENDING || $value === self::LATE) {
                 $this->_type = $value;
             } else {
                 throw new \UnexpectedValueException('Unknown type!');
             }
             break;
         case 'dest':
             if ($this->_type !== null && $value instanceof Adherent) {
                 $this->_dest = $value;
                 $this->_replaces['login_adh'] = $value->login;
                 $this->_replaces['name_adh'] = custom_html_entity_decode($value->sname);
                 $this->_replaces['firstname_adh'] = custom_html_entity_decode($value->surname);
                 $this->_replaces['lastname_adh'] = custom_html_entity_decode($value->name);
                 if ($value->email != '') {
                     $this->_nomail = false;
                 }
                 if ($this->_type === self::LATE) {
                     $this->_replaces['days_expired'] = $value->days_remaining * -1;
                 }
                 if ($this->_type === self::IMPENDING) {
                     $this->_replaces['days_remaining'] = $value->days_remaining;
                 }
             } else {
                 if (!$value instanceof Adherent) {
                     throw new \UnexpectedValueException('Please provide a member object.');
                 } else {
                     throw new \UnderflowException('Please set reminder type first.');
                 }
             }
             break;
         default:
             Analog::log('Unable to set property ' . $name, Analog::WARNING);
             break;
     }
 }
Ejemplo n.º 2
0
 //$adherent['id_adh'] = get_last_auto_increment($DB, PREFIX_DB."adherents", "id_adh");
 // il est temps d'envoyer un mail
 if ($adherent['email_adh'] != "") {
     //$mail_headers = "From: ".PREF_EMAIL_NOM." <".PREF_EMAIL.">\nContent-Type: text/plain; charset=iso-8859-15\n";
     $mail_subject = _T("Your Galette identifiers");
     $mail_text = _T("Hello,") . "\n";
     $mail_text .= "\n";
     $mail_text .= _T("You've just been subscribed on the members management system of the association.") . "\n";
     $mail_text .= _T("It is now possible to follow in real time the state of your subscription") . "\n";
     $mail_text .= _T("and to update your preferences from the web interface.") . "\n";
     $mail_text .= "\n";
     $mail_text .= _T("Please login at this address:") . "\n";
     $mail_text .= "http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER["REQUEST_URI"]) . "\n";
     $mail_text .= "\n";
     $mail_text .= _T("Username:"******" " . custom_html_entity_decode($adherent['login_adh']) . "\n";
     $mail_text .= _T("Password:"******" " . custom_html_entity_decode($adherent['mdp_adh_plain']) . "\n";
     $mail_text .= "\n";
     $mail_text .= _T("See you soon!") . "\n";
     $mail_text .= "\n";
     $mail_text .= _T("(this mail was sent automatically)") . "\n";
     /** For debug **/
     //echo "mail content (send to ".$_POST['email_adh']." with subject '".$mail_subject."') will be :<br />".$mail_text."<br />";
     $mail_result = custom_mail($_POST['email_adh'], $mail_subject, $mail_text);
     /** TODO
      * Send email to admin(s?) to inform a new account has been created.
      * Btw, emailing admin(s?) should be added in the preferences
      */
     if ($mail_result == 1) {
         //check if mail was successfully send
         dblog("Self subscribe - Send subscription mail to:" . $adherent["email_adh"], $requete);
         $warning_detected[] = _T("Password sent. Login:"******" \"" . $adherent["login_adh"] . "\"";
Ejemplo n.º 3
0
     $mail->setMessage($texts->getBody());
     $sent = $mail->send();
     if ($sent == GaletteMail::MAIL_SENT) {
         $hist->add(str_replace('%s', $member->sname . ' (' . $member->email . ')', _T("New account mail sent to admin for '%s'.")));
     } else {
         $str = str_replace('%s', $member->sname . ' (' . $member->email . ')', _T("A problem happened while sending email to admin for account '%s'."));
         $hist->add($str);
         $error_detected[] = $str;
     }
     unset($texts);
 }
 // send mail to member
 if ($preferences->pref_mail_method > GaletteMail::METHOD_DISABLED && $member->email != '') {
     //send mail to member
     // Get email text in database
     $texts = new Texts($texts_fields, $preferences, array('name_adh' => custom_html_entity_decode($member->sname), 'firstname_adh' => custom_html_entity_decode($member->surname), 'lastname_adh' => custom_html_entity_decode($member->name), 'mail_adh' => custom_html_entity_decode($member->email), 'login_adh' => custom_html_entity_decode($member->login), 'password_adh' => custom_html_entity_decode($_POST['mdp_adh'])));
     $mtxt = $texts->getTexts('sub', $member->language);
     $mail = new GaletteMail();
     $mail->setSubject($texts->getSubject());
     $mail->setRecipients(array($member->email => $member->sname));
     $mail->setMessage($texts->getBody());
     $sent = $mail->send();
     if ($sent == GaletteMail::MAIL_SENT) {
         $hist->add(str_replace('%s', $member->sname . ' (' . $member->email . ')', _T("New account mail sent to '%s'.")));
     } else {
         $str = str_replace('%s', $member->sname . ' (' . $member->email . ')', _T("A problem happened while sending new account mail to '%s'"));
         $hist->add($str);
         $error_detected[] = $str;
     }
 }
 /** FIXME: query was previously passed as second argument,
Ejemplo n.º 4
0
                     }
                 }
             }
         } else {
             //something went wrong :'(
             $error_detected[] = _T("An error occured while storing the contribution.");
         }
     }
 }
 if (count($error_detected) == 0) {
     $dyn_fields->setAllFields('contrib', $contrib->id, $contribution['dyn']);
     // Get member informations
     $adh = new Adherent();
     $adh->load($contrib->member);
     if ($preferences->pref_mail_method > GaletteMail::METHOD_DISABLED) {
         $texts = new Texts($texts_fields, $preferences, array('name_adh' => custom_html_entity_decode($adh->sname), 'firstname_adh' => custom_html_entity_decode($adh->surname), 'lastname_adh' => custom_html_entity_decode($adh->name), 'mail_adh' => custom_html_entity_decode($adh->email), 'login_adh' => custom_html_entity_decode($adh->login), 'deadline' => custom_html_entity_decode($contrib->end_date), 'contrib_info' => custom_html_entity_decode($contrib->info), 'contrib_amount' => custom_html_entity_decode($contrib->amount), 'contrib_type' => custom_html_entity_decode($contrib->type->libelle)));
         if ($new && isset($_POST['mail_confirm']) && $_POST['mail_confirm'] == '1') {
             if (GaletteMail::isValidEmail($adh->email)) {
                 $text = 'contrib';
                 if (!$contrib->isCotis()) {
                     $text = 'donation';
                 }
                 $mtxt = $texts->getTexts($text, $adh->language);
                 $mail = new GaletteMail();
                 $mail->setSubject($texts->getSubject());
                 $mail->setRecipients(array($adh->email => $adh->sname));
                 $mail->setMessage($texts->getBody());
                 $sent = $mail->send();
                 if ($sent) {
                     $hist->add(preg_replace(array('/%name/', '/%email/'), array($adh->sname, $adh->email), _T("Mail sent to user %name (%email)")));
                 } else {
Ejemplo n.º 5
0
     $adh = new Adherent($login_adh);
 }
 if ($adh->id != '') {
     //account has been found, proceed
     if (Core\GaletteMail::isValidEmail($adh->email)) {
         $password = new Core\Password();
         $res = $password->generateNewPassword($adh->id);
         if ($res == true) {
             $link_validity = new DateTime();
             $link_validity->add(new DateInterval('PT24H'));
             $df = _T("Y-m-d H:i:s");
             $proto = 'http';
             if (isset($_SERVER['HTTPS'])) {
                 $proto = 'https';
             }
             $texts = new Texts($texts_fields, $preferences, array('change_pass_uri' => $proto . '://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']) . '/change_passwd.php?hash=' . urlencode($password->getHash()), 'link_validity' => $link_validity->format(_T("Y-m-d H:i:s")), 'login_adh' => custom_html_entity_decode($adh->login, ENT_QUOTES)));
             $mtxt = $texts->getTexts('pwd', $adh->language);
             $mail = new Core\GaletteMail();
             $mail->setSubject($texts->getSubject());
             $mail->setRecipients(array($adh->email => $adh->sname));
             $mail->setMessage($texts->getBody());
             $sent = $mail->send();
             if ($sent == Core\GaletteMail::MAIL_SENT) {
                 $hist->add(str_replace('%s', $login_adh, _T("Mail sent to '%s' for password recovery.")));
                 if ($from_admin === false) {
                     $success_detected[] = _T("A mail has been sent to your address.<br/>Please check your inbox and follow the instructions.");
                     $tpl->assign('success_detected', $success_detected);
                     $done = true;
                 } else {
                     $success_detected[] = _T("An mail has been sent to the member.");
                 }