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