<?PHP
/************************************************************************/
/* NPDS V : Net Portal Dynamic System .                                 */
/* ===========================                                          */
/*                                                                      */
/* Original Copyright (c) 2001 by Francisco Burzi (fburzi@ncc.org.ve)   */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2005 by Philippe Brunier   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
function Access_Error () {
  if (file_exists("meta/meta.php"))
     include ("meta/meta.php");
  echo "<title>NPDS</title></head><body bgcolor=\"white\"><br /><p align=\"center\"><span style=\"font-size: 14px; font-family: Arial; font-weight: bold; color: red;\">";
  echo "Access Denied / Acc&egrave;s Refus&eacute;";
  if (cur_charset=="utf-8") echo" / &#x901A;&#x5165;&#x88AB;&#x5426;&#x8BA4;";
  echo "</span>";
  echo "<br /><br /><span style=\"font-size: 12px; font-family: Arial; font-weight: bold; color: black;\">NPDS - Portal System";
  echo "</span></p></body></html>";
  die();
}
if (!eregi("admin.php", $PHP_SELF)) { Access_Error(); }
global $pdst; $pdst="0";

global $language;
$hlpfile = "manuels/$language/leftblocks.html";
$result = mysql_query("select radminleft, radminsuper from authors where aid='$aid'");
list($radminleft, $radminsuper) = mysql_fetch_row($result);
if (($radminleft!=1) and ($radminsuper!=1)) {
   Access_Error();
}

function makelblock($title, $content, $members, $Mmember, $Lindex, $Scache, $BLaide, $SHTML) {
   if (is_array($Mmember) and ($members==1)) {
      $members=implode(",",$Mmember);
      if ($members==0) $members=1;
   }
   if (empty($Lindex)) {$Lindex=0;}
   $title=stripslashes(FixQuotes($title));
   $content = stripslashes(FixQuotes($content));
   if ($SHTML!="ON")
      $content = strip_tags(str_replace("<br />","\n",$content));
   mysql_query("insert INTO lblocks VALUES (NULL,'$title','$content','$members', '$Lindex', '$Scache', '1', '$BLaide')");
   Header("Location: admin.php?op=blocks");
}

function changelblock($id, $title, $content, $members, $Mmember, $Lindex, $Scache, $Sactif, $BLaide) {
   if (is_array($Mmember) and ($members==1)) {
      $members=implode(",",$Mmember);
      if ($members==0) $members=1;
   }
   if (empty($Lindex)) {$Lindex=0;}
   $title=stripslashes(FixQuotes($title));
   if ($Sactif=="ON") {$Sactif=1;} else {$Sactif=0;}
   $content = stripslashes(FixQuotes($content));
   $BLaide = stripslashes(FixQuotes($BLaide));
   mysql_query("update lblocks set title='$title', content='$content', member='$members', Lindex='$Lindex', cache='$Scache', actif='$Sactif', aide='$BLaide' where id='$id'");
   Header("Location: admin.php?op=blocks");
}

function changedroitelblock($id, $title, $content, $members, $Mmember, $Lindex, $Scache, $Sactif, $BLaide) {
   if (is_array($Mmember) and ($members==1)) {
      $members=implode(",",$Mmember);
      if ($members==0) $members=1;
   }
   if (empty($Lindex)) {$Lindex=0;}
   $title=stripslashes(FixQuotes($title));
   if ($Sactif=="ON") {$Sactif=1;} else {$Sactif=0;}
   $content = stripslashes(FixQuotes($content));
   $BLaide = stripslashes(FixQuotes($BLaide));
   mysql_query("INSERT INTO rblocks VALUES (NULL,'$title','$content', '$members', '$Lindex', '$Scache', '$Sactif', '$BLaide')");
   mysql_query("delete from lblocks where id='$id'");
   Header("Location: admin.php?op=blocks");
}

function deletelblock($id) {
   mysql_query("delete from lblocks where id='$id'");
   Header("Location: admin.php?op=blocks");
}

switch($op) {
   case "makelblock":
        makelblock($title, $xtext, $members, $Mmember, $index, $Scache, $Baide, $SHTML);
        break;

   case "deletelblock":
        deletelblock($id);
        break;

   case "changelblock":
        changelblock($id, $title, $content, $members, $Mmember, $Lindex, $Scache, $Sactif, $BLaide);
        break;

   case "droitelblock":
        changedroitelblock($id, $title, $content, $members, $Mmember, $Lindex, $Scache, $Sactif, $BLaide);
        break;
}
?>
