<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* 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.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
    Header("Location: index.php");
}


   $dummy = 0;
    incoh();
    menunews();
    Max_OpenTable();
    echo "<center><font class='title'><b>"._SUBMISSIONSADMIN."</b></font></center>";
    Max_CloseTable();
    br('1');
    Max_OpenTable();
        $result = $GLOBALS['db']->sql_query("SELECT `qid`, `uid`, `uname`, `subject`, `timestamp`, `alanguage` FROM `".TABLE_QUEUE."` order by `timestamp` DESC");
        if($GLOBALS['db']->sql_numrows($result) == 0) {
            echo "<table width=\"100%\"><tr><td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._NOSUBMISSIONS."</b></td></tr></table>\n";
        } else {
            echo "<center><font class=\"content\"><b>"._NEWSUBMISSIONS."</b></font><form action=\"".$admin_file.".php\" method=\"post\"><table width=\"100%\" border=\"1\" bgcolor=\"$bgcolor2\"><tr><td><b>&nbsp;"._TITLE."&nbsp;</b></td>";
            if ($multilingual == 1) {
                  echo "<td><b><center>&nbsp;"._LANGUAGE."&nbsp;</center></b></td>";
            }
                echo "<td><b><center>&nbsp;"._AUTHOR."&nbsp;</center></b></td><td><b><center>&nbsp;"._DATE."&nbsp;</center></b></td><td><b><center>&nbsp;"._FUNCTIONS."&nbsp;</center></b></td></tr>\n";
            while (list($qid, $uid, $uname, $subject, $timestamp, $alanguage) = $GLOBALS['db']->sql_fetchrow($result)) {
                $qid = $GLOBALS['db']->XMFnum($qid);
                $uid = $GLOBALS['db']->XMFnum($uid);
                /*
                $hour = "AM";
                ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $timestamp, $datetime);
                if ($datetime[4] > 12) { $datetime[4] = $datetime[4]-12; $hour = "PM"; }
                $datetime = date(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
                */
                echo "<tr>\n";
                echo "<td width=\"100%\"><font class=\"content\">\n";
                if ($subject == "") {
                    echo "&nbsp;<a href=\"".$admin_file.".php?op=DisplayStory&amp;qid=$qid\">"._NOSUBJECT."</a></font>\n";
                } else {
                    echo "&nbsp;<a href=\"".$admin_file.".php?op=DisplayStory&amp;qid=$qid\">$subject</a></font>\n";
                }
                if ($multilingual == 1) {
                        if ($alanguage == "") {
                                    $alanguage = _ALL;
                        }
                        echo "</td><td align=\"center\"><font size=\"2\">&nbsp;$alanguage&nbsp;</font>\n";
                }
                if ($uname != $anonymous) {
                        echo "</td><td align=\"center\" nowrap><font size=\"2\">&nbsp;<a href='modules.php?name=Your_Account&op=userinfo&username=$uname'>$uname</a>&nbsp;</font>\n";
                } else {
                        echo "</td><td align=\"center\" nowrap><font size=\"2\">&nbsp;$uname&nbsp;</font>\n";
                }
                $timestamp = explode(" ", $timestamp);
                echo "</td><td align=\"right\" nowrap><font class=\"content\">&nbsp;$timestamp[0]&nbsp;</font></td><td align=\"center\"><font class=\"content\">&nbsp;<a href=\"".$admin_file.".php?op=DeleteStory&amp;qid=$qid\">"._DELETE."</a>&nbsp;</td></tr>\n";
                $dummy++;
            }
            if ($dummy < 1) {
                echo "<tr><td bgcolor=\"$bgcolor1\" align=\"center\"><font color=\"$textcolor1\"><b>"._NOSUBMISSIONS."</b></form></td></tr></table>\n";
            } else {
                echo "</table></form>\n";
            }
        }
    if ($radminsuper==1) {
        echo "<br /><center>"
            ."[ <a href=\"".$admin_file.".php?op=subdelete\"><font color=\"$textcolor1\">"._DELETE."</a> ]"
            ."</center><br />";
    }
    Max_CloseTable();
    incof();