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