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