|
Revision 1162, 1.7 kB
(checked in by dom, 4 months ago)
|
|
Install signal handlers in reindex.pl and CGI scripts to allow
temporary files (eg from Plucene) to be cleaned up. (fixes #247)
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | use warnings; |
|---|
| 4 | use strict; |
|---|
| 5 | use sigtrap die => 'normal-signals'; |
|---|
| 6 | |
|---|
| 7 | use CGI; |
|---|
| 8 | use OpenGuides::Config; |
|---|
| 9 | use OpenGuides::CGI; |
|---|
| 10 | use OpenGuides::Utils; |
|---|
| 11 | use OpenGuides::Template; |
|---|
| 12 | |
|---|
| 13 | my $config_file = $ENV{OPENGUIDES_CONFIG_FILE} || "wiki.conf"; |
|---|
| 14 | my $config = OpenGuides::Config->new( file => $config_file ); |
|---|
| 15 | my $wiki = OpenGuides::Utils->make_wiki_object( config => $config ); |
|---|
| 16 | my $cgi = CGI->new(); |
|---|
| 17 | my $action = $cgi->param('action') || ''; |
|---|
| 18 | |
|---|
| 19 | if ( $action eq "set_preferences" ) { |
|---|
| 20 | set_preferences(); |
|---|
| 21 | } else { |
|---|
| 22 | show_form(); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | sub set_preferences { |
|---|
| 26 | my %prefs = OpenGuides::CGI->get_prefs_from_hash( $cgi->Vars ); |
|---|
| 27 | my $prefs_cookie = OpenGuides::CGI->make_prefs_cookie( |
|---|
| 28 | config => $config, |
|---|
| 29 | %prefs, |
|---|
| 30 | ); |
|---|
| 31 | my @cookies = ( $prefs_cookie ); |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | if ( ! $prefs{track_recent_changes_views} ) { |
|---|
| 35 | my $rc_cookie = OpenGuides::CGI->make_recent_changes_cookie( |
|---|
| 36 | config => $config, |
|---|
| 37 | clear_cookie => 1, |
|---|
| 38 | ); |
|---|
| 39 | push @cookies, $rc_cookie; |
|---|
| 40 | } |
|---|
| 41 | print OpenGuides::Template->output( |
|---|
| 42 | wiki => $wiki, |
|---|
| 43 | config => $config, |
|---|
| 44 | template => "preferences.tt", |
|---|
| 45 | cookies => \@cookies, |
|---|
| 46 | vars => { |
|---|
| 47 | not_editable => 1, |
|---|
| 48 | } |
|---|
| 49 | ); |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | sub show_form { |
|---|
| 53 | print OpenGuides::Template->output( |
|---|
| 54 | wiki => $wiki, |
|---|
| 55 | config => $config, |
|---|
| 56 | template => "preferences.tt", |
|---|
| 57 | vars => { |
|---|
| 58 | not_editable => 1, |
|---|
| 59 | show_form => 1 |
|---|
| 60 | } |
|---|
| 61 | ); |
|---|
| 62 | } |
|---|