<?php

$sitetitle="Добавить новость";
include "../admin/adminses.php";
include "../engine/functions.php";
require_once("../admin/fckeditor/fckeditor.php");
$sBasePath = $_SERVER['PHP_SELF'] ;

$template=adminmyconfig("template");
$url=$_SERVER['PHP_SELF'];			 

include("../mycode/newsconf.php");
require_once("../mycode/funcnews.php");
$date=date("d.m.Y");
$time=date("H:i:s");	
$rez="a+";
if (isset($_REQUEST['newsdoing'])) {
$new=trim($_REQUEST['message']);
$new=preg_replace('/\r/', '', $new);
$new=preg_replace('/\n/', ' ', $new);
$new=preg_replace('/\r\n/', ' ', $new);
$extranew=trim($_REQUEST['extramessage']);
$extranew=preg_replace('/\r/', '', $extranew);
$extranew=preg_replace('/\n/', ' ', $extranew);
$extranew=preg_replace('/\r\n/', ' ', $extranew);
	if (trim($_REQUEST['header'])==""||$new=="")
	{
	@$contentcenter="<font size=\"2\" color=\"$warnalertcolor\"><b>Вы не заполнили одно из обязательных полей!<br>Поля, отмеченные звездочкой (*), должны быть заполнены!</b></font>";
	}
	else {
	$data=array("head"=>trim($_REQUEST['header']),"mess"=>$new, "aname"=>$adminname, "admmail"=>$admmail, "pubdate"=>$date, "pubtime"=>$time, "extra"=>$extranew);
	savedata("../$newsdbfilename", $data, "$rez");
	@$contentcenter="<font size=\"2\" color=\"$warnalertcolor\"><b>Новость успешно добавлена!</b></font><br>";
	}
}


@$contentcenter .=<<<EOT
	<script type="text/javascript" src="../admin/fckeditor/fckeditor.js"></script>
	<form action="$url" method="post" target="_blank">
<h3>Добавление новости:</h3>Заполните все поля формы!<br /><br />
<input type="text" name="header" size="70" maxlength="255" value="Заголовок новости"><br/><br/>
		<script type="text/javascript">
<!--
var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('')) ;

var oFCKeditor = new FCKeditor( 'message' ) ;
oFCKeditor.BasePath	= '../admin/fckeditor/' ;
oFCKeditor.Height	= 300 ;
oFCKeditor.Value	= 'Краткий текст новости' ;
oFCKeditor.Create() ;
//-->
		</script>
		<br /><br />
		<script type="text/javascript">
<!--
var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('')) ;

var oFCKeditor = new FCKeditor( 'extramessage' ) ;
oFCKeditor.BasePath	= '../admin/fckeditor/' ;
oFCKeditor.Height	= 300 ;
oFCKeditor.Value	= 'Продолжение текста новости' ;
oFCKeditor.Create() ;
//-->
		</script>
		<br />
		<input type="submit" name="newsdoing" value="Добавить новость" />
	</form>
EOT;


include "../admin/admintemplate.php";

?>
