$textarea_contents = trim($_POST['textarea_contents']); if ($txt_title == '') { $post_error = TRUE; $msg .= "<font color=\"red\">Please specify title</font><br>"; } if ($textarea_contents == '') { $post_error = TRUE; $msg .= "<font color=\"red\">Please enter contents</font><br>"; } if (!$error) { $cat_obj = new MessageBoard(); if ($parent_id) { $cat_obj->set_category_id($parent_id); } else { if ($group_id) { $cat_obj->set_collection_id($group_id); } } $cat_obj->title = $txt_title; $cat_obj->body = $textarea_contents; $cat_obj->user_id = $uid; if (!$_POST['chk_allow_anonymous']) { $cat_obj->allow_anonymous = 0; } else { $cat_obj->allow_anonymous = 1; } try { $cat_obj->save(); } catch (PAException $e) { $msg = "Error occured in saving thread\n"; $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>";
$msg = "Error occured in retreiving group information\n"; $msg .= "<br><center><font color=\"red\">" . $e->message . "</font></center>"; $error_code = $e->code; $error = TRUE; } if (!Group::member_exists((int) $obj_group->collection_id, (int) $_SESSION['user']['id'])) { $error = TRUE; } if ($error) { $redirect_msg = "Group does not exist."; $back_to_page = $base_url . '/forums.php'; header("Location: {$base_url}/generic_error.php?msg={$redirect_msg}&back_to_page={$back_to_page}"); exit; } $thread_obj = new MessageBoard(); $thread_obj->set_collection_id($group_id); $arr_threads = $thread_obj->get(); } html_header($HTML_TITLE, ''); $content =& new Template(CURRENT_THEME_FSPATH . "/threads.tpl"); if ($error == TRUE) { $content->set('msg', $msg); } $content->set('uid', $uid); $content->set('gid', $group_id); $header =& new Template(CURRENT_THEME_FSPATH . "/header.tpl"); $header->set('user_name', $first_name . " " . $last_name); if ($network_info) { $header->set_object('network_info', $network_info); } $content->set('header', $header);