home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 April
/
PCWorld_2005-04_cd.bin
/
akce
/
web
/
unitednuke
/
unitednuke.exe
/
html
/
admin
/
modules
/
sidebar.php
< prev
next >
Wrap
PHP Script
|
2004-09-28
|
13KB
|
388 lines
<?php
if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }
global $prefix, $db;
$aid = substr(trim($aid), 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
if ($row['radminsuper'] == 1) {
function FlashNewsExist () {
global $db,$prefix;
$sql = "SELECT id FROM ".$prefix."_actual limit 1";
$result = $db->sql_query($sql);
if (!$result) {
return 0;
} else {
return 1;
}
}
$shwsearch = intval($shwsearch);
$searchdown = intval($searchdown);
$btn = intval($btn);
$shwstor = intval($shwstor);
$stornum = intval($stornum);
$shwfn = intval($shwfn);
$fnnum = intval($fnnum);
$shwlad = intval($shwlad);
$ladnum = intval($ladnum);
$shwtopd = intval($shwtopd);
$topdnum = intval($topdnum);
$shwlcomm = intval($shwlcomm);
$lcomm = intval($lcomm);
$shwlfa = intval($shwlfa);
$lfanum = intval($lfanum);
global $shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum;
function WriteConfigForm ($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum,$write = 0) {
global $db,$prefix;
OpenTable();
echo "<center>\n";
echo "<span class=\"title\">"._SIDEBAR_CONFIG."</span>\n";
echo "</center>\n";
CloseTable();
echo "<br>\n";
if ($write) {
OpenTable();
echo "<center>\n";
echo "<span class=\"title\"><font color=\"red\">"._SIDEBAR_SAVECFG."</font></span>\n";
echo "</center>\n";
CloseTable();
echo "<br>\n";
}
if (!is_active("Sidebar")) {
OpenTable();
echo "<center><b>"._SIDEBAR_MODWARN."</b></center>\n";
CloseTable();
echo "<br>\n";
}
OpenTable();
if (!file_exists("images/sidebarlogo.png") AND !file_exists("images/sidebarlogo.gif") AND !file_exists("images/sidebarlogo.jpg")) {
echo "<center><b>"._SIDEBAR_IMGNONEWARNING."</b><br><br>"._SIDEBAR_IMGNONENOTE."</center>\n";
} else {
if (file_exists("images/sidebarlogo.png")) {
$logo = "images/sidebarlogo.png";
} elseif (file_exists("images/sidebarlogo.gif")) {
$logo = "images/sidebarlogo.gif";
} elseif (file_exists("images/sidebarlogo.jpg")) {
$logo = "images/sidebarlogo.jpg";
}
echo "<center><b>"._SIDEBAR_IMGSHOW."</b><br>($logo)</center>\n";
}
CloseTable();
echo "<br>\n";
OpenTable();
echo "<form method=\"post\" action=\"admin.php\">\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo "<tr>\n";
echo " <td width=\"36%\"><b>"._SIDEBAR_SHWSEARCH."</b></td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($shwsearch) {
echo "<input type=\"checkbox\" name=\"shwsearch\" value=\"1\" checked>\n";
} else {
echo "<input type=\"checkbox\" name=\"shwsearch\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_WHERE."</td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($searchdown) {
echo ""._SIDEBAR_TOP." <input type=\"radio\" name=\"searchdown\" value=\"0\">\n";
echo ""._SIDEBAR_DOWN." <input type=\"radio\" name=\"searchdown\" value=\"1\" checked>\n";
} else {
echo ""._SIDEBAR_TOP."<input type=\"radio\" name=\"searchdown\" value=\"0\" checked>\n";
echo ""._SIDEBAR_DOWN." <input type=\"radio\" name=\"searchdown\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_SHWBUTON."</td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($btn) {
echo " <input type=\"checkbox\" name=\"btn\" value=\"1\" checked>\n";
} else {
echo " <input type=\"checkbox\" name=\"btn\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"> </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"><b>"._SIDEBAR_SHWSTORIES."</b></td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($shwstor) {
echo " <input type=\"checkbox\" name=\"shwstor\" value=\"1\" checked>\n";
} else {
echo "<input type=\"checkbox\" name=\"shwstor\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_STORIESNUM."</td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
echo " <input type=\"text\" name=\"stornum\" value=\"$stornum\">\n";
echo " "._SIDEBAR_DEFAULT." </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"> </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\"> </td>\n";
echo "</tr>\n";
if (!FlashNewsExist()) { //neexistuji vypisu hidden
echo "\n\n <INPUT TYPE=\"HIDDEN\" name=\"shwfn\" value=\"0\">\n";
echo "<INPUT TYPE=\"HIDDEN\" name=\"fnnum\" value=\"0\">\n\n";
} else {
echo "<tr>\n";
echo " <td width=\"36%\"><b>"._SIDEBAR_SHWFN."</b><br>"._SIDEBAR_SHWAM."<br><br></td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($shwfn) {
echo " <input type=\"checkbox\" name=\"shwfn\" value=\"1\" checked>\n";
} else {
echo " <input type=\"checkbox\" name=\"shwfn\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_FNNUM."</td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
echo " <input type=\"text\" name=\"fnnum\" value=\"$fnnum\">\n";
echo " "._SIDEBAR_DEFAULT."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"> </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\"> </td>\n";
echo "</tr>\n";
} //konec exituji FN
echo "<tr>\n";
echo " <td width=\"36%\"><b>"._SIDEBAR_SHWLAD."</b></td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($shwlad) {
echo " <input type=\"checkbox\" name=\"shwlad\" value=\"1\" checked>\n";
} else {
echo " <input type=\"checkbox\" name=\"shwlad\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_LADNUM." </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
echo " <input type=\"text\" name=\"ladnum\" value=\"$ladnum\">\n";
echo " "._SIDEBAR_DEFAULT."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"> </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"><b>"._SIDEBAR_SHWTOPD."</b></td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($shwtopd) {
echo " <input type=\"checkbox\" name=\"shwtopd\" value=\"1\" checked>\n";
} else {
echo " <input type=\"checkbox\" name=\"shwtopd\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_TOPDNUM." </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
echo " <input type=\"text\" name=\"topdnum\" value=\"$topdnum\">\n";
echo " "._SIDEBAR_DEFAULT."</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"> </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"><b>"._SIDEBAR_SHWLCOMM."</b></td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($shwlcomm) {
echo " <input type=\"checkbox\" name=\"shwlcomm\" value=\"1\" checked>\n";
} else {
echo " <input type=\"checkbox\" name=\"shwlcomm\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_LCOMMNUM."</td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
echo " <input type=\"text\" name=\"lcomm\" value=\"$lcomm\">\n";
echo " "._SIDEBAR_DEFAULT." </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"> </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"><b>"._SIDEBAR_SHWLFA."</b></td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
if ($shwlfa) {
echo "<input type=\"checkbox\" name=\"shwlfa\" value=\"1\" checked>\n";
} else {
echo "<input type=\"checkbox\" name=\"shwlfa\" value=\"1\">\n";
}
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\">"._SIDEBAR_LFANUM."</td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\">\n";
echo " <input type=\"text\" name=\"lfanum\" value=\"$lfanum\">\n";
echo " "._SIDEBAR_DEFAULT." </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width=\"36%\"> </td>\n";
echo " <td width=\"4%\"> </td>\n";
echo " <td width=\"60%\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td align=\"right\">\n";
echo " </td>\n";
echo " <td align=\"right\">\n";
echo " <INPUT TYPE=\"HIDDEN\" name=\"op\" value=\"SaveConfigSideBar\">\n";
echo " <input type=\"submit\" name=\"Submit\" value=\""._SIDEBAR_SAVE."\">\n";
echo " </td>\n";
echo " </form>\n";
echo " <form method=\"post\" action=\"admin.php\">\n";
echo " <td width=\"60%\" align=\"right\">\n";
echo " <INPUT TYPE=\"HIDDEN\" name=\"op\" value=\"ResetToDef\">\n";
echo " <input type=\"submit\" name=\"Submit2\" value=\""._SIDEBAR_RESET."\">\n";
echo " <br><br>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
CloseTable();
/*
pleas don't remove copyright stuff from here thanks :-0
*/
echo "<table width=\"98%\">\n";
echo "<tr>\n";
echo " <td align=\"right\">\n";
echo " <font size=\"-2\" class=\"content\">"._SIDEBAR_COPY."</font>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
}
function ViewConfigSideBar($write = 0) {
global $db, $prefix;
include("header.php");
GraphicAdmin();
$sql = "SELECT * FROM ".$prefix."_config_sidebar";
$result = $db->sql_query($sql);
if (!$result) {
echo "An error occured";
}
list($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum) = $db->sql_fetchrow($result);
WriteConfigForm ($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum, $write);
include("footer.php");
}
function SaveConfigSideBar($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum, $write) {
global $db,$prefix;
$searchdown = intval($searchdown);
$stornum = intval($stornum);
$fnnum = intval($fnnum);
$ladnum = intval($ladnum);
$topdnum = intval($topdnum);
$lcomm = intval($lcomm);
$lfanum = intval($lfanum);
$write = intval($write);
//boolean values
$shwsearch = intval($shwsearch);
$btn = intval($btn);
$shwstor = intval($shwstor);
$shwfn = intval($shwfn);
$shwlad = intval($shwlad);
$shwtopd = intval($shwtopd);
$shwlcomm = intval($shwlcomm);
$shwlfa = intval($shwlfa);
$sql = "UPDATE ".$prefix."_config_sidebar SET shwsearch='$shwsearch', searchdown='$searchdown', btn='$btn', shwstor='$shwstor', stornum='$stornum', shwfn='$shwfn', fnnum='$fnnum', shwlad='$shwlad', ladnum='$ladnum', shwtopd='$shwtopd', topdnum='$topdnum', shwlcomm='$shwlcomm', lcomm='$lcomm', shwlfa='$shwlfa', lfanum='$lfanum'";
$result = $db->sql_query($sql);
if (!$result) {
echo "An error occured";
} else {
//echo $shwlfa;
Header("Location: admin.php?op=ConfigSideBar&write=1");
}
}
function ResetToDef() {
global $db, $prefix;
$sql = "UPDATE ".$prefix."_config_sidebar SET shwsearch='1', searchdown='0', btn='1', shwstor='1', stornum='3', shwfn='0', fnnum='3', shwlad='1', ladnum='5', shwtopd='0', topdnum='3', shwlcomm='0', lcomm='3', shwlfa='1', lfanum='3'";
$result = $db->sql_query($sql);
if (!$result) {
echo "An error occured";
} else {
Header("Location: admin.php?op=ConfigSideBar&write=1");
}
}
switch ($op) {
case "ConfigSideBar":
ViewConfigSideBar($write);
break;
case "SaveConfigSideBar":
SaveConfigSideBar($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum, 1);
break;
case "ResetToDef":
ResetToDef();
break;
}
} else {
echo "Access Denied";
}
?>