Witam, korzystam ze skryptu PSnews w wersji 1.1.smile.gif

Chcę dać wszystkie newsy w osobną zakładkę a na stronie głównej wyświetlać tylko jeden i ostatni news. W tym celu skopiowałem show.php i nadałem mu nazwę last.php ...
I teraz pytanie, co przerobić w last.php aby nie wyświetlało stronicowania oraz pokazywało tylko ostatni news?

Pozdrawiam. smile.gif

KOD last.php:
  1. <?
  2. if(eregi("://", $newspath)){
  3. die("Nieautoryzowany dostęp!");
  4. }
  5. if(!isset($newspath)){
  6. $newspath = "news";
  7. }
  8. include("$newspath/functions.php");
  9. $config = confload($newspath);
  10.  
  11. $userlist_f = file("$newspath/users.inc.php");
  12. unset($userlist_f[0]);
  13. unset($userlist_f[count($userlist_f)]);
  14. reset($userlist_f);
  15. while((list($key, $val) = each($userlist_f))&&($logged!="true")){
  16. $expl = explode("||", $val);
  17. $userlist[$expl[0]] = $expl;
  18. }
  19.  
  20. /* FUNKCJE */
  21. function news_wiadomosc($wiadomosc){
  22. global $config;
  23. global $newspath;
  24. return tplparse(array('{WIADOMOSC}'),array($wiadomosc),$config["template"],$newspath,"wiadomosc.html");
  25. }
  26. switch($_GET["function"]){
  27.  
  28. /* STRONA GŁÓWNA */
  29. default:
  30. $newsfile = file("$newspath/news.txt");
  31. $count = count($newsfile);
  32. if($config["stronicownie"] != "off"){
  33. if(!isset($_GET["npage"])){ $npage = "1"; }
  34. else{ $npage = $_GET["npage"]; }
  35. $ilestron = $count/$config["stronicowanie"];
  36. $ilestron = ceil($ilestron);
  37. $begin = $count - $config["stronicowanie"]*($npage-1);
  38. if($begin>$count){ $begin = $count; }
  39. $end = $begin - $config["stronicowanie"];
  40. if($end<0){ $end = 0; }
  41. }
  42. else{
  43. $begin = $count;
  44. $end = 0;
  45. }
  46. for($i=$begin-1; $i>=$end;$i--){
  47. $news = explode("||", $newsfile[$i]);
  48. if($config["skracanie"] != "off"){
  49. $news[2] = ps_substr($news[2], $config["skracanie"], "... [<a href=\"".$config["adres"]."function=show_all&no=$news[0]\">więcej</a>]");
  50. }
  51. $news[2] = pscode($news[2]);
  52. if($config["emoty_news"] == "tak"){
  53. $news[2] = emots($news[2], $newspath);
  54. }
  55. $news[2] = stripslashes($news[2]);
  56. $news[2] = preg_replace("'\\|\\|'s", "||", $news[2]);
  57.  
  58. $news[1] = stripslashes($news[1]);
  59. $news[1] = preg_replace("'\\|\\|'s", "||", $news[1]);
  60.  
  61. $news[1] = wordwrap($news[1], 50, " ", 1);
  62. $news[2] = wordwrap($news[2], 50, " ", 1);
  63.  
  64.  
  65. $data = date("d.m.Y, H:i", $news[3]);
  66.  
  67. if($config["nimgs"]=="tak"){
  68. $img_path = "$newspath/nimgs/$news[5]";
  69. if((file_exists($img_path))&&($news[5]!="brak")&&($news[5]!="")){
  70. $news[2] = "<img src=\"$img_path\" align=\"".$config["nimgs_align"]."\" border=0> ".$news[2];
  71. }
  72. }
  73.  
  74. if(file_exists("$newspath/komentarze/$news[0]")){
  75. $komfile = @file("$newspath/komentarze/$news[0]");
  76. $ilekomentarzy = count($komfile);
  77. }
  78. else{ $ilekomentarzy = 0; }
  79.  
  80. $print_center.= tplparse(array('{TYTUL}','{NEWS}','{AUTOR}','{EMAIL}','{DATA}','{KOMENTARZE}','{ILEKOMENTARZY}'),array($news[1],$news[2],$userlist[$news[4]][3],$userlist[$news[4]][4],$data,$config["adres"]."function=show_all&no=$news[0]",$ilekomentarzy),$config["template"],$newspath,"news.html");
  81. }
  82. if($config["stronicownie"] != "off"){
  83. $print_center.= "<br><center>";
  84. if($npage>1){ $prevp = $npage-1; $print_center.= "<a href=\"".$config["adres"]."npage=$prevp\"><<</a>"; }
  85. else{ $print_center.= "<<"; }
  86. $print_center.= " $npage z $ilestron ";
  87. if($npage<$ilestron){ $nextp = $npage+1; $print_center.= "<a href=\"". $config["adres"] ."npage=$nextp\">>></a>"; }
  88. else{ $print_center.= ">>"; }
  89. $print_center.= "</center><br>";
  90. }
  91. break;
  92.  
  93. /* CAŁOŚĆ NEWSA + KOMENTARZE */
  94. case show_all:
  95. $newsfile = file("$newspath/news.txt");
  96. reset($newsfile);
  97. foreach($newsfile as $news){
  98. $news = explode("||", $news);
  99. if($news[0] == $_GET["no"]){
  100. $news[2] = pscode($news[2]);
  101. if($config["emoty_news"] == "tak"){
  102. $news[2] = emots($news[2], $newspath);
  103. }
  104. $news[2] = stripslashes($news[2]);
  105. $news[2] = preg_replace("'\\|\\|'s", "||", $news[2]);
  106.  
  107. $news[1] = stripslashes($news[1]);
  108. $news[1] = preg_replace("'\\|\\|'s", "||", $news[1]);
  109.  
  110. $news[1] = wordwrap($news[1], 50, " ", 1);
  111. $news[2] = wordwrap($news[2], 50, " ", 1);
  112.  
  113. $data = date("d.m.Y, H:i", $news[3]);
  114.  
  115. if($config["nimgs"]=="tak"){
  116. $img_path = "$newspath/nimgs/$news[5]";
  117. if((file_exists($img_path))&&($news[5]!="brak")&&($news[5]!="")){
  118. $news[2] = "<img src=\"$img_path\" align=\"".$config["nimgs_align"]."\" border=0> ".$news[2];
  119. }
  120. }
  121.  
  122. if(file_exists("$newspath/komentarze/$news[0]")){
  123. $komfile = file("$newspath/komentarze/$news[0]");
  124. $ilekomentarzy = count($komfile);
  125. }
  126. else{ $ilekomentarzy = 0; }
  127.  
  128. $print_center.= tplparse(array('{TYTUL}','{NEWS}','{AUTOR}','{EMAIL}','{DATA}','{KOMENTARZE}','{ILEKOMENTARZY}'),array($news[1],$news[2],$userlist[$news[4]][3],$userlist[$news[4]][4],$data,$config["adres"]."function=show_all&no=$news[0]",$ilekomentarzy),$config["template"],$newspath,"news.html");
  129. }
  130. }
  131. $print_center.= "<center>[<a href=\"". $config["adres"] ."function=add_kom&no=". $_GET["no"] ."\">skomentuj</a>] [<a href=\"". $config["adres"] ."\">wróć do newsów</a>]</center><br>";
  132.  
  133. if($ilekomentarzy<1){ $print_center.= news_wiadomosc("Do tego newsa nie dodano jeszcze żadnego komentarza.<br>[<a href=\"".$config["adres"]."function=add_kom&no=".$_GET["no"]."\">skomentuj</a>]"); }
  134. else{
  135. reset($komfile);
  136. foreach($komfile as $kom){
  137. $kom = explode("||", $kom);
  138. if($config["emoty_kom"] == "tak"){
  139. $kom[1] = emots($kom[1], $newspath);
  140. }
  141. $kom[2] = stripslashes($kom[2]);
  142. $kom[2] = preg_replace("'\\|\\|'s", "||", $kom[2]);
  143.  
  144.  
  145. $kom[1] = stripslashes($kom[1]);
  146. $kom[1] = preg_replace("'\\|\\|'s", "||", $kom[1]);
  147.  
  148. $kom[1] = wordwrap($kom[1], 50, " ", 1);
  149. $kom[2] = wordwrap($kom[2], 50, " ", 1);
  150.  
  151. $data = date("d.m.Y, H:i", $kom[4]);
  152.  
  153. $print_center.= tplparse(array('{KOMENTARZ}','{AUTOR}','{EMAIL}','{DATA}'),array($kom[1],$kom[2],$kom[3],$data),$config["template"],$newspath,"komentarz.html");
  154. }
  155. }
  156.  
  157. break;
  158.  
  159. /* DODAWANIE KOMENTARZA */
  160. case add_kom:
  161. $banfile = file("$newspath/ban.txt");
  162. $ip = $_SERVER["REMOTE_ADDR"];
  163. $ban = "false";
  164. foreach($banfile as $linia){
  165. $linia = explode("||", $linia);
  166. if($linia[0] == $ip){ $ban = "true"; }
  167. }
  168. if($ban == "true"){
  169. $print_center = news_wiadomosc("Przepraszamy, ale nie masz zezwolenia na dodanie komentarza, ponieważ twoje IP ($ip) zostało zablokowane przez administratora.<br>[<a href=\"".$config["adres"]."\">wróć do newsów</a>]");
  170. }
  171. else{
  172. if($_GET["do"] == "save"){
  173. $filename = "$newspath/komentarze/".$_GET["no"];
  174. if(file_exists($filename)){
  175. $kom_autor = $_POST["kom_autor"];
  176. $kom_email = $_POST["kom_email"];
  177. $komentarz = $_POST["komentarz"];
  178. $kom_autor = strip_tags($kom_autor);
  179. $kom_email = strip_tags($kom_email);
  180. $komentarz = strip_tags($komentarz);
  181. $kom_autor = str_replace("|", "\\|", $kom_autor);
  182. $kom_email = str_replace("|", "\\|", $kom_email);
  183. $komentarz = str_replace("|", "\\|", $komentarz);
  184. $kom_autor = preg_replace("'\n|\r\n|\r'si", "", $kom_autor);
  185. $kom_email = preg_replace("'\n|\r\n|\r'si", "", $kom_email);
  186. $komentarz = preg_replace("'\n|\r\n|\r'si", "<br>", $komentarz);
  187. $numer = max_l_plik(0, "||", $filename)+1;
  188.  
  189. $file = fopen($filename, "a+");
  190. flock($file, 2);
  191. $puts = "$numer||$komentarz||$kom_autor||$kom_email||".time()."||$ip||\n";
  192. fputs($file, $puts);
  193. flock($file, 3);
  194. fclose($file);
  195. $print_center = news_wiadomosc("Twój komentarz został dodany.<br>[<a href=".$config["adres"].">wróć do newsów</a>]");
  196. }
  197. else{
  198. $print_center = news_wiadomosc("Nie można dodać komentarza - brak pliku z bazą danych do tego newsa.<br>[<a href=".$config["adres"].">wróć do newsów</a>]");
  199. }
  200. }
  201. else{
  202. $print_center.= "
  203. <form action=\"". $config["adres"]."function=add_kom&no=".$_GET["no"]."&do=save\" method=post name=formularz>
  204. Autor:<br><input type=text name=\"kom_autor\"><br>
  205. Email:<br><input type=text name=\"kom_email\"><br>
  206. Komentarz:<br>";
  207. if($config["emoty_kom"] == "tak"){ $print_center.= list_emots($newspath,"komentarz")."<br>"; }
  208. $print_center.= "<textarea style=\"width:300; height:150\" name=\"komentarz\"></textarea><br>
  209. <input type=submit value=\"dodaj\">
  210. <br><a href=\"".$config["adres"]."\">[rezygnuj]</a>
  211. </form>
  212. ";
  213. }
  214. }
  215. break;
  216. }
  217.  
  218.  
  219.  
  220. /* WYŚWIETLANIE */
  221. eval("?>".$print_center."<?");
  222.  
  223. //proszę nie usuwać oraz nie zmieniać poniższej linii - złamiesz w ten sposób prawa autorskie! Uszanuj pracę programisty!
  224. print('<center><a href="http://www.imps.pl" target="_blank" title="[&copy; 2003/2004 by IMPSystems]">Powered by PsNews</a></center>');
  225. ?>


Proszę o pomoc. Nie potrafię sam tego zrobić!

Czy mogę liczyć na jakąś pomoc?