################################################################################
use strict;
-use vars qw($Bin $Shared $Script);
+use vars qw(
+ $Bin
+ $Shared
+ $Script
+ $Config
+);
# locate the script
#
BEGIN {
my $null = $0; $null =~ s/\\/\//g; # for win :-(
- ($Bin) = ($null =~ /^(.*)\/.*$/)? $1 : '.';
- $Shared = "$Bin/../shared";
- ($Script) = ($null =~ /^.*\/(.*)$/)? $1 : $null;
+ $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
+ $Shared = "$Bin/../shared";
+ $Config = "$Bin/config";
+ $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
+
+# my $null = $0; #$null =~ s/\\/\//g; # for win :-(
+# $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.';
+# $Config = "$Bin/../../../cgi-config/devforum";
+# $Shared = "$Bin/../../../cgi-shared";
+# $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null;
}
use lib "$Shared";
use Conf;
use Conf::Admin;
+use Posting::Cache;
# load script configuration and admin default conf.
#
-my $conf = read_script_conf ($Bin, $Shared, $Script);
+my $conf = read_script_conf ($Config, $Shared, $Script);
my $adminDefault = read_admin_conf ($conf -> {files} -> {adminDefault});
# Initialize the request
#
$request -> response;
+# shorten the main file?
+#
+$request -> severance;
+
#
#
### main end ###################################################################
### Posting::Request ###########################################################
package Posting::Request;
+use Arc::Archive;
use CheckRFC;
use Encode::Plain; $Encode::Plain::utf8 = 1; # generally convert from UTF-8
use Encode::Posting;
bless $self, $class;
}
+sub severance {
+ my $self = shift;
+
+ my $stat = cut_tail ({
+ forumFile => $self -> {conf} -> {forum_file_name},
+ messagePath => $self -> {conf} -> {message_path},
+ archivePath => $self -> {conf} -> {original} -> {files} -> {archivePath},
+ lockFile => $self -> {conf} -> {original} -> {files} -> {sev_lock},
+ adminDefault => $self -> {conf} -> {admin},
+ cachePath => $self -> {conf} -> {original} -> {files} -> {cachePath}
+ });
+# die $stat->{(keys %$stat)[0]} if (%$stat);
+
+}
+
### sub response ###############################################################
#
# print the response to STDOUT
lastMessage => $f -> {last_message},
parsedThreads => $f -> {threads},
dtd => $f -> {dtd},
- messages => $self -> {template} -> {messages} || {},
+ messages => $self -> {conf} -> {template} -> {messages} || {},
+ base_uri => $self -> {conf} -> {original} -> {files} -> {forum_base}
};
# set the variables if defined..
if (defined $q -> param ($formdata -> {$may{$_}} -> {name}));
}
- my ($stat, $xml, $mid);
+ my ($stat, $xml, $mid, $tid);
# we've got a fup if it's a reply
#
if ($self -> {response} -> {reply}) {
$pars -> {parentMessage} = $self -> {fup_mid};
$pars -> {thread} = $self -> {fup_tid};
- ($stat, $xml, $mid) = write_reply_posting ($pars);
+ ($stat, $xml, $mid, $tid) = write_reply_posting ($pars);
}
else {
- ($stat, $xml, $mid) = write_new_thread ($pars);
+ ($stat, $xml, $mid, $tid) = write_new_thread ($pars);
}
if ($stat) {
};
}
else {
+ my $cache = new Posting::Cache ($self->{conf}->{original}->{files}->{cachePath});
+ $cache -> add_posting (
+ { thread => ($tid =~ /(\d+)/)[0],
+ posting => ($mid =~ /(\d+)/)[0]
+ }
+ );
+
$self -> {check_success} = 1;
my $thx = $self -> {conf} -> {show_posting} -> {thanx};
#
$self -> {response} -> {doc} = $self -> {conf} -> {assign} -> {docThx};
$self -> {response} -> {pars} = {
- $thx -> {time} => plain (hr_time($time)),
- $thx -> {body} => message_as_HTML (
+ $thx -> {time} => plain (hr_time($time)),
+ $thx -> {body} => message_as_HTML (
$xml,
$self -> {template},
{ posting => $mid,
my $lock_stat;
unless ($lock_stat = write_lock_file ($self -> {conf} -> {forum_file_name})) {
- if (defined $lock_stat and $lock_stat == 0) {
+ if (defined $lock_stat) {
# occupied or no w-bit set for the directory..., hmmm
#
violent_unlock_file ($self -> {conf} -> {forum_file_name});
#
(my $val_ww = $val) =~ s/\s+//g;
+ $val_ww =~ y/a-zA-Z//cd
+ if (exists ($formdata -> {$name {$_}} -> {type}) and $formdata -> {$name {$_}} -> {type} eq 'name');
+
if (length $val_ww < $formdata -> {$name {$_}} -> {minlength}) {
$self -> {error} = {
spec => 'too_short',