File: index.cgi

package info (click to toggle)
sporum 1.8b1-3.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,108 kB
  • ctags: 676
  • sloc: perl: 14,300; makefile: 52
file content (58 lines) | stat: -rwxr-xr-x 1,340 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl

use SPDB;
use SPCGI;
use SmallPig;

use strict;

sub main{
#    print "Content-type: text/html\n\n";      

  # --- create a SPDB object
  my $spdb = SPDB->new();
  
  my $spcgi = SPCGI->new($spdb);
  $spcgi->set_state_for_client();

  # --- load the lang module
  $spcgi->{STATE}->{langptr} = SmallPig::get_lang_ptr($spcgi->{STATE}->{lang}, 
						      "index");

  my $STATE = $spcgi->{'STATE'};
  my $op = $STATE->{'op'};
  
  # --- create a template object
  my $template;
  if($op eq "markallthreads"){
      require Templates::Caution;
		
      # --- create a template object
      $template = Templates::Caution->new($spcgi, $spdb);
      
      require Ops::Comments;
      my $obj = Ops::Comments->new($STATE, $spdb);
      
      my ($succ, $err_msg, $btitle, $url) = $obj->mark_all_threads();
      
      $template->{'btitle'} = $btitle;
      $template->{'bmsg'} = $err_msg;
      $template->{'uri'} = $url;
  }
  elsif($op eq "shownewposts"){
      require Templates::TopicsList;
		
      # --- create a template object
      $template = Templates::TopicsList->new($spcgi, $spdb, "shownewposts");
  }
  else{
      require Templates::Index;

      $template = Templates::Index->new($spcgi, $spdb);
  }
  # --- print the http header
  $template->print_http_header();
  $template->print_template();
}

main();