home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / unitednuke / unitednuke.exe / html / blocks / block-Flashnews.php < prev    next >
PHP Script  |  2004-09-28  |  7KB  |  214 lines

  1. <?php
  2.  
  3. if (eregi("block-Flashnews.php",$_SERVER['PHP_SELF'])) {
  4.     Header("Location: ../index.php");
  5.     die();
  6. }
  7.  
  8. require("includes/flashnews.config.php"); //natahnout konfiguraci z DB
  9.  
  10. function showqlink2() {
  11.   global $prefix, $db, $maxlimit_down;
  12. $maxlimit_down = intval($maxlimit_down);
  13. $sql = "select title, lid from ".$prefix."_downloads_downloads order by lid DESC limit 0,$maxlimit_down";
  14. $lid = intval($lid);
  15. $result = $db->sql_query($sql);
  16. $resultpocet = $db->sql_numrows($result);
  17. if ($resultpocet == 0) {
  18.     $content = "<br>\n";
  19. } else {
  20.     if (!$result) {
  21.     $content .= ""._FNERRORDB."";
  22.     }
  23.     $content .= "<font size=\"2\"><b>"._FN_NEWINDOWNLOAD."</b></font>\n<font size=\"1\">";
  24.     while ($q = $db->sql_fetchrow($result)) {
  25.     $content .= "<b> | </b><a href=\"modules.php?name=Downloads&d_op=viewdownloaddetails&lid=$q[lid]&ttitle=$q[title]\">$q[title]</a>\n";
  26.     }
  27.     $content .= " <b>|</b>\n</font>\n<br>\n";
  28.   }
  29.     return $content;
  30. } //konec funkce showqlink2()
  31.  
  32.  
  33.  
  34. function actuality2() {
  35.   global $prefix, $db, $bgcolor1, $bgcolor2, $bgcolor3, $user, $admin, $banners, $show_link, $show_flash_news, $maxlimit_admin, $maxlimit_norm, $allow_down, $separator, $allow_add_users;
  36. if ($show_flash_news == 1 ) {
  37.   if (is_admin($admin)) { //admin?
  38.    $a = 1;                    //ano
  39.    } else {
  40.    $a = 0;                  //ne
  41.    }
  42.  
  43. if (is_user($user)) { //uzivatel?
  44.    $u = 1;                     //ano
  45.    } else {
  46.    $u = 0;                     //ne
  47.    }
  48.  
  49. if (!is_active("Flashnews") AND is_admin($admin)) {
  50. $content = ""._FNNOMODUL."<br>"; //upozorneni
  51. }
  52.  
  53. if (is_admin($admin)) { //pro adminy
  54.   $sql = "select count(*) from ".$prefix."_actual as pocet where status='0' and admin='0'";
  55.   $result = $db->sql_query($sql);
  56.   if (!$result) {
  57.   $content .= ""._FNERRORDB."";
  58.   }
  59. list($pocet) = $db->sql_fetchrow($result);
  60. $pocet = intval($pocet);
  61. $db->sql_freeresult($result);
  62. $maxlimit_admin = intval($maxlimit_admin);
  63. $sql = "select * from ".$prefix."_actual where status='1' and admin='1' order by date DESC limit 0,$maxlimit_admin";
  64. $result = $db->sql_query($sql);
  65.   if (!$result) {
  66.   $content.= ""._FNERRORDB."";
  67.   }
  68. $s_l=1; //inicializace suda/licha pro barvy
  69. $content .= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\n";
  70. $content .= "<tr>\n";
  71. $content .= "  <td bgcolor=\"#000000\">\n";
  72. $content .= "  <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
  73. $content .= "  <tr>\n";
  74. $content .= "    <td width=\"100%\" bgcolor=\"$bgcolor3\">\n";
  75. $content .= "    <b><a href=\"admin.php?op=FlashMain\">"._FN_ADMIN2."</a><font size=\"1\"> | <a href=\"modules.php?name=Flashnews&action=showJSmenu\">"._FN_INDEX1."</a> | <A href=\"admin.php?op=NewFlash\">"._FN_INDEX2."</a> | "._FN_INDEX3." [$pocet]</font></b>\n";
  76. $content .= "    </td>\n";
  77. $content .= "  </tr>\n";
  78. while(list($id, $text, $link, $date, $for_admin, $status) = $db->sql_fetchrow($result)) {
  79. $id = intval($id);
  80. $text = stripslashes($text);
  81. $link = stripslashes($link);
  82. $date = intval($date);
  83. $for_admin = intval($for_admin);
  84. $status = intval($status);
  85. $d[1] = date(d,$date);
  86. $d[2] = date(m,$date);
  87. $d[3] = date(Y,$date);
  88. $time=Time()-86400;
  89.  
  90. $datum = "$d[1]. $d[2]. $d[3]";
  91.  
  92.   if ($link == "http://" OR $link == "") { //zajisti nezobrazeno odkazu v pripade nezadani adresy
  93.   $show_link = 0;
  94.   } else {
  95.   $show_link = 1;
  96.   }
  97.  
  98.   if ($s_l%2 == 0) { //stridani barev
  99.   $bg = $bgcolor3;
  100.   } else {
  101.   $bg = $bgcolor2;
  102.   }
  103. $content.= "  <tr>\n";
  104. $content.= "    <td width=\"100%\" bgcolor=\"$bg\">\n";
  105. $content.= "    <font size=\"1\">$separator<b>$datum -</b> $text ";
  106. if ($show_link == 1) {
  107. $content.= "<a href=\"$link\">"._FN_MORE."</a>\n";
  108. }
  109. $content.= "    </font></td>\n";
  110. $content.= "  </tr>\n";
  111.  
  112. $s_l++;    //prictem
  113. }
  114. $content.= "  </table>\n";
  115. $content.= "  </td>\n";
  116. $content.= "</tr>";
  117. $content.= "</table>";
  118. $db->sql_freeresult($result);
  119. }
  120. //konec jen admini
  121.  
  122. //pro vsechny
  123. $maxlimit_norm = intval($maxlimit_norm);
  124. $sql = "select * from ".$prefix."_actual where status='1' and admin='0' order by date DESC limit 0,$maxlimit_norm";
  125. $result = $db->sql_query($sql);
  126.   if (!$result)  {
  127.   $content .= ""._FNERRORDB."";
  128.   }
  129.  $s_l=1; //inicializace suda/licha
  130.  
  131. $content.= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\n";
  132. $content.= "<tr>\n";
  133. $content.= "  <td bgcolor=\"#000000\">\n";
  134. $content.= "  <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
  135. $content.= "  <tr>\n";
  136. $content.= "    <td width=\"100%\" bgcolor=\"$bgcolor3\">\n";
  137.  if (is_active("Flashnews") OR $a == 1) {
  138. $content.= "<b>"._FN_ACTUAL."<font size=\"1\"> | <a href=\"modules.php?name=Flashnews\">"._FN_INDEX1."</a> | </font></b>";
  139.  }
  140.  if (is_active("Flashnews") AND $allow_add_users==1 and $u==1 or $a==1){        //pokud mohou registrovani posilat a je navstevnik nebo admin zobraz
  141. $content.= "<b><font size=\"1\"><a href=\"modules.php?name=Flashnews&action=showform\">"._FN_INDEX2."</a> |</font></b>\n";
  142. $content.= "    </td>\n";
  143. $content.= "  </tr>\n";
  144.  } else {                              //pokud nehohou tak nic
  145. $content.= "    </td>\n";
  146. $content.= "  </tr>\n";
  147.   }
  148.  
  149. while(list($id, $text, $link, $date, $for_admin, $status ) = $db->sql_fetchrow($result)){
  150. $id = intval($id);
  151. $text = stripslashes($text);
  152. $link = stripslashes($link);
  153. $date = intval($date);
  154. $for_admin = intval($for_admin);
  155. $status = intval($status);
  156.  
  157.   if ($link == "http://" OR $link == "") {
  158.   $show_link = 0;
  159.   } else {
  160.   $show_link = 1;
  161.   }
  162.  
  163. $link = base64_encode($link);
  164. $d[1] = date(d,$date);
  165. $d[2] = date(m,$date);
  166. $d[3] = date(Y,$date);
  167. $datum = "$d[1]. $d[2]. $d[3]";
  168. $time=Time()-86400;
  169.  
  170. if ($time<$date) {
  171.      $img = "<sup><font color=\"red\" size=\"-3\">"._FNNEW."</font></sup>";
  172.      } else {
  173.      $img = "";
  174.      }
  175.  
  176.   if ($s_l%2 == 0) {      //stridani barev
  177.   $bg = $bgcolor3;
  178.   } else {
  179.   $bg = $bgcolor2;
  180.   }
  181. $content.= "  <tr>\n";
  182. $content.= "    <td width=\"100%\" bgcolor=\"$bg\">\n";
  183. $content.= "    <font size=\"1\">";
  184. $content.= " $separator$img <b>$datum -</b> $text ";
  185.   if ($show_link == 1) {
  186. $content.= "<a href=\"modules.php?name=Flashnews&action=RediR&url=$link&id=$id\">"._FN_MORE."</a>\n";
  187.   }
  188. $content.= "    </font></td>\n";
  189. $content.= "  </tr>\n";
  190.  
  191. $s_l++;       //prictem
  192.  
  193. }
  194. $content.= "  </table>";
  195. $content.= "  </td>";
  196. $content.= "</tr>";
  197. $content.= "</table>";
  198.  
  199.   if ($allow_down == 1) {
  200. $content.= showqlink2();
  201.   }
  202.  
  203. $db->sql_freeresult($result);
  204.  
  205. return $content;
  206. } else {
  207. return ""._FNNOCONTENT."";
  208. }
  209. }
  210.  
  211. $content .= actuality2();      //vypiseme aktuality
  212.  
  213. ?>
  214.