<?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/submissions.html";
$result = mysql_query("select radminarticle, radminsuper from authors where aid='$aid'");
list($radminarticle, $radminsuper) = mysql_fetch_row($result);
if (($radminarticle!=1) and ($radminsuper!=1)) {
   Access_Error();
}

function submissions() {
    global $hlpfile, $aid, $radminsuper;
    $dummy = 0;
    include ("header.php");
    GraphicAdmin($hlpfile);
    OpenTable();
    $result = mysql_query("SELECT qid, subject, timestamp, topic FROM queue order by timestamp");
    if (mysql_num_rows($result) == 0) {
       echo "<table width=\"100%\"><tr><td align=\"center\"><b>".adm_translate("Pas de nouveaux Articles postés")."</b></td></tr></table>\n";
    } else {
       echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\"><tr><td class=\"HEADER\">\n";
       echo adm_translate("Nouveaux Articles postés");
       echo "</td></tr></table>\n";
       echo "<form action=\"admin.php\" method=\"post\">
       <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
       while (list($qid, $subject, $timestamp, $topic) = mysql_fetch_row($result)) {
          if ($topic<1) {$topic = 1;}
          $affiche=false;
          $result2=mysql_query("select topicadmin, topictext from topics where topicid='$topic'");
          list ($topicadmin, $topictext)=mysql_fetch_row($result2);
          if ($radminsuper) {
             $affiche=true;
          } else {
             $topicadminX=explode(",",$topicadmin);
             for ($i = 0; $i < count($topicadminX); $i++) {
                if (trim($topicadminX[$i])==$aid) $affiche=true;
             }
          }
          $rowcolor = tablos();
          echo "<tr $rowcolor><td width=\"5%\" align=\"right\">\n";
          if ($subject=="") { $subject=adm_translate("Aucun Sujet");}
          $subject=aff_langue($subject);
          if ($affiche) {
             echo aff_langue($topictext)."&nbsp;</td><td width=\"70%\" align=\"left\"><a href=\"admin.php?op=DisplayStory&amp;qid=$qid\" class=\"NOIR\">".$subject."</a></td>";
          } else {
             echo aff_langue($topictext)."&nbsp;</td><td width=\"70%\" align=\"left\"><i>".$subject."</i></td>";
          }
          echo "<td nowrap=\"nowrap\" align=\"right\">".formatTimestamp($timestamp)."&nbsp;</td>";
          if ($affiche) {
             echo "<td nowrap=\"nowrap\"><a href=\"admin.php?op=DeleteStory&amp;qid=$qid\" class=\"ROUGE\">".adm_translate("Effacer")."</a></td></tr>\n";
          } else {
             echo "<td nowrap=\"nowrap\">&nbsp;</td></tr>\n";
          }
          $dummy++;
       }
       if ($dummy < 1) {
          echo "<tr><td align=\"center\"><b>".adm_translate("Pas de nouveaux Articles postés")."</b></form></td></tr></table>\n";
       } else {
          echo "</table></form>\n";
       }
    }
    CloseTable();
    include ("footer.php");
}

switch ($op) {
    default:
        submissions();
        break;
}
?>