<?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";

$result = mysql_query("select radminsuper from authors where aid='$aid'");
list($radminsuper) = mysql_fetch_row($result);
if ($radminsuper!=1) {
   Access_Error();
}

function removeComment ($tid, $sid, $mode, $order) {
    global $ultramode;
    $result=mysql_query("select tid from comments where pid='$tid'");
    $num_pid=mysql_num_rows($result);
    $result=mysql_query("select tid from comments where tid='$tid'");
    $num_tid=mysql_num_rows($result);

    if (($num_pid==0) and ($num_tid!=0)) {
       mysql_query("DELETE FROM comments where tid='$tid'");
       mysql_query("update stories set comments=comments-1 where sid='$sid'");
    }
    if ($ultramode) {
        ultramode();
    }
    Header("Location: article.php?sid=$sid&mode=$mode&order=$order");
}

function RemovePollComment ($tid, $pollID, $mode, $order) {
    $result=mysql_query("select tid from pollcomments where pid='$tid'");
    $num_pid=mysql_num_rows($result);
    $result=mysql_query("select tid from pollcomments where tid='$tid'");
    $num_tid=mysql_num_rows($result);

    if (($num_pid==0) and ($num_tid!=0)) {
       mysql_query("DELETE FROM pollcomments where tid='$tid' and pollID='$pollID'");
    }
    Header("Location: pollBooth.php?op=results&pollID=$pollID&mode=$mode&order=$order");
}

switch ($op) {
    case "RemoveComment":
       removeComment($tid, $sid, $mode, $order);
       break;

    case "RemovePollComment":
       RemovePollComment($tid, $pollID, $mode, $order);
       break;
}
?>
