<?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)  {

   if($view == 6) { $ingroups = implode("-",$groups); }
    if($view < 6) { $ingroups = ""; }

		$mid       = $GLOBALS['db']->XMFnum($mid);
		$title     = stripslashes(FixQuotes($title));
		$content   = stripslashes(FixQuotes($content));
		$newdate   = stripslashes(FixQuotes($newdate));
		$expire    = stripslashes(FixQuotes($expire));
		$active    = $GLOBALS['db']->XMFbin($active);
		$view      = $GLOBALS['db']->XMFnum($view);
		$ingroups  = stripslashes(FixQuotes($ingroups));
		$mlanguage = $GLOBALS['db']->XMFlang($mlanguage);
		if ($chng_date == 1) {
			$newdate = time();
		} elseif ($chng_date == 0) {
			$newdate = $mdate;
		}
		$GLOBALS['db']->sql_query("UPDATE `".TABLE_MESSAGE."` SET `title`='$title', `content`='$content', `date`='$newdate', `expire`='$expire', `active`='$active', `view`='$view', `groups`='$ingroups', `mlanguage`='$mlanguage' WHERE `mid`='$mid'");
		$GLOBALS['db']->sql_query("OPTIMIZE TABLE `".TABLE_MESSAGE."`");

        redirect_url("".$admin_file.".php?op=viewmessages");
}
} else {
	echo "Access Denied";
}