return $self->query( 'history', [ $addr ] );
}
+sub spaceNorm( $ ) {
+ $_ = shift;
+ return undef unless defined $_;
+ s/[ \t]+/ /g;
+ s/^\s//;
+ s/\s$//;
+ return $_;
+}
+
sub submitItem( $$$ ) {
my( $self, $data, $auth ) = @_;
my( $addr ) = ( $data->{'address'} );
return( 'exists', undef ) if( defined( $self->item( $addr->get(), 0 ) ) );
eval {
$self->command( 'newitem', [ $addr->get(), $addr->parent()->get() ] );
- $self->command( 'newhistory', [ $addr->get(), $auth->{'authid'}, $data->{'discussion'}, $data->{'name'}, $data->{'note'} ] );
+ $self->command( 'newhistory', [ $addr->get(), $auth->{'authid'}, spaceNorm( $data->{'discussion'} ), spaceNorm( $data->{'name'} ), spaceNorm( $data->{'note'} ) ] );
};
if( $@ ) {
$self->rollback();
sub submitHistory( $$$$ ) {
my( $self, $data, $auth, $address ) = @_;
if( $data->{'delete'} ) {
- $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, $data->{'text'}, '', $data->{'note'} ], 1 );
+ $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, spaceNorm( $data->{'text'} ), '', '' ], 1 );
} else {
$data->{'name'} = undef if defined $data->{'name'} && $data->{'name'} eq '';
- $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, $data->{'text'}, $data->{'name'}, $data->{'note'} ], 1 );
+ $self->command( 'newhistory', [ $address->get(), $auth->{'authid'}, spaceNorm( $data->{'text'} ), spaceNorm( $data->{'name'} ), spaceNorm( $data->{'note'} ) ], 1 );
}
return $self->last();
}
sub safeEncode( $ ) {
my( $text ) = @_;
- return encode( $text ) if defined $text;
- return '';
+ return '' unless defined $text;
+ $text = encode( $text );
+ $text =~ s/\n/<br>/s;
+ return $text;
}
sub mailEncode( $$ ) {
sub redirect( $$$$ ) {
my( $req, $args, $addr, $hasSSL ) = @_;
my $prefix = ( !defined $args->{'action'} || $args->{'action'} eq '' || $args->{'action'} eq 'list' ) ? 'read' : 'mods';
- my $url = protoName( $hasSSL )."://".$req->hostname()."/$prefix/$addr".buildArgs( $args );
+ my $url = protoName( $hasSSL )."://".$req->hostname()."/$prefix/$addr";
return HTTPRedirect( $req, $url );
}
print "<h2>Found items</h2>\n";
genTableHead( 'found', [ 'ID', 'Name', 'Parent' ], [] );
my $prefix = '/'.( ( !defined $args->{'action'} || $args->{'action'} eq '' || $args->{'action'} eq 'list' ) ? 'read/' : 'mods/' );
- my $suffix = buildArgs( $args );
htmlFormatTable( $result, 3, [], [ sub {
my $addr = shift;
my $address = PciIds::Address::new( $addr );
- return "<a href='$prefix".$address->get()."$suffix'>".encode( $address->fullPretty() )."</a>";
+ return "<a href='$prefix".$address->get()."'>".encode( $address->fullPretty() )."</a>";
} ], sub { 1; }, sub { ' class="item"'; } );
genTableTail();
genHtmlFooter( 1, $req, $args );
use PciIds::Html::Forms;
use PciIds::Html::Users;
use PciIds::Address;
+use PciIds::Config;
use Apache2::Const qw(:common :http);
sub genNotifForm( $$$$$$ ) {
sub notifForm( $$$$ ) {
my( $req, $args, $tables, $auth ) = @_;
+ return HTTPRedirect( $req, '/mods/'.$config{'default_uri'}.'?action=notifications' ) if $req->uri() =~ /^(\/(read|mods))?\/?$/;
if( defined $auth->{'authid'} ) {
return genNotifForm( $req, $args, $tables, $auth, undef, $tables->getNotifData( $auth->{'authid'}, PciIds::Address::new( $req->uri() )->get() ) );
} else {
return HTTPRedirect( $req, setAddrPrefix( $req->uri(), 'read' ).buildExcept( 'action', $args )."?action=list" );
}
+checkConf( [ 'default_uri' ] );
+
1;
jelnet = /home/pciids/ids/perl/scripts/jelnet
xmpp_passwd = IorekByrnison
xmpp_name = pci-ids@ucw.cz
+default_uri = PC/
<li><a href="/read/PD/">PCI device classes</a>
</ul>
+<p>Or you can go directly to your <a href='/mods/?action=profile'>profile</a> or <a href='/mods/?action=notifications'>notification list</a>.
+
<p>You may want to read <a href="/read/?action=help?help=index">help</a> before you start using the
web interface.