/[suikacvs]/messaging/newsportal/post.php
Suika

Contents of /messaging/newsportal/post.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sat Dec 1 11:17:31 2001 UTC (23 years ago) by wakaba
Branch point for: suika, MAIN
Initial revision

1 <? include "config.inc";
2
3 if (($setcookies==true) && (isset($abspeichern)) && ($abspeichern=="ja")) {
4 setcookie("cookie_name",$name,time()+(3600*24*90));
5 setcookie("cookie_email",$email,time()+(3600*24*90));
6 }
7 if ((isset($post_server)) && ($post_server!=""))
8 $server=$post_server;
9 if ((isset($post_port)) && ($post_port!=""))
10 $port=$post_port;
11 ?>
12
13 <? include "body.inc"; ?>
14
15
16 <?php require("$file_newsportal");
17
18 if ($setcookies) {
19 if ((isset($cookie_name)) && (!isset($name))) $name=$cookie_name;
20 if ((isset($cookie_email)) && (!isset($email))) $email=$cookie_email;
21 }
22
23
24 if (!isset($references)) {
25 $references=false;
26 }
27
28 if (!isset($type)) {
29 $type="new";
30 }
31
32 if ($type=="new") {
33 $subject="";
34 $bodyzeile="";
35 $show=1;
36 }
37
38 if (!isset($group)) $group=$newsgroups;
39
40 if ($type=="post") {
41 $show=0;
42 if (trim($body)=="") {
43 $type="retry";
44 $error=$text_post["missing_message"];
45 }
46 if (trim($email)=="") {
47 // $type="retry";
48 // $error=$text_post["missing_email"];
49 $email = "nobody@foo.invalid";
50 }
51 if (!validate_email(trim($email))) {
52 $type="retry";
53 $error=$text_post["error_wrong_email"];
54 }
55 if (trim($name)=="") {
56 $type="retry";
57 $error=$text_post["missing_name"];
58 }
59 if (trim($subject)=="") {
60 $type="retry";
61 $error=$text_post["missing_subject"];
62 }
63 if ($type=="post") {
64 if (!$readonly) {
65 $message=verschicken($subject,
66 $email." (".mb_encode_mimeheader($name).")",
67 $newsgroups,$references,$body);
68 if (substr($message,0,3)=="240") {
69 ?>
70
71 <h1 align="center"><? echo $text_post["message_posted"];?></h1>
72
73 <p><? echo $text_post["message_posted2"];?></p>
74
75 <p><a href="<? echo $file_thread.'/'.$group.'/">'.$text_post["button_back"].'</a> '
76 .$text_post["button_back2"].' '.urlencode($group) ?></p>
77 <?
78 } else {
79 $type="retry";
80 $error=$text_post["error_newsserver"]."<br /><pre>$message</pre>";
81 }
82 } else {
83 echo $text_post["error_readonly"];
84 }
85 }
86 }
87
88 if ($type=="reply") {
89 // $ns=OpenNNTPconnection($server,$port);
90 $message=read_message($id,0,$group);
91 $head=$message->header;
92 $body=explode("\n",$message->body[0]);
93 closeNNTPconnection($ns);
94 if ($head->name != "") {
95 $bodyzeile=$head->name;
96 } else {
97 $bodyzeile=$head->from;
98 }
99 $bodyzeile=$bodyzeile." wrote:\n\n";
100 for ($i=0; $i<=count($body)-1; $i++) {
101 if (trim($body[$i])!="") {
102 $bodyzeile=$bodyzeile."> ".$body[$i]."\n";
103 } else {
104 $bodyzeile.="\n";
105 }
106 }
107 // $bodyzeile.=eregi_replace("\n","\n> ",$body);
108 // $bodyzeile.="> ".str_replace("\n","\n> ",$body);
109 $subject=$head->subject;
110 if (isset($head->followup) && ($head->followup != "")) {
111 $newsgroups=$head->followup;
112 } else {
113 $newsgroups=$head->newsgroups;
114 }
115 splitSubject($subject);
116 $subject="Re: ".$subject;
117 $show=1;
118 $references=false;
119 if (isset($head->references[0])) {
120 for ($i=0; $i<=count($head->references)-1; $i++) {
121 $references .= $head->references[$i]." ";
122 }
123 }
124 $references .= $head->id;
125 }
126
127 if ($type=="retry") {
128 $show=1;
129 $bodyzeile=$body;
130 }
131
132 if ($show==1) {
133
134 if ($testgroup) {
135 $testnewsgroups=testgroups($newsgroups);
136 } else {
137 $testnewsgroups=$newsgroups;
138 }
139
140 if ($testnewsgroups == "") {
141 echo $text_post["followup_not_allowed"];
142 echo " ".$newsgroups;
143 } else {
144 $newsgroups=$testnewsgroups;
145
146 echo '<h1>'.$text_post["group_head"].$newsgroups
147 .$text_post["group_tail"].'</h1>';
148
149 if (isset($error)) echo "<p>$error</p>"; ?>
150
151
152 <form action="<? echo $file_post?>" method="post" accept-encoding="iso-2022-jp, euc-jisx0213, euc-jp">
153
154 <table>
155 <tbody>
156 <tr><th>Subject:</th>
157 <td><input type="text" name="subject" value="<? echo $subject;?>" size="40" maxlength="80"></td></tr>
158 <tr><th>Name:</th>
159 <th><input type="text" name="name"
160 <? if (isset($name)) echo 'value="'.
161 stripslashes($name).'"'; ?>
162 size="40" maxlength="40"></th></tr>
163 <tr><th>eMail:</th>
164 <td><input type="text" name="email"
165 <? if (isset($email)) echo "value=\"$email\""; ?>
166 size="40" maxlength="40"></td></tr>
167 </tbody>
168 </table>
169
170 <table>
171 <tr><td><b><? echo $text_post["message"];?></b><br />
172 <textarea name="body" rows="20" cols="79" wrap="physical">
173 <? if (isset($bodyzeile)) echo stripslashes($bodyzeile); ?>
174 </textarea></td></tr>
175 <tr><td>
176 <input type="submit" value="<? echo $text_post["button_post"];?>" />
177 <? if ($setcookies==true) { ?>
178 <input type="checkbox" name="abspeichern" value="ja" />
179 <? echo $text_post["remember"];?>
180 <? } ?>
181 </td>
182 </tr>
183 </table>
184 <input type="hidden" name="type" value="post" />
185 <input type="hidden" name="newsgroups" value="<? echo $newsgroups; ?>" />
186 <input type="hidden" name="references" value="<? echo htmlentities($references); ?>" />
187 <input type="hidden" name="group" value="<? echo $group; ?>" />
188 </form>
189
190 <? } } ?>
191
192 <? include "footer.inc"; ?>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24