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 >
PHP Script  |  2004-09-28  |  13KB  |  388 lines

  1. <?php
  2. if (!eregi("admin.php", $_SERVER['SCRIPT_NAME'])) { die ("Access Denied"); }
  3. global $prefix, $db;
  4. $aid = substr(trim($aid), 0,25);
  5. $row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
  6. if ($row['radminsuper'] == 1) {
  7.  
  8. function FlashNewsExist () {
  9.   global $db,$prefix;
  10.   $sql = "SELECT id FROM ".$prefix."_actual limit 1";
  11.   $result = $db->sql_query($sql);
  12.  
  13.     if (!$result) {
  14.     return 0;
  15.     } else {
  16.     return 1;
  17.     }
  18.  
  19. }
  20.  
  21. $shwsearch = intval($shwsearch);
  22. $searchdown = intval($searchdown);
  23. $btn = intval($btn);
  24. $shwstor = intval($shwstor);
  25. $stornum = intval($stornum);
  26. $shwfn = intval($shwfn);
  27. $fnnum = intval($fnnum);
  28. $shwlad = intval($shwlad);
  29. $ladnum = intval($ladnum);
  30. $shwtopd = intval($shwtopd);
  31. $topdnum = intval($topdnum);
  32. $shwlcomm = intval($shwlcomm);
  33. $lcomm = intval($lcomm);
  34. $shwlfa = intval($shwlfa);
  35. $lfanum = intval($lfanum);
  36.  
  37. global $shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum;
  38.  
  39. function WriteConfigForm ($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum,$write = 0) {
  40.   global $db,$prefix;
  41. OpenTable();
  42. echo "<center>\n";
  43. echo "<span class=\"title\">"._SIDEBAR_CONFIG."</span>\n";
  44. echo "</center>\n";
  45. CloseTable();
  46. echo "<br>\n";
  47.   if ($write) {
  48.   OpenTable();
  49.   echo "<center>\n";
  50.   echo "<span class=\"title\"><font color=\"red\">"._SIDEBAR_SAVECFG."</font></span>\n";
  51.   echo "</center>\n";
  52.   CloseTable();
  53.   echo "<br>\n";
  54.   }
  55.  
  56.   if (!is_active("Sidebar")) {
  57.   OpenTable();
  58.   echo "<center><b>"._SIDEBAR_MODWARN."</b></center>\n";
  59.   CloseTable();
  60.   echo "<br>\n";
  61.   }
  62.  
  63.   OpenTable();
  64.   if (!file_exists("images/sidebarlogo.png") AND !file_exists("images/sidebarlogo.gif") AND !file_exists("images/sidebarlogo.jpg")) {
  65.     echo "<center><b>"._SIDEBAR_IMGNONEWARNING."</b><br><br>"._SIDEBAR_IMGNONENOTE."</center>\n";
  66.     } else {
  67.     if (file_exists("images/sidebarlogo.png")) {
  68.     $logo = "images/sidebarlogo.png";
  69.     } elseif (file_exists("images/sidebarlogo.gif")) {
  70.     $logo = "images/sidebarlogo.gif";
  71.     } elseif (file_exists("images/sidebarlogo.jpg")) {
  72.     $logo = "images/sidebarlogo.jpg";
  73.     }
  74.     echo "<center><b>"._SIDEBAR_IMGSHOW."</b><br>($logo)</center>\n";
  75.     }
  76.  CloseTable();
  77.  echo "<br>\n";
  78.    
  79.  OpenTable();
  80. echo "<form method=\"post\" action=\"admin.php\">\n";
  81. echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
  82. echo "<tr>\n";
  83. echo "  <td width=\"36%\"><b>"._SIDEBAR_SHWSEARCH."</b></td>\n";
  84. echo "  <td width=\"4%\"> </td>\n";
  85. echo "  <td width=\"60%\">\n";
  86.   if ($shwsearch) {
  87.   echo "<input type=\"checkbox\" name=\"shwsearch\" value=\"1\" checked>\n";
  88.   } else {
  89.   echo "<input type=\"checkbox\" name=\"shwsearch\" value=\"1\">\n";
  90.   }
  91.  
  92. echo "  </td>\n";
  93. echo "</tr>\n";
  94. echo "<tr>\n";
  95. echo "  <td width=\"36%\">"._SIDEBAR_WHERE."</td>\n";
  96. echo "  <td width=\"4%\"> </td>\n";
  97. echo "  <td width=\"60%\">\n";
  98.   if ($searchdown) {
  99.   echo ""._SIDEBAR_TOP." <input type=\"radio\" name=\"searchdown\" value=\"0\">\n";
  100.   echo ""._SIDEBAR_DOWN." <input type=\"radio\" name=\"searchdown\" value=\"1\" checked>\n";
  101.   } else {
  102.   echo ""._SIDEBAR_TOP."<input type=\"radio\" name=\"searchdown\" value=\"0\" checked>\n";
  103.   echo ""._SIDEBAR_DOWN." <input type=\"radio\" name=\"searchdown\" value=\"1\">\n";
  104.   }
  105.  
  106. echo "  </td>\n";
  107. echo "</tr>\n";
  108. echo "<tr>\n";
  109. echo "  <td width=\"36%\">"._SIDEBAR_SHWBUTON."</td>\n";
  110. echo "  <td width=\"4%\"> </td>\n";
  111. echo "  <td width=\"60%\">\n";
  112.  
  113.   if ($btn) {
  114.   echo "  <input type=\"checkbox\" name=\"btn\" value=\"1\" checked>\n";
  115.   } else {
  116.   echo "  <input type=\"checkbox\" name=\"btn\" value=\"1\">\n";
  117.   }
  118.  
  119. echo "  </td>\n";
  120. echo "</tr>\n";
  121. echo "<tr>\n";
  122. echo "  <td width=\"36%\"> </td>\n";
  123. echo "  <td width=\"4%\"> </td>\n";
  124. echo "  <td width=\"60%\"> </td>\n";
  125. echo "</tr>\n";
  126. echo "<tr>\n";
  127. echo "  <td width=\"36%\"><b>"._SIDEBAR_SHWSTORIES."</b></td>\n";
  128. echo "  <td width=\"4%\"> </td>\n";
  129. echo "  <td width=\"60%\">\n";
  130.   if ($shwstor) {
  131.   echo "  <input type=\"checkbox\" name=\"shwstor\" value=\"1\" checked>\n";
  132.   } else {
  133.   echo "<input type=\"checkbox\" name=\"shwstor\" value=\"1\">\n";
  134.   }
  135.  
  136. echo "  </td>\n";
  137. echo "</tr>\n";
  138. echo "<tr>\n";
  139. echo "  <td width=\"36%\">"._SIDEBAR_STORIESNUM."</td>\n";
  140. echo "  <td width=\"4%\"> </td>\n";
  141. echo "  <td width=\"60%\">\n";
  142. echo "  <input type=\"text\" name=\"stornum\" value=\"$stornum\">\n";
  143. echo "  "._SIDEBAR_DEFAULT." </td>\n";
  144. echo "</tr>\n";
  145. echo "<tr>\n";
  146. echo "  <td width=\"36%\"> </td>\n";
  147. echo "  <td width=\"4%\"> </td>\n";
  148. echo "  <td width=\"60%\"> </td>\n";
  149. echo "</tr>\n";
  150.  
  151.   if (!FlashNewsExist())  { //neexistuji vypisu hidden
  152.   echo "\n\n  <INPUT TYPE=\"HIDDEN\" name=\"shwfn\" value=\"0\">\n";
  153.   echo "<INPUT TYPE=\"HIDDEN\" name=\"fnnum\" value=\"0\">\n\n";
  154.   } else  {
  155.   echo "<tr>\n";
  156.   echo "  <td width=\"36%\"><b>"._SIDEBAR_SHWFN."</b><br>"._SIDEBAR_SHWAM."<br><br></td>\n";
  157.   echo "  <td width=\"4%\"> </td>\n";
  158.   echo "  <td width=\"60%\">\n";
  159.     if ($shwfn) {
  160.     echo "  <input type=\"checkbox\" name=\"shwfn\" value=\"1\" checked>\n";
  161.     } else {
  162.     echo "  <input type=\"checkbox\" name=\"shwfn\" value=\"1\">\n";
  163.     }
  164.  
  165. echo "  </td>\n";
  166. echo "</tr>\n";
  167. echo "<tr>\n";
  168. echo "  <td width=\"36%\">"._SIDEBAR_FNNUM."</td>\n";
  169. echo "  <td width=\"4%\"> </td>\n";
  170. echo "  <td width=\"60%\">\n";
  171. echo "  <input type=\"text\" name=\"fnnum\" value=\"$fnnum\">\n";
  172. echo "  "._SIDEBAR_DEFAULT."</td>\n";
  173. echo "</tr>\n";
  174. echo "<tr>\n";
  175. echo "  <td width=\"36%\"> </td>\n";
  176. echo "  <td width=\"4%\"> </td>\n";
  177. echo "  <td width=\"60%\"> </td>\n";
  178. echo "</tr>\n";
  179.                }   //konec exituji FN
  180.  
  181. echo "<tr>\n";
  182. echo "  <td width=\"36%\"><b>"._SIDEBAR_SHWLAD."</b></td>\n";
  183. echo "  <td width=\"4%\"> </td>\n";
  184. echo "  <td width=\"60%\">\n";
  185.   if ($shwlad) {
  186.   echo "  <input type=\"checkbox\" name=\"shwlad\" value=\"1\" checked>\n";
  187.   } else {
  188.   echo "  <input type=\"checkbox\" name=\"shwlad\" value=\"1\">\n";
  189.   }
  190.  
  191. echo "  </td>\n";
  192. echo "</tr>\n";
  193. echo "<tr>\n";
  194. echo "  <td width=\"36%\">"._SIDEBAR_LADNUM." </td>\n";
  195. echo "  <td width=\"4%\"> </td>\n";
  196. echo "  <td width=\"60%\">\n";
  197. echo "  <input type=\"text\" name=\"ladnum\" value=\"$ladnum\">\n";
  198. echo "  "._SIDEBAR_DEFAULT."</td>\n";
  199. echo "</tr>\n";
  200. echo "<tr>\n";
  201. echo "  <td width=\"36%\"> </td>\n";
  202. echo "  <td width=\"4%\"> </td>\n";
  203. echo "  <td width=\"60%\"> </td>\n";
  204. echo "</tr>\n";
  205. echo "<tr>\n";
  206. echo "  <td width=\"36%\"><b>"._SIDEBAR_SHWTOPD."</b></td>\n";
  207. echo "  <td width=\"4%\"> </td>\n";
  208. echo "  <td width=\"60%\">\n";
  209.  
  210.   if ($shwtopd) {
  211.   echo "  <input type=\"checkbox\" name=\"shwtopd\" value=\"1\" checked>\n";
  212.   } else {
  213.   echo "  <input type=\"checkbox\" name=\"shwtopd\" value=\"1\">\n";
  214.   }
  215.  
  216. echo "  </td>\n";
  217. echo "</tr>\n";
  218. echo "<tr>\n";
  219. echo "  <td width=\"36%\">"._SIDEBAR_TOPDNUM." </td>\n";
  220. echo "  <td width=\"4%\"> </td>\n";
  221. echo "  <td width=\"60%\">\n";
  222. echo "  <input type=\"text\" name=\"topdnum\" value=\"$topdnum\">\n";
  223. echo "  "._SIDEBAR_DEFAULT."</td>\n";
  224. echo "</tr>\n";
  225. echo "<tr>\n";
  226. echo "  <td width=\"36%\"> </td>\n";
  227. echo "  <td width=\"4%\"> </td>\n";
  228. echo "  <td width=\"60%\"> </td>\n";
  229. echo "</tr>\n";
  230. echo "<tr>\n";
  231. echo "  <td width=\"36%\"><b>"._SIDEBAR_SHWLCOMM."</b></td>\n";
  232. echo "  <td width=\"4%\"> </td>\n";
  233. echo "  <td width=\"60%\">\n";
  234.  
  235.   if ($shwlcomm) {
  236.   echo "  <input type=\"checkbox\" name=\"shwlcomm\" value=\"1\" checked>\n";
  237.   } else {
  238.   echo "  <input type=\"checkbox\" name=\"shwlcomm\" value=\"1\">\n";
  239.   }
  240.  
  241. echo "  </td>\n";
  242. echo "</tr>\n";
  243. echo "<tr>\n";
  244. echo "  <td width=\"36%\">"._SIDEBAR_LCOMMNUM."</td>\n";
  245. echo "  <td width=\"4%\"> </td>\n";
  246. echo "  <td width=\"60%\">\n";
  247. echo "  <input type=\"text\" name=\"lcomm\" value=\"$lcomm\">\n";
  248. echo "  "._SIDEBAR_DEFAULT." </td>\n";
  249. echo "</tr>\n";
  250. echo "<tr>\n";
  251. echo "  <td width=\"36%\"> </td>\n";
  252. echo "  <td width=\"4%\"> </td>\n";
  253. echo "  <td width=\"60%\"> </td>\n";
  254. echo "</tr>\n";
  255. echo "<tr>\n";
  256. echo "  <td width=\"36%\"><b>"._SIDEBAR_SHWLFA."</b></td>\n";
  257. echo "  <td width=\"4%\"> </td>\n";
  258. echo "  <td width=\"60%\">\n";
  259.   
  260.   if ($shwlfa) {
  261.   echo "<input type=\"checkbox\" name=\"shwlfa\" value=\"1\" checked>\n";
  262.   } else {
  263.   echo "<input type=\"checkbox\" name=\"shwlfa\" value=\"1\">\n";
  264.   }
  265.  
  266. echo "  </td>\n";
  267. echo "</tr>\n";
  268. echo "<tr>\n";
  269. echo "  <td width=\"36%\">"._SIDEBAR_LFANUM."</td>\n";
  270. echo "  <td width=\"4%\"> </td>\n";
  271. echo "  <td width=\"60%\">\n";
  272. echo "  <input type=\"text\" name=\"lfanum\" value=\"$lfanum\">\n";
  273. echo "  "._SIDEBAR_DEFAULT." </td>\n";
  274. echo "</tr>\n";
  275. echo "<tr>\n";
  276. echo "  <td width=\"36%\"> </td>\n";
  277. echo "  <td width=\"4%\"> </td>\n";
  278. echo "  <td width=\"60%\"> </td>\n";
  279. echo "</tr>\n";
  280. echo "<tr>\n";
  281. echo "  <td align=\"right\">\n";
  282. echo "  </td>\n";
  283. echo "  <td align=\"right\">\n";
  284. echo "  <INPUT TYPE=\"HIDDEN\" name=\"op\" value=\"SaveConfigSideBar\">\n";
  285. echo "  <input type=\"submit\" name=\"Submit\" value=\""._SIDEBAR_SAVE."\">\n";
  286. echo "  </td>\n";
  287. echo "  </form>\n";
  288. echo "  <form method=\"post\" action=\"admin.php\">\n";
  289. echo "  <td width=\"60%\" align=\"right\">\n";
  290. echo "  <INPUT TYPE=\"HIDDEN\" name=\"op\" value=\"ResetToDef\">\n";
  291. echo "  <input type=\"submit\" name=\"Submit2\" value=\""._SIDEBAR_RESET."\">\n";
  292. echo "  <br><br>\n";
  293. echo "  </td>\n";
  294. echo "</tr>\n";
  295. echo "</table>\n";
  296. echo "</form>\n";
  297. CloseTable();
  298.    /*
  299.    pleas don't remove copyright stuff from here thanks :-0
  300.    */
  301. echo "<table width=\"98%\">\n";
  302. echo "<tr>\n";
  303. echo "  <td  align=\"right\">\n";
  304. echo "  <font size=\"-2\" class=\"content\">"._SIDEBAR_COPY."</font>\n";
  305. echo "  </td>\n";
  306. echo "</tr>\n";
  307. echo "</table>\n";
  308. }
  309.  
  310. function ViewConfigSideBar($write = 0) {
  311.   global $db, $prefix;
  312. include("header.php");
  313. GraphicAdmin();
  314.  
  315. $sql = "SELECT * FROM ".$prefix."_config_sidebar";
  316. $result = $db->sql_query($sql);
  317.   if (!$result) {
  318.   echo "An error occured";
  319.   }
  320.   list($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum) = $db->sql_fetchrow($result);
  321.   WriteConfigForm ($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum, $write);
  322.   include("footer.php");
  323. }
  324.  
  325. function SaveConfigSideBar($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum, $write) {
  326.   global $db,$prefix;
  327.  
  328. $searchdown = intval($searchdown);
  329. $stornum = intval($stornum);
  330. $fnnum = intval($fnnum);
  331. $ladnum = intval($ladnum);
  332. $topdnum = intval($topdnum);
  333. $lcomm = intval($lcomm);
  334. $lfanum = intval($lfanum);
  335. $write = intval($write);
  336. //boolean values
  337. $shwsearch = intval($shwsearch);
  338. $btn = intval($btn);
  339. $shwstor = intval($shwstor);
  340. $shwfn = intval($shwfn);
  341. $shwlad = intval($shwlad);
  342. $shwtopd = intval($shwtopd);
  343. $shwlcomm = intval($shwlcomm);
  344. $shwlfa = intval($shwlfa);
  345.  
  346. $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'";
  347. $result = $db->sql_query($sql);
  348.   if (!$result) {
  349.   echo "An error occured";
  350.   } else {
  351.   //echo $shwlfa;
  352.   Header("Location: admin.php?op=ConfigSideBar&write=1");
  353.   }
  354. }
  355.  
  356. function ResetToDef() {
  357.   global $db, $prefix;
  358.  
  359.   $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'";
  360.   $result = $db->sql_query($sql);
  361.     if (!$result) {
  362.     echo "An error occured";
  363.     } else {
  364.     Header("Location: admin.php?op=ConfigSideBar&write=1");
  365.     }
  366. }
  367.  
  368. switch ($op) {
  369.  
  370.     case "ConfigSideBar":
  371.     ViewConfigSideBar($write);
  372.     break;
  373.  
  374.     case "SaveConfigSideBar":
  375.     SaveConfigSideBar($shwsearch, $searchdown, $btn, $shwstor, $stornum, $shwfn, $fnnum, $shwlad, $ladnum, $shwtopd, $topdnum, $shwlcomm, $lcomm, $shwlfa, $lfanum, 1);
  376.     break;
  377.  
  378.     case "ResetToDef":
  379.     ResetToDef();
  380.     break;
  381.         }
  382.  
  383.  
  384. } else {
  385.     echo "Access Denied";
  386. }
  387.  
  388. ?>