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