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