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