home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 March / PCWorld_2001-03_cd.bin / KOMUNIK / progweb / progweb.exe / phpnuke / html / admin / rightblocks.php < prev    next >
PHP Script  |  2000-12-05  |  4KB  |  114 lines

  1. <?PHP
  2.  
  3. ######################################################################
  4. # PHP-NUKE: Web Portal System
  5. # ===========================
  6. #
  7. # Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
  8. # http://phpnuke.org
  9. #
  10. # This modules is the main administration part
  11. #
  12. # This program is free software. You can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License.
  15. ######################################################################
  16.  
  17. if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
  18. $hlpfile = "manual/rightblocks.html";
  19. $result = mysql_query("select radminright, radminsuper from authors where aid='$aid'");
  20. list($radminright, $radminsuper) = mysql_fetch_row($result);
  21. if (($radminright==1) OR ($radminsuper==1)) {
  22.  
  23. /*********************************************************/
  24. /* RIGHT Blocks Functions                                */
  25. /*********************************************************/
  26.  
  27. function rblocks() {
  28.     global $hlpfile, $admin;
  29.     include("header.php");
  30.     GraphicAdmin($hlpfile);
  31.     OpenTable();
  32.     echo "
  33.     <font size=4><b><center>".translate("Edit Right Blocks")."</b></center></font><br><br>
  34.     ";
  35.     $result = mysql_query("select id, title, content from rblocks");
  36.     if (mysql_num_rows($result) > 0) {
  37.         while(list($id, $title, $content) = mysql_fetch_array($result)) {
  38. ?>
  39.             <?php echo ""; ?>
  40.             <form action="admin.php" method="post">
  41.             <?php echo translate("Title:"); ?>
  42.             <input class=textbox type="text" name="title" size="30" maxlength="60" value="<?php echo $title; ?>"><br>
  43.             <?php echo translate("Content:"); ?>
  44.             <br><textarea class=textbox cols="50" rows="6" name="content"><?php echo $content; ?></textarea><br>
  45.             <input type="hidden" name="id" value="<?php echo $id; ?>">
  46.             <select name="op">
  47.             <option VALUE="changerblock" SELECTED><?php echo translate("changerblock"); ?></option>
  48.             <option VALUE="deleterblock"><?php echo translate("deleterblock"); ?></option>
  49.             </select>
  50.             <input type="submit" VALUE="<?php echo translate("Go!"); ?>">
  51.             </form>
  52.             <br><br>
  53. <?php
  54.         }
  55.     }
  56.     echo "<hr noshade> 
  57.     <font size=4><b><center>".translate("Create New Right Block")."</b></center></font><br><br>";
  58.     ?>
  59.     <form action="admin.php" method="post">
  60.     <?php echo translate("Title:"); ?>
  61.     <input class=textbox type="text" name="title" size=30 maxlength=60><br>
  62.     <?php echo translate("Content:"); ?><br>
  63.     <textarea class=textbox wrap=virtual cols=50 rows=6 name=content></textarea><br>
  64.     <input type="hidden" NAME="op" VALUE="makerblock">
  65.     <input type="submit" VALUE="<?php echo translate("makerblock") ?>">
  66.     </form></td></tr></table></td></tr></table>
  67.     <?php
  68.     include("footer.php");
  69. }
  70.  
  71. function makerblock($title, $content) {
  72.     $title = stripslashes(FixQuotes($title));
  73.     $content = stripslashes(FixQuotes($content));
  74.     mysql_query("INSERT INTO rblocks VALUES (NULL,'$title','$content')");
  75.     Header("Location: admin.php?op=rblocks");
  76. }
  77.  
  78. function changerblock($id, $title, $content) {
  79.     $title = stripslashes(FixQuotes($title));
  80.     $content = stripslashes(FixQuotes($content));
  81.     mysql_query("update rblocks set title='$title', content='$content' where id=$id");
  82.     Header("Location: admin.php?op=rblocks");
  83. }
  84.  
  85. function deleterblock($id) {
  86.     mysql_query("delete from rblocks where id='$id'");
  87.     Header("Location: admin.php?op=rblocks");
  88. }
  89.  
  90.  
  91. switch($op) {
  92.  
  93.         case "rblocks":
  94.             rblocks();
  95.             break;
  96.  
  97.         case "makerblock":
  98.             makerblock($title, $content);
  99.             break;
  100.  
  101.         case "deleterblock":
  102.             deleterblock($id);
  103.             break;
  104.  
  105.         case "changerblock":
  106.             changerblock($id, $title, $content);
  107.             break;
  108.  
  109. }
  110.  
  111. } else {
  112.     echo "Access Denied";
  113. }
  114. ?>