+ # lock and load the forum main file
+ #
+ if ($self -> load_main_file) {
+
+ # if a reply - is it legal?
+ # is it a dupe?
+ #
+ if ($self -> check_reply_dupe) {
+
+ unless ($self -> {response} -> {reply} or $self -> {response} -> {new}) {
+ # don't know, if we any time come to this branch
+ # the script is probably broken
+ #
+ $self -> {error} = {
+ spec => 'unknown_error',
+ type => 'fatal'
+ };
+ }
+ else {
+ my $time = time;
+ my $formdata = $self -> {conf} -> {form_data};
+ my $q = $self -> {cgi_object};
+ my $f = $self -> {forum};
+ my $pars = {
+ author => $q -> param ($formdata -> {posterName} -> {name}),
+ email => $q -> param ($formdata -> {posterEmail} -> {name}),
+ category => $q -> param ($formdata -> {posterCategory} -> {name}),
+ subject => $q -> param ($formdata -> {posterSubject} -> {name}),
+ body => $q -> param ($formdata -> {posterBody} -> {name}),
+ homepage => $q -> param ($formdata -> {posterURL} -> {name}),
+ image => $q -> param ($formdata -> {posterImage} -> {name}),
+ quoteChars => $q -> param ($formdata -> {quoteChar} -> {name}),
+ uniqueID => $q -> param ($formdata -> {uniqueID} -> {name}),
+ time => $time,
+ ip => $q -> remote_addr,
+ forumFile => $self -> {conf} -> {forum_file_name},
+ messagePath => $self -> {conf} -> {message_path},
+ lastThread => $f -> {last_thread},
+ lastMessage => $f -> {last_message},
+ parsedThreads => $f -> {threads},
+ dtd => $f -> {dtd},
+ messages => $self -> {template} -> {messages}
+ };
+
+ if ($self -> {response} -> {reply}) {
+ $pars -> {parentMessage} = $self -> {fup_mid};
+ $pars -> {thread} = $self -> {fup_tid};
+ }
+
+ my ($stat, $xml, $mid) = write_posting ($pars);
+
+ if ($stat) {
+ $self -> {error} = {
+ spec => 'not_saved',
+ desc => $stat,
+ type => 'fatal'
+ };
+ }
+ else {
+ $self -> {check_success} = 1;
+ my $thx = $self -> {conf} -> {show_posting} -> {thanx};
+
+ # define special response data
+ #
+ $self -> {response} -> {doc} = $self -> {conf} -> {assign} -> {docThx};
+ $self -> {response} -> {pars} = {
+ $thx -> {subject} => plain ($q -> param ($formdata -> {posterSubject} -> {name})),
+ $thx -> {author} => plain ($q -> param ($formdata -> {posterName} -> {name})),
+ $thx -> {email} => plain ($q -> param ($formdata -> {posterEmail} -> {name})),
+ $thx -> {time} => plain (hr_time($time)),
+ $thx -> {body} => message_as_HTML (
+ $xml,
+ $self -> {template},
+ { posting => $mid,
+ assign => $self -> {conf} -> {assign},
+ quoteChars => $q -> param ($formdata -> {quoteChar} -> {name}),
+ quoting => $self -> {conf} -> {admin} -> {View} -> {quoting}
+ }),
+ $thx -> {category} => plain ($q -> param ($formdata -> {posterCategory} -> {name})),
+ $thx -> {home} => plain ($q -> param ($formdata -> {posterURL} -> {name})),
+ $thx -> {image} => plain ($q -> param ($formdata -> {posterImage} -> {name}))
+ };
+ }
+ }
+ }
+ }