require($DOCUMENT_ROOT."/libs/constants.inc");
require($DOCUMENT_ROOT."/classes/userObjects.inc");
$privs = new userPermissions(1);
if ($action == "delete") {
$deleteQuery = "UPDATE spud_board SET show_message = 0, editor_id = ".$privs->getUserId()." WHERE id = $id";
$deleteMess = new dbInterface($DB_NAME, $DB_USER, $DB_PASS, $deleteQuery);
header("Location: $url\n\n");
exit;
}
if ($t_title == "") {
$errNum = 1;
$errMsg .= "You must have a name for your topic.
";
}
if ($t_desc == "") {
$errNum = 1;
$errMsg .= "You must say what the topic is about. If you don't know... how will others?
";
}
if ($errNum) {
$type = "topic";
} else {
if ($parent_id != "") {
$topicInsertQuery = "INSERT INTO spud_board (id, title, message, user_id, parent_id, show_message, post_time) VALUES (0, '$t_title', '$t_desc', ".$privs->getUserId().", ".$parent_id.", 1, NOW())";
} else {
$topicInsertQuery = "INSERT INTO spud_board (id, title, message, user_id, show_message, post_time) VALUES (0, '$t_title', '$t_desc', ".$privs->getUserId().", 1, NOW())";
}
$topicInsert = new dbInterface($DB_NAME, $DB_USER, $DB_PASS, $topicInsertQuery);
}
header("Location: $url\n\n");
exit;
?>