home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / unitednuke / unitednuke.exe / html / backend.php < prev    next >
PHP Script  |  2004-01-31  |  8KB  |  165 lines

  1. <?php
  2. /************************************************************************/
  3. /*                                        */
  4. /*                                                                      */
  5. /* Copyright (c) 2002 by Michal Soukup                                  */
  6. /* http://www.boule.cz                                                   */
  7. /*                                                                      */
  8. /* upraveno/pridano generovani obrazku a konverzni funkce pro cestinu   */
  9. /* Vydano pod GNU/GPL verze 2                                           */
  10. /*                                                                      */
  11. /*For UNITED-NUKE rewritten by Jiri Stavinoha - http://united-nuke.openland.cz */
  12. /************************************************************************/
  13.  
  14. /************************************************************************/
  15. /* PHP-NUKE: Advanced Content Management System                         */
  16. /* ============================================                         */
  17. /*                                                                      */
  18. /* Copyright (c) 2002 by Francisco Burzi                                */
  19. /* http://phpnuke.org                                                   */
  20. /*                                                                      */
  21. /* This program is free software. You can redistribute it and/or modify */
  22. /* it under the terms of the GNU General Public License as published by */
  23. /* the Free Software Foundation; either version 2 of the License.       */
  24. /************************************************************************/
  25.  
  26. include("mainfile.php");
  27. global $prefix, $db, $nukeurl;
  28. if (isset($help))
  29.     {
  30.     include ("includes/backend_help.php");
  31.     exit();
  32.     }
  33. header("Content-Type: text/xml");
  34. $cat = intval($cat);
  35. $enc = strtolower($enc);
  36. if ($cat != "") {
  37.     $sql = "SELECT catid from ".$prefix."_stories_cat where title LIKE '%$cat%' limit 1";
  38.     $result = $db->sql_query($sql);
  39.     $catid = $db->sql_fetchrow($result);
  40.     if ($catid == "") {
  41.         $sql = "SELECT sid, title FROM ".$prefix."_stories ORDER BY sid DESC limit 10";
  42.     $result = $db->sql_query($sql);
  43.     } else {
  44.         $catid = intval($catid);
  45.         $sql = "SELECT sid, title FROM ".$prefix."_stories WHERE catid='$catid' ORDER BY sid DESC limit 10";
  46.     $result = $db->sql_query($sql);
  47.     }
  48. } else {
  49.     $sql = "SELECT sid, title FROM ".$prefix."_stories ORDER BY sid DESC limit 10";
  50.     $result = $db->sql_query($sql);
  51. }
  52.         if ($enc == "iso")
  53.              {
  54.              $charset = "iso-8859-2";
  55.              }
  56.         elseif($enc == "win")
  57.              {
  58.              $charset = "windows-1250";
  59.              }
  60.         elseif($enc == "asci")
  61.              {
  62.              $charset = "ISO-8859-1";
  63.              }
  64.         else
  65.              {
  66.              $charset = _CHARSET;
  67.              }
  68.     if($enc == "") {
  69.     $charset = _CHARSET;
  70.     $backend_language = str_replace ("_","-",$backend_language); //v rss nesmi byt podtrzitko ale pomlcka
  71.         $echo_content  = "<?xml version=\"1.0\" encoding=\"$charset\"?>\n";
  72.         $echo_content .= "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n\n";
  73.         $echo_content .= " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
  74.         $echo_content .= "<rss version=\"0.91\">\n\n";
  75.         $echo_content .= "<channel>\n";
  76.     $echo_content.= "<title>".htmlspecialchars($sitename)."</title>\n";
  77.     $echo_content.= "<link>$nukeurl</link>\n";
  78.     $echo_content.= "<description>".htmlspecialchars($backend_title)."</description>\n";
  79.     $echo_content.= "<language>$backend_language</language>\n\n";
  80.     $echo_content.= "<item>\n";
  81.     $echo_content.= "<title>"._BE_BADSET."</title>\n";
  82.     $echo_content.= "<link>$nukeurl/backend.php?help=1</link>\n";
  83.     $echo_content.= "</item>\n\n";
  84.     $echo_content.= "<item>\n";
  85.     $echo_content.= "<title>"._BE_INFO."</title>\n";
  86.     $echo_content.= "<link>http://united-nuke.openland.cz</link>\n";
  87.     $echo_content.= "</item>\n\n";
  88.     $echo_content.= "</channel>\n";
  89.         $echo_content .= "</rss>\n";
  90.     echo "$echo_content";
  91.              } else {
  92.         $backend_language = str_replace ("_","-",$backend_language); //v rss nesmi byt podtrzitko ale pomlcka
  93.         $echo_content  = "<?xml version=\"1.0\" encoding=\"$charset\"?>\n\n";
  94.         $echo_content .= "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
  95.         $echo_content .= " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
  96.         $echo_content .= "<rss version=\"0.91\">\n\n";
  97.         $echo_content .= "<channel>\n";
  98.         $echo_content .= "<title>".htmlspecialchars($sitename)."</title>\n";
  99.         $echo_content .= "<link>$nukeurl</link>\n";
  100.         $echo_content .= "<description>".htmlspecialchars($backend_title)."</description>\n";
  101.         $echo_content .= "<language>$backend_language</language>\n\n";
  102.         if (isset($img) AND $img == 1)
  103.             {
  104.             $echo_content .= "<image>\n";
  105.             $echo_content .= "<title>".htmlspecialchars($sitename)."</title>\n";
  106.             $echo_content .= "<url>$nukeurl/themes/$Default_Theme/images/rsslogo.gif</url>\n";
  107.             $echo_content .= "<link>$nukeurl</link>\n";
  108.             $echo_content .= "<description>".htmlspecialchars($backend_title)."</description>\n";
  109.             /*$echo_content .= "<width>98</width>\n"; // pro libovolne logo zakomentovano
  110.             $echo_content .= "<height>27</height>\n";*/
  111.             $echo_content .= "</image>\n\n";
  112.             }
  113.  
  114.      while ($row = $db->sql_fetchrow($result)) {
  115.      $rsid = intval($row['sid']);
  116.      $rtitle = $row['title'];
  117.      $echo_content .= "<item>\n";
  118.      $echo_content .= "<title>".htmlspecialchars($rtitle)."</title>\n";
  119.      $echo_content .= "<link>$nukeurl/modules.php?name=News&file=article&sid=$rsid</link>\n";
  120.      $echo_content .= "</item>\n\n";
  121.      }
  122.  
  123.         $echo_content .= "</channel>\n\n";
  124.         $echo_content .= "</rss>\n";
  125.  
  126.         $a = _CHARSET;  //nastaveno v root/language/lang-czech.php  windows-1250/iso-8859-2
  127.         if (($a=="iso-8859-2") AND ($charset=="iso-8859-2"))
  128.              {
  129.              echo "$echo_content";
  130.              }
  131.         elseif (($a == "windows-1250") AND ($charset == "windows-1250"))
  132.              {
  133.              echo "$echo_content";
  134.              }
  135.         elseif (($a == "iso-8859-2") AND ($charset == "windows-1250"))
  136.              {
  137.              // konvertuju z ISO do WIN
  138.              $echo_content = StrTr($echo_content,"⌐╣«╛Ñ╡½╗ª¼╢╝í▒","____╝╛______Ñ╣");  //iso to win conversion
  139.              echo "$echo_content";
  140.              }
  141.         elseif (($a == "windows-1250") AND ($charset == "iso-8859-2"))
  142.              {
  143.              // konvertuju z WIN do ISO
  144.              $echo_content = StrTr($echo_content,"____╝╛______Ñ╣","⌐╣«╛Ñ╡½╗ª¼╢╝í▒");  //WIN to ISO
  145.              echo "$echo_content";
  146.              }
  147.         elseif (($a == "windows-1250") AND ($charset == "ISO-8859-1"))
  148.              {
  149.              // konvertuju z WIN do ASCI
  150.              $echo_content = StrTr($echo_content, "ßΣΦ∩Θ∞δφ╛≥⌠≤÷α°__·∙ⁿ²_┴─╚╧╔╠╦═╝╥╙╓╘╪└__┌┘▄▌_","aacdeeeilnooorrstuuuyzAACDEEELINOOORRSTUUUYZ"); //WIN to ASCI
  151.              echo "$echo_content";
  152.              }
  153.         elseif (($a=="iso-8859-2") AND ($charset=="ISO-8859-1"))
  154.              {
  155.              // konvertuju z ISO latin 2 do ASCI
  156.              $echo_content = StrTr($echo_content, "ßΣΦ∩Θ∞δφ╡≥≤÷⌠α°╣╗·∙ⁿ²╛┴─╚╧╔╠╦═Ñ╥╙╓╘╪└⌐½┌┘▄▌«","aacdeeeilnooorrstuuuyzAACDEEELINOOORRSTUUUYZ"); //iso to ASCI
  157.              echo "$echo_content";
  158.              }
  159.          else
  160.              {
  161.              echo "$echo_content";
  162.              }
  163. }
  164. ?>
  165.