* Copyright 2002, Tim Perdue/GForge, LLC
* Copyright 2003, Guillaume Smet
* Copyright 2009, Roland Mas
+ * Copyright 2012, Franck Villaume - TrivialDev
*
- * This file is part of FusionForge.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with FusionForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once $gfcommon.'include/Error.class.php';
$realListName = strtolower($this->Group->getUnixName().'-'.$listName);
- if(!validate_email($realListName.'@'.forge_get_config('lists_host'))) {
+ // '|' or '/' are valid chars in emails but are not allowed by mailman.
+ if( preg_match('/[|\/]/', $realListName) ||
+ !validate_email($realListName.'@'.forge_get_config('lists_host'))) {
$this->setError(_('Invalid List Name') . ': ' .
$realListName.'@'.forge_get_config('lists_host'));
return false;
return false;
}
- $listPassword = substr(md5($GLOBALS['session_ser'] . time() . rand(0,40000)), 0, 16);
+ $listPassword = substr(md5($GLOBALS['session_ser'] . time() . util_randbytes()), 0, 16);
db_begin();
$result = db_query_params ('INSERT INTO mail_group_list (group_id,list_name,is_public,password,list_admin,status,description) VALUES ($1,$2,$3,$4,$5,$6,$7)',
$description)) ;
if (!$result) {
- $this->setError(sprintf(_('Error Creating %1$s'), _('Error Creating %1$s')).db_error());
+ $this->setError(_('Error Creating mailing list: ').db_error());
db_rollback();
return false;
}
array ($groupListId,
$this->Group->getID())) ;
if (!$res || db_numrows($res) < 1) {
- $this->setError(sprintf(_('Error Getting %1$s'), _('Error Getting %1$s')));
+ $this->setError(_('Error Getting mailing list'));
return false;
}
$this->dataArray = db_fetch_array($res);
return false;
}
- if ($status == 'xyzzy') {
+ // do not update the status if the mailing-list is not created yet
+ if ($status == 'xyzzy' || $this->getStatus() == MAIL__MAILING_LIST_IS_REQUESTED) {
$status = $this->getStatus();
}