$this->setError(_('Forum Description Must Be At Least 10 Characters'));
return false;
}
- $forum_name = strtolower($forum_name);
if (!preg_match('/^([_\.0-9a-z-])*$/i',$forum_name)) {
$this->setError(_('Illegal Characters in Forum Name'));
return false;
}
if ($send_all_posts_to) {
+ $send_all_posts_to = str_replace(';', ',', $send_all_posts_to);
$invalid_mails = validate_emails($send_all_posts_to);
if (count($invalid_mails) > 0) {
$this->setInvalidEmailError();
$project_name = $this->Group->getUnixName();
$result_list_samename = db_query_params ('SELECT 1 FROM mail_group_list WHERE list_name=$1 AND group_id=$2',
- array ($project_name.'-'.$forum_name,
+ array ($project_name.'-'.strtolower($forum_name),
$this->Group->getID())) ;
if (db_numrows($result_list_samename) > 0){
db_begin();
$result = db_query_params('INSERT INTO forum_group_list (group_id,forum_name,is_public,description,send_all_posts_to,allow_anonymous,moderation_level) VALUES ($1,$2,$3,$4,$5,$6,$7)',
array ($this->Group->getID(),
- $forum_name,
+ strtolower($forum_name),
$is_public,
htmlspecialchars($description),
$send_all_posts_to,
$this->group_forum_id=db_insertid($result,'forum_group_list','group_forum_id');
$this->fetchData($this->group_forum_id);
- // set the permission for the role's group
- $roles_group = $this->Group->getRolesId();
- for ($i=0; $i<sizeof($roles_group); $i++) {
- $role_setting_res = db_query_params ('INSERT INTO role_setting (role_id,section_name,ref_id,value) VALUES ($1,$2,$3,$4)',
- array ($roles_group[$i],
- 'forum',
- $this->group_forum_id,
- 1)) ;
- if (!$role_setting_res) {
- db_rollback();
- $this->setError('Error: Role setting for forum id ' . $this->group_forum_id . ' for groud id ' . $this->Group->getID() . ' ' .db_error());
- return false;
- }
- }
-
if ($create_default_message) {
$fm=new ForumMessage($this);
// Use the system side default language
}
}
db_commit();
+
+ $this->Group->normalizeAllRoles () ;
+
return true;
}
* @return int The next thread_id #.
*/
function getNextThreadID() {
- global $sys_database_type;
-
- if ($sys_database_type == "mysql") {
- $sql="call newval('forum_thread_seq', @res)";
- $result=db_mquery($sql);
- if (!$result) {
- echo db_error();
- return false;
- }
- $sql="select @res";
- $result = db_query_mysql ($sql);
- } else {
- $result = db_query_params ('SELECT nextval($1)',
- array ('forum_thread_seq')) ;
- }
+ $result = db_query_params ('SELECT nextval($1)',
+ array ('forum_thread_seq')) ;
if (!$result || db_numrows($result) < 1) {
echo db_error();
return false;
$this->setError(_('Forum Description Must Be At Least 10 Characters'));
return false;
}
- $forum_name = strtolower($forum_name);
- if (!preg_match('/^([_\.0-9a-z-])*$/',$forum_name)) {
+ if (!preg_match('/^([_\.0-9a-z-])*$/i',$forum_name)) {
$this->setError(_('Illegal Characters in Forum Name'));
return false;
}
is_public=$6
WHERE group_id=$7
AND group_forum_id=$8',
- array ($forum_name,
+ array (strtolower($forum_name),
htmlspecialchars($description),
$send_all_posts_to,
$allow_anonymous,
//delete forum's role setting
db_query_params ('DELETE FROM role_setting WHERE section_name=$1 AND ref_id=$2',
array ('forum',
- $this->getID())) ;
+ $this->getID())) ;
db_commit();
return true;
}