Mercurial > hg > chronicle
comparison cgi-bin/comments.cgi @ 155:4d2f0d6866e5
Updated the display of the blog comment when using AJAX
author | Steve Kemp <steve@steve.org.uk> |
---|---|
date | Thu, 03 Jan 2008 21:45:58 +0000 |
parents | 9f91d9377d1a |
children | 887a460d77d5 |
comparison
equal
deleted
inserted
replaced
154:9f91d9377d1a | 155:4d2f0d6866e5 |
---|---|
132 | 132 |
133 # | 133 # |
134 # Open the file. | 134 # Open the file. |
135 # | 135 # |
136 my $file = $COMMENT . "/" . $id . "." . $timestr; | 136 my $file = $COMMENT . "/" . $id . "." . $timestr; |
137 $file =~ s/[ \t]//g; | |
138 | |
137 open( FILE, ">", $file ); | 139 open( FILE, ">", $file ); |
138 print FILE "Name: $name\n"; | 140 print FILE "Name: $name\n"; |
139 print FILE "Mail: $mail\n"; | 141 print FILE "Mail: $mail\n"; |
140 print FILE "User-Agent: $ENV{'HTTP_USER_AGENT'}\n"; | 142 print FILE "User-Agent: $ENV{'HTTP_USER_AGENT'}\n"; |
141 print FILE "IP-Address: $ENV{'REMOTE_ADDR'}\n"; | 143 print FILE "IP-Address: $ENV{'REMOTE_ADDR'}\n"; |
147 # | 149 # |
148 # Send a mail. | 150 # Send a mail. |
149 # | 151 # |
150 if ( length($TO) && length($FROM) ) | 152 if ( length($TO) && length($FROM) ) |
151 { | 153 { |
152 open ( SENDMAIL, "|/usr/lib/sendmail -t -f $FROM"); | 154 open ( SENDMAIL, "|/usr/lib/sendmail -t -f $FROM"); |
153 print SENDMAIL "To: $TO\n"; | 155 print SENDMAIL "To: $TO\n"; |
154 print SENDMAIL "From: $FROM\n"; | 156 print SENDMAIL "From: $FROM\n"; |
155 print SENDMAIL "Subject: New Comment [$id]\n"; | 157 print SENDMAIL "Subject: New Comment [$id]\n"; |
156 print SENDMAIL "\n\n"; | 158 print SENDMAIL "\n\n"; |
157 print ( SENDMAIL `cat $file` ); | 159 print SENDMAIL `cat $file`; |
158 close ( SENDMAIL ); | 160 close( SENDMAIL ); |
159 } | 161 } |
160 | 162 |
161 # | 163 # |
162 # Now show the user the thanks message.. | 164 # Now show the user the thanks message.. |
163 # | 165 # |
164 if ( $cgi->param( "ajax" ) ) | 166 if ( $cgi->param( "ajax" ) ) |
165 { | 167 { |
166 print <<EOF; | 168 print <<EOF; |
167 | 169 <h3>Comment Submitted</h3> |
170 <blockquote> | |
168 <p>Thanks for your comment, it will be made live when the queue is moderated next.</p> | 171 <p>Thanks for your comment, it will be made live when the queue is moderated next.</p> |
172 </blockquote> | |
169 | 173 |
170 EOF | 174 EOF |
171 exit; | 175 exit; |
172 } | 176 } |
173 else | 177 else |