whole bunch of changes :
[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
0d407ce1 10require_once("include/session.inc.php");
cced14b6 11require_once("include/misc.inc.php");
0d407ce1 12require_once("include/format.inc.php");
13require_once("include/config.inc.php");
14require_once("include/NetNNTP.inc.php");
15require_once("include/post.inc.php");
16require_once("include/spool.inc.php");
17require_once("include/password.inc.php");
18require_once("include/profile.inc.php");
0d407ce1 19require_once("include/error.inc.php");
90962c86 20
90962c86 21$profile = getprofile();
0d407ce1 22require_once($profile['locale']);
e2625e72 23
0d407ce1 24require_once("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
a3b667fe 36$nntp = new nntp($news['server']);
37if (!$nntp) error("nntpsock");
90962c86 38if ($news['user']!="anonymous") {
a3b667fe 39 $result = $nntp->authinfo($news["user"],$news["pass"]);
40 if (!$result) error("nntpauth");
90962c86 41}
42
43if (isset($group) && isset($id) && isset($_REQUEST['type']) &&
44 ($_REQUEST['type']=='followup')) {
a3b667fe 45 $rq=$nntp->group($group);
4ee663c5 46 $post = new NNTPPost($nntp,$id);
90962c86 47 if ($post) {
48 $subject = (preg_match("/^re:/i",$post->headers->subject)?"":"Re: ")
49 .$post->headers->subject;
74b61ee2 50 if ($profile['dropsig']) {
cc8e1c4e 51 $cutoff=strpos($post->body,"\n-- \n");
4dab3cce 52 if ($cutoff) {
cc8e1c4e 53 $quotetext = substr($post->body,0,strpos($post->body,"\n-- \n"));
54 } else {
55 $quotetext = $post->body;
56 }
74b61ee2 57 } else {
58 $quotetext = $post->body;
59 }
60 $body = $post->headers->name." wrote :\n".wrap($quotetext, "> ");
90962c86 61 if (isset($post->headers->followup))
62 $target=$post->headers->followup;
63 else
64 $target=$post->headers->newsgroups;
65 }
66}
67
a3b667fe 68$nntp->quit();
90962c86 69?>
40e27a11 70<h1>
90962c86 71 <?php echo $locale['post']['title'];?>
40e27a11 72</h1>
90962c86 73<?php
74
75displayshortcuts();
76
77?>
78
96a4b435 79<form action="thread.php" method="post">
ab192563 80<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
90962c86 81 <tr>
82 <th colspan="2">
83 <?php echo $locale['post']['headers'];?>
84 </th>
85 </tr>
86 <tr>
0af957d1 87 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 88 <?php echo $locale['post']['name'];?>
89 </td>
90 <td>
91 <?php echo htmlentities($profile['name']); ?>
92 </td>
93 </tr>
94 <tr>
0af957d1 95 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 96 <?php echo $locale['post']['subject'];?>
97 </td>
98 <td>
99 <input type="text" name="subject" value="<?php echo
100 (isset($subject)?$subject:"");?>" />
101 </td>
102 </tr>
103 <tr>
0af957d1 104 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 105 <?php echo $locale['post']['newsgroups'];?>
106 </td>
107 <td>
108 <input type="text" name="newsgroups" value="<?php echo
109 (isset($target)?$target:"");?>" />
110 </td>
111 </tr>
112 <tr>
0af957d1 113 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 114 <?php echo $locale['post']['fu2'];?>
115 </td>
116 <td>
117 <input type="text" name="followup" value="" />
118 </td>
119 </tr>
120 <tr>
0af957d1 121 <td class="<?php echo $css['bicoltitre'];?>">
90962c86 122 <?php echo $locale['post']['organization'];?>
123 </td>
124 <td>
125 <?php echo $profile['org']; ?>
126 </td>
127 </tr>
128 <tr>
129 <th colspan="2">
130 <?php echo $locale['post']['body'];?>
131 </th>
132 </tr>
133 <tr>
0af957d1 134 <td class="<?php echo $css['bicolvpadd'];?>" colspan="2">
96a4b435 135 <textarea name="body" cols="90" rows="16"><?php echo
136 (isset($body)?htmlentities($body):"").
137 ($profile['sig']!=''?"\n\n-- \n".htmlentities($profile['sig']):"");?></textarea>
90962c86 138 </td>
139 </tr>
140 <tr>
ab192563 141 <td class="<?php echo $css['bouton']?>" colspan="2">
90962c86 142<?php
143if (isset($group) && isset($id) && isset($_REQUEST['type'])
144 && ($_REQUEST['type']=='followup')) {
145?>
146 <input type="hidden" name="type" value="followupok" />
147 <input type="hidden" name="group" value="<?php echo $group;?>" />
ab192563 148 <input type="hidden" name="id" value="<?php echo $id;?>" />
90962c86 149<?php
150} else {
151?>
152 <input type="hidden" name="type" value="new" />
153<?php
154}
155?>
156 <input type="submit" name="action" value="OK" />
157 </td>
96a4b435 158 </tr>
90962c86 159</table>
160</form>
161<?php
162displayshortcuts();
0d407ce1 163require_once("include/footer.inc.php");
90962c86 164?>