$this->setError(_('Forum Description Must Be At Least 10 Characters'));
return false;
}
- 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;
}
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){
}
$this->group_forum_id=db_insertid($result,'forum_group_list','group_forum_id');
$this->fetchData($this->group_forum_id);
+
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;
}
- if (eregi('[^_\.0-9a-z-]',$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();
allow_anonymous=$4,
moderation_level=$5,
is_public=$6
- WHERE group_id=$7,
+ WHERE group_id=$7
AND group_forum_id=$8',
array (strtolower($forum_name),
htmlspecialchars($description),
db_query_params ('DELETE FROM forum_group_list WHERE group_forum_id=$1',
array ($this->getID())) ;
//echo '5'.db_error();
+ //delete forum's role setting
+ db_query_params ('DELETE FROM role_setting WHERE section_name=$1 AND ref_id=$2',
+ array ('forum',
+ $this->getID())) ;
+
db_commit();
+
+ $this->Group->normalizeAllRoles () ;
+
return true;
}