<?PHP
/************************************************************************/
/* DUNE by NPDS                                                         */
/* ===========================                                          */
/*                                                                      */
/* Based on PhpNuke 4.x source code                                     */
/*                                                                      */
/* NPDS Copyright (c) 2002-2007 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 () {
  include("admin/die.php");
}
if (!eregi("admin.php", $PHP_SELF)) { Access_Error(); }

global $language;
$hlpfile = "manuels/$language/submissions.html";
$result = sql_query("select radminarticle, radminsuper from ".$NPDS_Prefix."authors where aid='$aid'");
list($radminarticle, $radminsuper) = sql_fetch_row($result);
if (($radminarticle!=1) and ($radminsuper!=1)) {
   Access_Error();
}

function submissions() {
    global $hlpfile, $aid, $radminsuper;
    global $NPDS_Prefix;

    $dummy = 0;
    include ("header.php");
    GraphicAdmin($hlpfile);
    opentable();
    $result = sql_query("SELECT qid, subject, timestamp, topic FROM ".$NPDS_Prefix."queue order by timestamp");
    if (sql_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) = sql_fetch_row($result)) {
          if ($topic<1) {$topic = 1;}
          $affiche=false;
          $result2=sql_query("select topicadmin, topictext from ".$NPDS_Prefix."topics where topicid='$topic'");
          list ($topicadmin, $topictext)=sql_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;
}
?>