[Jan Gerber] fix unicode filenames in wikibooks2epub (from https://code.launchpad...
[objavi2.git] / perl / objavi.pl
blobabbc49f341449585edbe673595bd58efa8e25ad0
1 #!/usr/bin/perl -wT
3 # Copyright (C) 2008 Aleksandar Erkalovic, aerkalov@gmail.com
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version. For
9 # more details read LICENSE in the root of this distribution.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 # As per the GPL, removal of this notice is prohibited.
17 BEGIN {
18 # Set default current working directory (needed for mod_perl)
19 if( $ENV{"SCRIPT_FILENAME"} && $ENV{"SCRIPT_FILENAME"} =~ /^(.+)\/[^\/]+$/ ) {
20 chdir $1;
22 # Set library paths in @INC, at compile time
23 unshift @INC, '.';
24 require 'setlib.cfg';
28 use strict;
29 use CGI::Carp qw( fatalsToBrowser );
30 use CGI;
31 use File::Temp qw(:POSIX);
32 use TWiki;
33 use TWiki::Render;
34 use TWiki::Meta;
35 use TWiki::Func;
37 my $log="";
39 my $query = new CGI;
41 my $thePathInfo = $query->path_info();
42 my $theRemoteUser = $query->remote_user();
43 my $theTopic = $query->param( 'topic' );
44 my $theUrl = $query->url;
46 my( $topic, $webName, $scriptUrlPath, $userName ) =
47 TWiki::initialize( $thePathInfo, $theRemoteUser,
48 $theTopic, $theUrl, $query );
52 use TWiki::Contrib::ObjaviContrib;
54 if($query->request_method() eq "GET") {
55 TWiki::Contrib::ObjaviContrib::handleRequest($webName, $userName, $thePathInfo, $query);
56 } else {
57 TWiki::Contrib::ObjaviContrib::handlePublish($webName, $userName, $thePathInfo, $query);