<?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($add_view == 6) { $ingroups = implode("-",$add_groups); }
    if($add_view < 6) { $ingroups = ""; }
    $add_title     = stripslashes(FixQuotes($add_title));
    $add_content   = stripslashes(FixQuotes($add_content));
    $add_mdate     = stripslashes(FixQuotes($add_mdate));
    $add_expire    = stripslashes(FixQuotes($add_expire));
    $add_active    = $GLOBALS['db']->XMFbin($add_active);
    $add_view      = $GLOBALS['db']->XMFnum($add_view);
    $ingroups      = stripslashes(FixQuotes($ingroups));
    $add_mlanguage = $GLOBALS['db']->XMFlang($add_mlanguage);
    $sql     = "INSERT INTO `".TABLE_MESSAGE."` VALUES (NULL, '$add_title', '$add_content', '$add_mdate', '$add_expire', '$add_active', '$add_view', '$ingroups', '$add_mlanguage')";
    if ( !($result = $GLOBALS['db']->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not insert admin message', '', __LINE__, __FILE__, $sql);}
   $GLOBALS['db']->sql_query("OPTIMIZE TABLE `".TABLE_MESSAGE."`");

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