<?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')) {
	die ("Access Denied");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {

		incoh();
		if ( $wysiwyg == 'fck' ) {
   		 include_once('FCKeditor/fckeditor.php');
   		 }
		MenuMessage();
		if ($admlanguage == "") {
			$admlanguage = $language; /* This to make sure some language is pre-selected */
		}
		Max_OpenTable();
		echo "<center><font class='title'><b>" . _ALLMESSAGES . "</b></font><br /><br /><table border=\"1\" width=\"100%\" bgcolor=\"$bgcolor1\">"
		."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _ID . "</b></td>"
		."<td bgcolor=\"$bgcolor2\" align=\"center\"><b>" . _TITLE . "</b></td>"
		."<td bgcolor=\"$bgcolor2\" align=\"center\">&nbsp;<b>" . _LANGUAGE . "</b>&nbsp;</td>"
		."<td bgcolor=\"$bgcolor2\" align=\"center\" nowrap>&nbsp;<b>" . _VIEW . "</b>&nbsp;</td>"
		."<td bgcolor=\"$bgcolor2\" align=\"center\">&nbsp;<b>" . _STATUS . "</b>&nbsp;</td>"
		."<td bgcolor=\"$bgcolor2\" align=\"center\">&nbsp;<b>" . _FUNCTIONS . "</b>&nbsp;</td></tr>";
		    $result = $db->sql_query("SELECT * FROM `".TABLE_MESSAGE."`");
                    while ($row = $db->sql_fetchrow($result)) {
            		$groups    = stripslashes($row['groups']);
           		$mid       = $db->XMFnum($row['mid']);
			$title     = stripslashes($row['title']);
			$content   = stripslashes($row['content']);
			$mdate     = stripslashes($row['date']);
			$expire    = $db->XMFnum($row['expire']);
			$active    = $db->XMFbin($row['active']);
			$view      = $db->XMFnum($row['view']);
			$mlanguage = $db->XMFlang($row['mlanguage']);
			if ($active == 1) {
				$mactive = "<a href='".$admin_file.".php?op=msgactive&mid=$mid&active=0'><img src=\"images/active.gif\" alt=\""._ACTIVE."\" title=\""._ACTIVE."\" border=\"0\" width=\"16\" height=\"16\"></a>";
			} elseif ($active == 0) {
				$mactive = "<a href='".$admin_file.".php?op=msgactive&mid=$mid&active=1'><img src=\"images/inactive.gif\" alt=\""._INACTIVE."\" title=\""._INACTIVE."\" border=\"0\" width=\"16\" height=\"16\"></a>";
			}
			if ($view == 1) {
				$mview = "" . _MVALL . "";
			} elseif ($view == 2) {
				$mview = "" . _MVANON . "";
			} elseif ($view == 3) {
				$mview = "" . _MVUSERS . "";
			} elseif ($view == 4) {
				$mview = "" . _MVADMIN . "";
			} elseif ($view == 5) {
				$mview = ""._SUBUSERS."";
			} elseif ($view > 5) {
            $mview = _MVGROUPS;
            }
			if ($mlanguage == "") {
				$mlanguage = "" . _ALL . "";
			}
			echo "<tr><td align=\"right\"><b>$mid</b>"
			."</td><td align=\"left\" width=\"100%\"><b>$title</b>"
			."</td><td align=\"center\">$mlanguage"
			."</td><td align=\"center\" nowrap>$mview"
			."</td><td align=\"center\">$mactive"
			."</td><td align=\"center\">&nbsp;<a href=\"".$admin_file.".php?op=editmsg&mid=$mid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\"></a>  <a href=\"".$admin_file.".php?op=deletemsg&mid=$mid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a>&nbsp;"
			."</td></tr>";

		}
		echo "</table></center><br />";
		Max_CloseTable();
		incof();
}
}else {
	echo "Access Denied";
}