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 >
Wrap
PHP Script
|
2004-09-28
|
7KB
|
214 lines
<?php
if (eregi("block-Flashnews.php",$_SERVER['PHP_SELF'])) {
Header("Location: ../index.php");
die();
}
require("includes/flashnews.config.php"); //natahnout konfiguraci z DB
function showqlink2() {
global $prefix, $db, $maxlimit_down;
$maxlimit_down = intval($maxlimit_down);
$sql = "select title, lid from ".$prefix."_downloads_downloads order by lid DESC limit 0,$maxlimit_down";
$lid = intval($lid);
$result = $db->sql_query($sql);
$resultpocet = $db->sql_numrows($result);
if ($resultpocet == 0) {
$content = "<br>\n";
} else {
if (!$result) {
$content .= ""._FNERRORDB."";
}
$content .= "<font size=\"2\"><b>"._FN_NEWINDOWNLOAD."</b></font>\n<font size=\"1\">";
while ($q = $db->sql_fetchrow($result)) {
$content .= "<b> | </b><a href=\"modules.php?name=Downloads&d_op=viewdownloaddetails&lid=$q[lid]&ttitle=$q[title]\">$q[title]</a>\n";
}
$content .= " <b>|</b>\n</font>\n<br>\n";
}
return $content;
} //konec funkce showqlink2()
function actuality2() {
global $prefix, $db, $bgcolor1, $bgcolor2, $bgcolor3, $user, $admin, $banners, $show_link, $show_flash_news, $maxlimit_admin, $maxlimit_norm, $allow_down, $separator, $allow_add_users;
if ($show_flash_news == 1 ) {
if (is_admin($admin)) { //admin?
$a = 1; //ano
} else {
$a = 0; //ne
}
if (is_user($user)) { //uzivatel?
$u = 1; //ano
} else {
$u = 0; //ne
}
if (!is_active("Flashnews") AND is_admin($admin)) {
$content = ""._FNNOMODUL."<br>"; //upozorneni
}
if (is_admin($admin)) { //pro adminy
$sql = "select count(*) from ".$prefix."_actual as pocet where status='0' and admin='0'";
$result = $db->sql_query($sql);
if (!$result) {
$content .= ""._FNERRORDB."";
}
list($pocet) = $db->sql_fetchrow($result);
$pocet = intval($pocet);
$db->sql_freeresult($result);
$maxlimit_admin = intval($maxlimit_admin);
$sql = "select * from ".$prefix."_actual where status='1' and admin='1' order by date DESC limit 0,$maxlimit_admin";
$result = $db->sql_query($sql);
if (!$result) {
$content.= ""._FNERRORDB."";
}
$s_l=1; //inicializace suda/licha pro barvy
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\n";
$content .= "<tr>\n";
$content .= " <td bgcolor=\"#000000\">\n";
$content .= " <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
$content .= " <tr>\n";
$content .= " <td width=\"100%\" bgcolor=\"$bgcolor3\">\n";
$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";
$content .= " </td>\n";
$content .= " </tr>\n";
while(list($id, $text, $link, $date, $for_admin, $status) = $db->sql_fetchrow($result)) {
$id = intval($id);
$text = stripslashes($text);
$link = stripslashes($link);
$date = intval($date);
$for_admin = intval($for_admin);
$status = intval($status);
$d[1] = date(d,$date);
$d[2] = date(m,$date);
$d[3] = date(Y,$date);
$time=Time()-86400;
$datum = "$d[1]. $d[2]. $d[3]";
if ($link == "http://" OR $link == "") { //zajisti nezobrazeno odkazu v pripade nezadani adresy
$show_link = 0;
} else {
$show_link = 1;
}
if ($s_l%2 == 0) { //stridani barev
$bg = $bgcolor3;
} else {
$bg = $bgcolor2;
}
$content.= " <tr>\n";
$content.= " <td width=\"100%\" bgcolor=\"$bg\">\n";
$content.= " <font size=\"1\">$separator<b>$datum -</b> $text ";
if ($show_link == 1) {
$content.= "<a href=\"$link\">"._FN_MORE."</a>\n";
}
$content.= " </font></td>\n";
$content.= " </tr>\n";
$s_l++; //prictem
}
$content.= " </table>\n";
$content.= " </td>\n";
$content.= "</tr>";
$content.= "</table>";
$db->sql_freeresult($result);
}
//konec jen admini
//pro vsechny
$maxlimit_norm = intval($maxlimit_norm);
$sql = "select * from ".$prefix."_actual where status='1' and admin='0' order by date DESC limit 0,$maxlimit_norm";
$result = $db->sql_query($sql);
if (!$result) {
$content .= ""._FNERRORDB."";
}
$s_l=1; //inicializace suda/licha
$content.= "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\n";
$content.= "<tr>\n";
$content.= " <td bgcolor=\"#000000\">\n";
$content.= " <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
$content.= " <tr>\n";
$content.= " <td width=\"100%\" bgcolor=\"$bgcolor3\">\n";
if (is_active("Flashnews") OR $a == 1) {
$content.= "<b>"._FN_ACTUAL."<font size=\"1\"> | <a href=\"modules.php?name=Flashnews\">"._FN_INDEX1."</a> | </font></b>";
}
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
$content.= "<b><font size=\"1\"><a href=\"modules.php?name=Flashnews&action=showform\">"._FN_INDEX2."</a> |</font></b>\n";
$content.= " </td>\n";
$content.= " </tr>\n";
} else { //pokud nehohou tak nic
$content.= " </td>\n";
$content.= " </tr>\n";
}
while(list($id, $text, $link, $date, $for_admin, $status ) = $db->sql_fetchrow($result)){
$id = intval($id);
$text = stripslashes($text);
$link = stripslashes($link);
$date = intval($date);
$for_admin = intval($for_admin);
$status = intval($status);
if ($link == "http://" OR $link == "") {
$show_link = 0;
} else {
$show_link = 1;
}
$link = base64_encode($link);
$d[1] = date(d,$date);
$d[2] = date(m,$date);
$d[3] = date(Y,$date);
$datum = "$d[1]. $d[2]. $d[3]";
$time=Time()-86400;
if ($time<$date) {
$img = "<sup><font color=\"red\" size=\"-3\">"._FNNEW."</font></sup>";
} else {
$img = "";
}
if ($s_l%2 == 0) { //stridani barev
$bg = $bgcolor3;
} else {
$bg = $bgcolor2;
}
$content.= " <tr>\n";
$content.= " <td width=\"100%\" bgcolor=\"$bg\">\n";
$content.= " <font size=\"1\">";
$content.= " $separator$img <b>$datum -</b> $text ";
if ($show_link == 1) {
$content.= "<a href=\"modules.php?name=Flashnews&action=RediR&url=$link&id=$id\">"._FN_MORE."</a>\n";
}
$content.= " </font></td>\n";
$content.= " </tr>\n";
$s_l++; //prictem
}
$content.= " </table>";
$content.= " </td>";
$content.= "</tr>";
$content.= "</table>";
if ($allow_down == 1) {
$content.= showqlink2();
}
$db->sql_freeresult($result);
return $content;
} else {
return ""._FNNOCONTENT."";
}
}
$content .= actuality2(); //vypiseme aktuality
?>