3 tons or rewrite
[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
2dbc0167 10require_once("include/banana.inc.php");
0d407ce1 11require_once("include/header.inc.php");
2dbc0167 12
ab192563 13if (isset($_REQUEST['group'])) {
2dbc0167 14 $group = htmlentities(strtolower($_REQUEST['group']));
ab192563 15}
16if (isset($_REQUEST['id'])) {
2dbc0167 17 $id = htmlentities(strtolower($_REQUEST['id']));
ab192563 18}
90962c86 19
20if (isset($group)) {
01681efd 21 $target = $group;
90962c86 22}
23
2dbc0167 24if (isset($group) && isset($id) && isset($_REQUEST['type']) && ($_REQUEST['type']=='followup')) {
25 $rq = $banana->nntp->group($group);
26 $post = new BananaPost($id);
27 $body = '';
01681efd 28 if ($post) {
2dbc0167 29 $subject = (preg_match("/^re\s*:\s*/i", $post->headers['subject']) ? '' : 'Re: ').$post->headers['subject'];
30 $body = $post->name." wrote :\n".wrap($post->body, "> ");
31 $target = isset($post->headers['followup-to']) ? $post->headers['followup-to'] : $post->headers['newsgroups'];
01681efd 32 }
90962c86 33}
34
2dbc0167 35$banana->nntp->quit();
90962c86 36?>
40e27a11 37<h1>
0a65ec9d 38 <?php echo _b_('Nouveau message'); ?>
40e27a11 39</h1>
90962c86 40<?php
41
42displayshortcuts();
43
44?>
45
96a4b435 46<form action="thread.php" method="post">
ab192563 47<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
90962c86 48 <tr>
49 <th colspan="2">
0a65ec9d 50 <?php echo _b_('En-têtes'); ?>
90962c86 51 </th>
52 </tr>
53 <tr>
0af957d1 54 <td class="<?php echo $css['bicoltitre'];?>">
0a65ec9d 55 <?php echo _b_('Nom'); ?>
90962c86 56 </td>
57 <td>
2dbc0167 58 <?php echo htmlentities($banana->profile['name']); ?>
90962c86 59 </td>
60 </tr>
61 <tr>
0af957d1 62 <td class="<?php echo $css['bicoltitre'];?>">
0a65ec9d 63 <?php echo _b_('Sujet'); ?>
90962c86 64 </td>
65 <td>
2dbc0167 66 <input type="text" name="subject" value="<?php if (isset($subject)) echo $subject; ?>" />
90962c86 67 </td>
68 </tr>
69 <tr>
0af957d1 70 <td class="<?php echo $css['bicoltitre'];?>">
0a65ec9d 71 <?php echo _b_('Forums'); ?>
90962c86 72 </td>
73 <td>
2dbc0167 74 <input type="text" name="newsgroups" value="<?php if (isset($target)) echo $target; ?>" />
90962c86 75 </td>
76 </tr>
77 <tr>
0af957d1 78 <td class="<?php echo $css['bicoltitre'];?>">
0a65ec9d 79 <?php echo _b_('Suivi-à'); ?>
90962c86 80 </td>
81 <td>
82 <input type="text" name="followup" value="" />
83 </td>
84 </tr>
85 <tr>
0af957d1 86 <td class="<?php echo $css['bicoltitre'];?>">
0a65ec9d 87 <?php echo _b_('Organisation'); ?>
90962c86 88 </td>
89 <td>
2dbc0167 90 <?php echo $banana->profile['org']; ?>
90962c86 91 </td>
92 </tr>
93 <tr>
94 <th colspan="2">
0a65ec9d 95 <?php echo _b_('Corps'); ?>
90962c86 96 </th>
97 </tr>
98 <tr>
0af957d1 99 <td class="<?php echo $css['bicolvpadd'];?>" colspan="2">
2dbc0167 100 <textarea name="body" cols="90" rows="16"><?php
101 echo htmlentities($body);
102 if ($banana->profile['sig']) echo "\n\n-- \n".htmlentities($banana->profile['sig']);
103 ?></textarea>
90962c86 104 </td>
105 </tr>
106 <tr>
ab192563 107 <td class="<?php echo $css['bouton']?>" colspan="2">
90962c86 108<?php
109if (isset($group) && isset($id) && isset($_REQUEST['type'])
110 && ($_REQUEST['type']=='followup')) {
111?>
112 <input type="hidden" name="type" value="followupok" />
113 <input type="hidden" name="group" value="<?php echo $group;?>" />
ab192563 114 <input type="hidden" name="id" value="<?php echo $id;?>" />
90962c86 115<?php
116} else {
117?>
118 <input type="hidden" name="type" value="new" />
119<?php
120}
121?>
122 <input type="submit" name="action" value="OK" />
123 </td>
96a4b435 124 </tr>
90962c86 125</table>
126</form>
127<?php
128displayshortcuts();
0d407ce1 129require_once("include/footer.inc.php");
90962c86 130?>