OSDN Git Service

自動リンク機能がある程度安定しているようなので、現時点でのブランチorigin/autolinkをmasterにmerge。
[kenranchat/yadchat.git] / index.cgi
1 #!/usr/bin/perl
2
3 ##### Yet Another Dice Chat #####
4 ### $Id: index.cgi,v 1.2 2007/05/06 03:27:40 jyugoya Exp $
5 ### YADChat / 2007 © \8c\8b\8fé\97R\97\85\81\97\90¢\8aE\94E\8eÒ\8d\91 / BSD Lisence
6 ### mihana\82³\82ñ\82É\98A\97\8d\82ª\82Â\82©\82È\82¢\82Ì\82Å\83R\81[\83h\82ðrewrite\92\86\81B
7
8 ##### \90Ý\92è\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý #####
9 require 'config.cgi';
10
11 ##### \83\89\83C\83u\83\89\83\8a\93Ç\82Ý\8d\9e\82Ý #####
12 require 'yadchatlib.pl';
13
14 ########################
15 ##### \83\81\83C\83\93\8f\88\97\9d\95\94 #####
16 ########################
17
18 ##### CGI\83p\83b\83P\81[\83W #####
19 use CGI qw/:standard/;
20
21 ##### \83O\83\8d\81[\83o\83\8b\95Ï\90\94 #####
22 # CGI \83I\83u\83W\83F\83N\83g
23 $query = new CGI;
24
25\83p\83\89\83\81\81[\83^\8eæ\93¾
26 $IN{'mode'}   = $query->param('mode');
27 $IN{'name'}   = $query->param('name');
28 $IN{'comment'}   = $query->param('comment');
29 $IN{'del'}    = $query->param('del');
30 $IN{'close'}   = $query->param('close');
31 $IN{'pass'}   = $query->param('pass');
32
33 ##### HTML\95\8f\91\95\\8e¦ #####
34\83w\83b\83_\81[
35 print $query->header(-charset => $CONF{'charset'});
36 print $query->start_html(-lang => $CONF{'lang'},
37                      -encoding => $CONF{'charset'},
38                      -head => meta({-http_equiv => 'Content-Type',
39                                     -content    => 'text/html; charset=' . $CONF{'charset'}}),
40                      -title=>$CONF{'title'},
41                      -style=>{-src=>$CONF{'indexstyle'}});
42
43\83K\83C\83h
44 print<<EOM;
45 <a href="$CONF{'home'}">\83z\81[\83\80</a> | <a href="$CONF{'indexcgi'}">\83\8b\81[\83\80\88ê\97\97</a>
46
47 <div class="main">
48 EOM
49
50\83^\83C\83g\83\8b
51 print $query->h1($CONF{'title'});
52 print "\n";
53
54\83f\83o\83b\83O
55 if ($DEBUG) {
56     &printDebug();
57 }
58
59\8f\88\97\9d\95ª\8aò
60 if ($IN{'name'} && $IN{'comment'} && $IN{'pass'}) {
61     if ($DEBUG) {
62         print "<p>create New Room ...\n";
63     }
64     &createNewRoom($IN{'name'}, $IN{'comment'});
65 } elsif ($IN{'del'} && $IN{'pass'} eq $CONF{'pass'}) {
66     if ($DEBUG) {
67         print "<p>delete a Room ...\n";
68     }
69     &deleteRoom($IN{'del'});
70 } elsif ($IN{'close'}) {
71     if ($DEBUG) {
72         print "<p>close a Room ...\n";
73     }
74     &closeRoom($IN{'pass'}, $IN{'close'});
75 }
76 if ($DEBUG) {
77     print "done</p>\n";
78 }
79
80
81\92\8d\88Ó\8f\91\82«
82 &printNotice();
83
84\95\\8e¦\95ª\8aò
85 if (!$IN{'mode'}) {
86     &printRoomList();
87 } elsif ($IN{'mode'} eq "make") {
88     &printMakeRoom();
89 } elsif ($IN{'mode'} eq "log") {
90     &printLogList();
91 } elsif ($IN{'mode'} eq "admin"){
92     &printAdminMenu();
93 }
94
95 print<<EOM;
96 </div>
97 EOM
98
99\83t\83b\83^\81[
100 print &genCopyright();
101
102\95\\8e¦\8fI\97¹
103 print $query->end_html;
104
105 ### End of index.cgi