web pages
[banana.git] / post.php
1 <?php
2 require("locales/locales.inc.php");
3 require("include/session.inc.php");
4 require("include/encoding.inc.php");
5 require("include/format.inc.php");
6 require("include/config.inc.php");
7 require("include/NetNNTP.inc.php");
8 require("include/post.inc.php");
9 require("include/spool.inc.php");
10 require("include/password.inc.php");
11 require("include/profile.inc.php");
12 require("include/wrapper.inc.php");
13
14 require("include/header.inc.php");
15 $profile = getprofile();
16 $group=htmlentities(strtolower($_REQUEST['group']));
17 $id=htmlentities(strtolower($_REQUEST['id']));
18
19 if (isset($group)) {
20 $target = $group;
21 }
22
23 $mynntp = new nntp($news['server']);
24 if (!$mynntp) {
25 echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>";
26 require("include/footer.inc.php");
27 exit;
28 }
29 if ($news['user']!="anonymous") {
30 $result = $mynntp->authinfo($news["user"],$news["pass"]);
31 if (!$result) {
32 echo "<p class=\"error\">\n\t".$locale['error']['credentials']
33 ."\n</p>";
34 require("include/footer.inc.php");
35 exit;
36 }
37 }
38
39 if (isset($group) && isset($id) && isset($_REQUEST['type']) &&
40 ($_REQUEST['type']=='followup')) {
41 $rq=$mynntp->group($group);
42 $post = new post($mynntp,$id);
43 if ($post) {
44 $subject = (preg_match("/^re:/i",$post->headers->subject)?"":"Re: ")
45 .$post->headers->subject;
46 $body = $post->headers->name." wrote :\n".wrap($post->body, ">");
47 if (isset($post->headers->followup))
48 $target=$post->headers->followup;
49 else
50 $target=$post->headers->newsgroups;
51 }
52 }
53
54 $mynntp->quit();
55 ?>
56 <div class="title">
57 <?php echo $locale['post']['title'];?>
58 </div>
59 <?php
60
61 displayshortcuts();
62
63 ?>
64
65 <form action="thread.php" method="POST">
66 <table class="bicol" cellpadding="0" cellspacing="0" border="0">
67 <tr>
68 <th colspan="2">
69 <?php echo $locale['post']['headers'];?>
70 </th>
71 </tr>
72 <tr>
73 <td>
74 <?php echo $locale['post']['name'];?>
75 </td>
76 <td>
77 <?php echo htmlentities($profile['name']); ?>
78 </td>
79 </tr>
80 <tr>
81 <td>
82 <?php echo $locale['post']['subject'];?>
83 </td>
84 <td>
85 <input type="text" name="subject" value="<?php echo
86 (isset($subject)?$subject:"");?>" />
87 </td>
88 </tr>
89 <tr>
90 <td>
91 <?php echo $locale['post']['newsgroups'];?>
92 </td>
93 <td>
94 <input type="text" name="newsgroups" value="<?php echo
95 (isset($target)?$target:"");?>" />
96 </td>
97 </tr>
98 <tr>
99 <td>
100 <?php echo $locale['post']['fu2'];?>
101 </td>
102 <td>
103 <input type="text" name="followup" value="" />
104 </td>
105 </tr>
106 <tr>
107 <td>
108 <?php echo $locale['post']['organization'];?>
109 </td>
110 <td>
111 <?php echo $profile['org']; ?>
112 </td>
113 </tr>
114 <tr>
115 <th colspan="2">
116 <?php echo $locale['post']['body'];?>
117 </th>
118 </tr>
119 <tr>
120 <td colspan="2">
121 <textarea name="body" cols="90" rows="10"><?php echo
122 (isset($body)?$body:"").($profile['sig']!=''?"\n\n-- \n"
123 .$profile['sig']:"");?></textarea>
124 </td>
125 </tr>
126 <tr>
127 <td class="bouton" colspan="2">
128 <?php
129 if (isset($group) && isset($id) && isset($_REQUEST['type'])
130 && ($_REQUEST['type']=='followup')) {
131 ?>
132 <input type="hidden" name="type" value="followupok" />
133 <input type="hidden" name="group" value="<?php echo $group;?>" />
134 <input type="hidden" name="id" value="<?php echo $id;?> " />
135 <?php
136 } else {
137 ?>
138 <input type="hidden" name="type" value="new" />
139 <?php
140 }
141 ?>
142 <input type="submit" name="action" value="OK" />
143 </td>
144 </table>
145 </form>
146 <?php
147 displayshortcuts();
148 require("include/footer.inc.php");
149 ?>