| 1 | <?php |
| 2 | /******************************************************************************** |
| 3 | * article.php : article 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/wrapper.inc.php"); |
| 13 | require("include/format.inc.php"); |
| 14 | require("include/config.inc.php"); |
| 15 | require("include/NetNNTP.inc.php"); |
| 16 | require("include/spool.inc.php"); |
| 17 | require("include/post.inc.php"); |
| 18 | require("include/profile.inc.php"); |
| 19 | require("include/password.inc.php"); |
| 20 | |
| 21 | $profile=getprofile(); |
| 22 | require($profile['locale']); |
| 23 | |
| 24 | require("include/header.inc.php"); |
| 25 | |
| 26 | if (isset($_REQUEST['group'])) { |
| 27 | $group=htmlentities(strtolower($_REQUEST['group'])); |
| 28 | } |
| 29 | if (isset($_REQUEST['id'])) { |
| 30 | $id=htmlentities(strtolower($_REQUEST['id'])); |
| 31 | } |
| 32 | |
| 33 | $mynntp = new nntp($news['server']); |
| 34 | if (!$mynntp) { |
| 35 | echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>"; |
| 36 | require("include/footer.inc.php"); |
| 37 | exit; |
| 38 | } |
| 39 | |
| 40 | if ($news['user']!="anonymous") { |
| 41 | $result = $mynntp->authinfo($news["user"],$news["pass"]); |
| 42 | if (!$result) { |
| 43 | echo "<p class=\"error\">\n\tYou have provided bad credentials to " |
| 44 | ."the server. Good bye !\n</p>"; |
| 45 | require("include/footer.inc.php"); |
| 46 | exit; |
| 47 | } |
| 48 | } |
| 49 | $spool = new spool($mynntp,$group,$profile['display'],$profile['lastnews']); |
| 50 | if (!$spool) { |
| 51 | echo "<p class=\"error\">\n\tError while accessing group.\n</p>"; |
| 52 | require("include/footer.inc.php"); |
| 53 | exit; |
| 54 | } |
| 55 | $mynntp->group($group); |
| 56 | |
| 57 | $post = new post($mynntp,$id); |
| 58 | if (!$post) { |
| 59 | if ($mynntp->lasterrorcode == "423") { |
| 60 | $spool->delid($id); |
| 61 | } |
| 62 | echo "<p class=\"error\">\n\tError while reading message.\n</p>"; |
| 63 | require("include/footer.inc.php"); |
| 64 | exit; |
| 65 | } |
| 66 | |
| 67 | $ndx = $spool->getndx($id); |
| 68 | |
| 69 | ?> |
| 70 | <div class="<?php echo $css['title']?>"> |
| 71 | <?php echo $locale['article']['message'];?> |
| 72 | </div> |
| 73 | |
| 74 | <?php |
| 75 | if (isset($_GET['type']) && ($_GET['type']=='cancel') && (checkcancel($post->headers))) { |
| 76 | ?> |
| 77 | <p class="<?php echo $css['error']?>"> |
| 78 | <?php echo $locale['article']['cancel'];?> |
| 79 | <form action="thread.php" method="post"> |
| 80 | <input type="hidden" name="group" value="<?php echo $group;?>" /> |
| 81 | <input type="hidden" name="id" value="<?php |
| 82 | echo $id;?>" /> |
| 83 | <input type="hidden" name="type" value="cancel" /> |
| 84 | <input type="submit" name="action" value="<?php echo |
| 85 | $locale['article']['okbtn'];?>" /> |
| 86 | </form> |
| 87 | </p> |
| 88 | <? |
| 89 | } |
| 90 | |
| 91 | displayshortcuts(); |
| 92 | ?> |
| 93 | |
| 94 | <table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" |
| 95 | summary="<?php echo $locale['article']['summary'];?>"> |
| 96 | <tr> |
| 97 | <th colspan="2"> |
| 98 | <?php echo $locale['article']['headers'];?> |
| 99 | </th> |
| 100 | </tr> |
| 101 | <?php |
| 102 | foreach ($news['head'] as $real => $nick) { |
| 103 | if (isset($post->headers->$nick)) |
| 104 | echo "<tr><td class=\"{$css['bicoltitre']}\">$real</td>" |
| 105 | ."<td>".formatdisplayheader($nick,$post->headers->$nick,$spool) |
| 106 | ."</td></tr>\n"; |
| 107 | } |
| 108 | ?> |
| 109 | <tr> |
| 110 | <th colspan="2"> |
| 111 | <?php echo $locale['article']['body'];?> |
| 112 | </th> |
| 113 | </tr> |
| 114 | <tr> |
| 115 | <td colspan="2"> |
| 116 | <pre><?php echo formatbody($post->body); ?></pre> |
| 117 | </td> |
| 118 | </tr> |
| 119 | <tr> |
| 120 | <th colspan="2"> |
| 121 | <?php echo $locale['article']['overview'];?> |
| 122 | </th> |
| 123 | </tr> |
| 124 | <tr> |
| 125 | <td class="<?php echo $css['nopadd']?>" colspan="2"> |
| 126 | <table class="<?php echo $css['overview']?>" cellpadding="0" |
| 127 | cellspacing="0" summary="overview"> |
| 128 | <?php |
| 129 | $spool->disp($ndx-$news['threadtop'],$ndx+$news['threadbottom'],$ndx); |
| 130 | ?> |
| 131 | </table> |
| 132 | </td> |
| 133 | </tr> |
| 134 | </table> |
| 135 | <?php |
| 136 | displayshortcuts(); |
| 137 | |
| 138 | require("include/footer.inc.php"); |
| 139 | ?> |