$m->removeAttachments(true);
}
$this->session->mailing = null;
+ $this->session->redirect_mailing = null;
}
$params = array();
$m->removeAttachments(true);
}
$this->session->mailing = null;
+ $this->session->redirect_mailing = null;
if (isset($this->session->filter_mailing)) {
$filters = $this->session->filter_mailing;
$filters->selected = [];
$mailing->message = $post['mailing_corps'];
}
- switch ($post['sender']) {
+ switch ($post['sender'] ?? false) {
case GaletteMail::SENDER_CURRENT:
$member = new Adherent($this->zdb, (int)$this->login->id, false);
$mailing->setSender(
$filters->selected = null;
$this->session->filter_members = $filters;
$this->session->mailing = null;
+ $this->session->redirect_mailing = null;
$success_detected[] = _T("Mailing has been successfully sent!");
$goto = $redirect_url;
}
if ($histo->storeMailing() !== false) {
$success_detected[] = _T("Mailing has been successfully saved.");
$this->session->mailing = null;
+ $this->session->redirect_mailing = null;
+ $goto = $this->router->pathFor('mailings');
}
}
}
$mailing->subject = $post['subject'];
$mailing->message = $post['body'];
$mailing->html = ($post['html'] === 'true');
- $attachments = (isset($post['attachments']) ? $post['attachments'] : []);
+ $attachments = $mailing->attachments;
}
// display page
*
* PHP version 5
*
- * Copyright © 2009-2014 The Galette Team
+ * Copyright © 2009-2020 The Galette Team
*
* This file is part of Galette (http://galette.tuxfamily.org).
*
* @package Galette
*
* @author Johan Cwiklinski <johan@x-tnd.be>
- * @copyright 2009-2014 The Galette Team
+ * @copyright 2009-2020 The Galette Team
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
* @link http://galette.tuxfamily.org
* @since Available since 0.7dev - 2009-03-07
*/
private function generateNewId(): string
{
- global $zdb;
+ $id = '';
+ $chars = 'abcdefghjkmnpqrstuvwxyz0123456789';
+ $i = 0;
+ $size = 30;
+ while ($i <= $size - 1) {
+ $num = mt_rand(0, strlen($chars) - 1) % strlen($chars);
+ $id .= substr($chars, $num, 1);
+ $i++;
+ }
- $pass = new Password($zdb);
- $this->id = $pass->makeRandomPassword(30);
+ $this->id = $id;
$this->generateTmpPath($this->id);
return $this->id;
}
private function generateTmpPath($id = null)
{
if ($id === null) {
- global $zdb;
-
- $pass = new Password($zdb);
- $id = $pass->makeRandomPassword(30);
+ $id = $this->generateNewId();
}
$this->tmp_path = GALETTE_ATTACHMENTS_PATH . '/' . $id;
}
) {
foreach ($this->attachments as &$attachment) {
$old_path = $attachment->getDestDir() . $attachment->getFileName();
- $new_path = GALETTE_ATTACHMENTS_PATH . $this->id . '/' .
+ $new_path = GALETTE_ATTACHMENTS_PATH . $id . '/' .
$attachment->getFileName();
- if (!file_exists(GALETTE_ATTACHMENTS_PATH . $this->id)) {
- mkdir(GALETTE_ATTACHMENTS_PATH . $this->id);
+ if (!file_exists(GALETTE_ATTACHMENTS_PATH . $id)) {
+ mkdir(GALETTE_ATTACHMENTS_PATH . $id);
}
$moved = rename($old_path, $new_path);
if ($moved) {