use h1
[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;
74b61ee2 51 if ($profile['dropsig']) {
cc8e1c4e 52 $cutoff=strpos($post->body,"\n-- \n");
4dab3cce 53 if ($cutoff) {
cc8e1c4e 54 $quotetext = substr($post->body,0,strpos($post->body,"\n-- \n"));
55 } else {
56 $quotetext = $post->body;
57 }
74b61ee2 58 } else {
59 $quotetext = $post->body;
60 }
61 $body = $post->headers->name." wrote :\n".wrap($quotetext, "> ");
90962c86 62 if (isset($post->headers->followup))
63 $target=$post->headers->followup;
64 else
65 $target=$post->headers->newsgroups;
66 }
67}
68
a3b667fe 69$nntp->quit();
90962c86 70?>
40e27a11 71<h1>
90962c86 72 <?php echo $locale['post']['title'];?>
40e27a11 73</h1>
90962c86 74<?php
75
76displayshortcuts();
77
78?>
79
96a4b435 80<form action="thread.php" method="post">
ab192563 81<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
90962c86 82 <tr>
83 <th colspan="2">
84 <?php echo $locale['post']['headers'];?>
85 </th>
86 </tr>
87 <tr>
0af957d1 88 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 89 <?php echo $locale['post']['name'];?>
90 </td>
91 <td>
92 <?php echo htmlentities($profile['name']); ?>
93 </td>
94 </tr>
95 <tr>
0af957d1 96 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 97 <?php echo $locale['post']['subject'];?>
98 </td>
99 <td>
100 <input type="text" name="subject" value="<?php echo
101 (isset($subject)?$subject:"");?>" />
102 </td>
103 </tr>
104 <tr>
0af957d1 105 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 106 <?php echo $locale['post']['newsgroups'];?>
107 </td>
108 <td>
109 <input type="text" name="newsgroups" value="<?php echo
110 (isset($target)?$target:"");?>" />
111 </td>
112 </tr>
113 <tr>
0af957d1 114 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 115 <?php echo $locale['post']['fu2'];?>
116 </td>
117 <td>
118 <input type="text" name="followup" value="" />
119 </td>
120 </tr>
121 <tr>
0af957d1 122 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 123 <?php echo $locale['post']['organization'];?>
124 </td>
125 <td>
126 <?php echo $profile['org']; ?>
127 </td>
128 </tr>
129 <tr>
130 <th colspan="2">
131 <?php echo $locale['post']['body'];?>
132 </th>
133 </tr>
134 <tr>
0af957d1 135 <td class="<?php echo $css['bicolvpadd'];?>" colspan="2">
96a4b435 136 <textarea name="body" cols="90" rows="16"><?php echo
137 (isset($body)?htmlentities($body):"").
138 ($profile['sig']!=''?"\n\n-- \n".htmlentities($profile['sig']):"");?></textarea>
90962c86 139 </td>
140 </tr>
141 <tr>
ab192563 142 <td class="<?php echo $css['bouton']?>" colspan="2">
90962c86 143<?php
144if (isset($group) && isset($id) && isset($_REQUEST['type'])
145 && ($_REQUEST['type']=='followup')) {
146?>
147 <input type="hidden" name="type" value="followupok" />
148 <input type="hidden" name="group" value="<?php echo $group;?>" />
ab192563 149 <input type="hidden" name="id" value="<?php echo $id;?>" />
90962c86 150<?php
151} else {
152?>
153 <input type="hidden" name="type" value="new" />
154<?php
155}
156?>
157 <input type="submit" name="action" value="OK" />
158 </td>
96a4b435 159 </tr>
90962c86 160</table>
161</form>
162<?php
163displayshortcuts();
164require("include/footer.inc.php");
165?>